From 2abdf220199108a85fad03ac0ffe53ad7ea7f885 Mon Sep 17 00:00:00 2001 From: Abhinavan2004 Date: Wed, 18 Jun 2025 16:59:11 +0530 Subject: [PATCH] (Solved one issue)Added .gitignore to ignore node_modules and IDE files --- .c9/.nakignore | 17 - .c9/metadata/tab16 | 1 - .c9/metadata/tab18 | 1 - .c9/metadata/workspace/APIs/first_request.js | 1 - .../workspace/APIs/movie_search_app/app.js | 1 - .../APIs/movie_search_app/views/results.ejs | 1 - .../APIs/movie_search_app/views/search.ejs | 1 - .c9/metadata/workspace/Associations/embed.js | 1 - .../workspace/Associations/models/post.js | 1 - .../workspace/Associations/models/user.js | 1 - .c9/metadata/workspace/Associations/readme.md | 1 - .../workspace/Associations/references.js | 1 - .../workspace/Authentication/AuthDemo/app.js | 1 - .../Authentication/AuthDemo/models/user.js | 1 - .../Authentication/AuthDemo/package.json | 1 - .../Authentication/AuthDemo/views/home.ejs | 1 - .../Authentication/AuthDemo/views/login.ejs | 1 - .../AuthDemo/views/register.ejs | 1 - .../Authentication/AuthDemo/views/secret.ejs | 1 - .../workspace/Authentication/readme.md | 1 - .c9/metadata/workspace/Databases/cats.js | 1 - .c9/metadata/workspace/Databases/readme.md | 1 - .c9/metadata/workspace/DeployingDemo/app.js | 1 - .../workspace/DeployingDemo/package.json | 1 - .../workspace/DeployingDemo/views/about.ejs | 1 - .../workspace/DeployingDemo/views/home.ejs | 1 - .c9/metadata/workspace/Git/demo/main.js | 1 - .c9/metadata/workspace/Git/demo/meh.js | 1 - .c9/metadata/workspace/Git/git_intro/app.js | 1 - .c9/metadata/workspace/Git/git_intro/cats.js | 1 - .c9/metadata/workspace/Git/git_intro/dogs.js | 1 - .../workspace/IntroToCommandLine/hello.html | 1 - .../workspace/IntroToCommandLine/message.txt | 1 - .../workspace/IntroToComnandLine/message.txt | 1 - .../IntroToExpress/Assignment/solution/app.js | 1 - .../Assignment/solution/package.json | 1 - .../IntroToExpress/FirstExpressApp/app.js | 1 - .../node_modules/express/lib/router/index.js | 1 - .../node_modules/express/lib/router/layer.js | 1 - .../node_modules/express/package.json | 1 - .../workspace/IntroToExpress/objectives.md | 1 - .../workspace/IntroToNPM/DemoApp/app.js | 1 - .../DemoApp/node_modules/cat-me/cats.js | 1 - .../DemoApp/node_modules/cat-me/index.js | 1 - .../DemoApp/node_modules/cat-me/package.json | 1 - .../node_modules/knock-knock-jokes/index.js | 1 - .../workspace/IntroToNPM/FakerApp/app.js | 1 - .../IntroToNPM/MyShop/listProducts.js | 1 - .c9/metadata/workspace/IntroToNPM/exercise.md | 1 - .../workspace/IntroToNPM/objectives.md | 1 - .c9/metadata/workspace/IntroToNode/echo.js | 1 - .../workspace/IntroToNode/exercise.js | 1 - .../workspace/IntroToNode/exercise2.js | 1 - .c9/metadata/workspace/IntroToNode/grader.js | 1 - .c9/metadata/workspace/IntroToNode/hello.js | 1 - .c9/metadata/workspace/IntroToNode/hello.rb | 1 - .../workspace/MoreExpress/EJSDemo/app.js | 1 - .../MoreExpress/EJSDemo/package.json | 1 - .../MoreExpress/EJSDemo/public/app.css | 1 - .../MoreExpress/EJSDemo/views/home.ejs | 1 - .../MoreExpress/EJSDemo/views/love.ejs | 1 - .../EJSDemo/views/partials/footer.ejs | 1 - .../EJSDemo/views/partials/header.ejs | 1 - .../MoreExpress/EJSDemo/views/posts.ejs | 1 - .../MoreExpress/PostRequestDemo/app.js | 1 - .../PostRequestDemo/views/friends.ejs | 1 - .../PostRequestDemo/views/home.ejs | 1 - .c9/metadata/workspace/MoreExpress/readme.md | 1 - .../RESTful Routing/BlogSolution/app.js | 1 - .../BlogSolution/public/app.css | 1 - .../BlogSolution/views/index.ejs | 1 - .../BlogSolution/views/new.ejs | 1 - .../BlogSolution/views/partials/header.ejs | 1 - .../BlogSolution/views/show.ejs | 1 - .../RESTful Routing/RESTfulBlogApp/app.js | 1 - .../RESTfulBlogApp/public/stylesheets/app.css | 1 - .../RESTfulBlogApp/views/edit.ejs | 1 - .../RESTfulBlogApp/views/index.ejs | 1 - .../RESTfulBlogApp/views/new.ejs | 1 - .../RESTfulBlogApp/views/partials/footer.ejs | 1 - .../RESTfulBlogApp/views/partials/header.ejs | 1 - .../RESTfulBlogApp/views/show.ejs | 1 - .../RESTful Routing/SemanticBlog/app.js | 1 - .../SemanticBlog/public/app.css | 1 - .../SemanticBlog/views/edit.ejs | 1 - .../SemanticBlog/views/index.ejs | 1 - .../SemanticBlog/views/new.ejs | 1 - .../SemanticBlog/views/partials/footer.ejs | 1 - .../SemanticBlog/views/partials/header.ejs | 1 - .../SemanticBlog/views/show.ejs | 1 - .../workspace/RESTful Routing/chart.html | 1 - .../workspace/RESTful Routing/readme.md | 1 - .c9/metadata/workspace/YelpCamp/Final/app.js | 1 - .../YelpCamp/Final/middleware/index.js | 1 - .../YelpCamp/Final/models/comment.js | 1 - .../workspace/YelpCamp/Final/models/user.js | 1 - .../Final/public/scripts/background.js | 1 - .../Final/public/stylesheets/landing.css | 1 - .../Final/public/stylesheets/main.css | 1 - .../workspace/YelpCamp/Final/readme.md | 1 - .../YelpCamp/Final/routes/campgrounds.js | 1 - .../workspace/YelpCamp/Final/routes/index.js | 1 - .../YelpCamp/Final/views/campgrounds/edit.ejs | 1 - .../Final/views/campgrounds/index.ejs | 1 - .../YelpCamp/Final/views/campgrounds/new.ejs | 1 - .../YelpCamp/Final/views/campgrounds/show.ejs | 1 - .../YelpCamp/Final/views/comments/edit.ejs | 1 - .../YelpCamp/Final/views/comments/new.ejs | 1 - .../YelpCamp/Final/views/landing.ejs | 1 - .../workspace/YelpCamp/Final/views/login.ejs | 1 - .../YelpCamp/Final/views/partials/footer.ejs | 1 - .../YelpCamp/Final/views/partials/header.ejs | 1 - .../YelpCamp/Final/views/register.ejs | 1 - .c9/metadata/workspace/YelpCamp/v1/app.js | 1 - .../workspace/YelpCamp/v1/package.json | 1 - .c9/metadata/workspace/YelpCamp/v1/readme.md | 1 - .../YelpCamp/v1/views/campgrounds.ejs | 1 - .../workspace/YelpCamp/v1/views/landing.ejs | 1 - .../workspace/YelpCamp/v1/views/new.ejs | 1 - .../YelpCamp/v1/views/partials/footer.ejs | 1 - .../YelpCamp/v1/views/partials/header.ejs | 1 - .c9/metadata/workspace/YelpCamp/v10/app.js | 1 - .../YelpCamp/v10/middleware/index.js | 1 - .../YelpCamp/v10/models/campground.js | 1 - .../workspace/YelpCamp/v10/models/comment.js | 1 - .../workspace/YelpCamp/v10/models/user.js | 1 - .../v10/node_modules/express/index.js | 1 - .../YelpCamp/v10/public/stylesheets/main.css | 1 - .c9/metadata/workspace/YelpCamp/v10/readme.md | 1 - .../YelpCamp/v10/routes/campgrounds.js | 1 - .../workspace/YelpCamp/v10/routes/comments.js | 1 - .../YelpCamp/v10/views/campgrounds/edit.ejs | 1 - .../YelpCamp/v10/views/campgrounds/new.ejs | 1 - .../YelpCamp/v10/views/campgrounds/show.ejs | 1 - .../YelpCamp/v10/views/comments/edit.ejs | 1 - .../YelpCamp/v10/views/comments/new.ejs | 1 - .c9/metadata/workspace/YelpCamp/v11/app.js | 1 - .../YelpCamp/v11/middleware/index.js | 1 - .c9/metadata/workspace/YelpCamp/v11/readme.md | 1 - .../YelpCamp/v11/routes/campgrounds.js | 1 - .../workspace/YelpCamp/v11/routes/comments.js | 1 - .../workspace/YelpCamp/v11/routes/index.js | 1 - .../workspace/YelpCamp/v11/views/login.ejs | 1 - .../YelpCamp/v11/views/partials/header.ejs | 1 - .../workspace/YelpCamp/v11Deployed/app.js | 1 - .../YelpCamp/v11Deployed/package.json | 1 - .c9/metadata/workspace/YelpCamp/v2/app.js | 1 - .../workspace/YelpCamp/v2/package.json | 1 - .c9/metadata/workspace/YelpCamp/v2/readme.md | 1 - .../YelpCamp/v2/views/campgrounds.ejs | 1 - .../workspace/YelpCamp/v2/views/index.ejs | 1 - .../workspace/YelpCamp/v2/views/new.ejs | 1 - .../workspace/YelpCamp/v2/views/show.ejs | 1 - .c9/metadata/workspace/YelpCamp/v3/app.js | 1 - .../YelpCamp/v3/models/campground.js | 1 - .../workspace/YelpCamp/v3/models/comment.js | 1 - .c9/metadata/workspace/YelpCamp/v3/readme.md | 1 - .c9/metadata/workspace/YelpCamp/v3/seeds.js | 1 - .../workspace/YelpCamp/v3/views/show.ejs | 1 - .c9/metadata/workspace/YelpCamp/v4/app.js | 1 - .c9/metadata/workspace/YelpCamp/v4/readme.md | 1 - .c9/metadata/workspace/YelpCamp/v4/seeds.js | 1 - .../YelpCamp/v4/views/campgrounds/index.ejs | 1 - .../YelpCamp/v4/views/campgrounds/new.ejs | 1 - .../YelpCamp/v4/views/campgrounds/show.ejs | 1 - .../YelpCamp/v4/views/comments/new.ejs | 1 - .c9/metadata/workspace/YelpCamp/v5/app.js | 1 - .../YelpCamp/v5/public/stylesheets/main.css | 1 - .c9/metadata/workspace/YelpCamp/v5/readme.md | 1 - .c9/metadata/workspace/YelpCamp/v5/seeds.js | 1 - .../YelpCamp/v5/views/campgrounds/show.ejs | 1 - .../YelpCamp/v5/views/partials/header.ejs | 1 - .c9/metadata/workspace/YelpCamp/v6/app.js | 1 - .../workspace/YelpCamp/v6/models/user.js | 1 - .../workspace/YelpCamp/v6/package.json | 1 - .c9/metadata/workspace/YelpCamp/v6/readme.md | 1 - .c9/metadata/workspace/YelpCamp/v6/seeds.js | 1 - .../YelpCamp/v6/views/campgrounds/index.ejs | 1 - .../workspace/YelpCamp/v6/views/login.ejs | 1 - .../YelpCamp/v6/views/partials/header.ejs | 1 - .../workspace/YelpCamp/v6/views/register.ejs | 1 - .c9/metadata/workspace/YelpCamp/v7/app.js | 1 - .c9/metadata/workspace/YelpCamp/v7/readme.md | 1 - .../YelpCamp/v7/routes/campgrounds.js | 1 - .../workspace/YelpCamp/v7/routes/comments.js | 1 - .../workspace/YelpCamp/v7/routes/index.js | 1 - .c9/metadata/workspace/YelpCamp/v8/app.js | 1 - .../YelpCamp/v8/models/campground.js | 1 - .../workspace/YelpCamp/v8/models/comment.js | 1 - .c9/metadata/workspace/YelpCamp/v8/readme.md | 1 - .../workspace/YelpCamp/v8/routes/comments.js | 1 - .c9/metadata/workspace/YelpCamp/v8/seeds.js | 1 - .../YelpCamp/v8/views/campgrounds/show.ejs | 1 - .../YelpCamp/v8/views/comments/new.ejs | 1 - .../workspace/YelpCamp/v8/views/landing.ejs | 1 - .c9/metadata/workspace/YelpCamp/v9/app.js | 1 - .../YelpCamp/v9/models/campground.js | 1 - .c9/metadata/workspace/YelpCamp/v9/readme.md | 1 - .../YelpCamp/v9/routes/campgrounds.js | 1 - .../workspace/YelpCamp/v9/routes/comments.js | 1 - .../workspace/YelpCamp/v9/routes/index.js | 1 - .../YelpCamp/v9/views/campgrounds/index.ejs | 1 - .../YelpCamp/v9/views/campgrounds/show.ejs | 1 - .../workspace/YelpCamp/v9/views/landing.ejs | 1 - .c9/project.settings | 61 - .gitignore | 35 + APIs/node_modules/request/.eslintrc | 45 - APIs/node_modules/request/.npmignore | 6 - APIs/node_modules/request/.travis.yml | 19 - APIs/node_modules/request/CHANGELOG.md | 623 - APIs/node_modules/request/CONTRIBUTING.md | 81 - APIs/node_modules/request/LICENSE | 55 - APIs/node_modules/request/README.md | 1098 -- APIs/node_modules/request/index.js | 157 - APIs/node_modules/request/lib/auth.js | 168 - APIs/node_modules/request/lib/cookies.js | 39 - .../request/lib/getProxyFromURI.js | 79 - APIs/node_modules/request/lib/har.js | 215 - APIs/node_modules/request/lib/helpers.js | 74 - APIs/node_modules/request/lib/multipart.js | 112 - APIs/node_modules/request/lib/oauth.js | 147 - APIs/node_modules/request/lib/querystring.js | 51 - APIs/node_modules/request/lib/redirect.js | 153 - APIs/node_modules/request/lib/tunnel.js | 176 - .../request/node_modules/.bin/har-validator | 1 - .../request/node_modules/.bin/uuid | 1 - .../request/node_modules/aws-sign2/LICENSE | 55 - .../request/node_modules/aws-sign2/README.md | 4 - .../request/node_modules/aws-sign2/index.js | 212 - .../node_modules/aws-sign2/package.json | 49 - .../request/node_modules/aws4/.npmignore | 4 - .../request/node_modules/aws4/.tern-port | 1 - .../request/node_modules/aws4/.travis.yml | 5 - .../request/node_modules/aws4/LICENSE | 19 - .../request/node_modules/aws4/README.md | 514 - .../request/node_modules/aws4/aws4.js | 318 - .../request/node_modules/aws4/lru.js | 96 - .../request/node_modules/aws4/package.json | 105 - .../request/node_modules/bl/.jshintrc | 59 - .../request/node_modules/bl/.npmignore | 1 - .../request/node_modules/bl/.travis.yml | 13 - .../request/node_modules/bl/LICENSE.md | 13 - .../request/node_modules/bl/README.md | 200 - .../request/node_modules/bl/bl.js | 243 - .../node_modules/readable-stream/.npmignore | 5 - .../node_modules/readable-stream/.travis.yml | 52 - .../bl/node_modules/readable-stream/.zuul.yml | 1 - .../bl/node_modules/readable-stream/LICENSE | 18 - .../bl/node_modules/readable-stream/README.md | 36 - .../readable-stream/doc/stream.markdown | 1760 --- .../doc/wg-meetings/2015-01-30.md | 60 - .../bl/node_modules/readable-stream/duplex.js | 1 - .../readable-stream/lib/_stream_duplex.js | 75 - .../lib/_stream_passthrough.js | 26 - .../readable-stream/lib/_stream_readable.js | 880 -- .../readable-stream/lib/_stream_transform.js | 180 - .../readable-stream/lib/_stream_writable.js | 516 - .../node_modules/core-util-is/LICENSE | 19 - .../node_modules/core-util-is/README.md | 3 - .../node_modules/core-util-is/float.patch | 604 - .../node_modules/core-util-is/lib/util.js | 107 - .../node_modules/core-util-is/package.json | 59 - .../node_modules/core-util-is/test.js | 68 - .../node_modules/inherits/LICENSE | 16 - .../node_modules/inherits/README.md | 42 - .../node_modules/inherits/inherits.js | 1 - .../node_modules/inherits/inherits_browser.js | 23 - .../node_modules/inherits/package.json | 50 - .../node_modules/inherits/test.js | 25 - .../node_modules/isarray/.npmignore | 1 - .../node_modules/isarray/.travis.yml | 4 - .../node_modules/isarray/Makefile | 6 - .../node_modules/isarray/README.md | 60 - .../node_modules/isarray/component.json | 19 - .../node_modules/isarray/index.js | 5 - .../node_modules/isarray/package.json | 70 - .../node_modules/isarray/test.js | 20 - .../process-nextick-args/.travis.yml | 12 - .../process-nextick-args/index.js | 43 - .../process-nextick-args/license.md | 19 - .../process-nextick-args/package.json | 48 - .../process-nextick-args/readme.md | 18 - .../node_modules/process-nextick-args/test.js | 24 - .../node_modules/string_decoder/.npmignore | 2 - .../node_modules/string_decoder/LICENSE | 20 - .../node_modules/string_decoder/README.md | 7 - .../node_modules/string_decoder/index.js | 221 - .../node_modules/string_decoder/package.json | 54 - .../node_modules/util-deprecate/History.md | 16 - .../node_modules/util-deprecate/LICENSE | 24 - .../node_modules/util-deprecate/README.md | 53 - .../node_modules/util-deprecate/browser.js | 67 - .../node_modules/util-deprecate/node.js | 6 - .../node_modules/util-deprecate/package.json | 54 - .../node_modules/readable-stream/package.json | 79 - .../readable-stream/passthrough.js | 1 - .../node_modules/readable-stream/readable.js | 12 - .../node_modules/readable-stream/transform.js | 1 - .../node_modules/readable-stream/writable.js | 1 - .../request/node_modules/bl/package.json | 63 - .../request/node_modules/bl/test/test.js | 640 - .../request/node_modules/caseless/LICENSE | 28 - .../request/node_modules/caseless/README.md | 45 - .../request/node_modules/caseless/index.js | 66 - .../node_modules/caseless/package.json | 62 - .../request/node_modules/caseless/test.js | 40 - .../node_modules/combined-stream/License | 19 - .../node_modules/combined-stream/Readme.md | 138 - .../combined-stream/lib/combined_stream.js | 188 - .../node_modules/delayed-stream/.npmignore | 1 - .../node_modules/delayed-stream/License | 19 - .../node_modules/delayed-stream/Makefile | 7 - .../node_modules/delayed-stream/Readme.md | 141 - .../delayed-stream/lib/delayed_stream.js | 107 - .../node_modules/delayed-stream/package.json | 64 - .../node_modules/combined-stream/package.json | 67 - .../request/node_modules/extend/.eslintrc | 192 - .../request/node_modules/extend/.jscs.json | 104 - .../request/node_modules/extend/.npmignore | 1 - .../request/node_modules/extend/.travis.yml | 44 - .../request/node_modules/extend/CHANGELOG.md | 69 - .../request/node_modules/extend/LICENSE | 23 - .../request/node_modules/extend/README.md | 62 - .../node_modules/extend/component.json | 32 - .../request/node_modules/extend/index.js | 86 - .../request/node_modules/extend/package.json | 73 - .../node_modules/forever-agent/LICENSE | 55 - .../node_modules/forever-agent/README.md | 4 - .../node_modules/forever-agent/index.js | 138 - .../node_modules/forever-agent/package.json | 56 - .../node_modules/form-data/.dockerignore | 7 - .../node_modules/form-data/.editorconfig | 10 - .../node_modules/form-data/.eslintignore | 1 - .../request/node_modules/form-data/.eslintrc | 64 - .../request/node_modules/form-data/License | 19 - .../request/node_modules/form-data/README.md | 218 - .../node_modules/form-data/lib/browser.js | 2 - .../node_modules/form-data/lib/form_data.js | 411 - .../node_modules/form-data/lib/populate.js | 9 - .../form-data/node_modules/async/CHANGELOG.md | 125 - .../form-data/node_modules/async/LICENSE | 19 - .../form-data/node_modules/async/README.md | 1877 --- .../node_modules/async/dist/async.js | 1265 -- .../node_modules/async/dist/async.min.js | 2 - .../form-data/node_modules/async/lib/async.js | 1265 -- .../form-data/node_modules/async/package.json | 122 - .../node_modules/form-data/package.json | 103 - .../node_modules/form-data/wercker.yml | 36 - .../node_modules/har-validator/LICENSE | 13 - .../node_modules/har-validator/README.md | 309 - .../har-validator/bin/har-validator | 56 - .../node_modules/har-validator/lib/async.js | 14 - .../node_modules/har-validator/lib/error.js | 10 - .../node_modules/har-validator/lib/index.js | 22 - .../node_modules/har-validator/lib/runner.js | 29 - .../har-validator/lib/schemas/cache.json | 13 - .../har-validator/lib/schemas/cacheEntry.json | 31 - .../har-validator/lib/schemas/content.json | 27 - .../har-validator/lib/schemas/cookie.json | 34 - .../har-validator/lib/schemas/creator.json | 18 - .../har-validator/lib/schemas/entry.json | 51 - .../har-validator/lib/schemas/har.json | 11 - .../har-validator/lib/schemas/index.js | 49 - .../har-validator/lib/schemas/log.json | 34 - .../har-validator/lib/schemas/page.json | 30 - .../lib/schemas/pageTimings.json | 16 - .../har-validator/lib/schemas/postData.json | 41 - .../har-validator/lib/schemas/record.json | 18 - .../har-validator/lib/schemas/request.json | 55 - .../har-validator/lib/schemas/response.json | 52 - .../har-validator/lib/schemas/timings.json | 40 - .../har-validator/node_modules/chalk/index.js | 116 - .../har-validator/node_modules/chalk/license | 21 - .../chalk/node_modules/ansi-styles/index.js | 65 - .../chalk/node_modules/ansi-styles/license | 21 - .../node_modules/ansi-styles/package.json | 79 - .../chalk/node_modules/ansi-styles/readme.md | 86 - .../escape-string-regexp/index.js | 11 - .../node_modules/escape-string-regexp/license | 21 - .../escape-string-regexp/package.json | 74 - .../escape-string-regexp/readme.md | 27 - .../chalk/node_modules/has-ansi/index.js | 4 - .../chalk/node_modules/has-ansi/license | 21 - .../has-ansi/node_modules/ansi-regex/index.js | 4 - .../has-ansi/node_modules/ansi-regex/license | 21 - .../node_modules/ansi-regex/package.json | 86 - .../node_modules/ansi-regex/readme.md | 31 - .../chalk/node_modules/has-ansi/package.json | 85 - .../chalk/node_modules/has-ansi/readme.md | 36 - .../chalk/node_modules/strip-ansi/index.js | 6 - .../chalk/node_modules/strip-ansi/license | 21 - .../node_modules/ansi-regex/index.js | 4 - .../node_modules/ansi-regex/license | 21 - .../node_modules/ansi-regex/package.json | 86 - .../node_modules/ansi-regex/readme.md | 31 - .../node_modules/strip-ansi/package.json | 89 - .../chalk/node_modules/strip-ansi/readme.md | 33 - .../node_modules/supports-color/index.js | 50 - .../chalk/node_modules/supports-color/license | 21 - .../node_modules/supports-color/package.json | 79 - .../node_modules/supports-color/readme.md | 36 - .../node_modules/chalk/package.json | 106 - .../node_modules/chalk/readme.md | 213 - .../node_modules/commander/History.md | 261 - .../node_modules/commander/LICENSE | 22 - .../node_modules/commander/Readme.md | 351 - .../node_modules/commander/index.js | 1110 -- .../node_modules/graceful-readlink/.npmignore | 3 - .../graceful-readlink/.travis.yml | 5 - .../node_modules/graceful-readlink/LICENSE | 22 - .../node_modules/graceful-readlink/README.md | 17 - .../node_modules/graceful-readlink/index.js | 12 - .../graceful-readlink/package.json | 48 - .../node_modules/commander/package.json | 71 - .../node_modules/is-my-json-valid/.npmignore | 2 - .../node_modules/is-my-json-valid/.travis.yml | 3 - .../node_modules/is-my-json-valid/LICENSE | 21 - .../node_modules/is-my-json-valid/README.md | 173 - .../node_modules/is-my-json-valid/example.js | 18 - .../node_modules/is-my-json-valid/formats.js | 14 - .../node_modules/is-my-json-valid/index.js | 584 - .../node_modules/generate-function/.npmignore | 1 - .../generate-function/.travis.yml | 3 - .../node_modules/generate-function/README.md | 72 - .../node_modules/generate-function/example.js | 27 - .../node_modules/generate-function/index.js | 61 - .../generate-function/package.json | 53 - .../node_modules/generate-function/test.js | 33 - .../generate-object-property/.npmignore | 1 - .../generate-object-property/.travis.yml | 3 - .../generate-object-property/LICENSE | 21 - .../generate-object-property/README.md | 19 - .../generate-object-property/index.js | 12 - .../node_modules/is-property/.npmignore | 17 - .../node_modules/is-property/LICENSE | 22 - .../node_modules/is-property/README.md | 28 - .../node_modules/is-property/is-property.js | 5 - .../node_modules/is-property/package.json | 59 - .../generate-object-property/package.json | 51 - .../generate-object-property/test.js | 12 - .../node_modules/jsonpointer/.travis.yml | 10 - .../node_modules/jsonpointer/README.md | 32 - .../node_modules/jsonpointer/jsonpointer.js | 76 - .../node_modules/jsonpointer/package.json | 63 - .../node_modules/jsonpointer/test.js | 98 - .../node_modules/xtend/.jshintrc | 30 - .../node_modules/xtend/.npmignore | 1 - .../node_modules/xtend/LICENCE | 19 - .../node_modules/xtend/Makefile | 4 - .../node_modules/xtend/README.md | 32 - .../node_modules/xtend/immutable.js | 19 - .../node_modules/xtend/mutable.js | 17 - .../node_modules/xtend/package.json | 84 - .../node_modules/xtend/test.js | 83 - .../is-my-json-valid/package.json | 74 - .../node_modules/is-my-json-valid/require.js | 12 - .../is-my-json-valid/test/fixtures/cosmic.js | 84 - .../json-schema-draft4/additionalItems.json | 82 - .../additionalProperties.json | 88 - .../test/json-schema-draft4/allOf.json | 112 - .../test/json-schema-draft4/anyOf.json | 68 - .../test/json-schema-draft4/bignum.json | 107 - .../test/json-schema-draft4/default.json | 49 - .../test/json-schema-draft4/definitions.json | 32 - .../test/json-schema-draft4/dependencies.json | 113 - .../test/json-schema-draft4/enum.json | 72 - .../test/json-schema-draft4/format.json | 143 - .../test/json-schema-draft4/items.json | 46 - .../test/json-schema-draft4/maxItems.json | 28 - .../test/json-schema-draft4/maxLength.json | 28 - .../json-schema-draft4/maxProperties.json | 28 - .../test/json-schema-draft4/maximum.json | 42 - .../test/json-schema-draft4/minItems.json | 28 - .../test/json-schema-draft4/minLength.json | 28 - .../json-schema-draft4/minProperties.json | 28 - .../test/json-schema-draft4/minimum.json | 42 - .../test/json-schema-draft4/multipleOf.json | 96 - .../test/json-schema-draft4/not.json | 96 - .../json-schema-draft4/nullAndFormat.json | 18 - .../json-schema-draft4/nullAndObject.json | 18 - .../test/json-schema-draft4/oneOf.json | 68 - .../test/json-schema-draft4/pattern.json | 23 - .../json-schema-draft4/patternProperties.json | 110 - .../test/json-schema-draft4/properties.json | 92 - .../test/json-schema-draft4/ref.json | 128 - .../test/json-schema-draft4/refRemote.json | 74 - .../test/json-schema-draft4/required.json | 39 - .../test/json-schema-draft4/type.json | 330 - .../test/json-schema-draft4/uniqueItems.json | 79 - .../is-my-json-valid/test/json-schema.js | 23 - .../is-my-json-valid/test/misc.js | 447 - .../node_modules/pinkie-promise/index.js | 3 - .../node_modules/pinkie-promise/license | 21 - .../node_modules/pinkie/index.js | 292 - .../node_modules/pinkie/license | 21 - .../node_modules/pinkie/package.json | 65 - .../node_modules/pinkie/readme.md | 83 - .../node_modules/pinkie-promise/package.json | 68 - .../node_modules/pinkie-promise/readme.md | 28 - .../node_modules/har-validator/package.json | 86 - .../request/node_modules/hawk/.npmignore | 20 - .../request/node_modules/hawk/.travis.yml | 5 - .../request/node_modules/hawk/LICENSE | 28 - .../request/node_modules/hawk/README.md | 634 - .../request/node_modules/hawk/bower.json | 24 - .../request/node_modules/hawk/component.json | 19 - .../request/node_modules/hawk/dist/client.js | 343 - .../node_modules/hawk/example/usage.js | 78 - .../request/node_modules/hawk/images/hawk.png | Bin 6945 -> 0 bytes .../request/node_modules/hawk/images/logo.png | Bin 71732 -> 0 bytes .../request/node_modules/hawk/lib/browser.js | 637 - .../request/node_modules/hawk/lib/client.js | 369 - .../request/node_modules/hawk/lib/crypto.js | 126 - .../request/node_modules/hawk/lib/index.js | 15 - .../request/node_modules/hawk/lib/server.js | 548 - .../request/node_modules/hawk/lib/utils.js | 184 - .../hawk/node_modules/boom/.npmignore | 18 - .../hawk/node_modules/boom/.travis.yml | 8 - .../hawk/node_modules/boom/CONTRIBUTING.md | 1 - .../hawk/node_modules/boom/LICENSE | 28 - .../hawk/node_modules/boom/README.md | 652 - .../hawk/node_modules/boom/images/boom.png | Bin 29479 -> 0 bytes .../hawk/node_modules/boom/lib/index.js | 318 - .../hawk/node_modules/boom/package.json | 64 - .../hawk/node_modules/boom/test/index.js | 654 - .../hawk/node_modules/cryptiles/.npmignore | 18 - .../hawk/node_modules/cryptiles/.travis.yml | 8 - .../hawk/node_modules/cryptiles/LICENSE | 28 - .../hawk/node_modules/cryptiles/README.md | 16 - .../hawk/node_modules/cryptiles/lib/index.js | 68 - .../hawk/node_modules/cryptiles/package.json | 61 - .../hawk/node_modules/cryptiles/test/index.js | 102 - .../hawk/node_modules/hoek/.npmignore | 18 - .../hawk/node_modules/hoek/.travis.yml | 7 - .../hawk/node_modules/hoek/CONTRIBUTING.md | 1 - .../hawk/node_modules/hoek/LICENSE | 31 - .../hawk/node_modules/hoek/README.md | 584 - .../hawk/node_modules/hoek/images/hoek.png | Bin 37939 -> 0 bytes .../hawk/node_modules/hoek/lib/escape.js | 132 - .../hawk/node_modules/hoek/lib/index.js | 993 -- .../hawk/node_modules/hoek/package.json | 61 - .../hawk/node_modules/hoek/test/escaper.js | 88 - .../hawk/node_modules/hoek/test/index.js | 2513 ---- .../node_modules/hoek/test/modules/ignore.txt | 0 .../node_modules/hoek/test/modules/test1.js | 1 - .../node_modules/hoek/test/modules/test2.js | 1 - .../node_modules/hoek/test/modules/test3.js | 1 - .../hawk/node_modules/sntp/.npmignore | 18 - .../hawk/node_modules/sntp/.travis.yml | 5 - .../hawk/node_modules/sntp/LICENSE | 28 - .../hawk/node_modules/sntp/Makefile | 9 - .../hawk/node_modules/sntp/README.md | 68 - .../hawk/node_modules/sntp/examples/offset.js | 16 - .../hawk/node_modules/sntp/examples/time.js | 25 - .../hawk/node_modules/sntp/index.js | 1 - .../hawk/node_modules/sntp/lib/index.js | 412 - .../hawk/node_modules/sntp/package.json | 65 - .../hawk/node_modules/sntp/test/index.js | 435 - .../request/node_modules/hawk/package.json | 67 - .../request/node_modules/hawk/test/browser.js | 1492 -- .../request/node_modules/hawk/test/client.js | 440 - .../request/node_modules/hawk/test/crypto.js | 70 - .../request/node_modules/hawk/test/index.js | 378 - .../request/node_modules/hawk/test/readme.js | 95 - .../request/node_modules/hawk/test/server.js | 1329 -- .../request/node_modules/hawk/test/uri.js | 838 -- .../request/node_modules/hawk/test/utils.js | 149 - .../http-signature/.dir-locals.el | 6 - .../node_modules/http-signature/.npmignore | 7 - .../node_modules/http-signature/CHANGES.md | 46 - .../node_modules/http-signature/LICENSE | 18 - .../node_modules/http-signature/README.md | 79 - .../http-signature/http_signing.md | 363 - .../node_modules/http-signature/lib/index.js | 29 - .../node_modules/http-signature/lib/parser.js | 318 - .../node_modules/http-signature/lib/signer.js | 399 - .../node_modules/http-signature/lib/utils.js | 112 - .../node_modules/http-signature/lib/verify.js | 88 - .../node_modules/.bin/sshpk-conv | 1 - .../node_modules/.bin/sshpk-sign | 1 - .../node_modules/.bin/sshpk-verify | 1 - .../node_modules/assert-plus/AUTHORS | 6 - .../node_modules/assert-plus/CHANGES.md | 8 - .../node_modules/assert-plus/README.md | 155 - .../node_modules/assert-plus/assert.js | 206 - .../node_modules/assert-plus/package.json | 82 - .../node_modules/jsprim/CHANGES.md | 30 - .../node_modules/jsprim/LICENSE | 19 - .../node_modules/jsprim/README.md | 228 - .../node_modules/jsprim/lib/jsprim.js | 478 - .../node_modules/extsprintf/.gitmodules | 6 - .../jsprim/node_modules/extsprintf/LICENSE | 19 - .../jsprim/node_modules/extsprintf/Makefile | 23 - .../node_modules/extsprintf/Makefile.deps | 39 - .../node_modules/extsprintf/Makefile.targ | 285 - .../jsprim/node_modules/extsprintf/README.md | 39 - .../extsprintf/examples/simple.js | 2 - .../node_modules/extsprintf/jsl.node.conf | 137 - .../node_modules/extsprintf/lib/extsprintf.js | 166 - .../node_modules/extsprintf/package.json | 33 - .../jsprim/node_modules/json-schema/README.md | 5 - .../json-schema/draft-00/hyper-schema | 68 - .../json-schema/draft-00/json-ref | 26 - .../node_modules/json-schema/draft-00/links | 33 - .../node_modules/json-schema/draft-00/schema | 155 - .../json-schema/draft-01/hyper-schema | 68 - .../json-schema/draft-01/json-ref | 26 - .../node_modules/json-schema/draft-01/links | 33 - .../node_modules/json-schema/draft-01/schema | 155 - .../json-schema/draft-02/hyper-schema | 68 - .../json-schema/draft-02/json-ref | 26 - .../node_modules/json-schema/draft-02/links | 35 - .../node_modules/json-schema/draft-02/schema | 166 - .../json-schema/draft-03/examples/address | 20 - .../json-schema/draft-03/examples/calendar | 53 - .../json-schema/draft-03/examples/card | 105 - .../json-schema/draft-03/examples/geo | 8 - .../json-schema/draft-03/examples/interfaces | 23 - .../json-schema/draft-03/hyper-schema | 60 - .../json-schema/draft-03/json-ref | 26 - .../node_modules/json-schema/draft-03/links | 35 - .../node_modules/json-schema/draft-03/schema | 174 - .../json-schema/draft-04/hyper-schema | 60 - .../node_modules/json-schema/draft-04/links | 41 - .../node_modules/json-schema/draft-04/schema | 189 - .../json-schema/draft-zyp-json-schema-03.xml | 1120 -- .../json-schema/draft-zyp-json-schema-04.xml | 1072 -- .../node_modules/json-schema/lib/links.js | 52 - .../node_modules/json-schema/lib/validate.js | 260 - .../node_modules/json-schema/package.json | 56 - .../node_modules/json-schema/test/tests.js | 95 - .../jsprim/node_modules/verror/.gitmodules | 0 .../jsprim/node_modules/verror/.npmignore | 1 - .../jsprim/node_modules/verror/LICENSE | 19 - .../jsprim/node_modules/verror/Makefile | 35 - .../jsprim/node_modules/verror/Makefile.targ | 285 - .../jsprim/node_modules/verror/README.md | 120 - .../verror/examples/levels-verror.js | 36 - .../verror/examples/levels-werror.js | 34 - .../node_modules/verror/examples/varargs.js | 6 - .../node_modules/verror/examples/verror.js | 13 - .../node_modules/verror/examples/werror.js | 14 - .../jsprim/node_modules/verror/jsl.node.conf | 139 - .../jsprim/node_modules/verror/lib/verror.js | 157 - .../jsprim/node_modules/verror/package.json | 39 - .../node_modules/verror/tests/tst.inherit.js | 100 - .../node_modules/verror/tests/tst.verror.js | 156 - .../node_modules/verror/tests/tst.werror.js | 179 - .../node_modules/jsprim/package.json | 46 - .../node_modules/sshpk/.npmignore | 9 - .../node_modules/sshpk/.travis.yml | 11 - .../http-signature/node_modules/sshpk/LICENSE | 18 - .../node_modules/sshpk/README.md | 455 - .../node_modules/sshpk/bin/sshpk-conv | 195 - .../node_modules/sshpk/bin/sshpk-sign | 191 - .../node_modules/sshpk/bin/sshpk-verify | 166 - .../node_modules/sshpk/lib/algs.js | 168 - .../node_modules/sshpk/lib/dhe.js | 311 - .../node_modules/sshpk/lib/ed-compat.js | 96 - .../node_modules/sshpk/lib/errors.js | 71 - .../node_modules/sshpk/lib/fingerprint.js | 140 - .../node_modules/sshpk/lib/formats/auto.js | 73 - .../node_modules/sshpk/lib/formats/pem.js | 186 - .../node_modules/sshpk/lib/formats/pkcs1.js | 320 - .../node_modules/sshpk/lib/formats/pkcs8.js | 510 - .../node_modules/sshpk/lib/formats/rfc4253.js | 146 - .../sshpk/lib/formats/ssh-private.js | 138 - .../node_modules/sshpk/lib/formats/ssh.js | 114 - .../node_modules/sshpk/lib/index.js | 26 - .../node_modules/sshpk/lib/key.js | 269 - .../node_modules/sshpk/lib/private-key.js | 231 - .../node_modules/sshpk/lib/signature.js | 237 - .../node_modules/sshpk/lib/ssh-buffer.js | 124 - .../node_modules/sshpk/lib/utils.js | 246 - .../node_modules/sshpk/man/man1/sshpk-conv.1 | 135 - .../node_modules/sshpk/man/man1/sshpk-sign.1 | 81 - .../sshpk/man/man1/sshpk-verify.1 | 68 - .../sshpk/node_modules/asn1/.npmignore | 2 - .../sshpk/node_modules/asn1/.travis.yml | 4 - .../sshpk/node_modules/asn1/LICENSE | 19 - .../sshpk/node_modules/asn1/README.md | 50 - .../sshpk/node_modules/asn1/lib/ber/errors.js | 13 - .../sshpk/node_modules/asn1/lib/ber/index.js | 27 - .../sshpk/node_modules/asn1/lib/ber/reader.js | 261 - .../sshpk/node_modules/asn1/lib/ber/types.js | 36 - .../sshpk/node_modules/asn1/lib/ber/writer.js | 316 - .../sshpk/node_modules/asn1/lib/index.js | 20 - .../sshpk/node_modules/asn1/package.json | 64 - .../node_modules/asn1/tst/ber/reader.test.js | 208 - .../node_modules/asn1/tst/ber/writer.test.js | 370 - .../sshpk/node_modules/assert-plus/AUTHORS | 6 - .../sshpk/node_modules/assert-plus/CHANGES.md | 14 - .../sshpk/node_modules/assert-plus/README.md | 162 - .../sshpk/node_modules/assert-plus/assert.js | 211 - .../node_modules/assert-plus/package.json | 82 - .../sshpk/node_modules/dashdash/README.md | 574 - .../dashdash/etc/dashdash.bash_completion.in | 388 - .../node_modules/dashdash/lib/dashdash.js | 1022 -- .../sshpk/node_modules/dashdash/package.json | 90 - .../sshpk/node_modules/ecc-jsbn/.npmignore | 15 - .../sshpk/node_modules/ecc-jsbn/LICENSE | 21 - .../sshpk/node_modules/ecc-jsbn/README.md | 8 - .../sshpk/node_modules/ecc-jsbn/index.js | 57 - .../node_modules/ecc-jsbn/lib/LICENSE-jsbn | 40 - .../sshpk/node_modules/ecc-jsbn/lib/ec.js | 561 - .../sshpk/node_modules/ecc-jsbn/lib/sec.js | 170 - .../sshpk/node_modules/ecc-jsbn/package.json | 55 - .../sshpk/node_modules/ecc-jsbn/test.js | 14 - .../sshpk/node_modules/getpass/.npmignore | 8 - .../sshpk/node_modules/getpass/.travis.yml | 9 - .../sshpk/node_modules/getpass/LICENSE | 18 - .../sshpk/node_modules/getpass/README.md | 32 - .../sshpk/node_modules/getpass/lib/index.js | 123 - .../sshpk/node_modules/getpass/package.json | 56 - .../sshpk/node_modules/jodid25519/.npmignore | 11 - .../sshpk/node_modules/jodid25519/.travis.yml | 7 - .../sshpk/node_modules/jodid25519/AUTHORS.md | 3 - .../sshpk/node_modules/jodid25519/LICENSE | 23 - .../sshpk/node_modules/jodid25519/README.md | 51 - .../sshpk/node_modules/jodid25519/almond.0 | 42 - .../sshpk/node_modules/jodid25519/almond.1 | 13 - .../sshpk/node_modules/jodid25519/index.js | 35 - .../sshpk/node_modules/jodid25519/jsdoc.json | 19 - .../sshpk/node_modules/jodid25519/lib/core.js | 481 - .../node_modules/jodid25519/lib/curve255.js | 221 - .../sshpk/node_modules/jodid25519/lib/dh.js | 111 - .../node_modules/jodid25519/lib/eddsa.js | 573 - .../node_modules/jodid25519/lib/utils.js | 198 - .../node_modules/jodid25519/package.json | 70 - .../sshpk/node_modules/jsbn/.npmignore | 2 - .../sshpk/node_modules/jsbn/LICENSE | 40 - .../sshpk/node_modules/jsbn/README.md | 175 - .../sshpk/node_modules/jsbn/example.html | 12 - .../sshpk/node_modules/jsbn/example.js | 3 - .../sshpk/node_modules/jsbn/index.js | 1358 -- .../sshpk/node_modules/jsbn/package.json | 49 - .../sshpk/node_modules/tweetnacl/.npmignore | 4 - .../sshpk/node_modules/tweetnacl/CHANGELOG.md | 128 - .../sshpk/node_modules/tweetnacl/README.md | 463 - .../sshpk/node_modules/tweetnacl/nacl-fast.js | 2418 ---- .../node_modules/tweetnacl/nacl-fast.min.js | 2 - .../sshpk/node_modules/tweetnacl/nacl.js | 1205 -- .../sshpk/node_modules/tweetnacl/nacl.min.js | 1 - .../sshpk/node_modules/tweetnacl/package.json | 93 - .../node_modules/sshpk/package.json | 100 - .../node_modules/http-signature/package.json | 82 - .../node_modules/is-typedarray/LICENSE.md | 18 - .../node_modules/is-typedarray/README.md | 16 - .../node_modules/is-typedarray/index.js | 41 - .../node_modules/is-typedarray/package.json | 56 - .../node_modules/is-typedarray/test.js | 34 - .../request/node_modules/isstream/.jshintrc | 59 - .../request/node_modules/isstream/.npmignore | 1 - .../request/node_modules/isstream/.travis.yml | 12 - .../request/node_modules/isstream/LICENSE.md | 11 - .../request/node_modules/isstream/README.md | 66 - .../request/node_modules/isstream/isstream.js | 27 - .../node_modules/isstream/package.json | 59 - .../request/node_modules/isstream/test.js | 168 - .../json-stringify-safe/.npmignore | 1 - .../json-stringify-safe/CHANGELOG.md | 14 - .../node_modules/json-stringify-safe/LICENSE | 15 - .../node_modules/json-stringify-safe/Makefile | 35 - .../json-stringify-safe/README.md | 52 - .../json-stringify-safe/package.json | 68 - .../json-stringify-safe/stringify.js | 27 - .../json-stringify-safe/test/mocha.opts | 2 - .../test/stringify_test.js | 246 - .../node_modules/mime-types/HISTORY.md | 197 - .../request/node_modules/mime-types/LICENSE | 23 - .../request/node_modules/mime-types/README.md | 103 - .../request/node_modules/mime-types/index.js | 188 - .../node_modules/mime-db/HISTORY.md | 341 - .../mime-types/node_modules/mime-db/LICENSE | 22 - .../mime-types/node_modules/mime-db/README.md | 82 - .../mime-types/node_modules/mime-db/db.json | 6627 --------- .../mime-types/node_modules/mime-db/index.js | 11 - .../node_modules/mime-db/package.json | 98 - .../node_modules/mime-types/package.json | 88 - .../request/node_modules/node-uuid/.npmignore | 4 - .../request/node_modules/node-uuid/LICENSE.md | 21 - .../request/node_modules/node-uuid/README.md | 254 - .../node-uuid/benchmark/README.md | 53 - .../node-uuid/benchmark/bench.gnu | 174 - .../node_modules/node-uuid/benchmark/bench.sh | 34 - .../node-uuid/benchmark/benchmark-native.c | 34 - .../node-uuid/benchmark/benchmark.js | 84 - .../request/node_modules/node-uuid/bin/uuid | 26 - .../request/node_modules/node-uuid/bower.json | 23 - .../node_modules/node-uuid/component.json | 25 - .../node_modules/node-uuid/package.json | 80 - .../node_modules/node-uuid/test/compare_v1.js | 63 - .../node_modules/node-uuid/test/test.html | 17 - .../node_modules/node-uuid/test/test.js | 231 - .../request/node_modules/node-uuid/uuid.js | 272 - .../request/node_modules/oauth-sign/LICENSE | 55 - .../request/node_modules/oauth-sign/README.md | 4 - .../request/node_modules/oauth-sign/index.js | 136 - .../node_modules/oauth-sign/package.json | 65 - .../request/node_modules/qs/.eslintignore | 1 - .../request/node_modules/qs/.eslintrc | 17 - .../request/node_modules/qs/.npmignore | 18 - .../request/node_modules/qs/.travis.yml | 69 - .../request/node_modules/qs/CHANGELOG.md | 115 - .../request/node_modules/qs/CONTRIBUTING.md | 1 - .../request/node_modules/qs/LICENSE | 28 - .../request/node_modules/qs/README.md | 335 - .../request/node_modules/qs/bower.json | 21 - .../request/node_modules/qs/component.json | 15 - .../request/node_modules/qs/dist/qs.js | 476 - .../request/node_modules/qs/lib/index.js | 9 - .../request/node_modules/qs/lib/parse.js | 164 - .../request/node_modules/qs/lib/stringify.js | 131 - .../request/node_modules/qs/lib/utils.js | 162 - .../request/node_modules/qs/package.json | 83 - .../request/node_modules/qs/test/index.js | 5 - .../request/node_modules/qs/test/parse.js | 393 - .../request/node_modules/qs/test/stringify.js | 259 - .../request/node_modules/qs/test/utils.js | 9 - .../node_modules/stringstream/.npmignore | 15 - .../node_modules/stringstream/.travis.yml | 4 - .../node_modules/stringstream/LICENSE.txt | 22 - .../node_modules/stringstream/README.md | 38 - .../node_modules/stringstream/example.js | 27 - .../node_modules/stringstream/package.json | 50 - .../node_modules/stringstream/stringstream.js | 102 - .../request/node_modules/tough-cookie/LICENSE | 27 - .../node_modules/tough-cookie/README.md | 492 - .../node_modules/tough-cookie/lib/cookie.js | 1342 -- .../node_modules/tough-cookie/lib/memstore.js | 170 - .../tough-cookie/lib/pathMatch.js | 61 - .../tough-cookie/lib/permuteDomain.js | 56 - .../tough-cookie/lib/pubsuffix.js | 98 - .../node_modules/tough-cookie/lib/store.js | 71 - .../node_modules/tough-cookie/package.json | 93 - .../request/node_modules/tunnel-agent/LICENSE | 55 - .../node_modules/tunnel-agent/README.md | 4 - .../node_modules/tunnel-agent/index.js | 243 - .../node_modules/tunnel-agent/package.json | 67 - APIs/node_modules/request/package.json | 118 - APIs/node_modules/request/request.js | 1458 -- .../node_modules/mongoose/.eslintignore | 3 - Associations/node_modules/mongoose/.eslintrc | 30 - Associations/node_modules/mongoose/.npmignore | 16 - .../node_modules/mongoose/.travis.yml | 9 - .../node_modules/mongoose/CONTRIBUTING.md | 58 - Associations/node_modules/mongoose/History.md | 2637 ---- Associations/node_modules/mongoose/README.md | 318 - Associations/node_modules/mongoose/contRun.sh | 10 - .../node_modules/mongoose/examples/README.md | 41 - .../mongoose/examples/aggregate/aggregate.js | 81 - .../mongoose/examples/aggregate/package.json | 14 - .../mongoose/examples/aggregate/person.js | 17 - .../mongoose/examples/doc-methods.js | 70 - .../mongoose/examples/express/README.md | 1 - .../express/connection-sharing/README.md | 6 - .../express/connection-sharing/app.js | 17 - .../express/connection-sharing/modelA.js | 5 - .../express/connection-sharing/package.json | 14 - .../express/connection-sharing/routes.js | 20 - .../examples/geospatial/geoJSONSchema.js | 22 - .../examples/geospatial/geoJSONexample.js | 49 - .../examples/geospatial/geospatial.js | 70 - .../mongoose/examples/geospatial/package.json | 14 - .../mongoose/examples/geospatial/person.js | 28 - .../examples/globalschemas/gs_example.js | 40 - .../mongoose/examples/globalschemas/person.js | 15 - .../mongoose/examples/lean/lean.js | 64 - .../mongoose/examples/lean/package.json | 14 - .../mongoose/examples/lean/person.js | 17 - .../mongoose/examples/mapreduce/mapreduce.js | 80 - .../mongoose/examples/mapreduce/package.json | 14 - .../mongoose/examples/mapreduce/person.js | 16 - .../population-across-three-collections.js | 135 - .../examples/population/population-basic.js | 95 - .../population/population-of-existing-doc.js | 101 - .../population-of-multiple-existing-docs.js | 112 - .../examples/population/population-options.js | 124 - .../population/population-plain-objects.js | 96 - .../mongoose/examples/promises/package.json | 14 - .../mongoose/examples/promises/person.js | 15 - .../mongoose/examples/promises/promise.js | 73 - .../examples/querybuilder/package.json | 14 - .../mongoose/examples/querybuilder/person.js | 15 - .../examples/querybuilder/querybuilder.js | 65 - .../examples/replicasets/package.json | 14 - .../mongoose/examples/replicasets/person.js | 15 - .../examples/replicasets/replica-sets.js | 56 - .../mongoose/examples/schema/schema.js | 103 - .../schema/storing-schemas-as-json/index.js | 27 - .../storing-schemas-as-json/schema.json | 9 - .../mongoose/examples/statics/person.js | 21 - .../mongoose/examples/statics/statics.js | 38 - Associations/node_modules/mongoose/index.js | 7 - .../node_modules/mongoose/lib/ES6Promise.js | 28 - .../node_modules/mongoose/lib/aggregate.js | 555 - .../node_modules/mongoose/lib/browser.js | 97 - .../mongoose/lib/browserDocument.js | 105 - .../node_modules/mongoose/lib/cast.js | 211 - .../node_modules/mongoose/lib/collection.js | 198 - .../node_modules/mongoose/lib/connection.js | 740 - .../mongoose/lib/connectionstate.js | 27 - .../node_modules/mongoose/lib/document.js | 2250 --- .../mongoose/lib/document_provider.js | 20 - .../node_modules/mongoose/lib/drivers/SPEC.md | 4 - .../lib/drivers/browser/ReadPreference.js | 5 - .../mongoose/lib/drivers/browser/binary.js | 12 - .../mongoose/lib/drivers/browser/index.js | 7 - .../mongoose/lib/drivers/browser/objectid.js | 14 - .../mongoose/lib/drivers/index.js | 17 - .../node-mongodb-native/ReadPreference.js | 45 - .../lib/drivers/node-mongodb-native/binary.js | 8 - .../drivers/node-mongodb-native/collection.js | 225 - .../drivers/node-mongodb-native/connection.js | 355 - .../lib/drivers/node-mongodb-native/index.js | 7 - .../drivers/node-mongodb-native/objectid.js | 14 - .../node_modules/mongoose/lib/error.js | 51 - .../lib/error/browserMissingSchema.js | 33 - .../node_modules/mongoose/lib/error/cast.js | 38 - .../mongoose/lib/error/divergentArray.js | 42 - .../mongoose/lib/error/messages.js | 43 - .../mongoose/lib/error/missingSchema.js | 33 - .../mongoose/lib/error/overwriteModel.js | 31 - .../mongoose/lib/error/validation.js | 58 - .../mongoose/lib/error/validator.js | 67 - .../mongoose/lib/error/version.js | 32 - .../node_modules/mongoose/lib/index.js | 693 - .../node_modules/mongoose/lib/internal.js | 31 - .../node_modules/mongoose/lib/model.js | 2958 ---- .../node_modules/mongoose/lib/promise.js | 291 - .../mongoose/lib/promise_provider.js | 51 - .../node_modules/mongoose/lib/query.js | 3103 ----- .../node_modules/mongoose/lib/queryhelpers.js | 78 - .../node_modules/mongoose/lib/querystream.js | 346 - .../node_modules/mongoose/lib/schema.js | 1181 -- .../node_modules/mongoose/lib/schema/array.js | 394 - .../mongoose/lib/schema/boolean.js | 107 - .../mongoose/lib/schema/buffer.js | 187 - .../node_modules/mongoose/lib/schema/date.js | 298 - .../mongoose/lib/schema/documentarray.js | 248 - .../node_modules/mongoose/lib/schema/index.js | 28 - .../node_modules/mongoose/lib/schema/mixed.js | 91 - .../mongoose/lib/schema/number.js | 278 - .../mongoose/lib/schema/objectid.js | 208 - .../mongoose/lib/schema/string.js | 495 - .../node_modules/mongoose/lib/schematype.js | 800 -- .../mongoose/lib/services/updateValidators.js | 178 - .../node_modules/mongoose/lib/statemachine.js | 178 - .../node_modules/mongoose/lib/types/array.js | 762 - .../node_modules/mongoose/lib/types/buffer.js | 269 - .../mongoose/lib/types/documentarray.js | 223 - .../mongoose/lib/types/embedded.js | 311 - .../node_modules/mongoose/lib/types/index.js | 13 - .../mongoose/lib/types/objectid.js | 13 - .../node_modules/mongoose/lib/utils.js | 794 -- .../node_modules/mongoose/lib/virtualtype.js | 103 - .../mongoose/node_modules/async/.travis.yml | 3 - .../mongoose/node_modules/async/LICENSE | 19 - .../mongoose/node_modules/async/README.md | 1646 --- .../node_modules/async/component.json | 11 - .../mongoose/node_modules/async/lib/async.js | 1123 -- .../mongoose/node_modules/async/package.json | 60 - .../mongoose/node_modules/bson/HISTORY | 126 - .../mongoose/node_modules/bson/LICENSE | 201 - .../mongoose/node_modules/bson/README.md | 70 - .../bson/alternate_parsers/bson.js | 1574 --- .../bson/alternate_parsers/faster_bson.js | 429 - .../node_modules/bson/browser_build/bson.js | 4843 ------- .../bson/browser_build/package.json | 8 - .../node_modules/bson/lib/bson/binary.js | 344 - .../bson/lib/bson/binary_parser.js | 385 - .../node_modules/bson/lib/bson/bson.js | 323 - .../node_modules/bson/lib/bson/code.js | 24 - .../node_modules/bson/lib/bson/db_ref.js | 32 - .../node_modules/bson/lib/bson/double.js | 33 - .../bson/lib/bson/float_parser.js | 121 - .../node_modules/bson/lib/bson/index.js | 86 - .../node_modules/bson/lib/bson/long.js | 856 -- .../node_modules/bson/lib/bson/map.js | 126 - .../node_modules/bson/lib/bson/max_key.js | 14 - .../node_modules/bson/lib/bson/min_key.js | 14 - .../node_modules/bson/lib/bson/objectid.js | 278 - .../bson/lib/bson/parser/calculate_size.js | 310 - .../bson/lib/bson/parser/deserializer.js | 555 - .../bson/lib/bson/parser/serializer.js | 912 -- .../node_modules/bson/lib/bson/regexp.js | 30 - .../node_modules/bson/lib/bson/symbol.js | 47 - .../node_modules/bson/lib/bson/timestamp.js | 856 -- .../mongoose/node_modules/bson/package.json | 71 - .../mongoose/node_modules/bson/tools/gleak.js | 21 - .../node_modules/hooks-fixed/.npmignore | 2 - .../node_modules/hooks-fixed/Makefile | 9 - .../node_modules/hooks-fixed/README.md | 369 - .../node_modules/hooks-fixed/hooks.alt.js | 134 - .../node_modules/hooks-fixed/hooks.js | 191 - .../node_modules/hooks-fixed/package.json | 67 - .../mongoose/node_modules/hooks-fixed/test.js | 786 -- .../mongoose/node_modules/kareem/.npmignore | 28 - .../mongoose/node_modules/kareem/.travis.yml | 7 - .../mongoose/node_modules/kareem/LICENSE | 202 - .../mongoose/node_modules/kareem/Makefile | 5 - .../mongoose/node_modules/kareem/README.md | 379 - .../mongoose/node_modules/kareem/docs.js | 37 - .../mongoose/node_modules/kareem/gulpfile.js | 18 - .../mongoose/node_modules/kareem/index.js | 229 - .../mongoose/node_modules/kareem/package.json | 60 - .../node_modules/kareem/test/examples.test.js | 339 - .../node_modules/kareem/test/post.test.js | 46 - .../node_modules/kareem/test/pre.test.js | 226 - .../node_modules/kareem/test/wrap.test.js | 277 - .../mongoose/node_modules/mongodb/HISTORY.md | 1225 -- .../mongoose/node_modules/mongodb/LICENSE | 201 - .../mongoose/node_modules/mongodb/Makefile | 11 - .../mongoose/node_modules/mongodb/README.md | 324 - .../mongoose/node_modules/mongodb/conf.json | 69 - .../mongoose/node_modules/mongodb/index.js | 48 - .../node_modules/mongodb/lib/admin.js | 581 - .../mongodb/lib/aggregation_cursor.js | 432 - .../mongoose/node_modules/mongodb/lib/apm.js | 608 - .../node_modules/mongodb/lib/bulk/common.js | 393 - .../node_modules/mongodb/lib/bulk/ordered.js | 529 - .../mongodb/lib/bulk/unordered.js | 538 - .../node_modules/mongodb/lib/collection.js | 3138 ----- .../mongodb/lib/command_cursor.js | 296 - .../node_modules/mongodb/lib/cursor.js | 1177 -- .../mongoose/node_modules/mongodb/lib/db.js | 1731 --- .../node_modules/mongodb/lib/gridfs/chunk.js | 237 - .../mongodb/lib/gridfs/grid_store.js | 1923 --- .../node_modules/mongodb/lib/metadata.js | 64 - .../node_modules/mongodb/lib/mongo_client.js | 465 - .../node_modules/mongodb/lib/mongos.js | 492 - .../mongodb/lib/read_preference.js | 104 - .../node_modules/mongodb/lib/replset.js | 555 - .../node_modules/mongodb/lib/server.js | 437 - .../node_modules/mongodb/lib/topology_base.js | 152 - .../node_modules/mongodb/lib/url_parser.js | 295 - .../node_modules/mongodb/lib/utils.js | 234 - .../mongoose/node_modules/mongodb/load.js | 32 - .../node_modules/es6-promise/CHANGELOG.md | 9 - .../mongodb/node_modules/es6-promise/LICENSE | 19 - .../node_modules/es6-promise/README.md | 61 - .../es6-promise/dist/es6-promise.js | 957 -- .../es6-promise/dist/es6-promise.min.js | 9 - .../es6-promise/dist/test/browserify.js | 11631 ---------------- .../es6-promise/dist/test/es6-promise.js | 950 -- .../es6-promise/dist/test/es6-promise.min.js | 1 - .../es6-promise/dist/test/index.html | 25 - .../es6-promise/dist/test/json3.js | 902 -- .../es6-promise/dist/test/mocha.css | 270 - .../es6-promise/dist/test/mocha.js | 6095 -------- .../es6-promise/dist/test/worker.js | 16 - .../es6-promise/lib/es6-promise.umd.js | 18 - .../es6-promise/lib/es6-promise/-internal.js | 250 - .../es6-promise/lib/es6-promise/asap.js | 111 - .../es6-promise/lib/es6-promise/enumerator.js | 113 - .../es6-promise/lib/es6-promise/polyfill.js | 26 - .../es6-promise/lib/es6-promise/promise.js | 408 - .../lib/es6-promise/promise/all.js | 52 - .../lib/es6-promise/promise/race.js | 104 - .../lib/es6-promise/promise/reject.js | 46 - .../lib/es6-promise/promise/resolve.js | 48 - .../es6-promise/lib/es6-promise/utils.js | 22 - .../node_modules/es6-promise/package.json | 89 - .../node_modules/mongodb-core/HISTORY.md | 266 - .../mongodb/node_modules/mongodb-core/LICENSE | 201 - .../node_modules/mongodb-core/Makefile | 11 - .../node_modules/mongodb-core/README.md | 225 - .../node_modules/mongodb-core/TESTING.md | 18 - .../node_modules/mongodb-core/conf.json | 60 - .../node_modules/mongodb-core/index.js | 18 - .../mongodb-core/lib/auth/gssapi.js | 244 - .../mongodb-core/lib/auth/mongocr.js | 160 - .../mongodb-core/lib/auth/plain.js | 150 - .../mongodb-core/lib/auth/scram.js | 317 - .../mongodb-core/lib/auth/sspi.js | 234 - .../mongodb-core/lib/auth/x509.js | 145 - .../mongodb-core/lib/connection/commands.js | 519 - .../mongodb-core/lib/connection/connection.js | 469 - .../mongodb-core/lib/connection/logger.js | 196 - .../mongodb-core/lib/connection/pool.js | 298 - .../mongodb-core/lib/connection/utils.js | 77 - .../node_modules/mongodb-core/lib/cursor.js | 768 - .../node_modules/mongodb-core/lib/error.js | 44 - .../mongodb-core/lib/tools/smoke_plugin.js | 59 - .../lib/topologies/command_result.js | 37 - .../mongodb-core/lib/topologies/mongos.js | 1000 -- .../lib/topologies/read_preference.js | 106 - .../mongodb-core/lib/topologies/replset.js | 1369 -- .../lib/topologies/replset_state.js | 483 - .../mongodb-core/lib/topologies/server.js | 1241 -- .../mongodb-core/lib/topologies/session.js | 93 - .../lib/topologies/strategies/ping.js | 276 - .../lib/wireprotocol/2_4_support.js | 581 - .../lib/wireprotocol/2_6_support.js | 317 - .../lib/wireprotocol/3_2_support.js | 509 - .../mongodb-core/lib/wireprotocol/commands.js | 357 - .../node_modules/kerberos/.travis.yml | 20 - .../node_modules/kerberos/LICENSE | 201 - .../node_modules/kerberos/README.md | 4 - .../node_modules/kerberos/binding.gyp | 46 - .../node_modules/kerberos/build/Makefile | 332 - .../obj.target/kerberos/lib/base64.o.d | 4 - .../obj.target/kerberos/lib/kerberos.o.d | 63 - .../kerberos/lib/kerberos_context.o.d | 62 - .../obj.target/kerberos/lib/kerberosgss.o.d | 16 - .../obj.target/kerberos/lib/worker.o.d | 49 - .../kerberos/build/Release/linker.lock | 0 .../Release/obj.target/kerberos/lib/base64.o | Bin 3600 -> 0 bytes .../obj.target/kerberos/lib/kerberos.o | Bin 69936 -> 0 bytes .../kerberos/lib/kerberos_context.o | Bin 25560 -> 0 bytes .../obj.target/kerberos/lib/kerberosgss.o | Bin 16448 -> 0 bytes .../Release/obj.target/kerberos/lib/worker.o | Bin 2248 -> 0 bytes .../kerberos/build/binding.Makefile | 6 - .../node_modules/kerberos/build/config.gypi | 122 - .../kerberos/build/kerberos.target.mk | 148 - .../node_modules/kerberos/builderror.log | 25 - .../node_modules/kerberos/index.js | 6 - .../kerberos/lib/auth_processes/mongodb.js | 281 - .../node_modules/kerberos/lib/base64.c | 134 - .../node_modules/kerberos/lib/base64.h | 22 - .../node_modules/kerberos/lib/kerberos.cc | 893 -- .../node_modules/kerberos/lib/kerberos.h | 50 - .../node_modules/kerberos/lib/kerberos.js | 164 - .../kerberos/lib/kerberos_context.cc | 134 - .../kerberos/lib/kerberos_context.h | 64 - .../node_modules/kerberos/lib/kerberosgss.c | 931 -- .../node_modules/kerberos/lib/kerberosgss.h | 73 - .../node_modules/kerberos/lib/sspi.js | 15 - .../node_modules/kerberos/lib/win32/base64.c | 121 - .../node_modules/kerberos/lib/win32/base64.h | 18 - .../kerberos/lib/win32/kerberos.cc | 51 - .../kerberos/lib/win32/kerberos.h | 60 - .../kerberos/lib/win32/kerberos_sspi.c | 244 - .../kerberos/lib/win32/kerberos_sspi.h | 106 - .../node_modules/kerberos/lib/win32/worker.cc | 7 - .../node_modules/kerberos/lib/win32/worker.h | 38 - .../lib/win32/wrappers/security_buffer.cc | 101 - .../lib/win32/wrappers/security_buffer.h | 48 - .../lib/win32/wrappers/security_buffer.js | 12 - .../wrappers/security_buffer_descriptor.cc | 182 - .../wrappers/security_buffer_descriptor.h | 46 - .../wrappers/security_buffer_descriptor.js | 3 - .../lib/win32/wrappers/security_context.cc | 856 -- .../lib/win32/wrappers/security_context.h | 74 - .../lib/win32/wrappers/security_context.js | 3 - .../win32/wrappers/security_credentials.cc | 348 - .../lib/win32/wrappers/security_credentials.h | 68 - .../win32/wrappers/security_credentials.js | 22 - .../node_modules/kerberos/lib/worker.cc | 7 - .../node_modules/kerberos/lib/worker.h | 38 - .../kerberos/node_modules/nan/.dntrc | 30 - .../kerberos/node_modules/nan/CHANGELOG.md | 374 - .../kerberos/node_modules/nan/LICENSE.md | 13 - .../kerberos/node_modules/nan/README.md | 367 - .../kerberos/node_modules/nan/appveyor.yml | 38 - .../kerberos/node_modules/nan/doc/.build.sh | 38 - .../node_modules/nan/doc/asyncworker.md | 97 - .../kerberos/node_modules/nan/doc/buffers.md | 54 - .../kerberos/node_modules/nan/doc/callback.md | 52 - .../node_modules/nan/doc/converters.md | 41 - .../kerberos/node_modules/nan/doc/errors.md | 226 - .../node_modules/nan/doc/maybe_types.md | 480 - .../kerberos/node_modules/nan/doc/methods.md | 624 - .../kerberos/node_modules/nan/doc/new.md | 141 - .../node_modules/nan/doc/node_misc.md | 114 - .../node_modules/nan/doc/persistent.md | 292 - .../kerberos/node_modules/nan/doc/scopes.md | 73 - .../kerberos/node_modules/nan/doc/script.md | 38 - .../node_modules/nan/doc/string_bytes.md | 62 - .../node_modules/nan/doc/v8_internals.md | 199 - .../kerberos/node_modules/nan/doc/v8_misc.md | 63 - .../kerberos/node_modules/nan/include_dirs.js | 1 - .../kerberos/node_modules/nan/nan.h | 2136 --- .../kerberos/node_modules/nan/nan_callbacks.h | 88 - .../node_modules/nan/nan_callbacks_12_inl.h | 512 - .../nan/nan_callbacks_pre_12_inl.h | 506 - .../node_modules/nan/nan_converters.h | 64 - .../node_modules/nan/nan_converters_43_inl.h | 42 - .../nan/nan_converters_pre_43_inl.h | 42 - .../nan/nan_implementation_12_inl.h | 399 - .../nan/nan_implementation_pre_12_inl.h | 259 - .../node_modules/nan/nan_maybe_43_inl.h | 224 - .../node_modules/nan/nan_maybe_pre_43_inl.h | 295 - .../kerberos/node_modules/nan/nan_new.h | 332 - .../node_modules/nan/nan_object_wrap.h | 155 - .../node_modules/nan/nan_persistent_12_inl.h | 129 - .../nan/nan_persistent_pre_12_inl.h | 238 - .../node_modules/nan/nan_string_bytes.h | 305 - .../kerberos/node_modules/nan/nan_weak.h | 422 - .../kerberos/node_modules/nan/package.json | 92 - .../kerberos/node_modules/nan/tools/1to2.js | 412 - .../kerberos/node_modules/nan/tools/README.md | 14 - .../node_modules/nan/tools/package.json | 19 - .../node_modules/kerberos/package.json | 56 - .../kerberos/test/kerberos_tests.js | 34 - .../kerberos/test/kerberos_win32_test.js | 15 - .../win32/security_buffer_descriptor_tests.js | 41 - .../test/win32/security_buffer_tests.js | 22 - .../test/win32/security_credentials_tests.js | 55 - .../node_modules/mongodb-core/package.json | 67 - .../simple_2_document_limit_toArray.dat | 11000 --------------- .../node_modules/readable-stream/.npmignore | 5 - .../node_modules/readable-stream/LICENSE | 27 - .../node_modules/readable-stream/README.md | 15 - .../node_modules/readable-stream/duplex.js | 1 - .../readable-stream/lib/_stream_duplex.js | 89 - .../lib/_stream_passthrough.js | 46 - .../readable-stream/lib/_stream_readable.js | 982 -- .../readable-stream/lib/_stream_transform.js | 210 - .../readable-stream/lib/_stream_writable.js | 386 - .../node_modules/core-util-is/README.md | 3 - .../node_modules/core-util-is/float.patch | 604 - .../node_modules/core-util-is/lib/util.js | 107 - .../node_modules/core-util-is/package.json | 54 - .../node_modules/core-util-is/util.js | 106 - .../node_modules/inherits/LICENSE | 16 - .../node_modules/inherits/README.md | 42 - .../node_modules/inherits/inherits.js | 1 - .../node_modules/inherits/inherits_browser.js | 23 - .../node_modules/inherits/package.json | 50 - .../node_modules/inherits/test.js | 25 - .../node_modules/isarray/README.md | 54 - .../node_modules/isarray/build/build.js | 209 - .../node_modules/isarray/component.json | 19 - .../node_modules/isarray/index.js | 3 - .../node_modules/isarray/package.json | 53 - .../node_modules/string_decoder/.npmignore | 2 - .../node_modules/string_decoder/LICENSE | 20 - .../node_modules/string_decoder/README.md | 7 - .../node_modules/string_decoder/index.js | 221 - .../node_modules/string_decoder/package.json | 54 - .../node_modules/readable-stream/package.json | 69 - .../readable-stream/passthrough.js | 1 - .../node_modules/readable-stream/readable.js | 6 - .../node_modules/readable-stream/transform.js | 1 - .../node_modules/readable-stream/writable.js | 1 - .../node_modules/mongodb/package.json | 67 - .../mongoose/node_modules/mongodb/t.js | 73 - .../mongoose/node_modules/mongodb/t1.js | 101 - .../node_modules/mongodb/test_boot/boot.sh | 3 - .../node_modules/mongodb/test_boot/ca.pem | 49 - .../node_modules/mongodb/test_boot/client.pem | 48 - .../mongodb/test_boot/client_password.pem | 51 - .../node_modules/mongodb/test_boot/connect.js | 29 - .../mongodb/test_boot/data/WiredTiger | 2 - .../mongodb/test_boot/data/WiredTiger.lock | 1 - .../mongodb/test_boot/data/WiredTiger.turtle | 6 - .../mongodb/test_boot/data/WiredTiger.wt | Bin 45056 -> 0 bytes .../mongodb/test_boot/data/WiredTigerLAS.wt | Bin 4096 -> 0 bytes .../mongodb/test_boot/data/_mdb_catalog.wt | Bin 16384 -> 0 bytes .../data/collection-0-757073248613337118.wt | Bin 36864 -> 0 bytes .../metrics.2015-10-07T14-44-37Z-00000 | Bin 7207 -> 0 bytes .../metrics.2015-10-07T14-45-15Z-00000 | Bin 7162 -> 0 bytes .../metrics.2015-10-07T14-46-31Z-00000 | Bin 7089 -> 0 bytes .../metrics.2015-10-07T14-47-25Z-00000 | Bin 7238 -> 0 bytes .../metrics.2015-10-07T14-49-07Z-00000 | Bin 7175 -> 0 bytes .../metrics.2015-10-07T14-50-41Z-00000 | Bin 7251 -> 0 bytes .../metrics.2015-10-07T14-50-53Z-00000 | Bin 7621 -> 0 bytes .../metrics.2015-10-07T14-52-31Z-00000 | Bin 7847 -> 0 bytes .../metrics.2015-10-07T14-54-53Z-00000 | Bin 7175 -> 0 bytes .../metrics.2015-10-07T14-55-09Z-00000 | Bin 7306 -> 0 bytes .../metrics.2015-10-07T14-55-38Z-00000 | Bin 7541 -> 0 bytes .../data/index-1-757073248613337118.wt | Bin 36864 -> 0 bytes .../mongodb/test_boot/data/mongod.lock | 0 .../mongodb/test_boot/data/sizeStorer.wt | Bin 36864 -> 0 bytes .../mongodb/test_boot/data/storage.bson | Bin 95 -> 0 bytes .../mongodb/test_boot/server_password.pem | 51 - .../mongoose/node_modules/mpath/.npmignore | 2 - .../mongoose/node_modules/mpath/.travis.yml | 4 - .../mongoose/node_modules/mpath/History.md | 16 - .../mongoose/node_modules/mpath/LICENSE | 22 - .../mongoose/node_modules/mpath/Makefile | 5 - .../mongoose/node_modules/mpath/README.md | 278 - .../mongoose/node_modules/mpath/index.js | 1 - .../mongoose/node_modules/mpath/lib/index.js | 183 - .../mongoose/node_modules/mpath/package.json | 52 - .../mongoose/node_modules/mpath/test/index.js | 1630 --- .../mongoose/node_modules/mpromise/.npmignore | 4 - .../node_modules/mpromise/.travis.yml | 5 - .../mongoose/node_modules/mpromise/History.md | 74 - .../mongoose/node_modules/mpromise/LICENSE | 22 - .../mongoose/node_modules/mpromise/README.md | 224 - .../node_modules/mpromise/lib/promise.js | 440 - .../node_modules/mpromise/package.json | 61 - .../mpromise/test/promise.domain.test.js | 28 - .../mpromise/test/promise.test.js | 554 - .../mpromise/test/promises.Aplus.js | 15 - .../mongoose/node_modules/mquery/.npmignore | 3 - .../mongoose/node_modules/mquery/.travis.yml | 7 - .../mongoose/node_modules/mquery/History.md | 230 - .../mongoose/node_modules/mquery/LICENSE | 22 - .../mongoose/node_modules/mquery/Makefile | 22 - .../mongoose/node_modules/mquery/README.md | 1220 -- .../mquery/lib/collection/collection.js | 42 - .../mquery/lib/collection/index.js | 13 - .../mquery/lib/collection/node.js | 100 - .../mongoose/node_modules/mquery/lib/env.js | 22 - .../node_modules/mquery/lib/mquery.js | 2612 ---- .../node_modules/mquery/lib/permissions.js | 90 - .../mongoose/node_modules/mquery/lib/utils.js | 331 - .../mquery/node_modules/bluebird/LICENSE | 21 - .../mquery/node_modules/bluebird/README.md | 676 - .../mquery/node_modules/bluebird/changelog.md | 1643 --- .../bluebird/js/browser/bluebird.js | 5105 ------- .../bluebird/js/browser/bluebird.min.js | 31 - .../node_modules/bluebird/js/main/any.js | 21 - .../node_modules/bluebird/js/main/assert.js | 55 - .../node_modules/bluebird/js/main/async.js | 204 - .../node_modules/bluebird/js/main/bind.js | 73 - .../node_modules/bluebird/js/main/bluebird.js | 11 - .../node_modules/bluebird/js/main/call_get.js | 123 - .../node_modules/bluebird/js/main/cancel.js | 48 - .../bluebird/js/main/captured_trace.js | 492 - .../bluebird/js/main/catch_filter.js | 66 - .../node_modules/bluebird/js/main/context.js | 38 - .../bluebird/js/main/debuggability.js | 147 - .../bluebird/js/main/direct_resolve.js | 62 - .../node_modules/bluebird/js/main/each.js | 12 - .../node_modules/bluebird/js/main/errors.js | 111 - .../node_modules/bluebird/js/main/es5.js | 80 - .../node_modules/bluebird/js/main/filter.js | 12 - .../node_modules/bluebird/js/main/finally.js | 99 - .../bluebird/js/main/generators.js | 136 - .../node_modules/bluebird/js/main/join.js | 107 - .../node_modules/bluebird/js/main/map.js | 131 - .../node_modules/bluebird/js/main/method.js | 44 - .../node_modules/bluebird/js/main/nodeify.js | 58 - .../node_modules/bluebird/js/main/progress.js | 76 - .../node_modules/bluebird/js/main/promise.js | 700 - .../bluebird/js/main/promise_array.js | 142 - .../bluebird/js/main/promise_resolver.js | 123 - .../bluebird/js/main/promisify.js | 291 - .../node_modules/bluebird/js/main/props.js | 79 - .../node_modules/bluebird/js/main/queue.js | 90 - .../node_modules/bluebird/js/main/race.js | 47 - .../node_modules/bluebird/js/main/reduce.js | 146 - .../node_modules/bluebird/js/main/schedule.js | 39 - .../node_modules/bluebird/js/main/settle.js | 40 - .../node_modules/bluebird/js/main/some.js | 125 - .../js/main/synchronous_inspection.js | 94 - .../bluebird/js/main/thenables.js | 89 - .../node_modules/bluebird/js/main/timers.js | 58 - .../node_modules/bluebird/js/main/using.js | 202 - .../node_modules/bluebird/js/main/util.js | 280 - .../mquery/node_modules/bluebird/package.json | 97 - .../mquery/node_modules/debug/.jshintrc | 3 - .../mquery/node_modules/debug/.npmignore | 6 - .../mquery/node_modules/debug/History.md | 195 - .../mquery/node_modules/debug/Makefile | 36 - .../mquery/node_modules/debug/Readme.md | 188 - .../mquery/node_modules/debug/bower.json | 28 - .../mquery/node_modules/debug/browser.js | 168 - .../mquery/node_modules/debug/component.json | 19 - .../mquery/node_modules/debug/debug.js | 197 - .../mquery/node_modules/debug/node.js | 209 - .../debug/node_modules/ms/.npmignore | 5 - .../debug/node_modules/ms/History.md | 66 - .../debug/node_modules/ms/LICENSE | 20 - .../debug/node_modules/ms/README.md | 35 - .../debug/node_modules/ms/index.js | 125 - .../debug/node_modules/ms/package.json | 48 - .../mquery/node_modules/debug/package.json | 73 - .../mongoose/node_modules/mquery/package.json | 69 - .../mquery/test/collection/browser.js | 0 .../mquery/test/collection/mongo.js | 0 .../mquery/test/collection/node.js | 29 - .../mongoose/node_modules/mquery/test/env.js | 20 - .../node_modules/mquery/test/index.js | 2875 ---- .../node_modules/mquery/test/utils.test.js | 143 - .../mongoose/node_modules/ms/.npmignore | 1 - .../mongoose/node_modules/ms/Makefile | 8 - .../mongoose/node_modules/ms/README.md | 65 - .../mongoose/node_modules/ms/ms.js | 35 - .../mongoose/node_modules/ms/package.json | 39 - .../mongoose/node_modules/ms/test/index.html | 19 - .../node_modules/ms/test/support/jquery.js | 9266 ------------ .../mongoose/node_modules/ms/test/test.js | 61 - .../mongoose/node_modules/muri/.npmignore | 2 - .../mongoose/node_modules/muri/.travis.yml | 4 - .../mongoose/node_modules/muri/History.md | 52 - .../mongoose/node_modules/muri/LICENSE | 22 - .../mongoose/node_modules/muri/Makefile | 5 - .../mongoose/node_modules/muri/README.md | 46 - .../mongoose/node_modules/muri/index.js | 1 - .../mongoose/node_modules/muri/lib/index.js | 235 - .../mongoose/node_modules/muri/package.json | 51 - .../mongoose/node_modules/muri/strict.js | 3 - .../mongoose/node_modules/muri/test/index.js | 312 - .../node_modules/regexp-clone/.npmignore | 2 - .../node_modules/regexp-clone/.travis.yml | 5 - .../node_modules/regexp-clone/History.md | 5 - .../node_modules/regexp-clone/LICENSE | 22 - .../node_modules/regexp-clone/Makefile | 5 - .../node_modules/regexp-clone/README.md | 18 - .../node_modules/regexp-clone/index.js | 20 - .../node_modules/regexp-clone/package.json | 51 - .../node_modules/regexp-clone/test/index.js | 112 - .../mongoose/node_modules/sliced/.npmignore | 2 - .../mongoose/node_modules/sliced/.travis.yml | 4 - .../mongoose/node_modules/sliced/History.md | 30 - .../mongoose/node_modules/sliced/LICENSE | 22 - .../mongoose/node_modules/sliced/Makefile | 5 - .../mongoose/node_modules/sliced/README.md | 62 - .../mongoose/node_modules/sliced/bench.js | 95 - .../node_modules/sliced/component.json | 14 - .../mongoose/node_modules/sliced/index.js | 1 - .../node_modules/sliced/lib/sliced.js | 33 - .../mongoose/node_modules/sliced/package.json | 52 - .../node_modules/sliced/test/index.js | 80 - .../node_modules/mongoose/package.json | 127 - .../node_modules/mongoose/release-items.md | 29 - Associations/node_modules/mongoose/static.js | 26 - Associations/node_modules/mongoose/website.js | 79 - Databases/node_modules/mongoose/.eslintignore | 3 - Databases/node_modules/mongoose/.eslintrc | 30 - Databases/node_modules/mongoose/.npmignore | 16 - Databases/node_modules/mongoose/.travis.yml | 9 - .../node_modules/mongoose/CONTRIBUTING.md | 58 - Databases/node_modules/mongoose/History.md | 2627 ---- Databases/node_modules/mongoose/README.md | 318 - Databases/node_modules/mongoose/contRun.sh | 10 - .../node_modules/mongoose/examples/README.md | 41 - .../mongoose/examples/aggregate/aggregate.js | 81 - .../mongoose/examples/aggregate/package.json | 14 - .../mongoose/examples/aggregate/person.js | 17 - .../mongoose/examples/doc-methods.js | 70 - .../mongoose/examples/express/README.md | 1 - .../express/connection-sharing/README.md | 6 - .../express/connection-sharing/app.js | 17 - .../express/connection-sharing/modelA.js | 5 - .../express/connection-sharing/package.json | 14 - .../express/connection-sharing/routes.js | 20 - .../examples/geospatial/geoJSONSchema.js | 22 - .../examples/geospatial/geoJSONexample.js | 49 - .../examples/geospatial/geospatial.js | 70 - .../mongoose/examples/geospatial/package.json | 14 - .../mongoose/examples/geospatial/person.js | 28 - .../examples/globalschemas/gs_example.js | 40 - .../mongoose/examples/globalschemas/person.js | 15 - .../mongoose/examples/lean/lean.js | 64 - .../mongoose/examples/lean/package.json | 14 - .../mongoose/examples/lean/person.js | 17 - .../mongoose/examples/mapreduce/mapreduce.js | 80 - .../mongoose/examples/mapreduce/package.json | 14 - .../mongoose/examples/mapreduce/person.js | 16 - .../population-across-three-collections.js | 135 - .../examples/population/population-basic.js | 95 - .../population/population-of-existing-doc.js | 101 - .../population-of-multiple-existing-docs.js | 112 - .../examples/population/population-options.js | 124 - .../population/population-plain-objects.js | 96 - .../mongoose/examples/promises/package.json | 14 - .../mongoose/examples/promises/person.js | 15 - .../mongoose/examples/promises/promise.js | 73 - .../examples/querybuilder/package.json | 14 - .../mongoose/examples/querybuilder/person.js | 15 - .../examples/querybuilder/querybuilder.js | 65 - .../examples/replicasets/package.json | 14 - .../mongoose/examples/replicasets/person.js | 15 - .../examples/replicasets/replica-sets.js | 56 - .../mongoose/examples/schema/schema.js | 103 - .../schema/storing-schemas-as-json/index.js | 27 - .../storing-schemas-as-json/schema.json | 9 - .../mongoose/examples/statics/person.js | 21 - .../mongoose/examples/statics/statics.js | 38 - Databases/node_modules/mongoose/index.js | 7 - .../node_modules/mongoose/lib/ES6Promise.js | 28 - .../node_modules/mongoose/lib/aggregate.js | 555 - .../node_modules/mongoose/lib/browser.js | 97 - .../mongoose/lib/browserDocument.js | 105 - Databases/node_modules/mongoose/lib/cast.js | 211 - .../node_modules/mongoose/lib/collection.js | 198 - .../node_modules/mongoose/lib/connection.js | 688 - .../mongoose/lib/connectionstate.js | 27 - .../node_modules/mongoose/lib/document.js | 2250 --- .../mongoose/lib/document_provider.js | 20 - .../node_modules/mongoose/lib/drivers/SPEC.md | 4 - .../lib/drivers/browser/ReadPreference.js | 5 - .../mongoose/lib/drivers/browser/binary.js | 12 - .../mongoose/lib/drivers/browser/index.js | 7 - .../mongoose/lib/drivers/browser/objectid.js | 14 - .../mongoose/lib/drivers/index.js | 17 - .../node-mongodb-native/ReadPreference.js | 45 - .../lib/drivers/node-mongodb-native/binary.js | 8 - .../drivers/node-mongodb-native/collection.js | 225 - .../drivers/node-mongodb-native/connection.js | 355 - .../lib/drivers/node-mongodb-native/index.js | 7 - .../drivers/node-mongodb-native/objectid.js | 14 - Databases/node_modules/mongoose/lib/error.js | 51 - .../lib/error/browserMissingSchema.js | 33 - .../node_modules/mongoose/lib/error/cast.js | 38 - .../mongoose/lib/error/divergentArray.js | 42 - .../mongoose/lib/error/messages.js | 43 - .../mongoose/lib/error/missingSchema.js | 33 - .../mongoose/lib/error/overwriteModel.js | 31 - .../mongoose/lib/error/validation.js | 58 - .../mongoose/lib/error/validator.js | 67 - .../mongoose/lib/error/version.js | 32 - Databases/node_modules/mongoose/lib/index.js | 693 - .../node_modules/mongoose/lib/internal.js | 31 - Databases/node_modules/mongoose/lib/model.js | 2958 ---- .../node_modules/mongoose/lib/promise.js | 291 - .../mongoose/lib/promise_provider.js | 51 - Databases/node_modules/mongoose/lib/query.js | 3102 ----- .../node_modules/mongoose/lib/queryhelpers.js | 78 - .../node_modules/mongoose/lib/querystream.js | 346 - Databases/node_modules/mongoose/lib/schema.js | 1181 -- .../node_modules/mongoose/lib/schema/array.js | 394 - .../mongoose/lib/schema/boolean.js | 107 - .../mongoose/lib/schema/buffer.js | 187 - .../node_modules/mongoose/lib/schema/date.js | 298 - .../mongoose/lib/schema/documentarray.js | 248 - .../node_modules/mongoose/lib/schema/index.js | 28 - .../node_modules/mongoose/lib/schema/mixed.js | 91 - .../mongoose/lib/schema/number.js | 278 - .../mongoose/lib/schema/objectid.js | 208 - .../mongoose/lib/schema/string.js | 495 - .../node_modules/mongoose/lib/schematype.js | 800 -- .../mongoose/lib/services/updateValidators.js | 178 - .../node_modules/mongoose/lib/statemachine.js | 178 - .../node_modules/mongoose/lib/types/array.js | 755 - .../node_modules/mongoose/lib/types/buffer.js | 269 - .../mongoose/lib/types/documentarray.js | 223 - .../mongoose/lib/types/embedded.js | 311 - .../node_modules/mongoose/lib/types/index.js | 13 - .../mongoose/lib/types/objectid.js | 13 - Databases/node_modules/mongoose/lib/utils.js | 794 -- .../node_modules/mongoose/lib/virtualtype.js | 103 - .../mongoose/node_modules/async/.travis.yml | 3 - .../mongoose/node_modules/async/LICENSE | 19 - .../mongoose/node_modules/async/README.md | 1646 --- .../node_modules/async/component.json | 11 - .../mongoose/node_modules/async/lib/async.js | 1123 -- .../mongoose/node_modules/async/package.json | 59 - .../mongoose/node_modules/bson/HISTORY | 126 - .../mongoose/node_modules/bson/LICENSE | 201 - .../mongoose/node_modules/bson/README.md | 70 - .../bson/alternate_parsers/bson.js | 1574 --- .../bson/alternate_parsers/faster_bson.js | 429 - .../node_modules/bson/browser_build/bson.js | 4843 ------- .../bson/browser_build/package.json | 8 - .../node_modules/bson/lib/bson/binary.js | 344 - .../bson/lib/bson/binary_parser.js | 385 - .../node_modules/bson/lib/bson/bson.js | 323 - .../node_modules/bson/lib/bson/code.js | 24 - .../node_modules/bson/lib/bson/db_ref.js | 32 - .../node_modules/bson/lib/bson/double.js | 33 - .../bson/lib/bson/float_parser.js | 121 - .../node_modules/bson/lib/bson/index.js | 86 - .../node_modules/bson/lib/bson/long.js | 856 -- .../node_modules/bson/lib/bson/map.js | 126 - .../node_modules/bson/lib/bson/max_key.js | 14 - .../node_modules/bson/lib/bson/min_key.js | 14 - .../node_modules/bson/lib/bson/objectid.js | 278 - .../bson/lib/bson/parser/calculate_size.js | 310 - .../bson/lib/bson/parser/deserializer.js | 555 - .../bson/lib/bson/parser/serializer.js | 912 -- .../node_modules/bson/lib/bson/regexp.js | 30 - .../node_modules/bson/lib/bson/symbol.js | 47 - .../node_modules/bson/lib/bson/timestamp.js | 856 -- .../mongoose/node_modules/bson/package.json | 70 - .../mongoose/node_modules/bson/tools/gleak.js | 21 - .../node_modules/hooks-fixed/.npmignore | 2 - .../node_modules/hooks-fixed/Makefile | 9 - .../node_modules/hooks-fixed/README.md | 369 - .../node_modules/hooks-fixed/hooks.alt.js | 134 - .../node_modules/hooks-fixed/hooks.js | 191 - .../node_modules/hooks-fixed/package.json | 66 - .../mongoose/node_modules/hooks-fixed/test.js | 786 -- .../mongoose/node_modules/kareem/.npmignore | 28 - .../mongoose/node_modules/kareem/.travis.yml | 7 - .../mongoose/node_modules/kareem/LICENSE | 202 - .../mongoose/node_modules/kareem/Makefile | 5 - .../mongoose/node_modules/kareem/README.md | 379 - .../mongoose/node_modules/kareem/docs.js | 37 - .../mongoose/node_modules/kareem/gulpfile.js | 18 - .../mongoose/node_modules/kareem/index.js | 229 - .../mongoose/node_modules/kareem/package.json | 59 - .../node_modules/kareem/test/examples.test.js | 339 - .../node_modules/kareem/test/post.test.js | 46 - .../node_modules/kareem/test/pre.test.js | 226 - .../node_modules/kareem/test/wrap.test.js | 277 - .../mongoose/node_modules/mongodb/HISTORY.md | 1218 -- .../mongoose/node_modules/mongodb/LICENSE | 201 - .../mongoose/node_modules/mongodb/Makefile | 11 - .../mongoose/node_modules/mongodb/README.md | 322 - .../mongoose/node_modules/mongodb/c.js | 24 - .../mongoose/node_modules/mongodb/conf.json | 69 - .../mongoose/node_modules/mongodb/index.js | 47 - .../node_modules/mongodb/lib/admin.js | 581 - .../mongodb/lib/aggregation_cursor.js | 432 - .../mongoose/node_modules/mongodb/lib/apm.js | 571 - .../node_modules/mongodb/lib/bulk/common.js | 393 - .../node_modules/mongodb/lib/bulk/ordered.js | 532 - .../mongodb/lib/bulk/unordered.js | 541 - .../node_modules/mongodb/lib/collection.js | 3128 ----- .../mongodb/lib/command_cursor.js | 296 - .../node_modules/mongodb/lib/cursor.js | 1149 -- .../mongoose/node_modules/mongodb/lib/db.js | 1731 --- .../node_modules/mongodb/lib/gridfs/chunk.js | 237 - .../mongodb/lib/gridfs/grid_store.js | 1919 --- .../node_modules/mongodb/lib/metadata.js | 64 - .../node_modules/mongodb/lib/mongo_client.js | 463 - .../node_modules/mongodb/lib/mongos.js | 491 - .../mongodb/lib/read_preference.js | 104 - .../node_modules/mongodb/lib/replset.js | 555 - .../node_modules/mongodb/lib/server.js | 437 - .../node_modules/mongodb/lib/topology_base.js | 152 - .../node_modules/mongodb/lib/url_parser.js | 295 - .../node_modules/mongodb/lib/utils.js | 234 - .../mongoose/node_modules/mongodb/load.js | 32 - .../node_modules/es6-promise/CHANGELOG.md | 9 - .../mongodb/node_modules/es6-promise/LICENSE | 19 - .../node_modules/es6-promise/README.md | 61 - .../es6-promise/dist/es6-promise.js | 957 -- .../es6-promise/dist/es6-promise.min.js | 9 - .../es6-promise/dist/test/browserify.js | 11631 ---------------- .../es6-promise/dist/test/es6-promise.js | 950 -- .../es6-promise/dist/test/es6-promise.min.js | 1 - .../es6-promise/dist/test/index.html | 25 - .../es6-promise/dist/test/json3.js | 902 -- .../es6-promise/dist/test/mocha.css | 270 - .../es6-promise/dist/test/mocha.js | 6095 -------- .../es6-promise/dist/test/worker.js | 16 - .../es6-promise/lib/es6-promise.umd.js | 18 - .../es6-promise/lib/es6-promise/-internal.js | 250 - .../es6-promise/lib/es6-promise/asap.js | 111 - .../es6-promise/lib/es6-promise/enumerator.js | 113 - .../es6-promise/lib/es6-promise/polyfill.js | 26 - .../es6-promise/lib/es6-promise/promise.js | 408 - .../lib/es6-promise/promise/all.js | 52 - .../lib/es6-promise/promise/race.js | 104 - .../lib/es6-promise/promise/reject.js | 46 - .../lib/es6-promise/promise/resolve.js | 48 - .../es6-promise/lib/es6-promise/utils.js | 22 - .../node_modules/es6-promise/package.json | 88 - .../node_modules/mongodb-core/HISTORY.md | 246 - .../mongodb/node_modules/mongodb-core/LICENSE | 201 - .../node_modules/mongodb-core/Makefile | 11 - .../node_modules/mongodb-core/README.md | 225 - .../node_modules/mongodb-core/TESTING.md | 18 - .../node_modules/mongodb-core/conf.json | 60 - .../node_modules/mongodb-core/index.js | 18 - .../mongodb-core/lib/auth/gssapi.js | 244 - .../mongodb-core/lib/auth/mongocr.js | 160 - .../mongodb-core/lib/auth/plain.js | 150 - .../mongodb-core/lib/auth/scram.js | 317 - .../mongodb-core/lib/auth/sspi.js | 234 - .../mongodb-core/lib/auth/x509.js | 145 - .../mongodb-core/lib/connection/commands.js | 519 - .../mongodb-core/lib/connection/connection.js | 462 - .../mongodb-core/lib/connection/logger.js | 196 - .../mongodb-core/lib/connection/pool.js | 275 - .../mongodb-core/lib/connection/utils.js | 77 - .../node_modules/mongodb-core/lib/cursor.js | 756 - .../node_modules/mongodb-core/lib/error.js | 44 - .../mongodb-core/lib/tools/smoke_plugin.js | 59 - .../lib/topologies/command_result.js | 37 - .../mongodb-core/lib/topologies/mongos.js | 1000 -- .../lib/topologies/read_preference.js | 106 - .../mongodb-core/lib/topologies/replset.js | 1333 -- .../lib/topologies/replset_state.js | 483 - .../mongodb-core/lib/topologies/server.js | 1230 -- .../mongodb-core/lib/topologies/session.js | 93 - .../lib/topologies/strategies/ping.js | 276 - .../lib/wireprotocol/2_4_support.js | 559 - .../lib/wireprotocol/2_6_support.js | 291 - .../lib/wireprotocol/3_2_support.js | 494 - .../mongodb-core/lib/wireprotocol/commands.js | 357 - .../node_modules/kerberos/.travis.yml | 20 - .../node_modules/kerberos/LICENSE | 201 - .../node_modules/kerberos/README.md | 4 - .../node_modules/kerberos/binding.gyp | 46 - .../node_modules/kerberos/build/Makefile | 332 - .../obj.target/kerberos/lib/base64.o.d | 4 - .../obj.target/kerberos/lib/kerberos.o.d | 63 - .../kerberos/lib/kerberos_context.o.d | 62 - .../obj.target/kerberos/lib/kerberosgss.o.d | 16 - .../obj.target/kerberos/lib/worker.o.d | 49 - .../kerberos/build/Release/linker.lock | 0 .../Release/obj.target/kerberos/lib/base64.o | Bin 3600 -> 0 bytes .../obj.target/kerberos/lib/kerberos.o | Bin 69936 -> 0 bytes .../kerberos/lib/kerberos_context.o | Bin 25560 -> 0 bytes .../obj.target/kerberos/lib/kerberosgss.o | Bin 16448 -> 0 bytes .../Release/obj.target/kerberos/lib/worker.o | Bin 2248 -> 0 bytes .../kerberos/build/binding.Makefile | 6 - .../node_modules/kerberos/build/config.gypi | 122 - .../kerberos/build/kerberos.target.mk | 148 - .../node_modules/kerberos/builderror.log | 25 - .../node_modules/kerberos/index.js | 6 - .../kerberos/lib/auth_processes/mongodb.js | 281 - .../node_modules/kerberos/lib/base64.c | 134 - .../node_modules/kerberos/lib/base64.h | 22 - .../node_modules/kerberos/lib/kerberos.cc | 893 -- .../node_modules/kerberos/lib/kerberos.h | 50 - .../node_modules/kerberos/lib/kerberos.js | 164 - .../kerberos/lib/kerberos_context.cc | 134 - .../kerberos/lib/kerberos_context.h | 64 - .../node_modules/kerberos/lib/kerberosgss.c | 931 -- .../node_modules/kerberos/lib/kerberosgss.h | 73 - .../node_modules/kerberos/lib/sspi.js | 15 - .../node_modules/kerberos/lib/win32/base64.c | 121 - .../node_modules/kerberos/lib/win32/base64.h | 18 - .../kerberos/lib/win32/kerberos.cc | 51 - .../kerberos/lib/win32/kerberos.h | 60 - .../kerberos/lib/win32/kerberos_sspi.c | 244 - .../kerberos/lib/win32/kerberos_sspi.h | 106 - .../node_modules/kerberos/lib/win32/worker.cc | 7 - .../node_modules/kerberos/lib/win32/worker.h | 38 - .../lib/win32/wrappers/security_buffer.cc | 101 - .../lib/win32/wrappers/security_buffer.h | 48 - .../lib/win32/wrappers/security_buffer.js | 12 - .../wrappers/security_buffer_descriptor.cc | 182 - .../wrappers/security_buffer_descriptor.h | 46 - .../wrappers/security_buffer_descriptor.js | 3 - .../lib/win32/wrappers/security_context.cc | 856 -- .../lib/win32/wrappers/security_context.h | 74 - .../lib/win32/wrappers/security_context.js | 3 - .../win32/wrappers/security_credentials.cc | 348 - .../lib/win32/wrappers/security_credentials.h | 68 - .../win32/wrappers/security_credentials.js | 22 - .../node_modules/kerberos/lib/worker.cc | 7 - .../node_modules/kerberos/lib/worker.h | 38 - .../kerberos/node_modules/nan/.dntrc | 30 - .../kerberos/node_modules/nan/CHANGELOG.md | 374 - .../kerberos/node_modules/nan/LICENSE.md | 13 - .../kerberos/node_modules/nan/README.md | 367 - .../kerberos/node_modules/nan/appveyor.yml | 38 - .../kerberos/node_modules/nan/doc/.build.sh | 38 - .../node_modules/nan/doc/asyncworker.md | 97 - .../kerberos/node_modules/nan/doc/buffers.md | 54 - .../kerberos/node_modules/nan/doc/callback.md | 52 - .../node_modules/nan/doc/converters.md | 41 - .../kerberos/node_modules/nan/doc/errors.md | 226 - .../node_modules/nan/doc/maybe_types.md | 480 - .../kerberos/node_modules/nan/doc/methods.md | 624 - .../kerberos/node_modules/nan/doc/new.md | 141 - .../node_modules/nan/doc/node_misc.md | 114 - .../node_modules/nan/doc/persistent.md | 292 - .../kerberos/node_modules/nan/doc/scopes.md | 73 - .../kerberos/node_modules/nan/doc/script.md | 38 - .../node_modules/nan/doc/string_bytes.md | 62 - .../node_modules/nan/doc/v8_internals.md | 199 - .../kerberos/node_modules/nan/doc/v8_misc.md | 63 - .../kerberos/node_modules/nan/include_dirs.js | 1 - .../kerberos/node_modules/nan/nan.h | 2136 --- .../kerberos/node_modules/nan/nan_callbacks.h | 88 - .../node_modules/nan/nan_callbacks_12_inl.h | 512 - .../nan/nan_callbacks_pre_12_inl.h | 506 - .../node_modules/nan/nan_converters.h | 64 - .../node_modules/nan/nan_converters_43_inl.h | 42 - .../nan/nan_converters_pre_43_inl.h | 42 - .../nan/nan_implementation_12_inl.h | 399 - .../nan/nan_implementation_pre_12_inl.h | 259 - .../node_modules/nan/nan_maybe_43_inl.h | 224 - .../node_modules/nan/nan_maybe_pre_43_inl.h | 295 - .../kerberos/node_modules/nan/nan_new.h | 332 - .../node_modules/nan/nan_object_wrap.h | 155 - .../node_modules/nan/nan_persistent_12_inl.h | 129 - .../nan/nan_persistent_pre_12_inl.h | 238 - .../node_modules/nan/nan_string_bytes.h | 305 - .../kerberos/node_modules/nan/nan_weak.h | 422 - .../kerberos/node_modules/nan/package.json | 91 - .../kerberos/node_modules/nan/tools/1to2.js | 412 - .../kerberos/node_modules/nan/tools/README.md | 14 - .../node_modules/nan/tools/package.json | 19 - .../node_modules/kerberos/package.json | 55 - .../kerberos/test/kerberos_tests.js | 34 - .../kerberos/test/kerberos_win32_test.js | 15 - .../win32/security_buffer_descriptor_tests.js | 41 - .../test/win32/security_buffer_tests.js | 22 - .../test/win32/security_credentials_tests.js | 55 - .../node_modules/mongodb-core/package.json | 66 - .../simple_2_document_limit_toArray.dat | 11000 --------------- .../node_modules/readable-stream/.npmignore | 5 - .../node_modules/readable-stream/LICENSE | 27 - .../node_modules/readable-stream/README.md | 15 - .../node_modules/readable-stream/duplex.js | 1 - .../readable-stream/lib/_stream_duplex.js | 89 - .../lib/_stream_passthrough.js | 46 - .../readable-stream/lib/_stream_readable.js | 982 -- .../readable-stream/lib/_stream_transform.js | 210 - .../readable-stream/lib/_stream_writable.js | 386 - .../node_modules/core-util-is/README.md | 3 - .../node_modules/core-util-is/float.patch | 604 - .../node_modules/core-util-is/lib/util.js | 107 - .../node_modules/core-util-is/package.json | 54 - .../node_modules/core-util-is/util.js | 106 - .../node_modules/inherits/LICENSE | 16 - .../node_modules/inherits/README.md | 42 - .../node_modules/inherits/inherits.js | 1 - .../node_modules/inherits/inherits_browser.js | 23 - .../node_modules/inherits/package.json | 50 - .../node_modules/inherits/test.js | 25 - .../node_modules/isarray/README.md | 54 - .../node_modules/isarray/build/build.js | 209 - .../node_modules/isarray/component.json | 19 - .../node_modules/isarray/index.js | 3 - .../node_modules/isarray/package.json | 53 - .../node_modules/string_decoder/.npmignore | 2 - .../node_modules/string_decoder/LICENSE | 20 - .../node_modules/string_decoder/README.md | 7 - .../node_modules/string_decoder/index.js | 221 - .../node_modules/string_decoder/package.json | 54 - .../node_modules/readable-stream/package.json | 68 - .../readable-stream/passthrough.js | 1 - .../node_modules/readable-stream/readable.js | 6 - .../node_modules/readable-stream/transform.js | 1 - .../node_modules/readable-stream/writable.js | 1 - .../node_modules/mongodb/package.json | 66 - .../mongoose/node_modules/mongodb/t.js | 73 - .../mongoose/node_modules/mongodb/t1.js | 77 - .../mongoose/node_modules/mongodb/wercker.yml | 19 - .../mongoose/node_modules/mpath/.npmignore | 2 - .../mongoose/node_modules/mpath/.travis.yml | 4 - .../mongoose/node_modules/mpath/History.md | 16 - .../mongoose/node_modules/mpath/LICENSE | 22 - .../mongoose/node_modules/mpath/Makefile | 5 - .../mongoose/node_modules/mpath/README.md | 278 - .../mongoose/node_modules/mpath/index.js | 1 - .../mongoose/node_modules/mpath/lib/index.js | 183 - .../mongoose/node_modules/mpath/package.json | 47 - .../mongoose/node_modules/mpath/test/index.js | 1630 --- .../mongoose/node_modules/mpromise/.npmignore | 4 - .../node_modules/mpromise/.travis.yml | 5 - .../mongoose/node_modules/mpromise/History.md | 74 - .../mongoose/node_modules/mpromise/LICENSE | 22 - .../mongoose/node_modules/mpromise/README.md | 224 - .../node_modules/mpromise/lib/promise.js | 440 - .../node_modules/mpromise/package.json | 60 - .../mpromise/test/promise.domain.test.js | 28 - .../mpromise/test/promise.test.js | 554 - .../mpromise/test/promises.Aplus.js | 15 - .../mongoose/node_modules/mquery/.npmignore | 3 - .../mongoose/node_modules/mquery/.travis.yml | 7 - .../mongoose/node_modules/mquery/History.md | 230 - .../mongoose/node_modules/mquery/LICENSE | 22 - .../mongoose/node_modules/mquery/Makefile | 22 - .../mongoose/node_modules/mquery/README.md | 1220 -- .../mquery/lib/collection/collection.js | 42 - .../mquery/lib/collection/index.js | 13 - .../mquery/lib/collection/node.js | 100 - .../mongoose/node_modules/mquery/lib/env.js | 22 - .../node_modules/mquery/lib/mquery.js | 2612 ---- .../node_modules/mquery/lib/permissions.js | 90 - .../mongoose/node_modules/mquery/lib/utils.js | 331 - .../mquery/node_modules/bluebird/LICENSE | 21 - .../mquery/node_modules/bluebird/README.md | 676 - .../mquery/node_modules/bluebird/changelog.md | 1643 --- .../bluebird/js/browser/bluebird.js | 5105 ------- .../bluebird/js/browser/bluebird.min.js | 31 - .../node_modules/bluebird/js/main/any.js | 21 - .../node_modules/bluebird/js/main/assert.js | 55 - .../node_modules/bluebird/js/main/async.js | 204 - .../node_modules/bluebird/js/main/bind.js | 73 - .../node_modules/bluebird/js/main/bluebird.js | 11 - .../node_modules/bluebird/js/main/call_get.js | 123 - .../node_modules/bluebird/js/main/cancel.js | 48 - .../bluebird/js/main/captured_trace.js | 492 - .../bluebird/js/main/catch_filter.js | 66 - .../node_modules/bluebird/js/main/context.js | 38 - .../bluebird/js/main/debuggability.js | 147 - .../bluebird/js/main/direct_resolve.js | 62 - .../node_modules/bluebird/js/main/each.js | 12 - .../node_modules/bluebird/js/main/errors.js | 111 - .../node_modules/bluebird/js/main/es5.js | 80 - .../node_modules/bluebird/js/main/filter.js | 12 - .../node_modules/bluebird/js/main/finally.js | 99 - .../bluebird/js/main/generators.js | 136 - .../node_modules/bluebird/js/main/join.js | 107 - .../node_modules/bluebird/js/main/map.js | 131 - .../node_modules/bluebird/js/main/method.js | 44 - .../node_modules/bluebird/js/main/nodeify.js | 58 - .../node_modules/bluebird/js/main/progress.js | 76 - .../node_modules/bluebird/js/main/promise.js | 700 - .../bluebird/js/main/promise_array.js | 142 - .../bluebird/js/main/promise_resolver.js | 123 - .../bluebird/js/main/promisify.js | 291 - .../node_modules/bluebird/js/main/props.js | 79 - .../node_modules/bluebird/js/main/queue.js | 90 - .../node_modules/bluebird/js/main/race.js | 47 - .../node_modules/bluebird/js/main/reduce.js | 146 - .../node_modules/bluebird/js/main/schedule.js | 39 - .../node_modules/bluebird/js/main/settle.js | 40 - .../node_modules/bluebird/js/main/some.js | 125 - .../js/main/synchronous_inspection.js | 94 - .../bluebird/js/main/thenables.js | 89 - .../node_modules/bluebird/js/main/timers.js | 58 - .../node_modules/bluebird/js/main/using.js | 202 - .../node_modules/bluebird/js/main/util.js | 280 - .../mquery/node_modules/bluebird/package.json | 96 - .../mquery/node_modules/debug/.jshintrc | 3 - .../mquery/node_modules/debug/.npmignore | 6 - .../mquery/node_modules/debug/History.md | 195 - .../mquery/node_modules/debug/Makefile | 36 - .../mquery/node_modules/debug/Readme.md | 188 - .../mquery/node_modules/debug/bower.json | 28 - .../mquery/node_modules/debug/browser.js | 168 - .../mquery/node_modules/debug/component.json | 19 - .../mquery/node_modules/debug/debug.js | 197 - .../mquery/node_modules/debug/node.js | 209 - .../debug/node_modules/ms/.npmignore | 5 - .../debug/node_modules/ms/History.md | 66 - .../debug/node_modules/ms/LICENSE | 20 - .../debug/node_modules/ms/README.md | 35 - .../debug/node_modules/ms/index.js | 125 - .../debug/node_modules/ms/package.json | 48 - .../mquery/node_modules/debug/package.json | 73 - .../mongoose/node_modules/mquery/package.json | 68 - .../mquery/test/collection/browser.js | 0 .../mquery/test/collection/mongo.js | 0 .../mquery/test/collection/node.js | 29 - .../mongoose/node_modules/mquery/test/env.js | 20 - .../node_modules/mquery/test/index.js | 2875 ---- .../node_modules/mquery/test/utils.test.js | 143 - .../mongoose/node_modules/ms/.npmignore | 1 - .../mongoose/node_modules/ms/Makefile | 8 - .../mongoose/node_modules/ms/README.md | 65 - .../mongoose/node_modules/ms/ms.js | 35 - .../mongoose/node_modules/ms/package.json | 38 - .../mongoose/node_modules/ms/test/index.html | 19 - .../node_modules/ms/test/support/jquery.js | 9266 ------------ .../mongoose/node_modules/ms/test/test.js | 61 - .../mongoose/node_modules/muri/.npmignore | 2 - .../mongoose/node_modules/muri/.travis.yml | 4 - .../mongoose/node_modules/muri/History.md | 52 - .../mongoose/node_modules/muri/LICENSE | 22 - .../mongoose/node_modules/muri/Makefile | 5 - .../mongoose/node_modules/muri/README.md | 46 - .../mongoose/node_modules/muri/index.js | 1 - .../mongoose/node_modules/muri/lib/index.js | 235 - .../mongoose/node_modules/muri/package.json | 50 - .../mongoose/node_modules/muri/strict.js | 3 - .../mongoose/node_modules/muri/test/index.js | 312 - .../node_modules/regexp-clone/.npmignore | 2 - .../node_modules/regexp-clone/.travis.yml | 5 - .../node_modules/regexp-clone/History.md | 5 - .../node_modules/regexp-clone/LICENSE | 22 - .../node_modules/regexp-clone/Makefile | 5 - .../node_modules/regexp-clone/README.md | 18 - .../node_modules/regexp-clone/index.js | 20 - .../node_modules/regexp-clone/package.json | 47 - .../node_modules/regexp-clone/test/index.js | 112 - .../mongoose/node_modules/sliced/.npmignore | 2 - .../mongoose/node_modules/sliced/.travis.yml | 4 - .../mongoose/node_modules/sliced/History.md | 30 - .../mongoose/node_modules/sliced/LICENSE | 22 - .../mongoose/node_modules/sliced/Makefile | 5 - .../mongoose/node_modules/sliced/README.md | 62 - .../mongoose/node_modules/sliced/bench.js | 95 - .../node_modules/sliced/component.json | 14 - .../mongoose/node_modules/sliced/index.js | 1 - .../node_modules/sliced/lib/sliced.js | 33 - .../mongoose/node_modules/sliced/package.json | 47 - .../node_modules/sliced/test/index.js | 80 - Databases/node_modules/mongoose/package.json | 126 - .../node_modules/mongoose/release-items.md | 29 - Databases/node_modules/mongoose/static.js | 26 - Databases/node_modules/mongoose/website.js | 79 - DeployingDemo/node_modules/ejs/Jakefile | 45 - DeployingDemo/node_modules/ejs/README.md | 181 - DeployingDemo/node_modules/ejs/ejs.js | 1228 -- DeployingDemo/node_modules/ejs/ejs.min.js | 1 - DeployingDemo/node_modules/ejs/lib/ejs.js | 749 - DeployingDemo/node_modules/ejs/lib/utils.js | 141 - DeployingDemo/node_modules/ejs/package.json | 77 - DeployingDemo/node_modules/ejs/test/ejs.js | 894 -- .../ejs/test/fixtures/backslash.ejs | 1 - .../ejs/test/fixtures/backslash.html | 1 - .../ejs/test/fixtures/comments.ejs | 7 - .../ejs/test/fixtures/comments.html | 6 - .../ejs/test/fixtures/consecutive-tags.ejs | 1 - .../ejs/test/fixtures/consecutive-tags.html | 1 - .../ejs/test/fixtures/double-quote.ejs | 1 - .../ejs/test/fixtures/double-quote.html | 1 - .../node_modules/ejs/test/fixtures/error.ejs | 5 - .../node_modules/ejs/test/fixtures/error.out | 8 - .../node_modules/ejs/test/fixtures/fail.ejs | 1 - .../ejs/test/fixtures/hello-world.ejs | 1 - .../ejs/test/fixtures/include-abspath.ejs | 5 - .../ejs/test/fixtures/include-simple.ejs | 3 - .../ejs/test/fixtures/include-simple.html | 4 - .../ejs/test/fixtures/include.css.ejs | 1 - .../ejs/test/fixtures/include.css.html | 4 - .../ejs/test/fixtures/include.ejs | 5 - .../ejs/test/fixtures/include.html | 12 - .../ejs/test/fixtures/include_cache.ejs | 1 - .../ejs/test/fixtures/include_cache.html | 1 - .../fixtures/include_preprocessor.css.ejs | 1 - .../fixtures/include_preprocessor.css.html | 4 - .../test/fixtures/include_preprocessor.ejs | 5 - .../test/fixtures/include_preprocessor.html | 12 - .../fixtures/include_preprocessor_cache.ejs | 1 - .../fixtures/include_preprocessor_cache.html | 1 - .../ejs/test/fixtures/includes/bom.ejs | 1 - .../ejs/test/fixtures/includes/menu-item.ejs | 1 - .../ejs/test/fixtures/includes/menu/item.ejs | 1 - .../ejs/test/fixtures/literal.ejs | 3 - .../ejs/test/fixtures/literal.html | 3 - .../node_modules/ejs/test/fixtures/menu.ejs | 15 - .../node_modules/ejs/test/fixtures/menu.html | 9 - .../ejs/test/fixtures/menu_preprocessor.ejs | 11 - .../ejs/test/fixtures/menu_preprocessor.html | 8 - .../ejs/test/fixtures/menu_var.ejs | 15 - .../node_modules/ejs/test/fixtures/messed.ejs | 1 - .../ejs/test/fixtures/messed.html | 1 - .../ejs/test/fixtures/newlines.ejs | 5 - .../ejs/test/fixtures/newlines.html | 9 - .../ejs/test/fixtures/newlines.mixed.ejs | 6 - .../ejs/test/fixtures/newlines.mixed.html | 4 - .../ejs/test/fixtures/no.newlines.ejs | 5 - .../ejs/test/fixtures/no.newlines.error.ejs | 5 - .../ejs/test/fixtures/no.newlines.html | 5 - .../ejs/test/fixtures/no.semicolons.ejs | 8 - .../ejs/test/fixtures/no.semicolons.html | 3 - .../node_modules/ejs/test/fixtures/para.ejs | 1 - .../node_modules/ejs/test/fixtures/pet.ejs | 1 - .../ejs/test/fixtures/rmWhitespace.ejs | 14 - .../ejs/test/fixtures/rmWhitespace.html | 8 - .../ejs/test/fixtures/single-quote.ejs | 1 - .../ejs/test/fixtures/single-quote.html | 1 - .../ejs/test/fixtures/space-and-tab-slurp.ejs | 5 - .../test/fixtures/space-and-tab-slurp.html | 5 - .../node_modules/ejs/test/fixtures/style.css | 3 - .../ejs/test/fixtures/user-no-with.ejs | 1 - .../node_modules/ejs/test/fixtures/user.ejs | 1 - .../ejs/test/fixtures/with-context.ejs | 1 - .../node_modules/ejs/test/mocha.opts | 3 - .../node_modules/ejs/test/tmp/include.ejs | 1 - .../ejs/test/tmp/include_preprocessor.ejs | 1 - .../node_modules/ejs/test/tmp/renderFile.ejs | 1 - DeployingDemo/node_modules/express/History.md | 3062 ---- DeployingDemo/node_modules/express/LICENSE | 24 - DeployingDemo/node_modules/express/Readme.md | 138 - DeployingDemo/node_modules/express/index.js | 11 - .../node_modules/express/lib/application.js | 643 - .../node_modules/express/lib/express.js | 103 - .../express/lib/middleware/init.js | 36 - .../express/lib/middleware/query.js | 51 - .../node_modules/express/lib/request.js | 489 - .../node_modules/express/lib/response.js | 1053 -- .../node_modules/express/lib/router/index.js | 645 - .../node_modules/express/lib/router/layer.js | 176 - .../node_modules/express/lib/router/route.js | 210 - .../node_modules/express/lib/utils.js | 300 - .../node_modules/express/lib/view.js | 173 - .../express/node_modules/accepts/HISTORY.md | 170 - .../express/node_modules/accepts/LICENSE | 23 - .../express/node_modules/accepts/README.md | 135 - .../express/node_modules/accepts/index.js | 231 - .../node_modules/mime-types/HISTORY.md | 183 - .../accepts/node_modules/mime-types/LICENSE | 23 - .../accepts/node_modules/mime-types/README.md | 103 - .../accepts/node_modules/mime-types/index.js | 188 - .../node_modules/mime-db/HISTORY.md | 306 - .../mime-types/node_modules/mime-db/LICENSE | 22 - .../mime-types/node_modules/mime-db/README.md | 82 - .../mime-types/node_modules/mime-db/db.json | 6552 --------- .../mime-types/node_modules/mime-db/index.js | 11 - .../node_modules/mime-db/package.json | 93 - .../node_modules/mime-types/package.json | 83 - .../node_modules/negotiator/HISTORY.md | 76 - .../accepts/node_modules/negotiator/LICENSE | 24 - .../accepts/node_modules/negotiator/README.md | 203 - .../accepts/node_modules/negotiator/index.js | 62 - .../node_modules/negotiator/lib/charset.js | 102 - .../node_modules/negotiator/lib/encoding.js | 118 - .../node_modules/negotiator/lib/language.js | 112 - .../node_modules/negotiator/lib/mediaType.js | 179 - .../node_modules/negotiator/package.json | 85 - .../express/node_modules/accepts/package.json | 98 - .../node_modules/array-flatten/LICENSE | 21 - .../node_modules/array-flatten/README.md | 43 - .../array-flatten/array-flatten.js | 64 - .../node_modules/array-flatten/package.json | 61 - .../content-disposition/HISTORY.md | 45 - .../node_modules/content-disposition/LICENSE | 22 - .../content-disposition/README.md | 141 - .../node_modules/content-disposition/index.js | 445 - .../content-disposition/package.json | 65 - .../node_modules/content-type/HISTORY.md | 9 - .../express/node_modules/content-type/LICENSE | 22 - .../node_modules/content-type/README.md | 92 - .../node_modules/content-type/index.js | 214 - .../node_modules/content-type/package.json | 65 - .../node_modules/cookie-signature/.npmignore | 4 - .../node_modules/cookie-signature/History.md | 38 - .../node_modules/cookie-signature/Readme.md | 42 - .../node_modules/cookie-signature/index.js | 51 - .../cookie-signature/package.json | 58 - .../express/node_modules/cookie/HISTORY.md | 72 - .../express/node_modules/cookie/LICENSE | 24 - .../express/node_modules/cookie/README.md | 64 - .../express/node_modules/cookie/index.js | 156 - .../express/node_modules/cookie/package.json | 75 - .../express/node_modules/debug/.jshintrc | 3 - .../express/node_modules/debug/.npmignore | 6 - .../express/node_modules/debug/History.md | 195 - .../express/node_modules/debug/Makefile | 36 - .../express/node_modules/debug/Readme.md | 188 - .../express/node_modules/debug/bower.json | 28 - .../express/node_modules/debug/browser.js | 168 - .../express/node_modules/debug/component.json | 19 - .../express/node_modules/debug/debug.js | 197 - .../express/node_modules/debug/node.js | 209 - .../debug/node_modules/ms/.npmignore | 5 - .../debug/node_modules/ms/History.md | 66 - .../debug/node_modules/ms/LICENSE | 20 - .../debug/node_modules/ms/README.md | 35 - .../debug/node_modules/ms/index.js | 125 - .../debug/node_modules/ms/package.json | 47 - .../express/node_modules/debug/package.json | 73 - .../express/node_modules/depd/History.md | 84 - .../express/node_modules/depd/LICENSE | 22 - .../express/node_modules/depd/Readme.md | 281 - .../express/node_modules/depd/index.js | 521 - .../node_modules/depd/lib/browser/index.js | 79 - .../depd/lib/compat/buffer-concat.js | 35 - .../depd/lib/compat/callsite-tostring.js | 103 - .../depd/lib/compat/event-listener-count.js | 22 - .../node_modules/depd/lib/compat/index.js | 84 - .../express/node_modules/depd/package.json | 67 - .../express/node_modules/escape-html/LICENSE | 24 - .../node_modules/escape-html/Readme.md | 43 - .../express/node_modules/escape-html/index.js | 78 - .../node_modules/escape-html/package.json | 56 - .../express/node_modules/etag/HISTORY.md | 71 - .../express/node_modules/etag/LICENSE | 22 - .../express/node_modules/etag/README.md | 165 - .../express/node_modules/etag/index.js | 132 - .../express/node_modules/etag/package.json | 73 - .../node_modules/finalhandler/HISTORY.md | 98 - .../express/node_modules/finalhandler/LICENSE | 22 - .../node_modules/finalhandler/README.md | 133 - .../node_modules/finalhandler/index.js | 151 - .../node_modules/unpipe/HISTORY.md | 4 - .../finalhandler/node_modules/unpipe/LICENSE | 22 - .../node_modules/unpipe/README.md | 43 - .../finalhandler/node_modules/unpipe/index.js | 69 - .../node_modules/unpipe/package.json | 59 - .../node_modules/finalhandler/package.json | 80 - .../express/node_modules/fresh/HISTORY.md | 38 - .../express/node_modules/fresh/LICENSE | 22 - .../express/node_modules/fresh/README.md | 58 - .../express/node_modules/fresh/index.js | 57 - .../express/node_modules/fresh/package.json | 86 - .../node_modules/merge-descriptors/HISTORY.md | 21 - .../node_modules/merge-descriptors/LICENSE | 23 - .../node_modules/merge-descriptors/README.md | 48 - .../node_modules/merge-descriptors/index.js | 60 - .../merge-descriptors/package.json | 137 - .../express/node_modules/methods/HISTORY.md | 29 - .../express/node_modules/methods/LICENSE | 24 - .../express/node_modules/methods/README.md | 51 - .../express/node_modules/methods/index.js | 69 - .../express/node_modules/methods/package.json | 87 - .../node_modules/on-finished/HISTORY.md | 88 - .../express/node_modules/on-finished/LICENSE | 23 - .../node_modules/on-finished/README.md | 154 - .../express/node_modules/on-finished/index.js | 196 - .../on-finished/node_modules/ee-first/LICENSE | 22 - .../node_modules/ee-first/README.md | 80 - .../node_modules/ee-first/index.js | 95 - .../node_modules/ee-first/package.json | 63 - .../node_modules/on-finished/package.json | 71 - .../express/node_modules/parseurl/HISTORY.md | 47 - .../express/node_modules/parseurl/LICENSE | 24 - .../express/node_modules/parseurl/README.md | 120 - .../express/node_modules/parseurl/index.js | 138 - .../node_modules/parseurl/package.json | 88 - .../node_modules/path-to-regexp/History.md | 36 - .../node_modules/path-to-regexp/LICENSE | 21 - .../node_modules/path-to-regexp/Readme.md | 35 - .../node_modules/path-to-regexp/index.js | 129 - .../node_modules/path-to-regexp/package.json | 184 - .../node_modules/proxy-addr/HISTORY.md | 80 - .../express/node_modules/proxy-addr/LICENSE | 22 - .../express/node_modules/proxy-addr/README.md | 137 - .../express/node_modules/proxy-addr/index.js | 347 - .../node_modules/forwarded/HISTORY.md | 4 - .../proxy-addr/node_modules/forwarded/LICENSE | 22 - .../node_modules/forwarded/README.md | 53 - .../node_modules/forwarded/index.js | 35 - .../node_modules/forwarded/package.json | 65 - .../node_modules/ipaddr.js/.npmignore | 2 - .../node_modules/ipaddr.js/.travis.yml | 10 - .../node_modules/ipaddr.js/Cakefile | 18 - .../proxy-addr/node_modules/ipaddr.js/LICENSE | 19 - .../node_modules/ipaddr.js/README.md | 161 - .../node_modules/ipaddr.js/bower.json | 29 - .../node_modules/ipaddr.js/ipaddr.min.js | 1 - .../node_modules/ipaddr.js/lib/ipaddr.js | 467 - .../node_modules/ipaddr.js/package.json | 58 - .../node_modules/ipaddr.js/src/ipaddr.coffee | 396 - .../ipaddr.js/test/ipaddr.test.coffee | 282 - .../node_modules/proxy-addr/package.json | 89 - .../express/node_modules/qs/.eslintignore | 1 - .../express/node_modules/qs/.npmignore | 19 - .../express/node_modules/qs/.travis.yml | 6 - .../express/node_modules/qs/CHANGELOG.md | 88 - .../express/node_modules/qs/CONTRIBUTING.md | 1 - .../express/node_modules/qs/LICENSE | 28 - .../express/node_modules/qs/README.md | 317 - .../express/node_modules/qs/bower.json | 22 - .../express/node_modules/qs/lib/index.js | 15 - .../express/node_modules/qs/lib/parse.js | 186 - .../express/node_modules/qs/lib/stringify.js | 121 - .../express/node_modules/qs/lib/utils.js | 190 - .../express/node_modules/qs/package.json | 56 - .../express/node_modules/qs/test/parse.js | 478 - .../express/node_modules/qs/test/stringify.js | 259 - .../express/node_modules/qs/test/utils.js | 28 - .../node_modules/range-parser/HISTORY.md | 40 - .../express/node_modules/range-parser/LICENSE | 22 - .../node_modules/range-parser/README.md | 57 - .../node_modules/range-parser/index.js | 63 - .../node_modules/range-parser/package.json | 75 - .../express/node_modules/send/HISTORY.md | 310 - .../express/node_modules/send/LICENSE | 23 - .../express/node_modules/send/README.md | 195 - .../express/node_modules/send/index.js | 820 -- .../node_modules/send/node_modules/.bin/mime | 1 - .../send/node_modules/destroy/LICENSE | 22 - .../send/node_modules/destroy/README.md | 60 - .../send/node_modules/destroy/index.js | 75 - .../send/node_modules/destroy/package.json | 71 - .../send/node_modules/http-errors/HISTORY.md | 76 - .../send/node_modules/http-errors/LICENSE | 22 - .../send/node_modules/http-errors/README.md | 63 - .../send/node_modules/http-errors/index.js | 120 - .../http-errors/node_modules/inherits/LICENSE | 16 - .../node_modules/inherits/README.md | 42 - .../node_modules/inherits/inherits.js | 1 - .../node_modules/inherits/inherits_browser.js | 23 - .../node_modules/inherits/package.json | 50 - .../http-errors/node_modules/inherits/test.js | 25 - .../node_modules/http-errors/package.json | 85 - .../send/node_modules/mime/.npmignore | 0 .../send/node_modules/mime/LICENSE | 19 - .../send/node_modules/mime/README.md | 90 - .../send/node_modules/mime/build/build.js | 11 - .../send/node_modules/mime/build/test.js | 57 - .../send/node_modules/mime/cli.js | 8 - .../send/node_modules/mime/mime.js | 108 - .../send/node_modules/mime/package.json | 72 - .../send/node_modules/mime/types.json | 1 - .../send/node_modules/ms/.npmignore | 5 - .../send/node_modules/ms/History.md | 66 - .../node_modules/send/node_modules/ms/LICENSE | 20 - .../send/node_modules/ms/README.md | 35 - .../send/node_modules/ms/index.js | 125 - .../send/node_modules/ms/package.json | 47 - .../send/node_modules/statuses/LICENSE | 22 - .../send/node_modules/statuses/README.md | 114 - .../send/node_modules/statuses/codes.json | 64 - .../send/node_modules/statuses/index.js | 60 - .../send/node_modules/statuses/package.json | 84 - .../express/node_modules/send/package.json | 88 - .../node_modules/serve-static/HISTORY.md | 303 - .../express/node_modules/serve-static/LICENSE | 25 - .../node_modules/serve-static/README.md | 236 - .../node_modules/serve-static/index.js | 187 - .../node_modules/serve-static/package.json | 82 - .../express/node_modules/type-is/HISTORY.md | 192 - .../express/node_modules/type-is/LICENSE | 23 - .../express/node_modules/type-is/README.md | 136 - .../express/node_modules/type-is/index.js | 262 - .../node_modules/media-typer/HISTORY.md | 22 - .../type-is/node_modules/media-typer/LICENSE | 22 - .../node_modules/media-typer/README.md | 81 - .../type-is/node_modules/media-typer/index.js | 270 - .../node_modules/media-typer/package.json | 57 - .../node_modules/mime-types/HISTORY.md | 183 - .../type-is/node_modules/mime-types/LICENSE | 23 - .../type-is/node_modules/mime-types/README.md | 103 - .../type-is/node_modules/mime-types/index.js | 188 - .../node_modules/mime-db/HISTORY.md | 306 - .../mime-types/node_modules/mime-db/LICENSE | 22 - .../mime-types/node_modules/mime-db/README.md | 82 - .../mime-types/node_modules/mime-db/db.json | 6552 --------- .../mime-types/node_modules/mime-db/index.js | 11 - .../node_modules/mime-db/package.json | 93 - .../node_modules/mime-types/package.json | 83 - .../express/node_modules/type-is/package.json | 80 - .../node_modules/utils-merge/.travis.yml | 6 - .../express/node_modules/utils-merge/LICENSE | 20 - .../node_modules/utils-merge/README.md | 34 - .../express/node_modules/utils-merge/index.js | 23 - .../node_modules/utils-merge/package.json | 60 - .../express/node_modules/vary/HISTORY.md | 23 - .../express/node_modules/vary/LICENSE | 22 - .../express/node_modules/vary/README.md | 91 - .../express/node_modules/vary/index.js | 117 - .../express/node_modules/vary/package.json | 72 - .../node_modules/express/package.json | 142 - 2295 files changed, 35 insertions(+), 457502 deletions(-) delete mode 100644 .c9/.nakignore delete mode 100644 .c9/metadata/tab16 delete mode 100644 .c9/metadata/tab18 delete mode 100644 .c9/metadata/workspace/APIs/first_request.js delete mode 100644 .c9/metadata/workspace/APIs/movie_search_app/app.js delete mode 100644 .c9/metadata/workspace/APIs/movie_search_app/views/results.ejs delete mode 100644 .c9/metadata/workspace/APIs/movie_search_app/views/search.ejs delete mode 100644 .c9/metadata/workspace/Associations/embed.js delete mode 100644 .c9/metadata/workspace/Associations/models/post.js delete mode 100644 .c9/metadata/workspace/Associations/models/user.js delete mode 100644 .c9/metadata/workspace/Associations/readme.md delete mode 100644 .c9/metadata/workspace/Associations/references.js delete mode 100644 .c9/metadata/workspace/Authentication/AuthDemo/app.js delete mode 100644 .c9/metadata/workspace/Authentication/AuthDemo/models/user.js delete mode 100644 .c9/metadata/workspace/Authentication/AuthDemo/package.json delete mode 100644 .c9/metadata/workspace/Authentication/AuthDemo/views/home.ejs delete mode 100644 .c9/metadata/workspace/Authentication/AuthDemo/views/login.ejs delete mode 100644 .c9/metadata/workspace/Authentication/AuthDemo/views/register.ejs delete mode 100644 .c9/metadata/workspace/Authentication/AuthDemo/views/secret.ejs delete mode 100644 .c9/metadata/workspace/Authentication/readme.md delete mode 100644 .c9/metadata/workspace/Databases/cats.js delete mode 100644 .c9/metadata/workspace/Databases/readme.md delete mode 100644 .c9/metadata/workspace/DeployingDemo/app.js delete mode 100644 .c9/metadata/workspace/DeployingDemo/package.json delete mode 100644 .c9/metadata/workspace/DeployingDemo/views/about.ejs delete mode 100644 .c9/metadata/workspace/DeployingDemo/views/home.ejs delete mode 100644 .c9/metadata/workspace/Git/demo/main.js delete mode 100644 .c9/metadata/workspace/Git/demo/meh.js delete mode 100644 .c9/metadata/workspace/Git/git_intro/app.js delete mode 100644 .c9/metadata/workspace/Git/git_intro/cats.js delete mode 100644 .c9/metadata/workspace/Git/git_intro/dogs.js delete mode 100644 .c9/metadata/workspace/IntroToCommandLine/hello.html delete mode 100644 .c9/metadata/workspace/IntroToCommandLine/message.txt delete mode 100644 .c9/metadata/workspace/IntroToComnandLine/message.txt delete mode 100644 .c9/metadata/workspace/IntroToExpress/Assignment/solution/app.js delete mode 100644 .c9/metadata/workspace/IntroToExpress/Assignment/solution/package.json delete mode 100644 .c9/metadata/workspace/IntroToExpress/FirstExpressApp/app.js delete mode 100644 .c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/index.js delete mode 100644 .c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/layer.js delete mode 100644 .c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/package.json delete mode 100644 .c9/metadata/workspace/IntroToExpress/objectives.md delete mode 100644 .c9/metadata/workspace/IntroToNPM/DemoApp/app.js delete mode 100644 .c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/cats.js delete mode 100644 .c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/index.js delete mode 100644 .c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/package.json delete mode 100644 .c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/knock-knock-jokes/index.js delete mode 100644 .c9/metadata/workspace/IntroToNPM/FakerApp/app.js delete mode 100644 .c9/metadata/workspace/IntroToNPM/MyShop/listProducts.js delete mode 100644 .c9/metadata/workspace/IntroToNPM/exercise.md delete mode 100644 .c9/metadata/workspace/IntroToNPM/objectives.md delete mode 100644 .c9/metadata/workspace/IntroToNode/echo.js delete mode 100644 .c9/metadata/workspace/IntroToNode/exercise.js delete mode 100644 .c9/metadata/workspace/IntroToNode/exercise2.js delete mode 100644 .c9/metadata/workspace/IntroToNode/grader.js delete mode 100644 .c9/metadata/workspace/IntroToNode/hello.js delete mode 100644 .c9/metadata/workspace/IntroToNode/hello.rb delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/app.js delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/package.json delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/public/app.css delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/views/home.ejs delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/views/love.ejs delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/footer.ejs delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/MoreExpress/EJSDemo/views/posts.ejs delete mode 100644 .c9/metadata/workspace/MoreExpress/PostRequestDemo/app.js delete mode 100644 .c9/metadata/workspace/MoreExpress/PostRequestDemo/views/friends.ejs delete mode 100644 .c9/metadata/workspace/MoreExpress/PostRequestDemo/views/home.ejs delete mode 100644 .c9/metadata/workspace/MoreExpress/readme.md delete mode 100644 .c9/metadata/workspace/RESTful Routing/BlogSolution/app.js delete mode 100644 .c9/metadata/workspace/RESTful Routing/BlogSolution/public/app.css delete mode 100644 .c9/metadata/workspace/RESTful Routing/BlogSolution/views/index.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/BlogSolution/views/new.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/BlogSolution/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/BlogSolution/views/show.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/app.js delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/public/stylesheets/app.css delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/views/edit.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/views/index.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/views/new.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/views/partials/footer.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/RESTfulBlogApp/views/show.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/app.js delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/public/app.css delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/views/edit.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/views/index.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/views/new.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/views/partials/footer.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/SemanticBlog/views/show.ejs delete mode 100644 .c9/metadata/workspace/RESTful Routing/chart.html delete mode 100644 .c9/metadata/workspace/RESTful Routing/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/middleware/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/models/comment.js delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/models/user.js delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/public/scripts/background.js delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/public/stylesheets/landing.css delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/public/stylesheets/main.css delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/routes/campgrounds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/routes/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/campgrounds/edit.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/campgrounds/index.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/campgrounds/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/campgrounds/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/comments/edit.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/comments/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/landing.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/login.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/partials/footer.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/Final/views/register.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/package.json delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/views/campgrounds.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/views/landing.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/views/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/views/partials/footer.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v1/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/middleware/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/models/campground.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/models/comment.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/models/user.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/node_modules/express/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/public/stylesheets/main.css delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/routes/campgrounds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/routes/comments.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/views/campgrounds/edit.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/views/campgrounds/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/views/campgrounds/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/views/comments/edit.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v10/views/comments/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/middleware/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/routes/campgrounds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/routes/comments.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/routes/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/views/login.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v11/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v11Deployed/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v11Deployed/package.json delete mode 100644 .c9/metadata/workspace/YelpCamp/v2/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v2/package.json delete mode 100644 .c9/metadata/workspace/YelpCamp/v2/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v2/views/campgrounds.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v2/views/index.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v2/views/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v2/views/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v3/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v3/models/campground.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v3/models/comment.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v3/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v3/seeds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v3/views/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v4/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v4/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v4/seeds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v4/views/campgrounds/index.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v4/views/campgrounds/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v4/views/campgrounds/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v4/views/comments/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v5/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v5/public/stylesheets/main.css delete mode 100644 .c9/metadata/workspace/YelpCamp/v5/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v5/seeds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v5/views/campgrounds/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v5/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/models/user.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/package.json delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/seeds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/views/campgrounds/index.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/views/login.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/views/partials/header.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v6/views/register.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v7/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v7/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v7/routes/campgrounds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v7/routes/comments.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v7/routes/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/models/campground.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/models/comment.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/routes/comments.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/seeds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/views/campgrounds/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/views/comments/new.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v8/views/landing.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/app.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/models/campground.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/readme.md delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/routes/campgrounds.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/routes/comments.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/routes/index.js delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/views/campgrounds/index.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/views/campgrounds/show.ejs delete mode 100644 .c9/metadata/workspace/YelpCamp/v9/views/landing.ejs delete mode 100644 .c9/project.settings create mode 100644 .gitignore delete mode 100644 APIs/node_modules/request/.eslintrc delete mode 100644 APIs/node_modules/request/.npmignore delete mode 100644 APIs/node_modules/request/.travis.yml delete mode 100644 APIs/node_modules/request/CHANGELOG.md delete mode 100644 APIs/node_modules/request/CONTRIBUTING.md delete mode 100644 APIs/node_modules/request/LICENSE delete mode 100644 APIs/node_modules/request/README.md delete mode 100755 APIs/node_modules/request/index.js delete mode 100644 APIs/node_modules/request/lib/auth.js delete mode 100644 APIs/node_modules/request/lib/cookies.js delete mode 100644 APIs/node_modules/request/lib/getProxyFromURI.js delete mode 100644 APIs/node_modules/request/lib/har.js delete mode 100644 APIs/node_modules/request/lib/helpers.js delete mode 100644 APIs/node_modules/request/lib/multipart.js delete mode 100644 APIs/node_modules/request/lib/oauth.js delete mode 100644 APIs/node_modules/request/lib/querystring.js delete mode 100644 APIs/node_modules/request/lib/redirect.js delete mode 100644 APIs/node_modules/request/lib/tunnel.js delete mode 120000 APIs/node_modules/request/node_modules/.bin/har-validator delete mode 120000 APIs/node_modules/request/node_modules/.bin/uuid delete mode 100644 APIs/node_modules/request/node_modules/aws-sign2/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/aws-sign2/README.md delete mode 100644 APIs/node_modules/request/node_modules/aws-sign2/index.js delete mode 100644 APIs/node_modules/request/node_modules/aws-sign2/package.json delete mode 100644 APIs/node_modules/request/node_modules/aws4/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/aws4/.tern-port delete mode 100644 APIs/node_modules/request/node_modules/aws4/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/aws4/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/aws4/README.md delete mode 100644 APIs/node_modules/request/node_modules/aws4/aws4.js delete mode 100644 APIs/node_modules/request/node_modules/aws4/lru.js delete mode 100644 APIs/node_modules/request/node_modules/aws4/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/.jshintrc delete mode 100644 APIs/node_modules/request/node_modules/bl/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/bl/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/bl/LICENSE.md delete mode 100644 APIs/node_modules/request/node_modules/bl/README.md delete mode 100644 APIs/node_modules/request/node_modules/bl/bl.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/README.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits_browser.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/test.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/Makefile delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/test.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/license.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js delete mode 100644 APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js delete mode 100644 APIs/node_modules/request/node_modules/bl/package.json delete mode 100644 APIs/node_modules/request/node_modules/bl/test/test.js delete mode 100644 APIs/node_modules/request/node_modules/caseless/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/caseless/README.md delete mode 100644 APIs/node_modules/request/node_modules/caseless/index.js delete mode 100644 APIs/node_modules/request/node_modules/caseless/package.json delete mode 100644 APIs/node_modules/request/node_modules/caseless/test.js delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/License delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/Readme.md delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/lib/combined_stream.js delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/License delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Makefile delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Readme.md delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/package.json delete mode 100644 APIs/node_modules/request/node_modules/combined-stream/package.json delete mode 100644 APIs/node_modules/request/node_modules/extend/.eslintrc delete mode 100644 APIs/node_modules/request/node_modules/extend/.jscs.json delete mode 100644 APIs/node_modules/request/node_modules/extend/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/extend/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/extend/CHANGELOG.md delete mode 100644 APIs/node_modules/request/node_modules/extend/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/extend/README.md delete mode 100644 APIs/node_modules/request/node_modules/extend/component.json delete mode 100644 APIs/node_modules/request/node_modules/extend/index.js delete mode 100644 APIs/node_modules/request/node_modules/extend/package.json delete mode 100644 APIs/node_modules/request/node_modules/forever-agent/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/forever-agent/README.md delete mode 100644 APIs/node_modules/request/node_modules/forever-agent/index.js delete mode 100644 APIs/node_modules/request/node_modules/forever-agent/package.json delete mode 100644 APIs/node_modules/request/node_modules/form-data/.dockerignore delete mode 100644 APIs/node_modules/request/node_modules/form-data/.editorconfig delete mode 100644 APIs/node_modules/request/node_modules/form-data/.eslintignore delete mode 100644 APIs/node_modules/request/node_modules/form-data/.eslintrc delete mode 100644 APIs/node_modules/request/node_modules/form-data/License delete mode 100644 APIs/node_modules/request/node_modules/form-data/README.md delete mode 100644 APIs/node_modules/request/node_modules/form-data/lib/browser.js delete mode 100644 APIs/node_modules/request/node_modules/form-data/lib/form_data.js delete mode 100644 APIs/node_modules/request/node_modules/form-data/lib/populate.js delete mode 100644 APIs/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md delete mode 100644 APIs/node_modules/request/node_modules/form-data/node_modules/async/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/form-data/node_modules/async/README.md delete mode 100644 APIs/node_modules/request/node_modules/form-data/node_modules/async/dist/async.js delete mode 100644 APIs/node_modules/request/node_modules/form-data/node_modules/async/dist/async.min.js delete mode 100644 APIs/node_modules/request/node_modules/form-data/node_modules/async/lib/async.js delete mode 100644 APIs/node_modules/request/node_modules/form-data/node_modules/async/package.json delete mode 100644 APIs/node_modules/request/node_modules/form-data/package.json delete mode 100644 APIs/node_modules/request/node_modules/form-data/wercker.yml delete mode 100644 APIs/node_modules/request/node_modules/har-validator/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/har-validator/README.md delete mode 100755 APIs/node_modules/request/node_modules/har-validator/bin/har-validator delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/async.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/error.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/runner.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/cache.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/cacheEntry.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/content.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/cookie.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/creator.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/entry.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/har.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/log.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/page.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/pageTimings.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/postData.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/record.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/request.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/response.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/lib/schemas/timings.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/ansi-styles/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/escape-string-regexp/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/node_modules/ansi-regex/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/has-ansi/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/node_modules/ansi-regex/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/strip-ansi/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/node_modules/supports-color/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/chalk/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/History.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/Readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/node_modules/graceful-readlink/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/node_modules/graceful-readlink/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/node_modules/graceful-readlink/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/node_modules/graceful-readlink/README.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/node_modules/graceful-readlink/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/node_modules/graceful-readlink/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/commander/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/README.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/example.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/formats.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/README.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/example.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-function/test.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/README.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/node_modules/is-property/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/node_modules/is-property/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/node_modules/is-property/README.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/node_modules/is-property/is-property.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/node_modules/is-property/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/generate-object-property/test.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/jsonpointer/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/jsonpointer/README.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/jsonpointer/jsonpointer.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/jsonpointer/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/jsonpointer/test.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/.jshintrc delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/LICENCE delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/Makefile delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/README.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/immutable.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/mutable.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/node_modules/xtend/test.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/require.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/fixtures/cosmic.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/additionalItems.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/additionalProperties.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/allOf.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/anyOf.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/bignum.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/default.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/definitions.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/dependencies.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/enum.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/format.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/items.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/maxItems.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/maxLength.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/maxProperties.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/maximum.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/minItems.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/minLength.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/minProperties.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/minimum.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/multipleOf.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/not.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndFormat.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/nullAndObject.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/oneOf.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/pattern.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/patternProperties.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/properties.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/ref.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/refRemote.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/required.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/type.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema-draft4/uniqueItems.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/json-schema.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/is-my-json-valid/test/misc.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/index.js delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/license delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/node_modules/pinkie/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/package.json delete mode 100644 APIs/node_modules/request/node_modules/har-validator/node_modules/pinkie-promise/readme.md delete mode 100644 APIs/node_modules/request/node_modules/har-validator/package.json delete mode 100644 APIs/node_modules/request/node_modules/hawk/.npmignore delete mode 100755 APIs/node_modules/request/node_modules/hawk/.travis.yml delete mode 100755 APIs/node_modules/request/node_modules/hawk/LICENSE delete mode 100755 APIs/node_modules/request/node_modules/hawk/README.md delete mode 100644 APIs/node_modules/request/node_modules/hawk/bower.json delete mode 100644 APIs/node_modules/request/node_modules/hawk/component.json delete mode 100644 APIs/node_modules/request/node_modules/hawk/dist/client.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/example/usage.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/images/hawk.png delete mode 100755 APIs/node_modules/request/node_modules/hawk/images/logo.png delete mode 100755 APIs/node_modules/request/node_modules/hawk/lib/browser.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/lib/client.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/lib/crypto.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/lib/index.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/lib/server.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/lib/utils.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/boom/.npmignore delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/boom/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/boom/CONTRIBUTING.md delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/boom/LICENSE delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/boom/README.md delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/boom/images/boom.png delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/boom/package.json delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/boom/test/index.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/cryptiles/.npmignore delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/cryptiles/.travis.yml delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/cryptiles/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/cryptiles/README.md delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/cryptiles/lib/index.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/cryptiles/package.json delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/cryptiles/test/index.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/CONTRIBUTING.md delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/README.md delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/images/hoek.png delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/lib/escape.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/lib/index.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/package.json delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/test/escaper.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/test/index.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/ignore.txt delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test1.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test2.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/hoek/test/modules/test3.js delete mode 100644 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/.npmignore delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/.travis.yml delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/LICENSE delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/Makefile delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/README.md delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/examples/offset.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/examples/time.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/index.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/lib/index.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/package.json delete mode 100755 APIs/node_modules/request/node_modules/hawk/node_modules/sntp/test/index.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/package.json delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/browser.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/client.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/crypto.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/index.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/readme.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/server.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/uri.js delete mode 100755 APIs/node_modules/request/node_modules/hawk/test/utils.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/.dir-locals.el delete mode 100644 APIs/node_modules/request/node_modules/http-signature/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/CHANGES.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/http_signing.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/lib/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/lib/parser.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/lib/signer.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/lib/utils.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/lib/verify.js delete mode 120000 APIs/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-conv delete mode 120000 APIs/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-sign delete mode 120000 APIs/node_modules/request/node_modules/http-signature/node_modules/.bin/sshpk-verify delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/assert-plus/AUTHORS delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/assert-plus/CHANGES.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/assert-plus/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/assert-plus/assert.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/assert-plus/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/CHANGES.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/lib/jsprim.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/.gitmodules delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.deps delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/Makefile.targ delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/examples/simple.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/jsl.node.conf delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/lib/extsprintf.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/extsprintf/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/hyper-schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/json-ref delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/links delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-00/schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/hyper-schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/json-ref delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/links delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-01/schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/hyper-schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/json-ref delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/links delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-02/schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/address delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/calendar delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/card delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/geo delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/examples/interfaces delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/hyper-schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/json-ref delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/links delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-03/schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/hyper-schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/links delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-04/schema delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-03.xml delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/draft-zyp-json-schema-04.xml delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/links.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/lib/validate.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/json-schema/test/tests.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.gitmodules delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/Makefile.targ delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-verror.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/levels-werror.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/varargs.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/verror.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/examples/werror.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/jsl.node.conf delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/lib/verror.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.inherit.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.verror.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/node_modules/verror/tests/tst.werror.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/jsprim/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/README.md delete mode 100755 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-conv delete mode 100755 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-sign delete mode 100755 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/bin/sshpk-verify delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/algs.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/dhe.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ed-compat.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/errors.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/fingerprint.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/auto.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pem.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs1.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/pkcs8.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/rfc4253.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh-private.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/formats/ssh.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/key.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/private-key.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/signature.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/ssh-buffer.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/lib/utils.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/man/man1/sshpk-conv.1 delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/man/man1/sshpk-sign.1 delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/man/man1/sshpk-verify.1 delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/errors.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/reader.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/types.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/ber/writer.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/lib/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/reader.test.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/asn1/tst/ber/writer.test.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/AUTHORS delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/CHANGES.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/assert.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/assert-plus/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/etc/dashdash.bash_completion.in delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/lib/dashdash.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/dashdash/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/LICENSE-jsbn delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/ec.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/lib/sec.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/ecc-jsbn/test.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/getpass/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/getpass/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/getpass/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/getpass/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/getpass/lib/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/getpass/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/AUTHORS.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.0 delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/almond.1 delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/jsdoc.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/core.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/curve255.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/dh.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/eddsa.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/lib/utils.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jodid25519/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.html delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json delete mode 100644 APIs/node_modules/request/node_modules/http-signature/package.json delete mode 100644 APIs/node_modules/request/node_modules/is-typedarray/LICENSE.md delete mode 100644 APIs/node_modules/request/node_modules/is-typedarray/README.md delete mode 100644 APIs/node_modules/request/node_modules/is-typedarray/index.js delete mode 100644 APIs/node_modules/request/node_modules/is-typedarray/package.json delete mode 100644 APIs/node_modules/request/node_modules/is-typedarray/test.js delete mode 100644 APIs/node_modules/request/node_modules/isstream/.jshintrc delete mode 100644 APIs/node_modules/request/node_modules/isstream/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/isstream/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/isstream/LICENSE.md delete mode 100644 APIs/node_modules/request/node_modules/isstream/README.md delete mode 100644 APIs/node_modules/request/node_modules/isstream/isstream.js delete mode 100644 APIs/node_modules/request/node_modules/isstream/package.json delete mode 100644 APIs/node_modules/request/node_modules/isstream/test.js delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/Makefile delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/README.md delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/package.json delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/stringify.js delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts delete mode 100644 APIs/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js delete mode 100644 APIs/node_modules/request/node_modules/mime-types/HISTORY.md delete mode 100644 APIs/node_modules/request/node_modules/mime-types/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/mime-types/README.md delete mode 100644 APIs/node_modules/request/node_modules/mime-types/index.js delete mode 100644 APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md delete mode 100644 APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/README.md delete mode 100644 APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json delete mode 100644 APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/index.js delete mode 100644 APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json delete mode 100644 APIs/node_modules/request/node_modules/mime-types/package.json delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/LICENSE.md delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/README.md delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/benchmark/README.md delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu delete mode 100755 APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.sh delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js delete mode 100755 APIs/node_modules/request/node_modules/node-uuid/bin/uuid delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/bower.json delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/component.json delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/package.json delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/test/compare_v1.js delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/test/test.html delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/test/test.js delete mode 100644 APIs/node_modules/request/node_modules/node-uuid/uuid.js delete mode 100644 APIs/node_modules/request/node_modules/oauth-sign/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/oauth-sign/README.md delete mode 100644 APIs/node_modules/request/node_modules/oauth-sign/index.js delete mode 100644 APIs/node_modules/request/node_modules/oauth-sign/package.json delete mode 100644 APIs/node_modules/request/node_modules/qs/.eslintignore delete mode 100644 APIs/node_modules/request/node_modules/qs/.eslintrc delete mode 100644 APIs/node_modules/request/node_modules/qs/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/qs/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/qs/CHANGELOG.md delete mode 100644 APIs/node_modules/request/node_modules/qs/CONTRIBUTING.md delete mode 100644 APIs/node_modules/request/node_modules/qs/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/qs/README.md delete mode 100644 APIs/node_modules/request/node_modules/qs/bower.json delete mode 100644 APIs/node_modules/request/node_modules/qs/component.json delete mode 100644 APIs/node_modules/request/node_modules/qs/dist/qs.js delete mode 100755 APIs/node_modules/request/node_modules/qs/lib/index.js delete mode 100755 APIs/node_modules/request/node_modules/qs/lib/parse.js delete mode 100755 APIs/node_modules/request/node_modules/qs/lib/stringify.js delete mode 100755 APIs/node_modules/request/node_modules/qs/lib/utils.js delete mode 100644 APIs/node_modules/request/node_modules/qs/package.json delete mode 100644 APIs/node_modules/request/node_modules/qs/test/index.js delete mode 100755 APIs/node_modules/request/node_modules/qs/test/parse.js delete mode 100755 APIs/node_modules/request/node_modules/qs/test/stringify.js delete mode 100755 APIs/node_modules/request/node_modules/qs/test/utils.js delete mode 100644 APIs/node_modules/request/node_modules/stringstream/.npmignore delete mode 100644 APIs/node_modules/request/node_modules/stringstream/.travis.yml delete mode 100644 APIs/node_modules/request/node_modules/stringstream/LICENSE.txt delete mode 100644 APIs/node_modules/request/node_modules/stringstream/README.md delete mode 100644 APIs/node_modules/request/node_modules/stringstream/example.js delete mode 100644 APIs/node_modules/request/node_modules/stringstream/package.json delete mode 100644 APIs/node_modules/request/node_modules/stringstream/stringstream.js delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/README.md delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/lib/cookie.js delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/lib/memstore.js delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/lib/pathMatch.js delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/lib/permuteDomain.js delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/lib/pubsuffix.js delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/lib/store.js delete mode 100644 APIs/node_modules/request/node_modules/tough-cookie/package.json delete mode 100644 APIs/node_modules/request/node_modules/tunnel-agent/LICENSE delete mode 100644 APIs/node_modules/request/node_modules/tunnel-agent/README.md delete mode 100644 APIs/node_modules/request/node_modules/tunnel-agent/index.js delete mode 100644 APIs/node_modules/request/node_modules/tunnel-agent/package.json delete mode 100644 APIs/node_modules/request/package.json delete mode 100644 APIs/node_modules/request/request.js delete mode 100644 Associations/node_modules/mongoose/.eslintignore delete mode 100644 Associations/node_modules/mongoose/.eslintrc delete mode 100644 Associations/node_modules/mongoose/.npmignore delete mode 100644 Associations/node_modules/mongoose/.travis.yml delete mode 100644 Associations/node_modules/mongoose/CONTRIBUTING.md delete mode 100644 Associations/node_modules/mongoose/History.md delete mode 100644 Associations/node_modules/mongoose/README.md delete mode 100755 Associations/node_modules/mongoose/contRun.sh delete mode 100644 Associations/node_modules/mongoose/examples/README.md delete mode 100644 Associations/node_modules/mongoose/examples/aggregate/aggregate.js delete mode 100644 Associations/node_modules/mongoose/examples/aggregate/package.json delete mode 100644 Associations/node_modules/mongoose/examples/aggregate/person.js delete mode 100644 Associations/node_modules/mongoose/examples/doc-methods.js delete mode 100644 Associations/node_modules/mongoose/examples/express/README.md delete mode 100644 Associations/node_modules/mongoose/examples/express/connection-sharing/README.md delete mode 100644 Associations/node_modules/mongoose/examples/express/connection-sharing/app.js delete mode 100644 Associations/node_modules/mongoose/examples/express/connection-sharing/modelA.js delete mode 100644 Associations/node_modules/mongoose/examples/express/connection-sharing/package.json delete mode 100644 Associations/node_modules/mongoose/examples/express/connection-sharing/routes.js delete mode 100644 Associations/node_modules/mongoose/examples/geospatial/geoJSONSchema.js delete mode 100644 Associations/node_modules/mongoose/examples/geospatial/geoJSONexample.js delete mode 100644 Associations/node_modules/mongoose/examples/geospatial/geospatial.js delete mode 100644 Associations/node_modules/mongoose/examples/geospatial/package.json delete mode 100644 Associations/node_modules/mongoose/examples/geospatial/person.js delete mode 100644 Associations/node_modules/mongoose/examples/globalschemas/gs_example.js delete mode 100644 Associations/node_modules/mongoose/examples/globalschemas/person.js delete mode 100644 Associations/node_modules/mongoose/examples/lean/lean.js delete mode 100644 Associations/node_modules/mongoose/examples/lean/package.json delete mode 100644 Associations/node_modules/mongoose/examples/lean/person.js delete mode 100644 Associations/node_modules/mongoose/examples/mapreduce/mapreduce.js delete mode 100644 Associations/node_modules/mongoose/examples/mapreduce/package.json delete mode 100644 Associations/node_modules/mongoose/examples/mapreduce/person.js delete mode 100644 Associations/node_modules/mongoose/examples/population/population-across-three-collections.js delete mode 100644 Associations/node_modules/mongoose/examples/population/population-basic.js delete mode 100644 Associations/node_modules/mongoose/examples/population/population-of-existing-doc.js delete mode 100644 Associations/node_modules/mongoose/examples/population/population-of-multiple-existing-docs.js delete mode 100644 Associations/node_modules/mongoose/examples/population/population-options.js delete mode 100644 Associations/node_modules/mongoose/examples/population/population-plain-objects.js delete mode 100644 Associations/node_modules/mongoose/examples/promises/package.json delete mode 100644 Associations/node_modules/mongoose/examples/promises/person.js delete mode 100644 Associations/node_modules/mongoose/examples/promises/promise.js delete mode 100644 Associations/node_modules/mongoose/examples/querybuilder/package.json delete mode 100644 Associations/node_modules/mongoose/examples/querybuilder/person.js delete mode 100644 Associations/node_modules/mongoose/examples/querybuilder/querybuilder.js delete mode 100644 Associations/node_modules/mongoose/examples/replicasets/package.json delete mode 100644 Associations/node_modules/mongoose/examples/replicasets/person.js delete mode 100644 Associations/node_modules/mongoose/examples/replicasets/replica-sets.js delete mode 100644 Associations/node_modules/mongoose/examples/schema/schema.js delete mode 100644 Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/index.js delete mode 100644 Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/schema.json delete mode 100644 Associations/node_modules/mongoose/examples/statics/person.js delete mode 100644 Associations/node_modules/mongoose/examples/statics/statics.js delete mode 100644 Associations/node_modules/mongoose/index.js delete mode 100644 Associations/node_modules/mongoose/lib/ES6Promise.js delete mode 100644 Associations/node_modules/mongoose/lib/aggregate.js delete mode 100644 Associations/node_modules/mongoose/lib/browser.js delete mode 100644 Associations/node_modules/mongoose/lib/browserDocument.js delete mode 100644 Associations/node_modules/mongoose/lib/cast.js delete mode 100644 Associations/node_modules/mongoose/lib/collection.js delete mode 100644 Associations/node_modules/mongoose/lib/connection.js delete mode 100644 Associations/node_modules/mongoose/lib/connectionstate.js delete mode 100644 Associations/node_modules/mongoose/lib/document.js delete mode 100644 Associations/node_modules/mongoose/lib/document_provider.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/SPEC.md delete mode 100644 Associations/node_modules/mongoose/lib/drivers/browser/ReadPreference.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/browser/binary.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/browser/index.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/browser/objectid.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/index.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/ReadPreference.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/binary.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/index.js delete mode 100644 Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js delete mode 100644 Associations/node_modules/mongoose/lib/error.js delete mode 100644 Associations/node_modules/mongoose/lib/error/browserMissingSchema.js delete mode 100644 Associations/node_modules/mongoose/lib/error/cast.js delete mode 100644 Associations/node_modules/mongoose/lib/error/divergentArray.js delete mode 100644 Associations/node_modules/mongoose/lib/error/messages.js delete mode 100644 Associations/node_modules/mongoose/lib/error/missingSchema.js delete mode 100644 Associations/node_modules/mongoose/lib/error/overwriteModel.js delete mode 100644 Associations/node_modules/mongoose/lib/error/validation.js delete mode 100644 Associations/node_modules/mongoose/lib/error/validator.js delete mode 100644 Associations/node_modules/mongoose/lib/error/version.js delete mode 100644 Associations/node_modules/mongoose/lib/index.js delete mode 100644 Associations/node_modules/mongoose/lib/internal.js delete mode 100644 Associations/node_modules/mongoose/lib/model.js delete mode 100644 Associations/node_modules/mongoose/lib/promise.js delete mode 100644 Associations/node_modules/mongoose/lib/promise_provider.js delete mode 100644 Associations/node_modules/mongoose/lib/query.js delete mode 100644 Associations/node_modules/mongoose/lib/queryhelpers.js delete mode 100644 Associations/node_modules/mongoose/lib/querystream.js delete mode 100644 Associations/node_modules/mongoose/lib/schema.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/array.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/boolean.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/buffer.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/date.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/documentarray.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/index.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/mixed.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/number.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/objectid.js delete mode 100644 Associations/node_modules/mongoose/lib/schema/string.js delete mode 100644 Associations/node_modules/mongoose/lib/schematype.js delete mode 100644 Associations/node_modules/mongoose/lib/services/updateValidators.js delete mode 100644 Associations/node_modules/mongoose/lib/statemachine.js delete mode 100644 Associations/node_modules/mongoose/lib/types/array.js delete mode 100644 Associations/node_modules/mongoose/lib/types/buffer.js delete mode 100644 Associations/node_modules/mongoose/lib/types/documentarray.js delete mode 100644 Associations/node_modules/mongoose/lib/types/embedded.js delete mode 100644 Associations/node_modules/mongoose/lib/types/index.js delete mode 100644 Associations/node_modules/mongoose/lib/types/objectid.js delete mode 100644 Associations/node_modules/mongoose/lib/utils.js delete mode 100644 Associations/node_modules/mongoose/lib/virtualtype.js delete mode 100644 Associations/node_modules/mongoose/node_modules/async/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/async/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/async/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/async/component.json delete mode 100755 Associations/node_modules/mongoose/node_modules/async/lib/async.js delete mode 100644 Associations/node_modules/mongoose/node_modules/async/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/HISTORY delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/browser_build/bson.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/browser_build/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/bson.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/code.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/double.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/long.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/map.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/bson/tools/gleak.js delete mode 100644 Associations/node_modules/mongoose/node_modules/hooks-fixed/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/hooks-fixed/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/hooks-fixed/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js delete mode 100644 Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.js delete mode 100644 Associations/node_modules/mongoose/node_modules/hooks-fixed/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/hooks-fixed/test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/docs.js delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/gulpfile.js delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/test/examples.test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/test/post.test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/test/pre.test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/kareem/test/wrap.test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/HISTORY.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/conf.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/admin.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/apm.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/collection.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/cursor.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/db.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/metadata.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/mongos.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/replset.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/server.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/lib/utils.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/load.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/browserify.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/index.html delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/linker.lock delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/base64.o delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberos.o delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberos_context.o delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberosgss.o delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/worker.o delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/binding.Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/config.gypi delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/kerberos.target.mk delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/builderror.log delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml delete mode 100755 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/asyncworker.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/buffers.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/callback.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/converters.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/errors.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/maybe_types.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/methods.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/new.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/node_misc.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/persistent.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/scopes.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/script.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/string_bytes.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/v8_internals.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/v8_misc.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/include_dirs.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_callbacks.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_callbacks_12_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_callbacks_pre_12_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_converters.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_converters_43_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_converters_pre_43_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_implementation_12_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_implementation_pre_12_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_maybe_43_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_maybe_pre_43_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_new.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_object_wrap.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_persistent_12_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_persistent_pre_12_inl.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_string_bytes.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_weak.h delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/package.json delete mode 100755 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/1to2.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/t.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/t1.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/boot.sh delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/ca.pem delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client.pem delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client_password.pem delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/connect.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.lock delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.turtle delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.wt delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTigerLAS.wt delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/_mdb_catalog.wt delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/collection-0-757073248613337118.wt delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-44-37Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-45-15Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-46-31Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-47-25Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-49-07Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-50-41Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-50-53Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-52-31Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-54-53Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-55-09Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-55-38Z-00000 delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/index-1-757073248613337118.wt delete mode 100755 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/mongod.lock delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/sizeStorer.wt delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/storage.bson delete mode 100644 Associations/node_modules/mongoose/node_modules/mongodb/test_boot/server_password.pem delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/lib/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mpath/test/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/lib/promise.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/test/promise.test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/lib/collection/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/lib/collection/node.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/lib/env.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/lib/mquery.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/lib/permissions.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/lib/utils.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/schedule.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/debug.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/test/collection/browser.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/test/collection/mongo.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/test/collection/node.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/test/env.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/test/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/mquery/test/utils.test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/ms.js delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/test/index.html delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/test/support/jquery.js delete mode 100644 Associations/node_modules/mongoose/node_modules/ms/test/test.js delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/lib/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/strict.js delete mode 100644 Associations/node_modules/mongoose/node_modules/muri/test/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/regexp-clone/test/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/.npmignore delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/.travis.yml delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/History.md delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/LICENSE delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/Makefile delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/README.md delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/bench.js delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/component.json delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/index.js delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/lib/sliced.js delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/package.json delete mode 100644 Associations/node_modules/mongoose/node_modules/sliced/test/index.js delete mode 100644 Associations/node_modules/mongoose/package.json delete mode 100644 Associations/node_modules/mongoose/release-items.md delete mode 100644 Associations/node_modules/mongoose/static.js delete mode 100644 Associations/node_modules/mongoose/website.js delete mode 100644 Databases/node_modules/mongoose/.eslintignore delete mode 100644 Databases/node_modules/mongoose/.eslintrc delete mode 100644 Databases/node_modules/mongoose/.npmignore delete mode 100644 Databases/node_modules/mongoose/.travis.yml delete mode 100644 Databases/node_modules/mongoose/CONTRIBUTING.md delete mode 100644 Databases/node_modules/mongoose/History.md delete mode 100644 Databases/node_modules/mongoose/README.md delete mode 100755 Databases/node_modules/mongoose/contRun.sh delete mode 100644 Databases/node_modules/mongoose/examples/README.md delete mode 100644 Databases/node_modules/mongoose/examples/aggregate/aggregate.js delete mode 100644 Databases/node_modules/mongoose/examples/aggregate/package.json delete mode 100644 Databases/node_modules/mongoose/examples/aggregate/person.js delete mode 100644 Databases/node_modules/mongoose/examples/doc-methods.js delete mode 100644 Databases/node_modules/mongoose/examples/express/README.md delete mode 100644 Databases/node_modules/mongoose/examples/express/connection-sharing/README.md delete mode 100644 Databases/node_modules/mongoose/examples/express/connection-sharing/app.js delete mode 100644 Databases/node_modules/mongoose/examples/express/connection-sharing/modelA.js delete mode 100644 Databases/node_modules/mongoose/examples/express/connection-sharing/package.json delete mode 100644 Databases/node_modules/mongoose/examples/express/connection-sharing/routes.js delete mode 100644 Databases/node_modules/mongoose/examples/geospatial/geoJSONSchema.js delete mode 100644 Databases/node_modules/mongoose/examples/geospatial/geoJSONexample.js delete mode 100644 Databases/node_modules/mongoose/examples/geospatial/geospatial.js delete mode 100644 Databases/node_modules/mongoose/examples/geospatial/package.json delete mode 100644 Databases/node_modules/mongoose/examples/geospatial/person.js delete mode 100644 Databases/node_modules/mongoose/examples/globalschemas/gs_example.js delete mode 100644 Databases/node_modules/mongoose/examples/globalschemas/person.js delete mode 100644 Databases/node_modules/mongoose/examples/lean/lean.js delete mode 100644 Databases/node_modules/mongoose/examples/lean/package.json delete mode 100644 Databases/node_modules/mongoose/examples/lean/person.js delete mode 100644 Databases/node_modules/mongoose/examples/mapreduce/mapreduce.js delete mode 100644 Databases/node_modules/mongoose/examples/mapreduce/package.json delete mode 100644 Databases/node_modules/mongoose/examples/mapreduce/person.js delete mode 100644 Databases/node_modules/mongoose/examples/population/population-across-three-collections.js delete mode 100644 Databases/node_modules/mongoose/examples/population/population-basic.js delete mode 100644 Databases/node_modules/mongoose/examples/population/population-of-existing-doc.js delete mode 100644 Databases/node_modules/mongoose/examples/population/population-of-multiple-existing-docs.js delete mode 100644 Databases/node_modules/mongoose/examples/population/population-options.js delete mode 100644 Databases/node_modules/mongoose/examples/population/population-plain-objects.js delete mode 100644 Databases/node_modules/mongoose/examples/promises/package.json delete mode 100644 Databases/node_modules/mongoose/examples/promises/person.js delete mode 100644 Databases/node_modules/mongoose/examples/promises/promise.js delete mode 100644 Databases/node_modules/mongoose/examples/querybuilder/package.json delete mode 100644 Databases/node_modules/mongoose/examples/querybuilder/person.js delete mode 100644 Databases/node_modules/mongoose/examples/querybuilder/querybuilder.js delete mode 100644 Databases/node_modules/mongoose/examples/replicasets/package.json delete mode 100644 Databases/node_modules/mongoose/examples/replicasets/person.js delete mode 100644 Databases/node_modules/mongoose/examples/replicasets/replica-sets.js delete mode 100644 Databases/node_modules/mongoose/examples/schema/schema.js delete mode 100644 Databases/node_modules/mongoose/examples/schema/storing-schemas-as-json/index.js delete mode 100644 Databases/node_modules/mongoose/examples/schema/storing-schemas-as-json/schema.json delete mode 100644 Databases/node_modules/mongoose/examples/statics/person.js delete mode 100644 Databases/node_modules/mongoose/examples/statics/statics.js delete mode 100644 Databases/node_modules/mongoose/index.js delete mode 100644 Databases/node_modules/mongoose/lib/ES6Promise.js delete mode 100644 Databases/node_modules/mongoose/lib/aggregate.js delete mode 100644 Databases/node_modules/mongoose/lib/browser.js delete mode 100644 Databases/node_modules/mongoose/lib/browserDocument.js delete mode 100644 Databases/node_modules/mongoose/lib/cast.js delete mode 100644 Databases/node_modules/mongoose/lib/collection.js delete mode 100644 Databases/node_modules/mongoose/lib/connection.js delete mode 100644 Databases/node_modules/mongoose/lib/connectionstate.js delete mode 100644 Databases/node_modules/mongoose/lib/document.js delete mode 100644 Databases/node_modules/mongoose/lib/document_provider.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/SPEC.md delete mode 100644 Databases/node_modules/mongoose/lib/drivers/browser/ReadPreference.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/browser/binary.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/browser/index.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/browser/objectid.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/index.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/node-mongodb-native/ReadPreference.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/node-mongodb-native/binary.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/node-mongodb-native/index.js delete mode 100644 Databases/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js delete mode 100644 Databases/node_modules/mongoose/lib/error.js delete mode 100644 Databases/node_modules/mongoose/lib/error/browserMissingSchema.js delete mode 100644 Databases/node_modules/mongoose/lib/error/cast.js delete mode 100644 Databases/node_modules/mongoose/lib/error/divergentArray.js delete mode 100644 Databases/node_modules/mongoose/lib/error/messages.js delete mode 100644 Databases/node_modules/mongoose/lib/error/missingSchema.js delete mode 100644 Databases/node_modules/mongoose/lib/error/overwriteModel.js delete mode 100644 Databases/node_modules/mongoose/lib/error/validation.js delete mode 100644 Databases/node_modules/mongoose/lib/error/validator.js delete mode 100644 Databases/node_modules/mongoose/lib/error/version.js delete mode 100644 Databases/node_modules/mongoose/lib/index.js delete mode 100644 Databases/node_modules/mongoose/lib/internal.js delete mode 100644 Databases/node_modules/mongoose/lib/model.js delete mode 100644 Databases/node_modules/mongoose/lib/promise.js delete mode 100644 Databases/node_modules/mongoose/lib/promise_provider.js delete mode 100644 Databases/node_modules/mongoose/lib/query.js delete mode 100644 Databases/node_modules/mongoose/lib/queryhelpers.js delete mode 100644 Databases/node_modules/mongoose/lib/querystream.js delete mode 100644 Databases/node_modules/mongoose/lib/schema.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/array.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/boolean.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/buffer.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/date.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/documentarray.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/index.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/mixed.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/number.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/objectid.js delete mode 100644 Databases/node_modules/mongoose/lib/schema/string.js delete mode 100644 Databases/node_modules/mongoose/lib/schematype.js delete mode 100644 Databases/node_modules/mongoose/lib/services/updateValidators.js delete mode 100644 Databases/node_modules/mongoose/lib/statemachine.js delete mode 100644 Databases/node_modules/mongoose/lib/types/array.js delete mode 100644 Databases/node_modules/mongoose/lib/types/buffer.js delete mode 100644 Databases/node_modules/mongoose/lib/types/documentarray.js delete mode 100644 Databases/node_modules/mongoose/lib/types/embedded.js delete mode 100644 Databases/node_modules/mongoose/lib/types/index.js delete mode 100644 Databases/node_modules/mongoose/lib/types/objectid.js delete mode 100644 Databases/node_modules/mongoose/lib/utils.js delete mode 100644 Databases/node_modules/mongoose/lib/virtualtype.js delete mode 100644 Databases/node_modules/mongoose/node_modules/async/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/async/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/async/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/async/component.json delete mode 100755 Databases/node_modules/mongoose/node_modules/async/lib/async.js delete mode 100644 Databases/node_modules/mongoose/node_modules/async/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/HISTORY delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/browser_build/bson.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/browser_build/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/bson.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/code.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/double.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/long.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/map.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/bson/tools/gleak.js delete mode 100644 Databases/node_modules/mongoose/node_modules/hooks-fixed/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/hooks-fixed/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/hooks-fixed/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js delete mode 100644 Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.js delete mode 100644 Databases/node_modules/mongoose/node_modules/hooks-fixed/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/hooks-fixed/test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/docs.js delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/gulpfile.js delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/test/examples.test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/test/post.test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/test/pre.test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/kareem/test/wrap.test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/HISTORY.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/c.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/conf.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/admin.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/apm.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/collection.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/cursor.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/db.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/metadata.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/mongos.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/replset.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/server.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/lib/utils.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/load.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/browserify.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/index.html delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/linker.lock delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/base64.o delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberos.o delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberos_context.o delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberosgss.o delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/worker.o delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/binding.Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/config.gypi delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/kerberos.target.mk delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/builderror.log delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml delete mode 100755 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/asyncworker.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/buffers.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/callback.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/converters.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/errors.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/maybe_types.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/methods.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/new.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/node_misc.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/persistent.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/scopes.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/script.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/string_bytes.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/v8_internals.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/v8_misc.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/include_dirs.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_callbacks.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_callbacks_12_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_callbacks_pre_12_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_converters.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_converters_43_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_converters_pre_43_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_implementation_12_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_implementation_pre_12_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_maybe_43_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_maybe_pre_43_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_new.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_object_wrap.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_persistent_12_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_persistent_pre_12_inl.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_string_bytes.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/nan_weak.h delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/package.json delete mode 100755 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/1to2.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/t.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/t1.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mongodb/wercker.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/lib/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mpath/test/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/lib/promise.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/test/promise.test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/lib/collection/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/lib/collection/node.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/lib/env.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/lib/mquery.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/lib/permissions.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/lib/utils.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/schedule.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/debug.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/test/collection/browser.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/test/collection/mongo.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/test/collection/node.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/test/env.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/test/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/mquery/test/utils.test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/ms.js delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/test/index.html delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/test/support/jquery.js delete mode 100644 Databases/node_modules/mongoose/node_modules/ms/test/test.js delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/lib/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/strict.js delete mode 100644 Databases/node_modules/mongoose/node_modules/muri/test/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/regexp-clone/test/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/.npmignore delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/.travis.yml delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/History.md delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/LICENSE delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/Makefile delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/README.md delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/bench.js delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/component.json delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/index.js delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/lib/sliced.js delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/package.json delete mode 100644 Databases/node_modules/mongoose/node_modules/sliced/test/index.js delete mode 100644 Databases/node_modules/mongoose/package.json delete mode 100644 Databases/node_modules/mongoose/release-items.md delete mode 100644 Databases/node_modules/mongoose/static.js delete mode 100644 Databases/node_modules/mongoose/website.js delete mode 100644 DeployingDemo/node_modules/ejs/Jakefile delete mode 100644 DeployingDemo/node_modules/ejs/README.md delete mode 100644 DeployingDemo/node_modules/ejs/ejs.js delete mode 100644 DeployingDemo/node_modules/ejs/ejs.min.js delete mode 100644 DeployingDemo/node_modules/ejs/lib/ejs.js delete mode 100644 DeployingDemo/node_modules/ejs/lib/utils.js delete mode 100644 DeployingDemo/node_modules/ejs/package.json delete mode 100644 DeployingDemo/node_modules/ejs/test/ejs.js delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/backslash.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/backslash.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/comments.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/comments.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/consecutive-tags.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/consecutive-tags.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/double-quote.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/double-quote.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/error.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/error.out delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/fail.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/hello-world.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include-abspath.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include-simple.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include-simple.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include.css.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include.css.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_cache.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_cache.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_preprocessor.css.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_preprocessor.css.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_preprocessor.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_preprocessor.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_preprocessor_cache.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/include_preprocessor_cache.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/includes/bom.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/includes/menu-item.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/includes/menu/item.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/literal.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/literal.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/menu.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/menu.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/menu_preprocessor.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/menu_preprocessor.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/menu_var.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/messed.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/messed.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/newlines.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/newlines.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/newlines.mixed.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/newlines.mixed.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/no.newlines.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/no.newlines.error.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/no.newlines.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/no.semicolons.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/no.semicolons.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/para.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/pet.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/rmWhitespace.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/rmWhitespace.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/single-quote.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/single-quote.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/space-and-tab-slurp.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/space-and-tab-slurp.html delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/style.css delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/user-no-with.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/user.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/fixtures/with-context.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/mocha.opts delete mode 100644 DeployingDemo/node_modules/ejs/test/tmp/include.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/tmp/include_preprocessor.ejs delete mode 100644 DeployingDemo/node_modules/ejs/test/tmp/renderFile.ejs delete mode 100644 DeployingDemo/node_modules/express/History.md delete mode 100644 DeployingDemo/node_modules/express/LICENSE delete mode 100644 DeployingDemo/node_modules/express/Readme.md delete mode 100644 DeployingDemo/node_modules/express/index.js delete mode 100644 DeployingDemo/node_modules/express/lib/application.js delete mode 100644 DeployingDemo/node_modules/express/lib/express.js delete mode 100644 DeployingDemo/node_modules/express/lib/middleware/init.js delete mode 100644 DeployingDemo/node_modules/express/lib/middleware/query.js delete mode 100644 DeployingDemo/node_modules/express/lib/request.js delete mode 100644 DeployingDemo/node_modules/express/lib/response.js delete mode 100644 DeployingDemo/node_modules/express/lib/router/index.js delete mode 100644 DeployingDemo/node_modules/express/lib/router/layer.js delete mode 100644 DeployingDemo/node_modules/express/lib/router/route.js delete mode 100644 DeployingDemo/node_modules/express/lib/utils.js delete mode 100644 DeployingDemo/node_modules/express/lib/view.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/db.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/node_modules/mime-db/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/mime-types/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/charset.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/encoding.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/language.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/lib/mediaType.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/node_modules/negotiator/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/accepts/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/array-flatten/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/array-flatten/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/array-flatten/array-flatten.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/array-flatten/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-disposition/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-disposition/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-disposition/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-disposition/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-disposition/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-type/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-type/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-type/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-type/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/content-type/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie-signature/.npmignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie-signature/History.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie-signature/Readme.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie-signature/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie-signature/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/cookie/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/.jshintrc delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/.npmignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/History.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/Makefile delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/Readme.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/bower.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/browser.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/component.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/debug.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/node.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/node_modules/ms/.npmignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/node_modules/ms/History.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/node_modules/ms/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/node_modules/ms/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/node_modules/ms/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/node_modules/ms/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/debug/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/History.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/Readme.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/lib/browser/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/lib/compat/buffer-concat.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/lib/compat/callsite-tostring.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/lib/compat/event-listener-count.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/lib/compat/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/depd/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/escape-html/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/escape-html/Readme.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/escape-html/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/escape-html/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/etag/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/etag/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/etag/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/etag/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/etag/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/node_modules/unpipe/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/node_modules/unpipe/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/node_modules/unpipe/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/node_modules/unpipe/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/node_modules/unpipe/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/finalhandler/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/fresh/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/fresh/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/fresh/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/fresh/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/fresh/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/merge-descriptors/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/merge-descriptors/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/merge-descriptors/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/merge-descriptors/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/merge-descriptors/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/methods/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/methods/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/methods/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/methods/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/methods/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/node_modules/ee-first/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/node_modules/ee-first/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/node_modules/ee-first/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/node_modules/ee-first/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/on-finished/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/parseurl/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/parseurl/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/parseurl/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/parseurl/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/parseurl/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/path-to-regexp/History.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/path-to-regexp/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/path-to-regexp/Readme.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/path-to-regexp/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/path-to-regexp/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/forwarded/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/.npmignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/.travis.yml delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/Cakefile delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/bower.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/ipaddr.min.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/lib/ipaddr.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/src/ipaddr.coffee delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/node_modules/ipaddr.js/test/ipaddr.test.coffee delete mode 100644 DeployingDemo/node_modules/express/node_modules/proxy-addr/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/.eslintignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/.npmignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/.travis.yml delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/CHANGELOG.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/CONTRIBUTING.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/bower.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/lib/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/lib/parse.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/lib/stringify.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/lib/utils.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/test/parse.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/test/stringify.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/qs/test/utils.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/range-parser/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/range-parser/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/range-parser/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/range-parser/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/range-parser/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/index.js delete mode 120000 DeployingDemo/node_modules/express/node_modules/send/node_modules/.bin/mime delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/destroy/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/destroy/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/destroy/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/destroy/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/inherits.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/inherits_browser.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/node_modules/inherits/test.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/http-errors/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/.npmignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/build/build.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/build/test.js delete mode 100755 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/cli.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/mime.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/mime/types.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/ms/.npmignore delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/ms/History.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/ms/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/ms/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/ms/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/ms/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/statuses/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/statuses/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/statuses/codes.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/statuses/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/node_modules/statuses/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/send/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/serve-static/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/serve-static/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/serve-static/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/serve-static/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/serve-static/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/media-typer/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/media-typer/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/media-typer/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/media-typer/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/media-typer/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/db.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/node_modules/mime-db/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/node_modules/mime-types/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/type-is/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/utils-merge/.travis.yml delete mode 100644 DeployingDemo/node_modules/express/node_modules/utils-merge/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/utils-merge/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/utils-merge/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/utils-merge/package.json delete mode 100644 DeployingDemo/node_modules/express/node_modules/vary/HISTORY.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/vary/LICENSE delete mode 100644 DeployingDemo/node_modules/express/node_modules/vary/README.md delete mode 100644 DeployingDemo/node_modules/express/node_modules/vary/index.js delete mode 100644 DeployingDemo/node_modules/express/node_modules/vary/package.json delete mode 100644 DeployingDemo/node_modules/express/package.json diff --git a/.c9/.nakignore b/.c9/.nakignore deleted file mode 100644 index 6d30aa67..00000000 --- a/.c9/.nakignore +++ /dev/null @@ -1,17 +0,0 @@ -*~backup-* -.c9revisions -.c9 -.git -.svn -.DS_Store -.bzr -.cdv -~.dep -~.dot -~.nib -~.plst -.hg -.pc -*.min.js -.nakignore -/dev diff --git a/.c9/metadata/tab16 b/.c9/metadata/tab16 deleted file mode 100644 index 50a365df..00000000 --- a/.c9/metadata/tab16 +++ /dev/null @@ -1 +0,0 @@ -{"changed":false,"filter":false,"title":"bash - \"learnwithcolt-webdevbootcamp-2012808\"","tooltip":"bash - \"learnwithcolt-webdevbootcamp-2012808\"","value":"","undoManager":{"mark":-1,"position":-1,"stack":[]},"terminal":{"id":"learnwithcolt@webdevbootcamp_780","cwd":"","width":825,"height":226,"scrollTop":22317.143394470215},"timestamp":1446362252724} \ No newline at end of file diff --git a/.c9/metadata/tab18 b/.c9/metadata/tab18 deleted file mode 100644 index 0c85e05b..00000000 --- a/.c9/metadata/tab18 +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"mongod - \"ubuntu@learnwithcolt-webdevbootcamp-2012808: ~/workspace\"","tooltip":"mongod - \"ubuntu@learnwithcolt-webdevbootcamp-2012808: ~/workspace\"","undoManager":{"mark":-1,"position":-1,"stack":[]},"terminal":{"id":"learnwithcolt@webdevbootcamp_342","cwd":"","width":1168,"height":308,"scrollTop":1262},"timestamp":1445288313508,"hash":"67452301efcdab8998badcfe10325476c3d2e1f0"} \ No newline at end of file diff --git a/.c9/metadata/workspace/APIs/first_request.js b/.c9/metadata/workspace/APIs/first_request.js deleted file mode 100644 index 688046cc..00000000 --- a/.c9/metadata/workspace/APIs/first_request.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"first_request.js","tooltip":"/APIs/first_request.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":11,"column":41},"end":{"row":11,"column":42},"action":"insert","lines":["r"],"id":543}],[{"start":{"row":11,"column":42},"end":{"row":11,"column":43},"action":"insert","lines":["e"],"id":544}],[{"start":{"row":11,"column":43},"end":{"row":11,"column":44},"action":"insert","lines":["s"],"id":545}],[{"start":{"row":11,"column":44},"end":{"row":11,"column":45},"action":"insert","lines":["u"],"id":546}],[{"start":{"row":11,"column":45},"end":{"row":11,"column":46},"action":"insert","lines":["l"],"id":547}],[{"start":{"row":11,"column":46},"end":{"row":11,"column":47},"action":"insert","lines":["t"],"id":548}],[{"start":{"row":11,"column":47},"end":{"row":11,"column":48},"action":"insert","lines":["s"],"id":549}],[{"start":{"row":11,"column":48},"end":{"row":11,"column":49},"action":"insert","lines":[" "],"id":550}],[{"start":{"row":11,"column":48},"end":{"row":11,"column":49},"action":"remove","lines":[" "],"id":551}],[{"start":{"row":11,"column":48},"end":{"row":11,"column":49},"action":"insert","lines":["\""],"id":552}],[{"start":{"row":11,"column":49},"end":{"row":11,"column":50},"action":"insert","lines":["]"],"id":553}],[{"start":{"row":11,"column":50},"end":{"row":11,"column":52},"action":"insert","lines":["[]"],"id":554}],[{"start":{"row":11,"column":51},"end":{"row":11,"column":53},"action":"insert","lines":["\"\""],"id":555}],[{"start":{"row":11,"column":52},"end":{"row":11,"column":53},"action":"insert","lines":["c"],"id":556},{"start":{"row":11,"column":53},"end":{"row":11,"column":54},"action":"insert","lines":["h"]}],[{"start":{"row":11,"column":54},"end":{"row":11,"column":55},"action":"insert","lines":["a"],"id":557}],[{"start":{"row":11,"column":55},"end":{"row":11,"column":56},"action":"insert","lines":["n"],"id":558}],[{"start":{"row":11,"column":56},"end":{"row":11,"column":57},"action":"insert","lines":["n"],"id":559}],[{"start":{"row":11,"column":57},"end":{"row":11,"column":58},"action":"insert","lines":["e"],"id":560}],[{"start":{"row":11,"column":58},"end":{"row":11,"column":59},"action":"insert","lines":["l"],"id":561}],[{"start":{"row":11,"column":59},"end":{"row":11,"column":60},"action":"insert","lines":[" "],"id":562}],[{"start":{"row":11,"column":59},"end":{"row":11,"column":60},"action":"remove","lines":[" "],"id":563}],[{"start":{"row":11,"column":61},"end":{"row":11,"column":63},"action":"insert","lines":["[]"],"id":564}],[{"start":{"row":11,"column":62},"end":{"row":11,"column":64},"action":"insert","lines":["\"\""],"id":565}],[{"start":{"row":11,"column":63},"end":{"row":11,"column":64},"action":"insert","lines":["a"],"id":566}],[{"start":{"row":11,"column":64},"end":{"row":11,"column":65},"action":"insert","lines":["s"],"id":567}],[{"start":{"row":11,"column":65},"end":{"row":11,"column":66},"action":"insert","lines":["t"],"id":568}],[{"start":{"row":11,"column":66},"end":{"row":11,"column":67},"action":"insert","lines":["r"],"id":569}],[{"start":{"row":11,"column":67},"end":{"row":11,"column":68},"action":"insert","lines":["o"],"id":570}],[{"start":{"row":11,"column":68},"end":{"row":11,"column":69},"action":"insert","lines":["n"],"id":571}],[{"start":{"row":11,"column":69},"end":{"row":11,"column":70},"action":"insert","lines":["o"],"id":572}],[{"start":{"row":11,"column":70},"end":{"row":11,"column":71},"action":"insert","lines":["m"],"id":573}],[{"start":{"row":11,"column":71},"end":{"row":11,"column":72},"action":"insert","lines":["y"],"id":574}],[{"start":{"row":11,"column":72},"end":{"row":11,"column":73},"action":"insert","lines":["t"],"id":575}],[{"start":{"row":11,"column":73},"end":{"row":11,"column":74},"action":"insert","lines":[" "],"id":576}],[{"start":{"row":11,"column":73},"end":{"row":11,"column":74},"action":"remove","lines":[" "],"id":577}],[{"start":{"row":11,"column":72},"end":{"row":11,"column":73},"action":"remove","lines":["t"],"id":578}],[{"start":{"row":11,"column":74},"end":{"row":11,"column":76},"action":"insert","lines":["[]"],"id":579}],[{"start":{"row":11,"column":75},"end":{"row":11,"column":77},"action":"insert","lines":["\"\""],"id":580}],[{"start":{"row":11,"column":76},"end":{"row":11,"column":77},"action":"insert","lines":["s"],"id":581}],[{"start":{"row":11,"column":77},"end":{"row":11,"column":78},"action":"insert","lines":["u"],"id":582}],[{"start":{"row":11,"column":78},"end":{"row":11,"column":79},"action":"insert","lines":["n"],"id":583}],[{"start":{"row":11,"column":79},"end":{"row":11,"column":80},"action":"insert","lines":["s"],"id":584}],[{"start":{"row":11,"column":80},"end":{"row":11,"column":81},"action":"insert","lines":["e"],"id":585}],[{"start":{"row":11,"column":81},"end":{"row":11,"column":82},"action":"insert","lines":["t"],"id":586}],[{"start":{"row":11,"column":82},"end":{"row":11,"column":83},"action":"insert","lines":[" "],"id":587}],[{"start":{"row":11,"column":82},"end":{"row":11,"column":83},"action":"remove","lines":[" "],"id":588}],[{"start":{"row":7,"column":33},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":589}],[{"start":{"row":8,"column":0},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":590}],[{"start":{"row":9,"column":0},"end":{"row":9,"column":1},"action":"insert","lines":["c"],"id":591}],[{"start":{"row":9,"column":1},"end":{"row":9,"column":2},"action":"insert","lines":["o"],"id":592}],[{"start":{"row":9,"column":2},"end":{"row":9,"column":3},"action":"insert","lines":["n"],"id":593}],[{"start":{"row":9,"column":3},"end":{"row":9,"column":4},"action":"insert","lines":["s"],"id":594}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"insert","lines":["o"],"id":595}],[{"start":{"row":9,"column":5},"end":{"row":9,"column":6},"action":"insert","lines":["l"],"id":596}],[{"start":{"row":9,"column":6},"end":{"row":9,"column":7},"action":"insert","lines":["e"],"id":597}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":[" "],"id":598}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"remove","lines":[" "],"id":599}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":["."],"id":600}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"insert","lines":["l"],"id":601}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"insert","lines":["o"],"id":602}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["g"],"id":603}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":[" "],"id":604}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"remove","lines":[" "],"id":605}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":13},"action":"insert","lines":["()"],"id":606}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":14},"action":"insert","lines":["\"\""],"id":607}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["S"],"id":608}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":["u"],"id":609}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"insert","lines":["n"],"id":610}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"insert","lines":["s"],"id":611}],[{"start":{"row":9,"column":17},"end":{"row":9,"column":18},"action":"insert","lines":["e"],"id":612}],[{"start":{"row":9,"column":18},"end":{"row":9,"column":19},"action":"insert","lines":["t"],"id":613}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":20},"action":"insert","lines":[" "],"id":614}],[{"start":{"row":9,"column":20},"end":{"row":9,"column":21},"action":"insert","lines":[" "],"id":615}],[{"start":{"row":9,"column":20},"end":{"row":9,"column":21},"action":"remove","lines":[" "],"id":616}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":20},"action":"remove","lines":[" "],"id":617}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":20},"action":"insert","lines":[" "],"id":618}],[{"start":{"row":9,"column":20},"end":{"row":9,"column":21},"action":"insert","lines":["i"],"id":619}],[{"start":{"row":9,"column":21},"end":{"row":9,"column":22},"action":"insert","lines":["n"],"id":620}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":[" "],"id":621}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["H"],"id":622}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"insert","lines":["a"],"id":623}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"insert","lines":["w"],"id":624}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"insert","lines":["a"],"id":625}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"insert","lines":["i"],"id":626}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":["i"],"id":627}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":[" "],"id":628}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"remove","lines":[" "],"id":629}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":[" "],"id":630}],[{"start":{"row":9,"column":30},"end":{"row":9,"column":31},"action":"insert","lines":["i"],"id":631}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"insert","lines":["s"],"id":632}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"insert","lines":[" "],"id":633}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"remove","lines":[" "],"id":634}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"insert","lines":[" "],"id":635}],[{"start":{"row":9,"column":33},"end":{"row":9,"column":34},"action":"insert","lines":["a"],"id":636}],[{"start":{"row":9,"column":34},"end":{"row":9,"column":35},"action":"insert","lines":["t"],"id":637}],[{"start":{"row":9,"column":35},"end":{"row":9,"column":36},"action":"insert","lines":[" "],"id":638}],[{"start":{"row":9,"column":35},"end":{"row":9,"column":36},"action":"remove","lines":[" "],"id":639}],[{"start":{"row":9,"column":35},"end":{"row":9,"column":36},"action":"insert","lines":["."],"id":640}],[{"start":{"row":9,"column":36},"end":{"row":9,"column":37},"action":"insert","lines":["."],"id":641}],[{"start":{"row":9,"column":37},"end":{"row":9,"column":38},"action":"insert","lines":["."],"id":642}],[{"start":{"row":9,"column":40},"end":{"row":9,"column":41},"action":"insert","lines":[";"],"id":643}]]},"ace":{"folds":[],"scrolltop":191.71430683135986,"scrollleft":0,"selection":{"start":{"row":11,"column":45},"end":{"row":11,"column":45},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":1,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1463119707000,"hash":"361f8aec110ae51ef4e9de3d2a2d3b39e44e607e"} \ No newline at end of file diff --git a/.c9/metadata/workspace/APIs/movie_search_app/app.js b/.c9/metadata/workspace/APIs/movie_search_app/app.js deleted file mode 100644 index 2521b1df..00000000 --- a/.c9/metadata/workspace/APIs/movie_search_app/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/APIs/movie_search_app/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":10,"column":18},"end":{"row":10,"column":19},"action":"insert","lines":["c"],"id":711}],[{"start":{"row":10,"column":19},"end":{"row":10,"column":20},"action":"insert","lines":["h"],"id":712}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":[" "],"id":713}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"remove","lines":[" "],"id":714}],[{"start":{"row":10,"column":4},"end":{"row":10,"column":5},"action":"insert","lines":["v"],"id":715}],[{"start":{"row":10,"column":4},"end":{"row":10,"column":5},"action":"remove","lines":["v"],"id":716}],[{"start":{"row":10,"column":4},"end":{"row":10,"column":5},"action":"insert","lines":["c"],"id":717}],[{"start":{"row":10,"column":5},"end":{"row":10,"column":6},"action":"insert","lines":["o"],"id":718}],[{"start":{"row":10,"column":6},"end":{"row":10,"column":7},"action":"insert","lines":["n"],"id":719}],[{"start":{"row":10,"column":7},"end":{"row":10,"column":8},"action":"insert","lines":["s"],"id":720}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"insert","lines":["o"],"id":721}],[{"start":{"row":10,"column":9},"end":{"row":10,"column":10},"action":"insert","lines":["l"],"id":722}],[{"start":{"row":10,"column":10},"end":{"row":10,"column":11},"action":"insert","lines":["e"],"id":723}],[{"start":{"row":10,"column":11},"end":{"row":10,"column":12},"action":"insert","lines":[" "],"id":724}],[{"start":{"row":10,"column":11},"end":{"row":10,"column":12},"action":"remove","lines":[" "],"id":725}],[{"start":{"row":10,"column":11},"end":{"row":10,"column":12},"action":"insert","lines":["."],"id":726}],[{"start":{"row":10,"column":12},"end":{"row":10,"column":13},"action":"insert","lines":["l"],"id":727}],[{"start":{"row":10,"column":13},"end":{"row":10,"column":14},"action":"insert","lines":["o"],"id":728}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"insert","lines":["g"],"id":729}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"insert","lines":[" "],"id":730}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"remove","lines":[" "],"id":731}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"insert","lines":["("],"id":732}],[{"start":{"row":10,"column":32},"end":{"row":10,"column":33},"action":"insert","lines":[")"],"id":733}],[{"start":{"row":10,"column":33},"end":{"row":10,"column":34},"action":"insert","lines":[";"],"id":734}],[{"start":{"row":10,"column":5},"end":{"row":10,"column":16},"action":"remove","lines":["onsole.log("],"id":735}],[{"start":{"row":10,"column":4},"end":{"row":10,"column":5},"action":"remove","lines":["c"],"id":736}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"remove","lines":[";"],"id":737}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"remove","lines":[")"],"id":738}],[{"start":{"row":10,"column":4},"end":{"row":10,"column":5},"action":"insert","lines":["v"],"id":739}],[{"start":{"row":10,"column":5},"end":{"row":10,"column":6},"action":"insert","lines":["a"],"id":740}],[{"start":{"row":10,"column":6},"end":{"row":10,"column":7},"action":"insert","lines":["r"],"id":741}],[{"start":{"row":10,"column":7},"end":{"row":10,"column":8},"action":"insert","lines":[" "],"id":742}],[{"start":{"row":10,"column":7},"end":{"row":10,"column":8},"action":"remove","lines":[" "],"id":743}],[{"start":{"row":10,"column":7},"end":{"row":10,"column":8},"action":"insert","lines":[" "],"id":744}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"insert","lines":["s"],"id":745}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"remove","lines":["s"],"id":746}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"insert","lines":["t"],"id":747}],[{"start":{"row":10,"column":9},"end":{"row":10,"column":10},"action":"insert","lines":["e"],"id":748}],[{"start":{"row":10,"column":9},"end":{"row":10,"column":10},"action":"remove","lines":["e"],"id":749}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"remove","lines":["t"],"id":750}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"insert","lines":["q"],"id":751}],[{"start":{"row":10,"column":9},"end":{"row":10,"column":10},"action":"insert","lines":["u"],"id":752}],[{"start":{"row":10,"column":10},"end":{"row":10,"column":11},"action":"insert","lines":["e"],"id":753}],[{"start":{"row":10,"column":11},"end":{"row":10,"column":12},"action":"insert","lines":["r"],"id":754}],[{"start":{"row":10,"column":12},"end":{"row":10,"column":13},"action":"insert","lines":["y"],"id":755}],[{"start":{"row":10,"column":13},"end":{"row":10,"column":14},"action":"insert","lines":[" "],"id":756}],[{"start":{"row":10,"column":13},"end":{"row":10,"column":14},"action":"remove","lines":[" "],"id":757}],[{"start":{"row":10,"column":13},"end":{"row":10,"column":14},"action":"insert","lines":[" "],"id":758}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"insert","lines":["="],"id":759}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"insert","lines":[" "],"id":760}],[{"start":{"row":10,"column":32},"end":{"row":10,"column":33},"action":"insert","lines":[";"],"id":761}],[{"start":{"row":10,"column":33},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":762},{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":39},"action":"remove","lines":["iowa"],"id":763}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":37},"action":"insert","lines":[" "],"id":764}],[{"start":{"row":12,"column":37},"end":{"row":12,"column":38},"action":"insert","lines":["+"],"id":765}],[{"start":{"row":12,"column":38},"end":{"row":12,"column":39},"action":"insert","lines":[" "],"id":766}],[{"start":{"row":12,"column":39},"end":{"row":12,"column":40},"action":"insert","lines":["q"],"id":767}],[{"start":{"row":12,"column":40},"end":{"row":12,"column":41},"action":"insert","lines":["u"],"id":768}],[{"start":{"row":12,"column":41},"end":{"row":12,"column":42},"action":"insert","lines":["e"],"id":769}],[{"start":{"row":12,"column":42},"end":{"row":12,"column":43},"action":"insert","lines":["r"],"id":770}],[{"start":{"row":12,"column":43},"end":{"row":12,"column":44},"action":"insert","lines":["y"],"id":771}],[{"start":{"row":12,"column":44},"end":{"row":12,"column":45},"action":"insert","lines":[" "],"id":772}],[{"start":{"row":12,"column":44},"end":{"row":12,"column":45},"action":"remove","lines":[" "],"id":773}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":44},"action":"remove","lines":[" + query"],"id":774}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":36},"action":"remove","lines":["\"http://omdbapi.com/?s=\""],"id":775}],[{"start":{"row":10,"column":33},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":776},{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":5},"action":"insert","lines":["v"],"id":777}],[{"start":{"row":11,"column":5},"end":{"row":11,"column":6},"action":"insert","lines":["a"],"id":778}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"insert","lines":["r"],"id":779}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"insert","lines":[" "],"id":780}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"remove","lines":[" "],"id":781}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"insert","lines":[" "],"id":782}],[{"start":{"row":11,"column":8},"end":{"row":11,"column":9},"action":"insert","lines":["u"],"id":783}],[{"start":{"row":11,"column":9},"end":{"row":11,"column":10},"action":"insert","lines":["r"],"id":784}],[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"insert","lines":["l"],"id":785}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":[" "],"id":786}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"remove","lines":[" "],"id":787}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":[" "],"id":788}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["="],"id":789}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":[" "],"id":790}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":38},"action":"insert","lines":["\"http://omdbapi.com/?s=\""],"id":791}],[{"start":{"row":11,"column":38},"end":{"row":11,"column":39},"action":"insert","lines":[" "],"id":792}],[{"start":{"row":11,"column":39},"end":{"row":11,"column":40},"action":"insert","lines":["+"],"id":793}],[{"start":{"row":11,"column":40},"end":{"row":11,"column":41},"action":"insert","lines":[" "],"id":794}],[{"start":{"row":11,"column":41},"end":{"row":11,"column":42},"action":"insert","lines":["q"],"id":795}],[{"start":{"row":11,"column":42},"end":{"row":11,"column":43},"action":"insert","lines":["u"],"id":796}],[{"start":{"row":11,"column":43},"end":{"row":11,"column":44},"action":"insert","lines":["e"],"id":797}],[{"start":{"row":11,"column":44},"end":{"row":11,"column":45},"action":"insert","lines":["r"],"id":798}],[{"start":{"row":11,"column":45},"end":{"row":11,"column":46},"action":"insert","lines":["y"],"id":799}],[{"start":{"row":11,"column":46},"end":{"row":11,"column":47},"action":"insert","lines":[" "],"id":800}],[{"start":{"row":11,"column":46},"end":{"row":11,"column":47},"action":"remove","lines":[" "],"id":801}],[{"start":{"row":11,"column":46},"end":{"row":11,"column":47},"action":"insert","lines":["'"],"id":802}],[{"start":{"row":11,"column":47},"end":{"row":11,"column":48},"action":"insert","lines":[";"],"id":803}],[{"start":{"row":11,"column":47},"end":{"row":11,"column":48},"action":"remove","lines":[";"],"id":804}],[{"start":{"row":11,"column":46},"end":{"row":11,"column":47},"action":"remove","lines":["'"],"id":805}],[{"start":{"row":11,"column":46},"end":{"row":11,"column":47},"action":"insert","lines":[";"],"id":806}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":4},"action":"remove","lines":[" "],"id":807}],[{"start":{"row":11,"column":47},"end":{"row":12,"column":0},"action":"remove","lines":["",""],"id":808}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"insert","lines":["u"],"id":809}],[{"start":{"row":12,"column":13},"end":{"row":12,"column":14},"action":"insert","lines":["r"],"id":810}],[{"start":{"row":12,"column":14},"end":{"row":12,"column":15},"action":"insert","lines":["l"],"id":811}],[{"start":{"row":12,"column":43},"end":{"row":12,"column":44},"action":"remove","lines":[" "],"id":826}],[{"start":{"row":12,"column":43},"end":{"row":12,"column":44},"action":"insert","lines":[" "],"id":825}],[{"start":{"row":12,"column":42},"end":{"row":12,"column":43},"action":"insert","lines":["k"],"id":824}],[{"start":{"row":12,"column":41},"end":{"row":12,"column":42},"action":"insert","lines":["r"],"id":823}],[{"start":{"row":12,"column":40},"end":{"row":12,"column":41},"action":"insert","lines":["o"],"id":822}],[{"start":{"row":12,"column":39},"end":{"row":12,"column":40},"action":"insert","lines":["y"],"id":821}],[{"start":{"row":12,"column":38},"end":{"row":12,"column":39},"action":"insert","lines":[" "],"id":820}],[{"start":{"row":12,"column":37},"end":{"row":12,"column":38},"action":"insert","lines":["w"],"id":819}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":37},"action":"insert","lines":["e"],"id":818}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"insert","lines":["n"],"id":817}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"remove","lines":["N"],"id":816}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":37},"action":"remove","lines":["e"],"id":815}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":37},"action":"insert","lines":["e"],"id":814}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"insert","lines":["N"],"id":813}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":15},"action":"remove","lines":["url"],"id":812},{"start":{"row":12,"column":12},"end":{"row":12,"column":36},"action":"insert","lines":["\"http://omdbapi.com/?s=\""]}]]},"ace":{"folds":[],"scrolltop":186.0714626312256,"scrollleft":0,"selection":{"start":{"row":14,"column":28},"end":{"row":14,"column":28},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1463122001528,"hash":"eeff01f030e6932329f3c40ce1aaf9dee50ede0f"} \ No newline at end of file diff --git a/.c9/metadata/workspace/APIs/movie_search_app/views/results.ejs b/.c9/metadata/workspace/APIs/movie_search_app/views/results.ejs deleted file mode 100644 index 51f618da..00000000 --- a/.c9/metadata/workspace/APIs/movie_search_app/views/results.ejs +++ /dev/null @@ -1 +0,0 @@ -{"changed":false,"filter":false,"title":"results.ejs","tooltip":"/APIs/movie_search_app/views/results.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["o"],"id":198}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["n"],"id":199}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":["g"],"id":200}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":[" "],"id":201}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"remove","lines":[" "],"id":202}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":27},"action":"insert","lines":[">"],"id":203}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":48},"action":"remove","lines":["<%= movie[\"Title\"] %>"],"id":204}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":39},"action":"insert","lines":["<%= movie[\"Title\"] %>"],"id":205}],[{"start":{"row":5,"column":18},"end":{"row":6,"column":14},"action":"insert","lines":[""," "],"id":206}],[{"start":{"row":6,"column":35},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":207},{"start":{"row":7,"column":0},"end":{"row":7,"column":14},"action":"insert","lines":[" "]}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"remove","lines":[" "],"id":208}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"remove","lines":[" "],"id":209}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":12},"action":"remove","lines":[" "],"id":210}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":[" "],"id":211}],[{"start":{"row":7,"column":9},"end":{"row":7,"column":10},"action":"insert","lines":[" "],"id":212}],[{"start":{"row":7,"column":20},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":213},{"start":{"row":8,"column":0},"end":{"row":8,"column":10},"action":"insert","lines":[" "]}],[{"start":{"row":11,"column":5},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":214}],[{"start":{"row":12,"column":0},"end":{"row":13,"column":0},"action":"insert","lines":["",""],"id":215}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"insert","lines":["<"],"id":216}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"remove","lines":["<"],"id":217}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"insert","lines":["a"],"id":218}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"remove","lines":["a"],"id":219},{"start":{"row":13,"column":0},"end":{"row":13,"column":3},"action":"insert","lines":["app"]}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":3},"action":"remove","lines":["p"],"id":220}],[{"start":{"row":13,"column":1},"end":{"row":13,"column":2},"action":"remove","lines":["p"],"id":221}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"remove","lines":["a"],"id":222}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"insert","lines":["<"],"id":223}],[{"start":{"row":13,"column":1},"end":{"row":13,"column":4},"action":"insert","lines":[" "],"id":224}],[{"start":{"row":13,"column":3},"end":{"row":13,"column":4},"action":"remove","lines":[" "],"id":225}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":3},"action":"remove","lines":[" "],"id":226}],[{"start":{"row":13,"column":1},"end":{"row":13,"column":2},"action":"remove","lines":[" "],"id":227}],[{"start":{"row":13,"column":1},"end":{"row":13,"column":2},"action":"insert","lines":["a"],"id":228}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":7},"action":"insert","lines":[">"],"id":229}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":3},"action":"insert","lines":[" "],"id":230}],[{"start":{"row":13,"column":3},"end":{"row":13,"column":4},"action":"insert","lines":["h"],"id":231}],[{"start":{"row":13,"column":4},"end":{"row":13,"column":5},"action":"insert","lines":["r"],"id":232}],[{"start":{"row":13,"column":5},"end":{"row":13,"column":6},"action":"insert","lines":["e"],"id":233}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"insert","lines":["f"],"id":234}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"insert","lines":[" "],"id":235}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"remove","lines":[" "],"id":236}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"insert","lines":["="],"id":237}],[{"start":{"row":13,"column":8},"end":{"row":13,"column":10},"action":"insert","lines":["\"\""],"id":238}],[{"start":{"row":13,"column":9},"end":{"row":13,"column":10},"action":"insert","lines":["/"],"id":239}],[{"start":{"row":13,"column":12},"end":{"row":13,"column":13},"action":"insert","lines":["B"],"id":240}],[{"start":{"row":13,"column":12},"end":{"row":13,"column":13},"action":"remove","lines":["B"],"id":241}],[{"start":{"row":13,"column":12},"end":{"row":13,"column":13},"action":"insert","lines":["S"],"id":242}],[{"start":{"row":13,"column":13},"end":{"row":13,"column":14},"action":"insert","lines":["e"],"id":243}],[{"start":{"row":13,"column":14},"end":{"row":13,"column":15},"action":"insert","lines":["a"],"id":244}],[{"start":{"row":13,"column":15},"end":{"row":13,"column":16},"action":"insert","lines":["r"],"id":245}],[{"start":{"row":13,"column":16},"end":{"row":13,"column":17},"action":"insert","lines":["c"],"id":246}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"insert","lines":["h"],"id":247}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"insert","lines":[" "],"id":248}],[{"start":{"row":13,"column":19},"end":{"row":13,"column":20},"action":"insert","lines":["A"],"id":249}],[{"start":{"row":13,"column":20},"end":{"row":13,"column":21},"action":"insert","lines":["g"],"id":250}],[{"start":{"row":13,"column":21},"end":{"row":13,"column":22},"action":"insert","lines":["a"],"id":251}],[{"start":{"row":13,"column":22},"end":{"row":13,"column":23},"action":"insert","lines":["i"],"id":252}],[{"start":{"row":13,"column":23},"end":{"row":13,"column":24},"action":"insert","lines":["n"],"id":253}],[{"start":{"row":13,"column":24},"end":{"row":13,"column":25},"action":"insert","lines":[" "],"id":254}],[{"start":{"row":13,"column":24},"end":{"row":13,"column":25},"action":"remove","lines":[" "],"id":255}],[{"start":{"row":13,"column":24},"end":{"row":13,"column":25},"action":"insert","lines":["!"],"id":256}],[{"start":{"row":8,"column":30},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":257},{"start":{"row":9,"column":0},"end":{"row":9,"column":10},"action":"insert","lines":[" "]}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["i"],"id":258}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":["m"],"id":259}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":["g"],"id":260}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":13},"action":"remove","lines":["img"],"id":261},{"start":{"row":9,"column":10},"end":{"row":9,"column":21},"action":"insert","lines":[""]}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":[" "],"id":262}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"insert","lines":["s"],"id":263}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"insert","lines":["r"],"id":264}],[{"start":{"row":9,"column":17},"end":{"row":9,"column":18},"action":"insert","lines":["c"],"id":265}],[{"start":{"row":9,"column":18},"end":{"row":9,"column":19},"action":"insert","lines":[" "],"id":266}],[{"start":{"row":9,"column":18},"end":{"row":9,"column":19},"action":"remove","lines":[" "],"id":267}],[{"start":{"row":9,"column":18},"end":{"row":9,"column":19},"action":"insert","lines":["="],"id":268}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":21},"action":"insert","lines":["\"\""],"id":269}],[{"start":{"row":9,"column":20},"end":{"row":9,"column":21},"action":"insert","lines":["<"],"id":270}],[{"start":{"row":9,"column":21},"end":{"row":9,"column":22},"action":"insert","lines":["%"],"id":271}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":[">"],"id":272}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":31},"action":"remove","lines":["/img>"],"id":273}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"remove","lines":["<"],"id":274}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":["-"],"id":275}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"remove","lines":["-"],"id":276}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":["="],"id":277}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["%"],"id":278}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["m"],"id":279}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"insert","lines":["o"],"id":280}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"insert","lines":["v"],"id":281}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"insert","lines":["i"],"id":282}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"insert","lines":["e"],"id":283}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":[" "],"id":284}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"remove","lines":[" "],"id":285}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":["["],"id":286}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":["'"],"id":287}],[{"start":{"row":9,"column":30},"end":{"row":9,"column":31},"action":"insert","lines":["P"],"id":288}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"insert","lines":["o"],"id":289}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"insert","lines":["s"],"id":290}],[{"start":{"row":9,"column":33},"end":{"row":9,"column":34},"action":"insert","lines":["t"],"id":291}],[{"start":{"row":9,"column":34},"end":{"row":9,"column":35},"action":"insert","lines":["e"],"id":292}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":39},"action":"remove","lines":["\">"],"id":296}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"remove","lines":[" "],"id":297}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"remove","lines":[" "],"id":298}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":8},"action":"remove","lines":[" "],"id":299}],[{"start":{"row":9,"column":0},"end":{"row":9,"column":4},"action":"remove","lines":[" "],"id":300}],[{"start":{"row":8,"column":30},"end":{"row":9,"column":0},"action":"remove","lines":["",""],"id":301}]]},"ace":{"folds":[],"scrolltop":40.5,"scrollleft":0,"selection":{"start":{"row":10,"column":12},"end":{"row":10,"column":12},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":0,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1463122137162} \ No newline at end of file diff --git a/.c9/metadata/workspace/APIs/movie_search_app/views/search.ejs b/.c9/metadata/workspace/APIs/movie_search_app/views/search.ejs deleted file mode 100644 index bfd84d96..00000000 --- a/.c9/metadata/workspace/APIs/movie_search_app/views/search.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"search.ejs","tooltip":"/APIs/movie_search_app/views/search.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":3,"column":49},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":89},{"start":{"row":4,"column":0},"end":{"row":4,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":["<"],"id":90}],[{"start":{"row":4,"column":5},"end":{"row":4,"column":6},"action":"insert","lines":["i"],"id":91}],[{"start":{"row":4,"column":6},"end":{"row":4,"column":7},"action":"insert","lines":["n"],"id":92}],[{"start":{"row":4,"column":7},"end":{"row":4,"column":8},"action":"insert","lines":["p"],"id":93}],[{"start":{"row":4,"column":8},"end":{"row":4,"column":9},"action":"insert","lines":["u"],"id":94}],[{"start":{"row":4,"column":9},"end":{"row":4,"column":10},"action":"insert","lines":["t"],"id":95}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":[" "],"id":96}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"remove","lines":[" "],"id":97}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":[" "],"id":98}],[{"start":{"row":4,"column":11},"end":{"row":4,"column":12},"action":"insert","lines":["t"],"id":99}],[{"start":{"row":4,"column":12},"end":{"row":4,"column":13},"action":"insert","lines":["y"],"id":100}],[{"start":{"row":4,"column":13},"end":{"row":4,"column":14},"action":"insert","lines":["p"],"id":101}],[{"start":{"row":4,"column":14},"end":{"row":4,"column":15},"action":"insert","lines":["e"],"id":102}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":[" "],"id":103}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"remove","lines":[" "],"id":104}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":["="],"id":105}],[{"start":{"row":4,"column":16},"end":{"row":4,"column":18},"action":"insert","lines":["\"\""],"id":106}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":["S"],"id":107}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"insert","lines":["u"],"id":108}],[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"insert","lines":["b"],"id":109}],[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"remove","lines":["b"],"id":110}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"remove","lines":["u"],"id":111}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"remove","lines":["S"],"id":112}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":["s"],"id":113}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"insert","lines":["u"],"id":114}],[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"insert","lines":["b"],"id":115}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":["m"],"id":116}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":["i"],"id":117}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"insert","lines":["t"],"id":118}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"insert","lines":[" "],"id":119}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"remove","lines":[" "],"id":120}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":[">"],"id":121}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":[" "],"id":122}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["a"],"id":123}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["c"],"id":124}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["t"],"id":125}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["i"],"id":126}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["o"],"id":127}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["n"],"id":128}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":[" "],"id":129}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"remove","lines":[" "],"id":130}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["="],"id":131}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":15},"action":"insert","lines":["\"\""],"id":132}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["/"],"id":133}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["r"],"id":134}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["e"],"id":135}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["s"],"id":136}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["u"],"id":137}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["l"],"id":138}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":["t"],"id":139}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["s"],"id":140}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":[" "],"id":141}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"remove","lines":[" "],"id":142}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":[" "],"id":143}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["m"],"id":144}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["e"],"id":145}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":["t"],"id":146}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["h"],"id":147}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":["o"],"id":148}],[{"start":{"row":2,"column":29},"end":{"row":2,"column":30},"action":"insert","lines":["d"],"id":149}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":[" "],"id":150}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"remove","lines":[" "],"id":151}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":["="],"id":152}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":33},"action":"insert","lines":["\"\""],"id":153}],[{"start":{"row":2,"column":32},"end":{"row":2,"column":33},"action":"insert","lines":["G"],"id":154}],[{"start":{"row":2,"column":33},"end":{"row":2,"column":34},"action":"insert","lines":["E"],"id":155}],[{"start":{"row":2,"column":34},"end":{"row":2,"column":35},"action":"insert","lines":["T"],"id":156}],[{"start":{"row":3,"column":48},"end":{"row":3,"column":49},"action":"insert","lines":[" "],"id":157}],[{"start":{"row":3,"column":49},"end":{"row":3,"column":50},"action":"insert","lines":["n"],"id":158}],[{"start":{"row":3,"column":50},"end":{"row":3,"column":51},"action":"insert","lines":["a"],"id":159}],[{"start":{"row":3,"column":51},"end":{"row":3,"column":52},"action":"insert","lines":["m"],"id":160}],[{"start":{"row":3,"column":52},"end":{"row":3,"column":53},"action":"insert","lines":["e"],"id":161}],[{"start":{"row":3,"column":53},"end":{"row":3,"column":54},"action":"insert","lines":[" "],"id":162}],[{"start":{"row":3,"column":53},"end":{"row":3,"column":54},"action":"remove","lines":[" "],"id":163}],[{"start":{"row":3,"column":53},"end":{"row":3,"column":54},"action":"insert","lines":["="],"id":164}],[{"start":{"row":3,"column":54},"end":{"row":3,"column":56},"action":"insert","lines":["\"\""],"id":165}],[{"start":{"row":3,"column":55},"end":{"row":3,"column":56},"action":"insert","lines":["q"],"id":166}],[{"start":{"row":3,"column":56},"end":{"row":3,"column":57},"action":"insert","lines":["u"],"id":167}],[{"start":{"row":3,"column":57},"end":{"row":3,"column":58},"action":"insert","lines":["e"],"id":168}],[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"insert","lines":["r"],"id":169}],[{"start":{"row":3,"column":59},"end":{"row":3,"column":60},"action":"insert","lines":["y"],"id":170}],[{"start":{"row":3,"column":59},"end":{"row":3,"column":60},"action":"remove","lines":["y"],"id":171}],[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"remove","lines":["r"],"id":172}],[{"start":{"row":3,"column":57},"end":{"row":3,"column":58},"action":"remove","lines":["e"],"id":173}],[{"start":{"row":3,"column":56},"end":{"row":3,"column":57},"action":"remove","lines":["u"],"id":174}],[{"start":{"row":3,"column":55},"end":{"row":3,"column":56},"action":"remove","lines":["q"],"id":175}],[{"start":{"row":3,"column":55},"end":{"row":3,"column":56},"action":"insert","lines":["t"],"id":176}],[{"start":{"row":3,"column":56},"end":{"row":3,"column":57},"action":"insert","lines":["e"],"id":177}],[{"start":{"row":3,"column":57},"end":{"row":3,"column":58},"action":"insert","lines":["r"],"id":178}],[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"insert","lines":["m"],"id":179}],[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"remove","lines":["m"],"id":180}],[{"start":{"row":3,"column":57},"end":{"row":3,"column":58},"action":"remove","lines":["r"],"id":181}],[{"start":{"row":3,"column":56},"end":{"row":3,"column":57},"action":"remove","lines":["e"],"id":182}],[{"start":{"row":3,"column":55},"end":{"row":3,"column":56},"action":"remove","lines":["t"],"id":183}],[{"start":{"row":3,"column":55},"end":{"row":3,"column":56},"action":"insert","lines":["s"],"id":184}],[{"start":{"row":3,"column":56},"end":{"row":3,"column":57},"action":"insert","lines":["e"],"id":185}],[{"start":{"row":3,"column":57},"end":{"row":3,"column":58},"action":"insert","lines":["a"],"id":186}],[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"insert","lines":["r"],"id":187}],[{"start":{"row":3,"column":59},"end":{"row":3,"column":60},"action":"insert","lines":["c"],"id":188}],[{"start":{"row":3,"column":60},"end":{"row":3,"column":61},"action":"insert","lines":["h"],"id":189}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":7},"end":{"row":5,"column":7},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":0,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1463121646114,"hash":"e89541cbbe5e64a990666a58cad348ee27f49bef"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Associations/embed.js b/.c9/metadata/workspace/Associations/embed.js deleted file mode 100644 index 1907b7ab..00000000 --- a/.c9/metadata/workspace/Associations/embed.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"embed.js","tooltip":"/Associations/embed.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":58,"column":17},"end":{"row":58,"column":18},"action":"insert","lines":[" "],"id":2698}],[{"start":{"row":58,"column":17},"end":{"row":58,"column":18},"action":"remove","lines":[" "],"id":2699}],[{"start":{"row":58,"column":17},"end":{"row":58,"column":19},"action":"insert","lines":["()"],"id":2700}],[{"start":{"row":58,"column":19},"end":{"row":58,"column":20},"action":"insert","lines":[";"],"id":2701}],[{"start":{"row":58,"column":18},"end":{"row":58,"column":19},"action":"insert","lines":["f"],"id":2702}],[{"start":{"row":58,"column":19},"end":{"row":58,"column":20},"action":"insert","lines":["u"],"id":2703}],[{"start":{"row":58,"column":20},"end":{"row":58,"column":21},"action":"insert","lines":["n"],"id":2704}],[{"start":{"row":58,"column":21},"end":{"row":58,"column":22},"action":"insert","lines":["c"],"id":2705}],[{"start":{"row":58,"column":22},"end":{"row":58,"column":23},"action":"insert","lines":["t"],"id":2706}],[{"start":{"row":58,"column":23},"end":{"row":58,"column":24},"action":"insert","lines":["i"],"id":2707}],[{"start":{"row":58,"column":24},"end":{"row":58,"column":25},"action":"insert","lines":["o"],"id":2708}],[{"start":{"row":58,"column":25},"end":{"row":58,"column":26},"action":"insert","lines":["n"],"id":2709}],[{"start":{"row":58,"column":26},"end":{"row":58,"column":27},"action":"insert","lines":[" "],"id":2710}],[{"start":{"row":58,"column":26},"end":{"row":58,"column":27},"action":"remove","lines":[" "],"id":2711}],[{"start":{"row":58,"column":26},"end":{"row":58,"column":28},"action":"insert","lines":["()"],"id":2712}],[{"start":{"row":58,"column":28},"end":{"row":58,"column":30},"action":"insert","lines":["{}"],"id":2713}],[{"start":{"row":58,"column":29},"end":{"row":60,"column":8},"action":"insert","lines":[""," "," "],"id":2714}],[{"start":{"row":58,"column":27},"end":{"row":58,"column":28},"action":"insert","lines":["e"],"id":2715}],[{"start":{"row":58,"column":28},"end":{"row":58,"column":29},"action":"insert","lines":["r"],"id":2716}],[{"start":{"row":58,"column":29},"end":{"row":58,"column":30},"action":"insert","lines":["r"],"id":2717}],[{"start":{"row":58,"column":30},"end":{"row":58,"column":31},"action":"insert","lines":[" "],"id":2718}],[{"start":{"row":58,"column":30},"end":{"row":58,"column":31},"action":"remove","lines":[" "],"id":2719}],[{"start":{"row":58,"column":30},"end":{"row":58,"column":31},"action":"insert","lines":[","],"id":2720}],[{"start":{"row":58,"column":31},"end":{"row":58,"column":32},"action":"insert","lines":[" "],"id":2721}],[{"start":{"row":58,"column":32},"end":{"row":58,"column":33},"action":"insert","lines":["u"],"id":2722}],[{"start":{"row":58,"column":33},"end":{"row":58,"column":34},"action":"insert","lines":["s"],"id":2723}],[{"start":{"row":58,"column":34},"end":{"row":58,"column":35},"action":"insert","lines":["e"],"id":2724}],[{"start":{"row":58,"column":35},"end":{"row":58,"column":36},"action":"insert","lines":["r"],"id":2725}],[{"start":{"row":58,"column":36},"end":{"row":58,"column":37},"action":"insert","lines":[" "],"id":2726}],[{"start":{"row":58,"column":36},"end":{"row":58,"column":37},"action":"remove","lines":[" "],"id":2727}],[{"start":{"row":59,"column":12},"end":{"row":59,"column":13},"action":"insert","lines":["c"],"id":2728}],[{"start":{"row":59,"column":12},"end":{"row":59,"column":13},"action":"remove","lines":["c"],"id":2729}],[{"start":{"row":59,"column":12},"end":{"row":59,"column":13},"action":"insert","lines":["i"],"id":2730}],[{"start":{"row":59,"column":13},"end":{"row":59,"column":14},"action":"insert","lines":["f"],"id":2731}],[{"start":{"row":59,"column":14},"end":{"row":59,"column":15},"action":"insert","lines":[" "],"id":2732}],[{"start":{"row":59,"column":14},"end":{"row":59,"column":15},"action":"remove","lines":[" "],"id":2733}],[{"start":{"row":59,"column":14},"end":{"row":59,"column":16},"action":"insert","lines":["()"],"id":2734}],[{"start":{"row":59,"column":15},"end":{"row":59,"column":16},"action":"insert","lines":["e"],"id":2735}],[{"start":{"row":59,"column":16},"end":{"row":59,"column":17},"action":"insert","lines":["r"],"id":2736}],[{"start":{"row":59,"column":17},"end":{"row":59,"column":18},"action":"insert","lines":["r"],"id":2737}],[{"start":{"row":59,"column":18},"end":{"row":59,"column":19},"action":"insert","lines":[" "],"id":2738}],[{"start":{"row":59,"column":18},"end":{"row":59,"column":19},"action":"remove","lines":[" "],"id":2739}],[{"start":{"row":59,"column":19},"end":{"row":59,"column":20},"action":"insert","lines":["{"],"id":2740}],[{"start":{"row":59,"column":20},"end":{"row":61,"column":13},"action":"insert","lines":[""," "," }"],"id":2741}],[{"start":{"row":60,"column":16},"end":{"row":60,"column":17},"action":"insert","lines":["c"],"id":2742}],[{"start":{"row":60,"column":17},"end":{"row":60,"column":18},"action":"insert","lines":["o"],"id":2743}],[{"start":{"row":60,"column":18},"end":{"row":60,"column":19},"action":"insert","lines":["n"],"id":2744}],[{"start":{"row":60,"column":19},"end":{"row":60,"column":20},"action":"insert","lines":["o"],"id":2745}],[{"start":{"row":60,"column":20},"end":{"row":60,"column":21},"action":"insert","lines":["l"],"id":2746}],[{"start":{"row":60,"column":20},"end":{"row":60,"column":21},"action":"remove","lines":["l"],"id":2747}],[{"start":{"row":60,"column":19},"end":{"row":60,"column":20},"action":"remove","lines":["o"],"id":2748}],[{"start":{"row":60,"column":19},"end":{"row":60,"column":20},"action":"insert","lines":["s"],"id":2749}],[{"start":{"row":60,"column":20},"end":{"row":60,"column":21},"action":"insert","lines":["o"],"id":2750}],[{"start":{"row":60,"column":21},"end":{"row":60,"column":22},"action":"insert","lines":["l"],"id":2751}],[{"start":{"row":60,"column":22},"end":{"row":60,"column":23},"action":"insert","lines":["e"],"id":2752}],[{"start":{"row":60,"column":23},"end":{"row":60,"column":24},"action":"insert","lines":[" "],"id":2753},{"start":{"row":60,"column":23},"end":{"row":60,"column":24},"action":"remove","lines":[" "]}],[{"start":{"row":60,"column":23},"end":{"row":60,"column":24},"action":"insert","lines":["."],"id":2754}],[{"start":{"row":60,"column":24},"end":{"row":60,"column":25},"action":"insert","lines":["l"],"id":2755}],[{"start":{"row":60,"column":25},"end":{"row":60,"column":26},"action":"insert","lines":["o"],"id":2756}],[{"start":{"row":60,"column":26},"end":{"row":60,"column":27},"action":"insert","lines":["g"],"id":2757}],[{"start":{"row":60,"column":27},"end":{"row":60,"column":28},"action":"insert","lines":[" "],"id":2758}],[{"start":{"row":60,"column":27},"end":{"row":60,"column":28},"action":"remove","lines":[" "],"id":2759}],[{"start":{"row":60,"column":27},"end":{"row":60,"column":29},"action":"insert","lines":["()"],"id":2760}],[{"start":{"row":60,"column":28},"end":{"row":60,"column":29},"action":"insert","lines":["e"],"id":2761}],[{"start":{"row":60,"column":29},"end":{"row":60,"column":30},"action":"insert","lines":["r"],"id":2762}],[{"start":{"row":60,"column":30},"end":{"row":60,"column":31},"action":"insert","lines":["r"],"id":2763}],[{"start":{"row":60,"column":32},"end":{"row":60,"column":33},"action":"insert","lines":[";"],"id":2764}],[{"start":{"row":61,"column":13},"end":{"row":61,"column":14},"action":"insert","lines":[" "],"id":2765}],[{"start":{"row":61,"column":14},"end":{"row":61,"column":15},"action":"insert","lines":["e"],"id":2766}],[{"start":{"row":61,"column":15},"end":{"row":61,"column":16},"action":"insert","lines":["l"],"id":2767}],[{"start":{"row":61,"column":16},"end":{"row":61,"column":17},"action":"insert","lines":["s"],"id":2768}],[{"start":{"row":61,"column":17},"end":{"row":61,"column":18},"action":"insert","lines":["e"],"id":2769}],[{"start":{"row":61,"column":18},"end":{"row":61,"column":19},"action":"insert","lines":[" "],"id":2770}],[{"start":{"row":61,"column":18},"end":{"row":61,"column":19},"action":"remove","lines":[" "],"id":2771}],[{"start":{"row":61,"column":18},"end":{"row":61,"column":19},"action":"insert","lines":[" "],"id":2772}],[{"start":{"row":61,"column":19},"end":{"row":61,"column":20},"action":"insert","lines":["{"],"id":2773}],[{"start":{"row":61,"column":20},"end":{"row":63,"column":13},"action":"insert","lines":[""," "," }"],"id":2774}],[{"start":{"row":62,"column":16},"end":{"row":62,"column":17},"action":"insert","lines":["c"],"id":2775}],[{"start":{"row":62,"column":17},"end":{"row":62,"column":18},"action":"insert","lines":["o"],"id":2776}],[{"start":{"row":62,"column":18},"end":{"row":62,"column":19},"action":"insert","lines":["n"],"id":2777}],[{"start":{"row":62,"column":19},"end":{"row":62,"column":20},"action":"insert","lines":["s"],"id":2778}],[{"start":{"row":62,"column":20},"end":{"row":62,"column":21},"action":"insert","lines":["o"],"id":2779}],[{"start":{"row":62,"column":21},"end":{"row":62,"column":22},"action":"insert","lines":["l"],"id":2780}],[{"start":{"row":62,"column":22},"end":{"row":62,"column":23},"action":"insert","lines":["e"],"id":2781}],[{"start":{"row":62,"column":23},"end":{"row":62,"column":24},"action":"insert","lines":[" "],"id":2782}],[{"start":{"row":62,"column":23},"end":{"row":62,"column":24},"action":"remove","lines":[" "],"id":2783}],[{"start":{"row":62,"column":23},"end":{"row":62,"column":24},"action":"insert","lines":["."],"id":2784}],[{"start":{"row":62,"column":24},"end":{"row":62,"column":25},"action":"insert","lines":["l"],"id":2785}],[{"start":{"row":62,"column":25},"end":{"row":62,"column":26},"action":"insert","lines":["o"],"id":2786}],[{"start":{"row":62,"column":26},"end":{"row":62,"column":27},"action":"insert","lines":["g"],"id":2787}],[{"start":{"row":62,"column":27},"end":{"row":62,"column":28},"action":"insert","lines":[" "],"id":2788}],[{"start":{"row":62,"column":27},"end":{"row":62,"column":28},"action":"remove","lines":[" "],"id":2789}],[{"start":{"row":62,"column":27},"end":{"row":62,"column":29},"action":"insert","lines":["()"],"id":2790}],[{"start":{"row":62,"column":28},"end":{"row":62,"column":29},"action":"insert","lines":["u"],"id":2791}],[{"start":{"row":62,"column":29},"end":{"row":62,"column":30},"action":"insert","lines":["s"],"id":2792}],[{"start":{"row":62,"column":30},"end":{"row":62,"column":31},"action":"insert","lines":["e"],"id":2793}],[{"start":{"row":62,"column":31},"end":{"row":62,"column":32},"action":"insert","lines":["r"],"id":2794}],[{"start":{"row":62,"column":32},"end":{"row":62,"column":33},"action":"insert","lines":[" "],"id":2795}],[{"start":{"row":62,"column":32},"end":{"row":62,"column":33},"action":"remove","lines":[" "],"id":2796}],[{"start":{"row":62,"column":33},"end":{"row":62,"column":34},"action":"insert","lines":[";"],"id":2797}],[{"start":{"row":52,"column":8},"end":{"row":52,"column":11},"action":"insert","lines":["// "],"id":2798}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":6,"column":18},"end":{"row":6,"column":18},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445294250000,"hash":"43389082f283456b533a40683bab55229e3987d0"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Associations/models/post.js b/.c9/metadata/workspace/Associations/models/post.js deleted file mode 100644 index 88aa8a20..00000000 --- a/.c9/metadata/workspace/Associations/models/post.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"post.js","tooltip":"/Associations/models/post.js","undoManager":{"mark":-1,"position":-1,"stack":[[{"start":{"row":7,"column":0},"end":{"row":7,"column":17},"action":"remove","lines":["module.exports = "],"id":215}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":18},"end":{"row":5,"column":18},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445310293210,"hash":"d63e38b940f0c4f62c9808fc16c746fefc496173"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Associations/models/user.js b/.c9/metadata/workspace/Associations/models/user.js deleted file mode 100644 index 4f5e2bb3..00000000 --- a/.c9/metadata/workspace/Associations/models/user.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"user.js","tooltip":"/Associations/models/user.js","undoManager":{"mark":65,"position":65,"stack":[[{"start":{"row":0,"column":0},"end":{"row":11,"column":46},"action":"insert","lines":["// USER - email, name","var userSchema = new mongoose.Schema({"," email: String,"," name: String,"," posts: ["," {"," type: mongoose.Schema.Types.ObjectId,"," ref: \"Post\""," }"," ]","});","var User = mongoose.model(\"User\", userSchema);"],"id":1}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":2}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["m"],"id":3}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"remove","lines":["m"],"id":4}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["v"],"id":5}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["a"],"id":6}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["r"],"id":7}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":[" "],"id":8}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"remove","lines":[" "],"id":9}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":[" "],"id":10}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["m"],"id":11}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["o"],"id":12}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["n"],"id":13}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["g"],"id":14}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["o"],"id":15}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["o"],"id":16}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["s"],"id":17}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["e"],"id":18}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":[" "],"id":19}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"remove","lines":[" "],"id":20}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":[" "],"id":21}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["="],"id":22}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":[" "],"id":23}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["r"],"id":24}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["e"],"id":25}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["q"],"id":26}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["u"],"id":27}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["i"],"id":28}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["r"],"id":29}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["e"],"id":30}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":[" "],"id":31}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"remove","lines":[" "],"id":32}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":24},"action":"insert","lines":["()"],"id":33}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":25},"action":"insert","lines":["\"\""],"id":34}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":["m"],"id":35}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"insert","lines":["o"],"id":36}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":["n"],"id":37}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["g"],"id":38}],[{"start":{"row":0,"column":28},"end":{"row":0,"column":29},"action":"insert","lines":["o"],"id":39}],[{"start":{"row":0,"column":29},"end":{"row":0,"column":30},"action":"insert","lines":["o"],"id":40}],[{"start":{"row":0,"column":30},"end":{"row":0,"column":31},"action":"insert","lines":["s"],"id":41}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"insert","lines":["e"],"id":42}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"insert","lines":[" "],"id":43}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"remove","lines":[" "],"id":44}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"insert","lines":[";"],"id":45}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":11},"action":"remove","lines":["var User = "],"id":46},{"start":{"row":12,"column":0},"end":{"row":12,"column":1},"action":"insert","lines":["m"]}],[{"start":{"row":12,"column":1},"end":{"row":12,"column":2},"action":"insert","lines":["o"],"id":47}],[{"start":{"row":12,"column":2},"end":{"row":12,"column":3},"action":"insert","lines":["d"],"id":48}],[{"start":{"row":12,"column":3},"end":{"row":12,"column":4},"action":"insert","lines":["u"],"id":49}],[{"start":{"row":12,"column":4},"end":{"row":12,"column":5},"action":"insert","lines":["l"],"id":50}],[{"start":{"row":12,"column":5},"end":{"row":12,"column":6},"action":"insert","lines":["e"],"id":51}],[{"start":{"row":12,"column":6},"end":{"row":12,"column":7},"action":"insert","lines":[" "],"id":52}],[{"start":{"row":12,"column":6},"end":{"row":12,"column":7},"action":"remove","lines":[" "],"id":53}],[{"start":{"row":12,"column":6},"end":{"row":12,"column":7},"action":"insert","lines":["."],"id":54}],[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"insert","lines":["e"],"id":55}],[{"start":{"row":12,"column":8},"end":{"row":12,"column":9},"action":"insert","lines":["x"],"id":56}],[{"start":{"row":12,"column":9},"end":{"row":12,"column":10},"action":"insert","lines":["p"],"id":57}],[{"start":{"row":12,"column":10},"end":{"row":12,"column":11},"action":"insert","lines":["o"],"id":58}],[{"start":{"row":12,"column":11},"end":{"row":12,"column":12},"action":"insert","lines":["r"],"id":59}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"insert","lines":["t"],"id":60}],[{"start":{"row":12,"column":13},"end":{"row":12,"column":14},"action":"insert","lines":["s"],"id":61}],[{"start":{"row":12,"column":14},"end":{"row":12,"column":15},"action":"insert","lines":[" "],"id":62}],[{"start":{"row":12,"column":14},"end":{"row":12,"column":15},"action":"remove","lines":[" "],"id":63}],[{"start":{"row":12,"column":14},"end":{"row":12,"column":15},"action":"insert","lines":[" "],"id":64}],[{"start":{"row":12,"column":15},"end":{"row":12,"column":16},"action":"insert","lines":["="],"id":65}],[{"start":{"row":12,"column":16},"end":{"row":12,"column":17},"action":"insert","lines":[" "],"id":66}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":17},"action":"remove","lines":["module.exports = "],"id":72}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":6,"column":8},"end":{"row":9,"column":9},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445310296246,"hash":"60ba06cd696f3ef12c6e2785acd334b9e9598507"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Associations/readme.md b/.c9/metadata/workspace/Associations/readme.md deleted file mode 100644 index 7bf1f0c1..00000000 --- a/.c9/metadata/workspace/Associations/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/Associations/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":12,"column":8},"end":{"row":12,"column":9},"action":"remove","lines":[" "],"id":487}],[{"start":{"row":12,"column":8},"end":{"row":12,"column":9},"action":"insert","lines":["."],"id":488}],[{"start":{"row":12,"column":9},"end":{"row":12,"column":10},"action":"insert","lines":["E"],"id":489}],[{"start":{"row":12,"column":10},"end":{"row":12,"column":11},"action":"insert","lines":["x"],"id":490}],[{"start":{"row":12,"column":11},"end":{"row":12,"column":12},"action":"insert","lines":["p"],"id":491}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"insert","lines":["o"],"id":492}],[{"start":{"row":12,"column":13},"end":{"row":12,"column":14},"action":"insert","lines":["r"],"id":493}],[{"start":{"row":12,"column":14},"end":{"row":12,"column":15},"action":"insert","lines":["t"],"id":494}],[{"start":{"row":12,"column":15},"end":{"row":12,"column":16},"action":"insert","lines":["s"],"id":495}],[{"start":{"row":12,"column":16},"end":{"row":12,"column":17},"action":"insert","lines":[" "],"id":496}],[{"start":{"row":12,"column":16},"end":{"row":12,"column":17},"action":"remove","lines":[" "],"id":497}],[{"start":{"row":12,"column":16},"end":{"row":13,"column":0},"action":"insert","lines":["",""],"id":498}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"insert","lines":["*"],"id":499}],[{"start":{"row":13,"column":1},"end":{"row":13,"column":2},"action":"insert","lines":[" "],"id":500}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":3},"action":"insert","lines":["C"],"id":501}],[{"start":{"row":13,"column":3},"end":{"row":13,"column":4},"action":"insert","lines":["l"],"id":502}],[{"start":{"row":13,"column":4},"end":{"row":13,"column":5},"action":"insert","lines":["e"],"id":503}],[{"start":{"row":13,"column":5},"end":{"row":13,"column":6},"action":"insert","lines":["a"],"id":504}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"insert","lines":["r"],"id":505}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"insert","lines":["n"],"id":506}],[{"start":{"row":13,"column":8},"end":{"row":13,"column":9},"action":"insert","lines":[" "],"id":507}],[{"start":{"row":13,"column":8},"end":{"row":13,"column":9},"action":"remove","lines":[" "],"id":508}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"remove","lines":["n"],"id":509}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"remove","lines":["r"],"id":510}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"insert","lines":["n"],"id":511}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"remove","lines":["n"],"id":512}],[{"start":{"row":13,"column":5},"end":{"row":13,"column":6},"action":"remove","lines":["a"],"id":513}],[{"start":{"row":13,"column":4},"end":{"row":13,"column":5},"action":"remove","lines":["e"],"id":514}],[{"start":{"row":13,"column":3},"end":{"row":13,"column":4},"action":"remove","lines":["l"],"id":515}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":3},"action":"remove","lines":["C"],"id":516}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":3},"action":"insert","lines":["M"],"id":517}],[{"start":{"row":13,"column":3},"end":{"row":13,"column":4},"action":"insert","lines":["o"],"id":518}],[{"start":{"row":13,"column":4},"end":{"row":13,"column":5},"action":"insert","lines":["v"],"id":519}],[{"start":{"row":13,"column":5},"end":{"row":13,"column":6},"action":"insert","lines":["e"],"id":520}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"insert","lines":[" "],"id":521}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"insert","lines":["o"],"id":522}],[{"start":{"row":13,"column":8},"end":{"row":13,"column":9},"action":"insert","lines":["u"],"id":523}],[{"start":{"row":13,"column":9},"end":{"row":13,"column":10},"action":"insert","lines":["r"],"id":524}],[{"start":{"row":13,"column":10},"end":{"row":13,"column":11},"action":"insert","lines":[" "],"id":525}],[{"start":{"row":13,"column":11},"end":{"row":13,"column":12},"action":"insert","lines":["m"],"id":526}],[{"start":{"row":13,"column":12},"end":{"row":13,"column":13},"action":"insert","lines":["o"],"id":527}],[{"start":{"row":13,"column":13},"end":{"row":13,"column":14},"action":"insert","lines":["d"],"id":528}],[{"start":{"row":13,"column":14},"end":{"row":13,"column":15},"action":"insert","lines":["e"],"id":529}],[{"start":{"row":13,"column":15},"end":{"row":13,"column":16},"action":"insert","lines":["l"],"id":530}],[{"start":{"row":13,"column":16},"end":{"row":13,"column":17},"action":"insert","lines":["s"],"id":531}],[{"start":{"row":12,"column":16},"end":{"row":13,"column":0},"action":"insert","lines":["",""],"id":532}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"insert","lines":["*"],"id":533}],[{"start":{"row":13,"column":1},"end":{"row":13,"column":2},"action":"insert","lines":[" "],"id":534}],[{"start":{"row":13,"column":2},"end":{"row":13,"column":3},"action":"insert","lines":["I"],"id":535}],[{"start":{"row":13,"column":3},"end":{"row":13,"column":4},"action":"insert","lines":["n"],"id":536}],[{"start":{"row":13,"column":4},"end":{"row":13,"column":5},"action":"insert","lines":["t"],"id":537}],[{"start":{"row":13,"column":5},"end":{"row":13,"column":6},"action":"insert","lines":["r"],"id":538}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"insert","lines":["o"],"id":539}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"insert","lines":["u"],"id":540}],[{"start":{"row":13,"column":8},"end":{"row":13,"column":9},"action":"insert","lines":["c"],"id":541}],[{"start":{"row":13,"column":9},"end":{"row":13,"column":10},"action":"insert","lines":["e"],"id":542}],[{"start":{"row":13,"column":10},"end":{"row":13,"column":11},"action":"insert","lines":[" "],"id":543}],[{"start":{"row":13,"column":11},"end":{"row":13,"column":12},"action":"insert","lines":["m"],"id":544}],[{"start":{"row":13,"column":12},"end":{"row":13,"column":13},"action":"insert","lines":["o"],"id":545}],[{"start":{"row":13,"column":13},"end":{"row":13,"column":14},"action":"insert","lines":["d"],"id":546}],[{"start":{"row":13,"column":14},"end":{"row":13,"column":15},"action":"insert","lines":["u"],"id":547}],[{"start":{"row":13,"column":15},"end":{"row":13,"column":16},"action":"insert","lines":["l"],"id":548}],[{"start":{"row":13,"column":16},"end":{"row":13,"column":17},"action":"insert","lines":["e"],"id":549}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"insert","lines":[" "],"id":550}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"remove","lines":[" "],"id":551}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"insert","lines":["."],"id":552}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"insert","lines":["e"],"id":553}],[{"start":{"row":13,"column":19},"end":{"row":13,"column":20},"action":"insert","lines":["x"],"id":554}],[{"start":{"row":13,"column":20},"end":{"row":13,"column":21},"action":"insert","lines":["p"],"id":555}],[{"start":{"row":13,"column":21},"end":{"row":13,"column":22},"action":"insert","lines":["o"],"id":556}],[{"start":{"row":13,"column":22},"end":{"row":13,"column":23},"action":"insert","lines":["r"],"id":557}],[{"start":{"row":13,"column":23},"end":{"row":13,"column":24},"action":"insert","lines":["t"],"id":558}],[{"start":{"row":13,"column":24},"end":{"row":13,"column":25},"action":"insert","lines":["s"],"id":559}],[{"start":{"row":13,"column":25},"end":{"row":13,"column":26},"action":"insert","lines":[" "],"id":560}],[{"start":{"row":13,"column":25},"end":{"row":13,"column":26},"action":"remove","lines":[" "],"id":561}],[{"start":{"row":14,"column":17},"end":{"row":14,"column":18},"action":"insert","lines":[" "],"id":562}],[{"start":{"row":14,"column":18},"end":{"row":14,"column":19},"action":"insert","lines":["i"],"id":563}],[{"start":{"row":14,"column":19},"end":{"row":14,"column":20},"action":"insert","lines":["n"],"id":564}],[{"start":{"row":14,"column":20},"end":{"row":14,"column":21},"action":"insert","lines":["t"],"id":565}],[{"start":{"row":14,"column":21},"end":{"row":14,"column":22},"action":"insert","lines":["o"],"id":566}],[{"start":{"row":14,"column":22},"end":{"row":14,"column":23},"action":"insert","lines":[" "],"id":567}],[{"start":{"row":14,"column":22},"end":{"row":14,"column":23},"action":"remove","lines":[" "],"id":568}],[{"start":{"row":14,"column":22},"end":{"row":14,"column":23},"action":"insert","lines":[" "],"id":569}],[{"start":{"row":14,"column":23},"end":{"row":14,"column":24},"action":"insert","lines":["s"],"id":570}],[{"start":{"row":14,"column":24},"end":{"row":14,"column":25},"action":"insert","lines":["e"],"id":571}],[{"start":{"row":14,"column":25},"end":{"row":14,"column":26},"action":"insert","lines":["p"],"id":572}],[{"start":{"row":14,"column":26},"end":{"row":14,"column":27},"action":"insert","lines":["a"],"id":573}],[{"start":{"row":14,"column":27},"end":{"row":14,"column":28},"action":"insert","lines":["r"],"id":574}],[{"start":{"row":14,"column":28},"end":{"row":14,"column":29},"action":"insert","lines":["a"],"id":575}],[{"start":{"row":14,"column":29},"end":{"row":14,"column":30},"action":"insert","lines":["t"],"id":576}],[{"start":{"row":14,"column":30},"end":{"row":14,"column":31},"action":"insert","lines":["e"],"id":577}],[{"start":{"row":14,"column":31},"end":{"row":14,"column":32},"action":"insert","lines":[" "],"id":578},{"start":{"row":14,"column":31},"end":{"row":14,"column":32},"action":"remove","lines":[" "]}],[{"start":{"row":14,"column":31},"end":{"row":14,"column":32},"action":"insert","lines":[" "],"id":579}],[{"start":{"row":14,"column":32},"end":{"row":14,"column":33},"action":"insert","lines":["f"],"id":580}],[{"start":{"row":14,"column":33},"end":{"row":14,"column":34},"action":"insert","lines":["i"],"id":581}],[{"start":{"row":14,"column":34},"end":{"row":14,"column":35},"action":"insert","lines":["l"],"id":582}],[{"start":{"row":14,"column":35},"end":{"row":14,"column":36},"action":"insert","lines":["e"],"id":583}],[{"start":{"row":14,"column":36},"end":{"row":14,"column":37},"action":"insert","lines":["s"],"id":584}],[{"start":{"row":14,"column":26},"end":{"row":14,"column":27},"action":"remove","lines":["a"],"id":585}],[{"start":{"row":14,"column":26},"end":{"row":14,"column":27},"action":"insert","lines":["e"],"id":586}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"insert","lines":["d"],"id":587}]]},"ace":{"folds":[],"scrolltop":158,"scrollleft":0,"selection":{"start":{"row":9,"column":0},"end":{"row":9,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":5,"state":"start","mode":"ace/mode/markdown"}},"timestamp":1445305747000,"hash":"da3dfb509589abcbdc42d8c40769b32d26588448"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Associations/references.js b/.c9/metadata/workspace/Associations/references.js deleted file mode 100644 index 7b6d4163..00000000 --- a/.c9/metadata/workspace/Associations/references.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"references.js","tooltip":"/Associations/references.js","undoManager":{"mark":0,"position":0,"stack":[[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"remove","lines":["",""],"id":1494}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":6,"column":13},"end":{"row":6,"column":13},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445310287673,"hash":"0d1ea3376037fad06ce5ad8ede12d6257e7d40e5"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/AuthDemo/app.js b/.c9/metadata/workspace/Authentication/AuthDemo/app.js deleted file mode 100644 index 90e313f1..00000000 --- a/.c9/metadata/workspace/Authentication/AuthDemo/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/Authentication/AuthDemo/app.js","undoManager":{"mark":1,"position":1,"stack":[[{"start":{"row":45,"column":0},"end":{"row":46,"column":21},"action":"remove","lines":[" req.body.username"," req.body.password"],"id":2}],[{"start":{"row":44,"column":41},"end":{"row":45,"column":0},"action":"remove","lines":["",""],"id":3}]]},"ace":{"folds":[],"scrolltop":957,"scrollleft":0,"selection":{"start":{"row":44,"column":41},"end":{"row":44,"column":41},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":35,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445455566240,"hash":"ed727cf17ee64e3354c9dd8cf76037ec3d395cd3"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/AuthDemo/models/user.js b/.c9/metadata/workspace/Authentication/AuthDemo/models/user.js deleted file mode 100644 index a6f9acfd..00000000 --- a/.c9/metadata/workspace/Authentication/AuthDemo/models/user.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"user.js","tooltip":"/Authentication/AuthDemo/models/user.js","undoManager":{"mark":36,"position":36,"stack":[[{"start":{"row":8,"column":41},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":439}],[{"start":{"row":9,"column":0},"end":{"row":9,"column":1},"action":"insert","lines":["U"],"id":440}],[{"start":{"row":9,"column":1},"end":{"row":9,"column":2},"action":"insert","lines":["s"],"id":441}],[{"start":{"row":9,"column":2},"end":{"row":9,"column":3},"action":"insert","lines":["e"],"id":442}],[{"start":{"row":9,"column":3},"end":{"row":9,"column":4},"action":"insert","lines":["r"],"id":443}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"insert","lines":[" "],"id":444}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"remove","lines":[" "],"id":445}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"insert","lines":["."],"id":446}],[{"start":{"row":9,"column":5},"end":{"row":9,"column":6},"action":"insert","lines":["s"],"id":447}],[{"start":{"row":9,"column":6},"end":{"row":9,"column":7},"action":"insert","lines":["e"],"id":448}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":["r"],"id":449}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"insert","lines":["i"],"id":450}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"insert","lines":["a"],"id":451}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["l"],"id":452}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":["i"],"id":453}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":["z"],"id":454}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["e"],"id":455}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":[" "],"id":456}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"remove","lines":[" "],"id":457}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":16},"action":"insert","lines":[" "],"id":458}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"remove","lines":[" "],"id":459}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"remove","lines":[" "],"id":460}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"remove","lines":["e"],"id":461}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"remove","lines":["z"],"id":462}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"remove","lines":["i"],"id":463}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"remove","lines":["l"],"id":464}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"remove","lines":["a"],"id":465}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"remove","lines":["i"],"id":466}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"remove","lines":["r"],"id":467}],[{"start":{"row":9,"column":6},"end":{"row":9,"column":7},"action":"remove","lines":["e"],"id":468}],[{"start":{"row":9,"column":5},"end":{"row":9,"column":6},"action":"remove","lines":["s"],"id":469}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"remove","lines":["."],"id":470}],[{"start":{"row":9,"column":3},"end":{"row":9,"column":4},"action":"remove","lines":["r"],"id":471}],[{"start":{"row":9,"column":2},"end":{"row":9,"column":3},"action":"remove","lines":["e"],"id":472}],[{"start":{"row":9,"column":1},"end":{"row":9,"column":2},"action":"remove","lines":["s"],"id":473}],[{"start":{"row":9,"column":0},"end":{"row":9,"column":1},"action":"remove","lines":["U"],"id":474}],[{"start":{"row":8,"column":41},"end":{"row":9,"column":0},"action":"remove","lines":["",""],"id":475}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":41},"end":{"row":8,"column":41},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445415576842,"hash":"3472eb597945a2d7179d0ff1495043419830c249"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/AuthDemo/package.json b/.c9/metadata/workspace/Authentication/AuthDemo/package.json deleted file mode 100644 index 6cb0e7c1..00000000 --- a/.c9/metadata/workspace/Authentication/AuthDemo/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/Authentication/AuthDemo/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":201,"scrollleft":0,"selection":{"start":{"row":14,"column":0},"end":{"row":15,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":6,"state":"start","mode":"ace/mode/json"}},"timestamp":1445408652240,"hash":"58990138cd00457a3b5785602b147e763f24e7d3"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/AuthDemo/views/home.ejs b/.c9/metadata/workspace/Authentication/AuthDemo/views/home.ejs deleted file mode 100644 index a1ee17c4..00000000 --- a/.c9/metadata/workspace/Authentication/AuthDemo/views/home.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"home.ejs","tooltip":"/Authentication/AuthDemo/views/home.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":2,"column":41},"end":{"row":3,"column":41},"action":"insert","lines":["","
  • Sign Up!
  • "],"id":76}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"remove","lines":["r"],"id":77}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"remove","lines":["e"],"id":78}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"remove","lines":["t"],"id":79}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"remove","lines":["s"],"id":80}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"remove","lines":["i"],"id":81}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"remove","lines":["g"],"id":82}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"remove","lines":["e"],"id":83}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"remove","lines":["r"],"id":84}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["l"],"id":85}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["o"],"id":86}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["g"],"id":87}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["o"],"id":88}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":["u"],"id":89}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"insert","lines":["t"],"id":90}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"insert","lines":[" "],"id":91}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"remove","lines":[" "],"id":92}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"insert","lines":["
  • Sign Up!
  • ",""],"id":93}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"remove","lines":["r"],"id":94}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"remove","lines":["e"],"id":95}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"remove","lines":["t"],"id":96}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"remove","lines":["s"],"id":97}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"remove","lines":["i"],"id":98}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"remove","lines":["g"],"id":99}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"remove","lines":["e"],"id":100}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"remove","lines":["r"],"id":101}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["l"],"id":102}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["o"],"id":103}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["g"],"id":104}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["i"],"id":105}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":["n"],"id":106}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":29},"action":"remove","lines":["gn Up!"],"id":107}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"remove","lines":["i"],"id":108}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"remove","lines":["S"],"id":109}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"insert","lines":["L"],"id":110}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":["o"],"id":111}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"insert","lines":["g"],"id":112}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":["i"],"id":113}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"insert","lines":["n"],"id":114}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["!"],"id":115}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":30},"action":"remove","lines":["ign Up!"],"id":116}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"remove","lines":["S"],"id":117}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"insert","lines":["L"],"id":118}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"insert","lines":["o"],"id":119}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":["g"],"id":120}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"insert","lines":["o"],"id":121}],[{"start":{"row":4,"column":26},"end":{"row":4,"column":27},"action":"insert","lines":["u"],"id":122}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":["t"],"id":123}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"insert","lines":[" "],"id":124}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"remove","lines":[" "],"id":125}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"insert","lines":["!"],"id":126}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":38},"action":"remove","lines":["
  • Login!
  • ","
  • Logout!
  • "],"id":128}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"insert","lines":["
  • Sign Up!
  • ",""],"id":129}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":22},"action":"remove","lines":["ster"],"id":130}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"remove","lines":["i"],"id":131}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"remove","lines":["g"],"id":132}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"remove","lines":["e"],"id":133}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"remove","lines":["r"],"id":134}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["l"],"id":135}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["o"],"id":136}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["g"],"id":137}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["o"],"id":138}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":["u"],"id":139}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"insert","lines":["t"],"id":140}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"insert","lines":[" "],"id":141}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"remove","lines":[" "],"id":142}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":29},"action":"remove","lines":["n Up"],"id":143}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"remove","lines":["g"],"id":144}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"remove","lines":["i"],"id":145}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"remove","lines":["S"],"id":146}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":["L"],"id":147}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"insert","lines":["o"],"id":148}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":["g"],"id":149}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"insert","lines":["o"],"id":150}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["u"],"id":151}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["t"],"id":152}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"insert","lines":[" "],"id":153}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"remove","lines":[" "],"id":154}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"insert","lines":["
  • Sign Up!
  • ",""],"id":155}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":31},"action":"remove","lines":["n Up"],"id":156}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"remove","lines":["g"],"id":157}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"remove","lines":["i"],"id":158}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"remove","lines":["S"],"id":159}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":["L"],"id":160}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"insert","lines":["o"],"id":161}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["g"],"id":162}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["i"],"id":163}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"insert","lines":["n"],"id":164}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":[" "],"id":165}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"remove","lines":[" "],"id":166}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":22},"action":"remove","lines":["ister"],"id":167}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"remove","lines":["g"],"id":168}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"remove","lines":["e"],"id":169}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"remove","lines":["r"],"id":170}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["l"],"id":171}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["o"],"id":172}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["g"],"id":173}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["i"],"id":174}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":["n"],"id":175}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"insert","lines":[" "],"id":176}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"remove","lines":[" "],"id":177}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":41},"end":{"row":2,"column":41},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":22,"mode":"ace/mode/ejs"}},"timestamp":1445415740570,"hash":"7102781c2387618cd256d528df4a05361cfe84a4"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/AuthDemo/views/login.ejs b/.c9/metadata/workspace/Authentication/AuthDemo/views/login.ejs deleted file mode 100644 index 23c8593b..00000000 --- a/.c9/metadata/workspace/Authentication/AuthDemo/views/login.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"login.ejs","tooltip":"/Authentication/AuthDemo/views/login.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"remove","lines":["r"],"id":113}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"remove","lines":["e"],"id":114}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"remove","lines":["s"],"id":115}],[{"start":{"row":4,"column":33},"end":{"row":4,"column":34},"action":"remove","lines":["u"],"id":116}],[{"start":{"row":4,"column":33},"end":{"row":4,"column":34},"action":"insert","lines":["p"],"id":117}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":["a"],"id":118}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"insert","lines":["s"],"id":119}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"insert","lines":["s"],"id":120}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":["w"],"id":121}],[{"start":{"row":4,"column":38},"end":{"row":4,"column":39},"action":"insert","lines":["o"],"id":122}],[{"start":{"row":4,"column":39},"end":{"row":4,"column":40},"action":"insert","lines":["r"],"id":123}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":["d"],"id":124}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"insert","lines":[" "],"id":125}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"remove","lines":[" "],"id":126}],[{"start":{"row":4,"column":59},"end":{"row":4,"column":64},"action":"remove","lines":["rname"],"id":127}],[{"start":{"row":4,"column":58},"end":{"row":4,"column":59},"action":"remove","lines":["e"],"id":128}],[{"start":{"row":4,"column":57},"end":{"row":4,"column":58},"action":"remove","lines":["s"],"id":129}],[{"start":{"row":4,"column":56},"end":{"row":4,"column":57},"action":"remove","lines":["u"],"id":130}],[{"start":{"row":4,"column":56},"end":{"row":4,"column":57},"action":"insert","lines":["p"],"id":131}],[{"start":{"row":4,"column":57},"end":{"row":4,"column":58},"action":"insert","lines":["a"],"id":132}],[{"start":{"row":4,"column":58},"end":{"row":4,"column":59},"action":"insert","lines":["s"],"id":133}],[{"start":{"row":4,"column":59},"end":{"row":4,"column":60},"action":"insert","lines":["s"],"id":134}],[{"start":{"row":4,"column":60},"end":{"row":4,"column":61},"action":"insert","lines":["w"],"id":135}],[{"start":{"row":4,"column":61},"end":{"row":4,"column":62},"action":"insert","lines":["o"],"id":136}],[{"start":{"row":4,"column":62},"end":{"row":4,"column":63},"action":"insert","lines":["r"],"id":137}],[{"start":{"row":4,"column":63},"end":{"row":4,"column":64},"action":"insert","lines":["d"],"id":138}],[{"start":{"row":4,"column":64},"end":{"row":4,"column":65},"action":"insert","lines":[" "],"id":139}],[{"start":{"row":4,"column":64},"end":{"row":4,"column":65},"action":"remove","lines":[" "],"id":140}],[{"start":{"row":4,"column":66},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":141},{"start":{"row":5,"column":0},"end":{"row":5,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["b"],"id":142}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["u"],"id":143}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["t"],"id":144}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["t"],"id":145}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"remove","lines":["t"],"id":146}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"remove","lines":["t"],"id":147}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"remove","lines":["u"],"id":148}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"remove","lines":["b"],"id":149}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["<"],"id":150}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["b"],"id":151}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["u"],"id":152}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["t"],"id":153}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["t"],"id":154}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["o"],"id":155}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["n"],"id":156}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":157}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"remove","lines":[" "],"id":158}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":21},"action":"insert","lines":[">"],"id":159}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["S"],"id":160}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"remove","lines":["S"],"id":161}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["L"],"id":162}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["o"],"id":163}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["g"],"id":164}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["i"],"id":165}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":["n"],"id":166}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":[" "],"id":167}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"remove","lines":[" "],"id":168}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":[" "],"id":169}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["m"],"id":170}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"remove","lines":["m"],"id":171}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["a"],"id":172}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["c"],"id":173}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["t"],"id":174}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["i"],"id":175}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["o"],"id":176}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["n"],"id":177}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":[" "],"id":178}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"remove","lines":[" "],"id":179}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["+"],"id":180}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"remove","lines":["+"],"id":181}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["="],"id":182}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":15},"action":"insert","lines":["\"\""],"id":183}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["/"],"id":184}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["l"],"id":185}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["o"],"id":186}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["g"],"id":187}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["i"],"id":188}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["n"],"id":189}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":[" "],"id":190}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"remove","lines":[" "],"id":191}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":[" "],"id":192}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":["m"],"id":193}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":["e"],"id":194}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["t"],"id":195}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["h"],"id":196}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":["o"],"id":197}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["d"],"id":198}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":[" "],"id":199}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"remove","lines":[" "],"id":200}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":["="],"id":201}],[{"start":{"row":2,"column":29},"end":{"row":2,"column":31},"action":"insert","lines":["\"\""],"id":202}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":["P"],"id":203}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":["O"],"id":204}],[{"start":{"row":2,"column":32},"end":{"row":2,"column":33},"action":"insert","lines":["S"],"id":205}],[{"start":{"row":2,"column":33},"end":{"row":2,"column":34},"action":"insert","lines":["T"],"id":206}],[{"start":{"row":2,"column":34},"end":{"row":2,"column":35},"action":"insert","lines":[" "],"id":207}],[{"start":{"row":2,"column":34},"end":{"row":2,"column":35},"action":"remove","lines":[" "],"id":208}],[{"start":{"row":6,"column":7},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":209}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":210}],[{"start":{"row":8,"column":0},"end":{"row":10,"column":38},"action":"insert","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":211}],[{"start":{"row":8,"column":0},"end":{"row":10,"column":38},"action":"remove","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":212}],[{"start":{"row":8,"column":0},"end":{"row":10,"column":38},"action":"insert","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":213}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":10,"column":38},"end":{"row":10,"column":38},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":22,"mode":"ace/mode/ejs"}},"timestamp":1445415747027,"hash":"4c16be24ea44a63eeb6819795bd655cf17cba4ac"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/AuthDemo/views/register.ejs b/.c9/metadata/workspace/Authentication/AuthDemo/views/register.ejs deleted file mode 100644 index 93650a51..00000000 --- a/.c9/metadata/workspace/Authentication/AuthDemo/views/register.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"register.ejs","tooltip":"/Authentication/AuthDemo/views/register.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["t"],"id":169}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["o"],"id":170}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["n"],"id":171}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":172}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"remove","lines":[" "],"id":173}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":21},"action":"insert","lines":[">"],"id":174}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["S"],"id":175}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["u"],"id":176}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["b"],"id":177}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["m"],"id":178}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":["i"],"id":179}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["t"],"id":180}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":[" "],"id":181}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"remove","lines":[" "],"id":182}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"insert","lines":["n"],"id":183}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":["a"],"id":184}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"insert","lines":["m"],"id":185}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["e"],"id":186}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":[" "],"id":187}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"remove","lines":[" "],"id":188}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["="],"id":189}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"insert","lines":["\""],"id":190}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":["u"],"id":191}],[{"start":{"row":3,"column":30},"end":{"row":3,"column":31},"action":"insert","lines":["s"],"id":192}],[{"start":{"row":3,"column":31},"end":{"row":3,"column":32},"action":"insert","lines":["e"],"id":193}],[{"start":{"row":3,"column":32},"end":{"row":3,"column":33},"action":"insert","lines":["r"],"id":194}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":[" "],"id":195}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"remove","lines":[" "],"id":196}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":["n"],"id":197}],[{"start":{"row":3,"column":34},"end":{"row":3,"column":35},"action":"insert","lines":["a"],"id":198}],[{"start":{"row":3,"column":35},"end":{"row":3,"column":36},"action":"insert","lines":["m"],"id":199}],[{"start":{"row":3,"column":36},"end":{"row":3,"column":37},"action":"insert","lines":["e"],"id":200}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"insert","lines":[" "],"id":201}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"remove","lines":[" "],"id":202}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"insert","lines":["\""],"id":203}],[{"start":{"row":3,"column":38},"end":{"row":3,"column":39},"action":"insert","lines":[" "],"id":204}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":["n"],"id":205}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"insert","lines":["a"],"id":206}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":["m"],"id":207}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":["e"],"id":208}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"insert","lines":[" "],"id":209}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"remove","lines":[" "],"id":210}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"insert","lines":["="],"id":211}],[{"start":{"row":4,"column":32},"end":{"row":4,"column":33},"action":"insert","lines":["\""],"id":212}],[{"start":{"row":4,"column":33},"end":{"row":4,"column":34},"action":"insert","lines":["p"],"id":213}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":["a"],"id":214}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"insert","lines":["s"],"id":215}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"insert","lines":["w"],"id":216}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"remove","lines":["w"],"id":217}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"insert","lines":["s"],"id":218}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":["w"],"id":219}],[{"start":{"row":4,"column":38},"end":{"row":4,"column":39},"action":"insert","lines":["o"],"id":220}],[{"start":{"row":4,"column":39},"end":{"row":4,"column":40},"action":"insert","lines":["r"],"id":221}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":["d"],"id":222}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"insert","lines":[" "],"id":223}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"remove","lines":[" "],"id":224}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"insert","lines":["\""],"id":225}],[{"start":{"row":4,"column":42},"end":{"row":4,"column":43},"action":"insert","lines":[" "],"id":226}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":[" "],"id":227}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["a"],"id":228}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["c"],"id":229}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["t"],"id":230}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["i"],"id":231}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["o"],"id":232}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["n"],"id":233}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":[" "],"id":234}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"remove","lines":[" "],"id":235}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":[" "],"id":236}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["m"],"id":237}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["e"],"id":238}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["t"],"id":239}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["h"],"id":240}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["o"],"id":241}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["d"],"id":242}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":[" "],"id":243}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"remove","lines":[" "],"id":244}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["="],"id":245}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":15},"action":"insert","lines":["\"\""],"id":246}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["/"],"id":247}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["r"],"id":248}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["e"],"id":249}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["g"],"id":250}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["i"],"id":251}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["s"],"id":252}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":["t"],"id":253}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["e"],"id":254}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":["r"],"id":255}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":[" "],"id":256}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"remove","lines":[" "],"id":257}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":["="],"id":258}],[{"start":{"row":2,"column":32},"end":{"row":2,"column":34},"action":"insert","lines":["\"\""],"id":259}],[{"start":{"row":2,"column":33},"end":{"row":2,"column":34},"action":"insert","lines":["P"],"id":260}],[{"start":{"row":2,"column":34},"end":{"row":2,"column":35},"action":"insert","lines":["O"],"id":261}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"insert","lines":["S"],"id":262}],[{"start":{"row":2,"column":36},"end":{"row":2,"column":37},"action":"insert","lines":["T"],"id":263}],[{"start":{"row":6,"column":7},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":264}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":265}],[{"start":{"row":8,"column":0},"end":{"row":10,"column":38},"action":"insert","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":266}],[{"start":{"row":7,"column":0},"end":{"row":10,"column":38},"action":"remove","lines":["","
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":268}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":269}],[{"start":{"row":8,"column":0},"end":{"row":10,"column":38},"action":"insert","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":270}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":10,"column":38},"end":{"row":10,"column":38},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":22,"mode":"ace/mode/ejs"}},"timestamp":1445415749499,"hash":"f64208fa620dab5d6bdcd6a430fb26d932e6c69f"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/AuthDemo/views/secret.ejs b/.c9/metadata/workspace/Authentication/AuthDemo/views/secret.ejs deleted file mode 100644 index 0560ea02..00000000 --- a/.c9/metadata/workspace/Authentication/AuthDemo/views/secret.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"secret.ejs","tooltip":"/Authentication/AuthDemo/views/secret.ejs","undoManager":{"mark":94,"position":94,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["<"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["h"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["1"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":9},"action":"insert","lines":[">"],"id":4}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["T"],"id":5}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["h"],"id":6}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["i"],"id":7}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["s"],"id":8}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":[" "],"id":9}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["i"],"id":10}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["s"],"id":11}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":[" "],"id":12}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["t"],"id":13}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["h"],"id":14}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["e"],"id":15}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":[" "],"id":16}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["s"],"id":17}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["e"],"id":18}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["c"],"id":19}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["r"],"id":20}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["e"],"id":21}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["t"],"id":22}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":[" "],"id":23}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["p"],"id":24}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":["a"],"id":25}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"insert","lines":["g"],"id":26}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":["e"],"id":27}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":[" "],"id":28}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"remove","lines":[" "],"id":29}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["!"],"id":30}],[{"start":{"row":0,"column":33},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":31}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":32}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["P"],"id":33}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"remove","lines":["P"],"id":34}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["<"],"id":35}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["p"],"id":36}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":7},"action":"insert","lines":[">

    "],"id":37}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":["Y"],"id":38}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["o"],"id":39}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["u"],"id":40}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":[" "],"id":41}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["f"],"id":42}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["o"],"id":43}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["u"],"id":44}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["n"],"id":45}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["d"],"id":46}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":[" "],"id":47}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["m"],"id":48}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["e"],"id":49}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":[" "],"id":50}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"remove","lines":[" "],"id":51}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["!"],"id":52}],[{"start":{"row":2,"column":20},"end":{"row":3,"column":0},"action":"insert","lines":["",""],"id":53}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":54}],[{"start":{"row":4,"column":0},"end":{"row":4,"column":1},"action":"insert","lines":["<"],"id":55}],[{"start":{"row":4,"column":1},"end":{"row":4,"column":2},"action":"insert","lines":["i"],"id":56}],[{"start":{"row":4,"column":2},"end":{"row":4,"column":3},"action":"insert","lines":["m"],"id":57}],[{"start":{"row":4,"column":3},"end":{"row":4,"column":4},"action":"insert","lines":["g"],"id":58}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":[" "],"id":59}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"remove","lines":[" "],"id":60}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":[" "],"id":61}],[{"start":{"row":4,"column":5},"end":{"row":4,"column":6},"action":"insert","lines":["s"],"id":62}],[{"start":{"row":4,"column":6},"end":{"row":4,"column":7},"action":"insert","lines":["r"],"id":63}],[{"start":{"row":4,"column":6},"end":{"row":4,"column":7},"action":"remove","lines":["r"],"id":64}],[{"start":{"row":4,"column":5},"end":{"row":4,"column":6},"action":"remove","lines":["s"],"id":65}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"remove","lines":[" "],"id":66}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":[">"],"id":67}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"remove","lines":[">"],"id":68}],[{"start":{"row":4,"column":3},"end":{"row":4,"column":4},"action":"remove","lines":["g"],"id":69}],[{"start":{"row":4,"column":2},"end":{"row":4,"column":3},"action":"remove","lines":["m"],"id":70}],[{"start":{"row":4,"column":1},"end":{"row":4,"column":2},"action":"remove","lines":["i"],"id":71}],[{"start":{"row":4,"column":0},"end":{"row":4,"column":1},"action":"remove","lines":["<"],"id":72}],[{"start":{"row":4,"column":0},"end":{"row":4,"column":1},"action":"insert","lines":["<"],"id":73}],[{"start":{"row":4,"column":1},"end":{"row":4,"column":2},"action":"insert","lines":["i"],"id":74}],[{"start":{"row":4,"column":2},"end":{"row":4,"column":3},"action":"insert","lines":["m"],"id":75}],[{"start":{"row":4,"column":3},"end":{"row":4,"column":4},"action":"insert","lines":["g"],"id":76}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":[" "],"id":77}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"remove","lines":[" "],"id":78}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":[" "],"id":79}],[{"start":{"row":4,"column":5},"end":{"row":4,"column":6},"action":"insert","lines":["s"],"id":80}],[{"start":{"row":4,"column":6},"end":{"row":4,"column":7},"action":"insert","lines":["r"],"id":81}],[{"start":{"row":4,"column":7},"end":{"row":4,"column":8},"action":"insert","lines":["c"],"id":82}],[{"start":{"row":4,"column":8},"end":{"row":4,"column":9},"action":"insert","lines":[" "],"id":83}],[{"start":{"row":4,"column":8},"end":{"row":4,"column":9},"action":"remove","lines":[" "],"id":84}],[{"start":{"row":4,"column":8},"end":{"row":4,"column":9},"action":"insert","lines":["="],"id":85}],[{"start":{"row":4,"column":9},"end":{"row":4,"column":11},"action":"insert","lines":["\"\""],"id":86}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":148},"action":"insert","lines":["https://scontent-sjc2-1.xx.fbcdn.net/hphotos-xaf1/v/t1.0-9/197592_1007017930183_5279_n.jpg?oh=2e24b7a0b113730421ec4fc65ddad724&oe=568A3492"],"id":87}],[{"start":{"row":4,"column":149},"end":{"row":4,"column":150},"action":"insert","lines":[">"],"id":88}],[{"start":{"row":4,"column":150},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":89}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":90}],[{"start":{"row":6,"column":0},"end":{"row":8,"column":38},"action":"insert","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":91}],[{"start":{"row":6,"column":0},"end":{"row":8,"column":38},"action":"remove","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":92}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"remove","lines":["",""],"id":93}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":94}],[{"start":{"row":6,"column":0},"end":{"row":8,"column":38},"action":"insert","lines":["
  • Sign Up!
  • ","
  • Login!
  • ","
  • Logout!
  • "],"id":95}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":38},"end":{"row":8,"column":38},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445415745143,"hash":"30062be6579ea714912c64ecc1cb174b72601985"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Authentication/readme.md b/.c9/metadata/workspace/Authentication/readme.md deleted file mode 100644 index f5d5d82f..00000000 --- a/.c9/metadata/workspace/Authentication/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/Authentication/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":29,"column":20},"end":{"row":29,"column":21},"action":"insert","lines":[" "],"id":983}],[{"start":{"row":29,"column":21},"end":{"row":29,"column":22},"action":"insert","lines":["5"],"id":984}],[{"start":{"row":29,"column":22},"end":{"row":30,"column":0},"action":"insert","lines":["",""],"id":985}],[{"start":{"row":30,"column":0},"end":{"row":30,"column":1},"action":"insert","lines":["*"],"id":986}],[{"start":{"row":30,"column":1},"end":{"row":30,"column":2},"action":"insert","lines":[" "],"id":987}],[{"start":{"row":30,"column":2},"end":{"row":30,"column":3},"action":"insert","lines":["A"],"id":988}],[{"start":{"row":30,"column":3},"end":{"row":30,"column":4},"action":"insert","lines":["d"],"id":989}],[{"start":{"row":30,"column":4},"end":{"row":30,"column":5},"action":"insert","lines":["d"],"id":990}],[{"start":{"row":30,"column":5},"end":{"row":30,"column":6},"action":"insert","lines":[" "],"id":991}],[{"start":{"row":30,"column":6},"end":{"row":30,"column":7},"action":"insert","lines":["L"],"id":992}],[{"start":{"row":30,"column":7},"end":{"row":30,"column":8},"action":"insert","lines":["o"],"id":993}],[{"start":{"row":30,"column":8},"end":{"row":30,"column":9},"action":"insert","lines":["g"],"id":994}],[{"start":{"row":30,"column":9},"end":{"row":30,"column":10},"action":"insert","lines":["o"],"id":995}],[{"start":{"row":30,"column":10},"end":{"row":30,"column":11},"action":"insert","lines":["u"],"id":996}],[{"start":{"row":30,"column":11},"end":{"row":30,"column":12},"action":"insert","lines":["t"],"id":997}],[{"start":{"row":30,"column":12},"end":{"row":30,"column":13},"action":"insert","lines":[" "],"id":998}],[{"start":{"row":30,"column":12},"end":{"row":30,"column":13},"action":"remove","lines":[" "],"id":999}],[{"start":{"row":30,"column":12},"end":{"row":30,"column":13},"action":"insert","lines":[" "],"id":1000}],[{"start":{"row":30,"column":13},"end":{"row":30,"column":14},"action":"insert","lines":["R"],"id":1001}],[{"start":{"row":30,"column":14},"end":{"row":30,"column":15},"action":"insert","lines":["o"],"id":1002}],[{"start":{"row":30,"column":15},"end":{"row":30,"column":16},"action":"insert","lines":["u"],"id":1003}],[{"start":{"row":30,"column":16},"end":{"row":30,"column":17},"action":"insert","lines":["t"],"id":1004}],[{"start":{"row":30,"column":17},"end":{"row":30,"column":18},"action":"insert","lines":["e"],"id":1005}],[{"start":{"row":30,"column":18},"end":{"row":30,"column":19},"action":"insert","lines":[" "],"id":1006}],[{"start":{"row":30,"column":18},"end":{"row":30,"column":19},"action":"remove","lines":[" "],"id":1007}],[{"start":{"row":30,"column":13},"end":{"row":30,"column":18},"action":"remove","lines":["Route"],"id":1008},{"start":{"row":30,"column":13},"end":{"row":30,"column":19},"action":"insert","lines":["Routes"]}],[{"start":{"row":30,"column":19},"end":{"row":31,"column":0},"action":"insert","lines":["",""],"id":1009},{"start":{"row":31,"column":0},"end":{"row":31,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":31,"column":1},"end":{"row":31,"column":2},"action":"remove","lines":[" "],"id":1010}],[{"start":{"row":31,"column":0},"end":{"row":31,"column":1},"action":"remove","lines":["*"],"id":1011}],[{"start":{"row":30,"column":19},"end":{"row":31,"column":0},"action":"remove","lines":["",""],"id":1012}],[{"start":{"row":30,"column":18},"end":{"row":30,"column":19},"action":"remove","lines":["s"],"id":1013}],[{"start":{"row":30,"column":17},"end":{"row":30,"column":18},"action":"remove","lines":["e"],"id":1014}],[{"start":{"row":30,"column":17},"end":{"row":30,"column":18},"action":"insert","lines":["e"],"id":1015}],[{"start":{"row":30,"column":13},"end":{"row":30,"column":18},"action":"remove","lines":["Route"],"id":1016},{"start":{"row":30,"column":13},"end":{"row":30,"column":19},"action":"insert","lines":["Routes"]}],[{"start":{"row":30,"column":18},"end":{"row":30,"column":19},"action":"remove","lines":["s"],"id":1017}],[{"start":{"row":30,"column":18},"end":{"row":31,"column":0},"action":"insert","lines":["",""],"id":1018},{"start":{"row":31,"column":0},"end":{"row":31,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":31,"column":2},"end":{"row":31,"column":3},"action":"insert","lines":["A"],"id":1019}],[{"start":{"row":31,"column":3},"end":{"row":31,"column":4},"action":"insert","lines":["d"],"id":1020}],[{"start":{"row":31,"column":4},"end":{"row":31,"column":5},"action":"insert","lines":["d"],"id":1021}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"insert","lines":[" "],"id":1022}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"remove","lines":[" "],"id":1023}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"insert","lines":[" "],"id":1024}],[{"start":{"row":31,"column":6},"end":{"row":31,"column":7},"action":"insert","lines":["L"],"id":1025}],[{"start":{"row":31,"column":6},"end":{"row":31,"column":7},"action":"remove","lines":["L"],"id":1026}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"remove","lines":[" "],"id":1027}],[{"start":{"row":31,"column":4},"end":{"row":31,"column":5},"action":"remove","lines":["d"],"id":1028}],[{"start":{"row":31,"column":3},"end":{"row":31,"column":4},"action":"remove","lines":["d"],"id":1029}],[{"start":{"row":31,"column":2},"end":{"row":31,"column":3},"action":"remove","lines":["A"],"id":1030}],[{"start":{"row":31,"column":1},"end":{"row":31,"column":2},"action":"remove","lines":[" "],"id":1031}],[{"start":{"row":31,"column":0},"end":{"row":31,"column":1},"action":"remove","lines":["*"],"id":1032}],[{"start":{"row":30,"column":18},"end":{"row":31,"column":0},"action":"remove","lines":["",""],"id":1033}],[{"start":{"row":30,"column":18},"end":{"row":31,"column":0},"action":"insert","lines":["",""],"id":1034},{"start":{"row":31,"column":0},"end":{"row":31,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":31,"column":2},"end":{"row":31,"column":3},"action":"insert","lines":["A"],"id":1035}],[{"start":{"row":31,"column":2},"end":{"row":31,"column":3},"action":"remove","lines":["A"],"id":1036}],[{"start":{"row":31,"column":1},"end":{"row":31,"column":2},"action":"remove","lines":[" "],"id":1037}],[{"start":{"row":31,"column":0},"end":{"row":31,"column":1},"action":"remove","lines":["*"],"id":1038}],[{"start":{"row":30,"column":18},"end":{"row":31,"column":0},"action":"remove","lines":["",""],"id":1039}],[{"start":{"row":30,"column":17},"end":{"row":30,"column":18},"action":"remove","lines":["e"],"id":1040}],[{"start":{"row":30,"column":16},"end":{"row":30,"column":17},"action":"remove","lines":["t"],"id":1041}],[{"start":{"row":30,"column":16},"end":{"row":30,"column":17},"action":"insert","lines":["t"],"id":1042}],[{"start":{"row":30,"column":17},"end":{"row":30,"column":18},"action":"insert","lines":["e"],"id":1043}],[{"start":{"row":30,"column":13},"end":{"row":30,"column":18},"action":"remove","lines":["Route"],"id":1044},{"start":{"row":30,"column":13},"end":{"row":30,"column":19},"action":"insert","lines":["Routes"]}],[{"start":{"row":30,"column":18},"end":{"row":30,"column":19},"action":"remove","lines":["s"],"id":1045}],[{"start":{"row":30,"column":18},"end":{"row":31,"column":0},"action":"insert","lines":["",""],"id":1046},{"start":{"row":31,"column":0},"end":{"row":31,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":31,"column":2},"end":{"row":31,"column":3},"action":"insert","lines":["A"],"id":1047}],[{"start":{"row":31,"column":3},"end":{"row":31,"column":4},"action":"insert","lines":["d"],"id":1048}],[{"start":{"row":31,"column":4},"end":{"row":31,"column":5},"action":"insert","lines":["d"],"id":1049}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"insert","lines":[" "],"id":1050}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"remove","lines":[" "],"id":1051}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"insert","lines":[" "],"id":1052}],[{"start":{"row":31,"column":6},"end":{"row":31,"column":7},"action":"insert","lines":["i"],"id":1053}],[{"start":{"row":31,"column":7},"end":{"row":31,"column":8},"action":"insert","lines":["s"],"id":1054}],[{"start":{"row":31,"column":8},"end":{"row":31,"column":9},"action":"insert","lines":[" "],"id":1055}],[{"start":{"row":31,"column":8},"end":{"row":31,"column":9},"action":"remove","lines":[" "],"id":1056}],[{"start":{"row":31,"column":8},"end":{"row":31,"column":9},"action":"insert","lines":["L"],"id":1057}],[{"start":{"row":31,"column":9},"end":{"row":31,"column":10},"action":"insert","lines":["o"],"id":1058}],[{"start":{"row":31,"column":10},"end":{"row":31,"column":11},"action":"insert","lines":["g"],"id":1059}],[{"start":{"row":31,"column":11},"end":{"row":31,"column":12},"action":"insert","lines":["g"],"id":1060}],[{"start":{"row":31,"column":12},"end":{"row":31,"column":13},"action":"insert","lines":["e"],"id":1061}],[{"start":{"row":31,"column":13},"end":{"row":31,"column":14},"action":"insert","lines":["d"],"id":1062}],[{"start":{"row":31,"column":14},"end":{"row":31,"column":15},"action":"insert","lines":[" "],"id":1063}],[{"start":{"row":31,"column":14},"end":{"row":31,"column":15},"action":"remove","lines":[" "],"id":1064}],[{"start":{"row":31,"column":14},"end":{"row":31,"column":15},"action":"insert","lines":["I"],"id":1065}],[{"start":{"row":31,"column":15},"end":{"row":31,"column":16},"action":"insert","lines":["n"],"id":1066}],[{"start":{"row":31,"column":16},"end":{"row":31,"column":17},"action":"insert","lines":[" "],"id":1067}],[{"start":{"row":31,"column":16},"end":{"row":31,"column":17},"action":"remove","lines":[" "],"id":1068}],[{"start":{"row":31,"column":16},"end":{"row":31,"column":17},"action":"insert","lines":[" "],"id":1069}],[{"start":{"row":31,"column":17},"end":{"row":31,"column":18},"action":"insert","lines":["M"],"id":1070}],[{"start":{"row":31,"column":17},"end":{"row":31,"column":18},"action":"remove","lines":["M"],"id":1071}],[{"start":{"row":31,"column":17},"end":{"row":31,"column":18},"action":"insert","lines":["m"],"id":1072}],[{"start":{"row":31,"column":18},"end":{"row":31,"column":19},"action":"insert","lines":["i"],"id":1073}],[{"start":{"row":31,"column":19},"end":{"row":31,"column":20},"action":"insert","lines":["d"],"id":1074}],[{"start":{"row":31,"column":20},"end":{"row":31,"column":21},"action":"insert","lines":["d"],"id":1075}],[{"start":{"row":31,"column":21},"end":{"row":31,"column":22},"action":"insert","lines":["l"],"id":1076}],[{"start":{"row":31,"column":22},"end":{"row":31,"column":23},"action":"insert","lines":["e"],"id":1077}],[{"start":{"row":31,"column":23},"end":{"row":31,"column":24},"action":"insert","lines":["w"],"id":1078}],[{"start":{"row":31,"column":24},"end":{"row":31,"column":25},"action":"insert","lines":["a"],"id":1079}],[{"start":{"row":31,"column":25},"end":{"row":31,"column":26},"action":"insert","lines":["r"],"id":1080}],[{"start":{"row":31,"column":26},"end":{"row":31,"column":27},"action":"insert","lines":["e"],"id":1081}],[{"start":{"row":31,"column":27},"end":{"row":31,"column":28},"action":"insert","lines":[" "],"id":1082}],[{"start":{"row":31,"column":27},"end":{"row":31,"column":28},"action":"remove","lines":[" "],"id":1083}]]},"ace":{"folds":[],"scrolltop":617.5,"scrollleft":0,"selection":{"start":{"row":31,"column":17},"end":{"row":31,"column":27},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":22,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445416527980,"hash":"ce9c4123b33fe5bfeb7c80713aa751755ca7900a"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Databases/cats.js b/.c9/metadata/workspace/Databases/cats.js deleted file mode 100644 index fd79c418..00000000 --- a/.c9/metadata/workspace/Databases/cats.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"cats.js","tooltip":"/Databases/cats.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":33,"column":6},"end":{"row":33,"column":8},"action":"insert","lines":["()"],"id":1328}],[{"start":{"row":33,"column":7},"end":{"row":33,"column":8},"action":"insert","lines":["e"],"id":1329}],[{"start":{"row":33,"column":8},"end":{"row":33,"column":9},"action":"insert","lines":["r"],"id":1330}],[{"start":{"row":33,"column":9},"end":{"row":33,"column":10},"action":"insert","lines":["r"],"id":1331}],[{"start":{"row":33,"column":10},"end":{"row":33,"column":11},"action":"insert","lines":[" "],"id":1332}],[{"start":{"row":33,"column":10},"end":{"row":33,"column":11},"action":"remove","lines":[" "],"id":1333}],[{"start":{"row":33,"column":10},"end":{"row":33,"column":11},"action":"remove","lines":[")"],"id":1334}],[{"start":{"row":33,"column":9},"end":{"row":33,"column":10},"action":"remove","lines":["r"],"id":1335}],[{"start":{"row":33,"column":8},"end":{"row":33,"column":9},"action":"remove","lines":["r"],"id":1336}],[{"start":{"row":33,"column":7},"end":{"row":33,"column":8},"action":"remove","lines":["e"],"id":1337}],[{"start":{"row":33,"column":6},"end":{"row":33,"column":7},"action":"remove","lines":["("],"id":1338}],[{"start":{"row":33,"column":5},"end":{"row":33,"column":6},"action":"remove","lines":["f"],"id":1339}],[{"start":{"row":33,"column":4},"end":{"row":33,"column":5},"action":"remove","lines":["i"],"id":1340}],[{"start":{"row":33,"column":4},"end":{"row":33,"column":5},"action":"insert","lines":["c"],"id":1341}],[{"start":{"row":33,"column":5},"end":{"row":33,"column":6},"action":"insert","lines":["o"],"id":1342}],[{"start":{"row":33,"column":6},"end":{"row":33,"column":7},"action":"insert","lines":["n"],"id":1343}],[{"start":{"row":33,"column":7},"end":{"row":33,"column":8},"action":"insert","lines":["s"],"id":1344}],[{"start":{"row":33,"column":8},"end":{"row":33,"column":9},"action":"insert","lines":["o"],"id":1345}],[{"start":{"row":33,"column":9},"end":{"row":33,"column":10},"action":"insert","lines":["l"],"id":1346}],[{"start":{"row":33,"column":10},"end":{"row":33,"column":11},"action":"insert","lines":["e"],"id":1347}],[{"start":{"row":33,"column":11},"end":{"row":33,"column":12},"action":"insert","lines":[" "],"id":1348}],[{"start":{"row":33,"column":11},"end":{"row":33,"column":12},"action":"remove","lines":[" "],"id":1349}],[{"start":{"row":33,"column":11},"end":{"row":33,"column":12},"action":"insert","lines":["."],"id":1350}],[{"start":{"row":33,"column":12},"end":{"row":33,"column":13},"action":"insert","lines":["l"],"id":1351}],[{"start":{"row":33,"column":13},"end":{"row":33,"column":14},"action":"insert","lines":["o"],"id":1352}],[{"start":{"row":33,"column":14},"end":{"row":33,"column":15},"action":"insert","lines":["g"],"id":1353}],[{"start":{"row":33,"column":15},"end":{"row":33,"column":16},"action":"insert","lines":[" "],"id":1354}],[{"start":{"row":33,"column":15},"end":{"row":33,"column":16},"action":"remove","lines":[" "],"id":1355}],[{"start":{"row":33,"column":15},"end":{"row":33,"column":17},"action":"insert","lines":["()"],"id":1356}],[{"start":{"row":33,"column":16},"end":{"row":33,"column":17},"action":"insert","lines":["c"],"id":1357}],[{"start":{"row":33,"column":17},"end":{"row":33,"column":18},"action":"insert","lines":["a"],"id":1358}],[{"start":{"row":33,"column":18},"end":{"row":33,"column":19},"action":"insert","lines":["t"],"id":1359}],[{"start":{"row":33,"column":19},"end":{"row":33,"column":20},"action":"insert","lines":[" "],"id":1360}],[{"start":{"row":33,"column":19},"end":{"row":33,"column":20},"action":"remove","lines":[" "],"id":1361}],[{"start":{"row":33,"column":20},"end":{"row":33,"column":21},"action":"insert","lines":[";"],"id":1362}],[{"start":{"row":33,"column":4},"end":{"row":33,"column":21},"action":"remove","lines":["console.log(cat);"],"id":1363}],[{"start":{"row":33,"column":0},"end":{"row":33,"column":4},"action":"remove","lines":[" "],"id":1364}],[{"start":{"row":32,"column":22},"end":{"row":33,"column":0},"action":"remove","lines":["",""],"id":1365}],[{"start":{"row":32,"column":22},"end":{"row":33,"column":0},"action":"insert","lines":["",""],"id":1367},{"start":{"row":33,"column":0},"end":{"row":33,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":33,"column":4},"end":{"row":33,"column":5},"action":"insert","lines":["i"],"id":1368}],[{"start":{"row":33,"column":5},"end":{"row":33,"column":6},"action":"insert","lines":["f"],"id":1369}],[{"start":{"row":33,"column":6},"end":{"row":33,"column":7},"action":"insert","lines":[" "],"id":1370}],[{"start":{"row":33,"column":6},"end":{"row":33,"column":7},"action":"remove","lines":[" "],"id":1371}],[{"start":{"row":33,"column":6},"end":{"row":33,"column":8},"action":"insert","lines":["()"],"id":1372}],[{"start":{"row":33,"column":7},"end":{"row":33,"column":8},"action":"insert","lines":["e"],"id":1373}],[{"start":{"row":33,"column":8},"end":{"row":33,"column":9},"action":"insert","lines":["r"],"id":1374}],[{"start":{"row":33,"column":9},"end":{"row":33,"column":10},"action":"insert","lines":["r"],"id":1375}],[{"start":{"row":33,"column":10},"end":{"row":33,"column":11},"action":"insert","lines":[" "],"id":1376}],[{"start":{"row":33,"column":10},"end":{"row":33,"column":11},"action":"remove","lines":[" "],"id":1377}],[{"start":{"row":33,"column":11},"end":{"row":33,"column":12},"action":"insert","lines":["{"],"id":1378}],[{"start":{"row":33,"column":12},"end":{"row":35,"column":5},"action":"insert","lines":[""," "," }"],"id":1379}],[{"start":{"row":34,"column":8},"end":{"row":34,"column":9},"action":"insert","lines":["c"],"id":1380}],[{"start":{"row":34,"column":9},"end":{"row":34,"column":10},"action":"insert","lines":["o"],"id":1381}],[{"start":{"row":34,"column":10},"end":{"row":34,"column":11},"action":"insert","lines":["n"],"id":1382}],[{"start":{"row":34,"column":11},"end":{"row":34,"column":12},"action":"insert","lines":["s"],"id":1383}],[{"start":{"row":34,"column":12},"end":{"row":34,"column":13},"action":"insert","lines":["o"],"id":1384}],[{"start":{"row":34,"column":13},"end":{"row":34,"column":14},"action":"insert","lines":["l"],"id":1385}],[{"start":{"row":34,"column":14},"end":{"row":34,"column":15},"action":"insert","lines":["e"],"id":1386}],[{"start":{"row":34,"column":15},"end":{"row":34,"column":16},"action":"insert","lines":[" "],"id":1387}],[{"start":{"row":34,"column":15},"end":{"row":34,"column":16},"action":"remove","lines":[" "],"id":1388}],[{"start":{"row":34,"column":15},"end":{"row":34,"column":16},"action":"insert","lines":["."],"id":1389}],[{"start":{"row":34,"column":16},"end":{"row":34,"column":17},"action":"insert","lines":["l"],"id":1390}],[{"start":{"row":34,"column":17},"end":{"row":34,"column":18},"action":"insert","lines":["o"],"id":1391}],[{"start":{"row":34,"column":18},"end":{"row":34,"column":19},"action":"insert","lines":["g"],"id":1392}],[{"start":{"row":34,"column":19},"end":{"row":34,"column":20},"action":"insert","lines":[" "],"id":1393}],[{"start":{"row":34,"column":19},"end":{"row":34,"column":20},"action":"remove","lines":[" "],"id":1394}],[{"start":{"row":34,"column":19},"end":{"row":34,"column":21},"action":"insert","lines":["()"],"id":1395}],[{"start":{"row":34,"column":20},"end":{"row":34,"column":21},"action":"insert","lines":["e"],"id":1396}],[{"start":{"row":34,"column":21},"end":{"row":34,"column":22},"action":"insert","lines":["r"],"id":1397}],[{"start":{"row":34,"column":22},"end":{"row":34,"column":23},"action":"insert","lines":["r"],"id":1398}],[{"start":{"row":34,"column":24},"end":{"row":34,"column":25},"action":"insert","lines":[";"],"id":1399}],[{"start":{"row":35,"column":5},"end":{"row":35,"column":6},"action":"insert","lines":[" "],"id":1400}],[{"start":{"row":35,"column":6},"end":{"row":35,"column":7},"action":"insert","lines":["e"],"id":1401}],[{"start":{"row":35,"column":7},"end":{"row":35,"column":8},"action":"insert","lines":["l"],"id":1402}],[{"start":{"row":35,"column":8},"end":{"row":35,"column":9},"action":"insert","lines":["s"],"id":1403}],[{"start":{"row":35,"column":9},"end":{"row":35,"column":10},"action":"insert","lines":["e"],"id":1404}],[{"start":{"row":35,"column":10},"end":{"row":35,"column":11},"action":"insert","lines":[" "],"id":1405}],[{"start":{"row":35,"column":10},"end":{"row":35,"column":11},"action":"remove","lines":[" "],"id":1406}],[{"start":{"row":35,"column":10},"end":{"row":35,"column":11},"action":"insert","lines":[" "],"id":1407}],[{"start":{"row":35,"column":11},"end":{"row":35,"column":12},"action":"insert","lines":["{"],"id":1408}],[{"start":{"row":35,"column":12},"end":{"row":37,"column":5},"action":"insert","lines":[""," "," }"],"id":1409}],[{"start":{"row":36,"column":8},"end":{"row":36,"column":9},"action":"insert","lines":["c"],"id":1410}],[{"start":{"row":36,"column":9},"end":{"row":36,"column":10},"action":"insert","lines":["o"],"id":1411}],[{"start":{"row":36,"column":10},"end":{"row":36,"column":11},"action":"insert","lines":["n"],"id":1412}],[{"start":{"row":36,"column":11},"end":{"row":36,"column":12},"action":"insert","lines":["s"],"id":1413}],[{"start":{"row":36,"column":12},"end":{"row":36,"column":13},"action":"insert","lines":["o"],"id":1414}],[{"start":{"row":36,"column":13},"end":{"row":36,"column":14},"action":"insert","lines":["l"],"id":1415}],[{"start":{"row":36,"column":14},"end":{"row":36,"column":15},"action":"insert","lines":["e"],"id":1416}],[{"start":{"row":36,"column":15},"end":{"row":36,"column":16},"action":"insert","lines":[" "],"id":1417}],[{"start":{"row":36,"column":15},"end":{"row":36,"column":16},"action":"remove","lines":[" "],"id":1418}],[{"start":{"row":36,"column":15},"end":{"row":36,"column":16},"action":"insert","lines":["."],"id":1419}],[{"start":{"row":36,"column":16},"end":{"row":36,"column":17},"action":"insert","lines":["l"],"id":1420}],[{"start":{"row":36,"column":17},"end":{"row":36,"column":18},"action":"insert","lines":["o"],"id":1421}],[{"start":{"row":36,"column":18},"end":{"row":36,"column":19},"action":"insert","lines":["g"],"id":1422}],[{"start":{"row":36,"column":19},"end":{"row":36,"column":20},"action":"insert","lines":[" "],"id":1423}],[{"start":{"row":36,"column":19},"end":{"row":36,"column":20},"action":"remove","lines":[" "],"id":1424}],[{"start":{"row":36,"column":19},"end":{"row":36,"column":21},"action":"insert","lines":["()"],"id":1425}],[{"start":{"row":36,"column":20},"end":{"row":36,"column":21},"action":"insert","lines":["c"],"id":1426}],[{"start":{"row":36,"column":21},"end":{"row":36,"column":22},"action":"insert","lines":["a"],"id":1427}],[{"start":{"row":36,"column":22},"end":{"row":36,"column":23},"action":"insert","lines":["t"],"id":1428}],[{"start":{"row":36,"column":24},"end":{"row":36,"column":25},"action":"insert","lines":[";"],"id":1429}]]},"ace":{"folds":[],"scrolltop":467,"scrollleft":0,"selection":{"start":{"row":44,"column":0},"end":{"row":45,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":16,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445241227739,"hash":"62f1ce4a1a34337d8464abb5f992e3b58cb5d20e"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Databases/readme.md b/.c9/metadata/workspace/Databases/readme.md deleted file mode 100644 index 9a3b9ab6..00000000 --- a/.c9/metadata/workspace/Databases/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/Databases/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":26,"column":22},"end":{"row":27,"column":0},"action":"remove","lines":["",""],"id":2476}],[{"start":{"row":26,"column":22},"end":{"row":27,"column":0},"action":"insert","lines":["",""],"id":2477},{"start":{"row":27,"column":0},"end":{"row":27,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":27,"column":2},"end":{"row":27,"column":3},"action":"insert","lines":["C"],"id":2478}],[{"start":{"row":27,"column":3},"end":{"row":27,"column":4},"action":"insert","lines":["r"],"id":2479}],[{"start":{"row":27,"column":4},"end":{"row":27,"column":5},"action":"insert","lines":["e"],"id":2480}],[{"start":{"row":27,"column":5},"end":{"row":27,"column":6},"action":"insert","lines":["a"],"id":2481}],[{"start":{"row":27,"column":6},"end":{"row":27,"column":7},"action":"insert","lines":["t"],"id":2482}],[{"start":{"row":27,"column":7},"end":{"row":27,"column":8},"action":"insert","lines":["e"],"id":2483}],[{"start":{"row":27,"column":8},"end":{"row":27,"column":9},"action":"insert","lines":[" "],"id":2484}],[{"start":{"row":27,"column":9},"end":{"row":27,"column":10},"action":"insert","lines":["a"],"id":2485}],[{"start":{"row":27,"column":10},"end":{"row":27,"column":11},"action":"insert","lines":[" "],"id":2486}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"insert","lines":["a"],"id":2487}],[{"start":{"row":27,"column":12},"end":{"row":27,"column":13},"action":"insert","lines":[" "],"id":2488}],[{"start":{"row":27,"column":13},"end":{"row":27,"column":14},"action":"insert","lines":["t"],"id":2489}],[{"start":{"row":27,"column":14},"end":{"row":27,"column":15},"action":"insert","lines":["i"],"id":2490}],[{"start":{"row":27,"column":14},"end":{"row":27,"column":15},"action":"remove","lines":["i"],"id":2491}],[{"start":{"row":27,"column":13},"end":{"row":27,"column":14},"action":"remove","lines":["t"],"id":2492}],[{"start":{"row":27,"column":12},"end":{"row":27,"column":13},"action":"remove","lines":[" "],"id":2493}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"remove","lines":["a"],"id":2494}],[{"start":{"row":27,"column":10},"end":{"row":27,"column":11},"action":"remove","lines":[" "],"id":2495}],[{"start":{"row":27,"column":9},"end":{"row":27,"column":10},"action":"remove","lines":["a"],"id":2496}],[{"start":{"row":27,"column":8},"end":{"row":27,"column":9},"action":"remove","lines":[" "],"id":2497}],[{"start":{"row":27,"column":7},"end":{"row":27,"column":8},"action":"remove","lines":["e"],"id":2498}],[{"start":{"row":27,"column":6},"end":{"row":27,"column":7},"action":"remove","lines":["t"],"id":2499}],[{"start":{"row":27,"column":5},"end":{"row":27,"column":6},"action":"remove","lines":["a"],"id":2500}],[{"start":{"row":27,"column":4},"end":{"row":27,"column":5},"action":"remove","lines":["e"],"id":2501}],[{"start":{"row":27,"column":3},"end":{"row":27,"column":4},"action":"remove","lines":["r"],"id":2502}],[{"start":{"row":27,"column":2},"end":{"row":27,"column":3},"action":"remove","lines":["C"],"id":2503}],[{"start":{"row":27,"column":2},"end":{"row":27,"column":3},"action":"insert","lines":["I"],"id":2504}],[{"start":{"row":27,"column":3},"end":{"row":27,"column":4},"action":"insert","lines":["n"],"id":2505}],[{"start":{"row":27,"column":4},"end":{"row":27,"column":5},"action":"insert","lines":["t"],"id":2506}],[{"start":{"row":27,"column":5},"end":{"row":27,"column":6},"action":"insert","lines":["e"],"id":2507}],[{"start":{"row":27,"column":6},"end":{"row":27,"column":7},"action":"insert","lines":["r"],"id":2508}],[{"start":{"row":27,"column":7},"end":{"row":27,"column":8},"action":"insert","lines":["a"],"id":2509}],[{"start":{"row":27,"column":8},"end":{"row":27,"column":9},"action":"insert","lines":["c"],"id":2510}],[{"start":{"row":27,"column":9},"end":{"row":27,"column":10},"action":"insert","lines":["t"],"id":2511}],[{"start":{"row":27,"column":10},"end":{"row":27,"column":11},"action":"insert","lines":[" "],"id":2512}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"insert","lines":["t"],"id":2513}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"remove","lines":["t"],"id":2514}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"insert","lines":["t"],"id":2515}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"remove","lines":["t"],"id":2516}],[{"start":{"row":27,"column":10},"end":{"row":27,"column":11},"action":"remove","lines":[" "],"id":2517}],[{"start":{"row":27,"column":9},"end":{"row":27,"column":10},"action":"remove","lines":["t"],"id":2518}],[{"start":{"row":27,"column":9},"end":{"row":27,"column":10},"action":"insert","lines":["t"],"id":2519}],[{"start":{"row":27,"column":10},"end":{"row":27,"column":11},"action":"insert","lines":[" "],"id":2520}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"insert","lines":["w"],"id":2521}],[{"start":{"row":27,"column":12},"end":{"row":27,"column":13},"action":"insert","lines":["i"],"id":2522}],[{"start":{"row":27,"column":13},"end":{"row":27,"column":14},"action":"insert","lines":["t"],"id":2523}],[{"start":{"row":27,"column":14},"end":{"row":27,"column":15},"action":"insert","lines":["h"],"id":2524}],[{"start":{"row":27,"column":15},"end":{"row":27,"column":16},"action":"insert","lines":[" "],"id":2525}],[{"start":{"row":27,"column":16},"end":{"row":27,"column":17},"action":"insert","lines":["a"],"id":2526}],[{"start":{"row":27,"column":17},"end":{"row":27,"column":18},"action":"insert","lines":[" "],"id":2527}],[{"start":{"row":27,"column":18},"end":{"row":27,"column":19},"action":"insert","lines":["m"],"id":2528}],[{"start":{"row":27,"column":19},"end":{"row":27,"column":20},"action":"insert","lines":["o"],"id":2529}],[{"start":{"row":27,"column":19},"end":{"row":27,"column":20},"action":"remove","lines":["o"],"id":2530}],[{"start":{"row":27,"column":19},"end":{"row":27,"column":20},"action":"insert","lines":["M"],"id":2531}],[{"start":{"row":27,"column":20},"end":{"row":27,"column":21},"action":"insert","lines":["O"],"id":2532}],[{"start":{"row":27,"column":21},"end":{"row":27,"column":22},"action":"insert","lines":["n"],"id":2533}],[{"start":{"row":27,"column":21},"end":{"row":27,"column":22},"action":"remove","lines":["n"],"id":2534}],[{"start":{"row":27,"column":20},"end":{"row":27,"column":21},"action":"remove","lines":["O"],"id":2535}],[{"start":{"row":27,"column":19},"end":{"row":27,"column":20},"action":"remove","lines":["M"],"id":2536}],[{"start":{"row":27,"column":18},"end":{"row":27,"column":19},"action":"remove","lines":["m"],"id":2537}],[{"start":{"row":27,"column":18},"end":{"row":27,"column":19},"action":"insert","lines":["M"],"id":2538}],[{"start":{"row":27,"column":19},"end":{"row":27,"column":20},"action":"insert","lines":["o"],"id":2539}],[{"start":{"row":27,"column":20},"end":{"row":27,"column":21},"action":"insert","lines":["n"],"id":2540}],[{"start":{"row":27,"column":21},"end":{"row":27,"column":22},"action":"insert","lines":["g"],"id":2541}],[{"start":{"row":27,"column":22},"end":{"row":27,"column":23},"action":"insert","lines":["o"],"id":2542}],[{"start":{"row":27,"column":23},"end":{"row":27,"column":24},"action":"insert","lines":[" "],"id":2543}],[{"start":{"row":27,"column":24},"end":{"row":27,"column":25},"action":"insert","lines":["D"],"id":2544}],[{"start":{"row":27,"column":25},"end":{"row":27,"column":26},"action":"insert","lines":["a"],"id":2545}],[{"start":{"row":27,"column":26},"end":{"row":27,"column":27},"action":"insert","lines":["b"],"id":2546}],[{"start":{"row":27,"column":26},"end":{"row":27,"column":27},"action":"remove","lines":["b"],"id":2547}],[{"start":{"row":27,"column":26},"end":{"row":27,"column":27},"action":"insert","lines":["t"],"id":2548}],[{"start":{"row":27,"column":27},"end":{"row":27,"column":28},"action":"insert","lines":["a"],"id":2549}],[{"start":{"row":27,"column":28},"end":{"row":27,"column":29},"action":"insert","lines":["b"],"id":2550}],[{"start":{"row":27,"column":29},"end":{"row":27,"column":30},"action":"insert","lines":["a"],"id":2551}],[{"start":{"row":27,"column":30},"end":{"row":27,"column":31},"action":"insert","lines":["s"],"id":2552}],[{"start":{"row":27,"column":31},"end":{"row":27,"column":32},"action":"insert","lines":["e"],"id":2553}],[{"start":{"row":27,"column":32},"end":{"row":27,"column":33},"action":"insert","lines":[" "],"id":2554}],[{"start":{"row":27,"column":33},"end":{"row":27,"column":34},"action":"insert","lines":["u"],"id":2555}],[{"start":{"row":27,"column":34},"end":{"row":27,"column":35},"action":"insert","lines":["s"],"id":2556}],[{"start":{"row":27,"column":35},"end":{"row":27,"column":36},"action":"insert","lines":["i"],"id":2557}],[{"start":{"row":27,"column":36},"end":{"row":27,"column":37},"action":"insert","lines":["n"],"id":2558}],[{"start":{"row":27,"column":37},"end":{"row":27,"column":38},"action":"insert","lines":["g"],"id":2559}],[{"start":{"row":27,"column":38},"end":{"row":27,"column":39},"action":"insert","lines":[" "],"id":2560}],[{"start":{"row":27,"column":38},"end":{"row":27,"column":39},"action":"remove","lines":[" "],"id":2561}],[{"start":{"row":27,"column":38},"end":{"row":27,"column":39},"action":"insert","lines":[" "],"id":2562}],[{"start":{"row":27,"column":39},"end":{"row":27,"column":40},"action":"insert","lines":["M"],"id":2563}],[{"start":{"row":27,"column":40},"end":{"row":27,"column":41},"action":"insert","lines":["o"],"id":2564}],[{"start":{"row":27,"column":41},"end":{"row":27,"column":42},"action":"insert","lines":["n"],"id":2565}],[{"start":{"row":27,"column":42},"end":{"row":27,"column":43},"action":"insert","lines":["g"],"id":2566}],[{"start":{"row":27,"column":43},"end":{"row":27,"column":44},"action":"insert","lines":["o"],"id":2567}],[{"start":{"row":27,"column":44},"end":{"row":27,"column":45},"action":"insert","lines":["o"],"id":2568}],[{"start":{"row":27,"column":45},"end":{"row":27,"column":46},"action":"insert","lines":["s"],"id":2569}],[{"start":{"row":27,"column":46},"end":{"row":27,"column":47},"action":"insert","lines":["e"],"id":2570}],[{"start":{"row":29,"column":0},"end":{"row":29,"column":1},"action":"insert","lines":["g"],"id":2571},{"start":{"row":29,"column":1},"end":{"row":29,"column":2},"action":"insert","lines":["i"]}],[{"start":{"row":29,"column":2},"end":{"row":29,"column":3},"action":"insert","lines":["s"],"id":2572}],[{"start":{"row":29,"column":2},"end":{"row":29,"column":3},"action":"remove","lines":["s"],"id":2574}],[{"start":{"row":29,"column":1},"end":{"row":29,"column":2},"action":"remove","lines":["i"],"id":2575}],[{"start":{"row":29,"column":0},"end":{"row":29,"column":1},"action":"remove","lines":["g"],"id":2576}],[{"start":{"row":28,"column":0},"end":{"row":29,"column":0},"action":"remove","lines":["",""],"id":2577}]]},"ace":{"folds":[],"scrolltop":527.5,"scrollleft":0,"selection":{"start":{"row":28,"column":0},"end":{"row":28,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":19,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445239430461,"hash":"8ff5c4e2bd1a27f30462775b83bc5b11f7746c8d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/DeployingDemo/app.js b/.c9/metadata/workspace/DeployingDemo/app.js deleted file mode 100644 index 774fd98f..00000000 --- a/.c9/metadata/workspace/DeployingDemo/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/DeployingDemo/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":[" "],"id":98}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"remove","lines":[" "],"id":99}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":[";"],"id":100}],[{"start":{"row":3,"column":30},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":101}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":102}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":1},"action":"insert","lines":["a"],"id":103}],[{"start":{"row":5,"column":1},"end":{"row":5,"column":2},"action":"insert","lines":["p"],"id":104}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["p"],"id":105}],[{"start":{"row":5,"column":3},"end":{"row":5,"column":4},"action":"insert","lines":["."],"id":106}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["g"],"id":107}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["e"],"id":108}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["t"],"id":109}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":[" "],"id":110}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"remove","lines":[" "],"id":111}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":[")"],"id":112}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":10},"action":"insert","lines":["()"],"id":113}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":10},"action":"remove","lines":["()"],"id":114}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"remove","lines":[")"],"id":115}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":9},"action":"insert","lines":["()"],"id":116}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":10},"action":"insert","lines":["\"\""],"id":117}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["/"],"id":118}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[","],"id":119}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":[" "],"id":120}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["f"],"id":121}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["u"],"id":122}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["n"],"id":123}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":["c"],"id":124}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["t"],"id":125}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["i"],"id":126}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":20},"action":"insert","lines":["o"],"id":127}],[{"start":{"row":5,"column":20},"end":{"row":5,"column":21},"action":"insert","lines":["n"],"id":128}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"insert","lines":[" "],"id":129}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"remove","lines":[" "],"id":130}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":23},"action":"insert","lines":["()"],"id":131},{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["*"]}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"remove","lines":["*"],"id":132}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["r"],"id":133}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["e"],"id":134}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["q"],"id":135}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":[" "],"id":136}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"remove","lines":[" "],"id":137}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":[","],"id":138}],[{"start":{"row":5,"column":26},"end":{"row":5,"column":27},"action":"insert","lines":[" "],"id":139}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["r"],"id":140}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["e"],"id":141}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":["s"],"id":142}],[{"start":{"row":5,"column":31},"end":{"row":5,"column":33},"action":"insert","lines":["{}"],"id":143}],[{"start":{"row":5,"column":32},"end":{"row":7,"column":0},"action":"insert","lines":[""," ",""],"id":144}],[{"start":{"row":6,"column":4},"end":{"row":6,"column":5},"action":"insert","lines":["r"],"id":145}],[{"start":{"row":6,"column":5},"end":{"row":6,"column":6},"action":"insert","lines":["e"],"id":146}],[{"start":{"row":6,"column":6},"end":{"row":6,"column":7},"action":"insert","lines":["s"],"id":147}],[{"start":{"row":6,"column":7},"end":{"row":6,"column":8},"action":"insert","lines":[" "],"id":148}],[{"start":{"row":6,"column":7},"end":{"row":6,"column":8},"action":"remove","lines":[" "],"id":149}],[{"start":{"row":6,"column":7},"end":{"row":6,"column":8},"action":"insert","lines":["."],"id":150}],[{"start":{"row":6,"column":8},"end":{"row":6,"column":9},"action":"insert","lines":["r"],"id":151}],[{"start":{"row":6,"column":9},"end":{"row":6,"column":10},"action":"insert","lines":["e"],"id":152}],[{"start":{"row":6,"column":10},"end":{"row":6,"column":11},"action":"insert","lines":["n"],"id":153}],[{"start":{"row":6,"column":11},"end":{"row":6,"column":12},"action":"insert","lines":["d"],"id":154}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"insert","lines":["e"],"id":155}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"insert","lines":["r"],"id":156}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":15},"action":"insert","lines":[" "],"id":157}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":15},"action":"remove","lines":[" "],"id":158}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":16},"action":"insert","lines":["()"],"id":159}],[{"start":{"row":6,"column":15},"end":{"row":6,"column":17},"action":"insert","lines":["\"\""],"id":160}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"insert","lines":["h"],"id":161}],[{"start":{"row":6,"column":17},"end":{"row":6,"column":18},"action":"insert","lines":["o"],"id":162}],[{"start":{"row":6,"column":18},"end":{"row":6,"column":19},"action":"insert","lines":["m"],"id":163}],[{"start":{"row":6,"column":19},"end":{"row":6,"column":20},"action":"insert","lines":["e"],"id":164}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"insert","lines":[" "],"id":165}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"remove","lines":[" "],"id":166}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"insert","lines":[";"],"id":167}],[{"start":{"row":7,"column":2},"end":{"row":7,"column":3},"action":"insert","lines":[";"],"id":168}],[{"start":{"row":7,"column":3},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":169}],[{"start":{"row":8,"column":0},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":170}],[{"start":{"row":9,"column":0},"end":{"row":11,"column":3},"action":"insert","lines":["app.get(\"/\", function(req, res){"," res.render(\"home\");","});"],"id":171}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["a"],"id":172}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":["b"],"id":173}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":["o"],"id":174}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["u"],"id":175}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":["t"],"id":176}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"insert","lines":[" "],"id":177}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"remove","lines":[" "],"id":178}],[{"start":{"row":10,"column":16},"end":{"row":10,"column":20},"action":"remove","lines":["home"],"id":179}],[{"start":{"row":10,"column":16},"end":{"row":10,"column":17},"action":"insert","lines":["a"],"id":180}],[{"start":{"row":10,"column":17},"end":{"row":10,"column":18},"action":"insert","lines":["b"],"id":181}],[{"start":{"row":10,"column":18},"end":{"row":10,"column":19},"action":"insert","lines":["o"],"id":182}],[{"start":{"row":10,"column":19},"end":{"row":10,"column":20},"action":"insert","lines":["u"],"id":183}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":["t"],"id":184}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"insert","lines":[" "],"id":185}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"remove","lines":[" "],"id":186}],[{"start":{"row":11,"column":3},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":187}],[{"start":{"row":12,"column":0},"end":{"row":13,"column":0},"action":"insert","lines":["",""],"id":188}],[{"start":{"row":12,"column":0},"end":{"row":13,"column":0},"action":"remove","lines":["",""],"id":190}],[{"start":{"row":11,"column":3},"end":{"row":12,"column":0},"action":"remove","lines":["",""],"id":191}],[{"start":{"row":11,"column":3},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":192}],[{"start":{"row":12,"column":0},"end":{"row":13,"column":0},"action":"insert","lines":["",""],"id":193}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":45},"action":"insert","lines":["app.listen(process.env.PORT, process.env.IP);"],"id":194}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"remove","lines":["-"],"id":195}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["m"],"id":196},{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":[" "]}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"remove","lines":[" "],"id":197}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"remove","lines":["m"],"id":198}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":[" "],"id":199}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":0},"end":{"row":8,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1454385863159,"hash":"86a6dbf76a617db1c8a8dbd658cd1d22374acbcd"} \ No newline at end of file diff --git a/.c9/metadata/workspace/DeployingDemo/package.json b/.c9/metadata/workspace/DeployingDemo/package.json deleted file mode 100644 index 11b0d1ea..00000000 --- a/.c9/metadata/workspace/DeployingDemo/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/DeployingDemo/package.json","undoManager":{"mark":21,"position":21,"stack":[[{"start":{"row":6,"column":57},"end":{"row":6,"column":58},"action":"insert","lines":[","],"id":2}],[{"start":{"row":6,"column":58},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":3},{"start":{"row":7,"column":0},"end":{"row":7,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":7,"column":4},"end":{"row":7,"column":6},"action":"insert","lines":["\"\""],"id":4}],[{"start":{"row":7,"column":5},"end":{"row":7,"column":6},"action":"insert","lines":["s"],"id":5}],[{"start":{"row":7,"column":6},"end":{"row":7,"column":7},"action":"insert","lines":["t"],"id":6}],[{"start":{"row":7,"column":7},"end":{"row":7,"column":8},"action":"insert","lines":["a"],"id":7}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":["r"],"id":8}],[{"start":{"row":7,"column":9},"end":{"row":7,"column":10},"action":"insert","lines":["t"],"id":9}],[{"start":{"row":7,"column":11},"end":{"row":7,"column":12},"action":"insert","lines":[":"],"id":10}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":11}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":15},"action":"insert","lines":["\"\""],"id":12}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":["n"],"id":13}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":["o"],"id":14}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"insert","lines":["d"],"id":15}],[{"start":{"row":7,"column":17},"end":{"row":7,"column":18},"action":"insert","lines":["e"],"id":16}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"insert","lines":[" "],"id":17}],[{"start":{"row":7,"column":19},"end":{"row":7,"column":20},"action":"insert","lines":["a"],"id":18}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"insert","lines":["p"],"id":19}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["p"],"id":20}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["."],"id":21}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"insert","lines":["j"],"id":22}],[{"start":{"row":7,"column":24},"end":{"row":7,"column":25},"action":"insert","lines":["s"],"id":23}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"remove","lines":[" \"start\": \"node app.js\"",""],"id":24},{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"insert","lines":["",""]}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1454386891503,"hash":"f956a59c4fb4efd7e0a4901ed936f903a9c19213"} \ No newline at end of file diff --git a/.c9/metadata/workspace/DeployingDemo/views/about.ejs b/.c9/metadata/workspace/DeployingDemo/views/about.ejs deleted file mode 100644 index 35841be4..00000000 --- a/.c9/metadata/workspace/DeployingDemo/views/about.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"about.ejs","tooltip":"/DeployingDemo/views/about.ejs","undoManager":{"mark":42,"position":42,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["h"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["1"],"id":2}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":2},"action":"remove","lines":["h1"],"id":3},{"start":{"row":0,"column":0},"end":{"row":0,"column":2},"action":"insert","lines":["h1"]}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"remove","lines":["1"],"id":4}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"remove","lines":["h"],"id":5}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":[">"],"id":6}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["h"],"id":7}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"remove","lines":["h"],"id":8}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"remove","lines":[">"],"id":9}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["<"],"id":10}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["j"],"id":11}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"remove","lines":["j"],"id":12}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["h"],"id":13}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["1"],"id":14}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":9},"action":"insert","lines":[">"],"id":15}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["A"],"id":16}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["b"],"id":17}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["o"],"id":18}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["u"],"id":19}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["t"],"id":20}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":[" "],"id":21}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["P"],"id":22}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["a"],"id":23}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["g"],"id":24}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["e"],"id":25}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":[" "],"id":26}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"remove","lines":[" "],"id":27}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["!"],"id":28}],[{"start":{"row":0,"column":20},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":29}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":30}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":42},"action":"insert","lines":["Go to the about page!"],"id":31}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":15},"action":"remove","lines":["bout"],"id":32}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"remove","lines":["a"],"id":33}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":33},"action":"remove","lines":[" the about page!"],"id":34}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"remove","lines":["o"],"id":35}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"remove","lines":["t"],"id":36}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["H"],"id":37}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["o"],"id":38}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["m"],"id":39}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["e"],"id":40}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":[" "],"id":41}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"remove","lines":[" "],"id":42}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["!"],"id":43}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":24},"end":{"row":2,"column":24},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1454385915517,"hash":"12bb4a516643969495b97112719cde5b1cff63ee"} \ No newline at end of file diff --git a/.c9/metadata/workspace/DeployingDemo/views/home.ejs b/.c9/metadata/workspace/DeployingDemo/views/home.ejs deleted file mode 100644 index 5ef67261..00000000 --- a/.c9/metadata/workspace/DeployingDemo/views/home.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"home.ejs","tooltip":"/DeployingDemo/views/home.ejs","undoManager":{"mark":80,"position":80,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["<"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["h"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["1"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":9},"action":"insert","lines":[">"],"id":4}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["H"],"id":5}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["o"],"id":6}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["m"],"id":7}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["e"],"id":8}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":[" "],"id":9}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["P"],"id":10}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["a"],"id":11}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["g"],"id":12}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["e"],"id":13}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":[" "],"id":14}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"remove","lines":[" "],"id":15}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["!"],"id":16}],[{"start":{"row":0,"column":19},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":17}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":18}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["<"],"id":19}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["a"],"id":20}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":7},"action":"insert","lines":[">"],"id":21}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":[" "],"id":22}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":["h"],"id":23}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["r"],"id":24}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["e"],"id":25}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["f"],"id":26}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":27}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"remove","lines":[" "],"id":28}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["="],"id":29}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":10},"action":"insert","lines":["\"\""],"id":30}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["/"],"id":31}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["h"],"id":32}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"remove","lines":["h"],"id":33}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["a"],"id":34}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["b"],"id":35}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["u"],"id":36}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["t"],"id":37}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":[" "],"id":38}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"remove","lines":[" "],"id":39}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"remove","lines":["t"],"id":40}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"remove","lines":["u"],"id":41}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["o"],"id":42}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["u"],"id":43}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["t"],"id":44}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["G"],"id":45}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["o"],"id":46}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":[" "],"id":47}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":["t"],"id":48}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["o"],"id":49}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":[" "],"id":50}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":["t"],"id":51}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["h"],"id":52}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["e"],"id":53}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":[" "],"id":54}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["a"],"id":55}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":["b"],"id":56}],[{"start":{"row":2,"column":29},"end":{"row":2,"column":30},"action":"insert","lines":["o"],"id":57}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":["u"],"id":58}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":["t"],"id":59}],[{"start":{"row":2,"column":32},"end":{"row":2,"column":33},"action":"insert","lines":[" "],"id":60}],[{"start":{"row":2,"column":33},"end":{"row":2,"column":34},"action":"insert","lines":["p"],"id":61}],[{"start":{"row":2,"column":34},"end":{"row":2,"column":35},"action":"insert","lines":["a"],"id":62}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"insert","lines":["g"],"id":63}],[{"start":{"row":2,"column":36},"end":{"row":2,"column":37},"action":"insert","lines":["e"],"id":64}],[{"start":{"row":2,"column":37},"end":{"row":2,"column":38},"action":"insert","lines":[" "],"id":65}],[{"start":{"row":2,"column":37},"end":{"row":2,"column":38},"action":"remove","lines":[" "],"id":66}],[{"start":{"row":2,"column":37},"end":{"row":2,"column":38},"action":"insert","lines":["!"],"id":67}],[{"start":{"row":0,"column":19},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":68}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":69}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["<"],"id":70}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["i"],"id":71}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["m"],"id":72}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":["g"],"id":73}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":[">"],"id":74}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":[" "],"id":75}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["s"],"id":76}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["r"],"id":77}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["c"],"id":78}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["="],"id":79}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":11},"action":"insert","lines":["\"\""],"id":80}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":120},"action":"insert","lines":["https://scontent-sjc2-1.xx.fbcdn.net/hphotos-xtf1/t31.0-8/12646729_10207496318300564_3268609887812418706_o.jpg"],"id":81}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":4,"column":42},"end":{"row":4,"column":42},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1454387177093,"hash":"555260913925f36e1a9626bb88a9b696f69da867"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Git/demo/main.js b/.c9/metadata/workspace/Git/demo/main.js deleted file mode 100644 index f9cfb4da..00000000 --- a/.c9/metadata/workspace/Git/demo/main.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"main.js","tooltip":"/Git/demo/main.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":18},"end":{"row":0,"column":18},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1448269050614,"hash":"89180fd0d16b00698670fbdbbe913ea3154966fa"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Git/demo/meh.js b/.c9/metadata/workspace/Git/demo/meh.js deleted file mode 100644 index e13c1e52..00000000 --- a/.c9/metadata/workspace/Git/demo/meh.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"meh.js","tooltip":"/Git/demo/meh.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":1,"column":27},"end":{"row":1,"column":27},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1448269048323,"hash":"a04eff5ea11f3aa536e36a8d26785ed8832d4b1c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Git/git_intro/app.js b/.c9/metadata/workspace/Git/git_intro/app.js deleted file mode 100644 index 00c12df9..00000000 --- a/.c9/metadata/workspace/Git/git_intro/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/Git/git_intro/app.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":39},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1448269844363,"hash":"a4fb5eed882db0b0cb9fb0aa5017b3c633d7742d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Git/git_intro/cats.js b/.c9/metadata/workspace/Git/git_intro/cats.js deleted file mode 100644 index a2931ed3..00000000 --- a/.c9/metadata/workspace/Git/git_intro/cats.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"cats.js","tooltip":"/Git/git_intro/cats.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":23},"end":{"row":0,"column":23},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1448270844180,"hash":"f5b72145cb92be624750c75124578af8503f7d94"} \ No newline at end of file diff --git a/.c9/metadata/workspace/Git/git_intro/dogs.js b/.c9/metadata/workspace/Git/git_intro/dogs.js deleted file mode 100644 index f21c34be..00000000 --- a/.c9/metadata/workspace/Git/git_intro/dogs.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"dogs.js","tooltip":"/Git/git_intro/dogs.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1448270844720,"hash":"67452301efcdab8998badcfe10325476c3d2e1f0"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToCommandLine/hello.html b/.c9/metadata/workspace/IntroToCommandLine/hello.html deleted file mode 100644 index 29f27258..00000000 --- a/.c9/metadata/workspace/IntroToCommandLine/hello.html +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"hello.html","tooltip":"/IntroToCommandLine/hello.html","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":1,"column":0},"end":{"row":1,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444891198451,"hash":"5839270614345ea3830c5785b2470fc8f59ff7d0"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToCommandLine/message.txt b/.c9/metadata/workspace/IntroToCommandLine/message.txt deleted file mode 100644 index 2484b79d..00000000 --- a/.c9/metadata/workspace/IntroToCommandLine/message.txt +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"message.txt","tooltip":"/IntroToCommandLine/message.txt","undoManager":{"mark":64,"position":64,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["H"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["e"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["l"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["l"],"id":4}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["o"],"id":5}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":[" "],"id":6}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"remove","lines":[" "],"id":7}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":[" "],"id":8}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["f"],"id":9}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["r"],"id":10}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["o"],"id":11}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["m"],"id":12}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":[" "],"id":13}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["t"],"id":14}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["h"],"id":15}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["e"],"id":16}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":[" "],"id":17}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["m"],"id":18}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["e"],"id":19}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["s"],"id":20}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["s"],"id":21}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["a"],"id":22}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["g"],"id":23}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["e"],"id":24}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":[" "],"id":25}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"remove","lines":[" "],"id":26}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":["."],"id":27}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["t"],"id":28}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":["x"],"id":29}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"insert","lines":["t"],"id":30}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":[" "],"id":31}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"remove","lines":[" "],"id":32}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":["f"],"id":33}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["i"],"id":34}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"remove","lines":["i"],"id":35}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"remove","lines":["f"],"id":36}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":[" "],"id":37}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["f"],"id":38}],[{"start":{"row":0,"column":28},"end":{"row":0,"column":29},"action":"insert","lines":["i"],"id":39}],[{"start":{"row":0,"column":29},"end":{"row":0,"column":30},"action":"insert","lines":["l"],"id":40}],[{"start":{"row":0,"column":30},"end":{"row":0,"column":31},"action":"insert","lines":["e"],"id":41}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"insert","lines":[" "],"id":42}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"remove","lines":[" "],"id":43}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"insert","lines":["!"],"id":44}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"insert","lines":["!"],"id":45}],[{"start":{"row":0,"column":33},"end":{"row":0,"column":34},"action":"insert","lines":["!"],"id":46}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"insert","lines":["!"],"id":47}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"insert","lines":[" "],"id":48}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"remove","lines":[" "],"id":49}],[{"start":{"row":0,"column":35},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":50}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":51}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["H"],"id":52}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"remove","lines":["H"],"id":53}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["G"],"id":54}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["o"],"id":55}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["o"],"id":56}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":["d"],"id":57}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["b"],"id":58}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["y"],"id":59}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["e"],"id":60}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":61}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"remove","lines":[" "],"id":62}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["!"],"id":63}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["!"],"id":64}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["!"],"id":65}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":10},"end":{"row":2,"column":10},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444889972585,"hash":"18ac54e318a35045b1d9d5d6f61763579f29fbc3"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToComnandLine/message.txt b/.c9/metadata/workspace/IntroToComnandLine/message.txt deleted file mode 100644 index 7be8ab38..00000000 --- a/.c9/metadata/workspace/IntroToComnandLine/message.txt +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"message.txt","tooltip":"/IntroToComnandLine/message.txt","undoManager":{"mark":48,"position":48,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["H"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["e"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["l"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["l"],"id":4}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["o"],"id":5}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":[" "],"id":6}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"remove","lines":[" "],"id":7}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":[" "],"id":8}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["f"],"id":9}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["r"],"id":10}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["o"],"id":11}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["m"],"id":12}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":[" "],"id":13}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["t"],"id":14}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["h"],"id":15}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["e"],"id":16}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":[" "],"id":17}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["m"],"id":18}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["e"],"id":19}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["s"],"id":20}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["s"],"id":21}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["a"],"id":22}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["g"],"id":23}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["e"],"id":24}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":[" "],"id":25}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"remove","lines":[" "],"id":26}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":["."],"id":27}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["t"],"id":28}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":["x"],"id":29}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"insert","lines":["t"],"id":30}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":[" "],"id":31}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"remove","lines":[" "],"id":32}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":["f"],"id":33}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["i"],"id":34}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"remove","lines":["i"],"id":35}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"remove","lines":["f"],"id":36}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":[" "],"id":37}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["f"],"id":38}],[{"start":{"row":0,"column":28},"end":{"row":0,"column":29},"action":"insert","lines":["i"],"id":39}],[{"start":{"row":0,"column":29},"end":{"row":0,"column":30},"action":"insert","lines":["l"],"id":40}],[{"start":{"row":0,"column":30},"end":{"row":0,"column":31},"action":"insert","lines":["e"],"id":41}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"insert","lines":[" "],"id":42}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"remove","lines":[" "],"id":43}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"insert","lines":["!"],"id":44}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"insert","lines":["!"],"id":45}],[{"start":{"row":0,"column":33},"end":{"row":0,"column":34},"action":"insert","lines":["!"],"id":46}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"insert","lines":["!"],"id":47}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"insert","lines":[" "],"id":48}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"remove","lines":[" "],"id":49}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":35},"end":{"row":0,"column":35},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444889666373,"hash":"9fc0c5618888fa5d524699d8048e3e377c710ac9"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToExpress/Assignment/solution/app.js b/.c9/metadata/workspace/IntroToExpress/Assignment/solution/app.js deleted file mode 100644 index fa14602e..00000000 --- a/.c9/metadata/workspace/IntroToExpress/Assignment/solution/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/IntroToExpress/Assignment/solution/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":23,"column":13},"end":{"row":23,"column":14},"action":"insert","lines":["t"],"id":1235}],[{"start":{"row":23,"column":14},"end":{"row":23,"column":15},"action":"insert","lines":[" "],"id":1236}],[{"start":{"row":23,"column":14},"end":{"row":23,"column":15},"action":"remove","lines":[" "],"id":1237}],[{"start":{"row":23,"column":14},"end":{"row":23,"column":15},"action":"insert","lines":[" "],"id":1238}],[{"start":{"row":23,"column":15},"end":{"row":23,"column":16},"action":"insert","lines":["="],"id":1239}],[{"start":{"row":23,"column":16},"end":{"row":23,"column":17},"action":"insert","lines":[" "],"id":1240}],[{"start":{"row":23,"column":17},"end":{"row":23,"column":19},"action":"insert","lines":["\"\""],"id":1241}],[{"start":{"row":23,"column":19},"end":{"row":23,"column":20},"action":"insert","lines":[";"],"id":1242}],[{"start":{"row":26,"column":8},"end":{"row":26,"column":9},"action":"insert","lines":["r"],"id":1243}],[{"start":{"row":26,"column":9},"end":{"row":26,"column":10},"action":"insert","lines":["e"],"id":1244}],[{"start":{"row":26,"column":10},"end":{"row":26,"column":11},"action":"insert","lines":["s"],"id":1245}],[{"start":{"row":26,"column":11},"end":{"row":26,"column":12},"action":"insert","lines":["u"],"id":1246}],[{"start":{"row":26,"column":12},"end":{"row":26,"column":13},"action":"insert","lines":["l"],"id":1247}],[{"start":{"row":26,"column":13},"end":{"row":26,"column":14},"action":"insert","lines":["t"],"id":1248}],[{"start":{"row":26,"column":14},"end":{"row":26,"column":15},"action":"insert","lines":[" "],"id":1249}],[{"start":{"row":26,"column":14},"end":{"row":26,"column":15},"action":"remove","lines":[" "],"id":1250}],[{"start":{"row":26,"column":14},"end":{"row":26,"column":15},"action":"insert","lines":[" "],"id":1251}],[{"start":{"row":26,"column":15},"end":{"row":26,"column":16},"action":"insert","lines":["+"],"id":1252}],[{"start":{"row":26,"column":16},"end":{"row":26,"column":17},"action":"insert","lines":["="],"id":1253}],[{"start":{"row":26,"column":17},"end":{"row":26,"column":18},"action":"insert","lines":[" "],"id":1254}],[{"start":{"row":26,"column":18},"end":{"row":26,"column":19},"action":"insert","lines":["m"],"id":1255}],[{"start":{"row":26,"column":19},"end":{"row":26,"column":20},"action":"insert","lines":["e"],"id":1256}],[{"start":{"row":26,"column":20},"end":{"row":26,"column":21},"action":"insert","lines":["s"],"id":1257}],[{"start":{"row":26,"column":21},"end":{"row":26,"column":22},"action":"insert","lines":["s"],"id":1258}],[{"start":{"row":26,"column":22},"end":{"row":26,"column":23},"action":"insert","lines":["a"],"id":1259}],[{"start":{"row":26,"column":23},"end":{"row":26,"column":24},"action":"insert","lines":["g"],"id":1260}],[{"start":{"row":26,"column":24},"end":{"row":26,"column":25},"action":"insert","lines":[" "],"id":1261}],[{"start":{"row":26,"column":25},"end":{"row":26,"column":26},"action":"insert","lines":["e"],"id":1262}],[{"start":{"row":26,"column":25},"end":{"row":26,"column":26},"action":"remove","lines":["e"],"id":1263}],[{"start":{"row":26,"column":24},"end":{"row":26,"column":25},"action":"remove","lines":[" "],"id":1264}],[{"start":{"row":26,"column":24},"end":{"row":26,"column":25},"action":"insert","lines":["e"],"id":1265}],[{"start":{"row":26,"column":25},"end":{"row":26,"column":26},"action":"insert","lines":[";"],"id":1266}],[{"start":{"row":26,"column":25},"end":{"row":26,"column":26},"action":"remove","lines":[";"],"id":1267}],[{"start":{"row":26,"column":25},"end":{"row":26,"column":26},"action":"insert","lines":[" "],"id":1268}],[{"start":{"row":26,"column":26},"end":{"row":26,"column":27},"action":"insert","lines":["+"],"id":1269}],[{"start":{"row":26,"column":27},"end":{"row":26,"column":28},"action":"insert","lines":[" "],"id":1270}],[{"start":{"row":26,"column":28},"end":{"row":26,"column":30},"action":"insert","lines":["\"\""],"id":1271}],[{"start":{"row":26,"column":29},"end":{"row":26,"column":30},"action":"insert","lines":[" "],"id":1274}],[{"start":{"row":26,"column":31},"end":{"row":26,"column":32},"action":"insert","lines":[";"],"id":1275}],[{"start":{"row":29,"column":3},"end":{"row":30,"column":0},"action":"insert","lines":["",""],"id":1276}],[{"start":{"row":30,"column":0},"end":{"row":31,"column":0},"action":"insert","lines":["",""],"id":1277}],[{"start":{"row":31,"column":0},"end":{"row":31,"column":1},"action":"insert","lines":["a"],"id":1278}],[{"start":{"row":31,"column":1},"end":{"row":31,"column":2},"action":"insert","lines":["p"],"id":1279}],[{"start":{"row":31,"column":2},"end":{"row":31,"column":3},"action":"insert","lines":["p"],"id":1280}],[{"start":{"row":31,"column":3},"end":{"row":31,"column":4},"action":"insert","lines":[" "],"id":1281}],[{"start":{"row":31,"column":3},"end":{"row":31,"column":4},"action":"remove","lines":[" "],"id":1282}],[{"start":{"row":31,"column":3},"end":{"row":31,"column":4},"action":"insert","lines":["."],"id":1283}],[{"start":{"row":31,"column":4},"end":{"row":31,"column":5},"action":"insert","lines":["g"],"id":1284}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"insert","lines":["e"],"id":1285}],[{"start":{"row":31,"column":6},"end":{"row":31,"column":7},"action":"insert","lines":["t"],"id":1286}],[{"start":{"row":31,"column":7},"end":{"row":31,"column":8},"action":"insert","lines":[" "],"id":1287}],[{"start":{"row":31,"column":7},"end":{"row":31,"column":8},"action":"remove","lines":[" "],"id":1288}],[{"start":{"row":31,"column":7},"end":{"row":31,"column":9},"action":"insert","lines":["()"],"id":1289}],[{"start":{"row":31,"column":8},"end":{"row":31,"column":10},"action":"insert","lines":["\"\""],"id":1290}],[{"start":{"row":31,"column":9},"end":{"row":31,"column":10},"action":"insert","lines":["*"],"id":1291}],[{"start":{"row":31,"column":11},"end":{"row":31,"column":12},"action":"insert","lines":[","],"id":1292}],[{"start":{"row":31,"column":12},"end":{"row":31,"column":13},"action":"insert","lines":[" "],"id":1293}],[{"start":{"row":31,"column":13},"end":{"row":31,"column":14},"action":"insert","lines":["f"],"id":1294}],[{"start":{"row":31,"column":14},"end":{"row":31,"column":15},"action":"insert","lines":["u"],"id":1295}],[{"start":{"row":31,"column":15},"end":{"row":31,"column":16},"action":"insert","lines":["n"],"id":1296}],[{"start":{"row":31,"column":16},"end":{"row":31,"column":17},"action":"insert","lines":["c"],"id":1297}],[{"start":{"row":31,"column":17},"end":{"row":31,"column":18},"action":"insert","lines":["t"],"id":1298}],[{"start":{"row":31,"column":18},"end":{"row":31,"column":19},"action":"insert","lines":["i"],"id":1299}],[{"start":{"row":31,"column":19},"end":{"row":31,"column":20},"action":"insert","lines":["o"],"id":1300}],[{"start":{"row":31,"column":20},"end":{"row":31,"column":21},"action":"insert","lines":["n"],"id":1301}],[{"start":{"row":31,"column":21},"end":{"row":31,"column":22},"action":"insert","lines":[" "],"id":1302}],[{"start":{"row":31,"column":21},"end":{"row":31,"column":22},"action":"remove","lines":[" "],"id":1303}],[{"start":{"row":31,"column":21},"end":{"row":31,"column":23},"action":"insert","lines":["()"],"id":1304}],[{"start":{"row":31,"column":22},"end":{"row":31,"column":23},"action":"insert","lines":["r"],"id":1305}],[{"start":{"row":31,"column":23},"end":{"row":31,"column":24},"action":"insert","lines":["e"],"id":1306}],[{"start":{"row":31,"column":24},"end":{"row":31,"column":25},"action":"insert","lines":["q"],"id":1307}],[{"start":{"row":31,"column":25},"end":{"row":31,"column":26},"action":"insert","lines":[" "],"id":1308}],[{"start":{"row":31,"column":25},"end":{"row":31,"column":26},"action":"remove","lines":[" "],"id":1309}],[{"start":{"row":31,"column":25},"end":{"row":31,"column":26},"action":"insert","lines":[","],"id":1310}],[{"start":{"row":31,"column":26},"end":{"row":31,"column":27},"action":"insert","lines":[" "],"id":1311}],[{"start":{"row":31,"column":27},"end":{"row":31,"column":28},"action":"insert","lines":["r"],"id":1312}],[{"start":{"row":31,"column":28},"end":{"row":31,"column":29},"action":"insert","lines":["e"],"id":1313}],[{"start":{"row":31,"column":29},"end":{"row":31,"column":30},"action":"insert","lines":["s"],"id":1314}],[{"start":{"row":31,"column":30},"end":{"row":31,"column":31},"action":"insert","lines":[" "],"id":1315}],[{"start":{"row":31,"column":30},"end":{"row":31,"column":31},"action":"remove","lines":[" "],"id":1316}],[{"start":{"row":31,"column":31},"end":{"row":31,"column":33},"action":"insert","lines":["{}"],"id":1317}],[{"start":{"row":31,"column":32},"end":{"row":33,"column":0},"action":"insert","lines":[""," ",""],"id":1318}],[{"start":{"row":33,"column":2},"end":{"row":33,"column":3},"action":"insert","lines":[";"],"id":1319}],[{"start":{"row":32,"column":3},"end":{"row":32,"column":4},"action":"insert","lines":["r"],"id":1320}],[{"start":{"row":32,"column":4},"end":{"row":32,"column":5},"action":"insert","lines":["e"],"id":1321}],[{"start":{"row":32,"column":5},"end":{"row":32,"column":6},"action":"insert","lines":["s"],"id":1322}],[{"start":{"row":32,"column":6},"end":{"row":32,"column":7},"action":"insert","lines":[" "],"id":1323}],[{"start":{"row":32,"column":6},"end":{"row":32,"column":7},"action":"remove","lines":[" "],"id":1324}],[{"start":{"row":32,"column":6},"end":{"row":32,"column":7},"action":"insert","lines":["."],"id":1325}],[{"start":{"row":32,"column":7},"end":{"row":32,"column":8},"action":"insert","lines":["s"],"id":1326}],[{"start":{"row":32,"column":8},"end":{"row":32,"column":9},"action":"insert","lines":["e"],"id":1327}],[{"start":{"row":32,"column":9},"end":{"row":32,"column":10},"action":"insert","lines":["n"],"id":1328}],[{"start":{"row":32,"column":10},"end":{"row":32,"column":11},"action":"insert","lines":["d"],"id":1329}],[{"start":{"row":32,"column":11},"end":{"row":32,"column":12},"action":"insert","lines":[" "],"id":1330}],[{"start":{"row":32,"column":11},"end":{"row":32,"column":12},"action":"remove","lines":[" "],"id":1331}],[{"start":{"row":32,"column":11},"end":{"row":32,"column":13},"action":"insert","lines":["()"],"id":1332}],[{"start":{"row":32,"column":12},"end":{"row":32,"column":72},"action":"insert","lines":["\"Sorry, page not found...What are you doing with your life?\""],"id":1333}],[{"start":{"row":32,"column":74},"end":{"row":32,"column":75},"action":"insert","lines":[";"],"id":1334}],[{"start":{"row":32,"column":74},"end":{"row":32,"column":75},"action":"remove","lines":[";"],"id":1335}],[{"start":{"row":32,"column":73},"end":{"row":32,"column":74},"action":"remove","lines":[" "],"id":1336}],[{"start":{"row":32,"column":73},"end":{"row":32,"column":74},"action":"insert","lines":[";"],"id":1337}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":4,"column":20},"end":{"row":4,"column":20},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445062430360,"hash":"ccef66535d798e8a648a404ba59a514cd9169d2a"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToExpress/Assignment/solution/package.json b/.c9/metadata/workspace/IntroToExpress/Assignment/solution/package.json deleted file mode 100644 index 36822ada..00000000 --- a/.c9/metadata/workspace/IntroToExpress/Assignment/solution/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/IntroToExpress/Assignment/solution/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":11,"column":8},"end":{"row":11,"column":8},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445061382234,"hash":"8c078c7d01d74584bcc36997b08af160bfc01066"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/app.js b/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/app.js deleted file mode 100644 index 614f21bb..00000000 --- a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/IntroToExpress/FirstExpressApp/app.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":127.5,"scrollleft":0,"selection":{"start":{"row":37,"column":0},"end":{"row":39,"column":3},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":4,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445047797000,"hash":"2b004c357788e35612268bdf0f4fa7ab27476385"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/index.js b/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/index.js deleted file mode 100644 index 9ec5e57d..00000000 --- a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/index.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":8530,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":327,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445028628981,"hash":"788bb9fdb4d2a7b8e0e498bec7a20f4df5709960"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/layer.js b/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/layer.js deleted file mode 100644 index 0356cfb2..00000000 --- a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/layer.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"layer.js","tooltip":"/IntroToExpress/FirstExpressApp/node_modules/express/lib/router/layer.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":3,"column":35},"end":{"row":3,"column":35},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445028628005,"hash":"27c8fe1d1c09a2699efdc3db1d384d536f6142fb"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/package.json b/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/package.json deleted file mode 100644 index 7139cd17..00000000 --- a/.c9/metadata/workspace/IntroToExpress/FirstExpressApp/node_modules/express/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/IntroToExpress/FirstExpressApp/node_modules/express/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":1665,"scrollleft":0,"selection":{"start":{"row":73,"column":27},"end":{"row":73,"column":27},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":63,"state":"start","mode":"ace/mode/json"}},"timestamp":1445032630647,"hash":"c92e88a6d33a06ce0e41036a1dfef2fe018c83dc"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToExpress/objectives.md b/.c9/metadata/workspace/IntroToExpress/objectives.md deleted file mode 100644 index da020b1c..00000000 --- a/.c9/metadata/workspace/IntroToExpress/objectives.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"objectives.md","tooltip":"/IntroToExpress/objectives.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":22,"column":17},"end":{"row":22,"column":18},"action":"remove","lines":["t"],"id":1193}],[{"start":{"row":22,"column":16},"end":{"row":22,"column":17},"action":"remove","lines":["i"],"id":1194}],[{"start":{"row":22,"column":15},"end":{"row":22,"column":16},"action":"remove","lines":["w"],"id":1195}],[{"start":{"row":22,"column":15},"end":{"row":22,"column":16},"action":"insert","lines":["u"],"id":1196}],[{"start":{"row":22,"column":16},"end":{"row":22,"column":17},"action":"insert","lines":["s"],"id":1197}],[{"start":{"row":22,"column":17},"end":{"row":22,"column":18},"action":"insert","lines":["i"],"id":1198}],[{"start":{"row":22,"column":18},"end":{"row":22,"column":19},"action":"insert","lines":["n"],"id":1199}],[{"start":{"row":22,"column":19},"end":{"row":22,"column":20},"action":"insert","lines":["g"],"id":1200}],[{"start":{"row":22,"column":19},"end":{"row":22,"column":20},"action":"remove","lines":["g"],"id":1201}],[{"start":{"row":22,"column":18},"end":{"row":22,"column":19},"action":"remove","lines":["n"],"id":1202}],[{"start":{"row":22,"column":17},"end":{"row":22,"column":18},"action":"remove","lines":["i"],"id":1203}],[{"start":{"row":22,"column":16},"end":{"row":22,"column":17},"action":"remove","lines":["s"],"id":1204}],[{"start":{"row":22,"column":15},"end":{"row":22,"column":16},"action":"remove","lines":["u"],"id":1205}],[{"start":{"row":22,"column":15},"end":{"row":22,"column":16},"action":"insert","lines":["c"],"id":1206}],[{"start":{"row":22,"column":16},"end":{"row":22,"column":17},"action":"insert","lines":["o"],"id":1207}],[{"start":{"row":22,"column":17},"end":{"row":22,"column":18},"action":"insert","lines":["n"],"id":1208}],[{"start":{"row":22,"column":18},"end":{"row":22,"column":19},"action":"insert","lines":["t"],"id":1209}],[{"start":{"row":22,"column":19},"end":{"row":22,"column":20},"action":"insert","lines":["a"],"id":1210}],[{"start":{"row":22,"column":20},"end":{"row":22,"column":21},"action":"insert","lines":["i"],"id":1211}],[{"start":{"row":22,"column":21},"end":{"row":22,"column":22},"action":"insert","lines":["n"],"id":1212}],[{"start":{"row":22,"column":22},"end":{"row":22,"column":23},"action":"insert","lines":["i"],"id":1213}],[{"start":{"row":22,"column":23},"end":{"row":22,"column":24},"action":"insert","lines":["n"],"id":1214}],[{"start":{"row":22,"column":24},"end":{"row":22,"column":25},"action":"insert","lines":["g"],"id":1215}],[{"start":{"row":22,"column":25},"end":{"row":22,"column":26},"action":"insert","lines":[" "],"id":1216}],[{"start":{"row":22,"column":25},"end":{"row":22,"column":26},"action":"remove","lines":[" "],"id":1217}],[{"start":{"row":22,"column":25},"end":{"row":22,"column":26},"action":"insert","lines":[" "],"id":1218}],[{"start":{"row":22,"column":26},"end":{"row":22,"column":27},"action":"insert","lines":["p"],"id":1219}],[{"start":{"row":22,"column":27},"end":{"row":22,"column":28},"action":"insert","lines":["a"],"id":1220}],[{"start":{"row":22,"column":28},"end":{"row":22,"column":29},"action":"insert","lines":["t"],"id":1221}],[{"start":{"row":22,"column":29},"end":{"row":22,"column":30},"action":"insert","lines":["h"],"id":1222}],[{"start":{"row":22,"column":30},"end":{"row":22,"column":31},"action":"insert","lines":[" "],"id":1223}],[{"start":{"row":22,"column":31},"end":{"row":22,"column":32},"action":"insert","lines":["v"],"id":1224}],[{"start":{"row":22,"column":32},"end":{"row":22,"column":33},"action":"insert","lines":["a"],"id":1225}],[{"start":{"row":22,"column":33},"end":{"row":22,"column":34},"action":"insert","lines":["r"],"id":1226}],[{"start":{"row":22,"column":34},"end":{"row":22,"column":35},"action":"insert","lines":["i"],"id":1227}],[{"start":{"row":22,"column":35},"end":{"row":22,"column":36},"action":"insert","lines":["a"],"id":1228}],[{"start":{"row":22,"column":36},"end":{"row":22,"column":37},"action":"insert","lines":["b"],"id":1229}],[{"start":{"row":22,"column":37},"end":{"row":22,"column":38},"action":"insert","lines":["l"],"id":1230}],[{"start":{"row":22,"column":38},"end":{"row":22,"column":39},"action":"insert","lines":["e"],"id":1231}],[{"start":{"row":22,"column":39},"end":{"row":22,"column":40},"action":"insert","lines":["s"],"id":1232}],[{"start":{"row":22,"column":40},"end":{"row":22,"column":41},"action":"insert","lines":[" "],"id":1233}],[{"start":{"row":22,"column":40},"end":{"row":22,"column":41},"action":"remove","lines":[" "],"id":1234}],[{"start":{"row":22,"column":27},"end":{"row":22,"column":40},"action":"remove","lines":["ath variables"],"id":1235}],[{"start":{"row":22,"column":26},"end":{"row":22,"column":27},"action":"remove","lines":["p"],"id":1236}],[{"start":{"row":22,"column":26},"end":{"row":22,"column":27},"action":"insert","lines":["r"],"id":1237}],[{"start":{"row":22,"column":27},"end":{"row":22,"column":28},"action":"insert","lines":["o"],"id":1238}],[{"start":{"row":22,"column":28},"end":{"row":22,"column":29},"action":"insert","lines":["u"],"id":1239}],[{"start":{"row":22,"column":29},"end":{"row":22,"column":30},"action":"insert","lines":["t"],"id":1240}],[{"start":{"row":22,"column":30},"end":{"row":22,"column":31},"action":"insert","lines":["e"],"id":1241}],[{"start":{"row":22,"column":31},"end":{"row":22,"column":32},"action":"insert","lines":[" "],"id":1242}],[{"start":{"row":22,"column":32},"end":{"row":22,"column":33},"action":"insert","lines":["p"],"id":1243}],[{"start":{"row":22,"column":33},"end":{"row":22,"column":34},"action":"insert","lines":["a"],"id":1244}],[{"start":{"row":22,"column":34},"end":{"row":22,"column":35},"action":"insert","lines":["r"],"id":1245}],[{"start":{"row":22,"column":35},"end":{"row":22,"column":36},"action":"insert","lines":["a"],"id":1246}],[{"start":{"row":22,"column":36},"end":{"row":22,"column":37},"action":"insert","lines":["m"],"id":1247}],[{"start":{"row":22,"column":37},"end":{"row":22,"column":38},"action":"insert","lines":["t"],"id":1248}],[{"start":{"row":22,"column":38},"end":{"row":22,"column":39},"action":"insert","lines":["e"],"id":1249}],[{"start":{"row":22,"column":39},"end":{"row":22,"column":40},"action":"insert","lines":["r"],"id":1250}],[{"start":{"row":22,"column":40},"end":{"row":22,"column":41},"action":"insert","lines":[" "],"id":1251}],[{"start":{"row":22,"column":40},"end":{"row":22,"column":41},"action":"remove","lines":[" "],"id":1252}],[{"start":{"row":22,"column":39},"end":{"row":22,"column":40},"action":"remove","lines":["r"],"id":1253}],[{"start":{"row":22,"column":38},"end":{"row":22,"column":39},"action":"remove","lines":["e"],"id":1254}],[{"start":{"row":22,"column":37},"end":{"row":22,"column":38},"action":"remove","lines":["t"],"id":1255}],[{"start":{"row":22,"column":37},"end":{"row":22,"column":38},"action":"insert","lines":["e"],"id":1256}],[{"start":{"row":22,"column":38},"end":{"row":22,"column":39},"action":"insert","lines":["t"],"id":1257}],[{"start":{"row":22,"column":39},"end":{"row":22,"column":40},"action":"insert","lines":["e"],"id":1258}],[{"start":{"row":22,"column":40},"end":{"row":22,"column":41},"action":"insert","lines":["r"],"id":1259}],[{"start":{"row":22,"column":41},"end":{"row":22,"column":42},"action":"insert","lines":[" "],"id":1260}],[{"start":{"row":22,"column":41},"end":{"row":22,"column":42},"action":"remove","lines":[" "],"id":1261}],[{"start":{"row":22,"column":41},"end":{"row":22,"column":42},"action":"insert","lines":["s"],"id":1262}],[{"start":{"row":23,"column":21},"end":{"row":23,"column":22},"action":"insert","lines":["l"],"id":1263}],[{"start":{"row":23,"column":21},"end":{"row":23,"column":22},"action":"remove","lines":["l"],"id":1264}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"remove","lines":["",""],"id":1265}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"insert","lines":["",""],"id":1266}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"remove","lines":["",""],"id":1267}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"insert","lines":["",""],"id":1268}],[{"start":{"row":18,"column":0},"end":{"row":19,"column":0},"action":"insert","lines":["",""],"id":1269}],[{"start":{"row":19,"column":0},"end":{"row":20,"column":0},"action":"insert","lines":["",""],"id":1270}],[{"start":{"row":20,"column":0},"end":{"row":21,"column":0},"action":"insert","lines":["",""],"id":1271}],[{"start":{"row":21,"column":0},"end":{"row":22,"column":0},"action":"insert","lines":["",""],"id":1272}],[{"start":{"row":22,"column":0},"end":{"row":23,"column":0},"action":"insert","lines":["",""],"id":1273}],[{"start":{"row":23,"column":0},"end":{"row":24,"column":0},"action":"insert","lines":["",""],"id":1274}],[{"start":{"row":24,"column":0},"end":{"row":25,"column":0},"action":"insert","lines":["",""],"id":1275}],[{"start":{"row":25,"column":0},"end":{"row":26,"column":0},"action":"insert","lines":["",""],"id":1276}],[{"start":{"row":26,"column":0},"end":{"row":27,"column":0},"action":"insert","lines":["",""],"id":1277}],[{"start":{"row":27,"column":0},"end":{"row":28,"column":0},"action":"insert","lines":["",""],"id":1278}],[{"start":{"row":28,"column":0},"end":{"row":29,"column":0},"action":"insert","lines":["",""],"id":1279}],[{"start":{"row":22,"column":0},"end":{"row":28,"column":0},"action":"remove","lines":["","","","","","",""],"id":1282}],[{"start":{"row":21,"column":0},"end":{"row":22,"column":0},"action":"remove","lines":["",""],"id":1283}],[{"start":{"row":20,"column":0},"end":{"row":21,"column":0},"action":"remove","lines":["",""],"id":1284}],[{"start":{"row":19,"column":0},"end":{"row":20,"column":0},"action":"remove","lines":["",""],"id":1285}],[{"start":{"row":18,"column":0},"end":{"row":19,"column":0},"action":"remove","lines":["",""],"id":1286}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"remove","lines":["",""],"id":1287}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"remove","lines":["",""],"id":1288}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"insert","lines":["",""],"id":1289}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"remove","lines":["",""],"id":1290}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"insert","lines":["",""],"id":1291}],[{"start":{"row":19,"column":1},"end":{"row":19,"column":2},"action":"insert","lines":[" "],"id":1292}],[{"start":{"row":20,"column":0},"end":{"row":20,"column":1},"action":"insert","lines":["!"],"id":1293}],[{"start":{"row":20,"column":0},"end":{"row":20,"column":1},"action":"remove","lines":["!"],"id":1294}],[{"start":{"row":19,"column":14},"end":{"row":19,"column":15},"action":"insert","lines":["!"],"id":1295}]]},"ace":{"folds":[],"scrolltop":428.5,"scrollleft":0,"selection":{"start":{"row":22,"column":24},"end":{"row":22,"column":24},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445046214429,"hash":"be279ee68138bc5a557e95cf7474b0e3cecddce3"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/DemoApp/app.js b/.c9/metadata/workspace/IntroToNPM/DemoApp/app.js deleted file mode 100644 index cefd5bc1..00000000 --- a/.c9/metadata/workspace/IntroToNPM/DemoApp/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/IntroToNPM/DemoApp/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["a"],"id":111}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["t"],"id":112}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":[" "],"id":113}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"remove","lines":[" "],"id":114}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":5},"action":"insert","lines":["()"],"id":115}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":[";"],"id":116}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["c"],"id":117}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["o"],"id":118}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["n"],"id":119}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":["s"],"id":120}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["o"],"id":121}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["l"],"id":122}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["e"],"id":123}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":124}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"remove","lines":[" "],"id":125}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["."],"id":126}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["l"],"id":127}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["o"],"id":128}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["g"],"id":129}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":[" "],"id":130}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"remove","lines":[" "],"id":131}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["("],"id":132}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":[")"],"id":133}],[{"start":{"row":0,"column":28},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":134}],[{"start":{"row":1,"column":0},"end":{"row":1,"column":1},"action":"insert","lines":["v"],"id":135}],[{"start":{"row":1,"column":1},"end":{"row":1,"column":2},"action":"insert","lines":["a"],"id":136}],[{"start":{"row":1,"column":2},"end":{"row":1,"column":3},"action":"insert","lines":["r"],"id":137}],[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"insert","lines":[" "],"id":138}],[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"remove","lines":[" "],"id":139}],[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"insert","lines":[" "],"id":140}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["j"],"id":141}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["o"],"id":142}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["k"],"id":143}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["e"],"id":144}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":[" "],"id":145}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["="],"id":146}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":[" "],"id":147}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["r"],"id":148}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["e"],"id":149}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["q"],"id":150}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["u"],"id":151}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":["i"],"id":152}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["r"],"id":153}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["e"],"id":154}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":[" "],"id":155}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"remove","lines":[" "],"id":156}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":20},"action":"insert","lines":["()"],"id":157}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":21},"action":"insert","lines":["\"\""],"id":158}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":21},"action":"remove","lines":["\"\""],"id":159}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":21},"action":"insert","lines":["\"\""],"id":160}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":["k"],"id":161}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["n"],"id":162}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":["o"],"id":163}],[{"start":{"row":1,"column":23},"end":{"row":1,"column":24},"action":"insert","lines":["c"],"id":164}],[{"start":{"row":1,"column":24},"end":{"row":1,"column":25},"action":"insert","lines":["k"],"id":165}],[{"start":{"row":1,"column":25},"end":{"row":1,"column":26},"action":"insert","lines":["-"],"id":166}],[{"start":{"row":1,"column":26},"end":{"row":1,"column":27},"action":"insert","lines":["k"],"id":167}],[{"start":{"row":1,"column":27},"end":{"row":1,"column":28},"action":"insert","lines":["n"],"id":168}],[{"start":{"row":1,"column":28},"end":{"row":1,"column":29},"action":"insert","lines":["o"],"id":169}],[{"start":{"row":1,"column":29},"end":{"row":1,"column":30},"action":"insert","lines":["c"],"id":170}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["k"],"id":171}],[{"start":{"row":1,"column":31},"end":{"row":1,"column":32},"action":"insert","lines":["-"],"id":172}],[{"start":{"row":1,"column":32},"end":{"row":1,"column":33},"action":"insert","lines":["j"],"id":173}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"insert","lines":["a"],"id":174}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":["k"],"id":175}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"remove","lines":["k"],"id":176}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"remove","lines":["a"],"id":177}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"insert","lines":["o"],"id":178}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":["k"],"id":179}],[{"start":{"row":1,"column":35},"end":{"row":1,"column":36},"action":"insert","lines":["e"],"id":180}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":37},"action":"insert","lines":["s"],"id":181}],[{"start":{"row":1,"column":37},"end":{"row":1,"column":38},"action":"insert","lines":[" "],"id":182}],[{"start":{"row":1,"column":37},"end":{"row":1,"column":38},"action":"remove","lines":[" "],"id":183}],[{"start":{"row":1,"column":39},"end":{"row":1,"column":40},"action":"insert","lines":[";"],"id":184}],[{"start":{"row":3,"column":19},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":185}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":186}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":1},"action":"insert","lines":["j"],"id":187}],[{"start":{"row":5,"column":1},"end":{"row":5,"column":2},"action":"insert","lines":["o"],"id":188}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["k"],"id":189}],[{"start":{"row":5,"column":3},"end":{"row":5,"column":4},"action":"insert","lines":["e"],"id":190}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":[" "],"id":191}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"remove","lines":[" "],"id":192}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":6},"action":"insert","lines":["()"],"id":193}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":[";"],"id":194}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":1},"action":"insert","lines":["c"],"id":195}],[{"start":{"row":5,"column":1},"end":{"row":5,"column":2},"action":"insert","lines":["o"],"id":196}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["n"],"id":197}],[{"start":{"row":5,"column":3},"end":{"row":5,"column":4},"action":"insert","lines":["s"],"id":198}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["o"],"id":199}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["l"],"id":200}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["e"],"id":201}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":[" "],"id":202}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"remove","lines":[" "],"id":203}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["."],"id":204}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["l"],"id":205}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["o"],"id":206}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["g"],"id":207}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":208}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"remove","lines":[" "],"id":209}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":["("],"id":210}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":[")"],"id":211}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":20},"end":{"row":5,"column":20},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444973756890,"hash":"2faf5ce1f720460d1eebfd38d3a6acda2dc12c34"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/cats.js b/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/cats.js deleted file mode 100644 index da93ff03..00000000 --- a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/cats.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"cats.js","tooltip":"/IntroToNPM/DemoApp/node_modules/cat-me/cats.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":3537.5,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":135,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1444973193904,"hash":"733d975b6bc575701c2d434be9279433511ec4fc"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/index.js b/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/index.js deleted file mode 100644 index 870c6344..00000000 --- a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/IntroToNPM/DemoApp/node_modules/cat-me/index.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444973192750,"hash":"35c1b62e5c42dec40465d63b2337b74764495ff1"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/package.json b/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/package.json deleted file mode 100644 index a8c5b309..00000000 --- a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/cat-me/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/IntroToNPM/DemoApp/node_modules/cat-me/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444973201557,"hash":"f2fc4f1c2401c0bf34ecf797491984066c5bd5a3"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/knock-knock-jokes/index.js b/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/knock-knock-jokes/index.js deleted file mode 100644 index e223a8c7..00000000 --- a/.c9/metadata/workspace/IntroToNPM/DemoApp/node_modules/knock-knock-jokes/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/IntroToNPM/DemoApp/node_modules/knock-knock-jokes/index.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":24,"column":20},"end":{"row":24,"column":20},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444973644145,"hash":"8098aad1ad821429216f7bdc2f5bfece63154b79"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/FakerApp/app.js b/.c9/metadata/workspace/IntroToNPM/FakerApp/app.js deleted file mode 100644 index 416e6d82..00000000 --- a/.c9/metadata/workspace/IntroToNPM/FakerApp/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/IntroToNPM/FakerApp/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":2,"column":63},"end":{"row":2,"column":64},"action":"remove","lines":[" "],"id":150}],[{"start":{"row":2,"column":63},"end":{"row":2,"column":64},"action":"insert","lines":["."],"id":151}],[{"start":{"row":2,"column":64},"end":{"row":2,"column":65},"action":"insert","lines":["p"],"id":152}],[{"start":{"row":2,"column":65},"end":{"row":2,"column":66},"action":"insert","lines":["r"],"id":153}],[{"start":{"row":2,"column":66},"end":{"row":2,"column":67},"action":"insert","lines":["i"],"id":154}],[{"start":{"row":2,"column":67},"end":{"row":2,"column":68},"action":"insert","lines":["c"],"id":155}],[{"start":{"row":2,"column":68},"end":{"row":2,"column":69},"action":"insert","lines":["e"],"id":156}],[{"start":{"row":2,"column":69},"end":{"row":2,"column":70},"action":"insert","lines":[" "],"id":157}],[{"start":{"row":2,"column":69},"end":{"row":2,"column":70},"action":"remove","lines":[" "],"id":158}],[{"start":{"row":2,"column":69},"end":{"row":2,"column":71},"action":"insert","lines":["()"],"id":159}],[{"start":{"row":2,"column":48},"end":{"row":2,"column":49},"action":"insert","lines":["_"],"id":160}],[{"start":{"row":2,"column":48},"end":{"row":2,"column":49},"action":"remove","lines":["_"],"id":161}],[{"start":{"row":2,"column":48},"end":{"row":2,"column":49},"action":"insert","lines":[" "],"id":162}],[{"start":{"row":2,"column":49},"end":{"row":2,"column":50},"action":"insert","lines":["+"],"id":163}],[{"start":{"row":2,"column":47},"end":{"row":2,"column":48},"action":"insert","lines":["$"],"id":164}],[{"start":{"row":0,"column":29},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":165}],[{"start":{"row":0,"column":29},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":166}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":167}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["c"],"id":168}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"remove","lines":["c"],"id":169}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["f"],"id":170}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["o"],"id":171}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["r"],"id":172}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":[" "],"id":173}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"remove","lines":[" "],"id":174}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":5},"action":"insert","lines":["()"],"id":175}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["v"],"id":176}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["a"],"id":177}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["r"],"id":178}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":179}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"remove","lines":[" "],"id":180}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":181}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["i"],"id":182}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":[" "],"id":183}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"remove","lines":[" "],"id":184}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":[" "],"id":185}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["="],"id":186}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":[" "],"id":187}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["0"],"id":188}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":[";"],"id":189}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":[" "],"id":190}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"remove","lines":[" "],"id":191}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":[" "],"id":192}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["I"],"id":193}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"remove","lines":["I"],"id":194}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["i"],"id":195}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":[" "],"id":196}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["<"],"id":197}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":[" "],"id":198}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["1"],"id":199}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":["0"],"id":200}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":[";"],"id":201}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":[" "],"id":202}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":["i"],"id":203}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["+"],"id":204}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["+"],"id":205}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["{"],"id":206}],[{"start":{"row":2,"column":28},"end":{"row":4,"column":1},"action":"insert","lines":[""," ","}"],"id":207}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":76},"action":"remove","lines":["console.log(faker.commerce.productName() + \" - $\" + faker.commerce.price());"],"id":208}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":80},"action":"insert","lines":["console.log(faker.commerce.productName() + \" - $\" + faker.commerce.price());"],"id":209}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":4},"action":"remove","lines":[" "],"id":210}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":4},"action":"insert","lines":[" "],"id":211}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":212}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["c"],"id":213}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["o"],"id":214}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["n"],"id":215}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":["s"],"id":216}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["o"],"id":217}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["l"],"id":218}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["e"],"id":219}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":220}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"remove","lines":[" "],"id":221}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["."],"id":222}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["l"],"id":223}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["o"],"id":224}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["g"],"id":225}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":[" "],"id":226}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"remove","lines":[" "],"id":227}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":13},"action":"insert","lines":["()"],"id":228}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":14},"action":"insert","lines":["\"\""],"id":229}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["W"],"id":230}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["E"],"id":231}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["L"],"id":232}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["C"],"id":233}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["O"],"id":234}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["M"],"id":235}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["E"],"id":236}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":[" "],"id":237}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["T"],"id":238}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":["O"],"id":239}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":[" "],"id":240}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["M"],"id":241}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["Y"],"id":242}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":[" "],"id":243}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["S"],"id":244}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":["H"],"id":245}],[{"start":{"row":2,"column":29},"end":{"row":2,"column":30},"action":"insert","lines":["O"],"id":246}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":["P"],"id":247}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":[" "],"id":248}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"remove","lines":[" "],"id":249}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":["!"],"id":250}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":1},"end":{"row":5,"column":1},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444975895481,"hash":"ef65ae9e26dacc3d848a2619d9e4f4f15196cb8b"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/MyShop/listProducts.js b/.c9/metadata/workspace/IntroToNPM/MyShop/listProducts.js deleted file mode 100644 index 7fd0b96c..00000000 --- a/.c9/metadata/workspace/IntroToNPM/MyShop/listProducts.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"listProducts.js","tooltip":"/IntroToNPM/MyShop/listProducts.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"remove","lines":["W"],"id":297}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["W"],"id":298}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["E"],"id":299}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["L"],"id":300}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["C"],"id":301}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["O"],"id":302}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["M"],"id":303}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["E"],"id":304}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":[" "],"id":305}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["T"],"id":306}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":["O"],"id":307}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":[" "],"id":308}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["M"],"id":309}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["Y"],"id":310}],[{"start":{"row":2,"column":0},"end":{"row":3,"column":0},"action":"remove","lines":["console.log(\"WELCOME TO MY\")",""],"id":311}],[{"start":{"row":2,"column":0},"end":{"row":3,"column":0},"action":"insert","lines":["",""],"id":312}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["c"],"id":313}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["o"],"id":314}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["n"],"id":315}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":["s"],"id":316}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["o"],"id":317}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["l"],"id":318}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["e"],"id":319}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":320}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"remove","lines":[" "],"id":321}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["."],"id":322}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["l"],"id":323}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["o"],"id":324}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["g"],"id":325}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":[" "],"id":326}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"remove","lines":[" "],"id":327}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":13},"action":"insert","lines":["()"],"id":328}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":14},"action":"insert","lines":["\"\""],"id":329}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["W"],"id":330}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["E"],"id":331}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["L"],"id":332}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["C"],"id":333}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["O"],"id":334}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["M"],"id":335}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["E"],"id":336}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":[" "],"id":337}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["T"],"id":338}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":["O"],"id":339}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":[" "],"id":340}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["M"],"id":341}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["Y"],"id":342}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":[" "],"id":343}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["S"],"id":344}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":["H"],"id":345}],[{"start":{"row":2,"column":29},"end":{"row":2,"column":30},"action":"insert","lines":["O"],"id":346}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":["P"],"id":347}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":[" "],"id":348}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"remove","lines":[" "],"id":349}],[{"start":{"row":1,"column":0},"end":{"row":1,"column":1},"action":"insert","lines":["c"],"id":350}],[{"start":{"row":1,"column":1},"end":{"row":1,"column":2},"action":"insert","lines":["o"],"id":351}],[{"start":{"row":1,"column":2},"end":{"row":1,"column":3},"action":"insert","lines":["n"],"id":352}],[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"insert","lines":["s"],"id":353}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["o"],"id":354}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["l"],"id":355}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["e"],"id":356}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":[" "],"id":357}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"remove","lines":[" "],"id":358}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["."],"id":359}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["l"],"id":360}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["o"],"id":361}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["g"],"id":362}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":[" "],"id":363}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":14},"action":"insert","lines":["()"],"id":364}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"remove","lines":[")"],"id":365}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"remove","lines":["("],"id":366}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":14},"action":"insert","lines":["()"],"id":367}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":14},"action":"remove","lines":["()"],"id":368}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":[" "],"id":369}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":13},"action":"insert","lines":["()"],"id":370}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":14},"action":"insert","lines":["\"\""],"id":371}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["="],"id":372}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["="],"id":373}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":["="],"id":374}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["="],"id":375}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["="],"id":376}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":["="],"id":377}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":["="],"id":378}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":["="],"id":379}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["="],"id":380}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":["="],"id":381}],[{"start":{"row":1,"column":23},"end":{"row":1,"column":24},"action":"insert","lines":["="],"id":382}],[{"start":{"row":1,"column":24},"end":{"row":1,"column":25},"action":"insert","lines":["="],"id":383}],[{"start":{"row":1,"column":25},"end":{"row":1,"column":26},"action":"insert","lines":["="],"id":384}],[{"start":{"row":1,"column":26},"end":{"row":1,"column":27},"action":"insert","lines":["="],"id":385}],[{"start":{"row":1,"column":27},"end":{"row":1,"column":28},"action":"insert","lines":["="],"id":386}],[{"start":{"row":1,"column":28},"end":{"row":1,"column":29},"action":"insert","lines":["="],"id":387}],[{"start":{"row":1,"column":29},"end":{"row":1,"column":30},"action":"insert","lines":["="],"id":388}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["="],"id":389}],[{"start":{"row":1,"column":31},"end":{"row":1,"column":32},"action":"insert","lines":["="],"id":390}],[{"start":{"row":1,"column":32},"end":{"row":1,"column":33},"action":"insert","lines":["="],"id":391}],[{"start":{"row":0,"column":29},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":392}],[{"start":{"row":3,"column":33},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":394}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["console.log(\"====================\")",""],"id":395}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"insert","lines":[";"],"id":396}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":[";"],"id":397}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"insert","lines":[";"],"id":398}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":9,"column":0},"end":{"row":9,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444979128030,"hash":"14459ff27d7e67140658ce170c5d455ea2ebb533"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/exercise.md b/.c9/metadata/workspace/IntroToNPM/exercise.md deleted file mode 100644 index 1f0c078f..00000000 --- a/.c9/metadata/workspace/IntroToNPM/exercise.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"exercise.md","tooltip":"/IntroToNPM/exercise.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"remove","lines":["n"],"id":500}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"remove","lines":["`"],"id":501}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["n"],"id":502}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"remove","lines":["n"],"id":503}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["n"],"id":504}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["o"],"id":505}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"insert","lines":["d"],"id":506}],[{"start":{"row":7,"column":24},"end":{"row":7,"column":25},"action":"insert","lines":["e"],"id":507}],[{"start":{"row":7,"column":25},"end":{"row":7,"column":26},"action":"insert","lines":[" "],"id":508}],[{"start":{"row":7,"column":26},"end":{"row":7,"column":27},"action":"insert","lines":["n"],"id":509}],[{"start":{"row":7,"column":27},"end":{"row":7,"column":28},"action":"insert","lines":["a"],"id":510}],[{"start":{"row":7,"column":28},"end":{"row":7,"column":29},"action":"insert","lines":["d"],"id":511}],[{"start":{"row":7,"column":29},"end":{"row":7,"column":30},"action":"insert","lines":[" "],"id":512}],[{"start":{"row":7,"column":30},"end":{"row":7,"column":31},"action":"insert","lines":["m"],"id":513}],[{"start":{"row":7,"column":31},"end":{"row":7,"column":32},"action":"insert","lines":["a"],"id":514}],[{"start":{"row":7,"column":31},"end":{"row":7,"column":32},"action":"remove","lines":["a"],"id":515}],[{"start":{"row":7,"column":30},"end":{"row":7,"column":31},"action":"remove","lines":["m"],"id":516}],[{"start":{"row":7,"column":26},"end":{"row":7,"column":30},"action":"remove","lines":["nad "],"id":518}],[{"start":{"row":7,"column":26},"end":{"row":7,"column":27},"action":"insert","lines":["a"],"id":519}],[{"start":{"row":7,"column":27},"end":{"row":7,"column":28},"action":"insert","lines":["n"],"id":520}],[{"start":{"row":7,"column":28},"end":{"row":7,"column":29},"action":"insert","lines":["d"],"id":521}],[{"start":{"row":7,"column":29},"end":{"row":7,"column":30},"action":"insert","lines":[" "],"id":522}],[{"start":{"row":7,"column":30},"end":{"row":7,"column":31},"action":"insert","lines":["m"],"id":523}],[{"start":{"row":7,"column":31},"end":{"row":7,"column":32},"action":"insert","lines":["a"],"id":524}],[{"start":{"row":7,"column":32},"end":{"row":7,"column":33},"action":"insert","lines":["k"],"id":525}],[{"start":{"row":7,"column":33},"end":{"row":7,"column":34},"action":"insert","lines":["e"],"id":526}],[{"start":{"row":7,"column":34},"end":{"row":7,"column":35},"action":"insert","lines":[" "],"id":527}],[{"start":{"row":7,"column":35},"end":{"row":7,"column":36},"action":"insert","lines":["s"],"id":528}],[{"start":{"row":7,"column":36},"end":{"row":7,"column":37},"action":"insert","lines":["u"],"id":529}],[{"start":{"row":7,"column":37},"end":{"row":7,"column":38},"action":"insert","lines":["r"],"id":530}],[{"start":{"row":7,"column":38},"end":{"row":7,"column":39},"action":"insert","lines":["e"],"id":531}],[{"start":{"row":7,"column":39},"end":{"row":7,"column":40},"action":"insert","lines":[" "],"id":532}],[{"start":{"row":7,"column":40},"end":{"row":7,"column":41},"action":"insert","lines":["i"],"id":533}],[{"start":{"row":7,"column":41},"end":{"row":7,"column":42},"action":"insert","lines":["t"],"id":534}],[{"start":{"row":7,"column":42},"end":{"row":7,"column":43},"action":"insert","lines":[" "],"id":535}],[{"start":{"row":7,"column":43},"end":{"row":7,"column":44},"action":"insert","lines":["w"],"id":536}],[{"start":{"row":7,"column":44},"end":{"row":7,"column":45},"action":"insert","lines":["o"],"id":537}],[{"start":{"row":7,"column":45},"end":{"row":7,"column":46},"action":"insert","lines":["r"],"id":538}],[{"start":{"row":7,"column":46},"end":{"row":7,"column":47},"action":"insert","lines":["k"],"id":539}],[{"start":{"row":7,"column":47},"end":{"row":7,"column":48},"action":"insert","lines":["s"],"id":540}],[{"start":{"row":7,"column":48},"end":{"row":7,"column":49},"action":"insert","lines":[" "],"id":541}],[{"start":{"row":7,"column":48},"end":{"row":7,"column":49},"action":"remove","lines":[" "],"id":542}],[{"start":{"row":7,"column":48},"end":{"row":7,"column":49},"action":"insert","lines":["!"],"id":543}],[{"start":{"row":6,"column":59},"end":{"row":6,"column":60},"action":"insert","lines":["."],"id":544}],[{"start":{"row":6,"column":59},"end":{"row":6,"column":60},"action":"remove","lines":["."],"id":545}],[{"start":{"row":6,"column":59},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":546},{"start":{"row":7,"column":0},"end":{"row":7,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":7,"column":2},"end":{"row":7,"column":3},"action":"insert","lines":["B"],"id":547}],[{"start":{"row":7,"column":3},"end":{"row":7,"column":4},"action":"insert","lines":["E"],"id":548}],[{"start":{"row":7,"column":4},"end":{"row":7,"column":5},"action":"insert","lines":[" "],"id":549}],[{"start":{"row":7,"column":5},"end":{"row":7,"column":6},"action":"insert","lines":["R"],"id":550}],[{"start":{"row":7,"column":6},"end":{"row":7,"column":7},"action":"insert","lines":["E"],"id":551}],[{"start":{"row":7,"column":7},"end":{"row":7,"column":8},"action":"insert","lines":["S"],"id":552}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":["O"],"id":553}],[{"start":{"row":7,"column":9},"end":{"row":7,"column":10},"action":"insert","lines":["U"],"id":554}],[{"start":{"row":7,"column":10},"end":{"row":7,"column":11},"action":"insert","lines":["R"],"id":555}],[{"start":{"row":7,"column":11},"end":{"row":7,"column":12},"action":"insert","lines":["C"],"id":556}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":["E"],"id":557}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"insert","lines":["F"],"id":558}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":["U"],"id":559}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":["L"],"id":560}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"insert","lines":[" "],"id":561}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"remove","lines":[" "],"id":562}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"insert","lines":["!"],"id":563}],[{"start":{"row":7,"column":17},"end":{"row":7,"column":18},"action":"insert","lines":[" "],"id":564}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"insert","lines":["D"],"id":565}],[{"start":{"row":7,"column":19},"end":{"row":7,"column":20},"action":"insert","lines":["O"],"id":566}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"insert","lines":["N"],"id":567}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["'"],"id":568}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["T"],"id":569}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"insert","lines":[" "],"id":570}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"remove","lines":[" "],"id":571}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"remove","lines":["T"],"id":572}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["T"],"id":573}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"insert","lines":[" "],"id":574}],[{"start":{"row":7,"column":24},"end":{"row":7,"column":25},"action":"insert","lines":["C"],"id":575}],[{"start":{"row":7,"column":25},"end":{"row":7,"column":26},"action":"insert","lines":["H"],"id":576}],[{"start":{"row":7,"column":26},"end":{"row":7,"column":27},"action":"insert","lines":["E"],"id":577}],[{"start":{"row":7,"column":27},"end":{"row":7,"column":28},"action":"insert","lines":["A"],"id":578}],[{"start":{"row":7,"column":28},"end":{"row":7,"column":29},"action":"insert","lines":["T"],"id":579}],[{"start":{"row":7,"column":29},"end":{"row":7,"column":30},"action":"insert","lines":[" "],"id":580}],[{"start":{"row":7,"column":30},"end":{"row":7,"column":31},"action":"insert","lines":["A"],"id":581}],[{"start":{"row":7,"column":31},"end":{"row":7,"column":32},"action":"insert","lines":["N"],"id":582}],[{"start":{"row":7,"column":32},"end":{"row":7,"column":33},"action":"insert","lines":["D"],"id":583}],[{"start":{"row":7,"column":33},"end":{"row":7,"column":34},"action":"insert","lines":[" "],"id":584}],[{"start":{"row":7,"column":34},"end":{"row":7,"column":35},"action":"insert","lines":["F"],"id":585}],[{"start":{"row":7,"column":35},"end":{"row":7,"column":36},"action":"insert","lines":["A"],"id":586}],[{"start":{"row":7,"column":36},"end":{"row":7,"column":37},"action":"insert","lines":["S"],"id":587}],[{"start":{"row":7,"column":37},"end":{"row":7,"column":38},"action":"insert","lines":["T"],"id":588}],[{"start":{"row":7,"column":38},"end":{"row":7,"column":39},"action":"insert","lines":[" "],"id":589}],[{"start":{"row":7,"column":39},"end":{"row":7,"column":40},"action":"insert","lines":["F"],"id":590}],[{"start":{"row":7,"column":40},"end":{"row":7,"column":41},"action":"insert","lines":["O"],"id":591}],[{"start":{"row":7,"column":41},"end":{"row":7,"column":42},"action":"insert","lines":["R"],"id":592}],[{"start":{"row":7,"column":42},"end":{"row":7,"column":43},"action":"insert","lines":["W"],"id":593}],[{"start":{"row":7,"column":43},"end":{"row":7,"column":44},"action":"insert","lines":["A"],"id":594}],[{"start":{"row":7,"column":44},"end":{"row":7,"column":45},"action":"insert","lines":["R"],"id":595}],[{"start":{"row":7,"column":45},"end":{"row":7,"column":46},"action":"insert","lines":["D"],"id":596}],[{"start":{"row":7,"column":46},"end":{"row":7,"column":47},"action":"insert","lines":[" "],"id":597}],[{"start":{"row":7,"column":46},"end":{"row":7,"column":47},"action":"remove","lines":[" "],"id":598}],[{"start":{"row":7,"column":46},"end":{"row":7,"column":47},"action":"insert","lines":["!"],"id":599}],[{"start":{"row":7,"column":47},"end":{"row":7,"column":48},"action":"insert","lines":["!"],"id":600}],[{"start":{"row":7,"column":48},"end":{"row":7,"column":49},"action":"insert","lines":["!"],"id":601}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":32},"end":{"row":0,"column":32},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444976142778,"hash":"c4636364942d4e91e26cb577a345f38fc40ed02d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNPM/objectives.md b/.c9/metadata/workspace/IntroToNPM/objectives.md deleted file mode 100644 index 69682aed..00000000 --- a/.c9/metadata/workspace/IntroToNPM/objectives.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"objectives.md","tooltip":"/IntroToNPM/objectives.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":10,"column":11},"end":{"row":10,"column":12},"action":"insert","lines":["i"],"id":380}],[{"start":{"row":10,"column":12},"end":{"row":10,"column":13},"action":"insert","lines":["r"],"id":381}],[{"start":{"row":10,"column":13},"end":{"row":10,"column":14},"action":"insert","lines":["e"],"id":382}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"insert","lines":[" "],"id":383}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"remove","lines":[" "],"id":384}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"insert","lines":["("],"id":385}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"insert","lines":[")"],"id":386}],[{"start":{"row":10,"column":16},"end":{"row":10,"column":17},"action":"insert","lines":["`"],"id":387}],[{"start":{"row":10,"column":17},"end":{"row":10,"column":18},"action":"insert","lines":[" "],"id":388}],[{"start":{"row":10,"column":18},"end":{"row":10,"column":19},"action":"insert","lines":["r"],"id":389}],[{"start":{"row":10,"column":18},"end":{"row":10,"column":19},"action":"remove","lines":["r"],"id":390}],[{"start":{"row":10,"column":18},"end":{"row":10,"column":19},"action":"insert","lines":["t"],"id":391}],[{"start":{"row":10,"column":19},"end":{"row":10,"column":20},"action":"insert","lines":["o"],"id":392}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":[" "],"id":393}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"remove","lines":[" "],"id":394}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":[" "],"id":395}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"insert","lines":["i"],"id":396}],[{"start":{"row":10,"column":22},"end":{"row":10,"column":23},"action":"insert","lines":["m"],"id":397}],[{"start":{"row":10,"column":23},"end":{"row":10,"column":24},"action":"insert","lines":["p"],"id":398}],[{"start":{"row":10,"column":24},"end":{"row":10,"column":25},"action":"insert","lines":["o"],"id":399}],[{"start":{"row":10,"column":25},"end":{"row":10,"column":26},"action":"insert","lines":["r"],"id":400}],[{"start":{"row":10,"column":26},"end":{"row":10,"column":27},"action":"insert","lines":["t"],"id":401}],[{"start":{"row":10,"column":27},"end":{"row":10,"column":28},"action":"insert","lines":[" "],"id":402}],[{"start":{"row":10,"column":28},"end":{"row":10,"column":29},"action":"insert","lines":["a"],"id":403}],[{"start":{"row":10,"column":29},"end":{"row":10,"column":30},"action":"insert","lines":[" "],"id":404}],[{"start":{"row":10,"column":30},"end":{"row":10,"column":31},"action":"insert","lines":["p"],"id":405}],[{"start":{"row":10,"column":31},"end":{"row":10,"column":32},"action":"insert","lines":["a"],"id":406}],[{"start":{"row":10,"column":32},"end":{"row":10,"column":33},"action":"insert","lines":["c"],"id":407}],[{"start":{"row":10,"column":33},"end":{"row":10,"column":34},"action":"insert","lines":["k"],"id":408}],[{"start":{"row":10,"column":34},"end":{"row":10,"column":35},"action":"insert","lines":["a"],"id":409}],[{"start":{"row":10,"column":35},"end":{"row":10,"column":36},"action":"insert","lines":["g"],"id":410}],[{"start":{"row":10,"column":36},"end":{"row":10,"column":37},"action":"insert","lines":["e"],"id":411}],[{"start":{"row":10,"column":37},"end":{"row":10,"column":38},"action":"insert","lines":[" "],"id":412}],[{"start":{"row":10,"column":37},"end":{"row":10,"column":38},"action":"remove","lines":[" "],"id":413}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":27},"action":"remove","lines":["import"],"id":414}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"remove","lines":[" "],"id":415}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":[" "],"id":416}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"insert","lines":["i"],"id":417}],[{"start":{"row":10,"column":22},"end":{"row":10,"column":23},"action":"insert","lines":["n"],"id":418}],[{"start":{"row":10,"column":23},"end":{"row":10,"column":24},"action":"insert","lines":["c"],"id":419}],[{"start":{"row":10,"column":24},"end":{"row":10,"column":25},"action":"insert","lines":["l"],"id":420}],[{"start":{"row":10,"column":25},"end":{"row":10,"column":26},"action":"insert","lines":["u"],"id":421}],[{"start":{"row":10,"column":26},"end":{"row":10,"column":27},"action":"insert","lines":["d"],"id":422}],[{"start":{"row":10,"column":27},"end":{"row":10,"column":28},"action":"insert","lines":["e"],"id":423}],[{"start":{"row":10,"column":28},"end":{"row":10,"column":29},"action":"insert","lines":[" "],"id":424}],[{"start":{"row":10,"column":28},"end":{"row":10,"column":29},"action":"remove","lines":[" "],"id":425}],[{"start":{"row":10,"column":38},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":426},{"start":{"row":11,"column":0},"end":{"row":11,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":11,"column":2},"end":{"row":11,"column":3},"action":"insert","lines":["I"],"id":427}],[{"start":{"row":11,"column":3},"end":{"row":11,"column":4},"action":"insert","lines":["n"],"id":428}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":5},"action":"insert","lines":["s"],"id":429}],[{"start":{"row":11,"column":5},"end":{"row":11,"column":6},"action":"insert","lines":["t"],"id":430}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"insert","lines":["a"],"id":431}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"insert","lines":["l"],"id":432}],[{"start":{"row":11,"column":8},"end":{"row":11,"column":9},"action":"insert","lines":["l"],"id":433}],[{"start":{"row":11,"column":9},"end":{"row":11,"column":10},"action":"insert","lines":[" "],"id":434}],[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"insert","lines":["b"],"id":435}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":["o"],"id":436}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["t"],"id":437}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":["h"],"id":438}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":[" "],"id":439}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"remove","lines":[" "],"id":440}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"remove","lines":["h"],"id":441}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"remove","lines":["t"],"id":442}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"remove","lines":["o"],"id":443}],[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"remove","lines":["b"],"id":444}],[{"start":{"row":11,"column":9},"end":{"row":11,"column":10},"action":"remove","lines":[" "],"id":445}],[{"start":{"row":11,"column":8},"end":{"row":11,"column":9},"action":"remove","lines":["l"],"id":446}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"remove","lines":["l"],"id":447}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"remove","lines":["a"],"id":448}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"insert","lines":["a"],"id":449}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"insert","lines":["l"],"id":450}],[{"start":{"row":11,"column":8},"end":{"row":11,"column":9},"action":"insert","lines":["l"],"id":451}],[{"start":{"row":11,"column":9},"end":{"row":11,"column":10},"action":"insert","lines":[" "],"id":452}],[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"insert","lines":["b"],"id":453}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":["o"],"id":454}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["t"],"id":455}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":["h"],"id":456}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":[" "],"id":457}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"remove","lines":[" "],"id":458}],[{"start":{"row":11,"column":0},"end":{"row":11,"column":14},"action":"remove","lines":["* Install both"],"id":459}],[{"start":{"row":10,"column":38},"end":{"row":11,"column":0},"action":"remove","lines":["",""],"id":460}],[{"start":{"row":5,"column":2},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":461}],[{"start":{"row":6,"column":0},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":462}],[{"start":{"row":7,"column":0},"end":{"row":7,"column":1},"action":"insert","lines":["="],"id":463}],[{"start":{"row":7,"column":1},"end":{"row":7,"column":2},"action":"insert","lines":["="],"id":464}],[{"start":{"row":7,"column":2},"end":{"row":7,"column":3},"action":"insert","lines":["="],"id":465}],[{"start":{"row":7,"column":2},"end":{"row":7,"column":3},"action":"remove","lines":["="],"id":466}],[{"start":{"row":7,"column":1},"end":{"row":7,"column":2},"action":"remove","lines":["="],"id":467}],[{"start":{"row":7,"column":0},"end":{"row":7,"column":1},"action":"remove","lines":["="],"id":468}],[{"start":{"row":6,"column":0},"end":{"row":7,"column":0},"action":"remove","lines":["",""],"id":469}],[{"start":{"row":5,"column":2},"end":{"row":6,"column":0},"action":"remove","lines":["",""],"id":470}],[{"start":{"row":5,"column":2},"end":{"row":6,"column":0},"action":"remove","lines":["",""],"id":471}],[{"start":{"row":5,"column":1},"end":{"row":5,"column":2},"action":"remove","lines":[" "],"id":472}],[{"start":{"row":5,"column":1},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":473}],[{"start":{"row":5,"column":1},"end":{"row":6,"column":0},"action":"remove","lines":["",""],"id":474}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":1},"action":"remove","lines":["*"],"id":475}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":476}],[{"start":{"row":10,"column":38},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":477},{"start":{"row":11,"column":0},"end":{"row":11,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":11,"column":1},"end":{"row":11,"column":2},"action":"remove","lines":[" "],"id":478}],[{"start":{"row":11,"column":0},"end":{"row":11,"column":1},"action":"remove","lines":["*"],"id":479}],[{"start":{"row":10,"column":38},"end":{"row":11,"column":0},"action":"remove","lines":["",""],"id":480}]]},"ace":{"folds":[],"scrolltop":1.5,"scrollleft":0,"selection":{"start":{"row":10,"column":7},"end":{"row":10,"column":14},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444972857248,"hash":"9a613de9fe81f0128632c050c5d269f77c09fb68"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNode/echo.js b/.c9/metadata/workspace/IntroToNode/echo.js deleted file mode 100644 index 05dfefb2..00000000 --- a/.c9/metadata/workspace/IntroToNode/echo.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"echo.js","tooltip":"/IntroToNode/echo.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["c"],"id":13}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["h"],"id":14}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["o"],"id":15}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":[" "],"id":16}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"remove","lines":[" "],"id":17}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":[" "],"id":18}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"remove","lines":[" "],"id":19}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":15},"action":"insert","lines":["()"],"id":20}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["s"],"id":21}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["t"],"id":22}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["r"],"id":23}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":[" "],"id":24}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"remove","lines":[" "],"id":25}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":[","],"id":26}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":[" "],"id":27}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["n"],"id":28}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["u"],"id":29}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["m"],"id":30}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["{"],"id":31}],[{"start":{"row":0,"column":24},"end":{"row":2,"column":1},"action":"insert","lines":[""," ","}"],"id":32}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["c"],"id":33}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["o"],"id":34}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["n"],"id":35}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["s"],"id":36}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["o"],"id":37}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["l"],"id":38}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["e"],"id":39}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":[" "],"id":40}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":[" "],"id":41}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["."],"id":42}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["l"],"id":43}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["o"],"id":44}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["g"],"id":45}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":[" "],"id":46}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"remove","lines":[" "],"id":47}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":17},"action":"insert","lines":["()"],"id":48}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["s"],"id":49}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["t"],"id":50}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":["r"],"id":51}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":[" "],"id":52}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"remove","lines":[" "],"id":53}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":[";"],"id":54}],[{"start":{"row":0,"column":24},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":55},{"start":{"row":1,"column":0},"end":{"row":1,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":1,"column":0},"end":{"row":1,"column":4},"action":"remove","lines":[" "],"id":56}],[{"start":{"row":0,"column":24},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":57}],[{"start":{"row":0,"column":24},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":58},{"start":{"row":1,"column":0},"end":{"row":1,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["f"],"id":59}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["o"],"id":60}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["r"],"id":61}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":[" "],"id":62}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"remove","lines":[" "],"id":63}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":9},"action":"insert","lines":["()"],"id":64}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["v"],"id":65}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["a"],"id":66}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["r"],"id":67}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":[" "],"id":68}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":[" "],"id":69}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["i"],"id":70}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":["i"],"id":71}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":[" "],"id":72}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["i"],"id":73}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":[" "],"id":74}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["="],"id":75}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":[" "],"id":76}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["0"],"id":77}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":[" "],"id":78}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"remove","lines":[" "],"id":79}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":[";"],"id":80}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":[" "],"id":81}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":["i"],"id":82}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":[" "],"id":83}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"remove","lines":[" "],"id":84}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":[" "],"id":85}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["<"],"id":86}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":[" "],"id":87}],[{"start":{"row":1,"column":23},"end":{"row":1,"column":24},"action":"insert","lines":["n"],"id":88}],[{"start":{"row":1,"column":24},"end":{"row":1,"column":25},"action":"insert","lines":["u"],"id":89}],[{"start":{"row":1,"column":25},"end":{"row":1,"column":26},"action":"insert","lines":["m"],"id":90}],[{"start":{"row":1,"column":26},"end":{"row":1,"column":27},"action":"insert","lines":[" "],"id":91}],[{"start":{"row":1,"column":26},"end":{"row":1,"column":27},"action":"remove","lines":[" "],"id":92}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"remove","lines":["0"],"id":93}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["1"],"id":94}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"remove","lines":[" "],"id":95}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":["="],"id":96}],[{"start":{"row":1,"column":23},"end":{"row":1,"column":24},"action":"insert","lines":[" "],"id":97}],[{"start":{"row":1,"column":27},"end":{"row":1,"column":28},"action":"insert","lines":[";"],"id":98}],[{"start":{"row":1,"column":28},"end":{"row":1,"column":29},"action":"insert","lines":[" "],"id":99}],[{"start":{"row":1,"column":29},"end":{"row":1,"column":30},"action":"insert","lines":["i"],"id":100}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":[" "],"id":101}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"remove","lines":[" "],"id":102}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["}"],"id":103}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"remove","lines":["}"],"id":104}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["+"],"id":105}],[{"start":{"row":1,"column":31},"end":{"row":1,"column":32},"action":"insert","lines":["+"],"id":106}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"insert","lines":["{"],"id":107}],[{"start":{"row":2,"column":21},"end":{"row":3,"column":0},"action":"insert","lines":["",""],"id":108},{"start":{"row":3,"column":0},"end":{"row":3,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":5},"action":"insert","lines":["}"],"id":109}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":110}],[{"start":{"row":4,"column":1},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":111}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":112}],[{"start":{"row":6,"column":0},"end":{"row":7,"column":57},"action":"insert","lines":["echo(\"Echo!!!\", 10) //should print \"Echo!!!\" 10 times","echo(\"Tater Tots\", 3) //should print \"Tater Tots\" 3 times"],"id":113}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":6,"column":29},"end":{"row":6,"column":29},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444953916769,"hash":"9a70c799bbbc8fa5e7f3ca806ce785e0ea90a3ad"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNode/exercise.js b/.c9/metadata/workspace/IntroToNode/exercise.js deleted file mode 100644 index 65e9a63e..00000000 --- a/.c9/metadata/workspace/IntroToNode/exercise.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"exercise.js","tooltip":"/IntroToNode/exercise.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":9,"column":41},"end":{"row":9,"column":42},"action":"insert","lines":["s"],"id":1364}],[{"start":{"row":9,"column":42},"end":{"row":9,"column":43},"action":"insert","lines":["i"],"id":1365}],[{"start":{"row":9,"column":43},"end":{"row":9,"column":44},"action":"insert","lines":["n"],"id":1366}],[{"start":{"row":9,"column":44},"end":{"row":9,"column":45},"action":"insert","lines":["g"],"id":1367}],[{"start":{"row":9,"column":45},"end":{"row":9,"column":46},"action":"insert","lines":[" "],"id":1368}],[{"start":{"row":9,"column":45},"end":{"row":9,"column":46},"action":"remove","lines":[" "],"id":1369}],[{"start":{"row":9,"column":45},"end":{"row":9,"column":46},"action":"insert","lines":[" "],"id":1370}],[{"start":{"row":9,"column":46},"end":{"row":9,"column":47},"action":"insert","lines":["n"],"id":1371}],[{"start":{"row":9,"column":47},"end":{"row":9,"column":48},"action":"insert","lines":["o"],"id":1372}],[{"start":{"row":9,"column":48},"end":{"row":9,"column":49},"action":"insert","lines":["e"],"id":1373}],[{"start":{"row":9,"column":49},"end":{"row":9,"column":50},"action":"insert","lines":[" "],"id":1374}],[{"start":{"row":9,"column":49},"end":{"row":9,"column":50},"action":"remove","lines":[" "],"id":1375}],[{"start":{"row":9,"column":48},"end":{"row":9,"column":49},"action":"remove","lines":["e"],"id":1376}],[{"start":{"row":9,"column":48},"end":{"row":9,"column":49},"action":"insert","lines":["d"],"id":1377}],[{"start":{"row":9,"column":49},"end":{"row":9,"column":50},"action":"insert","lines":["e"],"id":1378}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":1379}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"remove","lines":["",""],"id":1380}],[{"start":{"row":8,"column":0},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":1381}],[{"start":{"row":9,"column":0},"end":{"row":9,"column":1},"action":"insert","lines":["/"],"id":1382}],[{"start":{"row":9,"column":1},"end":{"row":9,"column":2},"action":"insert","lines":["/"],"id":1383}],[{"start":{"row":9,"column":2},"end":{"row":9,"column":3},"action":"insert","lines":["A"],"id":1384}],[{"start":{"row":9,"column":3},"end":{"row":9,"column":4},"action":"insert","lines":["d"],"id":1385}],[{"start":{"row":9,"column":3},"end":{"row":9,"column":4},"action":"remove","lines":["d"],"id":1386}],[{"start":{"row":9,"column":2},"end":{"row":9,"column":3},"action":"remove","lines":["A"],"id":1387}],[{"start":{"row":9,"column":2},"end":{"row":9,"column":3},"action":"insert","lines":[" "],"id":1388}],[{"start":{"row":9,"column":3},"end":{"row":9,"column":4},"action":"insert","lines":["A"],"id":1389}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"insert","lines":["d"],"id":1390}],[{"start":{"row":9,"column":5},"end":{"row":9,"column":6},"action":"insert","lines":["d"],"id":1391}],[{"start":{"row":10,"column":2},"end":{"row":10,"column":3},"action":"insert","lines":[" "],"id":1392}],[{"start":{"row":9,"column":6},"end":{"row":9,"column":7},"action":"insert","lines":[" "],"id":1393}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":["t"],"id":1394}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"insert","lines":["h"],"id":1395}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"insert","lines":["e"],"id":1396}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":[" "],"id":1397}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"remove","lines":[" "],"id":1398}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":[" "],"id":1399}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":["2"],"id":1400}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":[" "],"id":1401}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"remove","lines":[" "],"id":1402}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":[" "],"id":1403}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["e"],"id":1404}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":["x"],"id":1405}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"remove","lines":["x"],"id":1406}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"remove","lines":["e"],"id":1407}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"remove","lines":[" "],"id":1408}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"remove","lines":["2"],"id":1409}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":["a"],"id":1410}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":["b"],"id":1411}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["o"],"id":1412}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":["v"],"id":1413}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"insert","lines":["e"],"id":1414}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"insert","lines":[" "],"id":1415}],[{"start":{"row":9,"column":17},"end":{"row":9,"column":18},"action":"insert","lines":["2"],"id":1416}],[{"start":{"row":9,"column":18},"end":{"row":9,"column":19},"action":"insert","lines":[" "],"id":1417}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":20},"action":"insert","lines":["e"],"id":1418}],[{"start":{"row":9,"column":20},"end":{"row":9,"column":21},"action":"insert","lines":["x"],"id":1419}],[{"start":{"row":9,"column":21},"end":{"row":9,"column":22},"action":"insert","lines":["m"],"id":1420}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":["a"],"id":1421}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["p"],"id":1422}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"insert","lines":["l"],"id":1423}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"insert","lines":["e"],"id":1424}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"insert","lines":["s"],"id":1425}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"remove","lines":["s"],"id":1426}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"remove","lines":["e"],"id":1427}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"remove","lines":["l"],"id":1428}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"remove","lines":["p"],"id":1429}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"remove","lines":["a"],"id":1430}],[{"start":{"row":9,"column":21},"end":{"row":9,"column":22},"action":"remove","lines":["m"],"id":1431}],[{"start":{"row":9,"column":21},"end":{"row":9,"column":22},"action":"insert","lines":["a"],"id":1432}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":["m"],"id":1433}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["p"],"id":1434}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"insert","lines":["l"],"id":1435}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"insert","lines":["e"],"id":1436}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"insert","lines":["s"],"id":1437}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"insert","lines":[" "],"id":1438}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":["t"],"id":1439}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":["o"],"id":1440}],[{"start":{"row":9,"column":30},"end":{"row":9,"column":31},"action":"insert","lines":[" "],"id":1441}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"insert","lines":["t"],"id":1442}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"insert","lines":["h"],"id":1443}],[{"start":{"row":9,"column":33},"end":{"row":9,"column":34},"action":"insert","lines":["e"],"id":1444}],[{"start":{"row":9,"column":34},"end":{"row":9,"column":35},"action":"insert","lines":[" "],"id":1445}],[{"start":{"row":9,"column":35},"end":{"row":9,"column":36},"action":"insert","lines":["e"],"id":1446}],[{"start":{"row":9,"column":36},"end":{"row":9,"column":37},"action":"insert","lines":["n"],"id":1447}],[{"start":{"row":9,"column":37},"end":{"row":9,"column":38},"action":"insert","lines":["d"],"id":1448}],[{"start":{"row":9,"column":38},"end":{"row":9,"column":39},"action":"insert","lines":[" "],"id":1449}],[{"start":{"row":9,"column":39},"end":{"row":9,"column":40},"action":"insert","lines":["o"],"id":1450}],[{"start":{"row":9,"column":40},"end":{"row":9,"column":41},"action":"insert","lines":["f"],"id":1451}],[{"start":{"row":9,"column":41},"end":{"row":9,"column":42},"action":"insert","lines":[" "],"id":1452}],[{"start":{"row":9,"column":42},"end":{"row":9,"column":43},"action":"insert","lines":["y"],"id":1453}],[{"start":{"row":9,"column":43},"end":{"row":9,"column":44},"action":"insert","lines":["o"],"id":1454}],[{"start":{"row":9,"column":44},"end":{"row":9,"column":45},"action":"insert","lines":["u"],"id":1455}],[{"start":{"row":9,"column":45},"end":{"row":9,"column":46},"action":"insert","lines":["r"],"id":1456}],[{"start":{"row":9,"column":46},"end":{"row":9,"column":47},"action":"insert","lines":[" "],"id":1457}],[{"start":{"row":9,"column":47},"end":{"row":9,"column":48},"action":"insert","lines":["f"],"id":1458}],[{"start":{"row":9,"column":48},"end":{"row":9,"column":49},"action":"insert","lines":["i"],"id":1459}],[{"start":{"row":9,"column":49},"end":{"row":9,"column":50},"action":"insert","lines":["e"],"id":1460}],[{"start":{"row":9,"column":50},"end":{"row":9,"column":51},"action":"insert","lines":[" "],"id":1461}],[{"start":{"row":9,"column":50},"end":{"row":9,"column":51},"action":"remove","lines":[" "],"id":1462}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":1},"action":"insert","lines":["-"],"id":1463}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":1},"action":"remove","lines":["-"],"id":1464}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":11,"column":0},"end":{"row":11,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444953919816,"hash":"4037af1f3cd5b1e4c22f078da6e746517e752ea8"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNode/exercise2.js b/.c9/metadata/workspace/IntroToNode/exercise2.js deleted file mode 100644 index a76fe20b..00000000 --- a/.c9/metadata/workspace/IntroToNode/exercise2.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"exercise2.js","tooltip":"/IntroToNode/exercise2.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":10,"column":29},"end":{"row":10,"column":30},"action":"insert","lines":["r"],"id":598}],[{"start":{"row":10,"column":30},"end":{"row":10,"column":31},"action":"insert","lines":["n"],"id":599}],[{"start":{"row":10,"column":31},"end":{"row":10,"column":32},"action":"insert","lines":[" "],"id":600}],[{"start":{"row":10,"column":31},"end":{"row":10,"column":32},"action":"remove","lines":[" "],"id":601}],[{"start":{"row":10,"column":31},"end":{"row":10,"column":32},"action":"insert","lines":[" "],"id":602}],[{"start":{"row":7,"column":49},"end":{"row":7,"column":50},"action":"insert","lines":[","],"id":603}],[{"start":{"row":7,"column":50},"end":{"row":7,"column":51},"action":"insert","lines":[" "],"id":604}],[{"start":{"row":7,"column":51},"end":{"row":7,"column":52},"action":"insert","lines":["r"],"id":605}],[{"start":{"row":7,"column":52},"end":{"row":7,"column":53},"action":"insert","lines":["o"],"id":606}],[{"start":{"row":7,"column":53},"end":{"row":7,"column":54},"action":"insert","lines":["u"],"id":607}],[{"start":{"row":7,"column":54},"end":{"row":7,"column":55},"action":"insert","lines":["n"],"id":608}],[{"start":{"row":7,"column":55},"end":{"row":7,"column":56},"action":"insert","lines":["d"],"id":609}],[{"start":{"row":7,"column":56},"end":{"row":7,"column":57},"action":"insert","lines":["e"],"id":610}],[{"start":{"row":7,"column":57},"end":{"row":7,"column":58},"action":"insert","lines":["d"],"id":611}],[{"start":{"row":7,"column":58},"end":{"row":7,"column":59},"action":"insert","lines":[" "],"id":612}],[{"start":{"row":7,"column":58},"end":{"row":7,"column":59},"action":"remove","lines":[" "],"id":613}],[{"start":{"row":7,"column":58},"end":{"row":7,"column":59},"action":"insert","lines":[" "],"id":614}],[{"start":{"row":7,"column":59},"end":{"row":7,"column":60},"action":"insert","lines":["t"],"id":615}],[{"start":{"row":7,"column":60},"end":{"row":7,"column":61},"action":"insert","lines":["o"],"id":616}],[{"start":{"row":7,"column":61},"end":{"row":7,"column":62},"action":"insert","lines":[" "],"id":617}],[{"start":{"row":7,"column":62},"end":{"row":7,"column":63},"action":"insert","lines":["t"],"id":618}],[{"start":{"row":7,"column":63},"end":{"row":7,"column":64},"action":"insert","lines":["h"],"id":619}],[{"start":{"row":7,"column":64},"end":{"row":7,"column":65},"action":"insert","lines":["e"],"id":620}],[{"start":{"row":7,"column":65},"end":{"row":7,"column":66},"action":"insert","lines":[" "],"id":621}],[{"start":{"row":7,"column":66},"end":{"row":7,"column":67},"action":"insert","lines":["n"],"id":622}],[{"start":{"row":7,"column":67},"end":{"row":7,"column":68},"action":"insert","lines":["e"],"id":623}],[{"start":{"row":7,"column":68},"end":{"row":7,"column":69},"action":"insert","lines":["a"],"id":624}],[{"start":{"row":7,"column":69},"end":{"row":7,"column":70},"action":"insert","lines":["r"],"id":625}],[{"start":{"row":7,"column":70},"end":{"row":7,"column":71},"action":"insert","lines":["e"],"id":626}],[{"start":{"row":7,"column":71},"end":{"row":7,"column":72},"action":"insert","lines":["s"],"id":627}],[{"start":{"row":7,"column":72},"end":{"row":7,"column":73},"action":"insert","lines":["t"],"id":628}],[{"start":{"row":7,"column":73},"end":{"row":7,"column":74},"action":"insert","lines":[" "],"id":629}],[{"start":{"row":7,"column":74},"end":{"row":7,"column":75},"action":"insert","lines":["w"],"id":630}],[{"start":{"row":7,"column":75},"end":{"row":7,"column":76},"action":"insert","lines":["h"],"id":631}],[{"start":{"row":7,"column":76},"end":{"row":7,"column":77},"action":"insert","lines":["o"],"id":632}],[{"start":{"row":7,"column":77},"end":{"row":7,"column":78},"action":"insert","lines":["l"],"id":633}],[{"start":{"row":7,"column":78},"end":{"row":7,"column":79},"action":"insert","lines":["e"],"id":634}],[{"start":{"row":7,"column":79},"end":{"row":7,"column":80},"action":"insert","lines":[" "],"id":635}],[{"start":{"row":7,"column":80},"end":{"row":7,"column":81},"action":"insert","lines":["n"],"id":636}],[{"start":{"row":7,"column":81},"end":{"row":7,"column":82},"action":"insert","lines":["u"],"id":637}],[{"start":{"row":7,"column":82},"end":{"row":7,"column":83},"action":"insert","lines":["m"],"id":638}],[{"start":{"row":7,"column":83},"end":{"row":7,"column":84},"action":"insert","lines":["b"],"id":639}],[{"start":{"row":7,"column":84},"end":{"row":7,"column":85},"action":"insert","lines":["e"],"id":640}],[{"start":{"row":7,"column":85},"end":{"row":7,"column":86},"action":"insert","lines":["r"],"id":641}],[{"start":{"row":9,"column":0},"end":{"row":10,"column":32},"action":"remove","lines":["var scores = [90, 78, 81, 97, 98, 57, 77, 86]","average(scores) //should return "],"id":642}],[{"start":{"row":9,"column":0},"end":{"row":13,"column":30},"action":"insert","lines":["var scores = [90, 98, 89, 100, 100, 86, 94];","console.log(average(scores));","","var scores2 = [40, 65, 77, 82, 80, 54, 73, 63, 95, 49];","console.log(average(scores2));"],"id":643}],[{"start":{"row":10,"column":0},"end":{"row":10,"column":12},"action":"remove","lines":["console.log("],"id":644}],[{"start":{"row":10,"column":16},"end":{"row":10,"column":17},"action":"remove","lines":[";"],"id":645}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"remove","lines":[")"],"id":646}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":11},"action":"remove","lines":["console.log"],"id":647}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"remove","lines":[";"],"id":648}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"remove","lines":[")"],"id":649}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"insert","lines":[";"],"id":650}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"insert","lines":[";"],"id":651}],[{"start":{"row":10,"column":16},"end":{"row":10,"column":17},"action":"insert","lines":[" "],"id":652}],[{"start":{"row":10,"column":17},"end":{"row":10,"column":18},"action":"insert","lines":["/"],"id":653}],[{"start":{"row":10,"column":18},"end":{"row":10,"column":19},"action":"insert","lines":["/"],"id":654}],[{"start":{"row":10,"column":19},"end":{"row":10,"column":20},"action":"insert","lines":["s"],"id":655}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":["h"],"id":656}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"insert","lines":["o"],"id":657}],[{"start":{"row":10,"column":22},"end":{"row":10,"column":23},"action":"insert","lines":["u"],"id":658}],[{"start":{"row":10,"column":23},"end":{"row":10,"column":24},"action":"insert","lines":["l"],"id":659}],[{"start":{"row":10,"column":24},"end":{"row":10,"column":25},"action":"insert","lines":["d"],"id":660}],[{"start":{"row":10,"column":25},"end":{"row":10,"column":26},"action":"insert","lines":[" "],"id":661}],[{"start":{"row":10,"column":26},"end":{"row":10,"column":27},"action":"insert","lines":["r"],"id":662}],[{"start":{"row":10,"column":27},"end":{"row":10,"column":28},"action":"insert","lines":["e"],"id":663}],[{"start":{"row":10,"column":28},"end":{"row":10,"column":29},"action":"insert","lines":["t"],"id":664}],[{"start":{"row":10,"column":29},"end":{"row":10,"column":30},"action":"insert","lines":["u"],"id":665}],[{"start":{"row":10,"column":30},"end":{"row":10,"column":31},"action":"insert","lines":["r"],"id":666}],[{"start":{"row":10,"column":31},"end":{"row":10,"column":32},"action":"insert","lines":["n"],"id":667}],[{"start":{"row":10,"column":32},"end":{"row":10,"column":33},"action":"insert","lines":[" "],"id":668}],[{"start":{"row":10,"column":32},"end":{"row":10,"column":33},"action":"remove","lines":[" "],"id":669}],[{"start":{"row":10,"column":32},"end":{"row":10,"column":33},"action":"insert","lines":[" "],"id":670}],[{"start":{"row":10,"column":33},"end":{"row":10,"column":34},"action":"insert","lines":["9"],"id":671}],[{"start":{"row":10,"column":34},"end":{"row":10,"column":35},"action":"insert","lines":["4"],"id":672}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"insert","lines":["/"],"id":673}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"remove","lines":["/"],"id":674}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"insert","lines":[" "],"id":675}],[{"start":{"row":13,"column":19},"end":{"row":13,"column":20},"action":"insert","lines":["/"],"id":676}],[{"start":{"row":13,"column":20},"end":{"row":13,"column":21},"action":"insert","lines":["/"],"id":677}],[{"start":{"row":13,"column":21},"end":{"row":13,"column":22},"action":"insert","lines":["s"],"id":678}],[{"start":{"row":13,"column":22},"end":{"row":13,"column":23},"action":"insert","lines":["h"],"id":679}],[{"start":{"row":13,"column":23},"end":{"row":13,"column":24},"action":"insert","lines":["o"],"id":680}],[{"start":{"row":13,"column":24},"end":{"row":13,"column":25},"action":"insert","lines":["u"],"id":681}],[{"start":{"row":13,"column":25},"end":{"row":13,"column":26},"action":"insert","lines":["l"],"id":682}],[{"start":{"row":13,"column":26},"end":{"row":13,"column":27},"action":"insert","lines":["d"],"id":683}],[{"start":{"row":13,"column":27},"end":{"row":13,"column":28},"action":"insert","lines":[" "],"id":684}],[{"start":{"row":13,"column":28},"end":{"row":13,"column":29},"action":"insert","lines":["r"],"id":685}],[{"start":{"row":13,"column":29},"end":{"row":13,"column":30},"action":"insert","lines":["e"],"id":686}],[{"start":{"row":13,"column":30},"end":{"row":13,"column":31},"action":"insert","lines":["t"],"id":687}],[{"start":{"row":13,"column":31},"end":{"row":13,"column":32},"action":"insert","lines":["u"],"id":688}],[{"start":{"row":13,"column":32},"end":{"row":13,"column":33},"action":"insert","lines":["r"],"id":689}],[{"start":{"row":13,"column":33},"end":{"row":13,"column":34},"action":"insert","lines":["n"],"id":690}],[{"start":{"row":13,"column":34},"end":{"row":13,"column":35},"action":"insert","lines":[" "],"id":691}],[{"start":{"row":13,"column":34},"end":{"row":13,"column":35},"action":"remove","lines":[" "],"id":692}],[{"start":{"row":10,"column":17},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":693}],[{"start":{"row":10,"column":17},"end":{"row":11,"column":0},"action":"remove","lines":["",""],"id":694}],[{"start":{"row":13,"column":34},"end":{"row":13,"column":35},"action":"insert","lines":[" "],"id":695}],[{"start":{"row":13,"column":35},"end":{"row":13,"column":36},"action":"insert","lines":["6"],"id":696}],[{"start":{"row":13,"column":36},"end":{"row":13,"column":37},"action":"insert","lines":["8"],"id":697}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":1},"action":"remove","lines":["("],"id":698}]]},"ace":{"folds":[],"scrolltop":4.5,"scrollleft":0,"selection":{"start":{"row":9,"column":0},"end":{"row":13,"column":36},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444954574060,"hash":"56b92116e49149aac50877e9378c49b54c1b04ad"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNode/grader.js b/.c9/metadata/workspace/IntroToNode/grader.js deleted file mode 100644 index 5ef38fa6..00000000 --- a/.c9/metadata/workspace/IntroToNode/grader.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"grader.js","tooltip":"/IntroToNode/grader.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":13,"column":16},"end":{"row":13,"column":17},"action":"insert","lines":["r"],"id":440}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"insert","lines":["a"],"id":441}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"insert","lines":["g"],"id":442}],[{"start":{"row":13,"column":19},"end":{"row":13,"column":20},"action":"insert","lines":["e"],"id":443}],[{"start":{"row":13,"column":20},"end":{"row":13,"column":21},"action":"insert","lines":[" "],"id":444}],[{"start":{"row":13,"column":21},"end":{"row":13,"column":22},"action":"insert","lines":["s"],"id":445}],[{"start":{"row":13,"column":22},"end":{"row":13,"column":23},"action":"insert","lines":["c"],"id":446}],[{"start":{"row":13,"column":23},"end":{"row":13,"column":24},"action":"insert","lines":["o"],"id":447}],[{"start":{"row":13,"column":24},"end":{"row":13,"column":25},"action":"insert","lines":["r"],"id":448}],[{"start":{"row":13,"column":25},"end":{"row":13,"column":26},"action":"insert","lines":["e"],"id":449}],[{"start":{"row":13,"column":26},"end":{"row":13,"column":27},"action":"insert","lines":[" "],"id":450}],[{"start":{"row":13,"column":27},"end":{"row":13,"column":28},"action":"insert","lines":["f"],"id":451}],[{"start":{"row":13,"column":28},"end":{"row":13,"column":29},"action":"insert","lines":["o"],"id":452}],[{"start":{"row":13,"column":29},"end":{"row":13,"column":30},"action":"insert","lines":["r"],"id":453}],[{"start":{"row":13,"column":30},"end":{"row":13,"column":31},"action":"insert","lines":[" "],"id":454}],[{"start":{"row":13,"column":30},"end":{"row":13,"column":31},"action":"remove","lines":[" "],"id":455}],[{"start":{"row":13,"column":30},"end":{"row":13,"column":31},"action":"insert","lines":[" "],"id":456}],[{"start":{"row":13,"column":31},"end":{"row":13,"column":32},"action":"insert","lines":["e"],"id":457}],[{"start":{"row":13,"column":32},"end":{"row":13,"column":33},"action":"insert","lines":["n"],"id":458}],[{"start":{"row":13,"column":33},"end":{"row":13,"column":34},"action":"insert","lines":["v"],"id":459}],[{"start":{"row":13,"column":34},"end":{"row":13,"column":35},"action":"insert","lines":["i"],"id":460}],[{"start":{"row":13,"column":35},"end":{"row":13,"column":36},"action":"insert","lines":["r"],"id":461}],[{"start":{"row":13,"column":36},"end":{"row":13,"column":37},"action":"insert","lines":["o"],"id":462}],[{"start":{"row":13,"column":37},"end":{"row":13,"column":38},"action":"insert","lines":["n"],"id":463}],[{"start":{"row":13,"column":38},"end":{"row":13,"column":39},"action":"insert","lines":["m"],"id":464}],[{"start":{"row":13,"column":39},"end":{"row":13,"column":40},"action":"insert","lines":["e"],"id":465}],[{"start":{"row":13,"column":40},"end":{"row":13,"column":41},"action":"insert","lines":["n"],"id":466}],[{"start":{"row":13,"column":41},"end":{"row":13,"column":42},"action":"insert","lines":["t"],"id":467}],[{"start":{"row":13,"column":42},"end":{"row":13,"column":43},"action":"insert","lines":[" "],"id":468}],[{"start":{"row":13,"column":42},"end":{"row":13,"column":43},"action":"remove","lines":[" "],"id":469}],[{"start":{"row":13,"column":42},"end":{"row":13,"column":43},"action":"insert","lines":[" "],"id":470}],[{"start":{"row":13,"column":43},"end":{"row":13,"column":44},"action":"insert","lines":["s"],"id":471}],[{"start":{"row":13,"column":44},"end":{"row":13,"column":45},"action":"insert","lines":["c"],"id":472}],[{"start":{"row":13,"column":45},"end":{"row":13,"column":46},"action":"insert","lines":["i"],"id":473}],[{"start":{"row":13,"column":46},"end":{"row":13,"column":47},"action":"insert","lines":["e"],"id":474}],[{"start":{"row":13,"column":47},"end":{"row":13,"column":48},"action":"insert","lines":["n"],"id":475}],[{"start":{"row":13,"column":48},"end":{"row":13,"column":49},"action":"insert","lines":["c"],"id":476}],[{"start":{"row":13,"column":49},"end":{"row":13,"column":50},"action":"insert","lines":["e"],"id":477}],[{"start":{"row":13,"column":50},"end":{"row":13,"column":51},"action":"insert","lines":[" "],"id":478}],[{"start":{"row":13,"column":50},"end":{"row":13,"column":51},"action":"remove","lines":[" "],"id":479}],[{"start":{"row":13,"column":52},"end":{"row":13,"column":53},"action":"insert","lines":[";"],"id":480}],[{"start":{"row":16,"column":0},"end":{"row":17,"column":0},"action":"insert","lines":["",""],"id":481}],[{"start":{"row":17,"column":0},"end":{"row":17,"column":1},"action":"insert","lines":["c"],"id":482}],[{"start":{"row":17,"column":1},"end":{"row":17,"column":2},"action":"insert","lines":["o"],"id":483}],[{"start":{"row":17,"column":2},"end":{"row":17,"column":3},"action":"insert","lines":["n"],"id":484}],[{"start":{"row":17,"column":3},"end":{"row":17,"column":4},"action":"insert","lines":["s"],"id":485}],[{"start":{"row":17,"column":4},"end":{"row":17,"column":5},"action":"insert","lines":["o"],"id":486}],[{"start":{"row":17,"column":5},"end":{"row":17,"column":6},"action":"insert","lines":["l"],"id":487}],[{"start":{"row":17,"column":6},"end":{"row":17,"column":7},"action":"insert","lines":["e"],"id":488}],[{"start":{"row":17,"column":7},"end":{"row":17,"column":8},"action":"insert","lines":[" "],"id":489}],[{"start":{"row":17,"column":7},"end":{"row":17,"column":8},"action":"remove","lines":[" "],"id":490}],[{"start":{"row":17,"column":7},"end":{"row":17,"column":8},"action":"insert","lines":["."],"id":491}],[{"start":{"row":17,"column":8},"end":{"row":17,"column":9},"action":"insert","lines":["l"],"id":492}],[{"start":{"row":17,"column":9},"end":{"row":17,"column":10},"action":"insert","lines":["o"],"id":493}],[{"start":{"row":17,"column":10},"end":{"row":17,"column":11},"action":"insert","lines":["g"],"id":494}],[{"start":{"row":17,"column":11},"end":{"row":17,"column":12},"action":"insert","lines":[" "],"id":495}],[{"start":{"row":17,"column":11},"end":{"row":17,"column":12},"action":"remove","lines":[" "],"id":496}],[{"start":{"row":17,"column":11},"end":{"row":17,"column":13},"action":"insert","lines":["()"],"id":497}],[{"start":{"row":17,"column":12},"end":{"row":17,"column":14},"action":"insert","lines":["\"\""],"id":498}],[{"start":{"row":17,"column":13},"end":{"row":17,"column":14},"action":"insert","lines":["A"],"id":499}],[{"start":{"row":17,"column":14},"end":{"row":17,"column":15},"action":"insert","lines":["v"],"id":500}],[{"start":{"row":17,"column":15},"end":{"row":17,"column":16},"action":"insert","lines":["e"],"id":501}],[{"start":{"row":17,"column":16},"end":{"row":17,"column":17},"action":"insert","lines":["r"],"id":502}],[{"start":{"row":17,"column":17},"end":{"row":17,"column":18},"action":"insert","lines":["a"],"id":503}],[{"start":{"row":17,"column":18},"end":{"row":17,"column":19},"action":"insert","lines":["g"],"id":504}],[{"start":{"row":17,"column":19},"end":{"row":17,"column":20},"action":"insert","lines":["e"],"id":505}],[{"start":{"row":17,"column":20},"end":{"row":17,"column":21},"action":"insert","lines":[" "],"id":506}],[{"start":{"row":17,"column":21},"end":{"row":17,"column":22},"action":"insert","lines":["s"],"id":507}],[{"start":{"row":17,"column":22},"end":{"row":17,"column":23},"action":"insert","lines":["c"],"id":508}],[{"start":{"row":17,"column":23},"end":{"row":17,"column":24},"action":"insert","lines":["o"],"id":509}],[{"start":{"row":17,"column":24},"end":{"row":17,"column":25},"action":"insert","lines":["r"],"id":510}],[{"start":{"row":17,"column":25},"end":{"row":17,"column":26},"action":"insert","lines":["e"],"id":511}],[{"start":{"row":17,"column":26},"end":{"row":17,"column":27},"action":"insert","lines":[" "],"id":512}],[{"start":{"row":17,"column":26},"end":{"row":17,"column":27},"action":"remove","lines":[" "],"id":513}],[{"start":{"row":17,"column":26},"end":{"row":17,"column":27},"action":"insert","lines":[" "],"id":514}],[{"start":{"row":17,"column":27},"end":{"row":17,"column":28},"action":"insert","lines":["f"],"id":515}],[{"start":{"row":17,"column":28},"end":{"row":17,"column":29},"action":"insert","lines":["o"],"id":516}],[{"start":{"row":17,"column":29},"end":{"row":17,"column":30},"action":"insert","lines":["r"],"id":517}],[{"start":{"row":17,"column":30},"end":{"row":17,"column":31},"action":"insert","lines":[" "],"id":518}],[{"start":{"row":17,"column":30},"end":{"row":17,"column":31},"action":"remove","lines":[" "],"id":519}],[{"start":{"row":17,"column":30},"end":{"row":17,"column":31},"action":"insert","lines":[" "],"id":520}],[{"start":{"row":17,"column":31},"end":{"row":17,"column":32},"action":"insert","lines":["o"],"id":521}],[{"start":{"row":17,"column":32},"end":{"row":17,"column":33},"action":"insert","lines":["r"],"id":522}],[{"start":{"row":17,"column":33},"end":{"row":17,"column":34},"action":"insert","lines":["g"],"id":523}],[{"start":{"row":17,"column":34},"end":{"row":17,"column":35},"action":"insert","lines":["a"],"id":524}],[{"start":{"row":17,"column":35},"end":{"row":17,"column":36},"action":"insert","lines":["n"],"id":525}],[{"start":{"row":17,"column":36},"end":{"row":17,"column":37},"action":"insert","lines":["i"],"id":526}],[{"start":{"row":17,"column":37},"end":{"row":17,"column":38},"action":"insert","lines":["c"],"id":527}],[{"start":{"row":17,"column":38},"end":{"row":17,"column":39},"action":"insert","lines":[" "],"id":528}],[{"start":{"row":17,"column":39},"end":{"row":17,"column":40},"action":"insert","lines":["c"],"id":529}],[{"start":{"row":17,"column":40},"end":{"row":17,"column":41},"action":"insert","lines":["h"],"id":530}],[{"start":{"row":17,"column":41},"end":{"row":17,"column":42},"action":"insert","lines":["e"],"id":531}],[{"start":{"row":17,"column":42},"end":{"row":17,"column":43},"action":"insert","lines":["m"],"id":532}],[{"start":{"row":17,"column":43},"end":{"row":17,"column":44},"action":"insert","lines":["i"],"id":533}],[{"start":{"row":17,"column":44},"end":{"row":17,"column":45},"action":"insert","lines":["s"],"id":534}],[{"start":{"row":17,"column":45},"end":{"row":17,"column":46},"action":"insert","lines":["t"],"id":535}],[{"start":{"row":17,"column":46},"end":{"row":17,"column":47},"action":"insert","lines":["r"],"id":536}],[{"start":{"row":17,"column":47},"end":{"row":17,"column":48},"action":"insert","lines":["y"],"id":537}],[{"start":{"row":17,"column":48},"end":{"row":17,"column":49},"action":"insert","lines":[" "],"id":538}],[{"start":{"row":17,"column":48},"end":{"row":17,"column":49},"action":"remove","lines":[" "],"id":539}],[{"start":{"row":17,"column":50},"end":{"row":17,"column":51},"action":"insert","lines":[";"],"id":540}]]},"ace":{"folds":[],"scrolltop":276.5,"scrollleft":0,"selection":{"start":{"row":16,"column":0},"end":{"row":16,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":9,"state":"no_regex","mode":"ace/mode/javascript"}},"timestamp":1444957222761,"hash":"5724a4bc6ba7f3b4e3bb6b95077a2cc7c15ea37e"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNode/hello.js b/.c9/metadata/workspace/IntroToNode/hello.js deleted file mode 100644 index e8f66c54..00000000 --- a/.c9/metadata/workspace/IntroToNode/hello.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"hello.js","tooltip":"/IntroToNode/hello.js","undoManager":{"mark":90,"position":90,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["f"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["o"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["r"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":[" "],"id":4}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"remove","lines":[" "],"id":5}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":5},"action":"insert","lines":["()"],"id":6}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["v"],"id":7}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["a"],"id":8}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["r"],"id":9}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":[" "],"id":10}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"remove","lines":[" "],"id":11}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":[" "],"id":12}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["i"],"id":13}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":[" "],"id":14}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"remove","lines":[" "],"id":15}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":[" "],"id":16}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["="],"id":17}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":[" "],"id":18}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["0"],"id":19}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":[" "],"id":20}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"remove","lines":[" "],"id":21}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":[";"],"id":22}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":[" "],"id":23}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["i"],"id":24}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":[" "],"id":25}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"remove","lines":[" "],"id":26}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":[" "],"id":27}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["<"],"id":28}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":[" "],"id":29}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["1"],"id":30}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["0"],"id":31}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"remove","lines":["0"],"id":32}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"remove","lines":["1"],"id":33}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["1"],"id":34}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["9"],"id":35}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"remove","lines":["9"],"id":36}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["0"],"id":37}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":[";"],"id":38}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":[" "],"id":39}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["i"],"id":40}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":[" "],"id":41}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"remove","lines":[" "],"id":42}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":["+"],"id":43}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"insert","lines":["+"],"id":44}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["{"],"id":45}],[{"start":{"row":0,"column":28},"end":{"row":2,"column":1},"action":"insert","lines":[""," ","}"],"id":46}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["c"],"id":47}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["o"],"id":48}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["n"],"id":49}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["s"],"id":50}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["o"],"id":51}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["l"],"id":52}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["e"],"id":53}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":[" "],"id":54}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":[" "],"id":55}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["."],"id":56}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["l"],"id":57}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["o"],"id":58}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["g"],"id":59}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":[" "],"id":60}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"remove","lines":[" "],"id":61}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":17},"action":"insert","lines":["()"],"id":62}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":18},"action":"insert","lines":["\"\""],"id":63}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["H"],"id":64}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":["E"],"id":65}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":["L"],"id":66}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":["L"],"id":67}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["O"],"id":68}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":[" "],"id":69}],[{"start":{"row":1,"column":23},"end":{"row":1,"column":24},"action":"insert","lines":["F"],"id":70}],[{"start":{"row":1,"column":24},"end":{"row":1,"column":25},"action":"insert","lines":["R"],"id":71}],[{"start":{"row":1,"column":25},"end":{"row":1,"column":26},"action":"insert","lines":["O"],"id":72}],[{"start":{"row":1,"column":26},"end":{"row":1,"column":27},"action":"insert","lines":["M"],"id":73}],[{"start":{"row":1,"column":27},"end":{"row":1,"column":28},"action":"insert","lines":[" "],"id":74}],[{"start":{"row":1,"column":27},"end":{"row":1,"column":28},"action":"remove","lines":[" "],"id":75}],[{"start":{"row":1,"column":27},"end":{"row":1,"column":28},"action":"insert","lines":[" "],"id":76}],[{"start":{"row":1,"column":28},"end":{"row":1,"column":29},"action":"insert","lines":["H"],"id":77}],[{"start":{"row":1,"column":29},"end":{"row":1,"column":30},"action":"insert","lines":["E"],"id":78}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["L"],"id":79}],[{"start":{"row":1,"column":31},"end":{"row":1,"column":32},"action":"insert","lines":["L"],"id":80}],[{"start":{"row":1,"column":32},"end":{"row":1,"column":33},"action":"insert","lines":["O"],"id":81}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"insert","lines":["."],"id":82}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":["j"],"id":83}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"remove","lines":["j"],"id":84}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":["J"],"id":85}],[{"start":{"row":1,"column":35},"end":{"row":1,"column":36},"action":"insert","lines":["S"],"id":86}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":37},"action":"insert","lines":[" "],"id":87}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":37},"action":"remove","lines":[" "],"id":88}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":37},"action":"insert","lines":[" "],"id":89}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":37},"action":"remove","lines":[" "],"id":90}],[{"start":{"row":1,"column":38},"end":{"row":1,"column":39},"action":"insert","lines":[";"],"id":91}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":1},"end":{"row":2,"column":1},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444947013890,"hash":"0ec5922a3dd1cb1ad9a4d0d0ecdc1ccbb985033d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/IntroToNode/hello.rb b/.c9/metadata/workspace/IntroToNode/hello.rb deleted file mode 100644 index cc33bb56..00000000 --- a/.c9/metadata/workspace/IntroToNode/hello.rb +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"hello.rb","tooltip":"/IntroToNode/hello.rb","undoManager":{"mark":27,"position":27,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["p"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["u"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["t"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["s"],"id":4}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":[" "],"id":5}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"remove","lines":[" "],"id":6}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":[" "],"id":7}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":7},"action":"insert","lines":["\"\""],"id":8}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["H"],"id":9}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["i"],"id":10}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":[" "],"id":11}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["f"],"id":12}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["r"],"id":13}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["o"],"id":14}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["m"],"id":15}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":[" "],"id":16}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["h"],"id":17}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["e"],"id":18}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["l"],"id":19}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["l"],"id":20}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["o"],"id":21}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":[" "],"id":22}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"remove","lines":[" "],"id":23}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["."],"id":24}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["r"],"id":25}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["b"],"id":26}],[{"start":{"row":0,"column":23},"end":{"row":1,"column":23},"action":"insert","lines":["","puts \"Hi from hello.rb\""],"id":27}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["puts \"Hi from hello.rb\"",""],"id":28}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":23},"end":{"row":2,"column":23},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1444947176417,"hash":"6e1b17077106d27f47d887c402b898ef51d09547"} \ No newline at end of file diff --git a/.c9/metadata/workspace/MoreExpress/EJSDemo/app.js b/.c9/metadata/workspace/MoreExpress/EJSDemo/app.js deleted file mode 100644 index aa5a5373..00000000 --- a/.c9/metadata/workspace/MoreExpress/EJSDemo/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/MoreExpress/EJSDemo/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":3,"column":0},"end":{"row":3,"column":1},"action":"insert","lines":["a"],"id":1639}],[{"start":{"row":3,"column":1},"end":{"row":3,"column":2},"action":"insert","lines":["p"],"id":1640}],[{"start":{"row":3,"column":2},"end":{"row":3,"column":3},"action":"insert","lines":["p"],"id":1641}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":[" "],"id":1642}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"remove","lines":[" "],"id":1643}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":["."],"id":1644}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":5},"action":"insert","lines":["u"],"id":1645}],[{"start":{"row":3,"column":5},"end":{"row":3,"column":6},"action":"insert","lines":["s"],"id":1646}],[{"start":{"row":3,"column":6},"end":{"row":3,"column":7},"action":"insert","lines":["e"],"id":1647}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":8},"action":"insert","lines":[" "],"id":1648}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":8},"action":"remove","lines":[" "],"id":1649}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":9},"action":"insert","lines":["()"],"id":1650}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":["e"],"id":1651}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":["x"],"id":1652}],[{"start":{"row":3,"column":10},"end":{"row":3,"column":11},"action":"insert","lines":["p"],"id":1653}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"insert","lines":["r"],"id":1654}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"insert","lines":["e"],"id":1655}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["s"],"id":1656}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["s"],"id":1657}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":[" "],"id":1658}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"remove","lines":[" "],"id":1659}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["."],"id":1660}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["s"],"id":1661}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["t"],"id":1662}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":["a"],"id":1663}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"insert","lines":["t"],"id":1664}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"insert","lines":["i"],"id":1665}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"insert","lines":["c"],"id":1666}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":[" "],"id":1667}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"remove","lines":[" "],"id":1668}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":24},"action":"insert","lines":["()"],"id":1669}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":25},"action":"insert","lines":["\"\""],"id":1670}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":["p"],"id":1671}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"insert","lines":["u"],"id":1672}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["b"],"id":1673}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["l"],"id":1674}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"insert","lines":["i"],"id":1675}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":["c"],"id":1676}],[{"start":{"row":3,"column":30},"end":{"row":3,"column":31},"action":"insert","lines":[" "],"id":1677}],[{"start":{"row":3,"column":30},"end":{"row":3,"column":31},"action":"remove","lines":[" "],"id":1678}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":[";"],"id":1679}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"remove","lines":["s"],"id":1680}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"remove","lines":["j"],"id":1681}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"remove","lines":["e"],"id":1682}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"remove","lines":["."],"id":1683}],[{"start":{"row":11,"column":20},"end":{"row":11,"column":23},"action":"remove","lines":["ejs"],"id":1684}],[{"start":{"row":11,"column":19},"end":{"row":11,"column":20},"action":"remove","lines":["."],"id":1685}],[{"start":{"row":21,"column":24},"end":{"row":21,"column":25},"action":"remove","lines":["s"],"id":1686}],[{"start":{"row":21,"column":23},"end":{"row":21,"column":24},"action":"remove","lines":["j"],"id":1687}],[{"start":{"row":21,"column":22},"end":{"row":21,"column":23},"action":"remove","lines":["e"],"id":1688}],[{"start":{"row":21,"column":21},"end":{"row":21,"column":22},"action":"remove","lines":["."],"id":1689}],[{"start":{"row":3,"column":34},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":1690}],[{"start":{"row":4,"column":0},"end":{"row":4,"column":1},"action":"insert","lines":["a"],"id":1691}],[{"start":{"row":4,"column":1},"end":{"row":4,"column":2},"action":"insert","lines":["p"],"id":1692}],[{"start":{"row":4,"column":2},"end":{"row":4,"column":3},"action":"insert","lines":["p"],"id":1693}],[{"start":{"row":4,"column":3},"end":{"row":4,"column":4},"action":"insert","lines":["."],"id":1694}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":["s"],"id":1695}],[{"start":{"row":4,"column":5},"end":{"row":4,"column":6},"action":"insert","lines":["e"],"id":1696}],[{"start":{"row":4,"column":6},"end":{"row":4,"column":7},"action":"insert","lines":["t"],"id":1697}],[{"start":{"row":4,"column":7},"end":{"row":4,"column":8},"action":"insert","lines":[" "],"id":1698}],[{"start":{"row":4,"column":7},"end":{"row":4,"column":8},"action":"remove","lines":[" "],"id":1699}],[{"start":{"row":4,"column":7},"end":{"row":4,"column":9},"action":"insert","lines":["()"],"id":1700}],[{"start":{"row":4,"column":8},"end":{"row":4,"column":10},"action":"insert","lines":["\"\""],"id":1701}],[{"start":{"row":4,"column":9},"end":{"row":4,"column":10},"action":"insert","lines":["v"],"id":1702}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":["i"],"id":1703}],[{"start":{"row":4,"column":11},"end":{"row":4,"column":12},"action":"insert","lines":["e"],"id":1704}],[{"start":{"row":4,"column":12},"end":{"row":4,"column":13},"action":"insert","lines":["w"],"id":1705}],[{"start":{"row":4,"column":13},"end":{"row":4,"column":14},"action":"insert","lines":[" "],"id":1706}],[{"start":{"row":4,"column":13},"end":{"row":4,"column":14},"action":"remove","lines":[" "],"id":1707}],[{"start":{"row":4,"column":13},"end":{"row":4,"column":14},"action":"insert","lines":[" "],"id":1708}],[{"start":{"row":4,"column":14},"end":{"row":4,"column":15},"action":"insert","lines":["e"],"id":1709}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":["n"],"id":1710}],[{"start":{"row":4,"column":16},"end":{"row":4,"column":17},"action":"insert","lines":["g"],"id":1711}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":["i"],"id":1712}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"insert","lines":["n"],"id":1713}],[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"insert","lines":["e"],"id":1714}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":[" "],"id":1715}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"remove","lines":[" "],"id":1716}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":[","],"id":1717}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"insert","lines":[" "],"id":1718}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":25},"action":"insert","lines":["\"\""],"id":1719}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":["e"],"id":1720}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"insert","lines":["j"],"id":1721}],[{"start":{"row":4,"column":26},"end":{"row":4,"column":27},"action":"insert","lines":["s"],"id":1722}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":[" "],"id":1723}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"remove","lines":[" "],"id":1724}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":[";"],"id":1725}],[{"start":{"row":3,"column":34},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":1726}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["app.use(express.static(__dirname + '/public'));",""],"id":1727}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"remove","lines":["app.use(express.static(__dirname + '/public'));",""],"id":1728}],[{"start":{"row":3,"column":34},"end":{"row":4,"column":0},"action":"remove","lines":["",""],"id":1729}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"insert","lines":["."],"id":1730}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["e"],"id":1731}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["j"],"id":1732}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"insert","lines":["s"],"id":1733}],[{"start":{"row":7,"column":24},"end":{"row":7,"column":25},"action":"insert","lines":[" "],"id":1734}],[{"start":{"row":7,"column":24},"end":{"row":7,"column":25},"action":"remove","lines":[" "],"id":1735}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"remove","lines":["s"],"id":1736}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"remove","lines":["j"],"id":1737}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"remove","lines":["e"],"id":1738}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"remove","lines":["."],"id":1739}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":3},"end":{"row":8,"column":3},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445143228525,"hash":"1f153dae9e9fde0fb688c35b4b478910ef47b38e"} \ No newline at end of file diff --git a/.c9/metadata/workspace/MoreExpress/EJSDemo/package.json b/.c9/metadata/workspace/MoreExpress/EJSDemo/package.json deleted file mode 100644 index dc0aedba..00000000 --- a/.c9/metadata/workspace/MoreExpress/EJSDemo/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/MoreExpress/EJSDemo/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":157.5,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":5,"state":"start","mode":"ace/mode/json"}},"timestamp":1445140906350,"hash":"922ff5a8d4e01c941808fd29ce3dad3f40d24090"} \ No newline at end of file diff --git a/.c9/metadata/workspace/MoreExpress/EJSDemo/public/app.css b/.c9/metadata/workspace/MoreExpress/EJSDemo/public/app.css deleted file mode 100644 index ca785478..00000000 --- a/.c9/metadata/workspace/MoreExpress/EJSDemo/public/app.css +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.css","tooltip":"/MoreExpress/EJSDemo/public/app.css","undoManager":{"mark":80,"position":80,"stack":[[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["b"],"id":1}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["o"],"id":2}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["d"],"id":3}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["y"],"id":4}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":[" "],"id":5}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"remove","lines":[" "],"id":6}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"remove","lines":["y"],"id":7}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["y"],"id":8}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":[" "],"id":9}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["{"],"id":10}],[{"start":{"row":0,"column":6},"end":{"row":2,"column":1},"action":"insert","lines":[""," ","}"],"id":11}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["b"],"id":12}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["a"],"id":13}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["c"],"id":14}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["k"],"id":15}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["g"],"id":16}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["r"],"id":17}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["o"],"id":18}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["n"],"id":19}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["d"],"id":20}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"remove","lines":["d"],"id":21}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":["n"],"id":22}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["u"],"id":23}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["n"],"id":24}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["d"],"id":25}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":[" "],"id":26}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"remove","lines":[" "],"id":27}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":16},"action":"insert","lines":[":;"],"id":28}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":[" "],"id":29}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["y"],"id":30}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["e"],"id":31}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":["l"],"id":32}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":["l"],"id":33}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":["o"],"id":34}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["w"],"id":35}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":[" "],"id":36}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"remove","lines":[" "],"id":37}],[{"start":{"row":1,"column":23},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":38},{"start":{"row":2,"column":0},"end":{"row":2,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["c"],"id":39}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["o"],"id":40}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["l"],"id":41}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["o"],"id":42}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["r"],"id":43}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":[" "],"id":44}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"remove","lines":[" "],"id":45}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":11},"action":"insert","lines":[":;"],"id":46}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":[" "],"id":47}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["p"],"id":48}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["u"],"id":49}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["r"],"id":50}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["p"],"id":51}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["l"],"id":52}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["e"],"id":53}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":[" "],"id":54}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"remove","lines":[" "],"id":55}],[{"start":{"row":3,"column":1},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":56}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":57}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":1},"action":"insert","lines":["h"],"id":58}],[{"start":{"row":5,"column":1},"end":{"row":5,"column":2},"action":"insert","lines":["1"],"id":59}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":[":"],"id":60}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"remove","lines":[":"],"id":61}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["P"],"id":62}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"remove","lines":["P"],"id":63}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["{"],"id":64}],[{"start":{"row":5,"column":3},"end":{"row":7,"column":1},"action":"insert","lines":[""," ","}"],"id":65}],[{"start":{"row":6,"column":4},"end":{"row":6,"column":5},"action":"insert","lines":["c"],"id":66}],[{"start":{"row":6,"column":5},"end":{"row":6,"column":6},"action":"insert","lines":["o"],"id":67}],[{"start":{"row":6,"column":6},"end":{"row":6,"column":7},"action":"insert","lines":["l"],"id":68}],[{"start":{"row":6,"column":7},"end":{"row":6,"column":8},"action":"insert","lines":["o"],"id":69}],[{"start":{"row":6,"column":8},"end":{"row":6,"column":9},"action":"insert","lines":["r"],"id":70}],[{"start":{"row":6,"column":9},"end":{"row":6,"column":10},"action":"insert","lines":[" "],"id":71}],[{"start":{"row":6,"column":9},"end":{"row":6,"column":10},"action":"remove","lines":[" "],"id":72}],[{"start":{"row":6,"column":9},"end":{"row":6,"column":11},"action":"insert","lines":[":;"],"id":73}],[{"start":{"row":6,"column":10},"end":{"row":6,"column":11},"action":"insert","lines":[" "],"id":74}],[{"start":{"row":6,"column":11},"end":{"row":6,"column":12},"action":"insert","lines":["g"],"id":75}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"insert","lines":["r"],"id":76}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"insert","lines":["e"],"id":77}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":15},"action":"insert","lines":["e"],"id":78}],[{"start":{"row":6,"column":15},"end":{"row":6,"column":16},"action":"insert","lines":["n"],"id":79}],[{"start":{"row":4,"column":0},"end":{"row":7,"column":1},"action":"remove","lines":["","h1{"," color: green;","}"],"id":80}],[{"start":{"row":3,"column":1},"end":{"row":4,"column":0},"action":"remove","lines":["",""],"id":81}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":3,"column":1},"end":{"row":3,"column":1},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445142670875,"hash":"dce3197a8bc699785c4f7ca0052083ec48796c2f"} \ No newline at end of file diff --git a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/home.ejs b/.c9/metadata/workspace/MoreExpress/EJSDemo/views/home.ejs deleted file mode 100644 index b1f2793b..00000000 --- a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/home.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"home.ejs","tooltip":"/MoreExpress/EJSDemo/views/home.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"insert","lines":["."],"id":35}],[{"start":{"row":0,"column":36},"end":{"row":0,"column":37},"action":"insert","lines":["c"],"id":36}],[{"start":{"row":0,"column":37},"end":{"row":0,"column":38},"action":"insert","lines":["s"],"id":37}],[{"start":{"row":0,"column":38},"end":{"row":0,"column":39},"action":"insert","lines":["s"],"id":38}],[{"start":{"row":0,"column":29},"end":{"row":0,"column":30},"action":"remove","lines":["/"],"id":39}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"insert","lines":["s"],"id":40}],[{"start":{"row":0,"column":29},"end":{"row":0,"column":35},"action":"remove","lines":["styles"],"id":41},{"start":{"row":0,"column":29},"end":{"row":0,"column":39},"action":"insert","lines":["stylesheet"]}],[{"start":{"row":0,"column":38},"end":{"row":0,"column":39},"action":"remove","lines":["t"],"id":42}],[{"start":{"row":0,"column":37},"end":{"row":0,"column":38},"action":"remove","lines":["e"],"id":43}],[{"start":{"row":0,"column":36},"end":{"row":0,"column":37},"action":"remove","lines":["e"],"id":44}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"remove","lines":["h"],"id":45}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"remove","lines":["s"],"id":46}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"insert","lines":["s"],"id":47}],[{"start":{"row":4,"column":99},"end":{"row":4,"column":100},"action":"insert","lines":["l"],"id":48}],[{"start":{"row":4,"column":100},"end":{"row":4,"column":101},"action":"insert","lines":["s"],"id":49}],[{"start":{"row":4,"column":101},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":50}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":41},"action":"remove","lines":[""],"id":51}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":52}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":53}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":54}],[{"start":{"row":0,"column":0},"end":{"row":4,"column":8},"action":"insert","lines":[""],"id":55}],[{"start":{"row":4,"column":8},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":56}],[{"start":{"row":0,"column":0},"end":{"row":4,"column":8},"action":"remove","lines":[""],"id":57}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":58}],[{"start":{"row":0,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["","",""],"id":59}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":60}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":61}],[{"start":{"row":0,"column":0},"end":{"row":4,"column":8},"action":"insert","lines":[""],"id":62}],[{"start":{"row":4,"column":8},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":63}],[{"start":{"row":0,"column":0},"end":{"row":5,"column":0},"action":"remove","lines":["",""],"id":64}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":38},"action":"insert","lines":[""],"id":65}],[{"start":{"row":0,"column":38},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":66}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":67}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":3},"action":"insert","lines":["-->"],"id":68},{"start":{"row":0,"column":0},"end":{"row":0,"column":4},"action":"insert","lines":["",""],"id":95}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["e"],"id":96}],[{"start":{"row":6,"column":10},"end":{"row":6,"column":17},"action":"remove","lines":[" header"],"id":97}],[{"start":{"row":6,"column":10},"end":{"row":6,"column":11},"action":"insert","lines":["e"],"id":98}],[{"start":{"row":6,"column":11},"end":{"row":6,"column":12},"action":"insert","lines":[" "],"id":99}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"insert","lines":["f"],"id":100}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"insert","lines":["o"],"id":101}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":15},"action":"insert","lines":["o"],"id":102}],[{"start":{"row":6,"column":15},"end":{"row":6,"column":16},"action":"insert","lines":["t"],"id":103}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"insert","lines":["e"],"id":104}],[{"start":{"row":6,"column":17},"end":{"row":6,"column":18},"action":"insert","lines":["r"],"id":105}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":30},"action":"remove","lines":["--include header template-->"],"id":107}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":108}],[{"start":{"row":0,"column":2},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":109}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"remove","lines":["!"],"id":110}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"remove","lines":["<"],"id":111}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":29},"action":"insert","lines":["<% include partials/header %>"],"id":112}],[{"start":{"row":4,"column":0},"end":{"row":4,"column":30},"action":"remove","lines":[""],"id":113},{"start":{"row":4,"column":0},"end":{"row":4,"column":29},"action":"insert","lines":["<% include partials/header %>"]}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"remove","lines":["r"],"id":114}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"remove","lines":["e"],"id":115}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"remove","lines":["d"],"id":116}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"remove","lines":["a"],"id":117}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"remove","lines":["e"],"id":118}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"remove","lines":["h"],"id":119}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":["f"],"id":120}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":["o"],"id":121}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"insert","lines":["o"],"id":122}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"insert","lines":["t"],"id":123}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":["e"],"id":124}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"insert","lines":["r"],"id":125}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["<% include partials/header %>",""],"id":126}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":26},"action":"remove","lines":["/header"],"id":127}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":["/"],"id":128}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":["h"],"id":129}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["e"],"id":130}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"remove","lines":["e"],"id":131}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"remove","lines":["h"],"id":132}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":["n"],"id":133}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["a"],"id":134}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":["v"],"id":135}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["<% include partials/nav %>",""],"id":136}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":0},"end":{"row":5,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445147422691,"hash":"9bcb2104922efde345956b74df46ccd6c3075a58"} \ No newline at end of file diff --git a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/love.ejs b/.c9/metadata/workspace/MoreExpress/EJSDemo/views/love.ejs deleted file mode 100644 index c7bda0df..00000000 --- a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/love.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"love.ejs","tooltip":"/MoreExpress/EJSDemo/views/love.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["f"],"id":810}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["o"],"id":811}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"remove","lines":["o"],"id":812}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"remove","lines":["f"],"id":813}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["h"],"id":814}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["e"],"id":815}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["a"],"id":816}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["d"],"id":817}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["e"],"id":818}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["r"],"id":819}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":[" "],"id":820}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"remove","lines":[" "],"id":821}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["."],"id":822}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["e"],"id":823}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["j"],"id":824}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["s"],"id":825}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"remove","lines":["s"],"id":826}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"remove","lines":["j"],"id":827}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"remove","lines":["e"],"id":828}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"remove","lines":["."],"id":829}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"remove","lines":["r"],"id":830}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"remove","lines":["e"],"id":831}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"remove","lines":["d"],"id":832}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"remove","lines":["a"],"id":833}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"remove","lines":["e"],"id":834}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"remove","lines":["h"],"id":835}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["h"],"id":836}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["e"],"id":837}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["a"],"id":838}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["d"],"id":839}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["e"],"id":840}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["r"],"id":841}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":[" "],"id":842}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"remove","lines":[" "],"id":843}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["."],"id":844}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["e"],"id":845}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["j"],"id":846}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["s"],"id":847}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":[" "],"id":848}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"remove","lines":[" "],"id":849}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"remove","lines":["s"],"id":850}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"remove","lines":["j"],"id":851}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"remove","lines":["e"],"id":852}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"remove","lines":["."],"id":853}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":[" "],"id":854}],[{"start":{"row":9,"column":38},"end":{"row":10,"column":0},"action":"insert","lines":["",""],"id":855}],[{"start":{"row":10,"column":0},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":856}],[{"start":{"row":11,"column":0},"end":{"row":11,"column":20},"action":"insert","lines":["<% include header %>"],"id":857}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"remove","lines":["r"],"id":858}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"remove","lines":["e"],"id":859}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"remove","lines":["d"],"id":860}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"remove","lines":["a"],"id":861}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"remove","lines":["e"],"id":862}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"remove","lines":["h"],"id":863}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":["f"],"id":864}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["o"],"id":865}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":["o"],"id":866}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":["t"],"id":867}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"insert","lines":["e"],"id":868}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"insert","lines":["r"],"id":869}],[{"start":{"row":11,"column":17},"end":{"row":11,"column":18},"action":"insert","lines":[" "],"id":870}],[{"start":{"row":11,"column":17},"end":{"row":11,"column":18},"action":"remove","lines":[" "],"id":871}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["p"],"id":872}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["a"],"id":873}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["r"],"id":874}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["t"],"id":875}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["i"],"id":876}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["a"],"id":877}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["l"],"id":878}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"remove","lines":["l"],"id":879}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"remove","lines":["a"],"id":880}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"remove","lines":["i"],"id":881}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"remove","lines":["t"],"id":882}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"remove","lines":["r"],"id":883}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"remove","lines":["a"],"id":884}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"remove","lines":["p"],"id":885}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["p"],"id":886}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["a"],"id":887}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["r"],"id":888}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["t"],"id":889}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["i"],"id":890}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["a"],"id":891}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["l"],"id":892}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["s"],"id":893}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":[" "],"id":894}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"remove","lines":[" "],"id":895}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["/"],"id":896}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":["p"],"id":897}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["a"],"id":898}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":["r"],"id":899}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":["t"],"id":900}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"insert","lines":["i"],"id":901}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"insert","lines":["a"],"id":902}],[{"start":{"row":11,"column":17},"end":{"row":11,"column":18},"action":"insert","lines":["l"],"id":903}],[{"start":{"row":11,"column":18},"end":{"row":11,"column":19},"action":"insert","lines":["s"],"id":904}],[{"start":{"row":11,"column":19},"end":{"row":11,"column":20},"action":"insert","lines":[" "],"id":905}],[{"start":{"row":11,"column":19},"end":{"row":11,"column":20},"action":"remove","lines":[" "],"id":906}],[{"start":{"row":11,"column":19},"end":{"row":11,"column":20},"action":"insert","lines":["/"],"id":907}],[{"start":{"row":12,"column":2},"end":{"row":13,"column":0},"action":"remove","lines":["",""],"id":908}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":2},"action":"remove","lines":[" "],"id":909}],[{"start":{"row":11,"column":29},"end":{"row":12,"column":0},"action":"remove","lines":["",""],"id":910}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":14},"end":{"row":5,"column":14},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445147719317,"hash":"2cc8877b866643f49efeea7087d05072814deba1"} \ No newline at end of file diff --git a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/footer.ejs b/.c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/footer.ejs deleted file mode 100644 index 17e58a0b..00000000 --- a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/footer.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"footer.ejs","tooltip":"/MoreExpress/EJSDemo/views/partials/footer.ejs","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":7},"end":{"row":2,"column":7},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445142257729,"hash":"ab0ef817a2287e5d4c7e124d224c876bc0b778f7"} \ No newline at end of file diff --git a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/header.ejs b/.c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/header.ejs deleted file mode 100644 index 5db89884..00000000 --- a/.c9/metadata/workspace/MoreExpress/EJSDemo/views/partials/header.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"header.ejs","tooltip":"/MoreExpress/EJSDemo/views/partials/header.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["k"],"id":87}],[{"start":{"row":4,"column":58},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":88},{"start":{"row":5,"column":0},"end":{"row":5,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":51},"action":"insert","lines":[""],"id":89}],[{"start":{"row":5,"column":49},"end":{"row":5,"column":50},"action":"insert","lines":["a"],"id":90}],[{"start":{"row":5,"column":50},"end":{"row":5,"column":51},"action":"insert","lines":["p"],"id":91}],[{"start":{"row":5,"column":51},"end":{"row":5,"column":52},"action":"insert","lines":["p"],"id":92}],[{"start":{"row":5,"column":52},"end":{"row":5,"column":53},"action":"insert","lines":["."],"id":93}],[{"start":{"row":5,"column":53},"end":{"row":5,"column":54},"action":"insert","lines":["c"],"id":94}],[{"start":{"row":5,"column":54},"end":{"row":5,"column":55},"action":"insert","lines":["s"],"id":95}],[{"start":{"row":5,"column":55},"end":{"row":5,"column":56},"action":"insert","lines":["s"],"id":96}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"remove","lines":[" ",""],"id":97}],[{"start":{"row":4,"column":51},"end":{"row":4,"column":52},"action":"remove","lines":["p"],"id":98}],[{"start":{"row":4,"column":50},"end":{"row":4,"column":51},"action":"remove","lines":["p"],"id":99}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"remove","lines":["a"],"id":100}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"insert","lines":["m"],"id":101}],[{"start":{"row":4,"column":50},"end":{"row":4,"column":51},"action":"insert","lines":["a"],"id":102}],[{"start":{"row":4,"column":51},"end":{"row":4,"column":52},"action":"insert","lines":["i"],"id":103}],[{"start":{"row":4,"column":52},"end":{"row":4,"column":53},"action":"insert","lines":["n"],"id":104}],[{"start":{"row":5,"column":0},"end":{"row":9,"column":12},"action":"remove","lines":[" "],"id":105}],[{"start":{"row":4,"column":59},"end":{"row":5,"column":0},"action":"remove","lines":["",""],"id":106}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"insert","lines":["."],"id":107}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"remove","lines":["."],"id":110}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"insert","lines":["/"],"id":117}],[{"start":{"row":4,"column":50},"end":{"row":4,"column":54},"action":"remove","lines":["main"],"id":118}],[{"start":{"row":4,"column":50},"end":{"row":4,"column":51},"action":"insert","lines":["a"],"id":119}],[{"start":{"row":4,"column":51},"end":{"row":4,"column":52},"action":"insert","lines":["p"],"id":120}],[{"start":{"row":4,"column":52},"end":{"row":4,"column":53},"action":"insert","lines":["p"],"id":121}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"remove","lines":["/"],"id":122}],[{"start":{"row":7,"column":0},"end":{"row":7,"column":26},"action":"remove","lines":["

    FROM HEADER

    "],"id":123}],[{"start":{"row":6,"column":8},"end":{"row":7,"column":0},"action":"remove","lines":["",""],"id":124}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"insert","lines":["/"],"id":125}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"remove","lines":["/"],"id":126}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"insert","lines":["/"],"id":127}],[{"start":{"row":4,"column":50},"end":{"row":4,"column":51},"action":"insert","lines":["s"],"id":128}],[{"start":{"row":4,"column":51},"end":{"row":4,"column":52},"action":"insert","lines":["t"],"id":129}],[{"start":{"row":4,"column":52},"end":{"row":4,"column":53},"action":"insert","lines":["y"],"id":130}],[{"start":{"row":4,"column":53},"end":{"row":4,"column":54},"action":"insert","lines":["l"],"id":131}],[{"start":{"row":4,"column":54},"end":{"row":4,"column":55},"action":"insert","lines":["e"],"id":132}],[{"start":{"row":4,"column":55},"end":{"row":4,"column":56},"action":"insert","lines":[" "],"id":133}],[{"start":{"row":4,"column":55},"end":{"row":4,"column":56},"action":"remove","lines":[" "],"id":134}],[{"start":{"row":4,"column":55},"end":{"row":4,"column":56},"action":"insert","lines":["s"],"id":135}],[{"start":{"row":4,"column":56},"end":{"row":4,"column":57},"action":"insert","lines":["h"],"id":136}],[{"start":{"row":4,"column":57},"end":{"row":4,"column":58},"action":"insert","lines":["e"],"id":137}],[{"start":{"row":4,"column":58},"end":{"row":4,"column":59},"action":"insert","lines":["e"],"id":138}],[{"start":{"row":4,"column":59},"end":{"row":4,"column":60},"action":"insert","lines":["t"],"id":139}],[{"start":{"row":4,"column":60},"end":{"row":4,"column":61},"action":"insert","lines":["s"],"id":140}],[{"start":{"row":4,"column":61},"end":{"row":4,"column":62},"action":"insert","lines":[" "],"id":141}],[{"start":{"row":4,"column":61},"end":{"row":4,"column":62},"action":"remove","lines":[" "],"id":142}],[{"start":{"row":4,"column":61},"end":{"row":4,"column":62},"action":"insert","lines":["/"],"id":143}],[{"start":{"row":4,"column":62},"end":{"row":4,"column":63},"action":"insert","lines":["."],"id":144}],[{"start":{"row":4,"column":62},"end":{"row":4,"column":63},"action":"remove","lines":["."],"id":145}],[{"start":{"row":4,"column":71},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":146},{"start":{"row":5,"column":0},"end":{"row":5,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["<"],"id":147}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["s"],"id":148}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["c"],"id":149}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["r"],"id":150}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["i"],"id":151}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["p"],"id":152}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["t"],"id":153}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":154}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"remove","lines":[" "],"id":155}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":156}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["s"],"id":157}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["r"],"id":158}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["c"],"id":159}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":[" "],"id":160}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"remove","lines":[" "],"id":161}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["="],"id":162}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":18},"action":"insert","lines":["\"\""],"id":163}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["/"],"id":164}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["s"],"id":165}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":20},"action":"insert","lines":["c"],"id":166}],[{"start":{"row":5,"column":20},"end":{"row":5,"column":21},"action":"insert","lines":["r"],"id":167}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"insert","lines":["p"],"id":168}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["t"],"id":169}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"remove","lines":["t"],"id":170}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"remove","lines":["p"],"id":171}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"insert","lines":["i"],"id":172}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["t"],"id":173}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"remove","lines":["t"],"id":174}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["p"],"id":175}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["t"],"id":176}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["s"],"id":177}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":[" "],"id":178}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"remove","lines":[" "],"id":179}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":["/"],"id":180}],[{"start":{"row":5,"column":26},"end":{"row":5,"column":27},"action":"insert","lines":["m"],"id":181}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["a"],"id":182}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["i"],"id":183}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":["n"],"id":184}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"insert","lines":[" "],"id":185}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"remove","lines":[" "],"id":186}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"insert","lines":["."],"id":187}],[{"start":{"row":5,"column":31},"end":{"row":5,"column":32},"action":"insert","lines":["j"],"id":188}],[{"start":{"row":5,"column":32},"end":{"row":5,"column":33},"action":"insert","lines":["s"],"id":189}],[{"start":{"row":5,"column":33},"end":{"row":5,"column":34},"action":"insert","lines":[" "],"id":190}],[{"start":{"row":5,"column":33},"end":{"row":5,"column":34},"action":"remove","lines":[" "],"id":191}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":34},"action":"remove","lines":[" "],"id":380}],[{"start":{"row":16,"column":8},"end":{"row":16,"column":9},"action":"insert","lines":[" "],"id":381}],[{"start":{"row":16,"column":9},"end":{"row":16,"column":10},"action":"insert","lines":["s"],"id":382}],[{"start":{"row":16,"column":10},"end":{"row":16,"column":11},"action":"insert","lines":["r"],"id":383}],[{"start":{"row":16,"column":11},"end":{"row":16,"column":12},"action":"insert","lines":["c"],"id":384}],[{"start":{"row":16,"column":12},"end":{"row":16,"column":13},"action":"insert","lines":[" "],"id":385}],[{"start":{"row":16,"column":12},"end":{"row":16,"column":13},"action":"remove","lines":[" "],"id":386},{"start":{"row":16,"column":12},"end":{"row":16,"column":13},"action":"insert","lines":["="]}],[{"start":{"row":16,"column":13},"end":{"row":16,"column":15},"action":"insert","lines":["\"\""],"id":387}],[{"start":{"row":16,"column":14},"end":{"row":16,"column":15},"action":"insert","lines":["s"],"id":388}],[{"start":{"row":16,"column":15},"end":{"row":16,"column":16},"action":"insert","lines":["c"],"id":389}],[{"start":{"row":16,"column":16},"end":{"row":16,"column":17},"action":"insert","lines":["r"],"id":390}],[{"start":{"row":16,"column":17},"end":{"row":16,"column":18},"action":"insert","lines":["i"],"id":391}],[{"start":{"row":16,"column":18},"end":{"row":16,"column":19},"action":"insert","lines":["p"],"id":392}],[{"start":{"row":16,"column":19},"end":{"row":16,"column":20},"action":"insert","lines":["t"],"id":393}],[{"start":{"row":16,"column":20},"end":{"row":16,"column":21},"action":"insert","lines":["s"],"id":394}],[{"start":{"row":16,"column":21},"end":{"row":16,"column":22},"action":"insert","lines":[" "],"id":395}],[{"start":{"row":16,"column":21},"end":{"row":16,"column":22},"action":"remove","lines":[" "],"id":396}],[{"start":{"row":16,"column":21},"end":{"row":16,"column":22},"action":"insert","lines":["/"],"id":397}],[{"start":{"row":16,"column":22},"end":{"row":16,"column":23},"action":"insert","lines":["l"],"id":398}],[{"start":{"row":16,"column":23},"end":{"row":16,"column":24},"action":"insert","lines":["a"],"id":399}],[{"start":{"row":16,"column":24},"end":{"row":16,"column":25},"action":"insert","lines":["n"],"id":400}],[{"start":{"row":16,"column":25},"end":{"row":16,"column":26},"action":"insert","lines":["d"],"id":401}],[{"start":{"row":16,"column":26},"end":{"row":16,"column":27},"action":"insert","lines":["i"],"id":402}],[{"start":{"row":16,"column":26},"end":{"row":16,"column":27},"action":"remove","lines":["i"],"id":403}],[{"start":{"row":16,"column":25},"end":{"row":16,"column":26},"action":"remove","lines":["d"],"id":404}],[{"start":{"row":16,"column":24},"end":{"row":16,"column":25},"action":"remove","lines":["n"],"id":405}],[{"start":{"row":16,"column":23},"end":{"row":16,"column":24},"action":"remove","lines":["a"],"id":406}],[{"start":{"row":16,"column":22},"end":{"row":16,"column":23},"action":"remove","lines":["l"],"id":407}],[{"start":{"row":16,"column":22},"end":{"row":16,"column":23},"action":"insert","lines":["b"],"id":408}],[{"start":{"row":16,"column":23},"end":{"row":16,"column":24},"action":"insert","lines":["a"],"id":409}],[{"start":{"row":16,"column":24},"end":{"row":16,"column":25},"action":"insert","lines":["c"],"id":410}],[{"start":{"row":16,"column":25},"end":{"row":16,"column":26},"action":"insert","lines":["k"],"id":411}],[{"start":{"row":16,"column":26},"end":{"row":16,"column":27},"action":"insert","lines":["g"],"id":412}],[{"start":{"row":16,"column":27},"end":{"row":16,"column":28},"action":"insert","lines":["r"],"id":413}],[{"start":{"row":16,"column":28},"end":{"row":16,"column":29},"action":"insert","lines":["o"],"id":414}],[{"start":{"row":16,"column":29},"end":{"row":16,"column":30},"action":"insert","lines":["u"],"id":415}],[{"start":{"row":16,"column":30},"end":{"row":16,"column":31},"action":"insert","lines":["n"],"id":416}],[{"start":{"row":16,"column":31},"end":{"row":16,"column":32},"action":"insert","lines":["d"],"id":417}],[{"start":{"row":16,"column":32},"end":{"row":16,"column":33},"action":"insert","lines":[" "],"id":418}],[{"start":{"row":16,"column":32},"end":{"row":16,"column":33},"action":"remove","lines":[" "],"id":419}],[{"start":{"row":16,"column":32},"end":{"row":16,"column":33},"action":"insert","lines":["."],"id":420}],[{"start":{"row":16,"column":33},"end":{"row":16,"column":34},"action":"insert","lines":["j"],"id":421}],[{"start":{"row":16,"column":34},"end":{"row":16,"column":35},"action":"insert","lines":["s"],"id":422}],[{"start":{"row":16,"column":35},"end":{"row":16,"column":36},"action":"insert","lines":[" "],"id":423}],[{"start":{"row":16,"column":35},"end":{"row":16,"column":36},"action":"remove","lines":[" "],"id":424}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":[" "],"id":456}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["g"],"id":455}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["b"],"id":454}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["\""],"id":453}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"insert","lines":["\""],"id":452}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"insert","lines":["="],"id":451}],[{"start":{"row":3,"column":10},"end":{"row":3,"column":11},"action":"insert","lines":["s"],"id":450}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":["s"],"id":449}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":["a"],"id":448}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":8},"action":"insert","lines":["l"],"id":447}],[{"start":{"row":3,"column":6},"end":{"row":3,"column":7},"action":"insert","lines":["c"],"id":446}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"remove","lines":["u"],"id":445}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"remove","lines":["r"],"id":444}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":15},"action":"remove","lines":["l("],"id":443}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":130},"action":"insert","lines":["url(https://images.unsplash.com/photo-1444210971048-6130cf0c46cf?dpr=2&fit=crop&fm=jpg&h=825&ixlib=rb-0.3.5&q=50&w=1450"],"id":442}],[{"start":{"row":3,"column":10},"end":{"row":3,"column":12},"action":"insert","lines":["\"\""],"id":441}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":["="],"id":440}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":["c"],"id":439}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":8},"action":"insert","lines":["r"],"id":438}],[{"start":{"row":3,"column":6},"end":{"row":3,"column":7},"action":"insert","lines":["s"],"id":437}],[{"start":{"row":3,"column":5},"end":{"row":3,"column":6},"action":"insert","lines":[" "],"id":436}],[{"start":{"row":3,"column":5},"end":{"row":3,"column":6},"action":"insert","lines":[">"],"id":435}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":5},"action":"insert","lines":["g"],"id":434}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":["m"],"id":433}],[{"start":{"row":3,"column":2},"end":{"row":3,"column":3},"action":"insert","lines":["i"],"id":432}],[{"start":{"row":3,"column":1},"end":{"row":3,"column":2},"action":"insert","lines":["<"],"id":431}],[{"start":{"row":2,"column":55},"end":{"row":3,"column":0},"action":"insert","lines":["",""],"id":430},{"start":{"row":3,"column":0},"end":{"row":3,"column":1},"action":"insert","lines":["\t"]}],[{"start":{"row":12,"column":8},"end":{"row":13,"column":0},"action":"remove","lines":["",""],"id":429}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":7},"action":"remove","lines":[" "],"id":428}],[{"start":{"row":2,"column":55},"end":{"row":3,"column":0},"action":"remove","lines":["",""],"id":427}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":23},"action":"remove","lines":["
    "],"id":426}]]},"ace":{"folds":[],"scrolltop":45.5,"scrollleft":0,"selection":{"start":{"row":5,"column":26},"end":{"row":5,"column":26},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":0,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1447223132436,"hash":"65ce390b73a42b6a23aeb58f39a67f49e0fcbfc2"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/Final/views/login.ejs b/.c9/metadata/workspace/YelpCamp/Final/views/login.ejs deleted file mode 100644 index dae54343..00000000 --- a/.c9/metadata/workspace/YelpCamp/Final/views/login.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"login.ejs","tooltip":"/YelpCamp/Final/views/login.ejs","undoManager":{"mark":24,"position":24,"stack":[[{"start":{"row":0,"column":0},"end":{"row":10,"column":0},"action":"remove","lines":["<% include ./partials/header %> ","","

    Login!

    ","
    "," "," "," ","
    ","","<% include ./partials/footer %> ",""],"id":2}],[{"start":{"row":0,"column":0},"end":{"row":22,"column":0},"action":"insert","lines":["<% include ./partials/header %>","
    ","
    ","

    Sign Up

    ","
    ","
    ","
    "," ","
    ","
    "," ","
    ","
    "," ","
    ","
    "," Go Back","
    ","
    ","
    ","<% include ./partials/footer %>","",""],"id":3}],[{"start":{"row":3,"column":39},"end":{"row":3,"column":46},"action":"remove","lines":["Sign Up"],"id":4}],[{"start":{"row":3,"column":39},"end":{"row":3,"column":40},"action":"insert","lines":["L"],"id":5}],[{"start":{"row":3,"column":40},"end":{"row":3,"column":41},"action":"insert","lines":["o"],"id":6}],[{"start":{"row":3,"column":41},"end":{"row":3,"column":42},"action":"insert","lines":["g"],"id":7}],[{"start":{"row":3,"column":42},"end":{"row":3,"column":43},"action":"insert","lines":["i"],"id":8}],[{"start":{"row":3,"column":43},"end":{"row":3,"column":44},"action":"insert","lines":["n"],"id":9}],[{"start":{"row":13,"column":70},"end":{"row":13,"column":77},"action":"remove","lines":["ign Up!"],"id":10}],[{"start":{"row":13,"column":69},"end":{"row":13,"column":70},"action":"remove","lines":["S"],"id":11}],[{"start":{"row":13,"column":69},"end":{"row":13,"column":70},"action":"insert","lines":["L"],"id":12}],[{"start":{"row":13,"column":70},"end":{"row":13,"column":71},"action":"insert","lines":["o"],"id":13}],[{"start":{"row":13,"column":71},"end":{"row":13,"column":72},"action":"insert","lines":["g"],"id":14}],[{"start":{"row":13,"column":72},"end":{"row":13,"column":73},"action":"insert","lines":["i"],"id":15}],[{"start":{"row":13,"column":73},"end":{"row":13,"column":74},"action":"insert","lines":["n"],"id":16}],[{"start":{"row":5,"column":31},"end":{"row":5,"column":35},"action":"remove","lines":["ster"],"id":17}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"remove","lines":["i"],"id":18}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"remove","lines":["g"],"id":19}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"remove","lines":["e"],"id":20}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"remove","lines":["r"],"id":21}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["l"],"id":22}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["o"],"id":23}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":["g"],"id":24}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"insert","lines":["i"],"id":25}],[{"start":{"row":5,"column":31},"end":{"row":5,"column":32},"action":"insert","lines":["n"],"id":26}]]},"ace":{"folds":[],"scrolltop":45,"scrollleft":109,"selection":{"start":{"row":3,"column":15},"end":{"row":3,"column":15},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":7,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1446334566261,"hash":"8f9f77970e3154435b3da5353e77f113abc4749d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/Final/views/partials/footer.ejs b/.c9/metadata/workspace/YelpCamp/Final/views/partials/footer.ejs deleted file mode 100644 index 4aa95c0b..00000000 --- a/.c9/metadata/workspace/YelpCamp/Final/views/partials/footer.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"footer.ejs","tooltip":"/YelpCamp/Final/views/partials/footer.ejs","undoManager":{"mark":10,"position":10,"stack":[[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":2}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["<"],"id":3}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["/"],"id":4}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["d"],"id":5}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["i"],"id":6}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["v"],"id":7}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":[" "],"id":8}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"remove","lines":[" "],"id":9}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":[">"],"id":10}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":4},"action":"insert","lines":[" "],"id":11}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":8},"action":"insert","lines":[" "],"id":12}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":7},"end":{"row":2,"column":7},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":47,"mode":"ace/mode/ejs"}},"timestamp":1446340822329,"hash":"d3291f4a38a6435174fac2f2bf54c3272d5d4b7c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/Final/views/partials/header.ejs b/.c9/metadata/workspace/YelpCamp/Final/views/partials/header.ejs deleted file mode 100644 index 4d0fb91a..00000000 --- a/.c9/metadata/workspace/YelpCamp/Final/views/partials/header.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"header.ejs","tooltip":"/YelpCamp/Final/views/partials/header.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":28,"column":18},"end":{"row":28,"column":19},"action":"insert","lines":[" "],"id":216}],[{"start":{"row":28,"column":19},"end":{"row":28,"column":20},"action":"insert","lines":["&"],"id":217}],[{"start":{"row":28,"column":20},"end":{"row":28,"column":21},"action":"insert","lines":["&"],"id":218}],[{"start":{"row":28,"column":21},"end":{"row":28,"column":22},"action":"insert","lines":[" "],"id":219}],[{"start":{"row":28,"column":22},"end":{"row":28,"column":23},"action":"insert","lines":["a"],"id":220}],[{"start":{"row":28,"column":22},"end":{"row":28,"column":23},"action":"remove","lines":["a"],"id":221}],[{"start":{"row":28,"column":22},"end":{"row":28,"column":23},"action":"insert","lines":["e"],"id":222}],[{"start":{"row":28,"column":23},"end":{"row":28,"column":24},"action":"insert","lines":["r"],"id":223}],[{"start":{"row":28,"column":24},"end":{"row":28,"column":25},"action":"insert","lines":["r"],"id":224}],[{"start":{"row":28,"column":25},"end":{"row":28,"column":26},"action":"insert","lines":["o"],"id":225}],[{"start":{"row":28,"column":26},"end":{"row":28,"column":27},"action":"insert","lines":["r"],"id":226}],[{"start":{"row":28,"column":27},"end":{"row":28,"column":28},"action":"insert","lines":[" "],"id":227}],[{"start":{"row":28,"column":27},"end":{"row":28,"column":28},"action":"remove","lines":[" "],"id":228}],[{"start":{"row":28,"column":27},"end":{"row":28,"column":28},"action":"insert","lines":["."],"id":229}],[{"start":{"row":28,"column":28},"end":{"row":28,"column":29},"action":"insert","lines":["l"],"id":230}],[{"start":{"row":28,"column":29},"end":{"row":28,"column":30},"action":"insert","lines":["e"],"id":231}],[{"start":{"row":28,"column":30},"end":{"row":28,"column":31},"action":"insert","lines":["n"],"id":232}],[{"start":{"row":28,"column":31},"end":{"row":28,"column":32},"action":"insert","lines":["g"],"id":233}],[{"start":{"row":28,"column":32},"end":{"row":28,"column":33},"action":"insert","lines":["t"],"id":234}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"insert","lines":["h"],"id":235}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"insert","lines":[" "],"id":236}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"remove","lines":[" "],"id":237}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"insert","lines":[" "],"id":238}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"insert","lines":[">"],"id":239}],[{"start":{"row":28,"column":36},"end":{"row":28,"column":37},"action":"insert","lines":["0"],"id":240}],[{"start":{"row":28,"column":36},"end":{"row":28,"column":37},"action":"remove","lines":["0"],"id":241}],[{"start":{"row":28,"column":36},"end":{"row":28,"column":37},"action":"insert","lines":[" "],"id":242}],[{"start":{"row":28,"column":37},"end":{"row":28,"column":38},"action":"insert","lines":["0"],"id":243}],[{"start":{"row":32,"column":20},"end":{"row":32,"column":21},"action":"insert","lines":[" "],"id":244}],[{"start":{"row":32,"column":21},"end":{"row":32,"column":40},"action":"insert","lines":["&& error.length > 0"],"id":245}],[{"start":{"row":32,"column":24},"end":{"row":32,"column":29},"action":"remove","lines":["error"],"id":246}],[{"start":{"row":32,"column":24},"end":{"row":32,"column":25},"action":"insert","lines":["s"],"id":247}],[{"start":{"row":32,"column":25},"end":{"row":32,"column":26},"action":"insert","lines":["u"],"id":248}],[{"start":{"row":32,"column":26},"end":{"row":32,"column":27},"action":"insert","lines":["c"],"id":249}],[{"start":{"row":32,"column":27},"end":{"row":32,"column":28},"action":"insert","lines":["c"],"id":250}],[{"start":{"row":32,"column":28},"end":{"row":32,"column":29},"action":"insert","lines":["e"],"id":251}],[{"start":{"row":32,"column":29},"end":{"row":32,"column":30},"action":"insert","lines":["s"],"id":252}],[{"start":{"row":32,"column":30},"end":{"row":32,"column":31},"action":"insert","lines":["s"],"id":253}],[{"start":{"row":29,"column":45},"end":{"row":29,"column":53},"action":"remove","lines":["RROROROR"],"id":254}],[{"start":{"row":29,"column":44},"end":{"row":29,"column":45},"action":"remove","lines":["E"],"id":255}],[{"start":{"row":26,"column":10},"end":{"row":27,"column":0},"action":"insert","lines":["",""],"id":256},{"start":{"row":27,"column":0},"end":{"row":27,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":27,"column":4},"end":{"row":27,"column":27},"action":"insert","lines":["
    "],"id":257}],[{"start":{"row":28,"column":0},"end":{"row":28,"column":4},"action":"remove","lines":[" "],"id":259}],[{"start":{"row":27,"column":27},"end":{"row":28,"column":0},"action":"remove","lines":["",""],"id":260}],[{"start":{"row":26,"column":10},"end":{"row":27,"column":0},"action":"insert","lines":["",""],"id":261},{"start":{"row":27,"column":0},"end":{"row":27,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":35,"column":14},"end":{"row":36,"column":0},"action":"insert","lines":["",""],"id":262},{"start":{"row":36,"column":0},"end":{"row":36,"column":7},"action":"insert","lines":[" "]}],[{"start":{"row":36,"column":7},"end":{"row":36,"column":8},"action":"insert","lines":["<"],"id":263}],[{"start":{"row":36,"column":8},"end":{"row":36,"column":9},"action":"insert","lines":["/"],"id":264}],[{"start":{"row":36,"column":9},"end":{"row":36,"column":10},"action":"insert","lines":["d"],"id":265}],[{"start":{"row":36,"column":10},"end":{"row":36,"column":11},"action":"insert","lines":["i"],"id":266}],[{"start":{"row":36,"column":11},"end":{"row":36,"column":12},"action":"insert","lines":["v"],"id":267}],[{"start":{"row":36,"column":12},"end":{"row":36,"column":13},"action":"insert","lines":[">"],"id":268}],[{"start":{"row":36,"column":6},"end":{"row":36,"column":7},"action":"remove","lines":[" "],"id":269}],[{"start":{"row":36,"column":5},"end":{"row":36,"column":6},"action":"remove","lines":[" "],"id":270}],[{"start":{"row":36,"column":4},"end":{"row":36,"column":5},"action":"remove","lines":[" "],"id":271}],[{"start":{"row":37,"column":7},"end":{"row":37,"column":8},"action":"insert","lines":["<"],"id":272}],[{"start":{"row":37,"column":8},"end":{"row":37,"column":9},"action":"insert","lines":["d"],"id":273}],[{"start":{"row":37,"column":9},"end":{"row":37,"column":10},"action":"insert","lines":["i"],"id":274}],[{"start":{"row":37,"column":10},"end":{"row":37,"column":11},"action":"insert","lines":["v"],"id":275}],[{"start":{"row":37,"column":11},"end":{"row":37,"column":12},"action":"insert","lines":[" "],"id":276}],[{"start":{"row":37,"column":11},"end":{"row":37,"column":12},"action":"remove","lines":[" "],"id":277}],[{"start":{"row":37,"column":11},"end":{"row":37,"column":18},"action":"insert","lines":[">
    "],"id":278}],[{"start":{"row":37,"column":17},"end":{"row":37,"column":18},"action":"remove","lines":[">"],"id":279}],[{"start":{"row":37,"column":16},"end":{"row":37,"column":17},"action":"remove","lines":["v"],"id":280}],[{"start":{"row":37,"column":15},"end":{"row":37,"column":16},"action":"remove","lines":["i"],"id":281}],[{"start":{"row":37,"column":14},"end":{"row":37,"column":15},"action":"remove","lines":["d"],"id":282}],[{"start":{"row":37,"column":13},"end":{"row":37,"column":14},"action":"remove","lines":["/"],"id":283}],[{"start":{"row":37,"column":12},"end":{"row":37,"column":13},"action":"remove","lines":["<"],"id":284}],[{"start":{"row":37,"column":10},"end":{"row":37,"column":11},"action":"insert","lines":[" "],"id":285}],[{"start":{"row":37,"column":11},"end":{"row":37,"column":12},"action":"insert","lines":["c"],"id":286}],[{"start":{"row":37,"column":12},"end":{"row":37,"column":13},"action":"insert","lines":["l"],"id":287}],[{"start":{"row":37,"column":12},"end":{"row":37,"column":13},"action":"remove","lines":["l"],"id":288}],[{"start":{"row":37,"column":11},"end":{"row":37,"column":12},"action":"remove","lines":["c"],"id":289}],[{"start":{"row":37,"column":10},"end":{"row":37,"column":11},"action":"remove","lines":[" "],"id":290}],[{"start":{"row":37,"column":11},"end":{"row":37,"column":12},"action":"insert","lines":[" "],"id":291}],[{"start":{"row":37,"column":12},"end":{"row":37,"column":13},"action":"insert","lines":["c"],"id":292}],[{"start":{"row":37,"column":13},"end":{"row":37,"column":14},"action":"insert","lines":["l"],"id":293}],[{"start":{"row":37,"column":14},"end":{"row":37,"column":15},"action":"insert","lines":["a"],"id":294}],[{"start":{"row":37,"column":15},"end":{"row":37,"column":16},"action":"insert","lines":["s"],"id":295}],[{"start":{"row":37,"column":16},"end":{"row":37,"column":17},"action":"insert","lines":["s"],"id":296}],[{"start":{"row":37,"column":17},"end":{"row":37,"column":18},"action":"insert","lines":[" "],"id":297}],[{"start":{"row":37,"column":17},"end":{"row":37,"column":18},"action":"remove","lines":[" "],"id":298}],[{"start":{"row":37,"column":17},"end":{"row":37,"column":18},"action":"insert","lines":["="],"id":299}],[{"start":{"row":37,"column":18},"end":{"row":37,"column":20},"action":"insert","lines":["\"\""],"id":300}],[{"start":{"row":37,"column":19},"end":{"row":37,"column":20},"action":"insert","lines":["c"],"id":301}],[{"start":{"row":37,"column":20},"end":{"row":37,"column":21},"action":"insert","lines":["o"],"id":302}],[{"start":{"row":37,"column":21},"end":{"row":37,"column":22},"action":"insert","lines":["n"],"id":303}],[{"start":{"row":37,"column":22},"end":{"row":37,"column":23},"action":"insert","lines":["t"],"id":304}],[{"start":{"row":37,"column":23},"end":{"row":37,"column":24},"action":"insert","lines":["a"],"id":305}],[{"start":{"row":37,"column":24},"end":{"row":37,"column":25},"action":"insert","lines":["i"],"id":306}],[{"start":{"row":37,"column":25},"end":{"row":37,"column":26},"action":"insert","lines":["n"],"id":307}],[{"start":{"row":37,"column":26},"end":{"row":37,"column":27},"action":"insert","lines":["e"],"id":308}],[{"start":{"row":37,"column":27},"end":{"row":37,"column":28},"action":"insert","lines":["r"],"id":309}],[{"start":{"row":37,"column":6},"end":{"row":37,"column":7},"action":"remove","lines":[" "],"id":310}],[{"start":{"row":37,"column":5},"end":{"row":37,"column":6},"action":"remove","lines":[" "],"id":311}],[{"start":{"row":37,"column":4},"end":{"row":37,"column":5},"action":"remove","lines":[" "],"id":312}],[{"start":{"row":37,"column":0},"end":{"row":37,"column":4},"action":"remove","lines":[" "],"id":313}],[{"start":{"row":36,"column":10},"end":{"row":37,"column":0},"action":"remove","lines":["",""],"id":314}],[{"start":{"row":36,"column":10},"end":{"row":37,"column":0},"action":"insert","lines":["",""],"id":315},{"start":{"row":37,"column":0},"end":{"row":37,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":37,"column":0},"end":{"row":37,"column":4},"action":"remove","lines":[" "],"id":316}],[{"start":{"row":37,"column":0},"end":{"row":37,"column":4},"action":"insert","lines":[" "],"id":317}]]},"ace":{"folds":[],"scrolltop":285,"scrollleft":0,"selection":{"start":{"row":32,"column":7},"end":{"row":32,"column":7},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1447306055469,"hash":"783dd702a9464a5ae670991828e1ea3ff4629359"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/Final/views/register.ejs b/.c9/metadata/workspace/YelpCamp/Final/views/register.ejs deleted file mode 100644 index ff5849b6..00000000 --- a/.c9/metadata/workspace/YelpCamp/Final/views/register.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"register.ejs","tooltip":"/YelpCamp/Final/views/register.ejs","undoManager":{"mark":54,"position":54,"stack":[[{"start":{"row":9,"column":0},"end":{"row":10,"column":0},"action":"insert","lines":["",""],"id":2}],[{"start":{"row":10,"column":0},"end":{"row":35,"column":0},"action":"insert","lines":["<% include ../partials/header %>","
    ","
    ","

    Create a New Campground

    ","
    ","
    ","
    "," ","
    ","
    "," ","
    ","
    "," ","
    ","
    "," ","
    ","
    "," Go Back","
    ","
    ","
    ","<% include ../partials/footer %>","",""],"id":3}],[{"start":{"row":8,"column":32},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":4}],[{"start":{"row":3,"column":0},"end":{"row":7,"column":7},"action":"remove","lines":["
    "," "," "," ","
    "],"id":5}],[{"start":{"row":10,"column":41},"end":{"row":10,"column":61},"action":"remove","lines":["eate a New Campgroun"],"id":6}],[{"start":{"row":10,"column":40},"end":{"row":10,"column":41},"action":"remove","lines":["r"],"id":7}],[{"start":{"row":10,"column":39},"end":{"row":10,"column":40},"action":"remove","lines":["C"],"id":8}],[{"start":{"row":10,"column":39},"end":{"row":10,"column":40},"action":"insert","lines":["S"],"id":9}],[{"start":{"row":10,"column":40},"end":{"row":10,"column":41},"action":"insert","lines":["i"],"id":10}],[{"start":{"row":10,"column":41},"end":{"row":10,"column":42},"action":"insert","lines":["g"],"id":11}],[{"start":{"row":10,"column":42},"end":{"row":10,"column":43},"action":"insert","lines":["n"],"id":12}],[{"start":{"row":10,"column":43},"end":{"row":10,"column":44},"action":"insert","lines":[" "],"id":13}],[{"start":{"row":10,"column":44},"end":{"row":10,"column":45},"action":"insert","lines":["U"],"id":14}],[{"start":{"row":10,"column":45},"end":{"row":10,"column":46},"action":"insert","lines":["p"],"id":15}],[{"start":{"row":10,"column":46},"end":{"row":10,"column":47},"action":"remove","lines":["d"],"id":16}],[{"start":{"row":12,"column":54},"end":{"row":13,"column":16},"action":"insert","lines":[""," "],"id":17}],[{"start":{"row":13,"column":16},"end":{"row":17,"column":7},"action":"insert","lines":["
    "," "," "," ","
    "],"id":18}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":54},"action":"remove","lines":["
    "],"id":19}],[{"start":{"row":11,"column":52},"end":{"row":12,"column":0},"action":"remove","lines":["",""],"id":20}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":16},"action":"remove","lines":[" "],"id":21}],[{"start":{"row":12,"column":8},"end":{"row":12,"column":12},"action":"remove","lines":[" "],"id":22}],[{"start":{"row":12,"column":8},"end":{"row":12,"column":12},"action":"insert","lines":[" "],"id":23}],[{"start":{"row":18,"column":59},"end":{"row":18,"column":89},"action":"remove","lines":[" name=\"name\" placeholder=\"name"],"id":24}],[{"start":{"row":18,"column":59},"end":{"row":18,"column":60},"action":"insert","lines":[" "],"id":25}],[{"start":{"row":18,"column":59},"end":{"row":18,"column":60},"action":"remove","lines":[" "],"id":26}],[{"start":{"row":18,"column":59},"end":{"row":18,"column":60},"action":"remove","lines":["\""],"id":27}],[{"start":{"row":18,"column":59},"end":{"row":18,"column":60},"action":"insert","lines":[" "],"id":28}],[{"start":{"row":18,"column":60},"end":{"row":18,"column":98},"action":"insert","lines":["name=\"username\" placeholder=\"username\""],"id":29}],[{"start":{"row":13,"column":0},"end":{"row":14,"column":66},"action":"remove","lines":[" "," "],"id":30}],[{"start":{"row":12,"column":51},"end":{"row":13,"column":0},"action":"remove","lines":["",""],"id":31}],[{"start":{"row":19,"column":48},"end":{"row":19,"column":96},"action":"remove","lines":["type=\"text\" name=\"image\" placeholder=\"image url\""],"id":32}],[{"start":{"row":19,"column":48},"end":{"row":19,"column":102},"action":"insert","lines":["type=\"password\" name=\"password\" placeholder=\"password\""],"id":33}],[{"start":{"row":21,"column":0},"end":{"row":23,"column":22},"action":"remove","lines":["
    "," ","
    "],"id":34}],[{"start":{"row":20,"column":22},"end":{"row":21,"column":0},"action":"remove","lines":["",""],"id":35}],[{"start":{"row":22,"column":71},"end":{"row":22,"column":75},"action":"remove","lines":["bmit"],"id":36}],[{"start":{"row":22,"column":70},"end":{"row":22,"column":71},"action":"remove","lines":["u"],"id":37}],[{"start":{"row":22,"column":69},"end":{"row":22,"column":70},"action":"remove","lines":["S"],"id":38}],[{"start":{"row":22,"column":69},"end":{"row":22,"column":70},"action":"insert","lines":["S"],"id":39}],[{"start":{"row":22,"column":70},"end":{"row":22,"column":71},"action":"insert","lines":["i"],"id":40}],[{"start":{"row":22,"column":71},"end":{"row":22,"column":72},"action":"insert","lines":["g"],"id":41}],[{"start":{"row":22,"column":72},"end":{"row":22,"column":73},"action":"insert","lines":["n"],"id":42}],[{"start":{"row":22,"column":73},"end":{"row":22,"column":74},"action":"insert","lines":[" "],"id":43}],[{"start":{"row":22,"column":74},"end":{"row":22,"column":75},"action":"insert","lines":["U"],"id":44}],[{"start":{"row":22,"column":75},"end":{"row":22,"column":76},"action":"insert","lines":["p"],"id":45}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":28},"action":"remove","lines":[" "],"id":48}],[{"start":{"row":12,"column":51},"end":{"row":13,"column":0},"action":"remove","lines":["",""],"id":49}],[{"start":{"row":13,"column":0},"end":{"row":13,"column":7},"action":"remove","lines":["
    "],"id":50}],[{"start":{"row":12,"column":51},"end":{"row":13,"column":0},"action":"remove","lines":["",""],"id":51}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"remove","lines":["."],"id":52}],[{"start":{"row":27,"column":11},"end":{"row":27,"column":12},"action":"insert","lines":["."],"id":53}],[{"start":{"row":0,"column":0},"end":{"row":5,"column":0},"action":"remove","lines":["<% include ./partials/header %> ","

    Sign Up!

    ","","","<% include ./partials/footer %> ",""],"id":54}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":55}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":56}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"remove","lines":["."],"id":58}],[{"start":{"row":20,"column":11},"end":{"row":20,"column":12},"action":"remove","lines":["."],"id":59}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":9,"column":40},"end":{"row":9,"column":40},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":7,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1446334446448,"hash":"d42731db3a47b7513fc145235e14961b51b66d03"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/app.js b/.c9/metadata/workspace/YelpCamp/v1/app.js deleted file mode 100644 index e972ce5a..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v1/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":25,"column":12},"end":{"row":25,"column":13},"action":"insert","lines":["a"],"id":1468}],[{"start":{"row":25,"column":13},"end":{"row":25,"column":14},"action":"insert","lines":["m"],"id":1469}],[{"start":{"row":25,"column":14},"end":{"row":25,"column":15},"action":"insert","lines":["p"],"id":1470}],[{"start":{"row":25,"column":15},"end":{"row":25,"column":16},"action":"insert","lines":["g"],"id":1471}],[{"start":{"row":25,"column":16},"end":{"row":25,"column":17},"action":"insert","lines":["r"],"id":1472}],[{"start":{"row":25,"column":17},"end":{"row":25,"column":18},"action":"insert","lines":["o"],"id":1473}],[{"start":{"row":25,"column":18},"end":{"row":25,"column":19},"action":"insert","lines":["u"],"id":1474}],[{"start":{"row":25,"column":19},"end":{"row":25,"column":20},"action":"insert","lines":["n"],"id":1475}],[{"start":{"row":25,"column":20},"end":{"row":25,"column":21},"action":"insert","lines":["d"],"id":1476}],[{"start":{"row":25,"column":21},"end":{"row":25,"column":22},"action":"insert","lines":[" "],"id":1477}],[{"start":{"row":25,"column":21},"end":{"row":25,"column":22},"action":"remove","lines":[" "],"id":1478}],[{"start":{"row":25,"column":21},"end":{"row":25,"column":22},"action":"insert","lines":[" "],"id":1479}],[{"start":{"row":25,"column":22},"end":{"row":25,"column":23},"action":"insert","lines":["="],"id":1480}],[{"start":{"row":25,"column":23},"end":{"row":25,"column":24},"action":"insert","lines":[" "],"id":1481}],[{"start":{"row":25,"column":24},"end":{"row":25,"column":25},"action":"insert","lines":["{"],"id":1482}],[{"start":{"row":25,"column":25},"end":{"row":25,"column":26},"action":"insert","lines":["}"],"id":1483}],[{"start":{"row":25,"column":25},"end":{"row":25,"column":26},"action":"insert","lines":["n"],"id":1484}],[{"start":{"row":25,"column":26},"end":{"row":25,"column":27},"action":"insert","lines":["a"],"id":1485}],[{"start":{"row":25,"column":27},"end":{"row":25,"column":28},"action":"insert","lines":["m"],"id":1486}],[{"start":{"row":25,"column":28},"end":{"row":25,"column":29},"action":"insert","lines":["e"],"id":1487}],[{"start":{"row":25,"column":29},"end":{"row":25,"column":30},"action":"insert","lines":[" "],"id":1488}],[{"start":{"row":25,"column":29},"end":{"row":25,"column":30},"action":"remove","lines":[" "],"id":1489}],[{"start":{"row":25,"column":29},"end":{"row":25,"column":30},"action":"insert","lines":[":"],"id":1490}],[{"start":{"row":25,"column":30},"end":{"row":25,"column":31},"action":"insert","lines":[" "],"id":1491}],[{"start":{"row":25,"column":31},"end":{"row":25,"column":32},"action":"insert","lines":["n"],"id":1492}],[{"start":{"row":25,"column":32},"end":{"row":25,"column":33},"action":"insert","lines":["a"],"id":1493}],[{"start":{"row":25,"column":33},"end":{"row":25,"column":34},"action":"insert","lines":["m"],"id":1494}],[{"start":{"row":25,"column":34},"end":{"row":25,"column":35},"action":"insert","lines":["e"],"id":1495}],[{"start":{"row":25,"column":35},"end":{"row":25,"column":36},"action":"insert","lines":[" "],"id":1496}],[{"start":{"row":25,"column":35},"end":{"row":25,"column":36},"action":"remove","lines":[" "],"id":1497}],[{"start":{"row":25,"column":35},"end":{"row":25,"column":36},"action":"insert","lines":[","],"id":1498}],[{"start":{"row":25,"column":36},"end":{"row":25,"column":37},"action":"insert","lines":[" "],"id":1499}],[{"start":{"row":25,"column":37},"end":{"row":25,"column":38},"action":"insert","lines":["i"],"id":1500}],[{"start":{"row":25,"column":38},"end":{"row":25,"column":39},"action":"insert","lines":["m"],"id":1501}],[{"start":{"row":25,"column":39},"end":{"row":25,"column":40},"action":"insert","lines":["a"],"id":1502}],[{"start":{"row":25,"column":40},"end":{"row":25,"column":41},"action":"insert","lines":["g"],"id":1503}],[{"start":{"row":25,"column":41},"end":{"row":25,"column":42},"action":"insert","lines":["e"],"id":1504}],[{"start":{"row":25,"column":42},"end":{"row":25,"column":43},"action":"insert","lines":[" "],"id":1505}],[{"start":{"row":25,"column":42},"end":{"row":25,"column":43},"action":"remove","lines":[" "],"id":1506}],[{"start":{"row":25,"column":42},"end":{"row":25,"column":43},"action":"insert","lines":[":"],"id":1507}],[{"start":{"row":25,"column":43},"end":{"row":25,"column":44},"action":"insert","lines":[" "],"id":1508}],[{"start":{"row":25,"column":44},"end":{"row":25,"column":45},"action":"insert","lines":["i"],"id":1509}],[{"start":{"row":25,"column":45},"end":{"row":25,"column":46},"action":"insert","lines":["m"],"id":1510}],[{"start":{"row":25,"column":46},"end":{"row":25,"column":47},"action":"insert","lines":["a"],"id":1511}],[{"start":{"row":25,"column":47},"end":{"row":25,"column":48},"action":"insert","lines":["g"],"id":1512}],[{"start":{"row":25,"column":48},"end":{"row":25,"column":49},"action":"insert","lines":["e"],"id":1513}],[{"start":{"row":25,"column":49},"end":{"row":25,"column":50},"action":"insert","lines":[" "],"id":1514}],[{"start":{"row":25,"column":49},"end":{"row":25,"column":50},"action":"remove","lines":[" "],"id":1515}],[{"start":{"row":26,"column":21},"end":{"row":26,"column":22},"action":"insert","lines":["n"],"id":1516}],[{"start":{"row":26,"column":22},"end":{"row":26,"column":23},"action":"insert","lines":["e"],"id":1517}],[{"start":{"row":26,"column":23},"end":{"row":26,"column":24},"action":"insert","lines":["w"],"id":1518}],[{"start":{"row":26,"column":21},"end":{"row":26,"column":24},"action":"remove","lines":["new"],"id":1519},{"start":{"row":26,"column":21},"end":{"row":26,"column":34},"action":"insert","lines":["newCampground"]}],[{"start":{"row":26,"column":35},"end":{"row":26,"column":36},"action":"insert","lines":[";"],"id":1520}],[{"start":{"row":27,"column":39},"end":{"row":28,"column":0},"action":"insert","lines":["",""],"id":1521},{"start":{"row":28,"column":0},"end":{"row":28,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":28,"column":4},"end":{"row":28,"column":5},"action":"insert","lines":["r"],"id":1522}],[{"start":{"row":28,"column":5},"end":{"row":28,"column":6},"action":"insert","lines":["e"],"id":1523}],[{"start":{"row":28,"column":6},"end":{"row":28,"column":7},"action":"insert","lines":["s"],"id":1524}],[{"start":{"row":28,"column":7},"end":{"row":28,"column":8},"action":"insert","lines":[" "],"id":1525}],[{"start":{"row":28,"column":7},"end":{"row":28,"column":8},"action":"remove","lines":[" "],"id":1526}],[{"start":{"row":28,"column":7},"end":{"row":28,"column":8},"action":"insert","lines":["."],"id":1527}],[{"start":{"row":28,"column":8},"end":{"row":28,"column":9},"action":"insert","lines":["r"],"id":1528}],[{"start":{"row":28,"column":9},"end":{"row":28,"column":10},"action":"insert","lines":["e"],"id":1529}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"insert","lines":["s"],"id":1530}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"remove","lines":["s"],"id":1531}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"insert","lines":["d"],"id":1532}],[{"start":{"row":28,"column":11},"end":{"row":28,"column":12},"action":"insert","lines":["i"],"id":1533}],[{"start":{"row":28,"column":12},"end":{"row":28,"column":13},"action":"insert","lines":["r"],"id":1534},{"start":{"row":28,"column":13},"end":{"row":28,"column":14},"action":"insert","lines":["e"]}],[{"start":{"row":28,"column":14},"end":{"row":28,"column":15},"action":"insert","lines":["c"],"id":1535}],[{"start":{"row":28,"column":15},"end":{"row":28,"column":16},"action":"insert","lines":["t"],"id":1536}],[{"start":{"row":28,"column":16},"end":{"row":28,"column":17},"action":"insert","lines":[" "],"id":1537}],[{"start":{"row":28,"column":16},"end":{"row":28,"column":17},"action":"remove","lines":[" "],"id":1538}],[{"start":{"row":28,"column":16},"end":{"row":28,"column":18},"action":"insert","lines":["()"],"id":1539}],[{"start":{"row":28,"column":17},"end":{"row":28,"column":19},"action":"insert","lines":["\"\""],"id":1540}],[{"start":{"row":28,"column":18},"end":{"row":28,"column":19},"action":"insert","lines":["."],"id":1541},{"start":{"row":28,"column":19},"end":{"row":28,"column":20},"action":"insert","lines":["/"]}],[{"start":{"row":28,"column":19},"end":{"row":28,"column":20},"action":"remove","lines":["/"],"id":1542}],[{"start":{"row":28,"column":18},"end":{"row":28,"column":19},"action":"remove","lines":["."],"id":1543}],[{"start":{"row":28,"column":18},"end":{"row":28,"column":19},"action":"insert","lines":["/"],"id":1544}],[{"start":{"row":28,"column":19},"end":{"row":28,"column":20},"action":"insert","lines":["c"],"id":1545}],[{"start":{"row":28,"column":20},"end":{"row":28,"column":21},"action":"insert","lines":["a"],"id":1546}],[{"start":{"row":28,"column":21},"end":{"row":28,"column":22},"action":"insert","lines":["m"],"id":1547}],[{"start":{"row":28,"column":22},"end":{"row":28,"column":23},"action":"insert","lines":["p"],"id":1548}],[{"start":{"row":28,"column":23},"end":{"row":28,"column":24},"action":"insert","lines":["g"],"id":1549}],[{"start":{"row":28,"column":24},"end":{"row":28,"column":25},"action":"insert","lines":["r"],"id":1550}],[{"start":{"row":28,"column":25},"end":{"row":28,"column":26},"action":"insert","lines":["o"],"id":1551}],[{"start":{"row":28,"column":26},"end":{"row":28,"column":27},"action":"insert","lines":["u"],"id":1552}],[{"start":{"row":28,"column":27},"end":{"row":28,"column":28},"action":"insert","lines":["n"],"id":1553}],[{"start":{"row":28,"column":28},"end":{"row":28,"column":29},"action":"insert","lines":["d"],"id":1554}],[{"start":{"row":28,"column":29},"end":{"row":28,"column":30},"action":"insert","lines":["s"],"id":1555}],[{"start":{"row":28,"column":30},"end":{"row":28,"column":31},"action":"insert","lines":[" "],"id":1556}],[{"start":{"row":28,"column":30},"end":{"row":28,"column":31},"action":"remove","lines":[" "],"id":1557}],[{"start":{"row":28,"column":32},"end":{"row":28,"column":33},"action":"insert","lines":[";"],"id":1558}],[{"start":{"row":11,"column":0},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":1560}],[{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"insert","lines":[" "],"id":1561}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":8},"action":"insert","lines":[" "],"id":1562}],[{"start":{"row":11,"column":8},"end":{"row":13,"column":110},"action":"insert","lines":["{name: \"Salmon Creek\", image: \"https://farm9.staticflickr.com/8442/7962474612_bf2baf67c0.jpg\"},"," {name: \"Granite Hill\", image: \"https://farm1.staticflickr.com/60/215827008_6489cd30c3.jpg\"},"," {name: \"Mountain Goat's Rest\", image: \"https://farm7.staticflickr.com/6057/6234565071_4d20668bbd.jpg\"}"],"id":1563}],[{"start":{"row":14,"column":0},"end":{"row":15,"column":0},"action":"insert","lines":["",""],"id":1564}],[{"start":{"row":14,"column":0},"end":{"row":14,"column":4},"action":"insert","lines":[" "],"id":1565}],[{"start":{"row":14,"column":4},"end":{"row":14,"column":8},"action":"insert","lines":[" "],"id":1566}],[{"start":{"row":14,"column":8},"end":{"row":16,"column":110},"action":"insert","lines":["{name: \"Salmon Creek\", image: \"https://farm9.staticflickr.com/8442/7962474612_bf2baf67c0.jpg\"},"," {name: \"Granite Hill\", image: \"https://farm1.staticflickr.com/60/215827008_6489cd30c3.jpg\"},"," {name: \"Mountain Goat's Rest\", image: \"https://farm7.staticflickr.com/6057/6234565071_4d20668bbd.jpg\"}"],"id":1567}],[{"start":{"row":10,"column":110},"end":{"row":10,"column":111},"action":"insert","lines":[","],"id":1568}],[{"start":{"row":13,"column":110},"end":{"row":13,"column":111},"action":"insert","lines":[","],"id":1569}]]},"ace":{"folds":[],"scrolltop":438,"scrollleft":0,"selection":{"start":{"row":25,"column":0},"end":{"row":25,"column":3},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":15,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445214043000,"hash":"608643a7adb1246641cc119eb87a35e9fb2f4cc9"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/package.json b/.c9/metadata/workspace/YelpCamp/v1/package.json deleted file mode 100644 index 0304b2db..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/YelpCamp/v1/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":120,"scrollleft":0,"selection":{"start":{"row":12,"column":10},"end":{"row":12,"column":10},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":3,"state":"start","mode":"ace/mode/json"}},"timestamp":1445200984406,"hash":"2502146a813c077735d793f20c521c687f90a872"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/readme.md b/.c9/metadata/workspace/YelpCamp/v1/readme.md deleted file mode 100644 index e3f6958d..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v1/readme.md","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":296.5,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":10,"state":"start","mode":"ace/mode/markdown"}},"timestamp":1445309916466,"hash":"dbeb9bdfb617943a12b5b1d55accfabc09633112"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/views/campgrounds.ejs b/.c9/metadata/workspace/YelpCamp/v1/views/campgrounds.ejs deleted file mode 100644 index 6eeb22e7..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/views/campgrounds.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campgrounds.ejs","tooltip":"/YelpCamp/v1/views/campgrounds.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":8,"column":43},"end":{"row":8,"column":44},"action":"insert","lines":["r"],"id":1613}],[{"start":{"row":8,"column":44},"end":{"row":8,"column":45},"action":"insert","lines":["-"],"id":1614}],[{"start":{"row":8,"column":45},"end":{"row":8,"column":46},"action":"insert","lines":["r"],"id":1615}],[{"start":{"row":8,"column":46},"end":{"row":8,"column":47},"action":"insert","lines":["i"],"id":1616}],[{"start":{"row":8,"column":47},"end":{"row":8,"column":48},"action":"insert","lines":["g"],"id":1617}],[{"start":{"row":8,"column":48},"end":{"row":8,"column":49},"action":"insert","lines":["h"],"id":1618}],[{"start":{"row":8,"column":49},"end":{"row":8,"column":50},"action":"insert","lines":["t"],"id":1619}],[{"start":{"row":8,"column":50},"end":{"row":8,"column":51},"action":"insert","lines":[" "],"id":1620}],[{"start":{"row":8,"column":50},"end":{"row":8,"column":51},"action":"remove","lines":[" "],"id":1621}],[{"start":{"row":9,"column":20},"end":{"row":9,"column":21},"action":"insert","lines":["<"],"id":1622}],[{"start":{"row":9,"column":21},"end":{"row":9,"column":22},"action":"insert","lines":["l"],"id":1623}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":["i"],"id":1624}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["L"],"id":1625}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"remove","lines":["L"],"id":1626}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":29},"action":"insert","lines":[">"],"id":1627}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"insert","lines":["<"],"id":1628}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"insert","lines":["a"],"id":1629}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":31},"action":"insert","lines":[">"],"id":1630}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"insert","lines":["L"],"id":1631}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":["o"],"id":1632}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":["g"],"id":1633}],[{"start":{"row":9,"column":30},"end":{"row":9,"column":31},"action":"insert","lines":["i"],"id":1634}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"insert","lines":["n"],"id":1635}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"insert","lines":[" "],"id":1636}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"remove","lines":[" "],"id":1637}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"insert","lines":[" "],"id":1638}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"insert","lines":["c"],"id":1639}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":["l"],"id":1640}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":["a"],"id":1641}],[{"start":{"row":9,"column":30},"end":{"row":9,"column":31},"action":"insert","lines":["s"],"id":1642}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"insert","lines":["s"],"id":1643}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"insert","lines":[" "],"id":1644}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":33},"action":"remove","lines":[" "],"id":1645}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"remove","lines":["s"],"id":1646}],[{"start":{"row":9,"column":30},"end":{"row":9,"column":31},"action":"remove","lines":["s"],"id":1647}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"remove","lines":["a"],"id":1648}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"remove","lines":["l"],"id":1649}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"remove","lines":["c"],"id":1650}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"remove","lines":[" "],"id":1651}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"insert","lines":[" "],"id":1652}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"insert","lines":["h"],"id":1653}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":["r"],"id":1654}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":["e"],"id":1655}],[{"start":{"row":9,"column":30},"end":{"row":9,"column":31},"action":"insert","lines":["f"],"id":1656}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"insert","lines":[" "],"id":1657}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"remove","lines":[" "],"id":1658}],[{"start":{"row":9,"column":31},"end":{"row":9,"column":32},"action":"insert","lines":["="],"id":1659}],[{"start":{"row":9,"column":32},"end":{"row":9,"column":34},"action":"insert","lines":["\"\""],"id":1660}],[{"start":{"row":9,"column":33},"end":{"row":9,"column":34},"action":"insert","lines":["/"],"id":1661}],[{"start":{"row":10,"column":0},"end":{"row":11,"column":0},"action":"insert","lines":["
  • Login
  • ",""],"id":1662}],[{"start":{"row":10,"column":0},"end":{"row":11,"column":0},"action":"insert","lines":["
  • Login
  • ",""],"id":1663}],[{"start":{"row":10,"column":40},"end":{"row":10,"column":41},"action":"remove","lines":["n"],"id":1664}],[{"start":{"row":10,"column":39},"end":{"row":10,"column":40},"action":"remove","lines":["i"],"id":1665}],[{"start":{"row":10,"column":38},"end":{"row":10,"column":39},"action":"remove","lines":["g"],"id":1666}],[{"start":{"row":10,"column":37},"end":{"row":10,"column":38},"action":"remove","lines":["o"],"id":1667}],[{"start":{"row":10,"column":36},"end":{"row":10,"column":37},"action":"remove","lines":["L"],"id":1668}],[{"start":{"row":10,"column":36},"end":{"row":10,"column":37},"action":"insert","lines":["R"],"id":1669}],[{"start":{"row":10,"column":37},"end":{"row":10,"column":38},"action":"insert","lines":["e"],"id":1670}],[{"start":{"row":10,"column":38},"end":{"row":10,"column":39},"action":"insert","lines":["g"],"id":1671}],[{"start":{"row":10,"column":39},"end":{"row":10,"column":40},"action":"insert","lines":["i"],"id":1672}],[{"start":{"row":10,"column":39},"end":{"row":10,"column":40},"action":"remove","lines":["i"],"id":1673}],[{"start":{"row":10,"column":38},"end":{"row":10,"column":39},"action":"remove","lines":["g"],"id":1674}],[{"start":{"row":10,"column":37},"end":{"row":10,"column":38},"action":"remove","lines":["e"],"id":1675}],[{"start":{"row":10,"column":36},"end":{"row":10,"column":37},"action":"remove","lines":["R"],"id":1676}],[{"start":{"row":10,"column":36},"end":{"row":10,"column":37},"action":"insert","lines":["S"],"id":1677}],[{"start":{"row":10,"column":37},"end":{"row":10,"column":38},"action":"insert","lines":["i"],"id":1678}],[{"start":{"row":10,"column":38},"end":{"row":10,"column":39},"action":"insert","lines":["g"],"id":1679}],[{"start":{"row":10,"column":39},"end":{"row":10,"column":40},"action":"insert","lines":["n"],"id":1680}],[{"start":{"row":10,"column":40},"end":{"row":10,"column":41},"action":"insert","lines":[" "],"id":1681}],[{"start":{"row":10,"column":41},"end":{"row":10,"column":42},"action":"insert","lines":["U"],"id":1682}],[{"start":{"row":10,"column":42},"end":{"row":10,"column":43},"action":"insert","lines":["p"],"id":1683}],[{"start":{"row":10,"column":43},"end":{"row":10,"column":44},"action":"insert","lines":[" "],"id":1684}],[{"start":{"row":10,"column":43},"end":{"row":10,"column":44},"action":"remove","lines":[" "],"id":1685}],[{"start":{"row":11,"column":40},"end":{"row":11,"column":41},"action":"remove","lines":["n"],"id":1686}],[{"start":{"row":11,"column":39},"end":{"row":11,"column":40},"action":"remove","lines":["i"],"id":1687}],[{"start":{"row":11,"column":38},"end":{"row":11,"column":39},"action":"remove","lines":["g"],"id":1688}],[{"start":{"row":11,"column":37},"end":{"row":11,"column":38},"action":"remove","lines":["o"],"id":1689}],[{"start":{"row":11,"column":36},"end":{"row":11,"column":37},"action":"remove","lines":["L"],"id":1690}],[{"start":{"row":11,"column":36},"end":{"row":11,"column":37},"action":"insert","lines":["L"],"id":1691}],[{"start":{"row":11,"column":37},"end":{"row":11,"column":38},"action":"insert","lines":["o"],"id":1692}],[{"start":{"row":11,"column":38},"end":{"row":11,"column":39},"action":"insert","lines":["g"],"id":1693}],[{"start":{"row":11,"column":39},"end":{"row":11,"column":40},"action":"insert","lines":["o"],"id":1694}],[{"start":{"row":11,"column":40},"end":{"row":11,"column":41},"action":"insert","lines":["u"],"id":1695}],[{"start":{"row":11,"column":41},"end":{"row":11,"column":42},"action":"insert","lines":["t"],"id":1696}],[{"start":{"row":11,"column":42},"end":{"row":11,"column":43},"action":"insert","lines":[" "],"id":1697}],[{"start":{"row":11,"column":42},"end":{"row":11,"column":43},"action":"remove","lines":[" "],"id":1698}],[{"start":{"row":8,"column":27},"end":{"row":8,"column":28},"action":"insert","lines":["n"],"id":1699}],[{"start":{"row":8,"column":28},"end":{"row":8,"column":29},"action":"insert","lines":["a"],"id":1700}],[{"start":{"row":8,"column":28},"end":{"row":8,"column":29},"action":"remove","lines":["a"],"id":1703}],[{"start":{"row":8,"column":27},"end":{"row":8,"column":28},"action":"remove","lines":["n"],"id":1704}],[{"start":{"row":8,"column":27},"end":{"row":8,"column":28},"action":"insert","lines":["n"],"id":1705}],[{"start":{"row":8,"column":28},"end":{"row":8,"column":29},"action":"insert","lines":["a"],"id":1706}],[{"start":{"row":8,"column":29},"end":{"row":8,"column":30},"action":"insert","lines":["v"],"id":1707}],[{"start":{"row":8,"column":30},"end":{"row":8,"column":31},"action":"insert","lines":[" "],"id":1708}],[{"start":{"row":2,"column":0},"end":{"row":15,"column":10},"action":"remove","lines":[" "],"id":1709}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"remove","lines":["",""],"id":1710}],[{"start":{"row":2,"column":0},"end":{"row":3,"column":0},"action":"remove","lines":["",""],"id":1711}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":1712}],[{"start":{"row":0,"column":29},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":1713}],[{"start":{"row":0,"column":29},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":1714}],[{"start":{"row":0,"column":29},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":1715}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":29},"end":{"row":0,"column":29},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445215252269,"hash":"1483181d798605b09ea8a53b254622beadabc554"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/views/landing.ejs b/.c9/metadata/workspace/YelpCamp/v1/views/landing.ejs deleted file mode 100644 index aad3ca4b..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/views/landing.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"landing.ejs","tooltip":"/YelpCamp/v1/views/landing.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":9},"end":{"row":4,"column":10},"action":"insert","lines":["/"],"id":64}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":["c"],"id":65}],[{"start":{"row":4,"column":11},"end":{"row":4,"column":12},"action":"insert","lines":["a"],"id":66}],[{"start":{"row":4,"column":12},"end":{"row":4,"column":13},"action":"insert","lines":["m"],"id":67}],[{"start":{"row":4,"column":13},"end":{"row":4,"column":14},"action":"insert","lines":["p"],"id":68}],[{"start":{"row":4,"column":14},"end":{"row":4,"column":15},"action":"insert","lines":["g"],"id":69}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":["r"],"id":70}],[{"start":{"row":4,"column":16},"end":{"row":4,"column":17},"action":"insert","lines":["o"],"id":71}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":["u"],"id":72}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"insert","lines":["n"],"id":73}],[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"insert","lines":["d"],"id":74}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":["s"],"id":75}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":[" "],"id":76}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"remove","lines":[" "],"id":77}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"insert","lines":["V"],"id":78}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":["i"],"id":79}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"insert","lines":["e"],"id":80}],[{"start":{"row":4,"column":26},"end":{"row":4,"column":27},"action":"insert","lines":["w"],"id":81}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":[" "],"id":82}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"remove","lines":[" "],"id":83}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":[" "],"id":84}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"insert","lines":["A"],"id":85}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":["l"],"id":86}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":["l"],"id":87}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"insert","lines":[" "],"id":88}],[{"start":{"row":4,"column":32},"end":{"row":4,"column":33},"action":"insert","lines":["C"],"id":89}],[{"start":{"row":4,"column":33},"end":{"row":4,"column":34},"action":"insert","lines":["a"],"id":90}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":["m"],"id":91}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"insert","lines":["p"],"id":92}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"insert","lines":["g"],"id":93}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":["r"],"id":94}],[{"start":{"row":4,"column":38},"end":{"row":4,"column":39},"action":"insert","lines":["o"],"id":95}],[{"start":{"row":4,"column":39},"end":{"row":4,"column":40},"action":"insert","lines":["u"],"id":96}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":["n"],"id":97}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"insert","lines":["d"],"id":98}],[{"start":{"row":4,"column":42},"end":{"row":4,"column":43},"action":"insert","lines":["s"],"id":99}],[{"start":{"row":4,"column":43},"end":{"row":4,"column":44},"action":"insert","lines":[" "],"id":100}],[{"start":{"row":4,"column":43},"end":{"row":4,"column":44},"action":"remove","lines":[" "],"id":101}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":102}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":103}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":104}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["<"],"id":105}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["$"],"id":106}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"remove","lines":["$"],"id":107}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":[" "],"id":108}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"remove","lines":[" "],"id":109}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["%"],"id":110}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":[" "],"id":111}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["%"],"id":112}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":[">"],"id":113}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":[" "],"id":114}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["i"],"id":115}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["n"],"id":116}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["c"],"id":117}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["l"],"id":118}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["u"],"id":119}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["d"],"id":120}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["e"],"id":121}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":[" "],"id":122}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"remove","lines":[" "],"id":123}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":[" "],"id":124}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["/"],"id":125}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["p"],"id":126}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["a"],"id":127}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":["r"],"id":128}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["t"],"id":129}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":["i"],"id":130}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["a"],"id":131}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["l"],"id":132}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["s"],"id":133}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":[" "],"id":134}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"remove","lines":[" "],"id":135}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["/"],"id":136}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["h"],"id":137}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":["e"],"id":138}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["a"],"id":139}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":["d"],"id":140}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"insert","lines":["e"],"id":141}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":["r"],"id":142}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":[" "],"id":143}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"remove","lines":[" "],"id":144}],[{"start":{"row":5,"column":47},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":145}],[{"start":{"row":6,"column":0},"end":{"row":6,"column":30},"action":"insert","lines":["<% include /partials/header %>"],"id":146}],[{"start":{"row":6,"column":24},"end":{"row":6,"column":27},"action":"remove","lines":["der"],"id":147}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"remove","lines":["a"],"id":148}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"remove","lines":["e"],"id":149}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"remove","lines":["h"],"id":150}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"insert","lines":["f"],"id":151}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"insert","lines":["o"],"id":152}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"insert","lines":["o"],"id":153}],[{"start":{"row":6,"column":24},"end":{"row":6,"column":25},"action":"insert","lines":["t"],"id":154}],[{"start":{"row":6,"column":25},"end":{"row":6,"column":26},"action":"insert","lines":["e"],"id":155}],[{"start":{"row":6,"column":26},"end":{"row":6,"column":27},"action":"insert","lines":["r"],"id":156}],[{"start":{"row":5,"column":47},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":157}],[{"start":{"row":0,"column":30},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":158}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"remove","lines":[" "],"id":159}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"remove","lines":["/"],"id":160}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":[" "],"id":161}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"remove","lines":["/"],"id":162}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"insert","lines":[" "],"id":163}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"remove","lines":[" "],"id":164}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":21},"end":{"row":8,"column":21},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445202705000,"hash":"9892c547daaba2e3b2004bfb00c648761d1d340d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/views/new.ejs b/.c9/metadata/workspace/YelpCamp/v1/views/new.ejs deleted file mode 100644 index 7095102e..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/views/new.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"new.ejs","tooltip":"/YelpCamp/v1/views/new.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":9,"column":40},"end":{"row":10,"column":0},"action":"remove","lines":["",""],"id":898}],[{"start":{"row":10,"column":16},"end":{"row":10,"column":20},"action":"insert","lines":[" "],"id":899}],[{"start":{"row":11,"column":16},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":900},{"start":{"row":12,"column":0},"end":{"row":12,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":11,"column":16},"end":{"row":12,"column":0},"action":"insert","lines":["
    ",""],"id":901}],[{"start":{"row":11,"column":28},"end":{"row":11,"column":32},"action":"remove","lines":[" "],"id":902}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":28},"action":"remove","lines":[" "],"id":903}],[{"start":{"row":11,"column":20},"end":{"row":11,"column":24},"action":"remove","lines":[" "],"id":904}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":20},"action":"remove","lines":[" "],"id":905}],[{"start":{"row":11,"column":40},"end":{"row":12,"column":0},"action":"remove","lines":["",""],"id":906}],[{"start":{"row":11,"column":16},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":907},{"start":{"row":12,"column":0},"end":{"row":12,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"insert","lines":["<"],"id":908}],[{"start":{"row":11,"column":17},"end":{"row":11,"column":18},"action":"insert","lines":["/"],"id":909}],[{"start":{"row":11,"column":18},"end":{"row":11,"column":19},"action":"insert","lines":["d"],"id":910}],[{"start":{"row":11,"column":19},"end":{"row":11,"column":20},"action":"insert","lines":["i"],"id":911}],[{"start":{"row":11,"column":20},"end":{"row":11,"column":21},"action":"insert","lines":["v"],"id":912}],[{"start":{"row":11,"column":21},"end":{"row":11,"column":22},"action":"insert","lines":[" "],"id":913}],[{"start":{"row":11,"column":21},"end":{"row":11,"column":22},"action":"remove","lines":[" "],"id":914}],[{"start":{"row":11,"column":21},"end":{"row":11,"column":22},"action":"insert","lines":[">"],"id":915}],[{"start":{"row":13,"column":81},"end":{"row":14,"column":0},"action":"insert","lines":["",""],"id":916},{"start":{"row":14,"column":0},"end":{"row":14,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":14,"column":16},"end":{"row":14,"column":22},"action":"insert","lines":["
    "],"id":917}],[{"start":{"row":13,"column":16},"end":{"row":13,"column":20},"action":"insert","lines":[" "],"id":918}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"insert","lines":[" "],"id":919}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"insert","lines":["s"],"id":920}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["t"],"id":921}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["y"],"id":922}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["l"],"id":923}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["c"],"id":924}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"remove","lines":["c"],"id":925}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["e"],"id":926}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":[" "],"id":927}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"remove","lines":[" "],"id":928}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["="],"id":929}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":20},"action":"insert","lines":["\"\""],"id":930}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"insert","lines":["t"],"id":931}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"insert","lines":["e"],"id":932}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"insert","lines":["x"],"id":933}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":["t"],"id":934}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"insert","lines":["-"],"id":935}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":["a"],"id":936}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"insert","lines":["l"],"id":937}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["i"],"id":938}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["g"],"id":939}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"insert","lines":["n"],"id":940}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":[" "],"id":941}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"remove","lines":[" "],"id":942}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":[":"],"id":943}],[{"start":{"row":3,"column":30},"end":{"row":3,"column":31},"action":"insert","lines":[" "],"id":944}],[{"start":{"row":3,"column":31},"end":{"row":3,"column":32},"action":"insert","lines":["c"],"id":945}],[{"start":{"row":3,"column":32},"end":{"row":3,"column":33},"action":"insert","lines":["e"],"id":946}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":["m"],"id":947}],[{"start":{"row":3,"column":34},"end":{"row":3,"column":35},"action":"insert","lines":["t"],"id":948}],[{"start":{"row":3,"column":35},"end":{"row":3,"column":36},"action":"insert","lines":["e"],"id":949}],[{"start":{"row":3,"column":36},"end":{"row":3,"column":37},"action":"insert","lines":["r"],"id":950}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"insert","lines":[" "],"id":951}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"remove","lines":[" "],"id":952}],[{"start":{"row":3,"column":36},"end":{"row":3,"column":37},"action":"remove","lines":["r"],"id":953}],[{"start":{"row":3,"column":35},"end":{"row":3,"column":36},"action":"remove","lines":["e"],"id":954}],[{"start":{"row":3,"column":34},"end":{"row":3,"column":35},"action":"remove","lines":["t"],"id":955}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"remove","lines":["m"],"id":956}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":["n"],"id":957}],[{"start":{"row":3,"column":34},"end":{"row":3,"column":35},"action":"insert","lines":["t"],"id":958}],[{"start":{"row":3,"column":35},"end":{"row":3,"column":36},"action":"insert","lines":["e"],"id":959}],[{"start":{"row":3,"column":36},"end":{"row":3,"column":37},"action":"insert","lines":["r"],"id":1006}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"insert","lines":[";"],"id":1007}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"remove","lines":[";"],"id":1008}],[{"start":{"row":17,"column":4},"end":{"row":17,"column":8},"action":"remove","lines":[" "],"id":1009}],[{"start":{"row":17,"column":0},"end":{"row":17,"column":4},"action":"remove","lines":[" "],"id":1010}],[{"start":{"row":16,"column":14},"end":{"row":17,"column":0},"action":"remove","lines":["",""],"id":1011}],[{"start":{"row":13,"column":53},"end":{"row":13,"column":57},"action":"remove","lines":["ault"],"id":1012}],[{"start":{"row":13,"column":52},"end":{"row":13,"column":53},"action":"remove","lines":["f"],"id":1013}],[{"start":{"row":13,"column":51},"end":{"row":13,"column":52},"action":"remove","lines":["e"],"id":1014}],[{"start":{"row":13,"column":50},"end":{"row":13,"column":51},"action":"remove","lines":["d"],"id":1015}],[{"start":{"row":13,"column":50},"end":{"row":13,"column":51},"action":"insert","lines":["p"],"id":1016}],[{"start":{"row":13,"column":51},"end":{"row":13,"column":52},"action":"insert","lines":["r"],"id":1017}],[{"start":{"row":13,"column":52},"end":{"row":13,"column":53},"action":"insert","lines":["i"],"id":1018}],[{"start":{"row":13,"column":53},"end":{"row":13,"column":54},"action":"insert","lines":["m"],"id":1019}],[{"start":{"row":13,"column":54},"end":{"row":13,"column":55},"action":"insert","lines":["a"],"id":1020}],[{"start":{"row":13,"column":55},"end":{"row":13,"column":56},"action":"insert","lines":["r"],"id":1021}],[{"start":{"row":13,"column":56},"end":{"row":13,"column":57},"action":"insert","lines":["y"],"id":1022}],[{"start":{"row":13,"column":57},"end":{"row":13,"column":58},"action":"insert","lines":[" "],"id":1023}],[{"start":{"row":13,"column":57},"end":{"row":13,"column":58},"action":"remove","lines":[" "],"id":1024}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"remove","lines":[" Go Back",""],"id":1025}],[{"start":{"row":15,"column":19},"end":{"row":16,"column":0},"action":"insert","lines":["",""],"id":1026},{"start":{"row":16,"column":0},"end":{"row":16,"column":12},"action":"insert","lines":[" "]}],[{"start":{"row":16,"column":12},"end":{"row":17,"column":0},"action":"insert","lines":[" Go Back",""],"id":1027}],[{"start":{"row":16,"column":16},"end":{"row":16,"column":20},"action":"remove","lines":[" "],"id":1028}],[{"start":{"row":16,"column":12},"end":{"row":16,"column":16},"action":"remove","lines":[" "],"id":1029}],[{"start":{"row":16,"column":8},"end":{"row":16,"column":12},"action":"remove","lines":[" "],"id":1030}],[{"start":{"row":16,"column":8},"end":{"row":16,"column":12},"action":"insert","lines":[" "],"id":1031}],[{"start":{"row":16,"column":46},"end":{"row":17,"column":0},"action":"remove","lines":["",""],"id":1033}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"remove","lines":["0"],"id":1034}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":["2"],"id":1035}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"insert","lines":["0"],"id":1036}],[{"start":{"row":4,"column":42},"end":{"row":4,"column":43},"action":"insert","lines":["p"],"id":1037}],[{"start":{"row":4,"column":43},"end":{"row":4,"column":44},"action":"insert","lines":["x"],"id":1038}],[{"start":{"row":4,"column":44},"end":{"row":4,"column":45},"action":"insert","lines":[" "],"id":1039},{"start":{"row":4,"column":44},"end":{"row":4,"column":45},"action":"remove","lines":[" "]}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"remove","lines":["2"],"id":1040}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":["5"],"id":1041}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"remove","lines":["0"],"id":1042}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"remove","lines":["5"],"id":1043}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":["2"],"id":1044}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"insert","lines":["5"],"id":1045}]]},"ace":{"folds":[],"scrolltop":199.5,"scrollleft":0,"selection":{"start":{"row":5,"column":47},"end":{"row":5,"column":47},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":6,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1445217746690,"hash":"ca42780c1f613ebd78245d0a0d4cef50d306afd7"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/views/partials/footer.ejs b/.c9/metadata/workspace/YelpCamp/v1/views/partials/footer.ejs deleted file mode 100644 index 739c9dd1..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/views/partials/footer.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"footer.ejs","tooltip":"/YelpCamp/v1/views/partials/footer.ejs","undoManager":{"mark":0,"position":0,"stack":[[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"remove","lines":["

    TradeMark YelpCamp 2015

    ",""],"id":35}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":1,"column":7},"end":{"row":1,"column":7},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445217773803,"hash":"bb10c4f95b27ef87be5e39eee11dd2c13cf00ecd"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v1/views/partials/header.ejs b/.c9/metadata/workspace/YelpCamp/v1/views/partials/header.ejs deleted file mode 100644 index b0a89f86..00000000 --- a/.c9/metadata/workspace/YelpCamp/v1/views/partials/header.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"header.ejs","tooltip":"/YelpCamp/v1/views/partials/header.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"remove","lines":["y"],"id":132}],[{"start":{"row":4,"column":14},"end":{"row":4,"column":15},"action":"remove","lines":["t"],"id":133}],[{"start":{"row":4,"column":14},"end":{"row":4,"column":15},"action":"insert","lines":["r"],"id":134}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":["e"],"id":135}],[{"start":{"row":4,"column":16},"end":{"row":4,"column":17},"action":"insert","lines":["l"],"id":136}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":[" "],"id":137}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"remove","lines":[" "],"id":138}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":["="],"id":139}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"insert","lines":["\""],"id":140}],[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"insert","lines":["s"],"id":141}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":["y"],"id":142}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":["l"],"id":143}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"remove","lines":["l"],"id":144}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"remove","lines":["y"],"id":145}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":["t"],"id":146}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":["y"],"id":147}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"insert","lines":["l"],"id":148}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"insert","lines":["e"],"id":149}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":["s"],"id":150}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"insert","lines":["h"],"id":151}],[{"start":{"row":4,"column":26},"end":{"row":4,"column":27},"action":"insert","lines":["e"],"id":152}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":["e"],"id":153}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"insert","lines":["t"],"id":154}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":[" "],"id":155}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"remove","lines":[" "],"id":156}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":["\""],"id":157}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":[" "],"id":158}],[{"start":{"row":4,"column":108},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":159},{"start":{"row":5,"column":0},"end":{"row":5,"column":8},"action":"insert","lines":[" "]}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["s"],"id":160}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["t"],"id":161}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["y"],"id":162}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":["l"],"id":163}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["e"],"id":164}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":[" "],"id":165}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"remove","lines":[" "],"id":166}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["<"],"id":167}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":23},"action":"insert","lines":[">"],"id":168}],[{"start":{"row":5,"column":15},"end":{"row":7,"column":8},"action":"insert","lines":[""," "," "],"id":169}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"insert","lines":["b"],"id":171}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"insert","lines":["o"],"id":172}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":15},"action":"insert","lines":["d"],"id":173}],[{"start":{"row":6,"column":15},"end":{"row":6,"column":16},"action":"insert","lines":["y"],"id":174}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"insert","lines":[" "],"id":175}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"remove","lines":[" "],"id":176}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"insert","lines":[" "],"id":177}],[{"start":{"row":6,"column":17},"end":{"row":6,"column":18},"action":"insert","lines":["{"],"id":178}],[{"start":{"row":6,"column":18},"end":{"row":8,"column":13},"action":"insert","lines":[""," "," }"],"id":179}],[{"start":{"row":7,"column":16},"end":{"row":8,"column":0},"action":"insert","lines":[" background: url(http://c1.staticflickr.com/9/8002/7299820870_aa216b2687_k.jpg);",""],"id":180}],[{"start":{"row":7,"column":97},"end":{"row":8,"column":0},"action":"remove","lines":["",""],"id":181}],[{"start":{"row":7,"column":17},"end":{"row":7,"column":18},"action":"remove","lines":[" "],"id":182}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"remove","lines":[" "],"id":183}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":16},"action":"remove","lines":[" "],"id":184}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":12},"action":"remove","lines":[" "],"id":185}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":[" "],"id":186}],[{"start":{"row":7,"column":9},"end":{"row":7,"column":10},"action":"insert","lines":[" "],"id":187}],[{"start":{"row":7,"column":10},"end":{"row":7,"column":11},"action":"insert","lines":[" "],"id":188}],[{"start":{"row":7,"column":11},"end":{"row":7,"column":12},"action":"insert","lines":[" "],"id":189}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":190}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"insert","lines":[" "],"id":191}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"remove","lines":[" "],"id":192}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"remove","lines":[" "],"id":193}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":194}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"insert","lines":[" "],"id":195}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"remove","lines":[" "],"id":196}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"remove","lines":[" "],"id":197}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":198}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"insert","lines":[" "],"id":199}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":[" "],"id":200}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"remove","lines":[" "],"id":201}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"remove","lines":[" "],"id":202}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"remove","lines":[" "],"id":203}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":12},"action":"remove","lines":[" "],"id":204}],[{"start":{"row":7,"column":4},"end":{"row":7,"column":8},"action":"remove","lines":[" "],"id":205}],[{"start":{"row":7,"column":0},"end":{"row":7,"column":4},"action":"remove","lines":[" "],"id":206}],[{"start":{"row":6,"column":18},"end":{"row":7,"column":0},"action":"remove","lines":["",""],"id":207}],[{"start":{"row":6,"column":18},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":208},{"start":{"row":7,"column":0},"end":{"row":7,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"insert","lines":[" "],"id":209}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"remove","lines":[" "],"id":210}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":16},"action":"remove","lines":[" "],"id":211}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":12},"action":"remove","lines":[" "],"id":212}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":[" "],"id":213}],[{"start":{"row":7,"column":9},"end":{"row":7,"column":10},"action":"insert","lines":[" "],"id":214}],[{"start":{"row":7,"column":10},"end":{"row":7,"column":11},"action":"insert","lines":[" "],"id":215}],[{"start":{"row":7,"column":11},"end":{"row":7,"column":12},"action":"insert","lines":[" "],"id":216}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":217}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"remove","lines":[" "],"id":218}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":219}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"remove","lines":[" "],"id":220}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":221}],[{"start":{"row":5,"column":0},"end":{"row":9,"column":16},"action":"remove","lines":[" "],"id":222}],[{"start":{"row":4,"column":108},"end":{"row":5,"column":0},"action":"remove","lines":["",""],"id":223}],[{"start":{"row":6,"column":10},"end":{"row":7,"column":8},"action":"insert","lines":[""," "],"id":224}],[{"start":{"row":7,"column":8},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":225},{"start":{"row":8,"column":0},"end":{"row":8,"column":8},"action":"insert","lines":[" "]}],[{"start":{"row":8,"column":8},"end":{"row":21,"column":10},"action":"insert","lines":[" "],"id":226}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":12},"action":"remove","lines":[" "],"id":227}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":8},"action":"remove","lines":[" "],"id":228}],[{"start":{"row":8,"column":0},"end":{"row":8,"column":4},"action":"remove","lines":[" "],"id":229},{"start":{"row":9,"column":0},"end":{"row":9,"column":4},"action":"remove","lines":[" "]},{"start":{"row":10,"column":0},"end":{"row":10,"column":4},"action":"remove","lines":[" "]},{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"remove","lines":[" "]},{"start":{"row":12,"column":0},"end":{"row":12,"column":4},"action":"remove","lines":[" "]},{"start":{"row":13,"column":0},"end":{"row":13,"column":4},"action":"remove","lines":[" "]},{"start":{"row":14,"column":0},"end":{"row":14,"column":4},"action":"remove","lines":[" "]},{"start":{"row":15,"column":0},"end":{"row":15,"column":4},"action":"remove","lines":[" "]},{"start":{"row":16,"column":0},"end":{"row":16,"column":4},"action":"remove","lines":[" "]},{"start":{"row":17,"column":0},"end":{"row":17,"column":4},"action":"remove","lines":[" "]},{"start":{"row":18,"column":0},"end":{"row":18,"column":4},"action":"remove","lines":[" "]},{"start":{"row":19,"column":0},"end":{"row":19,"column":4},"action":"remove","lines":[" "]},{"start":{"row":20,"column":0},"end":{"row":20,"column":4},"action":"remove","lines":[" "]},{"start":{"row":21,"column":0},"end":{"row":21,"column":4},"action":"remove","lines":[" "]}],[{"start":{"row":8,"column":0},"end":{"row":8,"column":4},"action":"insert","lines":[" "],"id":230},{"start":{"row":9,"column":0},"end":{"row":9,"column":4},"action":"insert","lines":[" "]},{"start":{"row":10,"column":0},"end":{"row":10,"column":4},"action":"insert","lines":[" "]},{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"insert","lines":[" "]},{"start":{"row":12,"column":0},"end":{"row":12,"column":4},"action":"insert","lines":[" "]},{"start":{"row":13,"column":0},"end":{"row":13,"column":4},"action":"insert","lines":[" "]},{"start":{"row":14,"column":0},"end":{"row":14,"column":4},"action":"insert","lines":[" "]},{"start":{"row":15,"column":0},"end":{"row":15,"column":4},"action":"insert","lines":[" "]},{"start":{"row":16,"column":0},"end":{"row":16,"column":4},"action":"insert","lines":[" "]},{"start":{"row":17,"column":0},"end":{"row":17,"column":4},"action":"insert","lines":[" "]},{"start":{"row":18,"column":0},"end":{"row":18,"column":4},"action":"insert","lines":[" "]},{"start":{"row":19,"column":0},"end":{"row":19,"column":4},"action":"insert","lines":[" "]},{"start":{"row":20,"column":0},"end":{"row":20,"column":4},"action":"insert","lines":[" "]},{"start":{"row":21,"column":0},"end":{"row":21,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":7,"column":4},"end":{"row":7,"column":8},"action":"remove","lines":[" "],"id":231}],[{"start":{"row":7,"column":0},"end":{"row":7,"column":4},"action":"remove","lines":[" "],"id":232}],[{"start":{"row":6,"column":10},"end":{"row":7,"column":0},"action":"remove","lines":["",""],"id":233}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":7,"column":17},"end":{"row":7,"column":17},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445215281482,"hash":"a613090d9307f768782828fe6d80ca8dd8678941"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/app.js b/.c9/metadata/workspace/YelpCamp/v10/app.js deleted file mode 100644 index 55300f59..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v10/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":6,"column":43},"end":{"row":6,"column":44},"action":"insert","lines":["d"],"id":51}],[{"start":{"row":6,"column":44},"end":{"row":6,"column":45},"action":"insert","lines":["e"],"id":52}],[{"start":{"row":6,"column":45},"end":{"row":6,"column":46},"action":"insert","lines":[" "],"id":53}],[{"start":{"row":6,"column":45},"end":{"row":6,"column":46},"action":"remove","lines":[" "],"id":54}],[{"start":{"row":6,"column":47},"end":{"row":6,"column":48},"action":"insert","lines":[","],"id":55}],[{"start":{"row":20,"column":47},"end":{"row":21,"column":0},"action":"insert","lines":["",""],"id":56}],[{"start":{"row":21,"column":0},"end":{"row":21,"column":1},"action":"insert","lines":["a"],"id":57}],[{"start":{"row":21,"column":1},"end":{"row":21,"column":2},"action":"insert","lines":["p"],"id":58}],[{"start":{"row":21,"column":2},"end":{"row":21,"column":3},"action":"insert","lines":["p"],"id":59}],[{"start":{"row":21,"column":3},"end":{"row":21,"column":4},"action":"insert","lines":[" "],"id":60}],[{"start":{"row":21,"column":3},"end":{"row":21,"column":4},"action":"remove","lines":[" "],"id":61}],[{"start":{"row":21,"column":3},"end":{"row":21,"column":4},"action":"insert","lines":["."],"id":62}],[{"start":{"row":21,"column":4},"end":{"row":21,"column":5},"action":"insert","lines":["u"],"id":63}],[{"start":{"row":21,"column":5},"end":{"row":21,"column":6},"action":"insert","lines":["s"],"id":64}],[{"start":{"row":21,"column":6},"end":{"row":21,"column":7},"action":"insert","lines":["e"],"id":65}],[{"start":{"row":21,"column":7},"end":{"row":21,"column":8},"action":"insert","lines":[" "],"id":66}],[{"start":{"row":21,"column":7},"end":{"row":21,"column":8},"action":"remove","lines":[" "],"id":67}],[{"start":{"row":21,"column":7},"end":{"row":21,"column":9},"action":"insert","lines":["()"],"id":68}],[{"start":{"row":21,"column":8},"end":{"row":21,"column":9},"action":"insert","lines":["m"],"id":69}],[{"start":{"row":21,"column":9},"end":{"row":21,"column":10},"action":"insert","lines":["e"],"id":70}],[{"start":{"row":21,"column":10},"end":{"row":21,"column":11},"action":"insert","lines":["t"],"id":71}],[{"start":{"row":21,"column":11},"end":{"row":21,"column":12},"action":"insert","lines":["h"],"id":72}],[{"start":{"row":21,"column":12},"end":{"row":21,"column":13},"action":"insert","lines":["o"],"id":73}],[{"start":{"row":21,"column":13},"end":{"row":21,"column":14},"action":"insert","lines":["d"],"id":74}],[{"start":{"row":21,"column":8},"end":{"row":21,"column":14},"action":"remove","lines":["method"],"id":75},{"start":{"row":21,"column":8},"end":{"row":21,"column":14},"action":"insert","lines":["method"]}],[{"start":{"row":21,"column":14},"end":{"row":21,"column":15},"action":"insert","lines":["O"],"id":76}],[{"start":{"row":21,"column":15},"end":{"row":21,"column":16},"action":"insert","lines":["v"],"id":77}],[{"start":{"row":21,"column":8},"end":{"row":21,"column":16},"action":"remove","lines":["methodOv"],"id":78},{"start":{"row":21,"column":8},"end":{"row":21,"column":22},"action":"insert","lines":["methodOverride"]}],[{"start":{"row":21,"column":22},"end":{"row":21,"column":24},"action":"insert","lines":["()"],"id":79}],[{"start":{"row":21,"column":23},"end":{"row":21,"column":25},"action":"insert","lines":["\"\""],"id":80}],[{"start":{"row":21,"column":24},"end":{"row":21,"column":25},"action":"insert","lines":["_"],"id":81}],[{"start":{"row":21,"column":25},"end":{"row":21,"column":26},"action":"insert","lines":["m"],"id":82}],[{"start":{"row":21,"column":26},"end":{"row":21,"column":27},"action":"insert","lines":["e"],"id":83}],[{"start":{"row":21,"column":27},"end":{"row":21,"column":28},"action":"insert","lines":["t"],"id":84}],[{"start":{"row":21,"column":28},"end":{"row":21,"column":29},"action":"insert","lines":["h"],"id":85}],[{"start":{"row":21,"column":29},"end":{"row":21,"column":30},"action":"insert","lines":["o"],"id":86}],[{"start":{"row":21,"column":30},"end":{"row":21,"column":31},"action":"insert","lines":["d"],"id":87}],[{"start":{"row":21,"column":31},"end":{"row":21,"column":32},"action":"insert","lines":[" "],"id":88}],[{"start":{"row":21,"column":31},"end":{"row":21,"column":32},"action":"remove","lines":[" "],"id":89}],[{"start":{"row":21,"column":34},"end":{"row":21,"column":35},"action":"insert","lines":[";"],"id":90}],[{"start":{"row":10,"column":36},"end":{"row":10,"column":37},"action":"insert","lines":[","],"id":91}],[{"start":{"row":10,"column":37},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":92},{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":5},"action":"insert","lines":["m"],"id":93}],[{"start":{"row":11,"column":5},"end":{"row":11,"column":6},"action":"insert","lines":["i"],"id":94}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"insert","lines":["d"],"id":95}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"insert","lines":["d"],"id":96}],[{"start":{"row":11,"column":8},"end":{"row":11,"column":9},"action":"insert","lines":["l"],"id":97}],[{"start":{"row":11,"column":9},"end":{"row":11,"column":10},"action":"insert","lines":["e"],"id":98}],[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"insert","lines":["w"],"id":99}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":["a"],"id":100}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["r"],"id":101}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":["e"],"id":102}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":[" "],"id":103}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"remove","lines":[" "],"id":104}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":[" "],"id":105}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"insert","lines":["="],"id":106}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"insert","lines":[" "],"id":107}],[{"start":{"row":11,"column":17},"end":{"row":11,"column":18},"action":"insert","lines":["r"],"id":108}],[{"start":{"row":11,"column":18},"end":{"row":11,"column":19},"action":"insert","lines":["e"],"id":109}],[{"start":{"row":11,"column":19},"end":{"row":11,"column":20},"action":"insert","lines":["q"],"id":110}],[{"start":{"row":11,"column":20},"end":{"row":11,"column":21},"action":"insert","lines":["u"],"id":111}],[{"start":{"row":11,"column":21},"end":{"row":11,"column":22},"action":"insert","lines":["i"],"id":112}],[{"start":{"row":11,"column":22},"end":{"row":11,"column":23},"action":"insert","lines":["r"],"id":113}],[{"start":{"row":11,"column":23},"end":{"row":11,"column":24},"action":"insert","lines":["e"],"id":114}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":25},"action":"insert","lines":[" "],"id":115}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":25},"action":"remove","lines":[" "],"id":116}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":25},"action":"insert","lines":[")"],"id":117}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":25},"action":"remove","lines":[")"],"id":118}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":26},"action":"insert","lines":["()"],"id":119}],[{"start":{"row":11,"column":25},"end":{"row":11,"column":27},"action":"insert","lines":["\"\""],"id":120}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"insert","lines":["/"],"id":121}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"remove","lines":["/"],"id":122}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"insert","lines":[","],"id":123}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"remove","lines":[","],"id":124}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"insert","lines":[","],"id":125}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"remove","lines":[","],"id":126}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"insert","lines":["."],"id":127}],[{"start":{"row":11,"column":27},"end":{"row":11,"column":28},"action":"insert","lines":["/"],"id":128}],[{"start":{"row":11,"column":28},"end":{"row":11,"column":29},"action":"insert","lines":["m"],"id":129}],[{"start":{"row":11,"column":29},"end":{"row":11,"column":30},"action":"insert","lines":["i"],"id":130}],[{"start":{"row":11,"column":30},"end":{"row":11,"column":31},"action":"insert","lines":["d"],"id":131}],[{"start":{"row":11,"column":31},"end":{"row":11,"column":32},"action":"insert","lines":["d"],"id":132}],[{"start":{"row":11,"column":32},"end":{"row":11,"column":33},"action":"insert","lines":["l"],"id":133}],[{"start":{"row":11,"column":33},"end":{"row":11,"column":34},"action":"insert","lines":["e"],"id":134}],[{"start":{"row":11,"column":34},"end":{"row":11,"column":35},"action":"insert","lines":["a"],"id":135}],[{"start":{"row":11,"column":35},"end":{"row":11,"column":36},"action":"insert","lines":["r"],"id":136}],[{"start":{"row":11,"column":36},"end":{"row":11,"column":37},"action":"insert","lines":["e"],"id":137}],[{"start":{"row":11,"column":37},"end":{"row":11,"column":38},"action":"insert","lines":[" "],"id":138}],[{"start":{"row":11,"column":37},"end":{"row":11,"column":38},"action":"remove","lines":[" "],"id":139}],[{"start":{"row":11,"column":36},"end":{"row":11,"column":37},"action":"remove","lines":["e"],"id":140}],[{"start":{"row":11,"column":35},"end":{"row":11,"column":36},"action":"remove","lines":["r"],"id":141}],[{"start":{"row":11,"column":34},"end":{"row":11,"column":35},"action":"remove","lines":["a"],"id":142}],[{"start":{"row":11,"column":34},"end":{"row":11,"column":35},"action":"insert","lines":["w"],"id":143}],[{"start":{"row":11,"column":35},"end":{"row":11,"column":36},"action":"insert","lines":["a"],"id":144}],[{"start":{"row":11,"column":36},"end":{"row":11,"column":37},"action":"insert","lines":["r"],"id":145}],[{"start":{"row":11,"column":37},"end":{"row":11,"column":38},"action":"insert","lines":["e"],"id":146}],[{"start":{"row":11,"column":38},"end":{"row":11,"column":39},"action":"insert","lines":[" "],"id":147}],[{"start":{"row":11,"column":38},"end":{"row":11,"column":39},"action":"remove","lines":[" "],"id":148}],[{"start":{"row":11,"column":0},"end":{"row":11,"column":40},"action":"remove","lines":[" middleware = require(\"./middleware\")"],"id":149}],[{"start":{"row":10,"column":37},"end":{"row":11,"column":0},"action":"remove","lines":["",""],"id":150}],[{"start":{"row":10,"column":36},"end":{"row":10,"column":37},"action":"remove","lines":[","],"id":151}]]},"ace":{"folds":[],"scrolltop":157.5,"scrollleft":0,"selection":{"start":{"row":13,"column":10},"end":{"row":13,"column":10},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":5,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1446968431538,"hash":"a9c5b1442af139f8c8baa2439dd7be2026d7536b"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/middleware/index.js b/.c9/metadata/workspace/YelpCamp/v10/middleware/index.js deleted file mode 100644 index 9a898b50..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/middleware/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/YelpCamp/v10/middleware/index.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":41,"column":16},"end":{"row":41,"column":17},"action":"insert","lines":["L"],"id":385}],[{"start":{"row":41,"column":17},"end":{"row":41,"column":18},"action":"insert","lines":["o"],"id":386}],[{"start":{"row":41,"column":18},"end":{"row":41,"column":19},"action":"insert","lines":["g"],"id":387}],[{"start":{"row":41,"column":19},"end":{"row":41,"column":20},"action":"insert","lines":["g"],"id":388}],[{"start":{"row":41,"column":20},"end":{"row":41,"column":21},"action":"insert","lines":["e"],"id":389}],[{"start":{"row":41,"column":14},"end":{"row":41,"column":21},"action":"remove","lines":["isLogge"],"id":390},{"start":{"row":41,"column":14},"end":{"row":41,"column":24},"action":"insert","lines":["isLoggedIn"]}],[{"start":{"row":41,"column":24},"end":{"row":41,"column":25},"action":"insert","lines":[" "],"id":391}],[{"start":{"row":41,"column":25},"end":{"row":41,"column":26},"action":"insert","lines":["="],"id":392}],[{"start":{"row":41,"column":26},"end":{"row":41,"column":27},"action":"insert","lines":[" "],"id":393}],[{"start":{"row":41,"column":27},"end":{"row":46,"column":1},"action":"insert","lines":["function isLoggedIn(req, res, next){"," if(req.isAuthenticated()){"," return next();"," }"," res.redirect(\"/login\");","}"],"id":394}],[{"start":{"row":41,"column":38},"end":{"row":41,"column":46},"action":"remove","lines":["LoggedIn"],"id":395}],[{"start":{"row":41,"column":37},"end":{"row":41,"column":38},"action":"remove","lines":["s"],"id":396}],[{"start":{"row":41,"column":36},"end":{"row":41,"column":37},"action":"remove","lines":["i"],"id":397}],[{"start":{"row":41,"column":35},"end":{"row":41,"column":36},"action":"remove","lines":[" "],"id":398}],[{"start":{"row":48,"column":30},"end":{"row":48,"column":31},"action":"insert","lines":[";"],"id":399}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":400}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["v"],"id":401}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["a"],"id":402}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":["r"],"id":403}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":[" "],"id":404}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"remove","lines":[" "],"id":405}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":[" "],"id":406}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["C"],"id":407}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["a"],"id":408}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["m"],"id":409}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["p"],"id":410}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["g"],"id":411}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["r"],"id":412}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":["o"],"id":413}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["u"],"id":414}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["n"],"id":415}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["d"],"id":416}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":[" "],"id":417}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"remove","lines":[" "],"id":418}],[{"start":{"row":0,"column":14},"end":{"row":0,"column":15},"action":"insert","lines":[" "],"id":419}],[{"start":{"row":0,"column":15},"end":{"row":0,"column":16},"action":"insert","lines":["="],"id":420}],[{"start":{"row":0,"column":16},"end":{"row":0,"column":17},"action":"insert","lines":[" "],"id":421}],[{"start":{"row":0,"column":17},"end":{"row":0,"column":18},"action":"insert","lines":["r"],"id":422}],[{"start":{"row":0,"column":18},"end":{"row":0,"column":19},"action":"insert","lines":["e"],"id":423}],[{"start":{"row":0,"column":19},"end":{"row":0,"column":20},"action":"insert","lines":["q"],"id":424}],[{"start":{"row":0,"column":20},"end":{"row":0,"column":21},"action":"insert","lines":["u"],"id":425}],[{"start":{"row":0,"column":21},"end":{"row":0,"column":22},"action":"insert","lines":["i"],"id":426}],[{"start":{"row":0,"column":22},"end":{"row":0,"column":23},"action":"insert","lines":["r"],"id":427}],[{"start":{"row":0,"column":23},"end":{"row":0,"column":24},"action":"insert","lines":["e"],"id":428}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"insert","lines":[" "],"id":429}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":25},"action":"remove","lines":[" "],"id":430}],[{"start":{"row":0,"column":24},"end":{"row":0,"column":26},"action":"insert","lines":["()"],"id":431}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"insert","lines":[":"],"id":432}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":26},"action":"remove","lines":[":"],"id":433}],[{"start":{"row":0,"column":25},"end":{"row":0,"column":27},"action":"insert","lines":["\"\""],"id":434}],[{"start":{"row":0,"column":26},"end":{"row":0,"column":27},"action":"insert","lines":["."],"id":435}],[{"start":{"row":0,"column":27},"end":{"row":0,"column":28},"action":"insert","lines":["."],"id":436}],[{"start":{"row":0,"column":28},"end":{"row":0,"column":29},"action":"insert","lines":["/"],"id":437}],[{"start":{"row":0,"column":29},"end":{"row":0,"column":30},"action":"insert","lines":["m"],"id":438}],[{"start":{"row":0,"column":30},"end":{"row":0,"column":31},"action":"insert","lines":["o"],"id":439}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"insert","lines":["e"],"id":440}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"insert","lines":["l"],"id":441}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"remove","lines":["l"],"id":442}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"remove","lines":["e"],"id":443}],[{"start":{"row":0,"column":31},"end":{"row":0,"column":32},"action":"insert","lines":["d"],"id":444}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"insert","lines":["e"],"id":445}],[{"start":{"row":0,"column":33},"end":{"row":0,"column":34},"action":"insert","lines":["l"],"id":446}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"insert","lines":["s"],"id":447}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"insert","lines":[" "],"id":448}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"remove","lines":[" "],"id":449}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"insert","lines":["/"],"id":450}],[{"start":{"row":0,"column":36},"end":{"row":0,"column":37},"action":"insert","lines":["c"],"id":451}],[{"start":{"row":0,"column":37},"end":{"row":0,"column":38},"action":"insert","lines":["a"],"id":452}],[{"start":{"row":0,"column":38},"end":{"row":0,"column":39},"action":"insert","lines":["m"],"id":453}],[{"start":{"row":0,"column":39},"end":{"row":0,"column":40},"action":"insert","lines":["p"],"id":454}],[{"start":{"row":0,"column":40},"end":{"row":0,"column":41},"action":"insert","lines":["g"],"id":455}],[{"start":{"row":0,"column":41},"end":{"row":0,"column":42},"action":"insert","lines":["r"],"id":456}],[{"start":{"row":0,"column":42},"end":{"row":0,"column":43},"action":"insert","lines":["o"],"id":457}],[{"start":{"row":0,"column":43},"end":{"row":0,"column":44},"action":"insert","lines":["u"],"id":458}],[{"start":{"row":0,"column":44},"end":{"row":0,"column":45},"action":"insert","lines":["n"],"id":459}],[{"start":{"row":0,"column":45},"end":{"row":0,"column":46},"action":"insert","lines":["d"],"id":460}],[{"start":{"row":0,"column":46},"end":{"row":0,"column":47},"action":"insert","lines":[" "],"id":461}],[{"start":{"row":0,"column":46},"end":{"row":0,"column":47},"action":"remove","lines":[" "],"id":462}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["var Campground = require(\"../models/campground\")",""],"id":463}],[{"start":{"row":0,"column":48},"end":{"row":0,"column":49},"action":"insert","lines":[";"],"id":464}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":15},"action":"remove","lines":["ampground "],"id":465}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["o"],"id":466}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["m"],"id":467}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["m"],"id":468}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["e"],"id":469}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["n"],"id":470}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["t"],"id":471}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":[" "],"id":472}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":[" "],"id":473}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":[" "],"id":474}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":43},"action":"remove","lines":["ampground"],"id":475}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":["o"],"id":476}],[{"start":{"row":1,"column":35},"end":{"row":1,"column":36},"action":"insert","lines":["m"],"id":477}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":37},"action":"insert","lines":["m"],"id":478}],[{"start":{"row":1,"column":37},"end":{"row":1,"column":38},"action":"insert","lines":["e"],"id":479}],[{"start":{"row":1,"column":38},"end":{"row":1,"column":39},"action":"insert","lines":["n"],"id":480}],[{"start":{"row":1,"column":39},"end":{"row":1,"column":40},"action":"insert","lines":["t"],"id":481}],[{"start":{"row":1,"column":40},"end":{"row":1,"column":41},"action":"insert","lines":[" "],"id":482}],[{"start":{"row":1,"column":40},"end":{"row":1,"column":41},"action":"remove","lines":[" "],"id":483}],[{"start":{"row":1,"column":42},"end":{"row":1,"column":43},"action":"insert","lines":[";"],"id":484}],[{"start":{"row":1,"column":43},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":485}]]},"ace":{"folds":[],"scrolltop":79.5,"scrollleft":0,"selection":{"start":{"row":10,"column":36},"end":{"row":10,"column":36},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":2,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1447222661935,"hash":"13795810041c9dc036e231303189342e9c92babb"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/models/campground.js b/.c9/metadata/workspace/YelpCamp/v10/models/campground.js deleted file mode 100644 index 8e3813d6..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/models/campground.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campground.js","tooltip":"/YelpCamp/v10/models/campground.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":81,"scrollleft":0,"selection":{"start":{"row":7,"column":8},"end":{"row":7,"column":8},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":2,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1446430040971,"hash":"6a47307c1260b8ae223431925a4d312d0e9ff1df"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/models/comment.js b/.c9/metadata/workspace/YelpCamp/v10/models/comment.js deleted file mode 100644 index c60d08e5..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/models/comment.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comment.js","tooltip":"/YelpCamp/v10/models/comment.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":40.5,"scrollleft":0,"selection":{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":0,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1446967252740,"hash":"d5d10fe426a42c2448c441bc121bd9a5ea8a1ab6"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/models/user.js b/.c9/metadata/workspace/YelpCamp/v10/models/user.js deleted file mode 100644 index 8cc962c4..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/models/user.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"user.js","tooltip":"/YelpCamp/v10/models/user.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":40},"end":{"row":8,"column":40},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1446430053269,"hash":"ce08b2516b11cf283b51822bef488db693bc30cc"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/node_modules/express/index.js b/.c9/metadata/workspace/YelpCamp/v10/node_modules/express/index.js deleted file mode 100644 index 84920349..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/node_modules/express/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/YelpCamp/v10/node_modules/express/index.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":1.5,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1446968573856,"hash":"3f41478fdab31acabab8fa1d26126483a141ffb6"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/public/stylesheets/main.css b/.c9/metadata/workspace/YelpCamp/v10/public/stylesheets/main.css deleted file mode 100644 index 38ea3b6c..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/public/stylesheets/main.css +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"main.css","tooltip":"/YelpCamp/v10/public/stylesheets/main.css","undoManager":{"mark":41,"position":41,"stack":[[{"start":{"row":10,"column":1},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":2}],[{"start":{"row":11,"column":0},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":3}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":1},"action":"insert","lines":["#"],"id":4}],[{"start":{"row":12,"column":1},"end":{"row":12,"column":2},"action":"insert","lines":["d"],"id":5}],[{"start":{"row":12,"column":2},"end":{"row":12,"column":3},"action":"insert","lines":["e"],"id":6}],[{"start":{"row":12,"column":3},"end":{"row":12,"column":4},"action":"insert","lines":["l"],"id":7}],[{"start":{"row":12,"column":4},"end":{"row":12,"column":5},"action":"insert","lines":["t"],"id":8}],[{"start":{"row":12,"column":4},"end":{"row":12,"column":5},"action":"remove","lines":["t"],"id":9}],[{"start":{"row":12,"column":4},"end":{"row":12,"column":5},"action":"insert","lines":["e"],"id":10}],[{"start":{"row":12,"column":5},"end":{"row":12,"column":6},"action":"insert","lines":["t"],"id":11}],[{"start":{"row":12,"column":6},"end":{"row":12,"column":7},"action":"insert","lines":["e"],"id":12}],[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"insert","lines":[" "],"id":13}],[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"remove","lines":[" "],"id":14}],[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"insert","lines":["-"],"id":15}],[{"start":{"row":12,"column":8},"end":{"row":12,"column":9},"action":"insert","lines":["f"],"id":16}],[{"start":{"row":12,"column":9},"end":{"row":12,"column":10},"action":"insert","lines":["o"],"id":17}],[{"start":{"row":12,"column":10},"end":{"row":12,"column":11},"action":"insert","lines":["r"],"id":18}],[{"start":{"row":12,"column":11},"end":{"row":12,"column":12},"action":"insert","lines":["m"],"id":19}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"insert","lines":[" "],"id":20}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"remove","lines":[" "],"id":21}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"insert","lines":[" "],"id":22}],[{"start":{"row":12,"column":13},"end":{"row":12,"column":14},"action":"insert","lines":["{"],"id":23}],[{"start":{"row":12,"column":14},"end":{"row":14,"column":1},"action":"insert","lines":[""," ","}"],"id":24}],[{"start":{"row":13,"column":4},"end":{"row":13,"column":5},"action":"insert","lines":["d"],"id":25}],[{"start":{"row":13,"column":5},"end":{"row":13,"column":6},"action":"insert","lines":["i"],"id":26}],[{"start":{"row":13,"column":6},"end":{"row":13,"column":7},"action":"insert","lines":["s"],"id":27}],[{"start":{"row":13,"column":7},"end":{"row":13,"column":8},"action":"insert","lines":["p"],"id":28}],[{"start":{"row":13,"column":8},"end":{"row":13,"column":9},"action":"insert","lines":["l"],"id":29}],[{"start":{"row":13,"column":9},"end":{"row":13,"column":10},"action":"insert","lines":["a"],"id":30}],[{"start":{"row":13,"column":10},"end":{"row":13,"column":11},"action":"insert","lines":["y"],"id":31}],[{"start":{"row":13,"column":11},"end":{"row":13,"column":12},"action":"insert","lines":[" "],"id":32}],[{"start":{"row":13,"column":11},"end":{"row":13,"column":12},"action":"remove","lines":[" "],"id":33}],[{"start":{"row":13,"column":11},"end":{"row":13,"column":13},"action":"insert","lines":[":;"],"id":34}],[{"start":{"row":13,"column":12},"end":{"row":13,"column":13},"action":"insert","lines":[" "],"id":35}],[{"start":{"row":13,"column":13},"end":{"row":13,"column":14},"action":"insert","lines":["i"],"id":36}],[{"start":{"row":13,"column":14},"end":{"row":13,"column":15},"action":"insert","lines":["n"],"id":37}],[{"start":{"row":13,"column":15},"end":{"row":13,"column":16},"action":"insert","lines":["l"],"id":38}],[{"start":{"row":13,"column":16},"end":{"row":13,"column":17},"action":"insert","lines":["i"],"id":39}],[{"start":{"row":13,"column":17},"end":{"row":13,"column":18},"action":"insert","lines":["n"],"id":40}],[{"start":{"row":13,"column":18},"end":{"row":13,"column":19},"action":"insert","lines":["e"],"id":41}],[{"start":{"row":13,"column":19},"end":{"row":13,"column":20},"action":"insert","lines":[" "],"id":42}],[{"start":{"row":13,"column":19},"end":{"row":13,"column":20},"action":"remove","lines":[" "],"id":43}]]},"ace":{"folds":[],"scrolltop":138,"scrollleft":0,"selection":{"start":{"row":11,"column":0},"end":{"row":11,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":4,"state":"ruleset","mode":"ace/mode/css"}},"timestamp":1446429543806,"hash":"7c14dd4b7d3634535352e29f5836b5e3ae65322b"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/readme.md b/.c9/metadata/workspace/YelpCamp/v10/readme.md deleted file mode 100644 index 6ff4ec52..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v10/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":124,"column":27},"end":{"row":124,"column":28},"action":"insert","lines":["c"],"id":839}],[{"start":{"row":124,"column":28},"end":{"row":124,"column":29},"action":"insert","lines":["a"],"id":840}],[{"start":{"row":124,"column":29},"end":{"row":124,"column":30},"action":"insert","lines":["m"],"id":841}],[{"start":{"row":124,"column":30},"end":{"row":124,"column":31},"action":"insert","lines":["p"],"id":842}],[{"start":{"row":124,"column":31},"end":{"row":124,"column":32},"action":"insert","lines":["g"],"id":843}],[{"start":{"row":124,"column":32},"end":{"row":124,"column":33},"action":"insert","lines":["r"],"id":844}],[{"start":{"row":124,"column":33},"end":{"row":124,"column":34},"action":"insert","lines":["o"],"id":845}],[{"start":{"row":124,"column":34},"end":{"row":124,"column":35},"action":"insert","lines":["u"],"id":846}],[{"start":{"row":124,"column":35},"end":{"row":124,"column":36},"action":"insert","lines":["n"],"id":847}],[{"start":{"row":124,"column":36},"end":{"row":124,"column":37},"action":"insert","lines":["d"],"id":848}],[{"start":{"row":124,"column":37},"end":{"row":124,"column":38},"action":"insert","lines":["s"],"id":849}],[{"start":{"row":124,"column":38},"end":{"row":124,"column":39},"action":"insert","lines":[" "],"id":850}],[{"start":{"row":124,"column":38},"end":{"row":124,"column":39},"action":"remove","lines":[" "],"id":851}],[{"start":{"row":124,"column":38},"end":{"row":124,"column":39},"action":"insert","lines":["/"],"id":852}],[{"start":{"row":124,"column":39},"end":{"row":124,"column":40},"action":"insert","lines":[":"],"id":853}],[{"start":{"row":124,"column":40},"end":{"row":124,"column":41},"action":"insert","lines":["i"],"id":854}],[{"start":{"row":124,"column":41},"end":{"row":124,"column":42},"action":"insert","lines":["d"],"id":855}],[{"start":{"row":124,"column":42},"end":{"row":124,"column":43},"action":"insert","lines":[" "],"id":856}],[{"start":{"row":124,"column":42},"end":{"row":124,"column":43},"action":"remove","lines":[" "],"id":857}],[{"start":{"row":124,"column":42},"end":{"row":125,"column":0},"action":"insert","lines":["",""],"id":858}],[{"start":{"row":125,"column":0},"end":{"row":125,"column":1},"action":"insert","lines":["C"],"id":859}],[{"start":{"row":125,"column":1},"end":{"row":125,"column":2},"action":"insert","lines":["o"],"id":860}],[{"start":{"row":125,"column":2},"end":{"row":125,"column":3},"action":"insert","lines":["m"],"id":861}],[{"start":{"row":125,"column":3},"end":{"row":125,"column":4},"action":"insert","lines":["m"],"id":862}],[{"start":{"row":125,"column":4},"end":{"row":125,"column":5},"action":"insert","lines":["e"],"id":863}],[{"start":{"row":125,"column":5},"end":{"row":125,"column":6},"action":"insert","lines":["n"],"id":864}],[{"start":{"row":125,"column":6},"end":{"row":125,"column":7},"action":"insert","lines":["t"],"id":865}],[{"start":{"row":125,"column":7},"end":{"row":125,"column":8},"action":"insert","lines":[" "],"id":866}],[{"start":{"row":125,"column":7},"end":{"row":125,"column":8},"action":"remove","lines":[" "],"id":867}],[{"start":{"row":125,"column":7},"end":{"row":125,"column":8},"action":"insert","lines":[" "],"id":868}],[{"start":{"row":125,"column":8},"end":{"row":125,"column":9},"action":"insert","lines":["D"],"id":869}],[{"start":{"row":125,"column":9},"end":{"row":125,"column":10},"action":"insert","lines":["e"],"id":870}],[{"start":{"row":125,"column":10},"end":{"row":125,"column":11},"action":"insert","lines":["s"],"id":871}],[{"start":{"row":125,"column":11},"end":{"row":125,"column":12},"action":"insert","lines":["t"],"id":872}],[{"start":{"row":125,"column":12},"end":{"row":125,"column":13},"action":"insert","lines":["r"],"id":873}],[{"start":{"row":125,"column":13},"end":{"row":125,"column":14},"action":"insert","lines":["o"],"id":874}],[{"start":{"row":125,"column":14},"end":{"row":125,"column":15},"action":"insert","lines":["y"],"id":875}],[{"start":{"row":125,"column":15},"end":{"row":125,"column":16},"action":"insert","lines":[" "],"id":876}],[{"start":{"row":125,"column":15},"end":{"row":125,"column":16},"action":"remove","lines":[" "],"id":877}],[{"start":{"row":125,"column":15},"end":{"row":125,"column":16},"action":"insert","lines":[" "],"id":878}],[{"start":{"row":125,"column":16},"end":{"row":125,"column":17},"action":"insert","lines":["R"],"id":879}],[{"start":{"row":125,"column":17},"end":{"row":125,"column":18},"action":"insert","lines":["o"],"id":880}],[{"start":{"row":125,"column":18},"end":{"row":125,"column":19},"action":"insert","lines":["u"],"id":881}],[{"start":{"row":125,"column":19},"end":{"row":125,"column":20},"action":"insert","lines":["t"],"id":882}],[{"start":{"row":125,"column":20},"end":{"row":125,"column":21},"action":"insert","lines":["e"],"id":883}],[{"start":{"row":125,"column":21},"end":{"row":125,"column":22},"action":"insert","lines":[" "],"id":884}],[{"start":{"row":125,"column":21},"end":{"row":125,"column":22},"action":"remove","lines":[" "],"id":885}],[{"start":{"row":125,"column":21},"end":{"row":125,"column":22},"action":"insert","lines":[":"],"id":886}],[{"start":{"row":125,"column":22},"end":{"row":125,"column":23},"action":"insert","lines":[" "],"id":887}],[{"start":{"row":125,"column":23},"end":{"row":125,"column":24},"action":"insert","lines":[" "],"id":888}],[{"start":{"row":125,"column":24},"end":{"row":125,"column":25},"action":"insert","lines":[" "],"id":889}],[{"start":{"row":125,"column":25},"end":{"row":125,"column":26},"action":"insert","lines":[" "],"id":890}],[{"start":{"row":125,"column":26},"end":{"row":125,"column":27},"action":"insert","lines":["/"],"id":891}],[{"start":{"row":125,"column":27},"end":{"row":125,"column":28},"action":"insert","lines":["c"],"id":892}],[{"start":{"row":125,"column":28},"end":{"row":125,"column":29},"action":"insert","lines":["a"],"id":893}],[{"start":{"row":125,"column":29},"end":{"row":125,"column":30},"action":"insert","lines":["m"],"id":894}],[{"start":{"row":125,"column":30},"end":{"row":125,"column":31},"action":"insert","lines":["p"],"id":895}],[{"start":{"row":125,"column":31},"end":{"row":125,"column":32},"action":"insert","lines":["g"],"id":896}],[{"start":{"row":125,"column":32},"end":{"row":125,"column":33},"action":"insert","lines":["r"],"id":897}],[{"start":{"row":125,"column":33},"end":{"row":125,"column":34},"action":"insert","lines":["o"],"id":898}],[{"start":{"row":125,"column":34},"end":{"row":125,"column":35},"action":"insert","lines":["u"],"id":899}],[{"start":{"row":125,"column":35},"end":{"row":125,"column":36},"action":"insert","lines":["n"],"id":900}],[{"start":{"row":125,"column":36},"end":{"row":125,"column":37},"action":"insert","lines":["d"],"id":901}],[{"start":{"row":125,"column":37},"end":{"row":125,"column":38},"action":"insert","lines":["s"],"id":902}],[{"start":{"row":125,"column":38},"end":{"row":125,"column":39},"action":"insert","lines":[" "],"id":903}],[{"start":{"row":125,"column":38},"end":{"row":125,"column":39},"action":"remove","lines":[" "],"id":904}],[{"start":{"row":125,"column":38},"end":{"row":125,"column":39},"action":"insert","lines":["/"],"id":905}],[{"start":{"row":125,"column":39},"end":{"row":125,"column":40},"action":"insert","lines":[":"],"id":906}],[{"start":{"row":125,"column":40},"end":{"row":125,"column":41},"action":"insert","lines":["i"],"id":907}],[{"start":{"row":125,"column":41},"end":{"row":125,"column":42},"action":"insert","lines":["d"],"id":908}],[{"start":{"row":125,"column":42},"end":{"row":125,"column":43},"action":"insert","lines":[" "],"id":909}],[{"start":{"row":125,"column":42},"end":{"row":125,"column":43},"action":"remove","lines":[" "],"id":910}],[{"start":{"row":125,"column":42},"end":{"row":125,"column":43},"action":"insert","lines":["/"],"id":911}],[{"start":{"row":125,"column":43},"end":{"row":125,"column":44},"action":"insert","lines":["c"],"id":912}],[{"start":{"row":125,"column":44},"end":{"row":125,"column":45},"action":"insert","lines":["o"],"id":913}],[{"start":{"row":125,"column":45},"end":{"row":125,"column":46},"action":"insert","lines":["m"],"id":914}],[{"start":{"row":125,"column":46},"end":{"row":125,"column":47},"action":"insert","lines":["m"],"id":915}],[{"start":{"row":125,"column":47},"end":{"row":125,"column":48},"action":"insert","lines":["e"],"id":916}],[{"start":{"row":125,"column":48},"end":{"row":125,"column":49},"action":"insert","lines":["n"],"id":917}],[{"start":{"row":125,"column":49},"end":{"row":125,"column":50},"action":"insert","lines":["t"],"id":918}],[{"start":{"row":125,"column":50},"end":{"row":125,"column":51},"action":"insert","lines":["s"],"id":919}],[{"start":{"row":125,"column":51},"end":{"row":125,"column":52},"action":"insert","lines":[" "],"id":920}],[{"start":{"row":125,"column":51},"end":{"row":125,"column":52},"action":"remove","lines":[" "],"id":921}],[{"start":{"row":125,"column":51},"end":{"row":125,"column":52},"action":"insert","lines":["/"],"id":922}],[{"start":{"row":125,"column":52},"end":{"row":125,"column":53},"action":"insert","lines":[":"],"id":923}],[{"start":{"row":125,"column":53},"end":{"row":125,"column":54},"action":"insert","lines":["c"],"id":924}],[{"start":{"row":125,"column":54},"end":{"row":125,"column":55},"action":"insert","lines":["o"],"id":925}],[{"start":{"row":125,"column":55},"end":{"row":125,"column":56},"action":"insert","lines":["m"],"id":926}],[{"start":{"row":125,"column":56},"end":{"row":125,"column":57},"action":"insert","lines":["m"],"id":927}],[{"start":{"row":125,"column":57},"end":{"row":125,"column":58},"action":"insert","lines":["e"],"id":928}],[{"start":{"row":125,"column":58},"end":{"row":125,"column":59},"action":"insert","lines":["n"],"id":929}],[{"start":{"row":125,"column":59},"end":{"row":125,"column":60},"action":"insert","lines":["t"],"id":930}],[{"start":{"row":125,"column":60},"end":{"row":125,"column":61},"action":"insert","lines":[" "],"id":931}],[{"start":{"row":125,"column":60},"end":{"row":125,"column":61},"action":"remove","lines":[" "],"id":932}],[{"start":{"row":125,"column":60},"end":{"row":125,"column":61},"action":"insert","lines":["_"],"id":933}],[{"start":{"row":125,"column":61},"end":{"row":125,"column":62},"action":"insert","lines":["i"],"id":934}],[{"start":{"row":125,"column":62},"end":{"row":125,"column":63},"action":"insert","lines":["d"],"id":935}],[{"start":{"row":125,"column":63},"end":{"row":125,"column":64},"action":"insert","lines":[" "],"id":936}],[{"start":{"row":125,"column":63},"end":{"row":125,"column":64},"action":"remove","lines":[" "],"id":937}],[{"start":{"row":135,"column":0},"end":{"row":136,"column":0},"action":"insert","lines":["",""],"id":938}],[{"start":{"row":136,"column":0},"end":{"row":137,"column":0},"action":"insert","lines":["",""],"id":939}]]},"ace":{"folds":[],"scrolltop":3813.5,"scrollleft":0,"selection":{"start":{"row":155,"column":34},"end":{"row":155,"column":34},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":145,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1447306876490,"hash":"8195ed4559d953b4ac2155f4176e49d00994c8e0"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/routes/campgrounds.js b/.c9/metadata/workspace/YelpCamp/v10/routes/campgrounds.js deleted file mode 100644 index b35a09b1..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/routes/campgrounds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campgrounds.js","tooltip":"/YelpCamp/v10/routes/campgrounds.js","ace":{"folds":[],"scrolltop":2288,"scrollleft":0,"selection":{"start":{"row":90,"column":0},"end":{"row":90,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":12,"state":"start","mode":"ace/mode/javascript"}},"hash":"0c16c488539fc138237d6a7636ed78eadd1a1a19","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":80,"column":30},"end":{"row":80,"column":31},"action":"insert","lines":["e"],"id":2270}],[{"start":{"row":80,"column":31},"end":{"row":80,"column":32},"action":"insert","lines":[" "],"id":2271}],[{"start":{"row":80,"column":31},"end":{"row":80,"column":32},"action":"remove","lines":[" "],"id":2272}],[{"start":{"row":80,"column":31},"end":{"row":80,"column":32},"action":"insert","lines":["."],"id":2273}],[{"start":{"row":2,"column":49},"end":{"row":3,"column":0},"action":"insert","lines":["",""],"id":2274}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":36},"action":"insert","lines":["middleware = require(\"./middleware\")"],"id":2275}],[{"start":{"row":3,"column":1},"end":{"row":3,"column":2},"action":"insert","lines":["v"],"id":2276}],[{"start":{"row":3,"column":1},"end":{"row":3,"column":2},"action":"remove","lines":["v"],"id":2277}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":1},"action":"insert","lines":["v"],"id":2278}],[{"start":{"row":3,"column":1},"end":{"row":3,"column":2},"action":"insert","lines":["a"],"id":2279}],[{"start":{"row":3,"column":2},"end":{"row":3,"column":3},"action":"insert","lines":["r"],"id":2280}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":[" "],"id":2281}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"remove","lines":[" "],"id":2282}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":[" "],"id":2283}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["."],"id":2284}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"remove","lines":["var middleware = require(\"../middleware\")",""],"id":2285}],[{"start":{"row":18,"column":17},"end":{"row":18,"column":28},"action":"remove","lines":["middleware."],"id":2288}],[{"start":{"row":41,"column":21},"end":{"row":41,"column":30},"action":"remove","lines":["ddleware."],"id":2289}],[{"start":{"row":41,"column":20},"end":{"row":41,"column":21},"action":"remove","lines":["i"],"id":2290}],[{"start":{"row":41,"column":19},"end":{"row":41,"column":20},"action":"remove","lines":["m"],"id":2291}],[{"start":{"row":60,"column":25},"end":{"row":60,"column":35},"action":"remove","lines":["iddleware."],"id":2292}],[{"start":{"row":60,"column":24},"end":{"row":60,"column":25},"action":"remove","lines":["m"],"id":2293}],[{"start":{"row":67,"column":18},"end":{"row":67,"column":29},"action":"remove","lines":["middleware."],"id":2294}],[{"start":{"row":80,"column":21},"end":{"row":80,"column":32},"action":"remove","lines":["middleware."],"id":2295}],[{"start":{"row":2,"column":49},"end":{"row":3,"column":0},"action":"insert","lines":["",""],"id":2296}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":1},"action":"insert","lines":["v"],"id":2297}],[{"start":{"row":3,"column":1},"end":{"row":3,"column":2},"action":"insert","lines":["a"],"id":2298}],[{"start":{"row":3,"column":2},"end":{"row":3,"column":3},"action":"insert","lines":["r"],"id":2299}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":[" "],"id":2300}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"remove","lines":[" "],"id":2301}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":[" "],"id":2302}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":5},"action":"insert","lines":["m"],"id":2303}],[{"start":{"row":3,"column":5},"end":{"row":3,"column":6},"action":"insert","lines":["i"],"id":2304}],[{"start":{"row":3,"column":6},"end":{"row":3,"column":7},"action":"insert","lines":["d"],"id":2305}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":8},"action":"insert","lines":["d"],"id":2306}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":["l"],"id":2307}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":["e"],"id":2308}],[{"start":{"row":3,"column":10},"end":{"row":3,"column":11},"action":"insert","lines":["w"],"id":2309}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"insert","lines":["a"],"id":2310}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"insert","lines":["r"],"id":2311}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["e"],"id":2312}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":[" "],"id":2313}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"remove","lines":[" "],"id":2314}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":[" "],"id":2315}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["="],"id":2316}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":[" "],"id":2317}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["r"],"id":2318}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":["e"],"id":2319}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"insert","lines":["q"],"id":2320}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"insert","lines":["u"],"id":2321}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"insert","lines":["i"],"id":2322}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":["r"],"id":2323}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"insert","lines":["e"],"id":2324}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":[" "],"id":2325}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"remove","lines":[" "],"id":2326}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":[")"],"id":2327}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"remove","lines":[")"],"id":2328}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":26},"action":"insert","lines":["()"],"id":2329}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":27},"action":"insert","lines":["\"\""],"id":2330}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["."],"id":2331}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["."],"id":2332}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"insert","lines":["/"],"id":2333}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":["m"],"id":2334}],[{"start":{"row":3,"column":30},"end":{"row":3,"column":31},"action":"insert","lines":["i"],"id":2335}],[{"start":{"row":3,"column":31},"end":{"row":3,"column":32},"action":"insert","lines":["d"],"id":2336}],[{"start":{"row":3,"column":32},"end":{"row":3,"column":33},"action":"insert","lines":["d"],"id":2337}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":["l"],"id":2338}],[{"start":{"row":3,"column":34},"end":{"row":3,"column":35},"action":"insert","lines":["e"],"id":2339}],[{"start":{"row":3,"column":35},"end":{"row":3,"column":36},"action":"insert","lines":["w"],"id":2340}],[{"start":{"row":3,"column":36},"end":{"row":3,"column":37},"action":"insert","lines":["a"],"id":2341}],[{"start":{"row":3,"column":37},"end":{"row":3,"column":38},"action":"insert","lines":["r"],"id":2342}],[{"start":{"row":3,"column":38},"end":{"row":3,"column":39},"action":"insert","lines":["e"],"id":2343}],[{"start":{"row":3,"column":39},"end":{"row":3,"column":40},"action":"insert","lines":[" "],"id":2344}],[{"start":{"row":3,"column":39},"end":{"row":3,"column":40},"action":"remove","lines":[" "],"id":2345}],[{"start":{"row":3,"column":39},"end":{"row":3,"column":40},"action":"insert","lines":["/"],"id":2346}],[{"start":{"row":3,"column":40},"end":{"row":3,"column":41},"action":"insert","lines":["i"],"id":2347}],[{"start":{"row":3,"column":41},"end":{"row":3,"column":42},"action":"insert","lines":["n"],"id":2348}],[{"start":{"row":3,"column":42},"end":{"row":3,"column":43},"action":"insert","lines":["d"],"id":2349}],[{"start":{"row":3,"column":43},"end":{"row":3,"column":44},"action":"insert","lines":["e"],"id":2350}],[{"start":{"row":3,"column":44},"end":{"row":3,"column":45},"action":"insert","lines":["x"],"id":2351}],[{"start":{"row":3,"column":45},"end":{"row":3,"column":46},"action":"insert","lines":[" "],"id":2352}],[{"start":{"row":3,"column":45},"end":{"row":3,"column":46},"action":"remove","lines":[" "],"id":2353}],[{"start":{"row":3,"column":45},"end":{"row":3,"column":46},"action":"insert","lines":["."],"id":2354}],[{"start":{"row":3,"column":46},"end":{"row":3,"column":47},"action":"insert","lines":["j"],"id":2355}],[{"start":{"row":3,"column":47},"end":{"row":3,"column":48},"action":"insert","lines":["s"],"id":2356}],[{"start":{"row":3,"column":48},"end":{"row":3,"column":49},"action":"insert","lines":[" "],"id":2357}],[{"start":{"row":3,"column":48},"end":{"row":3,"column":49},"action":"remove","lines":[" "],"id":2358}],[{"start":{"row":3,"column":40},"end":{"row":3,"column":48},"action":"remove","lines":["index.js"],"id":2359}],[{"start":{"row":3,"column":39},"end":{"row":3,"column":40},"action":"remove","lines":["/"],"id":2360}],[{"start":{"row":3,"column":41},"end":{"row":3,"column":42},"action":"insert","lines":[";"],"id":2361}],[{"start":{"row":19,"column":17},"end":{"row":19,"column":18},"action":"insert","lines":["m"],"id":2362}],[{"start":{"row":19,"column":18},"end":{"row":19,"column":19},"action":"insert","lines":["i"],"id":2363}],[{"start":{"row":19,"column":19},"end":{"row":19,"column":20},"action":"insert","lines":["d"],"id":2364}],[{"start":{"row":19,"column":20},"end":{"row":19,"column":21},"action":"insert","lines":["d"],"id":2365}],[{"start":{"row":19,"column":21},"end":{"row":19,"column":22},"action":"insert","lines":["l"],"id":2366}],[{"start":{"row":19,"column":17},"end":{"row":19,"column":22},"action":"remove","lines":["middl"],"id":2367},{"start":{"row":19,"column":17},"end":{"row":19,"column":27},"action":"insert","lines":["middleware"]}],[{"start":{"row":19,"column":27},"end":{"row":19,"column":28},"action":"insert","lines":["."],"id":2368}],[{"start":{"row":42,"column":19},"end":{"row":42,"column":30},"action":"insert","lines":["middleware."],"id":2369}],[{"start":{"row":61,"column":24},"end":{"row":61,"column":35},"action":"insert","lines":["middleware."],"id":2370}],[{"start":{"row":68,"column":18},"end":{"row":68,"column":29},"action":"insert","lines":["middleware."],"id":2371}],[{"start":{"row":81,"column":21},"end":{"row":81,"column":32},"action":"insert","lines":["middleware."],"id":2372}]]},"timestamp":1446968627000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/routes/comments.js b/.c9/metadata/workspace/YelpCamp/v10/routes/comments.js deleted file mode 100644 index 7c7034ef..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/routes/comments.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comments.js","tooltip":"/YelpCamp/v10/routes/comments.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":95,"column":25},"end":{"row":95,"column":26},"action":"remove","lines":["a"],"id":1423}],[{"start":{"row":95,"column":24},"end":{"row":95,"column":25},"action":"remove","lines":["C"],"id":1424}],[{"start":{"row":95,"column":24},"end":{"row":95,"column":25},"action":"insert","lines":["c"],"id":1425}],[{"start":{"row":95,"column":25},"end":{"row":95,"column":26},"action":"insert","lines":["o"],"id":1426}],[{"start":{"row":95,"column":26},"end":{"row":95,"column":27},"action":"insert","lines":["m"],"id":1427}],[{"start":{"row":95,"column":26},"end":{"row":95,"column":27},"action":"remove","lines":["m"],"id":1428}],[{"start":{"row":95,"column":25},"end":{"row":95,"column":26},"action":"remove","lines":["o"],"id":1429}],[{"start":{"row":95,"column":24},"end":{"row":95,"column":25},"action":"remove","lines":["c"],"id":1430}],[{"start":{"row":95,"column":24},"end":{"row":95,"column":25},"action":"insert","lines":["C"],"id":1431}],[{"start":{"row":95,"column":25},"end":{"row":95,"column":26},"action":"insert","lines":["o"],"id":1432}],[{"start":{"row":95,"column":26},"end":{"row":95,"column":27},"action":"insert","lines":["m"],"id":1433}],[{"start":{"row":95,"column":27},"end":{"row":95,"column":28},"action":"insert","lines":["m"],"id":1434}],[{"start":{"row":95,"column":28},"end":{"row":95,"column":29},"action":"insert","lines":["e"],"id":1435}],[{"start":{"row":95,"column":29},"end":{"row":95,"column":30},"action":"insert","lines":["n"],"id":1436}],[{"start":{"row":95,"column":30},"end":{"row":95,"column":31},"action":"insert","lines":["t"],"id":1437}],[{"start":{"row":95,"column":31},"end":{"row":95,"column":32},"action":"insert","lines":[" "],"id":1438}],[{"start":{"row":95,"column":31},"end":{"row":95,"column":32},"action":"remove","lines":[" "],"id":1439}],[{"start":{"row":46,"column":74},"end":{"row":47,"column":0},"action":"insert","lines":["",""],"id":1440},{"start":{"row":47,"column":0},"end":{"row":47,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":47,"column":0},"end":{"row":47,"column":4},"action":"remove","lines":[" "],"id":1441}],[{"start":{"row":46,"column":74},"end":{"row":47,"column":0},"action":"remove","lines":["",""],"id":1442}],[{"start":{"row":57,"column":26},"end":{"row":57,"column":48},"action":"insert","lines":["checkCommentOwnership,"],"id":1443}],[{"start":{"row":57,"column":48},"end":{"row":57,"column":49},"action":"insert","lines":[","],"id":1444}],[{"start":{"row":57,"column":48},"end":{"row":57,"column":49},"action":"remove","lines":[","],"id":1445}],[{"start":{"row":57,"column":26},"end":{"row":57,"column":27},"action":"insert","lines":[" "],"id":1446}],[{"start":{"row":68,"column":30},"end":{"row":68,"column":52},"action":"insert","lines":["checkCommentOwnership,"],"id":1447}],[{"start":{"row":68,"column":52},"end":{"row":68,"column":53},"action":"insert","lines":[" "],"id":1448}],[{"start":{"row":68,"column":53},"end":{"row":68,"column":54},"action":"insert","lines":["m"],"id":1449}],[{"start":{"row":68,"column":53},"end":{"row":68,"column":54},"action":"remove","lines":["m"],"id":1450}],[{"start":{"row":88,"column":0},"end":{"row":105,"column":1},"action":"remove","lines":["function checkCommentOwnership(req, res, next) {"," if(req.isAuthenticated()){"," Comment.findById(req.params.comment_id, function(err, foundComment){"," if(err){"," res.redirect(\"back\");"," } else {"," // does user own the comment?"," if(foundComment.author.id.equals(req.user._id)) {"," next();"," } else {"," res.redirect(\"back\");"," }"," }"," });"," } else {"," res.redirect(\"back\");"," }","}"],"id":1451}],[{"start":{"row":81,"column":0},"end":{"row":86,"column":1},"action":"remove","lines":["function isLoggedIn(req, res, next){"," if(req.isAuthenticated()){"," return next();"," }"," res.redirect(\"/login\");","}"],"id":1452}],[{"start":{"row":80,"column":0},"end":{"row":84,"column":0},"action":"remove","lines":["//middleware","","","",""],"id":1453}],[{"start":{"row":79,"column":0},"end":{"row":80,"column":0},"action":"remove","lines":["",""],"id":1454}],[{"start":{"row":78,"column":0},"end":{"row":79,"column":0},"action":"remove","lines":["",""],"id":1455}],[{"start":{"row":77,"column":3},"end":{"row":78,"column":0},"action":"remove","lines":["",""],"id":1456}],[{"start":{"row":19,"column":16},"end":{"row":19,"column":17},"action":"insert","lines":["m"],"id":1457}],[{"start":{"row":19,"column":17},"end":{"row":19,"column":18},"action":"insert","lines":["i"],"id":1458}],[{"start":{"row":19,"column":18},"end":{"row":19,"column":19},"action":"insert","lines":["d"],"id":1459}],[{"start":{"row":19,"column":19},"end":{"row":19,"column":20},"action":"insert","lines":["d"],"id":1460}],[{"start":{"row":19,"column":20},"end":{"row":19,"column":21},"action":"insert","lines":["l"],"id":1461}],[{"start":{"row":19,"column":21},"end":{"row":19,"column":22},"action":"insert","lines":["e"],"id":1462}],[{"start":{"row":19,"column":22},"end":{"row":19,"column":23},"action":"insert","lines":["w"],"id":1463}],[{"start":{"row":19,"column":23},"end":{"row":19,"column":24},"action":"insert","lines":["a"],"id":1464}],[{"start":{"row":19,"column":24},"end":{"row":19,"column":25},"action":"insert","lines":["r"],"id":1465}],[{"start":{"row":19,"column":25},"end":{"row":19,"column":26},"action":"insert","lines":["e"],"id":1466}],[{"start":{"row":19,"column":26},"end":{"row":19,"column":27},"action":"insert","lines":[" "],"id":1467}],[{"start":{"row":19,"column":26},"end":{"row":19,"column":27},"action":"remove","lines":[" "],"id":1468}],[{"start":{"row":19,"column":26},"end":{"row":19,"column":27},"action":"insert","lines":["."],"id":1469}],[{"start":{"row":6,"column":19},"end":{"row":6,"column":20},"action":"insert","lines":["m"],"id":1470}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"insert","lines":["i"],"id":1471}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"insert","lines":["d"],"id":1472}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"insert","lines":["d"],"id":1473}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"insert","lines":["l"],"id":1474}],[{"start":{"row":6,"column":24},"end":{"row":6,"column":25},"action":"insert","lines":["e"],"id":1475}],[{"start":{"row":6,"column":25},"end":{"row":6,"column":26},"action":"insert","lines":["w"],"id":1476}],[{"start":{"row":6,"column":26},"end":{"row":6,"column":27},"action":"insert","lines":["a"],"id":1477}],[{"start":{"row":6,"column":27},"end":{"row":6,"column":28},"action":"insert","lines":["r"],"id":1478}],[{"start":{"row":6,"column":28},"end":{"row":6,"column":29},"action":"insert","lines":["e"],"id":1479}],[{"start":{"row":6,"column":29},"end":{"row":6,"column":30},"action":"insert","lines":[" "],"id":1480}],[{"start":{"row":6,"column":29},"end":{"row":6,"column":30},"action":"remove","lines":[" "],"id":1481}],[{"start":{"row":6,"column":29},"end":{"row":6,"column":30},"action":"insert","lines":["."],"id":1482}],[{"start":{"row":46,"column":32},"end":{"row":46,"column":33},"action":"insert","lines":["m"],"id":1483}],[{"start":{"row":46,"column":33},"end":{"row":46,"column":34},"action":"insert","lines":["i"],"id":1484}],[{"start":{"row":46,"column":34},"end":{"row":46,"column":35},"action":"insert","lines":["d"],"id":1485}],[{"start":{"row":46,"column":35},"end":{"row":46,"column":36},"action":"insert","lines":["d"],"id":1486}],[{"start":{"row":46,"column":36},"end":{"row":46,"column":37},"action":"insert","lines":["l"],"id":1487}],[{"start":{"row":46,"column":37},"end":{"row":46,"column":38},"action":"insert","lines":["e"],"id":1488}],[{"start":{"row":46,"column":38},"end":{"row":46,"column":39},"action":"insert","lines":["w"],"id":1489}],[{"start":{"row":46,"column":39},"end":{"row":46,"column":40},"action":"insert","lines":["a"],"id":1490}],[{"start":{"row":46,"column":40},"end":{"row":46,"column":41},"action":"insert","lines":["r"],"id":1491}],[{"start":{"row":46,"column":41},"end":{"row":46,"column":42},"action":"insert","lines":["e"],"id":1492}],[{"start":{"row":46,"column":42},"end":{"row":46,"column":43},"action":"insert","lines":[" "],"id":1493}],[{"start":{"row":46,"column":42},"end":{"row":46,"column":43},"action":"remove","lines":[" "],"id":1494}],[{"start":{"row":46,"column":42},"end":{"row":46,"column":43},"action":"insert","lines":["."],"id":1495}],[{"start":{"row":57,"column":27},"end":{"row":57,"column":28},"action":"insert","lines":["m"],"id":1496}],[{"start":{"row":57,"column":28},"end":{"row":57,"column":29},"action":"insert","lines":["i"],"id":1497}],[{"start":{"row":57,"column":29},"end":{"row":57,"column":30},"action":"insert","lines":["d"],"id":1498}],[{"start":{"row":57,"column":30},"end":{"row":57,"column":31},"action":"insert","lines":["d"],"id":1499}],[{"start":{"row":57,"column":31},"end":{"row":57,"column":32},"action":"insert","lines":["l"],"id":1500}],[{"start":{"row":57,"column":32},"end":{"row":57,"column":33},"action":"insert","lines":["e"],"id":1501}],[{"start":{"row":57,"column":33},"end":{"row":57,"column":34},"action":"insert","lines":["w"],"id":1502}],[{"start":{"row":57,"column":34},"end":{"row":57,"column":35},"action":"insert","lines":["a"],"id":1503}],[{"start":{"row":57,"column":35},"end":{"row":57,"column":36},"action":"insert","lines":["r"],"id":1504}],[{"start":{"row":57,"column":36},"end":{"row":57,"column":37},"action":"insert","lines":["e"],"id":1505}],[{"start":{"row":57,"column":37},"end":{"row":57,"column":38},"action":"insert","lines":[" "],"id":1506}],[{"start":{"row":57,"column":27},"end":{"row":57,"column":38},"action":"remove","lines":["middleware "],"id":1538}],[{"start":{"row":46,"column":32},"end":{"row":46,"column":43},"action":"remove","lines":["middleware."],"id":1539}],[{"start":{"row":19,"column":16},"end":{"row":19,"column":27},"action":"remove","lines":["middleware."],"id":1540}],[{"start":{"row":6,"column":19},"end":{"row":6,"column":30},"action":"remove","lines":["middleware."],"id":1541}],[{"start":{"row":6,"column":18},"end":{"row":6,"column":19},"action":"remove","lines":[" "],"id":1542}],[{"start":{"row":3,"column":43},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":1543}],[{"start":{"row":4,"column":0},"end":{"row":4,"column":42},"action":"insert","lines":["var middleware = require(\"../middleware\");"],"id":1544}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"insert","lines":["m"],"id":1545}],[{"start":{"row":7,"column":19},"end":{"row":7,"column":20},"action":"insert","lines":["i"],"id":1546}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"insert","lines":["d"],"id":1547}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["d"],"id":1548}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":22},"action":"remove","lines":["midd"],"id":1549},{"start":{"row":7,"column":18},"end":{"row":7,"column":28},"action":"insert","lines":["middleware"]}],[{"start":{"row":7,"column":28},"end":{"row":7,"column":29},"action":"insert","lines":["."],"id":1550}],[{"start":{"row":20,"column":16},"end":{"row":20,"column":27},"action":"insert","lines":["middleware."],"id":1551}],[{"start":{"row":47,"column":32},"end":{"row":47,"column":43},"action":"insert","lines":["middleware."],"id":1552}],[{"start":{"row":58,"column":27},"end":{"row":58,"column":38},"action":"insert","lines":["middleware."],"id":1553}],[{"start":{"row":69,"column":30},"end":{"row":69,"column":41},"action":"insert","lines":["middleware."],"id":1554}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":9,"column":27},"end":{"row":9,"column":27},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1446968649000,"hash":"7c0e533cec0fe28f7ac8f6ff59804b8ceadc7435"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/edit.ejs b/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/edit.ejs deleted file mode 100644 index d4fbe39c..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/edit.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"edit.ejs","tooltip":"/YelpCamp/v10/views/campgrounds/edit.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"insert","lines":[" "],"id":141}],[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"remove","lines":[" "],"id":142}],[{"start":{"row":3,"column":58},"end":{"row":3,"column":59},"action":"insert","lines":["."],"id":143}],[{"start":{"row":3,"column":59},"end":{"row":3,"column":60},"action":"insert","lines":["n"],"id":144}],[{"start":{"row":3,"column":60},"end":{"row":3,"column":61},"action":"insert","lines":["a"],"id":145}],[{"start":{"row":3,"column":61},"end":{"row":3,"column":62},"action":"insert","lines":["m"],"id":146}],[{"start":{"row":3,"column":62},"end":{"row":3,"column":63},"action":"insert","lines":["e"],"id":147}],[{"start":{"row":3,"column":63},"end":{"row":3,"column":64},"action":"insert","lines":[" "],"id":148}],[{"start":{"row":3,"column":63},"end":{"row":3,"column":64},"action":"remove","lines":[" "],"id":149}],[{"start":{"row":3,"column":63},"end":{"row":3,"column":64},"action":"insert","lines":[" "],"id":150}],[{"start":{"row":7,"column":75},"end":{"row":7,"column":90},"action":"remove","lines":["ceholder=\"name\""],"id":151}],[{"start":{"row":7,"column":74},"end":{"row":7,"column":75},"action":"remove","lines":["a"],"id":152}],[{"start":{"row":7,"column":73},"end":{"row":7,"column":74},"action":"remove","lines":["l"],"id":153}],[{"start":{"row":7,"column":72},"end":{"row":7,"column":73},"action":"remove","lines":["p"],"id":154}],[{"start":{"row":7,"column":72},"end":{"row":7,"column":73},"action":"insert","lines":["v"],"id":155}],[{"start":{"row":7,"column":73},"end":{"row":7,"column":74},"action":"insert","lines":["a"],"id":156}],[{"start":{"row":7,"column":74},"end":{"row":7,"column":75},"action":"insert","lines":["l"],"id":157}],[{"start":{"row":7,"column":75},"end":{"row":7,"column":76},"action":"insert","lines":["u"],"id":158}],[{"start":{"row":7,"column":76},"end":{"row":7,"column":77},"action":"insert","lines":["e"],"id":159}],[{"start":{"row":7,"column":77},"end":{"row":7,"column":78},"action":"insert","lines":[" "],"id":160}],[{"start":{"row":7,"column":77},"end":{"row":7,"column":78},"action":"remove","lines":[" "],"id":161}],[{"start":{"row":7,"column":77},"end":{"row":7,"column":78},"action":"insert","lines":["="],"id":162}],[{"start":{"row":7,"column":78},"end":{"row":7,"column":80},"action":"insert","lines":["\"\""],"id":163}],[{"start":{"row":7,"column":79},"end":{"row":7,"column":80},"action":"insert","lines":["<"],"id":164}],[{"start":{"row":7,"column":80},"end":{"row":7,"column":81},"action":"insert","lines":["%"],"id":165}],[{"start":{"row":7,"column":81},"end":{"row":7,"column":82},"action":"insert","lines":["="],"id":166}],[{"start":{"row":7,"column":82},"end":{"row":7,"column":83},"action":"insert","lines":[" "],"id":167}],[{"start":{"row":7,"column":83},"end":{"row":7,"column":84},"action":"insert","lines":["c"],"id":168}],[{"start":{"row":7,"column":84},"end":{"row":7,"column":85},"action":"insert","lines":["a"],"id":169}],[{"start":{"row":7,"column":85},"end":{"row":7,"column":86},"action":"insert","lines":["m"],"id":170}],[{"start":{"row":7,"column":86},"end":{"row":7,"column":87},"action":"insert","lines":["p"],"id":171}],[{"start":{"row":7,"column":87},"end":{"row":7,"column":88},"action":"insert","lines":["g"],"id":172}],[{"start":{"row":7,"column":88},"end":{"row":7,"column":89},"action":"insert","lines":["r"],"id":173}],[{"start":{"row":7,"column":89},"end":{"row":7,"column":90},"action":"insert","lines":["o"],"id":174}],[{"start":{"row":7,"column":90},"end":{"row":7,"column":91},"action":"insert","lines":["u"],"id":175}],[{"start":{"row":7,"column":91},"end":{"row":7,"column":92},"action":"insert","lines":["n"],"id":176}],[{"start":{"row":7,"column":92},"end":{"row":7,"column":93},"action":"insert","lines":["d"],"id":177}],[{"start":{"row":7,"column":93},"end":{"row":7,"column":94},"action":"insert","lines":[" "],"id":178}],[{"start":{"row":7,"column":93},"end":{"row":7,"column":94},"action":"remove","lines":[" "],"id":179}],[{"start":{"row":7,"column":93},"end":{"row":7,"column":94},"action":"insert","lines":["."],"id":180}],[{"start":{"row":7,"column":94},"end":{"row":7,"column":95},"action":"insert","lines":["n"],"id":181}],[{"start":{"row":7,"column":95},"end":{"row":7,"column":96},"action":"insert","lines":["a"],"id":182}],[{"start":{"row":7,"column":96},"end":{"row":7,"column":97},"action":"insert","lines":["m"],"id":183}],[{"start":{"row":7,"column":97},"end":{"row":7,"column":98},"action":"insert","lines":["e"],"id":184}],[{"start":{"row":7,"column":98},"end":{"row":7,"column":99},"action":"insert","lines":[" "],"id":185}],[{"start":{"row":7,"column":98},"end":{"row":7,"column":99},"action":"remove","lines":[" "],"id":186}],[{"start":{"row":7,"column":98},"end":{"row":7,"column":99},"action":"insert","lines":[" "],"id":187}],[{"start":{"row":7,"column":99},"end":{"row":7,"column":100},"action":"insert","lines":["%"],"id":188}],[{"start":{"row":7,"column":100},"end":{"row":7,"column":101},"action":"insert","lines":[">"],"id":189}],[{"start":{"row":10,"column":73},"end":{"row":10,"column":96},"action":"remove","lines":["placeholder=\"image url\""],"id":190}],[{"start":{"row":10,"column":73},"end":{"row":10,"column":103},"action":"insert","lines":["value=\"<%= campground.name %>\""],"id":191}],[{"start":{"row":10,"column":98},"end":{"row":10,"column":99},"action":"remove","lines":["e"],"id":192}],[{"start":{"row":10,"column":97},"end":{"row":10,"column":98},"action":"remove","lines":["m"],"id":193}],[{"start":{"row":10,"column":96},"end":{"row":10,"column":97},"action":"remove","lines":["a"],"id":194}],[{"start":{"row":10,"column":95},"end":{"row":10,"column":96},"action":"remove","lines":["n"],"id":195}],[{"start":{"row":10,"column":95},"end":{"row":10,"column":96},"action":"insert","lines":["i"],"id":196}],[{"start":{"row":10,"column":96},"end":{"row":10,"column":97},"action":"insert","lines":["m"],"id":197}],[{"start":{"row":10,"column":97},"end":{"row":10,"column":98},"action":"insert","lines":["a"],"id":198}],[{"start":{"row":10,"column":98},"end":{"row":10,"column":99},"action":"insert","lines":["g"],"id":199}],[{"start":{"row":10,"column":99},"end":{"row":10,"column":100},"action":"insert","lines":["e"],"id":200}],[{"start":{"row":13,"column":79},"end":{"row":13,"column":104},"action":"remove","lines":["placeholder=\"description\""],"id":201},{"start":{"row":13,"column":79},"end":{"row":13,"column":109},"action":"insert","lines":["value=\"<%= campground.name %>\""]}],[{"start":{"row":13,"column":101},"end":{"row":13,"column":105},"action":"remove","lines":["name"],"id":202}],[{"start":{"row":13,"column":101},"end":{"row":13,"column":102},"action":"insert","lines":["d"],"id":203}],[{"start":{"row":13,"column":102},"end":{"row":13,"column":103},"action":"insert","lines":["r"],"id":204}],[{"start":{"row":13,"column":102},"end":{"row":13,"column":103},"action":"remove","lines":["r"],"id":205}],[{"start":{"row":13,"column":102},"end":{"row":13,"column":103},"action":"insert","lines":["e"],"id":206}],[{"start":{"row":13,"column":103},"end":{"row":13,"column":104},"action":"insert","lines":["s"],"id":207}],[{"start":{"row":13,"column":104},"end":{"row":13,"column":105},"action":"insert","lines":["c"],"id":208}],[{"start":{"row":13,"column":105},"end":{"row":13,"column":106},"action":"insert","lines":["r"],"id":209}],[{"start":{"row":13,"column":106},"end":{"row":13,"column":107},"action":"insert","lines":["i"],"id":210}],[{"start":{"row":13,"column":107},"end":{"row":13,"column":108},"action":"insert","lines":["p"],"id":211}],[{"start":{"row":13,"column":108},"end":{"row":13,"column":109},"action":"insert","lines":["t"],"id":212}],[{"start":{"row":13,"column":109},"end":{"row":13,"column":110},"action":"insert","lines":["i"],"id":213}],[{"start":{"row":13,"column":110},"end":{"row":13,"column":111},"action":"insert","lines":["o"],"id":214}],[{"start":{"row":13,"column":111},"end":{"row":13,"column":112},"action":"insert","lines":["n"],"id":215}],[{"start":{"row":13,"column":112},"end":{"row":13,"column":113},"action":"insert","lines":[" "],"id":216}],[{"start":{"row":13,"column":112},"end":{"row":13,"column":113},"action":"remove","lines":[" "],"id":217}],[{"start":{"row":7,"column":66},"end":{"row":7,"column":67},"action":"insert","lines":["b"],"id":218}],[{"start":{"row":7,"column":67},"end":{"row":7,"column":68},"action":"insert","lines":["l"],"id":219}],[{"start":{"row":7,"column":67},"end":{"row":7,"column":68},"action":"remove","lines":["l"],"id":220}],[{"start":{"row":7,"column":66},"end":{"row":7,"column":67},"action":"remove","lines":["b"],"id":221}],[{"start":{"row":7,"column":66},"end":{"row":7,"column":67},"action":"insert","lines":["c"],"id":222}],[{"start":{"row":7,"column":67},"end":{"row":7,"column":68},"action":"insert","lines":["a"],"id":223}],[{"start":{"row":7,"column":68},"end":{"row":7,"column":69},"action":"insert","lines":["m"],"id":224}],[{"start":{"row":7,"column":69},"end":{"row":7,"column":70},"action":"insert","lines":["p"],"id":225}],[{"start":{"row":7,"column":70},"end":{"row":7,"column":71},"action":"insert","lines":["g"],"id":226}],[{"start":{"row":7,"column":71},"end":{"row":7,"column":72},"action":"insert","lines":["r"],"id":227}],[{"start":{"row":7,"column":72},"end":{"row":7,"column":73},"action":"insert","lines":["o"],"id":228}],[{"start":{"row":7,"column":73},"end":{"row":7,"column":74},"action":"insert","lines":["u"],"id":229}],[{"start":{"row":7,"column":74},"end":{"row":7,"column":75},"action":"insert","lines":["n"],"id":230}],[{"start":{"row":7,"column":75},"end":{"row":7,"column":76},"action":"insert","lines":["d"],"id":231}],[{"start":{"row":7,"column":76},"end":{"row":7,"column":77},"action":"insert","lines":[" "],"id":232}],[{"start":{"row":7,"column":76},"end":{"row":7,"column":77},"action":"remove","lines":[" "],"id":233}],[{"start":{"row":7,"column":76},"end":{"row":7,"column":77},"action":"insert","lines":["["],"id":234}],[{"start":{"row":7,"column":81},"end":{"row":7,"column":82},"action":"insert","lines":["]"],"id":235}],[{"start":{"row":10,"column":66},"end":{"row":10,"column":77},"action":"insert","lines":["campground["],"id":236}],[{"start":{"row":13,"column":66},"end":{"row":13,"column":77},"action":"insert","lines":["campground["],"id":237}],[{"start":{"row":10,"column":82},"end":{"row":10,"column":83},"action":"insert","lines":["]"],"id":238}],[{"start":{"row":13,"column":88},"end":{"row":13,"column":89},"action":"insert","lines":["]"],"id":239}],[{"start":{"row":5,"column":61},"end":{"row":5,"column":65},"action":"remove","lines":["edit"],"id":240}],[{"start":{"row":5,"column":60},"end":{"row":5,"column":61},"action":"remove","lines":["/"],"id":241}]]},"ace":{"folds":[],"scrolltop":51,"scrollleft":0,"selection":{"start":{"row":10,"column":53},"end":{"row":10,"column":53},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":79,"mode":"ace/mode/ejs"}},"timestamp":1446428550732,"hash":"b7cff7dd53485ed2411e7f39622a7f6dbc97a330"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/new.ejs b/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/new.ejs deleted file mode 100644 index e541af2c..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/new.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"new.ejs","tooltip":"/YelpCamp/v10/views/campgrounds/new.ejs","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":296.5,"scrollleft":0,"selection":{"start":{"row":25,"column":0},"end":{"row":25,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":1,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1446427977936,"hash":"2e55b7c51bbb7b76cc8b6f082aeedef06bb148c6"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/show.ejs b/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/show.ejs deleted file mode 100644 index a8761684..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/views/campgrounds/show.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"show.ejs","tooltip":"/YelpCamp/v10/views/campgrounds/show.ejs","ace":{"folds":[],"scrolltop":964,"scrollleft":84,"selection":{"start":{"row":48,"column":31},"end":{"row":48,"column":31},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"hash":"0c2d11573ebd4d1d67226d6fe7d22015b44386c3","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":45,"column":53},"end":{"row":45,"column":54},"action":"insert","lines":["c"],"id":309}],[{"start":{"row":45,"column":54},"end":{"row":45,"column":55},"action":"insert","lines":["l"],"id":310}],[{"start":{"row":45,"column":55},"end":{"row":45,"column":56},"action":"insert","lines":["a"],"id":311}],[{"start":{"row":45,"column":56},"end":{"row":45,"column":57},"action":"insert","lines":["s"],"id":312}],[{"start":{"row":45,"column":57},"end":{"row":45,"column":58},"action":"insert","lines":["s"],"id":313}],[{"start":{"row":45,"column":58},"end":{"row":45,"column":59},"action":"insert","lines":[" "],"id":314}],[{"start":{"row":45,"column":58},"end":{"row":45,"column":59},"action":"remove","lines":[" "],"id":315}],[{"start":{"row":45,"column":58},"end":{"row":45,"column":59},"action":"insert","lines":["="],"id":316}],[{"start":{"row":45,"column":59},"end":{"row":45,"column":61},"action":"insert","lines":["\"\""],"id":317}],[{"start":{"row":45,"column":60},"end":{"row":45,"column":61},"action":"insert","lines":["b"],"id":318}],[{"start":{"row":45,"column":61},"end":{"row":45,"column":62},"action":"insert","lines":["t"],"id":319}],[{"start":{"row":45,"column":62},"end":{"row":45,"column":63},"action":"insert","lines":["n"],"id":320}],[{"start":{"row":45,"column":63},"end":{"row":45,"column":64},"action":"insert","lines":[" "],"id":321}],[{"start":{"row":45,"column":63},"end":{"row":45,"column":64},"action":"remove","lines":[" "],"id":322}],[{"start":{"row":45,"column":63},"end":{"row":45,"column":64},"action":"insert","lines":[" "],"id":323}],[{"start":{"row":45,"column":64},"end":{"row":45,"column":65},"action":"insert","lines":["b"],"id":324}],[{"start":{"row":45,"column":65},"end":{"row":45,"column":66},"action":"insert","lines":["t"],"id":325}],[{"start":{"row":45,"column":66},"end":{"row":45,"column":67},"action":"insert","lines":["n"],"id":326}],[{"start":{"row":45,"column":67},"end":{"row":45,"column":68},"action":"insert","lines":[" "],"id":327}],[{"start":{"row":45,"column":67},"end":{"row":45,"column":68},"action":"remove","lines":[" "],"id":328}],[{"start":{"row":45,"column":67},"end":{"row":45,"column":68},"action":"insert","lines":["0"],"id":329},{"start":{"row":45,"column":68},"end":{"row":45,"column":69},"action":"insert","lines":["-"]}],[{"start":{"row":45,"column":69},"end":{"row":45,"column":70},"action":"insert","lines":["x"],"id":330}],[{"start":{"row":45,"column":69},"end":{"row":45,"column":70},"action":"remove","lines":["x"],"id":331}],[{"start":{"row":45,"column":68},"end":{"row":45,"column":69},"action":"remove","lines":["-"],"id":332}],[{"start":{"row":45,"column":67},"end":{"row":45,"column":68},"action":"remove","lines":["0"],"id":333}],[{"start":{"row":45,"column":67},"end":{"row":45,"column":68},"action":"insert","lines":["-"],"id":334}],[{"start":{"row":45,"column":68},"end":{"row":45,"column":69},"action":"insert","lines":["x"],"id":335}],[{"start":{"row":45,"column":69},"end":{"row":45,"column":70},"action":"insert","lines":["s"],"id":336}],[{"start":{"row":45,"column":70},"end":{"row":45,"column":71},"action":"insert","lines":[" "],"id":337}],[{"start":{"row":45,"column":70},"end":{"row":45,"column":71},"action":"remove","lines":[" "],"id":338}],[{"start":{"row":45,"column":70},"end":{"row":45,"column":71},"action":"insert","lines":[" "],"id":339}],[{"start":{"row":45,"column":71},"end":{"row":45,"column":72},"action":"insert","lines":["b"],"id":340}],[{"start":{"row":45,"column":72},"end":{"row":45,"column":73},"action":"insert","lines":["t"],"id":341}],[{"start":{"row":45,"column":73},"end":{"row":45,"column":74},"action":"insert","lines":["n"],"id":342}],[{"start":{"row":45,"column":74},"end":{"row":45,"column":75},"action":"insert","lines":[" "],"id":343}],[{"start":{"row":45,"column":74},"end":{"row":45,"column":75},"action":"remove","lines":[" "],"id":344}],[{"start":{"row":45,"column":74},"end":{"row":45,"column":75},"action":"insert","lines":["-"],"id":345}],[{"start":{"row":45,"column":75},"end":{"row":45,"column":76},"action":"insert","lines":["d"],"id":346}],[{"start":{"row":45,"column":76},"end":{"row":45,"column":77},"action":"insert","lines":["a"],"id":347}],[{"start":{"row":45,"column":77},"end":{"row":45,"column":78},"action":"insert","lines":["n"],"id":348}],[{"start":{"row":45,"column":78},"end":{"row":45,"column":79},"action":"insert","lines":["g"],"id":349}],[{"start":{"row":45,"column":79},"end":{"row":45,"column":80},"action":"insert","lines":["e"],"id":350}],[{"start":{"row":45,"column":80},"end":{"row":45,"column":81},"action":"insert","lines":["r"],"id":351}],[{"start":{"row":45,"column":81},"end":{"row":45,"column":82},"action":"insert","lines":[" "],"id":352}],[{"start":{"row":45,"column":81},"end":{"row":45,"column":82},"action":"remove","lines":[" "],"id":353}],[{"start":{"row":45,"column":82},"end":{"row":45,"column":83},"action":"insert","lines":[" "],"id":354}],[{"start":{"row":45,"column":83},"end":{"row":45,"column":84},"action":"insert","lines":["v"],"id":355}],[{"start":{"row":45,"column":84},"end":{"row":45,"column":85},"action":"insert","lines":["a"],"id":356}],[{"start":{"row":45,"column":85},"end":{"row":45,"column":86},"action":"insert","lines":["l"],"id":357}],[{"start":{"row":45,"column":86},"end":{"row":45,"column":87},"action":"insert","lines":["u"],"id":358}],[{"start":{"row":45,"column":87},"end":{"row":45,"column":88},"action":"insert","lines":["e"],"id":359}],[{"start":{"row":45,"column":88},"end":{"row":45,"column":89},"action":"insert","lines":[" "],"id":360}],[{"start":{"row":45,"column":88},"end":{"row":45,"column":89},"action":"remove","lines":[" "],"id":361}],[{"start":{"row":45,"column":88},"end":{"row":45,"column":89},"action":"insert","lines":["="],"id":362}],[{"start":{"row":45,"column":89},"end":{"row":45,"column":91},"action":"insert","lines":["\"\""],"id":363}],[{"start":{"row":45,"column":90},"end":{"row":45,"column":91},"action":"insert","lines":["D"],"id":364}],[{"start":{"row":45,"column":91},"end":{"row":45,"column":92},"action":"insert","lines":["e"],"id":365}],[{"start":{"row":45,"column":92},"end":{"row":45,"column":93},"action":"insert","lines":["l"],"id":366}],[{"start":{"row":45,"column":93},"end":{"row":45,"column":94},"action":"insert","lines":["e"],"id":367}],[{"start":{"row":45,"column":94},"end":{"row":45,"column":95},"action":"insert","lines":["t"],"id":368}],[{"start":{"row":45,"column":95},"end":{"row":45,"column":96},"action":"insert","lines":["e"],"id":369}],[{"start":{"row":45,"column":96},"end":{"row":45,"column":97},"action":"insert","lines":[" "],"id":370}],[{"start":{"row":45,"column":96},"end":{"row":45,"column":97},"action":"remove","lines":[" "],"id":371}],[{"start":{"row":44,"column":34},"end":{"row":44,"column":35},"action":"insert","lines":["i"],"id":372}],[{"start":{"row":44,"column":35},"end":{"row":44,"column":36},"action":"insert","lines":["d"],"id":373}],[{"start":{"row":44,"column":36},"end":{"row":44,"column":37},"action":"insert","lines":[" "],"id":374}],[{"start":{"row":44,"column":36},"end":{"row":44,"column":37},"action":"remove","lines":[" "],"id":375}],[{"start":{"row":44,"column":36},"end":{"row":44,"column":37},"action":"insert","lines":["="],"id":376}],[{"start":{"row":44,"column":37},"end":{"row":44,"column":38},"action":"insert","lines":["\""],"id":377}],[{"start":{"row":44,"column":38},"end":{"row":44,"column":49},"action":"insert","lines":["delete-form"],"id":378}],[{"start":{"row":44,"column":49},"end":{"row":44,"column":50},"action":"insert","lines":[" "],"id":379}],[{"start":{"row":44,"column":49},"end":{"row":44,"column":50},"action":"remove","lines":[" "],"id":380}],[{"start":{"row":44,"column":49},"end":{"row":44,"column":50},"action":"insert","lines":["\""],"id":381}],[{"start":{"row":44,"column":50},"end":{"row":44,"column":51},"action":"insert","lines":[" "],"id":382}],[{"start":{"row":41,"column":32},"end":{"row":42,"column":0},"action":"insert","lines":["",""],"id":383},{"start":{"row":42,"column":0},"end":{"row":42,"column":28},"action":"insert","lines":[" "]}],[{"start":{"row":42,"column":28},"end":{"row":42,"column":99},"action":"insert","lines":[" <% if(currentUser && campground.author.id.equals(currentUser._id)){ %>"],"id":384}],[{"start":{"row":42,"column":28},"end":{"row":42,"column":29},"action":"remove","lines":[" "],"id":385}],[{"start":{"row":42,"column":24},"end":{"row":42,"column":28},"action":"remove","lines":[" "],"id":386}],[{"start":{"row":42,"column":20},"end":{"row":42,"column":24},"action":"remove","lines":[" "],"id":387}],[{"start":{"row":42,"column":20},"end":{"row":42,"column":24},"action":"insert","lines":[" "],"id":388}],[{"start":{"row":42,"column":45},"end":{"row":42,"column":55},"action":"remove","lines":["campground"],"id":389}],[{"start":{"row":42,"column":45},"end":{"row":42,"column":46},"action":"insert","lines":["c"],"id":390}],[{"start":{"row":42,"column":46},"end":{"row":42,"column":47},"action":"insert","lines":["o"],"id":391}],[{"start":{"row":42,"column":47},"end":{"row":42,"column":48},"action":"insert","lines":["m"],"id":392}],[{"start":{"row":42,"column":48},"end":{"row":42,"column":49},"action":"insert","lines":["m"],"id":393}],[{"start":{"row":42,"column":49},"end":{"row":42,"column":50},"action":"insert","lines":["e"],"id":394}],[{"start":{"row":42,"column":50},"end":{"row":42,"column":51},"action":"insert","lines":["n"],"id":395}],[{"start":{"row":42,"column":51},"end":{"row":42,"column":52},"action":"insert","lines":["t"],"id":396}],[{"start":{"row":47,"column":35},"end":{"row":48,"column":0},"action":"insert","lines":["",""],"id":398},{"start":{"row":48,"column":0},"end":{"row":48,"column":28},"action":"insert","lines":[" "]}],[{"start":{"row":48,"column":28},"end":{"row":48,"column":29},"action":"insert","lines":["<"],"id":399}],[{"start":{"row":48,"column":29},"end":{"row":48,"column":30},"action":"insert","lines":["%"],"id":400}],[{"start":{"row":48,"column":30},"end":{"row":48,"column":31},"action":"insert","lines":[" "],"id":401}],[{"start":{"row":48,"column":31},"end":{"row":48,"column":32},"action":"insert","lines":["}"],"id":402}],[{"start":{"row":48,"column":32},"end":{"row":48,"column":33},"action":"insert","lines":[" "],"id":403}],[{"start":{"row":48,"column":33},"end":{"row":48,"column":34},"action":"insert","lines":["5"],"id":404}],[{"start":{"row":48,"column":33},"end":{"row":48,"column":34},"action":"remove","lines":["5"],"id":405}],[{"start":{"row":48,"column":33},"end":{"row":48,"column":34},"action":"insert","lines":["%"],"id":406}],[{"start":{"row":48,"column":34},"end":{"row":48,"column":35},"action":"insert","lines":[","],"id":407}],[{"start":{"row":48,"column":34},"end":{"row":48,"column":35},"action":"remove","lines":[","],"id":408}],[{"start":{"row":48,"column":34},"end":{"row":48,"column":35},"action":"insert","lines":[">"],"id":409}],[{"start":{"row":48,"column":24},"end":{"row":48,"column":28},"action":"remove","lines":[" "],"id":410}]]},"timestamp":1446967691000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/views/comments/edit.ejs b/.c9/metadata/workspace/YelpCamp/v10/views/comments/edit.ejs deleted file mode 100644 index 0cefd481..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/views/comments/edit.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"edit.ejs","tooltip":"/YelpCamp/v10/views/comments/edit.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":5,"column":79},"end":{"row":5,"column":80},"action":"insert","lines":["n"],"id":23}],[{"start":{"row":5,"column":80},"end":{"row":5,"column":81},"action":"insert","lines":["t"],"id":24}],[{"start":{"row":5,"column":81},"end":{"row":5,"column":82},"action":"insert","lines":[" "],"id":25}],[{"start":{"row":5,"column":81},"end":{"row":5,"column":82},"action":"remove","lines":[" "],"id":26}],[{"start":{"row":5,"column":81},"end":{"row":5,"column":82},"action":"insert","lines":["."],"id":27}],[{"start":{"row":5,"column":82},"end":{"row":5,"column":83},"action":"insert","lines":["_"],"id":28}],[{"start":{"row":5,"column":83},"end":{"row":5,"column":84},"action":"insert","lines":["i"],"id":29}],[{"start":{"row":5,"column":84},"end":{"row":5,"column":85},"action":"insert","lines":["d"],"id":30}],[{"start":{"row":5,"column":85},"end":{"row":5,"column":86},"action":"insert","lines":[" "],"id":31}],[{"start":{"row":5,"column":85},"end":{"row":5,"column":86},"action":"remove","lines":[" "],"id":32}],[{"start":{"row":5,"column":88},"end":{"row":5,"column":89},"action":"insert","lines":["?"],"id":33}],[{"start":{"row":5,"column":89},"end":{"row":5,"column":90},"action":"insert","lines":["_"],"id":34}],[{"start":{"row":5,"column":90},"end":{"row":5,"column":91},"action":"insert","lines":["m"],"id":35}],[{"start":{"row":5,"column":91},"end":{"row":5,"column":92},"action":"insert","lines":["e"],"id":36}],[{"start":{"row":5,"column":92},"end":{"row":5,"column":93},"action":"insert","lines":["t"],"id":37}],[{"start":{"row":5,"column":93},"end":{"row":5,"column":94},"action":"insert","lines":["h"],"id":38}],[{"start":{"row":5,"column":94},"end":{"row":5,"column":95},"action":"insert","lines":["o"],"id":39}],[{"start":{"row":5,"column":95},"end":{"row":5,"column":96},"action":"insert","lines":["d"],"id":40}],[{"start":{"row":5,"column":96},"end":{"row":5,"column":97},"action":"insert","lines":[" "],"id":41}],[{"start":{"row":5,"column":96},"end":{"row":5,"column":97},"action":"remove","lines":[" "],"id":42}],[{"start":{"row":5,"column":96},"end":{"row":5,"column":97},"action":"insert","lines":["-"],"id":43}],[{"start":{"row":5,"column":96},"end":{"row":5,"column":97},"action":"remove","lines":["-"],"id":44}],[{"start":{"row":5,"column":96},"end":{"row":5,"column":97},"action":"insert","lines":["="],"id":45}],[{"start":{"row":5,"column":97},"end":{"row":5,"column":98},"action":"insert","lines":["P"],"id":46}],[{"start":{"row":5,"column":98},"end":{"row":5,"column":99},"action":"insert","lines":["U"],"id":47}],[{"start":{"row":5,"column":99},"end":{"row":5,"column":100},"action":"insert","lines":["T"],"id":48}],[{"start":{"row":5,"column":100},"end":{"row":5,"column":101},"action":"insert","lines":[" "],"id":49}],[{"start":{"row":5,"column":100},"end":{"row":5,"column":101},"action":"remove","lines":[" "],"id":50}],[{"start":{"row":7,"column":81},"end":{"row":7,"column":99},"action":"remove","lines":["placeholder=\"text\""],"id":51},{"start":{"row":7,"column":81},"end":{"row":7,"column":82},"action":"insert","lines":["p"]}],[{"start":{"row":7,"column":82},"end":{"row":7,"column":83},"action":"insert","lines":["l"],"id":52}],[{"start":{"row":7,"column":83},"end":{"row":7,"column":84},"action":"insert","lines":["a"],"id":53}],[{"start":{"row":7,"column":83},"end":{"row":7,"column":84},"action":"remove","lines":["a"],"id":54}],[{"start":{"row":7,"column":82},"end":{"row":7,"column":83},"action":"remove","lines":["l"],"id":55}],[{"start":{"row":7,"column":81},"end":{"row":7,"column":82},"action":"remove","lines":["p"],"id":56}],[{"start":{"row":7,"column":81},"end":{"row":7,"column":82},"action":"insert","lines":["v"],"id":57}],[{"start":{"row":7,"column":82},"end":{"row":7,"column":83},"action":"insert","lines":["a"],"id":58}],[{"start":{"row":7,"column":83},"end":{"row":7,"column":84},"action":"insert","lines":["l"],"id":59}],[{"start":{"row":7,"column":84},"end":{"row":7,"column":85},"action":"insert","lines":["u"],"id":60}],[{"start":{"row":7,"column":85},"end":{"row":7,"column":86},"action":"insert","lines":["e"],"id":61}],[{"start":{"row":7,"column":86},"end":{"row":7,"column":87},"action":"insert","lines":[" "],"id":62}],[{"start":{"row":7,"column":86},"end":{"row":7,"column":87},"action":"remove","lines":[" "],"id":63}],[{"start":{"row":7,"column":86},"end":{"row":7,"column":87},"action":"insert","lines":["="],"id":64}],[{"start":{"row":7,"column":87},"end":{"row":7,"column":89},"action":"insert","lines":["\"\""],"id":65}],[{"start":{"row":7,"column":88},"end":{"row":7,"column":89},"action":"insert","lines":["<"],"id":66}],[{"start":{"row":7,"column":89},"end":{"row":7,"column":90},"action":"insert","lines":["%"],"id":67}],[{"start":{"row":7,"column":90},"end":{"row":7,"column":91},"action":"insert","lines":["="],"id":68}],[{"start":{"row":7,"column":91},"end":{"row":7,"column":92},"action":"insert","lines":[" "],"id":69}],[{"start":{"row":7,"column":92},"end":{"row":7,"column":93},"action":"insert","lines":["%"],"id":70}],[{"start":{"row":7,"column":93},"end":{"row":7,"column":94},"action":"insert","lines":[">"],"id":71}],[{"start":{"row":7,"column":91},"end":{"row":7,"column":92},"action":"insert","lines":["c"],"id":72}],[{"start":{"row":7,"column":92},"end":{"row":7,"column":93},"action":"insert","lines":["a"],"id":73}],[{"start":{"row":7,"column":92},"end":{"row":7,"column":93},"action":"remove","lines":["a"],"id":74}],[{"start":{"row":7,"column":91},"end":{"row":7,"column":92},"action":"remove","lines":["c"],"id":75}],[{"start":{"row":7,"column":91},"end":{"row":7,"column":92},"action":"insert","lines":[" "],"id":76}],[{"start":{"row":7,"column":92},"end":{"row":7,"column":93},"action":"insert","lines":["c"],"id":77}],[{"start":{"row":7,"column":93},"end":{"row":7,"column":94},"action":"insert","lines":["o"],"id":78}],[{"start":{"row":7,"column":94},"end":{"row":7,"column":95},"action":"insert","lines":["m"],"id":79}],[{"start":{"row":7,"column":95},"end":{"row":7,"column":96},"action":"insert","lines":["m"],"id":80}],[{"start":{"row":7,"column":96},"end":{"row":7,"column":97},"action":"insert","lines":["e"],"id":81}],[{"start":{"row":7,"column":97},"end":{"row":7,"column":98},"action":"insert","lines":["n"],"id":82}],[{"start":{"row":7,"column":98},"end":{"row":7,"column":99},"action":"insert","lines":["t"],"id":83}],[{"start":{"row":7,"column":99},"end":{"row":7,"column":100},"action":"insert","lines":[" "],"id":84}],[{"start":{"row":7,"column":99},"end":{"row":7,"column":100},"action":"remove","lines":[" "],"id":85}],[{"start":{"row":7,"column":99},"end":{"row":7,"column":100},"action":"insert","lines":["."],"id":86}],[{"start":{"row":7,"column":100},"end":{"row":7,"column":101},"action":"insert","lines":["t"],"id":87}],[{"start":{"row":7,"column":101},"end":{"row":7,"column":102},"action":"insert","lines":["e"],"id":88}],[{"start":{"row":7,"column":102},"end":{"row":7,"column":103},"action":"insert","lines":["x"],"id":89}],[{"start":{"row":7,"column":103},"end":{"row":7,"column":104},"action":"insert","lines":["t"],"id":90}],[{"start":{"row":7,"column":104},"end":{"row":7,"column":105},"action":"insert","lines":[" "],"id":91}],[{"start":{"row":7,"column":104},"end":{"row":7,"column":105},"action":"remove","lines":[" "],"id":92}],[{"start":{"row":5,"column":44},"end":{"row":5,"column":57},"action":"remove","lines":["ampground._id"],"id":93}],[{"start":{"row":5,"column":44},"end":{"row":5,"column":45},"action":"insert","lines":["a"],"id":94}],[{"start":{"row":5,"column":45},"end":{"row":5,"column":46},"action":"insert","lines":["m"],"id":95}],[{"start":{"row":5,"column":46},"end":{"row":5,"column":47},"action":"insert","lines":["p"],"id":96}],[{"start":{"row":5,"column":47},"end":{"row":5,"column":48},"action":"insert","lines":["g"],"id":97}],[{"start":{"row":5,"column":48},"end":{"row":5,"column":49},"action":"insert","lines":["r"],"id":98}],[{"start":{"row":5,"column":49},"end":{"row":5,"column":50},"action":"insert","lines":["o"],"id":99}],[{"start":{"row":5,"column":50},"end":{"row":5,"column":51},"action":"insert","lines":["u"],"id":100}],[{"start":{"row":5,"column":51},"end":{"row":5,"column":52},"action":"insert","lines":["n"],"id":101}],[{"start":{"row":5,"column":52},"end":{"row":5,"column":53},"action":"insert","lines":["d"],"id":102}],[{"start":{"row":5,"column":53},"end":{"row":5,"column":54},"action":"insert","lines":[" "],"id":103}],[{"start":{"row":5,"column":53},"end":{"row":5,"column":54},"action":"remove","lines":[" "],"id":104}],[{"start":{"row":5,"column":53},"end":{"row":5,"column":54},"action":"insert","lines":["_"],"id":105}],[{"start":{"row":5,"column":54},"end":{"row":5,"column":55},"action":"insert","lines":["i"],"id":106}],[{"start":{"row":5,"column":55},"end":{"row":5,"column":56},"action":"insert","lines":["d"],"id":107}],[{"start":{"row":3,"column":44},"end":{"row":3,"column":66},"action":"remove","lines":["<%= campground.name %>"],"id":108}],[{"start":{"row":3,"column":43},"end":{"row":3,"column":44},"action":"remove","lines":[" "],"id":109}],[{"start":{"row":3,"column":43},"end":{"row":3,"column":44},"action":"insert","lines":[" "],"id":110}],[{"start":{"row":3,"column":44},"end":{"row":3,"column":45},"action":"insert","lines":["C"],"id":111}],[{"start":{"row":3,"column":45},"end":{"row":3,"column":46},"action":"insert","lines":["i"],"id":112}],[{"start":{"row":3,"column":46},"end":{"row":3,"column":47},"action":"insert","lines":["n"],"id":113}],[{"start":{"row":3,"column":46},"end":{"row":3,"column":47},"action":"remove","lines":["n"],"id":114}],[{"start":{"row":3,"column":45},"end":{"row":3,"column":46},"action":"remove","lines":["i"],"id":115}],[{"start":{"row":3,"column":45},"end":{"row":3,"column":46},"action":"insert","lines":["o"],"id":116}],[{"start":{"row":3,"column":46},"end":{"row":3,"column":47},"action":"insert","lines":["m"],"id":117}],[{"start":{"row":3,"column":47},"end":{"row":3,"column":48},"action":"insert","lines":["m"],"id":118}],[{"start":{"row":3,"column":48},"end":{"row":3,"column":49},"action":"insert","lines":["e"],"id":119}],[{"start":{"row":3,"column":49},"end":{"row":3,"column":50},"action":"insert","lines":["n"],"id":120}],[{"start":{"row":3,"column":50},"end":{"row":3,"column":51},"action":"insert","lines":["t"],"id":121}],[{"start":{"row":3,"column":51},"end":{"row":3,"column":52},"action":"insert","lines":[" "],"id":122}],[{"start":{"row":3,"column":51},"end":{"row":3,"column":52},"action":"remove","lines":[" "],"id":123}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":186,"selection":{"start":{"row":7,"column":74},"end":{"row":7,"column":79},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1446965570870,"hash":"b58d29784a8a69727dda66e8c1c55d4061934bb6"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v10/views/comments/new.ejs b/.c9/metadata/workspace/YelpCamp/v10/views/comments/new.ejs deleted file mode 100644 index 86a867e0..00000000 --- a/.c9/metadata/workspace/YelpCamp/v10/views/comments/new.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"new.ejs","tooltip":"/YelpCamp/v10/views/comments/new.ejs","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":6,"column":40},"end":{"row":6,"column":40},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1446965244387,"hash":"c55c8775fc213dee946d6fe2d8bed817186a29c7"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/app.js b/.c9/metadata/workspace/YelpCamp/v11/app.js deleted file mode 100644 index 55e538f6..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v11/app.js","ace":{"folds":[],"scrolltop":965.5,"scrollleft":0,"selection":{"start":{"row":40,"column":0},"end":{"row":41,"column":45},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":21,"state":"start","mode":"ace/mode/javascript"}},"hash":"3f369bf66ef1254131ce019698c4173db4079d7b","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"insert","lines":["e"],"id":38}],[{"start":{"row":4,"column":32},"end":{"row":4,"column":33},"action":"insert","lines":["c"],"id":39}],[{"start":{"row":4,"column":33},"end":{"row":4,"column":34},"action":"insert","lines":["t"],"id":40}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":[" "],"id":41}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"remove","lines":[" "],"id":42}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":["-"],"id":43}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"insert","lines":["f"],"id":44}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"insert","lines":["l"],"id":45}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":["a"],"id":46}],[{"start":{"row":4,"column":38},"end":{"row":4,"column":39},"action":"insert","lines":["s"],"id":47}],[{"start":{"row":4,"column":39},"end":{"row":4,"column":40},"action":"insert","lines":["h"],"id":48}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":[" "],"id":49}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"remove","lines":[" "],"id":50}],[{"start":{"row":4,"column":42},"end":{"row":4,"column":43},"action":"insert","lines":[","],"id":51}],[{"start":{"row":22,"column":35},"end":{"row":23,"column":0},"action":"insert","lines":["",""],"id":52}],[{"start":{"row":23,"column":0},"end":{"row":23,"column":1},"action":"insert","lines":["a"],"id":53}],[{"start":{"row":23,"column":1},"end":{"row":23,"column":3},"action":"insert","lines":["[]"],"id":54}],[{"start":{"row":23,"column":2},"end":{"row":23,"column":4},"action":"insert","lines":["[]"],"id":55}],[{"start":{"row":23,"column":2},"end":{"row":23,"column":4},"action":"remove","lines":["[]"],"id":56}],[{"start":{"row":23,"column":1},"end":{"row":23,"column":3},"action":"remove","lines":["[]"],"id":57}],[{"start":{"row":23,"column":1},"end":{"row":23,"column":3},"action":"insert","lines":["[]"],"id":58}],[{"start":{"row":23,"column":1},"end":{"row":23,"column":3},"action":"remove","lines":["[]"],"id":59}],[{"start":{"row":23,"column":1},"end":{"row":23,"column":2},"action":"insert","lines":["p"],"id":60}],[{"start":{"row":23,"column":2},"end":{"row":23,"column":3},"action":"insert","lines":["p"],"id":61}],[{"start":{"row":23,"column":3},"end":{"row":23,"column":4},"action":"insert","lines":["."],"id":62}],[{"start":{"row":23,"column":4},"end":{"row":23,"column":5},"action":"insert","lines":["u"],"id":63}],[{"start":{"row":23,"column":5},"end":{"row":23,"column":6},"action":"insert","lines":["s"],"id":64}],[{"start":{"row":23,"column":6},"end":{"row":23,"column":7},"action":"insert","lines":["e"],"id":65}],[{"start":{"row":23,"column":7},"end":{"row":23,"column":8},"action":"insert","lines":[" "],"id":66}],[{"start":{"row":23,"column":7},"end":{"row":23,"column":8},"action":"remove","lines":[" "],"id":67}],[{"start":{"row":23,"column":7},"end":{"row":23,"column":9},"action":"insert","lines":["()"],"id":68}],[{"start":{"row":23,"column":8},"end":{"row":23,"column":9},"action":"insert","lines":["f"],"id":69}],[{"start":{"row":23,"column":9},"end":{"row":23,"column":10},"action":"insert","lines":["l"],"id":70}],[{"start":{"row":23,"column":10},"end":{"row":23,"column":11},"action":"insert","lines":["a"],"id":71}],[{"start":{"row":23,"column":11},"end":{"row":23,"column":12},"action":"insert","lines":["s"],"id":72}],[{"start":{"row":23,"column":12},"end":{"row":23,"column":13},"action":"insert","lines":["h"],"id":73}],[{"start":{"row":23,"column":13},"end":{"row":23,"column":14},"action":"insert","lines":[" "],"id":74}],[{"start":{"row":23,"column":13},"end":{"row":23,"column":14},"action":"remove","lines":[" "],"id":75}],[{"start":{"row":23,"column":13},"end":{"row":23,"column":15},"action":"insert","lines":["()"],"id":76}],[{"start":{"row":23,"column":16},"end":{"row":23,"column":17},"action":"insert","lines":[";"],"id":77}],[{"start":{"row":39,"column":37},"end":{"row":40,"column":0},"action":"insert","lines":["",""],"id":78},{"start":{"row":40,"column":0},"end":{"row":40,"column":3},"action":"insert","lines":[" "]}],[{"start":{"row":40,"column":3},"end":{"row":40,"column":30},"action":"insert","lines":["message: req.flash(\"error\")"],"id":79}],[{"start":{"row":40,"column":3},"end":{"row":40,"column":4},"action":"insert","lines":["r"],"id":80}],[{"start":{"row":40,"column":4},"end":{"row":40,"column":5},"action":"insert","lines":["e"],"id":81}],[{"start":{"row":40,"column":5},"end":{"row":40,"column":6},"action":"insert","lines":["s"],"id":82}],[{"start":{"row":40,"column":6},"end":{"row":40,"column":7},"action":"insert","lines":[" "],"id":83}],[{"start":{"row":40,"column":6},"end":{"row":40,"column":7},"action":"remove","lines":[" "],"id":84}],[{"start":{"row":40,"column":6},"end":{"row":40,"column":7},"action":"insert","lines":["."],"id":85}],[{"start":{"row":40,"column":7},"end":{"row":40,"column":8},"action":"insert","lines":["l"],"id":86}],[{"start":{"row":40,"column":8},"end":{"row":40,"column":9},"action":"insert","lines":["o"],"id":87}],[{"start":{"row":40,"column":9},"end":{"row":40,"column":10},"action":"insert","lines":["c"],"id":88}],[{"start":{"row":40,"column":10},"end":{"row":40,"column":11},"action":"insert","lines":["a"],"id":89}],[{"start":{"row":40,"column":11},"end":{"row":40,"column":12},"action":"insert","lines":["l"],"id":90}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":13},"action":"insert","lines":["s"],"id":91}],[{"start":{"row":40,"column":13},"end":{"row":40,"column":14},"action":"insert","lines":[" "],"id":92}],[{"start":{"row":40,"column":13},"end":{"row":40,"column":14},"action":"remove","lines":[" "],"id":93}],[{"start":{"row":40,"column":13},"end":{"row":40,"column":14},"action":"insert","lines":["."],"id":94}],[{"start":{"row":40,"column":22},"end":{"row":40,"column":23},"action":"remove","lines":[" "],"id":95}],[{"start":{"row":40,"column":21},"end":{"row":40,"column":22},"action":"remove","lines":[":"],"id":96}],[{"start":{"row":40,"column":21},"end":{"row":40,"column":22},"action":"insert","lines":[" "],"id":97}],[{"start":{"row":40,"column":22},"end":{"row":40,"column":23},"action":"insert","lines":["="],"id":98}],[{"start":{"row":40,"column":23},"end":{"row":40,"column":24},"action":"insert","lines":[" "],"id":99}],[{"start":{"row":40,"column":42},"end":{"row":40,"column":43},"action":"insert","lines":[";"],"id":100}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":21},"action":"remove","lines":["essage"],"id":101}],[{"start":{"row":40,"column":14},"end":{"row":40,"column":15},"action":"remove","lines":["m"],"id":102}],[{"start":{"row":40,"column":14},"end":{"row":40,"column":15},"action":"insert","lines":["e"],"id":103}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":16},"action":"insert","lines":["r"],"id":104}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":16},"action":"remove","lines":["r"],"id":105}],[{"start":{"row":40,"column":14},"end":{"row":40,"column":15},"action":"remove","lines":["e"],"id":106}],[{"start":{"row":40,"column":14},"end":{"row":40,"column":15},"action":"insert","lines":["e"],"id":107}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":16},"action":"insert","lines":["r"],"id":108}],[{"start":{"row":40,"column":16},"end":{"row":40,"column":17},"action":"insert","lines":["r"],"id":109}],[{"start":{"row":40,"column":17},"end":{"row":40,"column":18},"action":"insert","lines":["o"],"id":110}],[{"start":{"row":40,"column":18},"end":{"row":40,"column":19},"action":"insert","lines":["r"],"id":111}],[{"start":{"row":40,"column":19},"end":{"row":40,"column":20},"action":"insert","lines":[" "],"id":112}],[{"start":{"row":40,"column":19},"end":{"row":40,"column":20},"action":"remove","lines":[" "],"id":113}],[{"start":{"row":41,"column":0},"end":{"row":42,"column":0},"action":"insert","lines":[" res.locals.error = req.flash(\"error\");",""],"id":114}],[{"start":{"row":41,"column":16},"end":{"row":41,"column":19},"action":"remove","lines":["ror"],"id":115}],[{"start":{"row":41,"column":15},"end":{"row":41,"column":16},"action":"remove","lines":["r"],"id":116}],[{"start":{"row":41,"column":14},"end":{"row":41,"column":15},"action":"remove","lines":["e"],"id":117}],[{"start":{"row":41,"column":14},"end":{"row":41,"column":15},"action":"insert","lines":["s"],"id":118}],[{"start":{"row":41,"column":15},"end":{"row":41,"column":16},"action":"insert","lines":["u"],"id":119}],[{"start":{"row":41,"column":16},"end":{"row":41,"column":17},"action":"insert","lines":["c"],"id":120}],[{"start":{"row":41,"column":17},"end":{"row":41,"column":18},"action":"insert","lines":["c"],"id":121}],[{"start":{"row":41,"column":18},"end":{"row":41,"column":19},"action":"insert","lines":["e"],"id":122}],[{"start":{"row":41,"column":19},"end":{"row":41,"column":20},"action":"insert","lines":["s"],"id":123}],[{"start":{"row":41,"column":20},"end":{"row":41,"column":21},"action":"insert","lines":["s"],"id":124}],[{"start":{"row":41,"column":21},"end":{"row":41,"column":22},"action":"insert","lines":[" "],"id":125}],[{"start":{"row":41,"column":21},"end":{"row":41,"column":22},"action":"remove","lines":[" "],"id":126}],[{"start":{"row":41,"column":39},"end":{"row":41,"column":40},"action":"remove","lines":["r"],"id":127}],[{"start":{"row":41,"column":38},"end":{"row":41,"column":39},"action":"remove","lines":["o"],"id":128}],[{"start":{"row":41,"column":37},"end":{"row":41,"column":38},"action":"remove","lines":["r"],"id":129}],[{"start":{"row":41,"column":36},"end":{"row":41,"column":37},"action":"remove","lines":["r"],"id":130}],[{"start":{"row":41,"column":35},"end":{"row":41,"column":36},"action":"remove","lines":["e"],"id":131}],[{"start":{"row":41,"column":35},"end":{"row":41,"column":36},"action":"insert","lines":["s"],"id":132}],[{"start":{"row":41,"column":36},"end":{"row":41,"column":37},"action":"insert","lines":["u"],"id":133}],[{"start":{"row":41,"column":37},"end":{"row":41,"column":38},"action":"insert","lines":["c"],"id":134}],[{"start":{"row":41,"column":38},"end":{"row":41,"column":39},"action":"insert","lines":["c"],"id":135}],[{"start":{"row":41,"column":39},"end":{"row":41,"column":40},"action":"insert","lines":["e"],"id":136}],[{"start":{"row":41,"column":40},"end":{"row":41,"column":41},"action":"insert","lines":["s"],"id":137}],[{"start":{"row":41,"column":41},"end":{"row":41,"column":42},"action":"insert","lines":["s"],"id":138}]]},"timestamp":1447309749000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/middleware/index.js b/.c9/metadata/workspace/YelpCamp/v11/middleware/index.js deleted file mode 100644 index c0a426c6..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/middleware/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/YelpCamp/v11/middleware/index.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":17,"column":67},"end":{"row":17,"column":68},"action":"insert","lines":["o"],"id":333}],[{"start":{"row":17,"column":68},"end":{"row":17,"column":69},"action":"insert","lines":[" "],"id":334}],[{"start":{"row":17,"column":69},"end":{"row":17,"column":70},"action":"insert","lines":["t"],"id":335}],[{"start":{"row":17,"column":70},"end":{"row":17,"column":71},"action":"insert","lines":["h"],"id":336}],[{"start":{"row":17,"column":71},"end":{"row":17,"column":72},"action":"insert","lines":["a"],"id":337}],[{"start":{"row":17,"column":72},"end":{"row":17,"column":73},"action":"insert","lines":["t"],"id":338}],[{"start":{"row":17,"column":73},"end":{"row":17,"column":74},"action":"insert","lines":[" "],"id":339}],[{"start":{"row":17,"column":73},"end":{"row":17,"column":74},"action":"remove","lines":[" "],"id":340}],[{"start":{"row":17,"column":46},"end":{"row":17,"column":47},"action":"remove","lines":[" "],"id":341}],[{"start":{"row":42,"column":12},"end":{"row":43,"column":0},"action":"insert","lines":["",""],"id":342},{"start":{"row":43,"column":0},"end":{"row":43,"column":8},"action":"insert","lines":[" "]}],[{"start":{"row":43,"column":8},"end":{"row":43,"column":51},"action":"insert","lines":["req.flash(\"error\", \"Campground not found\");"],"id":343}],[{"start":{"row":43,"column":29},"end":{"row":43,"column":48},"action":"remove","lines":["ampground not found"],"id":344}],[{"start":{"row":43,"column":28},"end":{"row":43,"column":29},"action":"remove","lines":["C"],"id":345}],[{"start":{"row":43,"column":28},"end":{"row":43,"column":29},"action":"insert","lines":["Y"],"id":346}],[{"start":{"row":43,"column":29},"end":{"row":43,"column":30},"action":"insert","lines":["o"],"id":347}],[{"start":{"row":43,"column":30},"end":{"row":43,"column":31},"action":"insert","lines":["u"],"id":348}],[{"start":{"row":43,"column":31},"end":{"row":43,"column":32},"action":"insert","lines":[" "],"id":349}],[{"start":{"row":43,"column":32},"end":{"row":43,"column":33},"action":"insert","lines":["n"],"id":350}],[{"start":{"row":43,"column":33},"end":{"row":43,"column":34},"action":"insert","lines":["e"],"id":351}],[{"start":{"row":43,"column":34},"end":{"row":43,"column":35},"action":"insert","lines":["e"],"id":352}],[{"start":{"row":43,"column":35},"end":{"row":43,"column":36},"action":"insert","lines":["d"],"id":353}],[{"start":{"row":43,"column":36},"end":{"row":43,"column":37},"action":"insert","lines":[" "],"id":354}],[{"start":{"row":43,"column":37},"end":{"row":43,"column":38},"action":"insert","lines":["t"],"id":355}],[{"start":{"row":43,"column":38},"end":{"row":43,"column":39},"action":"insert","lines":["o"],"id":356}],[{"start":{"row":43,"column":39},"end":{"row":43,"column":40},"action":"insert","lines":[" "],"id":357}],[{"start":{"row":43,"column":40},"end":{"row":43,"column":41},"action":"insert","lines":["b"],"id":358}],[{"start":{"row":43,"column":41},"end":{"row":43,"column":42},"action":"insert","lines":["e"],"id":359}],[{"start":{"row":43,"column":42},"end":{"row":43,"column":43},"action":"insert","lines":[" "],"id":360}],[{"start":{"row":43,"column":43},"end":{"row":43,"column":44},"action":"insert","lines":["l"],"id":361}],[{"start":{"row":43,"column":44},"end":{"row":43,"column":45},"action":"insert","lines":["o"],"id":362}],[{"start":{"row":43,"column":45},"end":{"row":43,"column":46},"action":"insert","lines":["g"],"id":363}],[{"start":{"row":43,"column":46},"end":{"row":43,"column":47},"action":"insert","lines":["g"],"id":364}],[{"start":{"row":43,"column":47},"end":{"row":43,"column":48},"action":"insert","lines":["e"],"id":365}],[{"start":{"row":43,"column":48},"end":{"row":43,"column":49},"action":"insert","lines":["d"],"id":366}],[{"start":{"row":43,"column":49},"end":{"row":43,"column":50},"action":"insert","lines":[" "],"id":367}],[{"start":{"row":43,"column":50},"end":{"row":43,"column":51},"action":"insert","lines":["i"],"id":368}],[{"start":{"row":43,"column":51},"end":{"row":43,"column":52},"action":"insert","lines":["n"],"id":369}],[{"start":{"row":43,"column":52},"end":{"row":43,"column":53},"action":"insert","lines":[" "],"id":370}],[{"start":{"row":43,"column":53},"end":{"row":43,"column":54},"action":"insert","lines":["t"],"id":371}],[{"start":{"row":43,"column":54},"end":{"row":43,"column":55},"action":"insert","lines":["o"],"id":372}],[{"start":{"row":43,"column":55},"end":{"row":43,"column":56},"action":"insert","lines":[" "],"id":373}],[{"start":{"row":43,"column":56},"end":{"row":43,"column":57},"action":"insert","lines":["d"],"id":374}],[{"start":{"row":43,"column":57},"end":{"row":43,"column":58},"action":"insert","lines":["o"],"id":375}],[{"start":{"row":43,"column":58},"end":{"row":43,"column":59},"action":"insert","lines":[" "],"id":376}],[{"start":{"row":43,"column":59},"end":{"row":43,"column":60},"action":"insert","lines":["t"],"id":377}],[{"start":{"row":43,"column":60},"end":{"row":43,"column":61},"action":"insert","lines":["h"],"id":378}],[{"start":{"row":43,"column":61},"end":{"row":43,"column":62},"action":"insert","lines":["a"],"id":379}],[{"start":{"row":43,"column":62},"end":{"row":43,"column":63},"action":"insert","lines":["t"],"id":380}],[{"start":{"row":43,"column":63},"end":{"row":43,"column":64},"action":"insert","lines":[" "],"id":381}],[{"start":{"row":43,"column":63},"end":{"row":43,"column":64},"action":"remove","lines":[" "],"id":382}],[{"start":{"row":37,"column":20},"end":{"row":38,"column":0},"action":"insert","lines":["",""],"id":383},{"start":{"row":38,"column":0},"end":{"row":38,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":38,"column":16},"end":{"row":38,"column":59},"action":"insert","lines":["req.flash(\"error\", \"Campground not found\");"],"id":384}],[{"start":{"row":38,"column":36},"end":{"row":38,"column":56},"action":"remove","lines":["Campground not found"],"id":385}],[{"start":{"row":38,"column":36},"end":{"row":38,"column":37},"action":"insert","lines":["Y"],"id":386}],[{"start":{"row":38,"column":37},"end":{"row":38,"column":38},"action":"insert","lines":["o"],"id":387}],[{"start":{"row":38,"column":38},"end":{"row":38,"column":39},"action":"insert","lines":["u"],"id":388}],[{"start":{"row":38,"column":39},"end":{"row":38,"column":40},"action":"insert","lines":[" "],"id":389}],[{"start":{"row":38,"column":40},"end":{"row":38,"column":41},"action":"insert","lines":["d"],"id":390}],[{"start":{"row":38,"column":41},"end":{"row":38,"column":42},"action":"insert","lines":["o"],"id":391}],[{"start":{"row":38,"column":42},"end":{"row":38,"column":43},"action":"insert","lines":["n"],"id":392}],[{"start":{"row":38,"column":43},"end":{"row":38,"column":44},"action":"insert","lines":["'"],"id":393}],[{"start":{"row":38,"column":44},"end":{"row":38,"column":45},"action":"insert","lines":["t"],"id":394}],[{"start":{"row":38,"column":45},"end":{"row":38,"column":46},"action":"insert","lines":[" "],"id":395}],[{"start":{"row":38,"column":46},"end":{"row":38,"column":47},"action":"insert","lines":["h"],"id":396}],[{"start":{"row":38,"column":47},"end":{"row":38,"column":48},"action":"insert","lines":["a"],"id":397}],[{"start":{"row":38,"column":48},"end":{"row":38,"column":49},"action":"insert","lines":["v"],"id":398}],[{"start":{"row":38,"column":49},"end":{"row":38,"column":50},"action":"insert","lines":["e"],"id":399}],[{"start":{"row":38,"column":50},"end":{"row":38,"column":51},"action":"insert","lines":[" "],"id":400}],[{"start":{"row":38,"column":51},"end":{"row":38,"column":52},"action":"insert","lines":["p"],"id":401}],[{"start":{"row":38,"column":52},"end":{"row":38,"column":53},"action":"insert","lines":["e"],"id":402}],[{"start":{"row":38,"column":53},"end":{"row":38,"column":54},"action":"insert","lines":["r"],"id":403}],[{"start":{"row":38,"column":54},"end":{"row":38,"column":55},"action":"insert","lines":["s"],"id":404}],[{"start":{"row":38,"column":55},"end":{"row":38,"column":56},"action":"insert","lines":["m"],"id":405}],[{"start":{"row":38,"column":56},"end":{"row":38,"column":57},"action":"insert","lines":["i"],"id":406}],[{"start":{"row":38,"column":56},"end":{"row":38,"column":57},"action":"remove","lines":["i"],"id":407}],[{"start":{"row":38,"column":55},"end":{"row":38,"column":56},"action":"remove","lines":["m"],"id":408}],[{"start":{"row":38,"column":55},"end":{"row":38,"column":56},"action":"insert","lines":["m"],"id":409}],[{"start":{"row":38,"column":55},"end":{"row":38,"column":56},"action":"remove","lines":["m"],"id":410}],[{"start":{"row":38,"column":54},"end":{"row":38,"column":55},"action":"remove","lines":["s"],"id":411}],[{"start":{"row":38,"column":54},"end":{"row":38,"column":55},"action":"insert","lines":["m"],"id":412}],[{"start":{"row":38,"column":55},"end":{"row":38,"column":56},"action":"insert","lines":["s"],"id":413}],[{"start":{"row":38,"column":55},"end":{"row":38,"column":56},"action":"remove","lines":["s"],"id":414}],[{"start":{"row":38,"column":55},"end":{"row":38,"column":56},"action":"insert","lines":["i"],"id":415}],[{"start":{"row":38,"column":56},"end":{"row":38,"column":57},"action":"insert","lines":["s"],"id":416}],[{"start":{"row":38,"column":57},"end":{"row":38,"column":58},"action":"insert","lines":["s"],"id":417}],[{"start":{"row":38,"column":58},"end":{"row":38,"column":59},"action":"insert","lines":["i"],"id":418}],[{"start":{"row":38,"column":59},"end":{"row":38,"column":60},"action":"insert","lines":["o"],"id":419}],[{"start":{"row":38,"column":60},"end":{"row":38,"column":61},"action":"insert","lines":["n"],"id":420}],[{"start":{"row":38,"column":61},"end":{"row":38,"column":62},"action":"insert","lines":[" "],"id":421}],[{"start":{"row":38,"column":62},"end":{"row":38,"column":63},"action":"insert","lines":["t"],"id":422}],[{"start":{"row":38,"column":63},"end":{"row":38,"column":64},"action":"insert","lines":["o"],"id":423}],[{"start":{"row":38,"column":64},"end":{"row":38,"column":65},"action":"insert","lines":[" "],"id":424}],[{"start":{"row":38,"column":65},"end":{"row":38,"column":66},"action":"insert","lines":["d"],"id":425}],[{"start":{"row":38,"column":66},"end":{"row":38,"column":67},"action":"insert","lines":["o"],"id":426}],[{"start":{"row":38,"column":67},"end":{"row":38,"column":68},"action":"insert","lines":[" "],"id":427}],[{"start":{"row":38,"column":68},"end":{"row":38,"column":69},"action":"insert","lines":["t"],"id":428}],[{"start":{"row":38,"column":69},"end":{"row":38,"column":70},"action":"insert","lines":["h"],"id":429}],[{"start":{"row":38,"column":70},"end":{"row":38,"column":71},"action":"insert","lines":["a"],"id":430}],[{"start":{"row":38,"column":71},"end":{"row":38,"column":72},"action":"insert","lines":["t"],"id":431}],[{"start":{"row":38,"column":72},"end":{"row":38,"column":73},"action":"insert","lines":[" "],"id":432}],[{"start":{"row":38,"column":72},"end":{"row":38,"column":73},"action":"remove","lines":[" "],"id":433}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":18,"column":37},"end":{"row":18,"column":37},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1447311178265,"hash":"61d73efcc243c3658ba7ca8dd292cf549cc2afd7"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/readme.md b/.c9/metadata/workspace/YelpCamp/v11/readme.md deleted file mode 100644 index 08a5e4a9..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v11/readme.md","ace":{"folds":[],"scrolltop":3257,"scrollleft":0,"selection":{"start":{"row":133,"column":0},"end":{"row":134,"column":0},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":124,"state":"start","mode":"ace/mode/markdown"}},"hash":"8747cf19d7d8ec0ea15ff46b04a40452afe34a86","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":132,"column":27},"end":{"row":132,"column":28},"action":"remove","lines":["s"],"id":133}],[{"start":{"row":132,"column":26},"end":{"row":132,"column":27},"action":"remove","lines":["a"],"id":134}],[{"start":{"row":132,"column":25},"end":{"row":132,"column":26},"action":"remove","lines":["l"],"id":135}],[{"start":{"row":132,"column":24},"end":{"row":132,"column":25},"action":"remove","lines":["f"],"id":136}],[{"start":{"row":132,"column":24},"end":{"row":132,"column":25},"action":"insert","lines":["c"],"id":137}],[{"start":{"row":132,"column":25},"end":{"row":132,"column":26},"action":"insert","lines":["o"],"id":138}],[{"start":{"row":132,"column":26},"end":{"row":132,"column":27},"action":"insert","lines":["n"],"id":139}],[{"start":{"row":132,"column":27},"end":{"row":132,"column":28},"action":"insert","lines":["n"],"id":140}],[{"start":{"row":132,"column":28},"end":{"row":132,"column":29},"action":"insert","lines":["e"],"id":141}],[{"start":{"row":132,"column":29},"end":{"row":132,"column":30},"action":"insert","lines":["c"],"id":142}],[{"start":{"row":132,"column":30},"end":{"row":132,"column":31},"action":"insert","lines":["t"],"id":143}],[{"start":{"row":132,"column":31},"end":{"row":132,"column":32},"action":"insert","lines":["-"],"id":144}],[{"start":{"row":132,"column":32},"end":{"row":132,"column":33},"action":"insert","lines":["f"],"id":145}],[{"start":{"row":132,"column":33},"end":{"row":132,"column":34},"action":"insert","lines":["l"],"id":146}],[{"start":{"row":132,"column":34},"end":{"row":132,"column":35},"action":"insert","lines":["a"],"id":147}],[{"start":{"row":132,"column":35},"end":{"row":132,"column":36},"action":"insert","lines":["s"],"id":148}],[{"start":{"row":132,"column":36},"end":{"row":132,"column":37},"action":"insert","lines":["h"],"id":149}],[{"start":{"row":132,"column":37},"end":{"row":132,"column":38},"action":"insert","lines":[" "],"id":150}],[{"start":{"row":132,"column":37},"end":{"row":132,"column":38},"action":"remove","lines":[" "],"id":151}],[{"start":{"row":132,"column":37},"end":{"row":133,"column":0},"action":"insert","lines":["",""],"id":152},{"start":{"row":133,"column":0},"end":{"row":133,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":133,"column":2},"end":{"row":133,"column":3},"action":"insert","lines":["A"],"id":153}],[{"start":{"row":133,"column":3},"end":{"row":133,"column":4},"action":"insert","lines":["d"],"id":154}],[{"start":{"row":133,"column":4},"end":{"row":133,"column":5},"action":"insert","lines":["d"],"id":155}],[{"start":{"row":133,"column":5},"end":{"row":133,"column":6},"action":"insert","lines":[" "],"id":156}],[{"start":{"row":133,"column":5},"end":{"row":133,"column":6},"action":"remove","lines":[" "],"id":157}],[{"start":{"row":133,"column":4},"end":{"row":133,"column":5},"action":"remove","lines":["d"],"id":158}],[{"start":{"row":133,"column":3},"end":{"row":133,"column":4},"action":"remove","lines":["d"],"id":159}],[{"start":{"row":133,"column":2},"end":{"row":133,"column":3},"action":"remove","lines":["A"],"id":160}],[{"start":{"row":133,"column":2},"end":{"row":133,"column":3},"action":"insert","lines":["A"],"id":161}],[{"start":{"row":133,"column":3},"end":{"row":133,"column":4},"action":"insert","lines":["d"],"id":162}],[{"start":{"row":133,"column":4},"end":{"row":133,"column":5},"action":"insert","lines":["d"],"id":163}],[{"start":{"row":133,"column":5},"end":{"row":133,"column":6},"action":"insert","lines":[" "],"id":164}],[{"start":{"row":133,"column":5},"end":{"row":133,"column":6},"action":"remove","lines":[" "],"id":165}],[{"start":{"row":133,"column":5},"end":{"row":134,"column":0},"action":"insert","lines":["",""],"id":166},{"start":{"row":134,"column":0},"end":{"row":134,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":134,"column":2},"end":{"row":135,"column":0},"action":"insert","lines":["",""],"id":167}],[{"start":{"row":134,"column":2},"end":{"row":135,"column":0},"action":"remove","lines":["",""],"id":168}],[{"start":{"row":134,"column":1},"end":{"row":134,"column":2},"action":"remove","lines":[" "],"id":169}],[{"start":{"row":134,"column":0},"end":{"row":134,"column":1},"action":"remove","lines":["*"],"id":170}],[{"start":{"row":134,"column":0},"end":{"row":135,"column":0},"action":"insert","lines":["",""],"id":171}],[{"start":{"row":133,"column":4},"end":{"row":133,"column":5},"action":"remove","lines":["d"],"id":172}],[{"start":{"row":133,"column":3},"end":{"row":133,"column":4},"action":"remove","lines":["d"],"id":173}],[{"start":{"row":133,"column":2},"end":{"row":133,"column":3},"action":"remove","lines":["A"],"id":174}],[{"start":{"row":133,"column":2},"end":{"row":133,"column":3},"action":"insert","lines":["A"],"id":175}],[{"start":{"row":133,"column":3},"end":{"row":133,"column":4},"action":"insert","lines":["d"],"id":176}],[{"start":{"row":133,"column":4},"end":{"row":133,"column":5},"action":"insert","lines":["d"],"id":177}],[{"start":{"row":133,"column":5},"end":{"row":133,"column":6},"action":"insert","lines":[" "],"id":178}],[{"start":{"row":133,"column":5},"end":{"row":133,"column":6},"action":"remove","lines":[" "],"id":179}],[{"start":{"row":133,"column":5},"end":{"row":133,"column":6},"action":"insert","lines":[" "],"id":180}],[{"start":{"row":133,"column":6},"end":{"row":133,"column":7},"action":"insert","lines":["b"],"id":181}],[{"start":{"row":133,"column":7},"end":{"row":133,"column":8},"action":"insert","lines":["o"],"id":182}],[{"start":{"row":133,"column":8},"end":{"row":133,"column":9},"action":"insert","lines":["o"],"id":183}],[{"start":{"row":133,"column":9},"end":{"row":133,"column":10},"action":"insert","lines":["t"],"id":184}],[{"start":{"row":133,"column":10},"end":{"row":133,"column":11},"action":"insert","lines":["s"],"id":185}],[{"start":{"row":133,"column":11},"end":{"row":133,"column":12},"action":"insert","lines":["t"],"id":186}],[{"start":{"row":133,"column":12},"end":{"row":133,"column":13},"action":"insert","lines":["r"],"id":187}],[{"start":{"row":133,"column":13},"end":{"row":133,"column":14},"action":"insert","lines":["a"],"id":188}],[{"start":{"row":133,"column":14},"end":{"row":133,"column":15},"action":"insert","lines":["p"],"id":189}],[{"start":{"row":133,"column":15},"end":{"row":133,"column":16},"action":"insert","lines":[" "],"id":190}],[{"start":{"row":133,"column":15},"end":{"row":133,"column":16},"action":"remove","lines":[" "],"id":191}],[{"start":{"row":133,"column":15},"end":{"row":133,"column":16},"action":"insert","lines":[" "],"id":192}],[{"start":{"row":133,"column":16},"end":{"row":133,"column":17},"action":"insert","lines":["m"],"id":193}],[{"start":{"row":133,"column":17},"end":{"row":133,"column":18},"action":"insert","lines":["e"],"id":194}],[{"start":{"row":133,"column":18},"end":{"row":133,"column":19},"action":"insert","lines":["a"],"id":195}],[{"start":{"row":133,"column":19},"end":{"row":133,"column":20},"action":"insert","lines":["s"],"id":196}],[{"start":{"row":133,"column":19},"end":{"row":133,"column":20},"action":"remove","lines":["s"],"id":197}],[{"start":{"row":133,"column":18},"end":{"row":133,"column":19},"action":"remove","lines":["a"],"id":198}],[{"start":{"row":133,"column":18},"end":{"row":133,"column":19},"action":"insert","lines":["s"],"id":199}],[{"start":{"row":133,"column":19},"end":{"row":133,"column":20},"action":"insert","lines":["s"],"id":200}],[{"start":{"row":133,"column":20},"end":{"row":133,"column":21},"action":"insert","lines":["a"],"id":201}],[{"start":{"row":133,"column":20},"end":{"row":133,"column":21},"action":"remove","lines":["a"],"id":202}],[{"start":{"row":133,"column":19},"end":{"row":133,"column":20},"action":"remove","lines":["s"],"id":203}],[{"start":{"row":133,"column":18},"end":{"row":133,"column":19},"action":"remove","lines":["s"],"id":204}],[{"start":{"row":133,"column":17},"end":{"row":133,"column":18},"action":"remove","lines":["e"],"id":205}],[{"start":{"row":133,"column":16},"end":{"row":133,"column":17},"action":"remove","lines":["m"],"id":206}],[{"start":{"row":133,"column":16},"end":{"row":133,"column":17},"action":"insert","lines":["a"],"id":207}],[{"start":{"row":133,"column":17},"end":{"row":133,"column":18},"action":"insert","lines":["l"],"id":208}],[{"start":{"row":133,"column":18},"end":{"row":133,"column":19},"action":"insert","lines":["e"],"id":209}],[{"start":{"row":133,"column":19},"end":{"row":133,"column":20},"action":"insert","lines":["r"],"id":210}],[{"start":{"row":133,"column":20},"end":{"row":133,"column":21},"action":"insert","lines":["t"],"id":211}],[{"start":{"row":133,"column":21},"end":{"row":133,"column":22},"action":"insert","lines":["s"],"id":212}],[{"start":{"row":133,"column":22},"end":{"row":133,"column":23},"action":"insert","lines":[" "],"id":213}],[{"start":{"row":133,"column":23},"end":{"row":133,"column":24},"action":"insert","lines":["t"],"id":214}],[{"start":{"row":133,"column":24},"end":{"row":133,"column":25},"action":"insert","lines":["o"],"id":215}],[{"start":{"row":133,"column":25},"end":{"row":133,"column":26},"action":"insert","lines":[" "],"id":216}],[{"start":{"row":133,"column":26},"end":{"row":133,"column":27},"action":"insert","lines":["h"],"id":217}],[{"start":{"row":133,"column":27},"end":{"row":133,"column":28},"action":"insert","lines":["e"],"id":218}],[{"start":{"row":133,"column":28},"end":{"row":133,"column":29},"action":"insert","lines":["a"],"id":219}],[{"start":{"row":133,"column":29},"end":{"row":133,"column":30},"action":"insert","lines":["d"],"id":220}],[{"start":{"row":133,"column":30},"end":{"row":133,"column":31},"action":"insert","lines":["e"],"id":221}],[{"start":{"row":133,"column":31},"end":{"row":133,"column":32},"action":"insert","lines":["r"],"id":222}],[{"start":{"row":133,"column":32},"end":{"row":133,"column":33},"action":"insert","lines":[" "],"id":223}],[{"start":{"row":133,"column":32},"end":{"row":133,"column":33},"action":"remove","lines":[" "],"id":224}],[{"start":{"row":135,"column":0},"end":{"row":136,"column":0},"action":"insert","lines":["",""],"id":225}],[{"start":{"row":136,"column":0},"end":{"row":137,"column":0},"action":"insert","lines":["",""],"id":226}],[{"start":{"row":137,"column":0},"end":{"row":138,"column":0},"action":"insert","lines":["",""],"id":227}],[{"start":{"row":139,"column":0},"end":{"row":148,"column":0},"action":"remove","lines":["* BOOTSTRAP NAV COLLPASE JS","* Flash Messages","* Refactor container div to header","* Show/hide delete and update buttons","* style login/register forms","* Random Background Landing Page","* Refactor middleware","* change styling in show template - comment delete/update","* UPDATE/DELETE CAMPGROUND",""],"id":228}],[{"start":{"row":139,"column":0},"end":{"row":140,"column":0},"action":"remove","lines":["",""],"id":229}],[{"start":{"row":138,"column":0},"end":{"row":139,"column":0},"action":"remove","lines":["",""],"id":230}],[{"start":{"row":137,"column":0},"end":{"row":138,"column":0},"action":"remove","lines":["",""],"id":231}],[{"start":{"row":136,"column":0},"end":{"row":137,"column":0},"action":"remove","lines":["",""],"id":232}],[{"start":{"row":135,"column":0},"end":{"row":136,"column":0},"action":"remove","lines":["",""],"id":233}]]},"timestamp":1447306946000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/routes/campgrounds.js b/.c9/metadata/workspace/YelpCamp/v11/routes/campgrounds.js deleted file mode 100644 index d53598b2..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/routes/campgrounds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campgrounds.js","tooltip":"/YelpCamp/v11/routes/campgrounds.js","undoManager":{"mark":14,"position":14,"stack":[[{"start":{"row":62,"column":70},"end":{"row":63,"column":0},"action":"insert","lines":["",""],"id":2},{"start":{"row":63,"column":0},"end":{"row":63,"column":8},"action":"insert","lines":[" "]}],[{"start":{"row":63,"column":8},"end":{"row":63,"column":9},"action":"insert","lines":["i"],"id":4}],[{"start":{"row":63,"column":9},"end":{"row":63,"column":10},"action":"insert","lines":["f"],"id":5}],[{"start":{"row":63,"column":10},"end":{"row":63,"column":11},"action":"insert","lines":[" "],"id":6}],[{"start":{"row":63,"column":10},"end":{"row":63,"column":11},"action":"remove","lines":[" "],"id":7}],[{"start":{"row":63,"column":10},"end":{"row":63,"column":12},"action":"insert","lines":["()"],"id":8}],[{"start":{"row":63,"column":11},"end":{"row":63,"column":12},"action":"insert","lines":["e"],"id":9}],[{"start":{"row":63,"column":12},"end":{"row":63,"column":13},"action":"insert","lines":["r"],"id":10}],[{"start":{"row":63,"column":13},"end":{"row":63,"column":14},"action":"insert","lines":["r"],"id":11}],[{"start":{"row":63,"column":14},"end":{"row":63,"column":15},"action":"insert","lines":[" "],"id":12}],[{"start":{"row":63,"column":14},"end":{"row":63,"column":15},"action":"remove","lines":[" "],"id":13}],[{"start":{"row":63,"column":15},"end":{"row":63,"column":16},"action":"insert","lines":["{"],"id":14}],[{"start":{"row":63,"column":16},"end":{"row":65,"column":9},"action":"insert","lines":[""," "," }"],"id":15}],[{"start":{"row":63,"column":0},"end":{"row":65,"column":9},"action":"remove","lines":[" if(err){"," "," }"],"id":16}],[{"start":{"row":62,"column":70},"end":{"row":63,"column":0},"action":"remove","lines":["",""],"id":17}]]},"ace":{"folds":[],"scrolltop":1490.5,"scrollleft":0,"selection":{"start":{"row":88,"column":6},"end":{"row":88,"column":6},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":56,"state":"no_regex","mode":"ace/mode/javascript"}},"timestamp":1447310657126,"hash":"0c16c488539fc138237d6a7636ed78eadd1a1a19"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/routes/comments.js b/.c9/metadata/workspace/YelpCamp/v11/routes/comments.js deleted file mode 100644 index e4390e04..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/routes/comments.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comments.js","tooltip":"/YelpCamp/v11/routes/comments.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":29,"column":43},"end":{"row":29,"column":44},"action":"insert","lines":["g"],"id":15}],[{"start":{"row":29,"column":44},"end":{"row":29,"column":45},"action":"insert","lines":[" "],"id":16}],[{"start":{"row":29,"column":45},"end":{"row":29,"column":46},"action":"insert","lines":["w"],"id":17}],[{"start":{"row":29,"column":46},"end":{"row":29,"column":47},"action":"insert","lines":["n"],"id":18}],[{"start":{"row":29,"column":46},"end":{"row":29,"column":47},"action":"remove","lines":["n"],"id":19}],[{"start":{"row":29,"column":46},"end":{"row":29,"column":47},"action":"insert","lines":["e"],"id":20}],[{"start":{"row":29,"column":47},"end":{"row":29,"column":48},"action":"insert","lines":["n"],"id":21}],[{"start":{"row":29,"column":48},"end":{"row":29,"column":49},"action":"insert","lines":["t"],"id":22}],[{"start":{"row":29,"column":49},"end":{"row":29,"column":50},"action":"insert","lines":[" "],"id":23}],[{"start":{"row":29,"column":50},"end":{"row":29,"column":51},"action":"insert","lines":["w"],"id":24}],[{"start":{"row":29,"column":51},"end":{"row":29,"column":52},"action":"insert","lines":["r"],"id":25}],[{"start":{"row":29,"column":52},"end":{"row":29,"column":53},"action":"insert","lines":["o"],"id":26}],[{"start":{"row":29,"column":53},"end":{"row":29,"column":54},"action":"insert","lines":["g"],"id":27}],[{"start":{"row":29,"column":54},"end":{"row":29,"column":55},"action":"insert","lines":[" "],"id":28}],[{"start":{"row":29,"column":54},"end":{"row":29,"column":55},"action":"remove","lines":[" "],"id":29}],[{"start":{"row":29,"column":53},"end":{"row":29,"column":54},"action":"remove","lines":["g"],"id":30}],[{"start":{"row":29,"column":53},"end":{"row":29,"column":54},"action":"insert","lines":["n"],"id":31}],[{"start":{"row":29,"column":54},"end":{"row":29,"column":55},"action":"insert","lines":["g"],"id":32}],[{"start":{"row":39,"column":36},"end":{"row":40,"column":0},"action":"insert","lines":["",""],"id":33},{"start":{"row":40,"column":0},"end":{"row":40,"column":15},"action":"insert","lines":[" "]}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":58},"action":"insert","lines":["req.flash(\"error\", \"Campground not found\");"],"id":34}],[{"start":{"row":40,"column":30},"end":{"row":40,"column":31},"action":"remove","lines":["r"],"id":35}],[{"start":{"row":40,"column":29},"end":{"row":40,"column":30},"action":"remove","lines":["o"],"id":36}],[{"start":{"row":40,"column":28},"end":{"row":40,"column":29},"action":"remove","lines":["r"],"id":37}],[{"start":{"row":40,"column":27},"end":{"row":40,"column":28},"action":"remove","lines":["r"],"id":38}],[{"start":{"row":40,"column":26},"end":{"row":40,"column":27},"action":"remove","lines":["e"],"id":39}],[{"start":{"row":40,"column":26},"end":{"row":40,"column":27},"action":"insert","lines":["s"],"id":40}],[{"start":{"row":40,"column":27},"end":{"row":40,"column":28},"action":"insert","lines":["u"],"id":41}],[{"start":{"row":40,"column":28},"end":{"row":40,"column":29},"action":"insert","lines":["c"],"id":42}],[{"start":{"row":40,"column":29},"end":{"row":40,"column":30},"action":"insert","lines":["c"],"id":43}],[{"start":{"row":40,"column":30},"end":{"row":40,"column":31},"action":"insert","lines":["e"],"id":44}],[{"start":{"row":40,"column":31},"end":{"row":40,"column":32},"action":"insert","lines":["s"],"id":45}],[{"start":{"row":40,"column":32},"end":{"row":40,"column":33},"action":"insert","lines":["s"],"id":46}],[{"start":{"row":40,"column":37},"end":{"row":40,"column":57},"action":"remove","lines":["Campground not found"],"id":47}],[{"start":{"row":40,"column":37},"end":{"row":40,"column":38},"action":"insert","lines":["U"],"id":48}],[{"start":{"row":40,"column":37},"end":{"row":40,"column":38},"action":"remove","lines":["U"],"id":49}],[{"start":{"row":40,"column":37},"end":{"row":40,"column":38},"action":"insert","lines":["U"],"id":50}],[{"start":{"row":40,"column":38},"end":{"row":40,"column":39},"action":"insert","lines":["S"],"id":51}],[{"start":{"row":40,"column":39},"end":{"row":40,"column":40},"action":"insert","lines":["s"],"id":52}],[{"start":{"row":40,"column":39},"end":{"row":40,"column":40},"action":"remove","lines":["s"],"id":53}],[{"start":{"row":40,"column":38},"end":{"row":40,"column":39},"action":"remove","lines":["S"],"id":54}],[{"start":{"row":40,"column":37},"end":{"row":40,"column":38},"action":"remove","lines":["U"],"id":55}],[{"start":{"row":40,"column":37},"end":{"row":40,"column":38},"action":"insert","lines":["S"],"id":56}],[{"start":{"row":40,"column":38},"end":{"row":40,"column":39},"action":"insert","lines":["u"],"id":57}],[{"start":{"row":40,"column":39},"end":{"row":40,"column":40},"action":"insert","lines":["c"],"id":58}],[{"start":{"row":40,"column":40},"end":{"row":40,"column":41},"action":"insert","lines":["c"],"id":59}],[{"start":{"row":40,"column":41},"end":{"row":40,"column":42},"action":"insert","lines":["e"],"id":60}],[{"start":{"row":40,"column":42},"end":{"row":40,"column":43},"action":"insert","lines":["s"],"id":61}],[{"start":{"row":40,"column":43},"end":{"row":40,"column":44},"action":"insert","lines":["s"],"id":62}],[{"start":{"row":40,"column":44},"end":{"row":40,"column":45},"action":"insert","lines":["f"],"id":63}],[{"start":{"row":40,"column":45},"end":{"row":40,"column":46},"action":"insert","lines":["u"],"id":64}],[{"start":{"row":40,"column":46},"end":{"row":40,"column":47},"action":"insert","lines":["l"],"id":65}],[{"start":{"row":40,"column":47},"end":{"row":40,"column":48},"action":"insert","lines":["l"],"id":66}],[{"start":{"row":40,"column":48},"end":{"row":40,"column":49},"action":"insert","lines":["y"],"id":67}],[{"start":{"row":40,"column":49},"end":{"row":40,"column":50},"action":"insert","lines":[" "],"id":68}],[{"start":{"row":40,"column":49},"end":{"row":40,"column":50},"action":"remove","lines":[" "],"id":69}],[{"start":{"row":40,"column":49},"end":{"row":40,"column":50},"action":"insert","lines":[" "],"id":70}],[{"start":{"row":40,"column":50},"end":{"row":40,"column":51},"action":"insert","lines":["a"],"id":71}],[{"start":{"row":40,"column":51},"end":{"row":40,"column":52},"action":"insert","lines":["d"],"id":72}],[{"start":{"row":40,"column":52},"end":{"row":40,"column":53},"action":"insert","lines":["d"],"id":73}],[{"start":{"row":40,"column":53},"end":{"row":40,"column":54},"action":"insert","lines":["e"],"id":74}],[{"start":{"row":40,"column":54},"end":{"row":40,"column":55},"action":"insert","lines":["d"],"id":75}],[{"start":{"row":40,"column":55},"end":{"row":40,"column":56},"action":"insert","lines":[" "],"id":76}],[{"start":{"row":40,"column":56},"end":{"row":40,"column":57},"action":"insert","lines":["c"],"id":77}],[{"start":{"row":40,"column":57},"end":{"row":40,"column":58},"action":"insert","lines":["o"],"id":78}],[{"start":{"row":40,"column":58},"end":{"row":40,"column":59},"action":"insert","lines":["m"],"id":79}],[{"start":{"row":40,"column":59},"end":{"row":40,"column":60},"action":"insert","lines":["m"],"id":80}],[{"start":{"row":40,"column":60},"end":{"row":40,"column":61},"action":"insert","lines":["e"],"id":81}],[{"start":{"row":40,"column":61},"end":{"row":40,"column":62},"action":"insert","lines":["n"],"id":82}],[{"start":{"row":40,"column":62},"end":{"row":40,"column":63},"action":"insert","lines":["t"],"id":83}],[{"start":{"row":40,"column":63},"end":{"row":40,"column":64},"action":"insert","lines":[" "],"id":84}],[{"start":{"row":40,"column":63},"end":{"row":40,"column":64},"action":"remove","lines":[" "],"id":85}],[{"start":{"row":76,"column":15},"end":{"row":77,"column":0},"action":"insert","lines":["",""],"id":86},{"start":{"row":77,"column":0},"end":{"row":77,"column":11},"action":"insert","lines":[" "]}],[{"start":{"row":77,"column":11},"end":{"row":77,"column":54},"action":"insert","lines":["req.flash(\"error\", \"Campground not found\");"],"id":87}],[{"start":{"row":77,"column":26},"end":{"row":77,"column":27},"action":"remove","lines":["r"],"id":88}],[{"start":{"row":77,"column":25},"end":{"row":77,"column":26},"action":"remove","lines":["o"],"id":89}],[{"start":{"row":77,"column":24},"end":{"row":77,"column":25},"action":"remove","lines":["r"],"id":90}],[{"start":{"row":77,"column":23},"end":{"row":77,"column":24},"action":"remove","lines":["r"],"id":91}],[{"start":{"row":77,"column":22},"end":{"row":77,"column":23},"action":"remove","lines":["e"],"id":92}],[{"start":{"row":77,"column":22},"end":{"row":77,"column":23},"action":"insert","lines":["s"],"id":93}],[{"start":{"row":77,"column":23},"end":{"row":77,"column":24},"action":"insert","lines":["u"],"id":94}],[{"start":{"row":77,"column":24},"end":{"row":77,"column":25},"action":"insert","lines":["c"],"id":95}],[{"start":{"row":77,"column":25},"end":{"row":77,"column":26},"action":"insert","lines":["c"],"id":96}],[{"start":{"row":77,"column":26},"end":{"row":77,"column":27},"action":"insert","lines":["e"],"id":97}],[{"start":{"row":77,"column":27},"end":{"row":77,"column":28},"action":"insert","lines":["s"],"id":98}],[{"start":{"row":77,"column":28},"end":{"row":77,"column":29},"action":"insert","lines":["s"],"id":99}],[{"start":{"row":77,"column":34},"end":{"row":77,"column":53},"action":"remove","lines":["ampground not found"],"id":100},{"start":{"row":77,"column":34},"end":{"row":77,"column":35},"action":"insert","lines":["o"]}],[{"start":{"row":77,"column":35},"end":{"row":77,"column":36},"action":"insert","lines":["m"],"id":101}],[{"start":{"row":77,"column":36},"end":{"row":77,"column":37},"action":"insert","lines":["m"],"id":102}],[{"start":{"row":77,"column":37},"end":{"row":77,"column":38},"action":"insert","lines":["e"],"id":103}],[{"start":{"row":77,"column":38},"end":{"row":77,"column":39},"action":"insert","lines":["n"],"id":104}],[{"start":{"row":77,"column":39},"end":{"row":77,"column":40},"action":"insert","lines":["t"],"id":105}],[{"start":{"row":77,"column":40},"end":{"row":77,"column":41},"action":"insert","lines":[" "],"id":106}],[{"start":{"row":77,"column":41},"end":{"row":77,"column":42},"action":"insert","lines":["d"],"id":107}],[{"start":{"row":77,"column":42},"end":{"row":77,"column":43},"action":"insert","lines":["e"],"id":108}],[{"start":{"row":77,"column":43},"end":{"row":77,"column":44},"action":"insert","lines":["l"],"id":109}],[{"start":{"row":77,"column":44},"end":{"row":77,"column":45},"action":"insert","lines":["e"],"id":110}],[{"start":{"row":77,"column":45},"end":{"row":77,"column":46},"action":"insert","lines":["t"],"id":111}],[{"start":{"row":77,"column":46},"end":{"row":77,"column":47},"action":"insert","lines":["e"],"id":112}],[{"start":{"row":77,"column":47},"end":{"row":77,"column":48},"action":"insert","lines":["d"],"id":113}],[{"start":{"row":77,"column":48},"end":{"row":77,"column":49},"action":"insert","lines":[" "],"id":114}],[{"start":{"row":77,"column":48},"end":{"row":77,"column":49},"action":"remove","lines":[" "],"id":115}]]},"ace":{"folds":[],"scrolltop":1980,"scrollleft":0,"selection":{"start":{"row":80,"column":7},"end":{"row":80,"column":7},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":75,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1447310837268,"hash":"cc02e16e7a9dcf11792ff36aa4943b85ffdd0615"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/routes/index.js b/.c9/metadata/workspace/YelpCamp/v11/routes/index.js deleted file mode 100644 index 20a34cf4..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/routes/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/YelpCamp/v11/routes/index.js","ace":{"folds":[],"scrolltop":352,"scrollleft":0,"selection":{"start":{"row":22,"column":9},"end":{"row":22,"column":9},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":12,"state":"start","mode":"ace/mode/javascript"}},"hash":"2259bfd8251f18aec14193306bed59b4009295f6","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":24,"column":27},"end":{"row":24,"column":28},"action":"insert","lines":["s"],"id":369}],[{"start":{"row":24,"column":28},"end":{"row":24,"column":29},"action":"insert","lines":["s"],"id":370}],[{"start":{"row":24,"column":29},"end":{"row":24,"column":30},"action":"insert","lines":[" "],"id":371}],[{"start":{"row":24,"column":29},"end":{"row":24,"column":30},"action":"remove","lines":[" "],"id":372}],[{"start":{"row":24,"column":30},"end":{"row":24,"column":31},"action":"insert","lines":[","],"id":373}],[{"start":{"row":24,"column":31},"end":{"row":24,"column":32},"action":"insert","lines":[" "],"id":374}],[{"start":{"row":24,"column":32},"end":{"row":24,"column":34},"action":"insert","lines":["\"\""],"id":375}],[{"start":{"row":24,"column":33},"end":{"row":24,"column":34},"action":"insert","lines":["S"],"id":376}],[{"start":{"row":24,"column":33},"end":{"row":24,"column":34},"action":"remove","lines":["S"],"id":377}],[{"start":{"row":24,"column":33},"end":{"row":24,"column":34},"action":"insert","lines":["S"],"id":378}],[{"start":{"row":24,"column":34},"end":{"row":24,"column":35},"action":"insert","lines":["u"],"id":379}],[{"start":{"row":24,"column":34},"end":{"row":24,"column":35},"action":"remove","lines":["u"],"id":380}],[{"start":{"row":24,"column":33},"end":{"row":24,"column":34},"action":"remove","lines":["S"],"id":381}],[{"start":{"row":24,"column":33},"end":{"row":24,"column":34},"action":"insert","lines":["W"],"id":382}],[{"start":{"row":24,"column":34},"end":{"row":24,"column":35},"action":"insert","lines":["e"],"id":383}],[{"start":{"row":24,"column":35},"end":{"row":24,"column":36},"action":"insert","lines":["l"],"id":384}],[{"start":{"row":24,"column":36},"end":{"row":24,"column":37},"action":"insert","lines":["c"],"id":385}],[{"start":{"row":24,"column":37},"end":{"row":24,"column":38},"action":"insert","lines":["o"],"id":386}],[{"start":{"row":24,"column":38},"end":{"row":24,"column":39},"action":"insert","lines":["m"],"id":387}],[{"start":{"row":24,"column":39},"end":{"row":24,"column":40},"action":"insert","lines":["e"],"id":388}],[{"start":{"row":24,"column":40},"end":{"row":24,"column":41},"action":"insert","lines":[" "],"id":389}],[{"start":{"row":24,"column":41},"end":{"row":24,"column":42},"action":"insert","lines":["t"],"id":390}],[{"start":{"row":24,"column":42},"end":{"row":24,"column":43},"action":"insert","lines":["o"],"id":391}],[{"start":{"row":24,"column":43},"end":{"row":24,"column":44},"action":"insert","lines":[" "],"id":392}],[{"start":{"row":24,"column":43},"end":{"row":24,"column":44},"action":"remove","lines":[" "],"id":393}],[{"start":{"row":24,"column":43},"end":{"row":24,"column":44},"action":"insert","lines":[" "],"id":394}],[{"start":{"row":24,"column":44},"end":{"row":24,"column":45},"action":"insert","lines":["Y"],"id":395}],[{"start":{"row":24,"column":45},"end":{"row":24,"column":46},"action":"insert","lines":["e"],"id":396}],[{"start":{"row":24,"column":46},"end":{"row":24,"column":47},"action":"insert","lines":["l"],"id":397}],[{"start":{"row":24,"column":47},"end":{"row":24,"column":48},"action":"insert","lines":["p"],"id":398}],[{"start":{"row":24,"column":48},"end":{"row":24,"column":49},"action":"insert","lines":["C"],"id":399}],[{"start":{"row":24,"column":49},"end":{"row":24,"column":50},"action":"insert","lines":["a"],"id":400}],[{"start":{"row":24,"column":50},"end":{"row":24,"column":51},"action":"insert","lines":["m"],"id":401}],[{"start":{"row":24,"column":51},"end":{"row":24,"column":52},"action":"insert","lines":["p"],"id":402}],[{"start":{"row":24,"column":52},"end":{"row":24,"column":53},"action":"insert","lines":[" "],"id":403}],[{"start":{"row":24,"column":52},"end":{"row":24,"column":53},"action":"remove","lines":[" "],"id":404}],[{"start":{"row":24,"column":53},"end":{"row":24,"column":54},"action":"insert","lines":[","],"id":405}],[{"start":{"row":24,"column":53},"end":{"row":24,"column":54},"action":"remove","lines":[","],"id":406}],[{"start":{"row":24,"column":53},"end":{"row":24,"column":54},"action":"insert","lines":[" "],"id":407}],[{"start":{"row":24,"column":54},"end":{"row":24,"column":55},"action":"insert","lines":["+"],"id":408}],[{"start":{"row":24,"column":52},"end":{"row":24,"column":53},"action":"insert","lines":[" "],"id":409}],[{"start":{"row":24,"column":56},"end":{"row":24,"column":57},"action":"insert","lines":[" "],"id":410}],[{"start":{"row":24,"column":57},"end":{"row":24,"column":58},"action":"insert","lines":["u"],"id":411}],[{"start":{"row":24,"column":58},"end":{"row":24,"column":59},"action":"insert","lines":["s"],"id":412}],[{"start":{"row":24,"column":59},"end":{"row":24,"column":60},"action":"insert","lines":["e"],"id":413}],[{"start":{"row":24,"column":60},"end":{"row":24,"column":61},"action":"insert","lines":["r"],"id":414}],[{"start":{"row":24,"column":61},"end":{"row":24,"column":62},"action":"insert","lines":[" "],"id":415}],[{"start":{"row":24,"column":61},"end":{"row":24,"column":62},"action":"remove","lines":[" "],"id":416}],[{"start":{"row":24,"column":61},"end":{"row":24,"column":62},"action":"insert","lines":["."],"id":417}],[{"start":{"row":24,"column":62},"end":{"row":24,"column":63},"action":"insert","lines":["u"],"id":418}],[{"start":{"row":24,"column":63},"end":{"row":24,"column":64},"action":"insert","lines":["s"],"id":419}],[{"start":{"row":24,"column":64},"end":{"row":24,"column":65},"action":"insert","lines":["e"],"id":420}],[{"start":{"row":24,"column":65},"end":{"row":24,"column":66},"action":"insert","lines":["r"],"id":421}],[{"start":{"row":24,"column":66},"end":{"row":24,"column":67},"action":"insert","lines":["n"],"id":422}],[{"start":{"row":24,"column":67},"end":{"row":24,"column":68},"action":"insert","lines":["a"],"id":423}],[{"start":{"row":24,"column":68},"end":{"row":24,"column":69},"action":"insert","lines":["m"],"id":424}],[{"start":{"row":24,"column":69},"end":{"row":24,"column":70},"action":"insert","lines":["e"],"id":425}],[{"start":{"row":24,"column":70},"end":{"row":24,"column":71},"action":"insert","lines":[" "],"id":426}],[{"start":{"row":24,"column":70},"end":{"row":24,"column":71},"action":"remove","lines":[" "],"id":427}],[{"start":{"row":50,"column":0},"end":{"row":56,"column":1},"action":"remove","lines":["//middleware","function isLoggedIn(req, res, next){"," if(req.isAuthenticated()){"," return next();"," }"," res.redirect(\"/login\");","}"],"id":433}],[{"start":{"row":19,"column":16},"end":{"row":20,"column":0},"action":"insert","lines":["",""],"id":434},{"start":{"row":20,"column":0},"end":{"row":20,"column":12},"action":"insert","lines":[" "]}],[{"start":{"row":20,"column":12},"end":{"row":20,"column":13},"action":"insert","lines":["c"],"id":435}],[{"start":{"row":20,"column":13},"end":{"row":20,"column":14},"action":"insert","lines":["o"],"id":436}],[{"start":{"row":20,"column":14},"end":{"row":20,"column":15},"action":"insert","lines":["n"],"id":437}],[{"start":{"row":20,"column":15},"end":{"row":20,"column":16},"action":"insert","lines":["s"],"id":438}],[{"start":{"row":20,"column":16},"end":{"row":20,"column":17},"action":"insert","lines":["p"],"id":439}],[{"start":{"row":20,"column":17},"end":{"row":20,"column":18},"action":"insert","lines":["o"],"id":440}],[{"start":{"row":20,"column":18},"end":{"row":20,"column":19},"action":"insert","lines":["l"],"id":441}],[{"start":{"row":20,"column":19},"end":{"row":20,"column":20},"action":"insert","lines":["e"],"id":442}],[{"start":{"row":20,"column":20},"end":{"row":20,"column":21},"action":"insert","lines":[" "],"id":443}],[{"start":{"row":20,"column":20},"end":{"row":20,"column":21},"action":"remove","lines":[" "],"id":444}],[{"start":{"row":20,"column":19},"end":{"row":20,"column":20},"action":"remove","lines":["e"],"id":445}],[{"start":{"row":20,"column":18},"end":{"row":20,"column":19},"action":"remove","lines":["l"],"id":446}],[{"start":{"row":20,"column":17},"end":{"row":20,"column":18},"action":"remove","lines":["o"],"id":447}],[{"start":{"row":20,"column":16},"end":{"row":20,"column":17},"action":"remove","lines":["p"],"id":448}],[{"start":{"row":20,"column":16},"end":{"row":20,"column":17},"action":"insert","lines":["o"],"id":449}],[{"start":{"row":20,"column":17},"end":{"row":20,"column":18},"action":"insert","lines":["l"],"id":450}],[{"start":{"row":20,"column":18},"end":{"row":20,"column":19},"action":"insert","lines":["e"],"id":451}],[{"start":{"row":20,"column":19},"end":{"row":20,"column":20},"action":"insert","lines":[" "],"id":452}],[{"start":{"row":20,"column":19},"end":{"row":20,"column":20},"action":"remove","lines":[" "],"id":453}],[{"start":{"row":20,"column":19},"end":{"row":20,"column":20},"action":"insert","lines":["."],"id":454}],[{"start":{"row":20,"column":20},"end":{"row":20,"column":21},"action":"insert","lines":["l"],"id":455}],[{"start":{"row":20,"column":21},"end":{"row":20,"column":22},"action":"insert","lines":["o"],"id":456}],[{"start":{"row":20,"column":22},"end":{"row":20,"column":23},"action":"insert","lines":["g"],"id":457}],[{"start":{"row":20,"column":23},"end":{"row":20,"column":24},"action":"insert","lines":[" "],"id":458}],[{"start":{"row":20,"column":23},"end":{"row":20,"column":24},"action":"remove","lines":[" "],"id":459}],[{"start":{"row":20,"column":23},"end":{"row":20,"column":25},"action":"insert","lines":["()"],"id":460}],[{"start":{"row":20,"column":24},"end":{"row":20,"column":25},"action":"insert","lines":["e"],"id":461}],[{"start":{"row":20,"column":25},"end":{"row":20,"column":26},"action":"insert","lines":["r"],"id":462}],[{"start":{"row":20,"column":26},"end":{"row":20,"column":27},"action":"insert","lines":["r"],"id":463}],[{"start":{"row":20,"column":28},"end":{"row":20,"column":29},"action":"insert","lines":[";"],"id":464}],[{"start":{"row":21,"column":34},"end":{"row":21,"column":35},"action":"insert","lines":["."],"id":465}],[{"start":{"row":21,"column":35},"end":{"row":21,"column":36},"action":"insert","lines":["m"],"id":466}],[{"start":{"row":21,"column":36},"end":{"row":21,"column":37},"action":"insert","lines":["e"],"id":467}],[{"start":{"row":21,"column":37},"end":{"row":21,"column":38},"action":"insert","lines":["s"],"id":468}],[{"start":{"row":21,"column":38},"end":{"row":21,"column":39},"action":"insert","lines":["s"],"id":469}],[{"start":{"row":21,"column":39},"end":{"row":21,"column":40},"action":"insert","lines":["a"],"id":470}],[{"start":{"row":21,"column":40},"end":{"row":21,"column":41},"action":"insert","lines":["g"],"id":471}],[{"start":{"row":21,"column":41},"end":{"row":21,"column":42},"action":"insert","lines":["e"],"id":472}],[{"start":{"row":20,"column":0},"end":{"row":21,"column":0},"action":"remove","lines":[" console.log(err);",""],"id":473},{"start":{"row":20,"column":0},"end":{"row":20,"column":1},"action":"insert","lines":["\\"]}],[{"start":{"row":20,"column":0},"end":{"row":20,"column":1},"action":"remove","lines":["\\"],"id":475}]]},"timestamp":1447311323000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/views/login.ejs b/.c9/metadata/workspace/YelpCamp/v11/views/login.ejs deleted file mode 100644 index 703a4248..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/views/login.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"login.ejs","tooltip":"/YelpCamp/v11/views/login.ejs","undoManager":{"mark":24,"position":24,"stack":[[{"start":{"row":0,"column":32},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":2}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":3}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["<"],"id":4}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["h"],"id":5}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["1"],"id":6}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":9},"action":"insert","lines":[">"],"id":7}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["<"],"id":8}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["%"],"id":9}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["="],"id":10}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":11}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["m"],"id":12}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["e"],"id":13}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["s"],"id":14}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["s"],"id":15}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["a"],"id":16}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["g"],"id":17}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["e"],"id":18}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":[" "],"id":19}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"remove","lines":[" "],"id":20}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":[" "],"id":21}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":["%"],"id":22}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":[">"],"id":23}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":23},"action":"remove","lines":["

    <%= message %>

    "],"id":27}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":28}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":29}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":15},"end":{"row":2,"column":15},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":36,"mode":"ace/mode/ejs"}},"timestamp":1447309295483,"hash":"8ef1eca0273f08a3b4634afd27b2537b347efd4c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11/views/partials/header.ejs b/.c9/metadata/workspace/YelpCamp/v11/views/partials/header.ejs deleted file mode 100644 index 4f2b3bfc..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11/views/partials/header.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"header.ejs","tooltip":"/YelpCamp/v11/views/partials/header.ejs","ace":{"folds":[],"scrolltop":788,"scrollleft":0,"selection":{"start":{"row":37,"column":18},"end":{"row":37,"column":18},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":42,"mode":"ace/mode/ejs"}},"hash":"1f161b120e0e5f4acf2fe91989bda7e0c23167a6","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":29,"column":21},"end":{"row":29,"column":22},"action":"insert","lines":[" "],"id":95}],[{"start":{"row":29,"column":21},"end":{"row":29,"column":22},"action":"remove","lines":[" "],"id":96}],[{"start":{"row":32,"column":16},"end":{"row":32,"column":23},"action":"remove","lines":["message"],"id":97}],[{"start":{"row":32,"column":16},"end":{"row":32,"column":17},"action":"insert","lines":["s"],"id":98}],[{"start":{"row":32,"column":17},"end":{"row":32,"column":18},"action":"insert","lines":["u"],"id":99}],[{"start":{"row":32,"column":18},"end":{"row":32,"column":19},"action":"insert","lines":["c"],"id":100}],[{"start":{"row":32,"column":19},"end":{"row":32,"column":20},"action":"insert","lines":["c"],"id":101}],[{"start":{"row":32,"column":20},"end":{"row":32,"column":21},"action":"insert","lines":["e"],"id":102}],[{"start":{"row":32,"column":21},"end":{"row":32,"column":22},"action":"insert","lines":["s"],"id":103}],[{"start":{"row":32,"column":22},"end":{"row":32,"column":23},"action":"insert","lines":["s"],"id":104}],[{"start":{"row":27,"column":27},"end":{"row":28,"column":8},"action":"insert","lines":[""," "],"id":105}],[{"start":{"row":28,"column":8},"end":{"row":28,"column":9},"action":"insert","lines":["<"],"id":106}],[{"start":{"row":28,"column":9},"end":{"row":28,"column":10},"action":"insert","lines":["$"],"id":107}],[{"start":{"row":28,"column":9},"end":{"row":28,"column":10},"action":"remove","lines":["$"],"id":108}],[{"start":{"row":28,"column":9},"end":{"row":28,"column":10},"action":"insert","lines":["%"],"id":109}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"insert","lines":[" "],"id":110}],[{"start":{"row":28,"column":11},"end":{"row":28,"column":12},"action":"insert","lines":["%"],"id":111}],[{"start":{"row":28,"column":12},"end":{"row":28,"column":13},"action":"insert","lines":[">"],"id":112}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"insert","lines":[" "],"id":113}],[{"start":{"row":28,"column":11},"end":{"row":28,"column":12},"action":"insert","lines":["i"],"id":114}],[{"start":{"row":28,"column":12},"end":{"row":28,"column":13},"action":"insert","lines":["f"],"id":115}],[{"start":{"row":28,"column":13},"end":{"row":28,"column":14},"action":"insert","lines":[" "],"id":116}],[{"start":{"row":28,"column":13},"end":{"row":28,"column":14},"action":"remove","lines":[" "],"id":117}],[{"start":{"row":28,"column":13},"end":{"row":28,"column":14},"action":"insert","lines":["("],"id":118}],[{"start":{"row":28,"column":14},"end":{"row":28,"column":15},"action":"insert","lines":[")"],"id":119}],[{"start":{"row":28,"column":15},"end":{"row":28,"column":16},"action":"insert","lines":["{"],"id":120}],[{"start":{"row":31,"column":14},"end":{"row":32,"column":0},"action":"insert","lines":["",""],"id":121},{"start":{"row":32,"column":0},"end":{"row":32,"column":8},"action":"insert","lines":[" "]}],[{"start":{"row":32,"column":8},"end":{"row":32,"column":9},"action":"insert","lines":["<"],"id":122}],[{"start":{"row":32,"column":9},"end":{"row":32,"column":10},"action":"insert","lines":["%"],"id":123}],[{"start":{"row":32,"column":10},"end":{"row":32,"column":11},"action":"insert","lines":[" "],"id":124}],[{"start":{"row":32,"column":11},"end":{"row":32,"column":12},"action":"insert","lines":["%"],"id":125}],[{"start":{"row":32,"column":12},"end":{"row":32,"column":13},"action":"insert","lines":[">"],"id":126}],[{"start":{"row":32,"column":10},"end":{"row":32,"column":11},"action":"insert","lines":[" "],"id":127}],[{"start":{"row":32,"column":11},"end":{"row":32,"column":12},"action":"insert","lines":["}"],"id":128}],[{"start":{"row":29,"column":0},"end":{"row":29,"column":4},"action":"insert","lines":[" "],"id":129},{"start":{"row":30,"column":0},"end":{"row":30,"column":4},"action":"insert","lines":[" "]},{"start":{"row":31,"column":0},"end":{"row":31,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":28,"column":14},"end":{"row":28,"column":15},"action":"insert","lines":["e"],"id":130}],[{"start":{"row":28,"column":15},"end":{"row":28,"column":16},"action":"insert","lines":["r"],"id":131}],[{"start":{"row":28,"column":16},"end":{"row":28,"column":17},"action":"insert","lines":["r"],"id":132}],[{"start":{"row":28,"column":17},"end":{"row":28,"column":18},"action":"insert","lines":["o"],"id":133}],[{"start":{"row":28,"column":18},"end":{"row":28,"column":19},"action":"insert","lines":["r"],"id":134}],[{"start":{"row":28,"column":19},"end":{"row":28,"column":20},"action":"insert","lines":[" "],"id":135}],[{"start":{"row":28,"column":19},"end":{"row":28,"column":20},"action":"remove","lines":[" "],"id":136}],[{"start":{"row":28,"column":19},"end":{"row":28,"column":20},"action":"insert","lines":[" "],"id":137}],[{"start":{"row":28,"column":20},"end":{"row":28,"column":21},"action":"insert","lines":["&"],"id":138}],[{"start":{"row":28,"column":21},"end":{"row":28,"column":22},"action":"insert","lines":["&"],"id":139}],[{"start":{"row":28,"column":22},"end":{"row":28,"column":23},"action":"insert","lines":[" "],"id":140}],[{"start":{"row":28,"column":23},"end":{"row":28,"column":24},"action":"insert","lines":["e"],"id":141}],[{"start":{"row":28,"column":24},"end":{"row":28,"column":25},"action":"insert","lines":["r"],"id":142}],[{"start":{"row":28,"column":25},"end":{"row":28,"column":26},"action":"insert","lines":["r"],"id":143}],[{"start":{"row":28,"column":26},"end":{"row":28,"column":27},"action":"insert","lines":["o"],"id":144}],[{"start":{"row":28,"column":27},"end":{"row":28,"column":28},"action":"insert","lines":["r"],"id":145}],[{"start":{"row":28,"column":28},"end":{"row":28,"column":29},"action":"insert","lines":[" "],"id":146}],[{"start":{"row":28,"column":28},"end":{"row":28,"column":29},"action":"remove","lines":[" "],"id":147}],[{"start":{"row":28,"column":28},"end":{"row":28,"column":29},"action":"insert","lines":["."],"id":148}],[{"start":{"row":28,"column":29},"end":{"row":28,"column":30},"action":"insert","lines":["l"],"id":149}],[{"start":{"row":28,"column":30},"end":{"row":28,"column":31},"action":"insert","lines":["e"],"id":150}],[{"start":{"row":28,"column":31},"end":{"row":28,"column":32},"action":"insert","lines":["n"],"id":151}],[{"start":{"row":28,"column":32},"end":{"row":28,"column":33},"action":"insert","lines":["g"],"id":152}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"insert","lines":["t"],"id":153}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"insert","lines":["h"],"id":154}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"insert","lines":[" "],"id":155}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"remove","lines":[" "],"id":156}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"insert","lines":[" "],"id":157}],[{"start":{"row":28,"column":36},"end":{"row":28,"column":37},"action":"insert","lines":[">"],"id":158}],[{"start":{"row":28,"column":37},"end":{"row":28,"column":38},"action":"insert","lines":[" "],"id":159}],[{"start":{"row":28,"column":38},"end":{"row":28,"column":39},"action":"insert","lines":["9"],"id":160}],[{"start":{"row":28,"column":38},"end":{"row":28,"column":39},"action":"remove","lines":["9"],"id":161}],[{"start":{"row":28,"column":38},"end":{"row":28,"column":39},"action":"insert","lines":["0"],"id":162}],[{"start":{"row":27,"column":27},"end":{"row":28,"column":8},"action":"insert","lines":[""," "],"id":163}],[{"start":{"row":28,"column":8},"end":{"row":28,"column":9},"action":"insert","lines":["i"],"id":164}],[{"start":{"row":28,"column":9},"end":{"row":28,"column":10},"action":"insert","lines":["f"],"id":165}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"insert","lines":[" "],"id":166}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"remove","lines":[" "],"id":167}],[{"start":{"row":28,"column":10},"end":{"row":28,"column":11},"action":"insert","lines":["("],"id":168}],[{"start":{"row":28,"column":11},"end":{"row":28,"column":12},"action":"insert","lines":["["],"id":169}],[{"start":{"row":28,"column":12},"end":{"row":28,"column":13},"action":"insert","lines":["]"],"id":170}],[{"start":{"row":28,"column":13},"end":{"row":28,"column":14},"action":"insert","lines":[")"],"id":171}],[{"start":{"row":28,"column":9},"end":{"row":28,"column":14},"action":"remove","lines":["f([])"],"id":172}],[{"start":{"row":28,"column":8},"end":{"row":28,"column":9},"action":"remove","lines":["i"],"id":173}],[{"start":{"row":33,"column":15},"end":{"row":34,"column":0},"action":"insert","lines":["",""],"id":174},{"start":{"row":34,"column":0},"end":{"row":34,"column":8},"action":"insert","lines":[" "]}],[{"start":{"row":34,"column":8},"end":{"row":34,"column":44},"action":"insert","lines":["<% if(error && error.length > 0){ %>"],"id":175}],[{"start":{"row":35,"column":0},"end":{"row":35,"column":4},"action":"insert","lines":[" "],"id":176},{"start":{"row":36,"column":0},"end":{"row":36,"column":4},"action":"insert","lines":[" "]},{"start":{"row":37,"column":0},"end":{"row":37,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":34,"column":14},"end":{"row":34,"column":19},"action":"remove","lines":["error"],"id":177}],[{"start":{"row":34,"column":14},"end":{"row":34,"column":15},"action":"insert","lines":["s"],"id":178}],[{"start":{"row":34,"column":15},"end":{"row":34,"column":16},"action":"insert","lines":["u"],"id":179}],[{"start":{"row":34,"column":16},"end":{"row":34,"column":17},"action":"insert","lines":["c"],"id":180}],[{"start":{"row":34,"column":17},"end":{"row":34,"column":18},"action":"insert","lines":["c"],"id":181}],[{"start":{"row":34,"column":18},"end":{"row":34,"column":19},"action":"insert","lines":["e"],"id":182}],[{"start":{"row":34,"column":19},"end":{"row":34,"column":20},"action":"insert","lines":["s"],"id":183}],[{"start":{"row":34,"column":20},"end":{"row":34,"column":21},"action":"insert","lines":["s"],"id":184}],[{"start":{"row":34,"column":25},"end":{"row":34,"column":30},"action":"remove","lines":["error"],"id":185}],[{"start":{"row":34,"column":25},"end":{"row":34,"column":26},"action":"insert","lines":["s"],"id":186}],[{"start":{"row":34,"column":26},"end":{"row":34,"column":27},"action":"insert","lines":["u"],"id":187}],[{"start":{"row":34,"column":27},"end":{"row":34,"column":28},"action":"insert","lines":["c"],"id":188}],[{"start":{"row":34,"column":28},"end":{"row":34,"column":29},"action":"insert","lines":["c"],"id":189}],[{"start":{"row":34,"column":29},"end":{"row":34,"column":30},"action":"insert","lines":["e"],"id":190}],[{"start":{"row":34,"column":30},"end":{"row":34,"column":31},"action":"insert","lines":["s"],"id":191}],[{"start":{"row":34,"column":31},"end":{"row":34,"column":32},"action":"insert","lines":["s"],"id":192}],[{"start":{"row":37,"column":18},"end":{"row":38,"column":0},"action":"insert","lines":["",""],"id":193},{"start":{"row":38,"column":0},"end":{"row":38,"column":12},"action":"insert","lines":[" "]}],[{"start":{"row":38,"column":8},"end":{"row":38,"column":12},"action":"remove","lines":[" "],"id":194}],[{"start":{"row":38,"column":8},"end":{"row":38,"column":15},"action":"insert","lines":["<% } %>"],"id":195}]]},"timestamp":1447310063000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11Deployed/app.js b/.c9/metadata/workspace/YelpCamp/v11Deployed/app.js deleted file mode 100644 index ba0c9cd0..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11Deployed/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v11Deployed/app.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":1264.7857885360718,"scrollleft":0,"selection":{"start":{"row":20,"column":0},"end":{"row":20,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":49,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1454476997000,"hash":"d5150cfd82fabe7d3ddcccb7211d2d111366ed3c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v11Deployed/package.json b/.c9/metadata/workspace/YelpCamp/v11Deployed/package.json deleted file mode 100644 index 8d66e710..00000000 --- a/.c9/metadata/workspace/YelpCamp/v11Deployed/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/YelpCamp/v11Deployed/package.json","undoManager":{"mark":27,"position":27,"stack":[[{"start":{"row":6,"column":57},"end":{"row":6,"column":58},"action":"insert","lines":[","],"id":2}],[{"start":{"row":6,"column":58},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":3},{"start":{"row":7,"column":0},"end":{"row":7,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":7,"column":4},"end":{"row":7,"column":6},"action":"insert","lines":["\"\""],"id":4}],[{"start":{"row":7,"column":5},"end":{"row":7,"column":6},"action":"insert","lines":["s"],"id":5}],[{"start":{"row":7,"column":6},"end":{"row":7,"column":7},"action":"insert","lines":["t"],"id":6}],[{"start":{"row":7,"column":7},"end":{"row":7,"column":8},"action":"insert","lines":["a"],"id":7}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":["t"],"id":8}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"remove","lines":["t"],"id":9}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":["r"],"id":10}],[{"start":{"row":7,"column":9},"end":{"row":7,"column":10},"action":"insert","lines":["t"],"id":11}],[{"start":{"row":7,"column":11},"end":{"row":7,"column":12},"action":"insert","lines":[":"],"id":12}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":[" "],"id":13}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":15},"action":"insert","lines":["\"\""],"id":14}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":["n"],"id":15}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":["o"],"id":16}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"insert","lines":["d"],"id":17}],[{"start":{"row":7,"column":17},"end":{"row":7,"column":18},"action":"insert","lines":["e"],"id":18}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"insert","lines":[" "],"id":19}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"remove","lines":[" "],"id":20}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"insert","lines":[" "],"id":21}],[{"start":{"row":7,"column":19},"end":{"row":7,"column":20},"action":"insert","lines":["a"],"id":22}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"insert","lines":["p"],"id":23}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["p"],"id":24}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["."],"id":25}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"insert","lines":["j"],"id":26}],[{"start":{"row":7,"column":24},"end":{"row":7,"column":25},"action":"insert","lines":["s"],"id":27}],[{"start":{"row":7,"column":25},"end":{"row":7,"column":26},"action":"insert","lines":[" "],"id":28}],[{"start":{"row":7,"column":25},"end":{"row":7,"column":26},"action":"remove","lines":[" "],"id":29}]]},"ace":{"folds":[],"scrolltop":265.5,"scrollleft":0,"selection":{"start":{"row":15,"column":10},"end":{"row":15,"column":10},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":9,"state":"start","mode":"ace/mode/json"}},"timestamp":1454397624000,"hash":"463c8b3632d113c2c25e536bfc3f9d76e44edf55"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v2/app.js b/.c9/metadata/workspace/YelpCamp/v2/app.js deleted file mode 100644 index d236bf31..00000000 --- a/.c9/metadata/workspace/YelpCamp/v2/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v2/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":57,"column":57},"end":{"row":57,"column":58},"action":"insert","lines":["p"],"id":1909}],[{"start":{"row":57,"column":58},"end":{"row":57,"column":59},"action":"insert","lines":["t"],"id":1910}],[{"start":{"row":57,"column":59},"end":{"row":57,"column":60},"action":"insert","lines":["i"],"id":1911}],[{"start":{"row":57,"column":60},"end":{"row":57,"column":61},"action":"insert","lines":["o"],"id":1912}],[{"start":{"row":57,"column":61},"end":{"row":57,"column":62},"action":"insert","lines":["n"],"id":1913}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"insert","lines":[" "],"id":1914}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"remove","lines":[" "],"id":1915}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"insert","lines":[":"],"id":1916}],[{"start":{"row":57,"column":63},"end":{"row":57,"column":64},"action":"insert","lines":[" "],"id":1917}],[{"start":{"row":57,"column":64},"end":{"row":57,"column":65},"action":"insert","lines":["d"],"id":1918}],[{"start":{"row":57,"column":65},"end":{"row":57,"column":66},"action":"insert","lines":["e"],"id":1919}],[{"start":{"row":57,"column":66},"end":{"row":57,"column":67},"action":"insert","lines":["s"],"id":1920}],[{"start":{"row":57,"column":67},"end":{"row":57,"column":68},"action":"insert","lines":["c"],"id":1921}],[{"start":{"row":57,"column":68},"end":{"row":57,"column":69},"action":"insert","lines":["r"],"id":1922}],[{"start":{"row":57,"column":69},"end":{"row":57,"column":70},"action":"insert","lines":["i"],"id":1923}],[{"start":{"row":57,"column":70},"end":{"row":57,"column":71},"action":"insert","lines":["p"],"id":1924}],[{"start":{"row":57,"column":71},"end":{"row":57,"column":72},"action":"insert","lines":["t"],"id":1925}],[{"start":{"row":57,"column":72},"end":{"row":57,"column":73},"action":"insert","lines":["i"],"id":1926}],[{"start":{"row":57,"column":73},"end":{"row":57,"column":74},"action":"insert","lines":["o"],"id":1927}],[{"start":{"row":57,"column":74},"end":{"row":57,"column":75},"action":"insert","lines":["n"],"id":1928}],[{"start":{"row":57,"column":75},"end":{"row":57,"column":76},"action":"insert","lines":[" "],"id":1929}],[{"start":{"row":57,"column":75},"end":{"row":57,"column":76},"action":"remove","lines":[" "],"id":1930}],[{"start":{"row":57,"column":52},"end":{"row":57,"column":75},"action":"remove","lines":["escription: description"],"id":1931}],[{"start":{"row":57,"column":51},"end":{"row":57,"column":52},"action":"remove","lines":["d"],"id":1932}],[{"start":{"row":57,"column":50},"end":{"row":57,"column":51},"action":"remove","lines":[" "],"id":1933}],[{"start":{"row":57,"column":49},"end":{"row":57,"column":50},"action":"remove","lines":[","],"id":1934}],[{"start":{"row":57,"column":49},"end":{"row":57,"column":50},"action":"insert","lines":[","],"id":1935}],[{"start":{"row":57,"column":50},"end":{"row":57,"column":51},"action":"insert","lines":[" "],"id":1936}],[{"start":{"row":57,"column":51},"end":{"row":57,"column":52},"action":"insert","lines":["d"],"id":1937}],[{"start":{"row":57,"column":52},"end":{"row":57,"column":53},"action":"insert","lines":["e"],"id":1938}],[{"start":{"row":57,"column":53},"end":{"row":57,"column":54},"action":"insert","lines":["s"],"id":1939}],[{"start":{"row":57,"column":54},"end":{"row":57,"column":55},"action":"insert","lines":["c"],"id":1940}],[{"start":{"row":57,"column":55},"end":{"row":57,"column":56},"action":"insert","lines":["r"],"id":1941}],[{"start":{"row":57,"column":56},"end":{"row":57,"column":57},"action":"insert","lines":["i"],"id":1942}],[{"start":{"row":57,"column":57},"end":{"row":57,"column":58},"action":"insert","lines":["p"],"id":1943}],[{"start":{"row":57,"column":58},"end":{"row":57,"column":59},"action":"insert","lines":["t"],"id":1944}],[{"start":{"row":57,"column":59},"end":{"row":57,"column":60},"action":"insert","lines":["i"],"id":1945}],[{"start":{"row":57,"column":60},"end":{"row":57,"column":61},"action":"insert","lines":["o"],"id":1946}],[{"start":{"row":57,"column":61},"end":{"row":57,"column":62},"action":"insert","lines":["n"],"id":1947}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"insert","lines":[" "],"id":1948}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"remove","lines":[" "],"id":1949}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"insert","lines":[":"],"id":1950}],[{"start":{"row":57,"column":63},"end":{"row":57,"column":64},"action":"insert","lines":[" "],"id":1951}],[{"start":{"row":57,"column":64},"end":{"row":57,"column":65},"action":"insert","lines":["d"],"id":1952}],[{"start":{"row":57,"column":65},"end":{"row":57,"column":66},"action":"insert","lines":["e"],"id":1953}],[{"start":{"row":57,"column":66},"end":{"row":57,"column":67},"action":"insert","lines":["s"],"id":1954}],[{"start":{"row":57,"column":66},"end":{"row":57,"column":67},"action":"remove","lines":["s"],"id":1956}],[{"start":{"row":57,"column":65},"end":{"row":57,"column":66},"action":"remove","lines":["e"],"id":1957}],[{"start":{"row":57,"column":64},"end":{"row":57,"column":65},"action":"remove","lines":["d"],"id":1958}],[{"start":{"row":57,"column":63},"end":{"row":57,"column":64},"action":"remove","lines":[" "],"id":1959}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"remove","lines":[":"],"id":1960}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"insert","lines":[":"],"id":1961}],[{"start":{"row":57,"column":63},"end":{"row":57,"column":64},"action":"insert","lines":["L"],"id":1962}],[{"start":{"row":57,"column":63},"end":{"row":57,"column":64},"action":"remove","lines":["L"],"id":1963}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"remove","lines":[":"],"id":1964}],[{"start":{"row":57,"column":61},"end":{"row":57,"column":62},"action":"remove","lines":["n"],"id":1965}],[{"start":{"row":57,"column":60},"end":{"row":57,"column":61},"action":"remove","lines":["o"],"id":1966}],[{"start":{"row":57,"column":59},"end":{"row":57,"column":60},"action":"remove","lines":["i"],"id":1967}],[{"start":{"row":57,"column":58},"end":{"row":57,"column":59},"action":"remove","lines":["t"],"id":1968}],[{"start":{"row":57,"column":57},"end":{"row":57,"column":58},"action":"remove","lines":["p"],"id":1969}],[{"start":{"row":57,"column":56},"end":{"row":57,"column":57},"action":"remove","lines":["i"],"id":1970}],[{"start":{"row":57,"column":55},"end":{"row":57,"column":56},"action":"remove","lines":["r"],"id":1971}],[{"start":{"row":57,"column":54},"end":{"row":57,"column":55},"action":"remove","lines":["c"],"id":1972}],[{"start":{"row":57,"column":53},"end":{"row":57,"column":54},"action":"remove","lines":["s"],"id":1973}],[{"start":{"row":57,"column":52},"end":{"row":57,"column":53},"action":"remove","lines":["e"],"id":1974}],[{"start":{"row":57,"column":51},"end":{"row":57,"column":52},"action":"remove","lines":["d"],"id":1975}],[{"start":{"row":57,"column":50},"end":{"row":57,"column":51},"action":"remove","lines":[" "],"id":1976}],[{"start":{"row":57,"column":49},"end":{"row":57,"column":50},"action":"remove","lines":[","],"id":1977}],[{"start":{"row":57,"column":49},"end":{"row":57,"column":50},"action":"insert","lines":[","],"id":1981}],[{"start":{"row":57,"column":50},"end":{"row":57,"column":51},"action":"insert","lines":[" "],"id":1982}],[{"start":{"row":57,"column":51},"end":{"row":57,"column":52},"action":"insert","lines":["e"],"id":1983}],[{"start":{"row":57,"column":52},"end":{"row":57,"column":53},"action":"insert","lines":["s"],"id":1984}],[{"start":{"row":57,"column":53},"end":{"row":57,"column":54},"action":"insert","lines":["c"],"id":1985}],[{"start":{"row":57,"column":54},"end":{"row":57,"column":55},"action":"insert","lines":["r"],"id":1986}],[{"start":{"row":57,"column":55},"end":{"row":57,"column":56},"action":"insert","lines":["i"],"id":1987}],[{"start":{"row":57,"column":55},"end":{"row":57,"column":56},"action":"remove","lines":["i"],"id":1988}],[{"start":{"row":57,"column":54},"end":{"row":57,"column":55},"action":"remove","lines":["r"],"id":1989}],[{"start":{"row":57,"column":53},"end":{"row":57,"column":54},"action":"remove","lines":["c"],"id":1990}],[{"start":{"row":57,"column":52},"end":{"row":57,"column":53},"action":"remove","lines":["s"],"id":1991}],[{"start":{"row":57,"column":51},"end":{"row":57,"column":52},"action":"remove","lines":["e"],"id":1992}],[{"start":{"row":57,"column":51},"end":{"row":57,"column":52},"action":"insert","lines":["d"],"id":1993}],[{"start":{"row":57,"column":52},"end":{"row":57,"column":53},"action":"insert","lines":["e"],"id":1994}],[{"start":{"row":57,"column":53},"end":{"row":57,"column":54},"action":"insert","lines":["s"],"id":1995}],[{"start":{"row":57,"column":54},"end":{"row":57,"column":55},"action":"insert","lines":["c"],"id":1996}],[{"start":{"row":57,"column":55},"end":{"row":57,"column":56},"action":"insert","lines":["r"],"id":1997}],[{"start":{"row":57,"column":56},"end":{"row":57,"column":57},"action":"insert","lines":["i"],"id":1998}],[{"start":{"row":57,"column":57},"end":{"row":57,"column":58},"action":"insert","lines":["p"],"id":1999}],[{"start":{"row":57,"column":58},"end":{"row":57,"column":59},"action":"insert","lines":["t"],"id":2000}],[{"start":{"row":57,"column":59},"end":{"row":57,"column":60},"action":"insert","lines":["i"],"id":2001}],[{"start":{"row":57,"column":60},"end":{"row":57,"column":61},"action":"insert","lines":["o"],"id":2002}],[{"start":{"row":57,"column":61},"end":{"row":57,"column":62},"action":"insert","lines":["n"],"id":2003}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"insert","lines":[" "],"id":2004}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"remove","lines":[" "],"id":2005}],[{"start":{"row":57,"column":62},"end":{"row":57,"column":63},"action":"insert","lines":[":"],"id":2006}],[{"start":{"row":57,"column":63},"end":{"row":57,"column":64},"action":"insert","lines":[" "],"id":2007}],[{"start":{"row":57,"column":64},"end":{"row":57,"column":65},"action":"insert","lines":["d"],"id":2008}],[{"start":{"row":57,"column":65},"end":{"row":57,"column":66},"action":"insert","lines":["e"],"id":2009}],[{"start":{"row":57,"column":66},"end":{"row":57,"column":67},"action":"insert","lines":["s"],"id":2010}],[{"start":{"row":57,"column":67},"end":{"row":57,"column":68},"action":"insert","lines":["c"],"id":2011}],[{"start":{"row":57,"column":68},"end":{"row":57,"column":69},"action":"insert","lines":[" "],"id":2012}],[{"start":{"row":57,"column":68},"end":{"row":57,"column":69},"action":"remove","lines":[" "],"id":2013}]]},"ace":{"folds":[],"scrolltop":1886,"scrollleft":0,"selection":{"start":{"row":85,"column":2},"end":{"row":85,"column":2},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":71,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1446252181987,"hash":"1d39a46c55cb312f4c790860acbff449c94b7336"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v2/package.json b/.c9/metadata/workspace/YelpCamp/v2/package.json deleted file mode 100644 index c939f620..00000000 --- a/.c9/metadata/workspace/YelpCamp/v2/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/YelpCamp/v2/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":216,"scrollleft":0,"selection":{"start":{"row":14,"column":0},"end":{"row":15,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":7,"state":"start","mode":"ace/mode/json"}},"timestamp":1445279333278,"hash":"a11a80d25ce880c11e6067f75e84d0604a641b7b"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v2/readme.md b/.c9/metadata/workspace/YelpCamp/v2/readme.md deleted file mode 100644 index 23b44596..00000000 --- a/.c9/metadata/workspace/YelpCamp/v2/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v2/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":45,"column":42},"end":{"row":46,"column":0},"action":"insert","lines":["",""],"id":707}],[{"start":{"row":46,"column":0},"end":{"row":47,"column":0},"action":"insert","lines":["",""],"id":708}],[{"start":{"row":47,"column":0},"end":{"row":48,"column":0},"action":"insert","lines":["",""],"id":709}],[{"start":{"row":48,"column":0},"end":{"row":48,"column":1},"action":"insert","lines":["a"],"id":710}],[{"start":{"row":48,"column":1},"end":{"row":48,"column":2},"action":"insert","lines":["p"],"id":711}],[{"start":{"row":48,"column":2},"end":{"row":48,"column":3},"action":"insert","lines":["i"],"id":712}],[{"start":{"row":48,"column":3},"end":{"row":48,"column":4},"action":"insert","lines":[" "],"id":713}],[{"start":{"row":48,"column":3},"end":{"row":48,"column":4},"action":"remove","lines":[" "],"id":714}],[{"start":{"row":48,"column":3},"end":{"row":48,"column":4},"action":"insert","lines":["."],"id":715}],[{"start":{"row":48,"column":4},"end":{"row":48,"column":5},"action":"insert","lines":["g"],"id":716}],[{"start":{"row":48,"column":5},"end":{"row":48,"column":6},"action":"insert","lines":["i"],"id":717}],[{"start":{"row":48,"column":6},"end":{"row":48,"column":7},"action":"insert","lines":["t"],"id":718}],[{"start":{"row":48,"column":7},"end":{"row":48,"column":8},"action":"insert","lines":["h"],"id":719}],[{"start":{"row":48,"column":8},"end":{"row":48,"column":9},"action":"insert","lines":["u"],"id":720}],[{"start":{"row":48,"column":9},"end":{"row":48,"column":10},"action":"insert","lines":["b"],"id":721}],[{"start":{"row":48,"column":10},"end":{"row":48,"column":11},"action":"insert","lines":[" "],"id":722}],[{"start":{"row":48,"column":10},"end":{"row":48,"column":11},"action":"remove","lines":[" "],"id":723}],[{"start":{"row":48,"column":10},"end":{"row":48,"column":11},"action":"insert","lines":["."],"id":724}],[{"start":{"row":48,"column":11},"end":{"row":48,"column":12},"action":"insert","lines":["c"],"id":725}],[{"start":{"row":48,"column":12},"end":{"row":48,"column":13},"action":"insert","lines":["o"],"id":726}],[{"start":{"row":48,"column":13},"end":{"row":48,"column":14},"action":"insert","lines":["m"],"id":727}],[{"start":{"row":48,"column":14},"end":{"row":48,"column":15},"action":"insert","lines":[" "],"id":728}],[{"start":{"row":48,"column":14},"end":{"row":48,"column":15},"action":"remove","lines":[" "],"id":729}],[{"start":{"row":48,"column":14},"end":{"row":48,"column":15},"action":"insert","lines":["/"],"id":730}],[{"start":{"row":48,"column":15},"end":{"row":48,"column":16},"action":"insert","lines":["u"],"id":731}],[{"start":{"row":48,"column":16},"end":{"row":48,"column":17},"action":"insert","lines":["s"],"id":732}],[{"start":{"row":48,"column":17},"end":{"row":48,"column":18},"action":"insert","lines":["e"],"id":733}],[{"start":{"row":48,"column":18},"end":{"row":48,"column":19},"action":"insert","lines":["r"],"id":734}],[{"start":{"row":48,"column":19},"end":{"row":48,"column":20},"action":"insert","lines":["s"],"id":735}],[{"start":{"row":48,"column":20},"end":{"row":48,"column":21},"action":"insert","lines":[" "],"id":736}],[{"start":{"row":48,"column":20},"end":{"row":48,"column":21},"action":"remove","lines":[" "],"id":737}],[{"start":{"row":48,"column":0},"end":{"row":48,"column":20},"action":"remove","lines":["api.github.com/users"],"id":738}],[{"start":{"row":47,"column":0},"end":{"row":48,"column":0},"action":"remove","lines":["",""],"id":739}],[{"start":{"row":46,"column":0},"end":{"row":47,"column":0},"action":"remove","lines":["",""],"id":740}],[{"start":{"row":45,"column":42},"end":{"row":46,"column":0},"action":"remove","lines":["",""],"id":741}],[{"start":{"row":45,"column":42},"end":{"row":46,"column":0},"action":"insert","lines":["",""],"id":742}],[{"start":{"row":46,"column":0},"end":{"row":46,"column":1},"action":"insert","lines":["S"],"id":743}],[{"start":{"row":46,"column":1},"end":{"row":46,"column":2},"action":"insert","lines":["H"],"id":744}],[{"start":{"row":46,"column":2},"end":{"row":46,"column":3},"action":"insert","lines":["O"],"id":745}],[{"start":{"row":46,"column":3},"end":{"row":46,"column":4},"action":"insert","lines":["W"],"id":746}],[{"start":{"row":46,"column":4},"end":{"row":46,"column":5},"action":"insert","lines":[" "],"id":747}],[{"start":{"row":46,"column":4},"end":{"row":46,"column":5},"action":"remove","lines":[" "],"id":748}],[{"start":{"row":46,"column":4},"end":{"row":46,"column":5},"action":"insert","lines":[" "],"id":749}],[{"start":{"row":46,"column":5},"end":{"row":46,"column":6},"action":"insert","lines":[" "],"id":750}],[{"start":{"row":46,"column":6},"end":{"row":46,"column":7},"action":"insert","lines":[" "],"id":751}],[{"start":{"row":46,"column":7},"end":{"row":46,"column":8},"action":"insert","lines":[" "],"id":752}],[{"start":{"row":46,"column":8},"end":{"row":46,"column":9},"action":"insert","lines":["/"],"id":753}],[{"start":{"row":46,"column":9},"end":{"row":46,"column":10},"action":"insert","lines":["d"],"id":754}],[{"start":{"row":46,"column":10},"end":{"row":46,"column":11},"action":"insert","lines":["o"],"id":755}],[{"start":{"row":46,"column":11},"end":{"row":46,"column":12},"action":"insert","lines":["g"],"id":756}],[{"start":{"row":46,"column":12},"end":{"row":46,"column":13},"action":"insert","lines":["s"],"id":757}],[{"start":{"row":46,"column":13},"end":{"row":46,"column":14},"action":"insert","lines":[" "],"id":758}],[{"start":{"row":46,"column":13},"end":{"row":46,"column":14},"action":"remove","lines":[" "],"id":759}],[{"start":{"row":46,"column":13},"end":{"row":46,"column":14},"action":"insert","lines":["/"],"id":760}],[{"start":{"row":46,"column":14},"end":{"row":46,"column":15},"action":"insert","lines":[":"],"id":761}],[{"start":{"row":46,"column":15},"end":{"row":46,"column":16},"action":"insert","lines":["i"],"id":762}],[{"start":{"row":46,"column":16},"end":{"row":46,"column":17},"action":"insert","lines":["d"],"id":763}],[{"start":{"row":46,"column":17},"end":{"row":46,"column":18},"action":"insert","lines":[" "],"id":764}],[{"start":{"row":46,"column":17},"end":{"row":46,"column":18},"action":"remove","lines":[" "],"id":765}],[{"start":{"row":46,"column":17},"end":{"row":46,"column":18},"action":"insert","lines":[" "],"id":766}],[{"start":{"row":46,"column":18},"end":{"row":46,"column":19},"action":"insert","lines":[" "],"id":767}],[{"start":{"row":46,"column":19},"end":{"row":46,"column":20},"action":"insert","lines":["G"],"id":768}],[{"start":{"row":46,"column":20},"end":{"row":46,"column":21},"action":"insert","lines":["E"],"id":769}],[{"start":{"row":46,"column":21},"end":{"row":46,"column":22},"action":"insert","lines":["T"],"id":770}],[{"start":{"row":46,"column":22},"end":{"row":46,"column":23},"action":"insert","lines":[" "],"id":771}],[{"start":{"row":46,"column":23},"end":{"row":46,"column":24},"action":"insert","lines":[" "],"id":772}],[{"start":{"row":46,"column":24},"end":{"row":46,"column":25},"action":"insert","lines":[" "],"id":773}],[{"start":{"row":46,"column":25},"end":{"row":46,"column":26},"action":"insert","lines":["S"],"id":774}],[{"start":{"row":46,"column":26},"end":{"row":46,"column":27},"action":"insert","lines":["h"],"id":775}],[{"start":{"row":46,"column":27},"end":{"row":46,"column":28},"action":"insert","lines":["i"],"id":776}],[{"start":{"row":46,"column":28},"end":{"row":46,"column":29},"action":"insert","lines":["o"],"id":777}],[{"start":{"row":46,"column":29},"end":{"row":46,"column":30},"action":"insert","lines":["w"],"id":778}],[{"start":{"row":46,"column":29},"end":{"row":46,"column":30},"action":"remove","lines":["w"],"id":779}],[{"start":{"row":46,"column":28},"end":{"row":46,"column":29},"action":"remove","lines":["o"],"id":780}],[{"start":{"row":46,"column":27},"end":{"row":46,"column":28},"action":"remove","lines":["i"],"id":781}],[{"start":{"row":46,"column":27},"end":{"row":46,"column":28},"action":"insert","lines":["o"],"id":782}],[{"start":{"row":46,"column":28},"end":{"row":46,"column":29},"action":"insert","lines":["w"],"id":783}],[{"start":{"row":46,"column":29},"end":{"row":46,"column":30},"action":"insert","lines":["s"],"id":784}],[{"start":{"row":46,"column":30},"end":{"row":46,"column":31},"action":"insert","lines":[" "],"id":785}],[{"start":{"row":46,"column":31},"end":{"row":46,"column":32},"action":"insert","lines":["i"],"id":786}],[{"start":{"row":46,"column":32},"end":{"row":46,"column":33},"action":"insert","lines":["n"],"id":787}],[{"start":{"row":46,"column":33},"end":{"row":46,"column":34},"action":"insert","lines":["f"],"id":788}],[{"start":{"row":46,"column":34},"end":{"row":46,"column":35},"action":"insert","lines":["o"],"id":789}],[{"start":{"row":46,"column":35},"end":{"row":46,"column":36},"action":"insert","lines":[" "],"id":790}],[{"start":{"row":46,"column":36},"end":{"row":46,"column":37},"action":"insert","lines":["a"],"id":791}],[{"start":{"row":46,"column":37},"end":{"row":46,"column":38},"action":"insert","lines":["b"],"id":792}],[{"start":{"row":46,"column":38},"end":{"row":46,"column":39},"action":"insert","lines":["o"],"id":793}],[{"start":{"row":46,"column":39},"end":{"row":46,"column":40},"action":"insert","lines":["u"],"id":794}],[{"start":{"row":46,"column":40},"end":{"row":46,"column":41},"action":"insert","lines":["t"],"id":795}],[{"start":{"row":46,"column":41},"end":{"row":46,"column":42},"action":"insert","lines":[" "],"id":796}],[{"start":{"row":46,"column":42},"end":{"row":46,"column":43},"action":"insert","lines":["o"],"id":797}],[{"start":{"row":46,"column":43},"end":{"row":46,"column":44},"action":"insert","lines":["n"],"id":798}],[{"start":{"row":46,"column":44},"end":{"row":46,"column":45},"action":"insert","lines":["e"],"id":799}],[{"start":{"row":46,"column":45},"end":{"row":46,"column":46},"action":"insert","lines":[" "],"id":800}],[{"start":{"row":46,"column":45},"end":{"row":46,"column":46},"action":"remove","lines":[" "],"id":801}],[{"start":{"row":46,"column":45},"end":{"row":46,"column":46},"action":"insert","lines":[" "],"id":802}],[{"start":{"row":46,"column":46},"end":{"row":46,"column":47},"action":"insert","lines":["d"],"id":803}],[{"start":{"row":46,"column":47},"end":{"row":46,"column":48},"action":"insert","lines":["o"],"id":804}],[{"start":{"row":46,"column":48},"end":{"row":46,"column":49},"action":"insert","lines":["g"],"id":805}],[{"start":{"row":46,"column":49},"end":{"row":46,"column":50},"action":"insert","lines":[" "],"id":806}],[{"start":{"row":46,"column":49},"end":{"row":46,"column":50},"action":"remove","lines":[" "],"id":807}]]},"ace":{"folds":[],"scrolltop":707,"scrollleft":0,"selection":{"start":{"row":33,"column":10},"end":{"row":33,"column":10},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":26,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445283151544,"hash":"dfd678f6dd57e91de4b7f20f53185cafb896d2a8"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v2/views/campgrounds.ejs b/.c9/metadata/workspace/YelpCamp/v2/views/campgrounds.ejs deleted file mode 100644 index 6d961c99..00000000 --- a/.c9/metadata/workspace/YelpCamp/v2/views/campgrounds.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campgrounds.ejs","tooltip":"/YelpCamp/v2/views/campgrounds.ejs","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445283829701,"hash":"1483181d798605b09ea8a53b254622beadabc554"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v2/views/index.ejs b/.c9/metadata/workspace/YelpCamp/v2/views/index.ejs deleted file mode 100644 index 943c4849..00000000 --- a/.c9/metadata/workspace/YelpCamp/v2/views/index.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.ejs","tooltip":"/YelpCamp/v2/views/index.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":21,"column":44},"end":{"row":21,"column":45},"action":"insert","lines":[" "],"id":61}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"insert","lines":[" "],"id":62}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"insert","lines":["b"],"id":63}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"remove","lines":["b"],"id":64}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"remove","lines":[" "],"id":65}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"insert","lines":["r"],"id":66}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"remove","lines":["r"],"id":67}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"insert","lines":["b"],"id":68}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"insert","lines":["r"],"id":69}],[{"start":{"row":21,"column":47},"end":{"row":21,"column":48},"action":"insert","lines":["n"],"id":70}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"insert","lines":[" "],"id":71}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"remove","lines":[" "],"id":72}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"insert","lines":["-"],"id":73}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"remove","lines":["-"],"id":74}],[{"start":{"row":21,"column":47},"end":{"row":21,"column":48},"action":"remove","lines":["n"],"id":75}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"remove","lines":["r"],"id":76}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"insert","lines":["t"],"id":77}],[{"start":{"row":21,"column":47},"end":{"row":21,"column":48},"action":"insert","lines":["n"],"id":78}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"insert","lines":["-"],"id":79}],[{"start":{"row":21,"column":49},"end":{"row":21,"column":50},"action":"insert","lines":["p"],"id":80}],[{"start":{"row":21,"column":50},"end":{"row":21,"column":51},"action":"insert","lines":["r"],"id":81}],[{"start":{"row":21,"column":51},"end":{"row":21,"column":52},"action":"insert","lines":["i"],"id":82}],[{"start":{"row":21,"column":52},"end":{"row":21,"column":53},"action":"insert","lines":["m"],"id":83}],[{"start":{"row":21,"column":53},"end":{"row":21,"column":54},"action":"insert","lines":["a"],"id":84}],[{"start":{"row":21,"column":54},"end":{"row":21,"column":55},"action":"insert","lines":["r"],"id":85}],[{"start":{"row":21,"column":55},"end":{"row":21,"column":56},"action":"insert","lines":["y"],"id":86}],[{"start":{"row":21,"column":56},"end":{"row":21,"column":57},"action":"insert","lines":[" "],"id":87}],[{"start":{"row":21,"column":56},"end":{"row":21,"column":57},"action":"remove","lines":[" "],"id":88}],[{"start":{"row":21,"column":32},"end":{"row":21,"column":33},"action":"insert","lines":["/"],"id":89}],[{"start":{"row":21,"column":33},"end":{"row":21,"column":34},"action":"insert","lines":["c"],"id":90}],[{"start":{"row":21,"column":34},"end":{"row":21,"column":35},"action":"insert","lines":["a"],"id":91}],[{"start":{"row":21,"column":35},"end":{"row":21,"column":36},"action":"insert","lines":["m"],"id":92}],[{"start":{"row":21,"column":36},"end":{"row":21,"column":37},"action":"insert","lines":["p"],"id":93}],[{"start":{"row":21,"column":37},"end":{"row":21,"column":38},"action":"insert","lines":["g"],"id":94}],[{"start":{"row":21,"column":38},"end":{"row":21,"column":39},"action":"insert","lines":["r"],"id":95}],[{"start":{"row":21,"column":39},"end":{"row":21,"column":40},"action":"insert","lines":["u"],"id":96}],[{"start":{"row":21,"column":40},"end":{"row":21,"column":41},"action":"insert","lines":["n"],"id":97}],[{"start":{"row":21,"column":41},"end":{"row":21,"column":42},"action":"insert","lines":["d"],"id":98}],[{"start":{"row":21,"column":42},"end":{"row":21,"column":43},"action":"insert","lines":["s"],"id":99},{"start":{"row":21,"column":43},"end":{"row":21,"column":44},"action":"insert","lines":[" "]}],[{"start":{"row":21,"column":43},"end":{"row":21,"column":44},"action":"remove","lines":[" "],"id":100}],[{"start":{"row":21,"column":42},"end":{"row":21,"column":43},"action":"remove","lines":["s"],"id":101}],[{"start":{"row":21,"column":41},"end":{"row":21,"column":42},"action":"remove","lines":["d"],"id":102}],[{"start":{"row":21,"column":40},"end":{"row":21,"column":41},"action":"remove","lines":["n"],"id":103}],[{"start":{"row":21,"column":39},"end":{"row":21,"column":40},"action":"remove","lines":["u"],"id":104}],[{"start":{"row":21,"column":39},"end":{"row":21,"column":40},"action":"insert","lines":["o"],"id":105}],[{"start":{"row":21,"column":40},"end":{"row":21,"column":41},"action":"insert","lines":["u"],"id":106}],[{"start":{"row":21,"column":41},"end":{"row":21,"column":42},"action":"insert","lines":["n"],"id":107}],[{"start":{"row":21,"column":42},"end":{"row":21,"column":43},"action":"insert","lines":["d"],"id":108}],[{"start":{"row":21,"column":43},"end":{"row":21,"column":44},"action":"insert","lines":["s"],"id":109}],[{"start":{"row":21,"column":44},"end":{"row":21,"column":45},"action":"insert","lines":[" "],"id":110}],[{"start":{"row":21,"column":44},"end":{"row":21,"column":45},"action":"remove","lines":[" "],"id":111}],[{"start":{"row":21,"column":44},"end":{"row":21,"column":45},"action":"insert","lines":["/"],"id":112}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"insert","lines":["2"],"id":113}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"insert","lines":["1"],"id":114}],[{"start":{"row":21,"column":47},"end":{"row":21,"column":48},"action":"insert","lines":["8"],"id":115}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"insert","lines":["7"],"id":116}],[{"start":{"row":21,"column":49},"end":{"row":21,"column":50},"action":"insert","lines":["3"],"id":117}],[{"start":{"row":21,"column":50},"end":{"row":21,"column":51},"action":"insert","lines":["8"],"id":118}],[{"start":{"row":21,"column":51},"end":{"row":21,"column":52},"action":"insert","lines":["9"],"id":119}],[{"start":{"row":21,"column":52},"end":{"row":21,"column":53},"action":"insert","lines":["1"],"id":120}],[{"start":{"row":21,"column":53},"end":{"row":21,"column":54},"action":"insert","lines":["2"],"id":121}],[{"start":{"row":21,"column":54},"end":{"row":21,"column":55},"action":"insert","lines":["3"],"id":122}],[{"start":{"row":21,"column":55},"end":{"row":21,"column":56},"action":"insert","lines":["6"],"id":123}],[{"start":{"row":21,"column":55},"end":{"row":21,"column":56},"action":"remove","lines":["6"],"id":124}],[{"start":{"row":21,"column":54},"end":{"row":21,"column":55},"action":"remove","lines":["3"],"id":125}],[{"start":{"row":21,"column":53},"end":{"row":21,"column":54},"action":"remove","lines":["2"],"id":126}],[{"start":{"row":21,"column":52},"end":{"row":21,"column":53},"action":"remove","lines":["1"],"id":127}],[{"start":{"row":21,"column":51},"end":{"row":21,"column":52},"action":"remove","lines":["9"],"id":128}],[{"start":{"row":21,"column":50},"end":{"row":21,"column":51},"action":"remove","lines":["8"],"id":129}],[{"start":{"row":21,"column":49},"end":{"row":21,"column":50},"action":"remove","lines":["3"],"id":130}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"remove","lines":["7"],"id":131}],[{"start":{"row":21,"column":47},"end":{"row":21,"column":48},"action":"remove","lines":["8"],"id":132}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"remove","lines":["1"],"id":133}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"remove","lines":["2"],"id":134}],[{"start":{"row":21,"column":45},"end":{"row":21,"column":46},"action":"insert","lines":["<"],"id":135}],[{"start":{"row":21,"column":46},"end":{"row":21,"column":47},"action":"insert","lines":["%"],"id":136}],[{"start":{"row":21,"column":47},"end":{"row":21,"column":48},"action":"insert","lines":["="],"id":137}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"insert","lines":[" "],"id":138}],[{"start":{"row":21,"column":49},"end":{"row":21,"column":50},"action":"insert","lines":["%"],"id":139}],[{"start":{"row":21,"column":50},"end":{"row":21,"column":51},"action":"insert","lines":[">"],"id":140}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"remove","lines":[" "],"id":141}],[{"start":{"row":21,"column":48},"end":{"row":21,"column":49},"action":"insert","lines":[" "],"id":142}],[{"start":{"row":21,"column":49},"end":{"row":21,"column":50},"action":"insert","lines":["c"],"id":143}],[{"start":{"row":21,"column":50},"end":{"row":21,"column":51},"action":"insert","lines":["a"],"id":144}],[{"start":{"row":21,"column":51},"end":{"row":21,"column":52},"action":"insert","lines":["m"],"id":145}],[{"start":{"row":21,"column":52},"end":{"row":21,"column":53},"action":"insert","lines":["p"],"id":146}],[{"start":{"row":21,"column":53},"end":{"row":21,"column":54},"action":"insert","lines":["g"],"id":147}],[{"start":{"row":21,"column":54},"end":{"row":21,"column":55},"action":"insert","lines":["r"],"id":148}],[{"start":{"row":21,"column":55},"end":{"row":21,"column":56},"action":"insert","lines":["o"],"id":149}],[{"start":{"row":21,"column":56},"end":{"row":21,"column":57},"action":"insert","lines":["u"],"id":150}],[{"start":{"row":21,"column":57},"end":{"row":21,"column":58},"action":"insert","lines":["n"],"id":151}],[{"start":{"row":21,"column":58},"end":{"row":21,"column":59},"action":"insert","lines":["d"],"id":152}],[{"start":{"row":21,"column":59},"end":{"row":21,"column":60},"action":"insert","lines":[" "],"id":153}],[{"start":{"row":21,"column":59},"end":{"row":21,"column":60},"action":"remove","lines":[" "],"id":154}],[{"start":{"row":21,"column":59},"end":{"row":21,"column":60},"action":"insert","lines":["."],"id":155}],[{"start":{"row":21,"column":60},"end":{"row":21,"column":61},"action":"insert","lines":["_"],"id":156}],[{"start":{"row":21,"column":61},"end":{"row":21,"column":62},"action":"insert","lines":["i"],"id":157}],[{"start":{"row":21,"column":62},"end":{"row":21,"column":63},"action":"insert","lines":["d"],"id":158}],[{"start":{"row":21,"column":63},"end":{"row":21,"column":64},"action":"insert","lines":[" "],"id":159}],[{"start":{"row":21,"column":63},"end":{"row":21,"column":64},"action":"remove","lines":[" "],"id":160}],[{"start":{"row":21,"column":63},"end":{"row":21,"column":64},"action":"insert","lines":[" "],"id":161}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":29},"isBackwards":true},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":50,"mode":"ace/mode/ejs"}},"timestamp":1445283961509,"hash":"7ba9658e91cc9438c5cd03973aedc35bd7f05584"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v2/views/new.ejs b/.c9/metadata/workspace/YelpCamp/v2/views/new.ejs deleted file mode 100644 index 7c6b2beb..00000000 --- a/.c9/metadata/workspace/YelpCamp/v2/views/new.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"new.ejs","tooltip":"/YelpCamp/v2/views/new.ejs","undoManager":{"mark":31,"position":31,"stack":[[{"start":{"row":11,"column":22},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":2},{"start":{"row":12,"column":0},"end":{"row":12,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":12,"column":16},"end":{"row":14,"column":22},"action":"insert","lines":["
    "," ","
    "],"id":3}],[{"start":{"row":13,"column":88},"end":{"row":13,"column":95},"action":"remove","lines":["age url"],"id":4}],[{"start":{"row":13,"column":87},"end":{"row":13,"column":88},"action":"remove","lines":["m"],"id":5}],[{"start":{"row":13,"column":86},"end":{"row":13,"column":87},"action":"remove","lines":["i"],"id":6}],[{"start":{"row":13,"column":86},"end":{"row":13,"column":87},"action":"insert","lines":["d"],"id":7}],[{"start":{"row":13,"column":87},"end":{"row":13,"column":88},"action":"insert","lines":["e"],"id":8}],[{"start":{"row":13,"column":88},"end":{"row":13,"column":89},"action":"insert","lines":["s"],"id":9}],[{"start":{"row":13,"column":89},"end":{"row":13,"column":90},"action":"insert","lines":["c"],"id":10}],[{"start":{"row":13,"column":90},"end":{"row":13,"column":91},"action":"insert","lines":["r"],"id":11}],[{"start":{"row":13,"column":91},"end":{"row":13,"column":92},"action":"insert","lines":["i"],"id":12}],[{"start":{"row":13,"column":92},"end":{"row":13,"column":93},"action":"insert","lines":["p"],"id":13}],[{"start":{"row":13,"column":93},"end":{"row":13,"column":94},"action":"insert","lines":["t"],"id":14}],[{"start":{"row":13,"column":94},"end":{"row":13,"column":95},"action":"insert","lines":["i"],"id":15}],[{"start":{"row":13,"column":95},"end":{"row":13,"column":96},"action":"insert","lines":["o"],"id":16}],[{"start":{"row":13,"column":96},"end":{"row":13,"column":97},"action":"insert","lines":["n"],"id":17}],[{"start":{"row":13,"column":70},"end":{"row":13,"column":71},"action":"remove","lines":["e"],"id":18}],[{"start":{"row":13,"column":69},"end":{"row":13,"column":70},"action":"remove","lines":["g"],"id":19}],[{"start":{"row":13,"column":68},"end":{"row":13,"column":69},"action":"remove","lines":["a"],"id":20}],[{"start":{"row":13,"column":67},"end":{"row":13,"column":68},"action":"remove","lines":["m"],"id":21}],[{"start":{"row":13,"column":66},"end":{"row":13,"column":67},"action":"remove","lines":["i"],"id":22}],[{"start":{"row":13,"column":66},"end":{"row":13,"column":67},"action":"insert","lines":["d"],"id":23}],[{"start":{"row":13,"column":67},"end":{"row":13,"column":68},"action":"insert","lines":["e"],"id":24}],[{"start":{"row":13,"column":68},"end":{"row":13,"column":69},"action":"insert","lines":["s"],"id":25}],[{"start":{"row":13,"column":69},"end":{"row":13,"column":70},"action":"insert","lines":["c"],"id":26}],[{"start":{"row":13,"column":70},"end":{"row":13,"column":71},"action":"insert","lines":["r"],"id":27}],[{"start":{"row":13,"column":71},"end":{"row":13,"column":72},"action":"insert","lines":["i"],"id":28}],[{"start":{"row":13,"column":72},"end":{"row":13,"column":73},"action":"insert","lines":["p"],"id":29}],[{"start":{"row":13,"column":73},"end":{"row":13,"column":74},"action":"insert","lines":["t"],"id":30}],[{"start":{"row":13,"column":74},"end":{"row":13,"column":75},"action":"insert","lines":["i"],"id":31}],[{"start":{"row":13,"column":75},"end":{"row":13,"column":76},"action":"insert","lines":["o"],"id":32}],[{"start":{"row":13,"column":76},"end":{"row":13,"column":77},"action":"insert","lines":["n"],"id":33}]]},"ace":{"folds":[],"scrolltop":90,"scrollleft":2,"selection":{"start":{"row":13,"column":62},"end":{"row":13,"column":78},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":50,"mode":"ace/mode/ejs"}},"timestamp":1445284403015,"hash":"b05649aaee23ed6d0302ad1ce63da0680e363b57"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v2/views/show.ejs b/.c9/metadata/workspace/YelpCamp/v2/views/show.ejs deleted file mode 100644 index 4aa95011..00000000 --- a/.c9/metadata/workspace/YelpCamp/v2/views/show.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"show.ejs","tooltip":"/YelpCamp/v2/views/show.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"insert","lines":["r"],"id":94}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":["o"],"id":95}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":["u"],"id":96}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"insert","lines":["n"],"id":97}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"insert","lines":["d"],"id":98}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":[" "],"id":99}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"remove","lines":[" "],"id":100}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":["."],"id":101}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"insert","lines":["i"],"id":102}],[{"start":{"row":4,"column":26},"end":{"row":4,"column":27},"action":"insert","lines":["m"],"id":103}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":["a"],"id":104}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"insert","lines":["g"],"id":105}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":[" "],"id":106}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":["e"],"id":107}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"remove","lines":["e"],"id":108}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"remove","lines":[" "],"id":109}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":["e"],"id":110}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":[" "],"id":111}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"insert","lines":["%"],"id":112}],[{"start":{"row":4,"column":32},"end":{"row":4,"column":33},"action":"insert","lines":[">"],"id":113}],[{"start":{"row":4,"column":35},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":114}],[{"start":{"row":5,"column":0},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":115}],[{"start":{"row":6,"column":0},"end":{"row":6,"column":1},"action":"insert","lines":["p"],"id":116}],[{"start":{"row":6,"column":0},"end":{"row":6,"column":1},"action":"remove","lines":["p"],"id":117}],[{"start":{"row":6,"column":0},"end":{"row":6,"column":1},"action":"insert","lines":["<"],"id":118}],[{"start":{"row":6,"column":1},"end":{"row":6,"column":2},"action":"insert","lines":["p"],"id":119}],[{"start":{"row":6,"column":2},"end":{"row":6,"column":7},"action":"insert","lines":[">

    "],"id":120}],[{"start":{"row":6,"column":3},"end":{"row":6,"column":4},"action":"insert","lines":["<"],"id":121}],[{"start":{"row":6,"column":4},"end":{"row":6,"column":5},"action":"insert","lines":["%"],"id":122}],[{"start":{"row":6,"column":5},"end":{"row":6,"column":6},"action":"insert","lines":["="],"id":123}],[{"start":{"row":6,"column":6},"end":{"row":6,"column":7},"action":"insert","lines":[" "],"id":124}],[{"start":{"row":6,"column":7},"end":{"row":6,"column":8},"action":"insert","lines":["c"],"id":125}],[{"start":{"row":6,"column":8},"end":{"row":6,"column":9},"action":"insert","lines":["a"],"id":126}],[{"start":{"row":6,"column":9},"end":{"row":6,"column":10},"action":"insert","lines":["m"],"id":127}],[{"start":{"row":6,"column":10},"end":{"row":6,"column":11},"action":"insert","lines":["p"],"id":128}],[{"start":{"row":6,"column":11},"end":{"row":6,"column":12},"action":"insert","lines":["g"],"id":129}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"insert","lines":["o"],"id":130}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"insert","lines":["u"],"id":131}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"remove","lines":["u"],"id":132}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"remove","lines":["o"],"id":133}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"insert","lines":["r"],"id":134}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"insert","lines":["o"],"id":135}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":15},"action":"insert","lines":["u"],"id":136}],[{"start":{"row":6,"column":15},"end":{"row":6,"column":16},"action":"insert","lines":["n"],"id":137}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"insert","lines":["d"],"id":138}],[{"start":{"row":6,"column":17},"end":{"row":6,"column":18},"action":"insert","lines":[" "],"id":139}],[{"start":{"row":6,"column":17},"end":{"row":6,"column":18},"action":"remove","lines":[" "],"id":140}],[{"start":{"row":6,"column":17},"end":{"row":6,"column":18},"action":"insert","lines":["."],"id":141}],[{"start":{"row":6,"column":18},"end":{"row":6,"column":19},"action":"insert","lines":["d"],"id":142}],[{"start":{"row":6,"column":19},"end":{"row":6,"column":20},"action":"insert","lines":["e"],"id":143}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"insert","lines":["s"],"id":144}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"insert","lines":["c"],"id":145}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"insert","lines":["r"],"id":146}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"insert","lines":["i"],"id":147}],[{"start":{"row":6,"column":24},"end":{"row":6,"column":25},"action":"insert","lines":["p"],"id":148}],[{"start":{"row":6,"column":25},"end":{"row":6,"column":26},"action":"insert","lines":["t"],"id":149}],[{"start":{"row":6,"column":26},"end":{"row":6,"column":27},"action":"insert","lines":["i"],"id":150}],[{"start":{"row":6,"column":27},"end":{"row":6,"column":28},"action":"insert","lines":["o"],"id":151}],[{"start":{"row":6,"column":28},"end":{"row":6,"column":29},"action":"insert","lines":["n"],"id":152}],[{"start":{"row":6,"column":29},"end":{"row":6,"column":30},"action":"insert","lines":[" "],"id":153}],[{"start":{"row":6,"column":29},"end":{"row":6,"column":30},"action":"remove","lines":[" "],"id":154}],[{"start":{"row":6,"column":29},"end":{"row":6,"column":30},"action":"insert","lines":[" "],"id":155}],[{"start":{"row":6,"column":30},"end":{"row":6,"column":31},"action":"insert","lines":["%"],"id":156}],[{"start":{"row":6,"column":31},"end":{"row":6,"column":32},"action":"insert","lines":[">"],"id":157}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":23},"action":"remove","lines":["<%=campground.name%>"],"id":162}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":7},"action":"remove","lines":["

    "],"id":163}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":164}],[{"start":{"row":0,"column":35},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":165}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":30},"action":"remove","lines":["his is the show template!"],"id":166}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"remove","lines":["T"],"id":167}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":24},"action":"insert","lines":["<%=campground.name%>"],"id":168}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":169}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["<"],"id":170}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["%"],"id":171}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":[" "],"id":172}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["i"],"id":173}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["n"],"id":174}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["c"],"id":175}],[{"start":{"row":0,"column":6},"end":{"row":0,"column":7},"action":"insert","lines":["l"],"id":176}],[{"start":{"row":0,"column":7},"end":{"row":0,"column":8},"action":"insert","lines":["u"],"id":177}],[{"start":{"row":0,"column":8},"end":{"row":0,"column":9},"action":"insert","lines":["d"],"id":178}],[{"start":{"row":0,"column":9},"end":{"row":0,"column":10},"action":"insert","lines":["e"],"id":179}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"insert","lines":[" "],"id":180}],[{"start":{"row":0,"column":10},"end":{"row":0,"column":11},"action":"remove","lines":[" "],"id":181}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":10},"action":"remove","lines":["<% include"],"id":182},{"start":{"row":0,"column":0},"end":{"row":0,"column":29},"action":"insert","lines":["<% include partials/header %>"]}],[{"start":{"row":5,"column":36},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":183}],[{"start":{"row":6,"column":0},"end":{"row":6,"column":29},"action":"insert","lines":["<% include partials/header %>"],"id":184}],[{"start":{"row":6,"column":25},"end":{"row":6,"column":26},"action":"remove","lines":["r"],"id":185}],[{"start":{"row":6,"column":24},"end":{"row":6,"column":25},"action":"remove","lines":["e"],"id":186}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"remove","lines":["d"],"id":187}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"insert","lines":["o"],"id":188}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"remove","lines":["o"],"id":189}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"remove","lines":["a"],"id":190}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"remove","lines":["e"],"id":191}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"remove","lines":["h"],"id":192}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"insert","lines":["f"],"id":193}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"insert","lines":["o"],"id":194}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"insert","lines":["o"],"id":195}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"insert","lines":["t"],"id":196}],[{"start":{"row":6,"column":24},"end":{"row":6,"column":25},"action":"insert","lines":["e"],"id":197}],[{"start":{"row":6,"column":25},"end":{"row":6,"column":26},"action":"insert","lines":["r"],"id":198}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":6,"column":26},"end":{"row":6,"column":26},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":50,"mode":"ace/mode/ejs"}},"timestamp":1445284301276,"hash":"6cf438fcae9f73c518192380bd2353fe54c11e8f"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v3/app.js b/.c9/metadata/workspace/YelpCamp/v3/app.js deleted file mode 100644 index 5d2c3dc2..00000000 --- a/.c9/metadata/workspace/YelpCamp/v3/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v3/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":70,"column":46},"end":{"row":70,"column":47},"action":"insert","lines":["i"],"id":471}],[{"start":{"row":70,"column":47},"end":{"row":70,"column":48},"action":"insert","lines":["o"],"id":472}],[{"start":{"row":70,"column":48},"end":{"row":70,"column":49},"action":"insert","lines":["n"],"id":473}],[{"start":{"row":70,"column":49},"end":{"row":70,"column":50},"action":"insert","lines":[" "],"id":474}],[{"start":{"row":70,"column":49},"end":{"row":70,"column":50},"action":"remove","lines":[" "],"id":475}],[{"start":{"row":70,"column":49},"end":{"row":70,"column":51},"action":"insert","lines":["()"],"id":476}],[{"start":{"row":70,"column":50},"end":{"row":70,"column":51},"action":"insert","lines":["r"],"id":477}],[{"start":{"row":70,"column":51},"end":{"row":70,"column":52},"action":"insert","lines":["e"],"id":478}],[{"start":{"row":70,"column":52},"end":{"row":70,"column":53},"action":"insert","lines":["q"],"id":479}],[{"start":{"row":70,"column":53},"end":{"row":70,"column":54},"action":"insert","lines":[" "],"id":480}],[{"start":{"row":70,"column":53},"end":{"row":70,"column":54},"action":"remove","lines":[" "],"id":481}],[{"start":{"row":70,"column":53},"end":{"row":70,"column":54},"action":"insert","lines":[","],"id":482}],[{"start":{"row":70,"column":54},"end":{"row":70,"column":55},"action":"insert","lines":[" "],"id":483}],[{"start":{"row":70,"column":55},"end":{"row":70,"column":56},"action":"insert","lines":["r"],"id":484}],[{"start":{"row":70,"column":56},"end":{"row":70,"column":57},"action":"insert","lines":["e"],"id":485}],[{"start":{"row":70,"column":57},"end":{"row":70,"column":58},"action":"insert","lines":["s"],"id":486}],[{"start":{"row":70,"column":58},"end":{"row":70,"column":59},"action":"insert","lines":[" "],"id":487}],[{"start":{"row":70,"column":58},"end":{"row":70,"column":59},"action":"remove","lines":[" "],"id":488}],[{"start":{"row":70,"column":59},"end":{"row":70,"column":61},"action":"insert","lines":["{}"],"id":489}],[{"start":{"row":70,"column":60},"end":{"row":72,"column":0},"action":"insert","lines":[""," ",""],"id":490}],[{"start":{"row":72,"column":2},"end":{"row":72,"column":3},"action":"insert","lines":[";"],"id":491}],[{"start":{"row":71,"column":3},"end":{"row":71,"column":4},"action":"insert","lines":["r"],"id":492}],[{"start":{"row":71,"column":4},"end":{"row":71,"column":5},"action":"insert","lines":["e"],"id":493}],[{"start":{"row":71,"column":5},"end":{"row":71,"column":6},"action":"insert","lines":["s"],"id":494}],[{"start":{"row":71,"column":6},"end":{"row":71,"column":7},"action":"insert","lines":[" "],"id":495}],[{"start":{"row":71,"column":6},"end":{"row":71,"column":7},"action":"remove","lines":[" "],"id":496}],[{"start":{"row":71,"column":6},"end":{"row":71,"column":7},"action":"insert","lines":["."],"id":497}],[{"start":{"row":71,"column":7},"end":{"row":71,"column":8},"action":"insert","lines":["s"],"id":498}],[{"start":{"row":71,"column":8},"end":{"row":71,"column":9},"action":"insert","lines":["e"],"id":499}],[{"start":{"row":71,"column":9},"end":{"row":71,"column":10},"action":"insert","lines":["n"],"id":500}],[{"start":{"row":71,"column":10},"end":{"row":71,"column":11},"action":"insert","lines":["d"],"id":501}],[{"start":{"row":71,"column":11},"end":{"row":71,"column":12},"action":"insert","lines":[" "],"id":502}],[{"start":{"row":71,"column":11},"end":{"row":71,"column":12},"action":"remove","lines":[" "],"id":503}],[{"start":{"row":71,"column":11},"end":{"row":71,"column":13},"action":"insert","lines":["()"],"id":504}],[{"start":{"row":71,"column":12},"end":{"row":71,"column":14},"action":"insert","lines":["\"\""],"id":505}],[{"start":{"row":71,"column":13},"end":{"row":71,"column":14},"action":"insert","lines":["T"],"id":506}],[{"start":{"row":71,"column":14},"end":{"row":71,"column":15},"action":"insert","lines":["H"],"id":507}],[{"start":{"row":71,"column":15},"end":{"row":71,"column":16},"action":"insert","lines":["I"],"id":508}],[{"start":{"row":71,"column":16},"end":{"row":71,"column":17},"action":"insert","lines":["S"],"id":509}],[{"start":{"row":71,"column":17},"end":{"row":71,"column":18},"action":"insert","lines":[" "],"id":510}],[{"start":{"row":71,"column":18},"end":{"row":71,"column":19},"action":"insert","lines":["W"],"id":511}],[{"start":{"row":71,"column":19},"end":{"row":71,"column":20},"action":"insert","lines":["I"],"id":512}],[{"start":{"row":71,"column":20},"end":{"row":71,"column":21},"action":"insert","lines":["L"],"id":513}],[{"start":{"row":71,"column":21},"end":{"row":71,"column":22},"action":"insert","lines":["L"],"id":514}],[{"start":{"row":71,"column":22},"end":{"row":71,"column":23},"action":"insert","lines":[" "],"id":515}],[{"start":{"row":71,"column":23},"end":{"row":71,"column":24},"action":"insert","lines":["B"],"id":516}],[{"start":{"row":71,"column":24},"end":{"row":71,"column":25},"action":"insert","lines":["E"],"id":517}],[{"start":{"row":71,"column":25},"end":{"row":71,"column":26},"action":"insert","lines":[" "],"id":518}],[{"start":{"row":71,"column":26},"end":{"row":71,"column":27},"action":"insert","lines":["T"],"id":519}],[{"start":{"row":71,"column":27},"end":{"row":71,"column":28},"action":"insert","lines":["H"],"id":520}],[{"start":{"row":71,"column":28},"end":{"row":71,"column":29},"action":"insert","lines":["E"],"id":521}],[{"start":{"row":71,"column":29},"end":{"row":71,"column":30},"action":"insert","lines":[" "],"id":522}],[{"start":{"row":71,"column":30},"end":{"row":71,"column":31},"action":"insert","lines":["C"],"id":523}],[{"start":{"row":71,"column":31},"end":{"row":71,"column":32},"action":"insert","lines":["O"],"id":524}],[{"start":{"row":71,"column":32},"end":{"row":71,"column":33},"action":"insert","lines":["M"],"id":525}],[{"start":{"row":71,"column":33},"end":{"row":71,"column":34},"action":"insert","lines":["M"],"id":526}],[{"start":{"row":71,"column":34},"end":{"row":71,"column":35},"action":"insert","lines":["E"],"id":527}],[{"start":{"row":71,"column":35},"end":{"row":71,"column":36},"action":"insert","lines":["N"],"id":528}],[{"start":{"row":71,"column":36},"end":{"row":71,"column":37},"action":"insert","lines":["T"],"id":529}],[{"start":{"row":71,"column":37},"end":{"row":71,"column":38},"action":"insert","lines":[" "],"id":530}],[{"start":{"row":71,"column":38},"end":{"row":71,"column":39},"action":"insert","lines":["F"],"id":531}],[{"start":{"row":71,"column":39},"end":{"row":71,"column":40},"action":"insert","lines":["O"],"id":532}],[{"start":{"row":71,"column":40},"end":{"row":71,"column":41},"action":"insert","lines":["R"],"id":533}],[{"start":{"row":71,"column":41},"end":{"row":71,"column":42},"action":"insert","lines":["M"],"id":534}],[{"start":{"row":71,"column":42},"end":{"row":71,"column":43},"action":"insert","lines":[" "],"id":535}],[{"start":{"row":71,"column":42},"end":{"row":71,"column":43},"action":"remove","lines":[" "],"id":536}],[{"start":{"row":71,"column":42},"end":{"row":71,"column":43},"action":"insert","lines":["!"],"id":537}],[{"start":{"row":71,"column":45},"end":{"row":71,"column":46},"action":"insert","lines":[";"],"id":538}],[{"start":{"row":71,"column":3},"end":{"row":71,"column":47},"action":"remove","lines":["res.send(\"THIS WILL BE THE COMMENT FORM!\"); "],"id":539}],[{"start":{"row":71,"column":3},"end":{"row":71,"column":4},"action":"insert","lines":["r"],"id":540}],[{"start":{"row":71,"column":4},"end":{"row":71,"column":5},"action":"insert","lines":["e"],"id":541}],[{"start":{"row":71,"column":5},"end":{"row":71,"column":6},"action":"insert","lines":["s"],"id":542}],[{"start":{"row":71,"column":6},"end":{"row":71,"column":7},"action":"insert","lines":[" "],"id":543}],[{"start":{"row":71,"column":6},"end":{"row":71,"column":7},"action":"remove","lines":[" "],"id":544}],[{"start":{"row":71,"column":6},"end":{"row":71,"column":7},"action":"insert","lines":["."],"id":545}],[{"start":{"row":71,"column":7},"end":{"row":71,"column":8},"action":"insert","lines":["r"],"id":546}],[{"start":{"row":71,"column":8},"end":{"row":71,"column":9},"action":"insert","lines":["e"],"id":547}],[{"start":{"row":71,"column":9},"end":{"row":71,"column":10},"action":"insert","lines":["n"],"id":548}],[{"start":{"row":71,"column":10},"end":{"row":71,"column":11},"action":"insert","lines":["d"],"id":549}],[{"start":{"row":71,"column":11},"end":{"row":71,"column":12},"action":"insert","lines":["e"],"id":550}],[{"start":{"row":71,"column":12},"end":{"row":71,"column":13},"action":"insert","lines":["r"],"id":551}],[{"start":{"row":71,"column":13},"end":{"row":71,"column":14},"action":"insert","lines":[" "],"id":552}],[{"start":{"row":71,"column":13},"end":{"row":71,"column":14},"action":"remove","lines":[" "],"id":553}],[{"start":{"row":71,"column":13},"end":{"row":71,"column":15},"action":"insert","lines":["()"],"id":554}],[{"start":{"row":71,"column":14},"end":{"row":71,"column":16},"action":"insert","lines":["\"\""],"id":555}],[{"start":{"row":71,"column":15},"end":{"row":71,"column":16},"action":"insert","lines":["n"],"id":556}],[{"start":{"row":71,"column":16},"end":{"row":71,"column":17},"action":"insert","lines":["e"],"id":557}],[{"start":{"row":71,"column":17},"end":{"row":71,"column":18},"action":"insert","lines":["w"],"id":558}],[{"start":{"row":71,"column":18},"end":{"row":71,"column":19},"action":"insert","lines":[" "],"id":559}],[{"start":{"row":71,"column":18},"end":{"row":71,"column":19},"action":"remove","lines":[" "],"id":560}],[{"start":{"row":71,"column":18},"end":{"row":71,"column":19},"action":"insert","lines":["."],"id":561}],[{"start":{"row":71,"column":19},"end":{"row":71,"column":20},"action":"insert","lines":["e"],"id":562}],[{"start":{"row":71,"column":20},"end":{"row":71,"column":21},"action":"insert","lines":["j"],"id":563}],[{"start":{"row":71,"column":20},"end":{"row":71,"column":21},"action":"remove","lines":["j"],"id":564}],[{"start":{"row":71,"column":19},"end":{"row":71,"column":20},"action":"remove","lines":["e"],"id":565}],[{"start":{"row":71,"column":18},"end":{"row":71,"column":19},"action":"remove","lines":["."],"id":566}],[{"start":{"row":71,"column":20},"end":{"row":71,"column":21},"action":"insert","lines":[";"],"id":567}],[{"start":{"row":66,"column":0},"end":{"row":72,"column":3},"action":"remove","lines":["// ===================","// COMMENT ROUTES","// ===================","","app.get(\"/campgrounds/:id/comments/new\", function(req, res){"," res.render(\"new\");","});"],"id":568}],[{"start":{"row":66,"column":0},"end":{"row":67,"column":0},"action":"remove","lines":["",""],"id":569}],[{"start":{"row":65,"column":0},"end":{"row":66,"column":0},"action":"remove","lines":["",""],"id":570}],[{"start":{"row":64,"column":0},"end":{"row":65,"column":0},"action":"remove","lines":["",""],"id":571}]]},"ace":{"folds":[],"scrolltop":29,"scrollleft":0,"selection":{"start":{"row":64,"column":0},"end":{"row":64,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":0,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445319506303,"hash":"f205cb0806e333d590dba258744f50b9a2f30517"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v3/models/campground.js b/.c9/metadata/workspace/YelpCamp/v3/models/campground.js deleted file mode 100644 index cd9c8f19..00000000 --- a/.c9/metadata/workspace/YelpCamp/v3/models/campground.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campground.js","tooltip":"/YelpCamp/v3/models/campground.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":30,"scrollleft":0,"selection":{"start":{"row":6,"column":4},"end":{"row":6,"column":12},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445314897974,"hash":"196c2df19513dfb487c8eaac4d94294558634649"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v3/models/comment.js b/.c9/metadata/workspace/YelpCamp/v3/models/comment.js deleted file mode 100644 index 20534b8f..00000000 --- a/.c9/metadata/workspace/YelpCamp/v3/models/comment.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comment.js","tooltip":"/YelpCamp/v3/models/comment.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":[" "],"id":94}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":["m"],"id":95}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["o"],"id":96}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":["n"],"id":97}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":["g"],"id":98}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":["o"],"id":99}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":26},"action":"insert","lines":["o"],"id":100}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":["s"],"id":101}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["e"],"id":102}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":[" "],"id":103}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"remove","lines":[" "],"id":104}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":["."],"id":105}],[{"start":{"row":2,"column":29},"end":{"row":2,"column":30},"action":"insert","lines":["S"],"id":106}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":["c"],"id":107}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":["h"],"id":108}],[{"start":{"row":2,"column":32},"end":{"row":2,"column":33},"action":"insert","lines":["e"],"id":109}],[{"start":{"row":2,"column":33},"end":{"row":2,"column":34},"action":"insert","lines":["m"],"id":110}],[{"start":{"row":2,"column":34},"end":{"row":2,"column":35},"action":"insert","lines":["a"],"id":111}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"insert","lines":[" "],"id":112}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"remove","lines":[" "],"id":113}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":37},"action":"insert","lines":["()"],"id":114}],[{"start":{"row":2,"column":36},"end":{"row":2,"column":38},"action":"insert","lines":["{}"],"id":115}],[{"start":{"row":2,"column":37},"end":{"row":4,"column":0},"action":"insert","lines":[""," ",""],"id":116}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":5},"action":"insert","lines":["t"],"id":117}],[{"start":{"row":3,"column":5},"end":{"row":3,"column":6},"action":"insert","lines":["e"],"id":118}],[{"start":{"row":3,"column":6},"end":{"row":3,"column":7},"action":"insert","lines":["x"],"id":119}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":8},"action":"insert","lines":["t"],"id":120}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":[" "],"id":121}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"remove","lines":[" "],"id":122}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":[":"],"id":123}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":[" "],"id":124}],[{"start":{"row":3,"column":10},"end":{"row":3,"column":11},"action":"insert","lines":["S"],"id":125}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"insert","lines":["t"],"id":126}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"insert","lines":["r"],"id":127}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["i"],"id":128}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["n"],"id":129}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["g"],"id":130}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":[" "],"id":131}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"remove","lines":[" "],"id":132}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":[","],"id":133}],[{"start":{"row":3,"column":17},"end":{"row":4,"column":0},"action":"insert","lines":["",""],"id":134},{"start":{"row":4,"column":0},"end":{"row":4,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":4,"column":4},"end":{"row":4,"column":5},"action":"insert","lines":["a"],"id":135}],[{"start":{"row":4,"column":5},"end":{"row":4,"column":6},"action":"insert","lines":["u"],"id":136}],[{"start":{"row":4,"column":6},"end":{"row":4,"column":7},"action":"insert","lines":["t"],"id":137}],[{"start":{"row":4,"column":7},"end":{"row":4,"column":8},"action":"insert","lines":["h"],"id":138}],[{"start":{"row":4,"column":8},"end":{"row":4,"column":9},"action":"insert","lines":["o"],"id":139}],[{"start":{"row":4,"column":9},"end":{"row":4,"column":10},"action":"insert","lines":["r"],"id":140}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":[" "],"id":141}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"remove","lines":[" "],"id":142}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":[":"],"id":143}],[{"start":{"row":4,"column":11},"end":{"row":4,"column":12},"action":"insert","lines":[" "],"id":144}],[{"start":{"row":4,"column":12},"end":{"row":4,"column":13},"action":"insert","lines":["S"],"id":145}],[{"start":{"row":4,"column":13},"end":{"row":4,"column":14},"action":"insert","lines":["t"],"id":146}],[{"start":{"row":4,"column":14},"end":{"row":4,"column":15},"action":"insert","lines":["r"],"id":147}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":["i"],"id":148}],[{"start":{"row":4,"column":16},"end":{"row":4,"column":17},"action":"insert","lines":["n"],"id":149}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":["g"],"id":150}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"insert","lines":[" "],"id":151}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"remove","lines":[" "],"id":152}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":[";"],"id":153}],[{"start":{"row":7,"column":17},"end":{"row":7,"column":18},"action":"insert","lines":["m"],"id":154}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"insert","lines":["o"],"id":155}],[{"start":{"row":7,"column":19},"end":{"row":7,"column":20},"action":"insert","lines":["n"],"id":156}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"insert","lines":["g"],"id":157}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["o"],"id":158}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":["o"],"id":159}],[{"start":{"row":7,"column":23},"end":{"row":7,"column":24},"action":"insert","lines":["s"],"id":160}],[{"start":{"row":7,"column":24},"end":{"row":7,"column":25},"action":"insert","lines":["e"],"id":161}],[{"start":{"row":7,"column":25},"end":{"row":7,"column":26},"action":"insert","lines":[" "],"id":162}],[{"start":{"row":7,"column":25},"end":{"row":7,"column":26},"action":"remove","lines":[" "],"id":163}],[{"start":{"row":7,"column":25},"end":{"row":7,"column":26},"action":"insert","lines":["."],"id":164}],[{"start":{"row":7,"column":26},"end":{"row":7,"column":27},"action":"insert","lines":["m"],"id":165}],[{"start":{"row":7,"column":27},"end":{"row":7,"column":28},"action":"insert","lines":["o"],"id":166}],[{"start":{"row":7,"column":28},"end":{"row":7,"column":29},"action":"insert","lines":["d"],"id":167}],[{"start":{"row":7,"column":29},"end":{"row":7,"column":30},"action":"insert","lines":["e"],"id":168}],[{"start":{"row":7,"column":30},"end":{"row":7,"column":31},"action":"insert","lines":["l"],"id":169}],[{"start":{"row":7,"column":31},"end":{"row":7,"column":32},"action":"insert","lines":[" "],"id":170}],[{"start":{"row":7,"column":31},"end":{"row":7,"column":32},"action":"remove","lines":[" "],"id":171}],[{"start":{"row":7,"column":31},"end":{"row":7,"column":33},"action":"insert","lines":["()"],"id":172}],[{"start":{"row":7,"column":32},"end":{"row":7,"column":34},"action":"insert","lines":["\"\""],"id":173}],[{"start":{"row":7,"column":33},"end":{"row":7,"column":34},"action":"insert","lines":["C"],"id":174}],[{"start":{"row":7,"column":34},"end":{"row":7,"column":35},"action":"insert","lines":["o"],"id":175}],[{"start":{"row":7,"column":35},"end":{"row":7,"column":36},"action":"insert","lines":["m"],"id":176}],[{"start":{"row":7,"column":36},"end":{"row":7,"column":37},"action":"insert","lines":["m"],"id":177}],[{"start":{"row":7,"column":37},"end":{"row":7,"column":38},"action":"insert","lines":["e"],"id":178}],[{"start":{"row":7,"column":38},"end":{"row":7,"column":39},"action":"insert","lines":["n"],"id":179}],[{"start":{"row":7,"column":39},"end":{"row":7,"column":40},"action":"insert","lines":["t"],"id":180}],[{"start":{"row":7,"column":40},"end":{"row":7,"column":41},"action":"insert","lines":[" "],"id":181}],[{"start":{"row":7,"column":40},"end":{"row":7,"column":41},"action":"remove","lines":[" "],"id":182}],[{"start":{"row":7,"column":41},"end":{"row":7,"column":42},"action":"insert","lines":[","],"id":183}],[{"start":{"row":7,"column":42},"end":{"row":7,"column":43},"action":"insert","lines":[" "],"id":184}],[{"start":{"row":7,"column":43},"end":{"row":7,"column":44},"action":"insert","lines":["c"],"id":185}],[{"start":{"row":7,"column":44},"end":{"row":7,"column":45},"action":"insert","lines":["o"],"id":186}],[{"start":{"row":7,"column":45},"end":{"row":7,"column":46},"action":"insert","lines":["m"],"id":187}],[{"start":{"row":7,"column":46},"end":{"row":7,"column":47},"action":"insert","lines":["m"],"id":188}],[{"start":{"row":7,"column":47},"end":{"row":7,"column":48},"action":"insert","lines":["e"],"id":189}],[{"start":{"row":7,"column":48},"end":{"row":7,"column":49},"action":"insert","lines":["n"],"id":190}],[{"start":{"row":7,"column":43},"end":{"row":7,"column":49},"action":"remove","lines":["commen"],"id":191},{"start":{"row":7,"column":43},"end":{"row":7,"column":56},"action":"insert","lines":["commentSchema"]}],[{"start":{"row":7,"column":57},"end":{"row":7,"column":59},"action":"insert","lines":["''"],"id":192}],[{"start":{"row":7,"column":57},"end":{"row":7,"column":59},"action":"remove","lines":["''"],"id":193}],[{"start":{"row":7,"column":57},"end":{"row":7,"column":58},"action":"insert","lines":[";"],"id":194}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":7,"column":33},"end":{"row":7,"column":40},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445314674633,"hash":"faa46e5fbde1e5bf48fc7180b5f2c3bc83114a9c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v3/readme.md b/.c9/metadata/workspace/YelpCamp/v3/readme.md deleted file mode 100644 index 580468c4..00000000 --- a/.c9/metadata/workspace/YelpCamp/v3/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v3/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":53,"column":28},"end":{"row":53,"column":29},"action":"insert","lines":["e"],"id":613}],[{"start":{"row":53,"column":29},"end":{"row":53,"column":30},"action":"insert","lines":["a"],"id":614}],[{"start":{"row":53,"column":30},"end":{"row":53,"column":31},"action":"insert","lines":["t"],"id":615}],[{"start":{"row":53,"column":31},"end":{"row":53,"column":32},"action":"insert","lines":["e"],"id":616}],[{"start":{"row":53,"column":32},"end":{"row":53,"column":33},"action":"insert","lines":[" "],"id":617}],[{"start":{"row":53,"column":33},"end":{"row":53,"column":34},"action":"insert","lines":["r"],"id":618}],[{"start":{"row":53,"column":34},"end":{"row":53,"column":35},"action":"insert","lines":["o"],"id":619}],[{"start":{"row":53,"column":35},"end":{"row":53,"column":36},"action":"insert","lines":["u"],"id":620}],[{"start":{"row":53,"column":36},"end":{"row":53,"column":37},"action":"insert","lines":["t"],"id":621}],[{"start":{"row":53,"column":37},"end":{"row":53,"column":38},"action":"insert","lines":["e"],"id":622}],[{"start":{"row":53,"column":38},"end":{"row":53,"column":39},"action":"insert","lines":["s"],"id":623}],[{"start":{"row":53,"column":39},"end":{"row":53,"column":40},"action":"insert","lines":[" "],"id":624}],[{"start":{"row":53,"column":39},"end":{"row":53,"column":40},"action":"remove","lines":[" "],"id":625}],[{"start":{"row":53,"column":39},"end":{"row":54,"column":0},"action":"insert","lines":["",""],"id":626},{"start":{"row":54,"column":0},"end":{"row":54,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":54,"column":2},"end":{"row":54,"column":3},"action":"insert","lines":["A"],"id":627}],[{"start":{"row":54,"column":2},"end":{"row":54,"column":3},"action":"remove","lines":["A"],"id":628}],[{"start":{"row":54,"column":2},"end":{"row":54,"column":3},"action":"insert","lines":["C"],"id":629}],[{"start":{"row":54,"column":3},"end":{"row":54,"column":4},"action":"insert","lines":["r"],"id":630}],[{"start":{"row":54,"column":4},"end":{"row":54,"column":5},"action":"insert","lines":["e"],"id":631}],[{"start":{"row":54,"column":5},"end":{"row":54,"column":6},"action":"insert","lines":["a"],"id":632}],[{"start":{"row":54,"column":6},"end":{"row":54,"column":7},"action":"insert","lines":["t"],"id":633}],[{"start":{"row":54,"column":6},"end":{"row":54,"column":7},"action":"remove","lines":["t"],"id":634}],[{"start":{"row":54,"column":5},"end":{"row":54,"column":6},"action":"remove","lines":["a"],"id":635}],[{"start":{"row":54,"column":4},"end":{"row":54,"column":5},"action":"remove","lines":["e"],"id":636}],[{"start":{"row":54,"column":3},"end":{"row":54,"column":4},"action":"remove","lines":["r"],"id":637}],[{"start":{"row":54,"column":2},"end":{"row":54,"column":3},"action":"remove","lines":["C"],"id":638}],[{"start":{"row":54,"column":2},"end":{"row":54,"column":3},"action":"insert","lines":["A"],"id":639}],[{"start":{"row":54,"column":3},"end":{"row":54,"column":4},"action":"insert","lines":["d"],"id":640}],[{"start":{"row":54,"column":4},"end":{"row":54,"column":5},"action":"insert","lines":["d"],"id":641}],[{"start":{"row":54,"column":5},"end":{"row":54,"column":6},"action":"insert","lines":[" "],"id":642}],[{"start":{"row":54,"column":6},"end":{"row":54,"column":7},"action":"insert","lines":["t"],"id":643}],[{"start":{"row":54,"column":6},"end":{"row":54,"column":7},"action":"remove","lines":["t"],"id":644}],[{"start":{"row":54,"column":5},"end":{"row":54,"column":6},"action":"remove","lines":[" "],"id":645}],[{"start":{"row":54,"column":4},"end":{"row":54,"column":5},"action":"remove","lines":["d"],"id":646}],[{"start":{"row":54,"column":3},"end":{"row":54,"column":4},"action":"remove","lines":["d"],"id":647}],[{"start":{"row":54,"column":2},"end":{"row":54,"column":3},"action":"remove","lines":["A"],"id":648}],[{"start":{"row":54,"column":2},"end":{"row":54,"column":3},"action":"insert","lines":["A"],"id":649}],[{"start":{"row":54,"column":3},"end":{"row":54,"column":4},"action":"insert","lines":["d"],"id":650}],[{"start":{"row":54,"column":4},"end":{"row":54,"column":5},"action":"insert","lines":["d"],"id":651}],[{"start":{"row":54,"column":5},"end":{"row":54,"column":6},"action":"insert","lines":[" "],"id":652}],[{"start":{"row":54,"column":6},"end":{"row":54,"column":7},"action":"insert","lines":["t"],"id":653}],[{"start":{"row":54,"column":7},"end":{"row":54,"column":8},"action":"insert","lines":["h"],"id":654}],[{"start":{"row":54,"column":8},"end":{"row":54,"column":9},"action":"insert","lines":["e"],"id":655}],[{"start":{"row":54,"column":9},"end":{"row":54,"column":10},"action":"insert","lines":[" "],"id":656}],[{"start":{"row":54,"column":9},"end":{"row":54,"column":10},"action":"remove","lines":[" "],"id":657}],[{"start":{"row":54,"column":9},"end":{"row":54,"column":10},"action":"insert","lines":[" "],"id":658}],[{"start":{"row":54,"column":10},"end":{"row":54,"column":11},"action":"insert","lines":["c"],"id":659}],[{"start":{"row":54,"column":10},"end":{"row":54,"column":11},"action":"remove","lines":["c"],"id":660}],[{"start":{"row":54,"column":10},"end":{"row":54,"column":11},"action":"insert","lines":["n"],"id":661}],[{"start":{"row":54,"column":11},"end":{"row":54,"column":12},"action":"insert","lines":["e"],"id":662}],[{"start":{"row":54,"column":12},"end":{"row":54,"column":13},"action":"insert","lines":["w"],"id":663}],[{"start":{"row":54,"column":12},"end":{"row":54,"column":13},"action":"remove","lines":["w"],"id":664}],[{"start":{"row":54,"column":11},"end":{"row":54,"column":12},"action":"remove","lines":["e"],"id":665}],[{"start":{"row":54,"column":11},"end":{"row":54,"column":12},"action":"insert","lines":["e"],"id":666}],[{"start":{"row":54,"column":12},"end":{"row":54,"column":13},"action":"insert","lines":["w"],"id":667}],[{"start":{"row":54,"column":13},"end":{"row":54,"column":14},"action":"insert","lines":[" "],"id":668}],[{"start":{"row":54,"column":14},"end":{"row":54,"column":15},"action":"insert","lines":["c"],"id":669}],[{"start":{"row":54,"column":15},"end":{"row":54,"column":16},"action":"insert","lines":["o"],"id":670}],[{"start":{"row":54,"column":16},"end":{"row":54,"column":17},"action":"insert","lines":["m"],"id":671}],[{"start":{"row":54,"column":17},"end":{"row":54,"column":18},"action":"insert","lines":["m"],"id":672}],[{"start":{"row":54,"column":18},"end":{"row":54,"column":19},"action":"insert","lines":["e"],"id":673}],[{"start":{"row":54,"column":19},"end":{"row":54,"column":20},"action":"insert","lines":["n"],"id":674}],[{"start":{"row":54,"column":20},"end":{"row":54,"column":21},"action":"insert","lines":["t"],"id":675}],[{"start":{"row":54,"column":21},"end":{"row":54,"column":22},"action":"insert","lines":[" "],"id":676}],[{"start":{"row":54,"column":22},"end":{"row":54,"column":23},"action":"insert","lines":["f"],"id":677}],[{"start":{"row":54,"column":23},"end":{"row":54,"column":24},"action":"insert","lines":["o"],"id":678}],[{"start":{"row":54,"column":24},"end":{"row":54,"column":25},"action":"insert","lines":["r"],"id":679}],[{"start":{"row":54,"column":25},"end":{"row":54,"column":26},"action":"insert","lines":["m"],"id":680}],[{"start":{"row":54,"column":26},"end":{"row":54,"column":27},"action":"insert","lines":[" "],"id":681}],[{"start":{"row":54,"column":26},"end":{"row":54,"column":27},"action":"remove","lines":[" "],"id":682}],[{"start":{"row":53,"column":39},"end":{"row":54,"column":0},"action":"insert","lines":["",""],"id":683},{"start":{"row":54,"column":0},"end":{"row":54,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":54,"column":1},"end":{"row":54,"column":2},"action":"remove","lines":[" "],"id":684}],[{"start":{"row":54,"column":0},"end":{"row":54,"column":1},"action":"remove","lines":["*"],"id":685}],[{"start":{"row":53,"column":39},"end":{"row":54,"column":0},"action":"remove","lines":["",""],"id":686}],[{"start":{"row":52,"column":19},"end":{"row":53,"column":0},"action":"insert","lines":["",""],"id":687}],[{"start":{"row":53,"column":0},"end":{"row":53,"column":1},"action":"insert","lines":["*"],"id":688}],[{"start":{"row":53,"column":1},"end":{"row":53,"column":2},"action":"insert","lines":[" "],"id":689}],[{"start":{"row":53,"column":2},"end":{"row":53,"column":3},"action":"insert","lines":["D"],"id":690}],[{"start":{"row":53,"column":3},"end":{"row":53,"column":4},"action":"insert","lines":["i"],"id":691}],[{"start":{"row":53,"column":4},"end":{"row":53,"column":5},"action":"insert","lines":["s"],"id":692}],[{"start":{"row":53,"column":5},"end":{"row":53,"column":6},"action":"insert","lines":["c"],"id":693}],[{"start":{"row":53,"column":6},"end":{"row":53,"column":7},"action":"insert","lines":["u"],"id":694}],[{"start":{"row":53,"column":7},"end":{"row":53,"column":8},"action":"insert","lines":["s"],"id":695}],[{"start":{"row":53,"column":8},"end":{"row":53,"column":9},"action":"insert","lines":["s"],"id":696}],[{"start":{"row":53,"column":9},"end":{"row":53,"column":10},"action":"insert","lines":[" "],"id":697}],[{"start":{"row":53,"column":10},"end":{"row":53,"column":11},"action":"insert","lines":["n"],"id":698}],[{"start":{"row":53,"column":11},"end":{"row":53,"column":12},"action":"insert","lines":["e"],"id":699}],[{"start":{"row":53,"column":12},"end":{"row":53,"column":13},"action":"insert","lines":["s"],"id":700}],[{"start":{"row":53,"column":13},"end":{"row":53,"column":14},"action":"insert","lines":["t"],"id":701}],[{"start":{"row":53,"column":14},"end":{"row":53,"column":15},"action":"insert","lines":["e"],"id":702}],[{"start":{"row":53,"column":15},"end":{"row":53,"column":16},"action":"insert","lines":["d"],"id":703}],[{"start":{"row":53,"column":16},"end":{"row":53,"column":17},"action":"insert","lines":[" "],"id":704}],[{"start":{"row":53,"column":17},"end":{"row":53,"column":18},"action":"insert","lines":["r"],"id":705}],[{"start":{"row":53,"column":18},"end":{"row":53,"column":19},"action":"insert","lines":["o"],"id":706}],[{"start":{"row":53,"column":19},"end":{"row":53,"column":20},"action":"insert","lines":["u"],"id":707}],[{"start":{"row":53,"column":20},"end":{"row":53,"column":21},"action":"insert","lines":["t"],"id":708}],[{"start":{"row":53,"column":21},"end":{"row":53,"column":22},"action":"insert","lines":["e"],"id":709}],[{"start":{"row":53,"column":22},"end":{"row":53,"column":23},"action":"insert","lines":["s"],"id":710}],[{"start":{"row":53,"column":23},"end":{"row":53,"column":24},"action":"insert","lines":[" "],"id":711}],[{"start":{"row":53,"column":23},"end":{"row":53,"column":24},"action":"remove","lines":[" "],"id":712}],[{"start":{"row":51,"column":0},"end":{"row":55,"column":26},"action":"remove","lines":["","#Comment New/Create","* Discuss nested routes","* Add the comment new and create routes","* Add the new comment form"],"id":713}]]},"ace":{"folds":[],"scrolltop":1350.5,"scrollleft":0,"selection":{"start":{"row":51,"column":0},"end":{"row":51,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":50,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445317825189,"hash":"6f41a239e8f07c036f2ee3c998b823f4654ae281"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v3/seeds.js b/.c9/metadata/workspace/YelpCamp/v3/seeds.js deleted file mode 100644 index 9bdbc3ae..00000000 --- a/.c9/metadata/workspace/YelpCamp/v3/seeds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"seeds.js","tooltip":"/YelpCamp/v3/seeds.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":207,"scrollleft":0,"selection":{"start":{"row":45,"column":51},"end":{"row":45,"column":51},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":6,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445314434933,"hash":"a5d54778d0395e716908eedad6d545b6b32c4d8e"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v3/views/show.ejs b/.c9/metadata/workspace/YelpCamp/v3/views/show.ejs deleted file mode 100644 index 894a8753..00000000 --- a/.c9/metadata/workspace/YelpCamp/v3/views/show.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"show.ejs","tooltip":"/YelpCamp/v3/views/show.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"remove","lines":["p"],"id":79}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"insert","lines":["<"],"id":80}],[{"start":{"row":8,"column":5},"end":{"row":8,"column":6},"action":"insert","lines":["p"],"id":81}],[{"start":{"row":8,"column":6},"end":{"row":8,"column":11},"action":"insert","lines":[">

    "],"id":82}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"insert","lines":["<"],"id":83}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":["%"],"id":84}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":["="],"id":85}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":[" "],"id":86}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"insert","lines":["c"],"id":87}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"insert","lines":["o"],"id":88}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"insert","lines":["m"],"id":89}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"insert","lines":["m"],"id":90}],[{"start":{"row":8,"column":15},"end":{"row":8,"column":16},"action":"insert","lines":["e"],"id":91}],[{"start":{"row":8,"column":16},"end":{"row":8,"column":17},"action":"insert","lines":["n"],"id":92}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":18},"action":"insert","lines":["t"],"id":93}],[{"start":{"row":8,"column":18},"end":{"row":8,"column":19},"action":"insert","lines":[" "],"id":94}],[{"start":{"row":8,"column":18},"end":{"row":8,"column":19},"action":"remove","lines":[" "],"id":95}],[{"start":{"row":8,"column":18},"end":{"row":8,"column":19},"action":"insert","lines":["."],"id":96}],[{"start":{"row":8,"column":19},"end":{"row":8,"column":20},"action":"insert","lines":["a"],"id":97}],[{"start":{"row":8,"column":20},"end":{"row":8,"column":21},"action":"insert","lines":["u"],"id":98}],[{"start":{"row":8,"column":21},"end":{"row":8,"column":22},"action":"insert","lines":["t"],"id":99}],[{"start":{"row":8,"column":22},"end":{"row":8,"column":23},"action":"insert","lines":["h"],"id":100}],[{"start":{"row":8,"column":23},"end":{"row":8,"column":24},"action":"insert","lines":["o"],"id":101}],[{"start":{"row":8,"column":24},"end":{"row":8,"column":25},"action":"insert","lines":["r"],"id":102}],[{"start":{"row":8,"column":25},"end":{"row":8,"column":26},"action":"insert","lines":[" "],"id":103}],[{"start":{"row":8,"column":25},"end":{"row":8,"column":26},"action":"remove","lines":[" "],"id":104}],[{"start":{"row":8,"column":25},"end":{"row":8,"column":26},"action":"insert","lines":[" "],"id":105}],[{"start":{"row":8,"column":26},"end":{"row":8,"column":27},"action":"insert","lines":["%"],"id":106}],[{"start":{"row":8,"column":27},"end":{"row":8,"column":28},"action":"insert","lines":[">"],"id":107}],[{"start":{"row":8,"column":28},"end":{"row":8,"column":29},"action":"insert","lines":[" "],"id":108}],[{"start":{"row":8,"column":29},"end":{"row":8,"column":30},"action":"insert","lines":["-"],"id":109}],[{"start":{"row":8,"column":30},"end":{"row":8,"column":31},"action":"insert","lines":[" "],"id":110}],[{"start":{"row":8,"column":31},"end":{"row":8,"column":32},"action":"insert","lines":["<"],"id":111}],[{"start":{"row":8,"column":32},"end":{"row":8,"column":33},"action":"insert","lines":["%"],"id":112}],[{"start":{"row":8,"column":33},"end":{"row":8,"column":34},"action":"insert","lines":["="],"id":113}],[{"start":{"row":8,"column":34},"end":{"row":8,"column":35},"action":"insert","lines":["c"],"id":114}],[{"start":{"row":8,"column":35},"end":{"row":8,"column":36},"action":"insert","lines":["o"],"id":115}],[{"start":{"row":8,"column":35},"end":{"row":8,"column":36},"action":"remove","lines":["o"],"id":116}],[{"start":{"row":8,"column":34},"end":{"row":8,"column":35},"action":"remove","lines":["c"],"id":117}],[{"start":{"row":8,"column":34},"end":{"row":8,"column":35},"action":"insert","lines":[" "],"id":118}],[{"start":{"row":8,"column":35},"end":{"row":8,"column":36},"action":"insert","lines":["c"],"id":119}],[{"start":{"row":8,"column":36},"end":{"row":8,"column":37},"action":"insert","lines":["o"],"id":120}],[{"start":{"row":8,"column":37},"end":{"row":8,"column":38},"action":"insert","lines":["m"],"id":121}],[{"start":{"row":8,"column":38},"end":{"row":8,"column":39},"action":"insert","lines":["m"],"id":122}],[{"start":{"row":8,"column":39},"end":{"row":8,"column":40},"action":"insert","lines":["e"],"id":123}],[{"start":{"row":8,"column":40},"end":{"row":8,"column":41},"action":"insert","lines":["n"],"id":124}],[{"start":{"row":8,"column":41},"end":{"row":8,"column":42},"action":"insert","lines":["t"],"id":125}],[{"start":{"row":8,"column":42},"end":{"row":8,"column":43},"action":"insert","lines":[" "],"id":126}],[{"start":{"row":8,"column":42},"end":{"row":8,"column":43},"action":"remove","lines":[" "],"id":127}],[{"start":{"row":8,"column":42},"end":{"row":8,"column":43},"action":"insert","lines":["."],"id":128}],[{"start":{"row":8,"column":43},"end":{"row":8,"column":44},"action":"insert","lines":["t"],"id":129}],[{"start":{"row":8,"column":44},"end":{"row":8,"column":45},"action":"insert","lines":["e"],"id":130}],[{"start":{"row":8,"column":45},"end":{"row":8,"column":46},"action":"insert","lines":["x"],"id":131}],[{"start":{"row":8,"column":46},"end":{"row":8,"column":47},"action":"insert","lines":["t"],"id":132}],[{"start":{"row":8,"column":47},"end":{"row":8,"column":48},"action":"insert","lines":[" "],"id":133}],[{"start":{"row":8,"column":47},"end":{"row":8,"column":48},"action":"remove","lines":[" "],"id":134}],[{"start":{"row":8,"column":47},"end":{"row":8,"column":48},"action":"insert","lines":[" "],"id":135}],[{"start":{"row":8,"column":48},"end":{"row":8,"column":49},"action":"insert","lines":["%"],"id":136}],[{"start":{"row":8,"column":49},"end":{"row":8,"column":50},"action":"insert","lines":[">"],"id":137}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"insert","lines":["<"],"id":138}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":["s"],"id":139}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":["t"],"id":140}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":["r"],"id":141}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"insert","lines":["o"],"id":142}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"insert","lines":["g"],"id":143}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"insert","lines":["n"],"id":144}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"insert","lines":[" "],"id":145}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"remove","lines":[" "],"id":146}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":24},"action":"insert","lines":[">"],"id":147}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"remove","lines":[">"],"id":159}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"remove","lines":["n"],"id":160}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"remove","lines":["g"],"id":161}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"remove","lines":["o"],"id":162}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"remove","lines":["r"],"id":163}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"remove","lines":["t"],"id":164}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"remove","lines":["s"],"id":165}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":17},"action":"remove","lines":["strogn>"],"id":166}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"remove","lines":["/"],"id":167}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"remove","lines":["<"],"id":168}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"remove","lines":["<"],"id":169}],[{"start":{"row":8,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":[""," "],"id":170}],[{"start":{"row":8,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":[""," "],"id":171}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"insert","lines":["s"],"id":172}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"insert","lines":["t"],"id":173}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["r"],"id":174}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":["o"],"id":175}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":["n"],"id":176}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["g"],"id":177}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":[" "],"id":178}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"remove","lines":[" "],"id":179}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"insert","lines":["<"],"id":180}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":25},"action":"insert","lines":[">"],"id":181}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":29},"action":"remove","lines":["<%= comment.author %>"],"id":182}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":37},"action":"insert","lines":["<%= comment.author %>"],"id":183}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"remove","lines":[" "],"id":184}],[{"start":{"row":10,"column":4},"end":{"row":10,"column":8},"action":"remove","lines":[" "],"id":185}],[{"start":{"row":10,"column":0},"end":{"row":10,"column":4},"action":"remove","lines":[" "],"id":186}],[{"start":{"row":9,"column":46},"end":{"row":10,"column":0},"action":"remove","lines":["",""],"id":187}],[{"start":{"row":9,"column":46},"end":{"row":9,"column":47},"action":"insert","lines":[" "],"id":188}],[{"start":{"row":9,"column":68},"end":{"row":10,"column":0},"action":"insert","lines":["",""],"id":189},{"start":{"row":10,"column":0},"end":{"row":10,"column":8},"action":"insert","lines":[" "]}],[{"start":{"row":10,"column":4},"end":{"row":10,"column":8},"action":"remove","lines":[" "],"id":190}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":23},"end":{"row":5,"column":23},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445315555343,"hash":"258e0ca293875ae3ef336bff089f8332f32e46b4"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v4/app.js b/.c9/metadata/workspace/YelpCamp/v4/app.js deleted file mode 100644 index 7892bfa0..00000000 --- a/.c9/metadata/workspace/YelpCamp/v4/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v4/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":94,"column":32},"end":{"row":94,"column":33},"action":"insert","lines":["m"],"id":1392}],[{"start":{"row":94,"column":33},"end":{"row":94,"column":34},"action":"insert","lines":["p"],"id":1393}],[{"start":{"row":94,"column":33},"end":{"row":94,"column":34},"action":"remove","lines":["p"],"id":1394}],[{"start":{"row":94,"column":32},"end":{"row":94,"column":33},"action":"remove","lines":["m"],"id":1395}],[{"start":{"row":94,"column":31},"end":{"row":94,"column":32},"action":"remove","lines":["a"],"id":1396}],[{"start":{"row":94,"column":30},"end":{"row":94,"column":31},"action":"remove","lines":["c"],"id":1397}],[{"start":{"row":94,"column":29},"end":{"row":94,"column":30},"action":"remove","lines":["?"],"id":1398}],[{"start":{"row":94,"column":29},"end":{"row":94,"column":30},"action":"insert","lines":["/"],"id":1399}],[{"start":{"row":94,"column":30},"end":{"row":94,"column":31},"action":"insert","lines":["c"],"id":1400}],[{"start":{"row":94,"column":31},"end":{"row":94,"column":32},"action":"insert","lines":["a"],"id":1401}],[{"start":{"row":94,"column":32},"end":{"row":94,"column":33},"action":"insert","lines":["m"],"id":1402}],[{"start":{"row":94,"column":33},"end":{"row":94,"column":34},"action":"insert","lines":["p"],"id":1403}],[{"start":{"row":94,"column":34},"end":{"row":94,"column":35},"action":"insert","lines":["g"],"id":1404}],[{"start":{"row":94,"column":35},"end":{"row":94,"column":36},"action":"insert","lines":["r"],"id":1405}],[{"start":{"row":94,"column":36},"end":{"row":94,"column":37},"action":"insert","lines":["o"],"id":1406}],[{"start":{"row":94,"column":37},"end":{"row":94,"column":38},"action":"insert","lines":["u"],"id":1407}],[{"start":{"row":94,"column":38},"end":{"row":94,"column":39},"action":"insert","lines":["n"],"id":1408}],[{"start":{"row":94,"column":39},"end":{"row":94,"column":40},"action":"insert","lines":["d"],"id":1409}],[{"start":{"row":94,"column":40},"end":{"row":94,"column":41},"action":"insert","lines":["s"],"id":1410}],[{"start":{"row":94,"column":41},"end":{"row":94,"column":42},"action":"insert","lines":[" "],"id":1411}],[{"start":{"row":94,"column":41},"end":{"row":94,"column":42},"action":"remove","lines":[" "],"id":1412}],[{"start":{"row":94,"column":41},"end":{"row":94,"column":42},"action":"insert","lines":["/"],"id":1413}],[{"start":{"row":94,"column":43},"end":{"row":94,"column":44},"action":"insert","lines":[" "],"id":1414}],[{"start":{"row":94,"column":44},"end":{"row":94,"column":45},"action":"insert","lines":["+"],"id":1415}],[{"start":{"row":94,"column":45},"end":{"row":94,"column":46},"action":"insert","lines":[" "],"id":1416}],[{"start":{"row":94,"column":46},"end":{"row":94,"column":47},"action":"insert","lines":["c"],"id":1417}],[{"start":{"row":94,"column":47},"end":{"row":94,"column":48},"action":"insert","lines":["a"],"id":1418}],[{"start":{"row":94,"column":48},"end":{"row":94,"column":49},"action":"insert","lines":["m"],"id":1419}],[{"start":{"row":94,"column":49},"end":{"row":94,"column":50},"action":"insert","lines":["p"],"id":1420}],[{"start":{"row":94,"column":50},"end":{"row":94,"column":51},"action":"insert","lines":["g"],"id":1421}],[{"start":{"row":94,"column":51},"end":{"row":94,"column":52},"action":"insert","lines":["r"],"id":1422}],[{"start":{"row":94,"column":52},"end":{"row":94,"column":53},"action":"insert","lines":["o"],"id":1423}],[{"start":{"row":94,"column":53},"end":{"row":94,"column":54},"action":"insert","lines":["u"],"id":1424}],[{"start":{"row":94,"column":54},"end":{"row":94,"column":55},"action":"insert","lines":["n"],"id":1425}],[{"start":{"row":94,"column":55},"end":{"row":94,"column":56},"action":"insert","lines":["d"],"id":1426}],[{"start":{"row":94,"column":56},"end":{"row":94,"column":57},"action":"insert","lines":[" "],"id":1427}],[{"start":{"row":94,"column":56},"end":{"row":94,"column":57},"action":"remove","lines":[" "],"id":1428}],[{"start":{"row":94,"column":56},"end":{"row":94,"column":57},"action":"insert","lines":["."],"id":1429}],[{"start":{"row":94,"column":57},"end":{"row":94,"column":58},"action":"insert","lines":["_"],"id":1430}],[{"start":{"row":94,"column":58},"end":{"row":94,"column":59},"action":"insert","lines":["i"],"id":1431}],[{"start":{"row":94,"column":59},"end":{"row":94,"column":60},"action":"insert","lines":["d"],"id":1432}],[{"start":{"row":94,"column":60},"end":{"row":94,"column":61},"action":"insert","lines":[" "],"id":1433}],[{"start":{"row":94,"column":60},"end":{"row":94,"column":61},"action":"remove","lines":[" "],"id":1434}],[{"start":{"row":94,"column":61},"end":{"row":94,"column":62},"action":"insert","lines":[";"],"id":1435}],[{"start":{"row":4,"column":49},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":1436},{"start":{"row":5,"column":0},"end":{"row":5,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["C"],"id":1437}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["o"],"id":1438}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["m"],"id":1439}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["m"],"id":1440}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["e"],"id":1441}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["n"],"id":1442}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["t"],"id":1443}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":1444}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"remove","lines":[" "],"id":1445}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":1446}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":[" "],"id":1447}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":[" "],"id":1448}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":[" "],"id":1449}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":[" "],"id":1450}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":["="],"id":1451}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":[" "],"id":1452}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["r"],"id":1453}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":20},"action":"insert","lines":["e"],"id":1454}],[{"start":{"row":5,"column":20},"end":{"row":5,"column":21},"action":"insert","lines":["q"],"id":1455}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"insert","lines":["u"],"id":1456}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["i"],"id":1457}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["r"],"id":1458}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["e"],"id":1459}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":[" "],"id":1460}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"remove","lines":[" "],"id":1461}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":27},"action":"insert","lines":["()"],"id":1462}],[{"start":{"row":5,"column":26},"end":{"row":5,"column":28},"action":"insert","lines":["\"\""],"id":1463}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["/"],"id":1464}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"remove","lines":["/"],"id":1465}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":[","],"id":1466}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["/"],"id":1467}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":["."],"id":1468}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"remove","lines":["."],"id":1469}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"remove","lines":["/"],"id":1470}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"remove","lines":[","],"id":1471}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["."],"id":1472}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["/"],"id":1473}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":["m"],"id":1474}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"insert","lines":["o"],"id":1475}],[{"start":{"row":5,"column":31},"end":{"row":5,"column":32},"action":"insert","lines":["d"],"id":1476}],[{"start":{"row":5,"column":32},"end":{"row":5,"column":33},"action":"insert","lines":["e"],"id":1477}],[{"start":{"row":5,"column":33},"end":{"row":5,"column":34},"action":"insert","lines":["l"],"id":1478}],[{"start":{"row":5,"column":34},"end":{"row":5,"column":35},"action":"insert","lines":["s"],"id":1479}],[{"start":{"row":5,"column":35},"end":{"row":5,"column":36},"action":"insert","lines":[" "],"id":1480}],[{"start":{"row":5,"column":35},"end":{"row":5,"column":36},"action":"remove","lines":[" "],"id":1481}],[{"start":{"row":5,"column":35},"end":{"row":5,"column":36},"action":"insert","lines":["/"],"id":1482}],[{"start":{"row":5,"column":36},"end":{"row":5,"column":37},"action":"insert","lines":["c"],"id":1483}],[{"start":{"row":5,"column":37},"end":{"row":5,"column":38},"action":"insert","lines":["o"],"id":1484}],[{"start":{"row":5,"column":38},"end":{"row":5,"column":39},"action":"insert","lines":["m"],"id":1485}],[{"start":{"row":5,"column":39},"end":{"row":5,"column":40},"action":"insert","lines":["m"],"id":1486}],[{"start":{"row":5,"column":40},"end":{"row":5,"column":41},"action":"insert","lines":["e"],"id":1487}],[{"start":{"row":5,"column":41},"end":{"row":5,"column":42},"action":"insert","lines":["n"],"id":1488}],[{"start":{"row":5,"column":42},"end":{"row":5,"column":43},"action":"insert","lines":["t"],"id":1489}],[{"start":{"row":5,"column":43},"end":{"row":5,"column":44},"action":"insert","lines":[" "],"id":1490}],[{"start":{"row":5,"column":43},"end":{"row":5,"column":44},"action":"remove","lines":[" "],"id":1491}],[{"start":{"row":5,"column":45},"end":{"row":5,"column":46},"action":"insert","lines":[","],"id":1492}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":89,"column":21},"end":{"row":89,"column":21},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445321669000,"hash":"8458b286f6b39f8c20a9c77ef792d9ad8f3c27ef"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v4/readme.md b/.c9/metadata/workspace/YelpCamp/v4/readme.md deleted file mode 100644 index 2fb4268d..00000000 --- a/.c9/metadata/workspace/YelpCamp/v4/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v4/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":73,"column":19},"end":{"row":73,"column":20},"action":"insert","lines":["/"],"id":233}],[{"start":{"row":73,"column":20},"end":{"row":73,"column":21},"action":"insert","lines":[":"],"id":234}],[{"start":{"row":73,"column":21},"end":{"row":73,"column":22},"action":"insert","lines":["i"],"id":235}],[{"start":{"row":73,"column":22},"end":{"row":73,"column":23},"action":"insert","lines":["d"],"id":236}],[{"start":{"row":73,"column":23},"end":{"row":73,"column":24},"action":"insert","lines":[" "],"id":237}],[{"start":{"row":73,"column":23},"end":{"row":73,"column":24},"action":"remove","lines":[" "],"id":238}],[{"start":{"row":55,"column":26},"end":{"row":56,"column":0},"action":"insert","lines":["",""],"id":239},{"start":{"row":56,"column":0},"end":{"row":56,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":56,"column":2},"end":{"row":57,"column":0},"action":"insert","lines":["",""],"id":240}],[{"start":{"row":56,"column":2},"end":{"row":57,"column":0},"action":"remove","lines":["",""],"id":241}],[{"start":{"row":56,"column":1},"end":{"row":56,"column":2},"action":"remove","lines":[" "],"id":242}],[{"start":{"row":56,"column":0},"end":{"row":56,"column":1},"action":"remove","lines":["*"],"id":243}],[{"start":{"row":56,"column":0},"end":{"row":57,"column":0},"action":"insert","lines":["",""],"id":244}],[{"start":{"row":57,"column":0},"end":{"row":57,"column":1},"action":"insert","lines":["$"],"id":245}],[{"start":{"row":57,"column":0},"end":{"row":57,"column":1},"action":"remove","lines":["$"],"id":246}],[{"start":{"row":57,"column":0},"end":{"row":57,"column":1},"action":"insert","lines":["#"],"id":247}],[{"start":{"row":57,"column":1},"end":{"row":57,"column":2},"action":"insert","lines":["S"],"id":248}],[{"start":{"row":57,"column":2},"end":{"row":57,"column":3},"action":"insert","lines":["t"],"id":249}],[{"start":{"row":57,"column":3},"end":{"row":57,"column":4},"action":"insert","lines":["y"],"id":250}],[{"start":{"row":57,"column":4},"end":{"row":57,"column":5},"action":"insert","lines":["l"],"id":251}],[{"start":{"row":57,"column":5},"end":{"row":57,"column":6},"action":"insert","lines":["e"],"id":252}],[{"start":{"row":57,"column":6},"end":{"row":57,"column":7},"action":"insert","lines":[" "],"id":253}],[{"start":{"row":57,"column":7},"end":{"row":57,"column":8},"action":"insert","lines":["S"],"id":254}],[{"start":{"row":57,"column":8},"end":{"row":57,"column":9},"action":"insert","lines":["h"],"id":255}],[{"start":{"row":57,"column":9},"end":{"row":57,"column":10},"action":"insert","lines":["o"],"id":256}],[{"start":{"row":57,"column":10},"end":{"row":57,"column":11},"action":"insert","lines":["w"],"id":257}],[{"start":{"row":57,"column":11},"end":{"row":57,"column":12},"action":"insert","lines":[" "],"id":258}],[{"start":{"row":57,"column":11},"end":{"row":57,"column":12},"action":"remove","lines":[" "],"id":259}],[{"start":{"row":57,"column":11},"end":{"row":57,"column":12},"action":"insert","lines":[" "],"id":260}],[{"start":{"row":57,"column":12},"end":{"row":57,"column":13},"action":"insert","lines":["P"],"id":261}],[{"start":{"row":57,"column":13},"end":{"row":57,"column":14},"action":"insert","lines":["a"],"id":262}],[{"start":{"row":57,"column":14},"end":{"row":57,"column":15},"action":"insert","lines":["g"],"id":263}],[{"start":{"row":57,"column":15},"end":{"row":57,"column":16},"action":"insert","lines":["e"],"id":264}],[{"start":{"row":57,"column":16},"end":{"row":57,"column":17},"action":"insert","lines":[" "],"id":265}],[{"start":{"row":57,"column":16},"end":{"row":57,"column":17},"action":"remove","lines":[" "],"id":266}],[{"start":{"row":57,"column":16},"end":{"row":58,"column":0},"action":"insert","lines":["",""],"id":267}],[{"start":{"row":58,"column":0},"end":{"row":58,"column":1},"action":"insert","lines":["("],"id":268}],[{"start":{"row":58,"column":0},"end":{"row":58,"column":1},"action":"remove","lines":["("],"id":269}],[{"start":{"row":58,"column":0},"end":{"row":58,"column":1},"action":"insert","lines":["*"],"id":270}],[{"start":{"row":58,"column":1},"end":{"row":58,"column":2},"action":"insert","lines":[" "],"id":271}],[{"start":{"row":58,"column":2},"end":{"row":58,"column":3},"action":"insert","lines":["A"],"id":272}],[{"start":{"row":58,"column":3},"end":{"row":58,"column":4},"action":"insert","lines":["d"],"id":273}],[{"start":{"row":58,"column":4},"end":{"row":58,"column":5},"action":"insert","lines":["d"],"id":274}],[{"start":{"row":58,"column":5},"end":{"row":58,"column":6},"action":"insert","lines":[" "],"id":275}],[{"start":{"row":58,"column":5},"end":{"row":58,"column":6},"action":"remove","lines":[" "],"id":276}],[{"start":{"row":58,"column":5},"end":{"row":58,"column":6},"action":"insert","lines":[" "],"id":277}],[{"start":{"row":58,"column":6},"end":{"row":58,"column":7},"action":"insert","lines":["s"],"id":278}],[{"start":{"row":58,"column":7},"end":{"row":58,"column":8},"action":"insert","lines":["i"],"id":279}],[{"start":{"row":58,"column":8},"end":{"row":58,"column":9},"action":"insert","lines":["d"],"id":280}],[{"start":{"row":58,"column":9},"end":{"row":58,"column":10},"action":"insert","lines":["e"],"id":281}],[{"start":{"row":58,"column":10},"end":{"row":58,"column":11},"action":"insert","lines":[" "],"id":282}],[{"start":{"row":58,"column":10},"end":{"row":58,"column":11},"action":"remove","lines":[" "],"id":283}],[{"start":{"row":58,"column":10},"end":{"row":58,"column":11},"action":"insert","lines":["b"],"id":284}],[{"start":{"row":58,"column":11},"end":{"row":58,"column":12},"action":"insert","lines":["a"],"id":285}],[{"start":{"row":58,"column":12},"end":{"row":58,"column":13},"action":"insert","lines":["r"],"id":286}],[{"start":{"row":58,"column":13},"end":{"row":58,"column":14},"action":"insert","lines":[" "],"id":287}],[{"start":{"row":58,"column":14},"end":{"row":58,"column":15},"action":"insert","lines":["t"],"id":288}],[{"start":{"row":58,"column":15},"end":{"row":58,"column":16},"action":"insert","lines":["o"],"id":289}],[{"start":{"row":58,"column":16},"end":{"row":58,"column":17},"action":"insert","lines":[" "],"id":290}],[{"start":{"row":58,"column":17},"end":{"row":58,"column":18},"action":"insert","lines":["s"],"id":291}],[{"start":{"row":58,"column":18},"end":{"row":58,"column":19},"action":"insert","lines":["h"],"id":292}],[{"start":{"row":58,"column":19},"end":{"row":58,"column":20},"action":"insert","lines":["o"],"id":293}],[{"start":{"row":58,"column":20},"end":{"row":58,"column":21},"action":"insert","lines":["w"],"id":294}],[{"start":{"row":58,"column":21},"end":{"row":58,"column":22},"action":"insert","lines":[" "],"id":295}],[{"start":{"row":58,"column":22},"end":{"row":58,"column":23},"action":"insert","lines":["p"],"id":296}],[{"start":{"row":58,"column":23},"end":{"row":58,"column":24},"action":"insert","lines":["a"],"id":297}],[{"start":{"row":58,"column":24},"end":{"row":58,"column":25},"action":"insert","lines":["g"],"id":298}],[{"start":{"row":58,"column":25},"end":{"row":58,"column":26},"action":"insert","lines":["e"],"id":299}],[{"start":{"row":58,"column":26},"end":{"row":58,"column":27},"action":"insert","lines":[" "],"id":300}],[{"start":{"row":58,"column":26},"end":{"row":58,"column":27},"action":"remove","lines":[" "],"id":301}],[{"start":{"row":58,"column":26},"end":{"row":59,"column":0},"action":"insert","lines":["",""],"id":302},{"start":{"row":59,"column":0},"end":{"row":59,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":59,"column":2},"end":{"row":59,"column":3},"action":"insert","lines":["S"],"id":303}],[{"start":{"row":59,"column":2},"end":{"row":59,"column":3},"action":"remove","lines":["S"],"id":304}],[{"start":{"row":59,"column":2},"end":{"row":59,"column":3},"action":"insert","lines":["D"],"id":305}],[{"start":{"row":59,"column":3},"end":{"row":59,"column":4},"action":"insert","lines":["i"],"id":306}],[{"start":{"row":59,"column":4},"end":{"row":59,"column":5},"action":"insert","lines":["s"],"id":307}],[{"start":{"row":59,"column":5},"end":{"row":59,"column":6},"action":"insert","lines":["p"],"id":308}],[{"start":{"row":59,"column":6},"end":{"row":59,"column":7},"action":"insert","lines":["l"],"id":309}],[{"start":{"row":59,"column":7},"end":{"row":59,"column":8},"action":"insert","lines":["a"],"id":310}],[{"start":{"row":59,"column":8},"end":{"row":59,"column":9},"action":"insert","lines":["y"],"id":311}],[{"start":{"row":59,"column":9},"end":{"row":59,"column":10},"action":"insert","lines":[" "],"id":312}],[{"start":{"row":59,"column":10},"end":{"row":59,"column":11},"action":"insert","lines":["c"],"id":313}],[{"start":{"row":59,"column":11},"end":{"row":59,"column":12},"action":"insert","lines":["o"],"id":314}],[{"start":{"row":59,"column":12},"end":{"row":59,"column":13},"action":"insert","lines":["m"],"id":315}],[{"start":{"row":59,"column":13},"end":{"row":59,"column":14},"action":"insert","lines":["m"],"id":316}],[{"start":{"row":59,"column":14},"end":{"row":59,"column":15},"action":"insert","lines":["e"],"id":317}],[{"start":{"row":59,"column":15},"end":{"row":59,"column":16},"action":"insert","lines":["n"],"id":318}],[{"start":{"row":59,"column":16},"end":{"row":59,"column":17},"action":"insert","lines":["t"],"id":319}],[{"start":{"row":59,"column":17},"end":{"row":59,"column":18},"action":"insert","lines":["s"],"id":320}],[{"start":{"row":59,"column":18},"end":{"row":59,"column":19},"action":"insert","lines":[" "],"id":321}],[{"start":{"row":59,"column":18},"end":{"row":59,"column":19},"action":"remove","lines":[" "],"id":322}],[{"start":{"row":59,"column":18},"end":{"row":59,"column":19},"action":"insert","lines":[" "],"id":323}],[{"start":{"row":59,"column":19},"end":{"row":59,"column":20},"action":"insert","lines":["n"],"id":324}],[{"start":{"row":59,"column":20},"end":{"row":59,"column":21},"action":"insert","lines":["i"],"id":325}],[{"start":{"row":59,"column":21},"end":{"row":59,"column":22},"action":"insert","lines":["c"],"id":326}],[{"start":{"row":59,"column":22},"end":{"row":59,"column":23},"action":"insert","lines":["e"],"id":327}],[{"start":{"row":59,"column":23},"end":{"row":59,"column":24},"action":"insert","lines":["l"],"id":328}],[{"start":{"row":59,"column":24},"end":{"row":59,"column":25},"action":"insert","lines":["y"],"id":329}],[{"start":{"row":59,"column":25},"end":{"row":59,"column":26},"action":"insert","lines":[" "],"id":330}],[{"start":{"row":59,"column":25},"end":{"row":59,"column":26},"action":"remove","lines":[" "],"id":331}],[{"start":{"row":59,"column":25},"end":{"row":59,"column":26},"action":"insert","lines":["!"],"id":332}],[{"start":{"row":59,"column":25},"end":{"row":59,"column":26},"action":"remove","lines":["!"],"id":333}]]},"ace":{"folds":[],"scrolltop":887,"scrollleft":0,"selection":{"start":{"row":56,"column":0},"end":{"row":56,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":33,"state":"start","mode":"ace/mode/markdown"}},"timestamp":1445376348222,"hash":"e587863b656b78abbd867c752a2f964bed1bb541"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v4/seeds.js b/.c9/metadata/workspace/YelpCamp/v4/seeds.js deleted file mode 100644 index 8be5c77a..00000000 --- a/.c9/metadata/workspace/YelpCamp/v4/seeds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"seeds.js","tooltip":"/YelpCamp/v4/seeds.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":31,"column":21},"end":{"row":31,"column":21},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445317844506,"hash":"a5d54778d0395e716908eedad6d545b6b32c4d8e"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/index.ejs b/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/index.ejs deleted file mode 100644 index 6aa9946a..00000000 --- a/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/index.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.ejs","tooltip":"/YelpCamp/v4/views/campgrounds/index.ejs","ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":29,"column":11},"end":{"row":29,"column":11},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"hash":"457a357ae6422ce9d2dc834b70d846b39bb67e92","undoManager":{"mark":26,"position":26,"stack":[[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["."],"id":2}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["."],"id":3}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["/"],"id":4}],[{"start":{"row":29,"column":11},"end":{"row":29,"column":12},"action":"insert","lines":["."],"id":5}],[{"start":{"row":29,"column":12},"end":{"row":29,"column":13},"action":"insert","lines":["."],"id":6}],[{"start":{"row":29,"column":13},"end":{"row":29,"column":14},"action":"insert","lines":["/"],"id":7}],[{"start":{"row":29,"column":13},"end":{"row":29,"column":14},"action":"remove","lines":["/"],"id":8}],[{"start":{"row":29,"column":12},"end":{"row":29,"column":13},"action":"remove","lines":["."],"id":9}],[{"start":{"row":29,"column":11},"end":{"row":29,"column":12},"action":"remove","lines":["."],"id":10}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"remove","lines":["/"],"id":11}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"remove","lines":["."],"id":12}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"remove","lines":["."],"id":13}],[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["."],"id":14}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["."],"id":15}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["/"],"id":16}],[{"start":{"row":0,"column":32},"end":{"row":0,"column":33},"action":"insert","lines":[" "],"id":17}],[{"start":{"row":0,"column":33},"end":{"row":0,"column":34},"action":"insert","lines":["c"],"id":18}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"insert","lines":["d"],"id":19}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"insert","lines":["."],"id":20}],[{"start":{"row":0,"column":36},"end":{"row":0,"column":37},"action":"insert","lines":["."],"id":21}],[{"start":{"row":0,"column":36},"end":{"row":0,"column":37},"action":"remove","lines":["."],"id":22}],[{"start":{"row":0,"column":35},"end":{"row":0,"column":36},"action":"remove","lines":["."],"id":23}],[{"start":{"row":0,"column":34},"end":{"row":0,"column":35},"action":"remove","lines":["d"],"id":24}],[{"start":{"row":0,"column":33},"end":{"row":0,"column":34},"action":"remove","lines":["c"],"id":25}],[{"start":{"row":29,"column":11},"end":{"row":29,"column":12},"action":"insert","lines":["."],"id":26}],[{"start":{"row":29,"column":12},"end":{"row":29,"column":13},"action":"insert","lines":["."],"id":27}],[{"start":{"row":29,"column":13},"end":{"row":29,"column":14},"action":"insert","lines":["/"],"id":28}]]},"timestamp":1445320470000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/new.ejs b/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/new.ejs deleted file mode 100644 index 170ef2e1..00000000 --- a/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/new.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"new.ejs","tooltip":"/YelpCamp/v4/views/campgrounds/new.ejs","undoManager":{"mark":5,"position":5,"stack":[[{"start":{"row":0,"column":11},"end":{"row":0,"column":12},"action":"insert","lines":["."],"id":2}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"insert","lines":["."],"id":3}],[{"start":{"row":0,"column":13},"end":{"row":0,"column":14},"action":"insert","lines":["/"],"id":4}],[{"start":{"row":23,"column":11},"end":{"row":23,"column":12},"action":"insert","lines":["."],"id":5}],[{"start":{"row":23,"column":12},"end":{"row":23,"column":13},"action":"insert","lines":["."],"id":6}],[{"start":{"row":23,"column":13},"end":{"row":23,"column":14},"action":"insert","lines":["/"],"id":7}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":22},"end":{"row":8,"column":22},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445320487313,"hash":"2e55b7c51bbb7b76cc8b6f082aeedef06bb148c6"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/show.ejs b/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/show.ejs deleted file mode 100644 index 0d1526a4..00000000 --- a/.c9/metadata/workspace/YelpCamp/v4/views/campgrounds/show.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"show.ejs","tooltip":"/YelpCamp/v4/views/campgrounds/show.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":8,"column":49},"end":{"row":8,"column":50},"action":"insert","lines":["c"],"id":83}],[{"start":{"row":8,"column":50},"end":{"row":8,"column":51},"action":"insert","lines":["o"],"id":84}],[{"start":{"row":8,"column":51},"end":{"row":8,"column":52},"action":"insert","lines":["m"],"id":85}],[{"start":{"row":8,"column":52},"end":{"row":8,"column":53},"action":"insert","lines":["m"],"id":86}],[{"start":{"row":8,"column":53},"end":{"row":8,"column":54},"action":"insert","lines":["e"],"id":87}],[{"start":{"row":8,"column":54},"end":{"row":8,"column":55},"action":"insert","lines":["n"],"id":88}],[{"start":{"row":8,"column":55},"end":{"row":8,"column":56},"action":"insert","lines":["t"],"id":89}],[{"start":{"row":8,"column":55},"end":{"row":8,"column":56},"action":"remove","lines":["t"],"id":90}],[{"start":{"row":8,"column":54},"end":{"row":8,"column":55},"action":"remove","lines":["n"],"id":91}],[{"start":{"row":8,"column":53},"end":{"row":8,"column":54},"action":"remove","lines":["e"],"id":92}],[{"start":{"row":8,"column":52},"end":{"row":8,"column":53},"action":"remove","lines":["m"],"id":93}],[{"start":{"row":8,"column":51},"end":{"row":8,"column":52},"action":"remove","lines":["m"],"id":94}],[{"start":{"row":8,"column":50},"end":{"row":8,"column":51},"action":"remove","lines":["o"],"id":95}],[{"start":{"row":8,"column":49},"end":{"row":8,"column":50},"action":"remove","lines":["c"],"id":96}],[{"start":{"row":8,"column":48},"end":{"row":8,"column":49},"action":"remove","lines":["/"],"id":97}],[{"start":{"row":8,"column":47},"end":{"row":8,"column":48},"action":"insert","lines":["/"],"id":98}],[{"start":{"row":8,"column":48},"end":{"row":8,"column":49},"action":"insert","lines":["c"],"id":99}],[{"start":{"row":8,"column":49},"end":{"row":8,"column":50},"action":"insert","lines":["o"],"id":100}],[{"start":{"row":8,"column":50},"end":{"row":8,"column":51},"action":"insert","lines":["m"],"id":101}],[{"start":{"row":8,"column":51},"end":{"row":8,"column":52},"action":"insert","lines":["m"],"id":102}],[{"start":{"row":8,"column":52},"end":{"row":8,"column":53},"action":"insert","lines":["e"],"id":103}],[{"start":{"row":8,"column":53},"end":{"row":8,"column":54},"action":"insert","lines":["n"],"id":104}],[{"start":{"row":8,"column":54},"end":{"row":8,"column":55},"action":"insert","lines":["t"],"id":105}],[{"start":{"row":8,"column":55},"end":{"row":8,"column":56},"action":"insert","lines":["s"],"id":106}],[{"start":{"row":8,"column":56},"end":{"row":8,"column":57},"action":"insert","lines":[" "],"id":107}],[{"start":{"row":8,"column":56},"end":{"row":8,"column":57},"action":"remove","lines":[" "],"id":108}],[{"start":{"row":8,"column":56},"end":{"row":8,"column":57},"action":"insert","lines":["/"],"id":109}],[{"start":{"row":8,"column":57},"end":{"row":8,"column":58},"action":"insert","lines":["n"],"id":110}],[{"start":{"row":8,"column":58},"end":{"row":8,"column":59},"action":"insert","lines":["e"],"id":111}],[{"start":{"row":8,"column":59},"end":{"row":8,"column":60},"action":"insert","lines":["w"],"id":112}],[{"start":{"row":8,"column":60},"end":{"row":8,"column":61},"action":"insert","lines":[" "],"id":113}],[{"start":{"row":8,"column":60},"end":{"row":8,"column":61},"action":"remove","lines":[" "],"id":114}],[{"start":{"row":8,"column":62},"end":{"row":8,"column":63},"action":"insert","lines":["A"],"id":115}],[{"start":{"row":8,"column":63},"end":{"row":8,"column":64},"action":"insert","lines":["d"],"id":116}],[{"start":{"row":8,"column":64},"end":{"row":8,"column":65},"action":"insert","lines":["d"],"id":117}],[{"start":{"row":8,"column":65},"end":{"row":8,"column":66},"action":"insert","lines":[" "],"id":118}],[{"start":{"row":8,"column":66},"end":{"row":8,"column":67},"action":"insert","lines":["N"],"id":119}],[{"start":{"row":8,"column":67},"end":{"row":8,"column":68},"action":"insert","lines":["e"],"id":120}],[{"start":{"row":8,"column":68},"end":{"row":8,"column":69},"action":"insert","lines":["w"],"id":121}],[{"start":{"row":8,"column":69},"end":{"row":8,"column":70},"action":"insert","lines":[" "],"id":122}],[{"start":{"row":8,"column":70},"end":{"row":8,"column":71},"action":"insert","lines":["C"],"id":123}],[{"start":{"row":8,"column":71},"end":{"row":8,"column":72},"action":"insert","lines":["o"],"id":124}],[{"start":{"row":8,"column":72},"end":{"row":8,"column":73},"action":"insert","lines":["m"],"id":125}],[{"start":{"row":8,"column":73},"end":{"row":8,"column":74},"action":"insert","lines":["m"],"id":126}],[{"start":{"row":8,"column":74},"end":{"row":8,"column":75},"action":"insert","lines":["e"],"id":127}],[{"start":{"row":8,"column":75},"end":{"row":8,"column":76},"action":"insert","lines":["n"],"id":128}],[{"start":{"row":8,"column":76},"end":{"row":8,"column":77},"action":"insert","lines":["t"],"id":129}],[{"start":{"row":8,"column":77},"end":{"row":8,"column":78},"action":"insert","lines":[" "],"id":130}],[{"start":{"row":8,"column":77},"end":{"row":8,"column":78},"action":"remove","lines":[" "],"id":131}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"insert","lines":["c"],"id":132}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":["l"],"id":133}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":["a"],"id":134}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":["s"],"id":135}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"insert","lines":["s"],"id":136}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"insert","lines":[" "],"id":137}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"remove","lines":[" "],"id":138}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"insert","lines":["="],"id":139}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"insert","lines":["\""],"id":140}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"insert","lines":["\""],"id":141}],[{"start":{"row":8,"column":15},"end":{"row":8,"column":16},"action":"insert","lines":[" "],"id":142}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"insert","lines":["b"],"id":143}],[{"start":{"row":8,"column":15},"end":{"row":8,"column":16},"action":"insert","lines":["t"],"id":144}],[{"start":{"row":8,"column":16},"end":{"row":8,"column":17},"action":"insert","lines":["n"],"id":145}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":18},"action":"insert","lines":[" "],"id":146}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":18},"action":"remove","lines":[" "],"id":147}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":18},"action":"insert","lines":[" "],"id":148}],[{"start":{"row":8,"column":18},"end":{"row":8,"column":19},"action":"insert","lines":["b"],"id":149}],[{"start":{"row":8,"column":19},"end":{"row":8,"column":20},"action":"insert","lines":["t"],"id":150}],[{"start":{"row":8,"column":20},"end":{"row":8,"column":21},"action":"insert","lines":["n"],"id":151}],[{"start":{"row":8,"column":21},"end":{"row":8,"column":22},"action":"insert","lines":[" "],"id":152}],[{"start":{"row":8,"column":21},"end":{"row":8,"column":22},"action":"remove","lines":[" "],"id":153}],[{"start":{"row":8,"column":21},"end":{"row":8,"column":22},"action":"insert","lines":["-"],"id":154}],[{"start":{"row":8,"column":22},"end":{"row":8,"column":23},"action":"insert","lines":["s"],"id":155}],[{"start":{"row":8,"column":23},"end":{"row":8,"column":24},"action":"insert","lines":["u"],"id":156}],[{"start":{"row":8,"column":24},"end":{"row":8,"column":25},"action":"insert","lines":["c"],"id":157}],[{"start":{"row":8,"column":25},"end":{"row":8,"column":26},"action":"insert","lines":["c"],"id":158}],[{"start":{"row":8,"column":26},"end":{"row":8,"column":27},"action":"insert","lines":["e"],"id":159}],[{"start":{"row":8,"column":27},"end":{"row":8,"column":28},"action":"insert","lines":["s"],"id":160}],[{"start":{"row":8,"column":28},"end":{"row":8,"column":29},"action":"insert","lines":["s"],"id":161}],[{"start":{"row":8,"column":29},"end":{"row":8,"column":30},"action":"insert","lines":[" "],"id":162}],[{"start":{"row":8,"column":29},"end":{"row":8,"column":30},"action":"remove","lines":[" "],"id":163}],[{"start":{"row":0,"column":32},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":164}],[{"start":{"row":1,"column":0},"end":{"row":1,"column":1},"action":"insert","lines":["<"],"id":165}],[{"start":{"row":1,"column":1},"end":{"row":1,"column":2},"action":"insert","lines":["d"],"id":166}],[{"start":{"row":1,"column":2},"end":{"row":1,"column":3},"action":"insert","lines":["i"],"id":167}],[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"insert","lines":["v"],"id":168}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":[" "],"id":169}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"remove","lines":[" "],"id":170}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":11},"action":"insert","lines":[">
    "],"id":171}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":[" "],"id":172}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["c"],"id":173}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["l"],"id":174}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["a"],"id":175}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["s"],"id":176}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["s"],"id":177}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":[" "],"id":178}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"remove","lines":[" "],"id":179}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["="],"id":180}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":13},"action":"insert","lines":["\"\""],"id":181}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["c"],"id":182}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["
    ",""],"id":705}],[{"start":{"row":10,"column":0},"end":{"row":10,"column":62},"action":"insert","lines":["https://farm6.staticflickr.com/5487/11519019346_f66401b6c1.jpg"],"id":706}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":5,"column":36},"end":{"row":5,"column":36},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":47,"mode":"ace/mode/ejs"}},"timestamp":1445376269836,"hash":"fc2952938ebf926a271772397735f06276cf5caa"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v4/views/comments/new.ejs b/.c9/metadata/workspace/YelpCamp/v4/views/comments/new.ejs deleted file mode 100644 index a8954f07..00000000 --- a/.c9/metadata/workspace/YelpCamp/v4/views/comments/new.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"new.ejs","tooltip":"/YelpCamp/v4/views/comments/new.ejs","ace":{"folds":[],"scrolltop":82.5,"scrollleft":0,"selection":{"start":{"row":7,"column":66},"end":{"row":7,"column":73},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":78,"mode":"ace/mode/ejs"}},"hash":"af8ba9fbcf448aaf558203c045d3ee1158b491f2","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":5,"column":51},"end":{"row":5,"column":52},"action":"insert","lines":["n"],"id":104}],[{"start":{"row":5,"column":52},"end":{"row":5,"column":53},"action":"insert","lines":["d"],"id":105}],[{"start":{"row":5,"column":53},"end":{"row":5,"column":54},"action":"insert","lines":[" "],"id":106}],[{"start":{"row":5,"column":53},"end":{"row":5,"column":54},"action":"remove","lines":[" "],"id":107}],[{"start":{"row":5,"column":53},"end":{"row":5,"column":54},"action":"insert","lines":["."],"id":108}],[{"start":{"row":5,"column":54},"end":{"row":5,"column":55},"action":"insert","lines":["i"],"id":109}],[{"start":{"row":5,"column":55},"end":{"row":5,"column":56},"action":"insert","lines":["d"],"id":110}],[{"start":{"row":5,"column":55},"end":{"row":5,"column":56},"action":"remove","lines":["d"],"id":111}],[{"start":{"row":5,"column":54},"end":{"row":5,"column":55},"action":"remove","lines":["i"],"id":112}],[{"start":{"row":5,"column":54},"end":{"row":5,"column":55},"action":"insert","lines":["_"],"id":113}],[{"start":{"row":5,"column":55},"end":{"row":5,"column":56},"action":"insert","lines":["i"],"id":114}],[{"start":{"row":5,"column":56},"end":{"row":5,"column":57},"action":"insert","lines":["d"],"id":115}],[{"start":{"row":5,"column":57},"end":{"row":5,"column":58},"action":"insert","lines":[" "],"id":116}],[{"start":{"row":5,"column":57},"end":{"row":5,"column":58},"action":"remove","lines":[" "],"id":117}],[{"start":{"row":5,"column":60},"end":{"row":5,"column":61},"action":"insert","lines":["/"],"id":118}],[{"start":{"row":5,"column":61},"end":{"row":5,"column":62},"action":"insert","lines":["c"],"id":119}],[{"start":{"row":5,"column":62},"end":{"row":5,"column":63},"action":"insert","lines":["o"],"id":120}],[{"start":{"row":5,"column":63},"end":{"row":5,"column":64},"action":"insert","lines":["m"],"id":121}],[{"start":{"row":5,"column":64},"end":{"row":5,"column":65},"action":"insert","lines":["m"],"id":122}],[{"start":{"row":5,"column":65},"end":{"row":5,"column":66},"action":"insert","lines":["e"],"id":123}],[{"start":{"row":5,"column":66},"end":{"row":5,"column":67},"action":"insert","lines":["n"],"id":124}],[{"start":{"row":5,"column":67},"end":{"row":5,"column":68},"action":"insert","lines":["t"],"id":125}],[{"start":{"row":5,"column":68},"end":{"row":5,"column":69},"action":"insert","lines":["s"],"id":126}],[{"start":{"row":5,"column":69},"end":{"row":5,"column":70},"action":"insert","lines":[" "],"id":127}],[{"start":{"row":5,"column":69},"end":{"row":5,"column":70},"action":"remove","lines":[" "],"id":128}],[{"start":{"row":5,"column":69},"end":{"row":5,"column":70},"action":"insert","lines":["/"],"id":129}],[{"start":{"row":5,"column":70},"end":{"row":5,"column":71},"action":"insert","lines":["n"],"id":130}],[{"start":{"row":5,"column":71},"end":{"row":5,"column":72},"action":"insert","lines":["e"],"id":131}],[{"start":{"row":5,"column":72},"end":{"row":5,"column":73},"action":"insert","lines":["w"],"id":132}],[{"start":{"row":5,"column":73},"end":{"row":5,"column":74},"action":"insert","lines":[" "],"id":133}],[{"start":{"row":5,"column":73},"end":{"row":5,"column":74},"action":"remove","lines":[" "],"id":134}],[{"start":{"row":5,"column":72},"end":{"row":5,"column":73},"action":"remove","lines":["w"],"id":135}],[{"start":{"row":5,"column":71},"end":{"row":5,"column":72},"action":"remove","lines":["e"],"id":136}],[{"start":{"row":5,"column":70},"end":{"row":5,"column":71},"action":"remove","lines":["n"],"id":137}],[{"start":{"row":5,"column":69},"end":{"row":5,"column":70},"action":"remove","lines":["/"],"id":138}],[{"start":{"row":7,"column":88},"end":{"row":7,"column":89},"action":"remove","lines":["e"],"id":139}],[{"start":{"row":7,"column":87},"end":{"row":7,"column":88},"action":"remove","lines":["m"],"id":140}],[{"start":{"row":7,"column":86},"end":{"row":7,"column":87},"action":"remove","lines":["a"],"id":141}],[{"start":{"row":7,"column":85},"end":{"row":7,"column":86},"action":"remove","lines":["n"],"id":142}],[{"start":{"row":7,"column":85},"end":{"row":7,"column":86},"action":"insert","lines":["t"],"id":143}],[{"start":{"row":7,"column":86},"end":{"row":7,"column":87},"action":"insert","lines":["e"],"id":144}],[{"start":{"row":7,"column":87},"end":{"row":7,"column":88},"action":"insert","lines":["x"],"id":145}],[{"start":{"row":7,"column":88},"end":{"row":7,"column":89},"action":"insert","lines":["t"],"id":146}],[{"start":{"row":10,"column":89},"end":{"row":10,"column":95},"action":"remove","lines":["ge url"],"id":147}],[{"start":{"row":10,"column":88},"end":{"row":10,"column":89},"action":"remove","lines":["a"],"id":148}],[{"start":{"row":10,"column":87},"end":{"row":10,"column":88},"action":"remove","lines":["m"],"id":149}],[{"start":{"row":10,"column":86},"end":{"row":10,"column":87},"action":"remove","lines":["i"],"id":150}],[{"start":{"row":10,"column":86},"end":{"row":10,"column":87},"action":"insert","lines":["a"],"id":151}],[{"start":{"row":10,"column":87},"end":{"row":10,"column":88},"action":"insert","lines":["u"],"id":152}],[{"start":{"row":10,"column":88},"end":{"row":10,"column":89},"action":"insert","lines":["t"],"id":153}],[{"start":{"row":10,"column":89},"end":{"row":10,"column":90},"action":"insert","lines":["h"],"id":154}],[{"start":{"row":10,"column":90},"end":{"row":10,"column":91},"action":"insert","lines":["o"],"id":155}],[{"start":{"row":10,"column":91},"end":{"row":10,"column":92},"action":"insert","lines":["r"],"id":156}],[{"start":{"row":12,"column":15},"end":{"row":14,"column":22},"action":"remove","lines":["
    "," ","
    "],"id":157}],[{"start":{"row":12,"column":14},"end":{"row":12,"column":15},"action":"remove","lines":[" "],"id":158}],[{"start":{"row":12,"column":13},"end":{"row":12,"column":14},"action":"remove","lines":[" "],"id":159}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"remove","lines":[" "],"id":160}],[{"start":{"row":12,"column":8},"end":{"row":12,"column":12},"action":"remove","lines":[" "],"id":161}],[{"start":{"row":12,"column":4},"end":{"row":12,"column":8},"action":"remove","lines":[" "],"id":162}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":4},"action":"remove","lines":[" "],"id":163}],[{"start":{"row":11,"column":22},"end":{"row":12,"column":0},"action":"remove","lines":["",""],"id":164}],[{"start":{"row":10,"column":67},"end":{"row":10,"column":71},"action":"remove","lines":["mage"],"id":201}],[{"start":{"row":10,"column":66},"end":{"row":10,"column":67},"action":"remove","lines":["i"],"id":202}],[{"start":{"row":10,"column":66},"end":{"row":10,"column":67},"action":"insert","lines":["a"],"id":203}],[{"start":{"row":10,"column":67},"end":{"row":10,"column":68},"action":"insert","lines":["u"],"id":204}],[{"start":{"row":10,"column":68},"end":{"row":10,"column":69},"action":"insert","lines":["t"],"id":205}],[{"start":{"row":10,"column":69},"end":{"row":10,"column":70},"action":"insert","lines":["h"],"id":206}],[{"start":{"row":10,"column":70},"end":{"row":10,"column":71},"action":"insert","lines":["o"],"id":207}],[{"start":{"row":10,"column":71},"end":{"row":10,"column":72},"action":"insert","lines":["r"],"id":208}],[{"start":{"row":10,"column":72},"end":{"row":10,"column":73},"action":"insert","lines":[" "],"id":209}],[{"start":{"row":10,"column":72},"end":{"row":10,"column":73},"action":"remove","lines":[" "],"id":210}],[{"start":{"row":7,"column":69},"end":{"row":7,"column":70},"action":"remove","lines":["e"],"id":211}],[{"start":{"row":7,"column":68},"end":{"row":7,"column":69},"action":"remove","lines":["m"],"id":212}],[{"start":{"row":7,"column":67},"end":{"row":7,"column":68},"action":"remove","lines":["a"],"id":213}],[{"start":{"row":7,"column":66},"end":{"row":7,"column":67},"action":"remove","lines":["n"],"id":214}],[{"start":{"row":7,"column":66},"end":{"row":7,"column":67},"action":"insert","lines":["t"],"id":215}],[{"start":{"row":7,"column":67},"end":{"row":7,"column":68},"action":"insert","lines":["e"],"id":216}],[{"start":{"row":7,"column":68},"end":{"row":7,"column":69},"action":"insert","lines":["x"],"id":217}],[{"start":{"row":7,"column":69},"end":{"row":7,"column":70},"action":"insert","lines":["t"],"id":218}],[{"start":{"row":10,"column":66},"end":{"row":10,"column":67},"action":"insert","lines":["c"],"id":219}],[{"start":{"row":10,"column":67},"end":{"row":10,"column":68},"action":"insert","lines":["o"],"id":220}],[{"start":{"row":10,"column":68},"end":{"row":10,"column":69},"action":"insert","lines":["m"],"id":221}],[{"start":{"row":10,"column":69},"end":{"row":10,"column":70},"action":"insert","lines":["m"],"id":222}],[{"start":{"row":10,"column":70},"end":{"row":10,"column":71},"action":"insert","lines":["e"],"id":223}],[{"start":{"row":10,"column":71},"end":{"row":10,"column":72},"action":"insert","lines":["n"],"id":224}],[{"start":{"row":10,"column":72},"end":{"row":10,"column":73},"action":"insert","lines":["t"],"id":225}],[{"start":{"row":10,"column":73},"end":{"row":10,"column":74},"action":"insert","lines":[" "],"id":226}],[{"start":{"row":10,"column":73},"end":{"row":10,"column":74},"action":"remove","lines":[" "],"id":227}],[{"start":{"row":10,"column":73},"end":{"row":10,"column":74},"action":"insert","lines":["["],"id":228}],[{"start":{"row":10,"column":80},"end":{"row":10,"column":81},"action":"insert","lines":["]"],"id":229}],[{"start":{"row":7,"column":66},"end":{"row":7,"column":67},"action":"insert","lines":["c"],"id":230}],[{"start":{"row":7,"column":67},"end":{"row":7,"column":68},"action":"insert","lines":["o"],"id":231}],[{"start":{"row":7,"column":68},"end":{"row":7,"column":69},"action":"insert","lines":["m"],"id":232}],[{"start":{"row":7,"column":69},"end":{"row":7,"column":70},"action":"insert","lines":["m"],"id":233}],[{"start":{"row":7,"column":70},"end":{"row":7,"column":71},"action":"insert","lines":["e"],"id":234}],[{"start":{"row":7,"column":71},"end":{"row":7,"column":72},"action":"insert","lines":["n"],"id":235}],[{"start":{"row":7,"column":72},"end":{"row":7,"column":73},"action":"insert","lines":["t"],"id":236}],[{"start":{"row":7,"column":73},"end":{"row":7,"column":74},"action":"insert","lines":[" "],"id":237}],[{"start":{"row":7,"column":73},"end":{"row":7,"column":74},"action":"remove","lines":[" "],"id":238}],[{"start":{"row":7,"column":73},"end":{"row":7,"column":74},"action":"insert","lines":["["],"id":239}],[{"start":{"row":7,"column":78},"end":{"row":7,"column":79},"action":"insert","lines":["]"],"id":240}]]},"timestamp":1445320931000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v5/app.js b/.c9/metadata/workspace/YelpCamp/v5/app.js deleted file mode 100644 index e1bd574d..00000000 --- a/.c9/metadata/workspace/YelpCamp/v5/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v5/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"insert","lines":["p"],"id":17}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":["r"],"id":18}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["e"],"id":19}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":["s"],"id":20}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":["s"],"id":21}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"insert","lines":[" "],"id":22}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"remove","lines":[" "],"id":23}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"insert","lines":["."],"id":24}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"insert","lines":["s"],"id":25}],[{"start":{"row":11,"column":17},"end":{"row":11,"column":18},"action":"insert","lines":["t"],"id":26}],[{"start":{"row":11,"column":18},"end":{"row":11,"column":19},"action":"insert","lines":["a"],"id":27}],[{"start":{"row":11,"column":19},"end":{"row":11,"column":20},"action":"insert","lines":["t"],"id":28}],[{"start":{"row":11,"column":20},"end":{"row":11,"column":21},"action":"insert","lines":["i"],"id":29}],[{"start":{"row":11,"column":21},"end":{"row":11,"column":22},"action":"insert","lines":["c"],"id":30}],[{"start":{"row":11,"column":22},"end":{"row":11,"column":23},"action":"insert","lines":[" "],"id":31}],[{"start":{"row":11,"column":22},"end":{"row":11,"column":23},"action":"remove","lines":[" "],"id":32}],[{"start":{"row":11,"column":22},"end":{"row":11,"column":24},"action":"insert","lines":["()"],"id":33}],[{"start":{"row":11,"column":23},"end":{"row":11,"column":25},"action":"insert","lines":["\"\""],"id":34}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":25},"action":"insert","lines":["p"],"id":35}],[{"start":{"row":11,"column":25},"end":{"row":11,"column":26},"action":"insert","lines":["a"],"id":36}],[{"start":{"row":11,"column":25},"end":{"row":11,"column":26},"action":"remove","lines":["a"],"id":37}],[{"start":{"row":11,"column":25},"end":{"row":11,"column":26},"action":"insert","lines":["u"],"id":38}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"insert","lines":["b"],"id":39}],[{"start":{"row":11,"column":27},"end":{"row":11,"column":28},"action":"insert","lines":["l"],"id":40}],[{"start":{"row":11,"column":28},"end":{"row":11,"column":29},"action":"insert","lines":["i"],"id":41}],[{"start":{"row":11,"column":29},"end":{"row":11,"column":30},"action":"insert","lines":["c"],"id":42}],[{"start":{"row":11,"column":30},"end":{"row":11,"column":31},"action":"insert","lines":[" "],"id":43}],[{"start":{"row":11,"column":30},"end":{"row":11,"column":31},"action":"remove","lines":[" "],"id":44}],[{"start":{"row":11,"column":23},"end":{"row":11,"column":24},"action":"insert","lines":["_"],"id":45}],[{"start":{"row":11,"column":24},"end":{"row":11,"column":25},"action":"insert","lines":["_"],"id":46}],[{"start":{"row":11,"column":25},"end":{"row":11,"column":26},"action":"insert","lines":["d"],"id":47}],[{"start":{"row":11,"column":26},"end":{"row":11,"column":27},"action":"insert","lines":["i"],"id":48}],[{"start":{"row":11,"column":27},"end":{"row":11,"column":28},"action":"insert","lines":["r"],"id":49}],[{"start":{"row":11,"column":28},"end":{"row":11,"column":29},"action":"insert","lines":["n"],"id":50}],[{"start":{"row":11,"column":29},"end":{"row":11,"column":30},"action":"insert","lines":["a"],"id":51}],[{"start":{"row":11,"column":30},"end":{"row":11,"column":31},"action":"insert","lines":["m"],"id":52}],[{"start":{"row":11,"column":31},"end":{"row":11,"column":32},"action":"insert","lines":["e"],"id":53}],[{"start":{"row":11,"column":32},"end":{"row":11,"column":33},"action":"insert","lines":[" "],"id":54}],[{"start":{"row":11,"column":32},"end":{"row":11,"column":33},"action":"remove","lines":[" "],"id":55}],[{"start":{"row":11,"column":32},"end":{"row":11,"column":33},"action":"insert","lines":[" "],"id":56}],[{"start":{"row":11,"column":33},"end":{"row":11,"column":34},"action":"insert","lines":["+"],"id":57}],[{"start":{"row":11,"column":34},"end":{"row":11,"column":35},"action":"insert","lines":[" "],"id":58}],[{"start":{"row":11,"column":36},"end":{"row":11,"column":37},"action":"insert","lines":["/"],"id":59}],[{"start":{"row":11,"column":46},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":61}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":1},"action":"insert","lines":["c"],"id":62}],[{"start":{"row":12,"column":1},"end":{"row":12,"column":2},"action":"insert","lines":["o"],"id":63}],[{"start":{"row":12,"column":2},"end":{"row":12,"column":3},"action":"insert","lines":["n"],"id":64}],[{"start":{"row":12,"column":3},"end":{"row":12,"column":4},"action":"insert","lines":["s"],"id":65}],[{"start":{"row":12,"column":4},"end":{"row":12,"column":5},"action":"insert","lines":["o"],"id":66}],[{"start":{"row":12,"column":5},"end":{"row":12,"column":6},"action":"insert","lines":["l"],"id":67}],[{"start":{"row":12,"column":6},"end":{"row":12,"column":7},"action":"insert","lines":["e"],"id":68}],[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"insert","lines":[" "],"id":69}],[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"remove","lines":[" "],"id":70}],[{"start":{"row":12,"column":7},"end":{"row":12,"column":8},"action":"insert","lines":["."],"id":71}],[{"start":{"row":12,"column":8},"end":{"row":12,"column":9},"action":"insert","lines":["l"],"id":72}],[{"start":{"row":12,"column":9},"end":{"row":12,"column":10},"action":"insert","lines":["o"],"id":73}],[{"start":{"row":12,"column":10},"end":{"row":12,"column":11},"action":"insert","lines":["g"],"id":74}],[{"start":{"row":12,"column":11},"end":{"row":12,"column":12},"action":"insert","lines":[" "],"id":75}],[{"start":{"row":12,"column":11},"end":{"row":12,"column":12},"action":"remove","lines":[" "],"id":76}],[{"start":{"row":12,"column":11},"end":{"row":12,"column":13},"action":"insert","lines":["()"],"id":77}],[{"start":{"row":12,"column":12},"end":{"row":12,"column":13},"action":"insert","lines":["_"],"id":78}],[{"start":{"row":12,"column":13},"end":{"row":12,"column":14},"action":"insert","lines":["_"],"id":79}],[{"start":{"row":12,"column":14},"end":{"row":12,"column":15},"action":"insert","lines":["d"],"id":80}],[{"start":{"row":12,"column":15},"end":{"row":12,"column":16},"action":"insert","lines":["i"],"id":81}],[{"start":{"row":12,"column":16},"end":{"row":12,"column":17},"action":"insert","lines":["r"],"id":82}],[{"start":{"row":12,"column":17},"end":{"row":12,"column":18},"action":"insert","lines":["n"],"id":83}],[{"start":{"row":12,"column":18},"end":{"row":12,"column":19},"action":"insert","lines":["m"],"id":84}],[{"start":{"row":12,"column":19},"end":{"row":12,"column":20},"action":"insert","lines":["a"],"id":85}],[{"start":{"row":12,"column":20},"end":{"row":12,"column":21},"action":"insert","lines":["e"],"id":86}],[{"start":{"row":12,"column":21},"end":{"row":12,"column":22},"action":"insert","lines":[" "],"id":87}],[{"start":{"row":12,"column":21},"end":{"row":12,"column":22},"action":"remove","lines":[" "],"id":88}],[{"start":{"row":12,"column":20},"end":{"row":12,"column":21},"action":"remove","lines":["e"],"id":89}],[{"start":{"row":12,"column":19},"end":{"row":12,"column":20},"action":"remove","lines":["a"],"id":90}],[{"start":{"row":12,"column":18},"end":{"row":12,"column":19},"action":"remove","lines":["m"],"id":91}],[{"start":{"row":12,"column":18},"end":{"row":12,"column":19},"action":"insert","lines":["a"],"id":92}],[{"start":{"row":12,"column":19},"end":{"row":12,"column":20},"action":"insert","lines":["m"],"id":93}],[{"start":{"row":12,"column":20},"end":{"row":12,"column":21},"action":"insert","lines":["e"],"id":94}],[{"start":{"row":12,"column":21},"end":{"row":12,"column":22},"action":"insert","lines":[" "],"id":95}],[{"start":{"row":12,"column":21},"end":{"row":12,"column":22},"action":"remove","lines":[" "],"id":96}],[{"start":{"row":12,"column":22},"end":{"row":12,"column":23},"action":"insert","lines":[";"],"id":97}],[{"start":{"row":11,"column":46},"end":{"row":12,"column":0},"action":"insert","lines":["",""],"id":98}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":34},"action":"insert","lines":["/home/ubuntu/workspace/YelpCamp/v5"],"id":99}],[{"start":{"row":12,"column":34},"end":{"row":12,"column":35},"action":"insert","lines":["/"],"id":100}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"insert","lines":["u"],"id":101}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"remove","lines":["u"],"id":102}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"insert","lines":["o"],"id":103}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":37},"action":"insert","lines":["u"],"id":104}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":37},"action":"remove","lines":["u"],"id":105}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"remove","lines":["o"],"id":106}],[{"start":{"row":12,"column":35},"end":{"row":12,"column":36},"action":"insert","lines":["p"],"id":107}],[{"start":{"row":12,"column":36},"end":{"row":12,"column":37},"action":"insert","lines":["u"],"id":108}],[{"start":{"row":12,"column":37},"end":{"row":12,"column":38},"action":"insert","lines":["b"],"id":109}],[{"start":{"row":12,"column":38},"end":{"row":12,"column":39},"action":"insert","lines":["l"],"id":110}],[{"start":{"row":12,"column":39},"end":{"row":12,"column":40},"action":"insert","lines":["i"],"id":111}],[{"start":{"row":12,"column":40},"end":{"row":12,"column":41},"action":"insert","lines":["c"],"id":112}],[{"start":{"row":12,"column":41},"end":{"row":12,"column":42},"action":"insert","lines":[" "],"id":113}],[{"start":{"row":12,"column":41},"end":{"row":12,"column":42},"action":"remove","lines":[" "],"id":114}],[{"start":{"row":12,"column":0},"end":{"row":12,"column":41},"action":"remove","lines":["/home/ubuntu/workspace/YelpCamp/v5/public"],"id":115}],[{"start":{"row":11,"column":46},"end":{"row":12,"column":0},"action":"remove","lines":["",""],"id":116}],[{"start":{"row":11,"column":46},"end":{"row":11,"column":47},"action":"insert","lines":[";"],"id":117}],[{"start":{"row":12,"column":0},"end":{"row":13,"column":0},"action":"remove","lines":["console.log(__dirname);",""],"id":118}]]},"ace":{"folds":[],"scrolltop":64.5,"scrollleft":0,"selection":{"start":{"row":11,"column":42},"end":{"row":11,"column":42},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":1,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445384235115,"hash":"58a473f2f7374b05b74c0aa2413ace841a245732"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v5/public/stylesheets/main.css b/.c9/metadata/workspace/YelpCamp/v5/public/stylesheets/main.css deleted file mode 100644 index c346fd87..00000000 --- a/.c9/metadata/workspace/YelpCamp/v5/public/stylesheets/main.css +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"main.css","tooltip":"/YelpCamp/v5/public/stylesheets/main.css","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":12},"end":{"row":6,"column":1},"action":"insert","lines":[""," ","}"],"id":160}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["p"],"id":161}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["a"],"id":162}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["d"],"id":163}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["d"],"id":164}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["i"],"id":165}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["n"],"id":166}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["g"],"id":167}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":168}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"remove","lines":[" "],"id":169}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":13},"action":"insert","lines":[":;"],"id":170}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":[" "],"id":171}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["0"],"id":172}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":[" "],"id":173}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"remove","lines":[" "],"id":174}],[{"start":{"row":6,"column":1},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":175}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":176}],[{"start":{"row":8,"column":0},"end":{"row":8,"column":1},"action":"insert","lines":["."],"id":177}],[{"start":{"row":8,"column":1},"end":{"row":8,"column":2},"action":"insert","lines":["c"],"id":178}],[{"start":{"row":8,"column":2},"end":{"row":8,"column":3},"action":"insert","lines":["a"],"id":179}],[{"start":{"row":8,"column":3},"end":{"row":8,"column":4},"action":"insert","lines":["p"],"id":180}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"insert","lines":["t"],"id":181}],[{"start":{"row":8,"column":5},"end":{"row":8,"column":6},"action":"insert","lines":["i"],"id":182}],[{"start":{"row":8,"column":6},"end":{"row":8,"column":7},"action":"insert","lines":["o"],"id":183}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"insert","lines":["n"],"id":184}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":[" "],"id":185}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"remove","lines":[" "],"id":186}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":["-"],"id":187}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":["f"],"id":188}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":["u"],"id":189}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"insert","lines":["l"],"id":190}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"insert","lines":["l"],"id":191}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"insert","lines":[" "],"id":192}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"remove","lines":[" "],"id":193}],[{"start":{"row":8,"column":0},"end":{"row":8,"column":1},"action":"insert","lines":["."],"id":194}],[{"start":{"row":8,"column":1},"end":{"row":8,"column":2},"action":"insert","lines":["t"],"id":195}],[{"start":{"row":8,"column":2},"end":{"row":8,"column":3},"action":"insert","lines":["h"],"id":196}],[{"start":{"row":8,"column":3},"end":{"row":8,"column":4},"action":"insert","lines":["u"],"id":197}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"insert","lines":["m"],"id":198}],[{"start":{"row":8,"column":5},"end":{"row":8,"column":6},"action":"insert","lines":["b"],"id":199}],[{"start":{"row":8,"column":6},"end":{"row":8,"column":7},"action":"insert","lines":["a"],"id":200}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"insert","lines":["i"],"id":201}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":["l"],"id":202}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":[" "],"id":203}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"remove","lines":[" "],"id":204}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":[" "],"id":205}],[{"start":{"row":8,"column":23},"end":{"row":8,"column":24},"action":"insert","lines":[" "],"id":206}],[{"start":{"row":8,"column":24},"end":{"row":8,"column":25},"action":"insert","lines":["{"],"id":207}],[{"start":{"row":8,"column":25},"end":{"row":10,"column":1},"action":"insert","lines":[""," ","}"],"id":208}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"insert","lines":["p"],"id":209}],[{"start":{"row":9,"column":5},"end":{"row":9,"column":6},"action":"insert","lines":["a"],"id":210}],[{"start":{"row":9,"column":6},"end":{"row":9,"column":7},"action":"insert","lines":["d"],"id":211}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":["d"],"id":212}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"insert","lines":["i"],"id":213}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"insert","lines":["n"],"id":214}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["g"],"id":215}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":[" "],"id":216}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"remove","lines":[" "],"id":217}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":13},"action":"insert","lines":[":;"],"id":218}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":[" "],"id":219}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["9"],"id":220}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":["p"],"id":221}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"insert","lines":["x"],"id":222}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"insert","lines":[" "],"id":223}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"remove","lines":[" "],"id":224}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":10},"action":"remove","lines":["",".thumbail "],"id":226}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":227}],[{"start":{"row":8,"column":13},"end":{"row":10,"column":1},"action":"remove","lines":[" {"," padding: 9px;","}"],"id":228}],[{"start":{"row":8,"column":0},"end":{"row":8,"column":1},"action":"insert","lines":["."],"id":229}],[{"start":{"row":8,"column":1},"end":{"row":8,"column":2},"action":"insert","lines":["t"],"id":230}],[{"start":{"row":8,"column":2},"end":{"row":8,"column":3},"action":"insert","lines":["h"],"id":231}],[{"start":{"row":8,"column":3},"end":{"row":8,"column":4},"action":"insert","lines":["u"],"id":232}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"insert","lines":["m"],"id":233}],[{"start":{"row":8,"column":5},"end":{"row":8,"column":6},"action":"insert","lines":["b"],"id":234}],[{"start":{"row":8,"column":6},"end":{"row":8,"column":7},"action":"insert","lines":["n"],"id":235}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"insert","lines":["a"],"id":236}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":["i"],"id":237}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":["l"],"id":238}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":[" "],"id":239}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"remove","lines":[" "],"id":240}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":[" "],"id":241}],[{"start":{"row":8,"column":24},"end":{"row":8,"column":25},"action":"insert","lines":[" "],"id":242}],[{"start":{"row":8,"column":25},"end":{"row":8,"column":26},"action":"insert","lines":["P"],"id":243},{"start":{"row":8,"column":26},"end":{"row":8,"column":27},"action":"insert","lines":["{"]}],[{"start":{"row":8,"column":27},"end":{"row":10,"column":1},"action":"insert","lines":[""," ","}"],"id":244}],[{"start":{"row":8,"column":25},"end":{"row":8,"column":26},"action":"remove","lines":["P"],"id":245}],[{"start":{"row":9,"column":4},"end":{"row":9,"column":5},"action":"insert","lines":["p"],"id":246}],[{"start":{"row":9,"column":5},"end":{"row":9,"column":6},"action":"insert","lines":["a"],"id":247}],[{"start":{"row":9,"column":6},"end":{"row":9,"column":7},"action":"insert","lines":["d"],"id":248}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":["d"],"id":249}],[{"start":{"row":9,"column":8},"end":{"row":9,"column":9},"action":"insert","lines":["i"],"id":250}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"insert","lines":["n"],"id":251}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["g"],"id":252}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":[" "],"id":253}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"remove","lines":[" "],"id":254}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":13},"action":"insert","lines":[":;"],"id":255}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":[" "],"id":256}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":["9"],"id":257}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":15},"action":"insert","lines":["p"],"id":258}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"insert","lines":["x"],"id":259}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"insert","lines":[" "],"id":260}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"remove","lines":[" "],"id":261}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":4,"column":12},"end":{"row":4,"column":12},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445384807077,"hash":"4ed8405a9f532b155710bec877ed91ee60909c53"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v5/readme.md b/.c9/metadata/workspace/YelpCamp/v5/readme.md deleted file mode 100644 index b9f93a96..00000000 --- a/.c9/metadata/workspace/YelpCamp/v5/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v5/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":61,"column":6},"end":{"row":61,"column":7},"action":"insert","lines":["h"],"id":55}],[{"start":{"row":61,"column":7},"end":{"row":61,"column":8},"action":"insert","lines":[" "],"id":56}],[{"start":{"row":61,"column":8},"end":{"row":61,"column":9},"action":"insert","lines":["S"],"id":57}],[{"start":{"row":61,"column":9},"end":{"row":61,"column":10},"action":"insert","lines":["t"],"id":58}],[{"start":{"row":61,"column":10},"end":{"row":61,"column":11},"action":"insert","lines":["l"],"id":59}],[{"start":{"row":61,"column":11},"end":{"row":61,"column":12},"action":"insert","lines":["y"],"id":60}],[{"start":{"row":61,"column":12},"end":{"row":61,"column":13},"action":"insert","lines":["i"],"id":61}],[{"start":{"row":61,"column":13},"end":{"row":61,"column":14},"action":"insert","lines":["n"],"id":62}],[{"start":{"row":61,"column":14},"end":{"row":61,"column":15},"action":"insert","lines":["g"],"id":63}],[{"start":{"row":61,"column":14},"end":{"row":61,"column":15},"action":"remove","lines":["g"],"id":64}],[{"start":{"row":61,"column":13},"end":{"row":61,"column":14},"action":"remove","lines":["n"],"id":65}],[{"start":{"row":61,"column":12},"end":{"row":61,"column":13},"action":"remove","lines":["i"],"id":66}],[{"start":{"row":61,"column":11},"end":{"row":61,"column":12},"action":"remove","lines":["y"],"id":67}],[{"start":{"row":61,"column":10},"end":{"row":61,"column":11},"action":"remove","lines":["l"],"id":68}],[{"start":{"row":61,"column":10},"end":{"row":61,"column":11},"action":"insert","lines":["y"],"id":69}],[{"start":{"row":61,"column":11},"end":{"row":61,"column":12},"action":"insert","lines":["l"],"id":70}],[{"start":{"row":61,"column":12},"end":{"row":61,"column":13},"action":"insert","lines":["i"],"id":71}],[{"start":{"row":61,"column":13},"end":{"row":61,"column":14},"action":"insert","lines":["n"],"id":72}],[{"start":{"row":61,"column":14},"end":{"row":61,"column":15},"action":"insert","lines":["g"],"id":73}],[{"start":{"row":61,"column":15},"end":{"row":61,"column":16},"action":"insert","lines":[" "],"id":74}],[{"start":{"row":61,"column":16},"end":{"row":61,"column":17},"action":"insert","lines":["S"],"id":75}],[{"start":{"row":61,"column":17},"end":{"row":61,"column":18},"action":"insert","lines":["h"],"id":76}],[{"start":{"row":61,"column":18},"end":{"row":61,"column":19},"action":"insert","lines":["o"],"id":77}],[{"start":{"row":61,"column":19},"end":{"row":61,"column":20},"action":"insert","lines":["w"],"id":78}],[{"start":{"row":61,"column":20},"end":{"row":61,"column":21},"action":"insert","lines":[" "],"id":79}],[{"start":{"row":61,"column":21},"end":{"row":61,"column":22},"action":"insert","lines":["P"],"id":80}],[{"start":{"row":61,"column":22},"end":{"row":61,"column":23},"action":"insert","lines":["a"],"id":81}],[{"start":{"row":61,"column":23},"end":{"row":61,"column":24},"action":"insert","lines":["g"],"id":82}],[{"start":{"row":61,"column":24},"end":{"row":61,"column":25},"action":"insert","lines":["e"],"id":83},{"start":{"row":61,"column":25},"end":{"row":61,"column":26},"action":"insert","lines":[" "]}],[{"start":{"row":61,"column":25},"end":{"row":61,"column":26},"action":"remove","lines":[" "],"id":84}],[{"start":{"row":61,"column":25},"end":{"row":62,"column":0},"action":"insert","lines":["",""],"id":85}],[{"start":{"row":62,"column":0},"end":{"row":62,"column":1},"action":"insert","lines":["("],"id":86}],[{"start":{"row":62,"column":0},"end":{"row":62,"column":1},"action":"remove","lines":["("],"id":87}],[{"start":{"row":62,"column":0},"end":{"row":62,"column":1},"action":"insert","lines":["("],"id":88}],[{"start":{"row":62,"column":0},"end":{"row":62,"column":1},"action":"remove","lines":["("],"id":89}],[{"start":{"row":62,"column":0},"end":{"row":62,"column":1},"action":"insert","lines":["*"],"id":90}],[{"start":{"row":62,"column":1},"end":{"row":62,"column":2},"action":"insert","lines":[" "],"id":91}],[{"start":{"row":62,"column":2},"end":{"row":62,"column":3},"action":"insert","lines":["a"],"id":92}],[{"start":{"row":62,"column":3},"end":{"row":62,"column":4},"action":"insert","lines":["d"],"id":93}],[{"start":{"row":62,"column":3},"end":{"row":62,"column":4},"action":"remove","lines":["d"],"id":94}],[{"start":{"row":62,"column":2},"end":{"row":62,"column":3},"action":"remove","lines":["a"],"id":95}],[{"start":{"row":62,"column":2},"end":{"row":62,"column":3},"action":"insert","lines":["A"],"id":96}],[{"start":{"row":62,"column":3},"end":{"row":62,"column":4},"action":"insert","lines":["d"],"id":97}],[{"start":{"row":62,"column":4},"end":{"row":62,"column":5},"action":"insert","lines":["d"],"id":98}],[{"start":{"row":62,"column":5},"end":{"row":62,"column":6},"action":"insert","lines":[" "],"id":99}],[{"start":{"row":62,"column":5},"end":{"row":62,"column":6},"action":"remove","lines":[" "],"id":100}],[{"start":{"row":62,"column":5},"end":{"row":62,"column":6},"action":"insert","lines":[" "],"id":101}],[{"start":{"row":62,"column":6},"end":{"row":62,"column":7},"action":"insert","lines":["p"],"id":102}],[{"start":{"row":62,"column":7},"end":{"row":62,"column":8},"action":"insert","lines":["u"],"id":103}],[{"start":{"row":62,"column":8},"end":{"row":62,"column":9},"action":"insert","lines":["b"],"id":104}],[{"start":{"row":62,"column":9},"end":{"row":62,"column":10},"action":"insert","lines":["l"],"id":105}],[{"start":{"row":62,"column":10},"end":{"row":62,"column":11},"action":"insert","lines":["i"],"id":106}],[{"start":{"row":62,"column":11},"end":{"row":62,"column":12},"action":"insert","lines":["c"],"id":107}],[{"start":{"row":62,"column":12},"end":{"row":62,"column":13},"action":"insert","lines":[" "],"id":108}],[{"start":{"row":62,"column":13},"end":{"row":62,"column":14},"action":"insert","lines":["d"],"id":109}],[{"start":{"row":62,"column":14},"end":{"row":62,"column":15},"action":"insert","lines":["i"],"id":110}],[{"start":{"row":62,"column":15},"end":{"row":62,"column":16},"action":"insert","lines":["r"],"id":111}],[{"start":{"row":62,"column":16},"end":{"row":62,"column":17},"action":"insert","lines":["e"],"id":112}],[{"start":{"row":62,"column":17},"end":{"row":62,"column":18},"action":"insert","lines":["c"],"id":113}],[{"start":{"row":62,"column":18},"end":{"row":62,"column":19},"action":"insert","lines":["t"],"id":114}],[{"start":{"row":62,"column":19},"end":{"row":62,"column":20},"action":"insert","lines":["o"],"id":115}],[{"start":{"row":62,"column":20},"end":{"row":62,"column":21},"action":"insert","lines":["u"],"id":116}],[{"start":{"row":62,"column":21},"end":{"row":62,"column":22},"action":"insert","lines":[" "],"id":117}],[{"start":{"row":62,"column":21},"end":{"row":62,"column":22},"action":"remove","lines":[" "],"id":118}],[{"start":{"row":62,"column":21},"end":{"row":62,"column":22},"action":"insert","lines":["r"],"id":119}],[{"start":{"row":62,"column":22},"end":{"row":62,"column":23},"action":"insert","lines":["y"],"id":120}],[{"start":{"row":62,"column":22},"end":{"row":62,"column":23},"action":"remove","lines":["y"],"id":121}],[{"start":{"row":62,"column":21},"end":{"row":62,"column":22},"action":"remove","lines":["r"],"id":122}],[{"start":{"row":62,"column":20},"end":{"row":62,"column":21},"action":"remove","lines":["u"],"id":123}],[{"start":{"row":62,"column":20},"end":{"row":62,"column":21},"action":"insert","lines":["r"],"id":124}],[{"start":{"row":62,"column":21},"end":{"row":62,"column":22},"action":"insert","lines":["y"],"id":125}],[{"start":{"row":62,"column":22},"end":{"row":62,"column":23},"action":"insert","lines":[" "],"id":126}],[{"start":{"row":62,"column":22},"end":{"row":62,"column":23},"action":"remove","lines":[" "],"id":127}],[{"start":{"row":62,"column":22},"end":{"row":63,"column":0},"action":"insert","lines":["",""],"id":128},{"start":{"row":63,"column":0},"end":{"row":63,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":63,"column":2},"end":{"row":63,"column":3},"action":"insert","lines":["A"],"id":129}],[{"start":{"row":63,"column":3},"end":{"row":63,"column":4},"action":"insert","lines":["d"],"id":130}],[{"start":{"row":63,"column":4},"end":{"row":63,"column":5},"action":"insert","lines":["d"],"id":131}],[{"start":{"row":63,"column":5},"end":{"row":63,"column":6},"action":"insert","lines":[" "],"id":132}],[{"start":{"row":63,"column":6},"end":{"row":63,"column":7},"action":"insert","lines":["c"],"id":133}],[{"start":{"row":63,"column":7},"end":{"row":63,"column":8},"action":"insert","lines":["u"],"id":134}],[{"start":{"row":63,"column":8},"end":{"row":63,"column":9},"action":"insert","lines":["t"],"id":135}],[{"start":{"row":63,"column":8},"end":{"row":63,"column":9},"action":"remove","lines":["t"],"id":136}],[{"start":{"row":63,"column":8},"end":{"row":63,"column":9},"action":"insert","lines":["s"],"id":137}],[{"start":{"row":63,"column":9},"end":{"row":63,"column":10},"action":"insert","lines":["t"],"id":138}],[{"start":{"row":63,"column":10},"end":{"row":63,"column":11},"action":"insert","lines":["o"],"id":139}],[{"start":{"row":63,"column":11},"end":{"row":63,"column":12},"action":"insert","lines":["m"],"id":140}],[{"start":{"row":63,"column":12},"end":{"row":63,"column":13},"action":"insert","lines":[" "],"id":141}],[{"start":{"row":63,"column":13},"end":{"row":63,"column":14},"action":"insert","lines":["s"],"id":142}],[{"start":{"row":63,"column":14},"end":{"row":63,"column":15},"action":"insert","lines":["t"],"id":143}],[{"start":{"row":63,"column":15},"end":{"row":63,"column":16},"action":"insert","lines":["y"],"id":144}],[{"start":{"row":63,"column":16},"end":{"row":63,"column":17},"action":"insert","lines":["l"],"id":145}],[{"start":{"row":63,"column":17},"end":{"row":63,"column":18},"action":"insert","lines":["e"],"id":146}],[{"start":{"row":63,"column":18},"end":{"row":63,"column":19},"action":"insert","lines":["h"],"id":147}],[{"start":{"row":63,"column":18},"end":{"row":63,"column":19},"action":"remove","lines":["h"],"id":148}],[{"start":{"row":63,"column":18},"end":{"row":63,"column":19},"action":"insert","lines":["s"],"id":149}],[{"start":{"row":63,"column":19},"end":{"row":63,"column":20},"action":"insert","lines":["h"],"id":150}],[{"start":{"row":63,"column":20},"end":{"row":63,"column":21},"action":"insert","lines":["e"],"id":151}],[{"start":{"row":63,"column":21},"end":{"row":63,"column":22},"action":"insert","lines":["e"],"id":152}],[{"start":{"row":63,"column":22},"end":{"row":63,"column":23},"action":"insert","lines":["t"],"id":153}],[{"start":{"row":63,"column":23},"end":{"row":63,"column":24},"action":"insert","lines":[" "],"id":154}],[{"start":{"row":63,"column":23},"end":{"row":63,"column":24},"action":"remove","lines":[" "],"id":155}]]},"ace":{"folds":[],"scrolltop":1322.5,"scrollleft":0,"selection":{"start":{"row":61,"column":25},"end":{"row":61,"column":25},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":49,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445383703311,"hash":"1ade993167950d598c28dd6c85be3d87a3ee6a09"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v5/seeds.js b/.c9/metadata/workspace/YelpCamp/v5/seeds.js deleted file mode 100644 index 6cf543a5..00000000 --- a/.c9/metadata/workspace/YelpCamp/v5/seeds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"seeds.js","tooltip":"/YelpCamp/v5/seeds.js","undoManager":{"mark":12,"position":12,"stack":[[{"start":{"row":12,"column":18},"end":{"row":12,"column":78},"action":"remove","lines":["tps://farm4.staticflickr.com/3859/15123592300_6eecab209b.jpg"],"id":56}],[{"start":{"row":12,"column":17},"end":{"row":12,"column":18},"action":"remove","lines":["t"],"id":57}],[{"start":{"row":12,"column":16},"end":{"row":12,"column":17},"action":"remove","lines":["h"],"id":58}],[{"start":{"row":12,"column":16},"end":{"row":12,"column":78},"action":"insert","lines":["https://farm6.staticflickr.com/5487/11519019346_f66401b6c1.jpg"],"id":59}],[{"start":{"row":8,"column":23},"end":{"row":8,"column":36},"action":"remove","lines":["lah blah blah"],"id":68}],[{"start":{"row":8,"column":22},"end":{"row":8,"column":23},"action":"remove","lines":["b"],"id":69}],[{"start":{"row":8,"column":22},"end":{"row":8,"column":467},"action":"insert","lines":["Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"],"id":70}],[{"start":{"row":13,"column":24},"end":{"row":13,"column":36},"action":"remove","lines":["ah blah blah"],"id":71}],[{"start":{"row":13,"column":23},"end":{"row":13,"column":24},"action":"remove","lines":["l"],"id":72}],[{"start":{"row":13,"column":22},"end":{"row":13,"column":23},"action":"remove","lines":["b"],"id":73}],[{"start":{"row":13,"column":22},"end":{"row":13,"column":467},"action":"insert","lines":["Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"],"id":74}],[{"start":{"row":18,"column":22},"end":{"row":18,"column":36},"action":"remove","lines":["blah blah blah"],"id":75}],[{"start":{"row":18,"column":22},"end":{"row":18,"column":467},"action":"insert","lines":["Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum"],"id":76}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":18,"column":467},"end":{"row":18,"column":467},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445377738907,"hash":"bb328fd4d11e1843d92999cedc979e3c2878c462"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v5/views/campgrounds/show.ejs b/.c9/metadata/workspace/YelpCamp/v5/views/campgrounds/show.ejs deleted file mode 100644 index 7fa211c7..00000000 --- a/.c9/metadata/workspace/YelpCamp/v5/views/campgrounds/show.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"show.ejs","tooltip":"/YelpCamp/v5/views/campgrounds/show.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"insert","lines":[" "],"id":681}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"remove","lines":[" "],"id":682}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":41},"action":"insert","lines":[">"],"id":683}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"insert","lines":[" "],"id":684}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"insert","lines":["c"],"id":685}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"insert","lines":["l"],"id":686}],[{"start":{"row":28,"column":36},"end":{"row":28,"column":37},"action":"insert","lines":["a"],"id":687}],[{"start":{"row":28,"column":37},"end":{"row":28,"column":38},"action":"insert","lines":["s"],"id":688}],[{"start":{"row":28,"column":38},"end":{"row":28,"column":39},"action":"insert","lines":["s"],"id":689}],[{"start":{"row":28,"column":39},"end":{"row":28,"column":40},"action":"insert","lines":[" "],"id":690}],[{"start":{"row":28,"column":39},"end":{"row":28,"column":40},"action":"remove","lines":[" "],"id":691}],[{"start":{"row":28,"column":39},"end":{"row":28,"column":40},"action":"insert","lines":["="],"id":692}],[{"start":{"row":28,"column":40},"end":{"row":28,"column":42},"action":"insert","lines":["\"\""],"id":694}],[{"start":{"row":28,"column":41},"end":{"row":28,"column":42},"action":"insert","lines":["p"],"id":695}],[{"start":{"row":28,"column":42},"end":{"row":28,"column":43},"action":"insert","lines":["u"],"id":696}],[{"start":{"row":28,"column":43},"end":{"row":28,"column":44},"action":"insert","lines":["l"],"id":697}],[{"start":{"row":28,"column":44},"end":{"row":28,"column":45},"action":"insert","lines":["l"],"id":698}],[{"start":{"row":28,"column":45},"end":{"row":28,"column":46},"action":"insert","lines":["-"],"id":699}],[{"start":{"row":28,"column":46},"end":{"row":28,"column":47},"action":"insert","lines":["r"],"id":700}],[{"start":{"row":28,"column":47},"end":{"row":28,"column":48},"action":"insert","lines":["i"],"id":701}],[{"start":{"row":28,"column":48},"end":{"row":28,"column":49},"action":"insert","lines":["g"],"id":702}],[{"start":{"row":28,"column":49},"end":{"row":28,"column":50},"action":"insert","lines":["h"],"id":703}],[{"start":{"row":28,"column":50},"end":{"row":28,"column":51},"action":"insert","lines":["t"],"id":704}],[{"start":{"row":28,"column":51},"end":{"row":28,"column":52},"action":"insert","lines":[" "],"id":705}],[{"start":{"row":28,"column":51},"end":{"row":28,"column":52},"action":"remove","lines":[" "],"id":706}],[{"start":{"row":28,"column":53},"end":{"row":28,"column":54},"action":"insert","lines":["1"],"id":707}],[{"start":{"row":28,"column":54},"end":{"row":28,"column":55},"action":"insert","lines":["0"],"id":708}],[{"start":{"row":28,"column":55},"end":{"row":28,"column":56},"action":"insert","lines":[" "],"id":709}],[{"start":{"row":28,"column":55},"end":{"row":28,"column":56},"action":"remove","lines":[" "],"id":710}],[{"start":{"row":28,"column":55},"end":{"row":28,"column":56},"action":"insert","lines":[" "],"id":711}],[{"start":{"row":28,"column":56},"end":{"row":28,"column":57},"action":"insert","lines":["d"],"id":712}],[{"start":{"row":28,"column":57},"end":{"row":28,"column":58},"action":"insert","lines":["a"],"id":713}],[{"start":{"row":28,"column":58},"end":{"row":28,"column":59},"action":"insert","lines":["y"],"id":714}],[{"start":{"row":28,"column":59},"end":{"row":28,"column":60},"action":"insert","lines":["s"],"id":715}],[{"start":{"row":28,"column":60},"end":{"row":28,"column":61},"action":"insert","lines":[" "],"id":716}],[{"start":{"row":28,"column":61},"end":{"row":28,"column":62},"action":"insert","lines":["a"],"id":717}],[{"start":{"row":28,"column":62},"end":{"row":28,"column":63},"action":"insert","lines":["g"],"id":718}],[{"start":{"row":28,"column":63},"end":{"row":28,"column":64},"action":"insert","lines":["o"],"id":719}],[{"start":{"row":28,"column":64},"end":{"row":28,"column":65},"action":"insert","lines":[" "],"id":720}],[{"start":{"row":28,"column":64},"end":{"row":28,"column":65},"action":"remove","lines":[" "],"id":721}],[{"start":{"row":32,"column":44},"end":{"row":32,"column":63},"action":"remove","lines":["<%= comment.text %>"],"id":722}],[{"start":{"row":32,"column":25},"end":{"row":32,"column":43},"action":"remove","lines":["strong> -"],"id":723}],[{"start":{"row":32,"column":24},"end":{"row":32,"column":25},"action":"remove","lines":["<"],"id":724}],[{"start":{"row":32,"column":24},"end":{"row":32,"column":43},"action":"insert","lines":["<%= comment.text %>"],"id":725}],[{"start":{"row":31,"column":20},"end":{"row":33,"column":24},"action":"remove","lines":["

    "," <%= comment.text %> ","

    "],"id":727}],[{"start":{"row":28,"column":71},"end":{"row":29,"column":0},"action":"insert","lines":["",""],"id":728},{"start":{"row":29,"column":0},"end":{"row":29,"column":28},"action":"insert","lines":[" "]}],[{"start":{"row":29,"column":28},"end":{"row":31,"column":24},"action":"insert","lines":["

    "," <%= comment.text %> ","

    "],"id":729}],[{"start":{"row":30,"column":24},"end":{"row":30,"column":28},"action":"insert","lines":[" "],"id":730}],[{"start":{"row":30,"column":28},"end":{"row":30,"column":32},"action":"insert","lines":[" "],"id":731}],[{"start":{"row":31,"column":20},"end":{"row":31,"column":24},"action":"insert","lines":[" "],"id":732}],[{"start":{"row":31,"column":24},"end":{"row":31,"column":28},"action":"insert","lines":[" "],"id":733}],[{"start":{"row":31,"column":28},"end":{"row":31,"column":32},"action":"insert","lines":[" "],"id":734}],[{"start":{"row":31,"column":28},"end":{"row":31,"column":32},"action":"remove","lines":[" "],"id":735}],[{"start":{"row":34,"column":16},"end":{"row":34,"column":20},"action":"remove","lines":[" "],"id":736}],[{"start":{"row":34,"column":12},"end":{"row":34,"column":16},"action":"remove","lines":[" "],"id":737}],[{"start":{"row":34,"column":8},"end":{"row":34,"column":12},"action":"remove","lines":[" "],"id":738}],[{"start":{"row":34,"column":4},"end":{"row":34,"column":8},"action":"remove","lines":[" "],"id":739}],[{"start":{"row":34,"column":0},"end":{"row":34,"column":4},"action":"remove","lines":[" "],"id":740}],[{"start":{"row":33,"column":26},"end":{"row":34,"column":0},"action":"remove","lines":["",""],"id":741}],[{"start":{"row":23,"column":22},"end":{"row":24,"column":0},"action":"insert","lines":["",""],"id":742},{"start":{"row":24,"column":0},"end":{"row":24,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":24,"column":16},"end":{"row":24,"column":17},"action":"insert","lines":["<"],"id":743}],[{"start":{"row":24,"column":17},"end":{"row":24,"column":18},"action":"insert","lines":["h"],"id":744}],[{"start":{"row":24,"column":18},"end":{"row":24,"column":19},"action":"insert","lines":["r"],"id":745}],[{"start":{"row":24,"column":19},"end":{"row":24,"column":20},"action":"insert","lines":[" "],"id":746}],[{"start":{"row":24,"column":19},"end":{"row":24,"column":20},"action":"remove","lines":[" "],"id":747}],[{"start":{"row":24,"column":19},"end":{"row":24,"column":20},"action":"insert","lines":[">"],"id":748}],[{"start":{"row":28,"column":28},"end":{"row":28,"column":29},"action":"insert","lines":["<"],"id":749}],[{"start":{"row":28,"column":29},"end":{"row":28,"column":30},"action":"insert","lines":["s"],"id":750}],[{"start":{"row":28,"column":30},"end":{"row":28,"column":31},"action":"insert","lines":["t"],"id":751}],[{"start":{"row":28,"column":31},"end":{"row":28,"column":32},"action":"insert","lines":["r"],"id":752}],[{"start":{"row":28,"column":32},"end":{"row":28,"column":33},"action":"insert","lines":["i"],"id":753}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"insert","lines":["n"],"id":754}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"insert","lines":["g"],"id":755}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"insert","lines":[" "],"id":756}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"remove","lines":[" "],"id":757}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"remove","lines":["g"],"id":758}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"remove","lines":["n"],"id":759}],[{"start":{"row":28,"column":32},"end":{"row":28,"column":33},"action":"remove","lines":["i"],"id":760}],[{"start":{"row":28,"column":32},"end":{"row":28,"column":33},"action":"insert","lines":["o"],"id":761}],[{"start":{"row":28,"column":33},"end":{"row":28,"column":34},"action":"insert","lines":["n"],"id":762}],[{"start":{"row":28,"column":34},"end":{"row":28,"column":35},"action":"insert","lines":["g"],"id":763}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"insert","lines":[" "],"id":764}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":36},"action":"remove","lines":[" "],"id":765}],[{"start":{"row":28,"column":35},"end":{"row":28,"column":45},"action":"insert","lines":[">"],"id":766}],[{"start":{"row":28,"column":45},"end":{"row":28,"column":66},"action":"remove","lines":["<%= comment.author %>"],"id":767}],[{"start":{"row":28,"column":36},"end":{"row":28,"column":57},"action":"insert","lines":["<%= comment.author %>"],"id":768}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":769}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":770}],[{"start":{"row":1,"column":0},"end":{"row":1,"column":1},"action":"insert","lines":["<"],"id":771}],[{"start":{"row":1,"column":1},"end":{"row":1,"column":2},"action":"insert","lines":["s"],"id":772}],[{"start":{"row":1,"column":2},"end":{"row":1,"column":3},"action":"insert","lines":["t"],"id":773}],[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"insert","lines":["y"],"id":774}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["l"],"id":775}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["e"],"id":776}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":[" "],"id":777}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"remove","lines":[" "],"id":778}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":15},"action":"insert","lines":[">"],"id":779}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":780}],[{"start":{"row":1,"column":0},"end":{"row":1,"column":1},"action":"insert","lines":["\\"],"id":781}],[{"start":{"row":1,"column":0},"end":{"row":1,"column":1},"action":"remove","lines":["\\"],"id":782}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":783}]]},"ace":{"folds":[],"scrolltop":129,"scrollleft":0,"selection":{"start":{"row":12,"column":34},"end":{"row":12,"column":34},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445383883559,"hash":"36573e632710f91a8463c59aa59224f6afeefa45"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v5/views/partials/header.ejs b/.c9/metadata/workspace/YelpCamp/v5/views/partials/header.ejs deleted file mode 100644 index a40f62b9..00000000 --- a/.c9/metadata/workspace/YelpCamp/v5/views/partials/header.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"header.ejs","tooltip":"/YelpCamp/v5/views/partials/header.ejs","undoManager":{"mark":72,"position":72,"stack":[[{"start":{"row":5,"column":4},"end":{"row":6,"column":0},"action":"insert","lines":["",""],"id":2},{"start":{"row":6,"column":0},"end":{"row":6,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":8},"action":"insert","lines":[" "],"id":3}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["<"],"id":4}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["l"],"id":5}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["i"],"id":6}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":["n"],"id":7}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["k"],"id":8}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":[" "],"id":9}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"remove","lines":[" "],"id":10}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":[">"],"id":11}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":[" "],"id":12}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["h"],"id":13}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["r"],"id":14}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":["e"],"id":15}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["f"],"id":16}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["="],"id":17}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":21},"action":"insert","lines":["\"\""],"id":18}],[{"start":{"row":5,"column":20},"end":{"row":5,"column":21},"action":"insert","lines":["/"],"id":19}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"insert","lines":["s"],"id":20}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["t"],"id":21}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["y"],"id":22}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["l"],"id":23}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"remove","lines":["l"],"id":24}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["e"],"id":25}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"remove","lines":["e"],"id":26}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"remove","lines":["y"],"id":27}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["y"],"id":28}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["l"],"id":29}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":["e"],"id":30}],[{"start":{"row":5,"column":26},"end":{"row":5,"column":27},"action":"insert","lines":["s"],"id":31}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["h"],"id":32}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["e"],"id":33}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":["e"],"id":34}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"insert","lines":["t"],"id":35}],[{"start":{"row":5,"column":31},"end":{"row":5,"column":32},"action":"insert","lines":["s"],"id":36}],[{"start":{"row":5,"column":32},"end":{"row":5,"column":33},"action":"insert","lines":[" "],"id":37}],[{"start":{"row":5,"column":32},"end":{"row":5,"column":33},"action":"remove","lines":[" "],"id":38}],[{"start":{"row":5,"column":32},"end":{"row":5,"column":33},"action":"insert","lines":["/"],"id":39}],[{"start":{"row":5,"column":33},"end":{"row":5,"column":34},"action":"insert","lines":["m"],"id":40}],[{"start":{"row":5,"column":34},"end":{"row":5,"column":35},"action":"insert","lines":["a"],"id":41}],[{"start":{"row":5,"column":35},"end":{"row":5,"column":36},"action":"insert","lines":["i"],"id":42}],[{"start":{"row":5,"column":36},"end":{"row":5,"column":37},"action":"insert","lines":["n"],"id":43}],[{"start":{"row":5,"column":37},"end":{"row":5,"column":38},"action":"insert","lines":[" "],"id":44}],[{"start":{"row":5,"column":37},"end":{"row":5,"column":38},"action":"remove","lines":[" "],"id":45}],[{"start":{"row":5,"column":37},"end":{"row":5,"column":38},"action":"insert","lines":["."],"id":46}],[{"start":{"row":5,"column":38},"end":{"row":5,"column":39},"action":"insert","lines":["c"],"id":47}],[{"start":{"row":5,"column":39},"end":{"row":5,"column":40},"action":"insert","lines":["s"],"id":48}],[{"start":{"row":5,"column":40},"end":{"row":5,"column":41},"action":"insert","lines":["s"],"id":49}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["r"],"id":50}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["e"],"id":51}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":["l"],"id":52}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":[" "],"id":53}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"remove","lines":[" "],"id":54}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["="],"id":55}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["\""],"id":56}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":20},"action":"insert","lines":["s"],"id":57}],[{"start":{"row":5,"column":20},"end":{"row":5,"column":21},"action":"insert","lines":["t"],"id":58}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"insert","lines":["y"],"id":59}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":["l"],"id":60}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["s"],"id":61}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["h"],"id":62}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"remove","lines":["h"],"id":63}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"remove","lines":["s"],"id":64}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["e"],"id":65}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["s"],"id":66}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":["h"],"id":67}],[{"start":{"row":5,"column":26},"end":{"row":5,"column":27},"action":"insert","lines":["e"],"id":68}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["e"],"id":69}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["t"],"id":70}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":[" "],"id":71}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"remove","lines":[" "],"id":72}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":30},"action":"insert","lines":["\""],"id":73}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":31},"action":"insert","lines":[" "],"id":74}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":10,"column":17},"end":{"row":10,"column":17},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445384299879,"hash":"ab7e18e57eedde9ed3c5ead67248116466ed5531"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/app.js b/.c9/metadata/workspace/YelpCamp/v6/app.js deleted file mode 100644 index cfc8826e..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v6/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":29,"column":12},"end":{"row":29,"column":13},"action":"remove","lines":["t"],"id":3911}],[{"start":{"row":29,"column":11},"end":{"row":29,"column":12},"action":"remove","lines":["c"],"id":3912}],[{"start":{"row":29,"column":10},"end":{"row":29,"column":11},"action":"remove","lines":["n"],"id":3913}],[{"start":{"row":29,"column":9},"end":{"row":29,"column":10},"action":"remove","lines":["u"],"id":3914}],[{"start":{"row":29,"column":8},"end":{"row":29,"column":9},"action":"remove","lines":["f"],"id":3915}],[{"start":{"row":29,"column":8},"end":{"row":29,"column":9},"action":"insert","lines":["f"],"id":3916}],[{"start":{"row":29,"column":9},"end":{"row":29,"column":10},"action":"insert","lines":["u"],"id":3917}],[{"start":{"row":29,"column":10},"end":{"row":29,"column":11},"action":"insert","lines":["n"],"id":3918}],[{"start":{"row":29,"column":11},"end":{"row":29,"column":12},"action":"insert","lines":["c"],"id":3919}],[{"start":{"row":29,"column":12},"end":{"row":29,"column":13},"action":"insert","lines":["t"],"id":3920}],[{"start":{"row":29,"column":13},"end":{"row":29,"column":14},"action":"insert","lines":["i"],"id":3921}],[{"start":{"row":29,"column":14},"end":{"row":29,"column":15},"action":"insert","lines":["o"],"id":3922}],[{"start":{"row":29,"column":15},"end":{"row":29,"column":16},"action":"insert","lines":["n"],"id":3923}],[{"start":{"row":29,"column":16},"end":{"row":29,"column":17},"action":"insert","lines":[" "],"id":3924}],[{"start":{"row":29,"column":16},"end":{"row":29,"column":17},"action":"remove","lines":[" "],"id":3925}],[{"start":{"row":29,"column":16},"end":{"row":29,"column":18},"action":"insert","lines":["()"],"id":3926}],[{"start":{"row":29,"column":17},"end":{"row":29,"column":18},"action":"insert","lines":["r"],"id":3927}],[{"start":{"row":29,"column":18},"end":{"row":29,"column":19},"action":"insert","lines":["e"],"id":3928}],[{"start":{"row":29,"column":19},"end":{"row":29,"column":20},"action":"insert","lines":["q"],"id":3929}],[{"start":{"row":29,"column":20},"end":{"row":29,"column":21},"action":"insert","lines":[" "],"id":3930}],[{"start":{"row":29,"column":20},"end":{"row":29,"column":21},"action":"remove","lines":[" "],"id":3931}],[{"start":{"row":29,"column":20},"end":{"row":29,"column":21},"action":"insert","lines":[","],"id":3932}],[{"start":{"row":29,"column":21},"end":{"row":29,"column":22},"action":"insert","lines":[" "],"id":3933}],[{"start":{"row":29,"column":22},"end":{"row":29,"column":23},"action":"insert","lines":["r"],"id":3934}],[{"start":{"row":29,"column":23},"end":{"row":29,"column":24},"action":"insert","lines":["e"],"id":3935}],[{"start":{"row":29,"column":24},"end":{"row":29,"column":25},"action":"insert","lines":["s"],"id":3936}],[{"start":{"row":29,"column":25},"end":{"row":29,"column":26},"action":"insert","lines":[" "],"id":3937}],[{"start":{"row":29,"column":25},"end":{"row":29,"column":26},"action":"remove","lines":[" "],"id":3938}],[{"start":{"row":29,"column":25},"end":{"row":29,"column":26},"action":"insert","lines":[","],"id":3939}],[{"start":{"row":29,"column":26},"end":{"row":29,"column":27},"action":"insert","lines":[" "],"id":3940}],[{"start":{"row":29,"column":27},"end":{"row":29,"column":28},"action":"insert","lines":["n"],"id":3941}],[{"start":{"row":29,"column":28},"end":{"row":29,"column":29},"action":"insert","lines":["e"],"id":3942}],[{"start":{"row":29,"column":29},"end":{"row":29,"column":30},"action":"insert","lines":["w"],"id":3943}],[{"start":{"row":29,"column":29},"end":{"row":29,"column":30},"action":"remove","lines":["w"],"id":3944}],[{"start":{"row":29,"column":29},"end":{"row":29,"column":30},"action":"insert","lines":["x"],"id":3945}],[{"start":{"row":29,"column":30},"end":{"row":29,"column":31},"action":"insert","lines":["t"],"id":3946}],[{"start":{"row":29,"column":32},"end":{"row":29,"column":34},"action":"insert","lines":["{}"],"id":3947}],[{"start":{"row":29,"column":33},"end":{"row":31,"column":0},"action":"insert","lines":[""," ",""],"id":3948}],[{"start":{"row":31,"column":2},"end":{"row":31,"column":3},"action":"insert","lines":[";"],"id":3949}],[{"start":{"row":30,"column":3},"end":{"row":30,"column":4},"action":"insert","lines":["/"],"id":3950}],[{"start":{"row":30,"column":4},"end":{"row":30,"column":5},"action":"insert","lines":["/"],"id":3951}],[{"start":{"row":30,"column":5},"end":{"row":30,"column":6},"action":"insert","lines":["p"],"id":3952}],[{"start":{"row":30,"column":6},"end":{"row":30,"column":7},"action":"insert","lines":["r"],"id":3953}],[{"start":{"row":30,"column":6},"end":{"row":30,"column":7},"action":"remove","lines":["r"],"id":3954}],[{"start":{"row":30,"column":5},"end":{"row":30,"column":6},"action":"remove","lines":["p"],"id":3955}],[{"start":{"row":30,"column":4},"end":{"row":30,"column":5},"action":"remove","lines":["/"],"id":3956}],[{"start":{"row":30,"column":3},"end":{"row":30,"column":4},"action":"remove","lines":["/"],"id":3957}],[{"start":{"row":30,"column":3},"end":{"row":30,"column":4},"action":"insert","lines":["r"],"id":3958}],[{"start":{"row":30,"column":4},"end":{"row":30,"column":5},"action":"insert","lines":["e"],"id":3959}],[{"start":{"row":30,"column":5},"end":{"row":30,"column":6},"action":"insert","lines":["s"],"id":3960}],[{"start":{"row":30,"column":6},"end":{"row":30,"column":7},"action":"insert","lines":[" "],"id":3961}],[{"start":{"row":30,"column":6},"end":{"row":30,"column":7},"action":"remove","lines":[" "],"id":3962}],[{"start":{"row":30,"column":6},"end":{"row":30,"column":7},"action":"insert","lines":["."],"id":3963}],[{"start":{"row":30,"column":7},"end":{"row":30,"column":8},"action":"insert","lines":["l"],"id":3964}],[{"start":{"row":30,"column":8},"end":{"row":30,"column":9},"action":"insert","lines":["o"],"id":3965}],[{"start":{"row":30,"column":9},"end":{"row":30,"column":10},"action":"insert","lines":["c"],"id":3966}],[{"start":{"row":30,"column":10},"end":{"row":30,"column":11},"action":"insert","lines":["a"],"id":3967}],[{"start":{"row":30,"column":11},"end":{"row":30,"column":12},"action":"insert","lines":["l"],"id":3968}],[{"start":{"row":30,"column":12},"end":{"row":30,"column":13},"action":"insert","lines":["s"],"id":3969}],[{"start":{"row":30,"column":13},"end":{"row":30,"column":14},"action":"insert","lines":[" "],"id":3970}],[{"start":{"row":30,"column":13},"end":{"row":30,"column":14},"action":"remove","lines":[" "],"id":3971}],[{"start":{"row":30,"column":13},"end":{"row":30,"column":14},"action":"insert","lines":["."],"id":3972}],[{"start":{"row":30,"column":14},"end":{"row":30,"column":15},"action":"insert","lines":["c"],"id":3973}],[{"start":{"row":30,"column":15},"end":{"row":30,"column":16},"action":"insert","lines":["u"],"id":3974}],[{"start":{"row":30,"column":16},"end":{"row":30,"column":17},"action":"insert","lines":["r"],"id":3975}],[{"start":{"row":30,"column":17},"end":{"row":30,"column":18},"action":"insert","lines":["r"],"id":3976}],[{"start":{"row":30,"column":18},"end":{"row":30,"column":19},"action":"insert","lines":["e"],"id":3977}],[{"start":{"row":30,"column":19},"end":{"row":30,"column":20},"action":"insert","lines":["n"],"id":3978}],[{"start":{"row":30,"column":20},"end":{"row":30,"column":21},"action":"insert","lines":["t"],"id":3979}],[{"start":{"row":30,"column":21},"end":{"row":30,"column":22},"action":"insert","lines":["U"],"id":3980}],[{"start":{"row":30,"column":22},"end":{"row":30,"column":23},"action":"insert","lines":["s"],"id":3981}],[{"start":{"row":30,"column":23},"end":{"row":30,"column":24},"action":"insert","lines":["e"],"id":3982}],[{"start":{"row":30,"column":24},"end":{"row":30,"column":25},"action":"insert","lines":["r"],"id":3983}],[{"start":{"row":30,"column":25},"end":{"row":30,"column":26},"action":"insert","lines":[" "],"id":3984}],[{"start":{"row":30,"column":25},"end":{"row":30,"column":26},"action":"remove","lines":[" "],"id":3985}],[{"start":{"row":30,"column":25},"end":{"row":30,"column":26},"action":"insert","lines":[" "],"id":3986}],[{"start":{"row":30,"column":26},"end":{"row":30,"column":27},"action":"insert","lines":["="],"id":3987}],[{"start":{"row":30,"column":27},"end":{"row":30,"column":28},"action":"insert","lines":[" "],"id":3988}],[{"start":{"row":30,"column":28},"end":{"row":30,"column":29},"action":"insert","lines":["r"],"id":3989}],[{"start":{"row":30,"column":29},"end":{"row":30,"column":30},"action":"insert","lines":["e"],"id":3990}],[{"start":{"row":30,"column":30},"end":{"row":30,"column":31},"action":"insert","lines":["q"],"id":3991}],[{"start":{"row":30,"column":31},"end":{"row":30,"column":32},"action":"insert","lines":[" "],"id":3992}],[{"start":{"row":30,"column":31},"end":{"row":30,"column":32},"action":"remove","lines":[" "],"id":3993}],[{"start":{"row":30,"column":31},"end":{"row":30,"column":32},"action":"insert","lines":["."],"id":3994}],[{"start":{"row":30,"column":32},"end":{"row":30,"column":33},"action":"insert","lines":["u"],"id":3995}],[{"start":{"row":30,"column":33},"end":{"row":30,"column":34},"action":"insert","lines":["s"],"id":3996}],[{"start":{"row":30,"column":34},"end":{"row":30,"column":35},"action":"insert","lines":["e"],"id":3997}],[{"start":{"row":30,"column":35},"end":{"row":30,"column":36},"action":"insert","lines":["r"],"id":3998}],[{"start":{"row":30,"column":36},"end":{"row":30,"column":37},"action":"insert","lines":[" "],"id":3999}],[{"start":{"row":30,"column":36},"end":{"row":30,"column":37},"action":"remove","lines":[" "],"id":4000}],[{"start":{"row":30,"column":36},"end":{"row":30,"column":37},"action":"insert","lines":[";"],"id":4001}],[{"start":{"row":30,"column":37},"end":{"row":30,"column":38},"action":"remove","lines":[" "],"id":4002},{"start":{"row":30,"column":37},"end":{"row":31,"column":0},"action":"insert","lines":["",""]},{"start":{"row":31,"column":0},"end":{"row":31,"column":3},"action":"insert","lines":[" "]}],[{"start":{"row":31,"column":3},"end":{"row":31,"column":4},"action":"insert","lines":["n"],"id":4003}],[{"start":{"row":31,"column":4},"end":{"row":31,"column":5},"action":"insert","lines":["e"],"id":4004}],[{"start":{"row":31,"column":5},"end":{"row":31,"column":6},"action":"insert","lines":["x"],"id":4005}],[{"start":{"row":31,"column":6},"end":{"row":31,"column":7},"action":"insert","lines":["t"],"id":4006}],[{"start":{"row":31,"column":7},"end":{"row":31,"column":8},"action":"insert","lines":[" "],"id":4007}],[{"start":{"row":31,"column":7},"end":{"row":31,"column":8},"action":"remove","lines":[" "],"id":4008}],[{"start":{"row":31,"column":7},"end":{"row":31,"column":9},"action":"insert","lines":["()"],"id":4009}],[{"start":{"row":31,"column":9},"end":{"row":31,"column":10},"action":"insert","lines":[";"],"id":4010}],[{"start":{"row":45,"column":68},"end":{"row":45,"column":91},"action":"remove","lines":[", currentUser: req.user"],"id":4011}]]},"ace":{"folds":[],"scrolltop":3940.5,"scrollleft":0,"selection":{"start":{"row":163,"column":16},"end":{"row":163,"column":16},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":150,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445489683904,"hash":"a46484922bc85408a71fb0bc6e6feec4186467bc"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/models/user.js b/.c9/metadata/workspace/YelpCamp/v6/models/user.js deleted file mode 100644 index 125b3450..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/models/user.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"user.js","tooltip":"/YelpCamp/v6/models/user.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"remove","lines":[" "],"id":207}],[{"start":{"row":1,"column":3},"end":{"row":1,"column":4},"action":"insert","lines":[" "],"id":208}],[{"start":{"row":1,"column":4},"end":{"row":1,"column":5},"action":"insert","lines":["p"],"id":209}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":["a"],"id":210}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["s"],"id":211}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["s"],"id":212}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["p"],"id":213}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["o"],"id":214}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["r"],"id":215}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["t"],"id":216}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":[" "],"id":217}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"remove","lines":[" "],"id":218}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":["L"],"id":219}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["o"],"id":220}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["c"],"id":221}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":["a"],"id":222}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["l"],"id":223}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":[" "],"id":224}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"remove","lines":[" "],"id":225}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["M"],"id":226}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":["o"],"id":227}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":["n"],"id":228}],[{"start":{"row":1,"column":20},"end":{"row":1,"column":21},"action":"insert","lines":["g"],"id":229}],[{"start":{"row":1,"column":21},"end":{"row":1,"column":22},"action":"insert","lines":["o"],"id":230}],[{"start":{"row":1,"column":22},"end":{"row":1,"column":23},"action":"insert","lines":["o"],"id":231}],[{"start":{"row":1,"column":23},"end":{"row":1,"column":24},"action":"insert","lines":["s"],"id":232}],[{"start":{"row":1,"column":24},"end":{"row":1,"column":25},"action":"insert","lines":["e"],"id":233}],[{"start":{"row":1,"column":25},"end":{"row":1,"column":26},"action":"insert","lines":[" "],"id":234}],[{"start":{"row":1,"column":25},"end":{"row":1,"column":26},"action":"remove","lines":[" "],"id":235}],[{"start":{"row":1,"column":25},"end":{"row":1,"column":26},"action":"insert","lines":[" "],"id":236}],[{"start":{"row":1,"column":26},"end":{"row":1,"column":27},"action":"insert","lines":["="],"id":237}],[{"start":{"row":1,"column":27},"end":{"row":1,"column":28},"action":"insert","lines":[" "],"id":238}],[{"start":{"row":1,"column":28},"end":{"row":1,"column":29},"action":"insert","lines":["r"],"id":239}],[{"start":{"row":1,"column":29},"end":{"row":1,"column":30},"action":"insert","lines":["e"],"id":240}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["q"],"id":241}],[{"start":{"row":1,"column":31},"end":{"row":1,"column":32},"action":"insert","lines":["u"],"id":242}],[{"start":{"row":1,"column":32},"end":{"row":1,"column":33},"action":"insert","lines":["i"],"id":243}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"insert","lines":["r"],"id":244}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":["e"],"id":245}],[{"start":{"row":1,"column":35},"end":{"row":1,"column":36},"action":"insert","lines":[" "],"id":246}],[{"start":{"row":1,"column":35},"end":{"row":1,"column":36},"action":"remove","lines":[" "],"id":247}],[{"start":{"row":1,"column":35},"end":{"row":1,"column":37},"action":"insert","lines":["()"],"id":248}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":38},"action":"insert","lines":["\"\""],"id":249}],[{"start":{"row":1,"column":37},"end":{"row":1,"column":38},"action":"insert","lines":["p"],"id":250}],[{"start":{"row":1,"column":38},"end":{"row":1,"column":39},"action":"insert","lines":["a"],"id":251}],[{"start":{"row":1,"column":39},"end":{"row":1,"column":40},"action":"insert","lines":["s"],"id":252}],[{"start":{"row":1,"column":40},"end":{"row":1,"column":41},"action":"insert","lines":["s"],"id":253}],[{"start":{"row":1,"column":41},"end":{"row":1,"column":42},"action":"insert","lines":["p"],"id":254}],[{"start":{"row":1,"column":42},"end":{"row":1,"column":43},"action":"insert","lines":["o"],"id":255}],[{"start":{"row":1,"column":43},"end":{"row":1,"column":44},"action":"insert","lines":["r"],"id":256}],[{"start":{"row":1,"column":44},"end":{"row":1,"column":45},"action":"insert","lines":["t"],"id":257}],[{"start":{"row":1,"column":45},"end":{"row":1,"column":46},"action":"insert","lines":[" "],"id":258}],[{"start":{"row":1,"column":45},"end":{"row":1,"column":46},"action":"remove","lines":[" "],"id":259}],[{"start":{"row":1,"column":45},"end":{"row":1,"column":46},"action":"insert","lines":["-"],"id":260}],[{"start":{"row":1,"column":46},"end":{"row":1,"column":47},"action":"insert","lines":["l"],"id":261}],[{"start":{"row":1,"column":47},"end":{"row":1,"column":48},"action":"insert","lines":["o"],"id":262}],[{"start":{"row":1,"column":48},"end":{"row":1,"column":49},"action":"insert","lines":["c"],"id":263}],[{"start":{"row":1,"column":49},"end":{"row":1,"column":50},"action":"insert","lines":["a"],"id":264}],[{"start":{"row":1,"column":50},"end":{"row":1,"column":51},"action":"insert","lines":["l"],"id":265}],[{"start":{"row":1,"column":51},"end":{"row":1,"column":52},"action":"insert","lines":["-"],"id":266}],[{"start":{"row":1,"column":52},"end":{"row":1,"column":53},"action":"insert","lines":["m"],"id":267}],[{"start":{"row":1,"column":53},"end":{"row":1,"column":54},"action":"insert","lines":["o"],"id":268}],[{"start":{"row":1,"column":54},"end":{"row":1,"column":55},"action":"insert","lines":["n"],"id":269}],[{"start":{"row":1,"column":55},"end":{"row":1,"column":56},"action":"insert","lines":["g"],"id":270}],[{"start":{"row":1,"column":56},"end":{"row":1,"column":57},"action":"insert","lines":["o"],"id":271}],[{"start":{"row":1,"column":57},"end":{"row":1,"column":58},"action":"insert","lines":["o"],"id":272}],[{"start":{"row":1,"column":58},"end":{"row":1,"column":59},"action":"insert","lines":["s"],"id":273}],[{"start":{"row":1,"column":59},"end":{"row":1,"column":60},"action":"insert","lines":["e"],"id":274}],[{"start":{"row":1,"column":60},"end":{"row":1,"column":61},"action":"insert","lines":[" "],"id":275}],[{"start":{"row":1,"column":60},"end":{"row":1,"column":61},"action":"remove","lines":[" "],"id":276}],[{"start":{"row":1,"column":62},"end":{"row":1,"column":63},"action":"insert","lines":[";"],"id":277}],[{"start":{"row":6,"column":3},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":278}],[{"start":{"row":7,"column":0},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":279}],[{"start":{"row":8,"column":0},"end":{"row":8,"column":1},"action":"insert","lines":["U"],"id":280}],[{"start":{"row":8,"column":1},"end":{"row":8,"column":2},"action":"insert","lines":["s"],"id":281}],[{"start":{"row":8,"column":2},"end":{"row":8,"column":3},"action":"insert","lines":["e"],"id":282}],[{"start":{"row":8,"column":3},"end":{"row":8,"column":4},"action":"insert","lines":["r"],"id":283}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"insert","lines":[" "],"id":284}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"remove","lines":[" "],"id":285}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":5},"action":"insert","lines":["S"],"id":286}],[{"start":{"row":8,"column":5},"end":{"row":8,"column":6},"action":"insert","lines":["c"],"id":287}],[{"start":{"row":8,"column":6},"end":{"row":8,"column":7},"action":"insert","lines":["h"],"id":288}],[{"start":{"row":8,"column":7},"end":{"row":8,"column":8},"action":"insert","lines":["e"],"id":289}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":9},"action":"insert","lines":["m"],"id":290}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":["a"],"id":291}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":[" "],"id":292}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"remove","lines":[" "],"id":293}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":["."],"id":294}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"insert","lines":["p"],"id":295}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"insert","lines":["l"],"id":296}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"insert","lines":["u"],"id":297}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"insert","lines":["g"],"id":298}],[{"start":{"row":8,"column":15},"end":{"row":8,"column":16},"action":"insert","lines":["i"],"id":299}],[{"start":{"row":8,"column":16},"end":{"row":8,"column":17},"action":"insert","lines":["n"],"id":300}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":18},"action":"insert","lines":[" "],"id":301}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":18},"action":"remove","lines":[" "],"id":302}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":19},"action":"insert","lines":["()"],"id":303}],[{"start":{"row":8,"column":18},"end":{"row":8,"column":19},"action":"insert","lines":["p"],"id":304}],[{"start":{"row":8,"column":19},"end":{"row":8,"column":20},"action":"insert","lines":["a"],"id":305}],[{"start":{"row":8,"column":20},"end":{"row":8,"column":21},"action":"insert","lines":["s"],"id":306}],[{"start":{"row":8,"column":18},"end":{"row":8,"column":21},"action":"remove","lines":["pas"],"id":307},{"start":{"row":8,"column":18},"end":{"row":8,"column":39},"action":"insert","lines":["passportLocalMongoose"]}],[{"start":{"row":5,"column":20},"end":{"row":5,"column":21},"action":"insert","lines":[" "],"id":309}],[{"start":{"row":8,"column":40},"end":{"row":8,"column":41},"action":"insert","lines":[";"],"id":308}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":9,"column":0},"end":{"row":9,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445461397949,"hash":"ce08b2516b11cf283b51822bef488db693bc30cc"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/package.json b/.c9/metadata/workspace/YelpCamp/v6/package.json deleted file mode 100644 index 4c5d5d3a..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/package.json +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"package.json","tooltip":"/YelpCamp/v6/package.json","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":201,"scrollleft":0,"selection":{"start":{"row":14,"column":0},"end":{"row":15,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":6,"state":"start","mode":"ace/mode/json"}},"timestamp":1445453655901,"hash":"dcf3c5c14a61818c0f9cef424ea4ffab9a162a28"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/readme.md b/.c9/metadata/workspace/YelpCamp/v6/readme.md deleted file mode 100644 index 537a0199..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v6/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":81,"column":42},"end":{"row":81,"column":43},"action":"insert","lines":["t"],"id":746}],[{"start":{"row":81,"column":43},"end":{"row":81,"column":44},"action":"insert","lines":[" "],"id":747}],[{"start":{"row":81,"column":44},"end":{"row":81,"column":45},"action":"insert","lines":["s"],"id":748}],[{"start":{"row":81,"column":45},"end":{"row":81,"column":46},"action":"insert","lines":["i"],"id":749}],[{"start":{"row":81,"column":46},"end":{"row":81,"column":47},"action":"insert","lines":["g"],"id":750}],[{"start":{"row":81,"column":47},"end":{"row":81,"column":48},"action":"insert","lines":["n"],"id":751}],[{"start":{"row":81,"column":48},"end":{"row":81,"column":49},"action":"insert","lines":["e"],"id":752}],[{"start":{"row":81,"column":49},"end":{"row":81,"column":50},"action":"insert","lines":["d"],"id":753}],[{"start":{"row":81,"column":50},"end":{"row":81,"column":51},"action":"insert","lines":[" "],"id":754}],[{"start":{"row":81,"column":51},"end":{"row":81,"column":52},"action":"insert","lines":["i"],"id":755}],[{"start":{"row":81,"column":52},"end":{"row":81,"column":53},"action":"insert","lines":["n"],"id":756}],[{"start":{"row":81,"column":0},"end":{"row":82,"column":0},"action":"remove","lines":["* Prevent user from adding a comment if not signed in",""],"id":757}],[{"start":{"row":79,"column":18},"end":{"row":80,"column":0},"action":"insert","lines":["",""],"id":758},{"start":{"row":80,"column":0},"end":{"row":80,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":80,"column":2},"end":{"row":81,"column":0},"action":"insert","lines":["* Prevent user from adding a comment if not signed in",""],"id":759}],[{"start":{"row":80,"column":55},"end":{"row":81,"column":0},"action":"remove","lines":["",""],"id":761}],[{"start":{"row":80,"column":4},"end":{"row":80,"column":5},"action":"insert","lines":["="],"id":762}],[{"start":{"row":80,"column":4},"end":{"row":80,"column":5},"action":"remove","lines":["="],"id":763}],[{"start":{"row":80,"column":3},"end":{"row":80,"column":4},"action":"remove","lines":[" "],"id":764}],[{"start":{"row":80,"column":2},"end":{"row":80,"column":3},"action":"remove","lines":["*"],"id":765}],[{"start":{"row":81,"column":21},"end":{"row":82,"column":0},"action":"insert","lines":["",""],"id":766},{"start":{"row":82,"column":0},"end":{"row":82,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":82,"column":1},"end":{"row":82,"column":2},"action":"remove","lines":[" "],"id":767}],[{"start":{"row":82,"column":0},"end":{"row":82,"column":1},"action":"remove","lines":["*"],"id":768}],[{"start":{"row":82,"column":0},"end":{"row":83,"column":0},"action":"insert","lines":["",""],"id":769}],[{"start":{"row":83,"column":0},"end":{"row":83,"column":1},"action":"insert","lines":["#"],"id":770}],[{"start":{"row":83,"column":1},"end":{"row":83,"column":2},"action":"insert","lines":["#"],"id":771}],[{"start":{"row":83,"column":2},"end":{"row":83,"column":3},"action":"insert","lines":["A"],"id":772}],[{"start":{"row":83,"column":3},"end":{"row":83,"column":4},"action":"insert","lines":["u"],"id":773}],[{"start":{"row":83,"column":4},"end":{"row":83,"column":5},"action":"insert","lines":["t"],"id":774}],[{"start":{"row":83,"column":5},"end":{"row":83,"column":6},"action":"insert","lines":["h"],"id":775}],[{"start":{"row":83,"column":6},"end":{"row":83,"column":7},"action":"insert","lines":[" "],"id":776}],[{"start":{"row":83,"column":6},"end":{"row":83,"column":7},"action":"remove","lines":[" "],"id":777}],[{"start":{"row":83,"column":6},"end":{"row":83,"column":7},"action":"insert","lines":[" "],"id":778}],[{"start":{"row":83,"column":7},"end":{"row":83,"column":8},"action":"insert","lines":["P"],"id":779}],[{"start":{"row":83,"column":8},"end":{"row":83,"column":9},"action":"insert","lines":["t"],"id":780}],[{"start":{"row":83,"column":9},"end":{"row":83,"column":10},"action":"insert","lines":[" "],"id":781}],[{"start":{"row":83,"column":9},"end":{"row":83,"column":10},"action":"remove","lines":[" "],"id":782}],[{"start":{"row":83,"column":9},"end":{"row":83,"column":10},"action":"insert","lines":["."],"id":783}],[{"start":{"row":83,"column":10},"end":{"row":83,"column":11},"action":"insert","lines":[" "],"id":784}],[{"start":{"row":83,"column":11},"end":{"row":83,"column":12},"action":"insert","lines":["5"],"id":785}],[{"start":{"row":83,"column":12},"end":{"row":83,"column":13},"action":"insert","lines":[" "],"id":786}],[{"start":{"row":83,"column":12},"end":{"row":83,"column":13},"action":"remove","lines":[" "],"id":787}],[{"start":{"row":83,"column":12},"end":{"row":83,"column":13},"action":"insert","lines":[" "],"id":788}],[{"start":{"row":83,"column":12},"end":{"row":83,"column":13},"action":"remove","lines":[" "],"id":789}],[{"start":{"row":83,"column":12},"end":{"row":83,"column":13},"action":"insert","lines":[" "],"id":790}],[{"start":{"row":83,"column":13},"end":{"row":83,"column":14},"action":"insert","lines":["-"],"id":791}],[{"start":{"row":83,"column":14},"end":{"row":83,"column":15},"action":"insert","lines":[" "],"id":792}],[{"start":{"row":83,"column":15},"end":{"row":83,"column":16},"action":"insert","lines":["S"],"id":793}],[{"start":{"row":83,"column":16},"end":{"row":83,"column":17},"action":"insert","lines":["h"],"id":794}],[{"start":{"row":83,"column":17},"end":{"row":83,"column":18},"action":"insert","lines":["o"],"id":795}],[{"start":{"row":83,"column":18},"end":{"row":83,"column":19},"action":"insert","lines":["w"],"id":796}],[{"start":{"row":83,"column":19},"end":{"row":83,"column":20},"action":"insert","lines":[" "],"id":797}],[{"start":{"row":83,"column":19},"end":{"row":83,"column":20},"action":"remove","lines":[" "],"id":798}],[{"start":{"row":83,"column":19},"end":{"row":83,"column":20},"action":"insert","lines":["/"],"id":799}],[{"start":{"row":83,"column":20},"end":{"row":83,"column":21},"action":"insert","lines":["H"],"id":800}],[{"start":{"row":83,"column":21},"end":{"row":83,"column":22},"action":"insert","lines":["i"],"id":801}],[{"start":{"row":83,"column":22},"end":{"row":83,"column":23},"action":"insert","lines":["d"],"id":802}],[{"start":{"row":83,"column":23},"end":{"row":83,"column":24},"action":"insert","lines":["e"],"id":803}],[{"start":{"row":83,"column":24},"end":{"row":83,"column":25},"action":"insert","lines":[" "],"id":804}],[{"start":{"row":83,"column":24},"end":{"row":83,"column":25},"action":"remove","lines":[" "],"id":805}],[{"start":{"row":83,"column":24},"end":{"row":83,"column":25},"action":"insert","lines":[" "],"id":806}],[{"start":{"row":83,"column":25},"end":{"row":83,"column":26},"action":"insert","lines":["L"],"id":807}],[{"start":{"row":83,"column":26},"end":{"row":83,"column":27},"action":"insert","lines":["i"],"id":808}],[{"start":{"row":83,"column":27},"end":{"row":83,"column":28},"action":"insert","lines":["n"],"id":809}],[{"start":{"row":83,"column":28},"end":{"row":83,"column":29},"action":"insert","lines":["k"],"id":810}],[{"start":{"row":83,"column":29},"end":{"row":83,"column":30},"action":"insert","lines":["s"],"id":811}],[{"start":{"row":84,"column":32},"end":{"row":85,"column":0},"action":"insert","lines":["",""],"id":812},{"start":{"row":85,"column":0},"end":{"row":85,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":85,"column":2},"end":{"row":85,"column":3},"action":"insert","lines":["I"],"id":813}],[{"start":{"row":85,"column":3},"end":{"row":85,"column":4},"action":"insert","lines":["f"],"id":814}],[{"start":{"row":85,"column":3},"end":{"row":85,"column":4},"action":"remove","lines":["f"],"id":815}],[{"start":{"row":85,"column":2},"end":{"row":85,"column":3},"action":"remove","lines":["I"],"id":816}],[{"start":{"row":85,"column":2},"end":{"row":85,"column":3},"action":"insert","lines":["S"],"id":817}],[{"start":{"row":85,"column":3},"end":{"row":85,"column":4},"action":"insert","lines":["h"],"id":818}],[{"start":{"row":85,"column":4},"end":{"row":85,"column":5},"action":"insert","lines":["o"],"id":819}],[{"start":{"row":85,"column":5},"end":{"row":85,"column":6},"action":"insert","lines":["w"],"id":820}],[{"start":{"row":85,"column":6},"end":{"row":85,"column":7},"action":"insert","lines":[" "],"id":821}],[{"start":{"row":85,"column":7},"end":{"row":85,"column":8},"action":"insert","lines":["\""],"id":822}],[{"start":{"row":85,"column":8},"end":{"row":85,"column":9},"action":"insert","lines":["l"],"id":823}],[{"start":{"row":85,"column":9},"end":{"row":85,"column":10},"action":"insert","lines":["o"],"id":824}],[{"start":{"row":85,"column":9},"end":{"row":85,"column":10},"action":"remove","lines":["o"],"id":825}],[{"start":{"row":85,"column":8},"end":{"row":85,"column":9},"action":"remove","lines":["l"],"id":826}],[{"start":{"row":85,"column":7},"end":{"row":85,"column":8},"action":"remove","lines":["\""],"id":827}],[{"start":{"row":85,"column":6},"end":{"row":85,"column":7},"action":"remove","lines":[" "],"id":828}],[{"start":{"row":85,"column":5},"end":{"row":85,"column":6},"action":"remove","lines":["w"],"id":829}],[{"start":{"row":85,"column":4},"end":{"row":85,"column":5},"action":"remove","lines":["o"],"id":830}],[{"start":{"row":85,"column":3},"end":{"row":85,"column":4},"action":"remove","lines":["h"],"id":831}],[{"start":{"row":85,"column":2},"end":{"row":85,"column":3},"action":"remove","lines":["S"],"id":832}],[{"start":{"row":85,"column":1},"end":{"row":85,"column":2},"action":"remove","lines":[" "],"id":833}],[{"start":{"row":85,"column":0},"end":{"row":85,"column":1},"action":"remove","lines":["*"],"id":834}],[{"start":{"row":84,"column":32},"end":{"row":85,"column":0},"action":"remove","lines":["",""],"id":835}],[{"start":{"row":84,"column":22},"end":{"row":84,"column":23},"action":"insert","lines":[" "],"id":836}],[{"start":{"row":84,"column":23},"end":{"row":84,"column":24},"action":"insert","lines":["i"],"id":837}],[{"start":{"row":84,"column":24},"end":{"row":84,"column":25},"action":"insert","lines":["n"],"id":838}],[{"start":{"row":84,"column":25},"end":{"row":84,"column":26},"action":"insert","lines":[" "],"id":839}],[{"start":{"row":84,"column":26},"end":{"row":84,"column":27},"action":"insert","lines":["n"],"id":840}],[{"start":{"row":84,"column":27},"end":{"row":84,"column":28},"action":"insert","lines":["a"],"id":841}],[{"start":{"row":84,"column":28},"end":{"row":84,"column":29},"action":"insert","lines":["v"],"id":842}],[{"start":{"row":84,"column":29},"end":{"row":84,"column":30},"action":"insert","lines":["b"],"id":843}],[{"start":{"row":84,"column":30},"end":{"row":84,"column":31},"action":"insert","lines":["a"],"id":844}],[{"start":{"row":84,"column":31},"end":{"row":84,"column":32},"action":"insert","lines":["r"],"id":845}],[{"start":{"row":84,"column":32},"end":{"row":84,"column":33},"action":"insert","lines":[" "],"id":846}],[{"start":{"row":84,"column":32},"end":{"row":84,"column":33},"action":"remove","lines":[" "],"id":847}]]},"ace":{"folds":[],"scrolltop":1874,"scrollleft":0,"selection":{"start":{"row":80,"column":14},"end":{"row":80,"column":14},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":71,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445464743137,"hash":"2fa6258d88c941fc934a15892d7667b3577ae707"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/seeds.js b/.c9/metadata/workspace/YelpCamp/v6/seeds.js deleted file mode 100644 index 880e0b93..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/seeds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"seeds.js","tooltip":"/YelpCamp/v6/seeds.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":759,"scrollleft":0,"selection":{"start":{"row":37,"column":35},"end":{"row":37,"column":35},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":28,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445452644322,"hash":"bb328fd4d11e1843d92999cedc979e3c2878c462"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/views/campgrounds/index.ejs b/.c9/metadata/workspace/YelpCamp/v6/views/campgrounds/index.ejs deleted file mode 100644 index 2357922d..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/views/campgrounds/index.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.ejs","tooltip":"/YelpCamp/v6/views/campgrounds/index.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":3,"column":2},"end":{"row":3,"column":3},"action":"insert","lines":[" "],"id":31}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":["}"],"id":32}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":5},"action":"insert","lines":[" "],"id":33}],[{"start":{"row":3,"column":5},"end":{"row":3,"column":6},"action":"insert","lines":["%"],"id":34}],[{"start":{"row":3,"column":6},"end":{"row":3,"column":7},"action":"insert","lines":[">"],"id":35}],[{"start":{"row":2,"column":16},"end":{"row":3,"column":0},"action":"insert","lines":["",""],"id":36}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":1},"action":"insert","lines":[" "],"id":37}],[{"start":{"row":3,"column":1},"end":{"row":3,"column":2},"action":"insert","lines":["<"],"id":38}],[{"start":{"row":3,"column":2},"end":{"row":3,"column":3},"action":"insert","lines":["h"],"id":39}],[{"start":{"row":3,"column":3},"end":{"row":3,"column":4},"action":"insert","lines":["3"],"id":40}],[{"start":{"row":3,"column":4},"end":{"row":3,"column":10},"action":"insert","lines":[">"],"id":41}],[{"start":{"row":3,"column":5},"end":{"row":3,"column":6},"action":"insert","lines":["<"],"id":42}],[{"start":{"row":3,"column":6},"end":{"row":3,"column":7},"action":"insert","lines":["%"],"id":43}],[{"start":{"row":3,"column":7},"end":{"row":3,"column":8},"action":"insert","lines":["="],"id":44}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":[" "],"id":45}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"remove","lines":[" "],"id":46}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":["u"],"id":47}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":["s"],"id":48}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"remove","lines":["s"],"id":49}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"remove","lines":["u"],"id":50}],[{"start":{"row":3,"column":8},"end":{"row":3,"column":9},"action":"insert","lines":[" "],"id":51}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":["u"],"id":52}],[{"start":{"row":3,"column":10},"end":{"row":3,"column":11},"action":"insert","lines":["s"],"id":53}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"insert","lines":["e"],"id":54}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"insert","lines":["r"],"id":55}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":[" "],"id":56}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"remove","lines":[" "],"id":57}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["."],"id":58}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["u"],"id":59}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["s"],"id":60}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["e"],"id":61}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["r"],"id":62}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":["n"],"id":63}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":20},"action":"insert","lines":["a"],"id":64}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"insert","lines":["m"],"id":65}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"insert","lines":["e"],"id":66}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":[" "],"id":67}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"remove","lines":[" "],"id":68}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":[" "],"id":69}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"insert","lines":["%"],"id":70}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":[">"],"id":71}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["c"],"id":73}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["u"],"id":74}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["r"],"id":75}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["r"],"id":76}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["r"],"id":77}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["e"],"id":78}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["n"],"id":79}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["t"],"id":80}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"remove","lines":["u"],"id":81}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["H"],"id":82}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"remove","lines":["H"],"id":83}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":["U"],"id":84}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"remove","lines":["u"],"id":85}],[{"start":{"row":3,"column":9},"end":{"row":3,"column":10},"action":"insert","lines":["c"],"id":86}],[{"start":{"row":3,"column":10},"end":{"row":3,"column":11},"action":"insert","lines":["u"],"id":87}],[{"start":{"row":3,"column":11},"end":{"row":3,"column":12},"action":"insert","lines":["r"],"id":88}],[{"start":{"row":3,"column":12},"end":{"row":3,"column":13},"action":"insert","lines":["r"],"id":89}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["n"],"id":90}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"remove","lines":["n"],"id":91}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["e"],"id":92}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["n"],"id":93}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["t"],"id":94}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":[" "],"id":95}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"remove","lines":[" "],"id":96}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["U"],"id":97}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":29},"action":"remove","lines":["username"],"id":112}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"remove","lines":["."],"id":113}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":24},"action":"remove","lines":["<% if(currrentUser) { %>"],"id":114}],[{"start":{"row":4,"column":0},"end":{"row":4,"column":7},"action":"remove","lines":["<% } %>"],"id":115}],[{"start":{"row":3,"column":0},"end":{"row":3,"column":28},"action":"remove","lines":["

    <%= currentUser %>

    "],"id":118}],[{"start":{"row":2,"column":0},"end":{"row":3,"column":0},"action":"remove","lines":["",""],"id":119}],[{"start":{"row":3,"column":0},"end":{"row":4,"column":0},"action":"remove","lines":["",""],"id":120}],[{"start":{"row":2,"column":0},"end":{"row":3,"column":0},"action":"remove","lines":["",""],"id":121}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":122}],[{"start":{"row":0,"column":33},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":123}],[{"start":{"row":0,"column":33},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":124}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":125}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":126}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["<"],"id":127}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["h"],"id":128}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["4"],"id":129}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":[" "],"id":130}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"remove","lines":[" "],"id":131}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":9},"action":"insert","lines":[">"],"id":132}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["<"],"id":133}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["%"],"id":134}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["="],"id":135}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":[" "],"id":136}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["c"],"id":137}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["u"],"id":138}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["r"],"id":139}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["r"],"id":140}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["e"],"id":141}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":13},"action":"remove","lines":["curre"],"id":142},{"start":{"row":2,"column":8},"end":{"row":2,"column":19},"action":"insert","lines":["currentUser"]}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":[" "],"id":143}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":["%"],"id":144}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":[">"],"id":145}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":27},"action":"remove","lines":["

    <%= currentUser %>

    "],"id":146}],[{"start":{"row":2,"column":0},"end":{"row":3,"column":0},"action":"remove","lines":["",""],"id":147}],[{"start":{"row":1,"column":0},"end":{"row":2,"column":0},"action":"remove","lines":["",""],"id":148}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":2,"column":24},"end":{"row":2,"column":24},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":71,"mode":"ace/mode/ejs"}},"timestamp":1445465056337,"hash":"76ba7580736aa826dc375ba2fc146bc6a2c9043c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/views/login.ejs b/.c9/metadata/workspace/YelpCamp/v6/views/login.ejs deleted file mode 100644 index 8b8358b6..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/views/login.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"login.ejs","tooltip":"/YelpCamp/v6/views/login.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":9},"end":{"row":4,"column":10},"action":"insert","lines":["t"],"id":233}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":[" "],"id":234}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"remove","lines":[" "],"id":235}],[{"start":{"row":4,"column":10},"end":{"row":4,"column":11},"action":"insert","lines":[" "],"id":236}],[{"start":{"row":4,"column":11},"end":{"row":4,"column":12},"action":"insert","lines":["t"],"id":237}],[{"start":{"row":4,"column":12},"end":{"row":4,"column":13},"action":"insert","lines":["y"],"id":238}],[{"start":{"row":4,"column":13},"end":{"row":4,"column":14},"action":"insert","lines":["p"],"id":239}],[{"start":{"row":4,"column":14},"end":{"row":4,"column":15},"action":"insert","lines":["e"],"id":240}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":[" "],"id":241}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"remove","lines":[" "],"id":242}],[{"start":{"row":4,"column":15},"end":{"row":4,"column":16},"action":"insert","lines":["="],"id":243}],[{"start":{"row":4,"column":16},"end":{"row":4,"column":18},"action":"insert","lines":["\"\""],"id":244}],[{"start":{"row":4,"column":17},"end":{"row":4,"column":18},"action":"insert","lines":["s"],"id":245}],[{"start":{"row":4,"column":18},"end":{"row":4,"column":19},"action":"insert","lines":["u"],"id":246}],[{"start":{"row":4,"column":19},"end":{"row":4,"column":20},"action":"insert","lines":["b"],"id":247}],[{"start":{"row":4,"column":20},"end":{"row":4,"column":21},"action":"insert","lines":["m"],"id":248}],[{"start":{"row":4,"column":21},"end":{"row":4,"column":22},"action":"insert","lines":["i"],"id":249}],[{"start":{"row":4,"column":22},"end":{"row":4,"column":23},"action":"insert","lines":["t"],"id":250}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"insert","lines":[" "],"id":251}],[{"start":{"row":4,"column":23},"end":{"row":4,"column":24},"action":"remove","lines":[" "],"id":252}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":[">"],"id":253}],[{"start":{"row":4,"column":24},"end":{"row":4,"column":25},"action":"insert","lines":[" "],"id":254}],[{"start":{"row":4,"column":25},"end":{"row":4,"column":26},"action":"insert","lines":["v"],"id":255}],[{"start":{"row":4,"column":26},"end":{"row":4,"column":27},"action":"insert","lines":["a"],"id":256}],[{"start":{"row":4,"column":27},"end":{"row":4,"column":28},"action":"insert","lines":["l"],"id":257}],[{"start":{"row":4,"column":28},"end":{"row":4,"column":29},"action":"insert","lines":["u"],"id":258}],[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":["e"],"id":259}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":[" "],"id":260}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"remove","lines":[" "],"id":261}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":["="],"id":262}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":33},"action":"insert","lines":["\"\""],"id":263}],[{"start":{"row":4,"column":32},"end":{"row":4,"column":33},"action":"insert","lines":["L"],"id":264}],[{"start":{"row":4,"column":33},"end":{"row":4,"column":34},"action":"insert","lines":["o"],"id":265}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":["b"],"id":266}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"remove","lines":["b"],"id":267}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":["g"],"id":268}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"insert","lines":["i"],"id":269}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"insert","lines":["n"],"id":270}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":[" "],"id":271}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"remove","lines":[" "],"id":272}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":["!"],"id":273}],[{"start":{"row":1,"column":5},"end":{"row":1,"column":6},"action":"insert","lines":[" "],"id":274}],[{"start":{"row":1,"column":6},"end":{"row":1,"column":7},"action":"insert","lines":["a"],"id":275}],[{"start":{"row":1,"column":7},"end":{"row":1,"column":8},"action":"insert","lines":["c"],"id":276}],[{"start":{"row":1,"column":8},"end":{"row":1,"column":9},"action":"insert","lines":["t"],"id":277}],[{"start":{"row":1,"column":9},"end":{"row":1,"column":10},"action":"insert","lines":["i"],"id":278}],[{"start":{"row":1,"column":10},"end":{"row":1,"column":11},"action":"insert","lines":["o"],"id":279}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["n"],"id":280}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":[" "],"id":281}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"remove","lines":[" "],"id":282}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":13},"action":"insert","lines":[" "],"id":283}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["m"],"id":284}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["e"],"id":285}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":["t"],"id":286}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["h"],"id":287}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["o"],"id":288}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":["d"],"id":289}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":[" "],"id":290}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"remove","lines":[" "],"id":291}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"remove","lines":["n"],"id":292},{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["="]}],[{"start":{"row":1,"column":12},"end":{"row":1,"column":14},"action":"insert","lines":["\"\""],"id":293}],[{"start":{"row":1,"column":13},"end":{"row":1,"column":14},"action":"insert","lines":["/"],"id":294}],[{"start":{"row":1,"column":14},"end":{"row":1,"column":15},"action":"insert","lines":["l"],"id":295}],[{"start":{"row":1,"column":15},"end":{"row":1,"column":16},"action":"insert","lines":["o"],"id":296}],[{"start":{"row":1,"column":16},"end":{"row":1,"column":17},"action":"insert","lines":["g"],"id":297}],[{"start":{"row":1,"column":17},"end":{"row":1,"column":18},"action":"insert","lines":["i"],"id":298}],[{"start":{"row":1,"column":18},"end":{"row":1,"column":19},"action":"insert","lines":["n"],"id":299}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"insert","lines":[" "],"id":300}],[{"start":{"row":1,"column":19},"end":{"row":1,"column":20},"action":"remove","lines":[" "],"id":301}],[{"start":{"row":1,"column":11},"end":{"row":1,"column":12},"action":"insert","lines":["n"],"id":302}],[{"start":{"row":1,"column":28},"end":{"row":1,"column":29},"action":"insert","lines":["="],"id":303}],[{"start":{"row":1,"column":29},"end":{"row":1,"column":31},"action":"insert","lines":["\"\""],"id":304}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["P"],"id":305}],[{"start":{"row":1,"column":31},"end":{"row":1,"column":32},"action":"insert","lines":["O"],"id":306}],[{"start":{"row":1,"column":32},"end":{"row":1,"column":33},"action":"insert","lines":["S"],"id":307}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"insert","lines":["T"],"id":308}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":[" "],"id":309}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"remove","lines":[" "],"id":310}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["\\"],"id":311}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"remove","lines":["\\"],"id":312}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":313}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["<% include ../partials/header %> ",""],"id":314}],[{"start":{"row":7,"column":7},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":315}],[{"start":{"row":8,"column":0},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":316}],[{"start":{"row":9,"column":0},"end":{"row":10,"column":0},"action":"insert","lines":["<% include ../partials/header %> ",""],"id":317}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"remove","lines":["r"],"id":318}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"remove","lines":["e"],"id":319}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"remove","lines":["d"],"id":320}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"remove","lines":["a"],"id":321}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"remove","lines":["e"],"id":322}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"remove","lines":["h"],"id":323}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["f"],"id":324}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"insert","lines":["o"],"id":325}],[{"start":{"row":9,"column":25},"end":{"row":9,"column":26},"action":"insert","lines":["o"],"id":326}],[{"start":{"row":9,"column":26},"end":{"row":9,"column":27},"action":"insert","lines":["t"],"id":327}],[{"start":{"row":9,"column":27},"end":{"row":9,"column":28},"action":"insert","lines":["e"],"id":328}],[{"start":{"row":9,"column":28},"end":{"row":9,"column":29},"action":"insert","lines":["r"],"id":329}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"insert","lines":[" "],"id":330}],[{"start":{"row":9,"column":29},"end":{"row":9,"column":30},"action":"remove","lines":[" "],"id":331}],[{"start":{"row":0,"column":12},"end":{"row":0,"column":13},"action":"remove","lines":["."],"id":332}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"remove","lines":["."],"id":333}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":9,"column":0},"end":{"row":10,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445463462417,"hash":"8ef1eca0273f08a3b4634afd27b2537b347efd4c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/views/partials/header.ejs b/.c9/metadata/workspace/YelpCamp/v6/views/partials/header.ejs deleted file mode 100644 index dd0a132e..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/views/partials/header.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"header.ejs","tooltip":"/YelpCamp/v6/views/partials/header.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":18,"column":21},"end":{"row":18,"column":22},"action":"insert","lines":[">"],"id":187}],[{"start":{"row":18,"column":21},"end":{"row":18,"column":22},"action":"remove","lines":[">"],"id":188}],[{"start":{"row":18,"column":20},"end":{"row":18,"column":21},"action":"remove","lines":["%"],"id":189}],[{"start":{"row":18,"column":20},"end":{"row":18,"column":21},"action":"insert","lines":["<"],"id":190}],[{"start":{"row":18,"column":21},"end":{"row":18,"column":22},"action":"insert","lines":["%"],"id":191}],[{"start":{"row":18,"column":22},"end":{"row":18,"column":23},"action":"insert","lines":[" "],"id":192}],[{"start":{"row":18,"column":31},"end":{"row":18,"column":32},"action":"insert","lines":[" "],"id":193}],[{"start":{"row":18,"column":32},"end":{"row":18,"column":33},"action":"insert","lines":["%"],"id":194}],[{"start":{"row":18,"column":33},"end":{"row":18,"column":34},"action":"insert","lines":[">"],"id":195}],[{"start":{"row":20,"column":20},"end":{"row":20,"column":21},"action":"insert","lines":["<"],"id":196}],[{"start":{"row":20,"column":21},"end":{"row":20,"column":22},"action":"insert","lines":["%"],"id":197}],[{"start":{"row":20,"column":22},"end":{"row":20,"column":23},"action":"insert","lines":[" "],"id":198}],[{"start":{"row":20,"column":24},"end":{"row":20,"column":25},"action":"insert","lines":[" "],"id":199}],[{"start":{"row":20,"column":25},"end":{"row":20,"column":26},"action":"insert","lines":["%"],"id":200}],[{"start":{"row":20,"column":26},"end":{"row":20,"column":27},"action":"insert","lines":[">"],"id":201}],[{"start":{"row":18,"column":34},"end":{"row":19,"column":0},"action":"insert","lines":["",""],"id":202},{"start":{"row":19,"column":0},"end":{"row":19,"column":20},"action":"insert","lines":[" "]}],[{"start":{"row":19,"column":20},"end":{"row":20,"column":0},"action":"insert","lines":["
  • Logout
  • ",""],"id":203}],[{"start":{"row":19,"column":81},"end":{"row":20,"column":0},"action":"remove","lines":["",""],"id":204}],[{"start":{"row":19,"column":40},"end":{"row":19,"column":44},"action":"remove","lines":[" "],"id":205}],[{"start":{"row":19,"column":36},"end":{"row":19,"column":40},"action":"remove","lines":[" "],"id":206}],[{"start":{"row":19,"column":32},"end":{"row":19,"column":36},"action":"remove","lines":[" "],"id":207}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":32},"action":"remove","lines":[" "],"id":208}],[{"start":{"row":19,"column":24},"end":{"row":19,"column":28},"action":"remove","lines":[" "],"id":209}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":56},"action":"remove","lines":[" href=\"/logout\">Logout"],"id":210}],[{"start":{"row":19,"column":29},"end":{"row":19,"column":30},"action":"remove","lines":["a"],"id":211}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":29},"action":"remove","lines":["<"],"id":212}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":29},"action":"insert","lines":["C"],"id":213}],[{"start":{"row":19,"column":29},"end":{"row":19,"column":30},"action":"insert","lines":["u"],"id":214}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":31},"action":"insert","lines":["r"],"id":215}],[{"start":{"row":19,"column":31},"end":{"row":19,"column":32},"action":"insert","lines":["r"],"id":216}],[{"start":{"row":19,"column":31},"end":{"row":19,"column":32},"action":"remove","lines":["r"],"id":217}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":31},"action":"remove","lines":["r"],"id":218}],[{"start":{"row":19,"column":29},"end":{"row":19,"column":30},"action":"remove","lines":["u"],"id":219}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":29},"action":"remove","lines":["C"],"id":220}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":29},"action":"insert","lines":["S"],"id":221}],[{"start":{"row":19,"column":29},"end":{"row":19,"column":30},"action":"insert","lines":["i"],"id":222}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":31},"action":"insert","lines":["g"],"id":223}],[{"start":{"row":19,"column":31},"end":{"row":19,"column":32},"action":"insert","lines":["n"],"id":224}],[{"start":{"row":19,"column":32},"end":{"row":19,"column":33},"action":"insert","lines":["e"],"id":225}],[{"start":{"row":19,"column":33},"end":{"row":19,"column":34},"action":"insert","lines":["d"],"id":226}],[{"start":{"row":19,"column":34},"end":{"row":19,"column":35},"action":"insert","lines":[" "],"id":227}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":36},"action":"insert","lines":["i"],"id":228}],[{"start":{"row":19,"column":36},"end":{"row":19,"column":37},"action":"insert","lines":["n"],"id":229}],[{"start":{"row":19,"column":36},"end":{"row":19,"column":37},"action":"remove","lines":["n"],"id":230}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":36},"action":"remove","lines":["i"],"id":231}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":36},"action":"insert","lines":["I"],"id":232}],[{"start":{"row":19,"column":36},"end":{"row":19,"column":37},"action":"insert","lines":["n"],"id":233}],[{"start":{"row":19,"column":37},"end":{"row":19,"column":38},"action":"insert","lines":[" "],"id":234}],[{"start":{"row":19,"column":38},"end":{"row":19,"column":39},"action":"insert","lines":["A"],"id":235}],[{"start":{"row":19,"column":39},"end":{"row":19,"column":40},"action":"insert","lines":["s"],"id":236}],[{"start":{"row":19,"column":40},"end":{"row":19,"column":41},"action":"insert","lines":[" "],"id":237}],[{"start":{"row":19,"column":40},"end":{"row":19,"column":41},"action":"remove","lines":[" "],"id":238}],[{"start":{"row":19,"column":40},"end":{"row":19,"column":41},"action":"insert","lines":[" "],"id":239}],[{"start":{"row":19,"column":41},"end":{"row":19,"column":42},"action":"insert","lines":["<"],"id":240}],[{"start":{"row":19,"column":42},"end":{"row":19,"column":43},"action":"insert","lines":["%"],"id":241}],[{"start":{"row":19,"column":43},"end":{"row":19,"column":44},"action":"insert","lines":["="],"id":242}],[{"start":{"row":19,"column":44},"end":{"row":19,"column":45},"action":"insert","lines":[" "],"id":243}],[{"start":{"row":19,"column":45},"end":{"row":19,"column":46},"action":"insert","lines":["%"],"id":244}],[{"start":{"row":19,"column":46},"end":{"row":19,"column":47},"action":"insert","lines":[">"],"id":245}],[{"start":{"row":19,"column":45},"end":{"row":19,"column":46},"action":"insert","lines":["c"],"id":246}],[{"start":{"row":19,"column":46},"end":{"row":19,"column":47},"action":"insert","lines":["u"],"id":247}],[{"start":{"row":19,"column":47},"end":{"row":19,"column":48},"action":"insert","lines":["r"],"id":248}],[{"start":{"row":19,"column":48},"end":{"row":19,"column":49},"action":"insert","lines":["r"],"id":249}],[{"start":{"row":19,"column":49},"end":{"row":19,"column":50},"action":"insert","lines":["e"],"id":250}],[{"start":{"row":19,"column":50},"end":{"row":19,"column":51},"action":"insert","lines":["n"],"id":251}],[{"start":{"row":19,"column":51},"end":{"row":19,"column":52},"action":"insert","lines":["t"],"id":252}],[{"start":{"row":19,"column":52},"end":{"row":19,"column":53},"action":"insert","lines":[" "],"id":253}],[{"start":{"row":19,"column":52},"end":{"row":19,"column":53},"action":"remove","lines":[" "],"id":254}],[{"start":{"row":19,"column":52},"end":{"row":19,"column":56},"action":"insert","lines":[" "],"id":255}],[{"start":{"row":19,"column":52},"end":{"row":19,"column":56},"action":"remove","lines":[" "],"id":256}],[{"start":{"row":19,"column":51},"end":{"row":19,"column":52},"action":"remove","lines":["t"],"id":257}],[{"start":{"row":19,"column":51},"end":{"row":19,"column":52},"action":"insert","lines":["t"],"id":258}],[{"start":{"row":19,"column":52},"end":{"row":19,"column":53},"action":"insert","lines":["U"],"id":259}],[{"start":{"row":19,"column":45},"end":{"row":19,"column":53},"action":"remove","lines":["currentU"],"id":260},{"start":{"row":19,"column":45},"end":{"row":19,"column":56},"action":"insert","lines":["currentUser"]}],[{"start":{"row":19,"column":56},"end":{"row":19,"column":57},"action":"insert","lines":["."],"id":261}],[{"start":{"row":19,"column":57},"end":{"row":19,"column":58},"action":"insert","lines":["u"],"id":262}],[{"start":{"row":19,"column":58},"end":{"row":19,"column":59},"action":"insert","lines":["s"],"id":263}],[{"start":{"row":19,"column":59},"end":{"row":19,"column":60},"action":"insert","lines":["e"],"id":264}],[{"start":{"row":19,"column":60},"end":{"row":19,"column":61},"action":"insert","lines":["r"],"id":265}],[{"start":{"row":19,"column":61},"end":{"row":19,"column":62},"action":"insert","lines":["n"],"id":266}],[{"start":{"row":19,"column":62},"end":{"row":19,"column":63},"action":"insert","lines":["a"],"id":267}],[{"start":{"row":19,"column":63},"end":{"row":19,"column":64},"action":"insert","lines":["m"],"id":268}],[{"start":{"row":19,"column":64},"end":{"row":19,"column":65},"action":"insert","lines":["e"],"id":269}],[{"start":{"row":19,"column":65},"end":{"row":19,"column":66},"action":"insert","lines":[" "],"id":270}],[{"start":{"row":19,"column":65},"end":{"row":19,"column":66},"action":"remove","lines":[" "],"id":271}],[{"start":{"row":19,"column":65},"end":{"row":19,"column":66},"action":"insert","lines":[" "],"id":272}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":29},"action":"insert","lines":["<"],"id":273}],[{"start":{"row":19,"column":29},"end":{"row":19,"column":30},"action":"insert","lines":["a"],"id":274}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":35},"action":"insert","lines":[">"],"id":275}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":75},"action":"remove","lines":["Signed In As <%= currentUser.username %>"],"id":276}],[{"start":{"row":19,"column":31},"end":{"row":19,"column":71},"action":"insert","lines":["Signed In As <%= currentUser.username %>"],"id":277}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":31},"action":"insert","lines":[" "],"id":278}],[{"start":{"row":19,"column":31},"end":{"row":19,"column":32},"action":"insert","lines":["h"],"id":279}],[{"start":{"row":19,"column":32},"end":{"row":19,"column":33},"action":"insert","lines":["r"],"id":280}],[{"start":{"row":19,"column":33},"end":{"row":19,"column":34},"action":"insert","lines":["e"],"id":281}],[{"start":{"row":19,"column":34},"end":{"row":19,"column":35},"action":"insert","lines":["f"],"id":282}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":36},"action":"insert","lines":[" "],"id":283}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":36},"action":"remove","lines":[" "],"id":284}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":36},"action":"insert","lines":["="],"id":285}],[{"start":{"row":19,"column":36},"end":{"row":19,"column":38},"action":"insert","lines":["\"\""],"id":286}],[{"start":{"row":19,"column":37},"end":{"row":19,"column":38},"action":"insert","lines":["#"],"id":287}]]},"ace":{"folds":[],"scrolltop":243,"scrollleft":0,"selection":{"start":{"row":17,"column":64},"end":{"row":17,"column":64},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":71,"mode":"ace/mode/ejs"}},"timestamp":1445465476488,"hash":"ede0d790e206077f42678a18df639c197124a326"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v6/views/register.ejs b/.c9/metadata/workspace/YelpCamp/v6/views/register.ejs deleted file mode 100644 index 0dcc1bbb..00000000 --- a/.c9/metadata/workspace/YelpCamp/v6/views/register.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"register.ejs","tooltip":"/YelpCamp/v6/views/register.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":4,"column":29},"end":{"row":4,"column":30},"action":"insert","lines":["m"],"id":181}],[{"start":{"row":4,"column":30},"end":{"row":4,"column":31},"action":"insert","lines":["e"],"id":182}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"insert","lines":[" "],"id":183}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"remove","lines":[" "],"id":184}],[{"start":{"row":4,"column":31},"end":{"row":4,"column":32},"action":"insert","lines":["="],"id":185}],[{"start":{"row":4,"column":32},"end":{"row":4,"column":34},"action":"insert","lines":["\"\""],"id":186}],[{"start":{"row":4,"column":33},"end":{"row":4,"column":34},"action":"insert","lines":["p"],"id":187}],[{"start":{"row":4,"column":34},"end":{"row":4,"column":35},"action":"insert","lines":["a"],"id":188}],[{"start":{"row":4,"column":35},"end":{"row":4,"column":36},"action":"insert","lines":["s"],"id":189}],[{"start":{"row":4,"column":36},"end":{"row":4,"column":37},"action":"insert","lines":["s"],"id":190}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":["p"],"id":191}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"remove","lines":["p"],"id":192}],[{"start":{"row":4,"column":37},"end":{"row":4,"column":38},"action":"insert","lines":["w"],"id":193}],[{"start":{"row":4,"column":38},"end":{"row":4,"column":39},"action":"insert","lines":["o"],"id":194}],[{"start":{"row":4,"column":39},"end":{"row":4,"column":40},"action":"insert","lines":["r"],"id":195}],[{"start":{"row":4,"column":40},"end":{"row":4,"column":41},"action":"insert","lines":["d"],"id":196}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"insert","lines":[" "],"id":197}],[{"start":{"row":4,"column":41},"end":{"row":4,"column":42},"action":"remove","lines":[" "],"id":198}],[{"start":{"row":4,"column":42},"end":{"row":4,"column":43},"action":"insert","lines":[" "],"id":199}],[{"start":{"row":4,"column":43},"end":{"row":4,"column":44},"action":"insert","lines":["p"],"id":200}],[{"start":{"row":4,"column":44},"end":{"row":4,"column":45},"action":"insert","lines":["l"],"id":201}],[{"start":{"row":4,"column":45},"end":{"row":4,"column":46},"action":"insert","lines":["a"],"id":202}],[{"start":{"row":4,"column":46},"end":{"row":4,"column":47},"action":"insert","lines":["c"],"id":203}],[{"start":{"row":4,"column":47},"end":{"row":4,"column":48},"action":"insert","lines":["e"],"id":204}],[{"start":{"row":4,"column":48},"end":{"row":4,"column":49},"action":"insert","lines":["h"],"id":205}],[{"start":{"row":4,"column":49},"end":{"row":4,"column":50},"action":"insert","lines":["o"],"id":206}],[{"start":{"row":4,"column":50},"end":{"row":4,"column":51},"action":"insert","lines":["l"],"id":207}],[{"start":{"row":4,"column":51},"end":{"row":4,"column":52},"action":"insert","lines":["d"],"id":208}],[{"start":{"row":4,"column":52},"end":{"row":4,"column":53},"action":"insert","lines":["e"],"id":209}],[{"start":{"row":4,"column":53},"end":{"row":4,"column":54},"action":"insert","lines":["r"],"id":210}],[{"start":{"row":4,"column":54},"end":{"row":4,"column":55},"action":"insert","lines":[" "],"id":211}],[{"start":{"row":4,"column":54},"end":{"row":4,"column":55},"action":"remove","lines":[" "],"id":212}],[{"start":{"row":4,"column":54},"end":{"row":4,"column":55},"action":"insert","lines":["="],"id":213}],[{"start":{"row":4,"column":55},"end":{"row":4,"column":57},"action":"insert","lines":["\"\""],"id":214}],[{"start":{"row":4,"column":56},"end":{"row":4,"column":57},"action":"insert","lines":["p"],"id":215}],[{"start":{"row":4,"column":57},"end":{"row":4,"column":58},"action":"insert","lines":["a"],"id":216}],[{"start":{"row":4,"column":58},"end":{"row":4,"column":59},"action":"insert","lines":["s"],"id":217}],[{"start":{"row":4,"column":59},"end":{"row":4,"column":60},"action":"insert","lines":["s"],"id":218}],[{"start":{"row":4,"column":60},"end":{"row":4,"column":61},"action":"insert","lines":["w"],"id":219}],[{"start":{"row":4,"column":61},"end":{"row":4,"column":62},"action":"insert","lines":["o"],"id":220}],[{"start":{"row":4,"column":62},"end":{"row":4,"column":63},"action":"insert","lines":["r"],"id":221}],[{"start":{"row":4,"column":63},"end":{"row":4,"column":64},"action":"insert","lines":["d"],"id":222}],[{"start":{"row":4,"column":64},"end":{"row":4,"column":65},"action":"insert","lines":[" "],"id":223}],[{"start":{"row":4,"column":64},"end":{"row":4,"column":65},"action":"remove","lines":[" "],"id":224}],[{"start":{"row":4,"column":65},"end":{"row":4,"column":66},"action":"insert","lines":[">"],"id":225}],[{"start":{"row":4,"column":66},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":226},{"start":{"row":5,"column":0},"end":{"row":5,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["<"],"id":227}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["b"],"id":228}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["u"],"id":229}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["t"],"id":230}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["t"],"id":231}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["o"],"id":232}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["n"],"id":233}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":[" "],"id":234}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"remove","lines":[" "],"id":235}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":21},"action":"insert","lines":[">"],"id":236}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["S"],"id":237}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["i"],"id":238}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["g"],"id":239}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["n"],"id":240}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":[" "],"id":241}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"remove","lines":[" "],"id":242}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":[" "],"id":243}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["U"],"id":244}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["p"],"id":245}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"remove","lines":["p"],"id":246}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"remove","lines":["U"],"id":247}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"remove","lines":[" "],"id":248}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"remove","lines":["n"],"id":249}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"remove","lines":["g"],"id":250}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"remove","lines":["i"],"id":251}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"remove","lines":["S"],"id":252}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["S"],"id":253}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["i"],"id":254}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":["g"],"id":255}],[{"start":{"row":5,"column":15},"end":{"row":5,"column":16},"action":"insert","lines":["n"],"id":256}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":[" "],"id":257}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"remove","lines":[" "],"id":258}],[{"start":{"row":5,"column":16},"end":{"row":5,"column":17},"action":"insert","lines":[" "],"id":259}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["U"],"id":260}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["p"],"id":261}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":20},"action":"insert","lines":[" "],"id":262}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":20},"action":"remove","lines":[" "],"id":263}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":264}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"insert","lines":["<"],"id":265}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"insert","lines":["%"],"id":266}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"insert","lines":[" "],"id":267}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"insert","lines":["i"],"id":268}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"insert","lines":["u"],"id":269}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"insert","lines":["n"],"id":270}],[{"start":{"row":0,"column":5},"end":{"row":0,"column":6},"action":"remove","lines":["n"],"id":271}],[{"start":{"row":0,"column":4},"end":{"row":0,"column":5},"action":"remove","lines":["u"],"id":272}],[{"start":{"row":0,"column":3},"end":{"row":0,"column":4},"action":"remove","lines":["i"],"id":273}],[{"start":{"row":0,"column":2},"end":{"row":0,"column":3},"action":"remove","lines":[" "],"id":274}],[{"start":{"row":0,"column":1},"end":{"row":0,"column":2},"action":"remove","lines":["%"],"id":275}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":1},"action":"remove","lines":["<"],"id":276}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"remove","lines":["",""],"id":277}],[{"start":{"row":0,"column":0},"end":{"row":1,"column":0},"action":"insert","lines":["",""],"id":278}],[{"start":{"row":0,"column":0},"end":{"row":0,"column":32},"action":"insert","lines":["<% include ./partials/header %> "],"id":279}],[{"start":{"row":7,"column":7},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":280}],[{"start":{"row":8,"column":0},"end":{"row":9,"column":0},"action":"insert","lines":["<% include ./partials/footer %> ",""],"id":281}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":7,"column":7},"end":{"row":7,"column":7},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445463475440,"hash":"12c2d09494fba3cf0ca139670be55e076b7494cd"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v7/app.js b/.c9/metadata/workspace/YelpCamp/v7/app.js deleted file mode 100644 index 7d673e3a..00000000 --- a/.c9/metadata/workspace/YelpCamp/v7/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v7/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":39,"column":11},"end":{"row":39,"column":12},"action":"insert","lines":["a"],"id":397}],[{"start":{"row":39,"column":12},"end":{"row":39,"column":13},"action":"insert","lines":["m"],"id":398}],[{"start":{"row":39,"column":13},"end":{"row":39,"column":14},"action":"insert","lines":["p"],"id":399}],[{"start":{"row":39,"column":14},"end":{"row":39,"column":15},"action":"insert","lines":["g"],"id":400}],[{"start":{"row":39,"column":15},"end":{"row":39,"column":16},"action":"insert","lines":["r"],"id":401}],[{"start":{"row":39,"column":16},"end":{"row":39,"column":17},"action":"insert","lines":["o"],"id":402}],[{"start":{"row":39,"column":17},"end":{"row":39,"column":18},"action":"insert","lines":["u"],"id":403}],[{"start":{"row":39,"column":18},"end":{"row":39,"column":19},"action":"insert","lines":["n"],"id":404}],[{"start":{"row":39,"column":19},"end":{"row":39,"column":20},"action":"insert","lines":["d"],"id":405}],[{"start":{"row":39,"column":20},"end":{"row":39,"column":21},"action":"insert","lines":["s"],"id":406}],[{"start":{"row":39,"column":21},"end":{"row":39,"column":22},"action":"insert","lines":[" "],"id":407}],[{"start":{"row":39,"column":21},"end":{"row":39,"column":22},"action":"remove","lines":[" "],"id":408}],[{"start":{"row":39,"column":22},"end":{"row":39,"column":23},"action":"insert","lines":[","],"id":409}],[{"start":{"row":39,"column":23},"end":{"row":39,"column":24},"action":"insert","lines":[" "],"id":410}],[{"start":{"row":38,"column":8},"end":{"row":38,"column":9},"action":"insert","lines":["\""],"id":411}],[{"start":{"row":38,"column":9},"end":{"row":38,"column":10},"action":"insert","lines":["/"],"id":412}],[{"start":{"row":38,"column":10},"end":{"row":38,"column":11},"action":"insert","lines":["\""],"id":413}],[{"start":{"row":38,"column":11},"end":{"row":38,"column":12},"action":"insert","lines":["."],"id":414}],[{"start":{"row":38,"column":12},"end":{"row":38,"column":13},"action":"insert","lines":[" "],"id":415}],[{"start":{"row":38,"column":12},"end":{"row":38,"column":13},"action":"remove","lines":[" "],"id":416}],[{"start":{"row":38,"column":11},"end":{"row":38,"column":12},"action":"remove","lines":["."],"id":417}],[{"start":{"row":38,"column":11},"end":{"row":38,"column":12},"action":"insert","lines":[","],"id":418}],[{"start":{"row":38,"column":12},"end":{"row":38,"column":13},"action":"insert","lines":[" "],"id":419}],[{"start":{"row":40,"column":8},"end":{"row":40,"column":9},"action":"insert","lines":["\""],"id":420}],[{"start":{"row":40,"column":9},"end":{"row":40,"column":10},"action":"insert","lines":["/"],"id":421}],[{"start":{"row":40,"column":10},"end":{"row":40,"column":11},"action":"insert","lines":["c"],"id":422}],[{"start":{"row":40,"column":11},"end":{"row":40,"column":12},"action":"insert","lines":["o"],"id":423}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":13},"action":"insert","lines":["m"],"id":424}],[{"start":{"row":40,"column":13},"end":{"row":40,"column":14},"action":"insert","lines":["m"],"id":425}],[{"start":{"row":40,"column":14},"end":{"row":40,"column":15},"action":"insert","lines":["e"],"id":426}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":16},"action":"insert","lines":["n"],"id":427}],[{"start":{"row":40,"column":16},"end":{"row":40,"column":17},"action":"insert","lines":["t"],"id":428}],[{"start":{"row":40,"column":16},"end":{"row":40,"column":17},"action":"remove","lines":["t"],"id":429}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":16},"action":"remove","lines":["n"],"id":430}],[{"start":{"row":40,"column":14},"end":{"row":40,"column":15},"action":"remove","lines":["e"],"id":431}],[{"start":{"row":40,"column":13},"end":{"row":40,"column":14},"action":"remove","lines":["m"],"id":432}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":13},"action":"remove","lines":["m"],"id":433}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":13},"action":"insert","lines":["a"],"id":434}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":13},"action":"remove","lines":["a"],"id":435}],[{"start":{"row":40,"column":11},"end":{"row":40,"column":12},"action":"remove","lines":["o"],"id":436}],[{"start":{"row":40,"column":11},"end":{"row":40,"column":12},"action":"insert","lines":["a"],"id":437}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":13},"action":"insert","lines":["m"],"id":438}],[{"start":{"row":40,"column":13},"end":{"row":40,"column":14},"action":"insert","lines":["p"],"id":439}],[{"start":{"row":40,"column":14},"end":{"row":40,"column":15},"action":"insert","lines":["g"],"id":440}],[{"start":{"row":40,"column":15},"end":{"row":40,"column":16},"action":"insert","lines":["r"],"id":441}],[{"start":{"row":40,"column":16},"end":{"row":40,"column":17},"action":"insert","lines":["o"],"id":442}],[{"start":{"row":40,"column":17},"end":{"row":40,"column":18},"action":"insert","lines":["u"],"id":443}],[{"start":{"row":40,"column":18},"end":{"row":40,"column":19},"action":"insert","lines":["n"],"id":444}],[{"start":{"row":40,"column":19},"end":{"row":40,"column":20},"action":"insert","lines":["d"],"id":445}],[{"start":{"row":40,"column":20},"end":{"row":40,"column":21},"action":"insert","lines":["s"],"id":446}],[{"start":{"row":40,"column":21},"end":{"row":40,"column":22},"action":"insert","lines":[" "],"id":447}],[{"start":{"row":40,"column":21},"end":{"row":40,"column":22},"action":"remove","lines":[" "],"id":448}],[{"start":{"row":40,"column":21},"end":{"row":40,"column":22},"action":"insert","lines":["/"],"id":449}],[{"start":{"row":40,"column":22},"end":{"row":40,"column":23},"action":"insert","lines":[":"],"id":450}],[{"start":{"row":40,"column":23},"end":{"row":40,"column":24},"action":"insert","lines":["i"],"id":451}],[{"start":{"row":40,"column":24},"end":{"row":40,"column":25},"action":"insert","lines":["d"],"id":452}],[{"start":{"row":40,"column":25},"end":{"row":40,"column":26},"action":"insert","lines":[" "],"id":453}],[{"start":{"row":40,"column":25},"end":{"row":40,"column":26},"action":"remove","lines":[" "],"id":454}],[{"start":{"row":40,"column":25},"end":{"row":40,"column":26},"action":"insert","lines":["/"],"id":455}],[{"start":{"row":40,"column":26},"end":{"row":40,"column":27},"action":"insert","lines":["c"],"id":456}],[{"start":{"row":40,"column":27},"end":{"row":40,"column":28},"action":"insert","lines":["o"],"id":457}],[{"start":{"row":40,"column":28},"end":{"row":40,"column":29},"action":"insert","lines":["m"],"id":458}],[{"start":{"row":40,"column":29},"end":{"row":40,"column":30},"action":"insert","lines":["m"],"id":459}],[{"start":{"row":40,"column":30},"end":{"row":40,"column":31},"action":"insert","lines":["e"],"id":460}],[{"start":{"row":40,"column":31},"end":{"row":40,"column":32},"action":"insert","lines":["n"],"id":461}],[{"start":{"row":40,"column":32},"end":{"row":40,"column":33},"action":"insert","lines":["t"],"id":462}],[{"start":{"row":40,"column":33},"end":{"row":40,"column":34},"action":"insert","lines":["s"],"id":463}],[{"start":{"row":40,"column":34},"end":{"row":40,"column":35},"action":"insert","lines":[" "],"id":464}],[{"start":{"row":40,"column":34},"end":{"row":40,"column":35},"action":"remove","lines":[" "],"id":465}],[{"start":{"row":40,"column":34},"end":{"row":40,"column":35},"action":"insert","lines":["\""],"id":466}],[{"start":{"row":40,"column":35},"end":{"row":40,"column":36},"action":"insert","lines":[","],"id":467}],[{"start":{"row":40,"column":36},"end":{"row":40,"column":37},"action":"insert","lines":[" "],"id":468}],[{"start":{"row":10,"column":4},"end":{"row":11,"column":0},"action":"insert","lines":["",""],"id":469},{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"insert","lines":[" "]}],[{"start":{"row":11,"column":0},"end":{"row":11,"column":4},"action":"remove","lines":[" "],"id":470}],[{"start":{"row":11,"column":0},"end":{"row":11,"column":1},"action":"insert","lines":["/"],"id":471}],[{"start":{"row":11,"column":1},"end":{"row":11,"column":2},"action":"insert","lines":["/"],"id":472}],[{"start":{"row":11,"column":2},"end":{"row":11,"column":3},"action":"insert","lines":["r"],"id":473}],[{"start":{"row":11,"column":3},"end":{"row":11,"column":4},"action":"insert","lines":["e"],"id":474}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":5},"action":"insert","lines":["q"],"id":475}],[{"start":{"row":11,"column":5},"end":{"row":11,"column":6},"action":"insert","lines":["u"],"id":476}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"insert","lines":["i"],"id":477}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"remove","lines":["i"],"id":478}],[{"start":{"row":11,"column":5},"end":{"row":11,"column":6},"action":"remove","lines":["u"],"id":479}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":5},"action":"remove","lines":["q"],"id":480}],[{"start":{"row":11,"column":3},"end":{"row":11,"column":4},"action":"remove","lines":["e"],"id":481}],[{"start":{"row":11,"column":2},"end":{"row":11,"column":3},"action":"remove","lines":["r"],"id":482}],[{"start":{"row":11,"column":2},"end":{"row":11,"column":3},"action":"insert","lines":["r"],"id":483}],[{"start":{"row":11,"column":3},"end":{"row":11,"column":4},"action":"insert","lines":["e"],"id":484}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":5},"action":"insert","lines":["q"],"id":485}],[{"start":{"row":11,"column":5},"end":{"row":11,"column":6},"action":"insert","lines":["u"],"id":486}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"insert","lines":["r"],"id":487}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"insert","lines":["i"],"id":488}],[{"start":{"row":11,"column":8},"end":{"row":11,"column":9},"action":"insert","lines":["n"],"id":489}],[{"start":{"row":11,"column":9},"end":{"row":11,"column":10},"action":"insert","lines":["g"],"id":490}],[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"insert","lines":[" "],"id":491}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"insert","lines":["r"],"id":492}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"insert","lines":["o"],"id":493}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"insert","lines":["u"],"id":494}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"insert","lines":["t"],"id":495}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"insert","lines":["e"],"id":496}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"insert","lines":["s"],"id":497}],[{"start":{"row":11,"column":4},"end":{"row":11,"column":5},"action":"remove","lines":["q"],"id":510}],[{"start":{"row":11,"column":5},"end":{"row":11,"column":6},"action":"remove","lines":["u"],"id":509}],[{"start":{"row":11,"column":6},"end":{"row":11,"column":7},"action":"remove","lines":["r"],"id":508}],[{"start":{"row":11,"column":7},"end":{"row":11,"column":8},"action":"remove","lines":["i"],"id":507}],[{"start":{"row":11,"column":8},"end":{"row":11,"column":9},"action":"remove","lines":["n"],"id":506}],[{"start":{"row":11,"column":9},"end":{"row":11,"column":10},"action":"remove","lines":["g"],"id":505}],[{"start":{"row":11,"column":10},"end":{"row":11,"column":11},"action":"remove","lines":[" "],"id":504}],[{"start":{"row":11,"column":11},"end":{"row":11,"column":12},"action":"remove","lines":["r"],"id":503}],[{"start":{"row":11,"column":12},"end":{"row":11,"column":13},"action":"remove","lines":["o"],"id":502}],[{"start":{"row":11,"column":13},"end":{"row":11,"column":14},"action":"remove","lines":["u"],"id":501}],[{"start":{"row":11,"column":14},"end":{"row":11,"column":15},"action":"remove","lines":["t"],"id":500}],[{"start":{"row":11,"column":15},"end":{"row":11,"column":16},"action":"remove","lines":["e"],"id":499}],[{"start":{"row":11,"column":16},"end":{"row":11,"column":17},"action":"remove","lines":["s"],"id":498}]]},"ace":{"folds":[],"scrolltop":870,"scrollleft":0,"selection":{"start":{"row":45,"column":3},"end":{"row":45,"column":3},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":79,"mode":"ace/mode/javascript"}},"timestamp":1445490060402,"hash":"201da936e83f5cbef1e60465863bec86a16cf32a"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v7/readme.md b/.c9/metadata/workspace/YelpCamp/v7/readme.md deleted file mode 100644 index 3a4d8742..00000000 --- a/.c9/metadata/workspace/YelpCamp/v7/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v7/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":86,"column":11},"end":{"row":86,"column":12},"action":"remove","lines":["t"],"id":48}],[{"start":{"row":86,"column":11},"end":{"row":86,"column":12},"action":"insert","lines":["T"],"id":49}],[{"start":{"row":86,"column":12},"end":{"row":86,"column":13},"action":"insert","lines":["h"],"id":50}],[{"start":{"row":86,"column":13},"end":{"row":86,"column":14},"action":"insert","lines":["e"],"id":51}],[{"start":{"row":86,"column":14},"end":{"row":86,"column":15},"action":"insert","lines":[" "],"id":52}],[{"start":{"row":86,"column":15},"end":{"row":86,"column":16},"action":"insert","lines":["R"],"id":53}],[{"start":{"row":86,"column":16},"end":{"row":86,"column":17},"action":"insert","lines":["o"],"id":54}],[{"start":{"row":86,"column":17},"end":{"row":86,"column":18},"action":"insert","lines":["u"],"id":55}],[{"start":{"row":86,"column":18},"end":{"row":86,"column":19},"action":"insert","lines":["t"],"id":56}],[{"start":{"row":86,"column":19},"end":{"row":86,"column":20},"action":"insert","lines":["e"],"id":57}],[{"start":{"row":86,"column":20},"end":{"row":86,"column":21},"action":"insert","lines":["s"],"id":58}],[{"start":{"row":86,"column":21},"end":{"row":86,"column":22},"action":"insert","lines":[" "],"id":59}],[{"start":{"row":86,"column":21},"end":{"row":86,"column":22},"action":"remove","lines":[" "],"id":60}],[{"start":{"row":86,"column":21},"end":{"row":87,"column":0},"action":"insert","lines":["",""],"id":61}],[{"start":{"row":87,"column":0},"end":{"row":87,"column":1},"action":"insert","lines":["*"],"id":62}],[{"start":{"row":87,"column":1},"end":{"row":87,"column":2},"action":"insert","lines":[" "],"id":63}],[{"start":{"row":87,"column":2},"end":{"row":87,"column":3},"action":"insert","lines":["R"],"id":64}],[{"start":{"row":87,"column":3},"end":{"row":87,"column":4},"action":"insert","lines":["e"],"id":65}],[{"start":{"row":87,"column":4},"end":{"row":87,"column":5},"action":"insert","lines":["f"],"id":66}],[{"start":{"row":87,"column":5},"end":{"row":87,"column":6},"action":"insert","lines":["a"],"id":67}],[{"start":{"row":87,"column":6},"end":{"row":87,"column":7},"action":"insert","lines":["c"],"id":68}],[{"start":{"row":87,"column":6},"end":{"row":87,"column":7},"action":"remove","lines":["c"],"id":69}],[{"start":{"row":87,"column":5},"end":{"row":87,"column":6},"action":"remove","lines":["a"],"id":70}],[{"start":{"row":87,"column":4},"end":{"row":87,"column":5},"action":"remove","lines":["f"],"id":71}],[{"start":{"row":87,"column":3},"end":{"row":87,"column":4},"action":"remove","lines":["e"],"id":72}],[{"start":{"row":87,"column":2},"end":{"row":87,"column":3},"action":"remove","lines":["R"],"id":73}],[{"start":{"row":87,"column":2},"end":{"row":87,"column":3},"action":"insert","lines":["R"],"id":74}],[{"start":{"row":87,"column":2},"end":{"row":87,"column":3},"action":"remove","lines":["R"],"id":75}],[{"start":{"row":87,"column":2},"end":{"row":87,"column":3},"action":"insert","lines":["A"],"id":76}],[{"start":{"row":87,"column":3},"end":{"row":87,"column":4},"action":"insert","lines":["d"],"id":77}],[{"start":{"row":87,"column":4},"end":{"row":87,"column":5},"action":"insert","lines":["d"],"id":78}],[{"start":{"row":87,"column":5},"end":{"row":87,"column":6},"action":"insert","lines":[" "],"id":79}],[{"start":{"row":87,"column":5},"end":{"row":87,"column":6},"action":"remove","lines":[" "],"id":80}],[{"start":{"row":87,"column":4},"end":{"row":87,"column":5},"action":"remove","lines":["d"],"id":81}],[{"start":{"row":87,"column":3},"end":{"row":87,"column":4},"action":"remove","lines":["d"],"id":82}],[{"start":{"row":87,"column":2},"end":{"row":87,"column":3},"action":"remove","lines":["A"],"id":83}],[{"start":{"row":87,"column":2},"end":{"row":87,"column":3},"action":"insert","lines":["U"],"id":84}],[{"start":{"row":87,"column":3},"end":{"row":87,"column":4},"action":"insert","lines":["S"],"id":85}],[{"start":{"row":87,"column":4},"end":{"row":87,"column":5},"action":"insert","lines":["e"],"id":86}],[{"start":{"row":87,"column":5},"end":{"row":87,"column":6},"action":"insert","lines":[" "],"id":87}],[{"start":{"row":87,"column":6},"end":{"row":87,"column":7},"action":"insert","lines":["e"],"id":88}],[{"start":{"row":87,"column":6},"end":{"row":87,"column":7},"action":"remove","lines":["e"],"id":89}],[{"start":{"row":87,"column":5},"end":{"row":87,"column":6},"action":"remove","lines":[" "],"id":90}],[{"start":{"row":87,"column":4},"end":{"row":87,"column":5},"action":"remove","lines":["e"],"id":91}],[{"start":{"row":87,"column":3},"end":{"row":87,"column":4},"action":"remove","lines":["S"],"id":92}],[{"start":{"row":87,"column":3},"end":{"row":87,"column":4},"action":"insert","lines":["s"],"id":93}],[{"start":{"row":87,"column":4},"end":{"row":87,"column":5},"action":"insert","lines":["e"],"id":94}],[{"start":{"row":87,"column":5},"end":{"row":87,"column":6},"action":"insert","lines":[" "],"id":95}],[{"start":{"row":87,"column":6},"end":{"row":87,"column":7},"action":"insert","lines":["e"],"id":96}],[{"start":{"row":87,"column":6},"end":{"row":87,"column":7},"action":"remove","lines":["e"],"id":97}],[{"start":{"row":87,"column":6},"end":{"row":87,"column":7},"action":"insert","lines":["E"],"id":98}],[{"start":{"row":87,"column":7},"end":{"row":87,"column":8},"action":"insert","lines":["x"],"id":99}],[{"start":{"row":87,"column":8},"end":{"row":87,"column":9},"action":"insert","lines":["p"],"id":100}],[{"start":{"row":87,"column":9},"end":{"row":87,"column":10},"action":"insert","lines":["r"],"id":101}],[{"start":{"row":87,"column":10},"end":{"row":87,"column":11},"action":"insert","lines":["e"],"id":102}],[{"start":{"row":87,"column":11},"end":{"row":87,"column":12},"action":"insert","lines":["s"],"id":103}],[{"start":{"row":87,"column":12},"end":{"row":87,"column":13},"action":"insert","lines":["s"],"id":104}],[{"start":{"row":87,"column":13},"end":{"row":87,"column":14},"action":"insert","lines":[" "],"id":105}],[{"start":{"row":87,"column":14},"end":{"row":87,"column":15},"action":"insert","lines":["r"],"id":106}],[{"start":{"row":87,"column":15},"end":{"row":87,"column":16},"action":"insert","lines":["o"],"id":107}],[{"start":{"row":87,"column":16},"end":{"row":87,"column":17},"action":"insert","lines":["u"],"id":108}],[{"start":{"row":87,"column":17},"end":{"row":87,"column":18},"action":"insert","lines":["t"],"id":109}],[{"start":{"row":87,"column":18},"end":{"row":87,"column":19},"action":"insert","lines":["e"],"id":110}],[{"start":{"row":87,"column":19},"end":{"row":87,"column":20},"action":"insert","lines":["r"],"id":111}],[{"start":{"row":87,"column":20},"end":{"row":87,"column":21},"action":"insert","lines":[" "],"id":112}],[{"start":{"row":87,"column":21},"end":{"row":87,"column":22},"action":"insert","lines":["t"],"id":113}],[{"start":{"row":87,"column":22},"end":{"row":87,"column":23},"action":"insert","lines":["o"],"id":114}],[{"start":{"row":87,"column":23},"end":{"row":87,"column":24},"action":"insert","lines":[" "],"id":115}],[{"start":{"row":87,"column":23},"end":{"row":87,"column":24},"action":"remove","lines":[" "],"id":116}],[{"start":{"row":87,"column":23},"end":{"row":87,"column":24},"action":"insert","lines":[" "],"id":117}],[{"start":{"row":87,"column":24},"end":{"row":87,"column":25},"action":"insert","lines":["r"],"id":118}],[{"start":{"row":87,"column":25},"end":{"row":87,"column":26},"action":"insert","lines":["e"],"id":119}],[{"start":{"row":87,"column":26},"end":{"row":87,"column":27},"action":"insert","lines":["f"],"id":120}],[{"start":{"row":87,"column":27},"end":{"row":87,"column":28},"action":"insert","lines":["a"],"id":121}],[{"start":{"row":87,"column":28},"end":{"row":87,"column":29},"action":"insert","lines":["c"],"id":122}],[{"start":{"row":87,"column":29},"end":{"row":87,"column":30},"action":"insert","lines":["t"],"id":123}],[{"start":{"row":87,"column":30},"end":{"row":87,"column":31},"action":"insert","lines":["o"],"id":124}],[{"start":{"row":87,"column":31},"end":{"row":87,"column":32},"action":"insert","lines":["r"],"id":125}],[{"start":{"row":87,"column":32},"end":{"row":87,"column":33},"action":"insert","lines":[" "],"id":126}],[{"start":{"row":87,"column":33},"end":{"row":87,"column":34},"action":"insert","lines":["a"],"id":127}],[{"start":{"row":87,"column":34},"end":{"row":87,"column":35},"action":"insert","lines":["l"],"id":128}],[{"start":{"row":87,"column":35},"end":{"row":87,"column":36},"action":"insert","lines":["l"],"id":129}],[{"start":{"row":87,"column":36},"end":{"row":87,"column":37},"action":"insert","lines":[" "],"id":130}],[{"start":{"row":87,"column":37},"end":{"row":87,"column":38},"action":"insert","lines":["r"],"id":131}],[{"start":{"row":87,"column":38},"end":{"row":87,"column":39},"action":"insert","lines":["o"],"id":132}],[{"start":{"row":87,"column":39},"end":{"row":87,"column":40},"action":"insert","lines":["u"],"id":133}],[{"start":{"row":87,"column":40},"end":{"row":87,"column":41},"action":"insert","lines":["t"],"id":134}],[{"start":{"row":87,"column":41},"end":{"row":87,"column":42},"action":"insert","lines":["e"],"id":135}],[{"start":{"row":87,"column":42},"end":{"row":87,"column":43},"action":"insert","lines":["s"],"id":136}],[{"start":{"row":87,"column":43},"end":{"row":87,"column":44},"action":"insert","lines":[" "],"id":137}],[{"start":{"row":87,"column":43},"end":{"row":87,"column":44},"action":"remove","lines":[" "],"id":138}],[{"start":{"row":87,"column":26},"end":{"row":87,"column":31},"action":"remove","lines":["facto"],"id":139}],[{"start":{"row":87,"column":26},"end":{"row":87,"column":27},"action":"insert","lines":["o"],"id":140}],[{"start":{"row":87,"column":27},"end":{"row":87,"column":28},"action":"insert","lines":["r"],"id":141}],[{"start":{"row":87,"column":28},"end":{"row":87,"column":29},"action":"insert","lines":["a"],"id":142}],[{"start":{"row":87,"column":29},"end":{"row":87,"column":30},"action":"insert","lines":["g"],"id":143}],[{"start":{"row":87,"column":30},"end":{"row":87,"column":31},"action":"insert","lines":["n"],"id":144}],[{"start":{"row":87,"column":31},"end":{"row":87,"column":32},"action":"insert","lines":["i"],"id":145}],[{"start":{"row":87,"column":32},"end":{"row":87,"column":33},"action":"insert","lines":["z"],"id":146}],[{"start":{"row":87,"column":33},"end":{"row":87,"column":34},"action":"insert","lines":["e"],"id":147}],[{"start":{"row":87,"column":34},"end":{"row":87,"column":35},"action":"remove","lines":["r"],"id":148}]]},"ace":{"folds":[],"scrolltop":2152,"scrollleft":0,"selection":{"start":{"row":90,"column":0},"end":{"row":90,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":81,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445482158000,"hash":"7d21111743728ce1debd8267f7119235fe601079"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v7/routes/campgrounds.js b/.c9/metadata/workspace/YelpCamp/v7/routes/campgrounds.js deleted file mode 100644 index bed12e47..00000000 --- a/.c9/metadata/workspace/YelpCamp/v7/routes/campgrounds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campgrounds.js","tooltip":"/YelpCamp/v7/routes/campgrounds.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":34,"column":0},"end":{"row":34,"column":3},"action":"remove","lines":["app"],"id":120},{"start":{"row":34,"column":0},"end":{"row":34,"column":6},"action":"insert","lines":["router"]}],[{"start":{"row":39,"column":0},"end":{"row":39,"column":3},"action":"remove","lines":["app"],"id":121},{"start":{"row":39,"column":0},"end":{"row":39,"column":6},"action":"insert","lines":["router"]}],[{"start":{"row":50,"column":3},"end":{"row":51,"column":0},"action":"insert","lines":["",""],"id":122}],[{"start":{"row":51,"column":0},"end":{"row":52,"column":0},"action":"insert","lines":["",""],"id":123}],[{"start":{"row":52,"column":0},"end":{"row":52,"column":1},"action":"insert","lines":["m"],"id":124}],[{"start":{"row":52,"column":1},"end":{"row":52,"column":2},"action":"insert","lines":["o"],"id":125}],[{"start":{"row":52,"column":2},"end":{"row":52,"column":3},"action":"insert","lines":["d"],"id":126}],[{"start":{"row":52,"column":3},"end":{"row":52,"column":4},"action":"insert","lines":["u"],"id":127}],[{"start":{"row":52,"column":4},"end":{"row":52,"column":5},"action":"insert","lines":["l"],"id":128}],[{"start":{"row":52,"column":5},"end":{"row":52,"column":6},"action":"insert","lines":["e"],"id":129}],[{"start":{"row":52,"column":6},"end":{"row":52,"column":7},"action":"insert","lines":[" "],"id":130}],[{"start":{"row":52,"column":6},"end":{"row":52,"column":7},"action":"remove","lines":[" "],"id":131}],[{"start":{"row":52,"column":6},"end":{"row":52,"column":7},"action":"insert","lines":["."],"id":132}],[{"start":{"row":52,"column":7},"end":{"row":52,"column":8},"action":"insert","lines":["e"],"id":133}],[{"start":{"row":52,"column":8},"end":{"row":52,"column":9},"action":"insert","lines":["x"],"id":134}],[{"start":{"row":52,"column":9},"end":{"row":52,"column":10},"action":"insert","lines":["p"],"id":135}],[{"start":{"row":52,"column":10},"end":{"row":52,"column":11},"action":"insert","lines":["o"],"id":136}],[{"start":{"row":52,"column":11},"end":{"row":52,"column":12},"action":"insert","lines":["r"],"id":137}],[{"start":{"row":52,"column":12},"end":{"row":52,"column":13},"action":"insert","lines":["t"],"id":138}],[{"start":{"row":52,"column":13},"end":{"row":52,"column":14},"action":"insert","lines":["s"],"id":139}],[{"start":{"row":52,"column":14},"end":{"row":52,"column":15},"action":"insert","lines":[" "],"id":140}],[{"start":{"row":52,"column":14},"end":{"row":52,"column":15},"action":"remove","lines":[" "],"id":141}],[{"start":{"row":52,"column":14},"end":{"row":52,"column":15},"action":"insert","lines":[" "],"id":142}],[{"start":{"row":52,"column":15},"end":{"row":52,"column":16},"action":"insert","lines":["="],"id":143}],[{"start":{"row":52,"column":16},"end":{"row":52,"column":17},"action":"insert","lines":[" "],"id":144}],[{"start":{"row":52,"column":17},"end":{"row":52,"column":18},"action":"insert","lines":["r"],"id":145}],[{"start":{"row":52,"column":18},"end":{"row":52,"column":19},"action":"insert","lines":["o"],"id":146}],[{"start":{"row":52,"column":19},"end":{"row":52,"column":20},"action":"insert","lines":["u"],"id":147}],[{"start":{"row":52,"column":20},"end":{"row":52,"column":21},"action":"insert","lines":["t"],"id":148}],[{"start":{"row":52,"column":21},"end":{"row":52,"column":22},"action":"insert","lines":["e"],"id":149}],[{"start":{"row":52,"column":22},"end":{"row":52,"column":23},"action":"insert","lines":["r"],"id":150}],[{"start":{"row":52,"column":23},"end":{"row":52,"column":24},"action":"insert","lines":[" "],"id":151}],[{"start":{"row":52,"column":23},"end":{"row":52,"column":24},"action":"remove","lines":[" "],"id":152}],[{"start":{"row":52,"column":23},"end":{"row":52,"column":24},"action":"insert","lines":[";"],"id":153}],[{"start":{"row":1,"column":31},"end":{"row":2,"column":0},"action":"insert","lines":["",""],"id":154}],[{"start":{"row":2,"column":0},"end":{"row":2,"column":1},"action":"insert","lines":["v"],"id":155}],[{"start":{"row":2,"column":1},"end":{"row":2,"column":2},"action":"insert","lines":["a"],"id":156}],[{"start":{"row":2,"column":2},"end":{"row":2,"column":3},"action":"insert","lines":["r"],"id":157}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":[" "],"id":158}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"remove","lines":[" "],"id":159}],[{"start":{"row":2,"column":3},"end":{"row":2,"column":4},"action":"insert","lines":[" "],"id":160}],[{"start":{"row":2,"column":4},"end":{"row":2,"column":5},"action":"insert","lines":["C"],"id":161}],[{"start":{"row":2,"column":5},"end":{"row":2,"column":6},"action":"insert","lines":["a"],"id":162}],[{"start":{"row":2,"column":6},"end":{"row":2,"column":7},"action":"insert","lines":["m"],"id":163}],[{"start":{"row":2,"column":7},"end":{"row":2,"column":8},"action":"insert","lines":["p"],"id":164}],[{"start":{"row":2,"column":8},"end":{"row":2,"column":9},"action":"insert","lines":["g"],"id":165}],[{"start":{"row":2,"column":9},"end":{"row":2,"column":10},"action":"insert","lines":["r"],"id":166}],[{"start":{"row":2,"column":10},"end":{"row":2,"column":11},"action":"insert","lines":["o"],"id":167}],[{"start":{"row":2,"column":11},"end":{"row":2,"column":12},"action":"insert","lines":["u"],"id":168}],[{"start":{"row":2,"column":12},"end":{"row":2,"column":13},"action":"insert","lines":["n"],"id":169}],[{"start":{"row":2,"column":13},"end":{"row":2,"column":14},"action":"insert","lines":["d"],"id":170}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":[" "],"id":171}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"remove","lines":[" "],"id":172}],[{"start":{"row":2,"column":14},"end":{"row":2,"column":15},"action":"insert","lines":[" "],"id":173}],[{"start":{"row":2,"column":15},"end":{"row":2,"column":16},"action":"insert","lines":["="],"id":174}],[{"start":{"row":2,"column":16},"end":{"row":2,"column":17},"action":"insert","lines":[" "],"id":175}],[{"start":{"row":2,"column":17},"end":{"row":2,"column":18},"action":"insert","lines":["r"],"id":176}],[{"start":{"row":2,"column":18},"end":{"row":2,"column":19},"action":"insert","lines":["e"],"id":177}],[{"start":{"row":2,"column":19},"end":{"row":2,"column":20},"action":"insert","lines":["q"],"id":178}],[{"start":{"row":2,"column":20},"end":{"row":2,"column":21},"action":"insert","lines":["u"],"id":179}],[{"start":{"row":2,"column":21},"end":{"row":2,"column":22},"action":"insert","lines":["i"],"id":180}],[{"start":{"row":2,"column":22},"end":{"row":2,"column":23},"action":"insert","lines":["r"],"id":181}],[{"start":{"row":2,"column":23},"end":{"row":2,"column":24},"action":"insert","lines":["e"],"id":182}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"insert","lines":[" "],"id":183}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":25},"action":"remove","lines":[" "],"id":184}],[{"start":{"row":2,"column":24},"end":{"row":2,"column":26},"action":"insert","lines":["()"],"id":185}],[{"start":{"row":2,"column":25},"end":{"row":2,"column":27},"action":"insert","lines":["\"\""],"id":186}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":["{"],"id":187}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"remove","lines":["{"],"id":188}],[{"start":{"row":2,"column":26},"end":{"row":2,"column":27},"action":"insert","lines":["."],"id":189}],[{"start":{"row":2,"column":27},"end":{"row":2,"column":28},"action":"insert","lines":["."],"id":190}],[{"start":{"row":2,"column":28},"end":{"row":2,"column":29},"action":"insert","lines":["/"],"id":191}],[{"start":{"row":2,"column":29},"end":{"row":2,"column":30},"action":"insert","lines":["m"],"id":192}],[{"start":{"row":2,"column":30},"end":{"row":2,"column":31},"action":"insert","lines":["o"],"id":193}],[{"start":{"row":2,"column":31},"end":{"row":2,"column":32},"action":"insert","lines":["d"],"id":194}],[{"start":{"row":2,"column":32},"end":{"row":2,"column":33},"action":"insert","lines":["e"],"id":195}],[{"start":{"row":2,"column":33},"end":{"row":2,"column":34},"action":"insert","lines":["l"],"id":196}],[{"start":{"row":2,"column":34},"end":{"row":2,"column":35},"action":"insert","lines":["s"],"id":197}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"insert","lines":[" "],"id":198}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"remove","lines":[" "],"id":199}],[{"start":{"row":2,"column":35},"end":{"row":2,"column":36},"action":"insert","lines":["/"],"id":200}],[{"start":{"row":2,"column":36},"end":{"row":2,"column":37},"action":"insert","lines":["c"],"id":201}],[{"start":{"row":2,"column":37},"end":{"row":2,"column":38},"action":"insert","lines":["a"],"id":202}],[{"start":{"row":2,"column":38},"end":{"row":2,"column":39},"action":"insert","lines":["m"],"id":203}],[{"start":{"row":2,"column":39},"end":{"row":2,"column":40},"action":"insert","lines":["p"],"id":204}],[{"start":{"row":2,"column":40},"end":{"row":2,"column":41},"action":"insert","lines":["g"],"id":205}],[{"start":{"row":2,"column":41},"end":{"row":2,"column":42},"action":"insert","lines":["r"],"id":206}],[{"start":{"row":2,"column":42},"end":{"row":2,"column":43},"action":"insert","lines":["o"],"id":207}],[{"start":{"row":2,"column":43},"end":{"row":2,"column":44},"action":"insert","lines":["u"],"id":208}],[{"start":{"row":2,"column":44},"end":{"row":2,"column":45},"action":"insert","lines":["n"],"id":209}],[{"start":{"row":2,"column":45},"end":{"row":2,"column":46},"action":"insert","lines":["d"],"id":210}],[{"start":{"row":2,"column":46},"end":{"row":2,"column":47},"action":"insert","lines":[" "],"id":211}],[{"start":{"row":2,"column":46},"end":{"row":2,"column":47},"action":"remove","lines":[" "],"id":212}],[{"start":{"row":2,"column":48},"end":{"row":2,"column":49},"action":"insert","lines":[";"],"id":213}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":24},"action":"remove","lines":["ampgrounds"],"id":214}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"remove","lines":["c"],"id":215}],[{"start":{"row":17,"column":15},"end":{"row":17,"column":25},"action":"remove","lines":["ampgrounds"],"id":216}],[{"start":{"row":17,"column":14},"end":{"row":17,"column":15},"action":"remove","lines":["c"],"id":217}],[{"start":{"row":35,"column":13},"end":{"row":35,"column":25},"action":"remove","lines":["campgrounds/"],"id":218}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":25},"action":"remove","lines":["/campgrounds/"],"id":219}],[{"start":{"row":40,"column":12},"end":{"row":40,"column":13},"action":"insert","lines":["/"],"id":220}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":45,"column":16},"end":{"row":45,"column":16},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445483581000,"hash":"c5a66b695585bd5ee3a63deb59c440d25980a6ef"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v7/routes/comments.js b/.c9/metadata/workspace/YelpCamp/v7/routes/comments.js deleted file mode 100644 index d44d1ae5..00000000 --- a/.c9/metadata/workspace/YelpCamp/v7/routes/comments.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comments.js","tooltip":"/YelpCamp/v7/routes/comments.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":["p"],"id":159}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"insert","lines":["a"],"id":160}],[{"start":{"row":10,"column":22},"end":{"row":10,"column":23},"action":"insert","lines":["r"],"id":161}],[{"start":{"row":10,"column":23},"end":{"row":10,"column":24},"action":"insert","lines":["a"],"id":162}],[{"start":{"row":10,"column":24},"end":{"row":10,"column":25},"action":"insert","lines":["m"],"id":163}],[{"start":{"row":10,"column":25},"end":{"row":10,"column":26},"action":"insert","lines":["s"],"id":164}],[{"start":{"row":10,"column":26},"end":{"row":10,"column":27},"action":"insert","lines":[" "],"id":165}],[{"start":{"row":10,"column":26},"end":{"row":10,"column":27},"action":"remove","lines":[" "],"id":166}],[{"start":{"row":10,"column":26},"end":{"row":10,"column":27},"action":"insert","lines":["."],"id":167}],[{"start":{"row":10,"column":27},"end":{"row":10,"column":28},"action":"insert","lines":["i"],"id":168}],[{"start":{"row":10,"column":28},"end":{"row":10,"column":29},"action":"insert","lines":["d"],"id":169}],[{"start":{"row":10,"column":29},"end":{"row":10,"column":30},"action":"insert","lines":[" "],"id":170}],[{"start":{"row":10,"column":29},"end":{"row":10,"column":30},"action":"remove","lines":[" "],"id":171}],[{"start":{"row":10,"column":30},"end":{"row":10,"column":31},"action":"insert","lines":[";"],"id":172}],[{"start":{"row":1,"column":29},"end":{"row":1,"column":31},"action":"insert","lines":["{}"],"id":173}],[{"start":{"row":1,"column":30},"end":{"row":1,"column":31},"action":"insert","lines":["m"],"id":174}],[{"start":{"row":1,"column":31},"end":{"row":1,"column":32},"action":"insert","lines":["e"],"id":175}],[{"start":{"row":1,"column":32},"end":{"row":1,"column":33},"action":"insert","lines":["r"],"id":176}],[{"start":{"row":1,"column":33},"end":{"row":1,"column":34},"action":"insert","lines":["g"],"id":177}],[{"start":{"row":1,"column":34},"end":{"row":1,"column":35},"action":"insert","lines":["e"],"id":178}],[{"start":{"row":1,"column":35},"end":{"row":1,"column":36},"action":"insert","lines":["P"],"id":179}],[{"start":{"row":1,"column":36},"end":{"row":1,"column":37},"action":"insert","lines":["a"],"id":180}],[{"start":{"row":1,"column":37},"end":{"row":1,"column":38},"action":"insert","lines":["r"],"id":181}],[{"start":{"row":1,"column":38},"end":{"row":1,"column":39},"action":"insert","lines":["a"],"id":182}],[{"start":{"row":1,"column":39},"end":{"row":1,"column":40},"action":"insert","lines":["m"],"id":183}],[{"start":{"row":1,"column":40},"end":{"row":1,"column":41},"action":"insert","lines":["s"],"id":184}],[{"start":{"row":1,"column":41},"end":{"row":1,"column":42},"action":"insert","lines":[" "],"id":185}],[{"start":{"row":1,"column":41},"end":{"row":1,"column":42},"action":"remove","lines":[" "],"id":186}],[{"start":{"row":1,"column":41},"end":{"row":1,"column":42},"action":"insert","lines":[":"],"id":187}],[{"start":{"row":1,"column":42},"end":{"row":1,"column":43},"action":"insert","lines":[" "],"id":188}],[{"start":{"row":1,"column":43},"end":{"row":1,"column":44},"action":"insert","lines":["t"],"id":189}],[{"start":{"row":1,"column":44},"end":{"row":1,"column":45},"action":"insert","lines":["r"],"id":190}],[{"start":{"row":1,"column":45},"end":{"row":1,"column":46},"action":"insert","lines":["u"],"id":191}],[{"start":{"row":1,"column":46},"end":{"row":1,"column":47},"action":"insert","lines":["e"],"id":192}],[{"start":{"row":1,"column":47},"end":{"row":1,"column":48},"action":"insert","lines":[" "],"id":193}],[{"start":{"row":1,"column":47},"end":{"row":1,"column":48},"action":"remove","lines":[" "],"id":194}],[{"start":{"row":4,"column":0},"end":{"row":7,"column":0},"action":"remove","lines":["// ====================","// COMMENTS ROUTES","// ====================",""],"id":195}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":196}],[{"start":{"row":2,"column":48},"end":{"row":2,"column":49},"action":"insert","lines":[";"],"id":197}],[{"start":{"row":3,"column":42},"end":{"row":3,"column":43},"action":"insert","lines":[";"],"id":198}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":1},"action":"insert","lines":["/"],"id":199}],[{"start":{"row":5,"column":1},"end":{"row":5,"column":2},"action":"insert","lines":["/"],"id":200}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["c"],"id":201}],[{"start":{"row":5,"column":3},"end":{"row":5,"column":4},"action":"insert","lines":["o"],"id":202}],[{"start":{"row":5,"column":3},"end":{"row":5,"column":4},"action":"remove","lines":["o"],"id":203}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"remove","lines":["c"],"id":204}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["c"],"id":205}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"remove","lines":["c"],"id":206}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["C"],"id":207}],[{"start":{"row":5,"column":3},"end":{"row":5,"column":4},"action":"insert","lines":["o"],"id":208}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["m"],"id":209}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["m"],"id":210}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":["e"],"id":211}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["n"],"id":212}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["t"],"id":213}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["s"],"id":214}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":[" "],"id":215}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":["N"],"id":216}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":["e"],"id":217}],[{"start":{"row":5,"column":13},"end":{"row":5,"column":14},"action":"insert","lines":["w"],"id":218}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"insert","lines":[" "],"id":219}],[{"start":{"row":5,"column":14},"end":{"row":5,"column":15},"action":"remove","lines":[" "],"id":220}],[{"start":{"row":17,"column":0},"end":{"row":18,"column":0},"action":"insert","lines":["",""],"id":221}],[{"start":{"row":18,"column":0},"end":{"row":18,"column":1},"action":"insert","lines":["/"],"id":222}],[{"start":{"row":18,"column":1},"end":{"row":18,"column":2},"action":"insert","lines":["/"],"id":223}],[{"start":{"row":18,"column":2},"end":{"row":18,"column":3},"action":"insert","lines":["C"],"id":224}],[{"start":{"row":18,"column":3},"end":{"row":18,"column":4},"action":"insert","lines":["o"],"id":225}],[{"start":{"row":18,"column":4},"end":{"row":18,"column":5},"action":"insert","lines":["m"],"id":226}],[{"start":{"row":18,"column":5},"end":{"row":18,"column":6},"action":"insert","lines":["m"],"id":227}],[{"start":{"row":18,"column":6},"end":{"row":18,"column":7},"action":"insert","lines":["e"],"id":228}],[{"start":{"row":18,"column":7},"end":{"row":18,"column":8},"action":"insert","lines":["n"],"id":229}],[{"start":{"row":18,"column":8},"end":{"row":18,"column":9},"action":"insert","lines":["t"],"id":230}],[{"start":{"row":18,"column":9},"end":{"row":18,"column":10},"action":"insert","lines":["s"],"id":231}],[{"start":{"row":18,"column":10},"end":{"row":18,"column":11},"action":"insert","lines":[" "],"id":232}],[{"start":{"row":18,"column":11},"end":{"row":18,"column":12},"action":"insert","lines":["C"],"id":233}],[{"start":{"row":18,"column":12},"end":{"row":18,"column":13},"action":"insert","lines":["r"],"id":234}],[{"start":{"row":18,"column":13},"end":{"row":18,"column":14},"action":"insert","lines":["e"],"id":235}],[{"start":{"row":18,"column":14},"end":{"row":18,"column":15},"action":"insert","lines":["a"],"id":236}],[{"start":{"row":18,"column":15},"end":{"row":18,"column":16},"action":"insert","lines":["t"],"id":237}],[{"start":{"row":18,"column":16},"end":{"row":18,"column":17},"action":"insert","lines":["e"],"id":238}],[{"start":{"row":18,"column":17},"end":{"row":18,"column":18},"action":"insert","lines":[" "],"id":239}],[{"start":{"row":18,"column":17},"end":{"row":18,"column":18},"action":"remove","lines":[" "],"id":240}],[{"start":{"row":37,"column":0},"end":{"row":39,"column":34},"action":"remove","lines":[" //create new comment"," //connect new comment to campground"," //redirect campground show page"],"id":241}],[{"start":{"row":36,"column":6},"end":{"row":37,"column":0},"action":"remove","lines":["",""],"id":242}],[{"start":{"row":38,"column":0},"end":{"row":39,"column":0},"action":"insert","lines":["",""],"id":243}],[{"start":{"row":39,"column":0},"end":{"row":39,"column":1},"action":"insert","lines":["/"],"id":244}],[{"start":{"row":39,"column":1},"end":{"row":39,"column":2},"action":"insert","lines":["/"],"id":245}],[{"start":{"row":39,"column":2},"end":{"row":39,"column":3},"action":"insert","lines":["m"],"id":246}],[{"start":{"row":39,"column":3},"end":{"row":39,"column":4},"action":"insert","lines":["i"],"id":247}],[{"start":{"row":39,"column":4},"end":{"row":39,"column":5},"action":"insert","lines":["d"],"id":248}],[{"start":{"row":39,"column":5},"end":{"row":39,"column":6},"action":"insert","lines":["d"],"id":249}],[{"start":{"row":39,"column":6},"end":{"row":39,"column":7},"action":"insert","lines":["l"],"id":250}],[{"start":{"row":39,"column":7},"end":{"row":39,"column":8},"action":"insert","lines":["e"],"id":251}],[{"start":{"row":39,"column":8},"end":{"row":39,"column":9},"action":"insert","lines":["a"],"id":252}],[{"start":{"row":39,"column":8},"end":{"row":39,"column":9},"action":"remove","lines":["a"],"id":253}],[{"start":{"row":39,"column":8},"end":{"row":39,"column":9},"action":"insert","lines":["w"],"id":254}],[{"start":{"row":39,"column":9},"end":{"row":39,"column":10},"action":"insert","lines":["a"],"id":255}],[{"start":{"row":39,"column":10},"end":{"row":39,"column":11},"action":"insert","lines":["r"],"id":256}],[{"start":{"row":39,"column":11},"end":{"row":39,"column":12},"action":"insert","lines":["e"],"id":257}],[{"start":{"row":39,"column":12},"end":{"row":39,"column":13},"action":"insert","lines":[" "],"id":258}],[{"start":{"row":39,"column":12},"end":{"row":39,"column":13},"action":"remove","lines":[" "],"id":259}]]},"ace":{"folds":[],"scrolltop":1059.5,"scrollleft":0,"selection":{"start":{"row":48,"column":14},"end":{"row":48,"column":14},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":39,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445484056107,"hash":"c411b3d3b98b215ab954f5629d186b624cf8f4d0"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v7/routes/index.js b/.c9/metadata/workspace/YelpCamp/v7/routes/index.js deleted file mode 100644 index 27bddd19..00000000 --- a/.c9/metadata/workspace/YelpCamp/v7/routes/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/YelpCamp/v7/routes/index.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"remove","lines":["u"],"id":86}],[{"start":{"row":3,"column":13},"end":{"row":3,"column":14},"action":"insert","lines":["q"],"id":87}],[{"start":{"row":3,"column":14},"end":{"row":3,"column":15},"action":"insert","lines":["u"],"id":88}],[{"start":{"row":3,"column":15},"end":{"row":3,"column":16},"action":"insert","lines":["i"],"id":89}],[{"start":{"row":3,"column":16},"end":{"row":3,"column":17},"action":"insert","lines":["r"],"id":90}],[{"start":{"row":3,"column":17},"end":{"row":3,"column":18},"action":"insert","lines":["e"],"id":91}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"insert","lines":[" "],"id":92}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":19},"action":"remove","lines":[" "],"id":93}],[{"start":{"row":3,"column":18},"end":{"row":3,"column":20},"action":"insert","lines":["()"],"id":94}],[{"start":{"row":3,"column":19},"end":{"row":3,"column":21},"action":"insert","lines":["\"\""],"id":95}],[{"start":{"row":3,"column":20},"end":{"row":3,"column":21},"action":"insert","lines":["."],"id":96}],[{"start":{"row":3,"column":21},"end":{"row":3,"column":22},"action":"insert","lines":["."],"id":97}],[{"start":{"row":3,"column":22},"end":{"row":3,"column":23},"action":"insert","lines":["/"],"id":98}],[{"start":{"row":3,"column":23},"end":{"row":3,"column":24},"action":"insert","lines":["m"],"id":99}],[{"start":{"row":3,"column":24},"end":{"row":3,"column":25},"action":"insert","lines":["o"],"id":100}],[{"start":{"row":3,"column":25},"end":{"row":3,"column":26},"action":"insert","lines":["d"],"id":101}],[{"start":{"row":3,"column":26},"end":{"row":3,"column":27},"action":"insert","lines":["e"],"id":102}],[{"start":{"row":3,"column":27},"end":{"row":3,"column":28},"action":"insert","lines":["l"],"id":103}],[{"start":{"row":3,"column":28},"end":{"row":3,"column":29},"action":"insert","lines":["s"],"id":104}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":[" "],"id":105}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"remove","lines":[" "],"id":106}],[{"start":{"row":3,"column":29},"end":{"row":3,"column":30},"action":"insert","lines":["/"],"id":107}],[{"start":{"row":3,"column":30},"end":{"row":3,"column":31},"action":"insert","lines":["u"],"id":108}],[{"start":{"row":3,"column":31},"end":{"row":3,"column":32},"action":"insert","lines":["s"],"id":109}],[{"start":{"row":3,"column":32},"end":{"row":3,"column":33},"action":"insert","lines":["e"],"id":110}],[{"start":{"row":3,"column":33},"end":{"row":3,"column":34},"action":"insert","lines":["r"],"id":111}],[{"start":{"row":3,"column":34},"end":{"row":3,"column":35},"action":"insert","lines":[" "],"id":112}],[{"start":{"row":3,"column":34},"end":{"row":3,"column":35},"action":"remove","lines":[" "],"id":113}],[{"start":{"row":3,"column":36},"end":{"row":3,"column":37},"action":"insert","lines":[";"],"id":114}],[{"start":{"row":51,"column":0},"end":{"row":52,"column":0},"action":"insert","lines":["",""],"id":115}],[{"start":{"row":52,"column":0},"end":{"row":52,"column":1},"action":"insert","lines":["m"],"id":116}],[{"start":{"row":52,"column":1},"end":{"row":52,"column":2},"action":"insert","lines":["o"],"id":117}],[{"start":{"row":52,"column":2},"end":{"row":52,"column":3},"action":"insert","lines":["d"],"id":118}],[{"start":{"row":52,"column":3},"end":{"row":52,"column":4},"action":"insert","lines":["u"],"id":119}],[{"start":{"row":52,"column":4},"end":{"row":52,"column":5},"action":"insert","lines":["l"],"id":120}],[{"start":{"row":52,"column":5},"end":{"row":52,"column":6},"action":"insert","lines":["e"],"id":121}],[{"start":{"row":52,"column":6},"end":{"row":52,"column":7},"action":"insert","lines":[" "],"id":122}],[{"start":{"row":52,"column":6},"end":{"row":52,"column":7},"action":"remove","lines":[" "],"id":123}],[{"start":{"row":52,"column":6},"end":{"row":52,"column":7},"action":"insert","lines":["."],"id":124}],[{"start":{"row":52,"column":7},"end":{"row":52,"column":8},"action":"insert","lines":["e"],"id":125}],[{"start":{"row":52,"column":8},"end":{"row":52,"column":9},"action":"insert","lines":["x"],"id":126}],[{"start":{"row":52,"column":9},"end":{"row":52,"column":10},"action":"insert","lines":["p"],"id":127}],[{"start":{"row":52,"column":10},"end":{"row":52,"column":11},"action":"insert","lines":["o"],"id":128}],[{"start":{"row":52,"column":11},"end":{"row":52,"column":12},"action":"insert","lines":["r"],"id":129}],[{"start":{"row":52,"column":12},"end":{"row":52,"column":13},"action":"insert","lines":["t"],"id":130}],[{"start":{"row":52,"column":13},"end":{"row":52,"column":14},"action":"insert","lines":["s"],"id":131}],[{"start":{"row":52,"column":14},"end":{"row":52,"column":15},"action":"insert","lines":[" "],"id":132}],[{"start":{"row":52,"column":14},"end":{"row":52,"column":15},"action":"remove","lines":[" "],"id":133}],[{"start":{"row":52,"column":14},"end":{"row":52,"column":15},"action":"insert","lines":[" "],"id":134}],[{"start":{"row":52,"column":15},"end":{"row":52,"column":16},"action":"insert","lines":["="],"id":135}],[{"start":{"row":52,"column":16},"end":{"row":52,"column":17},"action":"insert","lines":[" "],"id":136}],[{"start":{"row":52,"column":17},"end":{"row":52,"column":18},"action":"insert","lines":["r"],"id":137}],[{"start":{"row":52,"column":18},"end":{"row":52,"column":19},"action":"insert","lines":["o"],"id":138}],[{"start":{"row":52,"column":19},"end":{"row":52,"column":20},"action":"insert","lines":["u"],"id":139}],[{"start":{"row":52,"column":20},"end":{"row":52,"column":21},"action":"insert","lines":["t"],"id":140}],[{"start":{"row":52,"column":21},"end":{"row":52,"column":22},"action":"insert","lines":["e"],"id":141}],[{"start":{"row":52,"column":22},"end":{"row":52,"column":23},"action":"insert","lines":["r"],"id":142}],[{"start":{"row":52,"column":23},"end":{"row":52,"column":24},"action":"insert","lines":[" "],"id":143}],[{"start":{"row":52,"column":23},"end":{"row":52,"column":24},"action":"remove","lines":[" "],"id":144}],[{"start":{"row":52,"column":23},"end":{"row":52,"column":24},"action":"insert","lines":[";"],"id":145}],[{"start":{"row":4,"column":0},"end":{"row":5,"column":0},"action":"insert","lines":["",""],"id":146}],[{"start":{"row":5,"column":0},"end":{"row":5,"column":1},"action":"insert","lines":["/"],"id":147}],[{"start":{"row":5,"column":1},"end":{"row":5,"column":2},"action":"insert","lines":["/"],"id":148}],[{"start":{"row":5,"column":2},"end":{"row":5,"column":3},"action":"insert","lines":["r"],"id":149}],[{"start":{"row":5,"column":3},"end":{"row":5,"column":4},"action":"insert","lines":["o"],"id":150}],[{"start":{"row":5,"column":4},"end":{"row":5,"column":5},"action":"insert","lines":["o"],"id":151}],[{"start":{"row":5,"column":5},"end":{"row":5,"column":6},"action":"insert","lines":["t"],"id":152}],[{"start":{"row":5,"column":6},"end":{"row":5,"column":7},"action":"insert","lines":[" "],"id":153}],[{"start":{"row":5,"column":7},"end":{"row":5,"column":8},"action":"insert","lines":["r"],"id":154}],[{"start":{"row":5,"column":8},"end":{"row":5,"column":9},"action":"insert","lines":["o"],"id":155}],[{"start":{"row":5,"column":9},"end":{"row":5,"column":10},"action":"insert","lines":["u"],"id":156}],[{"start":{"row":5,"column":10},"end":{"row":5,"column":11},"action":"insert","lines":["t"],"id":157}],[{"start":{"row":5,"column":11},"end":{"row":5,"column":12},"action":"insert","lines":["e"],"id":158}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"insert","lines":[" "],"id":159}],[{"start":{"row":5,"column":12},"end":{"row":5,"column":13},"action":"remove","lines":[" "],"id":160}],[{"start":{"row":13,"column":3},"end":{"row":14,"column":0},"action":"insert","lines":["",""],"id":161}],[{"start":{"row":29,"column":2},"end":{"row":29,"column":3},"action":"remove","lines":[" "],"id":162}],[{"start":{"row":33,"column":2},"end":{"row":33,"column":3},"action":"remove","lines":[" "],"id":163}],[{"start":{"row":32,"column":3},"end":{"row":33,"column":0},"action":"insert","lines":["",""],"id":164}],[{"start":{"row":42,"column":7},"end":{"row":42,"column":8},"action":"remove","lines":["c"],"id":165}],[{"start":{"row":42,"column":6},"end":{"row":42,"column":7},"action":"remove","lines":["i"],"id":166}],[{"start":{"row":42,"column":6},"end":{"row":42,"column":7},"action":"insert","lines":["o"],"id":167}],[{"start":{"row":42,"column":7},"end":{"row":42,"column":8},"action":"insert","lines":["u"],"id":168}],[{"start":{"row":42,"column":8},"end":{"row":42,"column":9},"action":"insert","lines":["t"],"id":169}],[{"start":{"row":42,"column":9},"end":{"row":42,"column":10},"action":"insert","lines":[" "],"id":170}],[{"start":{"row":42,"column":9},"end":{"row":42,"column":10},"action":"remove","lines":[" "],"id":171}],[{"start":{"row":47,"column":0},"end":{"row":48,"column":0},"action":"insert","lines":["",""],"id":172}],[{"start":{"row":48,"column":0},"end":{"row":48,"column":1},"action":"insert","lines":["/"],"id":173}],[{"start":{"row":48,"column":1},"end":{"row":48,"column":2},"action":"insert","lines":["/"],"id":174}],[{"start":{"row":48,"column":2},"end":{"row":48,"column":3},"action":"insert","lines":["m"],"id":175}],[{"start":{"row":48,"column":3},"end":{"row":48,"column":4},"action":"insert","lines":["i"],"id":176}],[{"start":{"row":48,"column":4},"end":{"row":48,"column":5},"action":"insert","lines":["d"],"id":177}],[{"start":{"row":48,"column":5},"end":{"row":48,"column":6},"action":"insert","lines":["d"],"id":178}],[{"start":{"row":48,"column":6},"end":{"row":48,"column":7},"action":"insert","lines":["l"],"id":179}],[{"start":{"row":48,"column":7},"end":{"row":48,"column":8},"action":"insert","lines":["e"],"id":180}],[{"start":{"row":48,"column":8},"end":{"row":48,"column":9},"action":"insert","lines":["w"],"id":181}],[{"start":{"row":48,"column":9},"end":{"row":48,"column":10},"action":"insert","lines":["a"],"id":182}],[{"start":{"row":48,"column":10},"end":{"row":48,"column":11},"action":"insert","lines":["r"],"id":183}],[{"start":{"row":48,"column":11},"end":{"row":48,"column":12},"action":"insert","lines":["e"],"id":184}],[{"start":{"row":48,"column":12},"end":{"row":48,"column":13},"action":"insert","lines":[" "],"id":185}],[{"start":{"row":48,"column":12},"end":{"row":48,"column":13},"action":"remove","lines":[" "],"id":186}]]},"ace":{"folds":[],"scrolltop":1105.5,"scrollleft":0,"selection":{"start":{"row":48,"column":12},"end":{"row":48,"column":12},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":79,"mode":"ace/mode/javascript"}},"timestamp":1445484091431,"hash":"22fb40e7a58175afbaa4062a39b7034914125ed7"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/app.js b/.c9/metadata/workspace/YelpCamp/v8/app.js deleted file mode 100644 index b8aefcec..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v8/app.js","undoManager":{"mark":36,"position":36,"stack":[[{"start":{"row":20,"column":0},"end":{"row":20,"column":3},"action":"insert","lines":["// "],"id":4}],[{"start":{"row":19,"column":47},"end":{"row":20,"column":0},"action":"insert","lines":["",""],"id":5}],[{"start":{"row":20,"column":0},"end":{"row":20,"column":1},"action":"insert","lines":["/"],"id":6}],[{"start":{"row":20,"column":1},"end":{"row":20,"column":2},"action":"insert","lines":["/"],"id":7}],[{"start":{"row":20,"column":2},"end":{"row":20,"column":3},"action":"insert","lines":["s"],"id":8}],[{"start":{"row":20,"column":3},"end":{"row":20,"column":4},"action":"insert","lines":["e"],"id":9}],[{"start":{"row":20,"column":4},"end":{"row":20,"column":5},"action":"insert","lines":["e"],"id":10}],[{"start":{"row":20,"column":5},"end":{"row":20,"column":6},"action":"insert","lines":["d"],"id":11}],[{"start":{"row":20,"column":6},"end":{"row":20,"column":7},"action":"insert","lines":[" "],"id":12}],[{"start":{"row":20,"column":7},"end":{"row":20,"column":8},"action":"insert","lines":["D"],"id":13}],[{"start":{"row":20,"column":8},"end":{"row":20,"column":9},"action":"insert","lines":["B"],"id":14}],[{"start":{"row":20,"column":9},"end":{"row":20,"column":10},"action":"insert","lines":[" "],"id":15}],[{"start":{"row":20,"column":9},"end":{"row":20,"column":10},"action":"remove","lines":[" "],"id":16}],[{"start":{"row":20,"column":8},"end":{"row":20,"column":9},"action":"remove","lines":["B"],"id":17}],[{"start":{"row":20,"column":7},"end":{"row":20,"column":8},"action":"remove","lines":["D"],"id":18}],[{"start":{"row":20,"column":7},"end":{"row":20,"column":8},"action":"insert","lines":["t"],"id":19}],[{"start":{"row":20,"column":8},"end":{"row":20,"column":9},"action":"insert","lines":["h"],"id":20}],[{"start":{"row":20,"column":9},"end":{"row":20,"column":10},"action":"insert","lines":["e"],"id":21}],[{"start":{"row":20,"column":10},"end":{"row":20,"column":11},"action":"insert","lines":[" "],"id":22}],[{"start":{"row":20,"column":11},"end":{"row":20,"column":12},"action":"insert","lines":["d"],"id":23}],[{"start":{"row":20,"column":12},"end":{"row":20,"column":13},"action":"insert","lines":["a"],"id":24}],[{"start":{"row":20,"column":13},"end":{"row":20,"column":14},"action":"insert","lines":["t"],"id":25}],[{"start":{"row":20,"column":14},"end":{"row":20,"column":15},"action":"insert","lines":["a"],"id":26}],[{"start":{"row":20,"column":15},"end":{"row":20,"column":16},"action":"insert","lines":["b"],"id":27}],[{"start":{"row":20,"column":16},"end":{"row":20,"column":17},"action":"insert","lines":["s"],"id":28}],[{"start":{"row":20,"column":16},"end":{"row":20,"column":17},"action":"remove","lines":["s"],"id":29}],[{"start":{"row":20,"column":15},"end":{"row":20,"column":16},"action":"remove","lines":["b"],"id":30}],[{"start":{"row":20,"column":15},"end":{"row":20,"column":16},"action":"insert","lines":["b"],"id":31}],[{"start":{"row":20,"column":16},"end":{"row":20,"column":17},"action":"insert","lines":["a"],"id":32}],[{"start":{"row":20,"column":17},"end":{"row":20,"column":18},"action":"insert","lines":["s"],"id":33}],[{"start":{"row":20,"column":18},"end":{"row":20,"column":19},"action":"insert","lines":["e"],"id":34}],[{"start":{"row":20,"column":19},"end":{"row":20,"column":20},"action":"insert","lines":[" "],"id":35}],[{"start":{"row":20,"column":19},"end":{"row":20,"column":20},"action":"remove","lines":[" "],"id":36}],[{"start":{"row":20,"column":0},"end":{"row":20,"column":19},"action":"remove","lines":["//seed the database"],"id":37}],[{"start":{"row":21,"column":12},"end":{"row":21,"column":13},"action":"insert","lines":[" "],"id":38}],[{"start":{"row":21,"column":13},"end":{"row":21,"column":32},"action":"insert","lines":["//seed the database"],"id":39}],[{"start":{"row":19,"column":47},"end":{"row":20,"column":0},"action":"remove","lines":["",""],"id":40}]]},"ace":{"folds":[],"scrolltop":291.5,"scrollleft":0,"selection":{"start":{"row":16,"column":49},"end":{"row":16,"column":49},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":10,"state":"no_regex","mode":"ace/mode/javascript"}},"timestamp":1445492040275,"hash":"781425057c48ca7ac74cef8caa4a51ac999e858d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/models/campground.js b/.c9/metadata/workspace/YelpCamp/v8/models/campground.js deleted file mode 100644 index 18649b3f..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/models/campground.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campground.js","tooltip":"/YelpCamp/v8/models/campground.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":9,"column":23},"end":{"row":9,"column":23},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445491913557,"hash":"196c2df19513dfb487c8eaac4d94294558634649"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/models/comment.js b/.c9/metadata/workspace/YelpCamp/v8/models/comment.js deleted file mode 100644 index 0d3960f8..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/models/comment.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comment.js","tooltip":"/YelpCamp/v8/models/comment.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":6,"column":8},"end":{"row":6,"column":9},"action":"remove","lines":["}"],"id":110}],[{"start":{"row":6,"column":8},"end":{"row":6,"column":12},"action":"insert","lines":[" "],"id":111}],[{"start":{"row":6,"column":12},"end":{"row":6,"column":13},"action":"insert","lines":["t"],"id":112}],[{"start":{"row":6,"column":13},"end":{"row":6,"column":14},"action":"insert","lines":["y"],"id":113}],[{"start":{"row":6,"column":14},"end":{"row":6,"column":15},"action":"insert","lines":["p"],"id":114}],[{"start":{"row":6,"column":15},"end":{"row":6,"column":16},"action":"insert","lines":["e"],"id":115}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"insert","lines":[" "],"id":116}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"remove","lines":[" "],"id":117}],[{"start":{"row":6,"column":16},"end":{"row":6,"column":17},"action":"insert","lines":[":"],"id":118}],[{"start":{"row":6,"column":17},"end":{"row":6,"column":18},"action":"insert","lines":[" "],"id":119}],[{"start":{"row":6,"column":18},"end":{"row":6,"column":19},"action":"insert","lines":["m"],"id":120}],[{"start":{"row":6,"column":19},"end":{"row":6,"column":20},"action":"insert","lines":["o"],"id":121}],[{"start":{"row":6,"column":20},"end":{"row":6,"column":21},"action":"insert","lines":["n"],"id":122}],[{"start":{"row":6,"column":21},"end":{"row":6,"column":22},"action":"insert","lines":["g"],"id":123}],[{"start":{"row":6,"column":22},"end":{"row":6,"column":23},"action":"insert","lines":["o"],"id":124}],[{"start":{"row":6,"column":23},"end":{"row":6,"column":24},"action":"insert","lines":["o"],"id":125}],[{"start":{"row":6,"column":24},"end":{"row":6,"column":25},"action":"insert","lines":["s"],"id":126}],[{"start":{"row":6,"column":25},"end":{"row":6,"column":26},"action":"insert","lines":["e"],"id":127}],[{"start":{"row":6,"column":26},"end":{"row":6,"column":27},"action":"insert","lines":[" "],"id":128}],[{"start":{"row":6,"column":26},"end":{"row":6,"column":27},"action":"remove","lines":[" "],"id":129}],[{"start":{"row":6,"column":26},"end":{"row":6,"column":27},"action":"insert","lines":["."],"id":130}],[{"start":{"row":6,"column":27},"end":{"row":6,"column":28},"action":"insert","lines":["S"],"id":131}],[{"start":{"row":6,"column":28},"end":{"row":6,"column":29},"action":"insert","lines":["c"],"id":132}],[{"start":{"row":6,"column":29},"end":{"row":6,"column":30},"action":"insert","lines":["h"],"id":133}],[{"start":{"row":6,"column":30},"end":{"row":6,"column":31},"action":"insert","lines":["e"],"id":134}],[{"start":{"row":6,"column":31},"end":{"row":6,"column":32},"action":"insert","lines":["m"],"id":135}],[{"start":{"row":6,"column":32},"end":{"row":6,"column":33},"action":"insert","lines":["a"],"id":136}],[{"start":{"row":6,"column":33},"end":{"row":6,"column":34},"action":"insert","lines":[" "],"id":137}],[{"start":{"row":6,"column":33},"end":{"row":6,"column":34},"action":"remove","lines":[" "],"id":138}],[{"start":{"row":6,"column":33},"end":{"row":6,"column":34},"action":"insert","lines":["."],"id":139}],[{"start":{"row":6,"column":34},"end":{"row":6,"column":35},"action":"insert","lines":["T"],"id":140}],[{"start":{"row":6,"column":35},"end":{"row":6,"column":36},"action":"insert","lines":["y"],"id":141}],[{"start":{"row":6,"column":36},"end":{"row":6,"column":37},"action":"insert","lines":["p"],"id":142}],[{"start":{"row":6,"column":37},"end":{"row":6,"column":38},"action":"insert","lines":["e"],"id":143}],[{"start":{"row":6,"column":38},"end":{"row":6,"column":39},"action":"insert","lines":["s"],"id":144}],[{"start":{"row":6,"column":39},"end":{"row":6,"column":40},"action":"insert","lines":[" "],"id":145}],[{"start":{"row":6,"column":39},"end":{"row":6,"column":40},"action":"remove","lines":[" "],"id":146}],[{"start":{"row":6,"column":39},"end":{"row":6,"column":40},"action":"insert","lines":["."],"id":147}],[{"start":{"row":6,"column":40},"end":{"row":6,"column":41},"action":"insert","lines":["O"],"id":148}],[{"start":{"row":6,"column":41},"end":{"row":6,"column":42},"action":"insert","lines":["b"],"id":149}],[{"start":{"row":6,"column":42},"end":{"row":6,"column":43},"action":"insert","lines":["j"],"id":150}],[{"start":{"row":6,"column":43},"end":{"row":6,"column":44},"action":"insert","lines":["e"],"id":151}],[{"start":{"row":6,"column":44},"end":{"row":6,"column":45},"action":"insert","lines":["c"],"id":152}],[{"start":{"row":6,"column":45},"end":{"row":6,"column":46},"action":"insert","lines":["t"],"id":153}],[{"start":{"row":6,"column":46},"end":{"row":6,"column":47},"action":"insert","lines":[" "],"id":154}],[{"start":{"row":6,"column":46},"end":{"row":6,"column":47},"action":"remove","lines":[" "],"id":155}],[{"start":{"row":6,"column":46},"end":{"row":6,"column":47},"action":"insert","lines":["I"],"id":156}],[{"start":{"row":6,"column":47},"end":{"row":6,"column":48},"action":"insert","lines":["d"],"id":157}],[{"start":{"row":6,"column":48},"end":{"row":6,"column":49},"action":"insert","lines":[" "],"id":158}],[{"start":{"row":6,"column":48},"end":{"row":6,"column":49},"action":"remove","lines":[" "],"id":159}],[{"start":{"row":6,"column":48},"end":{"row":6,"column":49},"action":"insert","lines":[","],"id":160}],[{"start":{"row":6,"column":49},"end":{"row":7,"column":0},"action":"insert","lines":["",""],"id":161},{"start":{"row":7,"column":0},"end":{"row":7,"column":12},"action":"insert","lines":[" "]}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":["r"],"id":162}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"insert","lines":["e"],"id":163}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":["d"],"id":164}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":[" "],"id":165}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"remove","lines":[" "],"id":166}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"remove","lines":["d"],"id":167}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":["f"],"id":168}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":["L"],"id":169}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"remove","lines":["L"],"id":170}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":[":"],"id":171}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"remove","lines":[":"],"id":172}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":[":"],"id":173}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"insert","lines":[" "],"id":174}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"remove","lines":[" "],"id":175}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"remove","lines":[":"],"id":176}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"remove","lines":["f"],"id":177}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"remove","lines":["e"],"id":178}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"remove","lines":["r"],"id":179}],[{"start":{"row":7,"column":12},"end":{"row":7,"column":13},"action":"insert","lines":["r"],"id":180}],[{"start":{"row":7,"column":13},"end":{"row":7,"column":14},"action":"insert","lines":["e"],"id":181}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":["d"],"id":182}],[{"start":{"row":7,"column":15},"end":{"row":8,"column":0},"action":"insert","lines":["",""],"id":183},{"start":{"row":8,"column":0},"end":{"row":8,"column":12},"action":"insert","lines":[" "]}],[{"start":{"row":8,"column":8},"end":{"row":8,"column":12},"action":"remove","lines":[" "],"id":184}],[{"start":{"row":8,"column":4},"end":{"row":8,"column":8},"action":"remove","lines":[" "],"id":185}],[{"start":{"row":8,"column":0},"end":{"row":8,"column":4},"action":"remove","lines":[" "],"id":186}],[{"start":{"row":7,"column":15},"end":{"row":8,"column":0},"action":"remove","lines":["",""],"id":187}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":["f"],"id":188}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"remove","lines":["f"],"id":189}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"remove","lines":["d"],"id":190}],[{"start":{"row":7,"column":14},"end":{"row":7,"column":15},"action":"insert","lines":["f"],"id":191}],[{"start":{"row":7,"column":15},"end":{"row":7,"column":16},"action":"insert","lines":[":"],"id":192}],[{"start":{"row":7,"column":16},"end":{"row":7,"column":17},"action":"insert","lines":[" "],"id":193}],[{"start":{"row":7,"column":17},"end":{"row":7,"column":19},"action":"insert","lines":["\"\""],"id":194}],[{"start":{"row":7,"column":18},"end":{"row":7,"column":19},"action":"insert","lines":["U"],"id":195}],[{"start":{"row":7,"column":19},"end":{"row":7,"column":20},"action":"insert","lines":["s"],"id":196}],[{"start":{"row":7,"column":20},"end":{"row":7,"column":21},"action":"insert","lines":["e"],"id":197}],[{"start":{"row":7,"column":21},"end":{"row":7,"column":22},"action":"insert","lines":["r"],"id":198}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"insert","lines":[" "],"id":199}],[{"start":{"row":7,"column":22},"end":{"row":7,"column":23},"action":"remove","lines":[" "],"id":200}],[{"start":{"row":9,"column":17},"end":{"row":9,"column":18},"action":"insert","lines":[" "],"id":201}],[{"start":{"row":9,"column":18},"end":{"row":9,"column":19},"action":"insert","lines":["S"],"id":202}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":20},"action":"insert","lines":["t"],"id":203}],[{"start":{"row":9,"column":20},"end":{"row":9,"column":21},"action":"insert","lines":["r"],"id":204}],[{"start":{"row":9,"column":21},"end":{"row":9,"column":22},"action":"insert","lines":["i"],"id":205}],[{"start":{"row":9,"column":22},"end":{"row":9,"column":23},"action":"insert","lines":["n"],"id":206}],[{"start":{"row":9,"column":23},"end":{"row":9,"column":24},"action":"insert","lines":["g"],"id":207}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"insert","lines":[" "],"id":208}],[{"start":{"row":9,"column":24},"end":{"row":9,"column":25},"action":"remove","lines":[" "],"id":209}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":[","],"id":210}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":11,"column":3},"end":{"row":11,"column":3},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":82,"mode":"ace/mode/javascript"}},"timestamp":1445491948119,"hash":"d5d10fe426a42c2448c441bc121bd9a5ea8a1ab6"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/readme.md b/.c9/metadata/workspace/YelpCamp/v8/readme.md deleted file mode 100644 index 00639789..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v8/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":94,"column":23},"end":{"row":94,"column":24},"action":"insert","lines":["r"],"id":418}],[{"start":{"row":94,"column":24},"end":{"row":94,"column":25},"action":"insert","lines":["e"],"id":419}],[{"start":{"row":94,"column":25},"end":{"row":94,"column":26},"action":"insert","lines":["a"],"id":420}],[{"start":{"row":94,"column":26},"end":{"row":94,"column":27},"action":"insert","lines":["t"],"id":421}],[{"start":{"row":94,"column":27},"end":{"row":94,"column":28},"action":"insert","lines":["i"],"id":422}],[{"start":{"row":94,"column":28},"end":{"row":94,"column":29},"action":"insert","lines":["n"],"id":423}],[{"start":{"row":94,"column":29},"end":{"row":94,"column":30},"action":"insert","lines":["g"],"id":424}],[{"start":{"row":94,"column":30},"end":{"row":94,"column":31},"action":"insert","lines":[" "],"id":425}],[{"start":{"row":94,"column":31},"end":{"row":94,"column":32},"action":"insert","lines":["a"],"id":426}],[{"start":{"row":94,"column":32},"end":{"row":94,"column":33},"action":"insert","lines":[" "],"id":427}],[{"start":{"row":94,"column":33},"end":{"row":94,"column":34},"action":"insert","lines":["c"],"id":428}],[{"start":{"row":94,"column":34},"end":{"row":94,"column":35},"action":"insert","lines":["a"],"id":429}],[{"start":{"row":94,"column":35},"end":{"row":94,"column":36},"action":"insert","lines":["m"],"id":430}],[{"start":{"row":94,"column":36},"end":{"row":94,"column":37},"action":"insert","lines":["p"],"id":431}],[{"start":{"row":94,"column":37},"end":{"row":94,"column":38},"action":"insert","lines":["g"],"id":432}],[{"start":{"row":94,"column":38},"end":{"row":94,"column":39},"action":"insert","lines":["r"],"id":433}],[{"start":{"row":94,"column":39},"end":{"row":94,"column":40},"action":"insert","lines":["o"],"id":434}],[{"start":{"row":94,"column":40},"end":{"row":94,"column":41},"action":"insert","lines":["u"],"id":435}],[{"start":{"row":94,"column":41},"end":{"row":94,"column":42},"action":"insert","lines":["n"],"id":436}],[{"start":{"row":94,"column":42},"end":{"row":94,"column":43},"action":"insert","lines":["d"],"id":437}],[{"start":{"row":94,"column":43},"end":{"row":94,"column":44},"action":"insert","lines":[" "],"id":438}],[{"start":{"row":94,"column":43},"end":{"row":94,"column":44},"action":"remove","lines":[" "],"id":439}],[{"start":{"row":94,"column":43},"end":{"row":94,"column":44},"action":"insert","lines":[" "],"id":440}],[{"start":{"row":94,"column":44},"end":{"row":94,"column":45},"action":"insert","lines":["i"],"id":441}],[{"start":{"row":94,"column":45},"end":{"row":94,"column":46},"action":"insert","lines":["f"],"id":442}],[{"start":{"row":94,"column":46},"end":{"row":94,"column":47},"action":"insert","lines":[" "],"id":443}],[{"start":{"row":94,"column":46},"end":{"row":94,"column":47},"action":"remove","lines":[" "],"id":444}],[{"start":{"row":94,"column":45},"end":{"row":94,"column":46},"action":"remove","lines":["f"],"id":445}],[{"start":{"row":94,"column":44},"end":{"row":94,"column":45},"action":"remove","lines":["i"],"id":446}],[{"start":{"row":94,"column":43},"end":{"row":94,"column":44},"action":"remove","lines":[" "],"id":447}],[{"start":{"row":94,"column":11},"end":{"row":94,"column":12},"action":"remove","lines":[" "],"id":448}],[{"start":{"row":94,"column":11},"end":{"row":94,"column":12},"action":"insert","lines":["n"],"id":449}],[{"start":{"row":94,"column":12},"end":{"row":94,"column":13},"action":"insert","lines":[" "],"id":450}],[{"start":{"row":94,"column":13},"end":{"row":94,"column":14},"action":"insert","lines":["a"],"id":451}],[{"start":{"row":94,"column":13},"end":{"row":94,"column":14},"action":"remove","lines":["a"],"id":452}],[{"start":{"row":94,"column":13},"end":{"row":94,"column":14},"action":"insert","lines":["u"],"id":453}],[{"start":{"row":94,"column":14},"end":{"row":94,"column":15},"action":"insert","lines":["n"],"id":454}],[{"start":{"row":94,"column":15},"end":{"row":94,"column":16},"action":"insert","lines":["a"],"id":455}],[{"start":{"row":94,"column":16},"end":{"row":94,"column":17},"action":"insert","lines":["u"],"id":456}],[{"start":{"row":94,"column":17},"end":{"row":94,"column":18},"action":"insert","lines":["t"],"id":457}],[{"start":{"row":94,"column":18},"end":{"row":94,"column":19},"action":"insert","lines":["h"],"id":458}],[{"start":{"row":94,"column":19},"end":{"row":94,"column":20},"action":"insert","lines":["e"],"id":459}],[{"start":{"row":94,"column":20},"end":{"row":94,"column":21},"action":"insert","lines":["n"],"id":460}],[{"start":{"row":94,"column":21},"end":{"row":94,"column":22},"action":"insert","lines":["t"],"id":461}],[{"start":{"row":94,"column":22},"end":{"row":94,"column":23},"action":"insert","lines":["i"],"id":462}],[{"start":{"row":94,"column":23},"end":{"row":94,"column":24},"action":"insert","lines":["c"],"id":463}],[{"start":{"row":94,"column":24},"end":{"row":94,"column":25},"action":"insert","lines":["a"],"id":464}],[{"start":{"row":94,"column":25},"end":{"row":94,"column":26},"action":"insert","lines":["t"],"id":465}],[{"start":{"row":94,"column":26},"end":{"row":94,"column":27},"action":"insert","lines":["e"],"id":466}],[{"start":{"row":94,"column":27},"end":{"row":94,"column":28},"action":"insert","lines":["d"],"id":467}],[{"start":{"row":94,"column":28},"end":{"row":94,"column":29},"action":"insert","lines":[" "],"id":468}],[{"start":{"row":94,"column":28},"end":{"row":94,"column":29},"action":"remove","lines":[" "],"id":469}],[{"start":{"row":94,"column":28},"end":{"row":94,"column":29},"action":"insert","lines":[" "],"id":470}],[{"start":{"row":94,"column":60},"end":{"row":95,"column":0},"action":"insert","lines":["",""],"id":471},{"start":{"row":95,"column":0},"end":{"row":95,"column":2},"action":"insert","lines":["* "]}],[{"start":{"row":95,"column":2},"end":{"row":95,"column":3},"action":"insert","lines":["A"],"id":472}],[{"start":{"row":95,"column":3},"end":{"row":95,"column":4},"action":"insert","lines":["s"],"id":473}],[{"start":{"row":95,"column":4},"end":{"row":95,"column":5},"action":"insert","lines":["s"],"id":474}],[{"start":{"row":95,"column":5},"end":{"row":95,"column":6},"action":"insert","lines":["o"],"id":475}],[{"start":{"row":95,"column":6},"end":{"row":95,"column":7},"action":"insert","lines":["c"],"id":476}],[{"start":{"row":95,"column":7},"end":{"row":95,"column":8},"action":"insert","lines":["i"],"id":477}],[{"start":{"row":95,"column":8},"end":{"row":95,"column":9},"action":"insert","lines":["a"],"id":478}],[{"start":{"row":95,"column":9},"end":{"row":95,"column":10},"action":"insert","lines":["t"],"id":479}],[{"start":{"row":95,"column":10},"end":{"row":95,"column":11},"action":"insert","lines":["e"],"id":480}],[{"start":{"row":95,"column":11},"end":{"row":95,"column":12},"action":"insert","lines":[" "],"id":481}],[{"start":{"row":95,"column":11},"end":{"row":95,"column":12},"action":"remove","lines":[" "],"id":482}],[{"start":{"row":95,"column":11},"end":{"row":95,"column":12},"action":"insert","lines":[" "],"id":483}],[{"start":{"row":95,"column":12},"end":{"row":95,"column":13},"action":"insert","lines":["U"],"id":484}],[{"start":{"row":95,"column":13},"end":{"row":95,"column":14},"action":"insert","lines":["s"],"id":485}],[{"start":{"row":95,"column":14},"end":{"row":95,"column":15},"action":"insert","lines":["e"],"id":486}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"insert","lines":["r"],"id":487}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"insert","lines":[" "],"id":488}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"remove","lines":[" "],"id":489}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"remove","lines":["r"],"id":490}],[{"start":{"row":95,"column":14},"end":{"row":95,"column":15},"action":"remove","lines":["e"],"id":491}],[{"start":{"row":95,"column":13},"end":{"row":95,"column":14},"action":"remove","lines":["s"],"id":492}],[{"start":{"row":95,"column":12},"end":{"row":95,"column":13},"action":"remove","lines":["U"],"id":493}],[{"start":{"row":95,"column":12},"end":{"row":95,"column":13},"action":"insert","lines":["u"],"id":494}],[{"start":{"row":95,"column":13},"end":{"row":95,"column":14},"action":"insert","lines":["s"],"id":495}],[{"start":{"row":95,"column":14},"end":{"row":95,"column":15},"action":"insert","lines":["e"],"id":496}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"insert","lines":["r"],"id":497}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"insert","lines":[" "],"id":498}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"remove","lines":[" "],"id":499}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"insert","lines":[" "],"id":500}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"insert","lines":["w"],"id":501}],[{"start":{"row":95,"column":18},"end":{"row":95,"column":19},"action":"insert","lines":["i"],"id":502}],[{"start":{"row":95,"column":19},"end":{"row":95,"column":20},"action":"insert","lines":["t"],"id":503}],[{"start":{"row":95,"column":20},"end":{"row":95,"column":21},"action":"insert","lines":["h"],"id":504}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"insert","lines":[" "],"id":505}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"remove","lines":[" "],"id":506}],[{"start":{"row":95,"column":20},"end":{"row":95,"column":21},"action":"remove","lines":["h"],"id":507}],[{"start":{"row":95,"column":19},"end":{"row":95,"column":20},"action":"remove","lines":["t"],"id":508}],[{"start":{"row":95,"column":18},"end":{"row":95,"column":19},"action":"remove","lines":["i"],"id":509}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"remove","lines":["w"],"id":510}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"insert","lines":["w"],"id":511}],[{"start":{"row":95,"column":18},"end":{"row":95,"column":19},"action":"insert","lines":["i"],"id":512}],[{"start":{"row":95,"column":19},"end":{"row":95,"column":20},"action":"insert","lines":["t"],"id":513}],[{"start":{"row":95,"column":20},"end":{"row":95,"column":21},"action":"insert","lines":["h"],"id":514}],[{"start":{"row":93,"column":0},"end":{"row":95,"column":21},"action":"remove","lines":["##Users + Campgrounds","* Prevent an unauthenticated user from creating a campground","* Associate user with"],"id":515}],[{"start":{"row":92,"column":0},"end":{"row":93,"column":0},"action":"remove","lines":["",""],"id":516}],[{"start":{"row":95,"column":0},"end":{"row":96,"column":0},"action":"insert","lines":["",""],"id":517}],[{"start":{"row":96,"column":0},"end":{"row":97,"column":0},"action":"insert","lines":["",""],"id":518}]]},"ace":{"folds":[],"scrolltop":2179.5,"scrollleft":0,"selection":{"start":{"row":97,"column":0},"end":{"row":97,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":82,"state":"start","mode":"ace/mode/markdown"}},"timestamp":1445493511130,"hash":"837102c0367079860dcca920f532d9cedb4d7d39"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/routes/comments.js b/.c9/metadata/workspace/YelpCamp/v8/routes/comments.js deleted file mode 100644 index e5a2c7a2..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/routes/comments.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comments.js","tooltip":"/YelpCamp/v8/routes/comments.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":32,"column":22},"end":{"row":32,"column":23},"action":"remove","lines":[" "],"id":224}],[{"start":{"row":32,"column":22},"end":{"row":32,"column":23},"action":"insert","lines":["."],"id":225}],[{"start":{"row":32,"column":23},"end":{"row":32,"column":24},"action":"insert","lines":["a"],"id":226}],[{"start":{"row":32,"column":24},"end":{"row":32,"column":25},"action":"insert","lines":["u"],"id":227}],[{"start":{"row":32,"column":25},"end":{"row":32,"column":26},"action":"insert","lines":["t"],"id":228}],[{"start":{"row":32,"column":26},"end":{"row":32,"column":27},"action":"insert","lines":["h"],"id":229}],[{"start":{"row":32,"column":27},"end":{"row":32,"column":28},"action":"insert","lines":["o"],"id":230}],[{"start":{"row":32,"column":28},"end":{"row":32,"column":29},"action":"insert","lines":["r"],"id":231}],[{"start":{"row":32,"column":29},"end":{"row":32,"column":30},"action":"insert","lines":[" "],"id":232}],[{"start":{"row":32,"column":29},"end":{"row":32,"column":30},"action":"remove","lines":[" "],"id":233}],[{"start":{"row":32,"column":29},"end":{"row":32,"column":30},"action":"insert","lines":["."],"id":234}],[{"start":{"row":32,"column":30},"end":{"row":32,"column":31},"action":"insert","lines":["_"],"id":235}],[{"start":{"row":32,"column":31},"end":{"row":32,"column":32},"action":"insert","lines":["u"],"id":236}],[{"start":{"row":32,"column":31},"end":{"row":32,"column":32},"action":"remove","lines":["u"],"id":237}],[{"start":{"row":32,"column":30},"end":{"row":32,"column":31},"action":"remove","lines":["_"],"id":238}],[{"start":{"row":32,"column":29},"end":{"row":32,"column":30},"action":"remove","lines":["."],"id":239}],[{"start":{"row":32,"column":29},"end":{"row":32,"column":30},"action":"insert","lines":["."],"id":240}],[{"start":{"row":32,"column":30},"end":{"row":32,"column":31},"action":"insert","lines":["u"],"id":241}],[{"start":{"row":32,"column":31},"end":{"row":32,"column":32},"action":"insert","lines":["s"],"id":242}],[{"start":{"row":32,"column":32},"end":{"row":32,"column":33},"action":"insert","lines":["e"],"id":243}],[{"start":{"row":32,"column":33},"end":{"row":32,"column":34},"action":"insert","lines":["r"],"id":244}],[{"start":{"row":32,"column":34},"end":{"row":32,"column":35},"action":"insert","lines":["n"],"id":245}],[{"start":{"row":32,"column":35},"end":{"row":32,"column":36},"action":"insert","lines":["a"],"id":246}],[{"start":{"row":32,"column":36},"end":{"row":32,"column":37},"action":"insert","lines":["m"],"id":247}],[{"start":{"row":32,"column":37},"end":{"row":32,"column":38},"action":"insert","lines":["e"],"id":248}],[{"start":{"row":32,"column":38},"end":{"row":32,"column":39},"action":"insert","lines":[" "],"id":249}],[{"start":{"row":32,"column":38},"end":{"row":32,"column":39},"action":"remove","lines":[" "],"id":250}],[{"start":{"row":32,"column":38},"end":{"row":32,"column":39},"action":"insert","lines":[" "],"id":251}],[{"start":{"row":32,"column":39},"end":{"row":32,"column":40},"action":"insert","lines":["="],"id":252}],[{"start":{"row":32,"column":40},"end":{"row":32,"column":41},"action":"insert","lines":[" "],"id":253}],[{"start":{"row":32,"column":41},"end":{"row":32,"column":42},"action":"insert","lines":["r"],"id":254}],[{"start":{"row":32,"column":42},"end":{"row":32,"column":43},"action":"insert","lines":["e"],"id":255}],[{"start":{"row":32,"column":43},"end":{"row":32,"column":44},"action":"insert","lines":["q"],"id":256}],[{"start":{"row":32,"column":44},"end":{"row":32,"column":45},"action":"insert","lines":[" "],"id":257}],[{"start":{"row":32,"column":44},"end":{"row":32,"column":45},"action":"remove","lines":[" "],"id":258}],[{"start":{"row":32,"column":44},"end":{"row":32,"column":45},"action":"insert","lines":["."],"id":259}],[{"start":{"row":32,"column":45},"end":{"row":32,"column":46},"action":"insert","lines":["u"],"id":260}],[{"start":{"row":32,"column":46},"end":{"row":32,"column":47},"action":"insert","lines":["s"],"id":261}],[{"start":{"row":32,"column":47},"end":{"row":32,"column":48},"action":"insert","lines":["e"],"id":262}],[{"start":{"row":32,"column":48},"end":{"row":32,"column":49},"action":"insert","lines":["r"],"id":263}],[{"start":{"row":32,"column":49},"end":{"row":32,"column":50},"action":"insert","lines":[" "],"id":264}],[{"start":{"row":32,"column":49},"end":{"row":32,"column":50},"action":"remove","lines":[" "],"id":265}],[{"start":{"row":32,"column":49},"end":{"row":32,"column":50},"action":"insert","lines":["."],"id":266}],[{"start":{"row":32,"column":50},"end":{"row":32,"column":51},"action":"insert","lines":["u"],"id":267}],[{"start":{"row":32,"column":51},"end":{"row":32,"column":52},"action":"insert","lines":["s"],"id":268}],[{"start":{"row":32,"column":52},"end":{"row":32,"column":53},"action":"insert","lines":["e"],"id":269}],[{"start":{"row":32,"column":53},"end":{"row":32,"column":54},"action":"insert","lines":["r"],"id":270}],[{"start":{"row":32,"column":54},"end":{"row":32,"column":55},"action":"insert","lines":["n"],"id":271}],[{"start":{"row":32,"column":55},"end":{"row":32,"column":56},"action":"insert","lines":["a"],"id":272}],[{"start":{"row":32,"column":56},"end":{"row":32,"column":57},"action":"insert","lines":["m"],"id":273}],[{"start":{"row":32,"column":57},"end":{"row":32,"column":58},"action":"insert","lines":["e"],"id":274}],[{"start":{"row":32,"column":58},"end":{"row":32,"column":59},"action":"insert","lines":[" "],"id":275}],[{"start":{"row":32,"column":58},"end":{"row":32,"column":59},"action":"remove","lines":[" "],"id":276}],[{"start":{"row":32,"column":58},"end":{"row":32,"column":59},"action":"insert","lines":[";"],"id":277}],[{"start":{"row":33,"column":0},"end":{"row":34,"column":0},"action":"remove","lines":[" console.log(\"New comment's username will be: \" + req.user.username);",""],"id":278}],[{"start":{"row":33,"column":29},"end":{"row":34,"column":0},"action":"insert","lines":["",""],"id":279},{"start":{"row":34,"column":0},"end":{"row":34,"column":15},"action":"insert","lines":[" "]}],[{"start":{"row":34,"column":15},"end":{"row":34,"column":16},"action":"insert","lines":["c"],"id":280}],[{"start":{"row":34,"column":16},"end":{"row":34,"column":17},"action":"insert","lines":["o"],"id":281}],[{"start":{"row":34,"column":17},"end":{"row":34,"column":18},"action":"insert","lines":["m"],"id":282}],[{"start":{"row":34,"column":18},"end":{"row":34,"column":19},"action":"insert","lines":["m"],"id":283}],[{"start":{"row":34,"column":19},"end":{"row":34,"column":20},"action":"insert","lines":["e"],"id":284}],[{"start":{"row":34,"column":20},"end":{"row":34,"column":21},"action":"insert","lines":["n"],"id":285}],[{"start":{"row":34,"column":21},"end":{"row":34,"column":22},"action":"insert","lines":["t"],"id":286}],[{"start":{"row":34,"column":22},"end":{"row":34,"column":23},"action":"insert","lines":[" "],"id":287}],[{"start":{"row":34,"column":22},"end":{"row":34,"column":23},"action":"remove","lines":[" "],"id":288}],[{"start":{"row":34,"column":22},"end":{"row":34,"column":23},"action":"insert","lines":["."],"id":289}],[{"start":{"row":34,"column":23},"end":{"row":34,"column":24},"action":"insert","lines":["s"],"id":290}],[{"start":{"row":34,"column":24},"end":{"row":34,"column":25},"action":"insert","lines":["a"],"id":291}],[{"start":{"row":34,"column":25},"end":{"row":34,"column":26},"action":"insert","lines":["v"],"id":292}],[{"start":{"row":34,"column":26},"end":{"row":34,"column":27},"action":"insert","lines":["e"],"id":293}],[{"start":{"row":34,"column":27},"end":{"row":34,"column":28},"action":"insert","lines":[" "],"id":294}],[{"start":{"row":34,"column":27},"end":{"row":34,"column":28},"action":"remove","lines":[" "],"id":295}],[{"start":{"row":34,"column":27},"end":{"row":34,"column":29},"action":"insert","lines":["()"],"id":296}],[{"start":{"row":34,"column":29},"end":{"row":34,"column":30},"action":"insert","lines":[";"],"id":297}],[{"start":{"row":36,"column":33},"end":{"row":37,"column":0},"action":"insert","lines":["",""],"id":298},{"start":{"row":37,"column":0},"end":{"row":37,"column":15},"action":"insert","lines":[" "]}],[{"start":{"row":37,"column":15},"end":{"row":37,"column":16},"action":"insert","lines":["c"],"id":299}],[{"start":{"row":37,"column":16},"end":{"row":37,"column":17},"action":"insert","lines":["o"],"id":300}],[{"start":{"row":37,"column":17},"end":{"row":37,"column":18},"action":"insert","lines":["n"],"id":301}],[{"start":{"row":37,"column":18},"end":{"row":37,"column":19},"action":"insert","lines":["s"],"id":302}],[{"start":{"row":37,"column":19},"end":{"row":37,"column":20},"action":"insert","lines":["o"],"id":303}],[{"start":{"row":37,"column":20},"end":{"row":37,"column":21},"action":"insert","lines":["l"],"id":304}],[{"start":{"row":37,"column":21},"end":{"row":37,"column":22},"action":"insert","lines":["e"],"id":305}],[{"start":{"row":37,"column":22},"end":{"row":37,"column":23},"action":"insert","lines":[" "],"id":306}],[{"start":{"row":37,"column":22},"end":{"row":37,"column":23},"action":"remove","lines":[" "],"id":307}],[{"start":{"row":37,"column":22},"end":{"row":37,"column":23},"action":"insert","lines":["."],"id":308}],[{"start":{"row":37,"column":23},"end":{"row":37,"column":24},"action":"insert","lines":["l"],"id":309}],[{"start":{"row":37,"column":24},"end":{"row":37,"column":25},"action":"insert","lines":["o"],"id":310}],[{"start":{"row":37,"column":25},"end":{"row":37,"column":26},"action":"insert","lines":["g"],"id":311}],[{"start":{"row":37,"column":26},"end":{"row":37,"column":27},"action":"insert","lines":[" "],"id":312}],[{"start":{"row":37,"column":26},"end":{"row":37,"column":27},"action":"remove","lines":[" "],"id":313}],[{"start":{"row":37,"column":26},"end":{"row":37,"column":28},"action":"insert","lines":["()"],"id":314}],[{"start":{"row":37,"column":27},"end":{"row":37,"column":28},"action":"insert","lines":["c"],"id":315}],[{"start":{"row":37,"column":28},"end":{"row":37,"column":29},"action":"insert","lines":["o"],"id":316}],[{"start":{"row":37,"column":29},"end":{"row":37,"column":30},"action":"insert","lines":["m"],"id":317}],[{"start":{"row":37,"column":30},"end":{"row":37,"column":31},"action":"insert","lines":["m"],"id":318}],[{"start":{"row":37,"column":31},"end":{"row":37,"column":32},"action":"insert","lines":["e"],"id":319}],[{"start":{"row":37,"column":32},"end":{"row":37,"column":33},"action":"insert","lines":["n"],"id":320}],[{"start":{"row":37,"column":33},"end":{"row":37,"column":34},"action":"insert","lines":["t"],"id":321}],[{"start":{"row":37,"column":34},"end":{"row":37,"column":35},"action":"insert","lines":[" "],"id":322}],[{"start":{"row":37,"column":34},"end":{"row":37,"column":35},"action":"remove","lines":[" "],"id":323}],[{"start":{"row":37,"column":35},"end":{"row":37,"column":36},"action":"insert","lines":[";"],"id":324}]]},"ace":{"folds":[],"scrolltop":661.5,"scrollleft":0,"selection":{"start":{"row":34,"column":30},"end":{"row":34,"column":30},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":82,"mode":"ace/mode/javascript"}},"timestamp":1445492665286,"hash":"1d84b716f4a867b6543f62fe0b09d273c06cffd3"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/seeds.js b/.c9/metadata/workspace/YelpCamp/v8/seeds.js deleted file mode 100644 index a9f19b52..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/seeds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"seeds.js","tooltip":"/YelpCamp/v8/seeds.js","undoManager":{"mark":-1,"position":-1,"stack":[[{"start":{"row":25,"column":8},"end":{"row":25,"column":11},"action":"insert","lines":["// "],"id":2},{"start":{"row":26,"column":8},"end":{"row":26,"column":11},"action":"insert","lines":["// "]},{"start":{"row":27,"column":8},"end":{"row":27,"column":11},"action":"insert","lines":["// "]},{"start":{"row":28,"column":8},"end":{"row":28,"column":11},"action":"insert","lines":["// "]},{"start":{"row":29,"column":8},"end":{"row":29,"column":11},"action":"insert","lines":["// "]},{"start":{"row":30,"column":8},"end":{"row":30,"column":11},"action":"insert","lines":["// "]},{"start":{"row":31,"column":8},"end":{"row":31,"column":11},"action":"insert","lines":["// "]},{"start":{"row":32,"column":8},"end":{"row":32,"column":11},"action":"insert","lines":["// "]},{"start":{"row":33,"column":8},"end":{"row":33,"column":11},"action":"insert","lines":["// "]},{"start":{"row":34,"column":8},"end":{"row":34,"column":11},"action":"insert","lines":["// "]},{"start":{"row":35,"column":8},"end":{"row":35,"column":11},"action":"insert","lines":["// "]},{"start":{"row":36,"column":8},"end":{"row":36,"column":11},"action":"insert","lines":["// "]},{"start":{"row":37,"column":8},"end":{"row":37,"column":11},"action":"insert","lines":["// "]},{"start":{"row":38,"column":8},"end":{"row":38,"column":11},"action":"insert","lines":["// "]},{"start":{"row":39,"column":8},"end":{"row":39,"column":11},"action":"insert","lines":["// "]},{"start":{"row":40,"column":8},"end":{"row":40,"column":11},"action":"insert","lines":["// "]},{"start":{"row":41,"column":8},"end":{"row":41,"column":11},"action":"insert","lines":["// "]},{"start":{"row":42,"column":8},"end":{"row":42,"column":11},"action":"insert","lines":["// "]},{"start":{"row":43,"column":8},"end":{"row":43,"column":11},"action":"insert","lines":["// "]},{"start":{"row":44,"column":8},"end":{"row":44,"column":11},"action":"insert","lines":["// "]},{"start":{"row":45,"column":8},"end":{"row":45,"column":11},"action":"insert","lines":["// "]},{"start":{"row":46,"column":8},"end":{"row":46,"column":11},"action":"insert","lines":["// "]},{"start":{"row":47,"column":8},"end":{"row":47,"column":11},"action":"insert","lines":["// "]},{"start":{"row":48,"column":8},"end":{"row":48,"column":11},"action":"insert","lines":["// "]},{"start":{"row":49,"column":8},"end":{"row":49,"column":11},"action":"insert","lines":["// "]},{"start":{"row":50,"column":8},"end":{"row":50,"column":11},"action":"insert","lines":["// "]},{"start":{"row":51,"column":8},"end":{"row":51,"column":11},"action":"insert","lines":["// "]},{"start":{"row":52,"column":8},"end":{"row":52,"column":11},"action":"insert","lines":["// "]}]]},"ace":{"folds":[],"scrolltop":517.5,"scrollleft":0,"selection":{"start":{"row":25,"column":16},"end":{"row":25,"column":16},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":82,"mode":"ace/mode/javascript"}},"timestamp":1445492020731,"hash":"bb328fd4d11e1843d92999cedc979e3c2878c462"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/views/campgrounds/show.ejs b/.c9/metadata/workspace/YelpCamp/v8/views/campgrounds/show.ejs deleted file mode 100644 index 2cbc2408..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/views/campgrounds/show.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"show.ejs","tooltip":"/YelpCamp/v8/views/campgrounds/show.ejs","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":34,"column":41},"end":{"row":34,"column":42},"action":"insert","lines":[" "],"id":42}],[{"start":{"row":34,"column":42},"end":{"row":34,"column":43},"action":"insert","lines":["B"],"id":43}],[{"start":{"row":34,"column":43},"end":{"row":34,"column":44},"action":"insert","lines":["y"],"id":44}],[{"start":{"row":34,"column":44},"end":{"row":34,"column":45},"action":"insert","lines":[" "],"id":45}],[{"start":{"row":34,"column":44},"end":{"row":34,"column":45},"action":"remove","lines":[" "],"id":46}],[{"start":{"row":34,"column":44},"end":{"row":34,"column":45},"action":"insert","lines":[" "],"id":47}],[{"start":{"row":34,"column":45},"end":{"row":34,"column":46},"action":"insert","lines":["T"],"id":48}],[{"start":{"row":34,"column":46},"end":{"row":34,"column":47},"action":"insert","lines":["o"],"id":49}],[{"start":{"row":34,"column":47},"end":{"row":34,"column":48},"action":"insert","lines":["d"],"id":50}],[{"start":{"row":34,"column":48},"end":{"row":34,"column":49},"action":"insert","lines":["d"],"id":51}],[{"start":{"row":34,"column":49},"end":{"row":34,"column":50},"action":"insert","lines":[" "],"id":52}],[{"start":{"row":34,"column":49},"end":{"row":34,"column":50},"action":"remove","lines":[" "],"id":53}],[{"start":{"row":34,"column":49},"end":{"row":34,"column":50},"action":"insert","lines":[" "],"id":54}],[{"start":{"row":34,"column":50},"end":{"row":34,"column":51},"action":"insert","lines":["P"],"id":55}],[{"start":{"row":34,"column":51},"end":{"row":34,"column":52},"action":"insert","lines":["a"],"id":56}],[{"start":{"row":34,"column":52},"end":{"row":34,"column":53},"action":"insert","lines":["r"],"id":57}],[{"start":{"row":34,"column":53},"end":{"row":34,"column":54},"action":"insert","lines":["k"],"id":58}],[{"start":{"row":34,"column":54},"end":{"row":34,"column":55},"action":"insert","lines":["e"],"id":59}],[{"start":{"row":34,"column":55},"end":{"row":34,"column":56},"action":"insert","lines":["r"],"id":60}],[{"start":{"row":34,"column":56},"end":{"row":34,"column":57},"action":"insert","lines":[" "],"id":61}],[{"start":{"row":34,"column":56},"end":{"row":34,"column":57},"action":"remove","lines":[" "],"id":62}],[{"start":{"row":33,"column":27},"end":{"row":35,"column":34},"action":"remove","lines":["
    "," Submitted By Todd Parker","
    "],"id":63}],[{"start":{"row":17,"column":56},"end":{"row":18,"column":0},"action":"insert","lines":["",""],"id":64},{"start":{"row":18,"column":0},"end":{"row":18,"column":20},"action":"insert","lines":[" "]}],[{"start":{"row":18,"column":16},"end":{"row":18,"column":20},"action":"remove","lines":[" "],"id":66}],[{"start":{"row":18,"column":12},"end":{"row":18,"column":16},"action":"remove","lines":[" "],"id":67}],[{"start":{"row":18,"column":8},"end":{"row":18,"column":12},"action":"remove","lines":[" "],"id":68}],[{"start":{"row":18,"column":4},"end":{"row":18,"column":8},"action":"remove","lines":[" "],"id":69}],[{"start":{"row":18,"column":0},"end":{"row":18,"column":4},"action":"remove","lines":[" "],"id":70}],[{"start":{"row":17,"column":56},"end":{"row":18,"column":0},"action":"remove","lines":["",""],"id":71}],[{"start":{"row":18,"column":22},"end":{"row":19,"column":0},"action":"insert","lines":["",""],"id":72},{"start":{"row":19,"column":0},"end":{"row":19,"column":16},"action":"insert","lines":[" "]}],[{"start":{"row":19,"column":16},"end":{"row":21,"column":34},"action":"insert","lines":["
    "," Submitted By Todd Parker","
    "],"id":73}],[{"start":{"row":19,"column":21},"end":{"row":19,"column":22},"action":"insert","lines":[" "],"id":74}],[{"start":{"row":19,"column":22},"end":{"row":19,"column":23},"action":"insert","lines":["c"],"id":75}],[{"start":{"row":19,"column":23},"end":{"row":19,"column":24},"action":"insert","lines":["l"],"id":76}],[{"start":{"row":19,"column":24},"end":{"row":19,"column":25},"action":"insert","lines":["a"],"id":77}],[{"start":{"row":19,"column":25},"end":{"row":19,"column":26},"action":"insert","lines":["s"],"id":78}],[{"start":{"row":19,"column":26},"end":{"row":19,"column":27},"action":"insert","lines":["s"],"id":79}],[{"start":{"row":19,"column":27},"end":{"row":19,"column":28},"action":"insert","lines":["="],"id":80}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":30},"action":"insert","lines":["\"\""],"id":81}],[{"start":{"row":19,"column":29},"end":{"row":19,"column":30},"action":"insert","lines":["r"],"id":82}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":31},"action":"insert","lines":["e"],"id":83}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":31},"action":"remove","lines":["e"],"id":84}],[{"start":{"row":19,"column":30},"end":{"row":19,"column":31},"action":"insert","lines":["a"],"id":85}],[{"start":{"row":19,"column":31},"end":{"row":19,"column":32},"action":"insert","lines":["t"],"id":86}],[{"start":{"row":19,"column":32},"end":{"row":19,"column":33},"action":"insert","lines":["i"],"id":87}],[{"start":{"row":19,"column":33},"end":{"row":19,"column":34},"action":"insert","lines":["n"],"id":88}],[{"start":{"row":19,"column":34},"end":{"row":19,"column":35},"action":"insert","lines":["g"],"id":89}],[{"start":{"row":19,"column":35},"end":{"row":19,"column":36},"action":"insert","lines":["s"],"id":90}],[{"start":{"row":19,"column":0},"end":{"row":21,"column":34},"action":"remove","lines":["
    "," Submitted By Todd Parker","
    "],"id":91}],[{"start":{"row":18,"column":22},"end":{"row":19,"column":0},"action":"remove","lines":["",""],"id":92}],[{"start":{"row":16,"column":56},"end":{"row":17,"column":0},"action":"insert","lines":["",""],"id":118},{"start":{"row":17,"column":0},"end":{"row":17,"column":20},"action":"insert","lines":[" "]}],[{"start":{"row":17,"column":20},"end":{"row":17,"column":21},"action":"insert","lines":["<"],"id":119}],[{"start":{"row":17,"column":21},"end":{"row":17,"column":22},"action":"insert","lines":["p"],"id":120}],[{"start":{"row":17,"column":22},"end":{"row":17,"column":27},"action":"insert","lines":[">

    "],"id":121}],[{"start":{"row":17,"column":23},"end":{"row":17,"column":24},"action":"insert","lines":["S"],"id":122}],[{"start":{"row":17,"column":24},"end":{"row":17,"column":25},"action":"insert","lines":["u"],"id":123}],[{"start":{"row":17,"column":25},"end":{"row":17,"column":26},"action":"insert","lines":["b"],"id":124}],[{"start":{"row":17,"column":26},"end":{"row":17,"column":27},"action":"insert","lines":["m"],"id":125}],[{"start":{"row":17,"column":27},"end":{"row":17,"column":28},"action":"insert","lines":["i"],"id":126}],[{"start":{"row":17,"column":28},"end":{"row":17,"column":29},"action":"insert","lines":["t"],"id":127}],[{"start":{"row":17,"column":29},"end":{"row":17,"column":30},"action":"insert","lines":["t"],"id":128}],[{"start":{"row":17,"column":30},"end":{"row":17,"column":31},"action":"insert","lines":["e"],"id":129}],[{"start":{"row":17,"column":31},"end":{"row":17,"column":32},"action":"insert","lines":["d"],"id":130}],[{"start":{"row":17,"column":32},"end":{"row":17,"column":33},"action":"insert","lines":[" "],"id":131}],[{"start":{"row":17,"column":33},"end":{"row":17,"column":34},"action":"insert","lines":["B"],"id":132}],[{"start":{"row":17,"column":34},"end":{"row":17,"column":35},"action":"insert","lines":["y"],"id":133}],[{"start":{"row":17,"column":35},"end":{"row":17,"column":36},"action":"insert","lines":[" "],"id":134}],[{"start":{"row":17,"column":36},"end":{"row":17,"column":37},"action":"insert","lines":["T"],"id":135}],[{"start":{"row":17,"column":37},"end":{"row":17,"column":38},"action":"insert","lines":["o"],"id":136}],[{"start":{"row":17,"column":38},"end":{"row":17,"column":39},"action":"insert","lines":["d"],"id":137}],[{"start":{"row":17,"column":39},"end":{"row":17,"column":40},"action":"insert","lines":["d"],"id":138}],[{"start":{"row":17,"column":40},"end":{"row":17,"column":41},"action":"insert","lines":[" "],"id":139}],[{"start":{"row":17,"column":41},"end":{"row":17,"column":42},"action":"insert","lines":["P"],"id":140}],[{"start":{"row":17,"column":42},"end":{"row":17,"column":43},"action":"insert","lines":["a"],"id":141}],[{"start":{"row":17,"column":43},"end":{"row":17,"column":44},"action":"insert","lines":["r"],"id":142}],[{"start":{"row":17,"column":44},"end":{"row":17,"column":45},"action":"insert","lines":["k"],"id":143}],[{"start":{"row":17,"column":45},"end":{"row":17,"column":46},"action":"insert","lines":["e"],"id":144}],[{"start":{"row":17,"column":46},"end":{"row":17,"column":47},"action":"insert","lines":["r"],"id":145}],[{"start":{"row":17,"column":21},"end":{"row":17,"column":22},"action":"remove","lines":["p"],"id":146}],[{"start":{"row":17,"column":21},"end":{"row":17,"column":22},"action":"insert","lines":["e"],"id":147}],[{"start":{"row":17,"column":22},"end":{"row":17,"column":23},"action":"insert","lines":["m"],"id":148}],[{"start":{"row":17,"column":50},"end":{"row":17,"column":51},"action":"remove","lines":["p"],"id":149}],[{"start":{"row":17,"column":50},"end":{"row":17,"column":51},"action":"insert","lines":["e"],"id":150}],[{"start":{"row":17,"column":51},"end":{"row":17,"column":52},"action":"insert","lines":["m"],"id":151}],[{"start":{"row":16,"column":56},"end":{"row":17,"column":0},"action":"insert","lines":["",""],"id":152},{"start":{"row":17,"column":0},"end":{"row":17,"column":20},"action":"insert","lines":[" "]}],[{"start":{"row":17,"column":20},"end":{"row":17,"column":21},"action":"insert","lines":["p"],"id":153}],[{"start":{"row":17,"column":20},"end":{"row":17,"column":21},"action":"remove","lines":["p"],"id":154},{"start":{"row":17,"column":20},"end":{"row":17,"column":21},"action":"insert","lines":["p"]}],[{"start":{"row":17,"column":20},"end":{"row":17,"column":21},"action":"remove","lines":["p"],"id":155}],[{"start":{"row":17,"column":20},"end":{"row":17,"column":21},"action":"insert","lines":["<"],"id":156}],[{"start":{"row":17,"column":21},"end":{"row":17,"column":22},"action":"insert","lines":["p"],"id":157}],[{"start":{"row":17,"column":22},"end":{"row":17,"column":27},"action":"insert","lines":[">

    "],"id":158}],[{"start":{"row":18,"column":20},"end":{"row":18,"column":53},"action":"remove","lines":["Submitted By Todd Parker"],"id":159}],[{"start":{"row":17,"column":23},"end":{"row":17,"column":56},"action":"insert","lines":["Submitted By Todd Parker"],"id":160}],[{"start":{"row":18,"column":16},"end":{"row":18,"column":20},"action":"remove","lines":[" "],"id":161}],[{"start":{"row":18,"column":12},"end":{"row":18,"column":16},"action":"remove","lines":[" "],"id":162}],[{"start":{"row":18,"column":8},"end":{"row":18,"column":12},"action":"remove","lines":[" "],"id":163}],[{"start":{"row":18,"column":4},"end":{"row":18,"column":8},"action":"remove","lines":[" "],"id":164}],[{"start":{"row":18,"column":0},"end":{"row":18,"column":4},"action":"remove","lines":[" "],"id":165}],[{"start":{"row":17,"column":60},"end":{"row":18,"column":0},"action":"remove","lines":["",""],"id":166}],[{"start":{"row":17,"column":0},"end":{"row":17,"column":60},"action":"remove","lines":["

    Submitted By Todd Parker

    "],"id":167}],[{"start":{"row":16,"column":56},"end":{"row":17,"column":0},"action":"remove","lines":["",""],"id":168}]]},"ace":{"folds":[],"scrolltop":287,"scrollleft":0,"selection":{"start":{"row":18,"column":22},"end":{"row":18,"column":22},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":10,"state":"start","mode":"ace/mode/ejs"}},"timestamp":1445493368149,"hash":"a2aefced21978174c84efe3609f2a76f89debfc1"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/views/comments/new.ejs b/.c9/metadata/workspace/YelpCamp/v8/views/comments/new.ejs deleted file mode 100644 index c6e2eb62..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/views/comments/new.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"new.ejs","tooltip":"/YelpCamp/v8/views/comments/new.ejs","undoManager":{"mark":1,"position":1,"stack":[[{"start":{"row":9,"column":0},"end":{"row":11,"column":22},"action":"remove","lines":["
    "," ","
    "],"id":2}],[{"start":{"row":8,"column":22},"end":{"row":9,"column":0},"action":"remove","lines":["",""],"id":3}]]},"ace":{"folds":[],"scrolltop":112.5,"scrollleft":0,"selection":{"start":{"row":8,"column":22},"end":{"row":8,"column":22},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":82,"mode":"ace/mode/ejs"}},"timestamp":1445492567816,"hash":"c55c8775fc213dee946d6fe2d8bed817186a29c7"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v8/views/landing.ejs b/.c9/metadata/workspace/YelpCamp/v8/views/landing.ejs deleted file mode 100644 index 16ef4732..00000000 --- a/.c9/metadata/workspace/YelpCamp/v8/views/landing.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"landing.ejs","tooltip":"/YelpCamp/v8/views/landing.ejs","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":8,"column":29},"end":{"row":8,"column":29},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1446332132033,"hash":"9892c547daaba2e3b2004bfb00c648761d1d340d"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/app.js b/.c9/metadata/workspace/YelpCamp/v9/app.js deleted file mode 100644 index 78894e1c..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/app.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"app.js","tooltip":"/YelpCamp/v9/app.js","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":43,"column":7},"end":{"row":43,"column":9},"action":"insert","lines":["()"],"id":20}],[{"start":{"row":43,"column":8},"end":{"row":43,"column":10},"action":"insert","lines":["\"\""],"id":21}],[{"start":{"row":43,"column":9},"end":{"row":43,"column":10},"action":"insert","lines":["/"],"id":22}],[{"start":{"row":43,"column":10},"end":{"row":43,"column":11},"action":"insert","lines":["d"],"id":23}],[{"start":{"row":43,"column":11},"end":{"row":43,"column":12},"action":"insert","lines":["e"],"id":24}],[{"start":{"row":43,"column":12},"end":{"row":43,"column":13},"action":"insert","lines":["m"],"id":25}],[{"start":{"row":43,"column":12},"end":{"row":43,"column":13},"action":"remove","lines":["m"],"id":26}],[{"start":{"row":43,"column":12},"end":{"row":43,"column":13},"action":"insert","lines":["m"],"id":27}],[{"start":{"row":43,"column":13},"end":{"row":43,"column":14},"action":"insert","lines":["o"],"id":28}],[{"start":{"row":43,"column":0},"end":{"row":44,"column":0},"action":"remove","lines":["app.get(\"/demo\")",""],"id":31}],[{"start":{"row":42,"column":0},"end":{"row":43,"column":0},"action":"insert","lines":["",""],"id":32}],[{"start":{"row":43,"column":0},"end":{"row":43,"column":1},"action":"insert","lines":["a"],"id":33}],[{"start":{"row":43,"column":1},"end":{"row":43,"column":2},"action":"insert","lines":["p"],"id":34}],[{"start":{"row":43,"column":2},"end":{"row":43,"column":3},"action":"insert","lines":["p"],"id":35}],[{"start":{"row":43,"column":3},"end":{"row":43,"column":4},"action":"insert","lines":[" "],"id":36}],[{"start":{"row":43,"column":3},"end":{"row":43,"column":4},"action":"remove","lines":[" "],"id":37}],[{"start":{"row":43,"column":3},"end":{"row":43,"column":4},"action":"insert","lines":["."],"id":38}],[{"start":{"row":43,"column":4},"end":{"row":43,"column":5},"action":"insert","lines":["g"],"id":39}],[{"start":{"row":43,"column":5},"end":{"row":43,"column":6},"action":"insert","lines":["e"],"id":40}],[{"start":{"row":43,"column":6},"end":{"row":43,"column":7},"action":"insert","lines":["t"],"id":41}],[{"start":{"row":43,"column":7},"end":{"row":43,"column":8},"action":"insert","lines":[" "],"id":42}],[{"start":{"row":43,"column":7},"end":{"row":43,"column":8},"action":"remove","lines":[" "],"id":43}],[{"start":{"row":43,"column":7},"end":{"row":43,"column":9},"action":"insert","lines":["()"],"id":44}],[{"start":{"row":43,"column":8},"end":{"row":43,"column":10},"action":"insert","lines":["\"\""],"id":45}],[{"start":{"row":43,"column":9},"end":{"row":43,"column":10},"action":"insert","lines":["/"],"id":46}],[{"start":{"row":43,"column":10},"end":{"row":43,"column":11},"action":"insert","lines":["l"],"id":47}],[{"start":{"row":43,"column":11},"end":{"row":43,"column":12},"action":"insert","lines":["o"],"id":48}],[{"start":{"row":43,"column":12},"end":{"row":43,"column":13},"action":"insert","lines":["g"],"id":49}],[{"start":{"row":43,"column":13},"end":{"row":43,"column":14},"action":"insert","lines":["i"],"id":50}],[{"start":{"row":43,"column":14},"end":{"row":43,"column":15},"action":"insert","lines":["n"],"id":51}],[{"start":{"row":43,"column":15},"end":{"row":43,"column":16},"action":"insert","lines":[" "],"id":52}],[{"start":{"row":43,"column":15},"end":{"row":43,"column":16},"action":"remove","lines":[" "],"id":53}],[{"start":{"row":43,"column":16},"end":{"row":43,"column":17},"action":"insert","lines":[","],"id":54}],[{"start":{"row":43,"column":17},"end":{"row":43,"column":18},"action":"insert","lines":[" "],"id":55}],[{"start":{"row":43,"column":18},"end":{"row":43,"column":19},"action":"insert","lines":["f"],"id":56}],[{"start":{"row":43,"column":19},"end":{"row":43,"column":20},"action":"insert","lines":["u"],"id":57}],[{"start":{"row":43,"column":20},"end":{"row":43,"column":21},"action":"insert","lines":["n"],"id":58}],[{"start":{"row":43,"column":21},"end":{"row":43,"column":22},"action":"insert","lines":["c"],"id":59}],[{"start":{"row":43,"column":22},"end":{"row":43,"column":23},"action":"insert","lines":["t"],"id":60}],[{"start":{"row":43,"column":23},"end":{"row":43,"column":24},"action":"insert","lines":["i"],"id":61}],[{"start":{"row":43,"column":24},"end":{"row":43,"column":25},"action":"insert","lines":["o"],"id":62}],[{"start":{"row":43,"column":25},"end":{"row":43,"column":26},"action":"insert","lines":["n"],"id":63}],[{"start":{"row":43,"column":26},"end":{"row":43,"column":27},"action":"insert","lines":[" "],"id":64}],[{"start":{"row":43,"column":26},"end":{"row":43,"column":27},"action":"remove","lines":[" "],"id":65}],[{"start":{"row":43,"column":26},"end":{"row":43,"column":28},"action":"insert","lines":["()"],"id":66}],[{"start":{"row":43,"column":27},"end":{"row":43,"column":28},"action":"insert","lines":["r"],"id":67}],[{"start":{"row":43,"column":28},"end":{"row":43,"column":29},"action":"insert","lines":["e"],"id":68}],[{"start":{"row":43,"column":29},"end":{"row":43,"column":30},"action":"insert","lines":["q"],"id":69}],[{"start":{"row":43,"column":30},"end":{"row":43,"column":31},"action":"insert","lines":[" "],"id":70}],[{"start":{"row":43,"column":30},"end":{"row":43,"column":31},"action":"remove","lines":[" "],"id":71}],[{"start":{"row":43,"column":30},"end":{"row":43,"column":31},"action":"insert","lines":[","],"id":72}],[{"start":{"row":43,"column":31},"end":{"row":43,"column":32},"action":"insert","lines":[" "],"id":73}],[{"start":{"row":43,"column":32},"end":{"row":43,"column":33},"action":"insert","lines":["e"],"id":74}],[{"start":{"row":43,"column":33},"end":{"row":43,"column":34},"action":"insert","lines":["s"],"id":75}],[{"start":{"row":43,"column":34},"end":{"row":43,"column":35},"action":"insert","lines":[" "],"id":76}],[{"start":{"row":43,"column":34},"end":{"row":43,"column":35},"action":"remove","lines":[" "],"id":77}],[{"start":{"row":43,"column":33},"end":{"row":43,"column":34},"action":"remove","lines":["s"],"id":78}],[{"start":{"row":43,"column":32},"end":{"row":43,"column":33},"action":"remove","lines":["e"],"id":79}],[{"start":{"row":43,"column":32},"end":{"row":43,"column":33},"action":"insert","lines":["r"],"id":80}],[{"start":{"row":43,"column":33},"end":{"row":43,"column":34},"action":"insert","lines":["e"],"id":81}],[{"start":{"row":43,"column":34},"end":{"row":43,"column":35},"action":"insert","lines":["s"],"id":82}],[{"start":{"row":43,"column":36},"end":{"row":43,"column":38},"action":"insert","lines":["{}"],"id":83}],[{"start":{"row":43,"column":37},"end":{"row":45,"column":0},"action":"insert","lines":[""," ",""],"id":84}],[{"start":{"row":45,"column":2},"end":{"row":45,"column":3},"action":"insert","lines":[";"],"id":85}],[{"start":{"row":44,"column":3},"end":{"row":44,"column":4},"action":"insert","lines":["r"],"id":86}],[{"start":{"row":44,"column":4},"end":{"row":44,"column":5},"action":"insert","lines":["e"],"id":87}],[{"start":{"row":44,"column":5},"end":{"row":44,"column":6},"action":"insert","lines":["s"],"id":88}],[{"start":{"row":44,"column":6},"end":{"row":44,"column":7},"action":"insert","lines":[" "],"id":89}],[{"start":{"row":44,"column":6},"end":{"row":44,"column":7},"action":"remove","lines":[" "],"id":90}],[{"start":{"row":44,"column":6},"end":{"row":44,"column":7},"action":"insert","lines":["."],"id":91}],[{"start":{"row":44,"column":7},"end":{"row":44,"column":8},"action":"insert","lines":["s"],"id":92}],[{"start":{"row":44,"column":8},"end":{"row":44,"column":9},"action":"insert","lines":["e"],"id":93}],[{"start":{"row":44,"column":9},"end":{"row":44,"column":10},"action":"insert","lines":["n"],"id":94}],[{"start":{"row":44,"column":10},"end":{"row":44,"column":11},"action":"insert","lines":["d"],"id":95}],[{"start":{"row":44,"column":11},"end":{"row":44,"column":12},"action":"insert","lines":[" "],"id":96}],[{"start":{"row":44,"column":11},"end":{"row":44,"column":12},"action":"remove","lines":[" "],"id":97}],[{"start":{"row":44,"column":11},"end":{"row":44,"column":13},"action":"insert","lines":["()"],"id":98}],[{"start":{"row":44,"column":12},"end":{"row":44,"column":14},"action":"insert","lines":["\"\""],"id":99}],[{"start":{"row":44,"column":13},"end":{"row":44,"column":14},"action":"insert","lines":["S"],"id":100}],[{"start":{"row":44,"column":14},"end":{"row":44,"column":15},"action":"insert","lines":["u"],"id":101}],[{"start":{"row":44,"column":15},"end":{"row":44,"column":16},"action":"insert","lines":["c"],"id":102}],[{"start":{"row":44,"column":15},"end":{"row":44,"column":16},"action":"remove","lines":["c"],"id":103}],[{"start":{"row":44,"column":14},"end":{"row":44,"column":15},"action":"remove","lines":["u"],"id":104}],[{"start":{"row":44,"column":13},"end":{"row":44,"column":14},"action":"remove","lines":["S"],"id":105}],[{"start":{"row":44,"column":13},"end":{"row":44,"column":14},"action":"insert","lines":["Y"],"id":106}],[{"start":{"row":44,"column":14},"end":{"row":44,"column":15},"action":"insert","lines":["o"],"id":107}],[{"start":{"row":44,"column":15},"end":{"row":44,"column":16},"action":"insert","lines":["u"],"id":108}],[{"start":{"row":44,"column":16},"end":{"row":44,"column":17},"action":"insert","lines":[" "],"id":109}],[{"start":{"row":44,"column":17},"end":{"row":44,"column":18},"action":"insert","lines":["l"],"id":110}],[{"start":{"row":44,"column":18},"end":{"row":44,"column":19},"action":"insert","lines":["o"],"id":111}],[{"start":{"row":44,"column":19},"end":{"row":44,"column":20},"action":"insert","lines":["g"],"id":112}],[{"start":{"row":44,"column":20},"end":{"row":44,"column":21},"action":"insert","lines":["g"],"id":113}],[{"start":{"row":44,"column":21},"end":{"row":44,"column":22},"action":"insert","lines":["e"],"id":114}],[{"start":{"row":44,"column":22},"end":{"row":44,"column":23},"action":"insert","lines":["d"],"id":115}],[{"start":{"row":44,"column":23},"end":{"row":44,"column":24},"action":"insert","lines":[" "],"id":116}],[{"start":{"row":44,"column":24},"end":{"row":44,"column":25},"action":"insert","lines":["i"],"id":117}],[{"start":{"row":44,"column":25},"end":{"row":44,"column":26},"action":"insert","lines":["n"],"id":118}],[{"start":{"row":44,"column":26},"end":{"row":44,"column":27},"action":"insert","lines":["!"],"id":119}],[{"start":{"row":44,"column":29},"end":{"row":44,"column":30},"action":"insert","lines":[";"],"id":120}],[{"start":{"row":43,"column":0},"end":{"row":45,"column":3},"action":"remove","lines":["app.get(\"/login\", function(req, res){"," res.send(\"You logged in!\"); ","});"],"id":121}],[{"start":{"row":42,"column":0},"end":{"row":43,"column":0},"action":"remove","lines":["",""],"id":122}]]},"ace":{"folds":[],"scrolltop":428.5,"scrollleft":0,"selection":{"start":{"row":42,"column":0},"end":{"row":42,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":15,"state":"no_regex","mode":"ace/mode/javascript"}},"timestamp":1446238309745,"hash":"0a4c3e67174db4e9dbf70e7810c54ac027a5971f"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/models/campground.js b/.c9/metadata/workspace/YelpCamp/v9/models/campground.js deleted file mode 100644 index 8e963588..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/models/campground.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campground.js","tooltip":"/YelpCamp/v9/models/campground.js","ace":{"folds":[],"scrolltop":85.5,"scrollleft":0,"selection":{"start":{"row":12,"column":5},"end":{"row":12,"column":5},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":50,"mode":"ace/mode/javascript"}},"hash":"6a47307c1260b8ae223431925a4d312d0e9ff1df","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":6,"column":9},"end":{"row":6,"column":10},"action":"insert","lines":[":"],"id":11}],[{"start":{"row":6,"column":10},"end":{"row":6,"column":11},"action":"insert","lines":[" "],"id":12}],[{"start":{"row":6,"column":11},"end":{"row":6,"column":12},"action":"insert","lines":["{"],"id":13}],[{"start":{"row":6,"column":12},"end":{"row":8,"column":4},"action":"insert","lines":[""," "," }"],"id":14}],[{"start":{"row":7,"column":6},"end":{"row":7,"column":7},"action":"insert","lines":["i"],"id":15}],[{"start":{"row":7,"column":7},"end":{"row":7,"column":8},"action":"insert","lines":["d"],"id":16}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":[" "],"id":17}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"remove","lines":[" "],"id":18}],[{"start":{"row":7,"column":8},"end":{"row":7,"column":9},"action":"insert","lines":[":"],"id":19}],[{"start":{"row":7,"column":9},"end":{"row":7,"column":10},"action":"insert","lines":[" "],"id":20}],[{"start":{"row":7,"column":10},"end":{"row":7,"column":11},"action":"insert","lines":["{"],"id":21}],[{"start":{"row":7,"column":11},"end":{"row":9,"column":7},"action":"insert","lines":[""," "," }"],"id":22}],[{"start":{"row":9,"column":7},"end":{"row":9,"column":8},"action":"insert","lines":[","],"id":23}],[{"start":{"row":9,"column":8},"end":{"row":10,"column":0},"action":"insert","lines":["",""],"id":24},{"start":{"row":10,"column":0},"end":{"row":10,"column":6},"action":"insert","lines":[" "]}],[{"start":{"row":10,"column":6},"end":{"row":10,"column":7},"action":"insert","lines":["u"],"id":25}],[{"start":{"row":10,"column":7},"end":{"row":10,"column":8},"action":"insert","lines":["s"],"id":26}],[{"start":{"row":10,"column":8},"end":{"row":10,"column":9},"action":"insert","lines":["e"],"id":27}],[{"start":{"row":10,"column":9},"end":{"row":10,"column":10},"action":"insert","lines":["r"],"id":28}],[{"start":{"row":10,"column":10},"end":{"row":10,"column":11},"action":"insert","lines":["n"],"id":29}],[{"start":{"row":10,"column":11},"end":{"row":10,"column":12},"action":"insert","lines":["a"],"id":30}],[{"start":{"row":10,"column":12},"end":{"row":10,"column":13},"action":"insert","lines":["m"],"id":31}],[{"start":{"row":10,"column":13},"end":{"row":10,"column":14},"action":"insert","lines":["e"],"id":32}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"insert","lines":[" "],"id":33}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"remove","lines":[" "],"id":34}],[{"start":{"row":10,"column":14},"end":{"row":10,"column":15},"action":"insert","lines":[":"],"id":35}],[{"start":{"row":10,"column":15},"end":{"row":10,"column":16},"action":"insert","lines":[" "],"id":36}],[{"start":{"row":10,"column":16},"end":{"row":10,"column":17},"action":"insert","lines":["S"],"id":37}],[{"start":{"row":10,"column":17},"end":{"row":10,"column":18},"action":"insert","lines":["t"],"id":38}],[{"start":{"row":10,"column":18},"end":{"row":10,"column":19},"action":"insert","lines":["r"],"id":39}],[{"start":{"row":10,"column":19},"end":{"row":10,"column":20},"action":"insert","lines":["i"],"id":40}],[{"start":{"row":10,"column":20},"end":{"row":10,"column":21},"action":"insert","lines":["n"],"id":41}],[{"start":{"row":10,"column":21},"end":{"row":10,"column":22},"action":"insert","lines":["g"],"id":42}],[{"start":{"row":10,"column":22},"end":{"row":10,"column":23},"action":"insert","lines":[" "],"id":43}],[{"start":{"row":10,"column":22},"end":{"row":10,"column":23},"action":"remove","lines":[" "],"id":44}],[{"start":{"row":8,"column":9},"end":{"row":8,"column":10},"action":"insert","lines":["t"],"id":45}],[{"start":{"row":8,"column":10},"end":{"row":8,"column":11},"action":"insert","lines":["y"],"id":46}],[{"start":{"row":8,"column":11},"end":{"row":8,"column":12},"action":"insert","lines":["p"],"id":47}],[{"start":{"row":8,"column":12},"end":{"row":8,"column":13},"action":"insert","lines":["e"],"id":48}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"insert","lines":[" "],"id":49}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"remove","lines":[" "],"id":50}],[{"start":{"row":8,"column":13},"end":{"row":8,"column":14},"action":"insert","lines":[":"],"id":51}],[{"start":{"row":8,"column":14},"end":{"row":8,"column":15},"action":"insert","lines":[" "],"id":52}],[{"start":{"row":8,"column":15},"end":{"row":8,"column":16},"action":"insert","lines":["m"],"id":53}],[{"start":{"row":8,"column":16},"end":{"row":8,"column":17},"action":"insert","lines":["o"],"id":54}],[{"start":{"row":8,"column":17},"end":{"row":8,"column":18},"action":"insert","lines":["n"],"id":55}],[{"start":{"row":8,"column":18},"end":{"row":8,"column":19},"action":"insert","lines":["g"],"id":56}],[{"start":{"row":8,"column":19},"end":{"row":8,"column":20},"action":"insert","lines":["o"],"id":57}],[{"start":{"row":8,"column":20},"end":{"row":8,"column":21},"action":"insert","lines":["o"],"id":58}],[{"start":{"row":8,"column":21},"end":{"row":8,"column":22},"action":"insert","lines":["s"],"id":59}],[{"start":{"row":8,"column":22},"end":{"row":8,"column":23},"action":"insert","lines":["e"],"id":60}],[{"start":{"row":8,"column":23},"end":{"row":8,"column":24},"action":"insert","lines":[" "],"id":61}],[{"start":{"row":8,"column":23},"end":{"row":8,"column":24},"action":"remove","lines":[" "],"id":62}],[{"start":{"row":8,"column":23},"end":{"row":8,"column":24},"action":"insert","lines":["."],"id":63}],[{"start":{"row":8,"column":24},"end":{"row":8,"column":25},"action":"insert","lines":["S"],"id":64}],[{"start":{"row":8,"column":25},"end":{"row":8,"column":26},"action":"insert","lines":["c"],"id":65}],[{"start":{"row":8,"column":26},"end":{"row":8,"column":27},"action":"insert","lines":["h"],"id":66}],[{"start":{"row":8,"column":27},"end":{"row":8,"column":28},"action":"insert","lines":["e"],"id":67}],[{"start":{"row":8,"column":28},"end":{"row":8,"column":29},"action":"insert","lines":["m"],"id":68}],[{"start":{"row":8,"column":29},"end":{"row":8,"column":30},"action":"insert","lines":["a"],"id":69}],[{"start":{"row":8,"column":30},"end":{"row":8,"column":31},"action":"insert","lines":[" "],"id":70}],[{"start":{"row":8,"column":30},"end":{"row":8,"column":31},"action":"remove","lines":[" "],"id":71}],[{"start":{"row":8,"column":30},"end":{"row":8,"column":31},"action":"insert","lines":["."],"id":72}],[{"start":{"row":8,"column":31},"end":{"row":8,"column":32},"action":"insert","lines":["T"],"id":73}],[{"start":{"row":8,"column":32},"end":{"row":8,"column":33},"action":"insert","lines":["y"],"id":74}],[{"start":{"row":8,"column":33},"end":{"row":8,"column":34},"action":"insert","lines":["p"],"id":75}],[{"start":{"row":8,"column":34},"end":{"row":8,"column":35},"action":"insert","lines":["e"],"id":76}],[{"start":{"row":8,"column":35},"end":{"row":8,"column":36},"action":"insert","lines":["s"],"id":77}],[{"start":{"row":8,"column":36},"end":{"row":8,"column":37},"action":"insert","lines":[" "],"id":78}],[{"start":{"row":8,"column":36},"end":{"row":8,"column":37},"action":"remove","lines":[" "],"id":79}],[{"start":{"row":8,"column":36},"end":{"row":8,"column":37},"action":"insert","lines":["."],"id":80}],[{"start":{"row":8,"column":37},"end":{"row":8,"column":38},"action":"insert","lines":["O"],"id":81}],[{"start":{"row":8,"column":38},"end":{"row":8,"column":39},"action":"insert","lines":["b"],"id":82}],[{"start":{"row":8,"column":39},"end":{"row":8,"column":40},"action":"insert","lines":["j"],"id":83}],[{"start":{"row":8,"column":40},"end":{"row":8,"column":41},"action":"insert","lines":["e"],"id":84}],[{"start":{"row":8,"column":41},"end":{"row":8,"column":42},"action":"insert","lines":["c"],"id":85}],[{"start":{"row":8,"column":42},"end":{"row":8,"column":43},"action":"insert","lines":["t"],"id":86}],[{"start":{"row":8,"column":43},"end":{"row":8,"column":44},"action":"insert","lines":[" "],"id":87}],[{"start":{"row":8,"column":43},"end":{"row":8,"column":44},"action":"remove","lines":[" "],"id":88}],[{"start":{"row":8,"column":43},"end":{"row":8,"column":44},"action":"insert","lines":["I"],"id":89}],[{"start":{"row":8,"column":44},"end":{"row":8,"column":45},"action":"insert","lines":["d"],"id":90}],[{"start":{"row":8,"column":45},"end":{"row":8,"column":46},"action":"insert","lines":[" "],"id":91}],[{"start":{"row":8,"column":45},"end":{"row":8,"column":46},"action":"remove","lines":[" "],"id":92}],[{"start":{"row":8,"column":45},"end":{"row":8,"column":46},"action":"insert","lines":[";"],"id":93}],[{"start":{"row":8,"column":46},"end":{"row":9,"column":0},"action":"insert","lines":["",""],"id":94},{"start":{"row":9,"column":0},"end":{"row":9,"column":9},"action":"insert","lines":[" "]}],[{"start":{"row":9,"column":9},"end":{"row":9,"column":10},"action":"insert","lines":["r"],"id":95}],[{"start":{"row":9,"column":10},"end":{"row":9,"column":11},"action":"insert","lines":["e"],"id":96}],[{"start":{"row":9,"column":11},"end":{"row":9,"column":12},"action":"insert","lines":["f"],"id":97}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":[" "],"id":98}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"remove","lines":[" "],"id":99}],[{"start":{"row":9,"column":12},"end":{"row":9,"column":13},"action":"insert","lines":[":"],"id":100}],[{"start":{"row":9,"column":13},"end":{"row":9,"column":14},"action":"insert","lines":[" "],"id":101}],[{"start":{"row":9,"column":14},"end":{"row":9,"column":16},"action":"insert","lines":["\"\""],"id":102}],[{"start":{"row":9,"column":15},"end":{"row":9,"column":16},"action":"insert","lines":["U"],"id":103}],[{"start":{"row":9,"column":16},"end":{"row":9,"column":17},"action":"insert","lines":["s"],"id":104}],[{"start":{"row":9,"column":17},"end":{"row":9,"column":18},"action":"insert","lines":["e"],"id":105}],[{"start":{"row":9,"column":18},"end":{"row":9,"column":19},"action":"insert","lines":["r"],"id":106}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":20},"action":"insert","lines":[" "],"id":107}],[{"start":{"row":9,"column":19},"end":{"row":9,"column":20},"action":"remove","lines":[" "],"id":108}],[{"start":{"row":8,"column":45},"end":{"row":8,"column":46},"action":"remove","lines":[";"],"id":109}],[{"start":{"row":8,"column":45},"end":{"row":8,"column":46},"action":"insert","lines":[","],"id":110}],[{"start":{"row":12,"column":4},"end":{"row":12,"column":5},"action":"insert","lines":[","],"id":111}]]},"timestamp":1445494211000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/readme.md b/.c9/metadata/workspace/YelpCamp/v9/readme.md deleted file mode 100644 index 226d9a60..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/readme.md +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"readme.md","tooltip":"/YelpCamp/v9/readme.md","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"insert","lines":[" "],"id":4}],[{"start":{"row":95,"column":22},"end":{"row":95,"column":23},"action":"insert","lines":["c"],"id":5}],[{"start":{"row":95,"column":22},"end":{"row":95,"column":23},"action":"remove","lines":["c"],"id":6}],[{"start":{"row":95,"column":22},"end":{"row":95,"column":23},"action":"insert","lines":["c"],"id":7}],[{"start":{"row":95,"column":22},"end":{"row":95,"column":23},"action":"remove","lines":["c"],"id":8}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"remove","lines":[" "],"id":9}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"insert","lines":[" "],"id":10}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"remove","lines":[" "],"id":11}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"insert","lines":[" "],"id":12}],[{"start":{"row":95,"column":22},"end":{"row":95,"column":23},"action":"insert","lines":["c"],"id":13}],[{"start":{"row":95,"column":23},"end":{"row":95,"column":24},"action":"insert","lines":["a"],"id":14}],[{"start":{"row":95,"column":24},"end":{"row":95,"column":25},"action":"insert","lines":["m"],"id":15}],[{"start":{"row":95,"column":25},"end":{"row":95,"column":26},"action":"insert","lines":["p"],"id":16}],[{"start":{"row":95,"column":25},"end":{"row":95,"column":26},"action":"remove","lines":["p"],"id":17}],[{"start":{"row":95,"column":24},"end":{"row":95,"column":25},"action":"remove","lines":["m"],"id":18}],[{"start":{"row":95,"column":23},"end":{"row":95,"column":24},"action":"remove","lines":["a"],"id":19}],[{"start":{"row":95,"column":22},"end":{"row":95,"column":23},"action":"remove","lines":["c"],"id":20}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"remove","lines":[" "],"id":21}],[{"start":{"row":95,"column":20},"end":{"row":95,"column":21},"action":"remove","lines":["h"],"id":22}],[{"start":{"row":95,"column":19},"end":{"row":95,"column":20},"action":"remove","lines":["t"],"id":23}],[{"start":{"row":95,"column":18},"end":{"row":95,"column":19},"action":"remove","lines":["i"],"id":24}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"remove","lines":["w"],"id":25}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"remove","lines":[" "],"id":26}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"remove","lines":["r"],"id":27}],[{"start":{"row":95,"column":14},"end":{"row":95,"column":15},"action":"remove","lines":["e"],"id":28}],[{"start":{"row":95,"column":13},"end":{"row":95,"column":14},"action":"remove","lines":["s"],"id":29}],[{"start":{"row":95,"column":12},"end":{"row":95,"column":13},"action":"remove","lines":["u"],"id":30}],[{"start":{"row":95,"column":11},"end":{"row":95,"column":12},"action":"remove","lines":[" "],"id":31}],[{"start":{"row":95,"column":10},"end":{"row":95,"column":11},"action":"remove","lines":["e"],"id":32}],[{"start":{"row":95,"column":9},"end":{"row":95,"column":10},"action":"remove","lines":["t"],"id":33}],[{"start":{"row":95,"column":8},"end":{"row":95,"column":9},"action":"remove","lines":["a"],"id":34}],[{"start":{"row":95,"column":7},"end":{"row":95,"column":8},"action":"remove","lines":["i"],"id":35}],[{"start":{"row":95,"column":6},"end":{"row":95,"column":7},"action":"remove","lines":["c"],"id":36}],[{"start":{"row":95,"column":5},"end":{"row":95,"column":6},"action":"remove","lines":["o"],"id":37}],[{"start":{"row":95,"column":4},"end":{"row":95,"column":5},"action":"remove","lines":["s"],"id":38}],[{"start":{"row":95,"column":3},"end":{"row":95,"column":4},"action":"remove","lines":["s"],"id":39}],[{"start":{"row":95,"column":2},"end":{"row":95,"column":3},"action":"remove","lines":["A"],"id":40}],[{"start":{"row":95,"column":2},"end":{"row":95,"column":3},"action":"insert","lines":["S"],"id":41}],[{"start":{"row":95,"column":3},"end":{"row":95,"column":4},"action":"insert","lines":["a"],"id":42}],[{"start":{"row":95,"column":4},"end":{"row":95,"column":5},"action":"insert","lines":["v"],"id":43}],[{"start":{"row":95,"column":5},"end":{"row":95,"column":6},"action":"insert","lines":["e"],"id":44}],[{"start":{"row":95,"column":6},"end":{"row":95,"column":7},"action":"insert","lines":[" "],"id":45}],[{"start":{"row":95,"column":7},"end":{"row":95,"column":8},"action":"insert","lines":["u"],"id":46}],[{"start":{"row":95,"column":8},"end":{"row":95,"column":9},"action":"insert","lines":["s"],"id":47}],[{"start":{"row":95,"column":9},"end":{"row":95,"column":10},"action":"insert","lines":["e"],"id":48}],[{"start":{"row":95,"column":10},"end":{"row":95,"column":11},"action":"insert","lines":["r"],"id":49}],[{"start":{"row":95,"column":11},"end":{"row":95,"column":12},"action":"insert","lines":["n"],"id":50}],[{"start":{"row":95,"column":12},"end":{"row":95,"column":13},"action":"insert","lines":["a"],"id":51}],[{"start":{"row":95,"column":13},"end":{"row":95,"column":14},"action":"insert","lines":["m"],"id":52}],[{"start":{"row":95,"column":14},"end":{"row":95,"column":15},"action":"insert","lines":["e"],"id":53}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"insert","lines":[" "],"id":54}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"remove","lines":[" "],"id":55}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"insert","lines":["+"],"id":56}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"insert","lines":["i"],"id":57}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"insert","lines":["d"],"id":58}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"remove","lines":["d"],"id":59}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"remove","lines":["i"],"id":60}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"remove","lines":["+"],"id":61}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"insert","lines":[" "],"id":62}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"remove","lines":[" "],"id":63}],[{"start":{"row":95,"column":15},"end":{"row":95,"column":16},"action":"insert","lines":["+"],"id":64}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"insert","lines":["o"],"id":65}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"insert","lines":["d"],"id":66}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"remove","lines":["d"],"id":67}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"remove","lines":["o"],"id":68}],[{"start":{"row":95,"column":16},"end":{"row":95,"column":17},"action":"insert","lines":["i"],"id":69}],[{"start":{"row":95,"column":17},"end":{"row":95,"column":18},"action":"insert","lines":["d"],"id":70}],[{"start":{"row":95,"column":18},"end":{"row":95,"column":19},"action":"insert","lines":[" "],"id":71}],[{"start":{"row":95,"column":18},"end":{"row":95,"column":19},"action":"remove","lines":[" "],"id":72}],[{"start":{"row":95,"column":18},"end":{"row":95,"column":19},"action":"insert","lines":[" "],"id":73}],[{"start":{"row":95,"column":19},"end":{"row":95,"column":20},"action":"insert","lines":["t"],"id":74}],[{"start":{"row":95,"column":20},"end":{"row":95,"column":21},"action":"insert","lines":["o"],"id":75}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"insert","lines":[" "],"id":76}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"remove","lines":[" "],"id":77}],[{"start":{"row":95,"column":21},"end":{"row":95,"column":22},"action":"insert","lines":[" "],"id":78}],[{"start":{"row":95,"column":22},"end":{"row":95,"column":23},"action":"insert","lines":["n"],"id":79}],[{"start":{"row":95,"column":23},"end":{"row":95,"column":24},"action":"insert","lines":["e"],"id":80}],[{"start":{"row":95,"column":24},"end":{"row":95,"column":25},"action":"insert","lines":["w"],"id":81}],[{"start":{"row":95,"column":25},"end":{"row":95,"column":26},"action":"insert","lines":["l"],"id":82}],[{"start":{"row":95,"column":26},"end":{"row":95,"column":27},"action":"insert","lines":["y"],"id":83}],[{"start":{"row":95,"column":27},"end":{"row":95,"column":28},"action":"insert","lines":[" "],"id":84}],[{"start":{"row":95,"column":28},"end":{"row":95,"column":29},"action":"insert","lines":["c"],"id":85}],[{"start":{"row":95,"column":29},"end":{"row":95,"column":30},"action":"insert","lines":["r"],"id":86}],[{"start":{"row":95,"column":30},"end":{"row":95,"column":31},"action":"insert","lines":["e"],"id":87}],[{"start":{"row":95,"column":31},"end":{"row":95,"column":32},"action":"insert","lines":["a"],"id":88}],[{"start":{"row":95,"column":32},"end":{"row":95,"column":33},"action":"insert","lines":["t"],"id":89}],[{"start":{"row":95,"column":33},"end":{"row":95,"column":34},"action":"insert","lines":["e"],"id":90}],[{"start":{"row":95,"column":34},"end":{"row":95,"column":35},"action":"insert","lines":["d"],"id":91}],[{"start":{"row":95,"column":35},"end":{"row":95,"column":36},"action":"insert","lines":[" "],"id":92}],[{"start":{"row":95,"column":36},"end":{"row":95,"column":37},"action":"insert","lines":["c"],"id":93}],[{"start":{"row":95,"column":37},"end":{"row":95,"column":38},"action":"insert","lines":["a"],"id":94}],[{"start":{"row":95,"column":38},"end":{"row":95,"column":39},"action":"insert","lines":["m"],"id":95}],[{"start":{"row":95,"column":39},"end":{"row":95,"column":40},"action":"insert","lines":["p"],"id":96}],[{"start":{"row":95,"column":40},"end":{"row":95,"column":41},"action":"insert","lines":["g"],"id":97}],[{"start":{"row":95,"column":41},"end":{"row":95,"column":42},"action":"insert","lines":["r"],"id":98}],[{"start":{"row":95,"column":42},"end":{"row":95,"column":43},"action":"insert","lines":["o"],"id":99}],[{"start":{"row":95,"column":43},"end":{"row":95,"column":44},"action":"insert","lines":["u"],"id":100}],[{"start":{"row":95,"column":44},"end":{"row":95,"column":45},"action":"insert","lines":["n"],"id":101}],[{"start":{"row":95,"column":45},"end":{"row":95,"column":46},"action":"insert","lines":["d"],"id":102}],[{"start":{"row":95,"column":46},"end":{"row":95,"column":47},"action":"insert","lines":[" "],"id":103}],[{"start":{"row":95,"column":46},"end":{"row":95,"column":47},"action":"remove","lines":[" "],"id":104}]]},"ace":{"folds":[],"scrolltop":423.5,"scrollleft":0,"selection":{"start":{"row":22,"column":36},"end":{"row":22,"column":36},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":15,"state":"listblock","mode":"ace/mode/markdown"}},"timestamp":1445493617000,"hash":"7a977e817c9c5fb7e7e7744c821d1e50caf05391"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/routes/campgrounds.js b/.c9/metadata/workspace/YelpCamp/v9/routes/campgrounds.js deleted file mode 100644 index 45247b91..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/routes/campgrounds.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"campgrounds.js","tooltip":"/YelpCamp/v9/routes/campgrounds.js","ace":{"folds":[],"scrolltop":484.5,"scrollleft":0,"selection":{"start":{"row":24,"column":35},"end":{"row":24,"column":35},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":9,"state":"start","mode":"ace/mode/javascript"}},"hash":"728f2c4d1124e9d21e7c0cf8b5e44e8766f2acf5","undoManager":{"mark":100,"position":100,"stack":[[{"start":{"row":24,"column":20},"end":{"row":24,"column":21},"action":"insert","lines":["q"],"id":211}],[{"start":{"row":24,"column":21},"end":{"row":24,"column":22},"action":"insert","lines":[" "],"id":212}],[{"start":{"row":24,"column":21},"end":{"row":24,"column":22},"action":"remove","lines":[" "],"id":213}],[{"start":{"row":24,"column":21},"end":{"row":24,"column":22},"action":"insert","lines":["."],"id":214}],[{"start":{"row":24,"column":22},"end":{"row":24,"column":23},"action":"insert","lines":["u"],"id":215}],[{"start":{"row":24,"column":23},"end":{"row":24,"column":24},"action":"insert","lines":["s"],"id":216}],[{"start":{"row":24,"column":24},"end":{"row":24,"column":25},"action":"insert","lines":["e"],"id":217}],[{"start":{"row":24,"column":25},"end":{"row":24,"column":26},"action":"insert","lines":["r"],"id":218}],[{"start":{"row":24,"column":26},"end":{"row":24,"column":27},"action":"insert","lines":[" "],"id":219}],[{"start":{"row":24,"column":26},"end":{"row":24,"column":27},"action":"remove","lines":[" "],"id":220}],[{"start":{"row":24,"column":26},"end":{"row":24,"column":27},"action":"insert","lines":["."],"id":221}],[{"start":{"row":24,"column":27},"end":{"row":24,"column":28},"action":"insert","lines":["u"],"id":222}],[{"start":{"row":24,"column":28},"end":{"row":24,"column":29},"action":"insert","lines":["s"],"id":223}],[{"start":{"row":24,"column":29},"end":{"row":24,"column":30},"action":"insert","lines":["e"],"id":224}],[{"start":{"row":24,"column":30},"end":{"row":24,"column":31},"action":"insert","lines":["r"],"id":225}],[{"start":{"row":24,"column":31},"end":{"row":24,"column":32},"action":"insert","lines":["n"],"id":226}],[{"start":{"row":24,"column":32},"end":{"row":24,"column":33},"action":"insert","lines":["m"],"id":227}],[{"start":{"row":24,"column":32},"end":{"row":24,"column":33},"action":"remove","lines":["m"],"id":228}],[{"start":{"row":24,"column":32},"end":{"row":24,"column":33},"action":"insert","lines":["a"],"id":229}],[{"start":{"row":24,"column":33},"end":{"row":24,"column":34},"action":"insert","lines":["m"],"id":230}],[{"start":{"row":24,"column":34},"end":{"row":24,"column":35},"action":"insert","lines":["e"],"id":231}],[{"start":{"row":24,"column":35},"end":{"row":24,"column":36},"action":"insert","lines":[" "],"id":232}],[{"start":{"row":24,"column":35},"end":{"row":24,"column":36},"action":"remove","lines":[" "],"id":233}],[{"start":{"row":23,"column":24},"end":{"row":23,"column":25},"action":"insert","lines":[","],"id":234}],[{"start":{"row":26,"column":68},"end":{"row":26,"column":69},"action":"insert","lines":[","],"id":235}],[{"start":{"row":26,"column":69},"end":{"row":26,"column":70},"action":"insert","lines":[" "],"id":236}],[{"start":{"row":26,"column":70},"end":{"row":26,"column":71},"action":"insert","lines":["a"],"id":237}],[{"start":{"row":26,"column":71},"end":{"row":26,"column":72},"action":"insert","lines":["u"],"id":238}],[{"start":{"row":26,"column":72},"end":{"row":26,"column":73},"action":"insert","lines":["t"],"id":239}],[{"start":{"row":26,"column":73},"end":{"row":26,"column":74},"action":"insert","lines":["h"],"id":240}],[{"start":{"row":26,"column":74},"end":{"row":26,"column":75},"action":"insert","lines":["o"],"id":241}],[{"start":{"row":26,"column":75},"end":{"row":26,"column":76},"action":"insert","lines":["r"],"id":242}],[{"start":{"row":26,"column":76},"end":{"row":26,"column":77},"action":"insert","lines":[" "],"id":243}],[{"start":{"row":26,"column":76},"end":{"row":26,"column":77},"action":"remove","lines":[" "],"id":244}],[{"start":{"row":26,"column":76},"end":{"row":26,"column":77},"action":"insert","lines":[":"],"id":245}],[{"start":{"row":26,"column":77},"end":{"row":26,"column":78},"action":"insert","lines":["a"],"id":246}],[{"start":{"row":26,"column":78},"end":{"row":26,"column":79},"action":"insert","lines":["u"],"id":247}],[{"start":{"row":26,"column":79},"end":{"row":26,"column":80},"action":"insert","lines":["t"],"id":248}],[{"start":{"row":26,"column":80},"end":{"row":26,"column":81},"action":"insert","lines":["j"],"id":249}],[{"start":{"row":26,"column":81},"end":{"row":26,"column":82},"action":"insert","lines":["o"],"id":250}],[{"start":{"row":26,"column":82},"end":{"row":26,"column":83},"action":"insert","lines":["r"],"id":251}],[{"start":{"row":26,"column":83},"end":{"row":26,"column":84},"action":"insert","lines":[" "],"id":252}],[{"start":{"row":26,"column":83},"end":{"row":26,"column":84},"action":"remove","lines":[" "],"id":253}],[{"start":{"row":26,"column":82},"end":{"row":26,"column":83},"action":"remove","lines":["r"],"id":254}],[{"start":{"row":26,"column":81},"end":{"row":26,"column":82},"action":"remove","lines":["o"],"id":255}],[{"start":{"row":26,"column":80},"end":{"row":26,"column":81},"action":"remove","lines":["j"],"id":256}],[{"start":{"row":26,"column":80},"end":{"row":26,"column":81},"action":"insert","lines":["h"],"id":257}],[{"start":{"row":26,"column":81},"end":{"row":26,"column":82},"action":"insert","lines":["o"],"id":258}],[{"start":{"row":26,"column":82},"end":{"row":26,"column":83},"action":"insert","lines":["r"],"id":259}],[{"start":{"row":27,"column":0},"end":{"row":28,"column":0},"action":"remove","lines":[" console.log(req.user);",""],"id":260}],[{"start":{"row":32,"column":47},"end":{"row":33,"column":0},"action":"insert","lines":["",""],"id":261},{"start":{"row":33,"column":0},"end":{"row":33,"column":12},"action":"insert","lines":[" "]}],[{"start":{"row":33,"column":12},"end":{"row":33,"column":13},"action":"insert","lines":["c"],"id":262}],[{"start":{"row":33,"column":13},"end":{"row":33,"column":14},"action":"insert","lines":["o"],"id":263}],[{"start":{"row":33,"column":14},"end":{"row":33,"column":15},"action":"insert","lines":["n"],"id":264}],[{"start":{"row":33,"column":15},"end":{"row":33,"column":16},"action":"insert","lines":["s"],"id":265}],[{"start":{"row":33,"column":16},"end":{"row":33,"column":17},"action":"insert","lines":["o"],"id":266}],[{"start":{"row":33,"column":17},"end":{"row":33,"column":18},"action":"insert","lines":["l"],"id":267}],[{"start":{"row":33,"column":18},"end":{"row":33,"column":19},"action":"insert","lines":["e"],"id":268}],[{"start":{"row":33,"column":19},"end":{"row":33,"column":20},"action":"insert","lines":[" "],"id":269}],[{"start":{"row":33,"column":19},"end":{"row":33,"column":20},"action":"remove","lines":[" "],"id":270}],[{"start":{"row":33,"column":19},"end":{"row":33,"column":20},"action":"insert","lines":["."],"id":271}],[{"start":{"row":33,"column":20},"end":{"row":33,"column":21},"action":"insert","lines":["l"],"id":272}],[{"start":{"row":33,"column":21},"end":{"row":33,"column":22},"action":"insert","lines":["o"],"id":273}],[{"start":{"row":33,"column":22},"end":{"row":33,"column":23},"action":"insert","lines":["g"],"id":274}],[{"start":{"row":33,"column":23},"end":{"row":33,"column":24},"action":"insert","lines":[" "],"id":275}],[{"start":{"row":33,"column":23},"end":{"row":33,"column":24},"action":"remove","lines":[" "],"id":276}],[{"start":{"row":33,"column":23},"end":{"row":33,"column":25},"action":"insert","lines":["()"],"id":277}],[{"start":{"row":33,"column":24},"end":{"row":33,"column":25},"action":"insert","lines":["c"],"id":278}],[{"start":{"row":33,"column":25},"end":{"row":33,"column":26},"action":"insert","lines":["a"],"id":279}],[{"start":{"row":33,"column":26},"end":{"row":33,"column":27},"action":"insert","lines":["m"],"id":280}],[{"start":{"row":33,"column":27},"end":{"row":33,"column":28},"action":"insert","lines":["p"],"id":281}],[{"start":{"row":33,"column":28},"end":{"row":33,"column":29},"action":"insert","lines":["g"],"id":282}],[{"start":{"row":33,"column":29},"end":{"row":33,"column":30},"action":"insert","lines":["r"],"id":283}],[{"start":{"row":33,"column":30},"end":{"row":33,"column":31},"action":"insert","lines":["o"],"id":284}],[{"start":{"row":33,"column":31},"end":{"row":33,"column":32},"action":"insert","lines":["u"],"id":285}],[{"start":{"row":33,"column":32},"end":{"row":33,"column":33},"action":"insert","lines":["n"],"id":286}],[{"start":{"row":33,"column":33},"end":{"row":33,"column":34},"action":"insert","lines":["d"],"id":287}],[{"start":{"row":33,"column":34},"end":{"row":33,"column":35},"action":"insert","lines":["d"],"id":288}],[{"start":{"row":33,"column":35},"end":{"row":33,"column":36},"action":"insert","lines":["s"],"id":289}],[{"start":{"row":33,"column":36},"end":{"row":33,"column":37},"action":"insert","lines":[" "],"id":290}],[{"start":{"row":33,"column":36},"end":{"row":33,"column":37},"action":"remove","lines":[" "],"id":291}],[{"start":{"row":33,"column":35},"end":{"row":33,"column":36},"action":"remove","lines":["s"],"id":292}],[{"start":{"row":33,"column":34},"end":{"row":33,"column":35},"action":"remove","lines":["d"],"id":293}],[{"start":{"row":33,"column":33},"end":{"row":33,"column":34},"action":"remove","lines":["d"],"id":294}],[{"start":{"row":33,"column":32},"end":{"row":33,"column":33},"action":"remove","lines":["n"],"id":295}],[{"start":{"row":33,"column":31},"end":{"row":33,"column":32},"action":"remove","lines":["u"],"id":296}],[{"start":{"row":33,"column":30},"end":{"row":33,"column":31},"action":"remove","lines":["o"],"id":297}],[{"start":{"row":33,"column":29},"end":{"row":33,"column":30},"action":"remove","lines":["r"],"id":298}],[{"start":{"row":33,"column":28},"end":{"row":33,"column":29},"action":"remove","lines":["g"],"id":299}],[{"start":{"row":33,"column":27},"end":{"row":33,"column":28},"action":"remove","lines":["p"],"id":300}],[{"start":{"row":33,"column":26},"end":{"row":33,"column":27},"action":"remove","lines":["m"],"id":301}],[{"start":{"row":33,"column":25},"end":{"row":33,"column":26},"action":"remove","lines":["a"],"id":302}],[{"start":{"row":33,"column":24},"end":{"row":33,"column":25},"action":"remove","lines":["c"],"id":303}],[{"start":{"row":33,"column":24},"end":{"row":33,"column":25},"action":"insert","lines":["n"],"id":304}],[{"start":{"row":33,"column":25},"end":{"row":33,"column":26},"action":"insert","lines":["e"],"id":305}],[{"start":{"row":33,"column":26},"end":{"row":33,"column":27},"action":"insert","lines":["w"],"id":306}],[{"start":{"row":33,"column":27},"end":{"row":33,"column":28},"action":"insert","lines":["s"],"id":307}],[{"start":{"row":33,"column":27},"end":{"row":33,"column":28},"action":"remove","lines":["s"],"id":308}],[{"start":{"row":33,"column":27},"end":{"row":33,"column":28},"action":"insert","lines":["l"],"id":309}],[{"start":{"row":33,"column":24},"end":{"row":33,"column":28},"action":"remove","lines":["newl"],"id":310},{"start":{"row":33,"column":24},"end":{"row":33,"column":36},"action":"insert","lines":["newlyCreated"]}],[{"start":{"row":33,"column":37},"end":{"row":33,"column":38},"action":"insert","lines":[";"],"id":311}]]},"timestamp":1445494519000} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/routes/comments.js b/.c9/metadata/workspace/YelpCamp/v9/routes/comments.js deleted file mode 100644 index 1c302576..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/routes/comments.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"comments.js","tooltip":"/YelpCamp/v9/routes/comments.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":1047.5,"scrollleft":0,"selection":{"start":{"row":47,"column":29},"end":{"row":47,"column":29},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":24,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445493813510,"hash":"1d84b716f4a867b6543f62fe0b09d273c06cffd3"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/routes/index.js b/.c9/metadata/workspace/YelpCamp/v9/routes/index.js deleted file mode 100644 index 3166b53b..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/routes/index.js +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.js","tooltip":"/YelpCamp/v9/routes/index.js","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":1128,"scrollleft":0,"selection":{"start":{"row":52,"column":5},"end":{"row":52,"column":5},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":{"row":42,"state":"start","mode":"ace/mode/javascript"}},"timestamp":1445493820968,"hash":"22fb40e7a58175afbaa4062a39b7034914125ed7"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/views/campgrounds/index.ejs b/.c9/metadata/workspace/YelpCamp/v9/views/campgrounds/index.ejs deleted file mode 100644 index a5e11c0c..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/views/campgrounds/index.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"index.ejs","tooltip":"/YelpCamp/v9/views/campgrounds/index.ejs","undoManager":{"mark":-1,"position":-1,"stack":[[{"start":{"row":8,"column":47},"end":{"row":8,"column":48},"action":"insert","lines":["g"],"id":22}],[{"start":{"row":8,"column":47},"end":{"row":8,"column":48},"action":"remove","lines":["a"],"id":21}],[{"start":{"row":8,"column":48},"end":{"row":8,"column":49},"action":"remove","lines":["r"],"id":20}],[{"start":{"row":8,"column":49},"end":{"row":8,"column":50},"action":"remove","lines":["g"],"id":19}],[{"start":{"row":8,"column":50},"end":{"row":8,"column":51},"action":"remove","lines":["e"],"id":18}],[{"start":{"row":5,"column":63},"end":{"row":5,"column":64},"action":"insert","lines":[" "],"id":17}],[{"start":{"row":5,"column":30},"end":{"row":5,"column":54},"action":"insert","lines":["glyphicon glyphicon-tent"],"id":16}],[{"start":{"row":5,"column":29},"end":{"row":5,"column":31},"action":"insert","lines":["\"\""],"id":15}],[{"start":{"row":5,"column":28},"end":{"row":5,"column":29},"action":"insert","lines":["="],"id":14}],[{"start":{"row":5,"column":27},"end":{"row":5,"column":28},"action":"insert","lines":["s"],"id":13}],[{"start":{"row":5,"column":26},"end":{"row":5,"column":27},"action":"insert","lines":["s"],"id":12}],[{"start":{"row":5,"column":25},"end":{"row":5,"column":26},"action":"insert","lines":["a"],"id":11}],[{"start":{"row":5,"column":24},"end":{"row":5,"column":25},"action":"insert","lines":["l"],"id":10}],[{"start":{"row":5,"column":23},"end":{"row":5,"column":24},"action":"insert","lines":["c"],"id":9}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":23},"action":"insert","lines":[" "],"id":8}],[{"start":{"row":5,"column":22},"end":{"row":5,"column":30},"action":"insert","lines":[">"],"id":7}],[{"start":{"row":5,"column":21},"end":{"row":5,"column":22},"action":"insert","lines":["n"],"id":6}],[{"start":{"row":5,"column":20},"end":{"row":5,"column":21},"action":"insert","lines":["a"],"id":5}],[{"start":{"row":5,"column":19},"end":{"row":5,"column":20},"action":"insert","lines":["p"],"id":4}],[{"start":{"row":5,"column":18},"end":{"row":5,"column":19},"action":"insert","lines":["s"],"id":3}],[{"start":{"row":5,"column":17},"end":{"row":5,"column":18},"action":"insert","lines":["<"],"id":2}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":10,"column":15},"end":{"row":10,"column":15},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445675317110,"hash":"76ba7580736aa826dc375ba2fc146bc6a2c9043c"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/views/campgrounds/show.ejs b/.c9/metadata/workspace/YelpCamp/v9/views/campgrounds/show.ejs deleted file mode 100644 index 40881a8a..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/views/campgrounds/show.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"show.ejs","tooltip":"/YelpCamp/v9/views/campgrounds/show.ejs","undoManager":{"mark":80,"position":80,"stack":[[{"start":{"row":17,"column":56},"end":{"row":18,"column":0},"action":"insert","lines":["",""],"id":2},{"start":{"row":18,"column":0},"end":{"row":18,"column":20},"action":"insert","lines":[" "]}],[{"start":{"row":18,"column":20},"end":{"row":18,"column":21},"action":"insert","lines":["<"],"id":3}],[{"start":{"row":18,"column":21},"end":{"row":18,"column":22},"action":"insert","lines":["p"],"id":4}],[{"start":{"row":18,"column":22},"end":{"row":18,"column":27},"action":"insert","lines":[">

    "],"id":5}],[{"start":{"row":18,"column":23},"end":{"row":18,"column":24},"action":"insert","lines":["<"],"id":6}],[{"start":{"row":18,"column":24},"end":{"row":18,"column":25},"action":"insert","lines":["%"],"id":7}],[{"start":{"row":18,"column":25},"end":{"row":18,"column":26},"action":"insert","lines":["="],"id":8}],[{"start":{"row":18,"column":25},"end":{"row":18,"column":26},"action":"remove","lines":["="],"id":9}],[{"start":{"row":18,"column":24},"end":{"row":18,"column":25},"action":"remove","lines":["%"],"id":10}],[{"start":{"row":18,"column":23},"end":{"row":18,"column":24},"action":"remove","lines":["<"],"id":11}],[{"start":{"row":18,"column":23},"end":{"row":18,"column":24},"action":"insert","lines":["<"],"id":12}],[{"start":{"row":18,"column":24},"end":{"row":18,"column":25},"action":"insert","lines":["%"],"id":13}],[{"start":{"row":18,"column":25},"end":{"row":18,"column":26},"action":"insert","lines":["="],"id":14}],[{"start":{"row":18,"column":26},"end":{"row":18,"column":27},"action":"insert","lines":[" "],"id":15}],[{"start":{"row":18,"column":27},"end":{"row":18,"column":28},"action":"insert","lines":["%"],"id":16}],[{"start":{"row":18,"column":28},"end":{"row":18,"column":29},"action":"insert","lines":[">"],"id":17}],[{"start":{"row":18,"column":27},"end":{"row":18,"column":28},"action":"insert","lines":["c"],"id":18}],[{"start":{"row":18,"column":28},"end":{"row":18,"column":29},"action":"insert","lines":["a"],"id":19}],[{"start":{"row":18,"column":29},"end":{"row":18,"column":30},"action":"insert","lines":["m"],"id":20}],[{"start":{"row":18,"column":30},"end":{"row":18,"column":31},"action":"insert","lines":["p"],"id":21}],[{"start":{"row":18,"column":31},"end":{"row":18,"column":32},"action":"insert","lines":["g"],"id":22}],[{"start":{"row":18,"column":32},"end":{"row":18,"column":33},"action":"insert","lines":["r"],"id":23}],[{"start":{"row":18,"column":33},"end":{"row":18,"column":34},"action":"insert","lines":["o"],"id":24}],[{"start":{"row":18,"column":34},"end":{"row":18,"column":35},"action":"insert","lines":["u"],"id":25}],[{"start":{"row":18,"column":35},"end":{"row":18,"column":36},"action":"insert","lines":["n"],"id":26}],[{"start":{"row":18,"column":36},"end":{"row":18,"column":37},"action":"insert","lines":["d"],"id":27}],[{"start":{"row":18,"column":37},"end":{"row":18,"column":38},"action":"insert","lines":[" "],"id":28}],[{"start":{"row":18,"column":37},"end":{"row":18,"column":38},"action":"remove","lines":[" "],"id":29}],[{"start":{"row":18,"column":37},"end":{"row":18,"column":38},"action":"insert","lines":["."],"id":30}],[{"start":{"row":18,"column":38},"end":{"row":18,"column":39},"action":"insert","lines":["a"],"id":31}],[{"start":{"row":18,"column":39},"end":{"row":18,"column":40},"action":"insert","lines":["u"],"id":32}],[{"start":{"row":18,"column":40},"end":{"row":18,"column":41},"action":"insert","lines":["t"],"id":33}],[{"start":{"row":18,"column":41},"end":{"row":18,"column":42},"action":"insert","lines":["h"],"id":34}],[{"start":{"row":18,"column":42},"end":{"row":18,"column":43},"action":"insert","lines":["o"],"id":35}],[{"start":{"row":18,"column":43},"end":{"row":18,"column":44},"action":"insert","lines":["r"],"id":36}],[{"start":{"row":18,"column":44},"end":{"row":18,"column":45},"action":"insert","lines":[" "],"id":37}],[{"start":{"row":18,"column":44},"end":{"row":18,"column":45},"action":"remove","lines":[" "],"id":38}],[{"start":{"row":18,"column":44},"end":{"row":18,"column":45},"action":"insert","lines":["."],"id":39}],[{"start":{"row":18,"column":45},"end":{"row":18,"column":46},"action":"insert","lines":["u"],"id":40}],[{"start":{"row":18,"column":46},"end":{"row":18,"column":47},"action":"insert","lines":["s"],"id":41}],[{"start":{"row":18,"column":47},"end":{"row":18,"column":48},"action":"insert","lines":["e"],"id":42}],[{"start":{"row":18,"column":48},"end":{"row":18,"column":49},"action":"insert","lines":["r"],"id":43}],[{"start":{"row":18,"column":49},"end":{"row":18,"column":50},"action":"insert","lines":["n"],"id":44}],[{"start":{"row":18,"column":50},"end":{"row":18,"column":51},"action":"insert","lines":["a"],"id":45}],[{"start":{"row":18,"column":51},"end":{"row":18,"column":52},"action":"insert","lines":["m"],"id":46}],[{"start":{"row":18,"column":52},"end":{"row":18,"column":53},"action":"insert","lines":["e"],"id":47}],[{"start":{"row":18,"column":53},"end":{"row":18,"column":54},"action":"insert","lines":[" "],"id":48}],[{"start":{"row":18,"column":53},"end":{"row":18,"column":54},"action":"remove","lines":[" "],"id":49}],[{"start":{"row":18,"column":53},"end":{"row":18,"column":54},"action":"insert","lines":[" "],"id":50}],[{"start":{"row":18,"column":23},"end":{"row":18,"column":24},"action":"insert","lines":["S"],"id":51}],[{"start":{"row":18,"column":24},"end":{"row":18,"column":25},"action":"insert","lines":["u"],"id":52}],[{"start":{"row":18,"column":25},"end":{"row":18,"column":26},"action":"insert","lines":["b"],"id":53}],[{"start":{"row":18,"column":26},"end":{"row":18,"column":27},"action":"insert","lines":["m"],"id":54}],[{"start":{"row":18,"column":27},"end":{"row":18,"column":28},"action":"insert","lines":["i"],"id":55}],[{"start":{"row":18,"column":28},"end":{"row":18,"column":29},"action":"insert","lines":["t"],"id":56}],[{"start":{"row":18,"column":29},"end":{"row":18,"column":30},"action":"insert","lines":["t"],"id":57}],[{"start":{"row":18,"column":30},"end":{"row":18,"column":31},"action":"insert","lines":["e"],"id":58}],[{"start":{"row":18,"column":31},"end":{"row":18,"column":32},"action":"insert","lines":["d"],"id":59}],[{"start":{"row":18,"column":32},"end":{"row":18,"column":33},"action":"insert","lines":[" "],"id":60}],[{"start":{"row":18,"column":32},"end":{"row":18,"column":33},"action":"remove","lines":[" "],"id":61}],[{"start":{"row":18,"column":32},"end":{"row":18,"column":33},"action":"insert","lines":[" "],"id":62}],[{"start":{"row":18,"column":33},"end":{"row":18,"column":34},"action":"insert","lines":["b"],"id":63}],[{"start":{"row":18,"column":33},"end":{"row":18,"column":34},"action":"remove","lines":["b"],"id":64}],[{"start":{"row":18,"column":33},"end":{"row":18,"column":34},"action":"insert","lines":["B"],"id":65}],[{"start":{"row":18,"column":34},"end":{"row":18,"column":35},"action":"insert","lines":["y"],"id":66}],[{"start":{"row":18,"column":35},"end":{"row":18,"column":36},"action":"insert","lines":[" "],"id":67}],[{"start":{"row":18,"column":35},"end":{"row":18,"column":36},"action":"remove","lines":[" "],"id":68}],[{"start":{"row":18,"column":35},"end":{"row":18,"column":36},"action":"insert","lines":[" "],"id":69}],[{"start":{"row":18,"column":23},"end":{"row":18,"column":24},"action":"insert","lines":["<"],"id":70}],[{"start":{"row":18,"column":23},"end":{"row":18,"column":24},"action":"remove","lines":["<"],"id":71}],[{"start":{"row":18,"column":23},"end":{"row":19,"column":24},"action":"insert","lines":[""," "],"id":72}],[{"start":{"row":19,"column":70},"end":{"row":20,"column":0},"action":"insert","lines":["",""],"id":73},{"start":{"row":20,"column":0},"end":{"row":20,"column":24},"action":"insert","lines":[" "]}],[{"start":{"row":20,"column":20},"end":{"row":20,"column":24},"action":"remove","lines":[" "],"id":74}],[{"start":{"row":19,"column":24},"end":{"row":19,"column":25},"action":"insert","lines":["<"],"id":75}],[{"start":{"row":19,"column":25},"end":{"row":19,"column":26},"action":"insert","lines":["e"],"id":76}],[{"start":{"row":19,"column":26},"end":{"row":19,"column":27},"action":"insert","lines":["m"],"id":77}],[{"start":{"row":19,"column":27},"end":{"row":19,"column":28},"action":"insert","lines":["p"],"id":78}],[{"start":{"row":19,"column":27},"end":{"row":19,"column":28},"action":"remove","lines":["p"],"id":79}],[{"start":{"row":19,"column":27},"end":{"row":19,"column":33},"action":"insert","lines":[">"],"id":80}],[{"start":{"row":19,"column":28},"end":{"row":19,"column":33},"action":"remove","lines":[""],"id":81}],[{"start":{"row":19,"column":74},"end":{"row":19,"column":79},"action":"insert","lines":[""],"id":82}]]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":17,"column":25},"end":{"row":17,"column":25},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1445494691000,"hash":"e6057d83da0f86a3526bba068f419cba5737e7e5"} \ No newline at end of file diff --git a/.c9/metadata/workspace/YelpCamp/v9/views/landing.ejs b/.c9/metadata/workspace/YelpCamp/v9/views/landing.ejs deleted file mode 100644 index a0d6fd8c..00000000 --- a/.c9/metadata/workspace/YelpCamp/v9/views/landing.ejs +++ /dev/null @@ -1 +0,0 @@ -{"filter":false,"title":"landing.ejs","tooltip":"/YelpCamp/v9/views/landing.ejs","undoManager":{"mark":-1,"position":-1,"stack":[]},"ace":{"folds":[],"scrolltop":0,"scrollleft":0,"selection":{"start":{"row":0,"column":0},"end":{"row":0,"column":0},"isBackwards":false},"options":{"guessTabSize":true,"useWrapMode":false,"wrapToView":true},"firstLineState":0},"timestamp":1446332140074,"hash":"9892c547daaba2e3b2004bfb00c648761d1d340d"} \ No newline at end of file diff --git a/.c9/project.settings b/.c9/project.settings deleted file mode 100644 index 76e3bb6a..00000000 --- a/.c9/project.settings +++ /dev/null @@ -1,61 +0,0 @@ -{ - "ace": { - "@guessTabSize": "true", - "@newLineMode": "unix", - "@tabSize": "4", - "@useSoftTabs": "true" - }, - "build": { - "@builder": "auto", - "@path": "/.c9/builders", - "@saveall": true - }, - "find.nak": { - "@searchLimit": 100 - }, - "general": { - "@stripws": false - }, - "language": { - "@eslintrc": "true", - "@instanceHighlight": "true", - "@semi": "true", - "@undeclaredVars": "true", - "@unusedFunctionArgs": "false", - "@warnLevel": "info", - "tern_defs": { - "json()": { - "browser": { - "enabled": true - }, - "ecma5": { - "enabled": true - }, - "jQuery": { - "enabled": true - } - } - } - }, - "php": { - "@completion": true, - "@path": ".:./vendor" - }, - "python": { - "@completion": true, - "@path": "/usr/local/lib/python2.7/dist-packages:/usr/local/lib/python3.4/dist-packages:/usr/local/lib/python3.5/dist-packages", - "@version": "python2" - }, - "run": { - "@path": "/.c9/runners", - "configs": { - "@inited": "true", - "json()": {} - } - }, - "share": { - "@app": false, - "@preview": false, - "@useOwnerSettings": false - } -} \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..dbb46f68 --- /dev/null +++ b/.gitignore @@ -0,0 +1,35 @@ +# Node modules (ignore in all subdirectories) +**/node_modules/ + +# Cloud9 config folder +.c9/ + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# OS-specific +.DS_Store +Thumbs.db + +# Environment files +.env +.env.* + +# Editor folders/files +.vscode/ +.idea/ + +# npm package lock files +package-lock.json +yarn.lock + +# Build folders (if any) +dist/ +build/ + +# Optional: ignore all coverage reports +coverage/ diff --git a/APIs/node_modules/request/.eslintrc b/APIs/node_modules/request/.eslintrc deleted file mode 100644 index 5a594815..00000000 --- a/APIs/node_modules/request/.eslintrc +++ /dev/null @@ -1,45 +0,0 @@ -{ - "env": { - "node": true - }, - "rules": { - // 2-space indentation - "indent": [2, 2, {"SwitchCase": 1}], - // Disallow semi-colons, unless needed to disambiguate statement - "semi": [2, "never"], - // Require strings to use single quotes - "quotes": [2, "single"], - // Require curly braces for all control statements - "curly": 2, - // Disallow using variables and functions before they've been defined - "no-use-before-define": 2, - // Allow any case for variable naming - "camelcase": 0, - // Disallow unused variables, except as function arguments - "no-unused-vars": [2, {"args":"none"}], - // Allow leading underscores for method names - // REASON: we use underscores to denote private methods - "no-underscore-dangle": 0, - // Allow multi spaces around operators since they are - // used for alignment. This is not consistent in the - // code. - "no-multi-spaces": 0, - // Style rule is: most objects use { beforeColon: false, afterColon: true }, unless aligning which uses: - // - // { - // beforeColon : true, - // afterColon : true - // } - // - // eslint can't handle this, so the check is disabled. - "key-spacing": 0, - // Allow shadowing vars in outer scope (needs discussion) - "no-shadow": 0, - // Use if () { } - // ^ space - "keyword-spacing": [2, {"after": true}], - // Use if () { } - // ^ space - "space-before-blocks": [2, "always"] - } -} diff --git a/APIs/node_modules/request/.npmignore b/APIs/node_modules/request/.npmignore deleted file mode 100644 index 67fe11cc..00000000 --- a/APIs/node_modules/request/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -coverage -tests -node_modules -examples -release.sh -disabled.appveyor.yml diff --git a/APIs/node_modules/request/.travis.yml b/APIs/node_modules/request/.travis.yml deleted file mode 100644 index e5d9bde2..00000000 --- a/APIs/node_modules/request/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: node_js - -node_js: - - node - - 0.12 - - 0.10 - -after_script: - - npm run test-cov - - cat ./coverage/lcov.info | codecov - - cat ./coverage/lcov.info | coveralls - -webhooks: - urls: https://webhooks.gitter.im/e/237280ed4796c19cc626 - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: false # default: false - -sudo: false diff --git a/APIs/node_modules/request/CHANGELOG.md b/APIs/node_modules/request/CHANGELOG.md deleted file mode 100644 index ce6826f2..00000000 --- a/APIs/node_modules/request/CHANGELOG.md +++ /dev/null @@ -1,623 +0,0 @@ -## Change Log - -### v2.72.0 (2016/04/17) -- [#2176](https://github.com/request/request/pull/2176) Do not try to pipe Gzip responses with no body (@simov) -- [#2175](https://github.com/request/request/pull/2175) Add 'delete' alias for the 'del' API method (@simov, @MuhanZou) -- [#2172](https://github.com/request/request/pull/2172) Add support for deflate content encoding (@czardoz) -- [#2169](https://github.com/request/request/pull/2169) Add callback option (@simov) -- [#2165](https://github.com/request/request/pull/2165) Check for self.req existence inside the write method (@simov) -- [#2167](https://github.com/request/request/pull/2167) Fix TravisCI badge reference master branch (@a0viedo) - -### v2.71.0 (2016/04/12) -- [#2164](https://github.com/request/request/pull/2164) Catch errors from the underlying http module (@simov) - -### v2.70.0 (2016/04/05) -- [#2147](https://github.com/request/request/pull/2147) Update eslint to version 2.5.3 🚀 (@simov, @greenkeeperio-bot) -- [#2009](https://github.com/request/request/pull/2009) Support JSON stringify replacer argument. (@elyobo) -- [#2142](https://github.com/request/request/pull/2142) Update eslint to version 2.5.1 🚀 (@greenkeeperio-bot) -- [#2128](https://github.com/request/request/pull/2128) Update browserify-istanbul to version 2.0.0 🚀 (@greenkeeperio-bot) -- [#2115](https://github.com/request/request/pull/2115) Update eslint to version 2.3.0 🚀 (@simov, @greenkeeperio-bot) -- [#2089](https://github.com/request/request/pull/2089) Fix badges (@simov) -- [#2092](https://github.com/request/request/pull/2092) Update browserify-istanbul to version 1.0.0 🚀 (@greenkeeperio-bot) -- [#2079](https://github.com/request/request/pull/2079) Accept read stream as body option (@simov) -- [#2070](https://github.com/request/request/pull/2070) Update bl to version 1.1.2 🚀 (@greenkeeperio-bot) -- [#2063](https://github.com/request/request/pull/2063) Up bluebird and oauth-sign (@simov) -- [#2058](https://github.com/request/request/pull/2058) Karma fixes for latest versions (@eiriksm) -- [#2057](https://github.com/request/request/pull/2057) Update contributing guidelines (@simov) -- [#2054](https://github.com/request/request/pull/2054) Update qs to version 6.1.0 🚀 (@greenkeeperio-bot) - -### v2.69.0 (2016/01/27) -- [#2041](https://github.com/request/request/pull/2041) restore aws4 as regular dependency (@rmg) - -### v2.68.0 (2016/01/27) -- [#2036](https://github.com/request/request/pull/2036) Add AWS Signature Version 4 (@simov, @mirkods) -- [#2022](https://github.com/request/request/pull/2022) Convert numeric multipart bodies to string (@simov, @feross) -- [#2024](https://github.com/request/request/pull/2024) Update har-validator dependency for nsp advisory #76 (@TylerDixon) -- [#2016](https://github.com/request/request/pull/2016) Update qs to version 6.0.2 🚀 (@greenkeeperio-bot) -- [#2007](https://github.com/request/request/pull/2007) Use the `extend` module instead of util._extend (@simov) -- [#2003](https://github.com/request/request/pull/2003) Update browserify to version 13.0.0 🚀 (@greenkeeperio-bot) -- [#1989](https://github.com/request/request/pull/1989) Update buffer-equal to version 1.0.0 🚀 (@greenkeeperio-bot) -- [#1956](https://github.com/request/request/pull/1956) Check form-data content-length value before setting up the header (@jongyoonlee) -- [#1958](https://github.com/request/request/pull/1958) Use IncomingMessage.destroy method (@simov) -- [#1952](https://github.com/request/request/pull/1952) Adds example for Tor proxy (@prometheansacrifice) -- [#1943](https://github.com/request/request/pull/1943) Update eslint to version 1.10.3 🚀 (@simov, @greenkeeperio-bot) -- [#1924](https://github.com/request/request/pull/1924) Update eslint to version 1.10.1 🚀 (@greenkeeperio-bot) -- [#1915](https://github.com/request/request/pull/1915) Remove content-length and transfer-encoding headers from defaultProxyHeaderWhiteList (@yaxia) - -### v2.67.0 (2015/11/19) -- [#1913](https://github.com/request/request/pull/1913) Update http-signature to version 1.1.0 🚀 (@greenkeeperio-bot) - -### v2.66.0 (2015/11/18) -- [#1906](https://github.com/request/request/pull/1906) Update README URLs based on HTTP redirects (@ReadmeCritic) -- [#1905](https://github.com/request/request/pull/1905) Convert typed arrays into regular buffers (@simov) -- [#1902](https://github.com/request/request/pull/1902) node-uuid@1.4.7 breaks build 🚨 (@greenkeeperio-bot) -- [#1894](https://github.com/request/request/pull/1894) Fix tunneling after redirection from https (Original: #1881) (@simov, @falms) -- [#1893](https://github.com/request/request/pull/1893) Update eslint to version 1.9.0 🚀 (@greenkeeperio-bot) -- [#1852](https://github.com/request/request/pull/1852) Update eslint to version 1.7.3 🚀 (@simov, @greenkeeperio-bot, @paulomcnally, @michelsalib, @arbaaz, @vladimirich, @LoicMahieu, @JoshWillik, @jzaefferer, @ryanwholey, @djchie, @thisconnect, @mgenereu, @acroca, @Sebmaster, @Bloutiouf) -- [#1876](https://github.com/request/request/pull/1876) Implement loose matching for har mime types (@simov) -- [#1875](https://github.com/request/request/pull/1875) Update bluebird to version 3.0.2 🚀 (@simov, @greenkeeperio-bot) -- [#1871](https://github.com/request/request/pull/1871) Update browserify to version 12.0.1 🚀 (@greenkeeperio-bot) -- [#1866](https://github.com/request/request/pull/1866) Add missing quotes on x-token property in README (@miguelmota) -- [#1874](https://github.com/request/request/pull/1874) Fix typo in README.md (@gswalden) -- [#1860](https://github.com/request/request/pull/1860) Improve referer header tests and docs (@simov) -- [#1861](https://github.com/request/request/pull/1861) Remove redundant call to Stream constructor (@watson) -- [#1857](https://github.com/request/request/pull/1857) Fix Referer header to point to the original host name (@simov) -- [#1850](https://github.com/request/request/pull/1850) Update karma-coverage to version 0.5.3 🚀 (@greenkeeperio-bot) -- [#1847](https://github.com/request/request/pull/1847) Use node's latest version when building (@simov) -- [#1836](https://github.com/request/request/pull/1836) Tunnel: fix wrong property name (@Bloutiouf) -- [#1820](https://github.com/request/request/pull/1820) Set href as request.js uses it (@mgenereu) -- [#1840](https://github.com/request/request/pull/1840) Update http-signature to version 1.0.2 🚀 (@greenkeeperio-bot) -- [#1845](https://github.com/request/request/pull/1845) Update istanbul to version 0.4.0 🚀 (@greenkeeperio-bot) - -### v2.65.0 (2015/10/11) -- [#1833](https://github.com/request/request/pull/1833) Update aws-sign2 to version 0.6.0 🚀 (@greenkeeperio-bot) -- [#1811](https://github.com/request/request/pull/1811) Enable loose cookie parsing in tough-cookie (@Sebmaster) -- [#1830](https://github.com/request/request/pull/1830) Bring back tilde ranges for all dependencies (@simov) -- [#1821](https://github.com/request/request/pull/1821) Implement support for RFC 2617 MD5-sess algorithm. (@BigDSK) -- [#1828](https://github.com/request/request/pull/1828) Updated qs dependency to 5.2.0 (@acroca) -- [#1818](https://github.com/request/request/pull/1818) Extract `readResponseBody` method out of `onRequestResponse` (@pvoisin) -- [#1819](https://github.com/request/request/pull/1819) Run stringify once (@mgenereu) -- [#1814](https://github.com/request/request/pull/1814) Updated har-validator to version 2.0.2 (@greenkeeperio-bot) -- [#1807](https://github.com/request/request/pull/1807) Updated tough-cookie to version 2.1.0 (@greenkeeperio-bot) -- [#1800](https://github.com/request/request/pull/1800) Add caret ranges for devDependencies, except eslint (@simov) -- [#1799](https://github.com/request/request/pull/1799) Updated karma-browserify to version 4.4.0 (@greenkeeperio-bot) -- [#1797](https://github.com/request/request/pull/1797) Updated tape to version 4.2.0 (@greenkeeperio-bot) -- [#1788](https://github.com/request/request/pull/1788) Pinned all dependencies (@greenkeeperio-bot) - -### v2.64.0 (2015/09/25) -- [#1787](https://github.com/request/request/pull/1787) npm ignore examples, release.sh and disabled.appveyor.yml (@thisconnect) -- [#1775](https://github.com/request/request/pull/1775) Fix typo in README.md (@djchie) -- [#1776](https://github.com/request/request/pull/1776) Changed word 'conjuction' to read 'conjunction' in README.md (@ryanwholey) -- [#1785](https://github.com/request/request/pull/1785) Revert: Set default application/json content-type when using json option #1772 (@simov) - -### v2.63.0 (2015/09/21) -- [#1772](https://github.com/request/request/pull/1772) Set default application/json content-type when using json option (@jzaefferer) - -### v2.62.0 (2015/09/15) -- [#1768](https://github.com/request/request/pull/1768) Add node 4.0 to the list of build targets (@simov) -- [#1767](https://github.com/request/request/pull/1767) Query strings now cooperate with unix sockets (@JoshWillik) -- [#1750](https://github.com/request/request/pull/1750) Revert doc about installation of tough-cookie added in #884 (@LoicMahieu) -- [#1746](https://github.com/request/request/pull/1746) Missed comma in Readme (@vladimirich) -- [#1743](https://github.com/request/request/pull/1743) Fix options not being initialized in defaults method (@simov) - -### v2.61.0 (2015/08/19) -- [#1721](https://github.com/request/request/pull/1721) Minor fix in README.md (@arbaaz) -- [#1733](https://github.com/request/request/pull/1733) Avoid useless Buffer transformation (@michelsalib) -- [#1726](https://github.com/request/request/pull/1726) Update README.md (@paulomcnally) -- [#1715](https://github.com/request/request/pull/1715) Fix forever option in node > 0.10 #1709 (@calibr) -- [#1716](https://github.com/request/request/pull/1716) Do not create Buffer from Object in setContentLength(iojs v3.0 issue) (@calibr) -- [#1711](https://github.com/request/request/pull/1711) Add ability to detect connect timeouts (@kevinburke) -- [#1712](https://github.com/request/request/pull/1712) Set certificate expiration to August 2, 2018 (@kevinburke) -- [#1700](https://github.com/request/request/pull/1700) debug() when JSON.parse() on a response body fails (@phillipj) - -### v2.60.0 (2015/07/21) -- [#1687](https://github.com/request/request/pull/1687) Fix caseless bug - content-type not being set for multipart/form-data (@simov, @garymathews) - -### v2.59.0 (2015/07/20) -- [#1671](https://github.com/request/request/pull/1671) Add tests and docs for using the agent, agentClass, agentOptions and forever options. - Forever option defaults to using http(s).Agent in node 0.12+ (@simov) -- [#1679](https://github.com/request/request/pull/1679) Fix - do not remove OAuth param when using OAuth realm (@simov, @jhalickman) -- [#1668](https://github.com/request/request/pull/1668) updated dependencies (@deamme) -- [#1656](https://github.com/request/request/pull/1656) Fix form method (@simov) -- [#1651](https://github.com/request/request/pull/1651) Preserve HEAD method when using followAllRedirects (@simov) -- [#1652](https://github.com/request/request/pull/1652) Update `encoding` option documentation in README.md (@daniel347x) -- [#1650](https://github.com/request/request/pull/1650) Allow content-type overriding when using the `form` option (@simov) -- [#1646](https://github.com/request/request/pull/1646) Clarify the nature of setting `ca` in `agentOptions` (@jeffcharles) - -### v2.58.0 (2015/06/16) -- [#1638](https://github.com/request/request/pull/1638) Use the `extend` module to deep extend in the defaults method (@simov) -- [#1631](https://github.com/request/request/pull/1631) Move tunnel logic into separate module (@simov) -- [#1634](https://github.com/request/request/pull/1634) Fix OAuth query transport_method (@simov) -- [#1603](https://github.com/request/request/pull/1603) Add codecov (@simov) - -### v2.57.0 (2015/05/31) -- [#1615](https://github.com/request/request/pull/1615) Replace '.client' with '.socket' as the former was deprecated in 2.2.0. (@ChALkeR) - -### v2.56.0 (2015/05/28) -- [#1610](https://github.com/request/request/pull/1610) Bump module dependencies (@simov) -- [#1600](https://github.com/request/request/pull/1600) Extract the querystring logic into separate module (@simov) -- [#1607](https://github.com/request/request/pull/1607) Re-generate certificates (@simov) -- [#1599](https://github.com/request/request/pull/1599) Move getProxyFromURI logic below the check for Invaild URI (#1595) (@simov) -- [#1598](https://github.com/request/request/pull/1598) Fix the way http verbs are defined in order to please intellisense IDEs (@simov, @flannelJesus) -- [#1591](https://github.com/request/request/pull/1591) A few minor fixes: (@simov) -- [#1584](https://github.com/request/request/pull/1584) Refactor test-default tests (according to comments in #1430) (@simov) -- [#1585](https://github.com/request/request/pull/1585) Fixing documentation regarding TLS options (#1583) (@mainakae) -- [#1574](https://github.com/request/request/pull/1574) Refresh the oauth_nonce on redirect (#1573) (@simov) -- [#1570](https://github.com/request/request/pull/1570) Discovered tests that weren't properly running (@seanstrom) -- [#1569](https://github.com/request/request/pull/1569) Fix pause before response arrives (@kevinoid) -- [#1558](https://github.com/request/request/pull/1558) Emit error instead of throw (@simov) -- [#1568](https://github.com/request/request/pull/1568) Fix stall when piping gzipped response (@kevinoid) -- [#1560](https://github.com/request/request/pull/1560) Update combined-stream (@apechimp) -- [#1543](https://github.com/request/request/pull/1543) Initial support for oauth_body_hash on json payloads (@simov, @aesopwolf) -- [#1541](https://github.com/request/request/pull/1541) Fix coveralls (@simov) -- [#1540](https://github.com/request/request/pull/1540) Fix recursive defaults for convenience methods (@simov) -- [#1536](https://github.com/request/request/pull/1536) More eslint style rules (@froatsnook) -- [#1533](https://github.com/request/request/pull/1533) Adding dependency status bar to README.md (@YasharF) -- [#1539](https://github.com/request/request/pull/1539) ensure the latest version of har-validator is included (@ahmadnassri) -- [#1516](https://github.com/request/request/pull/1516) forever+pool test (@devTristan) - -### v2.55.0 (2015/04/05) -- [#1520](https://github.com/request/request/pull/1520) Refactor defaults (@simov) -- [#1525](https://github.com/request/request/pull/1525) Delete request headers with undefined value. (@froatsnook) -- [#1521](https://github.com/request/request/pull/1521) Add promise tests (@simov) -- [#1518](https://github.com/request/request/pull/1518) Fix defaults (@simov) -- [#1515](https://github.com/request/request/pull/1515) Allow static invoking of convenience methods (@simov) -- [#1505](https://github.com/request/request/pull/1505) Fix multipart boundary extraction regexp (@simov) -- [#1510](https://github.com/request/request/pull/1510) Fix basic auth form data (@simov) - -### v2.54.0 (2015/03/24) -- [#1501](https://github.com/request/request/pull/1501) HTTP Archive 1.2 support (@ahmadnassri) -- [#1486](https://github.com/request/request/pull/1486) Add a test for the forever agent (@akshayp) -- [#1500](https://github.com/request/request/pull/1500) Adding handling for no auth method and null bearer (@philberg) -- [#1498](https://github.com/request/request/pull/1498) Add table of contents in readme (@simov) -- [#1477](https://github.com/request/request/pull/1477) Add support for qs options via qsOptions key (@simov) -- [#1496](https://github.com/request/request/pull/1496) Parameters encoded to base 64 should be decoded as UTF-8, not ASCII. (@albanm) -- [#1494](https://github.com/request/request/pull/1494) Update eslint (@froatsnook) -- [#1474](https://github.com/request/request/pull/1474) Require Colon in Basic Auth (@erykwalder) -- [#1481](https://github.com/request/request/pull/1481) Fix baseUrl and redirections. (@burningtree) -- [#1469](https://github.com/request/request/pull/1469) Feature/base url (@froatsnook) -- [#1459](https://github.com/request/request/pull/1459) Add option to time request/response cycle (including rollup of redirects) (@aaron-em) -- [#1468](https://github.com/request/request/pull/1468) Re-enable io.js/node 0.12 build (@simov, @mikeal, @BBB) -- [#1442](https://github.com/request/request/pull/1442) Fixed the issue with strictSSL tests on 0.12 & io.js by explicitly setting a cipher that matches the cert. (@BBB, @nicolasmccurdy, @demohi, @simov, @0x4139) -- [#1460](https://github.com/request/request/pull/1460) localAddress or proxy config is lost when redirecting (@simov, @0x4139) -- [#1453](https://github.com/request/request/pull/1453) Test on Node.js 0.12 and io.js with allowed failures (@nicolasmccurdy, @demohi) -- [#1426](https://github.com/request/request/pull/1426) Fixing tests to pass on io.js and node 0.12 (only test-https.js stiff failing) (@mikeal) -- [#1446](https://github.com/request/request/pull/1446) Missing HTTP referer header with redirects Fixes #1038 (@simov, @guimonz) -- [#1428](https://github.com/request/request/pull/1428) Deprecate Node v0.8.x (@nylen) -- [#1436](https://github.com/request/request/pull/1436) Add ability to set a requester without setting default options (@tikotzky) -- [#1435](https://github.com/request/request/pull/1435) dry up verb methods (@sethpollack) -- [#1423](https://github.com/request/request/pull/1423) Allow fully qualified multipart content-type header (@simov) -- [#1430](https://github.com/request/request/pull/1430) Fix recursive requester (@tikotzky) -- [#1429](https://github.com/request/request/pull/1429) Throw error when making HEAD request with a body (@tikotzky) -- [#1419](https://github.com/request/request/pull/1419) Add note that the project is broken in 0.12.x (@nylen) -- [#1413](https://github.com/request/request/pull/1413) Fix basic auth (@simov) -- [#1397](https://github.com/request/request/pull/1397) Improve pipe-from-file tests (@nylen) - -### v2.53.0 (2015/02/02) -- [#1396](https://github.com/request/request/pull/1396) Do not rfc3986 escape JSON bodies (@nylen, @simov) -- [#1392](https://github.com/request/request/pull/1392) Improve `timeout` option description (@watson) - -### v2.52.0 (2015/02/02) -- [#1383](https://github.com/request/request/pull/1383) Add missing HTTPS options that were not being passed to tunnel (@brichard19) (@nylen) -- [#1388](https://github.com/request/request/pull/1388) Upgrade mime-types package version (@roderickhsiao) -- [#1389](https://github.com/request/request/pull/1389) Revise Setup Tunnel Function (@seanstrom) -- [#1374](https://github.com/request/request/pull/1374) Allow explicitly disabling tunneling for proxied https destinations (@nylen) -- [#1376](https://github.com/request/request/pull/1376) Use karma-browserify for tests. Add browser test coverage reporter. (@eiriksm) -- [#1366](https://github.com/request/request/pull/1366) Refactor OAuth into separate module (@simov) -- [#1373](https://github.com/request/request/pull/1373) Rewrite tunnel test to be pure Node.js (@nylen) -- [#1371](https://github.com/request/request/pull/1371) Upgrade test reporter (@nylen) -- [#1360](https://github.com/request/request/pull/1360) Refactor basic, bearer, digest auth logic into separate class (@simov) -- [#1354](https://github.com/request/request/pull/1354) Remove circular dependency from debugging code (@nylen) -- [#1351](https://github.com/request/request/pull/1351) Move digest auth into private prototype method (@simov) -- [#1352](https://github.com/request/request/pull/1352) Update hawk dependency to ~2.3.0 (@mridgway) -- [#1353](https://github.com/request/request/pull/1353) Correct travis-ci badge (@dogancelik) -- [#1349](https://github.com/request/request/pull/1349) Make sure we return on errored browser requests. (@eiriksm) -- [#1346](https://github.com/request/request/pull/1346) getProxyFromURI Extraction Refactor (@seanstrom) -- [#1337](https://github.com/request/request/pull/1337) Standardize test ports on 6767 (@nylen) -- [#1341](https://github.com/request/request/pull/1341) Emit FormData error events as Request error events (@nylen, @rwky) -- [#1343](https://github.com/request/request/pull/1343) Clean up readme badges, and add Travis and Coveralls badges (@nylen) -- [#1345](https://github.com/request/request/pull/1345) Update README.md (@Aaron-Hartwig) -- [#1338](https://github.com/request/request/pull/1338) Always wait for server.close() callback in tests (@nylen) -- [#1342](https://github.com/request/request/pull/1342) Add mock https server and redo start of browser tests for this purpose. (@eiriksm) -- [#1339](https://github.com/request/request/pull/1339) Improve auth docs (@nylen) -- [#1335](https://github.com/request/request/pull/1335) Add support for OAuth plaintext signature method (@simov) -- [#1332](https://github.com/request/request/pull/1332) Add clean script to remove test-browser.js after the tests run (@seanstrom) -- [#1327](https://github.com/request/request/pull/1327) Fix errors generating coverage reports. (@nylen) -- [#1330](https://github.com/request/request/pull/1330) Return empty buffer upon empty response body and encoding is set to null (@seanstrom) -- [#1326](https://github.com/request/request/pull/1326) Use faster container-based infrastructure on Travis (@nylen) -- [#1315](https://github.com/request/request/pull/1315) Implement rfc3986 option (@simov, @nylen, @apoco, @DullReferenceException, @mmalecki, @oliamb, @cliffcrosland, @LewisJEllis, @eiriksm, @poislagarde) -- [#1314](https://github.com/request/request/pull/1314) Detect urlencoded form data header via regex (@simov) -- [#1317](https://github.com/request/request/pull/1317) Improve OAuth1.0 server side flow example (@simov) - -### v2.51.0 (2014/12/10) -- [#1310](https://github.com/request/request/pull/1310) Revert changes introduced in https://github.com/request/request/pull/1282 (@simov) - -### v2.50.0 (2014/12/09) -- [#1308](https://github.com/request/request/pull/1308) Add browser test to keep track of browserify compability. (@eiriksm) -- [#1299](https://github.com/request/request/pull/1299) Add optional support for jsonReviver (@poislagarde) -- [#1277](https://github.com/request/request/pull/1277) Add Coveralls configuration (@simov) -- [#1307](https://github.com/request/request/pull/1307) Upgrade form-data, add back browserify compability. Fixes #455. (@eiriksm) -- [#1305](https://github.com/request/request/pull/1305) Fix typo in README.md (@LewisJEllis) -- [#1288](https://github.com/request/request/pull/1288) Update README.md to explain custom file use case (@cliffcrosland) - -### v2.49.0 (2014/11/28) -- [#1295](https://github.com/request/request/pull/1295) fix(proxy): no-proxy false positive (@oliamb) -- [#1292](https://github.com/request/request/pull/1292) Upgrade `caseless` to 0.8.1 (@mmalecki) -- [#1276](https://github.com/request/request/pull/1276) Set transfer encoding for multipart/related to chunked by default (@simov) -- [#1275](https://github.com/request/request/pull/1275) Fix multipart content-type headers detection (@simov) -- [#1269](https://github.com/request/request/pull/1269) adds streams example for review (@tbuchok) -- [#1238](https://github.com/request/request/pull/1238) Add examples README.md (@simov) - -### v2.48.0 (2014/11/12) -- [#1263](https://github.com/request/request/pull/1263) Fixed a syntax error / typo in README.md (@xna2) -- [#1253](https://github.com/request/request/pull/1253) Add multipart chunked flag (@simov, @nylen) -- [#1251](https://github.com/request/request/pull/1251) Clarify that defaults() does not modify global defaults (@nylen) -- [#1250](https://github.com/request/request/pull/1250) Improve documentation for pool and maxSockets options (@nylen) -- [#1237](https://github.com/request/request/pull/1237) Documenting error handling when using streams (@vmattos) -- [#1244](https://github.com/request/request/pull/1244) Finalize changelog command (@nylen) -- [#1241](https://github.com/request/request/pull/1241) Fix typo (@alexanderGugel) -- [#1223](https://github.com/request/request/pull/1223) Show latest version number instead of "upcoming" in changelog (@nylen) -- [#1236](https://github.com/request/request/pull/1236) Document how to use custom CA in README (#1229) (@hypesystem) -- [#1228](https://github.com/request/request/pull/1228) Support for oauth with RSA-SHA1 signing (@nylen) -- [#1216](https://github.com/request/request/pull/1216) Made json and multipart options coexist (@nylen, @simov) -- [#1225](https://github.com/request/request/pull/1225) Allow header white/exclusive lists in any case. (@RReverser) - -### v2.47.0 (2014/10/26) -- [#1222](https://github.com/request/request/pull/1222) Move from mikeal/request to request/request (@nylen) -- [#1220](https://github.com/request/request/pull/1220) update qs dependency to 2.3.1 (@FredKSchott) -- [#1212](https://github.com/request/request/pull/1212) Improve tests/test-timeout.js (@nylen) -- [#1219](https://github.com/request/request/pull/1219) remove old globalAgent workaround for node 0.4 (@request) -- [#1214](https://github.com/request/request/pull/1214) Remove cruft left over from optional dependencies (@nylen) -- [#1215](https://github.com/request/request/pull/1215) Add proxyHeaderExclusiveList option for proxy-only headers. (@RReverser) -- [#1211](https://github.com/request/request/pull/1211) Allow 'Host' header instead of 'host' and remember case across redirects (@nylen) -- [#1208](https://github.com/request/request/pull/1208) Improve release script (@nylen) -- [#1213](https://github.com/request/request/pull/1213) Support for custom cookie store (@nylen, @mitsuru) -- [#1197](https://github.com/request/request/pull/1197) Clean up some code around setting the agent (@FredKSchott) -- [#1209](https://github.com/request/request/pull/1209) Improve multipart form append test (@simov) -- [#1207](https://github.com/request/request/pull/1207) Update changelog (@nylen) -- [#1185](https://github.com/request/request/pull/1185) Stream multipart/related bodies (@simov) - -### v2.46.0 (2014/10/23) -- [#1198](https://github.com/request/request/pull/1198) doc for TLS/SSL protocol options (@shawnzhu) -- [#1200](https://github.com/request/request/pull/1200) Add a Gitter chat badge to README.md (@gitter-badger) -- [#1196](https://github.com/request/request/pull/1196) Upgrade taper test reporter to v0.3.0 (@nylen) -- [#1199](https://github.com/request/request/pull/1199) Fix lint error: undeclared var i (@nylen) -- [#1191](https://github.com/request/request/pull/1191) Move self.proxy decision logic out of init and into a helper (@FredKSchott) -- [#1190](https://github.com/request/request/pull/1190) Move _buildRequest() logic back into init (@FredKSchott) -- [#1186](https://github.com/request/request/pull/1186) Support Smarter Unix URL Scheme (@FredKSchott) -- [#1178](https://github.com/request/request/pull/1178) update form documentation for new usage (@FredKSchott) -- [#1180](https://github.com/request/request/pull/1180) Enable no-mixed-requires linting rule (@nylen) -- [#1184](https://github.com/request/request/pull/1184) Don't forward authorization header across redirects to different hosts (@nylen) -- [#1183](https://github.com/request/request/pull/1183) Correct README about pre and postamble CRLF using multipart and not mult... (@netpoetica) -- [#1179](https://github.com/request/request/pull/1179) Lint tests directory (@nylen) -- [#1169](https://github.com/request/request/pull/1169) add metadata for form-data file field (@dotcypress) -- [#1173](https://github.com/request/request/pull/1173) remove optional dependencies (@seanstrom) -- [#1165](https://github.com/request/request/pull/1165) Cleanup event listeners and remove function creation from init (@FredKSchott) -- [#1174](https://github.com/request/request/pull/1174) update the request.cookie docs to have a valid cookie example (@seanstrom) -- [#1168](https://github.com/request/request/pull/1168) create a detach helper and use detach helper in replace of nextTick (@seanstrom) -- [#1171](https://github.com/request/request/pull/1171) in post can send form data and use callback (@MiroRadenovic) -- [#1159](https://github.com/request/request/pull/1159) accept charset for x-www-form-urlencoded content-type (@seanstrom) -- [#1157](https://github.com/request/request/pull/1157) Update README.md: body with json=true (@Rob--W) -- [#1164](https://github.com/request/request/pull/1164) Disable tests/test-timeout.js on Travis (@nylen) -- [#1153](https://github.com/request/request/pull/1153) Document how to run a single test (@nylen) -- [#1144](https://github.com/request/request/pull/1144) adds documentation for the "response" event within the streaming section (@tbuchok) -- [#1162](https://github.com/request/request/pull/1162) Update eslintrc file to no longer allow past errors (@FredKSchott) -- [#1155](https://github.com/request/request/pull/1155) Support/use self everywhere (@seanstrom) -- [#1161](https://github.com/request/request/pull/1161) fix no-use-before-define lint warnings (@emkay) -- [#1156](https://github.com/request/request/pull/1156) adding curly brackets to get rid of lint errors (@emkay) -- [#1151](https://github.com/request/request/pull/1151) Fix localAddress test on OS X (@nylen) -- [#1145](https://github.com/request/request/pull/1145) documentation: fix outdated reference to setCookieSync old name in README (@FredKSchott) -- [#1131](https://github.com/request/request/pull/1131) Update pool documentation (@FredKSchott) -- [#1143](https://github.com/request/request/pull/1143) Rewrite all tests to use tape (@nylen) -- [#1137](https://github.com/request/request/pull/1137) Add ability to specifiy querystring lib in options. (@jgrund) -- [#1138](https://github.com/request/request/pull/1138) allow hostname and port in place of host on uri (@cappslock) -- [#1134](https://github.com/request/request/pull/1134) Fix multiple redirects and `self.followRedirect` (@blakeembrey) -- [#1130](https://github.com/request/request/pull/1130) documentation fix: add note about npm test for contributing (@FredKSchott) -- [#1120](https://github.com/request/request/pull/1120) Support/refactor request setup tunnel (@seanstrom) -- [#1129](https://github.com/request/request/pull/1129) linting fix: convert double quote strings to use single quotes (@FredKSchott) -- [#1124](https://github.com/request/request/pull/1124) linting fix: remove unneccesary semi-colons (@FredKSchott) - -### v2.45.0 (2014/10/06) -- [#1128](https://github.com/request/request/pull/1128) Add test for setCookie regression (@nylen) -- [#1127](https://github.com/request/request/pull/1127) added tests around using objects as values in a query string (@bcoe) -- [#1103](https://github.com/request/request/pull/1103) Support/refactor request constructor (@nylen, @seanstrom) -- [#1119](https://github.com/request/request/pull/1119) add basic linting to request library (@FredKSchott) -- [#1121](https://github.com/request/request/pull/1121) Revert "Explicitly use sync versions of cookie functions" (@nylen) -- [#1118](https://github.com/request/request/pull/1118) linting fix: Restructure bad empty if statement (@FredKSchott) -- [#1117](https://github.com/request/request/pull/1117) Fix a bad check for valid URIs (@FredKSchott) -- [#1113](https://github.com/request/request/pull/1113) linting fix: space out operators (@FredKSchott) -- [#1116](https://github.com/request/request/pull/1116) Fix typo in `noProxyHost` definition (@FredKSchott) -- [#1114](https://github.com/request/request/pull/1114) linting fix: Added a `new` operator that was missing when creating and throwing a new error (@FredKSchott) -- [#1096](https://github.com/request/request/pull/1096) No_proxy support (@samcday) -- [#1107](https://github.com/request/request/pull/1107) linting-fix: remove unused variables (@FredKSchott) -- [#1112](https://github.com/request/request/pull/1112) linting fix: Make return values consistent and more straitforward (@FredKSchott) -- [#1111](https://github.com/request/request/pull/1111) linting fix: authPieces was getting redeclared (@FredKSchott) -- [#1105](https://github.com/request/request/pull/1105) Use strict mode in request (@FredKSchott) -- [#1110](https://github.com/request/request/pull/1110) linting fix: replace lazy '==' with more strict '===' (@FredKSchott) -- [#1109](https://github.com/request/request/pull/1109) linting fix: remove function call from if-else conditional statement (@FredKSchott) -- [#1102](https://github.com/request/request/pull/1102) Fix to allow setting a `requester` on recursive calls to `request.defaults` (@tikotzky) -- [#1095](https://github.com/request/request/pull/1095) Tweaking engines in package.json (@pdehaan) -- [#1082](https://github.com/request/request/pull/1082) Forward the socket event from the httpModule request (@seanstrom) -- [#972](https://github.com/request/request/pull/972) Clarify gzip handling in the README (@kevinoid) -- [#1089](https://github.com/request/request/pull/1089) Mention that encoding defaults to utf8, not Buffer (@stuartpb) -- [#1088](https://github.com/request/request/pull/1088) Fix cookie example in README.md and make it more clear (@pipi32167) -- [#1027](https://github.com/request/request/pull/1027) Add support for multipart form data in request options. (@crocket) -- [#1076](https://github.com/request/request/pull/1076) use Request.abort() to abort the request when the request has timed-out (@seanstrom) -- [#1068](https://github.com/request/request/pull/1068) add optional postamble required by .NET multipart requests (@netpoetica) - -### v2.43.0 (2014/09/18) -- [#1057](https://github.com/request/request/pull/1057) Defaults should not overwrite defined options (@davidwood) -- [#1046](https://github.com/request/request/pull/1046) Propagate datastream errors, useful in case gzip fails. (@ZJONSSON, @Janpot) -- [#1063](https://github.com/request/request/pull/1063) copy the input headers object #1060 (@finnp) -- [#1031](https://github.com/request/request/pull/1031) Explicitly use sync versions of cookie functions (@ZJONSSON) -- [#1056](https://github.com/request/request/pull/1056) Fix redirects when passing url.parse(x) as URL to convenience method (@nylen) - -### v2.42.0 (2014/09/04) -- [#1053](https://github.com/request/request/pull/1053) Fix #1051 Parse auth properly when using non-tunneling proxy (@isaacs) - -### v2.41.0 (2014/09/04) -- [#1050](https://github.com/request/request/pull/1050) Pass whitelisted headers to tunneling proxy. Organize all tunneling logic. (@isaacs, @Feldhacker) -- [#1035](https://github.com/request/request/pull/1035) souped up nodei.co badge (@rvagg) -- [#1048](https://github.com/request/request/pull/1048) Aws is now possible over a proxy (@steven-aerts) -- [#1039](https://github.com/request/request/pull/1039) extract out helper functions to a helper file (@seanstrom) -- [#1021](https://github.com/request/request/pull/1021) Support/refactor indexjs (@seanstrom) -- [#1033](https://github.com/request/request/pull/1033) Improve and document debug options (@nylen) -- [#1034](https://github.com/request/request/pull/1034) Fix readme headings (@nylen) -- [#1030](https://github.com/request/request/pull/1030) Allow recursive request.defaults (@tikotzky) -- [#1029](https://github.com/request/request/pull/1029) Fix a couple of typos (@nylen) -- [#675](https://github.com/request/request/pull/675) Checking for SSL fault on connection before reading SSL properties (@VRMink) -- [#989](https://github.com/request/request/pull/989) Added allowRedirect function. Should return true if redirect is allowed or false otherwise (@doronin) -- [#1025](https://github.com/request/request/pull/1025) [fixes #1023] Set self._ended to true once response has ended (@mridgway) -- [#1020](https://github.com/request/request/pull/1020) Add back removed debug metadata (@FredKSchott) -- [#1008](https://github.com/request/request/pull/1008) Moving to module instead of cutomer buffer concatenation. (@mikeal) -- [#770](https://github.com/request/request/pull/770) Added dependency badge for README file; (@timgluz, @mafintosh, @lalitkapoor, @stash, @bobyrizov) -- [#1016](https://github.com/request/request/pull/1016) toJSON no longer results in an infinite loop, returns simple objects (@FredKSchott) -- [#1018](https://github.com/request/request/pull/1018) Remove pre-0.4.4 HTTPS fix (@mmalecki) -- [#1006](https://github.com/request/request/pull/1006) Migrate to caseless, fixes #1001 (@mikeal) -- [#995](https://github.com/request/request/pull/995) Fix parsing array of objects (@sjonnet19) -- [#999](https://github.com/request/request/pull/999) Fix fallback for browserify for optional modules. (@eiriksm) -- [#996](https://github.com/request/request/pull/996) Wrong oauth signature when multiple same param keys exist [updated] (@bengl, @hyjin) - -### v2.40.0 (2014/08/06) -- [#992](https://github.com/request/request/pull/992) Fix security vulnerability. Update qs (@poeticninja) -- [#988](https://github.com/request/request/pull/988) “--” -> “—” (@upisfree) -- [#987](https://github.com/request/request/pull/987) Show optional modules as being loaded by the module that reqeusted them (@iarna) - -### v2.39.0 (2014/07/24) -- [#976](https://github.com/request/request/pull/976) Update README.md (@pvoznenko) - -### v2.38.0 (2014/07/22) -- [#952](https://github.com/request/request/pull/952) Adding support to client certificate with proxy use case (@ofirshaked) -- [#884](https://github.com/request/request/pull/884) Documented tough-cookie installation. (@wbyoung) -- [#935](https://github.com/request/request/pull/935) Correct repository url (@fritx) -- [#963](https://github.com/request/request/pull/963) Update changelog (@nylen) -- [#960](https://github.com/request/request/pull/960) Support gzip with encoding on node pre-v0.9.4 (@kevinoid) -- [#953](https://github.com/request/request/pull/953) Add async Content-Length computation when using form-data (@LoicMahieu) -- [#844](https://github.com/request/request/pull/844) Add support for HTTP[S]_PROXY environment variables. Fixes #595. (@jvmccarthy) -- [#946](https://github.com/request/request/pull/946) defaults: merge headers (@aj0strow) - -### v2.37.0 (2014/07/07) -- [#957](https://github.com/request/request/pull/957) Silence EventEmitter memory leak warning #311 (@watson) -- [#955](https://github.com/request/request/pull/955) check for content-length header before setting it in nextTick (@camilleanne) -- [#951](https://github.com/request/request/pull/951) Add support for gzip content decoding (@kevinoid) -- [#949](https://github.com/request/request/pull/949) Manually enter querystring in form option (@charlespwd) -- [#944](https://github.com/request/request/pull/944) Make request work with browserify (@eiriksm) -- [#943](https://github.com/request/request/pull/943) New mime module (@eiriksm) -- [#927](https://github.com/request/request/pull/927) Bump version of hawk dep. (@samccone) -- [#907](https://github.com/request/request/pull/907) append secureOptions to poolKey (@medovob) - -### v2.35.0 (2014/05/17) -- [#901](https://github.com/request/request/pull/901) Fixes #555 (@pigulla) -- [#897](https://github.com/request/request/pull/897) merge with default options (@vohof) -- [#891](https://github.com/request/request/pull/891) fixes 857 - options object is mutated by calling request (@lalitkapoor) -- [#869](https://github.com/request/request/pull/869) Pipefilter test (@tgohn) -- [#866](https://github.com/request/request/pull/866) Fix typo (@dandv) -- [#861](https://github.com/request/request/pull/861) Add support for RFC 6750 Bearer Tokens (@phedny) -- [#809](https://github.com/request/request/pull/809) upgrade tunnel-proxy to 0.4.0 (@ksato9700) -- [#850](https://github.com/request/request/pull/850) Fix word consistency in readme (@0xNobody) -- [#810](https://github.com/request/request/pull/810) add some exposition to mpu example in README.md (@mikermcneil) -- [#840](https://github.com/request/request/pull/840) improve error reporting for invalid protocols (@FND) -- [#821](https://github.com/request/request/pull/821) added secureOptions back (@nw) -- [#815](https://github.com/request/request/pull/815) Create changelog based on pull requests (@lalitkapoor) - -### v2.34.0 (2014/02/18) -- [#516](https://github.com/request/request/pull/516) UNIX Socket URL Support (@lyuzashi) -- [#801](https://github.com/request/request/pull/801) 794 ignore cookie parsing and domain errors (@lalitkapoor) -- [#802](https://github.com/request/request/pull/802) Added the Apache license to the package.json. (@keskival) -- [#793](https://github.com/request/request/pull/793) Adds content-length calculation when submitting forms using form-data li... (@Juul) -- [#785](https://github.com/request/request/pull/785) Provide ability to override content-type when `json` option used (@vvo) -- [#781](https://github.com/request/request/pull/781) simpler isReadStream function (@joaojeronimo) - -### v2.32.0 (2014/01/16) -- [#767](https://github.com/request/request/pull/767) Use tough-cookie CookieJar sync API (@stash) -- [#764](https://github.com/request/request/pull/764) Case-insensitive authentication scheme (@bobyrizov) -- [#763](https://github.com/request/request/pull/763) Upgrade tough-cookie to 0.10.0 (@stash) -- [#744](https://github.com/request/request/pull/744) Use Cookie.parse (@lalitkapoor) -- [#757](https://github.com/request/request/pull/757) require aws-sign2 (@mafintosh) - -### v2.31.0 (2014/01/08) -- [#645](https://github.com/request/request/pull/645) update twitter api url to v1.1 (@mick) -- [#746](https://github.com/request/request/pull/746) README: Markdown code highlight (@weakish) -- [#745](https://github.com/request/request/pull/745) updating setCookie example to make it clear that the callback is required (@emkay) -- [#742](https://github.com/request/request/pull/742) Add note about JSON output body type (@iansltx) -- [#741](https://github.com/request/request/pull/741) README example is using old cookie jar api (@emkay) -- [#736](https://github.com/request/request/pull/736) Fix callback arguments documentation (@mmalecki) - -### v2.30.0 (2013/12/13) -- [#732](https://github.com/request/request/pull/732) JSHINT: Creating global 'for' variable. Should be 'for (var ...'. (@Fritz-Lium) -- [#730](https://github.com/request/request/pull/730) better HTTP DIGEST support (@dai-shi) -- [#728](https://github.com/request/request/pull/728) Fix TypeError when calling request.cookie (@scarletmeow) - -### v2.29.0 (2013/12/06) -- [#727](https://github.com/request/request/pull/727) fix requester bug (@jchris) - -### v2.28.0 (2013/12/04) -- [#724](https://github.com/request/request/pull/724) README.md: add custom HTTP Headers example. (@tcort) -- [#719](https://github.com/request/request/pull/719) Made a comment gender neutral. (@unsetbit) -- [#715](https://github.com/request/request/pull/715) Request.multipart no longer crashes when header 'Content-type' present (@pastaclub) -- [#710](https://github.com/request/request/pull/710) Fixing listing in callback part of docs. (@lukasz-zak) -- [#696](https://github.com/request/request/pull/696) Edited README.md for formatting and clarity of phrasing (@Zearin) -- [#694](https://github.com/request/request/pull/694) Typo in README (@VRMink) -- [#690](https://github.com/request/request/pull/690) Handle blank password in basic auth. (@diversario) -- [#682](https://github.com/request/request/pull/682) Optional dependencies (@Turbo87) -- [#683](https://github.com/request/request/pull/683) Travis CI support (@Turbo87) -- [#674](https://github.com/request/request/pull/674) change cookie module,to tough-cookie.please check it . (@sxyizhiren) -- [#666](https://github.com/request/request/pull/666) make `ciphers` and `secureProtocol` to work in https request (@richarddong) -- [#656](https://github.com/request/request/pull/656) Test case for #304. (@diversario) -- [#662](https://github.com/request/request/pull/662) option.tunnel to explicitly disable tunneling (@seanmonstar) -- [#659](https://github.com/request/request/pull/659) fix failure when running with NODE_DEBUG=request, and a test for that (@jrgm) -- [#630](https://github.com/request/request/pull/630) Send random cnonce for HTTP Digest requests (@wprl) - -### v2.27.0 (2013/08/15) -- [#619](https://github.com/request/request/pull/619) decouple things a bit (@joaojeronimo) - -### v2.26.0 (2013/08/07) -- [#613](https://github.com/request/request/pull/613) Fixes #583, moved initialization of self.uri.pathname (@lexander) -- [#605](https://github.com/request/request/pull/605) Only include ":" + pass in Basic Auth if it's defined (fixes #602) (@bendrucker) - -### v2.24.0 (2013/07/23) -- [#596](https://github.com/request/request/pull/596) Global agent is being used when pool is specified (@Cauldrath) -- [#594](https://github.com/request/request/pull/594) Emit complete event when there is no callback (@RomainLK) -- [#601](https://github.com/request/request/pull/601) Fixed a small typo (@michalstanko) - -### v2.23.0 (2013/07/23) -- [#589](https://github.com/request/request/pull/589) Prevent setting headers after they are sent (@geek) -- [#587](https://github.com/request/request/pull/587) Global cookie jar disabled by default (@threepointone) - -### v2.22.0 (2013/07/05) -- [#544](https://github.com/request/request/pull/544) Update http-signature version. (@davidlehn) -- [#581](https://github.com/request/request/pull/581) Fix spelling of "ignoring." (@bigeasy) -- [#568](https://github.com/request/request/pull/568) use agentOptions to create agent when specified in request (@SamPlacette) -- [#564](https://github.com/request/request/pull/564) Fix redirections (@criloz) -- [#541](https://github.com/request/request/pull/541) The exported request function doesn't have an auth method (@tschaub) -- [#542](https://github.com/request/request/pull/542) Expose Request class (@regality) - -### v2.21.0 (2013/04/30) -- [#536](https://github.com/request/request/pull/536) Allow explicitly empty user field for basic authentication. (@mikeando) -- [#532](https://github.com/request/request/pull/532) fix typo (@fredericosilva) -- [#497](https://github.com/request/request/pull/497) Added redirect event (@Cauldrath) -- [#503](https://github.com/request/request/pull/503) Fix basic auth for passwords that contain colons (@tonistiigi) -- [#521](https://github.com/request/request/pull/521) Improving test-localAddress.js (@noway421) -- [#529](https://github.com/request/request/pull/529) dependencies versions bump (@jodaka) - -### v2.20.0 (2013/04/22) -- [#523](https://github.com/request/request/pull/523) Updating dependencies (@noway421) -- [#520](https://github.com/request/request/pull/520) Fixing test-tunnel.js (@noway421) -- [#519](https://github.com/request/request/pull/519) Update internal path state on post-creation QS changes (@jblebrun) -- [#510](https://github.com/request/request/pull/510) Add HTTP Signature support. (@davidlehn) -- [#502](https://github.com/request/request/pull/502) Fix POST (and probably other) requests that are retried after 401 Unauthorized (@nylen) -- [#508](https://github.com/request/request/pull/508) Honor the .strictSSL option when using proxies (tunnel-agent) (@jhs) -- [#512](https://github.com/request/request/pull/512) Make password optional to support the format: http://username@hostname/ (@pajato1) -- [#513](https://github.com/request/request/pull/513) add 'localAddress' support (@yyfrankyy) -- [#498](https://github.com/request/request/pull/498) Moving response emit above setHeaders on destination streams (@kenperkins) -- [#490](https://github.com/request/request/pull/490) Empty response body (3-rd argument) must be passed to callback as an empty string (@Olegas) -- [#479](https://github.com/request/request/pull/479) Changing so if Accept header is explicitly set, sending json does not ov... (@RoryH) -- [#475](https://github.com/request/request/pull/475) Use `unescape` from `querystring` (@shimaore) -- [#473](https://github.com/request/request/pull/473) V0.10 compat (@isaacs) -- [#471](https://github.com/request/request/pull/471) Using querystring library from visionmedia (@kbackowski) -- [#461](https://github.com/request/request/pull/461) Strip the UTF8 BOM from a UTF encoded response (@kppullin) -- [#460](https://github.com/request/request/pull/460) hawk 0.10.0 (@hueniverse) -- [#462](https://github.com/request/request/pull/462) if query params are empty, then request path shouldn't end with a '?' (merges cleanly now) (@jaipandya) -- [#456](https://github.com/request/request/pull/456) hawk 0.9.0 (@hueniverse) -- [#429](https://github.com/request/request/pull/429) Copy options before adding callback. (@nrn, @nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) -- [#454](https://github.com/request/request/pull/454) Destroy the response if present when destroying the request (clean merge) (@mafintosh) -- [#310](https://github.com/request/request/pull/310) Twitter Oauth Stuff Out of Date; Now Updated (@joemccann, @isaacs, @mscdex) -- [#413](https://github.com/request/request/pull/413) rename googledoodle.png to .jpg (@nfriedly, @youurayy, @jplock, @kapetan, @landeiro, @othiym23, @mmalecki) -- [#448](https://github.com/request/request/pull/448) Convenience method for PATCH (@mloar) -- [#444](https://github.com/request/request/pull/444) protect against double callbacks on error path (@spollack) -- [#433](https://github.com/request/request/pull/433) Added support for HTTPS cert & key (@mmalecki) -- [#430](https://github.com/request/request/pull/430) Respect specified {Host,host} headers, not just {host} (@andrewschaaf) -- [#415](https://github.com/request/request/pull/415) Fixed a typo. (@jerem) -- [#338](https://github.com/request/request/pull/338) Add more auth options, including digest support (@nylen) -- [#403](https://github.com/request/request/pull/403) Optimize environment lookup to happen once only (@mmalecki) -- [#398](https://github.com/request/request/pull/398) Add more reporting to tests (@mmalecki) -- [#388](https://github.com/request/request/pull/388) Ensure "safe" toJSON doesn't break EventEmitters (@othiym23) -- [#381](https://github.com/request/request/pull/381) Resolving "Invalid signature. Expected signature base string: " (@landeiro) -- [#380](https://github.com/request/request/pull/380) Fixes missing host header on retried request when using forever agent (@mac-) -- [#376](https://github.com/request/request/pull/376) Headers lost on redirect (@kapetan) -- [#375](https://github.com/request/request/pull/375) Fix for missing oauth_timestamp parameter (@jplock) -- [#374](https://github.com/request/request/pull/374) Correct Host header for proxy tunnel CONNECT (@youurayy) -- [#370](https://github.com/request/request/pull/370) Twitter reverse auth uses x_auth_mode not x_auth_type (@drudge) -- [#369](https://github.com/request/request/pull/369) Don't remove x_auth_mode for Twitter reverse auth (@drudge) -- [#344](https://github.com/request/request/pull/344) Make AWS auth signing find headers correctly (@nlf) -- [#363](https://github.com/request/request/pull/363) rfc3986 on base_uri, now passes tests (@jeffmarshall) -- [#362](https://github.com/request/request/pull/362) Running `rfc3986` on `base_uri` in `oauth.hmacsign` instead of just `encodeURIComponent` (@jeffmarshall) -- [#361](https://github.com/request/request/pull/361) Don't create a Content-Length header if we already have it set (@danjenkins) -- [#360](https://github.com/request/request/pull/360) Delete self._form along with everything else on redirect (@jgautier) -- [#355](https://github.com/request/request/pull/355) stop sending erroneous headers on redirected requests (@azylman) -- [#332](https://github.com/request/request/pull/332) Fix #296 - Only set Content-Type if body exists (@Marsup) -- [#343](https://github.com/request/request/pull/343) Allow AWS to work in more situations, added a note in the README on its usage (@nlf) -- [#320](https://github.com/request/request/pull/320) request.defaults() doesn't need to wrap jar() (@StuartHarris) -- [#322](https://github.com/request/request/pull/322) Fix + test for piped into request bumped into redirect. #321 (@alexindigo) -- [#326](https://github.com/request/request/pull/326) Do not try to remove listener from an undefined connection (@strk) -- [#318](https://github.com/request/request/pull/318) Pass servername to tunneling secure socket creation (@isaacs) -- [#317](https://github.com/request/request/pull/317) Workaround for #313 (@isaacs) -- [#293](https://github.com/request/request/pull/293) Allow parser errors to bubble up to request (@mscdex) -- [#290](https://github.com/request/request/pull/290) A test for #289 (@isaacs) -- [#280](https://github.com/request/request/pull/280) Like in node.js print options if NODE_DEBUG contains the word request (@Filirom1) -- [#207](https://github.com/request/request/pull/207) Fix #206 Change HTTP/HTTPS agent when redirecting between protocols (@isaacs) -- [#214](https://github.com/request/request/pull/214) documenting additional behavior of json option (@jphaas) -- [#272](https://github.com/request/request/pull/272) Boundary begins with CRLF? (@elspoono, @timshadel, @naholyr, @nanodocumet, @TehShrike) -- [#284](https://github.com/request/request/pull/284) Remove stray `console.log()` call in multipart generator. (@bcherry) -- [#241](https://github.com/request/request/pull/241) Composability updates suggested by issue #239 (@polotek) -- [#282](https://github.com/request/request/pull/282) OAuth Authorization header contains non-"oauth_" parameters (@jplock) -- [#279](https://github.com/request/request/pull/279) fix tests with boundary by injecting boundry from header (@benatkin) -- [#273](https://github.com/request/request/pull/273) Pipe back pressure issue (@mafintosh) -- [#268](https://github.com/request/request/pull/268) I'm not OCD seriously (@TehShrike) -- [#263](https://github.com/request/request/pull/263) Bug in OAuth key generation for sha1 (@nanodocumet) -- [#265](https://github.com/request/request/pull/265) uncaughtException when redirected to invalid URI (@naholyr) -- [#262](https://github.com/request/request/pull/262) JSON test should check for equality (@timshadel) -- [#261](https://github.com/request/request/pull/261) Setting 'pool' to 'false' does NOT disable Agent pooling (@timshadel) -- [#249](https://github.com/request/request/pull/249) Fix for the fix of your (closed) issue #89 where self.headers[content-length] is set to 0 for all methods (@sethbridges, @polotek, @zephrax, @jeromegn) -- [#255](https://github.com/request/request/pull/255) multipart allow body === '' ( the empty string ) (@Filirom1) -- [#260](https://github.com/request/request/pull/260) fixed just another leak of 'i' (@sreuter) -- [#246](https://github.com/request/request/pull/246) Fixing the set-cookie header (@jeromegn) -- [#243](https://github.com/request/request/pull/243) Dynamic boundary (@zephrax) -- [#240](https://github.com/request/request/pull/240) don't error when null is passed for options (@polotek) -- [#211](https://github.com/request/request/pull/211) Replace all occurrences of special chars in RFC3986 (@chriso) -- [#224](https://github.com/request/request/pull/224) Multipart content-type change (@janjongboom) -- [#217](https://github.com/request/request/pull/217) need to use Authorization (titlecase) header with Tumblr OAuth (@visnup) -- [#203](https://github.com/request/request/pull/203) Fix cookie and redirect bugs and add auth support for HTTPS tunnel (@milewise) -- [#199](https://github.com/request/request/pull/199) Tunnel (@isaacs) -- [#198](https://github.com/request/request/pull/198) Bugfix on forever usage of util.inherits (@isaacs) -- [#197](https://github.com/request/request/pull/197) Make ForeverAgent work with HTTPS (@isaacs) -- [#193](https://github.com/request/request/pull/193) Fixes GH-119 (@goatslacker) -- [#188](https://github.com/request/request/pull/188) Add abort support to the returned request (@itay) -- [#176](https://github.com/request/request/pull/176) Querystring option (@csainty) -- [#182](https://github.com/request/request/pull/182) Fix request.defaults to support (uri, options, callback) api (@twilson63) -- [#180](https://github.com/request/request/pull/180) Modified the post, put, head and del shortcuts to support uri optional param (@twilson63) -- [#179](https://github.com/request/request/pull/179) fix to add opts in .pipe(stream, opts) (@substack) -- [#177](https://github.com/request/request/pull/177) Issue #173 Support uri as first and optional config as second argument (@twilson63) -- [#170](https://github.com/request/request/pull/170) can't create a cookie in a wrapped request (defaults) (@fabianonunes) -- [#168](https://github.com/request/request/pull/168) Picking off an EasyFix by adding some missing mimetypes. (@serby) -- [#161](https://github.com/request/request/pull/161) Fix cookie jar/headers.cookie collision (#125) (@papandreou) -- [#162](https://github.com/request/request/pull/162) Fix issue #159 (@dpetukhov) -- [#90](https://github.com/request/request/pull/90) add option followAllRedirects to follow post/put redirects (@jroes) -- [#148](https://github.com/request/request/pull/148) Retry Agent (@thejh) -- [#146](https://github.com/request/request/pull/146) Multipart should respect content-type if previously set (@apeace) -- [#144](https://github.com/request/request/pull/144) added "form" option to readme (@petejkim) -- [#133](https://github.com/request/request/pull/133) Fixed cookies parsing (@afanasy) -- [#135](https://github.com/request/request/pull/135) host vs hostname (@iangreenleaf) -- [#132](https://github.com/request/request/pull/132) return the body as a Buffer when encoding is set to null (@jahewson) -- [#112](https://github.com/request/request/pull/112) Support using a custom http-like module (@jhs) -- [#104](https://github.com/request/request/pull/104) Cookie handling contains bugs (@janjongboom) -- [#121](https://github.com/request/request/pull/121) Another patch for cookie handling regression (@jhurliman) -- [#117](https://github.com/request/request/pull/117) Remove the global `i` (@3rd-Eden) -- [#110](https://github.com/request/request/pull/110) Update to Iris Couch URL (@jhs) -- [#86](https://github.com/request/request/pull/86) Can't post binary to multipart requests (@kkaefer) -- [#105](https://github.com/request/request/pull/105) added test for proxy option. (@dominictarr) -- [#102](https://github.com/request/request/pull/102) Implemented cookies - closes issue 82: https://github.com/mikeal/request/issues/82 (@alessioalex) -- [#97](https://github.com/request/request/pull/97) Typo in previous pull causes TypeError in non-0.5.11 versions (@isaacs) -- [#96](https://github.com/request/request/pull/96) Authless parsed url host support (@isaacs) -- [#81](https://github.com/request/request/pull/81) Enhance redirect handling (@danmactough) -- [#78](https://github.com/request/request/pull/78) Don't try to do strictSSL for non-ssl connections (@isaacs) -- [#76](https://github.com/request/request/pull/76) Bug when a request fails and a timeout is set (@Marsup) -- [#70](https://github.com/request/request/pull/70) add test script to package.json (@isaacs, @aheckmann) -- [#73](https://github.com/request/request/pull/73) Fix #71 Respect the strictSSL flag (@isaacs) -- [#69](https://github.com/request/request/pull/69) Flatten chunked requests properly (@isaacs) -- [#67](https://github.com/request/request/pull/67) fixed global variable leaks (@aheckmann) -- [#66](https://github.com/request/request/pull/66) Do not overwrite established content-type headers for read stream deliver (@voodootikigod) -- [#53](https://github.com/request/request/pull/53) Parse json: Issue #51 (@benatkin) -- [#45](https://github.com/request/request/pull/45) Added timeout option (@mbrevoort) -- [#35](https://github.com/request/request/pull/35) The "end" event isn't emitted for some responses (@voxpelli) -- [#31](https://github.com/request/request/pull/31) Error on piping a request to a destination (@tobowers) \ No newline at end of file diff --git a/APIs/node_modules/request/CONTRIBUTING.md b/APIs/node_modules/request/CONTRIBUTING.md deleted file mode 100644 index 8aa6999a..00000000 --- a/APIs/node_modules/request/CONTRIBUTING.md +++ /dev/null @@ -1,81 +0,0 @@ - -# Contributing to Request - -:+1::tada: First off, thanks for taking the time to contribute! :tada::+1: - -The following is a set of guidelines for contributing to Request and its packages, which are hosted in the [Request Organization](https://github.com/request) on GitHub. -These are just guidelines, not rules, use your best judgment and feel free to propose changes to this document in a pull request. - - -## Submitting an Issue - -1. Provide a small self **sufficient** code example to **reproduce** the issue. -2. Run your test code using [request-debug](https://github.com/request/request-debug) and copy/paste the results inside the issue. -3. You should **always** use fenced code blocks when submitting code examples or any other formatted output: -
    -  ```js
    -  put your javascript code here
    -  ```
    -
    -  ```
    -  put any other formatted output here,
    -  like for example the one returned from using request-debug
    -  ```
    -  
    - -If the problem cannot be reliably reproduced, the issue will be marked as `Not enough info (see CONTRIBUTING.md)`. - -If the problem is not related to request the issue will be marked as `Help (please use Stackoverflow)`. - - -## Submitting a Pull Request - -1. In almost all of the cases your PR **needs tests**. Make sure you have any. -2. Run `npm test` locally. Fix any errors before pushing to GitHub. -3. After submitting the PR a build will be triggered on TravisCI. Wait for it to ends and make sure all jobs are passing. - - ------------------------------------------ - - -## Becoming a Contributor - -Individuals making significant and valuable contributions are given -commit-access to the project to contribute as they see fit. This project is -more like an open wiki than a standard guarded open source project. - - -## Rules - -There are a few basic ground-rules for contributors: - -1. **No `--force` pushes** or modifying the Git history in any way. -1. **Non-master branches** ought to be used for ongoing work. -1. **Any** change should be added through Pull Request. -1. **External API changes and significant modifications** ought to be subject - to an **internal pull-request** to solicit feedback from other contributors. -1. Internal pull-requests to solicit feedback are *encouraged* for any other - non-trivial contribution but left to the discretion of the contributor. -1. For significant changes wait a full 24 hours before merging so that active - contributors who are distributed throughout the world have a chance to weigh - in. -1. Contributors should attempt to adhere to the prevailing code-style. -1. Run `npm test` locally before submitting your PR, to catch any easy to miss - style & testing issues. To diagnose test failures, there are two ways to - run a single test file: - - `node_modules/.bin/taper tests/test-file.js` - run using the default - [`taper`](https://github.com/nylen/taper) test reporter. - - `node tests/test-file.js` - view the raw - [tap](https://testanything.org/) output. - - -## Releases - -Declaring formal releases remains the prerogative of the project maintainer. - - -## Changes to this arrangement - -This is an experiment and feedback is welcome! This document may also be -subject to pull-requests or changes by contributors where you believe you have -something valuable to add or change. diff --git a/APIs/node_modules/request/LICENSE b/APIs/node_modules/request/LICENSE deleted file mode 100644 index a4a9aee0..00000000 --- a/APIs/node_modules/request/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/APIs/node_modules/request/README.md b/APIs/node_modules/request/README.md deleted file mode 100644 index cf9072a2..00000000 --- a/APIs/node_modules/request/README.md +++ /dev/null @@ -1,1098 +0,0 @@ - -# Request - Simplified HTTP client - -[![npm package](https://nodei.co/npm/request.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/request/) - -[![Build status](https://img.shields.io/travis/request/request/master.svg?style=flat-square)](https://travis-ci.org/request/request) -[![Coverage](https://img.shields.io/codecov/c/github/request/request.svg?style=flat-square)](https://codecov.io/github/request/request?branch=master) -[![Coverage](https://img.shields.io/coveralls/request/request.svg?style=flat-square)](https://coveralls.io/r/request/request) -[![Dependency Status](https://img.shields.io/david/request/request.svg?style=flat-square)](https://david-dm.org/request/request) -[![Known Vulnerabilities](https://snyk.io/test/npm/request/badge.svg?style=flat-square)](https://snyk.io/test/npm/request) -[![Gitter](https://img.shields.io/badge/gitter-join_chat-blue.svg?style=flat-square)](https://gitter.im/request/request?utm_source=badge) - - -## Super simple to use - -Request is designed to be the simplest way possible to make http calls. It supports HTTPS and follows redirects by default. - -```js -var request = require('request'); -request('http://www.google.com', function (error, response, body) { - if (!error && response.statusCode == 200) { - console.log(body) // Show the HTML for the Google homepage. - } -}) -``` - - -## Table of contents - -- [Streaming](#streaming) -- [Forms](#forms) -- [HTTP Authentication](#http-authentication) -- [Custom HTTP Headers](#custom-http-headers) -- [OAuth Signing](#oauth-signing) -- [Proxies](#proxies) -- [Unix Domain Sockets](#unix-domain-sockets) -- [TLS/SSL Protocol](#tlsssl-protocol) -- [Support for HAR 1.2](#support-for-har-12) -- [**All Available Options**](#requestoptions-callback) - -Request also offers [convenience methods](#convenience-methods) like -`request.defaults` and `request.post`, and there are -lots of [usage examples](#examples) and several -[debugging techniques](#debugging). - - ---- - - -## Streaming - -You can stream any response to a file stream. - -```js -request('http://google.com/doodle.png').pipe(fs.createWriteStream('doodle.png')) -``` - -You can also stream a file to a PUT or POST request. This method will also check the file extension against a mapping of file extensions to content-types (in this case `application/json`) and use the proper `content-type` in the PUT request (if the headers don’t already provide one). - -```js -fs.createReadStream('file.json').pipe(request.put('http://mysite.com/obj.json')) -``` - -Request can also `pipe` to itself. When doing so, `content-type` and `content-length` are preserved in the PUT headers. - -```js -request.get('http://google.com/img.png').pipe(request.put('http://mysite.com/img.png')) -``` - -Request emits a "response" event when a response is received. The `response` argument will be an instance of [http.IncomingMessage](http://nodejs.org/api/http.html#http_http_incomingmessage). - -```js -request - .get('http://google.com/img.png') - .on('response', function(response) { - console.log(response.statusCode) // 200 - console.log(response.headers['content-type']) // 'image/png' - }) - .pipe(request.put('http://mysite.com/img.png')) -``` - -To easily handle errors when streaming requests, listen to the `error` event before piping: - -```js -request - .get('http://mysite.com/doodle.png') - .on('error', function(err) { - console.log(err) - }) - .pipe(fs.createWriteStream('doodle.png')) -``` - -Now let’s get fancy. - -```js -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - if (req.method === 'PUT') { - req.pipe(request.put('http://mysite.com/doodle.png')) - } else if (req.method === 'GET' || req.method === 'HEAD') { - request.get('http://mysite.com/doodle.png').pipe(resp) - } - } -}) -``` - -You can also `pipe()` from `http.ServerRequest` instances, as well as to `http.ServerResponse` instances. The HTTP method, headers, and entity-body data will be sent. Which means that, if you don't really care about security, you can do: - -```js -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - var x = request('http://mysite.com/doodle.png') - req.pipe(x) - x.pipe(resp) - } -}) -``` - -And since `pipe()` returns the destination stream in ≥ Node 0.5.x you can do one line proxying. :) - -```js -req.pipe(request('http://mysite.com/doodle.png')).pipe(resp) -``` - -Also, none of this new functionality conflicts with requests previous features, it just expands them. - -```js -var r = request.defaults({'proxy':'http://localproxy.com'}) - -http.createServer(function (req, resp) { - if (req.url === '/doodle.png') { - r.get('http://google.com/doodle.png').pipe(resp) - } -}) -``` - -You can still use intermediate proxies, the requests will still follow HTTP forwards, etc. - -[back to top](#table-of-contents) - - ---- - - -## Forms - -`request` supports `application/x-www-form-urlencoded` and `multipart/form-data` form uploads. For `multipart/related` refer to the `multipart` API. - - -#### application/x-www-form-urlencoded (URL-Encoded Forms) - -URL-encoded forms are simple. - -```js -request.post('http://service.com/upload', {form:{key:'value'}}) -// or -request.post('http://service.com/upload').form({key:'value'}) -// or -request.post({url:'http://service.com/upload', form: {key:'value'}}, function(err,httpResponse,body){ /* ... */ }) -``` - - -#### multipart/form-data (Multipart Form Uploads) - -For `multipart/form-data` we use the [form-data](https://github.com/form-data/form-data) library by [@felixge](https://github.com/felixge). For the most cases, you can pass your upload form data via the `formData` option. - - -```js -var formData = { - // Pass a simple key-value pair - my_field: 'my_value', - // Pass data via Buffers - my_buffer: new Buffer([1, 2, 3]), - // Pass data via Streams - my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), - // Pass multiple values /w an Array - attachments: [ - fs.createReadStream(__dirname + '/attachment1.jpg'), - fs.createReadStream(__dirname + '/attachment2.jpg') - ], - // Pass optional meta-data with an 'options' object with style: {value: DATA, options: OPTIONS} - // Use case: for some types of streams, you'll need to provide "file"-related information manually. - // See the `form-data` README for more information about options: https://github.com/form-data/form-data - custom_file: { - value: fs.createReadStream('/dev/urandom'), - options: { - filename: 'topsecret.jpg', - contentType: 'image/jpg' - } - } -}; -request.post({url:'http://service.com/upload', formData: formData}, function optionalCallback(err, httpResponse, body) { - if (err) { - return console.error('upload failed:', err); - } - console.log('Upload successful! Server responded with:', body); -}); -``` - -For advanced cases, you can access the form-data object itself via `r.form()`. This can be modified until the request is fired on the next cycle of the event-loop. (Note that this calling `form()` will clear the currently set form data for that request.) - -```js -// NOTE: Advanced use-case, for normal use see 'formData' usage above -var r = request.post('http://service.com/upload', function optionalCallback(err, httpResponse, body) {...}) -var form = r.form(); -form.append('my_field', 'my_value'); -form.append('my_buffer', new Buffer([1, 2, 3])); -form.append('custom_file', fs.createReadStream(__dirname + '/unicycle.jpg'), {filename: 'unicycle.jpg'}); -``` -See the [form-data README](https://github.com/form-data/form-data) for more information & examples. - - -#### multipart/related - -Some variations in different HTTP implementations require a newline/CRLF before, after, or both before and after the boundary of a `multipart/related` request (using the multipart option). This has been observed in the .NET WebAPI version 4.0. You can turn on a boundary preambleCRLF or postamble by passing them as `true` to your request options. - -```js - request({ - method: 'PUT', - preambleCRLF: true, - postambleCRLF: true, - uri: 'http://service.com/upload', - multipart: [ - { - 'content-type': 'application/json', - body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - }, - { body: 'I am an attachment' }, - { body: fs.createReadStream('image.png') } - ], - // alternatively pass an object containing additional options - multipart: { - chunked: false, - data: [ - { - 'content-type': 'application/json', - body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - }, - { body: 'I am an attachment' } - ] - } - }, - function (error, response, body) { - if (error) { - return console.error('upload failed:', error); - } - console.log('Upload successful! Server responded with:', body); - }) -``` - -[back to top](#table-of-contents) - - ---- - - -## HTTP Authentication - -```js -request.get('http://some.server.com/').auth('username', 'password', false); -// or -request.get('http://some.server.com/', { - 'auth': { - 'user': 'username', - 'pass': 'password', - 'sendImmediately': false - } -}); -// or -request.get('http://some.server.com/').auth(null, null, true, 'bearerToken'); -// or -request.get('http://some.server.com/', { - 'auth': { - 'bearer': 'bearerToken' - } -}); -``` - -If passed as an option, `auth` should be a hash containing values: - -- `user` || `username` -- `pass` || `password` -- `sendImmediately` (optional) -- `bearer` (optional) - -The method form takes parameters -`auth(username, password, sendImmediately, bearer)`. - -`sendImmediately` defaults to `true`, which causes a basic or bearer -authentication header to be sent. If `sendImmediately` is `false`, then -`request` will retry with a proper authentication header after receiving a -`401` response from the server (which must contain a `WWW-Authenticate` header -indicating the required authentication method). - -Note that you can also specify basic authentication using the URL itself, as -detailed in [RFC 1738](http://www.ietf.org/rfc/rfc1738.txt). Simply pass the -`user:password` before the host with an `@` sign: - -```js -var username = 'username', - password = 'password', - url = 'http://' + username + ':' + password + '@some.server.com'; - -request({url: url}, function (error, response, body) { - // Do more stuff with 'body' here -}); -``` - -Digest authentication is supported, but it only works with `sendImmediately` -set to `false`; otherwise `request` will send basic authentication on the -initial request, which will probably cause the request to fail. - -Bearer authentication is supported, and is activated when the `bearer` value is -available. The value may be either a `String` or a `Function` returning a -`String`. Using a function to supply the bearer token is particularly useful if -used in conjunction with `defaults` to allow a single function to supply the -last known token at the time of sending a request, or to compute one on the fly. - -[back to top](#table-of-contents) - - ---- - - -## Custom HTTP Headers - -HTTP Headers, such as `User-Agent`, can be set in the `options` object. -In the example below, we call the github API to find out the number -of stars and forks for the request repository. This requires a -custom `User-Agent` header as well as https. - -```js -var request = require('request'); - -var options = { - url: 'https://api.github.com/repos/request/request', - headers: { - 'User-Agent': 'request' - } -}; - -function callback(error, response, body) { - if (!error && response.statusCode == 200) { - var info = JSON.parse(body); - console.log(info.stargazers_count + " Stars"); - console.log(info.forks_count + " Forks"); - } -} - -request(options, callback); -``` - -[back to top](#table-of-contents) - - ---- - - -## OAuth Signing - -[OAuth version 1.0](https://tools.ietf.org/html/rfc5849) is supported. The -default signing algorithm is -[HMAC-SHA1](https://tools.ietf.org/html/rfc5849#section-3.4.2): - -```js -// OAuth1.0 - 3-legged server side flow (Twitter example) -// step 1 -var qs = require('querystring') - , oauth = - { callback: 'http://mysite.com/callback/' - , consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - } - , url = 'https://api.twitter.com/oauth/request_token' - ; -request.post({url:url, oauth:oauth}, function (e, r, body) { - // Ideally, you would take the body in the response - // and construct a URL that a user clicks on (like a sign in button). - // The verifier is only available in the response after a user has - // verified with twitter that they are authorizing your app. - - // step 2 - var req_data = qs.parse(body) - var uri = 'https://api.twitter.com/oauth/authenticate' - + '?' + qs.stringify({oauth_token: req_data.oauth_token}) - // redirect the user to the authorize uri - - // step 3 - // after the user is redirected back to your server - var auth_data = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: auth_data.oauth_token - , token_secret: req_data.oauth_token_secret - , verifier: auth_data.oauth_verifier - } - , url = 'https://api.twitter.com/oauth/access_token' - ; - request.post({url:url, oauth:oauth}, function (e, r, body) { - // ready to make signed requests on behalf of the user - var perm_data = qs.parse(body) - , oauth = - { consumer_key: CONSUMER_KEY - , consumer_secret: CONSUMER_SECRET - , token: perm_data.oauth_token - , token_secret: perm_data.oauth_token_secret - } - , url = 'https://api.twitter.com/1.1/users/show.json' - , qs = - { screen_name: perm_data.screen_name - , user_id: perm_data.user_id - } - ; - request.get({url:url, oauth:oauth, qs:qs, json:true}, function (e, r, user) { - console.log(user) - }) - }) -}) -``` - -For [RSA-SHA1 signing](https://tools.ietf.org/html/rfc5849#section-3.4.3), make -the following changes to the OAuth options object: -* Pass `signature_method : 'RSA-SHA1'` -* Instead of `consumer_secret`, specify a `private_key` string in - [PEM format](http://how2ssl.com/articles/working_with_pem_files/) - -For [PLAINTEXT signing](http://oauth.net/core/1.0/#anchor22), make -the following changes to the OAuth options object: -* Pass `signature_method : 'PLAINTEXT'` - -To send OAuth parameters via query params or in a post body as described in The -[Consumer Request Parameters](http://oauth.net/core/1.0/#consumer_req_param) -section of the oauth1 spec: -* Pass `transport_method : 'query'` or `transport_method : 'body'` in the OAuth - options object. -* `transport_method` defaults to `'header'` - -To use [Request Body Hash](https://oauth.googlecode.com/svn/spec/ext/body_hash/1.0/oauth-bodyhash.html) you can either -* Manually generate the body hash and pass it as a string `body_hash: '...'` -* Automatically generate the body hash by passing `body_hash: true` - -[back to top](#table-of-contents) - - ---- - - -## Proxies - -If you specify a `proxy` option, then the request (and any subsequent -redirects) will be sent via a connection to the proxy server. - -If your endpoint is an `https` url, and you are using a proxy, then -request will send a `CONNECT` request to the proxy server *first*, and -then use the supplied connection to connect to the endpoint. - -That is, first it will make a request like: - -``` -HTTP/1.1 CONNECT endpoint-server.com:80 -Host: proxy-server.com -User-Agent: whatever user agent you specify -``` - -and then the proxy server make a TCP connection to `endpoint-server` -on port `80`, and return a response that looks like: - -``` -HTTP/1.1 200 OK -``` - -At this point, the connection is left open, and the client is -communicating directly with the `endpoint-server.com` machine. - -See [the wikipedia page on HTTP Tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel) -for more information. - -By default, when proxying `http` traffic, request will simply make a -standard proxied `http` request. This is done by making the `url` -section of the initial line of the request a fully qualified url to -the endpoint. - -For example, it will make a single request that looks like: - -``` -HTTP/1.1 GET http://endpoint-server.com/some-url -Host: proxy-server.com -Other-Headers: all go here - -request body or whatever -``` - -Because a pure "http over http" tunnel offers no additional security -or other features, it is generally simpler to go with a -straightforward HTTP proxy in this case. However, if you would like -to force a tunneling proxy, you may set the `tunnel` option to `true`. - -You can also make a standard proxied `http` request by explicitly setting -`tunnel : false`, but **note that this will allow the proxy to see the traffic -to/from the destination server**. - -If you are using a tunneling proxy, you may set the -`proxyHeaderWhiteList` to share certain headers with the proxy. - -You can also set the `proxyHeaderExclusiveList` to share certain -headers only with the proxy and not with destination host. - -By default, this set is: - -``` -accept -accept-charset -accept-encoding -accept-language -accept-ranges -cache-control -content-encoding -content-language -content-length -content-location -content-md5 -content-range -content-type -connection -date -expect -max-forwards -pragma -proxy-authorization -referer -te -transfer-encoding -user-agent -via -``` - -Note that, when using a tunneling proxy, the `proxy-authorization` -header and any headers from custom `proxyHeaderExclusiveList` are -*never* sent to the endpoint server, but only to the proxy server. - - -### Controlling proxy behaviour using environment variables - -The following environment variables are respected by `request`: - - * `HTTP_PROXY` / `http_proxy` - * `HTTPS_PROXY` / `https_proxy` - * `NO_PROXY` / `no_proxy` - -When `HTTP_PROXY` / `http_proxy` are set, they will be used to proxy non-SSL requests that do not have an explicit `proxy` configuration option present. Similarly, `HTTPS_PROXY` / `https_proxy` will be respected for SSL requests that do not have an explicit `proxy` configuration option. It is valid to define a proxy in one of the environment variables, but then override it for a specific request, using the `proxy` configuration option. Furthermore, the `proxy` configuration option can be explicitly set to false / null to opt out of proxying altogether for that request. - -`request` is also aware of the `NO_PROXY`/`no_proxy` environment variables. These variables provide a granular way to opt out of proxying, on a per-host basis. It should contain a comma separated list of hosts to opt out of proxying. It is also possible to opt of proxying when a particular destination port is used. Finally, the variable may be set to `*` to opt out of the implicit proxy configuration of the other environment variables. - -Here's some examples of valid `no_proxy` values: - - * `google.com` - don't proxy HTTP/HTTPS requests to Google. - * `google.com:443` - don't proxy HTTPS requests to Google, but *do* proxy HTTP requests to Google. - * `google.com:443, yahoo.com:80` - don't proxy HTTPS requests to Google, and don't proxy HTTP requests to Yahoo! - * `*` - ignore `https_proxy`/`http_proxy` environment variables altogether. - -[back to top](#table-of-contents) - - ---- - - -## UNIX Domain Sockets - -`request` supports making requests to [UNIX Domain Sockets](https://en.wikipedia.org/wiki/Unix_domain_socket). To make one, use the following URL scheme: - -```js -/* Pattern */ 'http://unix:SOCKET:PATH' -/* Example */ request.get('http://unix:/absolute/path/to/unix.socket:/request/path') -``` - -Note: The `SOCKET` path is assumed to be absolute to the root of the host file system. - -[back to top](#table-of-contents) - - ---- - - -## TLS/SSL Protocol - -TLS/SSL Protocol options, such as `cert`, `key` and `passphrase`, can be -set directly in `options` object, in the `agentOptions` property of the `options` object, or even in `https.globalAgent.options`. Keep in mind that, although `agentOptions` allows for a slightly wider range of configurations, the recommended way is via `options` object directly, as using `agentOptions` or `https.globalAgent.options` would not be applied in the same way in proxied environments (as data travels through a TLS connection instead of an http/https agent). - -```js -var fs = require('fs') - , path = require('path') - , certFile = path.resolve(__dirname, 'ssl/client.crt') - , keyFile = path.resolve(__dirname, 'ssl/client.key') - , caFile = path.resolve(__dirname, 'ssl/ca.cert.pem') - , request = require('request'); - -var options = { - url: 'https://api.some-server.com/', - cert: fs.readFileSync(certFile), - key: fs.readFileSync(keyFile), - passphrase: 'password', - ca: fs.readFileSync(caFile) - } -}; - -request.get(options); -``` - -### Using `options.agentOptions` - -In the example below, we call an API requires client side SSL certificate -(in PEM format) with passphrase protected private key (in PEM format) and disable the SSLv3 protocol: - -```js -var fs = require('fs') - , path = require('path') - , certFile = path.resolve(__dirname, 'ssl/client.crt') - , keyFile = path.resolve(__dirname, 'ssl/client.key') - , request = require('request'); - -var options = { - url: 'https://api.some-server.com/', - agentOptions: { - cert: fs.readFileSync(certFile), - key: fs.readFileSync(keyFile), - // Or use `pfx` property replacing `cert` and `key` when using private key, certificate and CA certs in PFX or PKCS12 format: - // pfx: fs.readFileSync(pfxFilePath), - passphrase: 'password', - securityOptions: 'SSL_OP_NO_SSLv3' - } -}; - -request.get(options); -``` - -It is able to force using SSLv3 only by specifying `secureProtocol`: - -```js -request.get({ - url: 'https://api.some-server.com/', - agentOptions: { - secureProtocol: 'SSLv3_method' - } -}); -``` - -It is possible to accept other certificates than those signed by generally allowed Certificate Authorities (CAs). -This can be useful, for example, when using self-signed certificates. -To require a different root certificate, you can specify the signing CA by adding the contents of the CA's certificate file to the `agentOptions`. -The certificate the domain presents must be signed by the root certificate specified: - -```js -request.get({ - url: 'https://api.some-server.com/', - agentOptions: { - ca: fs.readFileSync('ca.cert.pem') - } -}); -``` - -[back to top](#table-of-contents) - - ---- - -## Support for HAR 1.2 - -The `options.har` property will override the values: `url`, `method`, `qs`, `headers`, `form`, `formData`, `body`, `json`, as well as construct multipart data and read files from disk when `request.postData.params[].fileName` is present without a matching `value`. - -a validation step will check if the HAR Request format matches the latest spec (v1.2) and will skip parsing if not matching. - -```js - var request = require('request') - request({ - // will be ignored - method: 'GET', - uri: 'http://www.google.com', - - // HTTP Archive Request Object - har: { - url: 'http://www.mockbin.com/har', - method: 'POST', - headers: [ - { - name: 'content-type', - value: 'application/x-www-form-urlencoded' - } - ], - postData: { - mimeType: 'application/x-www-form-urlencoded', - params: [ - { - name: 'foo', - value: 'bar' - }, - { - name: 'hello', - value: 'world' - } - ] - } - } - }) - - // a POST request will be sent to http://www.mockbin.com - // with body an application/x-www-form-urlencoded body: - // foo=bar&hello=world -``` - -[back to top](#table-of-contents) - - ---- - -## request(options, callback) - -The first argument can be either a `url` or an `options` object. The only required option is `uri`; all others are optional. - -- `uri` || `url` - fully qualified uri or a parsed url object from `url.parse()` -- `baseUrl` - fully qualified uri string used as the base url. Most useful with `request.defaults`, for example when you want to do many requests to the same domain. If `baseUrl` is `https://example.com/api/`, then requesting `/end/point?test=true` will fetch `https://example.com/api/end/point?test=true`. When `baseUrl` is given, `uri` must also be a string. -- `method` - http method (default: `"GET"`) -- `headers` - http headers (default: `{}`) - ---- - -- `qs` - object containing querystring values to be appended to the `uri` -- `qsParseOptions` - object containing options to pass to the [qs.parse](https://github.com/hapijs/qs#parsing-objects) method. Alternatively pass options to the [querystring.parse](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_parse_str_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}` -- `qsStringifyOptions` - object containing options to pass to the [qs.stringify](https://github.com/hapijs/qs#stringifying) method. Alternatively pass options to the [querystring.stringify](https://nodejs.org/docs/v0.12.0/api/querystring.html#querystring_querystring_stringify_obj_sep_eq_options) method using this format `{sep:';', eq:':', options:{}}`. For example, to change the way arrays are converted to query strings using the `qs` module pass the `arrayFormat` option with one of `indices|brackets|repeat` -- `useQuerystring` - If true, use `querystring` to stringify and parse - querystrings, otherwise use `qs` (default: `false`). Set this option to - `true` if you need arrays to be serialized as `foo=bar&foo=baz` instead of the - default `foo[0]=bar&foo[1]=baz`. - ---- - -- `body` - entity body for PATCH, POST and PUT requests. Must be a `Buffer`, `String` or `ReadStream`. If `json` is `true`, then `body` must be a JSON-serializable object. -- `form` - when passed an object or a querystring, this sets `body` to a querystring representation of value, and adds `Content-type: application/x-www-form-urlencoded` header. When passed no options, a `FormData` instance is returned (and is piped to request). See "Forms" section above. -- `formData` - Data to pass for a `multipart/form-data` request. See - [Forms](#forms) section above. -- `multipart` - array of objects which contain their own headers and `body` - attributes. Sends a `multipart/related` request. See [Forms](#forms) section - above. - - Alternatively you can pass in an object `{chunked: false, data: []}` where - `chunked` is used to specify whether the request is sent in - [chunked transfer encoding](https://en.wikipedia.org/wiki/Chunked_transfer_encoding) - In non-chunked requests, data items with body streams are not allowed. -- `preambleCRLF` - append a newline/CRLF before the boundary of your `multipart/form-data` request. -- `postambleCRLF` - append a newline/CRLF at the end of the boundary of your `multipart/form-data` request. -- `json` - sets `body` to JSON representation of value and adds `Content-type: application/json` header. Additionally, parses the response body as JSON. -- `jsonReviver` - a [reviver function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse) that will be passed to `JSON.parse()` when parsing a JSON response body. -- `jsonReplacer` - a [replacer function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) that will be passed to `JSON.stringify()` when stringifying a JSON request body. - ---- - -- `auth` - A hash containing values `user` || `username`, `pass` || `password`, and `sendImmediately` (optional). See documentation above. -- `oauth` - Options for OAuth HMAC-SHA1 signing. See documentation above. -- `hawk` - Options for [Hawk signing](https://github.com/hueniverse/hawk). The `credentials` key must contain the necessary signing info, [see hawk docs for details](https://github.com/hueniverse/hawk#usage-example). -- `aws` - `object` containing AWS signing information. Should have the properties `key`, `secret`. Also requires the property `bucket`, unless you’re specifying your `bucket` as part of the path, or the request doesn’t use a bucket (i.e. GET Services). If you want to use AWS sign version 4 use the parameter `sign_version` with value `4` otherwise the default is version 2. **Note:** you need to `npm install aws4` first. -- `httpSignature` - Options for the [HTTP Signature Scheme](https://github.com/joyent/node-http-signature/blob/master/http_signing.md) using [Joyent's library](https://github.com/joyent/node-http-signature). The `keyId` and `key` properties must be specified. See the docs for other options. - ---- - -- `followRedirect` - follow HTTP 3xx responses as redirects (default: `true`). This property can also be implemented as function which gets `response` object as a single argument and should return `true` if redirects should continue or `false` otherwise. -- `followAllRedirects` - follow non-GET HTTP 3xx responses as redirects (default: `false`) -- `maxRedirects` - the maximum number of redirects to follow (default: `10`) -- `removeRefererHeader` - removes the referer header when a redirect happens (default: `false`). **Note:** if true, referer header set in the initial request is preserved during redirect chain. - ---- - -- `encoding` - Encoding to be used on `setEncoding` of response data. If `null`, the `body` is returned as a `Buffer`. Anything else **(including the default value of `undefined`)** will be passed as the [encoding](http://nodejs.org/api/buffer.html#buffer_buffer) parameter to `toString()` (meaning this is effectively `utf8` by default). (**Note:** if you expect binary data, you should set `encoding: null`.) -- `gzip` - If `true`, add an `Accept-Encoding` header to request compressed content encodings from the server (if not already present) and decode supported content encodings in the response. **Note:** Automatic decoding of the response content is performed on the body data returned through `request` (both through the `request` stream and passed to the callback function) but is not performed on the `response` stream (available from the `response` event) which is the unmodified `http.IncomingMessage` object which may contain compressed data. See example below. -- `jar` - If `true`, remember cookies for future use (or define your custom cookie jar; see examples section) - ---- - -- `agent` - `http(s).Agent` instance to use -- `agentClass` - alternatively specify your agent's class name -- `agentOptions` - and pass its options. **Note:** for HTTPS see [tls API doc for TLS/SSL options](http://nodejs.org/api/tls.html#tls_tls_connect_options_callback) and the [documentation above](#using-optionsagentoptions). -- `forever` - set to `true` to use the [forever-agent](https://github.com/request/forever-agent) **Note:** Defaults to `http(s).Agent({keepAlive:true})` in node 0.12+ -- `pool` - An object describing which agents to use for the request. If this option is omitted the request will use the global agent (as long as your options allow for it). Otherwise, request will search the pool for your custom agent. If no custom agent is found, a new agent will be created and added to the pool. **Note:** `pool` is used only when the `agent` option is not specified. - - A `maxSockets` property can also be provided on the `pool` object to set the max number of sockets for all agents created (ex: `pool: {maxSockets: Infinity}`). - - Note that if you are sending multiple requests in a loop and creating - multiple new `pool` objects, `maxSockets` will not work as intended. To - work around this, either use [`request.defaults`](#requestdefaultsoptions) - with your pool options or create the pool object with the `maxSockets` - property outside of the loop. -- `timeout` - Integer containing the number of milliseconds to wait for a -server to send response headers (and start the response body) before aborting -the request. Note that if the underlying TCP connection cannot be established, -the OS-wide TCP connection timeout will overrule the `timeout` option ([the -default in Linux can be anywhere from 20-120 seconds][linux-timeout]). - -[linux-timeout]: http://www.sekuda.com/overriding_the_default_linux_kernel_20_second_tcp_socket_connect_timeout - ---- - -- `localAddress` - Local interface to bind for network connections. -- `proxy` - An HTTP proxy to be used. Supports proxy Auth with Basic Auth, identical to support for the `url` parameter (by embedding the auth info in the `uri`) -- `strictSSL` - If `true`, requires SSL certificates be valid. **Note:** to use your own certificate authority, you need to specify an agent that was created with that CA as an option. -- `tunnel` - controls the behavior of - [HTTP `CONNECT` tunneling](https://en.wikipedia.org/wiki/HTTP_tunnel#HTTP_CONNECT_tunneling) - as follows: - - `undefined` (default) - `true` if the destination is `https`, `false` otherwise - - `true` - always tunnel to the destination by making a `CONNECT` request to - the proxy - - `false` - request the destination as a `GET` request. -- `proxyHeaderWhiteList` - A whitelist of headers to send to a - tunneling proxy. -- `proxyHeaderExclusiveList` - A whitelist of headers to send - exclusively to a tunneling proxy and not to destination. - ---- - -- `time` - If `true`, the request-response cycle (including all redirects) is timed at millisecond resolution, and the result provided on the response's `elapsedTime` property. -- `har` - A [HAR 1.2 Request Object](http://www.softwareishard.com/blog/har-12-spec/#request), will be processed from HAR format into options overwriting matching values *(see the [HAR 1.2 section](#support-for-har-1.2) for details)* -- `callback` - alternatively pass the request's callback in the options object - -The callback argument gets 3 arguments: - -1. An `error` when applicable (usually from [`http.ClientRequest`](http://nodejs.org/api/http.html#http_class_http_clientrequest) object) -2. An [`http.IncomingMessage`](http://nodejs.org/api/http.html#http_http_incomingmessage) object -3. The third is the `response` body (`String` or `Buffer`, or JSON object if the `json` option is supplied) - -[back to top](#table-of-contents) - - ---- - -## Convenience methods - -There are also shorthand methods for different HTTP METHODs and some other conveniences. - - -### request.defaults(options) - -This method **returns a wrapper** around the normal request API that defaults -to whatever options you pass to it. - -**Note:** `request.defaults()` **does not** modify the global request API; -instead, it **returns a wrapper** that has your default settings applied to it. - -**Note:** You can call `.defaults()` on the wrapper that is returned from -`request.defaults` to add/override defaults that were previously defaulted. - -For example: -```js -//requests using baseRequest() will set the 'x-token' header -var baseRequest = request.defaults({ - headers: {'x-token': 'my-token'} -}) - -//requests using specialRequest() will include the 'x-token' header set in -//baseRequest and will also include the 'special' header -var specialRequest = baseRequest.defaults({ - headers: {special: 'special value'} -}) -``` - -### request.put - -Same as `request()`, but defaults to `method: "PUT"`. - -```js -request.put(url) -``` - -### request.patch - -Same as `request()`, but defaults to `method: "PATCH"`. - -```js -request.patch(url) -``` - -### request.post - -Same as `request()`, but defaults to `method: "POST"`. - -```js -request.post(url) -``` - -### request.head - -Same as `request()`, but defaults to `method: "HEAD"`. - -```js -request.head(url) -``` - -### request.del / request.delete - -Same as `request()`, but defaults to `method: "DELETE"`. - -```js -request.del(url) -request.delete(url) -``` - -### request.get - -Same as `request()` (for uniformity). - -```js -request.get(url) -``` -### request.cookie - -Function that creates a new cookie. - -```js -request.cookie('key1=value1') -``` -### request.jar() - -Function that creates a new cookie jar. - -```js -request.jar() -``` - -[back to top](#table-of-contents) - - ---- - - -## Debugging - -There are at least three ways to debug the operation of `request`: - -1. Launch the node process like `NODE_DEBUG=request node script.js` - (`lib,request,otherlib` works too). - -2. Set `require('request').debug = true` at any time (this does the same thing - as #1). - -3. Use the [request-debug module](https://github.com/request/request-debug) to - view request and response headers and bodies. - -[back to top](#table-of-contents) - - ---- - -## Timeouts - -Most requests to external servers should have a timeout attached, in case the -server is not responding in a timely manner. Without a timeout, your code may -have a socket open/consume resources for minutes or more. - -There are two main types of timeouts: **connection timeouts** and **read -timeouts**. A connect timeout occurs if the timeout is hit while your client is -attempting to establish a connection to a remote machine (corresponding to the -[connect() call][connect] on the socket). A read timeout occurs any time the -server is too slow to send back a part of the response. - -These two situations have widely different implications for what went wrong -with the request, so it's useful to be able to distinguish them. You can detect -timeout errors by checking `err.code` for an 'ETIMEDOUT' value. Further, you -can detect whether the timeout was a connection timeout by checking if the -`err.connect` property is set to `true`. - -```js -request.get('http://10.255.255.1', {timeout: 1500}, function(err) { - console.log(err.code === 'ETIMEDOUT'); - // Set to `true` if the timeout was a connection timeout, `false` or - // `undefined` otherwise. - console.log(err.connect === true); - process.exit(0); -}); -``` - -[connect]: http://linux.die.net/man/2/connect - -## Examples: - -```js - var request = require('request') - , rand = Math.floor(Math.random()*100000000).toString() - ; - request( - { method: 'PUT' - , uri: 'http://mikeal.iriscouch.com/testjs/' + rand - , multipart: - [ { 'content-type': 'application/json' - , body: JSON.stringify({foo: 'bar', _attachments: {'message.txt': {follows: true, length: 18, 'content_type': 'text/plain' }}}) - } - , { body: 'I am an attachment' } - ] - } - , function (error, response, body) { - if(response.statusCode == 201){ - console.log('document saved as: http://mikeal.iriscouch.com/testjs/'+ rand) - } else { - console.log('error: '+ response.statusCode) - console.log(body) - } - } - ) -``` - -For backwards-compatibility, response compression is not supported by default. -To accept gzip-compressed responses, set the `gzip` option to `true`. Note -that the body data passed through `request` is automatically decompressed -while the response object is unmodified and will contain compressed data if -the server sent a compressed response. - -```js - var request = require('request') - request( - { method: 'GET' - , uri: 'http://www.google.com' - , gzip: true - } - , function (error, response, body) { - // body is the decompressed response body - console.log('server encoded the data as: ' + (response.headers['content-encoding'] || 'identity')) - console.log('the decoded data is: ' + body) - } - ).on('data', function(data) { - // decompressed data as it is received - console.log('decoded chunk: ' + data) - }) - .on('response', function(response) { - // unmodified http.IncomingMessage object - response.on('data', function(data) { - // compressed data as it is received - console.log('received ' + data.length + ' bytes of compressed data') - }) - }) -``` - -Cookies are disabled by default (else, they would be used in subsequent requests). To enable cookies, set `jar` to `true` (either in `defaults` or `options`). - -```js -var request = request.defaults({jar: true}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -To use a custom cookie jar (instead of `request`’s global cookie jar), set `jar` to an instance of `request.jar()` (either in `defaults` or `options`) - -```js -var j = request.jar() -var request = request.defaults({jar:j}) -request('http://www.google.com', function () { - request('http://images.google.com') -}) -``` - -OR - -```js -var j = request.jar(); -var cookie = request.cookie('key1=value1'); -var url = 'http://www.google.com'; -j.setCookie(cookie, url); -request({url: url, jar: j}, function () { - request('http://images.google.com') -}) -``` - -To use a custom cookie store (such as a -[`FileCookieStore`](https://github.com/mitsuru/tough-cookie-filestore) -which supports saving to and restoring from JSON files), pass it as a parameter -to `request.jar()`: - -```js -var FileCookieStore = require('tough-cookie-filestore'); -// NOTE - currently the 'cookies.json' file must already exist! -var j = request.jar(new FileCookieStore('cookies.json')); -request = request.defaults({ jar : j }) -request('http://www.google.com', function() { - request('http://images.google.com') -}) -``` - -The cookie store must be a -[`tough-cookie`](https://github.com/SalesforceEng/tough-cookie) -store and it must support synchronous operations; see the -[`CookieStore` API docs](https://github.com/SalesforceEng/tough-cookie#cookiestore-api) -for details. - -To inspect your cookie jar after a request: - -```js -var j = request.jar() -request({url: 'http://www.google.com', jar: j}, function () { - var cookie_string = j.getCookieString(url); // "key1=value1; key2=value2; ..." - var cookies = j.getCookies(url); - // [{key: 'key1', value: 'value1', domain: "www.google.com", ...}, ...] -}) -``` - -[back to top](#table-of-contents) diff --git a/APIs/node_modules/request/index.js b/APIs/node_modules/request/index.js deleted file mode 100755 index 911a90db..00000000 --- a/APIs/node_modules/request/index.js +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2010-2012 Mikeal Rogers -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -'use strict' - -var extend = require('extend') - , cookies = require('./lib/cookies') - , helpers = require('./lib/helpers') - -var isFunction = helpers.isFunction - , paramsHaveRequestBody = helpers.paramsHaveRequestBody - - -// organize params for patch, post, put, head, del -function initParams(uri, options, callback) { - if (typeof options === 'function') { - callback = options - } - - var params = {} - if (typeof options === 'object') { - extend(params, options, {uri: uri}) - } else if (typeof uri === 'string') { - extend(params, {uri: uri}) - } else { - extend(params, uri) - } - - params.callback = callback || params.callback - return params -} - -function request (uri, options, callback) { - if (typeof uri === 'undefined') { - throw new Error('undefined is not a valid uri or options object.') - } - - var params = initParams(uri, options, callback) - - if (params.method === 'HEAD' && paramsHaveRequestBody(params)) { - throw new Error('HTTP HEAD requests MUST NOT include a request body.') - } - - return new request.Request(params) -} - -function verbFunc (verb) { - var method = verb.toUpperCase() - return function (uri, options, callback) { - var params = initParams(uri, options, callback) - params.method = method - return request(params, params.callback) - } -} - -// define like this to please codeintel/intellisense IDEs -request.get = verbFunc('get') -request.head = verbFunc('head') -request.post = verbFunc('post') -request.put = verbFunc('put') -request.patch = verbFunc('patch') -request.del = verbFunc('delete') -request['delete'] = verbFunc('delete') - -request.jar = function (store) { - return cookies.jar(store) -} - -request.cookie = function (str) { - return cookies.parse(str) -} - -function wrapRequestMethod (method, options, requester, verb) { - - return function (uri, opts, callback) { - var params = initParams(uri, opts, callback) - - var target = {} - extend(true, target, options, params) - - target.pool = params.pool || options.pool - - if (verb) { - target.method = verb.toUpperCase() - } - - if (isFunction(requester)) { - method = requester - } - - return method(target, target.callback) - } -} - -request.defaults = function (options, requester) { - var self = this - - options = options || {} - - if (typeof options === 'function') { - requester = options - options = {} - } - - var defaults = wrapRequestMethod(self, options, requester) - - var verbs = ['get', 'head', 'post', 'put', 'patch', 'del', 'delete'] - verbs.forEach(function(verb) { - defaults[verb] = wrapRequestMethod(self[verb], options, requester, verb) - }) - - defaults.cookie = wrapRequestMethod(self.cookie, options, requester) - defaults.jar = self.jar - defaults.defaults = self.defaults - return defaults -} - -request.forever = function (agentOptions, optionsArg) { - var options = {} - if (optionsArg) { - extend(options, optionsArg) - } - if (agentOptions) { - options.agentOptions = agentOptions - } - - options.forever = true - return request.defaults(options) -} - -// Exports - -module.exports = request -request.Request = require('./request') -request.initParams = initParams - -// Backwards compatibility for request.debug -Object.defineProperty(request, 'debug', { - enumerable : true, - get : function() { - return request.Request.debug - }, - set : function(debug) { - request.Request.debug = debug - } -}) diff --git a/APIs/node_modules/request/lib/auth.js b/APIs/node_modules/request/lib/auth.js deleted file mode 100644 index 1cb69521..00000000 --- a/APIs/node_modules/request/lib/auth.js +++ /dev/null @@ -1,168 +0,0 @@ -'use strict' - -var caseless = require('caseless') - , uuid = require('node-uuid') - , helpers = require('./helpers') - -var md5 = helpers.md5 - , toBase64 = helpers.toBase64 - - -function Auth (request) { - // define all public properties here - this.request = request - this.hasAuth = false - this.sentAuth = false - this.bearerToken = null - this.user = null - this.pass = null -} - -Auth.prototype.basic = function (user, pass, sendImmediately) { - var self = this - if (typeof user !== 'string' || (pass !== undefined && typeof pass !== 'string')) { - self.request.emit('error', new Error('auth() received invalid user or password')) - } - self.user = user - self.pass = pass - self.hasAuth = true - var header = user + ':' + (pass || '') - if (sendImmediately || typeof sendImmediately === 'undefined') { - var authHeader = 'Basic ' + toBase64(header) - self.sentAuth = true - return authHeader - } -} - -Auth.prototype.bearer = function (bearer, sendImmediately) { - var self = this - self.bearerToken = bearer - self.hasAuth = true - if (sendImmediately || typeof sendImmediately === 'undefined') { - if (typeof bearer === 'function') { - bearer = bearer() - } - var authHeader = 'Bearer ' + (bearer || '') - self.sentAuth = true - return authHeader - } -} - -Auth.prototype.digest = function (method, path, authHeader) { - // TODO: More complete implementation of RFC 2617. - // - handle challenge.domain - // - support qop="auth-int" only - // - handle Authentication-Info (not necessarily?) - // - check challenge.stale (not necessarily?) - // - increase nc (not necessarily?) - // For reference: - // http://tools.ietf.org/html/rfc2617#section-3 - // https://github.com/bagder/curl/blob/master/lib/http_digest.c - - var self = this - - var challenge = {} - var re = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi - for (;;) { - var match = re.exec(authHeader) - if (!match) { - break - } - challenge[match[1]] = match[2] || match[3] - } - - /** - * RFC 2617: handle both MD5 and MD5-sess algorithms. - * - * If the algorithm directive's value is "MD5" or unspecified, then HA1 is - * HA1=MD5(username:realm:password) - * If the algorithm directive's value is "MD5-sess", then HA1 is - * HA1=MD5(MD5(username:realm:password):nonce:cnonce) - */ - var ha1Compute = function (algorithm, user, realm, pass, nonce, cnonce) { - var ha1 = md5(user + ':' + realm + ':' + pass) - if (algorithm && algorithm.toLowerCase() === 'md5-sess') { - return md5(ha1 + ':' + nonce + ':' + cnonce) - } else { - return ha1 - } - } - - var qop = /(^|,)\s*auth\s*($|,)/.test(challenge.qop) && 'auth' - var nc = qop && '00000001' - var cnonce = qop && uuid().replace(/-/g, '') - var ha1 = ha1Compute(challenge.algorithm, self.user, challenge.realm, self.pass, challenge.nonce, cnonce) - var ha2 = md5(method + ':' + path) - var digestResponse = qop - ? md5(ha1 + ':' + challenge.nonce + ':' + nc + ':' + cnonce + ':' + qop + ':' + ha2) - : md5(ha1 + ':' + challenge.nonce + ':' + ha2) - var authValues = { - username: self.user, - realm: challenge.realm, - nonce: challenge.nonce, - uri: path, - qop: qop, - response: digestResponse, - nc: nc, - cnonce: cnonce, - algorithm: challenge.algorithm, - opaque: challenge.opaque - } - - authHeader = [] - for (var k in authValues) { - if (authValues[k]) { - if (k === 'qop' || k === 'nc' || k === 'algorithm') { - authHeader.push(k + '=' + authValues[k]) - } else { - authHeader.push(k + '="' + authValues[k] + '"') - } - } - } - authHeader = 'Digest ' + authHeader.join(', ') - self.sentAuth = true - return authHeader -} - -Auth.prototype.onRequest = function (user, pass, sendImmediately, bearer) { - var self = this - , request = self.request - - var authHeader - if (bearer === undefined && user === undefined) { - self.request.emit('error', new Error('no auth mechanism defined')) - } else if (bearer !== undefined) { - authHeader = self.bearer(bearer, sendImmediately) - } else { - authHeader = self.basic(user, pass, sendImmediately) - } - if (authHeader) { - request.setHeader('authorization', authHeader) - } -} - -Auth.prototype.onResponse = function (response) { - var self = this - , request = self.request - - if (!self.hasAuth || self.sentAuth) { return null } - - var c = caseless(response.headers) - - var authHeader = c.get('www-authenticate') - var authVerb = authHeader && authHeader.split(' ')[0].toLowerCase() - request.debug('reauth', authVerb) - - switch (authVerb) { - case 'basic': - return self.basic(self.user, self.pass, true) - - case 'bearer': - return self.bearer(self.bearerToken, true) - - case 'digest': - return self.digest(request.method, request.path, authHeader) - } -} - -exports.Auth = Auth diff --git a/APIs/node_modules/request/lib/cookies.js b/APIs/node_modules/request/lib/cookies.js deleted file mode 100644 index 412c07d6..00000000 --- a/APIs/node_modules/request/lib/cookies.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -var tough = require('tough-cookie') - -var Cookie = tough.Cookie - , CookieJar = tough.CookieJar - - -exports.parse = function(str) { - if (str && str.uri) { - str = str.uri - } - if (typeof str !== 'string') { - throw new Error('The cookie function only accepts STRING as param') - } - return Cookie.parse(str, {loose: true}) -} - -// Adapt the sometimes-Async api of tough.CookieJar to our requirements -function RequestJar(store) { - var self = this - self._jar = new CookieJar(store, {looseMode: true}) -} -RequestJar.prototype.setCookie = function(cookieOrStr, uri, options) { - var self = this - return self._jar.setCookieSync(cookieOrStr, uri, options || {}) -} -RequestJar.prototype.getCookieString = function(uri) { - var self = this - return self._jar.getCookieStringSync(uri) -} -RequestJar.prototype.getCookies = function(uri) { - var self = this - return self._jar.getCookiesSync(uri) -} - -exports.jar = function(store) { - return new RequestJar(store) -} diff --git a/APIs/node_modules/request/lib/getProxyFromURI.js b/APIs/node_modules/request/lib/getProxyFromURI.js deleted file mode 100644 index c2013a6e..00000000 --- a/APIs/node_modules/request/lib/getProxyFromURI.js +++ /dev/null @@ -1,79 +0,0 @@ -'use strict' - -function formatHostname(hostname) { - // canonicalize the hostname, so that 'oogle.com' won't match 'google.com' - return hostname.replace(/^\.*/, '.').toLowerCase() -} - -function parseNoProxyZone(zone) { - zone = zone.trim().toLowerCase() - - var zoneParts = zone.split(':', 2) - , zoneHost = formatHostname(zoneParts[0]) - , zonePort = zoneParts[1] - , hasPort = zone.indexOf(':') > -1 - - return {hostname: zoneHost, port: zonePort, hasPort: hasPort} -} - -function uriInNoProxy(uri, noProxy) { - var port = uri.port || (uri.protocol === 'https:' ? '443' : '80') - , hostname = formatHostname(uri.hostname) - , noProxyList = noProxy.split(',') - - // iterate through the noProxyList until it finds a match. - return noProxyList.map(parseNoProxyZone).some(function(noProxyZone) { - var isMatchedAt = hostname.indexOf(noProxyZone.hostname) - , hostnameMatched = ( - isMatchedAt > -1 && - (isMatchedAt === hostname.length - noProxyZone.hostname.length) - ) - - if (noProxyZone.hasPort) { - return (port === noProxyZone.port) && hostnameMatched - } - - return hostnameMatched - }) -} - -function getProxyFromURI(uri) { - // Decide the proper request proxy to use based on the request URI object and the - // environmental variables (NO_PROXY, HTTP_PROXY, etc.) - // respect NO_PROXY environment variables (see: http://lynx.isc.org/current/breakout/lynx_help/keystrokes/environments.html) - - var noProxy = process.env.NO_PROXY || process.env.no_proxy || '' - - // if the noProxy is a wildcard then return null - - if (noProxy === '*') { - return null - } - - // if the noProxy is not empty and the uri is found return null - - if (noProxy !== '' && uriInNoProxy(uri, noProxy)) { - return null - } - - // Check for HTTP or HTTPS Proxy in environment Else default to null - - if (uri.protocol === 'http:') { - return process.env.HTTP_PROXY || - process.env.http_proxy || null - } - - if (uri.protocol === 'https:') { - return process.env.HTTPS_PROXY || - process.env.https_proxy || - process.env.HTTP_PROXY || - process.env.http_proxy || null - } - - // if none of that works, return null - // (What uri protocol are you using then?) - - return null -} - -module.exports = getProxyFromURI diff --git a/APIs/node_modules/request/lib/har.js b/APIs/node_modules/request/lib/har.js deleted file mode 100644 index 30595748..00000000 --- a/APIs/node_modules/request/lib/har.js +++ /dev/null @@ -1,215 +0,0 @@ -'use strict' - -var fs = require('fs') -var qs = require('querystring') -var validate = require('har-validator') -var extend = require('extend') - -function Har (request) { - this.request = request -} - -Har.prototype.reducer = function (obj, pair) { - // new property ? - if (obj[pair.name] === undefined) { - obj[pair.name] = pair.value - return obj - } - - // existing? convert to array - var arr = [ - obj[pair.name], - pair.value - ] - - obj[pair.name] = arr - - return obj -} - -Har.prototype.prep = function (data) { - // construct utility properties - data.queryObj = {} - data.headersObj = {} - data.postData.jsonObj = false - data.postData.paramsObj = false - - // construct query objects - if (data.queryString && data.queryString.length) { - data.queryObj = data.queryString.reduce(this.reducer, {}) - } - - // construct headers objects - if (data.headers && data.headers.length) { - // loweCase header keys - data.headersObj = data.headers.reduceRight(function (headers, header) { - headers[header.name] = header.value - return headers - }, {}) - } - - // construct Cookie header - if (data.cookies && data.cookies.length) { - var cookies = data.cookies.map(function (cookie) { - return cookie.name + '=' + cookie.value - }) - - if (cookies.length) { - data.headersObj.cookie = cookies.join('; ') - } - } - - // prep body - function some (arr) { - return arr.some(function (type) { - return data.postData.mimeType.indexOf(type) === 0 - }) - } - - if (some([ - 'multipart/mixed', - 'multipart/related', - 'multipart/form-data', - 'multipart/alternative'])) { - - // reset values - data.postData.mimeType = 'multipart/form-data' - } - - else if (some([ - 'application/x-www-form-urlencoded'])) { - - if (!data.postData.params) { - data.postData.text = '' - } else { - data.postData.paramsObj = data.postData.params.reduce(this.reducer, {}) - - // always overwrite - data.postData.text = qs.stringify(data.postData.paramsObj) - } - } - - else if (some([ - 'text/json', - 'text/x-json', - 'application/json', - 'application/x-json'])) { - - data.postData.mimeType = 'application/json' - - if (data.postData.text) { - try { - data.postData.jsonObj = JSON.parse(data.postData.text) - } catch (e) { - this.request.debug(e) - - // force back to text/plain - data.postData.mimeType = 'text/plain' - } - } - } - - return data -} - -Har.prototype.options = function (options) { - // skip if no har property defined - if (!options.har) { - return options - } - - var har = {} - extend(har, options.har) - - // only process the first entry - if (har.log && har.log.entries) { - har = har.log.entries[0] - } - - // add optional properties to make validation successful - har.url = har.url || options.url || options.uri || options.baseUrl || '/' - har.httpVersion = har.httpVersion || 'HTTP/1.1' - har.queryString = har.queryString || [] - har.headers = har.headers || [] - har.cookies = har.cookies || [] - har.postData = har.postData || {} - har.postData.mimeType = har.postData.mimeType || 'application/octet-stream' - - har.bodySize = 0 - har.headersSize = 0 - har.postData.size = 0 - - if (!validate.request(har)) { - return options - } - - // clean up and get some utility properties - var req = this.prep(har) - - // construct new options - if (req.url) { - options.url = req.url - } - - if (req.method) { - options.method = req.method - } - - if (Object.keys(req.queryObj).length) { - options.qs = req.queryObj - } - - if (Object.keys(req.headersObj).length) { - options.headers = req.headersObj - } - - function test (type) { - return req.postData.mimeType.indexOf(type) === 0 - } - if (test('application/x-www-form-urlencoded')) { - options.form = req.postData.paramsObj - } - else if (test('application/json')) { - if (req.postData.jsonObj) { - options.body = req.postData.jsonObj - options.json = true - } - } - else if (test('multipart/form-data')) { - options.formData = {} - - req.postData.params.forEach(function (param) { - var attachment = {} - - if (!param.fileName && !param.fileName && !param.contentType) { - options.formData[param.name] = param.value - return - } - - // attempt to read from disk! - if (param.fileName && !param.value) { - attachment.value = fs.createReadStream(param.fileName) - } else if (param.value) { - attachment.value = param.value - } - - if (param.fileName) { - attachment.options = { - filename: param.fileName, - contentType: param.contentType ? param.contentType : null - } - } - - options.formData[param.name] = attachment - }) - } - else { - if (req.postData.text) { - options.body = req.postData.text - } - } - - return options -} - -exports.Har = Har diff --git a/APIs/node_modules/request/lib/helpers.js b/APIs/node_modules/request/lib/helpers.js deleted file mode 100644 index 356ff748..00000000 --- a/APIs/node_modules/request/lib/helpers.js +++ /dev/null @@ -1,74 +0,0 @@ -'use strict' - -var jsonSafeStringify = require('json-stringify-safe') - , crypto = require('crypto') - -function deferMethod() { - if (typeof setImmediate === 'undefined') { - return process.nextTick - } - - return setImmediate -} - -function isFunction(value) { - return typeof value === 'function' -} - -function paramsHaveRequestBody(params) { - return ( - params.body || - params.requestBodyStream || - (params.json && typeof params.json !== 'boolean') || - params.multipart - ) -} - -function safeStringify (obj, replacer) { - var ret - try { - ret = JSON.stringify(obj, replacer) - } catch (e) { - ret = jsonSafeStringify(obj, replacer) - } - return ret -} - -function md5 (str) { - return crypto.createHash('md5').update(str).digest('hex') -} - -function isReadStream (rs) { - return rs.readable && rs.path && rs.mode -} - -function toBase64 (str) { - return (new Buffer(str || '', 'utf8')).toString('base64') -} - -function copy (obj) { - var o = {} - Object.keys(obj).forEach(function (i) { - o[i] = obj[i] - }) - return o -} - -function version () { - var numbers = process.version.replace('v', '').split('.') - return { - major: parseInt(numbers[0], 10), - minor: parseInt(numbers[1], 10), - patch: parseInt(numbers[2], 10) - } -} - -exports.isFunction = isFunction -exports.paramsHaveRequestBody = paramsHaveRequestBody -exports.safeStringify = safeStringify -exports.md5 = md5 -exports.isReadStream = isReadStream -exports.toBase64 = toBase64 -exports.copy = copy -exports.version = version -exports.defer = deferMethod() diff --git a/APIs/node_modules/request/lib/multipart.js b/APIs/node_modules/request/lib/multipart.js deleted file mode 100644 index c1281726..00000000 --- a/APIs/node_modules/request/lib/multipart.js +++ /dev/null @@ -1,112 +0,0 @@ -'use strict' - -var uuid = require('node-uuid') - , CombinedStream = require('combined-stream') - , isstream = require('isstream') - - -function Multipart (request) { - this.request = request - this.boundary = uuid() - this.chunked = false - this.body = null -} - -Multipart.prototype.isChunked = function (options) { - var self = this - , chunked = false - , parts = options.data || options - - if (!parts.forEach) { - self.request.emit('error', new Error('Argument error, options.multipart.')) - } - - if (options.chunked !== undefined) { - chunked = options.chunked - } - - if (self.request.getHeader('transfer-encoding') === 'chunked') { - chunked = true - } - - if (!chunked) { - parts.forEach(function (part) { - if (typeof part.body === 'undefined') { - self.request.emit('error', new Error('Body attribute missing in multipart.')) - } - if (isstream(part.body)) { - chunked = true - } - }) - } - - return chunked -} - -Multipart.prototype.setHeaders = function (chunked) { - var self = this - - if (chunked && !self.request.hasHeader('transfer-encoding')) { - self.request.setHeader('transfer-encoding', 'chunked') - } - - var header = self.request.getHeader('content-type') - - if (!header || header.indexOf('multipart') === -1) { - self.request.setHeader('content-type', 'multipart/related; boundary=' + self.boundary) - } else { - if (header.indexOf('boundary') !== -1) { - self.boundary = header.replace(/.*boundary=([^\s;]+).*/, '$1') - } else { - self.request.setHeader('content-type', header + '; boundary=' + self.boundary) - } - } -} - -Multipart.prototype.build = function (parts, chunked) { - var self = this - var body = chunked ? new CombinedStream() : [] - - function add (part) { - if (typeof part === 'number') { - part = part.toString() - } - return chunked ? body.append(part) : body.push(new Buffer(part)) - } - - if (self.request.preambleCRLF) { - add('\r\n') - } - - parts.forEach(function (part) { - var preamble = '--' + self.boundary + '\r\n' - Object.keys(part).forEach(function (key) { - if (key === 'body') { return } - preamble += key + ': ' + part[key] + '\r\n' - }) - preamble += '\r\n' - add(preamble) - add(part.body) - add('\r\n') - }) - add('--' + self.boundary + '--') - - if (self.request.postambleCRLF) { - add('\r\n') - } - - return body -} - -Multipart.prototype.onRequest = function (options) { - var self = this - - var chunked = self.isChunked(options) - , parts = options.data || options - - self.setHeaders(chunked) - self.chunked = chunked - self.body = self.build(parts, chunked) -} - -exports.Multipart = Multipart diff --git a/APIs/node_modules/request/lib/oauth.js b/APIs/node_modules/request/lib/oauth.js deleted file mode 100644 index c24209b8..00000000 --- a/APIs/node_modules/request/lib/oauth.js +++ /dev/null @@ -1,147 +0,0 @@ -'use strict' - -var url = require('url') - , qs = require('qs') - , caseless = require('caseless') - , uuid = require('node-uuid') - , oauth = require('oauth-sign') - , crypto = require('crypto') - - -function OAuth (request) { - this.request = request - this.params = null -} - -OAuth.prototype.buildParams = function (_oauth, uri, method, query, form, qsLib) { - var oa = {} - for (var i in _oauth) { - oa['oauth_' + i] = _oauth[i] - } - if (!oa.oauth_version) { - oa.oauth_version = '1.0' - } - if (!oa.oauth_timestamp) { - oa.oauth_timestamp = Math.floor( Date.now() / 1000 ).toString() - } - if (!oa.oauth_nonce) { - oa.oauth_nonce = uuid().replace(/-/g, '') - } - if (!oa.oauth_signature_method) { - oa.oauth_signature_method = 'HMAC-SHA1' - } - - var consumer_secret_or_private_key = oa.oauth_consumer_secret || oa.oauth_private_key - delete oa.oauth_consumer_secret - delete oa.oauth_private_key - - var token_secret = oa.oauth_token_secret - delete oa.oauth_token_secret - - var realm = oa.oauth_realm - delete oa.oauth_realm - delete oa.oauth_transport_method - - var baseurl = uri.protocol + '//' + uri.host + uri.pathname - var params = qsLib.parse([].concat(query, form, qsLib.stringify(oa)).join('&')) - - oa.oauth_signature = oauth.sign( - oa.oauth_signature_method, - method, - baseurl, - params, - consumer_secret_or_private_key, - token_secret) - - if (realm) { - oa.realm = realm - } - - return oa -} - -OAuth.prototype.buildBodyHash = function(_oauth, body) { - if (['HMAC-SHA1', 'RSA-SHA1'].indexOf(_oauth.signature_method || 'HMAC-SHA1') < 0) { - this.request.emit('error', new Error('oauth: ' + _oauth.signature_method + - ' signature_method not supported with body_hash signing.')) - } - - var shasum = crypto.createHash('sha1') - shasum.update(body || '') - var sha1 = shasum.digest('hex') - - return new Buffer(sha1).toString('base64') -} - -OAuth.prototype.concatParams = function (oa, sep, wrap) { - wrap = wrap || '' - - var params = Object.keys(oa).filter(function (i) { - return i !== 'realm' && i !== 'oauth_signature' - }).sort() - - if (oa.realm) { - params.splice(0, 0, 'realm') - } - params.push('oauth_signature') - - return params.map(function (i) { - return i + '=' + wrap + oauth.rfc3986(oa[i]) + wrap - }).join(sep) -} - -OAuth.prototype.onRequest = function (_oauth) { - var self = this - self.params = _oauth - - var uri = self.request.uri || {} - , method = self.request.method || '' - , headers = caseless(self.request.headers) - , body = self.request.body || '' - , qsLib = self.request.qsLib || qs - - var form - , query - , contentType = headers.get('content-type') || '' - , formContentType = 'application/x-www-form-urlencoded' - , transport = _oauth.transport_method || 'header' - - if (contentType.slice(0, formContentType.length) === formContentType) { - contentType = formContentType - form = body - } - if (uri.query) { - query = uri.query - } - if (transport === 'body' && (method !== 'POST' || contentType !== formContentType)) { - self.request.emit('error', new Error('oauth: transport_method of body requires POST ' + - 'and content-type ' + formContentType)) - } - - if (!form && typeof _oauth.body_hash === 'boolean') { - _oauth.body_hash = self.buildBodyHash(_oauth, self.request.body.toString()) - } - - var oa = self.buildParams(_oauth, uri, method, query, form, qsLib) - - switch (transport) { - case 'header': - self.request.setHeader('Authorization', 'OAuth ' + self.concatParams(oa, ',', '"')) - break - - case 'query': - var href = self.request.uri.href += (query ? '&' : '?') + self.concatParams(oa, '&') - self.request.uri = url.parse(href) - self.request.path = self.request.uri.path - break - - case 'body': - self.request.body = (form ? form + '&' : '') + self.concatParams(oa, '&') - break - - default: - self.request.emit('error', new Error('oauth: transport_method invalid')) - } -} - -exports.OAuth = OAuth diff --git a/APIs/node_modules/request/lib/querystring.js b/APIs/node_modules/request/lib/querystring.js deleted file mode 100644 index baf5e802..00000000 --- a/APIs/node_modules/request/lib/querystring.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict' - -var qs = require('qs') - , querystring = require('querystring') - - -function Querystring (request) { - this.request = request - this.lib = null - this.useQuerystring = null - this.parseOptions = null - this.stringifyOptions = null -} - -Querystring.prototype.init = function (options) { - if (this.lib) {return} - - this.useQuerystring = options.useQuerystring - this.lib = (this.useQuerystring ? querystring : qs) - - this.parseOptions = options.qsParseOptions || {} - this.stringifyOptions = options.qsStringifyOptions || {} -} - -Querystring.prototype.stringify = function (obj) { - return (this.useQuerystring) - ? this.rfc3986(this.lib.stringify(obj, - this.stringifyOptions.sep || null, - this.stringifyOptions.eq || null, - this.stringifyOptions)) - : this.lib.stringify(obj, this.stringifyOptions) -} - -Querystring.prototype.parse = function (str) { - return (this.useQuerystring) - ? this.lib.parse(str, - this.parseOptions.sep || null, - this.parseOptions.eq || null, - this.parseOptions) - : this.lib.parse(str, this.parseOptions) -} - -Querystring.prototype.rfc3986 = function (str) { - return str.replace(/[!'()*]/g, function (c) { - return '%' + c.charCodeAt(0).toString(16).toUpperCase() - }) -} - -Querystring.prototype.unescape = querystring.unescape - -exports.Querystring = Querystring diff --git a/APIs/node_modules/request/lib/redirect.js b/APIs/node_modules/request/lib/redirect.js deleted file mode 100644 index 040dfe0e..00000000 --- a/APIs/node_modules/request/lib/redirect.js +++ /dev/null @@ -1,153 +0,0 @@ -'use strict' - -var url = require('url') -var isUrl = /^https?:/ - -function Redirect (request) { - this.request = request - this.followRedirect = true - this.followRedirects = true - this.followAllRedirects = false - this.allowRedirect = function () {return true} - this.maxRedirects = 10 - this.redirects = [] - this.redirectsFollowed = 0 - this.removeRefererHeader = false -} - -Redirect.prototype.onRequest = function (options) { - var self = this - - if (options.maxRedirects !== undefined) { - self.maxRedirects = options.maxRedirects - } - if (typeof options.followRedirect === 'function') { - self.allowRedirect = options.followRedirect - } - if (options.followRedirect !== undefined) { - self.followRedirects = !!options.followRedirect - } - if (options.followAllRedirects !== undefined) { - self.followAllRedirects = options.followAllRedirects - } - if (self.followRedirects || self.followAllRedirects) { - self.redirects = self.redirects || [] - } - if (options.removeRefererHeader !== undefined) { - self.removeRefererHeader = options.removeRefererHeader - } -} - -Redirect.prototype.redirectTo = function (response) { - var self = this - , request = self.request - - var redirectTo = null - if (response.statusCode >= 300 && response.statusCode < 400 && response.caseless.has('location')) { - var location = response.caseless.get('location') - request.debug('redirect', location) - - if (self.followAllRedirects) { - redirectTo = location - } else if (self.followRedirects) { - switch (request.method) { - case 'PATCH': - case 'PUT': - case 'POST': - case 'DELETE': - // Do not follow redirects - break - default: - redirectTo = location - break - } - } - } else if (response.statusCode === 401) { - var authHeader = request._auth.onResponse(response) - if (authHeader) { - request.setHeader('authorization', authHeader) - redirectTo = request.uri - } - } - return redirectTo -} - -Redirect.prototype.onResponse = function (response) { - var self = this - , request = self.request - - var redirectTo = self.redirectTo(response) - if (!redirectTo || !self.allowRedirect.call(request, response)) { - return false - } - - request.debug('redirect to', redirectTo) - - // ignore any potential response body. it cannot possibly be useful - // to us at this point. - // response.resume should be defined, but check anyway before calling. Workaround for browserify. - if (response.resume) { - response.resume() - } - - if (self.redirectsFollowed >= self.maxRedirects) { - request.emit('error', new Error('Exceeded maxRedirects. Probably stuck in a redirect loop ' + request.uri.href)) - return false - } - self.redirectsFollowed += 1 - - if (!isUrl.test(redirectTo)) { - redirectTo = url.resolve(request.uri.href, redirectTo) - } - - var uriPrev = request.uri - request.uri = url.parse(redirectTo) - - // handle the case where we change protocol from https to http or vice versa - if (request.uri.protocol !== uriPrev.protocol) { - delete request.agent - } - - self.redirects.push( - { statusCode : response.statusCode - , redirectUri: redirectTo - } - ) - if (self.followAllRedirects && request.method !== 'HEAD' - && response.statusCode !== 401 && response.statusCode !== 307) { - request.method = 'GET' - } - // request.method = 'GET' // Force all redirects to use GET || commented out fixes #215 - delete request.src - delete request.req - delete request._started - if (response.statusCode !== 401 && response.statusCode !== 307) { - // Remove parameters from the previous response, unless this is the second request - // for a server that requires digest authentication. - delete request.body - delete request._form - if (request.headers) { - request.removeHeader('host') - request.removeHeader('content-type') - request.removeHeader('content-length') - if (request.uri.hostname !== request.originalHost.split(':')[0]) { - // Remove authorization if changing hostnames (but not if just - // changing ports or protocols). This matches the behavior of curl: - // https://github.com/bagder/curl/blob/6beb0eee/lib/http.c#L710 - request.removeHeader('authorization') - } - } - } - - if (!self.removeRefererHeader) { - request.setHeader('referer', uriPrev.href) - } - - request.emit('redirect') - - request.init() - - return true -} - -exports.Redirect = Redirect diff --git a/APIs/node_modules/request/lib/tunnel.js b/APIs/node_modules/request/lib/tunnel.js deleted file mode 100644 index bf96a8fe..00000000 --- a/APIs/node_modules/request/lib/tunnel.js +++ /dev/null @@ -1,176 +0,0 @@ -'use strict' - -var url = require('url') - , tunnel = require('tunnel-agent') - -var defaultProxyHeaderWhiteList = [ - 'accept', - 'accept-charset', - 'accept-encoding', - 'accept-language', - 'accept-ranges', - 'cache-control', - 'content-encoding', - 'content-language', - 'content-location', - 'content-md5', - 'content-range', - 'content-type', - 'connection', - 'date', - 'expect', - 'max-forwards', - 'pragma', - 'referer', - 'te', - 'user-agent', - 'via' -] - -var defaultProxyHeaderExclusiveList = [ - 'proxy-authorization' -] - -function constructProxyHost(uriObject) { - var port = uriObject.port - , protocol = uriObject.protocol - , proxyHost = uriObject.hostname + ':' - - if (port) { - proxyHost += port - } else if (protocol === 'https:') { - proxyHost += '443' - } else { - proxyHost += '80' - } - - return proxyHost -} - -function constructProxyHeaderWhiteList(headers, proxyHeaderWhiteList) { - var whiteList = proxyHeaderWhiteList - .reduce(function (set, header) { - set[header.toLowerCase()] = true - return set - }, {}) - - return Object.keys(headers) - .filter(function (header) { - return whiteList[header.toLowerCase()] - }) - .reduce(function (set, header) { - set[header] = headers[header] - return set - }, {}) -} - -function constructTunnelOptions (request, proxyHeaders) { - var proxy = request.proxy - - var tunnelOptions = { - proxy : { - host : proxy.hostname, - port : +proxy.port, - proxyAuth : proxy.auth, - headers : proxyHeaders - }, - headers : request.headers, - ca : request.ca, - cert : request.cert, - key : request.key, - passphrase : request.passphrase, - pfx : request.pfx, - ciphers : request.ciphers, - rejectUnauthorized : request.rejectUnauthorized, - secureOptions : request.secureOptions, - secureProtocol : request.secureProtocol - } - - return tunnelOptions -} - -function constructTunnelFnName(uri, proxy) { - var uriProtocol = (uri.protocol === 'https:' ? 'https' : 'http') - var proxyProtocol = (proxy.protocol === 'https:' ? 'Https' : 'Http') - return [uriProtocol, proxyProtocol].join('Over') -} - -function getTunnelFn(request) { - var uri = request.uri - var proxy = request.proxy - var tunnelFnName = constructTunnelFnName(uri, proxy) - return tunnel[tunnelFnName] -} - - -function Tunnel (request) { - this.request = request - this.proxyHeaderWhiteList = defaultProxyHeaderWhiteList - this.proxyHeaderExclusiveList = [] - if (typeof request.tunnel !== 'undefined') { - this.tunnelOverride = request.tunnel - } -} - -Tunnel.prototype.isEnabled = function () { - var self = this - , request = self.request - // Tunnel HTTPS by default. Allow the user to override this setting. - - // If self.tunnelOverride is set (the user specified a value), use it. - if (typeof self.tunnelOverride !== 'undefined') { - return self.tunnelOverride - } - - // If the destination is HTTPS, tunnel. - if (request.uri.protocol === 'https:') { - return true - } - - // Otherwise, do not use tunnel. - return false -} - -Tunnel.prototype.setup = function (options) { - var self = this - , request = self.request - - options = options || {} - - if (typeof request.proxy === 'string') { - request.proxy = url.parse(request.proxy) - } - - if (!request.proxy || !request.tunnel) { - return false - } - - // Setup Proxy Header Exclusive List and White List - if (options.proxyHeaderWhiteList) { - self.proxyHeaderWhiteList = options.proxyHeaderWhiteList - } - if (options.proxyHeaderExclusiveList) { - self.proxyHeaderExclusiveList = options.proxyHeaderExclusiveList - } - - var proxyHeaderExclusiveList = self.proxyHeaderExclusiveList.concat(defaultProxyHeaderExclusiveList) - var proxyHeaderWhiteList = self.proxyHeaderWhiteList.concat(proxyHeaderExclusiveList) - - // Setup Proxy Headers and Proxy Headers Host - // Only send the Proxy White Listed Header names - var proxyHeaders = constructProxyHeaderWhiteList(request.headers, proxyHeaderWhiteList) - proxyHeaders.host = constructProxyHost(request.uri) - - proxyHeaderExclusiveList.forEach(request.removeHeader, request) - - // Set Agent from Tunnel Data - var tunnelFn = getTunnelFn(request) - var tunnelOptions = constructTunnelOptions(request, proxyHeaders) - request.agent = tunnelFn(tunnelOptions) - - return true -} - -Tunnel.defaultProxyHeaderWhiteList = defaultProxyHeaderWhiteList -Tunnel.defaultProxyHeaderExclusiveList = defaultProxyHeaderExclusiveList -exports.Tunnel = Tunnel diff --git a/APIs/node_modules/request/node_modules/.bin/har-validator b/APIs/node_modules/request/node_modules/.bin/har-validator deleted file mode 120000 index c6ec1634..00000000 --- a/APIs/node_modules/request/node_modules/.bin/har-validator +++ /dev/null @@ -1 +0,0 @@ -../har-validator/bin/har-validator \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/.bin/uuid b/APIs/node_modules/request/node_modules/.bin/uuid deleted file mode 120000 index 80eb14aa..00000000 --- a/APIs/node_modules/request/node_modules/.bin/uuid +++ /dev/null @@ -1 +0,0 @@ -../node-uuid/bin/uuid \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/aws-sign2/LICENSE b/APIs/node_modules/request/node_modules/aws-sign2/LICENSE deleted file mode 100644 index a4a9aee0..00000000 --- a/APIs/node_modules/request/node_modules/aws-sign2/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/aws-sign2/README.md b/APIs/node_modules/request/node_modules/aws-sign2/README.md deleted file mode 100644 index 763564e0..00000000 --- a/APIs/node_modules/request/node_modules/aws-sign2/README.md +++ /dev/null @@ -1,4 +0,0 @@ -aws-sign -======== - -AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module. diff --git a/APIs/node_modules/request/node_modules/aws-sign2/index.js b/APIs/node_modules/request/node_modules/aws-sign2/index.js deleted file mode 100644 index ac720930..00000000 --- a/APIs/node_modules/request/node_modules/aws-sign2/index.js +++ /dev/null @@ -1,212 +0,0 @@ - -/*! - * Copyright 2010 LearnBoost - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * Module dependencies. - */ - -var crypto = require('crypto') - , parse = require('url').parse - ; - -/** - * Valid keys. - */ - -var keys = - [ 'acl' - , 'location' - , 'logging' - , 'notification' - , 'partNumber' - , 'policy' - , 'requestPayment' - , 'torrent' - , 'uploadId' - , 'uploads' - , 'versionId' - , 'versioning' - , 'versions' - , 'website' - ] - -/** - * Return an "Authorization" header value with the given `options` - * in the form of "AWS :" - * - * @param {Object} options - * @return {String} - * @api private - */ - -function authorization (options) { - return 'AWS ' + options.key + ':' + sign(options) -} - -module.exports = authorization -module.exports.authorization = authorization - -/** - * Simple HMAC-SHA1 Wrapper - * - * @param {Object} options - * @return {String} - * @api private - */ - -function hmacSha1 (options) { - return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64') -} - -module.exports.hmacSha1 = hmacSha1 - -/** - * Create a base64 sha1 HMAC for `options`. - * - * @param {Object} options - * @return {String} - * @api private - */ - -function sign (options) { - options.message = stringToSign(options) - return hmacSha1(options) -} -module.exports.sign = sign - -/** - * Create a base64 sha1 HMAC for `options`. - * - * Specifically to be used with S3 presigned URLs - * - * @param {Object} options - * @return {String} - * @api private - */ - -function signQuery (options) { - options.message = queryStringToSign(options) - return hmacSha1(options) -} -module.exports.signQuery= signQuery - -/** - * Return a string for sign() with the given `options`. - * - * Spec: - * - * \n - * \n - * \n - * \n - * [headers\n] - * - * - * @param {Object} options - * @return {String} - * @api private - */ - -function stringToSign (options) { - var headers = options.amazonHeaders || '' - if (headers) headers += '\n' - var r = - [ options.verb - , options.md5 - , options.contentType - , options.date ? options.date.toUTCString() : '' - , headers + options.resource - ] - return r.join('\n') -} -module.exports.queryStringToSign = stringToSign - -/** - * Return a string for sign() with the given `options`, but is meant exclusively - * for S3 presigned URLs - * - * Spec: - * - * \n - * - * - * @param {Object} options - * @return {String} - * @api private - */ - -function queryStringToSign (options){ - return 'GET\n\n\n' + options.date + '\n' + options.resource -} -module.exports.queryStringToSign = queryStringToSign - -/** - * Perform the following: - * - * - ignore non-amazon headers - * - lowercase fields - * - sort lexicographically - * - trim whitespace between ":" - * - join with newline - * - * @param {Object} headers - * @return {String} - * @api private - */ - -function canonicalizeHeaders (headers) { - var buf = [] - , fields = Object.keys(headers) - ; - for (var i = 0, len = fields.length; i < len; ++i) { - var field = fields[i] - , val = headers[field] - , field = field.toLowerCase() - ; - if (0 !== field.indexOf('x-amz')) continue - buf.push(field + ':' + val) - } - return buf.sort().join('\n') -} -module.exports.canonicalizeHeaders = canonicalizeHeaders - -/** - * Perform the following: - * - * - ignore non sub-resources - * - sort lexicographically - * - * @param {String} resource - * @return {String} - * @api private - */ - -function canonicalizeResource (resource) { - var url = parse(resource, true) - , path = url.pathname - , buf = [] - ; - - Object.keys(url.query).forEach(function(key){ - if (!~keys.indexOf(key)) return - var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key]) - buf.push(key + val) - }) - - return path + (buf.length ? '?' + buf.sort().join('&') : '') -} -module.exports.canonicalizeResource = canonicalizeResource diff --git a/APIs/node_modules/request/node_modules/aws-sign2/package.json b/APIs/node_modules/request/node_modules/aws-sign2/package.json deleted file mode 100644 index a743b855..00000000 --- a/APIs/node_modules/request/node_modules/aws-sign2/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com", - "url": "http://www.futurealoof.com" - }, - "name": "aws-sign2", - "description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.", - "version": "0.6.0", - "repository": { - "url": "git+https://github.com/mikeal/aws-sign.git" - }, - "license": "Apache-2.0", - "main": "index.js", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "gitHead": "8554bdb41268fa295eb1ee300f4adaa9f7f07fec", - "bugs": { - "url": "https://github.com/mikeal/aws-sign/issues" - }, - "homepage": "https://github.com/mikeal/aws-sign#readme", - "_id": "aws-sign2@0.6.0", - "scripts": {}, - "_shasum": "14342dd38dbcc94d0e5b87d763cd63612c0e794f", - "_from": "aws-sign2@~0.6.0", - "_npmVersion": "2.14.4", - "_nodeVersion": "4.1.2", - "_npmUser": { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - } - ], - "dist": { - "shasum": "14342dd38dbcc94d0e5b87d763cd63612c0e794f", - "tarball": "http://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/aws4/.npmignore b/APIs/node_modules/request/node_modules/aws4/.npmignore deleted file mode 100644 index 6c6ade6f..00000000 --- a/APIs/node_modules/request/node_modules/aws4/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -test -examples -example.js -browser diff --git a/APIs/node_modules/request/node_modules/aws4/.tern-port b/APIs/node_modules/request/node_modules/aws4/.tern-port deleted file mode 100644 index 7fd1b522..00000000 --- a/APIs/node_modules/request/node_modules/aws4/.tern-port +++ /dev/null @@ -1 +0,0 @@ -62638 \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/aws4/.travis.yml b/APIs/node_modules/request/node_modules/aws4/.travis.yml deleted file mode 100644 index 61d06340..00000000 --- a/APIs/node_modules/request/node_modules/aws4/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - "0.10" - - "0.12" - - "4.2" diff --git a/APIs/node_modules/request/node_modules/aws4/LICENSE b/APIs/node_modules/request/node_modules/aws4/LICENSE deleted file mode 100644 index 4f321e59..00000000 --- a/APIs/node_modules/request/node_modules/aws4/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright 2013 Michael Hart (michael.hart.au@gmail.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/APIs/node_modules/request/node_modules/aws4/README.md b/APIs/node_modules/request/node_modules/aws4/README.md deleted file mode 100644 index 6c55da80..00000000 --- a/APIs/node_modules/request/node_modules/aws4/README.md +++ /dev/null @@ -1,514 +0,0 @@ -aws4 ----- - -[![Build Status](https://secure.travis-ci.org/mhart/aws4.png?branch=master)](http://travis-ci.org/mhart/aws4) - -A small utility to sign vanilla node.js http(s) request options using Amazon's -[AWS Signature Version 4](http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html). - -Can also be used [in the browser](./browser). - -This signature is supported by nearly all Amazon services, including -[S3](http://docs.aws.amazon.com/AmazonS3/latest/API/), -[EC2](http://docs.aws.amazon.com/AWSEC2/latest/APIReference/), -[DynamoDB](http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/API.html), -[Kinesis](http://docs.aws.amazon.com/kinesis/latest/APIReference/), -[Lambda](http://docs.aws.amazon.com/lambda/latest/dg/API_Reference.html), -[SQS](http://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/), -[SNS](http://docs.aws.amazon.com/sns/latest/api/), -[IAM](http://docs.aws.amazon.com/IAM/latest/APIReference/), -[STS](http://docs.aws.amazon.com/STS/latest/APIReference/), -[RDS](http://docs.aws.amazon.com/AmazonRDS/latest/APIReference/), -[CloudWatch](http://docs.aws.amazon.com/AmazonCloudWatch/latest/APIReference/), -[CloudWatch Logs](http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/), -[CodeDeploy](http://docs.aws.amazon.com/codedeploy/latest/APIReference/), -[CloudFront](http://docs.aws.amazon.com/AmazonCloudFront/latest/APIReference/), -[CloudTrail](http://docs.aws.amazon.com/awscloudtrail/latest/APIReference/), -[ElastiCache](http://docs.aws.amazon.com/AmazonElastiCache/latest/APIReference/), -[EMR](http://docs.aws.amazon.com/ElasticMapReduce/latest/API/), -[Glacier](http://docs.aws.amazon.com/amazonglacier/latest/dev/amazon-glacier-api.html), -[CloudSearch](http://docs.aws.amazon.com/cloudsearch/latest/developerguide/APIReq.html), -[Elastic Load Balancing](http://docs.aws.amazon.com/ElasticLoadBalancing/latest/APIReference/), -[Elastic Transcoder](http://docs.aws.amazon.com/elastictranscoder/latest/developerguide/api-reference.html), -[CloudFormation](http://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/), -[Elastic Beanstalk](http://docs.aws.amazon.com/elasticbeanstalk/latest/api/), -[Storage Gateway](http://docs.aws.amazon.com/storagegateway/latest/userguide/AWSStorageGatewayAPI.html), -[Data Pipeline](http://docs.aws.amazon.com/datapipeline/latest/APIReference/), -[Direct Connect](http://docs.aws.amazon.com/directconnect/latest/APIReference/), -[Redshift](http://docs.aws.amazon.com/redshift/latest/APIReference/), -[OpsWorks](http://docs.aws.amazon.com/opsworks/latest/APIReference/), -[SES](http://docs.aws.amazon.com/ses/latest/APIReference/), -[SWF](http://docs.aws.amazon.com/amazonswf/latest/apireference/), -[AutoScaling](http://docs.aws.amazon.com/AutoScaling/latest/APIReference/), -[Mobile Analytics](http://docs.aws.amazon.com/mobileanalytics/latest/ug/server-reference.html), -[Cognito Identity](http://docs.aws.amazon.com/cognitoidentity/latest/APIReference/), -[Cognito Sync](http://docs.aws.amazon.com/cognitosync/latest/APIReference/), -[Container Service](http://docs.aws.amazon.com/AmazonECS/latest/APIReference/), -[AppStream](http://docs.aws.amazon.com/appstream/latest/developerguide/appstream-api-rest.html), -[Key Management Service](http://docs.aws.amazon.com/kms/latest/APIReference/), -[Config](http://docs.aws.amazon.com/config/latest/APIReference/), -[CloudHSM](http://docs.aws.amazon.com/cloudhsm/latest/dg/api-ref.html), -[Route53](http://docs.aws.amazon.com/Route53/latest/APIReference/requests-rest.html) and -[Route53 Domains](http://docs.aws.amazon.com/Route53/latest/APIReference/requests-rpc.html). - -Indeed, the only AWS services that *don't* support v4 as of 2014-12-30 are -[Import/Export](http://docs.aws.amazon.com/AWSImportExport/latest/DG/api-reference.html) and -[SimpleDB](http://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/SDB_API.html) -(they only support [AWS Signature Version 2](https://github.com/mhart/aws2)). - -It also provides defaults for a number of core AWS headers and -request parameters, making it very easy to query AWS services, or -build out a fully-featured AWS library. - -Example -------- - -```javascript -var http = require('http'), - https = require('https'), - aws4 = require('aws4') - -// given an options object you could pass to http.request -var opts = {host: 'sqs.us-east-1.amazonaws.com', path: '/?Action=ListQueues'} - -// alternatively (as aws4 can infer the host): -opts = {service: 'sqs', region: 'us-east-1', path: '/?Action=ListQueues'} - -// alternatively (as us-east-1 is default): -opts = {service: 'sqs', path: '/?Action=ListQueues'} - -aws4.sign(opts) // assumes AWS credentials are available in process.env - -console.log(opts) -/* -{ - host: 'sqs.us-east-1.amazonaws.com', - path: '/?Action=ListQueues', - headers: { - Host: 'sqs.us-east-1.amazonaws.com', - 'X-Amz-Date': '20121226T061030Z', - Authorization: 'AWS4-HMAC-SHA256 Credential=ABCDEF/20121226/us-east-1/sqs/aws4_request, ...' - } -} -*/ - -// we can now use this to query AWS using the standard node.js http API -http.request(opts, function(res) { res.pipe(process.stdout) }).end() -/* - - -... -*/ -``` - -More options ------------- - -```javascript -// you can also pass AWS credentials in explicitly (otherwise taken from process.env) -aws4.sign(opts, {accessKeyId: '', secretAccessKey: ''}) - -// can also add the signature to query strings -aws4.sign({service: 's3', path: '/my-bucket?X-Amz-Expires=12345', signQuery: true}) - -// create a utility function to pipe to stdout (with https this time) -function request(o) { https.request(o, function(res) { res.pipe(process.stdout) }).end(o.body || '') } - -// aws4 can infer the HTTP method if a body is passed in -// method will be POST and Content-Type: 'application/x-www-form-urlencoded; charset=utf-8' -request(aws4.sign({service: 'iam', body: 'Action=ListGroups&Version=2010-05-08'})) -/* - -... -*/ - -// can specify any custom option or header as per usual -request(aws4.sign({ - service: 'dynamodb', - region: 'ap-southeast-2', - method: 'POST', - path: '/', - headers: { - 'Content-Type': 'application/x-amz-json-1.0', - 'X-Amz-Target': 'DynamoDB_20120810.ListTables' - }, - body: '{}' -})) -/* -{"TableNames":[]} -... -*/ - -// works with all other services that support Signature Version 4 - -request(aws4.sign({service: 's3', path: '/', signQuery: true})) -/* - -... -*/ - -request(aws4.sign({service: 'ec2', path: '/?Action=DescribeRegions&Version=2014-06-15'})) -/* - -... -*/ - -request(aws4.sign({service: 'sns', path: '/?Action=ListTopics&Version=2010-03-31'})) -/* - -... -*/ - -request(aws4.sign({service: 'sts', path: '/?Action=GetSessionToken&Version=2011-06-15'})) -/* - -... -*/ - -request(aws4.sign({service: 'cloudsearch', path: '/?Action=ListDomainNames&Version=2013-01-01'})) -/* - -... -*/ - -request(aws4.sign({service: 'ses', path: '/?Action=ListIdentities&Version=2010-12-01'})) -/* - -... -*/ - -request(aws4.sign({service: 'autoscaling', path: '/?Action=DescribeAutoScalingInstances&Version=2011-01-01'})) -/* - -... -*/ - -request(aws4.sign({service: 'elasticloadbalancing', path: '/?Action=DescribeLoadBalancers&Version=2012-06-01'})) -/* - -... -*/ - -request(aws4.sign({service: 'cloudformation', path: '/?Action=ListStacks&Version=2010-05-15'})) -/* - -... -*/ - -request(aws4.sign({service: 'elasticbeanstalk', path: '/?Action=ListAvailableSolutionStacks&Version=2010-12-01'})) -/* - -... -*/ - -request(aws4.sign({service: 'rds', path: '/?Action=DescribeDBInstances&Version=2012-09-17'})) -/* - -... -*/ - -request(aws4.sign({service: 'monitoring', path: '/?Action=ListMetrics&Version=2010-08-01'})) -/* - -... -*/ - -request(aws4.sign({service: 'redshift', path: '/?Action=DescribeClusters&Version=2012-12-01'})) -/* - -... -*/ - -request(aws4.sign({service: 'cloudfront', path: '/2014-05-31/distribution'})) -/* - -... -*/ - -request(aws4.sign({service: 'elasticache', path: '/?Action=DescribeCacheClusters&Version=2014-07-15'})) -/* - -... -*/ - -request(aws4.sign({service: 'elasticmapreduce', path: '/?Action=DescribeJobFlows&Version=2009-03-31'})) -/* - -... -*/ - -request(aws4.sign({service: 'route53', path: '/2013-04-01/hostedzone'})) -/* - -... -*/ - -request(aws4.sign({service: 'appstream', path: '/applications'})) -/* -{"_links":{"curie":[{"href":"http://docs.aws.amazon.com/appstream/latest/... -... -*/ - -request(aws4.sign({service: 'cognito-sync', path: '/identitypools'})) -/* -{"Count":0,"IdentityPoolUsages":[],"MaxResults":16,"NextToken":null} -... -*/ - -request(aws4.sign({service: 'elastictranscoder', path: '/2012-09-25/pipelines'})) -/* -{"NextPageToken":null,"Pipelines":[]} -... -*/ - -request(aws4.sign({service: 'lambda', path: '/2014-11-13/functions/'})) -/* -{"Functions":[],"NextMarker":null} -... -*/ - -request(aws4.sign({service: 'ecs', path: '/?Action=ListClusters&Version=2014-11-13'})) -/* - -... -*/ - -request(aws4.sign({service: 'glacier', path: '/-/vaults', headers: {'X-Amz-Glacier-Version': '2012-06-01'}})) -/* -{"Marker":null,"VaultList":[]} -... -*/ - -request(aws4.sign({service: 'storagegateway', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'StorageGateway_20120630.ListGateways' -}})) -/* -{"Gateways":[]} -... -*/ - -request(aws4.sign({service: 'datapipeline', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'DataPipeline.ListPipelines' -}})) -/* -{"hasMoreResults":false,"pipelineIdList":[]} -... -*/ - -request(aws4.sign({service: 'opsworks', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'OpsWorks_20130218.DescribeStacks' -}})) -/* -{"Stacks":[]} -... -*/ - -request(aws4.sign({service: 'route53domains', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'Route53Domains_v20140515.ListDomains' -}})) -/* -{"Domains":[]} -... -*/ - -request(aws4.sign({service: 'kinesis', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'Kinesis_20131202.ListStreams' -}})) -/* -{"HasMoreStreams":false,"StreamNames":[]} -... -*/ - -request(aws4.sign({service: 'cloudtrail', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'CloudTrail_20131101.DescribeTrails' -}})) -/* -{"trailList":[]} -... -*/ - -request(aws4.sign({service: 'logs', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'Logs_20140328.DescribeLogGroups' -}})) -/* -{"logGroups":[]} -... -*/ - -request(aws4.sign({service: 'codedeploy', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'CodeDeploy_20141006.ListApplications' -}})) -/* -{"applications":[]} -... -*/ - -request(aws4.sign({service: 'directconnect', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'OvertureService.DescribeConnections' -}})) -/* -{"connections":[]} -... -*/ - -request(aws4.sign({service: 'kms', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'TrentService.ListKeys' -}})) -/* -{"Keys":[],"Truncated":false} -... -*/ - -request(aws4.sign({service: 'config', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'StarlingDoveService.DescribeDeliveryChannels' -}})) -/* -{"DeliveryChannels":[]} -... -*/ - -request(aws4.sign({service: 'cloudhsm', body: '{}', headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'CloudHsmFrontendService.ListAvailableZones' -}})) -/* -{"AZList":["us-east-1a","us-east-1b","us-east-1c"]} -... -*/ - -request(aws4.sign({ - service: 'swf', - body: '{"registrationStatus":"REGISTERED"}', - headers: { - 'Content-Type': 'application/x-amz-json-1.0', - 'X-Amz-Target': 'SimpleWorkflowService.ListDomains' - } -})) -/* -{"domainInfos":[]} -... -*/ - -request(aws4.sign({ - service: 'cognito-identity', - body: '{"MaxResults": 1}', - headers: { - 'Content-Type': 'application/x-amz-json-1.1', - 'X-Amz-Target': 'AWSCognitoIdentityService.ListIdentityPools' - } -})) -/* -{"IdentityPools":[]} -... -*/ - -request(aws4.sign({ - service: 'mobileanalytics', - path: '/2014-06-05/events', - body: JSON.stringify({events:[{ - eventType: 'a', - timestamp: new Date().toISOString(), - session: {}, - }]}), - headers: { - 'Content-Type': 'application/json', - 'X-Amz-Client-Context': JSON.stringify({ - client: {client_id: 'a', app_title: 'a'}, - custom: {}, - env: {platform: 'a'}, - services: {}, - }), - } -})) -/* -(HTTP 202, empty response) -*/ -``` - -API ---- - -### aws4.sign(requestOptions, [credentials]) - -This calculates and populates the `Authorization` header of -`requestOptions`, and any other necessary AWS headers and/or request -options. Returns `requestOptions` as a convenience for chaining. - -`requestOptions` is an object holding the same options that the node.js -[http.request](http://nodejs.org/docs/latest/api/http.html#http_http_request_options_callback) -function takes. - -The following properties of `requestOptions` are used in the signing or -populated if they don't already exist: - -- `hostname` or `host` (will be determined from `service` and `region` if not given) -- `method` (will use `'GET'` if not given or `'POST'` if there is a `body`) -- `path` (will use `'/'` if not given) -- `body` (will use `''` if not given) -- `service` (will be calculated from `hostname` or `host` if not given) -- `region` (will be calculated from `hostname` or `host` or use `'us-east-1'` if not given) -- `headers['Host']` (will use `hostname` or `host` or be calculated if not given) -- `headers['Content-Type']` (will use `'application/x-www-form-urlencoded; charset=utf-8'` - if not given and there is a `body`) -- `headers['Date']` (used to calculate the signature date if given, otherwise `new Date` is used) - -Your AWS credentials (which can be found in your -[AWS console](https://portal.aws.amazon.com/gp/aws/securityCredentials)) -can be specified in one of two ways: - -- As the second argument, like this: - -```javascript -aws4.sign(requestOptions, { - secretAccessKey: "", - accessKeyId: "", - sessionToken: "" -}) -``` - -- From `process.env`, such as this: - -``` -export AWS_SECRET_ACCESS_KEY="" -export AWS_ACCESS_KEY_ID="" -export AWS_SESSION_TOKEN="" -``` - -(will also use `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` if available) - -The `sessionToken` property and `AWS_SESSION_TOKEN` environment variable are optional for signing -with [IAM STS temporary credentials](http://docs.aws.amazon.com/STS/latest/UsingSTS/using-temp-creds.html). - -Installation ------------- - -With [npm](http://npmjs.org/) do: - -``` -npm install aws4 -``` - -Can also be used [in the browser](./browser). - -Thanks ------- - -Thanks to [@jed](https://github.com/jed) for his -[dynamo-client](https://github.com/jed/dynamo-client) lib where I first -committed and subsequently extracted this code. - -Also thanks to the -[official node.js AWS SDK](https://github.com/aws/aws-sdk-js) for giving -me a start on implementing the v4 signature. - diff --git a/APIs/node_modules/request/node_modules/aws4/aws4.js b/APIs/node_modules/request/node_modules/aws4/aws4.js deleted file mode 100644 index cbe5dc90..00000000 --- a/APIs/node_modules/request/node_modules/aws4/aws4.js +++ /dev/null @@ -1,318 +0,0 @@ -var aws4 = exports, - url = require('url'), - querystring = require('querystring'), - crypto = require('crypto'), - lru = require('./lru'), - credentialsCache = lru(1000) - -// http://docs.amazonwebservices.com/general/latest/gr/signature-version-4.html - -function hmac(key, string, encoding) { - return crypto.createHmac('sha256', key).update(string, 'utf8').digest(encoding) -} - -function hash(string, encoding) { - return crypto.createHash('sha256').update(string, 'utf8').digest(encoding) -} - -// This function assumes the string has already been percent encoded -function encodeRfc3986(urlEncodedString) { - return urlEncodedString.replace(/[!'()*]/g, function(c) { - return '%' + c.charCodeAt(0).toString(16).toUpperCase() - }) -} - -// request: { path | body, [host], [method], [headers], [service], [region] } -// credentials: { accessKeyId, secretAccessKey, [sessionToken] } -function RequestSigner(request, credentials) { - - if (typeof request === 'string') request = url.parse(request) - - var headers = request.headers = (request.headers || {}), - hostParts = this.matchHost(request.hostname || request.host || headers.Host || headers.host) - - this.request = request - this.credentials = credentials || this.defaultCredentials() - - this.service = request.service || hostParts[0] || '' - this.region = request.region || hostParts[1] || 'us-east-1' - - // SES uses a different domain from the service name - if (this.service === 'email') this.service = 'ses' - - if (!request.method && request.body) - request.method = 'POST' - - if (!headers.Host && !headers.host) { - headers.Host = request.hostname || request.host || this.createHost() - - // If a port is specified explicitly, use it as is - if (request.port) - headers.Host += ':' + request.port - } - if (!request.hostname && !request.host) - request.hostname = headers.Host || headers.host -} - -RequestSigner.prototype.matchHost = function(host) { - var match = (host || '').match(/([^\.]+)\.(?:([^\.]*)\.)?amazonaws\.com$/) - var hostParts = (match || []).slice(1, 3) - - // ES's hostParts are sometimes the other way round, if the value that is expected - // to be region equals ‘es’ switch them back - // e.g. search-cluster-name-aaaa00aaaa0aaa0aaaaaaa0aaa.us-east-1.es.amazonaws.com - if (hostParts[1] === 'es') - hostParts = hostParts.reverse() - - return hostParts -} - -// http://docs.aws.amazon.com/general/latest/gr/rande.html -RequestSigner.prototype.isSingleRegion = function() { - // Special case for S3 and SimpleDB in us-east-1 - if (['s3', 'sdb'].indexOf(this.service) >= 0 && this.region === 'us-east-1') return true - - return ['cloudfront', 'ls', 'route53', 'iam', 'importexport', 'sts'] - .indexOf(this.service) >= 0 -} - -RequestSigner.prototype.createHost = function() { - var region = this.isSingleRegion() ? '' : - (this.service === 's3' && this.region !== 'us-east-1' ? '-' : '.') + this.region, - service = this.service === 'ses' ? 'email' : this.service - return service + region + '.amazonaws.com' -} - -RequestSigner.prototype.prepareRequest = function() { - this.parsePath() - - var request = this.request, headers = request.headers, query - - if (request.signQuery) { - - this.parsedPath.query = query = this.parsedPath.query || {} - - if (this.credentials.sessionToken) - query['X-Amz-Security-Token'] = this.credentials.sessionToken - - if (this.service === 's3' && !query['X-Amz-Expires']) - query['X-Amz-Expires'] = 86400 - - if (query['X-Amz-Date']) - this.datetime = query['X-Amz-Date'] - else - query['X-Amz-Date'] = this.getDateTime() - - query['X-Amz-Algorithm'] = 'AWS4-HMAC-SHA256' - query['X-Amz-Credential'] = this.credentials.accessKeyId + '/' + this.credentialString() - query['X-Amz-SignedHeaders'] = this.signedHeaders() - - } else { - - if (!request.doNotModifyHeaders) { - if (request.body && !headers['Content-Type'] && !headers['content-type']) - headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=utf-8' - - if (request.body && !headers['Content-Length'] && !headers['content-length']) - headers['Content-Length'] = Buffer.byteLength(request.body) - - if (this.credentials.sessionToken) - headers['X-Amz-Security-Token'] = this.credentials.sessionToken - - if (this.service === 's3') - headers['X-Amz-Content-Sha256'] = hash(this.request.body || '', 'hex') - - if (headers['X-Amz-Date']) - this.datetime = headers['X-Amz-Date'] - else - headers['X-Amz-Date'] = this.getDateTime() - } - - delete headers.Authorization - delete headers.authorization - } -} - -RequestSigner.prototype.sign = function() { - if (!this.parsedPath) this.prepareRequest() - - if (this.request.signQuery) { - this.parsedPath.query['X-Amz-Signature'] = this.signature() - } else { - this.request.headers.Authorization = this.authHeader() - } - - this.request.path = this.formatPath() - - return this.request -} - -RequestSigner.prototype.getDateTime = function() { - if (!this.datetime) { - var headers = this.request.headers, - date = new Date(headers.Date || headers.date || new Date) - - this.datetime = date.toISOString().replace(/[:\-]|\.\d{3}/g, '') - } - return this.datetime -} - -RequestSigner.prototype.getDate = function() { - return this.getDateTime().substr(0, 8) -} - -RequestSigner.prototype.authHeader = function() { - return [ - 'AWS4-HMAC-SHA256 Credential=' + this.credentials.accessKeyId + '/' + this.credentialString(), - 'SignedHeaders=' + this.signedHeaders(), - 'Signature=' + this.signature(), - ].join(', ') -} - -RequestSigner.prototype.signature = function() { - var date = this.getDate(), - cacheKey = [this.credentials.secretAccessKey, date, this.region, this.service].join(), - kDate, kRegion, kService, kCredentials = credentialsCache.get(cacheKey) - if (!kCredentials) { - kDate = hmac('AWS4' + this.credentials.secretAccessKey, date) - kRegion = hmac(kDate, this.region) - kService = hmac(kRegion, this.service) - kCredentials = hmac(kService, 'aws4_request') - credentialsCache.set(cacheKey, kCredentials) - } - return hmac(kCredentials, this.stringToSign(), 'hex') -} - -RequestSigner.prototype.stringToSign = function() { - return [ - 'AWS4-HMAC-SHA256', - this.getDateTime(), - this.credentialString(), - hash(this.canonicalString(), 'hex'), - ].join('\n') -} - -RequestSigner.prototype.canonicalString = function() { - if (!this.parsedPath) this.prepareRequest() - - var pathStr = this.parsedPath.path, - query = this.parsedPath.query, - queryStr = '', - normalizePath = this.service !== 's3', - decodePath = this.service === 's3' || this.request.doNotEncodePath, - decodeSlashesInPath = this.service === 's3', - firstValOnly = this.service === 's3', - bodyHash = this.service === 's3' && this.request.signQuery ? - 'UNSIGNED-PAYLOAD' : hash(this.request.body || '', 'hex') - - if (query) { - queryStr = encodeRfc3986(querystring.stringify(Object.keys(query).sort().reduce(function(obj, key) { - if (!key) return obj - obj[key] = !Array.isArray(query[key]) ? query[key] : - (firstValOnly ? query[key][0] : query[key].slice().sort()) - return obj - }, {}))) - } - if (pathStr !== '/') { - if (normalizePath) pathStr = pathStr.replace(/\/{2,}/g, '/') - pathStr = pathStr.split('/').reduce(function(path, piece) { - if (normalizePath && piece === '..') { - path.pop() - } else if (!normalizePath || piece !== '.') { - if (decodePath) piece = querystring.unescape(piece) - path.push(encodeRfc3986(querystring.escape(piece))) - } - return path - }, []).join('/') - if (pathStr[0] !== '/') pathStr = '/' + pathStr - if (decodeSlashesInPath) pathStr = pathStr.replace(/%2F/g, '/') - } - - return [ - this.request.method || 'GET', - pathStr, - queryStr, - this.canonicalHeaders() + '\n', - this.signedHeaders(), - bodyHash, - ].join('\n') -} - -RequestSigner.prototype.canonicalHeaders = function() { - var headers = this.request.headers - function trimAll(header) { - return header.toString().trim().replace(/\s+/g, ' ') - } - return Object.keys(headers) - .sort(function(a, b) { return a.toLowerCase() < b.toLowerCase() ? -1 : 1 }) - .map(function(key) { return key.toLowerCase() + ':' + trimAll(headers[key]) }) - .join('\n') -} - -RequestSigner.prototype.signedHeaders = function() { - return Object.keys(this.request.headers) - .map(function(key) { return key.toLowerCase() }) - .sort() - .join(';') -} - -RequestSigner.prototype.credentialString = function() { - return [ - this.getDate(), - this.region, - this.service, - 'aws4_request', - ].join('/') -} - -RequestSigner.prototype.defaultCredentials = function() { - var env = process.env - return { - accessKeyId: env.AWS_ACCESS_KEY_ID || env.AWS_ACCESS_KEY, - secretAccessKey: env.AWS_SECRET_ACCESS_KEY || env.AWS_SECRET_KEY, - sessionToken: env.AWS_SESSION_TOKEN, - } -} - -RequestSigner.prototype.parsePath = function() { - var path = this.request.path || '/', - queryIx = path.indexOf('?'), - query = null - - if (queryIx >= 0) { - query = querystring.parse(path.slice(queryIx + 1)) - path = path.slice(0, queryIx) - } - - // S3 doesn't always encode characters > 127 correctly and - // all services don't encode characters > 255 correctly - // So if there are non-reserved chars (and it's not already all % encoded), just encode them all - if (/[^0-9A-Za-z!'()*\-._~%/]/.test(path)) { - path = path.split('/').map(function(piece) { - return querystring.escape(querystring.unescape(piece)) - }).join('/') - } - - this.parsedPath = { - path: path, - query: query, - } -} - -RequestSigner.prototype.formatPath = function() { - var path = this.parsedPath.path, - query = this.parsedPath.query - - if (!query) return path - - // Services don't support empty query string keys - if (query[''] != null) delete query[''] - - return path + '?' + encodeRfc3986(querystring.stringify(query)) -} - -aws4.RequestSigner = RequestSigner - -aws4.sign = function(request, credentials) { - return new RequestSigner(request, credentials).sign() -} diff --git a/APIs/node_modules/request/node_modules/aws4/lru.js b/APIs/node_modules/request/node_modules/aws4/lru.js deleted file mode 100644 index 333f66a4..00000000 --- a/APIs/node_modules/request/node_modules/aws4/lru.js +++ /dev/null @@ -1,96 +0,0 @@ -module.exports = function(size) { - return new LruCache(size) -} - -function LruCache(size) { - this.capacity = size | 0 - this.map = Object.create(null) - this.list = new DoublyLinkedList() -} - -LruCache.prototype.get = function(key) { - var node = this.map[key] - if (node == null) return undefined - this.used(node) - return node.val -} - -LruCache.prototype.set = function(key, val) { - var node = this.map[key] - if (node != null) { - node.val = val - } else { - if (!this.capacity) this.prune() - if (!this.capacity) return false - node = new DoublyLinkedNode(key, val) - this.map[key] = node - this.capacity-- - } - this.used(node) - return true -} - -LruCache.prototype.used = function(node) { - this.list.moveToFront(node) -} - -LruCache.prototype.prune = function() { - var node = this.list.pop() - if (node != null) { - delete this.map[node.key] - this.capacity++ - } -} - - -function DoublyLinkedList() { - this.firstNode = null - this.lastNode = null -} - -DoublyLinkedList.prototype.moveToFront = function(node) { - if (this.firstNode == node) return - - this.remove(node) - - if (this.firstNode == null) { - this.firstNode = node - this.lastNode = node - node.prev = null - node.next = null - } else { - node.prev = null - node.next = this.firstNode - node.next.prev = node - this.firstNode = node - } -} - -DoublyLinkedList.prototype.pop = function() { - var lastNode = this.lastNode - if (lastNode != null) { - this.remove(lastNode) - } - return lastNode -} - -DoublyLinkedList.prototype.remove = function(node) { - if (this.firstNode == node) { - this.firstNode = node.next - } else if (node.prev != null) { - node.prev.next = node.next - } - if (this.lastNode == node) { - this.lastNode = node.prev - } else if (node.next != null) { - node.next.prev = node.prev - } -} - - -function DoublyLinkedNode(key, val) { - this.key = key - this.val = val - this.prev = null - this.next = null -} diff --git a/APIs/node_modules/request/node_modules/aws4/package.json b/APIs/node_modules/request/node_modules/aws4/package.json deleted file mode 100644 index fcce77e0..00000000 --- a/APIs/node_modules/request/node_modules/aws4/package.json +++ /dev/null @@ -1,105 +0,0 @@ -{ - "name": "aws4", - "version": "1.4.1", - "description": "Signs and prepares requests using AWS Signature Version 4", - "author": { - "name": "Michael Hart", - "email": "michael.hart.au@gmail.com", - "url": "http://github.com/mhart" - }, - "main": "aws4.js", - "keywords": [ - "amazon", - "aws", - "signature", - "s3", - "ec2", - "autoscaling", - "cloudformation", - "elasticloadbalancing", - "elb", - "elasticbeanstalk", - "cloudsearch", - "dynamodb", - "kinesis", - "lambda", - "glacier", - "sqs", - "sns", - "iam", - "sts", - "ses", - "swf", - "storagegateway", - "datapipeline", - "directconnect", - "redshift", - "opsworks", - "rds", - "monitoring", - "cloudtrail", - "cloudfront", - "codedeploy", - "elasticache", - "elasticmapreduce", - "elastictranscoder", - "emr", - "cloudwatch", - "mobileanalytics", - "cognitoidentity", - "cognitosync", - "cognito", - "containerservice", - "ecs", - "appstream", - "keymanagementservice", - "kms", - "config", - "cloudhsm", - "route53", - "route53domains", - "logs" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/mhart/aws4.git" - }, - "license": "MIT", - "devDependencies": { - "mocha": "^2.4.5", - "should": "^8.2.2" - }, - "scripts": { - "test": "mocha ./test/fast.js ./test/slow.js -b -t 100s -R list" - }, - "gitHead": "f126d3ff80be1ddde0fc6b50bb51a7f199547e81", - "bugs": { - "url": "https://github.com/mhart/aws4/issues" - }, - "homepage": "https://github.com/mhart/aws4#readme", - "_id": "aws4@1.4.1", - "_shasum": "fde7d5292466d230e5ee0f4e038d9dfaab08fc61", - "_from": "aws4@^1.2.1", - "_npmVersion": "2.15.4", - "_nodeVersion": "4.4.3", - "_npmUser": { - "name": "hichaelmart", - "email": "michael.hart.au@gmail.com" - }, - "maintainers": [ - { - "name": "hichaelmart", - "email": "michael.hart.au@gmail.com" - } - ], - "dist": { - "shasum": "fde7d5292466d230e5ee0f4e038d9dfaab08fc61", - "tarball": "https://registry.npmjs.org/aws4/-/aws4-1.4.1.tgz" - }, - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/aws4-1.4.1.tgz_1462643218465_0.6527479749638587" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/aws4/-/aws4-1.4.1.tgz" -} diff --git a/APIs/node_modules/request/node_modules/bl/.jshintrc b/APIs/node_modules/request/node_modules/bl/.jshintrc deleted file mode 100644 index c8ef3ca4..00000000 --- a/APIs/node_modules/request/node_modules/bl/.jshintrc +++ /dev/null @@ -1,59 +0,0 @@ -{ - "predef": [ ] - , "bitwise": false - , "camelcase": false - , "curly": false - , "eqeqeq": false - , "forin": false - , "immed": false - , "latedef": false - , "noarg": true - , "noempty": true - , "nonew": true - , "plusplus": false - , "quotmark": true - , "regexp": false - , "undef": true - , "unused": true - , "strict": false - , "trailing": true - , "maxlen": 120 - , "asi": true - , "boss": true - , "debug": true - , "eqnull": true - , "esnext": true - , "evil": true - , "expr": true - , "funcscope": false - , "globalstrict": false - , "iterator": false - , "lastsemic": true - , "laxbreak": true - , "laxcomma": true - , "loopfunc": true - , "multistr": false - , "onecase": false - , "proto": false - , "regexdash": false - , "scripturl": true - , "smarttabs": false - , "shadow": false - , "sub": true - , "supernew": false - , "validthis": true - , "browser": true - , "couch": false - , "devel": false - , "dojo": false - , "mootools": false - , "node": true - , "nonstandard": true - , "prototypejs": false - , "rhino": false - , "worker": true - , "wsh": false - , "nomen": false - , "onevar": false - , "passfail": false -} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/.npmignore b/APIs/node_modules/request/node_modules/bl/.npmignore deleted file mode 100644 index 40b878db..00000000 --- a/APIs/node_modules/request/node_modules/bl/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/ \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/.travis.yml b/APIs/node_modules/request/node_modules/bl/.travis.yml deleted file mode 100644 index 5cb0480b..00000000 --- a/APIs/node_modules/request/node_modules/bl/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false -language: node_js -node_js: - - '0.10' - - '0.12' - - '4' - - '5' -branches: - only: - - master -notifications: - email: - - rod@vagg.org diff --git a/APIs/node_modules/request/node_modules/bl/LICENSE.md b/APIs/node_modules/request/node_modules/bl/LICENSE.md deleted file mode 100644 index ccb24797..00000000 --- a/APIs/node_modules/request/node_modules/bl/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2014 bl contributors ----------------------------------- - -*bl contributors listed at * - -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/APIs/node_modules/request/node_modules/bl/README.md b/APIs/node_modules/request/node_modules/bl/README.md deleted file mode 100644 index f7044db2..00000000 --- a/APIs/node_modules/request/node_modules/bl/README.md +++ /dev/null @@ -1,200 +0,0 @@ -# bl *(BufferList)* - -[![Build Status](https://travis-ci.org/rvagg/bl.svg?branch=master)](https://travis-ci.org/rvagg/bl) - -**A Node.js Buffer list collector, reader and streamer thingy.** - -[![NPM](https://nodei.co/npm/bl.png?downloads=true&downloadRank=true)](https://nodei.co/npm/bl/) -[![NPM](https://nodei.co/npm-dl/bl.png?months=6&height=3)](https://nodei.co/npm/bl/) - -**bl** is a storage object for collections of Node Buffers, exposing them with the main Buffer readable API. Also works as a duplex stream so you can collect buffers from a stream that emits them and emit buffers to a stream that consumes them! - -The original buffers are kept intact and copies are only done as necessary. Any reads that require the use of a single original buffer will return a slice of that buffer only (which references the same memory as the original buffer). Reads that span buffers perform concatenation as required and return the results transparently. - -```js -const BufferList = require('bl') - -var bl = new BufferList() -bl.append(new Buffer('abcd')) -bl.append(new Buffer('efg')) -bl.append('hi') // bl will also accept & convert Strings -bl.append(new Buffer('j')) -bl.append(new Buffer([ 0x3, 0x4 ])) - -console.log(bl.length) // 12 - -console.log(bl.slice(0, 10).toString('ascii')) // 'abcdefghij' -console.log(bl.slice(3, 10).toString('ascii')) // 'defghij' -console.log(bl.slice(3, 6).toString('ascii')) // 'def' -console.log(bl.slice(3, 8).toString('ascii')) // 'defgh' -console.log(bl.slice(5, 10).toString('ascii')) // 'fghij' - -// or just use toString! -console.log(bl.toString()) // 'abcdefghij\u0003\u0004' -console.log(bl.toString('ascii', 3, 8)) // 'defgh' -console.log(bl.toString('ascii', 5, 10)) // 'fghij' - -// other standard Buffer readables -console.log(bl.readUInt16BE(10)) // 0x0304 -console.log(bl.readUInt16LE(10)) // 0x0403 -``` - -Give it a callback in the constructor and use it just like **[concat-stream](https://github.com/maxogden/node-concat-stream)**: - -```js -const bl = require('bl') - , fs = require('fs') - -fs.createReadStream('README.md') - .pipe(bl(function (err, data) { // note 'new' isn't strictly required - // `data` is a complete Buffer object containing the full data - console.log(data.toString()) - })) -``` - -Note that when you use the *callback* method like this, the resulting `data` parameter is a concatenation of all `Buffer` objects in the list. If you want to avoid the overhead of this concatenation (in cases of extreme performance consciousness), then avoid the *callback* method and just listen to `'end'` instead, like a standard Stream. - -Or to fetch a URL using [hyperquest](https://github.com/substack/hyperquest) (should work with [request](http://github.com/mikeal/request) and even plain Node http too!): -```js -const hyperquest = require('hyperquest') - , bl = require('bl') - , url = 'https://raw.github.com/rvagg/bl/master/README.md' - -hyperquest(url).pipe(bl(function (err, data) { - console.log(data.toString()) -})) -``` - -Or, use it as a readable stream to recompose a list of Buffers to an output source: - -```js -const BufferList = require('bl') - , fs = require('fs') - -var bl = new BufferList() -bl.append(new Buffer('abcd')) -bl.append(new Buffer('efg')) -bl.append(new Buffer('hi')) -bl.append(new Buffer('j')) - -bl.pipe(fs.createWriteStream('gibberish.txt')) -``` - -## API - - * new BufferList([ callback ]) - * bl.length - * bl.append(buffer) - * bl.get(index) - * bl.slice([ start[, end ] ]) - * bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) - * bl.duplicate() - * bl.consume(bytes) - * bl.toString([encoding, [ start, [ end ]]]) - * bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() - * Streams - --------------------------------------------------------- - -### new BufferList([ callback | Buffer | Buffer array | BufferList | BufferList array | String ]) -The constructor takes an optional callback, if supplied, the callback will be called with an error argument followed by a reference to the **bl** instance, when `bl.end()` is called (i.e. from a piped stream). This is a convenient method of collecting the entire contents of a stream, particularly when the stream is *chunky*, such as a network stream. - -Normally, no arguments are required for the constructor, but you can initialise the list by passing in a single `Buffer` object or an array of `Buffer` object. - -`new` is not strictly required, if you don't instantiate a new object, it will be done automatically for you so you can create a new instance simply with: - -```js -var bl = require('bl') -var myinstance = bl() - -// equivilant to: - -var BufferList = require('bl') -var myinstance = new BufferList() -``` - --------------------------------------------------------- - -### bl.length -Get the length of the list in bytes. This is the sum of the lengths of all of the buffers contained in the list, minus any initial offset for a semi-consumed buffer at the beginning. Should accurately represent the total number of bytes that can be read from the list. - --------------------------------------------------------- - -### bl.append(Buffer | Buffer array | BufferList | BufferList array | String) -`append(buffer)` adds an additional buffer or BufferList to the internal list. `this` is returned so it can be chained. - --------------------------------------------------------- - -### bl.get(index) -`get()` will return the byte at the specified index. - --------------------------------------------------------- - -### bl.slice([ start, [ end ] ]) -`slice()` returns a new `Buffer` object containing the bytes within the range specified. Both `start` and `end` are optional and will default to the beginning and end of the list respectively. - -If the requested range spans a single internal buffer then a slice of that buffer will be returned which shares the original memory range of that Buffer. If the range spans multiple buffers then copy operations will likely occur to give you a uniform Buffer. - --------------------------------------------------------- - -### bl.copy(dest, [ destStart, [ srcStart [, srcEnd ] ] ]) -`copy()` copies the content of the list in the `dest` buffer, starting from `destStart` and containing the bytes within the range specified with `srcStart` to `srcEnd`. `destStart`, `start` and `end` are optional and will default to the beginning of the `dest` buffer, and the beginning and end of the list respectively. - --------------------------------------------------------- - -### bl.duplicate() -`duplicate()` performs a **shallow-copy** of the list. The internal Buffers remains the same, so if you change the underlying Buffers, the change will be reflected in both the original and the duplicate. This method is needed if you want to call `consume()` or `pipe()` and still keep the original list.Example: - -```js -var bl = new BufferList() - -bl.append('hello') -bl.append(' world') -bl.append('\n') - -bl.duplicate().pipe(process.stdout, { end: false }) - -console.log(bl.toString()) -``` - --------------------------------------------------------- - -### bl.consume(bytes) -`consume()` will shift bytes *off the start of the list*. The number of bytes consumed don't need to line up with the sizes of the internal Buffers—initial offsets will be calculated accordingly in order to give you a consistent view of the data. - --------------------------------------------------------- - -### bl.toString([encoding, [ start, [ end ]]]) -`toString()` will return a string representation of the buffer. The optional `start` and `end` arguments are passed on to `slice()`, while the `encoding` is passed on to `toString()` of the resulting Buffer. See the [Buffer#toString()](http://nodejs.org/docs/latest/api/buffer.html#buffer_buf_tostring_encoding_start_end) documentation for more information. - --------------------------------------------------------- - -### bl.readDoubleBE(), bl.readDoubleLE(), bl.readFloatBE(), bl.readFloatLE(), bl.readInt32BE(), bl.readInt32LE(), bl.readUInt32BE(), bl.readUInt32LE(), bl.readInt16BE(), bl.readInt16LE(), bl.readUInt16BE(), bl.readUInt16LE(), bl.readInt8(), bl.readUInt8() - -All of the standard byte-reading methods of the `Buffer` interface are implemented and will operate across internal Buffer boundaries transparently. - -See the [Buffer](http://nodejs.org/docs/latest/api/buffer.html) documentation for how these work. - --------------------------------------------------------- - -### Streams -**bl** is a Node **[Duplex Stream](http://nodejs.org/docs/latest/api/stream.html#stream_class_stream_duplex)**, so it can be read from and written to like a standard Node stream. You can also `pipe()` to and from a **bl** instance. - --------------------------------------------------------- - -## Contributors - -**bl** is brought to you by the following hackers: - - * [Rod Vagg](https://github.com/rvagg) - * [Matteo Collina](https://github.com/mcollina) - * [Jarett Cruger](https://github.com/jcrugzz) - -======= - - -## License & copyright - -Copyright (c) 2013-2014 bl contributors (listed above). - -bl is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. diff --git a/APIs/node_modules/request/node_modules/bl/bl.js b/APIs/node_modules/request/node_modules/bl/bl.js deleted file mode 100644 index f585df17..00000000 --- a/APIs/node_modules/request/node_modules/bl/bl.js +++ /dev/null @@ -1,243 +0,0 @@ -var DuplexStream = require('readable-stream/duplex') - , util = require('util') - - -function BufferList (callback) { - if (!(this instanceof BufferList)) - return new BufferList(callback) - - this._bufs = [] - this.length = 0 - - if (typeof callback == 'function') { - this._callback = callback - - var piper = function piper (err) { - if (this._callback) { - this._callback(err) - this._callback = null - } - }.bind(this) - - this.on('pipe', function onPipe (src) { - src.on('error', piper) - }) - this.on('unpipe', function onUnpipe (src) { - src.removeListener('error', piper) - }) - } else { - this.append(callback) - } - - DuplexStream.call(this) -} - - -util.inherits(BufferList, DuplexStream) - - -BufferList.prototype._offset = function _offset (offset) { - var tot = 0, i = 0, _t - for (; i < this._bufs.length; i++) { - _t = tot + this._bufs[i].length - if (offset < _t) - return [ i, offset - tot ] - tot = _t - } -} - - -BufferList.prototype.append = function append (buf) { - var i = 0 - , newBuf - - if (Array.isArray(buf)) { - for (; i < buf.length; i++) - this.append(buf[i]) - } else if (buf instanceof BufferList) { - // unwrap argument into individual BufferLists - for (; i < buf._bufs.length; i++) - this.append(buf._bufs[i]) - } else if (buf != null) { - // coerce number arguments to strings, since Buffer(number) does - // uninitialized memory allocation - if (typeof buf == 'number') - buf = buf.toString() - - newBuf = Buffer.isBuffer(buf) ? buf : new Buffer(buf) - this._bufs.push(newBuf) - this.length += newBuf.length - } - - return this -} - - -BufferList.prototype._write = function _write (buf, encoding, callback) { - this.append(buf) - - if (typeof callback == 'function') - callback() -} - - -BufferList.prototype._read = function _read (size) { - if (!this.length) - return this.push(null) - - size = Math.min(size, this.length) - this.push(this.slice(0, size)) - this.consume(size) -} - - -BufferList.prototype.end = function end (chunk) { - DuplexStream.prototype.end.call(this, chunk) - - if (this._callback) { - this._callback(null, this.slice()) - this._callback = null - } -} - - -BufferList.prototype.get = function get (index) { - return this.slice(index, index + 1)[0] -} - - -BufferList.prototype.slice = function slice (start, end) { - return this.copy(null, 0, start, end) -} - - -BufferList.prototype.copy = function copy (dst, dstStart, srcStart, srcEnd) { - if (typeof srcStart != 'number' || srcStart < 0) - srcStart = 0 - if (typeof srcEnd != 'number' || srcEnd > this.length) - srcEnd = this.length - if (srcStart >= this.length) - return dst || new Buffer(0) - if (srcEnd <= 0) - return dst || new Buffer(0) - - var copy = !!dst - , off = this._offset(srcStart) - , len = srcEnd - srcStart - , bytes = len - , bufoff = (copy && dstStart) || 0 - , start = off[1] - , l - , i - - // copy/slice everything - if (srcStart === 0 && srcEnd == this.length) { - if (!copy) // slice, just return a full concat - return Buffer.concat(this._bufs) - - // copy, need to copy individual buffers - for (i = 0; i < this._bufs.length; i++) { - this._bufs[i].copy(dst, bufoff) - bufoff += this._bufs[i].length - } - - return dst - } - - // easy, cheap case where it's a subset of one of the buffers - if (bytes <= this._bufs[off[0]].length - start) { - return copy - ? this._bufs[off[0]].copy(dst, dstStart, start, start + bytes) - : this._bufs[off[0]].slice(start, start + bytes) - } - - if (!copy) // a slice, we need something to copy in to - dst = new Buffer(len) - - for (i = off[0]; i < this._bufs.length; i++) { - l = this._bufs[i].length - start - - if (bytes > l) { - this._bufs[i].copy(dst, bufoff, start) - } else { - this._bufs[i].copy(dst, bufoff, start, start + bytes) - break - } - - bufoff += l - bytes -= l - - if (start) - start = 0 - } - - return dst -} - -BufferList.prototype.toString = function toString (encoding, start, end) { - return this.slice(start, end).toString(encoding) -} - -BufferList.prototype.consume = function consume (bytes) { - while (this._bufs.length) { - if (bytes >= this._bufs[0].length) { - bytes -= this._bufs[0].length - this.length -= this._bufs[0].length - this._bufs.shift() - } else { - this._bufs[0] = this._bufs[0].slice(bytes) - this.length -= bytes - break - } - } - return this -} - - -BufferList.prototype.duplicate = function duplicate () { - var i = 0 - , copy = new BufferList() - - for (; i < this._bufs.length; i++) - copy.append(this._bufs[i]) - - return copy -} - - -BufferList.prototype.destroy = function destroy () { - this._bufs.length = 0 - this.length = 0 - this.push(null) -} - - -;(function () { - var methods = { - 'readDoubleBE' : 8 - , 'readDoubleLE' : 8 - , 'readFloatBE' : 4 - , 'readFloatLE' : 4 - , 'readInt32BE' : 4 - , 'readInt32LE' : 4 - , 'readUInt32BE' : 4 - , 'readUInt32LE' : 4 - , 'readInt16BE' : 2 - , 'readInt16LE' : 2 - , 'readUInt16BE' : 2 - , 'readUInt16LE' : 2 - , 'readInt8' : 1 - , 'readUInt8' : 1 - } - - for (var m in methods) { - (function (m) { - BufferList.prototype[m] = function (offset) { - return this.slice(offset, offset + methods[m])[m](0) - } - }(m)) - } -}()) - - -module.exports = BufferList diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore deleted file mode 100644 index 38344f87..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -build/ -test/ -examples/ -fs.js -zlib.js \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml deleted file mode 100644 index 1b821184..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.travis.yml +++ /dev/null @@ -1,52 +0,0 @@ -sudo: false -language: node_js -before_install: - - npm install -g npm@2 - - npm install -g npm -notifications: - email: false -matrix: - fast_finish: true - allow_failures: - - env: TASK=browser BROWSER_NAME=ipad BROWSER_VERSION="6.0..latest" - - env: TASK=browser BROWSER_NAME=iphone BROWSER_VERSION="6.0..latest" - include: - - node_js: '0.8' - env: TASK=test - - node_js: '0.10' - env: TASK=test - - node_js: '0.11' - env: TASK=test - - node_js: '0.12' - env: TASK=test - - node_js: 1 - env: TASK=test - - node_js: 2 - env: TASK=test - - node_js: 3 - env: TASK=test - - node_js: 4 - env: TASK=test - - node_js: 5 - env: TASK=test - - node_js: 5 - env: TASK=browser BROWSER_NAME=android BROWSER_VERSION="4.0..latest" - - node_js: 5 - env: TASK=browser BROWSER_NAME=ie BROWSER_VERSION="9..latest" - - node_js: 5 - env: TASK=browser BROWSER_NAME=opera BROWSER_VERSION="11..latest" - - node_js: 5 - env: TASK=browser BROWSER_NAME=chrome BROWSER_VERSION="-3..latest" - - node_js: 5 - env: TASK=browser BROWSER_NAME=firefox BROWSER_VERSION="-3..latest" - - node_js: 5 - env: TASK=browser BROWSER_NAME=ipad BROWSER_VERSION="6.0..latest" - - node_js: 5 - env: TASK=browser BROWSER_NAME=iphone BROWSER_VERSION="6.0..latest" - - node_js: 5 - env: TASK=browser BROWSER_NAME=safari BROWSER_VERSION="5..latest" -script: "npm run $TASK" -env: - global: - - secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc= - - secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI= diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml deleted file mode 100644 index 96d9cfbd..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/.zuul.yml +++ /dev/null @@ -1 +0,0 @@ -ui: tape diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE deleted file mode 100644 index e3d4e695..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,18 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. All rights reserved. -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/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md deleted file mode 100644 index 86b95a3b..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/README.md +++ /dev/null @@ -1,36 +0,0 @@ -# readable-stream - -***Node-core v5.8.0 streams for userland*** [![Build Status](https://travis-ci.org/nodejs/readable-stream.svg?branch=master)](https://travis-ci.org/nodejs/readable-stream) - - -[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true&downloadRank=true)](https://nodei.co/npm/readable-stream/) -[![NPM](https://nodei.co/npm-dl/readable-stream.png?&months=6&height=3)](https://nodei.co/npm/readable-stream/) - - -[![Sauce Test Status](https://saucelabs.com/browser-matrix/readable-stream.svg)](https://saucelabs.com/u/readable-stream) - -```bash -npm install --save readable-stream -``` - -***Node-core streams for userland*** - -This package is a mirror of the Streams2 and Streams3 implementations in -Node-core, including [documentation](doc/stream.markdown). - -If you want to guarantee a stable streams base, regardless of what version of -Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html). - -As of version 2.0.0 **readable-stream** uses semantic versioning. - -# Streams WG Team Members - -* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com> - - Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B -* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com> - - Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242 -* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org> - - Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D -* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com> -* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com> -* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me> diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown deleted file mode 100644 index 0bc3819e..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/stream.markdown +++ /dev/null @@ -1,1760 +0,0 @@ -# Stream - - Stability: 2 - Stable - -A stream is an abstract interface implemented by various objects in -Node.js. For example a [request to an HTTP server][http-incoming-message] is a -stream, as is [`process.stdout`][]. Streams are readable, writable, or both. All -streams are instances of [`EventEmitter`][]. - -You can load the Stream base classes by doing `require('stream')`. -There are base classes provided for [Readable][] streams, [Writable][] -streams, [Duplex][] streams, and [Transform][] streams. - -This document is split up into 3 sections: - -1. The first section explains the parts of the API that you need to be - aware of to use streams in your programs. -2. The second section explains the parts of the API that you need to - use if you implement your own custom streams yourself. The API is designed to - make this easy for you to do. -3. The third section goes into more depth about how streams work, - including some of the internal mechanisms and functions that you - should probably not modify unless you definitely know what you are - doing. - - -## API for Stream Consumers - - - -Streams can be either [Readable][], [Writable][], or both ([Duplex][]). - -All streams are EventEmitters, but they also have other custom methods -and properties depending on whether they are Readable, Writable, or -Duplex. - -If a stream is both Readable and Writable, then it implements all of -the methods and events. So, a [Duplex][] or [Transform][] stream is -fully described by this API, though their implementation may be -somewhat different. - -It is not necessary to implement Stream interfaces in order to consume -streams in your programs. If you **are** implementing streaming -interfaces in your own program, please also refer to -[API for Stream Implementors][]. - -Almost all Node.js programs, no matter how simple, use Streams in some -way. Here is an example of using Streams in an Node.js program: - -```js -const http = require('http'); - -var server = http.createServer( (req, res) => { - // req is an http.IncomingMessage, which is a Readable Stream - // res is an http.ServerResponse, which is a Writable Stream - - var body = ''; - // we want to get the data as utf8 strings - // If you don't set an encoding, then you'll get Buffer objects - req.setEncoding('utf8'); - - // Readable streams emit 'data' events once a listener is added - req.on('data', (chunk) => { - body += chunk; - }); - - // the end event tells you that you have entire body - req.on('end', () => { - try { - var data = JSON.parse(body); - } catch (er) { - // uh oh! bad json! - res.statusCode = 400; - return res.end(`error: ${er.message}`); - } - - // write back something interesting to the user: - res.write(typeof data); - res.end(); - }); -}); - -server.listen(1337); - -// $ curl localhost:1337 -d '{}' -// object -// $ curl localhost:1337 -d '"foo"' -// string -// $ curl localhost:1337 -d 'not json' -// error: Unexpected token o -``` - -### Class: stream.Duplex - -Duplex streams are streams that implement both the [Readable][] and -[Writable][] interfaces. - -Examples of Duplex streams include: - -* [TCP sockets][] -* [zlib streams][zlib] -* [crypto streams][crypto] - -### Class: stream.Readable - - - -The Readable stream interface is the abstraction for a *source* of -data that you are reading from. In other words, data comes *out* of a -Readable stream. - -A Readable stream will not start emitting data until you indicate that -you are ready to receive it. - -Readable streams have two "modes": a **flowing mode** and a **paused -mode**. When in flowing mode, data is read from the underlying system -and provided to your program as fast as possible. In paused mode, you -must explicitly call [`stream.read()`][stream-read] to get chunks of data out. -Streams start out in paused mode. - -**Note**: If no data event handlers are attached, and there are no -[`stream.pipe()`][] destinations, and the stream is switched into flowing -mode, then data will be lost. - -You can switch to flowing mode by doing any of the following: - -* Adding a [`'data'`][] event handler to listen for data. -* Calling the [`stream.resume()`][stream-resume] method to explicitly open the - flow. -* Calling the [`stream.pipe()`][] method to send the data to a [Writable][]. - -You can switch back to paused mode by doing either of the following: - -* If there are no pipe destinations, by calling the - [`stream.pause()`][stream-pause] method. -* If there are pipe destinations, by removing any [`'data'`][] event - handlers, and removing all pipe destinations by calling the - [`stream.unpipe()`][] method. - -Note that, for backwards compatibility reasons, removing [`'data'`][] -event handlers will **not** automatically pause the stream. Also, if -there are piped destinations, then calling [`stream.pause()`][stream-pause] will -not guarantee that the stream will *remain* paused once those -destinations drain and ask for more data. - -Examples of readable streams include: - -* [HTTP responses, on the client][http-incoming-message] -* [HTTP requests, on the server][http-incoming-message] -* [fs read streams][] -* [zlib streams][zlib] -* [crypto streams][crypto] -* [TCP sockets][] -* [child process stdout and stderr][] -* [`process.stdin`][] - -#### Event: 'close' - -Emitted when the stream and any of its underlying resources (a file -descriptor, for example) have been closed. The event indicates that -no more events will be emitted, and no further computation will occur. - -Not all streams will emit the `'close'` event. - -#### Event: 'data' - -* `chunk` {Buffer|String} The chunk of data. - -Attaching a `'data'` event listener to a stream that has not been -explicitly paused will switch the stream into flowing mode. Data will -then be passed as soon as it is available. - -If you just want to get all the data out of the stream as fast as -possible, this is the best way to do so. - -```js -var readable = getReadableStreamSomehow(); -readable.on('data', (chunk) => { - console.log('got %d bytes of data', chunk.length); -}); -``` - -#### Event: 'end' - -This event fires when there will be no more data to read. - -Note that the `'end'` event **will not fire** unless the data is -completely consumed. This can be done by switching into flowing mode, -or by calling [`stream.read()`][stream-read] repeatedly until you get to the -end. - -```js -var readable = getReadableStreamSomehow(); -readable.on('data', (chunk) => { - console.log('got %d bytes of data', chunk.length); -}); -readable.on('end', () => { - console.log('there will be no more data.'); -}); -``` - -#### Event: 'error' - -* {Error Object} - -Emitted if there was an error receiving data. - -#### Event: 'readable' - -When a chunk of data can be read from the stream, it will emit a -`'readable'` event. - -In some cases, listening for a `'readable'` event will cause some data -to be read into the internal buffer from the underlying system, if it -hadn't already. - -```javascript -var readable = getReadableStreamSomehow(); -readable.on('readable', () => { - // there is some data to read now -}); -``` - -Once the internal buffer is drained, a `'readable'` event will fire -again when more data is available. - -The `'readable'` event is not emitted in the "flowing" mode with the -sole exception of the last one, on end-of-stream. - -The `'readable'` event indicates that the stream has new information: -either new data is available or the end of the stream has been reached. -In the former case, [`stream.read()`][stream-read] will return that data. In the -latter case, [`stream.read()`][stream-read] will return null. For instance, in -the following example, `foo.txt` is an empty file: - -```js -const fs = require('fs'); -var rr = fs.createReadStream('foo.txt'); -rr.on('readable', () => { - console.log('readable:', rr.read()); -}); -rr.on('end', () => { - console.log('end'); -}); -``` - -The output of running this script is: - -``` -$ node test.js -readable: null -end -``` - -#### readable.isPaused() - -* Return: {Boolean} - -This method returns whether or not the `readable` has been **explicitly** -paused by client code (using [`stream.pause()`][stream-pause] without a -corresponding [`stream.resume()`][stream-resume]). - -```js -var readable = new stream.Readable - -readable.isPaused() // === false -readable.pause() -readable.isPaused() // === true -readable.resume() -readable.isPaused() // === false -``` - -#### readable.pause() - -* Return: `this` - -This method will cause a stream in flowing mode to stop emitting -[`'data'`][] events, switching out of flowing mode. Any data that becomes -available will remain in the internal buffer. - -```js -var readable = getReadableStreamSomehow(); -readable.on('data', (chunk) => { - console.log('got %d bytes of data', chunk.length); - readable.pause(); - console.log('there will be no more data for 1 second'); - setTimeout(() => { - console.log('now data will start flowing again'); - readable.resume(); - }, 1000); -}); -``` - -#### readable.pipe(destination[, options]) - -* `destination` {stream.Writable} The destination for writing data -* `options` {Object} Pipe options - * `end` {Boolean} End the writer when the reader ends. Default = `true` - -This method pulls all the data out of a readable stream, and writes it -to the supplied destination, automatically managing the flow so that -the destination is not overwhelmed by a fast readable stream. - -Multiple destinations can be piped to safely. - -```js -var readable = getReadableStreamSomehow(); -var writable = fs.createWriteStream('file.txt'); -// All the data from readable goes into 'file.txt' -readable.pipe(writable); -``` - -This function returns the destination stream, so you can set up pipe -chains like so: - -```js -var r = fs.createReadStream('file.txt'); -var z = zlib.createGzip(); -var w = fs.createWriteStream('file.txt.gz'); -r.pipe(z).pipe(w); -``` - -For example, emulating the Unix `cat` command: - -```js -process.stdin.pipe(process.stdout); -``` - -By default [`stream.end()`][stream-end] is called on the destination when the -source stream emits [`'end'`][], so that `destination` is no longer writable. -Pass `{ end: false }` as `options` to keep the destination stream open. - -This keeps `writer` open so that "Goodbye" can be written at the -end. - -```js -reader.pipe(writer, { end: false }); -reader.on('end', () => { - writer.end('Goodbye\n'); -}); -``` - -Note that [`process.stderr`][] and [`process.stdout`][] are never closed until -the process exits, regardless of the specified options. - -#### readable.read([size]) - -* `size` {Number} Optional argument to specify how much data to read. -* Return {String|Buffer|Null} - -The `read()` method pulls some data out of the internal buffer and -returns it. If there is no data available, then it will return -`null`. - -If you pass in a `size` argument, then it will return that many -bytes. If `size` bytes are not available, then it will return `null`, -unless we've ended, in which case it will return the data remaining -in the buffer. - -If you do not specify a `size` argument, then it will return all the -data in the internal buffer. - -This method should only be called in paused mode. In flowing mode, -this method is called automatically until the internal buffer is -drained. - -```js -var readable = getReadableStreamSomehow(); -readable.on('readable', () => { - var chunk; - while (null !== (chunk = readable.read())) { - console.log('got %d bytes of data', chunk.length); - } -}); -``` - -If this method returns a data chunk, then it will also trigger the -emission of a [`'data'`][] event. - -Note that calling [`stream.read([size])`][stream-read] after the [`'end'`][] -event has been triggered will return `null`. No runtime error will be raised. - -#### readable.resume() - -* Return: `this` - -This method will cause the readable stream to resume emitting [`'data'`][] -events. - -This method will switch the stream into flowing mode. If you do *not* -want to consume the data from a stream, but you *do* want to get to -its [`'end'`][] event, you can call [`stream.resume()`][stream-resume] to open -the flow of data. - -```js -var readable = getReadableStreamSomehow(); -readable.resume(); -readable.on('end', () => { - console.log('got to the end, but did not read anything'); -}); -``` - -#### readable.setEncoding(encoding) - -* `encoding` {String} The encoding to use. -* Return: `this` - -Call this function to cause the stream to return strings of the specified -encoding instead of Buffer objects. For example, if you do -`readable.setEncoding('utf8')`, then the output data will be interpreted as -UTF-8 data, and returned as strings. If you do `readable.setEncoding('hex')`, -then the data will be encoded in hexadecimal string format. - -This properly handles multi-byte characters that would otherwise be -potentially mangled if you simply pulled the Buffers directly and -called [`buf.toString(encoding)`][] on them. If you want to read the data -as strings, always use this method. - -Also you can disable any encoding at all with `readable.setEncoding(null)`. -This approach is very useful if you deal with binary data or with large -multi-byte strings spread out over multiple chunks. - -```js -var readable = getReadableStreamSomehow(); -readable.setEncoding('utf8'); -readable.on('data', (chunk) => { - assert.equal(typeof chunk, 'string'); - console.log('got %d characters of string data', chunk.length); -}); -``` - -#### readable.unpipe([destination]) - -* `destination` {stream.Writable} Optional specific stream to unpipe - -This method will remove the hooks set up for a previous [`stream.pipe()`][] -call. - -If the destination is not specified, then all pipes are removed. - -If the destination is specified, but no pipe is set up for it, then -this is a no-op. - -```js -var readable = getReadableStreamSomehow(); -var writable = fs.createWriteStream('file.txt'); -// All the data from readable goes into 'file.txt', -// but only for the first second -readable.pipe(writable); -setTimeout(() => { - console.log('stop writing to file.txt'); - readable.unpipe(writable); - console.log('manually close the file stream'); - writable.end(); -}, 1000); -``` - -#### readable.unshift(chunk) - -* `chunk` {Buffer|String} Chunk of data to unshift onto the read queue - -This is useful in certain cases where a stream is being consumed by a -parser, which needs to "un-consume" some data that it has -optimistically pulled out of the source, so that the stream can be -passed on to some other party. - -Note that `stream.unshift(chunk)` cannot be called after the [`'end'`][] event -has been triggered; a runtime error will be raised. - -If you find that you must often call `stream.unshift(chunk)` in your -programs, consider implementing a [Transform][] stream instead. (See [API -for Stream Implementors][].) - -```js -// Pull off a header delimited by \n\n -// use unshift() if we get too much -// Call the callback with (error, header, stream) -const StringDecoder = require('string_decoder').StringDecoder; -function parseHeader(stream, callback) { - stream.on('error', callback); - stream.on('readable', onReadable); - var decoder = new StringDecoder('utf8'); - var header = ''; - function onReadable() { - var chunk; - while (null !== (chunk = stream.read())) { - var str = decoder.write(chunk); - if (str.match(/\n\n/)) { - // found the header boundary - var split = str.split(/\n\n/); - header += split.shift(); - var remaining = split.join('\n\n'); - var buf = new Buffer(remaining, 'utf8'); - if (buf.length) - stream.unshift(buf); - stream.removeListener('error', callback); - stream.removeListener('readable', onReadable); - // now the body of the message can be read from the stream. - callback(null, header, stream); - } else { - // still reading the header. - header += str; - } - } - } -} -``` - -Note that, unlike [`stream.push(chunk)`][stream-push], `stream.unshift(chunk)` -will not end the reading process by resetting the internal reading state of the -stream. This can cause unexpected results if `unshift()` is called during a -read (i.e. from within a [`stream._read()`][stream-_read] implementation on a -custom stream). Following the call to `unshift()` with an immediate -[`stream.push('')`][stream-push] will reset the reading state appropriately, -however it is best to simply avoid calling `unshift()` while in the process of -performing a read. - -#### readable.wrap(stream) - -* `stream` {Stream} An "old style" readable stream - -Versions of Node.js prior to v0.10 had streams that did not implement the -entire Streams API as it is today. (See [Compatibility][] for -more information.) - -If you are using an older Node.js library that emits [`'data'`][] events and -has a [`stream.pause()`][stream-pause] method that is advisory only, then you -can use the `wrap()` method to create a [Readable][] stream that uses the old -stream as its data source. - -You will very rarely ever need to call this function, but it exists -as a convenience for interacting with old Node.js programs and libraries. - -For example: - -```js -const OldReader = require('./old-api-module.js').OldReader; -const Readable = require('stream').Readable; -const oreader = new OldReader; -const myReader = new Readable().wrap(oreader); - -myReader.on('readable', () => { - myReader.read(); // etc. -}); -``` - -### Class: stream.Transform - -Transform streams are [Duplex][] streams where the output is in some way -computed from the input. They implement both the [Readable][] and -[Writable][] interfaces. - -Examples of Transform streams include: - -* [zlib streams][zlib] -* [crypto streams][crypto] - -### Class: stream.Writable - - - -The Writable stream interface is an abstraction for a *destination* -that you are writing data *to*. - -Examples of writable streams include: - -* [HTTP requests, on the client][] -* [HTTP responses, on the server][] -* [fs write streams][] -* [zlib streams][zlib] -* [crypto streams][crypto] -* [TCP sockets][] -* [child process stdin][] -* [`process.stdout`][], [`process.stderr`][] - -#### Event: 'drain' - -If a [`stream.write(chunk)`][stream-write] call returns `false`, then the -`'drain'` event will indicate when it is appropriate to begin writing more data -to the stream. - -```js -// Write the data to the supplied writable stream one million times. -// Be attentive to back-pressure. -function writeOneMillionTimes(writer, data, encoding, callback) { - var i = 1000000; - write(); - function write() { - var ok = true; - do { - i -= 1; - if (i === 0) { - // last time! - writer.write(data, encoding, callback); - } else { - // see if we should continue, or wait - // don't pass the callback, because we're not done yet. - ok = writer.write(data, encoding); - } - } while (i > 0 && ok); - if (i > 0) { - // had to stop early! - // write some more once it drains - writer.once('drain', write); - } - } -} -``` - -#### Event: 'error' - -* {Error} - -Emitted if there was an error when writing or piping data. - -#### Event: 'finish' - -When the [`stream.end()`][stream-end] method has been called, and all data has -been flushed to the underlying system, this event is emitted. - -```javascript -var writer = getWritableStreamSomehow(); -for (var i = 0; i < 100; i ++) { - writer.write('hello, #${i}!\n'); -} -writer.end('this is the end\n'); -writer.on('finish', () => { - console.error('all writes are now complete.'); -}); -``` - -#### Event: 'pipe' - -* `src` {stream.Readable} source stream that is piping to this writable - -This is emitted whenever the [`stream.pipe()`][] method is called on a readable -stream, adding this writable to its set of destinations. - -```js -var writer = getWritableStreamSomehow(); -var reader = getReadableStreamSomehow(); -writer.on('pipe', (src) => { - console.error('something is piping into the writer'); - assert.equal(src, reader); -}); -reader.pipe(writer); -``` - -#### Event: 'unpipe' - -* `src` {[Readable][] Stream} The source stream that - [unpiped][`stream.unpipe()`] this writable - -This is emitted whenever the [`stream.unpipe()`][] method is called on a -readable stream, removing this writable from its set of destinations. - -```js -var writer = getWritableStreamSomehow(); -var reader = getReadableStreamSomehow(); -writer.on('unpipe', (src) => { - console.error('something has stopped piping into the writer'); - assert.equal(src, reader); -}); -reader.pipe(writer); -reader.unpipe(writer); -``` - -#### writable.cork() - -Forces buffering of all writes. - -Buffered data will be flushed either at [`stream.uncork()`][] or at -[`stream.end()`][stream-end] call. - -#### writable.end([chunk][, encoding][, callback]) - -* `chunk` {String|Buffer} Optional data to write -* `encoding` {String} The encoding, if `chunk` is a String -* `callback` {Function} Optional callback for when the stream is finished - -Call this method when no more data will be written to the stream. If supplied, -the callback is attached as a listener on the [`'finish'`][] event. - -Calling [`stream.write()`][stream-write] after calling -[`stream.end()`][stream-end] will raise an error. - -```js -// write 'hello, ' and then end with 'world!' -var file = fs.createWriteStream('example.txt'); -file.write('hello, '); -file.end('world!'); -// writing more now is not allowed! -``` - -#### writable.setDefaultEncoding(encoding) - -* `encoding` {String} The new default encoding - -Sets the default encoding for a writable stream. - -#### writable.uncork() - -Flush all data, buffered since [`stream.cork()`][] call. - -#### writable.write(chunk[, encoding][, callback]) - -* `chunk` {String|Buffer} The data to write -* `encoding` {String} The encoding, if `chunk` is a String -* `callback` {Function} Callback for when this chunk of data is flushed -* Returns: {Boolean} `true` if the data was handled completely. - -This method writes some data to the underlying system, and calls the -supplied callback once the data has been fully handled. - -The return value indicates if you should continue writing right now. -If the data had to be buffered internally, then it will return -`false`. Otherwise, it will return `true`. - -This return value is strictly advisory. You MAY continue to write, -even if it returns `false`. However, writes will be buffered in -memory, so it is best not to do this excessively. Instead, wait for -the [`'drain'`][] event before writing more data. - - -## API for Stream Implementors - - - -To implement any sort of stream, the pattern is the same: - -1. Extend the appropriate parent class in your own subclass. (The - [`util.inherits()`][] method is particularly helpful for this.) -2. Call the appropriate parent class constructor in your constructor, - to be sure that the internal mechanisms are set up properly. -3. Implement one or more specific methods, as detailed below. - -The class to extend and the method(s) to implement depend on the sort -of stream class you are writing: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    -

    Use-case

    -
    -

    Class

    -
    -

    Method(s) to implement

    -
    -

    Reading only

    -
    -

    [Readable](#stream_class_stream_readable_1)

    -
    -

    [_read][stream-_read]

    -
    -

    Writing only

    -
    -

    [Writable](#stream_class_stream_writable_1)

    -
    -

    [_write][stream-_write], [_writev][stream-_writev]

    -
    -

    Reading and writing

    -
    -

    [Duplex](#stream_class_stream_duplex_1)

    -
    -

    [_read][stream-_read], [_write][stream-_write], [_writev][stream-_writev]

    -
    -

    Operate on written data, then read the result

    -
    -

    [Transform](#stream_class_stream_transform_1)

    -
    -

    [_transform][stream-_transform], [_flush][stream-_flush]

    -
    - -In your implementation code, it is very important to never call the methods -described in [API for Stream Consumers][]. Otherwise, you can potentially cause -adverse side effects in programs that consume your streaming interfaces. - -### Class: stream.Duplex - - - -A "duplex" stream is one that is both Readable and Writable, such as a TCP -socket connection. - -Note that `stream.Duplex` is an abstract class designed to be extended -with an underlying implementation of the [`stream._read(size)`][stream-_read] -and [`stream._write(chunk, encoding, callback)`][stream-_write] methods as you -would with a Readable or Writable stream class. - -Since JavaScript doesn't have multiple prototypal inheritance, this class -prototypally inherits from Readable, and then parasitically from Writable. It is -thus up to the user to implement both the low-level -[`stream._read(n)`][stream-_read] method as well as the low-level -[`stream._write(chunk, encoding, callback)`][stream-_write] method on extension -duplex classes. - -#### new stream.Duplex(options) - -* `options` {Object} Passed to both Writable and Readable - constructors. Also has the following fields: - * `allowHalfOpen` {Boolean} Default = `true`. If set to `false`, then - the stream will automatically end the readable side when the - writable side ends and vice versa. - * `readableObjectMode` {Boolean} Default = `false`. Sets `objectMode` - for readable side of the stream. Has no effect if `objectMode` - is `true`. - * `writableObjectMode` {Boolean} Default = `false`. Sets `objectMode` - for writable side of the stream. Has no effect if `objectMode` - is `true`. - -In classes that extend the Duplex class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -### Class: stream.PassThrough - -This is a trivial implementation of a [Transform][] stream that simply -passes the input bytes across to the output. Its purpose is mainly -for examples and testing, but there are occasionally use cases where -it can come in handy as a building block for novel sorts of streams. - -### Class: stream.Readable - - - -`stream.Readable` is an abstract class designed to be extended with an -underlying implementation of the [`stream._read(size)`][stream-_read] method. - -Please see [API for Stream Consumers][] for how to consume -streams in your programs. What follows is an explanation of how to -implement Readable streams in your programs. - -#### new stream.Readable([options]) - -* `options` {Object} - * `highWaterMark` {Number} The maximum number of bytes to store in - the internal buffer before ceasing to read from the underlying - resource. Default = `16384` (16kb), or `16` for `objectMode` streams - * `encoding` {String} If specified, then buffers will be decoded to - strings using the specified encoding. Default = `null` - * `objectMode` {Boolean} Whether this stream should behave - as a stream of objects. Meaning that [`stream.read(n)`][stream-read] returns - a single value instead of a Buffer of size n. Default = `false` - * `read` {Function} Implementation for the [`stream._read()`][stream-_read] - method. - -In classes that extend the Readable class, make sure to call the -Readable constructor so that the buffering settings can be properly -initialized. - -#### readable.\_read(size) - -* `size` {Number} Number of bytes to read asynchronously - -Note: **Implement this method, but do NOT call it directly.** - -This method is prefixed with an underscore because it is internal to the -class that defines it and should only be called by the internal Readable -class methods. All Readable stream implementations must provide a \_read -method to fetch data from the underlying resource. - -When `_read()` is called, if data is available from the resource, the `_read()` -implementation should start pushing that data into the read queue by calling -[`this.push(dataChunk)`][stream-push]. `_read()` should continue reading from -the resource and pushing data until push returns `false`, at which point it -should stop reading from the resource. Only when `_read()` is called again after -it has stopped should it start reading more data from the resource and pushing -that data onto the queue. - -Note: once the `_read()` method is called, it will not be called again until -the [`stream.push()`][stream-push] method is called. - -The `size` argument is advisory. Implementations where a "read" is a -single call that returns data can use this to know how much data to -fetch. Implementations where that is not relevant, such as TCP or -TLS, may ignore this argument, and simply provide data whenever it -becomes available. There is no need, for example to "wait" until -`size` bytes are available before calling [`stream.push(chunk)`][stream-push]. - -#### readable.push(chunk[, encoding]) - - -* `chunk` {Buffer|Null|String} Chunk of data to push into the read queue -* `encoding` {String} Encoding of String chunks. Must be a valid - Buffer encoding, such as `'utf8'` or `'ascii'` -* return {Boolean} Whether or not more pushes should be performed - -Note: **This method should be called by Readable implementors, NOT -by consumers of Readable streams.** - -If a value other than null is passed, The `push()` method adds a chunk of data -into the queue for subsequent stream processors to consume. If `null` is -passed, it signals the end of the stream (EOF), after which no more data -can be written. - -The data added with `push()` can be pulled out by calling the -[`stream.read()`][stream-read] method when the [`'readable'`][] event fires. - -This API is designed to be as flexible as possible. For example, -you may be wrapping a lower-level source which has some sort of -pause/resume mechanism, and a data callback. In those cases, you -could wrap the low-level source object by doing something like this: - -```js -// source is an object with readStop() and readStart() methods, -// and an `ondata` member that gets called when it has data, and -// an `onend` member that gets called when the data is over. - -util.inherits(SourceWrapper, Readable); - -function SourceWrapper(options) { - Readable.call(this, options); - - this._source = getLowlevelSourceObject(); - - // Every time there's data, we push it into the internal buffer. - this._source.ondata = (chunk) => { - // if push() returns false, then we need to stop reading from source - if (!this.push(chunk)) - this._source.readStop(); - }; - - // When the source ends, we push the EOF-signaling `null` chunk - this._source.onend = () => { - this.push(null); - }; -} - -// _read will be called when the stream wants to pull more data in -// the advisory size argument is ignored in this case. -SourceWrapper.prototype._read = function(size) { - this._source.readStart(); -}; -``` - -#### Example: A Counting Stream - - - -This is a basic example of a Readable stream. It emits the numerals -from 1 to 1,000,000 in ascending order, and then ends. - -```js -const Readable = require('stream').Readable; -const util = require('util'); -util.inherits(Counter, Readable); - -function Counter(opt) { - Readable.call(this, opt); - this._max = 1000000; - this._index = 1; -} - -Counter.prototype._read = function() { - var i = this._index++; - if (i > this._max) - this.push(null); - else { - var str = '' + i; - var buf = new Buffer(str, 'ascii'); - this.push(buf); - } -}; -``` - -#### Example: SimpleProtocol v1 (Sub-optimal) - -This is similar to the `parseHeader` function described -[here](#stream_readable_unshift_chunk), but implemented as a custom stream. -Also, note that this implementation does not convert the incoming data to a -string. - -However, this would be better implemented as a [Transform][] stream. See -[SimpleProtocol v2][] for a better implementation. - -```js -// A parser for a simple data protocol. -// The "header" is a JSON object, followed by 2 \n characters, and -// then a message body. -// -// NOTE: This can be done more simply as a Transform stream! -// Using Readable directly for this is sub-optimal. See the -// alternative example below under the Transform section. - -const Readable = require('stream').Readable; -const util = require('util'); - -util.inherits(SimpleProtocol, Readable); - -function SimpleProtocol(source, options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(source, options); - - Readable.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - - // source is a readable stream, such as a socket or file - this._source = source; - - var self = this; - source.on('end', () => { - self.push(null); - }); - - // give it a kick whenever the source is readable - // read(0) will not consume any bytes - source.on('readable', () => { - self.read(0); - }); - - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype._read = function(n) { - if (!this._inBody) { - var chunk = this._source.read(); - - // if the source doesn't have data, we don't have data yet. - if (chunk === null) - return this.push(''); - - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - this.push(''); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // now, because we got some extra data, unshift the rest - // back into the read queue so that our consumer will see it. - var b = chunk.slice(split); - this.unshift(b); - // calling unshift by itself does not reset the reading state - // of the stream; since we're inside _read, doing an additional - // push('') will reset the state appropriately. - this.push(''); - - // and let them know that we are done parsing the header. - this.emit('header', this.header); - } - } else { - // from there on, just provide the data to our consumer. - // careful not to push(null), since that would indicate EOF. - var chunk = this._source.read(); - if (chunk) this.push(chunk); - } -}; - -// Usage: -// var parser = new SimpleProtocol(source); -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### Class: stream.Transform - -A "transform" stream is a duplex stream where the output is causally -connected in some way to the input, such as a [zlib][] stream or a -[crypto][] stream. - -There is no requirement that the output be the same size as the input, -the same number of chunks, or arrive at the same time. For example, a -Hash stream will only ever have a single chunk of output which is -provided when the input is ended. A zlib stream will produce output -that is either much smaller or much larger than its input. - -Rather than implement the [`stream._read()`][stream-_read] and -[`stream._write()`][stream-_write] methods, Transform classes must implement the -[`stream._transform()`][stream-_transform] method, and may optionally -also implement the [`stream._flush()`][stream-_flush] method. (See below.) - -#### new stream.Transform([options]) - -* `options` {Object} Passed to both Writable and Readable - constructors. Also has the following fields: - * `transform` {Function} Implementation for the - [`stream._transform()`][stream-_transform] method. - * `flush` {Function} Implementation for the [`stream._flush()`][stream-_flush] - method. - -In classes that extend the Transform class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -#### Events: 'finish' and 'end' - -The [`'finish'`][] and [`'end'`][] events are from the parent Writable -and Readable classes respectively. The `'finish'` event is fired after -[`stream.end()`][stream-end] is called and all chunks have been processed by -[`stream._transform()`][stream-_transform], `'end'` is fired after all data has -been output which is after the callback in [`stream._flush()`][stream-_flush] -has been called. - -#### transform.\_flush(callback) - -* `callback` {Function} Call this function (optionally with an error - argument) when you are done flushing any remaining data. - -Note: **This function MUST NOT be called directly.** It MAY be implemented -by child classes, and if so, will be called by the internal Transform -class methods only. - -In some cases, your transform operation may need to emit a bit more -data at the end of the stream. For example, a `Zlib` compression -stream will store up some internal state so that it can optimally -compress the output. At the end, however, it needs to do the best it -can with what is left, so that the data will be complete. - -In those cases, you can implement a `_flush()` method, which will be -called at the very end, after all the written data is consumed, but -before emitting [`'end'`][] to signal the end of the readable side. Just -like with [`stream._transform()`][stream-_transform], call -`transform.push(chunk)` zero or more times, as appropriate, and call `callback` -when the flush operation is complete. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### transform.\_transform(chunk, encoding, callback) - -* `chunk` {Buffer|String} The chunk to be transformed. Will **always** - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. If chunk is a buffer, then this is the special - value - 'buffer', ignore it in this case. -* `callback` {Function} Call this function (optionally with an error - argument and data) when you are done processing the supplied chunk. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Transform -class methods only. - -All Transform stream implementations must provide a `_transform()` -method to accept input and produce output. - -`_transform()` should do whatever has to be done in this specific -Transform class, to handle the bytes being written, and pass them off -to the readable portion of the interface. Do asynchronous I/O, -process things, and so on. - -Call `transform.push(outputChunk)` 0 or more times to generate output -from this input chunk, depending on how much data you want to output -as a result of this chunk. - -Call the callback function only when the current chunk is completely -consumed. Note that there may or may not be output as a result of any -particular input chunk. If you supply a second argument to the callback -it will be passed to the push method. In other words the following are -equivalent: - -```js -transform.prototype._transform = function (data, encoding, callback) { - this.push(data); - callback(); -}; - -transform.prototype._transform = function (data, encoding, callback) { - callback(null, data); -}; -``` - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### Example: `SimpleProtocol` parser v2 - -The example [here](#stream_example_simpleprotocol_v1_sub_optimal) of a simple -protocol parser can be implemented simply by using the higher level -[Transform][] stream class, similar to the `parseHeader` and `SimpleProtocol -v1` examples. - -In this example, rather than providing the input as an argument, it -would be piped into the parser, which is a more idiomatic Node.js stream -approach. - -```javascript -const util = require('util'); -const Transform = require('stream').Transform; -util.inherits(SimpleProtocol, Transform); - -function SimpleProtocol(options) { - if (!(this instanceof SimpleProtocol)) - return new SimpleProtocol(options); - - Transform.call(this, options); - this._inBody = false; - this._sawFirstCr = false; - this._rawHeader = []; - this.header = null; -} - -SimpleProtocol.prototype._transform = function(chunk, encoding, done) { - if (!this._inBody) { - // check if the chunk has a \n\n - var split = -1; - for (var i = 0; i < chunk.length; i++) { - if (chunk[i] === 10) { // '\n' - if (this._sawFirstCr) { - split = i; - break; - } else { - this._sawFirstCr = true; - } - } else { - this._sawFirstCr = false; - } - } - - if (split === -1) { - // still waiting for the \n\n - // stash the chunk, and try again. - this._rawHeader.push(chunk); - } else { - this._inBody = true; - var h = chunk.slice(0, split); - this._rawHeader.push(h); - var header = Buffer.concat(this._rawHeader).toString(); - try { - this.header = JSON.parse(header); - } catch (er) { - this.emit('error', new Error('invalid simple protocol data')); - return; - } - // and let them know that we are done parsing the header. - this.emit('header', this.header); - - // now, because we got some extra data, emit this first. - this.push(chunk.slice(split)); - } - } else { - // from there on, just provide the data to our consumer as-is. - this.push(chunk); - } - done(); -}; - -// Usage: -// var parser = new SimpleProtocol(); -// source.pipe(parser) -// Now parser is a readable stream that will emit 'header' -// with the parsed header data. -``` - -### Class: stream.Writable - - - -`stream.Writable` is an abstract class designed to be extended with an -underlying implementation of the -[`stream._write(chunk, encoding, callback)`][stream-_write] method. - -Please see [API for Stream Consumers][] for how to consume -writable streams in your programs. What follows is an explanation of -how to implement Writable streams in your programs. - -#### new stream.Writable([options]) - -* `options` {Object} - * `highWaterMark` {Number} Buffer level when - [`stream.write()`][stream-write] starts returning `false`. Default = `16384` - (16kb), or `16` for `objectMode` streams. - * `decodeStrings` {Boolean} Whether or not to decode strings into - Buffers before passing them to [`stream._write()`][stream-_write]. - Default = `true` - * `objectMode` {Boolean} Whether or not the - [`stream.write(anyObj)`][stream-write] is a valid operation. If set you can - write arbitrary data instead of only `Buffer` / `String` data. - Default = `false` - * `write` {Function} Implementation for the - [`stream._write()`][stream-_write] method. - * `writev` {Function} Implementation for the - [`stream._writev()`][stream-_writev] method. - -In classes that extend the Writable class, make sure to call the -constructor so that the buffering settings can be properly -initialized. - -#### writable.\_write(chunk, encoding, callback) - -* `chunk` {Buffer|String} The chunk to be written. Will **always** - be a buffer unless the `decodeStrings` option was set to `false`. -* `encoding` {String} If the chunk is a string, then this is the - encoding type. If chunk is a buffer, then this is the special - value - 'buffer', ignore it in this case. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunk. - -All Writable stream implementations must provide a -[`stream._write()`][stream-_write] method to send data to the underlying -resource. - -Note: **This function MUST NOT be called directly.** It should be -implemented by child classes, and called by the internal Writable -class methods only. - -Call the callback using the standard `callback(error)` pattern to -signal that the write completed successfully or with an error. - -If the `decodeStrings` flag is set in the constructor options, then -`chunk` may be a string rather than a Buffer, and `encoding` will -indicate the sort of string that it is. This is to support -implementations that have an optimized handling for certain string -data encodings. If you do not explicitly set the `decodeStrings` -option to `false`, then you can safely ignore the `encoding` argument, -and assume that `chunk` will always be a Buffer. - -This method is prefixed with an underscore because it is internal to -the class that defines it, and should not be called directly by user -programs. However, you **are** expected to override this method in -your own extension classes. - -#### writable.\_writev(chunks, callback) - -* `chunks` {Array} The chunks to be written. Each chunk has following - format: `{ chunk: ..., encoding: ... }`. -* `callback` {Function} Call this function (optionally with an error - argument) when you are done processing the supplied chunks. - -Note: **This function MUST NOT be called directly.** It may be -implemented by child classes, and called by the internal Writable -class methods only. - -This function is completely optional to implement. In most cases it is -unnecessary. If implemented, it will be called with all the chunks -that are buffered in the write queue. - - -## Simplified Constructor API - - - -In simple cases there is now the added benefit of being able to construct a -stream without inheritance. - -This can be done by passing the appropriate methods as constructor options: - -Examples: - -### Duplex - -```js -var duplex = new stream.Duplex({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - }, - write: function(chunk, encoding, next) { - // sets this._write under the hood - - // An optional error can be passed as the first argument - next() - } -}); - -// or - -var duplex = new stream.Duplex({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - }, - writev: function(chunks, next) { - // sets this._writev under the hood - - // An optional error can be passed as the first argument - next() - } -}); -``` - -### Readable - -```js -var readable = new stream.Readable({ - read: function(n) { - // sets this._read under the hood - - // push data onto the read queue, passing null - // will signal the end of the stream (EOF) - this.push(chunk); - } -}); -``` - -### Transform - -```js -var transform = new stream.Transform({ - transform: function(chunk, encoding, next) { - // sets this._transform under the hood - - // generate output as many times as needed - // this.push(chunk); - - // call when the current chunk is consumed - next(); - }, - flush: function(done) { - // sets this._flush under the hood - - // generate output as many times as needed - // this.push(chunk); - - done(); - } -}); -``` - -### Writable - -```js -var writable = new stream.Writable({ - write: function(chunk, encoding, next) { - // sets this._write under the hood - - // An optional error can be passed as the first argument - next() - } -}); - -// or - -var writable = new stream.Writable({ - writev: function(chunks, next) { - // sets this._writev under the hood - - // An optional error can be passed as the first argument - next() - } -}); -``` - -## Streams: Under the Hood - - - -### Buffering - - - -Both Writable and Readable streams will buffer data on an internal -object which can be retrieved from `_writableState.getBuffer()` or -`_readableState.buffer`, respectively. - -The amount of data that will potentially be buffered depends on the -`highWaterMark` option which is passed into the constructor. - -Buffering in Readable streams happens when the implementation calls -[`stream.push(chunk)`][stream-push]. If the consumer of the Stream does not -call [`stream.read()`][stream-read], then the data will sit in the internal -queue until it is consumed. - -Buffering in Writable streams happens when the user calls -[`stream.write(chunk)`][stream-write] repeatedly, even when it returns `false`. - -The purpose of streams, especially with the [`stream.pipe()`][] method, is to -limit the buffering of data to acceptable levels, so that sources and -destinations of varying speed will not overwhelm the available memory. - -### Compatibility with Older Node.js Versions - - - -In versions of Node.js prior to v0.10, the Readable stream interface was -simpler, but also less powerful and less useful. - -* Rather than waiting for you to call the [`stream.read()`][stream-read] method, - [`'data'`][] events would start emitting immediately. If you needed to do - some I/O to decide how to handle data, then you had to store the chunks - in some kind of buffer so that they would not be lost. -* The [`stream.pause()`][stream-pause] method was advisory, rather than - guaranteed. This meant that you still had to be prepared to receive - [`'data'`][] events even when the stream was in a paused state. - -In Node.js v0.10, the [Readable][] class was added. -For backwards compatibility with older Node.js programs, Readable streams -switch into "flowing mode" when a [`'data'`][] event handler is added, or -when the [`stream.resume()`][stream-resume] method is called. The effect is -that, even if you are not using the new [`stream.read()`][stream-read] method -and [`'readable'`][] event, you no longer have to worry about losing -[`'data'`][] chunks. - -Most programs will continue to function normally. However, this -introduces an edge case in the following conditions: - -* No [`'data'`][] event handler is added. -* The [`stream.resume()`][stream-resume] method is never called. -* The stream is not piped to any writable destination. - -For example, consider the following code: - -```js -// WARNING! BROKEN! -net.createServer((socket) => { - - // we add an 'end' method, but never consume the data - socket.on('end', () => { - // It will never get here. - socket.end('I got your message (but didnt read it)\n'); - }); - -}).listen(1337); -``` - -In versions of Node.js prior to v0.10, the incoming message data would be -simply discarded. However, in Node.js v0.10 and beyond, -the socket will remain paused forever. - -The workaround in this situation is to call the -[`stream.resume()`][stream-resume] method to start the flow of data: - -```js -// Workaround -net.createServer((socket) => { - - socket.on('end', () => { - socket.end('I got your message (but didnt read it)\n'); - }); - - // start the flow of data, discarding it. - socket.resume(); - -}).listen(1337); -``` - -In addition to new Readable streams switching into flowing mode, -pre-v0.10 style streams can be wrapped in a Readable class using the -[`stream.wrap()`][] method. - - -### Object Mode - - - -Normally, Streams operate on Strings and Buffers exclusively. - -Streams that are in **object mode** can emit generic JavaScript values -other than Buffers and Strings. - -A Readable stream in object mode will always return a single item from -a call to [`stream.read(size)`][stream-read], regardless of what the size -argument is. - -A Writable stream in object mode will always ignore the `encoding` -argument to [`stream.write(data, encoding)`][stream-write]. - -The special value `null` still retains its special value for object -mode streams. That is, for object mode readable streams, `null` as a -return value from [`stream.read()`][stream-read] indicates that there is no more -data, and [`stream.push(null)`][stream-push] will signal the end of stream data -(`EOF`). - -No streams in Node.js core are object mode streams. This pattern is only -used by userland streaming libraries. - -You should set `objectMode` in your stream child class constructor on -the options object. Setting `objectMode` mid-stream is not safe. - -For Duplex streams `objectMode` can be set exclusively for readable or -writable side with `readableObjectMode` and `writableObjectMode` -respectively. These options can be used to implement parsers and -serializers with Transform streams. - -```js -const util = require('util'); -const StringDecoder = require('string_decoder').StringDecoder; -const Transform = require('stream').Transform; -util.inherits(JSONParseStream, Transform); - -// Gets \n-delimited JSON string data, and emits the parsed objects -function JSONParseStream() { - if (!(this instanceof JSONParseStream)) - return new JSONParseStream(); - - Transform.call(this, { readableObjectMode : true }); - - this._buffer = ''; - this._decoder = new StringDecoder('utf8'); -} - -JSONParseStream.prototype._transform = function(chunk, encoding, cb) { - this._buffer += this._decoder.write(chunk); - // split on newlines - var lines = this._buffer.split(/\r?\n/); - // keep the last partial line buffered - this._buffer = lines.pop(); - for (var l = 0; l < lines.length; l++) { - var line = lines[l]; - try { - var obj = JSON.parse(line); - } catch (er) { - this.emit('error', er); - return; - } - // push the parsed object out to the readable consumer - this.push(obj); - } - cb(); -}; - -JSONParseStream.prototype._flush = function(cb) { - // Just handle any leftover - var rem = this._buffer.trim(); - if (rem) { - try { - var obj = JSON.parse(rem); - } catch (er) { - this.emit('error', er); - return; - } - // push the parsed object out to the readable consumer - this.push(obj); - } - cb(); -}; -``` - -### `stream.read(0)` - -There are some cases where you want to trigger a refresh of the -underlying readable stream mechanisms, without actually consuming any -data. In that case, you can call `stream.read(0)`, which will always -return null. - -If the internal read buffer is below the `highWaterMark`, and the -stream is not currently reading, then calling `stream.read(0)` will trigger -a low-level [`stream._read()`][stream-_read] call. - -There is almost never a need to do this. However, you will see some -cases in Node.js's internals where this is done, particularly in the -Readable stream class internals. - -### `stream.push('')` - -Pushing a zero-byte string or Buffer (when not in [Object mode][]) has an -interesting side effect. Because it *is* a call to -[`stream.push()`][stream-push], it will end the `reading` process. However, it -does *not* add any data to the readable buffer, so there's nothing for -a user to consume. - -Very rarely, there are cases where you have no data to provide now, -but the consumer of your stream (or, perhaps, another bit of your own -code) will know when to check again, by calling [`stream.read(0)`][stream-read]. -In those cases, you *may* call `stream.push('')`. - -So far, the only use case for this functionality is in the -[`tls.CryptoStream`][] class, which is deprecated in Node.js/io.js v1.0. If you -find that you have to use `stream.push('')`, please consider another -approach, because it almost certainly indicates that something is -horribly wrong. - -[`'data'`]: #stream_event_data -[`'drain'`]: #stream_event_drain -[`'end'`]: #stream_event_end -[`'finish'`]: #stream_event_finish -[`'readable'`]: #stream_event_readable -[`buf.toString(encoding)`]: https://nodejs.org/docs/v5.8.0/api/buffer.html#buffer_buf_tostring_encoding_start_end -[`EventEmitter`]: https://nodejs.org/docs/v5.8.0/api/events.html#events_class_eventemitter -[`process.stderr`]: https://nodejs.org/docs/v5.8.0/api/process.html#process_process_stderr -[`process.stdin`]: https://nodejs.org/docs/v5.8.0/api/process.html#process_process_stdin -[`process.stdout`]: https://nodejs.org/docs/v5.8.0/api/process.html#process_process_stdout -[`stream.cork()`]: #stream_writable_cork -[`stream.pipe()`]: #stream_readable_pipe_destination_options -[`stream.uncork()`]: #stream_writable_uncork -[`stream.unpipe()`]: #stream_readable_unpipe_destination -[`stream.wrap()`]: #stream_readable_wrap_stream -[`tls.CryptoStream`]: https://nodejs.org/docs/v5.8.0/api/tls.html#tls_class_cryptostream -[`util.inherits()`]: https://nodejs.org/docs/v5.8.0/api/util.html#util_util_inherits_constructor_superconstructor -[API for Stream Consumers]: #stream_api_for_stream_consumers -[API for Stream Implementors]: #stream_api_for_stream_implementors -[child process stdin]: https://nodejs.org/docs/v5.8.0/api/child_process.html#child_process_child_stdin -[child process stdout and stderr]: https://nodejs.org/docs/v5.8.0/api/child_process.html#child_process_child_stdout -[Compatibility]: #stream_compatibility_with_older_node_js_versions -[crypto]: crypto.html -[Duplex]: #stream_class_stream_duplex -[fs read streams]: https://nodejs.org/docs/v5.8.0/api/fs.html#fs_class_fs_readstream -[fs write streams]: https://nodejs.org/docs/v5.8.0/api/fs.html#fs_class_fs_writestream -[HTTP requests, on the client]: https://nodejs.org/docs/v5.8.0/api/http.html#http_class_http_clientrequest -[HTTP responses, on the server]: https://nodejs.org/docs/v5.8.0/api/http.html#http_class_http_serverresponse -[http-incoming-message]: https://nodejs.org/docs/v5.8.0/api/http.html#http_class_http_incomingmessage -[Object mode]: #stream_object_mode -[Readable]: #stream_class_stream_readable -[SimpleProtocol v2]: #stream_example_simpleprotocol_parser_v2 -[stream-_flush]: #stream_transform_flush_callback -[stream-_read]: #stream_readable_read_size_1 -[stream-_transform]: #stream_transform_transform_chunk_encoding_callback -[stream-_write]: #stream_writable_write_chunk_encoding_callback_1 -[stream-_writev]: #stream_writable_writev_chunks_callback -[stream-end]: #stream_writable_end_chunk_encoding_callback -[stream-pause]: #stream_readable_pause -[stream-push]: #stream_readable_push_chunk_encoding -[stream-read]: #stream_readable_read_size -[stream-resume]: #stream_readable_resume -[stream-write]: #stream_writable_write_chunk_encoding_callback -[TCP sockets]: https://nodejs.org/docs/v5.8.0/api/net.html#net_class_net_socket -[Transform]: #stream_class_stream_transform -[Writable]: #stream_class_stream_writable -[zlib]: zlib.html diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md deleted file mode 100644 index 83275f19..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +++ /dev/null @@ -1,60 +0,0 @@ -# streams WG Meeting 2015-01-30 - -## Links - -* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg -* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106 -* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/ - -## Agenda - -Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting. - -* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105) -* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101) -* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102) -* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99) - -## Minutes - -### adopt a charter - -* group: +1's all around - -### What versioning scheme should be adopted? -* group: +1’s 3.0.0 -* domenic+group: pulling in patches from other sources where appropriate -* mikeal: version independently, suggesting versions for io.js -* mikeal+domenic: work with TC to notify in advance of changes -simpler stream creation - -### streamline creation of streams -* sam: streamline creation of streams -* domenic: nice simple solution posted - but, we lose the opportunity to change the model - may not be backwards incompatible (double check keys) - - **action item:** domenic will check - -### remove implicit flowing of streams on(‘data’) -* add isFlowing / isPaused -* mikeal: worrying that we’re documenting polyfill methods – confuses users -* domenic: more reflective API is probably good, with warning labels for users -* new section for mad scientists (reflective stream access) -* calvin: name the “third state” -* mikeal: maybe borrow the name from whatwg? -* domenic: we’re missing the “third state” -* consensus: kind of difficult to name the third state -* mikeal: figure out differences in states / compat -* mathias: always flow on data – eliminates third state - * explore what it breaks - -**action items:** -* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream) -* ask rod/build for infrastructure -* **chris**: explore the “flow on data” approach -* add isPaused/isFlowing -* add new docs section -* move isPaused to that section - - diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js deleted file mode 100644 index ca807af8..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/duplex.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_duplex.js") diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index 736693b8..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,75 +0,0 @@ -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -'use strict'; - -/**/ - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - keys.push(key); - }return keys; -}; -/**/ - -module.exports = Duplex; - -/**/ -var processNextTick = require('process-nextick-args'); -/**/ - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -var keys = objectKeys(Writable.prototype); -for (var v = 0; v < keys.length; v++) { - var method = keys[v]; - if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; -} - -function Duplex(options) { - if (!(this instanceof Duplex)) return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) this.readable = false; - - if (options && options.writable === false) this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) return; - - // no more data can be written. - // But allow more writes to happen in this tick. - processNextTick(onEndNT, this); -} - -function onEndNT(self) { - self.end(); -} - -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js deleted file mode 100644 index d06f71f1..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_passthrough.js +++ /dev/null @@ -1,26 +0,0 @@ -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -'use strict'; - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function (chunk, encoding, cb) { - cb(null, chunk); -}; \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index 54a9d5c5..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,880 +0,0 @@ -'use strict'; - -module.exports = Readable; - -/**/ -var processNextTick = require('process-nextick-args'); -/**/ - -/**/ -var isArray = require('isarray'); -/**/ - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Readable.ReadableState = ReadableState; - -var EE = require('events'); - -/**/ -var EElistenerCount = function (emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; - } -})(); -/**/ - -var Buffer = require('buffer').Buffer; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var debugUtil = require('util'); -var debug = undefined; -if (debugUtil && debugUtil.debuglog) { - debug = debugUtil.debuglog('stream'); -} else { - debug = function () {}; -} -/**/ - -var StringDecoder; - -util.inherits(Readable, Stream); - -var Duplex; -function ReadableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.readableObjectMode; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = null; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - this.resumeScheduled = false; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -var Duplex; -function Readable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - if (!(this instanceof Readable)) return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - if (options && typeof options.read === 'function') this._read = options.read; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function (chunk, encoding) { - var state = this._readableState; - - if (!state.objectMode && typeof chunk === 'string') { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function (chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -Readable.prototype.isPaused = function () { - return this._readableState.flowing === false; -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null) { - state.reading = false; - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - var skipAdd; - if (state.decoder && !addToFront && !encoding) { - chunk = state.decoder.write(chunk); - skipAdd = !state.objectMode && chunk.length === 0; - } - - if (!addToFront) state.reading = false; - - // Don't add to the buffer if we've decoded to an empty string chunk and - // we're not in object mode - if (!skipAdd) { - // if we want the data now, just emit it. - if (state.flowing && state.length === 0 && !state.sync) { - stream.emit('data', chunk); - stream.read(0); - } else { - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); - - if (state.needReadable) emitReadable(stream); - } - } - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && (state.needReadable || state.length < state.highWaterMark || state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function (enc) { - if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; - return this; -}; - -// Don't raise the hwm > 8MB -var MAX_HWM = 0x800000; -function computeNewHighWaterMark(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - n |= n >>> 1; - n |= n >>> 2; - n |= n >>> 4; - n |= n >>> 8; - n |= n >>> 16; - n++; - } - return n; -} - -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) return 0; - - if (state.objectMode) return n === 0 ? 0 : 1; - - if (n === null || isNaN(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length; - } - - if (n <= 0) return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else { - return state.length; - } - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function (n) { - debug('read', n); - var state = this._readableState; - var nOrig = n; - - if (typeof n !== 'number' || n > 0) state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && state.needReadable && (state.length >= state.highWaterMark || state.ended)) { - debug('read: emitReadable', state.length, state.ended); - if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - if (state.length === 0) endReadable(this); - return null; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - debug('need readable', doRead); - - // if we currently have less than the highWaterMark, then also read some - if (state.length === 0 || state.length - n < state.highWaterMark) { - doRead = true; - debug('length less than watermark', doRead); - } - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) { - doRead = false; - debug('reading or ended', doRead); - } - - if (doRead) { - debug('do read'); - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read pushed data synchronously, then `reading` will be false, - // and we need to re-evaluate how much data we can return to the user. - if (doRead && !state.reading) n = howMuchToRead(nOrig, state); - - var ret; - if (n > 0) ret = fromList(n, state);else ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) state.needReadable = true; - - // If we tried to read() past the EOF, then emit end on the next tick. - if (nOrig !== n && state.ended && state.length === 0) endReadable(this); - - if (ret !== null) this.emit('data', ret); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - -function onEofChunk(stream, state) { - if (state.ended) return; - if (state.decoder) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // emit 'readable' now to make sure it gets picked up. - emitReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (!state.emittedReadable) { - debug('emitReadable', state.flowing); - state.emittedReadable = true; - if (state.sync) processNextTick(emitReadable_, stream);else emitReadable_(stream); - } -} - -function emitReadable_(stream) { - debug('emit readable'); - stream.emit('readable'); - flow(stream); -} - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - processNextTick(maybeReadMore_, stream, state); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && state.length < state.highWaterMark) { - debug('maybeReadMore read 0'); - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break;else len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function (n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function (dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) processNextTick(endFn);else src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - debug('onunpipe'); - if (readable === src) { - cleanup(); - } - } - - function onend() { - debug('onend'); - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - var cleanedUp = false; - function cleanup() { - debug('cleanup'); - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - src.removeListener('data', ondata); - - cleanedUp = true; - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); - } - - src.on('data', ondata); - function ondata(chunk) { - debug('ondata'); - var ret = dest.write(chunk); - if (false === ret) { - // If the user unpiped during `dest.write()`, it is possible - // to get stuck in a permanently paused state if that write - // also returned false. - if (state.pipesCount === 1 && state.pipes[0] === dest && src.listenerCount('data') === 1 && !cleanedUp) { - debug('false write response, pause', src._readableState.awaitDrain); - src._readableState.awaitDrain++; - } - src.pause(); - } - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - debug('onerror', er); - unpipe(); - dest.removeListener('error', onerror); - if (EElistenerCount(dest, 'error') === 0) dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) dest.on('error', onerror);else if (isArray(dest._events.error)) dest._events.error.unshift(onerror);else dest._events.error = [onerror, dest._events.error]; - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - debug('onfinish'); - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - debug('unpipe'); - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - debug('pipe resume'); - src.resume(); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function () { - var state = src._readableState; - debug('pipeOnDrain', state.awaitDrain); - if (state.awaitDrain) state.awaitDrain--; - if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { - state.flowing = true; - flow(src); - } - }; -} - -Readable.prototype.unpipe = function (dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) return this; - - if (!dest) dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - if (dest) dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - state.flowing = false; - - for (var _i = 0; _i < len; _i++) { - dests[_i].emit('unpipe', this); - }return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function (ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - // If listening to data, and it has not explicitly been paused, - // then call resume to start the flow of data on the next tick. - if (ev === 'data' && false !== this._readableState.flowing) { - this.resume(); - } - - if (ev === 'readable' && !this._readableState.endEmitted) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - processNextTick(nReadingNextTick, this); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -function nReadingNextTick(self) { - debug('readable nexttick read 0'); - self.read(0); -} - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function () { - var state = this._readableState; - if (!state.flowing) { - debug('resume'); - state.flowing = true; - resume(this, state); - } - return this; -}; - -function resume(stream, state) { - if (!state.resumeScheduled) { - state.resumeScheduled = true; - processNextTick(resume_, stream, state); - } -} - -function resume_(stream, state) { - if (!state.reading) { - debug('resume read 0'); - stream.read(0); - } - - state.resumeScheduled = false; - stream.emit('resume'); - flow(stream); - if (state.flowing && !state.reading) stream.read(0); -} - -Readable.prototype.pause = function () { - debug('call pause flowing=%j', this._readableState.flowing); - if (false !== this._readableState.flowing) { - debug('pause'); - this._readableState.flowing = false; - this.emit('pause'); - } - return this; -}; - -function flow(stream) { - var state = stream._readableState; - debug('flow', state.flowing); - if (state.flowing) { - do { - var chunk = stream.read(); - } while (null !== chunk && state.flowing); - } -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function (stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function () { - debug('wrapped end'); - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function (chunk) { - debug('wrapped data'); - if (state.decoder) chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (this[i] === undefined && typeof stream[i] === 'function') { - this[i] = function (method) { - return function () { - return stream[method].apply(stream, arguments); - }; - }(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function (ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function (n) { - debug('wrapped _read', n); - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) return null; - - if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) ret = '';else ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) ret += buf.slice(0, cpy);else buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) list[0] = buf.slice(cpy);else list.shift(); - - c += cpy; - } - } - } - - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted) { - state.ended = true; - processNextTick(endReadableNT, state, stream); - } -} - -function endReadableNT(state, stream) { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } -} - -function forEach(xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -function indexOf(xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index 625cdc17..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,180 +0,0 @@ -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -'use strict'; - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - -function TransformState(stream) { - this.afterTransform = function (er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; - this.writeencoding = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (data !== null && data !== undefined) stream.push(data); - - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - -function Transform(options) { - if (!(this instanceof Transform)) return new Transform(options); - - Duplex.call(this, options); - - this._transformState = new TransformState(this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - if (options) { - if (typeof options.transform === 'function') this._transform = options.transform; - - if (typeof options.flush === 'function') this._flush = options.flush; - } - - this.once('prefinish', function () { - if (typeof this._flush === 'function') this._flush(function (er) { - done(stream, er); - });else done(stream); - }); -} - -Transform.prototype.push = function (chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function (chunk, encoding, cb) { - throw new Error('not implemented'); -}; - -Transform.prototype._write = function (chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function (n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - -function done(stream, er) { - if (er) return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var ts = stream._transformState; - - if (ws.length) throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) throw new Error('calling transform done when still transforming'); - - return stream.push(null); -} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index 95916c99..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,516 +0,0 @@ -// A bit simpler than readable streams. -// Implement an async ._write(chunk, encoding, cb), and it'll handle all -// the drain event emission and buffering. - -'use strict'; - -module.exports = Writable; - -/**/ -var processNextTick = require('process-nextick-args'); -/**/ - -/**/ -var asyncWrite = !process.browser && ['v0.10', 'v0.9.'].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : processNextTick; -/**/ - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Writable.WritableState = WritableState; - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -/**/ -var internalUtil = { - deprecate: require('util-deprecate') -}; -/**/ - -/**/ -var Stream; -(function () { - try { - Stream = require('st' + 'ream'); - } catch (_) {} finally { - if (!Stream) Stream = require('events').EventEmitter; - } -})(); -/**/ - -var Buffer = require('buffer').Buffer; - -util.inherits(Writable, Stream); - -function nop() {} - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; - this.next = null; -} - -var Duplex; -function WritableState(options, stream) { - Duplex = Duplex || require('./_stream_duplex'); - - options = options || {}; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - if (stream instanceof Duplex) this.objectMode = this.objectMode || !!options.writableObjectMode; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - var defaultHwm = this.objectMode ? 16 : 16 * 1024; - this.highWaterMark = hwm || hwm === 0 ? hwm : defaultHwm; - - // cast to ints. - this.highWaterMark = ~ ~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // when true all writes will be buffered until .uncork() call - this.corked = 0; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, because any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function (er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.bufferedRequest = null; - this.lastBufferedRequest = null; - - // number of pending user-supplied write callbacks - // this must be 0 before 'finish' can be emitted - this.pendingcb = 0; - - // emit prefinish if the only thing we're waiting for is _write cbs - // This is relevant for synchronous Transform streams - this.prefinished = false; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; - - // count buffered requests - this.bufferedRequestCount = 0; - - // create the two objects needed to store the corked requests - // they are not a linked list, as no new elements are inserted in there - this.corkedRequestsFree = new CorkedRequest(this); - this.corkedRequestsFree.next = new CorkedRequest(this); -} - -WritableState.prototype.getBuffer = function writableStateGetBuffer() { - var current = this.bufferedRequest; - var out = []; - while (current) { - out.push(current); - current = current.next; - } - return out; -}; - -(function () { - try { - Object.defineProperty(WritableState.prototype, 'buffer', { - get: internalUtil.deprecate(function () { - return this.getBuffer(); - }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.') - }); - } catch (_) {} -})(); - -var Duplex; -function Writable(options) { - Duplex = Duplex || require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - if (options) { - if (typeof options.write === 'function') this._write = options.write; - - if (typeof options.writev === 'function') this._writev = options.writev; - } - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function () { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; - -function writeAfterEnd(stream, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - processNextTick(cb, er); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - - if (!Buffer.isBuffer(chunk) && typeof chunk !== 'string' && chunk !== null && chunk !== undefined && !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - processNextTick(cb, er); - valid = false; - } - return valid; -} - -Writable.prototype.write = function (chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (Buffer.isBuffer(chunk)) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; - - if (typeof cb !== 'function') cb = nop; - - if (state.ended) writeAfterEnd(this, cb);else if (validChunk(this, state, chunk, cb)) { - state.pendingcb++; - ret = writeOrBuffer(this, state, chunk, encoding, cb); - } - - return ret; -}; - -Writable.prototype.cork = function () { - var state = this._writableState; - - state.corked++; -}; - -Writable.prototype.uncork = function () { - var state = this._writableState; - - if (state.corked) { - state.corked--; - - if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); - } -}; - -Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { - // node::ParseEncoding() requires lower case. - if (typeof encoding === 'string') encoding = encoding.toLowerCase(); - if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new TypeError('Unknown encoding: ' + encoding); - this._writableState.defaultEncoding = encoding; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { - chunk = new Buffer(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - - if (Buffer.isBuffer(chunk)) encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) state.needDrain = true; - - if (state.writing || state.corked) { - var last = state.lastBufferedRequest; - state.lastBufferedRequest = new WriteReq(chunk, encoding, cb); - if (last) { - last.next = state.lastBufferedRequest; - } else { - state.bufferedRequest = state.lastBufferedRequest; - } - state.bufferedRequestCount += 1; - } else { - doWrite(stream, state, false, len, chunk, encoding, cb); - } - - return ret; -} - -function doWrite(stream, state, writev, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - --state.pendingcb; - if (sync) processNextTick(cb, er);else cb(er); - - stream._writableState.errorEmitted = true; - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) onwriteError(stream, state, sync, er, cb);else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(state); - - if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { - clearBuffer(stream, state); - } - - if (sync) { - /**/ - asyncWrite(afterWrite, stream, state, finished, cb); - /**/ - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) onwriteDrain(stream, state); - state.pendingcb--; - cb(); - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - var entry = state.bufferedRequest; - - if (stream._writev && entry && entry.next) { - // Fast case, write everything using _writev() - var l = state.bufferedRequestCount; - var buffer = new Array(l); - var holder = state.corkedRequestsFree; - holder.entry = entry; - - var count = 0; - while (entry) { - buffer[count] = entry; - entry = entry.next; - count += 1; - } - - doWrite(stream, state, true, state.length, buffer, '', holder.finish); - - // doWrite is always async, defer these to save a bit of time - // as the hot path ends with doWrite - state.pendingcb++; - state.lastBufferedRequest = null; - state.corkedRequestsFree = holder.next; - holder.next = null; - } else { - // Slow case, write chunks one-by-one - while (entry) { - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, false, len, chunk, encoding, cb); - entry = entry.next; - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - break; - } - } - - if (entry === null) state.lastBufferedRequest = null; - } - - state.bufferedRequestCount = 0; - state.bufferedRequest = entry; - state.bufferProcessing = false; -} - -Writable.prototype._write = function (chunk, encoding, cb) { - cb(new Error('not implemented')); -}; - -Writable.prototype._writev = null; - -Writable.prototype.end = function (chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); - - // .end() fully uncorks - if (state.corked) { - state.corked = 1; - this.uncork(); - } - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) endWritable(this, state, cb); -}; - -function needFinish(state) { - return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; -} - -function prefinish(stream, state) { - if (!state.prefinished) { - state.prefinished = true; - stream.emit('prefinish'); - } -} - -function finishMaybe(stream, state) { - var need = needFinish(state); - if (need) { - if (state.pendingcb === 0) { - prefinish(stream, state); - state.finished = true; - stream.emit('finish'); - } else { - prefinish(stream, state); - } - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) processNextTick(cb);else stream.once('finish', cb); - } - state.ended = true; - stream.writable = false; -} - -// It seems a linked list but it is not -// there will be only 2 of these for each stream -function CorkedRequest(state) { - var _this = this; - - this.next = null; - this.entry = null; - - this.finish = function (err) { - var entry = _this.entry; - _this.entry = null; - while (entry) { - var cb = entry.callback; - state.pendingcb--; - cb(err); - entry = entry.next; - } - if (state.corkedRequestsFree) { - state.corkedRequestsFree.next = _this; - } else { - state.corkedRequestsFree = _this; - } - }; -} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE deleted file mode 100644 index d8d7f943..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright Node.js contributors. All rights reserved. - -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/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md deleted file mode 100644 index 5a76b414..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# core-util-is - -The `util.is*` functions introduced in Node v0.12. diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch deleted file mode 100644 index a06d5c05..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/float.patch +++ /dev/null @@ -1,604 +0,0 @@ -diff --git a/lib/util.js b/lib/util.js -index a03e874..9074e8e 100644 ---- a/lib/util.js -+++ b/lib/util.js -@@ -19,430 +19,6 @@ - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - --var formatRegExp = /%[sdj%]/g; --exports.format = function(f) { -- if (!isString(f)) { -- var objects = []; -- for (var i = 0; i < arguments.length; i++) { -- objects.push(inspect(arguments[i])); -- } -- return objects.join(' '); -- } -- -- var i = 1; -- var args = arguments; -- var len = args.length; -- var str = String(f).replace(formatRegExp, function(x) { -- if (x === '%%') return '%'; -- if (i >= len) return x; -- switch (x) { -- case '%s': return String(args[i++]); -- case '%d': return Number(args[i++]); -- case '%j': -- try { -- return JSON.stringify(args[i++]); -- } catch (_) { -- return '[Circular]'; -- } -- default: -- return x; -- } -- }); -- for (var x = args[i]; i < len; x = args[++i]) { -- if (isNull(x) || !isObject(x)) { -- str += ' ' + x; -- } else { -- str += ' ' + inspect(x); -- } -- } -- return str; --}; -- -- --// Mark that a method should not be used. --// Returns a modified function which warns once by default. --// If --no-deprecation is set, then it is a no-op. --exports.deprecate = function(fn, msg) { -- // Allow for deprecating things in the process of starting up. -- if (isUndefined(global.process)) { -- return function() { -- return exports.deprecate(fn, msg).apply(this, arguments); -- }; -- } -- -- if (process.noDeprecation === true) { -- return fn; -- } -- -- var warned = false; -- function deprecated() { -- if (!warned) { -- if (process.throwDeprecation) { -- throw new Error(msg); -- } else if (process.traceDeprecation) { -- console.trace(msg); -- } else { -- console.error(msg); -- } -- warned = true; -- } -- return fn.apply(this, arguments); -- } -- -- return deprecated; --}; -- -- --var debugs = {}; --var debugEnviron; --exports.debuglog = function(set) { -- if (isUndefined(debugEnviron)) -- debugEnviron = process.env.NODE_DEBUG || ''; -- set = set.toUpperCase(); -- if (!debugs[set]) { -- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { -- var pid = process.pid; -- debugs[set] = function() { -- var msg = exports.format.apply(exports, arguments); -- console.error('%s %d: %s', set, pid, msg); -- }; -- } else { -- debugs[set] = function() {}; -- } -- } -- return debugs[set]; --}; -- -- --/** -- * Echos the value of a value. Trys to print the value out -- * in the best way possible given the different types. -- * -- * @param {Object} obj The object to print out. -- * @param {Object} opts Optional options object that alters the output. -- */ --/* legacy: obj, showHidden, depth, colors*/ --function inspect(obj, opts) { -- // default options -- var ctx = { -- seen: [], -- stylize: stylizeNoColor -- }; -- // legacy... -- if (arguments.length >= 3) ctx.depth = arguments[2]; -- if (arguments.length >= 4) ctx.colors = arguments[3]; -- if (isBoolean(opts)) { -- // legacy... -- ctx.showHidden = opts; -- } else if (opts) { -- // got an "options" object -- exports._extend(ctx, opts); -- } -- // set default options -- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; -- if (isUndefined(ctx.depth)) ctx.depth = 2; -- if (isUndefined(ctx.colors)) ctx.colors = false; -- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; -- if (ctx.colors) ctx.stylize = stylizeWithColor; -- return formatValue(ctx, obj, ctx.depth); --} --exports.inspect = inspect; -- -- --// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics --inspect.colors = { -- 'bold' : [1, 22], -- 'italic' : [3, 23], -- 'underline' : [4, 24], -- 'inverse' : [7, 27], -- 'white' : [37, 39], -- 'grey' : [90, 39], -- 'black' : [30, 39], -- 'blue' : [34, 39], -- 'cyan' : [36, 39], -- 'green' : [32, 39], -- 'magenta' : [35, 39], -- 'red' : [31, 39], -- 'yellow' : [33, 39] --}; -- --// Don't use 'blue' not visible on cmd.exe --inspect.styles = { -- 'special': 'cyan', -- 'number': 'yellow', -- 'boolean': 'yellow', -- 'undefined': 'grey', -- 'null': 'bold', -- 'string': 'green', -- 'date': 'magenta', -- // "name": intentionally not styling -- 'regexp': 'red' --}; -- -- --function stylizeWithColor(str, styleType) { -- var style = inspect.styles[styleType]; -- -- if (style) { -- return '\u001b[' + inspect.colors[style][0] + 'm' + str + -- '\u001b[' + inspect.colors[style][1] + 'm'; -- } else { -- return str; -- } --} -- -- --function stylizeNoColor(str, styleType) { -- return str; --} -- -- --function arrayToHash(array) { -- var hash = {}; -- -- array.forEach(function(val, idx) { -- hash[val] = true; -- }); -- -- return hash; --} -- -- --function formatValue(ctx, value, recurseTimes) { -- // Provide a hook for user-specified inspect functions. -- // Check that value is an object with an inspect function on it -- if (ctx.customInspect && -- value && -- isFunction(value.inspect) && -- // Filter out the util module, it's inspect function is special -- value.inspect !== exports.inspect && -- // Also filter out any prototype objects using the circular check. -- !(value.constructor && value.constructor.prototype === value)) { -- var ret = value.inspect(recurseTimes, ctx); -- if (!isString(ret)) { -- ret = formatValue(ctx, ret, recurseTimes); -- } -- return ret; -- } -- -- // Primitive types cannot have properties -- var primitive = formatPrimitive(ctx, value); -- if (primitive) { -- return primitive; -- } -- -- // Look up the keys of the object. -- var keys = Object.keys(value); -- var visibleKeys = arrayToHash(keys); -- -- if (ctx.showHidden) { -- keys = Object.getOwnPropertyNames(value); -- } -- -- // Some type of object without properties can be shortcutted. -- if (keys.length === 0) { -- if (isFunction(value)) { -- var name = value.name ? ': ' + value.name : ''; -- return ctx.stylize('[Function' + name + ']', 'special'); -- } -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } -- if (isDate(value)) { -- return ctx.stylize(Date.prototype.toString.call(value), 'date'); -- } -- if (isError(value)) { -- return formatError(value); -- } -- } -- -- var base = '', array = false, braces = ['{', '}']; -- -- // Make Array say that they are Array -- if (isArray(value)) { -- array = true; -- braces = ['[', ']']; -- } -- -- // Make functions say that they are functions -- if (isFunction(value)) { -- var n = value.name ? ': ' + value.name : ''; -- base = ' [Function' + n + ']'; -- } -- -- // Make RegExps say that they are RegExps -- if (isRegExp(value)) { -- base = ' ' + RegExp.prototype.toString.call(value); -- } -- -- // Make dates with properties first say the date -- if (isDate(value)) { -- base = ' ' + Date.prototype.toUTCString.call(value); -- } -- -- // Make error with message first say the error -- if (isError(value)) { -- base = ' ' + formatError(value); -- } -- -- if (keys.length === 0 && (!array || value.length == 0)) { -- return braces[0] + base + braces[1]; -- } -- -- if (recurseTimes < 0) { -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } else { -- return ctx.stylize('[Object]', 'special'); -- } -- } -- -- ctx.seen.push(value); -- -- var output; -- if (array) { -- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); -- } else { -- output = keys.map(function(key) { -- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); -- }); -- } -- -- ctx.seen.pop(); -- -- return reduceToSingleString(output, base, braces); --} -- -- --function formatPrimitive(ctx, value) { -- if (isUndefined(value)) -- return ctx.stylize('undefined', 'undefined'); -- if (isString(value)) { -- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') -- .replace(/'/g, "\\'") -- .replace(/\\"/g, '"') + '\''; -- return ctx.stylize(simple, 'string'); -- } -- if (isNumber(value)) { -- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, -- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . -- if (value === 0 && 1 / value < 0) -- return ctx.stylize('-0', 'number'); -- return ctx.stylize('' + value, 'number'); -- } -- if (isBoolean(value)) -- return ctx.stylize('' + value, 'boolean'); -- // For some reason typeof null is "object", so special case here. -- if (isNull(value)) -- return ctx.stylize('null', 'null'); --} -- -- --function formatError(value) { -- return '[' + Error.prototype.toString.call(value) + ']'; --} -- -- --function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { -- var output = []; -- for (var i = 0, l = value.length; i < l; ++i) { -- if (hasOwnProperty(value, String(i))) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- String(i), true)); -- } else { -- output.push(''); -- } -- } -- keys.forEach(function(key) { -- if (!key.match(/^\d+$/)) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- key, true)); -- } -- }); -- return output; --} -- -- --function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { -- var name, str, desc; -- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; -- if (desc.get) { -- if (desc.set) { -- str = ctx.stylize('[Getter/Setter]', 'special'); -- } else { -- str = ctx.stylize('[Getter]', 'special'); -- } -- } else { -- if (desc.set) { -- str = ctx.stylize('[Setter]', 'special'); -- } -- } -- if (!hasOwnProperty(visibleKeys, key)) { -- name = '[' + key + ']'; -- } -- if (!str) { -- if (ctx.seen.indexOf(desc.value) < 0) { -- if (isNull(recurseTimes)) { -- str = formatValue(ctx, desc.value, null); -- } else { -- str = formatValue(ctx, desc.value, recurseTimes - 1); -- } -- if (str.indexOf('\n') > -1) { -- if (array) { -- str = str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n').substr(2); -- } else { -- str = '\n' + str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n'); -- } -- } -- } else { -- str = ctx.stylize('[Circular]', 'special'); -- } -- } -- if (isUndefined(name)) { -- if (array && key.match(/^\d+$/)) { -- return str; -- } -- name = JSON.stringify('' + key); -- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { -- name = name.substr(1, name.length - 2); -- name = ctx.stylize(name, 'name'); -- } else { -- name = name.replace(/'/g, "\\'") -- .replace(/\\"/g, '"') -- .replace(/(^"|"$)/g, "'"); -- name = ctx.stylize(name, 'string'); -- } -- } -- -- return name + ': ' + str; --} -- -- --function reduceToSingleString(output, base, braces) { -- var numLinesEst = 0; -- var length = output.reduce(function(prev, cur) { -- numLinesEst++; -- if (cur.indexOf('\n') >= 0) numLinesEst++; -- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; -- }, 0); -- -- if (length > 60) { -- return braces[0] + -- (base === '' ? '' : base + '\n ') + -- ' ' + -- output.join(',\n ') + -- ' ' + -- braces[1]; -- } -- -- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; --} -- -- - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { -@@ -522,166 +98,10 @@ function isPrimitive(arg) { - exports.isPrimitive = isPrimitive; - - function isBuffer(arg) { -- return arg instanceof Buffer; -+ return Buffer.isBuffer(arg); - } - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); --} -- -- --function pad(n) { -- return n < 10 ? '0' + n.toString(10) : n.toString(10); --} -- -- --var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', -- 'Oct', 'Nov', 'Dec']; -- --// 26 Feb 16:19:34 --function timestamp() { -- var d = new Date(); -- var time = [pad(d.getHours()), -- pad(d.getMinutes()), -- pad(d.getSeconds())].join(':'); -- return [d.getDate(), months[d.getMonth()], time].join(' '); --} -- -- --// log is just a thin wrapper to console.log that prepends a timestamp --exports.log = function() { -- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); --}; -- -- --/** -- * Inherit the prototype methods from one constructor into another. -- * -- * The Function.prototype.inherits from lang.js rewritten as a standalone -- * function (not on Function.prototype). NOTE: If this file is to be loaded -- * during bootstrapping this function needs to be rewritten using some native -- * functions as prototype setup using normal JavaScript does not work as -- * expected during bootstrapping (see mirror.js in r114903). -- * -- * @param {function} ctor Constructor function which needs to inherit the -- * prototype. -- * @param {function} superCtor Constructor function to inherit prototype from. -- */ --exports.inherits = function(ctor, superCtor) { -- ctor.super_ = superCtor; -- ctor.prototype = Object.create(superCtor.prototype, { -- constructor: { -- value: ctor, -- enumerable: false, -- writable: true, -- configurable: true -- } -- }); --}; -- --exports._extend = function(origin, add) { -- // Don't do anything if add isn't an object -- if (!add || !isObject(add)) return origin; -- -- var keys = Object.keys(add); -- var i = keys.length; -- while (i--) { -- origin[keys[i]] = add[keys[i]]; -- } -- return origin; --}; -- --function hasOwnProperty(obj, prop) { -- return Object.prototype.hasOwnProperty.call(obj, prop); --} -- -- --// Deprecated old stuff. -- --exports.p = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- console.error(exports.inspect(arguments[i])); -- } --}, 'util.p: Use console.error() instead'); -- -- --exports.exec = exports.deprecate(function() { -- return require('child_process').exec.apply(this, arguments); --}, 'util.exec is now called `child_process.exec`.'); -- -- --exports.print = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(String(arguments[i])); -- } --}, 'util.print: Use console.log instead'); -- -- --exports.puts = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(arguments[i] + '\n'); -- } --}, 'util.puts: Use console.log instead'); -- -- --exports.debug = exports.deprecate(function(x) { -- process.stderr.write('DEBUG: ' + x + '\n'); --}, 'util.debug: Use console.error instead'); -- -- --exports.error = exports.deprecate(function(x) { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stderr.write(arguments[i] + '\n'); -- } --}, 'util.error: Use console.error instead'); -- -- --exports.pump = exports.deprecate(function(readStream, writeStream, callback) { -- var callbackCalled = false; -- -- function call(a, b, c) { -- if (callback && !callbackCalled) { -- callback(a, b, c); -- callbackCalled = true; -- } -- } -- -- readStream.addListener('data', function(chunk) { -- if (writeStream.write(chunk) === false) readStream.pause(); -- }); -- -- writeStream.addListener('drain', function() { -- readStream.resume(); -- }); -- -- readStream.addListener('end', function() { -- writeStream.end(); -- }); -- -- readStream.addListener('close', function() { -- call(); -- }); -- -- readStream.addListener('error', function(err) { -- writeStream.end(); -- call(err); -- }); -- -- writeStream.addListener('error', function(err) { -- readStream.destroy(); -- call(err); -- }); --}, 'util.pump(): Use readableStream.pipe() instead'); -- -- --var uv; --exports._errnoException = function(err, syscall) { -- if (isUndefined(uv)) uv = process.binding('uv'); -- var errname = uv.errname(err); -- var e = new Error(syscall + ' ' + errname); -- e.code = errname; -- e.errno = errname; -- e.syscall = syscall; -- return e; --}; -+} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js deleted file mode 100644 index ff4c851c..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. - -function isArray(arg) { - if (Array.isArray) { - return Array.isArray(arg); - } - return objectToString(arg) === '[object Array]'; -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = Buffer.isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json deleted file mode 100644 index e14ae2d6..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "core-util-is", - "version": "1.0.2", - "description": "The `util.is*` functions introduced in Node v0.12.", - "main": "lib/util.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/core-util-is.git" - }, - "keywords": [ - "util", - "isBuffer", - "isArray", - "isNumber", - "isString", - "isRegExp", - "isThis", - "isThat", - "polyfill" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/isaacs/core-util-is/issues" - }, - "scripts": { - "test": "tap test.js" - }, - "devDependencies": { - "tap": "^2.3.0" - }, - "gitHead": "a177da234df5638b363ddc15fa324619a38577c8", - "homepage": "https://github.com/isaacs/core-util-is#readme", - "_id": "core-util-is@1.0.2", - "_shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", - "_from": "core-util-is@~1.0.0", - "_npmVersion": "3.3.2", - "_nodeVersion": "4.0.0", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "dist": { - "shasum": "b5fd54220aa2bc5ab57aab7140c940754503c1a7", - "tarball": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js deleted file mode 100644 index 1a490c65..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/core-util-is/test.js +++ /dev/null @@ -1,68 +0,0 @@ -var assert = require('tap'); - -var t = require('./lib/util'); - -assert.equal(t.isArray([]), true); -assert.equal(t.isArray({}), false); - -assert.equal(t.isBoolean(null), false); -assert.equal(t.isBoolean(true), true); -assert.equal(t.isBoolean(false), true); - -assert.equal(t.isNull(null), true); -assert.equal(t.isNull(undefined), false); -assert.equal(t.isNull(false), false); -assert.equal(t.isNull(), false); - -assert.equal(t.isNullOrUndefined(null), true); -assert.equal(t.isNullOrUndefined(undefined), true); -assert.equal(t.isNullOrUndefined(false), false); -assert.equal(t.isNullOrUndefined(), true); - -assert.equal(t.isNumber(null), false); -assert.equal(t.isNumber('1'), false); -assert.equal(t.isNumber(1), true); - -assert.equal(t.isString(null), false); -assert.equal(t.isString('1'), true); -assert.equal(t.isString(1), false); - -assert.equal(t.isSymbol(null), false); -assert.equal(t.isSymbol('1'), false); -assert.equal(t.isSymbol(1), false); -assert.equal(t.isSymbol(Symbol()), true); - -assert.equal(t.isUndefined(null), false); -assert.equal(t.isUndefined(undefined), true); -assert.equal(t.isUndefined(false), false); -assert.equal(t.isUndefined(), true); - -assert.equal(t.isRegExp(null), false); -assert.equal(t.isRegExp('1'), false); -assert.equal(t.isRegExp(new RegExp()), true); - -assert.equal(t.isObject({}), true); -assert.equal(t.isObject([]), true); -assert.equal(t.isObject(new RegExp()), true); -assert.equal(t.isObject(new Date()), true); - -assert.equal(t.isDate(null), false); -assert.equal(t.isDate('1'), false); -assert.equal(t.isDate(new Date()), true); - -assert.equal(t.isError(null), false); -assert.equal(t.isError({ err: true }), false); -assert.equal(t.isError(new Error()), true); - -assert.equal(t.isFunction(null), false); -assert.equal(t.isFunction({ }), false); -assert.equal(t.isFunction(function() {}), true); - -assert.equal(t.isPrimitive(null), true); -assert.equal(t.isPrimitive(''), true); -assert.equal(t.isPrimitive(0), true); -assert.equal(t.isPrimitive(new Date()), false); - -assert.equal(t.isBuffer(null), false); -assert.equal(t.isBuffer({}), false); -assert.equal(t.isBuffer(new Buffer(0)), true); diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/LICENSE b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013d..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -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. - diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/README.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/README.md deleted file mode 100644 index b1c56658..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits.js deleted file mode 100644 index 29f5e24f..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('util').inherits diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits_browser.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits_browser.js deleted file mode 100644 index c1e78a75..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,23 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json deleted file mode 100644 index 6c556ed3..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.1", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inherits" - }, - "license": "ISC", - "scripts": { - "test": "node test" - }, - "bugs": { - "url": "https://github.com/isaacs/inherits/issues" - }, - "_id": "inherits@2.0.1", - "dist": { - "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "_from": "inherits@~2.0.1", - "_npmVersion": "1.3.8", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/isaacs/inherits" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/test.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/test.js deleted file mode 100644 index fc53012d..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/inherits/test.js +++ /dev/null @@ -1,25 +0,0 @@ -var inherits = require('./inherits.js') -var assert = require('assert') - -function test(c) { - assert(c.constructor === Child) - assert(c.constructor.super_ === Parent) - assert(Object.getPrototypeOf(c) === Child.prototype) - assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) - assert(c instanceof Child) - assert(c instanceof Parent) -} - -function Child() { - Parent.call(this) - test(this) -} - -function Parent() {} - -inherits(Child, Parent) - -var c = new Child -test(c) - -console.log('ok') diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.npmignore b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.npmignore deleted file mode 100644 index 3c3629e6..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.travis.yml b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.travis.yml deleted file mode 100644 index cc4dba29..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/Makefile b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/Makefile deleted file mode 100644 index 787d56e1..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/Makefile +++ /dev/null @@ -1,6 +0,0 @@ - -test: - @node_modules/.bin/tape test.js - -.PHONY: test - diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md deleted file mode 100644 index 16d2c59c..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/README.md +++ /dev/null @@ -1,60 +0,0 @@ - -# isarray - -`Array#isArray` for older browsers. - -[![build status](https://secure.travis-ci.org/juliangruber/isarray.svg)](http://travis-ci.org/juliangruber/isarray) -[![downloads](https://img.shields.io/npm/dm/isarray.svg)](https://www.npmjs.org/package/isarray) - -[![browser support](https://ci.testling.com/juliangruber/isarray.png) -](https://ci.testling.com/juliangruber/isarray) - -## Usage - -```js -var isArray = require('isarray'); - -console.log(isArray([])); // => true -console.log(isArray({})); // => false -``` - -## Installation - -With [npm](http://npmjs.org) do - -```bash -$ npm install isarray -``` - -Then bundle for the browser with -[browserify](https://github.com/substack/browserify). - -With [component](http://component.io) do - -```bash -$ component install juliangruber/isarray -``` - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json deleted file mode 100644 index 9e31b683..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name" : "isarray", - "description" : "Array#isArray for older browsers", - "version" : "0.0.1", - "repository" : "juliangruber/isarray", - "homepage": "https://github.com/juliangruber/isarray", - "main" : "index.js", - "scripts" : [ - "index.js" - ], - "dependencies" : {}, - "keywords": ["browser","isarray","array"], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js deleted file mode 100644 index a57f6349..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/index.js +++ /dev/null @@ -1,5 +0,0 @@ -var toString = {}.toString; - -module.exports = Array.isArray || function (arr) { - return toString.call(arr) == '[object Array]'; -}; diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json deleted file mode 100644 index 06bb8bda..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "isarray", - "description": "Array#isArray for older browsers", - "version": "1.0.0", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/isarray.git" - }, - "homepage": "https://github.com/juliangruber/isarray", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "tape": "~2.13.4" - }, - "keywords": [ - "browser", - "isarray", - "array" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "testling": { - "files": "test.js", - "browsers": [ - "ie/8..latest", - "firefox/17..latest", - "firefox/nightly", - "chrome/22..latest", - "chrome/canary", - "opera/12..latest", - "opera/next", - "safari/5.1..latest", - "ipad/6.0..latest", - "iphone/6.0..latest", - "android-browser/4.2..latest" - ] - }, - "scripts": { - "test": "tape test.js" - }, - "gitHead": "2a23a281f369e9ae06394c0fb4d2381355a6ba33", - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - }, - "_id": "isarray@1.0.0", - "_shasum": "bb935d48582cba168c06834957a54a3e07124f11", - "_from": "isarray@~1.0.0", - "_npmVersion": "3.3.12", - "_nodeVersion": "5.1.0", - "_npmUser": { - "name": "juliangruber", - "email": "julian@juliangruber.com" - }, - "dist": { - "shasum": "bb935d48582cba168c06834957a54a3e07124f11", - "tarball": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" - }, - "maintainers": [ - { - "name": "juliangruber", - "email": "julian@juliangruber.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/test.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/test.js deleted file mode 100644 index e0c3444d..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/isarray/test.js +++ /dev/null @@ -1,20 +0,0 @@ -var isArray = require('./'); -var test = require('tape'); - -test('is array', function(t){ - t.ok(isArray([])); - t.notOk(isArray({})); - t.notOk(isArray(null)); - t.notOk(isArray(false)); - - var obj = {}; - obj[0] = true; - t.notOk(isArray(obj)); - - var arr = []; - arr.foo = 'bar'; - t.ok(isArray(arr)); - - t.end(); -}); - diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/.travis.yml b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/.travis.yml deleted file mode 100644 index 36201b10..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.11" - - "0.12" - - "1.7.1" - - 1 - - 2 - - 3 - - 4 - - 5 diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js deleted file mode 100644 index a4f40f84..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -if (!process.version || - process.version.indexOf('v0.') === 0 || - process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) { - module.exports = nextTick; -} else { - module.exports = process.nextTick; -} - -function nextTick(fn, arg1, arg2, arg3) { - if (typeof fn !== 'function') { - throw new TypeError('"callback" argument must be a function'); - } - var len = arguments.length; - var args, i; - switch (len) { - case 0: - case 1: - return process.nextTick(fn); - case 2: - return process.nextTick(function afterTickOne() { - fn.call(null, arg1); - }); - case 3: - return process.nextTick(function afterTickTwo() { - fn.call(null, arg1, arg2); - }); - case 4: - return process.nextTick(function afterTickThree() { - fn.call(null, arg1, arg2, arg3); - }); - default: - args = new Array(len - 1); - i = 0; - while (i < args.length) { - args[i++] = arguments[i]; - } - return process.nextTick(function afterTick() { - fn.apply(null, args); - }); - } -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/license.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/license.md deleted file mode 100644 index c67e3532..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/license.md +++ /dev/null @@ -1,19 +0,0 @@ -# Copyright (c) 2015 Calvin Metcalf - -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/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json deleted file mode 100644 index 86641ff9..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "process-nextick-args", - "version": "1.0.7", - "description": "process.nextTick but always with args", - "main": "index.js", - "scripts": { - "test": "node test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/calvinmetcalf/process-nextick-args.git" - }, - "author": "", - "license": "MIT", - "bugs": { - "url": "https://github.com/calvinmetcalf/process-nextick-args/issues" - }, - "homepage": "https://github.com/calvinmetcalf/process-nextick-args", - "devDependencies": { - "tap": "~0.2.6" - }, - "gitHead": "5c00899ab01dd32f93ad4b5743da33da91404f39", - "_id": "process-nextick-args@1.0.7", - "_shasum": "150e20b756590ad3f91093f25a4f2ad8bff30ba3", - "_from": "process-nextick-args@~1.0.6", - "_npmVersion": "3.8.6", - "_nodeVersion": "5.11.0", - "_npmUser": { - "name": "cwmma", - "email": "calvin.metcalf@gmail.com" - }, - "dist": { - "shasum": "150e20b756590ad3f91093f25a4f2ad8bff30ba3", - "tarball": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz" - }, - "maintainers": [ - { - "name": "cwmma", - "email": "calvin.metcalf@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/process-nextick-args-1.0.7.tgz_1462394251778_0.36989671061746776" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md deleted file mode 100644 index 78e7cfae..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/readme.md +++ /dev/null @@ -1,18 +0,0 @@ -process-nextick-args -===== - -[![Build Status](https://travis-ci.org/calvinmetcalf/process-nextick-args.svg?branch=master)](https://travis-ci.org/calvinmetcalf/process-nextick-args) - -```bash -npm install --save process-nextick-args -``` - -Always be able to pass arguments to process.nextTick, no matter the platform - -```js -var nextTick = require('process-nextick-args'); - -nextTick(function (a, b, c) { - console.log(a, b, c); -}, 'step', 3, 'profit'); -``` diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js deleted file mode 100644 index ef157215..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/process-nextick-args/test.js +++ /dev/null @@ -1,24 +0,0 @@ -var test = require("tap").test; -var nextTick = require('./'); - -test('should work', function (t) { - t.plan(5); - nextTick(function (a) { - t.ok(a); - nextTick(function (thing) { - t.equals(thing, 7); - }, 7); - }, true); - nextTick(function (a, b, c) { - t.equals(a, 'step'); - t.equals(b, 3); - t.equals(c, 'profit'); - }, 'step', 3, 'profit'); -}); - -test('correct number of arguments', function (t) { - t.plan(1); - nextTick(function () { - t.equals(2, arguments.length, 'correct number'); - }, 1, 2); -}); diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore deleted file mode 100644 index 206320cc..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -build -test diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE deleted file mode 100644 index 6de584a4..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. - -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/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md deleted file mode 100644 index 4d2aa001..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/README.md +++ /dev/null @@ -1,7 +0,0 @@ -**string_decoder.js** (`require('string_decoder')`) from Node.js core - -Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details. - -Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.** - -The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version. \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js deleted file mode 100644 index b00e54fb..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/index.js +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var Buffer = require('buffer').Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; - - -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} - -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json deleted file mode 100644 index a8c586bf..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/string_decoder/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "string_decoder", - "version": "0.10.31", - "description": "The string_decoder module from Node core", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "tap": "~0.4.8" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/rvagg/string_decoder.git" - }, - "homepage": "https://github.com/rvagg/string_decoder", - "keywords": [ - "string", - "decoder", - "browser", - "browserify" - ], - "license": "MIT", - "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0", - "bugs": { - "url": "https://github.com/rvagg/string_decoder/issues" - }, - "_id": "string_decoder@0.10.31", - "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "_from": "string_decoder@~0.10.x", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md deleted file mode 100644 index acc86753..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/History.md +++ /dev/null @@ -1,16 +0,0 @@ - -1.0.2 / 2015-10-07 -================== - - * use try/catch when checking `localStorage` (#3, @kumavis) - -1.0.1 / 2014-11-25 -================== - - * browser: use `console.warn()` for deprecation calls - * browser: more jsdocs - -1.0.0 / 2014-04-30 -================== - - * initial commit diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE deleted file mode 100644 index 6a60e8c2..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -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/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md deleted file mode 100644 index 75622fa7..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/README.md +++ /dev/null @@ -1,53 +0,0 @@ -util-deprecate -============== -### The Node.js `util.deprecate()` function with browser support - -In Node.js, this module simply re-exports the `util.deprecate()` function. - -In the web browser (i.e. via browserify), a browser-specific implementation -of the `util.deprecate()` function is used. - - -## API - -A `deprecate()` function is the only thing exposed by this module. - -``` javascript -// setup: -exports.foo = deprecate(foo, 'foo() is deprecated, use bar() instead'); - - -// users see: -foo(); -// foo() is deprecated, use bar() instead -foo(); -foo(); -``` - - -## License - -(The MIT License) - -Copyright (c) 2014 Nathan Rajlich - -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/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js deleted file mode 100644 index 549ae2f0..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/browser.js +++ /dev/null @@ -1,67 +0,0 @@ - -/** - * Module exports. - */ - -module.exports = deprecate; - -/** - * Mark that a method should not be used. - * Returns a modified function which warns once by default. - * - * If `localStorage.noDeprecation = true` is set, then it is a no-op. - * - * If `localStorage.throwDeprecation = true` is set, then deprecated functions - * will throw an Error when invoked. - * - * If `localStorage.traceDeprecation = true` is set, then deprecated functions - * will invoke `console.trace()` instead of `console.error()`. - * - * @param {Function} fn - the function to deprecate - * @param {String} msg - the string to print to the console when `fn` is invoked - * @returns {Function} a new "deprecated" version of `fn` - * @api public - */ - -function deprecate (fn, msg) { - if (config('noDeprecation')) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (config('throwDeprecation')) { - throw new Error(msg); - } else if (config('traceDeprecation')) { - console.trace(msg); - } else { - console.warn(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -} - -/** - * Checks `localStorage` for boolean values for the given `name`. - * - * @param {String} name - * @returns {Boolean} - * @api private - */ - -function config (name) { - // accessing global.localStorage can trigger a DOMException in sandboxed iframes - try { - if (!global.localStorage) return false; - } catch (_) { - return false; - } - var val = global.localStorage[name]; - if (null == val) return false; - return String(val).toLowerCase() === 'true'; -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js deleted file mode 100644 index 5e6fcff5..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/node.js +++ /dev/null @@ -1,6 +0,0 @@ - -/** - * For Node.js, simply re-export the core `util.deprecate` function. - */ - -module.exports = require('util').deprecate; diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json deleted file mode 100644 index ddfcae0e..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/node_modules/util-deprecate/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "util-deprecate", - "version": "1.0.2", - "description": "The Node.js `util.deprecate()` function with browser support", - "main": "node.js", - "browser": "browser.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "repository": { - "type": "git", - "url": "git://github.com/TooTallNate/util-deprecate.git" - }, - "keywords": [ - "util", - "deprecate", - "browserify", - "browser", - "node" - ], - "author": { - "name": "Nathan Rajlich", - "email": "nathan@tootallnate.net", - "url": "http://n8.io/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/TooTallNate/util-deprecate/issues" - }, - "homepage": "https://github.com/TooTallNate/util-deprecate", - "gitHead": "475fb6857cd23fafff20c1be846c1350abf8e6d4", - "_id": "util-deprecate@1.0.2", - "_shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", - "_from": "util-deprecate@~1.0.1", - "_npmVersion": "2.14.4", - "_nodeVersion": "4.1.2", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "dist": { - "shasum": "450d4dc9fa70de732762fbd2d4a28981419a0ccf", - "tarball": "http://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json deleted file mode 100644 index a918728a..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/package.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "name": "readable-stream", - "version": "2.0.6", - "description": "Streams3, a user-land copy of the stream library from Node.js", - "main": "readable.js", - "dependencies": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.1", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "string_decoder": "~0.10.x", - "util-deprecate": "~1.0.1" - }, - "devDependencies": { - "tap": "~0.2.6", - "tape": "~4.5.1", - "zuul": "~3.9.0" - }, - "scripts": { - "test": "tap test/parallel/*.js test/ours/*.js", - "browser": "npm run write-zuul && zuul -- test/browser.js", - "write-zuul": "printf \"ui: tape\nbrowsers:\n - name: $BROWSER_NAME\n version: $BROWSER_VERSION\n\">.zuul.yml" - }, - "repository": { - "type": "git", - "url": "git://github.com/nodejs/readable-stream.git" - }, - "keywords": [ - "readable", - "stream", - "pipe" - ], - "browser": { - "util": false - }, - "license": "MIT", - "gitHead": "01fb5608a970b42c900b96746cadc13d27dd9d7e", - "bugs": { - "url": "https://github.com/nodejs/readable-stream/issues" - }, - "homepage": "https://github.com/nodejs/readable-stream#readme", - "_id": "readable-stream@2.0.6", - "_shasum": "8f90341e68a53ccc928788dacfcd11b36eb9b78e", - "_from": "readable-stream@~2.0.5", - "_npmVersion": "3.6.0", - "_nodeVersion": "5.7.0", - "_npmUser": { - "name": "cwmma", - "email": "calvin.metcalf@gmail.com" - }, - "dist": { - "shasum": "8f90341e68a53ccc928788dacfcd11b36eb9b78e", - "tarball": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "isaacs@npmjs.com" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - }, - { - "name": "cwmma", - "email": "calvin.metcalf@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/readable-stream-2.0.6.tgz_1457893507709_0.369257491780445" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz" -} diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js deleted file mode 100644 index 27e8d8a5..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/passthrough.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_passthrough.js") diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js deleted file mode 100644 index 6222a579..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,12 +0,0 @@ -var Stream = (function (){ - try { - return require('st' + 'ream'); // hack to fix a circular dependency issue when used with browserify - } catch(_){} -}()); -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Stream = Stream || exports; -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js deleted file mode 100644 index 5d482f07..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/transform.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_transform.js") diff --git a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js b/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js deleted file mode 100644 index e1e9efdf..00000000 --- a/APIs/node_modules/request/node_modules/bl/node_modules/readable-stream/writable.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_writable.js") diff --git a/APIs/node_modules/request/node_modules/bl/package.json b/APIs/node_modules/request/node_modules/bl/package.json deleted file mode 100644 index 80c15fe4..00000000 --- a/APIs/node_modules/request/node_modules/bl/package.json +++ /dev/null @@ -1,63 +0,0 @@ -{ - "name": "bl", - "version": "1.1.2", - "description": "Buffer List: collect buffers and access with a standard readable Buffer interface, streamable too!", - "main": "bl.js", - "scripts": { - "test": "node test/test.js | faucet" - }, - "repository": { - "type": "git", - "url": "https://github.com/rvagg/bl.git" - }, - "homepage": "https://github.com/rvagg/bl", - "authors": [ - "Rod Vagg (https://github.com/rvagg)", - "Matteo Collina (https://github.com/mcollina)", - "Jarett Cruger (https://github.com/jcrugzz)" - ], - "keywords": [ - "buffer", - "buffers", - "stream", - "awesomesauce" - ], - "license": "MIT", - "dependencies": { - "readable-stream": "~2.0.5" - }, - "devDependencies": { - "faucet": "0.0.1", - "hash_file": "~0.1.1", - "tape": "~4.4.0" - }, - "gitHead": "ea42021059dc65fc60d7f4b9217c73431f09d23d", - "bugs": { - "url": "https://github.com/rvagg/bl/issues" - }, - "_id": "bl@1.1.2", - "_shasum": "fdca871a99713aa00d19e3bbba41c44787a65398", - "_from": "bl@~1.1.2", - "_npmVersion": "3.3.12", - "_nodeVersion": "5.3.0", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "fdca871a99713aa00d19e3bbba41c44787a65398", - "tarball": "https://registry.npmjs.org/bl/-/bl-1.1.2.tgz" - }, - "_npmOperationalInternal": { - "host": "packages-9-west.internal.npmjs.com", - "tmp": "tmp/bl-1.1.2.tgz_1455246621698_0.6300242957659066" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/bl/-/bl-1.1.2.tgz" -} diff --git a/APIs/node_modules/request/node_modules/bl/test/test.js b/APIs/node_modules/request/node_modules/bl/test/test.js deleted file mode 100644 index c95b1ba4..00000000 --- a/APIs/node_modules/request/node_modules/bl/test/test.js +++ /dev/null @@ -1,640 +0,0 @@ -var tape = require('tape') - , crypto = require('crypto') - , fs = require('fs') - , hash = require('hash_file') - , BufferList = require('../') - - , encodings = - ('hex utf8 utf-8 ascii binary base64' - + (process.browser ? '' : ' ucs2 ucs-2 utf16le utf-16le')).split(' ') - -tape('single bytes from single buffer', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abcd')) - - t.equal(bl.length, 4) - - t.equal(bl.get(0), 97) - t.equal(bl.get(1), 98) - t.equal(bl.get(2), 99) - t.equal(bl.get(3), 100) - - t.end() -}) - -tape('single bytes from multiple buffers', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.length, 10) - - t.equal(bl.get(0), 97) - t.equal(bl.get(1), 98) - t.equal(bl.get(2), 99) - t.equal(bl.get(3), 100) - t.equal(bl.get(4), 101) - t.equal(bl.get(5), 102) - t.equal(bl.get(6), 103) - t.equal(bl.get(7), 104) - t.equal(bl.get(8), 105) - t.equal(bl.get(9), 106) - t.end() -}) - -tape('multi bytes from single buffer', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abcd')) - - t.equal(bl.length, 4) - - t.equal(bl.slice(0, 4).toString('ascii'), 'abcd') - t.equal(bl.slice(0, 3).toString('ascii'), 'abc') - t.equal(bl.slice(1, 4).toString('ascii'), 'bcd') - - t.end() -}) - -tape('multiple bytes from multiple buffers', function (t) { - var bl = new BufferList() - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') - t.equal(bl.slice(3, 6).toString('ascii'), 'def') - t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') - t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') - - t.end() -}) - -tape('multiple bytes from multiple buffer lists', function (t) { - var bl = new BufferList() - - bl.append(new BufferList([ new Buffer('abcd'), new Buffer('efg') ])) - bl.append(new BufferList([ new Buffer('hi'), new Buffer('j') ])) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - - t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') - t.equal(bl.slice(3, 6).toString('ascii'), 'def') - t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') - t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') - - t.end() -}) - -// same data as previous test, just using nested constructors -tape('multiple bytes from crazy nested buffer lists', function (t) { - var bl = new BufferList() - - bl.append(new BufferList([ - new BufferList([ - new BufferList(new Buffer('abc')) - , new Buffer('d') - , new BufferList(new Buffer('efg')) - ]) - , new BufferList([ new Buffer('hi') ]) - , new BufferList(new Buffer('j')) - ])) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - - t.equal(bl.slice(3, 10).toString('ascii'), 'defghij') - t.equal(bl.slice(3, 6).toString('ascii'), 'def') - t.equal(bl.slice(3, 8).toString('ascii'), 'defgh') - t.equal(bl.slice(5, 10).toString('ascii'), 'fghij') - - t.end() -}) - -tape('append accepts arrays of Buffers', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abc')) - bl.append([ new Buffer('def') ]) - bl.append([ new Buffer('ghi'), new Buffer('jkl') ]) - bl.append([ new Buffer('mnop'), new Buffer('qrstu'), new Buffer('vwxyz') ]) - t.equal(bl.length, 26) - t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') - t.end() -}) - -tape('append accepts arrays of BufferLists', function (t) { - var bl = new BufferList() - bl.append(new Buffer('abc')) - bl.append([ new BufferList('def') ]) - bl.append(new BufferList([ new Buffer('ghi'), new BufferList('jkl') ])) - bl.append([ new Buffer('mnop'), new BufferList([ new Buffer('qrstu'), new Buffer('vwxyz') ]) ]) - t.equal(bl.length, 26) - t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') - t.end() -}) - -tape('append chainable', function (t) { - var bl = new BufferList() - t.ok(bl.append(new Buffer('abcd')) === bl) - t.ok(bl.append([ new Buffer('abcd') ]) === bl) - t.ok(bl.append(new BufferList(new Buffer('abcd'))) === bl) - t.ok(bl.append([ new BufferList(new Buffer('abcd')) ]) === bl) - t.end() -}) - -tape('append chainable (test results)', function (t) { - var bl = new BufferList('abc') - .append([ new BufferList('def') ]) - .append(new BufferList([ new Buffer('ghi'), new BufferList('jkl') ])) - .append([ new Buffer('mnop'), new BufferList([ new Buffer('qrstu'), new Buffer('vwxyz') ]) ]) - - t.equal(bl.length, 26) - t.equal(bl.slice().toString('ascii'), 'abcdefghijklmnopqrstuvwxyz') - t.end() -}) - -tape('consuming from multiple buffers', function (t) { - var bl = new BufferList() - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.length, 10) - - t.equal(bl.slice(0, 10).toString('ascii'), 'abcdefghij') - - bl.consume(3) - t.equal(bl.length, 7) - t.equal(bl.slice(0, 7).toString('ascii'), 'defghij') - - bl.consume(2) - t.equal(bl.length, 5) - t.equal(bl.slice(0, 5).toString('ascii'), 'fghij') - - bl.consume(1) - t.equal(bl.length, 4) - t.equal(bl.slice(0, 4).toString('ascii'), 'ghij') - - bl.consume(1) - t.equal(bl.length, 3) - t.equal(bl.slice(0, 3).toString('ascii'), 'hij') - - bl.consume(2) - t.equal(bl.length, 1) - t.equal(bl.slice(0, 1).toString('ascii'), 'j') - - t.end() -}) - -tape('complete consumption', function (t) { - var bl = new BufferList() - - bl.append(new Buffer('a')) - bl.append(new Buffer('b')) - - bl.consume(2) - - t.equal(bl.length, 0) - t.equal(bl._bufs.length, 0) - - t.end() -}) - -tape('test readUInt8 / readInt8', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt8(2), 0x3) - t.equal(bl.readInt8(2), 0x3) - t.equal(bl.readUInt8(3), 0x4) - t.equal(bl.readInt8(3), 0x4) - t.equal(bl.readUInt8(4), 0x23) - t.equal(bl.readInt8(4), 0x23) - t.equal(bl.readUInt8(5), 0x42) - t.equal(bl.readInt8(5), 0x42) - t.end() -}) - -tape('test readUInt16LE / readUInt16BE / readInt16LE / readInt16BE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt16BE(2), 0x0304) - t.equal(bl.readUInt16LE(2), 0x0403) - t.equal(bl.readInt16BE(2), 0x0304) - t.equal(bl.readInt16LE(2), 0x0403) - t.equal(bl.readUInt16BE(3), 0x0423) - t.equal(bl.readUInt16LE(3), 0x2304) - t.equal(bl.readInt16BE(3), 0x0423) - t.equal(bl.readInt16LE(3), 0x2304) - t.equal(bl.readUInt16BE(4), 0x2342) - t.equal(bl.readUInt16LE(4), 0x4223) - t.equal(bl.readInt16BE(4), 0x2342) - t.equal(bl.readInt16LE(4), 0x4223) - t.end() -}) - -tape('test readUInt32LE / readUInt32BE / readInt32LE / readInt32BE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x3 - buf2[2] = 0x4 - buf3[0] = 0x23 - buf3[1] = 0x42 - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readUInt32BE(2), 0x03042342) - t.equal(bl.readUInt32LE(2), 0x42230403) - t.equal(bl.readInt32BE(2), 0x03042342) - t.equal(bl.readInt32LE(2), 0x42230403) - t.end() -}) - -tape('test readFloatLE / readFloatBE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(3) - , bl = new BufferList() - - buf2[1] = 0x00 - buf2[2] = 0x00 - buf3[0] = 0x80 - buf3[1] = 0x3f - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readFloatLE(2), 0x01) - t.end() -}) - -tape('test readDoubleLE / readDoubleBE', function (t) { - var buf1 = new Buffer(1) - , buf2 = new Buffer(3) - , buf3 = new Buffer(10) - , bl = new BufferList() - - buf2[1] = 0x55 - buf2[2] = 0x55 - buf3[0] = 0x55 - buf3[1] = 0x55 - buf3[2] = 0x55 - buf3[3] = 0x55 - buf3[4] = 0xd5 - buf3[5] = 0x3f - - bl.append(buf1) - bl.append(buf2) - bl.append(buf3) - - t.equal(bl.readDoubleLE(2), 0.3333333333333333) - t.end() -}) - -tape('test toString', function (t) { - var bl = new BufferList() - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - - t.equal(bl.toString('ascii', 0, 10), 'abcdefghij') - t.equal(bl.toString('ascii', 3, 10), 'defghij') - t.equal(bl.toString('ascii', 3, 6), 'def') - t.equal(bl.toString('ascii', 3, 8), 'defgh') - t.equal(bl.toString('ascii', 5, 10), 'fghij') - - t.end() -}) - -tape('test toString encoding', function (t) { - var bl = new BufferList() - , b = new Buffer('abcdefghij\xff\x00') - - bl.append(new Buffer('abcd')) - bl.append(new Buffer('efg')) - bl.append(new Buffer('hi')) - bl.append(new Buffer('j')) - bl.append(new Buffer('\xff\x00')) - - encodings.forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc), enc) - }) - - t.end() -}) - -!process.browser && tape('test stream', function (t) { - var random = crypto.randomBytes(65534) - , rndhash = hash(random, 'md5') - , md5sum = crypto.createHash('md5') - , bl = new BufferList(function (err, buf) { - t.ok(Buffer.isBuffer(buf)) - t.ok(err === null) - t.equal(rndhash, hash(bl.slice(), 'md5')) - t.equal(rndhash, hash(buf, 'md5')) - - bl.pipe(fs.createWriteStream('/tmp/bl_test_rnd_out.dat')) - .on('close', function () { - var s = fs.createReadStream('/tmp/bl_test_rnd_out.dat') - s.on('data', md5sum.update.bind(md5sum)) - s.on('end', function() { - t.equal(rndhash, md5sum.digest('hex'), 'woohoo! correct hash!') - t.end() - }) - }) - - }) - - fs.writeFileSync('/tmp/bl_test_rnd.dat', random) - fs.createReadStream('/tmp/bl_test_rnd.dat').pipe(bl) -}) - -tape('instantiation with Buffer', function (t) { - var buf = crypto.randomBytes(1024) - , buf2 = crypto.randomBytes(1024) - , b = BufferList(buf) - - t.equal(buf.toString('hex'), b.slice().toString('hex'), 'same buffer') - b = BufferList([ buf, buf2 ]) - t.equal(b.slice().toString('hex'), Buffer.concat([ buf, buf2 ]).toString('hex'), 'same buffer') - t.end() -}) - -tape('test String appendage', function (t) { - var bl = new BufferList() - , b = new Buffer('abcdefghij\xff\x00') - - bl.append('abcd') - bl.append('efg') - bl.append('hi') - bl.append('j') - bl.append('\xff\x00') - - encodings.forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc)) - }) - - t.end() -}) - -tape('test Number appendage', function (t) { - var bl = new BufferList() - , b = new Buffer('1234567890') - - bl.append(1234) - bl.append(567) - bl.append(89) - bl.append(0) - - encodings.forEach(function (enc) { - t.equal(bl.toString(enc), b.toString(enc)) - }) - - t.end() -}) - -tape('write nothing, should get empty buffer', function (t) { - t.plan(3) - BufferList(function (err, data) { - t.notOk(err, 'no error') - t.ok(Buffer.isBuffer(data), 'got a buffer') - t.equal(0, data.length, 'got a zero-length buffer') - t.end() - }).end() -}) - -tape('unicode string', function (t) { - t.plan(2) - var inp1 = '\u2600' - , inp2 = '\u2603' - , exp = inp1 + ' and ' + inp2 - , bl = BufferList() - bl.write(inp1) - bl.write(' and ') - bl.write(inp2) - t.equal(exp, bl.toString()) - t.equal(new Buffer(exp).toString('hex'), bl.toString('hex')) -}) - -tape('should emit finish', function (t) { - var source = BufferList() - , dest = BufferList() - - source.write('hello') - source.pipe(dest) - - dest.on('finish', function () { - t.equal(dest.toString('utf8'), 'hello') - t.end() - }) -}) - -tape('basic copy', function (t) { - var buf = crypto.randomBytes(1024) - , buf2 = new Buffer(1024) - , b = BufferList(buf) - - b.copy(buf2) - t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer') - t.end() -}) - -tape('copy after many appends', function (t) { - var buf = crypto.randomBytes(512) - , buf2 = new Buffer(1024) - , b = BufferList(buf) - - b.append(buf) - b.copy(buf2) - t.equal(b.slice().toString('hex'), buf2.toString('hex'), 'same buffer') - t.end() -}) - -tape('copy at a precise position', function (t) { - var buf = crypto.randomBytes(1004) - , buf2 = new Buffer(1024) - , b = BufferList(buf) - - b.copy(buf2, 20) - t.equal(b.slice().toString('hex'), buf2.slice(20).toString('hex'), 'same buffer') - t.end() -}) - -tape('copy starting from a precise location', function (t) { - var buf = crypto.randomBytes(10) - , buf2 = new Buffer(5) - , b = BufferList(buf) - - b.copy(buf2, 0, 5) - t.equal(b.slice(5).toString('hex'), buf2.toString('hex'), 'same buffer') - t.end() -}) - -tape('copy in an interval', function (t) { - var rnd = crypto.randomBytes(10) - , b = BufferList(rnd) // put the random bytes there - , actual = new Buffer(3) - , expected = new Buffer(3) - - rnd.copy(expected, 0, 5, 8) - b.copy(actual, 0, 5, 8) - - t.equal(actual.toString('hex'), expected.toString('hex'), 'same buffer') - t.end() -}) - -tape('copy an interval between two buffers', function (t) { - var buf = crypto.randomBytes(10) - , buf2 = new Buffer(10) - , b = BufferList(buf) - - b.append(buf) - b.copy(buf2, 0, 5, 15) - - t.equal(b.slice(5, 15).toString('hex'), buf2.toString('hex'), 'same buffer') - t.end() -}) - -tape('duplicate', function (t) { - t.plan(2) - - var bl = new BufferList('abcdefghij\xff\x00') - , dup = bl.duplicate() - - t.equal(bl.prototype, dup.prototype) - t.equal(bl.toString('hex'), dup.toString('hex')) -}) - -tape('destroy no pipe', function (t) { - t.plan(2) - - var bl = new BufferList('alsdkfja;lsdkfja;lsdk') - bl.destroy() - - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) -}) - -!process.browser && tape('destroy with pipe before read end', function (t) { - t.plan(2) - - var bl = new BufferList() - fs.createReadStream(__dirname + '/test.js') - .pipe(bl) - - bl.destroy() - - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) - -}) - -!process.browser && tape('destroy with pipe before read end with race', function (t) { - t.plan(2) - - var bl = new BufferList() - fs.createReadStream(__dirname + '/test.js') - .pipe(bl) - - setTimeout(function () { - bl.destroy() - setTimeout(function () { - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) - }, 500) - }, 500) -}) - -!process.browser && tape('destroy with pipe after read end', function (t) { - t.plan(2) - - var bl = new BufferList() - fs.createReadStream(__dirname + '/test.js') - .on('end', onEnd) - .pipe(bl) - - function onEnd () { - bl.destroy() - - t.equal(bl._bufs.length, 0) - t.equal(bl.length, 0) - } -}) - -!process.browser && tape('destroy with pipe while writing to a destination', function (t) { - t.plan(4) - - var bl = new BufferList() - , ds = new BufferList() - - fs.createReadStream(__dirname + '/test.js') - .on('end', onEnd) - .pipe(bl) - - function onEnd () { - bl.pipe(ds) - - setTimeout(function () { - bl.destroy() - - t.equals(bl._bufs.length, 0) - t.equals(bl.length, 0) - - ds.destroy() - - t.equals(bl._bufs.length, 0) - t.equals(bl.length, 0) - - }, 100) - } -}) - -!process.browser && tape('handle error', function (t) { - t.plan(2) - fs.createReadStream('/does/not/exist').pipe(BufferList(function (err, data) { - t.ok(err instanceof Error, 'has error') - t.notOk(data, 'no data') - })) -}) diff --git a/APIs/node_modules/request/node_modules/caseless/LICENSE b/APIs/node_modules/request/node_modules/caseless/LICENSE deleted file mode 100644 index 61789f4a..00000000 --- a/APIs/node_modules/request/node_modules/caseless/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Apache License -Version 2.0, January 2004 -http://www.apache.org/licenses/ -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION -1. Definitions. -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: -You must give any other recipients of the Work or Derivative Works a copy of this License; and -You must cause any modified files to carry prominent notices stating that You changed the files; and -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/caseless/README.md b/APIs/node_modules/request/node_modules/caseless/README.md deleted file mode 100644 index e5077a21..00000000 --- a/APIs/node_modules/request/node_modules/caseless/README.md +++ /dev/null @@ -1,45 +0,0 @@ -## Caseless -- wrap an object to set and get property with caseless semantics but also preserve caseing. - -This library is incredibly useful when working with HTTP headers. It allows you to get/set/check for headers in a caseless manner while also preserving the caseing of headers the first time they are set. - -## Usage - -```javascript -var headers = {} - , c = caseless(headers) - ; -c.set('a-Header', 'asdf') -c.get('a-header') === 'asdf' -``` - -## has(key) - -Has takes a name and if it finds a matching header will return that header name with the preserved caseing it was set with. - -```javascript -c.has('a-header') === 'a-Header' -``` - -## set(key, value[, clobber=true]) - -Set is fairly straight forward except that if the header exists and clobber is disabled it will add `','+value` to the existing header. - -```javascript -c.set('a-Header', 'fdas') -c.set('a-HEADER', 'more', false) -c.get('a-header') === 'fdsa,more' -``` - -## swap(key) - -Swaps the casing of a header with the new one that is passed in. - -```javascript -var headers = {} - , c = caseless(headers) - ; -c.set('a-Header', 'fdas') -c.swap('a-HEADER') -c.has('a-header') === 'a-HEADER' -headers === {'a-HEADER': 'fdas'} -``` diff --git a/APIs/node_modules/request/node_modules/caseless/index.js b/APIs/node_modules/request/node_modules/caseless/index.js deleted file mode 100644 index d86a70ec..00000000 --- a/APIs/node_modules/request/node_modules/caseless/index.js +++ /dev/null @@ -1,66 +0,0 @@ -function Caseless (dict) { - this.dict = dict || {} -} -Caseless.prototype.set = function (name, value, clobber) { - if (typeof name === 'object') { - for (var i in name) { - this.set(i, name[i], value) - } - } else { - if (typeof clobber === 'undefined') clobber = true - var has = this.has(name) - - if (!clobber && has) this.dict[has] = this.dict[has] + ',' + value - else this.dict[has || name] = value - return has - } -} -Caseless.prototype.has = function (name) { - var keys = Object.keys(this.dict) - , name = name.toLowerCase() - ; - for (var i=0;i - -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/APIs/node_modules/request/node_modules/combined-stream/Readme.md b/APIs/node_modules/request/node_modules/combined-stream/Readme.md deleted file mode 100644 index 3a9e025f..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/Readme.md +++ /dev/null @@ -1,138 +0,0 @@ -# combined-stream - -A stream that emits multiple other streams one after another. - -**NB** Currently `combined-stream` works with streams vesrion 1 only. There is ongoing effort to switch this library to streams version 2. Any help is welcome. :) Meanwhile you can explore other libraries that provide streams2 support with more or less compatability with `combined-stream`. - -- [combined-stream2](https://www.npmjs.com/package/combined-stream2): A drop-in streams2-compatible replacement for the combined-stream module. - -- [multistream](https://www.npmjs.com/package/multistream): A stream that emits multiple other streams one after another. - -## Installation - -``` bash -npm install combined-stream -``` - -## Usage - -Here is a simple example that shows how you can use combined-stream to combine -two files into one: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create(); -combinedStream.append(fs.createReadStream('file1.txt')); -combinedStream.append(fs.createReadStream('file2.txt')); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -While the example above works great, it will pause all source streams until -they are needed. If you don't want that to happen, you can set `pauseStreams` -to `false`: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create({pauseStreams: false}); -combinedStream.append(fs.createReadStream('file1.txt')); -combinedStream.append(fs.createReadStream('file2.txt')); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -However, what if you don't have all the source streams yet, or you don't want -to allocate the resources (file descriptors, memory, etc.) for them right away? -Well, in that case you can simply provide a callback that supplies the stream -by calling a `next()` function: - -``` javascript -var CombinedStream = require('combined-stream'); -var fs = require('fs'); - -var combinedStream = CombinedStream.create(); -combinedStream.append(function(next) { - next(fs.createReadStream('file1.txt')); -}); -combinedStream.append(function(next) { - next(fs.createReadStream('file2.txt')); -}); - -combinedStream.pipe(fs.createWriteStream('combined.txt')); -``` - -## API - -### CombinedStream.create([options]) - -Returns a new combined stream object. Available options are: - -* `maxDataSize` -* `pauseStreams` - -The effect of those options is described below. - -### combinedStream.pauseStreams = `true` - -Whether to apply back pressure to the underlaying streams. If set to `false`, -the underlaying streams will never be paused. If set to `true`, the -underlaying streams will be paused right after being appended, as well as when -`delayedStream.pipe()` wants to throttle. - -### combinedStream.maxDataSize = `2 * 1024 * 1024` - -The maximum amount of bytes (or characters) to buffer for all source streams. -If this value is exceeded, `combinedStream` emits an `'error'` event. - -### combinedStream.dataSize = `0` - -The amount of bytes (or characters) currently buffered by `combinedStream`. - -### combinedStream.append(stream) - -Appends the given `stream` to the combinedStream object. If `pauseStreams` is -set to `true, this stream will also be paused right away. - -`streams` can also be a function that takes one parameter called `next`. `next` -is a function that must be invoked in order to provide the `next` stream, see -example above. - -Regardless of how the `stream` is appended, combined-stream always attaches an -`'error'` listener to it, so you don't have to do that manually. - -Special case: `stream` can also be a String or Buffer. - -### combinedStream.write(data) - -You should not call this, `combinedStream` takes care of piping the appended -streams into itself for you. - -### combinedStream.resume() - -Causes `combinedStream` to start drain the streams it manages. The function is -idempotent, and also emits a `'resume'` event each time which usually goes to -the stream that is currently being drained. - -### combinedStream.pause(); - -If `combinedStream.pauseStreams` is set to `false`, this does nothing. -Otherwise a `'pause'` event is emitted, this goes to the stream that is -currently being drained, so you can use it to apply back pressure. - -### combinedStream.end(); - -Sets `combinedStream.writable` to false, emits an `'end'` event, and removes -all streams from the queue. - -### combinedStream.destroy(); - -Same as `combinedStream.end()`, except it emits a `'close'` event instead of -`'end'`. - -## License - -combined-stream is licensed under the MIT license. diff --git a/APIs/node_modules/request/node_modules/combined-stream/lib/combined_stream.js b/APIs/node_modules/request/node_modules/combined-stream/lib/combined_stream.js deleted file mode 100644 index 6b5c21b6..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/lib/combined_stream.js +++ /dev/null @@ -1,188 +0,0 @@ -var util = require('util'); -var Stream = require('stream').Stream; -var DelayedStream = require('delayed-stream'); - -module.exports = CombinedStream; -function CombinedStream() { - this.writable = false; - this.readable = true; - this.dataSize = 0; - this.maxDataSize = 2 * 1024 * 1024; - this.pauseStreams = true; - - this._released = false; - this._streams = []; - this._currentStream = null; -} -util.inherits(CombinedStream, Stream); - -CombinedStream.create = function(options) { - var combinedStream = new this(); - - options = options || {}; - for (var option in options) { - combinedStream[option] = options[option]; - } - - return combinedStream; -}; - -CombinedStream.isStreamLike = function(stream) { - return (typeof stream !== 'function') - && (typeof stream !== 'string') - && (typeof stream !== 'boolean') - && (typeof stream !== 'number') - && (!Buffer.isBuffer(stream)); -}; - -CombinedStream.prototype.append = function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); - - if (isStreamLike) { - if (!(stream instanceof DelayedStream)) { - var newStream = DelayedStream.create(stream, { - maxDataSize: Infinity, - pauseStream: this.pauseStreams, - }); - stream.on('data', this._checkDataSize.bind(this)); - stream = newStream; - } - - this._handleErrors(stream); - - if (this.pauseStreams) { - stream.pause(); - } - } - - this._streams.push(stream); - return this; -}; - -CombinedStream.prototype.pipe = function(dest, options) { - Stream.prototype.pipe.call(this, dest, options); - this.resume(); - return dest; -}; - -CombinedStream.prototype._getNext = function() { - this._currentStream = null; - var stream = this._streams.shift(); - - - if (typeof stream == 'undefined') { - this.end(); - return; - } - - if (typeof stream !== 'function') { - this._pipeNext(stream); - return; - } - - var getStream = stream; - getStream(function(stream) { - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('data', this._checkDataSize.bind(this)); - this._handleErrors(stream); - } - - this._pipeNext(stream); - }.bind(this)); -}; - -CombinedStream.prototype._pipeNext = function(stream) { - this._currentStream = stream; - - var isStreamLike = CombinedStream.isStreamLike(stream); - if (isStreamLike) { - stream.on('end', this._getNext.bind(this)); - stream.pipe(this, {end: false}); - return; - } - - var value = stream; - this.write(value); - this._getNext(); -}; - -CombinedStream.prototype._handleErrors = function(stream) { - var self = this; - stream.on('error', function(err) { - self._emitError(err); - }); -}; - -CombinedStream.prototype.write = function(data) { - this.emit('data', data); -}; - -CombinedStream.prototype.pause = function() { - if (!this.pauseStreams) { - return; - } - - if(this.pauseStreams && this._currentStream && typeof(this._currentStream.pause) == 'function') this._currentStream.pause(); - this.emit('pause'); -}; - -CombinedStream.prototype.resume = function() { - if (!this._released) { - this._released = true; - this.writable = true; - this._getNext(); - } - - if(this.pauseStreams && this._currentStream && typeof(this._currentStream.resume) == 'function') this._currentStream.resume(); - this.emit('resume'); -}; - -CombinedStream.prototype.end = function() { - this._reset(); - this.emit('end'); -}; - -CombinedStream.prototype.destroy = function() { - this._reset(); - this.emit('close'); -}; - -CombinedStream.prototype._reset = function() { - this.writable = false; - this._streams = []; - this._currentStream = null; -}; - -CombinedStream.prototype._checkDataSize = function() { - this._updateDataSize(); - if (this.dataSize <= this.maxDataSize) { - return; - } - - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.'; - this._emitError(new Error(message)); -}; - -CombinedStream.prototype._updateDataSize = function() { - this.dataSize = 0; - - var self = this; - this._streams.forEach(function(stream) { - if (!stream.dataSize) { - return; - } - - self.dataSize += stream.dataSize; - }); - - if (this._currentStream && this._currentStream.dataSize) { - this.dataSize += this._currentStream.dataSize; - } -}; - -CombinedStream.prototype._emitError = function(err) { - this._reset(); - this.emit('error', err); -}; diff --git a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/.npmignore b/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/.npmignore deleted file mode 100644 index 9daeafb9..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test diff --git a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/License b/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/License deleted file mode 100644 index 4804b7ab..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2011 Debuggable Limited - -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/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Makefile b/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Makefile deleted file mode 100644 index b4ff85a3..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Makefile +++ /dev/null @@ -1,7 +0,0 @@ -SHELL := /bin/bash - -test: - @./test/run.js - -.PHONY: test - diff --git a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Readme.md b/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Readme.md deleted file mode 100644 index aca36f9f..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/Readme.md +++ /dev/null @@ -1,141 +0,0 @@ -# delayed-stream - -Buffers events from a stream until you are ready to handle them. - -## Installation - -``` bash -npm install delayed-stream -``` - -## Usage - -The following example shows how to write a http echo server that delays its -response by 1000 ms. - -``` javascript -var DelayedStream = require('delayed-stream'); -var http = require('http'); - -http.createServer(function(req, res) { - var delayed = DelayedStream.create(req); - - setTimeout(function() { - res.writeHead(200); - delayed.pipe(res); - }, 1000); -}); -``` - -If you are not using `Stream#pipe`, you can also manually release the buffered -events by calling `delayedStream.resume()`: - -``` javascript -var delayed = DelayedStream.create(req); - -setTimeout(function() { - // Emit all buffered events and resume underlaying source - delayed.resume(); -}, 1000); -``` - -## Implementation - -In order to use this meta stream properly, here are a few things you should -know about the implementation. - -### Event Buffering / Proxying - -All events of the `source` stream are hijacked by overwriting the `source.emit` -method. Until node implements a catch-all event listener, this is the only way. - -However, delayed-stream still continues to emit all events it captures on the -`source`, regardless of whether you have released the delayed stream yet or -not. - -Upon creation, delayed-stream captures all `source` events and stores them in -an internal event buffer. Once `delayedStream.release()` is called, all -buffered events are emitted on the `delayedStream`, and the event buffer is -cleared. After that, delayed-stream merely acts as a proxy for the underlaying -source. - -### Error handling - -Error events on `source` are buffered / proxied just like any other events. -However, `delayedStream.create` attaches a no-op `'error'` listener to the -`source`. This way you only have to handle errors on the `delayedStream` -object, rather than in two places. - -### Buffer limits - -delayed-stream provides a `maxDataSize` property that can be used to limit -the amount of data being buffered. In order to protect you from bad `source` -streams that don't react to `source.pause()`, this feature is enabled by -default. - -## API - -### DelayedStream.create(source, [options]) - -Returns a new `delayedStream`. Available options are: - -* `pauseStream` -* `maxDataSize` - -The description for those properties can be found below. - -### delayedStream.source - -The `source` stream managed by this object. This is useful if you are -passing your `delayedStream` around, and you still want to access properties -on the `source` object. - -### delayedStream.pauseStream = true - -Whether to pause the underlaying `source` when calling -`DelayedStream.create()`. Modifying this property afterwards has no effect. - -### delayedStream.maxDataSize = 1024 * 1024 - -The amount of data to buffer before emitting an `error`. - -If the underlaying source is emitting `Buffer` objects, the `maxDataSize` -refers to bytes. - -If the underlaying source is emitting JavaScript strings, the size refers to -characters. - -If you know what you are doing, you can set this property to `Infinity` to -disable this feature. You can also modify this property during runtime. - -### delayedStream.dataSize = 0 - -The amount of data buffered so far. - -### delayedStream.readable - -An ECMA5 getter that returns the value of `source.readable`. - -### delayedStream.resume() - -If the `delayedStream` has not been released so far, `delayedStream.release()` -is called. - -In either case, `source.resume()` is called. - -### delayedStream.pause() - -Calls `source.pause()`. - -### delayedStream.pipe(dest) - -Calls `delayedStream.resume()` and then proxies the arguments to `source.pipe`. - -### delayedStream.release() - -Emits and clears all events that have been buffered up so far. This does not -resume the underlaying source, use `delayedStream.resume()` instead. - -## License - -delayed-stream is licensed under the MIT license. diff --git a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js b/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js deleted file mode 100644 index b38fc85f..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/lib/delayed_stream.js +++ /dev/null @@ -1,107 +0,0 @@ -var Stream = require('stream').Stream; -var util = require('util'); - -module.exports = DelayedStream; -function DelayedStream() { - this.source = null; - this.dataSize = 0; - this.maxDataSize = 1024 * 1024; - this.pauseStream = true; - - this._maxDataSizeExceeded = false; - this._released = false; - this._bufferedEvents = []; -} -util.inherits(DelayedStream, Stream); - -DelayedStream.create = function(source, options) { - var delayedStream = new this(); - - options = options || {}; - for (var option in options) { - delayedStream[option] = options[option]; - } - - delayedStream.source = source; - - var realEmit = source.emit; - source.emit = function() { - delayedStream._handleEmit(arguments); - return realEmit.apply(source, arguments); - }; - - source.on('error', function() {}); - if (delayedStream.pauseStream) { - source.pause(); - } - - return delayedStream; -}; - -Object.defineProperty(DelayedStream.prototype, 'readable', { - configurable: true, - enumerable: true, - get: function() { - return this.source.readable; - } -}); - -DelayedStream.prototype.setEncoding = function() { - return this.source.setEncoding.apply(this.source, arguments); -}; - -DelayedStream.prototype.resume = function() { - if (!this._released) { - this.release(); - } - - this.source.resume(); -}; - -DelayedStream.prototype.pause = function() { - this.source.pause(); -}; - -DelayedStream.prototype.release = function() { - this._released = true; - - this._bufferedEvents.forEach(function(args) { - this.emit.apply(this, args); - }.bind(this)); - this._bufferedEvents = []; -}; - -DelayedStream.prototype.pipe = function() { - var r = Stream.prototype.pipe.apply(this, arguments); - this.resume(); - return r; -}; - -DelayedStream.prototype._handleEmit = function(args) { - if (this._released) { - this.emit.apply(this, args); - return; - } - - if (args[0] === 'data') { - this.dataSize += args[1].length; - this._checkIfMaxDataSizeExceeded(); - } - - this._bufferedEvents.push(args); -}; - -DelayedStream.prototype._checkIfMaxDataSizeExceeded = function() { - if (this._maxDataSizeExceeded) { - return; - } - - if (this.dataSize <= this.maxDataSize) { - return; - } - - this._maxDataSizeExceeded = true; - var message = - 'DelayedStream#maxDataSize of ' + this.maxDataSize + ' bytes exceeded.' - this.emit('error', new Error(message)); -}; diff --git a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/package.json b/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/package.json deleted file mode 100644 index a549dd07..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/node_modules/delayed-stream/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "contributors": [ - { - "name": "Mike Atkins", - "email": "apeherder@gmail.com" - } - ], - "name": "delayed-stream", - "description": "Buffers events from a stream until you are ready to handle them.", - "license": "MIT", - "version": "1.0.0", - "homepage": "https://github.com/felixge/node-delayed-stream", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-delayed-stream.git" - }, - "main": "./lib/delayed_stream", - "engines": { - "node": ">=0.4.0" - }, - "scripts": { - "test": "make test" - }, - "dependencies": {}, - "devDependencies": { - "fake": "0.2.0", - "far": "0.0.1" - }, - "gitHead": "07a9dc99fb8f1a488160026b9ad77493f766fb84", - "bugs": { - "url": "https://github.com/felixge/node-delayed-stream/issues" - }, - "_id": "delayed-stream@1.0.0", - "_shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", - "_from": "delayed-stream@~1.0.0", - "_npmVersion": "2.8.3", - "_nodeVersion": "1.6.4", - "_npmUser": { - "name": "apechimp", - "email": "apeherder@gmail.com" - }, - "dist": { - "shasum": "df3ae199acadfb7d440aaae0b29e2272b24ec619", - "tarball": "http://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz" - }, - "maintainers": [ - { - "name": "felixge", - "email": "felix@debuggable.com" - }, - { - "name": "apechimp", - "email": "apeherder@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/combined-stream/package.json b/APIs/node_modules/request/node_modules/combined-stream/package.json deleted file mode 100644 index 3b66f70f..00000000 --- a/APIs/node_modules/request/node_modules/combined-stream/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "author": { - "name": "Felix Geisendörfer", - "email": "felix@debuggable.com", - "url": "http://debuggable.com/" - }, - "name": "combined-stream", - "description": "A stream that emits multiple other streams one after another.", - "version": "1.0.5", - "homepage": "https://github.com/felixge/node-combined-stream", - "repository": { - "type": "git", - "url": "git://github.com/felixge/node-combined-stream.git" - }, - "main": "./lib/combined_stream", - "scripts": { - "test": "node test/run.js" - }, - "engines": { - "node": ">= 0.8" - }, - "dependencies": { - "delayed-stream": "~1.0.0" - }, - "devDependencies": { - "far": "~0.0.7" - }, - "license": "MIT", - "gitHead": "cfc7b815d090a109bcedb5bb0f6713148d55a6b7", - "bugs": { - "url": "https://github.com/felixge/node-combined-stream/issues" - }, - "_id": "combined-stream@1.0.5", - "_shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009", - "_from": "combined-stream@~1.0.5", - "_npmVersion": "2.10.1", - "_nodeVersion": "0.12.4", - "_npmUser": { - "name": "alexindigo", - "email": "iam@alexindigo.com" - }, - "dist": { - "shasum": "938370a57b4a51dea2c77c15d5c5fdf895164009", - "tarball": "http://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz" - }, - "maintainers": [ - { - "name": "felixge", - "email": "felix@debuggable.com" - }, - { - "name": "celer", - "email": "dtyree77@gmail.com" - }, - { - "name": "alexindigo", - "email": "iam@alexindigo.com" - }, - { - "name": "apechimp", - "email": "apeherder@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/extend/.eslintrc b/APIs/node_modules/request/node_modules/extend/.eslintrc deleted file mode 100644 index d49f1735..00000000 --- a/APIs/node_modules/request/node_modules/extend/.eslintrc +++ /dev/null @@ -1,192 +0,0 @@ -{ - "env": { - "browser": false, - "node": true, - "amd": false, - "mocha": false, - "jasmine": false - }, - - "rules": { - "accessor-pairs": [2, { getWithoutSet: false, setWithoutGet: true }], - "array-bracket-spacing": [2, "never", { - "singleValue": false, - "objectsInArrays": false, - "arraysInArrays": false - }], - "block-scoped-var": [0], - "brace-style": [2, "1tbs", { "allowSingleLine": true }], - "camelcase": [2], - "comma-dangle": [2, "never"], - "comma-spacing": [2], - "comma-style": [2, "last"], - "complexity": [2, 15], - "computed-property-spacing": [2, "never"], - "consistent-return": [2], - "consistent-this": [0, "that"], - "constructor-super": [2], - "curly": [2, "all"], - "default-case": [2], - "dot-notation": [2, { "allowKeywords": true }], - "eol-last": [2], - "eqeqeq": [2], - "func-names": [0], - "func-style": [2, "expression"], - "generator-star-spacing": [2, { "before": false, "after": true }], - "global-strict": [0, "never"], - "guard-for-in": [0], - "handle-callback-err": [0], - "key-spacing": [2, { "beforeColon": false, "afterColon": true }], - "linebreak-style": [2, "unix"], - "lines-around-comment": [2, { - "beforeBlockComment": false, - "afterBlockComment": false, - "beforeLineComment": false, - "beforeLineComment": false, - "allowBlockStart": true, - "allowBlockEnd": true - }], - "quotes": [2, "single", "avoid-escape"], - "max-depth": [1, 4], - "max-len": [0, 80, 4], - "max-nested-callbacks": [2, 2], - "max-params": [2, 2], - "max-statements": [2, 21], - "new-parens": [2], - "new-cap": [2], - "newline-after-var": [0], - "no-alert": [2], - "no-array-constructor": [2], - "no-bitwise": [0], - "no-caller": [2], - "no-catch-shadow": [2], - "no-cond-assign": [2], - "no-console": [2], - "no-constant-condition": [2], - "no-continue": [2], - "no-control-regex": [2], - "no-debugger": [2], - "no-delete-var": [2], - "no-div-regex": [0], - "no-dupe-args": [2], - "no-dupe-keys": [2], - "no-duplicate-case": [2], - "no-else-return": [0], - "no-empty": [2], - "no-empty-character-class": [2], - "no-empty-label": [2], - "no-eq-null": [0], - "no-eval": [2], - "no-ex-assign": [2], - "no-extend-native": [2], - "no-extra-bind": [2], - "no-extra-boolean-cast": [2], - "no-extra-parens": [0], - "no-extra-semi": [2], - "no-fallthrough": [2], - "no-floating-decimal": [2], - "no-func-assign": [2], - "no-implied-eval": [2], - "no-inline-comments": [0], - "no-inner-declarations": [2, "functions"], - "no-invalid-regexp": [2], - "no-irregular-whitespace": [2], - "no-iterator": [2], - "no-label-var": [2], - "no-labels": [2], - "no-lone-blocks": [2], - "no-lonely-if": [2], - "no-loop-func": [2], - "no-mixed-requires": [0, false], - "no-mixed-spaces-and-tabs": [2, false], - "no-multi-spaces": [2], - "no-multi-str": [2], - "no-multiple-empty-lines": [2, {"max": 1}], - "no-native-reassign": [2], - "no-negated-in-lhs": [2], - "no-nested-ternary": [0], - "no-new": [2], - "no-new-func": [2], - "no-new-object": [2], - "no-new-require": [0], - "no-new-wrappers": [2], - "no-obj-calls": [2], - "no-octal": [2], - "no-octal-escape": [2], - "no-param-reassign": [2], - "no-path-concat": [0], - "no-plusplus": [0], - "no-process-env": [0], - "no-process-exit": [2], - "no-proto": [2], - "no-redeclare": [2], - "no-regex-spaces": [2], - "no-reserved-keys": [2], - "no-restricted-modules": [0], - "no-return-assign": [2, "always"], - "no-script-url": [2], - "no-self-compare": [0], - "no-sequences": [2], - "no-shadow": [2], - "no-shadow-restricted-names": [2], - "no-space-before-semi": [2], - "no-spaced-func": [2], - "no-sparse-arrays": [2], - "no-sync": [0], - "no-ternary": [0], - "no-this-before-super": [2], - "no-throw-literal": [2], - "no-trailing-spaces": [2, { "skipBlankLines": false }], - "no-undef": [2], - "no-undef-init": [2], - "no-undefined": [0], - "no-underscore-dangle": [2], - "no-unexpected-multiline": [2], - "no-unneeded-ternary": [2], - "no-unreachable": [2], - "no-unused-expressions": [2], - "no-unused-vars": [2, { "vars": "all", "args": "after-used" }], - "no-use-before-define": [2], - "no-void": [0], - "no-warning-comments": [0, { "terms": ["todo", "fixme", "xxx"], "location": "start" }], - "no-with": [2], - "no-wrap-func": [2], - "object-curly-spacing": [2, "always"], - "object-shorthand": [2, "never"], - "one-var": [0], - "operator-assignment": [0, "always"], - "operator-linebreak": [2, "none"], - "padded-blocks": [0], - "prefer-const": [0], - "quote-props": [0], - "radix": [0], - "semi": [2], - "semi-spacing": [2, { "before": false, "after": true }], - "sort-vars": [0], - "space-after-keywords": [2, "always"], - "space-before-function-paren": [2, { "anonymous": "always", "named": "never" }], - "space-before-blocks": [0, "always"], - "space-in-brackets": [0, "never", { - "singleValue": true, - "arraysInArrays": false, - "arraysInObjects": false, - "objectsInArrays": true, - "objectsInObjects": true, - "propertyName": false - }], - "space-in-parens": [2, "never"], - "space-infix-ops": [2], - "space-return-throw-case": [2], - "space-unary-ops": [2, { "words": true, "nonwords": false }], - "spaced-comment": [2, "always"], - "spaced-line-comment": [0, "always"], - "strict": [2, "global"], - "use-isnan": [2], - "valid-jsdoc": [0], - "valid-typeof": [2], - "vars-on-top": [0], - "wrap-iife": [2], - "wrap-regex": [2], - "yoda": [2, "never", { "exceptRange": true, "onlyEquality": false }] - } -} diff --git a/APIs/node_modules/request/node_modules/extend/.jscs.json b/APIs/node_modules/request/node_modules/extend/.jscs.json deleted file mode 100644 index 7e84b282..00000000 --- a/APIs/node_modules/request/node_modules/extend/.jscs.json +++ /dev/null @@ -1,104 +0,0 @@ -{ - "additionalRules": [], - - "requireSemicolons": true, - - "disallowMultipleSpaces": true, - - "disallowIdentifierNames": [], - - "requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"], - - "requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch", "function"], - - "disallowSpaceAfterKeywords": [], - - "requireSpacesInAnonymousFunctionExpression": { "beforeOpeningRoundBrace": true, "beforeOpeningCurlyBrace": true }, - "requireSpacesInNamedFunctionExpression": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInNamedFunctionExpression": { "beforeOpeningRoundBrace": true }, - "requireSpacesInFunctionDeclaration": { "beforeOpeningCurlyBrace": true }, - "disallowSpacesInFunctionDeclaration": { "beforeOpeningRoundBrace": true }, - - "requireSpaceBetweenArguments": true, - - "disallowSpacesInsideParentheses": true, - - "disallowSpacesInsideArrayBrackets": true, - - "disallowQuotedKeysInObjects": "allButReserved", - - "disallowSpaceAfterObjectKeys": true, - - "requireCommaBeforeLineBreak": true, - - "disallowSpaceAfterPrefixUnaryOperators": ["++", "--", "+", "-", "~", "!"], - "requireSpaceAfterPrefixUnaryOperators": [], - - "disallowSpaceBeforePostfixUnaryOperators": ["++", "--"], - "requireSpaceBeforePostfixUnaryOperators": [], - - "disallowSpaceBeforeBinaryOperators": [], - "requireSpaceBeforeBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - - "requireSpaceAfterBinaryOperators": ["+", "-", "/", "*", "=", "==", "===", "!=", "!=="], - "disallowSpaceAfterBinaryOperators": [], - - "disallowImplicitTypeConversion": ["binary", "string"], - - "disallowKeywords": ["with", "eval"], - - "requireKeywordsOnNewLine": [], - "disallowKeywordsOnNewLine": ["else"], - - "requireLineFeedAtFileEnd": true, - - "disallowTrailingWhitespace": true, - - "disallowTrailingComma": true, - - "excludeFiles": ["node_modules/**", "vendor/**"], - - "disallowMultipleLineStrings": true, - - "requireDotNotation": true, - - "requireParenthesesAroundIIFE": true, - - "validateLineBreaks": "LF", - - "validateQuoteMarks": { - "escape": true, - "mark": "'" - }, - - "disallowOperatorBeforeLineBreak": [], - - "requireSpaceBeforeKeywords": [ - "do", - "for", - "if", - "else", - "switch", - "case", - "try", - "catch", - "finally", - "while", - "with", - "return" - ], - - "validateAlignedFunctionParameters": { - "lineBreakAfterOpeningBraces": true, - "lineBreakBeforeClosingBraces": true - }, - - "requirePaddingNewLinesBeforeExport": true, - - "validateNewlineAfterArrayElements": { - "maximum": 6 - }, - - "requirePaddingNewLinesAfterUseStrict": true -} - diff --git a/APIs/node_modules/request/node_modules/extend/.npmignore b/APIs/node_modules/request/node_modules/extend/.npmignore deleted file mode 100644 index 30d74d25..00000000 --- a/APIs/node_modules/request/node_modules/extend/.npmignore +++ /dev/null @@ -1 +0,0 @@ -test \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/extend/.travis.yml b/APIs/node_modules/request/node_modules/extend/.travis.yml deleted file mode 100644 index ebef6449..00000000 --- a/APIs/node_modules/request/node_modules/extend/.travis.yml +++ /dev/null @@ -1,44 +0,0 @@ -language: node_js -node_js: - - "iojs-v2.3" - - "iojs-v2.2" - - "iojs-v2.1" - - "iojs-v2.0" - - "iojs-v1.8" - - "iojs-v1.7" - - "iojs-v1.6" - - "iojs-v1.5" - - "iojs-v1.4" - - "iojs-v1.3" - - "iojs-v1.2" - - "iojs-v1.1" - - "iojs-v1.0" - - "0.12" - - "0.11" - - "0.10" - - "0.9" - - "0.8" - - "0.6" - - "0.4" -before_install: - - '[ "${TRAVIS_NODE_VERSION}" = "0.6" ] || npm install -g npm@1.4.28 && npm install -g npm' -sudo: false -matrix: - fast_finish: true - allow_failures: - - node_js: "iojs-v2.2" - - node_js: "iojs-v2.1" - - node_js: "iojs-v2.0" - - node_js: "iojs-v1.7" - - node_js: "iojs-v1.6" - - node_js: "iojs-v1.5" - - node_js: "iojs-v1.4" - - node_js: "iojs-v1.3" - - node_js: "iojs-v1.2" - - node_js: "iojs-v1.1" - - node_js: "iojs-v1.0" - - node_js: "0.11" - - node_js: "0.9" - - node_js: "0.8" - - node_js: "0.6" - - node_js: "0.4" diff --git a/APIs/node_modules/request/node_modules/extend/CHANGELOG.md b/APIs/node_modules/request/node_modules/extend/CHANGELOG.md deleted file mode 100644 index ee0cfd6a..00000000 --- a/APIs/node_modules/request/node_modules/extend/CHANGELOG.md +++ /dev/null @@ -1,69 +0,0 @@ -3.0.0 / 2015-07-01 -================== - * [Possible breaking change] Use global "strict" directive (#32) - * [Tests] `int` is an ES3 reserved word - * [Tests] Test up to `io.js` `v2.3` - * [Tests] Add `npm run eslint` - * [Dev Deps] Update `covert`, `jscs` - -2.0.1 / 2015-04-25 -================== - * Use an inline `isArray` check, for ES3 browsers. (#27) - * Some old browsers fail when an identifier is `toString` - * Test latest `node` and `io.js` versions on `travis-ci`; speed up builds - * Add license info to package.json (#25) - * Update `tape`, `jscs` - * Adding a CHANGELOG - -2.0.0 / 2014-10-01 -================== - * Increase code coverage to 100%; run code coverage as part of tests - * Add `npm run lint`; Run linter as part of tests - * Remove nodeType and setInterval checks in isPlainObject - * Updating `tape`, `jscs`, `covert` - * General style and README cleanup - -1.3.0 / 2014-06-20 -================== - * Add component.json for browser support (#18) - * Use SVG for badges in README (#16) - * Updating `tape`, `covert` - * Updating travis-ci to work with multiple node versions - * Fix `deep === false` bug (returning target as {}) (#14) - * Fixing constructor checks in isPlainObject - * Adding additional test coverage - * Adding `npm run coverage` - * Add LICENSE (#13) - * Adding a warning about `false`, per #11 - * General style and whitespace cleanup - -1.2.1 / 2013-09-14 -================== - * Fixing hasOwnProperty bugs that would only have shown up in specific browsers. Fixes #8 - * Updating `tape` - -1.2.0 / 2013-09-02 -================== - * Updating the README: add badges - * Adding a missing variable reference. - * Using `tape` instead of `buster` for tests; add more tests (#7) - * Adding node 0.10 to Travis CI (#6) - * Enabling "npm test" and cleaning up package.json (#5) - * Add Travis CI. - -1.1.3 / 2012-12-06 -================== - * Added unit tests. - * Ensure extend function is named. (Looks nicer in a stack trace.) - * README cleanup. - -1.1.1 / 2012-11-07 -================== - * README cleanup. - * Added installation instructions. - * Added a missing semicolon - -1.0.0 / 2012-04-08 -================== - * Initial commit - diff --git a/APIs/node_modules/request/node_modules/extend/LICENSE b/APIs/node_modules/request/node_modules/extend/LICENSE deleted file mode 100644 index e16d6a56..00000000 --- a/APIs/node_modules/request/node_modules/extend/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Stefan Thomas - -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/APIs/node_modules/request/node_modules/extend/README.md b/APIs/node_modules/request/node_modules/extend/README.md deleted file mode 100644 index 632fb0f9..00000000 --- a/APIs/node_modules/request/node_modules/extend/README.md +++ /dev/null @@ -1,62 +0,0 @@ -[![Build Status][travis-svg]][travis-url] -[![dependency status][deps-svg]][deps-url] -[![dev dependency status][dev-deps-svg]][dev-deps-url] - -# extend() for Node.js [![Version Badge][npm-version-png]][npm-url] - -`node-extend` is a port of the classic extend() method from jQuery. It behaves as you expect. It is simple, tried and true. - -## Installation - -This package is available on [npm][npm-url] as: `extend` - -``` sh -npm install extend -``` - -## Usage - -**Syntax:** extend **(** [`deep`], `target`, `object1`, [`objectN`] **)** - -*Extend one object with one or more others, returning the modified object.* - -Keep in mind that the target object will be modified, and will be returned from extend(). - -If a boolean true is specified as the first argument, extend performs a deep copy, recursively copying any objects it finds. Otherwise, the copy will share structure with the original object(s). -Undefined properties are not copied. However, properties inherited from the object's prototype will be copied over. -Warning: passing `false` as the first argument is not supported. - -### Arguments - -* `deep` *Boolean* (optional) -If set, the merge becomes recursive (i.e. deep copy). -* `target` *Object* -The object to extend. -* `object1` *Object* -The object that will be merged into the first. -* `objectN` *Object* (Optional) -More objects to merge into the first. - -## License - -`node-extend` is licensed under the [MIT License][mit-license-url]. - -## Acknowledgements - -All credit to the jQuery authors for perfecting this amazing utility. - -Ported to Node.js by [Stefan Thomas][github-justmoon] with contributions by [Jonathan Buchanan][github-insin] and [Jordan Harband][github-ljharb]. - -[travis-svg]: https://travis-ci.org/justmoon/node-extend.svg -[travis-url]: https://travis-ci.org/justmoon/node-extend -[npm-url]: https://npmjs.org/package/extend -[mit-license-url]: http://opensource.org/licenses/MIT -[github-justmoon]: https://github.com/justmoon -[github-insin]: https://github.com/insin -[github-ljharb]: https://github.com/ljharb -[npm-version-png]: http://vb.teelaun.ch/justmoon/node-extend.svg -[deps-svg]: https://david-dm.org/justmoon/node-extend.svg -[deps-url]: https://david-dm.org/justmoon/node-extend -[dev-deps-svg]: https://david-dm.org/justmoon/node-extend/dev-status.svg -[dev-deps-url]: https://david-dm.org/justmoon/node-extend#info=devDependencies - diff --git a/APIs/node_modules/request/node_modules/extend/component.json b/APIs/node_modules/request/node_modules/extend/component.json deleted file mode 100644 index 1500a2f3..00000000 --- a/APIs/node_modules/request/node_modules/extend/component.json +++ /dev/null @@ -1,32 +0,0 @@ -{ - "name": "extend", - "author": "Stefan Thomas (http://www.justmoon.net)", - "version": "3.0.0", - "description": "Port of jQuery.extend for node.js and the browser.", - "scripts": [ - "index.js" - ], - "contributors": [ - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "keywords": [ - "extend", - "clone", - "merge" - ], - "repository" : { - "type": "git", - "url": "https://github.com/justmoon/node-extend.git" - }, - "dependencies": { - }, - "devDependencies": { - "tape" : "~3.0.0", - "covert": "~0.4.0", - "jscs": "~1.6.2" - } -} - diff --git a/APIs/node_modules/request/node_modules/extend/index.js b/APIs/node_modules/request/node_modules/extend/index.js deleted file mode 100644 index f5ec75d5..00000000 --- a/APIs/node_modules/request/node_modules/extend/index.js +++ /dev/null @@ -1,86 +0,0 @@ -'use strict'; - -var hasOwn = Object.prototype.hasOwnProperty; -var toStr = Object.prototype.toString; - -var isArray = function isArray(arr) { - if (typeof Array.isArray === 'function') { - return Array.isArray(arr); - } - - return toStr.call(arr) === '[object Array]'; -}; - -var isPlainObject = function isPlainObject(obj) { - if (!obj || toStr.call(obj) !== '[object Object]') { - return false; - } - - var hasOwnConstructor = hasOwn.call(obj, 'constructor'); - var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf'); - // Not own constructor property must be Object - if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) { - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - var key; - for (key in obj) {/**/} - - return typeof key === 'undefined' || hasOwn.call(obj, key); -}; - -module.exports = function extend() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0], - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if (typeof target === 'boolean') { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } else if ((typeof target !== 'object' && typeof target !== 'function') || target == null) { - target = {}; - } - - for (; i < length; ++i) { - options = arguments[i]; - // Only deal with non-null/undefined values - if (options != null) { - // Extend the base object - for (name in options) { - src = target[name]; - copy = options[name]; - - // Prevent never-ending loop - if (target !== copy) { - // Recurse if we're merging plain objects or arrays - if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) { - if (copyIsArray) { - copyIsArray = false; - clone = src && isArray(src) ? src : []; - } else { - clone = src && isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[name] = extend(deep, clone, copy); - - // Don't bring in undefined values - } else if (typeof copy !== 'undefined') { - target[name] = copy; - } - } - } - } - } - - // Return the modified object - return target; -}; - diff --git a/APIs/node_modules/request/node_modules/extend/package.json b/APIs/node_modules/request/node_modules/extend/package.json deleted file mode 100644 index 2dc858a5..00000000 --- a/APIs/node_modules/request/node_modules/extend/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "extend", - "author": { - "name": "Stefan Thomas", - "email": "justmoon@members.fsf.org", - "url": "http://www.justmoon.net" - }, - "version": "3.0.0", - "description": "Port of jQuery.extend for node.js and the browser", - "main": "index", - "scripts": { - "test": "npm run lint && node test/index.js && npm run coverage-quiet", - "coverage": "covert test/index.js", - "coverage-quiet": "covert test/index.js --quiet", - "lint": "npm run jscs && npm run eslint", - "jscs": "jscs *.js */*.js", - "eslint": "eslint *.js */*.js" - }, - "contributors": [ - { - "name": "Jordan Harband", - "url": "https://github.com/ljharb" - } - ], - "keywords": [ - "extend", - "clone", - "merge" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/justmoon/node-extend.git" - }, - "dependencies": {}, - "devDependencies": { - "tape": "^4.0.0", - "covert": "^1.1.0", - "jscs": "^1.13.1", - "eslint": "^0.24.0" - }, - "license": "MIT", - "gitHead": "148e7270cab2e9413af2cd0cab147070d755ed6d", - "bugs": { - "url": "https://github.com/justmoon/node-extend/issues" - }, - "homepage": "https://github.com/justmoon/node-extend#readme", - "_id": "extend@3.0.0", - "_shasum": "5a474353b9f3353ddd8176dfd37b91c83a46f1d4", - "_from": "extend@~3.0.0", - "_npmVersion": "2.11.3", - "_nodeVersion": "2.3.1", - "_npmUser": { - "name": "ljharb", - "email": "ljharb@gmail.com" - }, - "dist": { - "shasum": "5a474353b9f3353ddd8176dfd37b91c83a46f1d4", - "tarball": "http://registry.npmjs.org/extend/-/extend-3.0.0.tgz" - }, - "maintainers": [ - { - "name": "justmoon", - "email": "justmoon@members.fsf.org" - }, - { - "name": "ljharb", - "email": "ljharb@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/extend/-/extend-3.0.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/forever-agent/LICENSE b/APIs/node_modules/request/node_modules/forever-agent/LICENSE deleted file mode 100644 index a4a9aee0..00000000 --- a/APIs/node_modules/request/node_modules/forever-agent/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/forever-agent/README.md b/APIs/node_modules/request/node_modules/forever-agent/README.md deleted file mode 100644 index 9d5b6634..00000000 --- a/APIs/node_modules/request/node_modules/forever-agent/README.md +++ /dev/null @@ -1,4 +0,0 @@ -forever-agent -============= - -HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module. diff --git a/APIs/node_modules/request/node_modules/forever-agent/index.js b/APIs/node_modules/request/node_modules/forever-agent/index.js deleted file mode 100644 index 416c7abd..00000000 --- a/APIs/node_modules/request/node_modules/forever-agent/index.js +++ /dev/null @@ -1,138 +0,0 @@ -module.exports = ForeverAgent -ForeverAgent.SSL = ForeverAgentSSL - -var util = require('util') - , Agent = require('http').Agent - , net = require('net') - , tls = require('tls') - , AgentSSL = require('https').Agent - -function getConnectionName(host, port) { - var name = '' - if (typeof host === 'string') { - name = host + ':' + port - } else { - // For node.js v012.0 and iojs-v1.5.1, host is an object. And any existing localAddress is part of the connection name. - name = host.host + ':' + host.port + ':' + (host.localAddress ? (host.localAddress + ':') : ':') - } - return name -} - -function ForeverAgent(options) { - var self = this - self.options = options || {} - self.requests = {} - self.sockets = {} - self.freeSockets = {} - self.maxSockets = self.options.maxSockets || Agent.defaultMaxSockets - self.minSockets = self.options.minSockets || ForeverAgent.defaultMinSockets - self.on('free', function(socket, host, port) { - var name = getConnectionName(host, port) - - if (self.requests[name] && self.requests[name].length) { - self.requests[name].shift().onSocket(socket) - } else if (self.sockets[name].length < self.minSockets) { - if (!self.freeSockets[name]) self.freeSockets[name] = [] - self.freeSockets[name].push(socket) - - // if an error happens while we don't use the socket anyway, meh, throw the socket away - var onIdleError = function() { - socket.destroy() - } - socket._onIdleError = onIdleError - socket.on('error', onIdleError) - } else { - // If there are no pending requests just destroy the - // socket and it will get removed from the pool. This - // gets us out of timeout issues and allows us to - // default to Connection:keep-alive. - socket.destroy() - } - }) - -} -util.inherits(ForeverAgent, Agent) - -ForeverAgent.defaultMinSockets = 5 - - -ForeverAgent.prototype.createConnection = net.createConnection -ForeverAgent.prototype.addRequestNoreuse = Agent.prototype.addRequest -ForeverAgent.prototype.addRequest = function(req, host, port) { - var name = getConnectionName(host, port) - - if (typeof host !== 'string') { - var options = host - port = options.port - host = options.host - } - - if (this.freeSockets[name] && this.freeSockets[name].length > 0 && !req.useChunkedEncodingByDefault) { - var idleSocket = this.freeSockets[name].pop() - idleSocket.removeListener('error', idleSocket._onIdleError) - delete idleSocket._onIdleError - req._reusedSocket = true - req.onSocket(idleSocket) - } else { - this.addRequestNoreuse(req, host, port) - } -} - -ForeverAgent.prototype.removeSocket = function(s, name, host, port) { - if (this.sockets[name]) { - var index = this.sockets[name].indexOf(s) - if (index !== -1) { - this.sockets[name].splice(index, 1) - } - } else if (this.sockets[name] && this.sockets[name].length === 0) { - // don't leak - delete this.sockets[name] - delete this.requests[name] - } - - if (this.freeSockets[name]) { - var index = this.freeSockets[name].indexOf(s) - if (index !== -1) { - this.freeSockets[name].splice(index, 1) - if (this.freeSockets[name].length === 0) { - delete this.freeSockets[name] - } - } - } - - if (this.requests[name] && this.requests[name].length) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createSocket(name, host, port).emit('free') - } -} - -function ForeverAgentSSL (options) { - ForeverAgent.call(this, options) -} -util.inherits(ForeverAgentSSL, ForeverAgent) - -ForeverAgentSSL.prototype.createConnection = createConnectionSSL -ForeverAgentSSL.prototype.addRequestNoreuse = AgentSSL.prototype.addRequest - -function createConnectionSSL (port, host, options) { - if (typeof port === 'object') { - options = port; - } else if (typeof host === 'object') { - options = host; - } else if (typeof options === 'object') { - options = options; - } else { - options = {}; - } - - if (typeof port === 'number') { - options.port = port; - } - - if (typeof host === 'string') { - options.host = host; - } - - return tls.connect(options); -} diff --git a/APIs/node_modules/request/node_modules/forever-agent/package.json b/APIs/node_modules/request/node_modules/forever-agent/package.json deleted file mode 100644 index b0a0f4a0..00000000 --- a/APIs/node_modules/request/node_modules/forever-agent/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com", - "url": "http://www.futurealoof.com" - }, - "name": "forever-agent", - "description": "HTTP Agent that keeps socket connections alive between keep-alive requests. Formerly part of mikeal/request, now a standalone module.", - "version": "0.6.1", - "license": "Apache-2.0", - "repository": { - "url": "https://github.com/mikeal/forever-agent" - }, - "main": "index.js", - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "gitHead": "1b3b6163f2b3c2c4122bbfa288c1325c0df9871d", - "bugs": { - "url": "https://github.com/mikeal/forever-agent/issues" - }, - "homepage": "https://github.com/mikeal/forever-agent", - "_id": "forever-agent@0.6.1", - "scripts": {}, - "_shasum": "fbc71f0c41adeb37f96c577ad1ed42d8fdacca91", - "_from": "forever-agent@~0.6.1", - "_npmVersion": "1.4.28", - "_npmUser": { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - { - "name": "nylen", - "email": "jnylen@gmail.com" - }, - { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - } - ], - "dist": { - "shasum": "fbc71f0c41adeb37f96c577ad1ed42d8fdacca91", - "tarball": "http://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/form-data/.dockerignore b/APIs/node_modules/request/node_modules/form-data/.dockerignore deleted file mode 100644 index c67305cf..00000000 --- a/APIs/node_modules/request/node_modules/form-data/.dockerignore +++ /dev/null @@ -1,7 +0,0 @@ -*.iml -*.sublime-* -*.un~ -.idea -sftp-config.json -node_modules/ -test/tmp/ diff --git a/APIs/node_modules/request/node_modules/form-data/.editorconfig b/APIs/node_modules/request/node_modules/form-data/.editorconfig deleted file mode 100644 index 0f099897..00000000 --- a/APIs/node_modules/request/node_modules/form-data/.editorconfig +++ /dev/null @@ -1,10 +0,0 @@ -# editorconfig.org -root = true - -[*] -indent_style = space -indent_size = 2 -end_of_line = lf -charset = utf-8 -trim_trailing_whitespace = true -insert_final_newline = true diff --git a/APIs/node_modules/request/node_modules/form-data/.eslintignore b/APIs/node_modules/request/node_modules/form-data/.eslintignore deleted file mode 100644 index 8d87b1d2..00000000 --- a/APIs/node_modules/request/node_modules/form-data/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -node_modules/* diff --git a/APIs/node_modules/request/node_modules/form-data/.eslintrc b/APIs/node_modules/request/node_modules/form-data/.eslintrc deleted file mode 100644 index 129fcef0..00000000 --- a/APIs/node_modules/request/node_modules/form-data/.eslintrc +++ /dev/null @@ -1,64 +0,0 @@ -{ - "env": { - "node": true, - "browser": false - }, - "rules": { - // 2-space indentation - "indent": [2, 2, {"SwitchCase": 1}], - // Require strings to use single quotes - "quotes": [2, "single"], - // Allow only unix line-endings - "linebreak-style": [2, "unix"], - // Always require semicolons - "semi": [2, "always"], - // Require curly braces for multi-line control statements - "curly": [2, "multi-line"], - // Always handle callback error cases - "handle-callback-err": [2, "^err"], - // Require JSDoc for all function definitions - "valid-jsdoc": [2, { - "requireReturn": false, - "requireReturnDescription": false, - "prefer": { - "return": "returns" - } - }], - "require-jsdoc": [2, { - "require": { - "FunctionDeclaration": true - } - }], - "no-redeclare": [2, { "builtinGlobals": true }], - "no-shadow": [2, { "builtinGlobals": true, "hoist": "all" }], - // Disallow using variables before they've been defined - // functions are ok - "no-use-before-define": [2, "nofunc"], - "no-shadow-restricted-names": 2, - "no-extra-semi": 2, - // Disallow unused variables - "no-unused-vars": 2, - "no-undef": 2, - // Use if () { } - // ^ space - "keyword-spacing": 2, - // Use if () { } - // ^ space - "space-before-blocks": [2, "always"], - // eslint can't handle this, so the check is disabled. - "key-spacing": 0, - "strict": 0, - // Do not force dot-notation - "dot-notation": 0, - "eol-last": 0, - "no-new": 0, - "semi-spacing": 0, - // Allow multi spaces around operators since they are - // used for alignment. This is not consistent in the - // code. - "no-multi-spaces": 0, - "eqeqeq": 0, - "no-mixed-requires": 0, - "no-console": 0 - } -} diff --git a/APIs/node_modules/request/node_modules/form-data/License b/APIs/node_modules/request/node_modules/form-data/License deleted file mode 100644 index c7ff12a2..00000000 --- a/APIs/node_modules/request/node_modules/form-data/License +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2012 Felix Geisendörfer (felix@debuggable.com) and contributors - - 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/APIs/node_modules/request/node_modules/form-data/README.md b/APIs/node_modules/request/node_modules/form-data/README.md deleted file mode 100644 index e857db6e..00000000 --- a/APIs/node_modules/request/node_modules/form-data/README.md +++ /dev/null @@ -1,218 +0,0 @@ -# Form-Data [![NPM Module](https://img.shields.io/npm/v/form-data.svg)](https://www.npmjs.com/package/form-data) [![Join the chat at https://gitter.im/form-data/form-data](http://form-data.github.io/images/gitterbadge.svg)](https://gitter.im/form-data/form-data) - -A library to create readable ```"multipart/form-data"``` streams. Can be used to submit forms and file uploads to other web applications. - -The API of this library is inspired by the [XMLHttpRequest-2 FormData Interface][xhr2-fd]. - -[xhr2-fd]: http://dev.w3.org/2006/webapi/XMLHttpRequest-2/Overview.html#the-formdata-interface -[streams2-thing]: http://nodejs.org/api/stream.html#stream_compatibility_with_older_node_versions - -[![Linux Build](https://img.shields.io/travis/form-data/form-data/master.svg?label=linux:0.10-5.x)](https://travis-ci.org/form-data/form-data) -[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/form-data/master.svg?label=windows:0.10-5.x)](https://ci.appveyor.com/project/alexindigo/form-data) -[![Coverage Status](https://img.shields.io/coveralls/form-data/form-data/master.svg?label=code+coverage)](https://coveralls.io/github/form-data/form-data?branch=master) - -[![Dependency Status](https://img.shields.io/david/form-data/form-data.svg)](https://david-dm.org/form-data/form-data) -[![Codacy Badge](https://img.shields.io/codacy/43ece80331c246179695e41f81eeffe2.svg)](https://www.codacy.com/app/form-data/form-data) -[![bitHound Overall Score](https://www.bithound.io/github/form-data/form-data/badges/score.svg)](https://www.bithound.io/github/form-data/form-data) - -## Install - -``` -npm install form-data -``` - -## Usage - -In this example we are constructing a form with 3 fields that contain a string, -a buffer and a file stream. - -``` javascript -var FormData = require('form-data'); -var fs = require('fs'); - -var form = new FormData(); -form.append('my_field', 'my value'); -form.append('my_buffer', new Buffer(10)); -form.append('my_file', fs.createReadStream('/foo/bar.jpg')); -``` - -Also you can use http-response stream: - -``` javascript -var FormData = require('form-data'); -var http = require('http'); - -var form = new FormData(); - -http.request('http://nodejs.org/images/logo.png', function(response) { - form.append('my_field', 'my value'); - form.append('my_buffer', new Buffer(10)); - form.append('my_logo', response); -}); -``` - -Or @mikeal's [request](https://github.com/request/request) stream: - -``` javascript -var FormData = require('form-data'); -var request = require('request'); - -var form = new FormData(); - -form.append('my_field', 'my value'); -form.append('my_buffer', new Buffer(10)); -form.append('my_logo', request('http://nodejs.org/images/logo.png')); -``` - -In order to submit this form to a web application, call ```submit(url, [callback])``` method: - -``` javascript -form.submit('http://example.org/', function(err, res) { - // res – response object (http.IncomingMessage) // - res.resume(); -}); - -``` - -For more advanced request manipulations ```submit()``` method returns ```http.ClientRequest``` object, or you can choose from one of the alternative submission methods. - -### Alternative submission methods - -You can use node's http client interface: - -``` javascript -var http = require('http'); - -var request = http.request({ - method: 'post', - host: 'example.org', - path: '/upload', - headers: form.getHeaders() -}); - -form.pipe(request); - -request.on('response', function(res) { - console.log(res.statusCode); -}); -``` - -Or if you would prefer the `'Content-Length'` header to be set for you: - -``` javascript -form.submit('example.org/upload', function(err, res) { - console.log(res.statusCode); -}); -``` - -To use custom headers and pre-known length in parts: - -``` javascript -var CRLF = '\r\n'; -var form = new FormData(); - -var options = { - header: CRLF + '--' + form.getBoundary() + CRLF + 'X-Custom-Header: 123' + CRLF + CRLF, - knownLength: 1 -}; - -form.append('my_buffer', buffer, options); - -form.submit('http://example.com/', function(err, res) { - if (err) throw err; - console.log('Done'); -}); -``` - -Form-Data can recognize and fetch all the required information from common types of streams (```fs.readStream```, ```http.response``` and ```mikeal's request```), for some other types of streams you'd need to provide "file"-related information manually: - -``` javascript -someModule.stream(function(err, stdout, stderr) { - if (err) throw err; - - var form = new FormData(); - - form.append('file', stdout, { - filename: 'unicycle.jpg', - contentType: 'image/jpg', - knownLength: 19806 - }); - - form.submit('http://example.com/', function(err, res) { - if (err) throw err; - console.log('Done'); - }); -}); -``` - -For edge cases, like POST request to URL with query string or to pass HTTP auth credentials, object can be passed to `form.submit()` as first parameter: - -``` javascript -form.submit({ - host: 'example.com', - path: '/probably.php?extra=params', - auth: 'username:password' -}, function(err, res) { - console.log(res.statusCode); -}); -``` - -In case you need to also send custom HTTP headers with the POST request, you can use the `headers` key in first parameter of `form.submit()`: - -``` javascript -form.submit({ - host: 'example.com', - path: '/surelynot.php', - headers: {'x-test-header': 'test-header-value'} -}, function(err, res) { - console.log(res.statusCode); -}); -``` - -### Integration with other libraries - -#### Request - -Form submission using [request](https://github.com/request/request): - -```javascript -var formData = { - my_field: 'my_value', - my_file: fs.createReadStream(__dirname + '/unicycle.jpg'), -}; - -request.post({url:'http://service.com/upload', formData: formData}, function(err, httpResponse, body) { - if (err) { - return console.error('upload failed:', err); - } - console.log('Upload successful! Server responded with:', body); -}); -``` - -For more details see [request readme](https://github.com/request/request#multipartform-data-multipart-form-uploads). - -#### node-fetch - -You can also submit a form using [node-fetch](https://github.com/bitinn/node-fetch): - -```javascript -var form = new FormData(); - -form.append('a', 1); - -fetch('http://example.com', { method: 'POST', body: form }) - .then(function(res) { - return res.json(); - }).then(function(json) { - console.log(json); - }); -``` - -## Notes - -- ```getLengthSync()``` method DOESN'T calculate length for streams, use ```knownLength``` options as workaround. -- If it feels like FormData hangs after submit and you're on ```node-0.10```, please check [Compatibility with Older Node Versions][streams2-thing] - -## License - -Form-Data is licensed under the MIT license. diff --git a/APIs/node_modules/request/node_modules/form-data/lib/browser.js b/APIs/node_modules/request/node_modules/form-data/lib/browser.js deleted file mode 100644 index 8141d658..00000000 --- a/APIs/node_modules/request/node_modules/form-data/lib/browser.js +++ /dev/null @@ -1,2 +0,0 @@ -/* eslint-env browser */ -module.exports = FormData; diff --git a/APIs/node_modules/request/node_modules/form-data/lib/form_data.js b/APIs/node_modules/request/node_modules/form-data/lib/form_data.js deleted file mode 100644 index 55328b46..00000000 --- a/APIs/node_modules/request/node_modules/form-data/lib/form_data.js +++ /dev/null @@ -1,411 +0,0 @@ -var CombinedStream = require('combined-stream'); -var util = require('util'); -var path = require('path'); -var http = require('http'); -var https = require('https'); -var parseUrl = require('url').parse; -var fs = require('fs'); -var mime = require('mime-types'); -var async = require('async'); -var populate = require('./populate.js'); - -// Public API -module.exports = FormData; - -// make it a Stream -util.inherits(FormData, CombinedStream); - -/** - * Create readable "multipart/form-data" streams. - * Can be used to submit forms - * and file uploads to other web applications. - * - * @constructor - */ -function FormData() { - if (!(this instanceof FormData)) { - throw new TypeError('Failed to construct FormData: Please use the _new_ operator, this object constructor cannot be called as a function.'); - } - - this._overheadLength = 0; - this._valueLength = 0; - this._lengthRetrievers = []; - - CombinedStream.call(this); -} - -FormData.LINE_BREAK = '\r\n'; -FormData.DEFAULT_CONTENT_TYPE = 'application/octet-stream'; - -FormData.prototype.append = function(field, value, options) { - - options = options || {}; - - // allow filename as single option - if (typeof options == 'string') { - options = {filename: options}; - } - - var append = CombinedStream.prototype.append.bind(this); - - // all that streamy business can't handle numbers - if (typeof value == 'number') { - value = '' + value; - } - - // https://github.com/felixge/node-form-data/issues/38 - if (util.isArray(value)) { - // Please convert your array into string - // the way web server expects it - this._error(new Error('Arrays are not supported.')); - return; - } - - var header = this._multiPartHeader(field, value, options); - var footer = this._multiPartFooter(); - - append(header); - append(value); - append(footer); - - // pass along options.knownLength - this._trackLength(header, value, options); -}; - -FormData.prototype._trackLength = function(header, value, options) { - var valueLength = 0; - - // used w/ getLengthSync(), when length is known. - // e.g. for streaming directly from a remote server, - // w/ a known file a size, and not wanting to wait for - // incoming file to finish to get its size. - if (options.knownLength != null) { - valueLength += +options.knownLength; - } else if (Buffer.isBuffer(value)) { - valueLength = value.length; - } else if (typeof value === 'string') { - valueLength = Buffer.byteLength(value); - } - - this._valueLength += valueLength; - - // @check why add CRLF? does this account for custom/multiple CRLFs? - this._overheadLength += - Buffer.byteLength(header) + - FormData.LINE_BREAK.length; - - // empty or either doesn't have path or not an http response - if (!value || ( !value.path && !(value.readable && value.hasOwnProperty('httpVersion')) )) { - return; - } - - // no need to bother with the length - if (!options.knownLength) { - this._lengthRetrievers.push(function(next) { - - if (value.hasOwnProperty('fd')) { - - // take read range into a account - // `end` = Infinity –> read file till the end - // - // TODO: Looks like there is bug in Node fs.createReadStream - // it doesn't respect `end` options without `start` options - // Fix it when node fixes it. - // https://github.com/joyent/node/issues/7819 - if (value.end != undefined && value.end != Infinity && value.start != undefined) { - - // when end specified - // no need to calculate range - // inclusive, starts with 0 - next(null, value.end + 1 - (value.start ? value.start : 0)); - - // not that fast snoopy - } else { - // still need to fetch file size from fs - fs.stat(value.path, function(err, stat) { - - var fileSize; - - if (err) { - next(err); - return; - } - - // update final size based on the range options - fileSize = stat.size - (value.start ? value.start : 0); - next(null, fileSize); - }); - } - - // or http response - } else if (value.hasOwnProperty('httpVersion')) { - next(null, +value.headers['content-length']); - - // or request stream http://github.com/mikeal/request - } else if (value.hasOwnProperty('httpModule')) { - // wait till response come back - value.on('response', function(response) { - value.pause(); - next(null, +response.headers['content-length']); - }); - value.resume(); - - // something else - } else { - next('Unknown stream'); - } - }); - } -}; - -FormData.prototype._multiPartHeader = function(field, value, options) { - // custom header specified (as string)? - // it becomes responsible for boundary - // (e.g. to handle extra CRLFs on .NET servers) - if (options.header) { - return options.header; - } - - var contentDisposition = this._getContentDisposition(value, options); - var contentType = this._getContentType(value, options); - - var contents = ''; - var headers = { - // add custom disposition as third element or keep it two elements if not - 'Content-Disposition': ['form-data', 'name="' + field + '"'].concat(contentDisposition || []), - // if no content type. allow it to be empty array - 'Content-Type': [].concat(contentType || []) - }; - - for (var prop in headers) { - if (headers[prop].length) { - contents += prop + ': ' + headers[prop].join('; ') + FormData.LINE_BREAK; - } - } - - return '--' + this.getBoundary() + FormData.LINE_BREAK + contents + FormData.LINE_BREAK; -}; - -FormData.prototype._getContentDisposition = function(value, options) { - - var contentDisposition; - - // custom filename takes precedence - // fs- and request- streams have path property - var filename = options.filename || value.path; - - // or try http response - if (!filename && value.readable && value.hasOwnProperty('httpVersion')) { - filename = value.client._httpMessage.path; - } - - if (filename) { - contentDisposition = 'filename="' + path.basename(filename) + '"'; - } - - return contentDisposition; -}; - -FormData.prototype._getContentType = function(value, options) { - - // use custom content-type above all - var contentType = options.contentType; - - // or try `path` from fs-, request- streams - if (!contentType && value.path) { - contentType = mime.lookup(value.path); - } - - // or if it's http-reponse - if (!contentType && value.readable && value.hasOwnProperty('httpVersion')) { - contentType = value.headers['content-type']; - } - - // or guess it from the filename - if (!contentType && options.filename) { - contentType = mime.lookup(options.filename); - } - - // fallback to the default content type if `value` is not simple value - if (!contentType && typeof value == 'object') { - contentType = FormData.DEFAULT_CONTENT_TYPE; - } - - return contentType; -}; - -FormData.prototype._multiPartFooter = function() { - return function(next) { - var footer = FormData.LINE_BREAK; - - var lastPart = (this._streams.length === 0); - if (lastPart) { - footer += this._lastBoundary(); - } - - next(footer); - }.bind(this); -}; - -FormData.prototype._lastBoundary = function() { - return '--' + this.getBoundary() + '--' + FormData.LINE_BREAK; -}; - -FormData.prototype.getHeaders = function(userHeaders) { - var header; - var formHeaders = { - 'content-type': 'multipart/form-data; boundary=' + this.getBoundary() - }; - - for (header in userHeaders) { - if (userHeaders.hasOwnProperty(header)) { - formHeaders[header.toLowerCase()] = userHeaders[header]; - } - } - - return formHeaders; -}; - -FormData.prototype.getCustomHeaders = function(contentType) { - contentType = contentType ? contentType : 'multipart/form-data'; - - var formHeaders = { - 'content-type': contentType + '; boundary=' + this.getBoundary(), - 'content-length': this.getLengthSync() - }; - - return formHeaders; -}; - -FormData.prototype.getBoundary = function() { - if (!this._boundary) { - this._generateBoundary(); - } - - return this._boundary; -}; - -FormData.prototype._generateBoundary = function() { - // This generates a 50 character boundary similar to those used by Firefox. - // They are optimized for boyer-moore parsing. - var boundary = '--------------------------'; - for (var i = 0; i < 24; i++) { - boundary += Math.floor(Math.random() * 10).toString(16); - } - - this._boundary = boundary; -}; - -// Note: getLengthSync DOESN'T calculate streams length -// As workaround one can calculate file size manually -// and add it as knownLength option -FormData.prototype.getLengthSync = function() { - var knownLength = this._overheadLength + this._valueLength; - - // Don't get confused, there are 3 "internal" streams for each keyval pair - // so it basically checks if there is any value added to the form - if (this._streams.length) { - knownLength += this._lastBoundary().length; - } - - // https://github.com/form-data/form-data/issues/40 - if (this._lengthRetrievers.length) { - // Some async length retrievers are present - // therefore synchronous length calculation is false. - // Please use getLength(callback) to get proper length - this._error(new Error('Cannot calculate proper length in synchronous way.')); - } - - return knownLength; -}; - -FormData.prototype.getLength = function(cb) { - var knownLength = this._overheadLength + this._valueLength; - - if (this._streams.length) { - knownLength += this._lastBoundary().length; - } - - if (!this._lengthRetrievers.length) { - process.nextTick(cb.bind(this, null, knownLength)); - return; - } - - async.parallel(this._lengthRetrievers, function(err, values) { - if (err) { - cb(err); - return; - } - - values.forEach(function(length) { - knownLength += length; - }); - - cb(null, knownLength); - }); -}; - -FormData.prototype.submit = function(params, cb) { - var request - , options - , defaults = {method: 'post'} - ; - - // parse provided url if it's string - // or treat it as options object - if (typeof params == 'string') { - - params = parseUrl(params); - options = populate({ - port: params.port, - path: params.pathname, - host: params.hostname - }, defaults); - - // use custom params - } else { - - options = populate(params, defaults); - // if no port provided use default one - if (!options.port) { - options.port = options.protocol == 'https:' ? 443 : 80; - } - } - - // put that good code in getHeaders to some use - options.headers = this.getHeaders(params.headers); - - // https if specified, fallback to http in any other case - if (options.protocol == 'https:') { - request = https.request(options); - } else { - request = http.request(options); - } - - // get content length and fire away - this.getLength(function(err, length) { - if (err) { - this._error(err); - return; - } - - // add content length - request.setHeader('Content-Length', length); - - this.pipe(request); - if (cb) { - request.on('error', cb); - request.on('response', cb.bind(this, null)); - } - }.bind(this)); - - return request; -}; - -FormData.prototype._error = function(err) { - if (!this.error) { - this.error = err; - this.pause(); - this.emit('error', err); - } -}; diff --git a/APIs/node_modules/request/node_modules/form-data/lib/populate.js b/APIs/node_modules/request/node_modules/form-data/lib/populate.js deleted file mode 100644 index 6f64a6d3..00000000 --- a/APIs/node_modules/request/node_modules/form-data/lib/populate.js +++ /dev/null @@ -1,9 +0,0 @@ -// populates missing values -module.exports = function(dst, src) { - for (var prop in src) { - if (src.hasOwnProperty(prop) && !dst[prop]) { - dst[prop] = src[prop]; - } - } - return dst; -}; diff --git a/APIs/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md b/APIs/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md deleted file mode 100644 index f15e0812..00000000 --- a/APIs/node_modules/request/node_modules/form-data/node_modules/async/CHANGELOG.md +++ /dev/null @@ -1,125 +0,0 @@ -# v1.5.2 -- Allow using `"consructor"` as an argument in `memoize` (#998) -- Give a better error messsage when `auto` dependency checking fails (#994) -- Various doc updates (#936, #956, #979, #1002) - -# v1.5.1 -- Fix issue with `pause` in `queue` with concurrency enabled (#946) -- `while` and `until` now pass the final result to callback (#963) -- `auto` will properly handle concurrency when there is no callback (#966) -- `auto` will now properly stop execution when an error occurs (#988, #993) -- Various doc fixes (#971, #980) - -# v1.5.0 - -- Added `transform`, analogous to [`_.transform`](http://lodash.com/docs#transform) (#892) -- `map` now returns an object when an object is passed in, rather than array with non-numeric keys. `map` will begin always returning an array with numeric indexes in the next major release. (#873) -- `auto` now accepts an optional `concurrency` argument to limit the number of running tasks (#637) -- Added `queue#workersList()`, to retrieve the list of currently running tasks. (#891) -- Various code simplifications (#896, #904) -- Various doc fixes :scroll: (#890, #894, #903, #905, #912) - -# v1.4.2 - -- Ensure coverage files don't get published on npm (#879) - -# v1.4.1 - -- Add in overlooked `detectLimit` method (#866) -- Removed unnecessary files from npm releases (#861) -- Removed usage of a reserved word to prevent :boom: in older environments (#870) - -# v1.4.0 - -- `asyncify` now supports promises (#840) -- Added `Limit` versions of `filter` and `reject` (#836) -- Add `Limit` versions of `detect`, `some` and `every` (#828, #829) -- `some`, `every` and `detect` now short circuit early (#828, #829) -- Improve detection of the global object (#804), enabling use in WebWorkers -- `whilst` now called with arguments from iterator (#823) -- `during` now gets called with arguments from iterator (#824) -- Code simplifications and optimizations aplenty ([diff](https://github.com/caolan/async/compare/v1.3.0...v1.4.0)) - - -# v1.3.0 - -New Features: -- Added `constant` -- Added `asyncify`/`wrapSync` for making sync functions work with callbacks. (#671, #806) -- Added `during` and `doDuring`, which are like `whilst` with an async truth test. (#800) -- `retry` now accepts an `interval` parameter to specify a delay between retries. (#793) -- `async` should work better in Web Workers due to better `root` detection (#804) -- Callbacks are now optional in `whilst`, `doWhilst`, `until`, and `doUntil` (#642) -- Various internal updates (#786, #801, #802, #803) -- Various doc fixes (#790, #794) - -Bug Fixes: -- `cargo` now exposes the `payload` size, and `cargo.payload` can be changed on the fly after the `cargo` is created. (#740, #744, #783) - - -# v1.2.1 - -Bug Fix: - -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782) - - -# v1.2.0 - -New Features: - -- Added `timesLimit` (#743) -- `concurrency` can be changed after initialization in `queue` by setting `q.concurrency`. The new concurrency will be reflected the next time a task is processed. (#747, #772) - -Bug Fixes: - -- Fixed a regression in `each` and family with empty arrays that have additional properties. (#775, #777) - - -# v1.1.1 - -Bug Fix: - -- Small regression with synchronous iterator behavior in `eachSeries` with a 1-element array. Before 1.1.0, `eachSeries`'s callback was called on the same tick, which this patch restores. In 2.0.0, it will be called on the next tick. (#782) - - -# v1.1.0 - -New Features: - -- `cargo` now supports all of the same methods and event callbacks as `queue`. -- Added `ensureAsync` - A wrapper that ensures an async function calls its callback on a later tick. (#769) -- Optimized `map`, `eachOf`, and `waterfall` families of functions -- Passing a `null` or `undefined` array to `map`, `each`, `parallel` and families will be treated as an empty array (#667). -- The callback is now optional for the composed results of `compose` and `seq`. (#618) -- Reduced file size by 4kb, (minified version by 1kb) -- Added code coverage through `nyc` and `coveralls` (#768) - -Bug Fixes: - -- `forever` will no longer stack overflow with a synchronous iterator (#622) -- `eachLimit` and other limit functions will stop iterating once an error occurs (#754) -- Always pass `null` in callbacks when there is no error (#439) -- Ensure proper conditions when calling `drain()` after pushing an empty data set to a queue (#668) -- `each` and family will properly handle an empty array (#578) -- `eachSeries` and family will finish if the underlying array is modified during execution (#557) -- `queue` will throw if a non-function is passed to `q.push()` (#593) -- Doc fixes (#629, #766) - - -# v1.0.0 - -No known breaking changes, we are simply complying with semver from here on out. - -Changes: - -- Start using a changelog! -- Add `forEachOf` for iterating over Objects (or to iterate Arrays with indexes available) (#168 #704 #321) -- Detect deadlocks in `auto` (#663) -- Better support for require.js (#527) -- Throw if queue created with concurrency `0` (#714) -- Fix unneeded iteration in `queue.resume()` (#758) -- Guard against timer mocking overriding `setImmediate` (#609 #611) -- Miscellaneous doc fixes (#542 #596 #615 #628 #631 #690 #729) -- Use single noop function internally (#546) -- Optimize internal `_each`, `_map` and `_keys` functions. diff --git a/APIs/node_modules/request/node_modules/form-data/node_modules/async/LICENSE b/APIs/node_modules/request/node_modules/form-data/node_modules/async/LICENSE deleted file mode 100644 index 8f296985..00000000 --- a/APIs/node_modules/request/node_modules/form-data/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010-2014 Caolan McMahon - -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/APIs/node_modules/request/node_modules/form-data/node_modules/async/README.md b/APIs/node_modules/request/node_modules/form-data/node_modules/async/README.md deleted file mode 100644 index 316c4050..00000000 --- a/APIs/node_modules/request/node_modules/form-data/node_modules/async/README.md +++ /dev/null @@ -1,1877 +0,0 @@ -# Async.js - -[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) -[![NPM version](http://img.shields.io/npm/v/async.svg)](https://www.npmjs.org/package/async) -[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master) -[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) - - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [Node.js](http://nodejs.org) and installable via `npm install async`, -it can also be used directly in the browser. - -Async is also installable via: - -- [bower](http://bower.io/): `bower install async` -- [component](https://github.com/component/component): `component install - caolan/async` -- [jam](http://jamjs.org/): `jam install async` -- [spm](http://spmjs.io/): `spm install async` - -Async provides around 20 functions that include the usual 'functional' -suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns -for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these -functions assume you follow the Node.js convention of providing a single -callback as the last argument of your `async` function. - - -## Quick Examples - -```javascript -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); - -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); - -async.parallel([ - function(){ ... }, - function(){ ... } -], callback); - -async.series([ - function(){ ... }, - function(){ ... } -]); -``` - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - -## Common Pitfalls [(StackOverflow)](http://stackoverflow.com/questions/tagged/async.js) -### Synchronous iteration functions - -If you get an error like `RangeError: Maximum call stack size exceeded.` or other stack overflow issues when using async, you are likely using a synchronous iterator. By *synchronous* we mean a function that calls its callback on the same tick in the javascript event loop, without doing any I/O or using any timers. Calling many callbacks iteratively will quickly overflow the stack. If you run into this issue, just defer your callback with `async.setImmediate` to start a new call stack on the next tick of the event loop. - -This can also arise by accident if you callback early in certain cases: - -```js -async.eachSeries(hugeArray, function iterator(item, callback) { - if (inCache(item)) { - callback(null, cache[item]); // if many items are cached, you'll overflow - } else { - doSomeIO(item, callback); - } -}, function done() { - //... -}); -``` - -Just change it to: - -```js -async.eachSeries(hugeArray, function iterator(item, callback) { - if (inCache(item)) { - async.setImmediate(function () { - callback(null, cache[item]); - }); - } else { - doSomeIO(item, callback); - //... -``` - -Async guards against synchronous functions in some, but not all, cases. If you are still running into stack overflows, you can defer as suggested above, or wrap functions with [`async.ensureAsync`](#ensureAsync) Functions that are asynchronous by their nature do not have this problem and don't need the extra callback deferral. - -If JavaScript's event loop is still a bit nebulous, check out [this article](http://blog.carbonfive.com/2013/10/27/the-javascript-event-loop-explained/) or [this talk](http://2014.jsconf.eu/speakers/philip-roberts-what-the-heck-is-the-event-loop-anyway.html) for more detailed information about how it works. - - -### Multiple callbacks - -Make sure to always `return` when calling a callback early, otherwise you will cause multiple callbacks and unpredictable behavior in many cases. - -```js -async.waterfall([ - function (callback) { - getSomething(options, function (err, result) { - if (err) { - callback(new Error("failed getting something:" + err.message)); - // we should return here - } - // since we did not return, this callback still will be called and - // `processData` will be called twice - callback(null, result); - }); - }, - processData -], done) -``` - -It is always good practice to `return callback(err, result)` whenever a callback call is not the last statement of a function. - - -### Binding a context to an iterator - -This section is really about `bind`, not about `async`. If you are wondering how to -make `async` execute your iterators in a given context, or are confused as to why -a method of another library isn't working as an iterator, study this example: - -```js -// Here is a simple object with an (unnecessarily roundabout) squaring method -var AsyncSquaringLibrary = { - squareExponent: 2, - square: function(number, callback){ - var result = Math.pow(number, this.squareExponent); - setTimeout(function(){ - callback(null, result); - }, 200); - } -}; - -async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ - // result is [NaN, NaN, NaN] - // This fails because the `this.squareExponent` expression in the square - // function is not evaluated in the context of AsyncSquaringLibrary, and is - // therefore undefined. -}); - -async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ - // result is [1, 4, 9] - // With the help of bind we can attach a context to the iterator before - // passing it to async. Now the square function will be executed in its - // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` - // will be as expected. -}); -``` - -## Download - -The source is available for download from -[GitHub](https://github.com/caolan/async/blob/master/lib/async.js). -Alternatively, you can install using Node Package Manager (`npm`): - - npm install async - -As well as using Bower: - - bower install async - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed - -## In the Browser - -So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. - -Usage: - -```html - - -``` - -## Documentation - -Some functions are also available in the following forms: -* `Series` - the same as `` but runs only a single async operation at a time -* `Limit` - the same as `` but runs a maximum of `limit` async operations at a time - -### Collections - -* [`each`](#each), `eachSeries`, `eachLimit` -* [`forEachOf`](#forEachOf), `forEachOfSeries`, `forEachOfLimit` -* [`map`](#map), `mapSeries`, `mapLimit` -* [`filter`](#filter), `filterSeries`, `filterLimit` -* [`reject`](#reject), `rejectSeries`, `rejectLimit` -* [`reduce`](#reduce), [`reduceRight`](#reduceRight) -* [`detect`](#detect), `detectSeries`, `detectLimit` -* [`sortBy`](#sortBy) -* [`some`](#some), `someLimit` -* [`every`](#every), `everyLimit` -* [`concat`](#concat), `concatSeries` - -### Control Flow - -* [`series`](#seriestasks-callback) -* [`parallel`](#parallel), `parallelLimit` -* [`whilst`](#whilst), [`doWhilst`](#doWhilst) -* [`until`](#until), [`doUntil`](#doUntil) -* [`during`](#during), [`doDuring`](#doDuring) -* [`forever`](#forever) -* [`waterfall`](#waterfall) -* [`compose`](#compose) -* [`seq`](#seq) -* [`applyEach`](#applyEach), `applyEachSeries` -* [`queue`](#queue), [`priorityQueue`](#priorityQueue) -* [`cargo`](#cargo) -* [`auto`](#auto) -* [`retry`](#retry) -* [`iterator`](#iterator) -* [`times`](#times), `timesSeries`, `timesLimit` - -### Utils - -* [`apply`](#apply) -* [`nextTick`](#nextTick) -* [`memoize`](#memoize) -* [`unmemoize`](#unmemoize) -* [`ensureAsync`](#ensureAsync) -* [`constant`](#constant) -* [`asyncify`](#asyncify) -* [`wrapSync`](#wrapSync) -* [`log`](#log) -* [`dir`](#dir) -* [`noConflict`](#noConflict) - -## Collections - - - -### each(arr, iterator, [callback]) - -Applies the function `iterator` to each item in `arr`, in parallel. -The `iterator` is called with an item from the list, and a callback for when it -has finished. If the `iterator` passes an error to its `callback`, the main -`callback` (for the `each` function) is immediately called with the error. - -Note, that since this function applies `iterator` to each item in parallel, -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occurred, the `callback` should be run without - arguments or with an explicit `null` argument. The array index is not passed - to the iterator. If you need the index, use [`forEachOf`](#forEachOf). -* `callback(err)` - *Optional* A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Examples__ - - -```js -// assuming openFiles is an array of file names and saveFile is a function -// to save the modified contents of that file: - -async.each(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - -```js -// assuming openFiles is an array of file names - -async.each(openFiles, function(file, callback) { - - // Perform operation on file here. - console.log('Processing file ' + file); - - if( file.length > 32 ) { - console.log('This file name is too long'); - callback('File name too long'); - } else { - // Do work to process file here - console.log('File processed'); - callback(); - } -}, function(err){ - // if any of the file processing produced an error, err would equal that error - if( err ) { - // One of the iterations produced an error. - // All processing will now stop. - console.log('A file failed to process'); - } else { - console.log('All files have been processed successfully'); - } -}); -``` - -__Related__ - -* eachSeries(arr, iterator, [callback]) -* eachLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - - - -### forEachOf(obj, iterator, [callback]) - -Like `each`, except that it iterates over objects, and passes the key as the second argument to the iterator. - -__Arguments__ - -* `obj` - An object or array to iterate over. -* `iterator(item, key, callback)` - A function to apply to each item in `obj`. -The `key` is the item's key, or index in the case of an array. The iterator is -passed a `callback(err)` which must be called once it has completed. If no -error has occurred, the callback should be run without arguments or with an -explicit `null` argument. -* `callback(err)` - *Optional* A callback which is called when all `iterator` functions have finished, or an error occurs. - -__Example__ - -```js -var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; -var configs = {}; - -async.forEachOf(obj, function (value, key, callback) { - fs.readFile(__dirname + value, "utf8", function (err, data) { - if (err) return callback(err); - try { - configs[key] = JSON.parse(data); - } catch (e) { - return callback(e); - } - callback(); - }) -}, function (err) { - if (err) console.error(err.message); - // configs is now a map of JSON data - doSomethingWith(configs); -}) -``` - -__Related__ - -* forEachOfSeries(obj, iterator, [callback]) -* forEachOfLimit(obj, limit, iterator, [callback]) - ---------------------------------------- - - -### map(arr, iterator, [callback]) - -Produces a new array of values by mapping each value in `arr` through -the `iterator` function. The `iterator` is called with an item from `arr` and a -callback for when it has finished processing. Each of these callback takes 2 arguments: -an `error`, and the transformed item from `arr`. If `iterator` passes an error to its -callback, the main `callback` (for the `map` function) is immediately called with the error. - -Note, that since this function applies the `iterator` to each item in parallel, -there is no guarantee that the `iterator` functions will complete in order. -However, the results array will be in the same order as the original `arr`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - *Optional* A callback which is called when all `iterator` - functions have finished, or an error occurs. Results is an array of the - transformed items from the `arr`. - -__Example__ - -```js -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - -__Related__ -* mapSeries(arr, iterator, [callback]) -* mapLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - - -### filter(arr, iterator, [callback]) - -__Alias:__ `select` - -Returns a new array of all the values in `arr` which pass an async truth test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The `iterator` is passed a `callback(truthValue)`, which must be called with a - boolean argument once it has completed. -* `callback(results)` - *Optional* A callback which is called after all the `iterator` - functions have finished. - -__Example__ - -```js -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); -``` - -__Related__ - -* filterSeries(arr, iterator, [callback]) -* filterLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - -### reject(arr, iterator, [callback]) - -The opposite of [`filter`](#filter). Removes values that pass an `async` truth test. - -__Related__ - -* rejectSeries(arr, iterator, [callback]) -* rejectLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - -### reduce(arr, memo, iterator, [callback]) - -__Aliases:__ `inject`, `foldl` - -Reduces `arr` into a single value using an async `iterator` to return -each successive step. `memo` is the initial state of the reduction. -This function only operates in series. - -For performance reasons, it may make sense to split a call to this function into -a parallel map, and then use the normal `Array.prototype.reduce` on the results. -This function is for situations where each step in the reduction needs to be async; -if you can get the data before reducing it, then it's probably a good idea to do so. - -__Arguments__ - -* `arr` - An array to iterate over. -* `memo` - The initial state of the reduction. -* `iterator(memo, item, callback)` - A function applied to each item in the - array to produce the next step in the reduction. The `iterator` is passed a - `callback(err, reduction)` which accepts an optional error as its first - argument, and the state of the reduction as the second. If an error is - passed to the callback, the reduction is stopped and the main `callback` is - immediately called with the error. -* `callback(err, result)` - *Optional* A callback which is called after all the `iterator` - functions have finished. Result is the reduced value. - -__Example__ - -```js -async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); -}, function(err, result){ - // result is now equal to the last value of memo, which is 6 -}); -``` - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, [callback]) - -__Alias:__ `foldr` - -Same as [`reduce`](#reduce), only operates on `arr` in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, [callback]) - -Returns the first value in `arr` that passes an async truth test. The -`iterator` is applied in parallel, meaning the first iterator to return `true` will -fire the detect `callback` with that result. That means the result might not be -the first item in the original `arr` (in terms of order) that passes the test. - -If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries). - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The iterator is passed a `callback(truthValue)` which must be called with a - boolean argument once it has completed. **Note: this callback does not take an error as its first argument.** -* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns - `true`, or after all the `iterator` functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value `undefined` if none passed. **Note: this callback does not take an error as its first argument.** - -__Example__ - -```js -async.detect(['file1','file2','file3'], fs.exists, function(result){ - // result now equals the first file in the list that exists -}); -``` - -__Related__ - -* detectSeries(arr, iterator, [callback]) -* detectLimit(arr, limit, iterator, [callback]) - ---------------------------------------- - - -### sortBy(arr, iterator, [callback]) - -Sorts a list by the results of running each `arr` value through an async `iterator`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, sortValue)` which must be called once it - has completed with an error (which can be `null`) and a value to use as the sort - criteria. -* `callback(err, results)` - *Optional* A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is the items from - the original `arr` sorted by the values returned by the `iterator` calls. - -__Example__ - -```js -async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); -}, function(err, results){ - // results is now the original array of files sorted by - // modified date -}); -``` - -__Sort Order__ - -By modifying the callback parameter the sorting order can be influenced: - -```js -//ascending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(null, x); -}, function(err,result){ - //result callback -} ); - -//descending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(null, x*-1); //<- x*-1 instead of x, turns the order around -}, function(err,result){ - //result callback -} ); -``` - ---------------------------------------- - - -### some(arr, iterator, [callback]) - -__Alias:__ `any` - -Returns `true` if at least one element in the `arr` satisfies an async test. -_The callback for each iterator call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. Once any iterator -call returns `true`, the main `callback` is immediately called. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a `callback(truthValue)`` which must be - called with a boolean argument once it has completed. -* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns - `true`, or after all the iterator functions have finished. Result will be - either `true` or `false` depending on the values of the async tests. - - **Note: the callbacks do not take an error as their first argument.** -__Example__ - -```js -async.some(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then at least one of the files exists -}); -``` - -__Related__ - -* someLimit(arr, limit, iterator, callback) - ---------------------------------------- - - -### every(arr, iterator, [callback]) - -__Alias:__ `all` - -Returns `true` if every element in `arr` satisfies an async test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a `callback(truthValue)` which must be - called with a boolean argument once it has completed. -* `callback(result)` - *Optional* A callback which is called as soon as any iterator returns - `false`, or after all the iterator functions have finished. Result will be - either `true` or `false` depending on the values of the async tests. - - **Note: the callbacks do not take an error as their first argument.** - -__Example__ - -```js -async.every(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then every file exists -}); -``` - -__Related__ - -* everyLimit(arr, limit, iterator, callback) - ---------------------------------------- - - -### concat(arr, iterator, [callback]) - -Applies `iterator` to each item in `arr`, concatenating the results. Returns the -concatenated list. The `iterator`s are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of `arr` passed to the `iterator` function. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, results)` which must be called once it - has completed with an error (which can be `null`) and an array of results. -* `callback(err, results)` - *Optional* A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is an array containing - the concatenated results of the `iterator` function. - -__Example__ - -```js -async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories -}); -``` - -__Related__ - -* concatSeries(arr, iterator, [callback]) - - -## Control Flow - - -### series(tasks, [callback]) - -Run the functions in the `tasks` array in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run, and `callback` is immediately called with the value of the error. -Otherwise, `callback` receives an array of results when `tasks` have completed. - -It is also possible to use an object instead of an array. Each property will be -run as a function, and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`series`](#series). - -**Note** that while many implementations preserve the order of object properties, the -[ECMAScript Language Specification](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) -explicitly states that - -> The mechanics and order of enumerating the properties is not specified. - -So if you rely on the order in which your series of functions are executed, and want -this to work on all platforms, consider using an array. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - -__Example__ - -```js -async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - } -], -// optional callback -function(err, results){ - // results is now equal to ['one', 'two'] -}); - - -// an example using an object instead of an array -async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equal to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run the `tasks` array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main `callback` is immediately called with the value of the error. -Once the `tasks` have completed, the results are passed to the final `callback` as an -array. - -**Note:** `parallel` is about kicking-off I/O tasks in parallel, not about parallel execution of code. If your tasks do not use any timers or perform any I/O, they will actually be executed in series. Any synchronous setup sections for each task will happen one after the other. JavaScript remains single-threaded. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`parallel`](#parallel). - - -__Arguments__ - -* `tasks` - An array or object containing functions to run. Each function is passed - a `callback(err, result)` which it must call on completion with an error `err` - (which can be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed successfully. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - } -], -// optional callback -function(err, results){ - // the results array will equal ['one','two'] even though - // the second function had a shorter timeout. -}); - - -// an example using an object instead of an array -async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equals to: {one: 1, two: 2} -}); -``` - -__Related__ - -* parallelLimit(tasks, limit, [callback]) - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -__Arguments__ - -* `test()` - synchronous truth test to perform before each execution of `fn`. -* `fn(callback)` - A function which is called each time `test` passes. The function is - passed a `callback(err)`, which must be called once it has completed with an - optional `err` argument. -* `callback(err, [results])` - A callback which is called after the test - function has failed and repeated execution of `fn` has stopped. `callback` - will be passed an error and any arguments passed to the final `fn`'s callback. - -__Example__ - -```js -var count = 0; - -async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(function () { - callback(null, count); - }, 1000); - }, - function (err, n) { - // 5 seconds have passed, n = 5 - } -); -``` - ---------------------------------------- - - -### doWhilst(fn, test, callback) - -The post-check version of [`whilst`](#whilst). To reflect the difference in -the order of operations, the arguments `test` and `fn` are switched. - -`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped, -or an error occurs. `callback` will be passed an error and any arguments passed -to the final `fn`'s callback. - -The inverse of [`whilst`](#whilst). - ---------------------------------------- - - -### doUntil(fn, test, callback) - -Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`. - ---------------------------------------- - - -### during(test, fn, callback) - -Like [`whilst`](#whilst), except the `test` is an asynchronous function that is passed a callback in the form of `function (err, truth)`. If error is passed to `test` or `fn`, the main callback is immediately called with the value of the error. - -__Example__ - -```js -var count = 0; - -async.during( - function (callback) { - return callback(null, count < 5); - }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } -); -``` - ---------------------------------------- - - -### doDuring(fn, test, callback) - -The post-check version of [`during`](#during). To reflect the difference in -the order of operations, the arguments `test` and `fn` are switched. - -Also a version of [`doWhilst`](#doWhilst) with asynchronous `test` function. - ---------------------------------------- - - -### forever(fn, [errback]) - -Calls the asynchronous function `fn` with a callback parameter that allows it to -call itself again, in series, indefinitely. - -If an error is passed to the callback then `errback` is called with the -error, and execution stops, otherwise it will never be called. - -```js -async.forever( - function(next) { - // next is suitable for passing to things that need a callback(err [, whatever]); - // it will result in this function being called again. - }, - function(err) { - // if next is called with a value in its first parameter, it will appear - // in here as 'err', and execution will stop. - } -); -``` - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs the `tasks` array of functions in series, each passing their results to the next in -the array. However, if any of the `tasks` pass an error to their own callback, the -next function is not executed, and the main `callback` is immediately called with -the error. - -__Arguments__ - -* `tasks` - An array of functions to run, each function is passed a - `callback(err, result1, result2, ...)` it must call on completion. The first - argument is an error (which can be `null`) and any further arguments will be - passed as arguments in order to the next task. -* `callback(err, [results])` - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - -```js -async.waterfall([ - function(callback) { - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback) { - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); - }, - function(arg1, callback) { - // arg1 now equals 'three' - callback(null, 'done'); - } -], function (err, result) { - // result now equals 'done' -}); -``` -Or, with named functions: - -```js -async.waterfall([ - myFirstFunction, - mySecondFunction, - myLastFunction, -], function (err, result) { - // result now equals 'done' -}); -function myFirstFunction(callback) { - callback(null, 'one', 'two'); -} -function mySecondFunction(arg1, arg2, callback) { - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); -} -function myLastFunction(arg1, callback) { - // arg1 now equals 'three' - callback(null, 'done'); -} -``` - -Or, if you need to pass any argument to the first function: - -```js -async.waterfall([ - async.apply(myFirstFunction, 'zero'), - mySecondFunction, - myLastFunction, -], function (err, result) { - // result now equals 'done' -}); -function myFirstFunction(arg1, callback) { - // arg1 now equals 'zero' - callback(null, 'one', 'two'); -} -function mySecondFunction(arg1, arg2, callback) { - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); -} -function myLastFunction(arg1, callback) { - // arg1 now equals 'three' - callback(null, 'done'); -} -``` - ---------------------------------------- - -### compose(fn1, fn2...) - -Creates a function which is a composition of the passed asynchronous -functions. Each function consumes the return value of the function that -follows. Composing functions `f()`, `g()`, and `h()` would produce the result of -`f(g(h()))`, only this version uses callbacks to obtain the return values. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* `functions...` - the asynchronous functions to compose - - -__Example__ - -```js -function add1(n, callback) { - setTimeout(function () { - callback(null, n + 1); - }, 10); -} - -function mul3(n, callback) { - setTimeout(function () { - callback(null, n * 3); - }, 10); -} - -var add1mul3 = async.compose(mul3, add1); - -add1mul3(4, function (err, result) { - // result now equals 15 -}); -``` - ---------------------------------------- - -### seq(fn1, fn2...) - -Version of the compose function that is more natural to read. -Each function consumes the return value of the previous function. -It is the equivalent of [`compose`](#compose) with the arguments reversed. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* `functions...` - the asynchronous functions to compose - - -__Example__ - -```js -// Requires lodash (or underscore), express3 and dresende's orm2. -// Part of an app, that fetches cats of the logged user. -// This example uses `seq` function to avoid overnesting and error -// handling clutter. -app.get('/cats', function(request, response) { - var User = request.models.User; - async.seq( - _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - function(user, fn) { - user.getCats(fn); // 'getCats' has signature (callback(err, data)) - } - )(req.session.user_id, function (err, cats) { - if (err) { - console.error(err); - response.json({ status: 'error', message: err.message }); - } else { - response.json({ status: 'ok', message: 'Cats found', data: cats }); - } - }); -}); -``` - ---------------------------------------- - -### applyEach(fns, args..., callback) - -Applies the provided arguments to each function in the array, calling -`callback` after all functions have completed. If you only provide the first -argument, then it will return a function which lets you pass in the -arguments as if it were a single function call. - -__Arguments__ - -* `fns` - the asynchronous functions to all call with the same arguments -* `args...` - any number of separate arguments to pass to the function -* `callback` - the final argument should be the callback, called when all - functions have completed processing - - -__Example__ - -```js -async.applyEach([enableSearch, updateSchema], 'bucket', callback); - -// partial application example: -async.each( - buckets, - async.applyEach([enableSearch, updateSchema]), - callback -); -``` - -__Related__ - -* applyEachSeries(tasks, args..., [callback]) - ---------------------------------------- - - -### queue(worker, [concurrency]) - -Creates a `queue` object with the specified `concurrency`. Tasks added to the -`queue` are processed in parallel (up to the `concurrency` limit). If all -`worker`s are in progress, the task is queued until one becomes available. -Once a `worker` completes a `task`, that `task`'s callback is called. - -__Arguments__ - -* `worker(task, callback)` - An asynchronous function for processing a queued - task, which must call its `callback(err)` argument when finished, with an - optional `error` as an argument. If you want to handle errors from an individual task, pass a callback to `q.push()`. -* `concurrency` - An `integer` for determining how many `worker` functions should be - run in parallel. If omitted, the concurrency defaults to `1`. If the concurrency is `0`, an error is thrown. - -__Queue objects__ - -The `queue` object returned by this function has the following properties and -methods: - -* `length()` - a function returning the number of items waiting to be processed. -* `started` - a function returning whether or not any items have been pushed and processed by the queue -* `running()` - a function returning the number of items currently being processed. -* `workersList()` - a function returning the array of items currently being processed. -* `idle()` - a function returning false if there are items waiting or being processed, or true if not. -* `concurrency` - an integer for determining how many `worker` functions should be - run in parallel. This property can be changed after a `queue` is created to - alter the concurrency on-the-fly. -* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once - the `worker` has finished processing the task. Instead of a single task, a `tasks` array - can be submitted. The respective callback is used for every task in the list. -* `unshift(task, [callback])` - add a new task to the front of the `queue`. -* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, - and further tasks will be queued. -* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`. -* `paused` - a boolean for determining whether the queue is in a paused state -* `pause()` - a function that pauses the processing of tasks until `resume()` is called. -* `resume()` - a function that resumes the processing of queued tasks when the queue is paused. -* `kill()` - a function that removes the `drain` callback and empties remaining tasks from the queue forcing it to go idle. - -__Example__ - -```js -// create a queue object with concurrency 2 - -var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -// assign a callback -q.drain = function() { - console.log('all items have been processed'); -} - -// add some items to the queue - -q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); - -// add some items to the queue (batch-wise) - -q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing item'); -}); - -// add some items to the front of the queue - -q.unshift({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -``` - - ---------------------------------------- - - -### priorityQueue(worker, concurrency) - -The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects: - -* `push(task, priority, [callback])` - `priority` should be a number. If an array of - `tasks` is given, all tasks will be assigned the same priority. -* The `unshift` method was removed. - ---------------------------------------- - - -### cargo(worker, [payload]) - -Creates a `cargo` object with the specified payload. Tasks added to the -cargo will be processed altogether (up to the `payload` limit). If the -`worker` is in progress, the task is queued until it becomes available. Once -the `worker` has completed some tasks, each callback of those tasks is called. -Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) for how `cargo` and `queue` work. - -While [queue](#queue) passes only one task to one of a group of workers -at a time, cargo passes an array of tasks to a single worker, repeating -when the worker is finished. - -__Arguments__ - -* `worker(tasks, callback)` - An asynchronous function for processing an array of - queued tasks, which must call its `callback(err)` argument when finished, with - an optional `err` argument. -* `payload` - An optional `integer` for determining how many tasks should be - processed per round; if omitted, the default is unlimited. - -__Cargo objects__ - -The `cargo` object returned by this function has the following properties and -methods: - -* `length()` - A function returning the number of items waiting to be processed. -* `payload` - An `integer` for determining how many tasks should be - process per round. This property can be changed after a `cargo` is created to - alter the payload on-the-fly. -* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called - once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` - can be submitted. The respective callback is used for every task in the list. -* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued. -* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`. -* `idle()`, `pause()`, `resume()`, `kill()` - cargo inherits all of the same methods and event calbacks as [`queue`](#queue) - -__Example__ - -```js -// create a cargo object with payload 2 - -var cargo = async.cargo(function (tasks, callback) { - for(var i=0; i -### auto(tasks, [concurrency], [callback]) - -Determines the best order for running the functions in `tasks`, based on their requirements. Each function can optionally depend on other functions being completed first, and each function is run as soon as its requirements are satisfied. - -If any of the functions pass an error to their callback, the `auto` sequence will stop. Further tasks will not execute (so any other functions depending on it will not run), and the main `callback` is immediately called with the error. Functions also receive an object containing the results of functions which have completed so far. - -Note, all functions are called with a `results` object as a second argument, -so it is unsafe to pass functions in the `tasks` object which cannot handle the -extra argument. - -For example, this snippet of code: - -```js -async.auto({ - readData: async.apply(fs.readFile, 'data.txt', 'utf-8') -}, callback); -``` - -will have the effect of calling `readFile` with the results object as the last -argument, which will fail: - -```js -fs.readFile('data.txt', 'utf-8', cb, {}); -``` - -Instead, wrap the call to `readFile` in a function which does not forward the -`results` object: - -```js -async.auto({ - readData: function(cb, results){ - fs.readFile('data.txt', 'utf-8', cb); - } -}, callback); -``` - -__Arguments__ - -* `tasks` - An object. Each of its properties is either a function or an array of - requirements, with the function itself the last item in the array. The object's key - of a property serves as the name of the task defined by that property, - i.e. can be used when specifying requirements for other tasks. - The function receives two arguments: (1) a `callback(err, result)` which must be - called when finished, passing an `error` (which can be `null`) and the result of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions. -* `concurrency` - An optional `integer` for determining the maximum number of tasks that can be run in parallel. By default, as many as possible. -* `callback(err, results)` - An optional callback which is called when all the - tasks have been completed. It receives the `err` argument if any `tasks` - pass an error to their callback. Results are always returned; however, if - an error occurs, no further `tasks` will be performed, and the results - object will only contain partial results. - - -__Example__ - -```js -async.auto({ - get_data: function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - make_folder: function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - }, - write_file: ['get_data', 'make_folder', function(callback, results){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, 'filename'); - }], - email_link: ['write_file', function(callback, results){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - callback(null, {'file':results.write_file, 'email':'user@example.com'}); - }] -}, function(err, results) { - console.log('err = ', err); - console.log('results = ', results); -}); -``` - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - -```js -async.parallel([ - function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - } -], -function(err, results){ - async.series([ - function(callback){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - results.push('filename'); - callback(null); - }, - function(callback){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - callback(null, {'file':results.pop(), 'email':'user@example.com'}); - } - ]); -}); -``` - -For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding -new tasks much easier (and the code more readable). - - ---------------------------------------- - - -### retry([opts = {times: 5, interval: 0}| 5], task, [callback]) - -Attempts to get a successful response from `task` no more than `times` times before -returning an error. If the task is successful, the `callback` will be passed the result -of the successful task. If all attempts fail, the callback will be passed the error and -result (if any) of the final attempt. - -__Arguments__ - -* `opts` - Can be either an object with `times` and `interval` or a number. - * `times` - The number of attempts to make before giving up. The default is `5`. - * `interval` - The time to wait between retries, in milliseconds. The default is `0`. - * If `opts` is a number, the number specifies the number of times to retry, with the default interval of `0`. -* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)` - which must be called when finished, passing `err` (which can be `null`) and the `result` of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions (if nested inside another control flow). -* `callback(err, results)` - An optional callback which is called when the - task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`. - -The [`retry`](#retry) function can be used as a stand-alone control flow by passing a callback, as shown below: - -```js -// try calling apiMethod 3 times -async.retry(3, apiMethod, function(err, result) { - // do something with the result -}); -``` - -```js -// try calling apiMethod 3 times, waiting 200 ms between each retry -async.retry({times: 3, interval: 200}, apiMethod, function(err, result) { - // do something with the result -}); -``` - -```js -// try calling apiMethod the default 5 times no delay between each retry -async.retry(apiMethod, function(err, result) { - // do something with the result -}); -``` - -It can also be embedded within other control flow functions to retry individual methods -that are not as reliable, like this: - -```js -async.auto({ - users: api.getUsers.bind(api), - payments: async.retry(3, api.getPayments.bind(api)) -}, function(err, results) { - // do something with the results -}); -``` - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the `tasks` array, -returning a continuation to call the next one after that. It's also possible to -“peek” at the next iterator with `iterator.next()`. - -This function is used internally by the `async` module, but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* `tasks` - An array of functions to run. - -__Example__ - -```js -var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } -]); - -node> var iterator2 = iterator(); -'one' -node> var iterator3 = iterator2(); -'two' -node> iterator3(); -'three' -node> var nextfn = iterator2.next(); -node> nextfn(); -'three' -``` - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied. - -Useful as a shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - -```js -// using apply - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -// the same process without using apply - -async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - } -]); -``` - -It's possible to pass any number of additional arguments when calling the -continuation: - -```js -node> var fn = async.apply(sys.puts, 'one'); -node> fn('two', 'three'); -one -two -three -``` - ---------------------------------------- - - -### nextTick(callback), setImmediate(callback) - -Calls `callback` on a later loop around the event loop. In Node.js this just -calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` -if available, otherwise `setTimeout(callback, 0)`, which means other higher priority -events may precede the execution of `callback`. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* `callback` - The function to call on a later loop around the event loop. - -__Example__ - -```js -var call_order = []; -async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two'] -}); -call_order.push('one') -``` - - -### times(n, iterator, [callback]) - -Calls the `iterator` function `n` times, and accumulates results in the same manner -you would use with [`map`](#map). - -__Arguments__ - -* `n` - The number of times to run the function. -* `iterator` - The function to call `n` times. -* `callback` - see [`map`](#map) - -__Example__ - -```js -// Pretend this is some complicated async factory -var createUser = function(id, callback) { - callback(null, { - id: 'user' + id - }) -} -// generate 5 users -async.times(5, function(n, next){ - createUser(n, function(err, user) { - next(err, user) - }) -}, function(err, users) { - // we should now have 5 users -}); -``` - -__Related__ - -* timesSeries(n, iterator, [callback]) -* timesLimit(n, limit, iterator, [callback]) - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an `async` function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -If no hash function is specified, the first argument is used as a hash key, which may work reasonably if it is a string or a data type that converts to a distinct string. Note that objects and arrays will not behave reasonably. Neither will cases where the other arguments are significant. In such cases, specify your own hash function. - -The cache of results is exposed as the `memo` property of the function returned -by `memoize`. - -__Arguments__ - -* `fn` - The function to proxy and cache results from. -* `hasher` - An optional function for generating a custom hash for storing - results. It has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - -```js -var slow_fn = function (name, callback) { - // do something - callback(null, result); -}; -var fn = async.memoize(slow_fn); - -// fn can now be used as if it were slow_fn -fn('some name', function () { - // callback -}); -``` - - -### unmemoize(fn) - -Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized -form. Handy for testing. - -__Arguments__ - -* `fn` - the memoized function - ---------------------------------------- - - -### ensureAsync(fn) - -Wrap an async function and ensure it calls its callback on a later tick of the event loop. If the function already calls its callback on a next tick, no extra deferral is added. This is useful for preventing stack overflows (`RangeError: Maximum call stack size exceeded`) and generally keeping [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) contained. - -__Arguments__ - -* `fn` - an async function, one that expects a node-style callback as its last argument - -Returns a wrapped function with the exact same call signature as the function passed in. - -__Example__ - -```js -function sometimesAsync(arg, callback) { - if (cache[arg]) { - return callback(null, cache[arg]); // this would be synchronous!! - } else { - doSomeIO(arg, callback); // this IO would be asynchronous - } -} - -// this has a risk of stack overflows if many results are cached in a row -async.mapSeries(args, sometimesAsync, done); - -// this will defer sometimesAsync's callback if necessary, -// preventing stack overflows -async.mapSeries(args, async.ensureAsync(sometimesAsync), done); - -``` - ---------------------------------------- - - -### constant(values...) - -Returns a function that when called, calls-back with the values provided. Useful as the first function in a `waterfall`, or for plugging values in to `auto`. - -__Example__ - -```js -async.waterfall([ - async.constant(42), - function (value, next) { - // value === 42 - }, - //... -], callback); - -async.waterfall([ - async.constant(filename, "utf8"), - fs.readFile, - function (fileData, next) { - //... - } - //... -], callback); - -async.auto({ - hostname: async.constant("https://server.net/"), - port: findFreePort, - launchServer: ["hostname", "port", function (cb, options) { - startServer(options, cb); - }], - //... -}, callback); - -``` - ---------------------------------------- - - - -### asyncify(func) - -__Alias:__ `wrapSync` - -Take a sync function and make it async, passing its return value to a callback. This is useful for plugging sync functions into a waterfall, series, or other async functions. Any arguments passed to the generated function will be passed to the wrapped function (except for the final callback argument). Errors thrown will be passed to the callback. - -__Example__ - -```js -async.waterfall([ - async.apply(fs.readFile, filename, "utf8"), - async.asyncify(JSON.parse), - function (data, next) { - // data is the result of parsing the text. - // If there was a parsing error, it would have been caught. - } -], callback) -``` - -If the function passed to `asyncify` returns a Promise, that promises's resolved/rejected state will be used to call the callback, rather than simply the synchronous return value. Example: - -```js -async.waterfall([ - async.apply(fs.readFile, filename, "utf8"), - async.asyncify(function (contents) { - return db.model.create(contents); - }), - function (model, next) { - // `model` is the instantiated model object. - // If there was an error, this function would be skipped. - } -], callback) -``` - -This also means you can asyncify ES2016 `async` functions. - -```js -var q = async.queue(async.asyncify(async function (file) { - var intermediateStep = await processFile(file); - return await somePromise(intermediateStep) -})); - -q.push(files); -``` - ---------------------------------------- - - -### log(function, arguments) - -Logs the result of an `async` function to the `console`. Only works in Node.js or -in browsers that support `console.log` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.log` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); -}; -``` -```js -node> async.log(hello, 'world'); -'hello world' -``` - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an `async` function to the `console` using `console.dir` to -display the properties of the resulting object. Only works in Node.js or -in browsers that support `console.dir` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.dir` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); -}; -``` -```js -node> async.dir(hello, 'world'); -{hello: 'world'} -``` - ---------------------------------------- - - -### noConflict() - -Changes the value of `async` back to its original value, returning a reference to the -`async` object. diff --git a/APIs/node_modules/request/node_modules/form-data/node_modules/async/dist/async.js b/APIs/node_modules/request/node_modules/form-data/node_modules/async/dist/async.js deleted file mode 100644 index 31e7620f..00000000 --- a/APIs/node_modules/request/node_modules/form-data/node_modules/async/dist/async.js +++ /dev/null @@ -1,1265 +0,0 @@ -/*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2014 Caolan McMahon - * Released under the MIT license - */ -(function () { - - var async = {}; - function noop() {} - function identity(v) { - return v; - } - function toBool(v) { - return !!v; - } - function notId(v) { - return !v; - } - - // global on the server, window in the browser - var previous_async; - - // Establish the root object, `window` (`self`) in the browser, `global` - // on the server, or `this` in some virtual machines. We use `self` - // instead of `window` for `WebWorker` support. - var root = typeof self === 'object' && self.self === self && self || - typeof global === 'object' && global.global === global && global || - this; - - if (root != null) { - previous_async = root.async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - return function() { - if (fn === null) throw new Error("Callback was already called."); - fn.apply(this, arguments); - fn = null; - }; - } - - function _once(fn) { - return function() { - if (fn === null) return; - fn.apply(this, arguments); - fn = null; - }; - } - - //// cross-browser compatiblity functions //// - - var _toString = Object.prototype.toString; - - var _isArray = Array.isArray || function (obj) { - return _toString.call(obj) === '[object Array]'; - }; - - // Ported from underscore.js isObject - var _isObject = function(obj) { - var type = typeof obj; - return type === 'function' || type === 'object' && !!obj; - }; - - function _isArrayLike(arr) { - return _isArray(arr) || ( - // has a positive integer length property - typeof arr.length === "number" && - arr.length >= 0 && - arr.length % 1 === 0 - ); - } - - function _arrayEach(arr, iterator) { - var index = -1, - length = arr.length; - - while (++index < length) { - iterator(arr[index], index, arr); - } - } - - function _map(arr, iterator) { - var index = -1, - length = arr.length, - result = Array(length); - - while (++index < length) { - result[index] = iterator(arr[index], index, arr); - } - return result; - } - - function _range(count) { - return _map(Array(count), function (v, i) { return i; }); - } - - function _reduce(arr, iterator, memo) { - _arrayEach(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - } - - function _forEachOf(object, iterator) { - _arrayEach(_keys(object), function (key) { - iterator(object[key], key); - }); - } - - function _indexOf(arr, item) { - for (var i = 0; i < arr.length; i++) { - if (arr[i] === item) return i; - } - return -1; - } - - var _keys = Object.keys || function (obj) { - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - function _keyIterator(coll) { - var i = -1; - var len; - var keys; - if (_isArrayLike(coll)) { - len = coll.length; - return function next() { - i++; - return i < len ? i : null; - }; - } else { - keys = _keys(coll); - len = keys.length; - return function next() { - i++; - return i < len ? keys[i] : null; - }; - } - } - - // Similar to ES6's rest param (http://ariya.ofilabs.com/2013/03/es6-and-rest-parameter.html) - // This accumulates the arguments passed into an array, after a given index. - // From underscore.js (https://github.com/jashkenas/underscore/pull/2140). - function _restParam(func, startIndex) { - startIndex = startIndex == null ? func.length - 1 : +startIndex; - return function() { - var length = Math.max(arguments.length - startIndex, 0); - var rest = Array(length); - for (var index = 0; index < length; index++) { - rest[index] = arguments[index + startIndex]; - } - switch (startIndex) { - case 0: return func.call(this, rest); - case 1: return func.call(this, arguments[0], rest); - } - // Currently unused but handle cases outside of the switch statement: - // var args = Array(startIndex + 1); - // for (index = 0; index < startIndex; index++) { - // args[index] = arguments[index]; - // } - // args[startIndex] = rest; - // return func.apply(this, args); - }; - } - - function _withoutIndex(iterator) { - return function (value, index, callback) { - return iterator(value, callback); - }; - } - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - - // capture the global reference to guard against fakeTimer mocks - var _setImmediate = typeof setImmediate === 'function' && setImmediate; - - var _delay = _setImmediate ? function(fn) { - // not a direct alias for IE10 compatibility - _setImmediate(fn); - } : function(fn) { - setTimeout(fn, 0); - }; - - if (typeof process === 'object' && typeof process.nextTick === 'function') { - async.nextTick = process.nextTick; - } else { - async.nextTick = _delay; - } - async.setImmediate = _setImmediate ? _delay : async.nextTick; - - - async.forEach = - async.each = function (arr, iterator, callback) { - return async.eachOf(arr, _withoutIndex(iterator), callback); - }; - - async.forEachSeries = - async.eachSeries = function (arr, iterator, callback) { - return async.eachOfSeries(arr, _withoutIndex(iterator), callback); - }; - - - async.forEachLimit = - async.eachLimit = function (arr, limit, iterator, callback) { - return _eachOfLimit(limit)(arr, _withoutIndex(iterator), callback); - }; - - async.forEachOf = - async.eachOf = function (object, iterator, callback) { - callback = _once(callback || noop); - object = object || []; - - var iter = _keyIterator(object); - var key, completed = 0; - - while ((key = iter()) != null) { - completed += 1; - iterator(object[key], key, only_once(done)); - } - - if (completed === 0) callback(null); - - function done(err) { - completed--; - if (err) { - callback(err); - } - // Check key is null in case iterator isn't exhausted - // and done resolved synchronously. - else if (key === null && completed <= 0) { - callback(null); - } - } - }; - - async.forEachOfSeries = - async.eachOfSeries = function (obj, iterator, callback) { - callback = _once(callback || noop); - obj = obj || []; - var nextKey = _keyIterator(obj); - var key = nextKey(); - function iterate() { - var sync = true; - if (key === null) { - return callback(null); - } - iterator(obj[key], key, only_once(function (err) { - if (err) { - callback(err); - } - else { - key = nextKey(); - if (key === null) { - return callback(null); - } else { - if (sync) { - async.setImmediate(iterate); - } else { - iterate(); - } - } - } - })); - sync = false; - } - iterate(); - }; - - - - async.forEachOfLimit = - async.eachOfLimit = function (obj, limit, iterator, callback) { - _eachOfLimit(limit)(obj, iterator, callback); - }; - - function _eachOfLimit(limit) { - - return function (obj, iterator, callback) { - callback = _once(callback || noop); - obj = obj || []; - var nextKey = _keyIterator(obj); - if (limit <= 0) { - return callback(null); - } - var done = false; - var running = 0; - var errored = false; - - (function replenish () { - if (done && running <= 0) { - return callback(null); - } - - while (running < limit && !errored) { - var key = nextKey(); - if (key === null) { - done = true; - if (running <= 0) { - callback(null); - } - return; - } - running += 1; - iterator(obj[key], key, only_once(function (err) { - running -= 1; - if (err) { - callback(err); - errored = true; - } - else { - replenish(); - } - })); - } - })(); - }; - } - - - function doParallel(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOf, obj, iterator, callback); - }; - } - function doParallelLimit(fn) { - return function (obj, limit, iterator, callback) { - return fn(_eachOfLimit(limit), obj, iterator, callback); - }; - } - function doSeries(fn) { - return function (obj, iterator, callback) { - return fn(async.eachOfSeries, obj, iterator, callback); - }; - } - - function _asyncMap(eachfn, arr, iterator, callback) { - callback = _once(callback || noop); - arr = arr || []; - var results = _isArrayLike(arr) ? [] : {}; - eachfn(arr, function (value, index, callback) { - iterator(value, function (err, v) { - results[index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = doParallelLimit(_asyncMap); - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.inject = - async.foldl = - async.reduce = function (arr, memo, iterator, callback) { - async.eachOfSeries(arr, function (x, i, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - - async.foldr = - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, identity).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - - async.transform = function (arr, memo, iterator, callback) { - if (arguments.length === 3) { - callback = iterator; - iterator = memo; - memo = _isArray(arr) ? [] : {}; - } - - async.eachOf(arr, function(v, k, cb) { - iterator(memo, v, k, cb); - }, function(err) { - callback(err, memo); - }); - }; - - function _filter(eachfn, arr, iterator, callback) { - var results = []; - eachfn(arr, function (x, index, callback) { - iterator(x, function (v) { - if (v) { - results.push({index: index, value: x}); - } - callback(); - }); - }, function () { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - } - - async.select = - async.filter = doParallel(_filter); - - async.selectLimit = - async.filterLimit = doParallelLimit(_filter); - - async.selectSeries = - async.filterSeries = doSeries(_filter); - - function _reject(eachfn, arr, iterator, callback) { - _filter(eachfn, arr, function(value, cb) { - iterator(value, function(v) { - cb(!v); - }); - }, callback); - } - async.reject = doParallel(_reject); - async.rejectLimit = doParallelLimit(_reject); - async.rejectSeries = doSeries(_reject); - - function _createTester(eachfn, check, getResult) { - return function(arr, limit, iterator, cb) { - function done() { - if (cb) cb(getResult(false, void 0)); - } - function iteratee(x, _, callback) { - if (!cb) return callback(); - iterator(x, function (v) { - if (cb && check(v)) { - cb(getResult(true, x)); - cb = iterator = false; - } - callback(); - }); - } - if (arguments.length > 3) { - eachfn(arr, limit, iteratee, done); - } else { - cb = iterator; - iterator = limit; - eachfn(arr, iteratee, done); - } - }; - } - - async.any = - async.some = _createTester(async.eachOf, toBool, identity); - - async.someLimit = _createTester(async.eachOfLimit, toBool, identity); - - async.all = - async.every = _createTester(async.eachOf, notId, notId); - - async.everyLimit = _createTester(async.eachOfLimit, notId, notId); - - function _findGetResult(v, x) { - return x; - } - async.detect = _createTester(async.eachOf, identity, _findGetResult); - async.detectSeries = _createTester(async.eachOfSeries, identity, _findGetResult); - async.detectLimit = _createTester(async.eachOfLimit, identity, _findGetResult); - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - callback(null, _map(results.sort(comparator), function (x) { - return x.value; - })); - } - - }); - - function comparator(left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - } - }; - - async.auto = function (tasks, concurrency, callback) { - if (typeof arguments[1] === 'function') { - // concurrency is optional, shift the args. - callback = concurrency; - concurrency = null; - } - callback = _once(callback || noop); - var keys = _keys(tasks); - var remainingTasks = keys.length; - if (!remainingTasks) { - return callback(null); - } - if (!concurrency) { - concurrency = remainingTasks; - } - - var results = {}; - var runningTasks = 0; - - var hasError = false; - - var listeners = []; - function addListener(fn) { - listeners.unshift(fn); - } - function removeListener(fn) { - var idx = _indexOf(listeners, fn); - if (idx >= 0) listeners.splice(idx, 1); - } - function taskComplete() { - remainingTasks--; - _arrayEach(listeners.slice(0), function (fn) { - fn(); - }); - } - - addListener(function () { - if (!remainingTasks) { - callback(null, results); - } - }); - - _arrayEach(keys, function (k) { - if (hasError) return; - var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; - var taskCallback = _restParam(function(err, args) { - runningTasks--; - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _forEachOf(results, function(val, rkey) { - safeResults[rkey] = val; - }); - safeResults[k] = args; - hasError = true; - - callback(err, safeResults); - } - else { - results[k] = args; - async.setImmediate(taskComplete); - } - }); - var requires = task.slice(0, task.length - 1); - // prevent dead-locks - var len = requires.length; - var dep; - while (len--) { - if (!(dep = tasks[requires[len]])) { - throw new Error('Has nonexistent dependency in ' + requires.join(', ')); - } - if (_isArray(dep) && _indexOf(dep, k) >= 0) { - throw new Error('Has cyclic dependencies'); - } - } - function ready() { - return runningTasks < concurrency && _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); - } - if (ready()) { - runningTasks++; - task[task.length - 1](taskCallback, results); - } - else { - addListener(listener); - } - function listener() { - if (ready()) { - runningTasks++; - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - } - }); - }; - - - - async.retry = function(times, task, callback) { - var DEFAULT_TIMES = 5; - var DEFAULT_INTERVAL = 0; - - var attempts = []; - - var opts = { - times: DEFAULT_TIMES, - interval: DEFAULT_INTERVAL - }; - - function parseTimes(acc, t){ - if(typeof t === 'number'){ - acc.times = parseInt(t, 10) || DEFAULT_TIMES; - } else if(typeof t === 'object'){ - acc.times = parseInt(t.times, 10) || DEFAULT_TIMES; - acc.interval = parseInt(t.interval, 10) || DEFAULT_INTERVAL; - } else { - throw new Error('Unsupported argument type for \'times\': ' + typeof t); - } - } - - var length = arguments.length; - if (length < 1 || length > 3) { - throw new Error('Invalid arguments - must be either (task), (task, callback), (times, task) or (times, task, callback)'); - } else if (length <= 2 && typeof times === 'function') { - callback = task; - task = times; - } - if (typeof times !== 'function') { - parseTimes(opts, times); - } - opts.callback = callback; - opts.task = task; - - function wrappedTask(wrappedCallback, wrappedResults) { - function retryAttempt(task, finalAttempt) { - return function(seriesCallback) { - task(function(err, result){ - seriesCallback(!err || finalAttempt, {err: err, result: result}); - }, wrappedResults); - }; - } - - function retryInterval(interval){ - return function(seriesCallback){ - setTimeout(function(){ - seriesCallback(null); - }, interval); - }; - } - - while (opts.times) { - - var finalAttempt = !(opts.times-=1); - attempts.push(retryAttempt(opts.task, finalAttempt)); - if(!finalAttempt && opts.interval > 0){ - attempts.push(retryInterval(opts.interval)); - } - } - - async.series(attempts, function(done, data){ - data = data[data.length - 1]; - (wrappedCallback || opts.callback)(data.err, data.result); - }); - } - - // If a callback is passed, run this as a controll flow - return opts.callback ? wrappedTask() : wrappedTask; - }; - - async.waterfall = function (tasks, callback) { - callback = _once(callback || noop); - if (!_isArray(tasks)) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - function wrapIterator(iterator) { - return _restParam(function (err, args) { - if (err) { - callback.apply(null, [err].concat(args)); - } - else { - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - ensureAsync(iterator).apply(null, args); - } - }); - } - wrapIterator(async.iterator(tasks))(); - }; - - function _parallel(eachfn, tasks, callback) { - callback = callback || noop; - var results = _isArrayLike(tasks) ? [] : {}; - - eachfn(tasks, function (task, key, callback) { - task(_restParam(function (err, args) { - if (args.length <= 1) { - args = args[0]; - } - results[key] = args; - callback(err); - })); - }, function (err) { - callback(err, results); - }); - } - - async.parallel = function (tasks, callback) { - _parallel(async.eachOf, tasks, callback); - }; - - async.parallelLimit = function(tasks, limit, callback) { - _parallel(_eachOfLimit(limit), tasks, callback); - }; - - async.series = function(tasks, callback) { - _parallel(async.eachOfSeries, tasks, callback); - }; - - async.iterator = function (tasks) { - function makeCallback(index) { - function fn() { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - } - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - } - return makeCallback(0); - }; - - async.apply = _restParam(function (fn, args) { - return _restParam(function (callArgs) { - return fn.apply( - null, args.concat(callArgs) - ); - }); - }); - - function _concat(eachfn, arr, fn, callback) { - var result = []; - eachfn(arr, function (x, index, cb) { - fn(x, function (err, y) { - result = result.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, result); - }); - } - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - callback = callback || noop; - if (test()) { - var next = _restParam(function(err, args) { - if (err) { - callback(err); - } else if (test.apply(this, args)) { - iterator(next); - } else { - callback.apply(null, [null].concat(args)); - } - }); - iterator(next); - } else { - callback(null); - } - }; - - async.doWhilst = function (iterator, test, callback) { - var calls = 0; - return async.whilst(function() { - return ++calls <= 1 || test.apply(this, arguments); - }, iterator, callback); - }; - - async.until = function (test, iterator, callback) { - return async.whilst(function() { - return !test.apply(this, arguments); - }, iterator, callback); - }; - - async.doUntil = function (iterator, test, callback) { - return async.doWhilst(iterator, function() { - return !test.apply(this, arguments); - }, callback); - }; - - async.during = function (test, iterator, callback) { - callback = callback || noop; - - var next = _restParam(function(err, args) { - if (err) { - callback(err); - } else { - args.push(check); - test.apply(this, args); - } - }); - - var check = function(err, truth) { - if (err) { - callback(err); - } else if (truth) { - iterator(next); - } else { - callback(null); - } - }; - - test(check); - }; - - async.doDuring = function (iterator, test, callback) { - var calls = 0; - async.during(function(next) { - if (calls++ < 1) { - next(null, true); - } else { - test.apply(this, arguments); - } - }, iterator, callback); - }; - - function _queue(worker, concurrency, payload) { - if (concurrency == null) { - concurrency = 1; - } - else if(concurrency === 0) { - throw new Error('Concurrency must not be zero'); - } - function _insert(q, data, pos, callback) { - if (callback != null && typeof callback !== "function") { - throw new Error("task callback must be a function"); - } - q.started = true; - if (!_isArray(data)) { - data = [data]; - } - if(data.length === 0 && q.idle()) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - q.drain(); - }); - } - _arrayEach(data, function(task) { - var item = { - data: task, - callback: callback || noop - }; - - if (pos) { - q.tasks.unshift(item); - } else { - q.tasks.push(item); - } - - if (q.tasks.length === q.concurrency) { - q.saturated(); - } - }); - async.setImmediate(q.process); - } - function _next(q, tasks) { - return function(){ - workers -= 1; - - var removed = false; - var args = arguments; - _arrayEach(tasks, function (task) { - _arrayEach(workersList, function (worker, index) { - if (worker === task && !removed) { - workersList.splice(index, 1); - removed = true; - } - }); - - task.callback.apply(task, args); - }); - if (q.tasks.length + workers === 0) { - q.drain(); - } - q.process(); - }; - } - - var workers = 0; - var workersList = []; - var q = { - tasks: [], - concurrency: concurrency, - payload: payload, - saturated: noop, - empty: noop, - drain: noop, - started: false, - paused: false, - push: function (data, callback) { - _insert(q, data, false, callback); - }, - kill: function () { - q.drain = noop; - q.tasks = []; - }, - unshift: function (data, callback) { - _insert(q, data, true, callback); - }, - process: function () { - while(!q.paused && workers < q.concurrency && q.tasks.length){ - - var tasks = q.payload ? - q.tasks.splice(0, q.payload) : - q.tasks.splice(0, q.tasks.length); - - var data = _map(tasks, function (task) { - return task.data; - }); - - if (q.tasks.length === 0) { - q.empty(); - } - workers += 1; - workersList.push(tasks[0]); - var cb = only_once(_next(q, tasks)); - worker(data, cb); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - }, - workersList: function () { - return workersList; - }, - idle: function() { - return q.tasks.length + workers === 0; - }, - pause: function () { - q.paused = true; - }, - resume: function () { - if (q.paused === false) { return; } - q.paused = false; - var resumeCount = Math.min(q.concurrency, q.tasks.length); - // Need to call q.process once per concurrent - // worker to preserve full concurrency after pause - for (var w = 1; w <= resumeCount; w++) { - async.setImmediate(q.process); - } - } - }; - return q; - } - - async.queue = function (worker, concurrency) { - var q = _queue(function (items, cb) { - worker(items[0], cb); - }, concurrency, 1); - - return q; - }; - - async.priorityQueue = function (worker, concurrency) { - - function _compareTasks(a, b){ - return a.priority - b.priority; - } - - function _binarySearch(sequence, item, compare) { - var beg = -1, - end = sequence.length - 1; - while (beg < end) { - var mid = beg + ((end - beg + 1) >>> 1); - if (compare(item, sequence[mid]) >= 0) { - beg = mid; - } else { - end = mid - 1; - } - } - return beg; - } - - function _insert(q, data, priority, callback) { - if (callback != null && typeof callback !== "function") { - throw new Error("task callback must be a function"); - } - q.started = true; - if (!_isArray(data)) { - data = [data]; - } - if(data.length === 0) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - q.drain(); - }); - } - _arrayEach(data, function(task) { - var item = { - data: task, - priority: priority, - callback: typeof callback === 'function' ? callback : noop - }; - - q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); - - if (q.tasks.length === q.concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - // Start with a normal queue - var q = async.queue(worker, concurrency); - - // Override push to accept second parameter representing priority - q.push = function (data, priority, callback) { - _insert(q, data, priority, callback); - }; - - // Remove unshift function - delete q.unshift; - - return q; - }; - - async.cargo = function (worker, payload) { - return _queue(worker, 1, payload); - }; - - function _console_fn(name) { - return _restParam(function (fn, args) { - fn.apply(null, args.concat([_restParam(function (err, args) { - if (typeof console === 'object') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _arrayEach(args, function (x) { - console[name](x); - }); - } - } - })])); - }); - } - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - var has = Object.prototype.hasOwnProperty; - hasher = hasher || identity; - var memoized = _restParam(function memoized(args) { - var callback = args.pop(); - var key = hasher.apply(null, args); - if (has.call(memo, key)) { - async.setImmediate(function () { - callback.apply(null, memo[key]); - }); - } - else if (has.call(queues, key)) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([_restParam(function (args) { - memo[key] = args; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, args); - } - })])); - } - }); - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; - - function _times(mapper) { - return function (count, iterator, callback) { - mapper(_range(count), iterator, callback); - }; - } - - async.times = _times(async.map); - async.timesSeries = _times(async.mapSeries); - async.timesLimit = function (count, limit, iterator, callback) { - return async.mapLimit(_range(count), limit, iterator, callback); - }; - - async.seq = function (/* functions... */) { - var fns = arguments; - return _restParam(function (args) { - var that = this; - - var callback = args[args.length - 1]; - if (typeof callback == 'function') { - args.pop(); - } else { - callback = noop; - } - - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([_restParam(function (err, nextargs) { - cb(err, nextargs); - })])); - }, - function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }); - }; - - async.compose = function (/* functions... */) { - return async.seq.apply(null, Array.prototype.reverse.call(arguments)); - }; - - - function _applyEach(eachfn) { - return _restParam(function(fns, args) { - var go = _restParam(function(args) { - var that = this; - var callback = args.pop(); - return eachfn(fns, function (fn, _, cb) { - fn.apply(that, args.concat([cb])); - }, - callback); - }); - if (args.length) { - return go.apply(this, args); - } - else { - return go; - } - }); - } - - async.applyEach = _applyEach(async.eachOf); - async.applyEachSeries = _applyEach(async.eachOfSeries); - - - async.forever = function (fn, callback) { - var done = only_once(callback || noop); - var task = ensureAsync(fn); - function next(err) { - if (err) { - return done(err); - } - task(next); - } - next(); - }; - - function ensureAsync(fn) { - return _restParam(function (args) { - var callback = args.pop(); - args.push(function () { - var innerArgs = arguments; - if (sync) { - async.setImmediate(function () { - callback.apply(null, innerArgs); - }); - } else { - callback.apply(null, innerArgs); - } - }); - var sync = true; - fn.apply(this, args); - sync = false; - }); - } - - async.ensureAsync = ensureAsync; - - async.constant = _restParam(function(values) { - var args = [null].concat(values); - return function (callback) { - return callback.apply(this, args); - }; - }); - - async.wrapSync = - async.asyncify = function asyncify(func) { - return _restParam(function (args) { - var callback = args.pop(); - var result; - try { - result = func.apply(this, args); - } catch (e) { - return callback(e); - } - // if result is Promise object - if (_isObject(result) && typeof result.then === "function") { - result.then(function(value) { - callback(null, value); - })["catch"](function(err) { - callback(err.message ? err : new Error(err)); - }); - } else { - callback(null, result); - } - }); - }; - - // Node.js - if (typeof module === 'object' && module.exports) { - module.exports = async; - } - // AMD / RequireJS - else if (typeof define === 'function' && define.amd) { - define([], function () { - return async; - }); - } - // included directly via '); - expect(encoded).to.equal('\\x3cscript\\x3ealert\\x281\\x29\\x3c\\x2fscript\\x3e'); - done(); - }); - - it('encodes \' characters', function (done) { - - var encoded = Hoek.escapeJavaScript('something(\'param\')'); - expect(encoded).to.equal('something\\x28\\x27param\\x27\\x29'); - done(); - }); - - it('encodes large unicode characters with the correct padding', function (done) { - - var encoded = Hoek.escapeJavaScript(String.fromCharCode(500) + String.fromCharCode(1000)); - expect(encoded).to.equal('\\u0500\\u1000'); - done(); - }); - - it('doesn\'t throw an exception when passed null', function (done) { - - var encoded = Hoek.escapeJavaScript(null); - expect(encoded).to.equal(''); - done(); - }); -}); - -describe('escapeHtml()', function () { - - it('encodes / characters', function (done) { - - var encoded = Hoek.escapeHtml(''); - expect(encoded).to.equal('<script>alert(1)</script>'); - done(); - }); - - it('encodes < and > as named characters', function (done) { - - var encoded = Hoek.escapeHtml(' - - \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js deleted file mode 100644 index 664c1b45..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/example.js +++ /dev/null @@ -1,3 +0,0 @@ -var BigInteger = require('./'); -var a = new BigInteger('91823918239182398123'); -console.log(a.bitLength()); \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js deleted file mode 100644 index e32fe13d..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/index.js +++ /dev/null @@ -1,1358 +0,0 @@ -(function(){ - - // Copyright (c) 2005 Tom Wu - // All Rights Reserved. - // See "LICENSE" for details. - - // Basic JavaScript BN library - subset useful for RSA encryption. - - // Bits per digit - var dbits; - - // JavaScript engine analysis - var canary = 0xdeadbeefcafe; - var j_lm = ((canary&0xffffff)==0xefcafe); - - // (public) Constructor - function BigInteger(a,b,c) { - if(a != null) - if("number" == typeof a) this.fromNumber(a,b,c); - else if(b == null && "string" != typeof a) this.fromString(a,256); - else this.fromString(a,b); - } - - // return new, unset BigInteger - function nbi() { return new BigInteger(null); } - - // am: Compute w_j += (x*this_i), propagate carries, - // c is initial carry, returns final carry. - // c < 3*dvalue, x < 2*dvalue, this_i < dvalue - // We need to select the fastest one that works in this environment. - - // am1: use a single mult and divide to get the high bits, - // max digit bits should be 26 because - // max internal value = 2*dvalue^2-2*dvalue (< 2^53) - function am1(i,x,w,j,c,n) { - while(--n >= 0) { - var v = x*this[i++]+w[j]+c; - c = Math.floor(v/0x4000000); - w[j++] = v&0x3ffffff; - } - return c; - } - // am2 avoids a big mult-and-extract completely. - // Max digit bits should be <= 30 because we do bitwise ops - // on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) - function am2(i,x,w,j,c,n) { - var xl = x&0x7fff, xh = x>>15; - while(--n >= 0) { - var l = this[i]&0x7fff; - var h = this[i++]>>15; - var m = xh*l+h*xl; - l = xl*l+((m&0x7fff)<<15)+w[j]+(c&0x3fffffff); - c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); - w[j++] = l&0x3fffffff; - } - return c; - } - // Alternately, set max digit bits to 28 since some - // browsers slow down when dealing with 32-bit numbers. - function am3(i,x,w,j,c,n) { - var xl = x&0x3fff, xh = x>>14; - while(--n >= 0) { - var l = this[i]&0x3fff; - var h = this[i++]>>14; - var m = xh*l+h*xl; - l = xl*l+((m&0x3fff)<<14)+w[j]+c; - c = (l>>28)+(m>>14)+xh*h; - w[j++] = l&0xfffffff; - } - return c; - } - var inBrowser = typeof navigator !== "undefined"; - if(inBrowser && j_lm && (navigator.appName == "Microsoft Internet Explorer")) { - BigInteger.prototype.am = am2; - dbits = 30; - } - else if(inBrowser && j_lm && (navigator.appName != "Netscape")) { - BigInteger.prototype.am = am1; - dbits = 26; - } - else { // Mozilla/Netscape seems to prefer am3 - BigInteger.prototype.am = am3; - dbits = 28; - } - - BigInteger.prototype.DB = dbits; - BigInteger.prototype.DM = ((1<= 0; --i) r[i] = this[i]; - r.t = this.t; - r.s = this.s; - } - - // (protected) set from integer value x, -DV <= x < DV - function bnpFromInt(x) { - this.t = 1; - this.s = (x<0)?-1:0; - if(x > 0) this[0] = x; - else if(x < -1) this[0] = x+this.DV; - else this.t = 0; - } - - // return bigint initialized to value - function nbv(i) { var r = nbi(); r.fromInt(i); return r; } - - // (protected) set from string and radix - function bnpFromString(s,b) { - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 256) k = 8; // byte array - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else { this.fromRadix(s,b); return; } - this.t = 0; - this.s = 0; - var i = s.length, mi = false, sh = 0; - while(--i >= 0) { - var x = (k==8)?s[i]&0xff:intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-") mi = true; - continue; - } - mi = false; - if(sh == 0) - this[this.t++] = x; - else if(sh+k > this.DB) { - this[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); - } - else - this[this.t-1] |= x<= this.DB) sh -= this.DB; - } - if(k == 8 && (s[0]&0x80) != 0) { - this.s = -1; - if(sh > 0) this[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this[this.t-1] == c) --this.t; - } - - // (public) return string representation in given radix - function bnToString(b) { - if(this.s < 0) return "-"+this.negate().toString(b); - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else return this.toRadix(b); - var km = (1< 0) { - if(p < this.DB && (d = this[i]>>p) > 0) { m = true; r = int2char(d); } - while(i >= 0) { - if(p < k) { - d = (this[i]&((1<>(p+=this.DB-k); - } - else { - d = (this[i]>>(p-=k))&km; - if(p <= 0) { p += this.DB; --i; } - } - if(d > 0) m = true; - if(m) r += int2char(d); - } - } - return m?r:"0"; - } - - // (public) -this - function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } - - // (public) |this| - function bnAbs() { return (this.s<0)?this.negate():this; } - - // (public) return + if this > a, - if this < a, 0 if equal - function bnCompareTo(a) { - var r = this.s-a.s; - if(r != 0) return r; - var i = this.t; - r = i-a.t; - if(r != 0) return (this.s<0)?-r:r; - while(--i >= 0) if((r=this[i]-a[i]) != 0) return r; - return 0; - } - - // returns bit length of the integer x - function nbits(x) { - var r = 1, t; - if((t=x>>>16) != 0) { x = t; r += 16; } - if((t=x>>8) != 0) { x = t; r += 8; } - if((t=x>>4) != 0) { x = t; r += 4; } - if((t=x>>2) != 0) { x = t; r += 2; } - if((t=x>>1) != 0) { x = t; r += 1; } - return r; - } - - // (public) return the number of bits in "this" - function bnBitLength() { - if(this.t <= 0) return 0; - return this.DB*(this.t-1)+nbits(this[this.t-1]^(this.s&this.DM)); - } - - // (protected) r = this << n*DB - function bnpDLShiftTo(n,r) { - var i; - for(i = this.t-1; i >= 0; --i) r[i+n] = this[i]; - for(i = n-1; i >= 0; --i) r[i] = 0; - r.t = this.t+n; - r.s = this.s; - } - - // (protected) r = this >> n*DB - function bnpDRShiftTo(n,r) { - for(var i = n; i < this.t; ++i) r[i-n] = this[i]; - r.t = Math.max(this.t-n,0); - r.s = this.s; - } - - // (protected) r = this << n - function bnpLShiftTo(n,r) { - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<= 0; --i) { - r[i+ds+1] = (this[i]>>cbs)|c; - c = (this[i]&bm)<= 0; --i) r[i] = 0; - r[ds] = c; - r.t = this.t+ds+1; - r.s = this.s; - r.clamp(); - } - - // (protected) r = this >> n - function bnpRShiftTo(n,r) { - r.s = this.s; - var ds = Math.floor(n/this.DB); - if(ds >= this.t) { r.t = 0; return; } - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<>bs; - for(var i = ds+1; i < this.t; ++i) { - r[i-ds-1] |= (this[i]&bm)<>bs; - } - if(bs > 0) r[this.t-ds-1] |= (this.s&bm)<>= this.DB; - } - if(a.t < this.t) { - c -= a.s; - while(i < this.t) { - c += this[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; - } - else { - c += this.s; - while(i < a.t) { - c -= a[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c -= a.s; - } - r.s = (c<0)?-1:0; - if(c < -1) r[i++] = this.DV+c; - else if(c > 0) r[i++] = c; - r.t = i; - r.clamp(); - } - - // (protected) r = this * a, r != this,a (HAC 14.12) - // "this" should be the larger one if appropriate. - function bnpMultiplyTo(a,r) { - var x = this.abs(), y = a.abs(); - var i = x.t; - r.t = i+y.t; - while(--i >= 0) r[i] = 0; - for(i = 0; i < y.t; ++i) r[i+x.t] = x.am(0,y[i],r,i,0,x.t); - r.s = 0; - r.clamp(); - if(this.s != a.s) BigInteger.ZERO.subTo(r,r); - } - - // (protected) r = this^2, r != this (HAC 14.16) - function bnpSquareTo(r) { - var x = this.abs(); - var i = r.t = 2*x.t; - while(--i >= 0) r[i] = 0; - for(i = 0; i < x.t-1; ++i) { - var c = x.am(i,x[i],r,2*i,0,1); - if((r[i+x.t]+=x.am(i+1,2*x[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { - r[i+x.t] -= x.DV; - r[i+x.t+1] = 1; - } - } - if(r.t > 0) r[r.t-1] += x.am(i,x[i],r,2*i,0,1); - r.s = 0; - r.clamp(); - } - - // (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) - // r != q, this != m. q or r may be null. - function bnpDivRemTo(m,q,r) { - var pm = m.abs(); - if(pm.t <= 0) return; - var pt = this.abs(); - if(pt.t < pm.t) { - if(q != null) q.fromInt(0); - if(r != null) this.copyTo(r); - return; - } - if(r == null) r = nbi(); - var y = nbi(), ts = this.s, ms = m.s; - var nsh = this.DB-nbits(pm[pm.t-1]); // normalize modulus - if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } - else { pm.copyTo(y); pt.copyTo(r); } - var ys = y.t; - var y0 = y[ys-1]; - if(y0 == 0) return; - var yt = y0*(1<1)?y[ys-2]>>this.F2:0); - var d1 = this.FV/yt, d2 = (1<= 0) { - r[r.t++] = 1; - r.subTo(t,r); - } - BigInteger.ONE.dlShiftTo(ys,t); - t.subTo(y,y); // "negative" y so we can replace sub with am later - while(y.t < ys) y[y.t++] = 0; - while(--j >= 0) { - // Estimate quotient digit - var qd = (r[--i]==y0)?this.DM:Math.floor(r[i]*d1+(r[i-1]+e)*d2); - if((r[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out - y.dlShiftTo(j,t); - r.subTo(t,r); - while(r[i] < --qd) r.subTo(t,r); - } - } - if(q != null) { - r.drShiftTo(ys,q); - if(ts != ms) BigInteger.ZERO.subTo(q,q); - } - r.t = ys; - r.clamp(); - if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder - if(ts < 0) BigInteger.ZERO.subTo(r,r); - } - - // (public) this mod a - function bnMod(a) { - var r = nbi(); - this.abs().divRemTo(a,null,r); - if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); - return r; - } - - // Modular reduction using "classic" algorithm - function Classic(m) { this.m = m; } - function cConvert(x) { - if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); - else return x; - } - function cRevert(x) { return x; } - function cReduce(x) { x.divRemTo(this.m,null,x); } - function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - - Classic.prototype.convert = cConvert; - Classic.prototype.revert = cRevert; - Classic.prototype.reduce = cReduce; - Classic.prototype.mulTo = cMulTo; - Classic.prototype.sqrTo = cSqrTo; - - // (protected) return "-1/this % 2^DB"; useful for Mont. reduction - // justification: - // xy == 1 (mod m) - // xy = 1+km - // xy(2-xy) = (1+km)(1-km) - // x[y(2-xy)] = 1-k^2m^2 - // x[y(2-xy)] == 1 (mod m^2) - // if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 - // should reduce x and y(2-xy) by m^2 at each step to keep size bounded. - // JS multiply "overflows" differently from C/C++, so care is needed here. - function bnpInvDigit() { - if(this.t < 1) return 0; - var x = this[0]; - if((x&1) == 0) return 0; - var y = x&3; // y == 1/x mod 2^2 - y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 - y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 - y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 - // last step - calculate inverse mod DV directly; - // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints - y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits - // we really want the negative inverse, and -DV < y < DV - return (y>0)?this.DV-y:-y; - } - - // Montgomery reduction - function Montgomery(m) { - this.m = m; - this.mp = m.invDigit(); - this.mpl = this.mp&0x7fff; - this.mph = this.mp>>15; - this.um = (1<<(m.DB-15))-1; - this.mt2 = 2*m.t; - } - - // xR mod m - function montConvert(x) { - var r = nbi(); - x.abs().dlShiftTo(this.m.t,r); - r.divRemTo(this.m,null,r); - if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); - return r; - } - - // x/R mod m - function montRevert(x) { - var r = nbi(); - x.copyTo(r); - this.reduce(r); - return r; - } - - // x = x/R mod m (HAC 14.32) - function montReduce(x) { - while(x.t <= this.mt2) // pad x so am has enough room later - x[x.t++] = 0; - for(var i = 0; i < this.m.t; ++i) { - // faster way of calculating u0 = x[i]*mp mod DV - var j = x[i]&0x7fff; - var u0 = (j*this.mpl+(((j*this.mph+(x[i]>>15)*this.mpl)&this.um)<<15))&x.DM; - // use am to combine the multiply-shift-add into one call - j = i+this.m.t; - x[j] += this.m.am(0,u0,x,i,0,this.m.t); - // propagate carry - while(x[j] >= x.DV) { x[j] -= x.DV; x[++j]++; } - } - x.clamp(); - x.drShiftTo(this.m.t,x); - if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); - } - - // r = "x^2/R mod m"; x != r - function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - - // r = "xy/R mod m"; x,y != r - function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - - Montgomery.prototype.convert = montConvert; - Montgomery.prototype.revert = montRevert; - Montgomery.prototype.reduce = montReduce; - Montgomery.prototype.mulTo = montMulTo; - Montgomery.prototype.sqrTo = montSqrTo; - - // (protected) true iff this is even - function bnpIsEven() { return ((this.t>0)?(this[0]&1):this.s) == 0; } - - // (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) - function bnpExp(e,z) { - if(e > 0xffffffff || e < 1) return BigInteger.ONE; - var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; - g.copyTo(r); - while(--i >= 0) { - z.sqrTo(r,r2); - if((e&(1< 0) z.mulTo(r2,g,r); - else { var t = r; r = r2; r2 = t; } - } - return z.revert(r); - } - - // (public) this^e % m, 0 <= e < 2^32 - function bnModPowInt(e,m) { - var z; - if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); - return this.exp(e,z); - } - - // protected - BigInteger.prototype.copyTo = bnpCopyTo; - BigInteger.prototype.fromInt = bnpFromInt; - BigInteger.prototype.fromString = bnpFromString; - BigInteger.prototype.clamp = bnpClamp; - BigInteger.prototype.dlShiftTo = bnpDLShiftTo; - BigInteger.prototype.drShiftTo = bnpDRShiftTo; - BigInteger.prototype.lShiftTo = bnpLShiftTo; - BigInteger.prototype.rShiftTo = bnpRShiftTo; - BigInteger.prototype.subTo = bnpSubTo; - BigInteger.prototype.multiplyTo = bnpMultiplyTo; - BigInteger.prototype.squareTo = bnpSquareTo; - BigInteger.prototype.divRemTo = bnpDivRemTo; - BigInteger.prototype.invDigit = bnpInvDigit; - BigInteger.prototype.isEven = bnpIsEven; - BigInteger.prototype.exp = bnpExp; - - // public - BigInteger.prototype.toString = bnToString; - BigInteger.prototype.negate = bnNegate; - BigInteger.prototype.abs = bnAbs; - BigInteger.prototype.compareTo = bnCompareTo; - BigInteger.prototype.bitLength = bnBitLength; - BigInteger.prototype.mod = bnMod; - BigInteger.prototype.modPowInt = bnModPowInt; - - // "constants" - BigInteger.ZERO = nbv(0); - BigInteger.ONE = nbv(1); - - // Copyright (c) 2005-2009 Tom Wu - // All Rights Reserved. - // See "LICENSE" for details. - - // Extended JavaScript BN functions, required for RSA private ops. - - // Version 1.1: new BigInteger("0", 10) returns "proper" zero - // Version 1.2: square() API, isProbablePrime fix - - // (public) - function bnClone() { var r = nbi(); this.copyTo(r); return r; } - - // (public) return value as integer - function bnIntValue() { - if(this.s < 0) { - if(this.t == 1) return this[0]-this.DV; - else if(this.t == 0) return -1; - } - else if(this.t == 1) return this[0]; - else if(this.t == 0) return 0; - // assumes 16 < DB < 32 - return ((this[1]&((1<<(32-this.DB))-1))<>24; } - - // (public) return value as short (assumes DB>=16) - function bnShortValue() { return (this.t==0)?this.s:(this[0]<<16)>>16; } - - // (protected) return x s.t. r^x < DV - function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } - - // (public) 0 if this == 0, 1 if this > 0 - function bnSigNum() { - if(this.s < 0) return -1; - else if(this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; - else return 1; - } - - // (protected) convert to radix string - function bnpToRadix(b) { - if(b == null) b = 10; - if(this.signum() == 0 || b < 2 || b > 36) return "0"; - var cs = this.chunkSize(b); - var a = Math.pow(b,cs); - var d = nbv(a), y = nbi(), z = nbi(), r = ""; - this.divRemTo(d,y,z); - while(y.signum() > 0) { - r = (a+z.intValue()).toString(b).substr(1) + r; - y.divRemTo(d,y,z); - } - return z.intValue().toString(b) + r; - } - - // (protected) convert from radix string - function bnpFromRadix(s,b) { - this.fromInt(0); - if(b == null) b = 10; - var cs = this.chunkSize(b); - var d = Math.pow(b,cs), mi = false, j = 0, w = 0; - for(var i = 0; i < s.length; ++i) { - var x = intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-" && this.signum() == 0) mi = true; - continue; - } - w = b*w+x; - if(++j >= cs) { - this.dMultiply(d); - this.dAddOffset(w,0); - j = 0; - w = 0; - } - } - if(j > 0) { - this.dMultiply(Math.pow(b,j)); - this.dAddOffset(w,0); - } - if(mi) BigInteger.ZERO.subTo(this,this); - } - - // (protected) alternate constructor - function bnpFromNumber(a,b,c) { - if("number" == typeof b) { - // new BigInteger(int,int,RNG) - if(a < 2) this.fromInt(1); - else { - this.fromNumber(a,c); - if(!this.testBit(a-1)) // force MSB set - this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); - if(this.isEven()) this.dAddOffset(1,0); // force odd - while(!this.isProbablePrime(b)) { - this.dAddOffset(2,0); - if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); - } - } - } - else { - // new BigInteger(int,RNG) - var x = new Array(), t = a&7; - x.length = (a>>3)+1; - b.nextBytes(x); - if(t > 0) x[0] &= ((1< 0) { - if(p < this.DB && (d = this[i]>>p) != (this.s&this.DM)>>p) - r[k++] = d|(this.s<<(this.DB-p)); - while(i >= 0) { - if(p < 8) { - d = (this[i]&((1<>(p+=this.DB-8); - } - else { - d = (this[i]>>(p-=8))&0xff; - if(p <= 0) { p += this.DB; --i; } - } - if((d&0x80) != 0) d |= -256; - if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; - if(k > 0 || d != this.s) r[k++] = d; - } - } - return r; - } - - function bnEquals(a) { return(this.compareTo(a)==0); } - function bnMin(a) { return(this.compareTo(a)<0)?this:a; } - function bnMax(a) { return(this.compareTo(a)>0)?this:a; } - - // (protected) r = this op a (bitwise) - function bnpBitwiseTo(a,op,r) { - var i, f, m = Math.min(a.t,this.t); - for(i = 0; i < m; ++i) r[i] = op(this[i],a[i]); - if(a.t < this.t) { - f = a.s&this.DM; - for(i = m; i < this.t; ++i) r[i] = op(this[i],f); - r.t = this.t; - } - else { - f = this.s&this.DM; - for(i = m; i < a.t; ++i) r[i] = op(f,a[i]); - r.t = a.t; - } - r.s = op(this.s,a.s); - r.clamp(); - } - - // (public) this & a - function op_and(x,y) { return x&y; } - function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } - - // (public) this | a - function op_or(x,y) { return x|y; } - function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } - - // (public) this ^ a - function op_xor(x,y) { return x^y; } - function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } - - // (public) this & ~a - function op_andnot(x,y) { return x&~y; } - function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } - - // (public) ~this - function bnNot() { - var r = nbi(); - for(var i = 0; i < this.t; ++i) r[i] = this.DM&~this[i]; - r.t = this.t; - r.s = ~this.s; - return r; - } - - // (public) this << n - function bnShiftLeft(n) { - var r = nbi(); - if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); - return r; - } - - // (public) this >> n - function bnShiftRight(n) { - var r = nbi(); - if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); - return r; - } - - // return index of lowest 1-bit in x, x < 2^31 - function lbit(x) { - if(x == 0) return -1; - var r = 0; - if((x&0xffff) == 0) { x >>= 16; r += 16; } - if((x&0xff) == 0) { x >>= 8; r += 8; } - if((x&0xf) == 0) { x >>= 4; r += 4; } - if((x&3) == 0) { x >>= 2; r += 2; } - if((x&1) == 0) ++r; - return r; - } - - // (public) returns index of lowest 1-bit (or -1 if none) - function bnGetLowestSetBit() { - for(var i = 0; i < this.t; ++i) - if(this[i] != 0) return i*this.DB+lbit(this[i]); - if(this.s < 0) return this.t*this.DB; - return -1; - } - - // return number of 1 bits in x - function cbit(x) { - var r = 0; - while(x != 0) { x &= x-1; ++r; } - return r; - } - - // (public) return number of set bits - function bnBitCount() { - var r = 0, x = this.s&this.DM; - for(var i = 0; i < this.t; ++i) r += cbit(this[i]^x); - return r; - } - - // (public) true iff nth bit is set - function bnTestBit(n) { - var j = Math.floor(n/this.DB); - if(j >= this.t) return(this.s!=0); - return((this[j]&(1<<(n%this.DB)))!=0); - } - - // (protected) this op (1<>= this.DB; - } - if(a.t < this.t) { - c += a.s; - while(i < this.t) { - c += this[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; - } - else { - c += this.s; - while(i < a.t) { - c += a[i]; - r[i++] = c&this.DM; - c >>= this.DB; - } - c += a.s; - } - r.s = (c<0)?-1:0; - if(c > 0) r[i++] = c; - else if(c < -1) r[i++] = this.DV+c; - r.t = i; - r.clamp(); - } - - // (public) this + a - function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } - - // (public) this - a - function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } - - // (public) this * a - function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } - - // (public) this^2 - function bnSquare() { var r = nbi(); this.squareTo(r); return r; } - - // (public) this / a - function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } - - // (public) this % a - function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } - - // (public) [this/a,this%a] - function bnDivideAndRemainder(a) { - var q = nbi(), r = nbi(); - this.divRemTo(a,q,r); - return new Array(q,r); - } - - // (protected) this *= n, this >= 0, 1 < n < DV - function bnpDMultiply(n) { - this[this.t] = this.am(0,n-1,this,0,0,this.t); - ++this.t; - this.clamp(); - } - - // (protected) this += n << w words, this >= 0 - function bnpDAddOffset(n,w) { - if(n == 0) return; - while(this.t <= w) this[this.t++] = 0; - this[w] += n; - while(this[w] >= this.DV) { - this[w] -= this.DV; - if(++w >= this.t) this[this.t++] = 0; - ++this[w]; - } - } - - // A "null" reducer - function NullExp() {} - function nNop(x) { return x; } - function nMulTo(x,y,r) { x.multiplyTo(y,r); } - function nSqrTo(x,r) { x.squareTo(r); } - - NullExp.prototype.convert = nNop; - NullExp.prototype.revert = nNop; - NullExp.prototype.mulTo = nMulTo; - NullExp.prototype.sqrTo = nSqrTo; - - // (public) this^e - function bnPow(e) { return this.exp(e,new NullExp()); } - - // (protected) r = lower n words of "this * a", a.t <= n - // "this" should be the larger one if appropriate. - function bnpMultiplyLowerTo(a,n,r) { - var i = Math.min(this.t+a.t,n); - r.s = 0; // assumes a,this >= 0 - r.t = i; - while(i > 0) r[--i] = 0; - var j; - for(j = r.t-this.t; i < j; ++i) r[i+this.t] = this.am(0,a[i],r,i,0,this.t); - for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a[i],r,i,0,n-i); - r.clamp(); - } - - // (protected) r = "this * a" without lower n words, n > 0 - // "this" should be the larger one if appropriate. - function bnpMultiplyUpperTo(a,n,r) { - --n; - var i = r.t = this.t+a.t-n; - r.s = 0; // assumes a,this >= 0 - while(--i >= 0) r[i] = 0; - for(i = Math.max(n-this.t,0); i < a.t; ++i) - r[this.t+i-n] = this.am(n-i,a[i],r,0,0,this.t+i-n); - r.clamp(); - r.drShiftTo(1,r); - } - - // Barrett modular reduction - function Barrett(m) { - // setup Barrett - this.r2 = nbi(); - this.q3 = nbi(); - BigInteger.ONE.dlShiftTo(2*m.t,this.r2); - this.mu = this.r2.divide(m); - this.m = m; - } - - function barrettConvert(x) { - if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); - else if(x.compareTo(this.m) < 0) return x; - else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } - } - - function barrettRevert(x) { return x; } - - // x = x mod m (HAC 14.42) - function barrettReduce(x) { - x.drShiftTo(this.m.t-1,this.r2); - if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } - this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); - this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); - while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); - x.subTo(this.r2,x); - while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); - } - - // r = x^2 mod m; x != r - function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - - // r = x*y mod m; x,y != r - function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - - Barrett.prototype.convert = barrettConvert; - Barrett.prototype.revert = barrettRevert; - Barrett.prototype.reduce = barrettReduce; - Barrett.prototype.mulTo = barrettMulTo; - Barrett.prototype.sqrTo = barrettSqrTo; - - // (public) this^e % m (HAC 14.85) - function bnModPow(e,m) { - var i = e.bitLength(), k, r = nbv(1), z; - if(i <= 0) return r; - else if(i < 18) k = 1; - else if(i < 48) k = 3; - else if(i < 144) k = 4; - else if(i < 768) k = 5; - else k = 6; - if(i < 8) - z = new Classic(m); - else if(m.isEven()) - z = new Barrett(m); - else - z = new Montgomery(m); - - // precomputation - var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { - var g2 = nbi(); - z.sqrTo(g[1],g2); - while(n <= km) { - g[n] = nbi(); - z.mulTo(g2,g[n-2],g[n]); - n += 2; - } - } - - var j = e.t-1, w, is1 = true, r2 = nbi(), t; - i = nbits(e[j])-1; - while(j >= 0) { - if(i >= k1) w = (e[j]>>(i-k1))&km; - else { - w = (e[j]&((1<<(i+1))-1))<<(k1-i); - if(j > 0) w |= e[j-1]>>(this.DB+i-k1); - } - - n = k; - while((w&1) == 0) { w >>= 1; --n; } - if((i -= n) < 0) { i += this.DB; --j; } - if(is1) { // ret == 1, don't bother squaring or multiplying it - g[w].copyTo(r); - is1 = false; - } - else { - while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } - if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } - z.mulTo(r2,g[w],r); - } - - while(j >= 0 && (e[j]&(1< 0) { - x.rShiftTo(g,x); - y.rShiftTo(g,y); - } - while(x.signum() > 0) { - if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); - if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); - if(x.compareTo(y) >= 0) { - x.subTo(y,x); - x.rShiftTo(1,x); - } - else { - y.subTo(x,y); - y.rShiftTo(1,y); - } - } - if(g > 0) y.lShiftTo(g,y); - return y; - } - - // (protected) this % n, n < 2^26 - function bnpModInt(n) { - if(n <= 0) return 0; - var d = this.DV%n, r = (this.s<0)?n-1:0; - if(this.t > 0) - if(d == 0) r = this[0]%n; - else for(var i = this.t-1; i >= 0; --i) r = (d*r+this[i])%n; - return r; - } - - // (public) 1/this % m (HAC 14.61) - function bnModInverse(m) { - var ac = m.isEven(); - if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; - var u = m.clone(), v = this.clone(); - var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); - while(u.signum() != 0) { - while(u.isEven()) { - u.rShiftTo(1,u); - if(ac) { - if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } - a.rShiftTo(1,a); - } - else if(!b.isEven()) b.subTo(m,b); - b.rShiftTo(1,b); - } - while(v.isEven()) { - v.rShiftTo(1,v); - if(ac) { - if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } - c.rShiftTo(1,c); - } - else if(!d.isEven()) d.subTo(m,d); - d.rShiftTo(1,d); - } - if(u.compareTo(v) >= 0) { - u.subTo(v,u); - if(ac) a.subTo(c,a); - b.subTo(d,b); - } - else { - v.subTo(u,v); - if(ac) c.subTo(a,c); - d.subTo(b,d); - } - } - if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; - if(d.compareTo(m) >= 0) return d.subtract(m); - if(d.signum() < 0) d.addTo(m,d); else return d; - if(d.signum() < 0) return d.add(m); else return d; - } - - var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; - var lplim = (1<<26)/lowprimes[lowprimes.length-1]; - - // (public) test primality with certainty >= 1-.5^t - function bnIsProbablePrime(t) { - var i, x = this.abs(); - if(x.t == 1 && x[0] <= lowprimes[lowprimes.length-1]) { - for(i = 0; i < lowprimes.length; ++i) - if(x[0] == lowprimes[i]) return true; - return false; - } - if(x.isEven()) return false; - i = 1; - while(i < lowprimes.length) { - var m = lowprimes[i], j = i+1; - while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; - m = x.modInt(m); - while(i < j) if(m%lowprimes[i++] == 0) return false; - } - return x.millerRabin(t); - } - - // (protected) true if probably prime (HAC 4.24, Miller-Rabin) - function bnpMillerRabin(t) { - var n1 = this.subtract(BigInteger.ONE); - var k = n1.getLowestSetBit(); - if(k <= 0) return false; - var r = n1.shiftRight(k); - t = (t+1)>>1; - if(t > lowprimes.length) t = lowprimes.length; - var a = nbi(); - for(var i = 0; i < t; ++i) { - //Pick bases at random, instead of starting at 2 - a.fromInt(lowprimes[Math.floor(Math.random()*lowprimes.length)]); - var y = a.modPow(r,this); - if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { - var j = 1; - while(j++ < k && y.compareTo(n1) != 0) { - y = y.modPowInt(2,this); - if(y.compareTo(BigInteger.ONE) == 0) return false; - } - if(y.compareTo(n1) != 0) return false; - } - } - return true; - } - - // protected - BigInteger.prototype.chunkSize = bnpChunkSize; - BigInteger.prototype.toRadix = bnpToRadix; - BigInteger.prototype.fromRadix = bnpFromRadix; - BigInteger.prototype.fromNumber = bnpFromNumber; - BigInteger.prototype.bitwiseTo = bnpBitwiseTo; - BigInteger.prototype.changeBit = bnpChangeBit; - BigInteger.prototype.addTo = bnpAddTo; - BigInteger.prototype.dMultiply = bnpDMultiply; - BigInteger.prototype.dAddOffset = bnpDAddOffset; - BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; - BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; - BigInteger.prototype.modInt = bnpModInt; - BigInteger.prototype.millerRabin = bnpMillerRabin; - - // public - BigInteger.prototype.clone = bnClone; - BigInteger.prototype.intValue = bnIntValue; - BigInteger.prototype.byteValue = bnByteValue; - BigInteger.prototype.shortValue = bnShortValue; - BigInteger.prototype.signum = bnSigNum; - BigInteger.prototype.toByteArray = bnToByteArray; - BigInteger.prototype.equals = bnEquals; - BigInteger.prototype.min = bnMin; - BigInteger.prototype.max = bnMax; - BigInteger.prototype.and = bnAnd; - BigInteger.prototype.or = bnOr; - BigInteger.prototype.xor = bnXor; - BigInteger.prototype.andNot = bnAndNot; - BigInteger.prototype.not = bnNot; - BigInteger.prototype.shiftLeft = bnShiftLeft; - BigInteger.prototype.shiftRight = bnShiftRight; - BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; - BigInteger.prototype.bitCount = bnBitCount; - BigInteger.prototype.testBit = bnTestBit; - BigInteger.prototype.setBit = bnSetBit; - BigInteger.prototype.clearBit = bnClearBit; - BigInteger.prototype.flipBit = bnFlipBit; - BigInteger.prototype.add = bnAdd; - BigInteger.prototype.subtract = bnSubtract; - BigInteger.prototype.multiply = bnMultiply; - BigInteger.prototype.divide = bnDivide; - BigInteger.prototype.remainder = bnRemainder; - BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; - BigInteger.prototype.modPow = bnModPow; - BigInteger.prototype.modInverse = bnModInverse; - BigInteger.prototype.pow = bnPow; - BigInteger.prototype.gcd = bnGCD; - BigInteger.prototype.isProbablePrime = bnIsProbablePrime; - - // JSBN-specific extension - BigInteger.prototype.square = bnSquare; - - // Expose the Barrett function - BigInteger.prototype.Barrett = Barrett - - // BigInteger interfaces not implemented in jsbn: - - // BigInteger(int signum, byte[] magnitude) - // double doubleValue() - // float floatValue() - // int hashCode() - // long longValue() - // static BigInteger valueOf(long val) - - // Random number generator - requires a PRNG backend, e.g. prng4.js - - // For best results, put code like - // - // in your main HTML document. - - var rng_state; - var rng_pool; - var rng_pptr; - - // Mix in a 32-bit integer into the pool - function rng_seed_int(x) { - rng_pool[rng_pptr++] ^= x & 255; - rng_pool[rng_pptr++] ^= (x >> 8) & 255; - rng_pool[rng_pptr++] ^= (x >> 16) & 255; - rng_pool[rng_pptr++] ^= (x >> 24) & 255; - if(rng_pptr >= rng_psize) rng_pptr -= rng_psize; - } - - // Mix in the current time (w/milliseconds) into the pool - function rng_seed_time() { - rng_seed_int(new Date().getTime()); - } - - // Initialize the pool with junk if needed. - if(rng_pool == null) { - rng_pool = new Array(); - rng_pptr = 0; - var t; - if(typeof window !== "undefined" && window.crypto) { - if (window.crypto.getRandomValues) { - // Use webcrypto if available - var ua = new Uint8Array(32); - window.crypto.getRandomValues(ua); - for(t = 0; t < 32; ++t) - rng_pool[rng_pptr++] = ua[t]; - } - else if(navigator.appName == "Netscape" && navigator.appVersion < "5") { - // Extract entropy (256 bits) from NS4 RNG if available - var z = window.crypto.random(32); - for(t = 0; t < z.length; ++t) - rng_pool[rng_pptr++] = z.charCodeAt(t) & 255; - } - } - while(rng_pptr < rng_psize) { // extract some randomness from Math.random() - t = Math.floor(65536 * Math.random()); - rng_pool[rng_pptr++] = t >>> 8; - rng_pool[rng_pptr++] = t & 255; - } - rng_pptr = 0; - rng_seed_time(); - //rng_seed_int(window.screenX); - //rng_seed_int(window.screenY); - } - - function rng_get_byte() { - if(rng_state == null) { - rng_seed_time(); - rng_state = prng_newstate(); - rng_state.init(rng_pool); - for(rng_pptr = 0; rng_pptr < rng_pool.length; ++rng_pptr) - rng_pool[rng_pptr] = 0; - rng_pptr = 0; - //rng_pool = null; - } - // TODO: allow reseeding after first request - return rng_state.next(); - } - - function rng_get_bytes(ba) { - var i; - for(i = 0; i < ba.length; ++i) ba[i] = rng_get_byte(); - } - - function SecureRandom() {} - - SecureRandom.prototype.nextBytes = rng_get_bytes; - - // prng4.js - uses Arcfour as a PRNG - - function Arcfour() { - this.i = 0; - this.j = 0; - this.S = new Array(); - } - - // Initialize arcfour context from key, an array of ints, each from [0..255] - function ARC4init(key) { - var i, j, t; - for(i = 0; i < 256; ++i) - this.S[i] = i; - j = 0; - for(i = 0; i < 256; ++i) { - j = (j + this.S[i] + key[i % key.length]) & 255; - t = this.S[i]; - this.S[i] = this.S[j]; - this.S[j] = t; - } - this.i = 0; - this.j = 0; - } - - function ARC4next() { - var t; - this.i = (this.i + 1) & 255; - this.j = (this.j + this.S[this.i]) & 255; - t = this.S[this.i]; - this.S[this.i] = this.S[this.j]; - this.S[this.j] = t; - return this.S[(t + this.S[this.i]) & 255]; - } - - Arcfour.prototype.init = ARC4init; - Arcfour.prototype.next = ARC4next; - - // Plug in your RNG constructor here - function prng_newstate() { - return new Arcfour(); - } - - // Pool size must be a multiple of 4 and greater than 32. - // An array of bytes the size of the pool will be passed to init() - var rng_psize = 256; - - if (typeof exports !== 'undefined') { - exports = module.exports = { - BigInteger: BigInteger, - SecureRandom: SecureRandom, - }; - } else { - this.BigInteger = BigInteger; - this.SecureRandom = SecureRandom; - } - -}).call(this); diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json deleted file mode 100644 index ca3f19fc..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/jsbn/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "jsbn", - "version": "0.1.0", - "description": "The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers.", - "main": "index.js", - "scripts": { - "test": "mocha test.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/andyperlitch/jsbn.git" - }, - "keywords": [ - "biginteger", - "bignumber", - "big", - "integer" - ], - "author": { - "name": "Tom Wu" - }, - "license": "BSD", - "gitHead": "148a967b112806e63ddeeed78ee7938eef74c84a", - "bugs": { - "url": "https://github.com/andyperlitch/jsbn/issues" - }, - "homepage": "https://github.com/andyperlitch/jsbn", - "_id": "jsbn@0.1.0", - "_shasum": "650987da0dd74f4ebf5a11377a2aa2d273e97dfd", - "_from": "jsbn@~0.1.0", - "_npmVersion": "2.7.4", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "andyperlitch", - "email": "andyperlitch@gmail.com" - }, - "dist": { - "shasum": "650987da0dd74f4ebf5a11377a2aa2d273e97dfd", - "tarball": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz" - }, - "maintainers": [ - { - "name": "andyperlitch", - "email": "andyperlitch@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.0.tgz" -} diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore deleted file mode 100644 index 7d98dcbd..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -.eslintrc -.travis.yml -bower.json -test diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md deleted file mode 100644 index 77c69bd5..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/CHANGELOG.md +++ /dev/null @@ -1,128 +0,0 @@ -TweetNaCl.js Changelog -====================== - - -v0.13.2 -------- - -* Fixed undefined variable bug in fast version of Poly1305. No worries, this - bug was *never* triggered. - -* Specified CC0 public domain dedication. - -* Updated development dependencies. - - -v0.13.1 -------- - -* Exclude `crypto` and `buffer` modules from browserify builds. - - -v0.13.0 -------- - -* Made `nacl-fast` the default version in NPM package. Now - `require("tweetnacl")` will use fast version; to get the original version, - use `require("tweetnacl/nacl.js")`. - -* Cleanup temporary array after generating random bytes. - - -v0.12.2 -------- - -* Improved performance of curve operations, making `nacl.scalarMult`, `nacl.box`, - `nacl.sign` and related functions up to 3x faster in `nacl-fast` version. - - -v0.12.1 -------- - -* Significantly improved performance of Salsa20 (~1.5x faster) and - Poly1305 (~3.5x faster) in `nacl-fast` version. - - -v0.12.0 -------- - -* Instead of using the given secret key directly, TweetNaCl.js now copies it to - a new array in `nacl.box.keyPair.fromSecretKey` and - `nacl.sign.keyPair.fromSecretKey`. - - -v0.11.2 -------- - -* Added new constant: `nacl.sign.seedLength`. - - -v0.11.1 -------- - -* Even faster hash for both short and long inputs (in `nacl-fast`). - - -v0.11.0 -------- - -* Implement `nacl.sign.keyPair.fromSeed` to enable creation of sign key pairs - deterministically from a 32-byte seed. (It behaves like - [libsodium's](http://doc.libsodium.org/public-key_cryptography/public-key_signatures.html) - `crypto_sign_seed_keypair`: the seed becomes a secret part of the secret key.) - -* Fast version now has an improved hash implementation that is 2x-5x faster. - -* Fixed benchmarks, which may have produced incorrect measurements. - - -v0.10.1 -------- - -* Exported undocumented `nacl.lowlevel.crypto_core_hsalsa20`. - - -v0.10.0 -------- - -* **Signature API breaking change!** `nacl.sign` and `nacl.sign.open` now deal - with signed messages, and new `nacl.sign.detached` and - `nacl.sign.detached.verify` are available. - - Previously, `nacl.sign` returned a signature, and `nacl.sign.open` accepted a - message and "detached" signature. This was unlike NaCl's API, which dealt with - signed messages (concatenation of signature and message). - - The new API is: - - nacl.sign(message, secretKey) -> signedMessage - nacl.sign.open(signedMessage, publicKey) -> message | null - - Since detached signatures are common, two new API functions were introduced: - - nacl.sign.detached(message, secretKey) -> signature - nacl.sign.detached.verify(message, signature, publicKey) -> true | false - - (Note that it's `verify`, not `open`, and it returns a boolean value, unlike - `open`, which returns an "unsigned" message.) - -* NPM package now comes without `test` directory to keep it small. - - -v0.9.2 ------- - -* Improved documentation. -* Fast version: increased theoretical message size limit from 2^32-1 to 2^52 - bytes in Poly1305 (and thus, secretbox and box). However this has no impact - in practice since JavaScript arrays or ArrayBuffers are limited to 32-bit - indexes, and most implementations won't allocate more than a gigabyte or so. - (Obviously, there are no tests for the correctness of implementation.) Also, - it's not recommended to use messages that large without splitting them into - smaller packets anyway. - - -v0.9.1 ------- - -* Initial release diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md deleted file mode 100644 index 11bd3472..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/README.md +++ /dev/null @@ -1,463 +0,0 @@ -TweetNaCl.js -============ - -Port of [TweetNaCl](http://tweetnacl.cr.yp.to) / [NaCl](http://nacl.cr.yp.to/) -to JavaScript for modern browsers and Node.js. Public domain. - -[![Build Status](https://travis-ci.org/dchest/tweetnacl-js.svg?branch=master) -](https://travis-ci.org/dchest/tweetnacl-js) - -[Demo](https://dchest.github.io/tweetnacl-js/) - -**:warning: Beta version. The library is stable and API is frozen, however -it has not been independently reviewed. If you can help reviewing it, please -[contact me](mailto:dmitry@codingrobots.com).** - -Documentation -============= - -* [Overview](#overview) -* [Installation](#installation) -* [Usage](#usage) - * [Public-key authenticated encryption (box)](#public-key-authenticated-encryption-box) - * [Secret-key authenticated encryption (secretbox)](#secret-key-authenticated-encryption-secretbox) - * [Scalar multiplication](#scalar-multiplication) - * [Signatures](#signatures) - * [Hashing](#hashing) - * [Random bytes generation](#random-bytes-generation) - * [Constant-time comparison](#constant-time-comparison) - * [Utilities](#utilities) -* [Examples](#examples) -* [System requirements](#system-requirements) -* [Development and testing](#development-and-testing) -* [Contributors](#contributors) -* [Who uses it](#who-uses-it) - - -Overview --------- - -The primary goal of this project is to produce a translation of TweetNaCl to -JavaScript which is as close as possible to the original C implementation, plus -a thin layer of idiomatic high-level API on top of it. - -There are two versions, you can use either of them: - -* `nacl.js` is the port of TweetNaCl with minimum differences from the - original + high-level API. - -* `nacl-fast.js` is like `nacl.js`, but with some functions replaced with - faster versions. - - -Installation ------------- - -You can install TweetNaCl.js via a package manager: - -[Bower](http://bower.io): - - $ bower install tweetnacl - -[NPM](https://www.npmjs.org/): - - $ npm install tweetnacl - -or [download source code](https://github.com/dchest/tweetnacl-js/releases). - - -Usage ------- - -All API functions accept and return bytes as `Uint8Array`s. If you need to -encode or decode strings, use functions from `nacl.util` namespace. - -### Public-key authenticated encryption (box) - -Implements *curve25519-xsalsa20-poly1305*. - -#### nacl.box.keyPair() - -Generates a new random key pair for box and returns it as an object with -`publicKey` and `secretKey` members: - - { - publicKey: ..., // Uint8Array with 32-byte public key - secretKey: ... // Uint8Array with 32-byte secret key - } - - -#### nacl.box.keyPair.fromSecretKey(secretKey) - -Returns a key pair for box with public key corresponding to the given secret -key. - -#### nacl.box(message, nonce, theirPublicKey, mySecretKey) - -Encrypt and authenticates message using peer's public key, our secret key, and -the given nonce, which must be unique for each distinct message for a key pair. - -Returns an encrypted and authenticated message, which is -`nacl.box.overheadLength` longer than the original message. - -#### nacl.box.open(box, nonce, theirPublicKey, mySecretKey) - -Authenticates and decrypts the given box with peer's public key, our secret -key, and the given nonce. - -Returns the original message, or `false` if authentication fails. - -#### nacl.box.before(theirPublicKey, mySecretKey) - -Returns a precomputed shared key which can be used in `nacl.box.after` and -`nacl.box.open.after`. - -#### nacl.box.after(message, nonce, sharedKey) - -Same as `nacl.box`, but uses a shared key precomputed with `nacl.box.before`. - -#### nacl.box.open.after(box, nonce, sharedKey) - -Same as `nacl.box.open`, but uses a shared key precomputed with `nacl.box.before`. - -#### nacl.box.publicKeyLength = 32 - -Length of public key in bytes. - -#### nacl.box.secretKeyLength = 32 - -Length of secret key in bytes. - -#### nacl.box.sharedKeyLength = 32 - -Length of precomputed shared key in bytes. - -#### nacl.box.nonceLength = 24 - -Length of nonce in bytes. - -#### nacl.box.overheadLength = 16 - -Length of overhead added to box compared to original message. - - -### Secret-key authenticated encryption (secretbox) - -Implements *xsalsa20-poly1305*. - -#### nacl.secretbox(message, nonce, key) - -Encrypt and authenticates message using the key and the nonce. The nonce must -be unique for each distinct message for this key. - -Returns an encrypted and authenticated message, which is -`nacl.secretbox.overheadLength` longer than the original message. - -#### nacl.secretbox.open(box, nonce, key) - -Authenticates and decrypts the given secret box using the key and the nonce. - -Returns the original message, or `false` if authentication fails. - -#### nacl.secretbox.keyLength = 32 - -Length of key in bytes. - -#### nacl.secretbox.nonceLength = 24 - -Length of nonce in bytes. - -#### nacl.secretbox.overheadLength = 16 - -Length of overhead added to secret box compared to original message. - - -### Scalar multiplication - -Implements *curve25519*. - -#### nacl.scalarMult(n, p) - -Multiplies an integer `n` by a group element `p` and returns the resulting -group element. - -#### nacl.scalarMult.base(n) - -Multiplies an integer `n` by a standard group element and returns the resulting -group element. - -#### nacl.scalarMult.scalarLength = 32 - -Length of scalar in bytes. - -#### nacl.scalarMult.groupElementLength = 32 - -Length of group element in bytes. - - -### Signatures - -Implements [ed25519](http://ed25519.cr.yp.to). - -#### nacl.sign.keyPair() - -Generates new random key pair for signing and returns it as an object with -`publicKey` and `secretKey` members: - - { - publicKey: ..., // Uint8Array with 32-byte public key - secretKey: ... // Uint8Array with 64-byte secret key - } - -#### nacl.sign.keyPair.fromSecretKey(secretKey) - -Returns a signing key pair with public key corresponding to the given -64-byte secret key. The secret key must have been generated by -`nacl.sign.keyPair` or `nacl.sign.keyPair.fromSeed`. - -#### nacl.sign.keyPair.fromSeed(seed) - -Returns a new signing key pair generated deterministically from a 32-byte seed. -The seed must contain enough entropy to be secure. This method is not -recommended for general use: instead, use `nacl.sign.keyPair` to generate a new -key pair from a random seed. - -#### nacl.sign(message, secretKey) - -Signs the message using the secret key and returns a signed message. - -#### nacl.sign.open(signedMessage, publicKey) - -Verifies the signed message and returns the message without signature. - -Returns `null` if verification failed. - -#### nacl.sign.detached(message, secretKey) - -Signs the message using the secret key and returns a signature. - -#### nacl.sign.detached.verify(message, signature, publicKey) - -Verifies the signature for the message and returns `true` if verification -succeeded or `false` if it failed. - -#### nacl.sign.publicKeyLength = 32 - -Length of signing public key in bytes. - -#### nacl.sign.secretKeyLength = 64 - -Length of signing secret key in bytes. - -#### nacl.sign.seedLength = 32 - -Length of seed for `nacl.sign.keyPair.fromSeed` in bytes. - -#### nacl.sign.signatureLength = 64 - -Length of signature in bytes. - - -### Hashing - -Implements *SHA-512*. - -#### nacl.hash(message) - -Returns SHA-512 hash of the message. - -#### nacl.hash.hashLength = 64 - -Length of hash in bytes. - - -### Random bytes generation - -#### nacl.randomBytes(length) - -Returns a `Uint8Array` of the given length containing random bytes of -cryptographic quality. - -**Implementation note** - -TweetNaCl.js uses the following methods to generate random bytes, -depending on the platform it runs on: - -* `window.crypto.getRandomValues` (WebCrypto standard) -* `window.msCrypto.getRandomValues` (Internet Explorer 11) -* `crypto.randomBytes` (Node.js) - -Note that browsers are required to throw `QuotaExceededError` exception if -requested `length` is more than 65536, so do not ask for more than 65536 bytes -in *one call* (multiple calls to get as many bytes as you like are okay: -browsers can generate infinite amount of random bytes without any bad -consequences). - -If the platform doesn't provide a suitable PRNG, the following functions, -which require random numbers, will throw exception: - -* `nacl.randomBytes` -* `nacl.box.keyPair` -* `nacl.sign.keyPair` - -Other functions are deterministic and will continue working. - -If a platform you are targeting doesn't implement secure random number -generator, but you somehow have a cryptographically-strong source of entropy -(not `Math.random`!), and you know what you are doing, you can plug it into -TweetNaCl.js like this: - - nacl.setPRNG(function(x, n) { - // ... copy n random bytes into x ... - }); - -Note that `nacl.setPRNG` *completely replaces* internal random byte generator -with the one provided. - - -### Constant-time comparison - -#### nacl.verify(x, y) - -Compares `x` and `y` in constant time and returns `true` if their lengths are -non-zero and equal, and their contents are equal. - -Returns `false` if either of the arguments has zero length, or arguments have -different lengths, or their contents differ. - - -### Utilities - -Encoding/decoding functions are provided for convenience. They are correct, -however their performance and wide compatibility with uncommon runtimes is not -something that is considered important compared to the simplicity and size of -implementation. You can use third-party libraries if you need to. - -#### nacl.util.decodeUTF8(string) - -Decodes string and returns `Uint8Array` of bytes. - -#### nacl.util.encodeUTF8(array) - -Encodes `Uint8Array` or `Array` of bytes into string. - -#### nacl.util.decodeBase64(string) - -Decodes Base-64 encoded string and returns `Uint8Array` of bytes. - -#### nacl.util.encodeBase64(array) - -Encodes `Uint8Array` or `Array` of bytes into string using Base-64 encoding. - - -System requirements -------------------- - -TweetNaCl.js supports modern browsers that have a cryptographically secure -pseudorandom number generator and typed arrays, including the latest versions -of: - -* Chrome -* Firefox -* Safari (Mac, iOS) -* Internet Explorer 11 - -Other systems: - -* Node.js (we test on 0.10 and later) - - -Development and testing ------------------------- - -Install NPM modules needed for development: - - $ npm install - -To build minified versions: - - $ npm run build - -Tests use minified version, so make sure to rebuild it every time you change -`nacl.js` or `nacl-fast.js`. - -### Testing - -To run tests in Node.js: - - $ npm test - -By default all tests described here work on `nacl.min.js`. To test other -versions, set environment variable `NACL_SRC` to the file name you want to test. -For example, the following command will test fast minified version: - - $ NACL_SRC=nacl-fast.min.js npm test - -To run full suite of tests in Node.js, including comparing outputs of -JavaScript port to outputs of the original C version: - - $ npm run testall - -To prepare tests for browsers: - - $ npm run browser - -and then open `test/browser/test.html` (or `test/browser/test-fast.html`) to -run them. - -To run headless browser tests with `testling`: - - $ npm run testling - -(If you get `Error: spawn ENOENT`, install *xvfb*: `sudo apt-get install xvfb`.) - -### Benchmarking - -To run benchmarks in Node.js: - - $ npm run bench - $ NACL_SRC=nacl-fast.min.js npm run bench - -To run benchmarks in a browser, open `test/benchmark/bench.html` (or -`test/benchmark/bench-fast.html`). - - -Contributors ------------- - -JavaScript port: - - * [Dmitry Chestnykh](http://github.com/dchest) (ported xsalsa20, poly1305, curve25519) - * [Devi Mandiri](https://github.com/devi) (ported curve25519, ed25519, sha512) - -Original authors of [NaCl](http://nacl.cr.yp.to), [TweetNaCl](http://tweetnacl.cr.yp.to) -and [Poly1305-donna](https://github.com/floodyberry/poly1305-donna) -(who are *not* responsible for any errors in this implementation): - - * [Daniel J. Bernstein](http://cr.yp.to/djb.html) - * Wesley Janssen - * [Tanja Lange](http://hyperelliptic.org/tanja) - * [Peter Schwabe](http://www.cryptojedi.org/users/peter/) - * [Matthew Dempsky](https://github.com/mdempsky) - * [Andrew Moon](https://github.com/floodyberry) - -Contributors have dedicated their work to the public domain. - -This software is distributed without any warranty. - - -Third-party libraries based on TweetNaCl.js -------------------------------------------- - -* [forward-secrecy](https://github.com/alax/forward-secrecy) — Axolotl ratchet implementation -* [nacl-stream](https://github.com/dchest/nacl-stream-js) - streaming encryption -* [tweetnacl-auth-js](https://github.com/dchest/tweetnacl-auth-js) — implementation of [`crypto_auth`](http://nacl.cr.yp.to/auth.html) - - -Who uses it ------------ - -Some notable users of TweetNaCl.js: - -* [miniLock](http://minilock.io/) -* [Stellar](https://www.stellar.org/) diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js deleted file mode 100644 index 6c499584..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.js +++ /dev/null @@ -1,2418 +0,0 @@ -(function(nacl) { -'use strict'; - -// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. -// Public domain. -// -// Implementation derived from TweetNaCl version 20140427. -// See for details: http://tweetnacl.cr.yp.to/ - -var gf = function(init) { - var i, r = new Float64Array(16); - if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; - return r; -}; - -// Pluggable, initialized in high-level API below. -var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; - -var _0 = new Uint8Array(16); -var _9 = new Uint8Array(32); _9[0] = 9; - -var gf0 = gf(), - gf1 = gf([1]), - _121665 = gf([0xdb41, 1]), - D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), - D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), - X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), - Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), - I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - -function ts64(x, i, h, l) { - x[i] = (h >> 24) & 0xff; - x[i+1] = (h >> 16) & 0xff; - x[i+2] = (h >> 8) & 0xff; - x[i+3] = h & 0xff; - x[i+4] = (l >> 24) & 0xff; - x[i+5] = (l >> 16) & 0xff; - x[i+6] = (l >> 8) & 0xff; - x[i+7] = l & 0xff; -} - -function vn(x, xi, y, yi, n) { - var i,d = 0; - for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; - return (1 & ((d - 1) >>> 8)) - 1; -} - -function crypto_verify_16(x, xi, y, yi) { - return vn(x,xi,y,yi,16); -} - -function crypto_verify_32(x, xi, y, yi) { - return vn(x,xi,y,yi,32); -} - -function core_salsa20(o, p, k, c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; - - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); - - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } - x0 = x0 + j0 | 0; - x1 = x1 + j1 | 0; - x2 = x2 + j2 | 0; - x3 = x3 + j3 | 0; - x4 = x4 + j4 | 0; - x5 = x5 + j5 | 0; - x6 = x6 + j6 | 0; - x7 = x7 + j7 | 0; - x8 = x8 + j8 | 0; - x9 = x9 + j9 | 0; - x10 = x10 + j10 | 0; - x11 = x11 + j11 | 0; - x12 = x12 + j12 | 0; - x13 = x13 + j13 | 0; - x14 = x14 + j14 | 0; - x15 = x15 + j15 | 0; - - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; - - o[ 4] = x1 >>> 0 & 0xff; - o[ 5] = x1 >>> 8 & 0xff; - o[ 6] = x1 >>> 16 & 0xff; - o[ 7] = x1 >>> 24 & 0xff; - - o[ 8] = x2 >>> 0 & 0xff; - o[ 9] = x2 >>> 8 & 0xff; - o[10] = x2 >>> 16 & 0xff; - o[11] = x2 >>> 24 & 0xff; - - o[12] = x3 >>> 0 & 0xff; - o[13] = x3 >>> 8 & 0xff; - o[14] = x3 >>> 16 & 0xff; - o[15] = x3 >>> 24 & 0xff; - - o[16] = x4 >>> 0 & 0xff; - o[17] = x4 >>> 8 & 0xff; - o[18] = x4 >>> 16 & 0xff; - o[19] = x4 >>> 24 & 0xff; - - o[20] = x5 >>> 0 & 0xff; - o[21] = x5 >>> 8 & 0xff; - o[22] = x5 >>> 16 & 0xff; - o[23] = x5 >>> 24 & 0xff; - - o[24] = x6 >>> 0 & 0xff; - o[25] = x6 >>> 8 & 0xff; - o[26] = x6 >>> 16 & 0xff; - o[27] = x6 >>> 24 & 0xff; - - o[28] = x7 >>> 0 & 0xff; - o[29] = x7 >>> 8 & 0xff; - o[30] = x7 >>> 16 & 0xff; - o[31] = x7 >>> 24 & 0xff; - - o[32] = x8 >>> 0 & 0xff; - o[33] = x8 >>> 8 & 0xff; - o[34] = x8 >>> 16 & 0xff; - o[35] = x8 >>> 24 & 0xff; - - o[36] = x9 >>> 0 & 0xff; - o[37] = x9 >>> 8 & 0xff; - o[38] = x9 >>> 16 & 0xff; - o[39] = x9 >>> 24 & 0xff; - - o[40] = x10 >>> 0 & 0xff; - o[41] = x10 >>> 8 & 0xff; - o[42] = x10 >>> 16 & 0xff; - o[43] = x10 >>> 24 & 0xff; - - o[44] = x11 >>> 0 & 0xff; - o[45] = x11 >>> 8 & 0xff; - o[46] = x11 >>> 16 & 0xff; - o[47] = x11 >>> 24 & 0xff; - - o[48] = x12 >>> 0 & 0xff; - o[49] = x12 >>> 8 & 0xff; - o[50] = x12 >>> 16 & 0xff; - o[51] = x12 >>> 24 & 0xff; - - o[52] = x13 >>> 0 & 0xff; - o[53] = x13 >>> 8 & 0xff; - o[54] = x13 >>> 16 & 0xff; - o[55] = x13 >>> 24 & 0xff; - - o[56] = x14 >>> 0 & 0xff; - o[57] = x14 >>> 8 & 0xff; - o[58] = x14 >>> 16 & 0xff; - o[59] = x14 >>> 24 & 0xff; - - o[60] = x15 >>> 0 & 0xff; - o[61] = x15 >>> 8 & 0xff; - o[62] = x15 >>> 16 & 0xff; - o[63] = x15 >>> 24 & 0xff; -} - -function core_hsalsa20(o,p,k,c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; - - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); - - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } - - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; - - o[ 4] = x5 >>> 0 & 0xff; - o[ 5] = x5 >>> 8 & 0xff; - o[ 6] = x5 >>> 16 & 0xff; - o[ 7] = x5 >>> 24 & 0xff; - - o[ 8] = x10 >>> 0 & 0xff; - o[ 9] = x10 >>> 8 & 0xff; - o[10] = x10 >>> 16 & 0xff; - o[11] = x10 >>> 24 & 0xff; - - o[12] = x15 >>> 0 & 0xff; - o[13] = x15 >>> 8 & 0xff; - o[14] = x15 >>> 16 & 0xff; - o[15] = x15 >>> 24 & 0xff; - - o[16] = x6 >>> 0 & 0xff; - o[17] = x6 >>> 8 & 0xff; - o[18] = x6 >>> 16 & 0xff; - o[19] = x6 >>> 24 & 0xff; - - o[20] = x7 >>> 0 & 0xff; - o[21] = x7 >>> 8 & 0xff; - o[22] = x7 >>> 16 & 0xff; - o[23] = x7 >>> 24 & 0xff; - - o[24] = x8 >>> 0 & 0xff; - o[25] = x8 >>> 8 & 0xff; - o[26] = x8 >>> 16 & 0xff; - o[27] = x8 >>> 24 & 0xff; - - o[28] = x9 >>> 0 & 0xff; - o[29] = x9 >>> 8 & 0xff; - o[30] = x9 >>> 16 & 0xff; - o[31] = x9 >>> 24 & 0xff; -} - -function crypto_core_salsa20(out,inp,k,c) { - core_salsa20(out,inp,k,c); -} - -function crypto_core_hsalsa20(out,inp,k,c) { - core_hsalsa20(out,inp,k,c); -} - -var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - // "expand 32-byte k" - -function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - mpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - } - return 0; -} - -function crypto_stream_salsa20(c,cpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = x[i]; - } - return 0; -} - -function crypto_stream(c,cpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20(c,cpos,d,sn,s); -} - -function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); -} - -/* -* Port of Andrew Moon's Poly1305-donna-16. Public domain. -* https://github.com/floodyberry/poly1305-donna -*/ - -var poly1305 = function(key) { - this.buffer = new Uint8Array(16); - this.r = new Uint16Array(10); - this.h = new Uint16Array(10); - this.pad = new Uint16Array(8); - this.leftover = 0; - this.fin = 0; - - var t0, t1, t2, t3, t4, t5, t6, t7; - - t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; - t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; - t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; - this.r[5] = ((t4 >>> 1)) & 0x1ffe; - t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; - t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - this.r[9] = ((t7 >>> 5)) & 0x007f; - - this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; - this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; - this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; - this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; - this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; - this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; - this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; - this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; -}; - -poly1305.prototype.blocks = function(m, mpos, bytes) { - var hibit = this.fin ? 0 : (1 << 11); - var t0, t1, t2, t3, t4, t5, t6, t7, c; - var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; - - var h0 = this.h[0], - h1 = this.h[1], - h2 = this.h[2], - h3 = this.h[3], - h4 = this.h[4], - h5 = this.h[5], - h6 = this.h[6], - h7 = this.h[7], - h8 = this.h[8], - h9 = this.h[9]; - - var r0 = this.r[0], - r1 = this.r[1], - r2 = this.r[2], - r3 = this.r[3], - r4 = this.r[4], - r5 = this.r[5], - r6 = this.r[6], - r7 = this.r[7], - r8 = this.r[8], - r9 = this.r[9]; - - while (bytes >= 16) { - t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; - t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; - t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; - h5 += ((t4 >>> 1)) & 0x1fff; - t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; - t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - h9 += ((t7 >>> 5)) | hibit; - - c = 0; - - d0 = c; - d0 += h0 * r0; - d0 += h1 * (5 * r9); - d0 += h2 * (5 * r8); - d0 += h3 * (5 * r7); - d0 += h4 * (5 * r6); - c = (d0 >>> 13); d0 &= 0x1fff; - d0 += h5 * (5 * r5); - d0 += h6 * (5 * r4); - d0 += h7 * (5 * r3); - d0 += h8 * (5 * r2); - d0 += h9 * (5 * r1); - c += (d0 >>> 13); d0 &= 0x1fff; - - d1 = c; - d1 += h0 * r1; - d1 += h1 * r0; - d1 += h2 * (5 * r9); - d1 += h3 * (5 * r8); - d1 += h4 * (5 * r7); - c = (d1 >>> 13); d1 &= 0x1fff; - d1 += h5 * (5 * r6); - d1 += h6 * (5 * r5); - d1 += h7 * (5 * r4); - d1 += h8 * (5 * r3); - d1 += h9 * (5 * r2); - c += (d1 >>> 13); d1 &= 0x1fff; - - d2 = c; - d2 += h0 * r2; - d2 += h1 * r1; - d2 += h2 * r0; - d2 += h3 * (5 * r9); - d2 += h4 * (5 * r8); - c = (d2 >>> 13); d2 &= 0x1fff; - d2 += h5 * (5 * r7); - d2 += h6 * (5 * r6); - d2 += h7 * (5 * r5); - d2 += h8 * (5 * r4); - d2 += h9 * (5 * r3); - c += (d2 >>> 13); d2 &= 0x1fff; - - d3 = c; - d3 += h0 * r3; - d3 += h1 * r2; - d3 += h2 * r1; - d3 += h3 * r0; - d3 += h4 * (5 * r9); - c = (d3 >>> 13); d3 &= 0x1fff; - d3 += h5 * (5 * r8); - d3 += h6 * (5 * r7); - d3 += h7 * (5 * r6); - d3 += h8 * (5 * r5); - d3 += h9 * (5 * r4); - c += (d3 >>> 13); d3 &= 0x1fff; - - d4 = c; - d4 += h0 * r4; - d4 += h1 * r3; - d4 += h2 * r2; - d4 += h3 * r1; - d4 += h4 * r0; - c = (d4 >>> 13); d4 &= 0x1fff; - d4 += h5 * (5 * r9); - d4 += h6 * (5 * r8); - d4 += h7 * (5 * r7); - d4 += h8 * (5 * r6); - d4 += h9 * (5 * r5); - c += (d4 >>> 13); d4 &= 0x1fff; - - d5 = c; - d5 += h0 * r5; - d5 += h1 * r4; - d5 += h2 * r3; - d5 += h3 * r2; - d5 += h4 * r1; - c = (d5 >>> 13); d5 &= 0x1fff; - d5 += h5 * r0; - d5 += h6 * (5 * r9); - d5 += h7 * (5 * r8); - d5 += h8 * (5 * r7); - d5 += h9 * (5 * r6); - c += (d5 >>> 13); d5 &= 0x1fff; - - d6 = c; - d6 += h0 * r6; - d6 += h1 * r5; - d6 += h2 * r4; - d6 += h3 * r3; - d6 += h4 * r2; - c = (d6 >>> 13); d6 &= 0x1fff; - d6 += h5 * r1; - d6 += h6 * r0; - d6 += h7 * (5 * r9); - d6 += h8 * (5 * r8); - d6 += h9 * (5 * r7); - c += (d6 >>> 13); d6 &= 0x1fff; - - d7 = c; - d7 += h0 * r7; - d7 += h1 * r6; - d7 += h2 * r5; - d7 += h3 * r4; - d7 += h4 * r3; - c = (d7 >>> 13); d7 &= 0x1fff; - d7 += h5 * r2; - d7 += h6 * r1; - d7 += h7 * r0; - d7 += h8 * (5 * r9); - d7 += h9 * (5 * r8); - c += (d7 >>> 13); d7 &= 0x1fff; - - d8 = c; - d8 += h0 * r8; - d8 += h1 * r7; - d8 += h2 * r6; - d8 += h3 * r5; - d8 += h4 * r4; - c = (d8 >>> 13); d8 &= 0x1fff; - d8 += h5 * r3; - d8 += h6 * r2; - d8 += h7 * r1; - d8 += h8 * r0; - d8 += h9 * (5 * r9); - c += (d8 >>> 13); d8 &= 0x1fff; - - d9 = c; - d9 += h0 * r9; - d9 += h1 * r8; - d9 += h2 * r7; - d9 += h3 * r6; - d9 += h4 * r5; - c = (d9 >>> 13); d9 &= 0x1fff; - d9 += h5 * r4; - d9 += h6 * r3; - d9 += h7 * r2; - d9 += h8 * r1; - d9 += h9 * r0; - c += (d9 >>> 13); d9 &= 0x1fff; - - c = (((c << 2) + c)) | 0; - c = (c + d0) | 0; - d0 = c & 0x1fff; - c = (c >>> 13); - d1 += c; - - h0 = d0; - h1 = d1; - h2 = d2; - h3 = d3; - h4 = d4; - h5 = d5; - h6 = d6; - h7 = d7; - h8 = d8; - h9 = d9; - - mpos += 16; - bytes -= 16; - } - this.h[0] = h0; - this.h[1] = h1; - this.h[2] = h2; - this.h[3] = h3; - this.h[4] = h4; - this.h[5] = h5; - this.h[6] = h6; - this.h[7] = h7; - this.h[8] = h8; - this.h[9] = h9; -}; - -poly1305.prototype.finish = function(mac, macpos) { - var g = new Uint16Array(10); - var c, mask, f, i; - - if (this.leftover) { - i = this.leftover; - this.buffer[i++] = 1; - for (; i < 16; i++) this.buffer[i] = 0; - this.fin = 1; - this.blocks(this.buffer, 0, 16); - } - - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - for (i = 2; i < 10; i++) { - this.h[i] += c; - c = this.h[i] >>> 13; - this.h[i] &= 0x1fff; - } - this.h[0] += (c * 5); - c = this.h[0] >>> 13; - this.h[0] &= 0x1fff; - this.h[1] += c; - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - this.h[2] += c; - - g[0] = this.h[0] + 5; - c = g[0] >>> 13; - g[0] &= 0x1fff; - for (i = 1; i < 10; i++) { - g[i] = this.h[i] + c; - c = g[i] >>> 13; - g[i] &= 0x1fff; - } - g[9] -= (1 << 13); - - mask = (g[9] >>> ((2 * 8) - 1)) - 1; - for (i = 0; i < 10; i++) g[i] &= mask; - mask = ~mask; - for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; - - this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; - this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; - this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; - this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; - this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; - this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; - this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; - this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; - - f = this.h[0] + this.pad[0]; - this.h[0] = f & 0xffff; - for (i = 1; i < 8; i++) { - f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; - this.h[i] = f & 0xffff; - } - - mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; - mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; - mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; - mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; - mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; - mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; - mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; - mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; - mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; - mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; - mac[macpos+10] = (this.h[5] >>> 0) & 0xff; - mac[macpos+11] = (this.h[5] >>> 8) & 0xff; - mac[macpos+12] = (this.h[6] >>> 0) & 0xff; - mac[macpos+13] = (this.h[6] >>> 8) & 0xff; - mac[macpos+14] = (this.h[7] >>> 0) & 0xff; - mac[macpos+15] = (this.h[7] >>> 8) & 0xff; -}; - -poly1305.prototype.update = function(m, mpos, bytes) { - var i, want; - - if (this.leftover) { - want = (16 - this.leftover); - if (want > bytes) - want = bytes; - for (i = 0; i < want; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - bytes -= want; - mpos += want; - this.leftover += want; - if (this.leftover < 16) - return; - this.blocks(this.buffer, 0, 16); - this.leftover = 0; - } - - if (bytes >= 16) { - want = bytes - (bytes % 16); - this.blocks(m, mpos, want); - mpos += want; - bytes -= want; - } - - if (bytes) { - for (i = 0; i < bytes; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - this.leftover += bytes; - } -}; - -function crypto_onetimeauth(out, outpos, m, mpos, n, k) { - var s = new poly1305(k); - s.update(m, mpos, n); - s.finish(out, outpos); - return 0; -} - -function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { - var x = new Uint8Array(16); - crypto_onetimeauth(x,0,m,mpos,n,k); - return crypto_verify_16(h,hpos,x,0); -} - -function crypto_secretbox(c,m,d,n,k) { - var i; - if (d < 32) return -1; - crypto_stream_xor(c,0,m,0,d,n,k); - crypto_onetimeauth(c, 16, c, 32, d - 32, c); - for (i = 0; i < 16; i++) c[i] = 0; - return 0; -} - -function crypto_secretbox_open(m,c,d,n,k) { - var i; - var x = new Uint8Array(32); - if (d < 32) return -1; - crypto_stream(x,0,32,n,k); - if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; - crypto_stream_xor(m,0,c,0,d,n,k); - for (i = 0; i < 32; i++) m[i] = 0; - return 0; -} - -function set25519(r, a) { - var i; - for (i = 0; i < 16; i++) r[i] = a[i]|0; -} - -function car25519(o) { - var i, v, c = 1; - for (i = 0; i < 16; i++) { - v = o[i] + c + 65535; - c = Math.floor(v / 65536); - o[i] = v - c * 65536; - } - o[0] += c-1 + 37 * (c-1); -} - -function sel25519(p, q, b) { - var t, c = ~(b-1); - for (var i = 0; i < 16; i++) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } -} - -function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for (i = 0; i < 16; i++) t[i] = n[i]; - car25519(t); - car25519(t); - car25519(t); - for (j = 0; j < 2; j++) { - m[0] = t[0] - 0xffed; - for (i = 1; i < 15; i++) { - m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); - m[i-1] &= 0xffff; - } - m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); - b = (m[15]>>16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1-b); - } - for (i = 0; i < 16; i++) { - o[2*i] = t[i] & 0xff; - o[2*i+1] = t[i]>>8; - } -} - -function neq25519(a, b) { - var c = new Uint8Array(32), d = new Uint8Array(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); -} - -function par25519(a) { - var d = new Uint8Array(32); - pack25519(d, a); - return d[0] & 1; -} - -function unpack25519(o, n) { - var i; - for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); - o[15] &= 0x7fff; -} - -function A(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; -} - -function Z(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; -} - -function M(o, a, b) { - var v, c, - t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, - t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, - t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, - t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, - b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3], - b4 = b[4], - b5 = b[5], - b6 = b[6], - b7 = b[7], - b8 = b[8], - b9 = b[9], - b10 = b[10], - b11 = b[11], - b12 = b[12], - b13 = b[13], - b14 = b[14], - b15 = b[15]; - - v = a[0]; - t0 += v * b0; - t1 += v * b1; - t2 += v * b2; - t3 += v * b3; - t4 += v * b4; - t5 += v * b5; - t6 += v * b6; - t7 += v * b7; - t8 += v * b8; - t9 += v * b9; - t10 += v * b10; - t11 += v * b11; - t12 += v * b12; - t13 += v * b13; - t14 += v * b14; - t15 += v * b15; - v = a[1]; - t1 += v * b0; - t2 += v * b1; - t3 += v * b2; - t4 += v * b3; - t5 += v * b4; - t6 += v * b5; - t7 += v * b6; - t8 += v * b7; - t9 += v * b8; - t10 += v * b9; - t11 += v * b10; - t12 += v * b11; - t13 += v * b12; - t14 += v * b13; - t15 += v * b14; - t16 += v * b15; - v = a[2]; - t2 += v * b0; - t3 += v * b1; - t4 += v * b2; - t5 += v * b3; - t6 += v * b4; - t7 += v * b5; - t8 += v * b6; - t9 += v * b7; - t10 += v * b8; - t11 += v * b9; - t12 += v * b10; - t13 += v * b11; - t14 += v * b12; - t15 += v * b13; - t16 += v * b14; - t17 += v * b15; - v = a[3]; - t3 += v * b0; - t4 += v * b1; - t5 += v * b2; - t6 += v * b3; - t7 += v * b4; - t8 += v * b5; - t9 += v * b6; - t10 += v * b7; - t11 += v * b8; - t12 += v * b9; - t13 += v * b10; - t14 += v * b11; - t15 += v * b12; - t16 += v * b13; - t17 += v * b14; - t18 += v * b15; - v = a[4]; - t4 += v * b0; - t5 += v * b1; - t6 += v * b2; - t7 += v * b3; - t8 += v * b4; - t9 += v * b5; - t10 += v * b6; - t11 += v * b7; - t12 += v * b8; - t13 += v * b9; - t14 += v * b10; - t15 += v * b11; - t16 += v * b12; - t17 += v * b13; - t18 += v * b14; - t19 += v * b15; - v = a[5]; - t5 += v * b0; - t6 += v * b1; - t7 += v * b2; - t8 += v * b3; - t9 += v * b4; - t10 += v * b5; - t11 += v * b6; - t12 += v * b7; - t13 += v * b8; - t14 += v * b9; - t15 += v * b10; - t16 += v * b11; - t17 += v * b12; - t18 += v * b13; - t19 += v * b14; - t20 += v * b15; - v = a[6]; - t6 += v * b0; - t7 += v * b1; - t8 += v * b2; - t9 += v * b3; - t10 += v * b4; - t11 += v * b5; - t12 += v * b6; - t13 += v * b7; - t14 += v * b8; - t15 += v * b9; - t16 += v * b10; - t17 += v * b11; - t18 += v * b12; - t19 += v * b13; - t20 += v * b14; - t21 += v * b15; - v = a[7]; - t7 += v * b0; - t8 += v * b1; - t9 += v * b2; - t10 += v * b3; - t11 += v * b4; - t12 += v * b5; - t13 += v * b6; - t14 += v * b7; - t15 += v * b8; - t16 += v * b9; - t17 += v * b10; - t18 += v * b11; - t19 += v * b12; - t20 += v * b13; - t21 += v * b14; - t22 += v * b15; - v = a[8]; - t8 += v * b0; - t9 += v * b1; - t10 += v * b2; - t11 += v * b3; - t12 += v * b4; - t13 += v * b5; - t14 += v * b6; - t15 += v * b7; - t16 += v * b8; - t17 += v * b9; - t18 += v * b10; - t19 += v * b11; - t20 += v * b12; - t21 += v * b13; - t22 += v * b14; - t23 += v * b15; - v = a[9]; - t9 += v * b0; - t10 += v * b1; - t11 += v * b2; - t12 += v * b3; - t13 += v * b4; - t14 += v * b5; - t15 += v * b6; - t16 += v * b7; - t17 += v * b8; - t18 += v * b9; - t19 += v * b10; - t20 += v * b11; - t21 += v * b12; - t22 += v * b13; - t23 += v * b14; - t24 += v * b15; - v = a[10]; - t10 += v * b0; - t11 += v * b1; - t12 += v * b2; - t13 += v * b3; - t14 += v * b4; - t15 += v * b5; - t16 += v * b6; - t17 += v * b7; - t18 += v * b8; - t19 += v * b9; - t20 += v * b10; - t21 += v * b11; - t22 += v * b12; - t23 += v * b13; - t24 += v * b14; - t25 += v * b15; - v = a[11]; - t11 += v * b0; - t12 += v * b1; - t13 += v * b2; - t14 += v * b3; - t15 += v * b4; - t16 += v * b5; - t17 += v * b6; - t18 += v * b7; - t19 += v * b8; - t20 += v * b9; - t21 += v * b10; - t22 += v * b11; - t23 += v * b12; - t24 += v * b13; - t25 += v * b14; - t26 += v * b15; - v = a[12]; - t12 += v * b0; - t13 += v * b1; - t14 += v * b2; - t15 += v * b3; - t16 += v * b4; - t17 += v * b5; - t18 += v * b6; - t19 += v * b7; - t20 += v * b8; - t21 += v * b9; - t22 += v * b10; - t23 += v * b11; - t24 += v * b12; - t25 += v * b13; - t26 += v * b14; - t27 += v * b15; - v = a[13]; - t13 += v * b0; - t14 += v * b1; - t15 += v * b2; - t16 += v * b3; - t17 += v * b4; - t18 += v * b5; - t19 += v * b6; - t20 += v * b7; - t21 += v * b8; - t22 += v * b9; - t23 += v * b10; - t24 += v * b11; - t25 += v * b12; - t26 += v * b13; - t27 += v * b14; - t28 += v * b15; - v = a[14]; - t14 += v * b0; - t15 += v * b1; - t16 += v * b2; - t17 += v * b3; - t18 += v * b4; - t19 += v * b5; - t20 += v * b6; - t21 += v * b7; - t22 += v * b8; - t23 += v * b9; - t24 += v * b10; - t25 += v * b11; - t26 += v * b12; - t27 += v * b13; - t28 += v * b14; - t29 += v * b15; - v = a[15]; - t15 += v * b0; - t16 += v * b1; - t17 += v * b2; - t18 += v * b3; - t19 += v * b4; - t20 += v * b5; - t21 += v * b6; - t22 += v * b7; - t23 += v * b8; - t24 += v * b9; - t25 += v * b10; - t26 += v * b11; - t27 += v * b12; - t28 += v * b13; - t29 += v * b14; - t30 += v * b15; - - t0 += 38 * t16; - t1 += 38 * t17; - t2 += 38 * t18; - t3 += 38 * t19; - t4 += 38 * t20; - t5 += 38 * t21; - t6 += 38 * t22; - t7 += 38 * t23; - t8 += 38 * t24; - t9 += 38 * t25; - t10 += 38 * t26; - t11 += 38 * t27; - t12 += 38 * t28; - t13 += 38 * t29; - t14 += 38 * t30; - // t15 left as is - - // first car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - // second car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - o[ 0] = t0; - o[ 1] = t1; - o[ 2] = t2; - o[ 3] = t3; - o[ 4] = t4; - o[ 5] = t5; - o[ 6] = t6; - o[ 7] = t7; - o[ 8] = t8; - o[ 9] = t9; - o[10] = t10; - o[11] = t11; - o[12] = t12; - o[13] = t13; - o[14] = t14; - o[15] = t15; -} - -function S(o, a) { - M(o, a, a); -} - -function inv25519(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 253; a >= 0; a--) { - S(c, c); - if(a !== 2 && a !== 4) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function pow2523(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 250; a >= 0; a--) { - S(c, c); - if(a !== 1) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function crypto_scalarmult(q, n, p) { - var z = new Uint8Array(32); - var x = new Float64Array(80), r, i; - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(); - for (i = 0; i < 31; i++) z[i] = n[i]; - z[31]=(n[31]&127)|64; - z[0]&=248; - unpack25519(x,p); - for (i = 0; i < 16; i++) { - b[i]=x[i]; - d[i]=a[i]=c[i]=0; - } - a[0]=d[0]=1; - for (i=254; i>=0; --i) { - r=(z[i>>>3]>>>(i&7))&1; - sel25519(a,b,r); - sel25519(c,d,r); - A(e,a,c); - Z(a,a,c); - A(c,b,d); - Z(b,b,d); - S(d,e); - S(f,a); - M(a,c,a); - M(c,b,e); - A(e,a,c); - Z(a,a,c); - S(b,a); - Z(c,d,f); - M(a,c,_121665); - A(a,a,d); - M(c,c,a); - M(a,d,f); - M(d,b,x); - S(b,e); - sel25519(a,b,r); - sel25519(c,d,r); - } - for (i = 0; i < 16; i++) { - x[i+16]=a[i]; - x[i+32]=c[i]; - x[i+48]=b[i]; - x[i+64]=d[i]; - } - var x32 = x.subarray(32); - var x16 = x.subarray(16); - inv25519(x32,x32); - M(x16,x16,x32); - pack25519(q,x16); - return 0; -} - -function crypto_scalarmult_base(q, n) { - return crypto_scalarmult(q, n, _9); -} - -function crypto_box_keypair(y, x) { - randombytes(x, 32); - return crypto_scalarmult_base(y, x); -} - -function crypto_box_beforenm(k, y, x) { - var s = new Uint8Array(32); - crypto_scalarmult(s, x, y); - return crypto_core_hsalsa20(k, _0, s, sigma); -} - -var crypto_box_afternm = crypto_secretbox; -var crypto_box_open_afternm = crypto_secretbox_open; - -function crypto_box(c, m, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_afternm(c, m, d, n, k); -} - -function crypto_box_open(m, c, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_open_afternm(m, c, d, n, k); -} - -var K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 -]; - -function crypto_hashblocks_hl(hh, hl, m, n) { - var wh = new Int32Array(16), wl = new Int32Array(16), - bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, - bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, - th, tl, i, j, h, l, a, b, c, d; - - var ah0 = hh[0], - ah1 = hh[1], - ah2 = hh[2], - ah3 = hh[3], - ah4 = hh[4], - ah5 = hh[5], - ah6 = hh[6], - ah7 = hh[7], - - al0 = hl[0], - al1 = hl[1], - al2 = hl[2], - al3 = hl[3], - al4 = hl[4], - al5 = hl[5], - al6 = hl[6], - al7 = hl[7]; - - var pos = 0; - while (n >= 128) { - for (i = 0; i < 16; i++) { - j = 8 * i + pos; - wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; - wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; - } - for (i = 0; i < 80; i++) { - bh0 = ah0; - bh1 = ah1; - bh2 = ah2; - bh3 = ah3; - bh4 = ah4; - bh5 = ah5; - bh6 = ah6; - bh7 = ah7; - - bl0 = al0; - bl1 = al1; - bl2 = al2; - bl3 = al3; - bl4 = al4; - bl5 = al5; - bl6 = al6; - bl7 = al7; - - // add - h = ah7; - l = al7; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - // Sigma1 - h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); - l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // Ch - h = (ah4 & ah5) ^ (~ah4 & ah6); - l = (al4 & al5) ^ (~al4 & al6); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // K - h = K[i*2]; - l = K[i*2+1]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // w - h = wh[i%16]; - l = wl[i%16]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - th = c & 0xffff | d << 16; - tl = a & 0xffff | b << 16; - - // add - h = th; - l = tl; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - // Sigma0 - h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); - l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // Maj - h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); - l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - bh7 = (c & 0xffff) | (d << 16); - bl7 = (a & 0xffff) | (b << 16); - - // add - h = bh3; - l = bl3; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = th; - l = tl; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - bh3 = (c & 0xffff) | (d << 16); - bl3 = (a & 0xffff) | (b << 16); - - ah1 = bh0; - ah2 = bh1; - ah3 = bh2; - ah4 = bh3; - ah5 = bh4; - ah6 = bh5; - ah7 = bh6; - ah0 = bh7; - - al1 = bl0; - al2 = bl1; - al3 = bl2; - al4 = bl3; - al5 = bl4; - al6 = bl5; - al7 = bl6; - al0 = bl7; - - if (i%16 === 15) { - for (j = 0; j < 16; j++) { - // add - h = wh[j]; - l = wl[j]; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = wh[(j+9)%16]; - l = wl[(j+9)%16]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // sigma0 - th = wh[(j+1)%16]; - tl = wl[(j+1)%16]; - h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); - l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // sigma1 - th = wh[(j+14)%16]; - tl = wl[(j+14)%16]; - h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); - l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - wh[j] = (c & 0xffff) | (d << 16); - wl[j] = (a & 0xffff) | (b << 16); - } - } - } - - // add - h = ah0; - l = al0; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[0]; - l = hl[0]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[0] = ah0 = (c & 0xffff) | (d << 16); - hl[0] = al0 = (a & 0xffff) | (b << 16); - - h = ah1; - l = al1; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[1]; - l = hl[1]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[1] = ah1 = (c & 0xffff) | (d << 16); - hl[1] = al1 = (a & 0xffff) | (b << 16); - - h = ah2; - l = al2; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[2]; - l = hl[2]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[2] = ah2 = (c & 0xffff) | (d << 16); - hl[2] = al2 = (a & 0xffff) | (b << 16); - - h = ah3; - l = al3; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[3]; - l = hl[3]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[3] = ah3 = (c & 0xffff) | (d << 16); - hl[3] = al3 = (a & 0xffff) | (b << 16); - - h = ah4; - l = al4; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[4]; - l = hl[4]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[4] = ah4 = (c & 0xffff) | (d << 16); - hl[4] = al4 = (a & 0xffff) | (b << 16); - - h = ah5; - l = al5; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[5]; - l = hl[5]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[5] = ah5 = (c & 0xffff) | (d << 16); - hl[5] = al5 = (a & 0xffff) | (b << 16); - - h = ah6; - l = al6; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[6]; - l = hl[6]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[6] = ah6 = (c & 0xffff) | (d << 16); - hl[6] = al6 = (a & 0xffff) | (b << 16); - - h = ah7; - l = al7; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[7]; - l = hl[7]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[7] = ah7 = (c & 0xffff) | (d << 16); - hl[7] = al7 = (a & 0xffff) | (b << 16); - - pos += 128; - n -= 128; - } - - return n; -} - -function crypto_hash(out, m, n) { - var hh = new Int32Array(8), - hl = new Int32Array(8), - x = new Uint8Array(256), - i, b = n; - - hh[0] = 0x6a09e667; - hh[1] = 0xbb67ae85; - hh[2] = 0x3c6ef372; - hh[3] = 0xa54ff53a; - hh[4] = 0x510e527f; - hh[5] = 0x9b05688c; - hh[6] = 0x1f83d9ab; - hh[7] = 0x5be0cd19; - - hl[0] = 0xf3bcc908; - hl[1] = 0x84caa73b; - hl[2] = 0xfe94f82b; - hl[3] = 0x5f1d36f1; - hl[4] = 0xade682d1; - hl[5] = 0x2b3e6c1f; - hl[6] = 0xfb41bd6b; - hl[7] = 0x137e2179; - - crypto_hashblocks_hl(hh, hl, m, n); - n %= 128; - - for (i = 0; i < n; i++) x[i] = m[b-n+i]; - x[n] = 128; - - n = 256-128*(n<112?1:0); - x[n-9] = 0; - ts64(x, n-8, (b / 0x20000000) | 0, b << 3); - crypto_hashblocks_hl(hh, hl, x, n); - - for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); - - return 0; -} - -function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); -} - -function cswap(p, q, b) { - var i; - for (i = 0; i < 4; i++) { - sel25519(p[i], q[i], b); - } -} - -function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; -} - -function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for (i = 255; i >= 0; --i) { - b = (s[(i/8)|0] >> (i&7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } -} - -function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); -} - -function crypto_sign_keypair(pk, sk, seeded) { - var d = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()]; - var i; - - if (!seeded) randombytes(sk, 32); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - scalarbase(p, d); - pack(pk, p); - - for (i = 0; i < 32; i++) sk[i+32] = pk[i]; - return 0; -} - -var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); - -function modL(r, x) { - var carry, i, j, k; - for (i = 63; i >= 32; --i) { - carry = 0; - for (j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for (j = 0; j < 32; j++) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for (j = 0; j < 32; j++) x[j] -= carry * L[j]; - for (i = 0; i < 32; i++) { - x[i+1] += x[i] >> 8; - r[i] = x[i] & 255; - } -} - -function reduce(r) { - var x = new Float64Array(64), i; - for (i = 0; i < 64; i++) x[i] = r[i]; - for (i = 0; i < 64; i++) r[i] = 0; - modL(r, x); -} - -// Note: difference from C - smlen returned, not passed as argument. -function crypto_sign(sm, m, n, sk) { - var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - var smlen = n + 64; - for (i = 0; i < n; i++) sm[64 + i] = m[i]; - for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; - - crypto_hash(r, sm.subarray(32), n+32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - - for (i = 32; i < 64; i++) sm[i] = sk[i]; - crypto_hash(h, sm, n + 64); - reduce(h); - - for (i = 0; i < 64; i++) x[i] = 0; - for (i = 0; i < 32; i++) x[i] = r[i]; - for (i = 0; i < 32; i++) { - for (j = 0; j < 32; j++) { - x[i+j] += h[i] * d[j]; - } - } - - modL(sm.subarray(32), x); - return smlen; -} - -function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) M(r[0], r[0], I); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) return -1; - - if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); - - M(r[3], r[0], r[1]); - return 0; -} - -function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new Uint8Array(32), h = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; - - mlen = -1; - if (n < 64) return -1; - - if (unpackneg(q, pk)) return -1; - - for (i = 0; i < n; i++) m[i] = sm[i]; - for (i = 0; i < 32; i++) m[i+32] = pk[i]; - crypto_hash(h, m, n); - reduce(h); - scalarmult(p, q, h); - - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - - n -= 64; - if (crypto_verify_32(sm, 0, t, 0)) { - for (i = 0; i < n; i++) m[i] = 0; - return -1; - } - - for (i = 0; i < n; i++) m[i] = sm[i + 64]; - mlen = n; - return mlen; -} - -var crypto_secretbox_KEYBYTES = 32, - crypto_secretbox_NONCEBYTES = 24, - crypto_secretbox_ZEROBYTES = 32, - crypto_secretbox_BOXZEROBYTES = 16, - crypto_scalarmult_BYTES = 32, - crypto_scalarmult_SCALARBYTES = 32, - crypto_box_PUBLICKEYBYTES = 32, - crypto_box_SECRETKEYBYTES = 32, - crypto_box_BEFORENMBYTES = 32, - crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, - crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, - crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, - crypto_sign_BYTES = 64, - crypto_sign_PUBLICKEYBYTES = 32, - crypto_sign_SECRETKEYBYTES = 64, - crypto_sign_SEEDBYTES = 32, - crypto_hash_BYTES = 64; - -nacl.lowlevel = { - crypto_core_hsalsa20: crypto_core_hsalsa20, - crypto_stream_xor: crypto_stream_xor, - crypto_stream: crypto_stream, - crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, - crypto_stream_salsa20: crypto_stream_salsa20, - crypto_onetimeauth: crypto_onetimeauth, - crypto_onetimeauth_verify: crypto_onetimeauth_verify, - crypto_verify_16: crypto_verify_16, - crypto_verify_32: crypto_verify_32, - crypto_secretbox: crypto_secretbox, - crypto_secretbox_open: crypto_secretbox_open, - crypto_scalarmult: crypto_scalarmult, - crypto_scalarmult_base: crypto_scalarmult_base, - crypto_box_beforenm: crypto_box_beforenm, - crypto_box_afternm: crypto_box_afternm, - crypto_box: crypto_box, - crypto_box_open: crypto_box_open, - crypto_box_keypair: crypto_box_keypair, - crypto_hash: crypto_hash, - crypto_sign: crypto_sign, - crypto_sign_keypair: crypto_sign_keypair, - crypto_sign_open: crypto_sign_open, - - crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, - crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, - crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, - crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, - crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, - crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, - crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, - crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, - crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, - crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, - crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, - crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, - crypto_sign_BYTES: crypto_sign_BYTES, - crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, - crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, - crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, - crypto_hash_BYTES: crypto_hash_BYTES -}; - -/* High-level API */ - -function checkLengths(k, n) { - if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); - if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); -} - -function checkBoxLengths(pk, sk) { - if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); - if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); -} - -function checkArrayTypes() { - var t, i; - for (i = 0; i < arguments.length; i++) { - if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') - throw new TypeError('unexpected type ' + t + ', use Uint8Array'); - } -} - -function cleanup(arr) { - for (var i = 0; i < arr.length; i++) arr[i] = 0; -} - -nacl.util = {}; - -nacl.util.decodeUTF8 = function(s) { - var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; -}; - -nacl.util.encodeUTF8 = function(arr) { - var i, s = []; - for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i])); - return decodeURIComponent(escape(s.join(''))); -}; - -nacl.util.encodeBase64 = function(arr) { - if (typeof btoa === 'undefined') { - return (new Buffer(arr)).toString('base64'); - } else { - var i, s = [], len = arr.length; - for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i])); - return btoa(s.join('')); - } -}; - -nacl.util.decodeBase64 = function(s) { - if (typeof atob === 'undefined') { - return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0)); - } else { - var i, d = atob(s), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; - } -}; - -nacl.randomBytes = function(n) { - var b = new Uint8Array(n); - randombytes(b, n); - return b; -}; - -nacl.secretbox = function(msg, nonce, key) { - checkArrayTypes(msg, nonce, key); - checkLengths(key, nonce); - var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); - var c = new Uint8Array(m.length); - for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; - crypto_secretbox(c, m, m.length, nonce, key); - return c.subarray(crypto_secretbox_BOXZEROBYTES); -}; - -nacl.secretbox.open = function(box, nonce, key) { - checkArrayTypes(box, nonce, key); - checkLengths(key, nonce); - var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); - var m = new Uint8Array(c.length); - for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; - if (c.length < 32) return false; - if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; - return m.subarray(crypto_secretbox_ZEROBYTES); -}; - -nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; -nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; -nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; - -nacl.scalarMult = function(n, p) { - checkArrayTypes(n, p); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult(q, n, p); - return q; -}; - -nacl.scalarMult.base = function(n) { - checkArrayTypes(n); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult_base(q, n); - return q; -}; - -nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; -nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; - -nacl.box = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox(msg, nonce, k); -}; - -nacl.box.before = function(publicKey, secretKey) { - checkArrayTypes(publicKey, secretKey); - checkBoxLengths(publicKey, secretKey); - var k = new Uint8Array(crypto_box_BEFORENMBYTES); - crypto_box_beforenm(k, publicKey, secretKey); - return k; -}; - -nacl.box.after = nacl.secretbox; - -nacl.box.open = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox.open(msg, nonce, k); -}; - -nacl.box.open.after = nacl.secretbox.open; - -nacl.box.keyPair = function() { - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); - crypto_box_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.box.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_box_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - crypto_scalarmult_base(pk, secretKey); - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; -nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; -nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; -nacl.box.nonceLength = crypto_box_NONCEBYTES; -nacl.box.overheadLength = nacl.secretbox.overheadLength; - -nacl.sign = function(msg, secretKey) { - checkArrayTypes(msg, secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); - crypto_sign(signedMsg, msg, msg.length, secretKey); - return signedMsg; -}; - -nacl.sign.open = function(signedMsg, publicKey) { - if (arguments.length !== 2) - throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); - checkArrayTypes(signedMsg, publicKey); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var tmp = new Uint8Array(signedMsg.length); - var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); - if (mlen < 0) return null; - var m = new Uint8Array(mlen); - for (var i = 0; i < m.length; i++) m[i] = tmp[i]; - return m; -}; - -nacl.sign.detached = function(msg, secretKey) { - var signedMsg = nacl.sign(msg, secretKey); - var sig = new Uint8Array(crypto_sign_BYTES); - for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; - return sig; -}; - -nacl.sign.detached.verify = function(msg, sig, publicKey) { - checkArrayTypes(msg, sig, publicKey); - if (sig.length !== crypto_sign_BYTES) - throw new Error('bad signature size'); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var sm = new Uint8Array(crypto_sign_BYTES + msg.length); - var m = new Uint8Array(crypto_sign_BYTES + msg.length); - var i; - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); -}; - -nacl.sign.keyPair = function() { - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - crypto_sign_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.sign.keyPair.fromSeed = function(seed) { - checkArrayTypes(seed); - if (seed.length !== crypto_sign_SEEDBYTES) - throw new Error('bad seed size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - for (var i = 0; i < 32; i++) sk[i] = seed[i]; - crypto_sign_keypair(pk, sk, true); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; -nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; -nacl.sign.seedLength = crypto_sign_SEEDBYTES; -nacl.sign.signatureLength = crypto_sign_BYTES; - -nacl.hash = function(msg) { - checkArrayTypes(msg); - var h = new Uint8Array(crypto_hash_BYTES); - crypto_hash(h, msg, msg.length); - return h; -}; - -nacl.hash.hashLength = crypto_hash_BYTES; - -nacl.verify = function(x, y) { - checkArrayTypes(x, y); - // Zero length arguments are considered not equal. - if (x.length === 0 || y.length === 0) return false; - if (x.length !== y.length) return false; - return (vn(x, 0, y, 0, x.length) === 0) ? true : false; -}; - -nacl.setPRNG = function(fn) { - randombytes = fn; -}; - -(function() { - // Initialize PRNG if environment provides CSPRNG. - // If not, methods calling randombytes will throw. - var crypto; - if (typeof window !== 'undefined') { - // Browser. - if (window.crypto && window.crypto.getRandomValues) { - crypto = window.crypto; // Standard - } else if (window.msCrypto && window.msCrypto.getRandomValues) { - crypto = window.msCrypto; // Internet Explorer 11+ - } - if (crypto) { - nacl.setPRNG(function(x, n) { - var i, v = new Uint8Array(n); - crypto.getRandomValues(v); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } - } else if (typeof require !== 'undefined') { - // Node.js. - crypto = require('crypto'); - if (crypto) { - nacl.setPRNG(function(x, n) { - var i, v = crypto.randomBytes(n); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } - } -})(); - -})(typeof module !== 'undefined' && module.exports ? module.exports : (window.nacl = window.nacl || {})); diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js deleted file mode 100644 index 7072c2af..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl-fast.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(r){"use strict";function t(r,t,n,e){r[t]=n>>24&255,r[t+1]=n>>16&255,r[t+2]=n>>8&255,r[t+3]=255&n,r[t+4]=e>>24&255,r[t+5]=e>>16&255,r[t+6]=e>>8&255,r[t+7]=255&e}function n(r,t,n,e,o){var i,h=0;for(i=0;o>i;i++)h|=r[t+i]^n[e+i];return(1&h-1>>>8)-1}function e(r,t,e,o){return n(r,t,e,o,16)}function o(r,t,e,o){return n(r,t,e,o,32)}function i(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,d=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=i,U=h,E=a,x=f,M=s,m=u,B=c,S=y,K=l,T=w,Y=p,k=g,L=v,C=b,R=d,z=A,P=0;20>P;P+=2)o=_+L|0,M^=o<<7|o>>>25,o=M+_|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,_^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,C^=o<<9|o>>>23,o=C+T|0,U^=o<<13|o>>>19,o=U+C|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=z+k|0,x^=o<<7|o>>>25,o=x+z|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,z^=o<<18|o>>>14,o=_+x|0,U^=o<<7|o>>>25,o=U+_|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,_^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=z+R|0,L^=o<<7|o>>>25,o=L+z|0,C^=o<<9|o>>>23,o=C+L|0,R^=o<<13|o>>>19,o=R+C|0,z^=o<<18|o>>>14;_=_+i|0,U=U+h|0,E=E+a|0,x=x+f|0,M=M+s|0,m=m+u|0,B=B+c|0,S=S+y|0,K=K+l|0,T=T+w|0,Y=Y+p|0,k=k+g|0,L=L+v|0,C=C+b|0,R=R+d|0,z=z+A|0,r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=U>>>0&255,r[5]=U>>>8&255,r[6]=U>>>16&255,r[7]=U>>>24&255,r[8]=E>>>0&255,r[9]=E>>>8&255,r[10]=E>>>16&255,r[11]=E>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=M>>>0&255,r[17]=M>>>8&255,r[18]=M>>>16&255,r[19]=M>>>24&255,r[20]=m>>>0&255,r[21]=m>>>8&255,r[22]=m>>>16&255,r[23]=m>>>24&255,r[24]=B>>>0&255,r[25]=B>>>8&255,r[26]=B>>>16&255,r[27]=B>>>24&255,r[28]=S>>>0&255,r[29]=S>>>8&255,r[30]=S>>>16&255,r[31]=S>>>24&255,r[32]=K>>>0&255,r[33]=K>>>8&255,r[34]=K>>>16&255,r[35]=K>>>24&255,r[36]=T>>>0&255,r[37]=T>>>8&255,r[38]=T>>>16&255,r[39]=T>>>24&255,r[40]=Y>>>0&255,r[41]=Y>>>8&255,r[42]=Y>>>16&255,r[43]=Y>>>24&255,r[44]=k>>>0&255,r[45]=k>>>8&255,r[46]=k>>>16&255,r[47]=k>>>24&255,r[48]=L>>>0&255,r[49]=L>>>8&255,r[50]=L>>>16&255,r[51]=L>>>24&255,r[52]=C>>>0&255,r[53]=C>>>8&255,r[54]=C>>>16&255,r[55]=C>>>24&255,r[56]=R>>>0&255,r[57]=R>>>8&255,r[58]=R>>>16&255,r[59]=R>>>24&255,r[60]=z>>>0&255,r[61]=z>>>8&255,r[62]=z>>>16&255,r[63]=z>>>24&255}function h(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,u=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,c=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,g=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,v=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,b=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,d=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,_=i,U=h,E=a,x=f,M=s,m=u,B=c,S=y,K=l,T=w,Y=p,k=g,L=v,C=b,R=d,z=A,P=0;20>P;P+=2)o=_+L|0,M^=o<<7|o>>>25,o=M+_|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,_^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,C^=o<<9|o>>>23,o=C+T|0,U^=o<<13|o>>>19,o=U+C|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=z+k|0,x^=o<<7|o>>>25,o=x+z|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,z^=o<<18|o>>>14,o=_+x|0,U^=o<<7|o>>>25,o=U+_|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,_^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=z+R|0,L^=o<<7|o>>>25,o=L+z|0,C^=o<<9|o>>>23,o=C+L|0,R^=o<<13|o>>>19,o=R+C|0,z^=o<<18|o>>>14;r[0]=_>>>0&255,r[1]=_>>>8&255,r[2]=_>>>16&255,r[3]=_>>>24&255,r[4]=m>>>0&255,r[5]=m>>>8&255,r[6]=m>>>16&255,r[7]=m>>>24&255,r[8]=Y>>>0&255,r[9]=Y>>>8&255,r[10]=Y>>>16&255,r[11]=Y>>>24&255,r[12]=z>>>0&255,r[13]=z>>>8&255,r[14]=z>>>16&255,r[15]=z>>>24&255,r[16]=B>>>0&255,r[17]=B>>>8&255,r[18]=B>>>16&255,r[19]=B>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=K>>>0&255,r[25]=K>>>8&255,r[26]=K>>>16&255,r[27]=K>>>24&255,r[28]=T>>>0&255,r[29]=T>>>8&255,r[30]=T>>>16&255,r[31]=T>>>24&255}function a(r,t,n,e){i(r,t,n,e)}function f(r,t,n,e){h(r,t,n,e)}function s(r,t,n,e,o,i,h){var f,s,u=new Uint8Array(16),c=new Uint8Array(64);for(s=0;16>s;s++)u[s]=0;for(s=0;8>s;s++)u[s]=i[s];for(;o>=64;){for(a(c,u,h,cr),s=0;64>s;s++)r[t+s]=n[e+s]^c[s];for(f=1,s=8;16>s;s++)f=f+(255&u[s])|0,u[s]=255&f,f>>>=8;o-=64,t+=64,e+=64}if(o>0)for(a(c,u,h,cr),s=0;o>s;s++)r[t+s]=n[e+s]^c[s];return 0}function u(r,t,n,e,o){var i,h,f=new Uint8Array(16),s=new Uint8Array(64);for(h=0;16>h;h++)f[h]=0;for(h=0;8>h;h++)f[h]=e[h];for(;n>=64;){for(a(s,f,o,cr),h=0;64>h;h++)r[t+h]=s[h];for(i=1,h=8;16>h;h++)i=i+(255&f[h])|0,f[h]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(a(s,f,o,cr),h=0;n>h;h++)r[t+h]=s[h];return 0}function c(r,t,n,e,o){var i=new Uint8Array(32);f(i,e,o,cr);for(var h=new Uint8Array(8),a=0;8>a;a++)h[a]=e[a+16];return u(r,t,n,h,i)}function y(r,t,n,e,o,i,h){var a=new Uint8Array(32);f(a,i,h,cr);for(var u=new Uint8Array(8),c=0;8>c;c++)u[c]=i[c+16];return s(r,t,n,e,o,u,a)}function l(r,t,n,e,o,i){var h=new yr(i);return h.update(n,e,o),h.finish(r,t),0}function w(r,t,n,o,i,h){var a=new Uint8Array(16);return l(a,0,n,o,i,h),e(r,t,a,0)}function p(r,t,n,e,o){var i;if(32>n)return-1;for(y(r,0,t,0,n,e,o),l(r,16,r,32,n-32,r),i=0;16>i;i++)r[i]=0;return 0}function g(r,t,n,e,o){var i,h=new Uint8Array(32);if(32>n)return-1;if(c(h,0,32,e,o),0!==w(t,16,t,32,n-32,h))return-1;for(y(r,0,t,0,n,e,o),i=0;32>i;i++)r[i]=0;return 0}function v(r,t){var n;for(n=0;16>n;n++)r[n]=0|t[n]}function b(r){var t,n,e=1;for(t=0;16>t;t++)n=r[t]+e+65535,e=Math.floor(n/65536),r[t]=n-65536*e;r[0]+=e-1+37*(e-1)}function d(r,t,n){for(var e,o=~(n-1),i=0;16>i;i++)e=o&(r[i]^t[i]),r[i]^=e,t[i]^=e}function A(r,t){var n,e,o,i=$(),h=$();for(n=0;16>n;n++)h[n]=t[n];for(b(h),b(h),b(h),e=0;2>e;e++){for(i[0]=h[0]-65517,n=1;15>n;n++)i[n]=h[n]-65535-(i[n-1]>>16&1),i[n-1]&=65535;i[15]=h[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,d(h,i,1-o)}for(n=0;16>n;n++)r[2*n]=255&h[n],r[2*n+1]=h[n]>>8}function _(r,t){var n=new Uint8Array(32),e=new Uint8Array(32);return A(n,r),A(e,t),o(n,0,e,0)}function U(r){var t=new Uint8Array(32);return A(t,r),1&t[0]}function E(r,t){var n;for(n=0;16>n;n++)r[n]=t[2*n]+(t[2*n+1]<<8);r[15]&=32767}function x(r,t,n){for(var e=0;16>e;e++)r[e]=t[e]+n[e]}function M(r,t,n){for(var e=0;16>e;e++)r[e]=t[e]-n[e]}function m(r,t,n){var e,o,i=0,h=0,a=0,f=0,s=0,u=0,c=0,y=0,l=0,w=0,p=0,g=0,v=0,b=0,d=0,A=0,_=0,U=0,E=0,x=0,M=0,m=0,B=0,S=0,K=0,T=0,Y=0,k=0,L=0,C=0,R=0,z=n[0],P=n[1],O=n[2],N=n[3],F=n[4],I=n[5],j=n[6],G=n[7],Z=n[8],V=n[9],q=n[10],X=n[11],D=n[12],H=n[13],J=n[14],Q=n[15];e=t[0],i+=e*z,h+=e*P,a+=e*O,f+=e*N,s+=e*F,u+=e*I,c+=e*j,y+=e*G,l+=e*Z,w+=e*V,p+=e*q,g+=e*X,v+=e*D,b+=e*H,d+=e*J,A+=e*Q,e=t[1],h+=e*z,a+=e*P,f+=e*O,s+=e*N,u+=e*F,c+=e*I,y+=e*j,l+=e*G,w+=e*Z,p+=e*V,g+=e*q,v+=e*X,b+=e*D,d+=e*H,A+=e*J,_+=e*Q,e=t[2],a+=e*z,f+=e*P,s+=e*O,u+=e*N,c+=e*F,y+=e*I,l+=e*j,w+=e*G,p+=e*Z,g+=e*V,v+=e*q,b+=e*X,d+=e*D,A+=e*H,_+=e*J,U+=e*Q,e=t[3],f+=e*z,s+=e*P,u+=e*O,c+=e*N,y+=e*F,l+=e*I,w+=e*j,p+=e*G,g+=e*Z,v+=e*V,b+=e*q,d+=e*X,A+=e*D,_+=e*H,U+=e*J,E+=e*Q,e=t[4],s+=e*z,u+=e*P,c+=e*O,y+=e*N,l+=e*F,w+=e*I,p+=e*j,g+=e*G,v+=e*Z,b+=e*V,d+=e*q,A+=e*X,_+=e*D,U+=e*H,E+=e*J,x+=e*Q,e=t[5],u+=e*z,c+=e*P,y+=e*O,l+=e*N,w+=e*F,p+=e*I,g+=e*j,v+=e*G,b+=e*Z,d+=e*V,A+=e*q,_+=e*X,U+=e*D,E+=e*H,x+=e*J,M+=e*Q,e=t[6],c+=e*z,y+=e*P,l+=e*O,w+=e*N,p+=e*F,g+=e*I,v+=e*j,b+=e*G,d+=e*Z,A+=e*V,_+=e*q,U+=e*X,E+=e*D,x+=e*H,M+=e*J,m+=e*Q,e=t[7],y+=e*z,l+=e*P,w+=e*O,p+=e*N,g+=e*F,v+=e*I,b+=e*j,d+=e*G,A+=e*Z,_+=e*V,U+=e*q,E+=e*X,x+=e*D,M+=e*H,m+=e*J,B+=e*Q,e=t[8],l+=e*z,w+=e*P,p+=e*O,g+=e*N,v+=e*F,b+=e*I,d+=e*j,A+=e*G,_+=e*Z,U+=e*V,E+=e*q,x+=e*X,M+=e*D,m+=e*H,B+=e*J,S+=e*Q,e=t[9],w+=e*z,p+=e*P,g+=e*O,v+=e*N,b+=e*F,d+=e*I,A+=e*j,_+=e*G,U+=e*Z,E+=e*V,x+=e*q,M+=e*X,m+=e*D,B+=e*H,S+=e*J,K+=e*Q,e=t[10],p+=e*z,g+=e*P,v+=e*O,b+=e*N,d+=e*F,A+=e*I,_+=e*j,U+=e*G,E+=e*Z,x+=e*V,M+=e*q,m+=e*X,B+=e*D,S+=e*H,K+=e*J,T+=e*Q,e=t[11],g+=e*z,v+=e*P,b+=e*O,d+=e*N,A+=e*F,_+=e*I,U+=e*j,E+=e*G,x+=e*Z,M+=e*V,m+=e*q,B+=e*X,S+=e*D,K+=e*H,T+=e*J,Y+=e*Q,e=t[12],v+=e*z,b+=e*P,d+=e*O,A+=e*N,_+=e*F,U+=e*I,E+=e*j,x+=e*G,M+=e*Z,m+=e*V,B+=e*q,S+=e*X,K+=e*D,T+=e*H,Y+=e*J,k+=e*Q,e=t[13],b+=e*z,d+=e*P,A+=e*O,_+=e*N,U+=e*F,E+=e*I,x+=e*j,M+=e*G,m+=e*Z,B+=e*V,S+=e*q,K+=e*X,T+=e*D,Y+=e*H,k+=e*J,L+=e*Q,e=t[14],d+=e*z,A+=e*P,_+=e*O,U+=e*N,E+=e*F,x+=e*I,M+=e*j,m+=e*G,B+=e*Z,S+=e*V,K+=e*q,T+=e*X,Y+=e*D,k+=e*H,L+=e*J,C+=e*Q,e=t[15],A+=e*z,_+=e*P,U+=e*O,E+=e*N,x+=e*F,M+=e*I,m+=e*j,B+=e*G,S+=e*Z,K+=e*V,T+=e*q,Y+=e*X,k+=e*D,L+=e*H,C+=e*J,R+=e*Q,i+=38*_,h+=38*U,a+=38*E,f+=38*x,s+=38*M,u+=38*m,c+=38*B,y+=38*S,l+=38*K,w+=38*T,p+=38*Y,g+=38*k,v+=38*L,b+=38*C,d+=38*R,o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=d+o+65535,o=Math.floor(e/65536),d=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=d+o+65535,o=Math.floor(e/65536),d=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),r[0]=i,r[1]=h,r[2]=a,r[3]=f,r[4]=s,r[5]=u,r[6]=c,r[7]=y,r[8]=l,r[9]=w,r[10]=p,r[11]=g,r[12]=v,r[13]=b,r[14]=d,r[15]=A}function B(r,t){m(r,t,t)}function S(r,t){var n,e=$();for(n=0;16>n;n++)e[n]=t[n];for(n=253;n>=0;n--)B(e,e),2!==n&&4!==n&&m(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function K(r,t){var n,e=$();for(n=0;16>n;n++)e[n]=t[n];for(n=250;n>=0;n--)B(e,e),1!==n&&m(e,e,t);for(n=0;16>n;n++)r[n]=e[n]}function T(r,t,n){var e,o,i=new Uint8Array(32),h=new Float64Array(80),a=$(),f=$(),s=$(),u=$(),c=$(),y=$();for(o=0;31>o;o++)i[o]=t[o];for(i[31]=127&t[31]|64,i[0]&=248,E(h,n),o=0;16>o;o++)f[o]=h[o],u[o]=a[o]=s[o]=0;for(a[0]=u[0]=1,o=254;o>=0;--o)e=i[o>>>3]>>>(7&o)&1,d(a,f,e),d(s,u,e),x(c,a,s),M(a,a,s),x(s,f,u),M(f,f,u),B(u,c),B(y,a),m(a,s,a),m(s,f,c),x(c,a,s),M(a,a,s),B(f,a),M(s,u,y),m(a,s,ir),x(a,a,u),m(s,s,a),m(a,u,y),m(u,f,h),B(f,c),d(a,f,e),d(s,u,e);for(o=0;16>o;o++)h[o+16]=a[o],h[o+32]=s[o],h[o+48]=f[o],h[o+64]=u[o];var l=h.subarray(32),w=h.subarray(16);return S(l,l),m(w,w,l),A(r,w),0}function Y(r,t){return T(r,t,nr)}function k(r,t){return rr(t,32),Y(r,t)}function L(r,t,n){var e=new Uint8Array(32);return T(e,n,t),f(r,tr,e,cr)}function C(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),lr(r,t,n,e,h)}function R(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),wr(r,t,n,e,h)}function z(r,t,n,e){for(var o,i,h,a,f,s,u,c,y,l,w,p,g,v,b,d,A,_,U,E,x,M,m,B,S,K,T=new Int32Array(16),Y=new Int32Array(16),k=r[0],L=r[1],C=r[2],R=r[3],z=r[4],P=r[5],O=r[6],N=r[7],F=t[0],I=t[1],j=t[2],G=t[3],Z=t[4],V=t[5],q=t[6],X=t[7],D=0;e>=128;){for(U=0;16>U;U++)E=8*U+D,T[U]=n[E+0]<<24|n[E+1]<<16|n[E+2]<<8|n[E+3],Y[U]=n[E+4]<<24|n[E+5]<<16|n[E+6]<<8|n[E+7];for(U=0;80>U;U++)if(o=k,i=L,h=C,a=R,f=z,s=P,u=O,c=N,y=F,l=I,w=j,p=G,g=Z,v=V,b=q,d=X,x=N,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(z>>>14|Z<<18)^(z>>>18|Z<<14)^(Z>>>9|z<<23),M=(Z>>>14|z<<18)^(Z>>>18|z<<14)^(z>>>9|Z<<23),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=z&P^~z&O,M=Z&V^~Z&q,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=pr[2*U],M=pr[2*U+1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=T[U%16],M=Y[U%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,A=65535&S|K<<16,_=65535&m|B<<16,x=A,M=_,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(k>>>28|F<<4)^(F>>>2|k<<30)^(F>>>7|k<<25),M=(F>>>28|k<<4)^(k>>>2|F<<30)^(k>>>7|F<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=k&L^k&C^L&C,M=F&I^F&j^I&j,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,c=65535&S|K<<16,d=65535&m|B<<16,x=a,M=p,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=A,M=_,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,a=65535&S|K<<16,p=65535&m|B<<16,L=o,C=i,R=h,z=a,P=f,O=s,N=u,k=c,I=y,j=l,G=w,Z=p,V=g,q=v,X=b,F=d,U%16===15)for(E=0;16>E;E++)x=T[E],M=Y[E],m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=T[(E+9)%16],M=Y[(E+9)%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+1)%16],_=Y[(E+1)%16],x=(A>>>1|_<<31)^(A>>>8|_<<24)^A>>>7,M=(_>>>1|A<<31)^(_>>>8|A<<24)^(_>>>7|A<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+14)%16],_=Y[(E+14)%16],x=(A>>>19|_<<13)^(_>>>29|A<<3)^A>>>6,M=(_>>>19|A<<13)^(A>>>29|_<<3)^(_>>>6|A<<26),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,T[E]=65535&S|K<<16,Y[E]=65535&m|B<<16;x=k,M=F,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[0],M=t[0],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[0]=k=65535&S|K<<16,t[0]=F=65535&m|B<<16,x=L,M=I,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[1],M=t[1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[1]=L=65535&S|K<<16,t[1]=I=65535&m|B<<16,x=C,M=j,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[2],M=t[2],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[2]=C=65535&S|K<<16,t[2]=j=65535&m|B<<16,x=R,M=G,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[3],M=t[3],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[3]=R=65535&S|K<<16,t[3]=G=65535&m|B<<16,x=z,M=Z,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[4],M=t[4],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[4]=z=65535&S|K<<16,t[4]=Z=65535&m|B<<16,x=P,M=V,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[5],M=t[5],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[5]=P=65535&S|K<<16,t[5]=V=65535&m|B<<16,x=O,M=q,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[6],M=t[6],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[6]=O=65535&S|K<<16,t[6]=q=65535&m|B<<16,x=N,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[7],M=t[7],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[7]=N=65535&S|K<<16,t[7]=X=65535&m|B<<16,D+=128,e-=128}return e}function P(r,n,e){var o,i=new Int32Array(8),h=new Int32Array(8),a=new Uint8Array(256),f=e;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,h[0]=4089235720,h[1]=2227873595,h[2]=4271175723,h[3]=1595750129,h[4]=2917565137,h[5]=725511199,h[6]=4215389547,h[7]=327033209,z(i,h,n,e),e%=128,o=0;e>o;o++)a[o]=n[f-e+o];for(a[e]=128,e=256-128*(112>e?1:0),a[e-9]=0,t(a,e-8,f/536870912|0,f<<3),z(i,h,a,e),o=0;8>o;o++)t(r,8*o,i[o],h[o]);return 0}function O(r,t){var n=$(),e=$(),o=$(),i=$(),h=$(),a=$(),f=$(),s=$(),u=$();M(n,r[1],r[0]),M(u,t[1],t[0]),m(n,n,u),x(e,r[0],r[1]),x(u,t[0],t[1]),m(e,e,u),m(o,r[3],t[3]),m(o,o,ar),m(i,r[2],t[2]),x(i,i,i),M(h,e,n),M(a,i,o),x(f,i,o),x(s,e,n),m(r[0],h,a),m(r[1],s,f),m(r[2],f,a),m(r[3],h,s)}function N(r,t,n){var e;for(e=0;4>e;e++)d(r[e],t[e],n)}function F(r,t){var n=$(),e=$(),o=$();S(o,t[2]),m(n,t[0],o),m(e,t[1],o),A(r,e),r[31]^=U(n)<<7}function I(r,t,n){var e,o;for(v(r[0],er),v(r[1],or),v(r[2],or),v(r[3],er),o=255;o>=0;--o)e=n[o/8|0]>>(7&o)&1,N(r,t,e),O(t,r),O(r,r),N(r,t,e)}function j(r,t){var n=[$(),$(),$(),$()];v(n[0],fr),v(n[1],sr),v(n[2],or),m(n[3],fr,sr),I(r,n,t)}function G(r,t,n){var e,o=new Uint8Array(64),i=[$(),$(),$(),$()];for(n||rr(t,32),P(o,t,32),o[0]&=248,o[31]&=127,o[31]|=64,j(i,o),F(r,i),e=0;32>e;e++)t[e+32]=r[e];return 0}function Z(r,t){var n,e,o,i;for(e=63;e>=32;--e){for(n=0,o=e-32,i=e-12;i>o;++o)t[o]+=n-16*t[e]*gr[o-(e-32)],n=t[o]+128>>8,t[o]-=256*n;t[o]+=n,t[e]=0}for(n=0,o=0;32>o;o++)t[o]+=n-(t[31]>>4)*gr[o],n=t[o]>>8,t[o]&=255;for(o=0;32>o;o++)t[o]-=n*gr[o];for(e=0;32>e;e++)t[e+1]+=t[e]>>8,r[e]=255&t[e]}function V(r){var t,n=new Float64Array(64);for(t=0;64>t;t++)n[t]=r[t];for(t=0;64>t;t++)r[t]=0;Z(r,n)}function q(r,t,n,e){var o,i,h=new Uint8Array(64),a=new Uint8Array(64),f=new Uint8Array(64),s=new Float64Array(64),u=[$(),$(),$(),$()];P(h,e,32),h[0]&=248,h[31]&=127,h[31]|=64;var c=n+64;for(o=0;n>o;o++)r[64+o]=t[o];for(o=0;32>o;o++)r[32+o]=h[32+o];for(P(f,r.subarray(32),n+32),V(f),j(u,f),F(r,u),o=32;64>o;o++)r[o]=e[o];for(P(a,r,n+64),V(a),o=0;64>o;o++)s[o]=0;for(o=0;32>o;o++)s[o]=f[o];for(o=0;32>o;o++)for(i=0;32>i;i++)s[o+i]+=a[o]*h[i];return Z(r.subarray(32),s),c}function X(r,t){var n=$(),e=$(),o=$(),i=$(),h=$(),a=$(),f=$();return v(r[2],or),E(r[1],t),B(o,r[1]),m(i,o,hr),M(o,o,r[2]),x(i,r[2],i),B(h,i),B(a,h),m(f,a,h),m(n,f,o),m(n,n,i),K(n,n),m(n,n,o),m(n,n,i),m(n,n,i),m(r[0],n,i),B(e,r[0]),m(e,e,i),_(e,o)&&m(r[0],r[0],ur),B(e,r[0]),m(e,e,i),_(e,o)?-1:(U(r[0])===t[31]>>7&&M(r[0],er,r[0]),m(r[3],r[0],r[1]),0)}function D(r,t,n,e){var i,h,a=new Uint8Array(32),f=new Uint8Array(64),s=[$(),$(),$(),$()],u=[$(),$(),$(),$()];if(h=-1,64>n)return-1;if(X(u,e))return-1;for(i=0;n>i;i++)r[i]=t[i];for(i=0;32>i;i++)r[i+32]=e[i];if(P(f,r,n),V(f),I(s,u,f),j(u,t.subarray(32)),O(s,u),F(a,s),n-=64,o(t,0,a,0)){for(i=0;n>i;i++)r[i]=0;return-1}for(i=0;n>i;i++)r[i]=t[i+64];return h=n}function H(r,t){if(r.length!==vr)throw new Error("bad key size");if(t.length!==br)throw new Error("bad nonce size")}function J(r,t){if(r.length!==Er)throw new Error("bad public key size");if(t.length!==xr)throw new Error("bad secret key size")}function Q(){var r,t;for(t=0;t>>13|n<<3),e=255&r[4]|(255&r[5])<<8,this.r[2]=7939&(n>>>10|e<<6),o=255&r[6]|(255&r[7])<<8,this.r[3]=8191&(e>>>7|o<<9),i=255&r[8]|(255&r[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,h=255&r[10]|(255&r[11])<<8,this.r[6]=8191&(i>>>14|h<<2),a=255&r[12]|(255&r[13])<<8,this.r[7]=8065&(h>>>11|a<<5),f=255&r[14]|(255&r[15])<<8,this.r[8]=8191&(a>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&r[16]|(255&r[17])<<8,this.pad[1]=255&r[18]|(255&r[19])<<8,this.pad[2]=255&r[20]|(255&r[21])<<8,this.pad[3]=255&r[22]|(255&r[23])<<8,this.pad[4]=255&r[24]|(255&r[25])<<8,this.pad[5]=255&r[26]|(255&r[27])<<8,this.pad[6]=255&r[28]|(255&r[29])<<8,this.pad[7]=255&r[30]|(255&r[31])<<8};yr.prototype.blocks=function(r,t,n){for(var e,o,i,h,a,f,s,u,c,y,l,w,p,g,v,b,d,A,_,U=this.fin?0:2048,E=this.h[0],x=this.h[1],M=this.h[2],m=this.h[3],B=this.h[4],S=this.h[5],K=this.h[6],T=this.h[7],Y=this.h[8],k=this.h[9],L=this.r[0],C=this.r[1],R=this.r[2],z=this.r[3],P=this.r[4],O=this.r[5],N=this.r[6],F=this.r[7],I=this.r[8],j=this.r[9];n>=16;)e=255&r[t+0]|(255&r[t+1])<<8,E+=8191&e,o=255&r[t+2]|(255&r[t+3])<<8,x+=8191&(e>>>13|o<<3),i=255&r[t+4]|(255&r[t+5])<<8,M+=8191&(o>>>10|i<<6),h=255&r[t+6]|(255&r[t+7])<<8,m+=8191&(i>>>7|h<<9),a=255&r[t+8]|(255&r[t+9])<<8,B+=8191&(h>>>4|a<<12),S+=a>>>1&8191,f=255&r[t+10]|(255&r[t+11])<<8,K+=8191&(a>>>14|f<<2),s=255&r[t+12]|(255&r[t+13])<<8,T+=8191&(f>>>11|s<<5),u=255&r[t+14]|(255&r[t+15])<<8,Y+=8191&(s>>>8|u<<8),k+=u>>>5|U,c=0,y=c,y+=E*L,y+=5*x*j,y+=5*M*I,y+=5*m*F,y+=5*B*N,c=y>>>13,y&=8191,y+=5*S*O,y+=5*K*P,y+=5*T*z,y+=5*Y*R,y+=5*k*C,c+=y>>>13,y&=8191,l=c,l+=E*C,l+=x*L,l+=5*M*j,l+=5*m*I,l+=5*B*F,c=l>>>13,l&=8191,l+=5*S*N,l+=5*K*O,l+=5*T*P,l+=5*Y*z,l+=5*k*R,c+=l>>>13,l&=8191,w=c,w+=E*R,w+=x*C,w+=M*L,w+=5*m*j,w+=5*B*I,c=w>>>13,w&=8191,w+=5*S*F,w+=5*K*N,w+=5*T*O,w+=5*Y*P,w+=5*k*z,c+=w>>>13,w&=8191,p=c,p+=E*z,p+=x*R,p+=M*C,p+=m*L,p+=5*B*j,c=p>>>13,p&=8191,p+=5*S*I,p+=5*K*F,p+=5*T*N,p+=5*Y*O,p+=5*k*P,c+=p>>>13,p&=8191,g=c,g+=E*P,g+=x*z,g+=M*R,g+=m*C,g+=B*L,c=g>>>13,g&=8191,g+=5*S*j,g+=5*K*I,g+=5*T*F,g+=5*Y*N,g+=5*k*O,c+=g>>>13,g&=8191,v=c,v+=E*O,v+=x*P,v+=M*z,v+=m*R,v+=B*C,c=v>>>13,v&=8191,v+=S*L,v+=5*K*j,v+=5*T*I,v+=5*Y*F,v+=5*k*N,c+=v>>>13,v&=8191,b=c,b+=E*N,b+=x*O,b+=M*P,b+=m*z,b+=B*R,c=b>>>13,b&=8191,b+=S*C,b+=K*L,b+=5*T*j,b+=5*Y*I,b+=5*k*F,c+=b>>>13,b&=8191,d=c,d+=E*F,d+=x*N,d+=M*O,d+=m*P,d+=B*z,c=d>>>13,d&=8191,d+=S*R,d+=K*C,d+=T*L,d+=5*Y*j,d+=5*k*I,c+=d>>>13,d&=8191,A=c,A+=E*I,A+=x*F,A+=M*N,A+=m*O,A+=B*P,c=A>>>13,A&=8191,A+=S*z,A+=K*R,A+=T*C,A+=Y*L,A+=5*k*j,c+=A>>>13,A&=8191,_=c,_+=E*j,_+=x*I,_+=M*F,_+=m*N,_+=B*O,c=_>>>13,_&=8191,_+=S*P,_+=K*z,_+=T*R,_+=Y*C,_+=k*L,c+=_>>>13,_&=8191,c=(c<<2)+c|0,c=c+y|0,y=8191&c,c>>>=13,l+=c,E=y,x=l,M=w,m=p,B=g,S=v,K=b,T=d,Y=A,k=_,t+=16,n-=16;this.h[0]=E,this.h[1]=x,this.h[2]=M,this.h[3]=m,this.h[4]=B,this.h[5]=S,this.h[6]=K,this.h[7]=T,this.h[8]=Y,this.h[9]=k},yr.prototype.finish=function(r,t){var n,e,o,i,h=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;16>i;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;10>i;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,h[0]=this.h[0]+5,n=h[0]>>>13,h[0]&=8191,i=1;10>i;i++)h[i]=this.h[i]+n,n=h[i]>>>13,h[i]&=8191;for(h[9]-=8192,e=(h[9]>>>15)-1,i=0;10>i;i++)h[i]&=e;for(e=~e,i=0;10>i;i++)this.h[i]=this.h[i]&e|h[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;8>i;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;r[t+0]=this.h[0]>>>0&255,r[t+1]=this.h[0]>>>8&255,r[t+2]=this.h[1]>>>0&255,r[t+3]=this.h[1]>>>8&255,r[t+4]=this.h[2]>>>0&255,r[t+5]=this.h[2]>>>8&255,r[t+6]=this.h[3]>>>0&255,r[t+7]=this.h[3]>>>8&255,r[t+8]=this.h[4]>>>0&255,r[t+9]=this.h[4]>>>8&255,r[t+10]=this.h[5]>>>0&255,r[t+11]=this.h[5]>>>8&255,r[t+12]=this.h[6]>>>0&255,r[t+13]=this.h[6]>>>8&255,r[t+14]=this.h[7]>>>0&255,r[t+15]=this.h[7]>>>8&255},yr.prototype.update=function(r,t,n){var e,o;if(this.leftover){for(o=16-this.leftover,o>n&&(o=n),e=0;o>e;e++)this.buffer[this.leftover+e]=r[t+e];if(n-=o,t+=o,this.leftover+=o,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(n>=16&&(o=n-n%16,this.blocks(r,t,o),t+=o,n-=o),n){for(e=0;n>e;e++)this.buffer[this.leftover+e]=r[t+e];this.leftover+=n}};var lr=p,wr=g,pr=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],gr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),vr=32,br=24,dr=32,Ar=16,_r=32,Ur=32,Er=32,xr=32,Mr=32,mr=br,Br=dr,Sr=Ar,Kr=64,Tr=32,Yr=64,kr=32,Lr=64;r.lowlevel={crypto_core_hsalsa20:f,crypto_stream_xor:y,crypto_stream:c,crypto_stream_salsa20_xor:s,crypto_stream_salsa20:u,crypto_onetimeauth:l,crypto_onetimeauth_verify:w,crypto_verify_16:e,crypto_verify_32:o,crypto_secretbox:p,crypto_secretbox_open:g,crypto_scalarmult:T,crypto_scalarmult_base:Y,crypto_box_beforenm:L,crypto_box_afternm:lr,crypto_box:C,crypto_box_open:R,crypto_box_keypair:k,crypto_hash:P,crypto_sign:q,crypto_sign_keypair:G,crypto_sign_open:D,crypto_secretbox_KEYBYTES:vr,crypto_secretbox_NONCEBYTES:br,crypto_secretbox_ZEROBYTES:dr,crypto_secretbox_BOXZEROBYTES:Ar,crypto_scalarmult_BYTES:_r,crypto_scalarmult_SCALARBYTES:Ur,crypto_box_PUBLICKEYBYTES:Er,crypto_box_SECRETKEYBYTES:xr,crypto_box_BEFORENMBYTES:Mr,crypto_box_NONCEBYTES:mr,crypto_box_ZEROBYTES:Br,crypto_box_BOXZEROBYTES:Sr,crypto_sign_BYTES:Kr,crypto_sign_PUBLICKEYBYTES:Tr,crypto_sign_SECRETKEYBYTES:Yr,crypto_sign_SEEDBYTES:kr,crypto_hash_BYTES:Lr},r.util={},r.util.decodeUTF8=function(r){var t,n=unescape(encodeURIComponent(r)),e=new Uint8Array(n.length);for(t=0;tt;t++)n.push(String.fromCharCode(r[t]));return btoa(n.join(""))},r.util.decodeBase64=function(r){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0));var t,n=atob(r),e=new Uint8Array(n.length);for(t=0;te)return null;for(var o=new Uint8Array(e),i=0;ie;e++)o[e]=t[e];for(e=0;e=0},r.sign.keyPair=function(){var r=new Uint8Array(Tr),t=new Uint8Array(Yr);return G(r,t),{publicKey:r,secretKey:t}},r.sign.keyPair.fromSecretKey=function(r){if(Q(r),r.length!==Yr)throw new Error("bad secret key size");for(var t=new Uint8Array(Tr),n=0;ne;e++)n[e]=r[e];return G(t,n,!0),{publicKey:t,secretKey:n}},r.sign.publicKeyLength=Tr,r.sign.secretKeyLength=Yr,r.sign.seedLength=kr,r.sign.signatureLength=Kr,r.hash=function(r){Q(r);var t=new Uint8Array(Lr);return P(t,r,r.length),t},r.hash.hashLength=Lr,r.verify=function(r,t){return Q(r,t),0===r.length||0===t.length?!1:r.length!==t.length?!1:0===n(r,0,t,0,r.length)?!0:!1},r.setPRNG=function(r){rr=r},function(){var t;"undefined"!=typeof window?(window.crypto&&window.crypto.getRandomValues?t=window.crypto:window.msCrypto&&window.msCrypto.getRandomValues&&(t=window.msCrypto),t&&r.setPRNG(function(r,n){var e,o=new Uint8Array(n);for(t.getRandomValues(o),e=0;n>e;e++)r[e]=o[e];W(o)})):"undefined"!=typeof require&&(t=require("crypto"),t&&r.setPRNG(function(r,n){var e,o=t.randomBytes(n);for(e=0;n>e;e++)r[e]=o[e];W(o)}))}()}("undefined"!=typeof module&&module.exports?module.exports:window.nacl=window.nacl||{}); \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js deleted file mode 100644 index b8edbbee..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.js +++ /dev/null @@ -1,1205 +0,0 @@ -(function(nacl) { -'use strict'; - -// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. -// Public domain. -// -// Implementation derived from TweetNaCl version 20140427. -// See for details: http://tweetnacl.cr.yp.to/ - -var u64 = function(h, l) { this.hi = h|0 >>> 0; this.lo = l|0 >>> 0; }; -var gf = function(init) { - var i, r = new Float64Array(16); - if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; - return r; -}; - -// Pluggable, initialized in high-level API below. -var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; - -var _0 = new Uint8Array(16); -var _9 = new Uint8Array(32); _9[0] = 9; - -var gf0 = gf(), - gf1 = gf([1]), - _121665 = gf([0xdb41, 1]), - D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), - D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), - X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), - Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), - I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - -function L32(x, c) { return (x << c) | (x >>> (32 - c)); } - -function ld32(x, i) { - var u = x[i+3] & 0xff; - u = (u<<8)|(x[i+2] & 0xff); - u = (u<<8)|(x[i+1] & 0xff); - return (u<<8)|(x[i+0] & 0xff); -} - -function dl64(x, i) { - var h = (x[i] << 24) | (x[i+1] << 16) | (x[i+2] << 8) | x[i+3]; - var l = (x[i+4] << 24) | (x[i+5] << 16) | (x[i+6] << 8) | x[i+7]; - return new u64(h, l); -} - -function st32(x, j, u) { - var i; - for (i = 0; i < 4; i++) { x[j+i] = u & 255; u >>>= 8; } -} - -function ts64(x, i, u) { - x[i] = (u.hi >> 24) & 0xff; - x[i+1] = (u.hi >> 16) & 0xff; - x[i+2] = (u.hi >> 8) & 0xff; - x[i+3] = u.hi & 0xff; - x[i+4] = (u.lo >> 24) & 0xff; - x[i+5] = (u.lo >> 16) & 0xff; - x[i+6] = (u.lo >> 8) & 0xff; - x[i+7] = u.lo & 0xff; -} - -function vn(x, xi, y, yi, n) { - var i,d = 0; - for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; - return (1 & ((d - 1) >>> 8)) - 1; -} - -function crypto_verify_16(x, xi, y, yi) { - return vn(x,xi,y,yi,16); -} - -function crypto_verify_32(x, xi, y, yi) { - return vn(x,xi,y,yi,32); -} - -function core(out,inp,k,c,h) { - var w = new Uint32Array(16), x = new Uint32Array(16), - y = new Uint32Array(16), t = new Uint32Array(4); - var i, j, m; - - for (i = 0; i < 4; i++) { - x[5*i] = ld32(c, 4*i); - x[1+i] = ld32(k, 4*i); - x[6+i] = ld32(inp, 4*i); - x[11+i] = ld32(k, 16+4*i); - } - - for (i = 0; i < 16; i++) y[i] = x[i]; - - for (i = 0; i < 20; i++) { - for (j = 0; j < 4; j++) { - for (m = 0; m < 4; m++) t[m] = x[(5*j+4*m)%16]; - t[1] ^= L32((t[0]+t[3])|0, 7); - t[2] ^= L32((t[1]+t[0])|0, 9); - t[3] ^= L32((t[2]+t[1])|0,13); - t[0] ^= L32((t[3]+t[2])|0,18); - for (m = 0; m < 4; m++) w[4*j+(j+m)%4] = t[m]; - } - for (m = 0; m < 16; m++) x[m] = w[m]; - } - - if (h) { - for (i = 0; i < 16; i++) x[i] = (x[i] + y[i]) | 0; - for (i = 0; i < 4; i++) { - x[5*i] = (x[5*i] - ld32(c, 4*i)) | 0; - x[6+i] = (x[6+i] - ld32(inp, 4*i)) | 0; - } - for (i = 0; i < 4; i++) { - st32(out,4*i,x[5*i]); - st32(out,16+4*i,x[6+i]); - } - } else { - for (i = 0; i < 16; i++) st32(out, 4 * i, (x[i] + y[i]) | 0); - } -} - -function crypto_core_salsa20(out,inp,k,c) { - core(out,inp,k,c,false); - return 0; -} - -function crypto_core_hsalsa20(out,inp,k,c) { - core(out,inp,k,c,true); - return 0; -} - -var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - // "expand 32-byte k" - -function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - if (!b) return 0; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - if (m) mpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i]; - } - return 0; -} - -function crypto_stream_salsa20(c,cpos,d,n,k) { - return crypto_stream_salsa20_xor(c,cpos,null,0,d,n,k); -} - -function crypto_stream(c,cpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - return crypto_stream_salsa20(c,cpos,d,n.subarray(16),s); -} - -function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,n.subarray(16),s); -} - -function add1305(h, c) { - var j, u = 0; - for (j = 0; j < 17; j++) { - u = (u + ((h[j] + c[j]) | 0)) | 0; - h[j] = u & 255; - u >>>= 8; - } -} - -var minusp = new Uint32Array([ - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252 -]); - -function crypto_onetimeauth(out, outpos, m, mpos, n, k) { - var s, i, j, u; - var x = new Uint32Array(17), r = new Uint32Array(17), - h = new Uint32Array(17), c = new Uint32Array(17), - g = new Uint32Array(17); - for (j = 0; j < 17; j++) r[j]=h[j]=0; - for (j = 0; j < 16; j++) r[j]=k[j]; - r[3]&=15; - r[4]&=252; - r[7]&=15; - r[8]&=252; - r[11]&=15; - r[12]&=252; - r[15]&=15; - - while (n > 0) { - for (j = 0; j < 17; j++) c[j] = 0; - for (j = 0; (j < 16) && (j < n); ++j) c[j] = m[mpos+j]; - c[j] = 1; - mpos += j; n -= j; - add1305(h,c); - for (i = 0; i < 17; i++) { - x[i] = 0; - for (j = 0; j < 17; j++) x[i] = (x[i] + (h[j] * ((j <= i) ? r[i - j] : ((320 * r[i + 17 - j])|0))) | 0) | 0; - } - for (i = 0; i < 17; i++) h[i] = x[i]; - u = 0; - for (j = 0; j < 16; j++) { - u = (u + h[j]) | 0; - h[j] = u & 255; - u >>>= 8; - } - u = (u + h[16]) | 0; h[16] = u & 3; - u = (5 * (u >>> 2)) | 0; - for (j = 0; j < 16; j++) { - u = (u + h[j]) | 0; - h[j] = u & 255; - u >>>= 8; - } - u = (u + h[16]) | 0; h[16] = u; - } - - for (j = 0; j < 17; j++) g[j] = h[j]; - add1305(h,minusp); - s = (-(h[16] >>> 7) | 0); - for (j = 0; j < 17; j++) h[j] ^= s & (g[j] ^ h[j]); - - for (j = 0; j < 16; j++) c[j] = k[j + 16]; - c[16] = 0; - add1305(h,c); - for (j = 0; j < 16; j++) out[outpos+j] = h[j]; - return 0; -} - -function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { - var x = new Uint8Array(16); - crypto_onetimeauth(x,0,m,mpos,n,k); - return crypto_verify_16(h,hpos,x,0); -} - -function crypto_secretbox(c,m,d,n,k) { - var i; - if (d < 32) return -1; - crypto_stream_xor(c,0,m,0,d,n,k); - crypto_onetimeauth(c, 16, c, 32, d - 32, c); - for (i = 0; i < 16; i++) c[i] = 0; - return 0; -} - -function crypto_secretbox_open(m,c,d,n,k) { - var i; - var x = new Uint8Array(32); - if (d < 32) return -1; - crypto_stream(x,0,32,n,k); - if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; - crypto_stream_xor(m,0,c,0,d,n,k); - for (i = 0; i < 32; i++) m[i] = 0; - return 0; -} - -function set25519(r, a) { - var i; - for (i = 0; i < 16; i++) r[i] = a[i]|0; -} - -function car25519(o) { - var c; - var i; - for (i = 0; i < 16; i++) { - o[i] += 65536; - c = Math.floor(o[i] / 65536); - o[(i+1)*(i<15?1:0)] += c - 1 + 37 * (c-1) * (i===15?1:0); - o[i] -= (c * 65536); - } -} - -function sel25519(p, q, b) { - var t, c = ~(b-1); - for (var i = 0; i < 16; i++) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } -} - -function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for (i = 0; i < 16; i++) t[i] = n[i]; - car25519(t); - car25519(t); - car25519(t); - for (j = 0; j < 2; j++) { - m[0] = t[0] - 0xffed; - for (i = 1; i < 15; i++) { - m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); - m[i-1] &= 0xffff; - } - m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); - b = (m[15]>>16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1-b); - } - for (i = 0; i < 16; i++) { - o[2*i] = t[i] & 0xff; - o[2*i+1] = t[i]>>8; - } -} - -function neq25519(a, b) { - var c = new Uint8Array(32), d = new Uint8Array(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); -} - -function par25519(a) { - var d = new Uint8Array(32); - pack25519(d, a); - return d[0] & 1; -} - -function unpack25519(o, n) { - var i; - for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); - o[15] &= 0x7fff; -} - -function A(o, a, b) { - var i; - for (i = 0; i < 16; i++) o[i] = (a[i] + b[i])|0; -} - -function Z(o, a, b) { - var i; - for (i = 0; i < 16; i++) o[i] = (a[i] - b[i])|0; -} - -function M(o, a, b) { - var i, j, t = new Float64Array(31); - for (i = 0; i < 31; i++) t[i] = 0; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - t[i+j] += a[i] * b[j]; - } - } - for (i = 0; i < 15; i++) { - t[i] += 38 * t[i+16]; - } - for (i = 0; i < 16; i++) o[i] = t[i]; - car25519(o); - car25519(o); -} - -function S(o, a) { - M(o, a, a); -} - -function inv25519(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 253; a >= 0; a--) { - S(c, c); - if(a !== 2 && a !== 4) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function pow2523(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 250; a >= 0; a--) { - S(c, c); - if(a !== 1) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function crypto_scalarmult(q, n, p) { - var z = new Uint8Array(32); - var x = new Float64Array(80), r, i; - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(); - for (i = 0; i < 31; i++) z[i] = n[i]; - z[31]=(n[31]&127)|64; - z[0]&=248; - unpack25519(x,p); - for (i = 0; i < 16; i++) { - b[i]=x[i]; - d[i]=a[i]=c[i]=0; - } - a[0]=d[0]=1; - for (i=254; i>=0; --i) { - r=(z[i>>>3]>>>(i&7))&1; - sel25519(a,b,r); - sel25519(c,d,r); - A(e,a,c); - Z(a,a,c); - A(c,b,d); - Z(b,b,d); - S(d,e); - S(f,a); - M(a,c,a); - M(c,b,e); - A(e,a,c); - Z(a,a,c); - S(b,a); - Z(c,d,f); - M(a,c,_121665); - A(a,a,d); - M(c,c,a); - M(a,d,f); - M(d,b,x); - S(b,e); - sel25519(a,b,r); - sel25519(c,d,r); - } - for (i = 0; i < 16; i++) { - x[i+16]=a[i]; - x[i+32]=c[i]; - x[i+48]=b[i]; - x[i+64]=d[i]; - } - var x32 = x.subarray(32); - var x16 = x.subarray(16); - inv25519(x32,x32); - M(x16,x16,x32); - pack25519(q,x16); - return 0; -} - -function crypto_scalarmult_base(q, n) { - return crypto_scalarmult(q, n, _9); -} - -function crypto_box_keypair(y, x) { - randombytes(x, 32); - return crypto_scalarmult_base(y, x); -} - -function crypto_box_beforenm(k, y, x) { - var s = new Uint8Array(32); - crypto_scalarmult(s, x, y); - return crypto_core_hsalsa20(k, _0, s, sigma); -} - -var crypto_box_afternm = crypto_secretbox; -var crypto_box_open_afternm = crypto_secretbox_open; - -function crypto_box(c, m, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_afternm(c, m, d, n, k); -} - -function crypto_box_open(m, c, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_open_afternm(m, c, d, n, k); -} - -function add64() { - var a = 0, b = 0, c = 0, d = 0, m16 = 65535, l, h, i; - for (i = 0; i < arguments.length; i++) { - l = arguments[i].lo; - h = arguments[i].hi; - a += (l & m16); b += (l >>> 16); - c += (h & m16); d += (h >>> 16); - } - - b += (a >>> 16); - c += (b >>> 16); - d += (c >>> 16); - - return new u64((c & m16) | (d << 16), (a & m16) | (b << 16)); -} - -function shr64(x, c) { - return new u64((x.hi >>> c), (x.lo >>> c) | (x.hi << (32 - c))); -} - -function xor64() { - var l = 0, h = 0, i; - for (i = 0; i < arguments.length; i++) { - l ^= arguments[i].lo; - h ^= arguments[i].hi; - } - return new u64(h, l); -} - -function R(x, c) { - var h, l, c1 = 32 - c; - if (c < 32) { - h = (x.hi >>> c) | (x.lo << c1); - l = (x.lo >>> c) | (x.hi << c1); - } else if (c < 64) { - h = (x.lo >>> c) | (x.hi << c1); - l = (x.hi >>> c) | (x.lo << c1); - } - return new u64(h, l); -} - -function Ch(x, y, z) { - var h = (x.hi & y.hi) ^ (~x.hi & z.hi), - l = (x.lo & y.lo) ^ (~x.lo & z.lo); - return new u64(h, l); -} - -function Maj(x, y, z) { - var h = (x.hi & y.hi) ^ (x.hi & z.hi) ^ (y.hi & z.hi), - l = (x.lo & y.lo) ^ (x.lo & z.lo) ^ (y.lo & z.lo); - return new u64(h, l); -} - -function Sigma0(x) { return xor64(R(x,28), R(x,34), R(x,39)); } -function Sigma1(x) { return xor64(R(x,14), R(x,18), R(x,41)); } -function sigma0(x) { return xor64(R(x, 1), R(x, 8), shr64(x,7)); } -function sigma1(x) { return xor64(R(x,19), R(x,61), shr64(x,6)); } - -var K = [ - new u64(0x428a2f98, 0xd728ae22), new u64(0x71374491, 0x23ef65cd), - new u64(0xb5c0fbcf, 0xec4d3b2f), new u64(0xe9b5dba5, 0x8189dbbc), - new u64(0x3956c25b, 0xf348b538), new u64(0x59f111f1, 0xb605d019), - new u64(0x923f82a4, 0xaf194f9b), new u64(0xab1c5ed5, 0xda6d8118), - new u64(0xd807aa98, 0xa3030242), new u64(0x12835b01, 0x45706fbe), - new u64(0x243185be, 0x4ee4b28c), new u64(0x550c7dc3, 0xd5ffb4e2), - new u64(0x72be5d74, 0xf27b896f), new u64(0x80deb1fe, 0x3b1696b1), - new u64(0x9bdc06a7, 0x25c71235), new u64(0xc19bf174, 0xcf692694), - new u64(0xe49b69c1, 0x9ef14ad2), new u64(0xefbe4786, 0x384f25e3), - new u64(0x0fc19dc6, 0x8b8cd5b5), new u64(0x240ca1cc, 0x77ac9c65), - new u64(0x2de92c6f, 0x592b0275), new u64(0x4a7484aa, 0x6ea6e483), - new u64(0x5cb0a9dc, 0xbd41fbd4), new u64(0x76f988da, 0x831153b5), - new u64(0x983e5152, 0xee66dfab), new u64(0xa831c66d, 0x2db43210), - new u64(0xb00327c8, 0x98fb213f), new u64(0xbf597fc7, 0xbeef0ee4), - new u64(0xc6e00bf3, 0x3da88fc2), new u64(0xd5a79147, 0x930aa725), - new u64(0x06ca6351, 0xe003826f), new u64(0x14292967, 0x0a0e6e70), - new u64(0x27b70a85, 0x46d22ffc), new u64(0x2e1b2138, 0x5c26c926), - new u64(0x4d2c6dfc, 0x5ac42aed), new u64(0x53380d13, 0x9d95b3df), - new u64(0x650a7354, 0x8baf63de), new u64(0x766a0abb, 0x3c77b2a8), - new u64(0x81c2c92e, 0x47edaee6), new u64(0x92722c85, 0x1482353b), - new u64(0xa2bfe8a1, 0x4cf10364), new u64(0xa81a664b, 0xbc423001), - new u64(0xc24b8b70, 0xd0f89791), new u64(0xc76c51a3, 0x0654be30), - new u64(0xd192e819, 0xd6ef5218), new u64(0xd6990624, 0x5565a910), - new u64(0xf40e3585, 0x5771202a), new u64(0x106aa070, 0x32bbd1b8), - new u64(0x19a4c116, 0xb8d2d0c8), new u64(0x1e376c08, 0x5141ab53), - new u64(0x2748774c, 0xdf8eeb99), new u64(0x34b0bcb5, 0xe19b48a8), - new u64(0x391c0cb3, 0xc5c95a63), new u64(0x4ed8aa4a, 0xe3418acb), - new u64(0x5b9cca4f, 0x7763e373), new u64(0x682e6ff3, 0xd6b2b8a3), - new u64(0x748f82ee, 0x5defb2fc), new u64(0x78a5636f, 0x43172f60), - new u64(0x84c87814, 0xa1f0ab72), new u64(0x8cc70208, 0x1a6439ec), - new u64(0x90befffa, 0x23631e28), new u64(0xa4506ceb, 0xde82bde9), - new u64(0xbef9a3f7, 0xb2c67915), new u64(0xc67178f2, 0xe372532b), - new u64(0xca273ece, 0xea26619c), new u64(0xd186b8c7, 0x21c0c207), - new u64(0xeada7dd6, 0xcde0eb1e), new u64(0xf57d4f7f, 0xee6ed178), - new u64(0x06f067aa, 0x72176fba), new u64(0x0a637dc5, 0xa2c898a6), - new u64(0x113f9804, 0xbef90dae), new u64(0x1b710b35, 0x131c471b), - new u64(0x28db77f5, 0x23047d84), new u64(0x32caab7b, 0x40c72493), - new u64(0x3c9ebe0a, 0x15c9bebc), new u64(0x431d67c4, 0x9c100d4c), - new u64(0x4cc5d4be, 0xcb3e42b6), new u64(0x597f299c, 0xfc657e2a), - new u64(0x5fcb6fab, 0x3ad6faec), new u64(0x6c44198c, 0x4a475817) -]; - -function crypto_hashblocks(x, m, n) { - var z = [], b = [], a = [], w = [], t, i, j; - - for (i = 0; i < 8; i++) z[i] = a[i] = dl64(x, 8*i); - - var pos = 0; - while (n >= 128) { - for (i = 0; i < 16; i++) w[i] = dl64(m, 8*i+pos); - for (i = 0; i < 80; i++) { - for (j = 0; j < 8; j++) b[j] = a[j]; - t = add64(a[7], Sigma1(a[4]), Ch(a[4], a[5], a[6]), K[i], w[i%16]); - b[7] = add64(t, Sigma0(a[0]), Maj(a[0], a[1], a[2])); - b[3] = add64(b[3], t); - for (j = 0; j < 8; j++) a[(j+1)%8] = b[j]; - if (i%16 === 15) { - for (j = 0; j < 16; j++) { - w[j] = add64(w[j], w[(j+9)%16], sigma0(w[(j+1)%16]), sigma1(w[(j+14)%16])); - } - } - } - - for (i = 0; i < 8; i++) { - a[i] = add64(a[i], z[i]); - z[i] = a[i]; - } - - pos += 128; - n -= 128; - } - - for (i = 0; i < 8; i++) ts64(x, 8*i, z[i]); - return n; -} - -var iv = new Uint8Array([ - 0x6a,0x09,0xe6,0x67,0xf3,0xbc,0xc9,0x08, - 0xbb,0x67,0xae,0x85,0x84,0xca,0xa7,0x3b, - 0x3c,0x6e,0xf3,0x72,0xfe,0x94,0xf8,0x2b, - 0xa5,0x4f,0xf5,0x3a,0x5f,0x1d,0x36,0xf1, - 0x51,0x0e,0x52,0x7f,0xad,0xe6,0x82,0xd1, - 0x9b,0x05,0x68,0x8c,0x2b,0x3e,0x6c,0x1f, - 0x1f,0x83,0xd9,0xab,0xfb,0x41,0xbd,0x6b, - 0x5b,0xe0,0xcd,0x19,0x13,0x7e,0x21,0x79 -]); - -function crypto_hash(out, m, n) { - var h = new Uint8Array(64), x = new Uint8Array(256); - var i, b = n; - - for (i = 0; i < 64; i++) h[i] = iv[i]; - - crypto_hashblocks(h, m, n); - n %= 128; - - for (i = 0; i < 256; i++) x[i] = 0; - for (i = 0; i < n; i++) x[i] = m[b-n+i]; - x[n] = 128; - - n = 256-128*(n<112?1:0); - x[n-9] = 0; - ts64(x, n-8, new u64((b / 0x20000000) | 0, b << 3)); - crypto_hashblocks(h, x, n); - - for (i = 0; i < 64; i++) out[i] = h[i]; - - return 0; -} - -function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); -} - -function cswap(p, q, b) { - var i; - for (i = 0; i < 4; i++) { - sel25519(p[i], q[i], b); - } -} - -function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; -} - -function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for (i = 255; i >= 0; --i) { - b = (s[(i/8)|0] >> (i&7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } -} - -function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); -} - -function crypto_sign_keypair(pk, sk, seeded) { - var d = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()]; - var i; - - if (!seeded) randombytes(sk, 32); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - scalarbase(p, d); - pack(pk, p); - - for (i = 0; i < 32; i++) sk[i+32] = pk[i]; - return 0; -} - -var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); - -function modL(r, x) { - var carry, i, j, k; - for (i = 63; i >= 32; --i) { - carry = 0; - for (j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for (j = 0; j < 32; j++) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for (j = 0; j < 32; j++) x[j] -= carry * L[j]; - for (i = 0; i < 32; i++) { - x[i+1] += x[i] >> 8; - r[i] = x[i] & 255; - } -} - -function reduce(r) { - var x = new Float64Array(64), i; - for (i = 0; i < 64; i++) x[i] = r[i]; - for (i = 0; i < 64; i++) r[i] = 0; - modL(r, x); -} - -// Note: difference from C - smlen returned, not passed as argument. -function crypto_sign(sm, m, n, sk) { - var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - var smlen = n + 64; - for (i = 0; i < n; i++) sm[64 + i] = m[i]; - for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; - - crypto_hash(r, sm.subarray(32), n+32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - - for (i = 32; i < 64; i++) sm[i] = sk[i]; - crypto_hash(h, sm, n + 64); - reduce(h); - - for (i = 0; i < 64; i++) x[i] = 0; - for (i = 0; i < 32; i++) x[i] = r[i]; - for (i = 0; i < 32; i++) { - for (j = 0; j < 32; j++) { - x[i+j] += h[i] * d[j]; - } - } - - modL(sm.subarray(32), x); - return smlen; -} - -function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) M(r[0], r[0], I); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) return -1; - - if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); - - M(r[3], r[0], r[1]); - return 0; -} - -function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new Uint8Array(32), h = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; - - mlen = -1; - if (n < 64) return -1; - - if (unpackneg(q, pk)) return -1; - - for (i = 0; i < n; i++) m[i] = sm[i]; - for (i = 0; i < 32; i++) m[i+32] = pk[i]; - crypto_hash(h, m, n); - reduce(h); - scalarmult(p, q, h); - - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - - n -= 64; - if (crypto_verify_32(sm, 0, t, 0)) { - for (i = 0; i < n; i++) m[i] = 0; - return -1; - } - - for (i = 0; i < n; i++) m[i] = sm[i + 64]; - mlen = n; - return mlen; -} - -var crypto_secretbox_KEYBYTES = 32, - crypto_secretbox_NONCEBYTES = 24, - crypto_secretbox_ZEROBYTES = 32, - crypto_secretbox_BOXZEROBYTES = 16, - crypto_scalarmult_BYTES = 32, - crypto_scalarmult_SCALARBYTES = 32, - crypto_box_PUBLICKEYBYTES = 32, - crypto_box_SECRETKEYBYTES = 32, - crypto_box_BEFORENMBYTES = 32, - crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, - crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, - crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, - crypto_sign_BYTES = 64, - crypto_sign_PUBLICKEYBYTES = 32, - crypto_sign_SECRETKEYBYTES = 64, - crypto_sign_SEEDBYTES = 32, - crypto_hash_BYTES = 64; - -nacl.lowlevel = { - crypto_core_hsalsa20: crypto_core_hsalsa20, - crypto_stream_xor: crypto_stream_xor, - crypto_stream: crypto_stream, - crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, - crypto_stream_salsa20: crypto_stream_salsa20, - crypto_onetimeauth: crypto_onetimeauth, - crypto_onetimeauth_verify: crypto_onetimeauth_verify, - crypto_verify_16: crypto_verify_16, - crypto_verify_32: crypto_verify_32, - crypto_secretbox: crypto_secretbox, - crypto_secretbox_open: crypto_secretbox_open, - crypto_scalarmult: crypto_scalarmult, - crypto_scalarmult_base: crypto_scalarmult_base, - crypto_box_beforenm: crypto_box_beforenm, - crypto_box_afternm: crypto_box_afternm, - crypto_box: crypto_box, - crypto_box_open: crypto_box_open, - crypto_box_keypair: crypto_box_keypair, - crypto_hash: crypto_hash, - crypto_sign: crypto_sign, - crypto_sign_keypair: crypto_sign_keypair, - crypto_sign_open: crypto_sign_open, - - crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, - crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, - crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, - crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, - crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, - crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, - crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, - crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, - crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, - crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, - crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, - crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, - crypto_sign_BYTES: crypto_sign_BYTES, - crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, - crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, - crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, - crypto_hash_BYTES: crypto_hash_BYTES -}; - -/* High-level API */ - -function checkLengths(k, n) { - if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); - if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); -} - -function checkBoxLengths(pk, sk) { - if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); - if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); -} - -function checkArrayTypes() { - var t, i; - for (i = 0; i < arguments.length; i++) { - if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') - throw new TypeError('unexpected type ' + t + ', use Uint8Array'); - } -} - -function cleanup(arr) { - for (var i = 0; i < arr.length; i++) arr[i] = 0; -} - -nacl.util = {}; - -nacl.util.decodeUTF8 = function(s) { - var i, d = unescape(encodeURIComponent(s)), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; -}; - -nacl.util.encodeUTF8 = function(arr) { - var i, s = []; - for (i = 0; i < arr.length; i++) s.push(String.fromCharCode(arr[i])); - return decodeURIComponent(escape(s.join(''))); -}; - -nacl.util.encodeBase64 = function(arr) { - if (typeof btoa === 'undefined') { - return (new Buffer(arr)).toString('base64'); - } else { - var i, s = [], len = arr.length; - for (i = 0; i < len; i++) s.push(String.fromCharCode(arr[i])); - return btoa(s.join('')); - } -}; - -nacl.util.decodeBase64 = function(s) { - if (typeof atob === 'undefined') { - return new Uint8Array(Array.prototype.slice.call(new Buffer(s, 'base64'), 0)); - } else { - var i, d = atob(s), b = new Uint8Array(d.length); - for (i = 0; i < d.length; i++) b[i] = d.charCodeAt(i); - return b; - } -}; - -nacl.randomBytes = function(n) { - var b = new Uint8Array(n); - randombytes(b, n); - return b; -}; - -nacl.secretbox = function(msg, nonce, key) { - checkArrayTypes(msg, nonce, key); - checkLengths(key, nonce); - var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); - var c = new Uint8Array(m.length); - for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; - crypto_secretbox(c, m, m.length, nonce, key); - return c.subarray(crypto_secretbox_BOXZEROBYTES); -}; - -nacl.secretbox.open = function(box, nonce, key) { - checkArrayTypes(box, nonce, key); - checkLengths(key, nonce); - var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); - var m = new Uint8Array(c.length); - for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; - if (c.length < 32) return false; - if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; - return m.subarray(crypto_secretbox_ZEROBYTES); -}; - -nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; -nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; -nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; - -nacl.scalarMult = function(n, p) { - checkArrayTypes(n, p); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult(q, n, p); - return q; -}; - -nacl.scalarMult.base = function(n) { - checkArrayTypes(n); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult_base(q, n); - return q; -}; - -nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; -nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; - -nacl.box = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox(msg, nonce, k); -}; - -nacl.box.before = function(publicKey, secretKey) { - checkArrayTypes(publicKey, secretKey); - checkBoxLengths(publicKey, secretKey); - var k = new Uint8Array(crypto_box_BEFORENMBYTES); - crypto_box_beforenm(k, publicKey, secretKey); - return k; -}; - -nacl.box.after = nacl.secretbox; - -nacl.box.open = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox.open(msg, nonce, k); -}; - -nacl.box.open.after = nacl.secretbox.open; - -nacl.box.keyPair = function() { - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); - crypto_box_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.box.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_box_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - crypto_scalarmult_base(pk, secretKey); - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; -nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; -nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; -nacl.box.nonceLength = crypto_box_NONCEBYTES; -nacl.box.overheadLength = nacl.secretbox.overheadLength; - -nacl.sign = function(msg, secretKey) { - checkArrayTypes(msg, secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); - crypto_sign(signedMsg, msg, msg.length, secretKey); - return signedMsg; -}; - -nacl.sign.open = function(signedMsg, publicKey) { - if (arguments.length !== 2) - throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); - checkArrayTypes(signedMsg, publicKey); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var tmp = new Uint8Array(signedMsg.length); - var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); - if (mlen < 0) return null; - var m = new Uint8Array(mlen); - for (var i = 0; i < m.length; i++) m[i] = tmp[i]; - return m; -}; - -nacl.sign.detached = function(msg, secretKey) { - var signedMsg = nacl.sign(msg, secretKey); - var sig = new Uint8Array(crypto_sign_BYTES); - for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; - return sig; -}; - -nacl.sign.detached.verify = function(msg, sig, publicKey) { - checkArrayTypes(msg, sig, publicKey); - if (sig.length !== crypto_sign_BYTES) - throw new Error('bad signature size'); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var sm = new Uint8Array(crypto_sign_BYTES + msg.length); - var m = new Uint8Array(crypto_sign_BYTES + msg.length); - var i; - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); -}; - -nacl.sign.keyPair = function() { - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - crypto_sign_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.sign.keyPair.fromSeed = function(seed) { - checkArrayTypes(seed); - if (seed.length !== crypto_sign_SEEDBYTES) - throw new Error('bad seed size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - for (var i = 0; i < 32; i++) sk[i] = seed[i]; - crypto_sign_keypair(pk, sk, true); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; -nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; -nacl.sign.seedLength = crypto_sign_SEEDBYTES; -nacl.sign.signatureLength = crypto_sign_BYTES; - -nacl.hash = function(msg) { - checkArrayTypes(msg); - var h = new Uint8Array(crypto_hash_BYTES); - crypto_hash(h, msg, msg.length); - return h; -}; - -nacl.hash.hashLength = crypto_hash_BYTES; - -nacl.verify = function(x, y) { - checkArrayTypes(x, y); - // Zero length arguments are considered not equal. - if (x.length === 0 || y.length === 0) return false; - if (x.length !== y.length) return false; - return (vn(x, 0, y, 0, x.length) === 0) ? true : false; -}; - -nacl.setPRNG = function(fn) { - randombytes = fn; -}; - -(function() { - // Initialize PRNG if environment provides CSPRNG. - // If not, methods calling randombytes will throw. - var crypto; - if (typeof window !== 'undefined') { - // Browser. - if (window.crypto && window.crypto.getRandomValues) { - crypto = window.crypto; // Standard - } else if (window.msCrypto && window.msCrypto.getRandomValues) { - crypto = window.msCrypto; // Internet Explorer 11+ - } - if (crypto) { - nacl.setPRNG(function(x, n) { - var i, v = new Uint8Array(n); - crypto.getRandomValues(v); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } - } else if (typeof require !== 'undefined') { - // Node.js. - crypto = require('crypto'); - if (crypto) { - nacl.setPRNG(function(x, n) { - var i, v = crypto.randomBytes(n); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } - } -})(); - -})(typeof module !== 'undefined' && module.exports ? module.exports : (window.nacl = window.nacl || {})); diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js deleted file mode 100644 index 95d86950..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/nacl.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(r){"use strict";function n(r,n){return r<>>32-n}function e(r,n){var e=255&r[n+3];return e=e<<8|255&r[n+2],e=e<<8|255&r[n+1],e<<8|255&r[n+0]}function t(r,n){var e=r[n]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3],t=r[n+4]<<24|r[n+5]<<16|r[n+6]<<8|r[n+7];return new lr(e,t)}function o(r,n,e){var t;for(t=0;4>t;t++)r[n+t]=255&e,e>>>=8}function i(r,n,e){r[n]=e.hi>>24&255,r[n+1]=e.hi>>16&255,r[n+2]=e.hi>>8&255,r[n+3]=255&e.hi,r[n+4]=e.lo>>24&255,r[n+5]=e.lo>>16&255,r[n+6]=e.lo>>8&255,r[n+7]=255&e.lo}function a(r,n,e,t,o){var i,a=0;for(i=0;o>i;i++)a|=r[n+i]^e[t+i];return(1&a-1>>>8)-1}function f(r,n,e,t){return a(r,n,e,t,16)}function u(r,n,e,t){return a(r,n,e,t,32)}function c(r,t,i,a,f){var u,c,w,y=new Uint32Array(16),s=new Uint32Array(16),l=new Uint32Array(16),h=new Uint32Array(4);for(u=0;4>u;u++)s[5*u]=e(a,4*u),s[1+u]=e(i,4*u),s[6+u]=e(t,4*u),s[11+u]=e(i,16+4*u);for(u=0;16>u;u++)l[u]=s[u];for(u=0;20>u;u++){for(c=0;4>c;c++){for(w=0;4>w;w++)h[w]=s[(5*c+4*w)%16];for(h[1]^=n(h[0]+h[3]|0,7),h[2]^=n(h[1]+h[0]|0,9),h[3]^=n(h[2]+h[1]|0,13),h[0]^=n(h[3]+h[2]|0,18),w=0;4>w;w++)y[4*c+(c+w)%4]=h[w]}for(w=0;16>w;w++)s[w]=y[w]}if(f){for(u=0;16>u;u++)s[u]=s[u]+l[u]|0;for(u=0;4>u;u++)s[5*u]=s[5*u]-e(a,4*u)|0,s[6+u]=s[6+u]-e(t,4*u)|0;for(u=0;4>u;u++)o(r,4*u,s[5*u]),o(r,16+4*u,s[6+u])}else for(u=0;16>u;u++)o(r,4*u,s[u]+l[u]|0)}function w(r,n,e,t){return c(r,n,e,t,!1),0}function y(r,n,e,t){return c(r,n,e,t,!0),0}function s(r,n,e,t,o,i,a){var f,u,c=new Uint8Array(16),y=new Uint8Array(64);if(!o)return 0;for(u=0;16>u;u++)c[u]=0;for(u=0;8>u;u++)c[u]=i[u];for(;o>=64;){for(w(y,c,a,Br),u=0;64>u;u++)r[n+u]=(e?e[t+u]:0)^y[u];for(f=1,u=8;16>u;u++)f=f+(255&c[u])|0,c[u]=255&f,f>>>=8;o-=64,n+=64,e&&(t+=64)}if(o>0)for(w(y,c,a,Br),u=0;o>u;u++)r[n+u]=(e?e[t+u]:0)^y[u];return 0}function l(r,n,e,t,o){return s(r,n,null,0,e,t,o)}function h(r,n,e,t,o){var i=new Uint8Array(32);return y(i,t,o,Br),l(r,n,e,t.subarray(16),i)}function g(r,n,e,t,o,i,a){var f=new Uint8Array(32);return y(f,i,a,Br),s(r,n,e,t,o,i.subarray(16),f)}function p(r,n){var e,t=0;for(e=0;17>e;e++)t=t+(r[e]+n[e]|0)|0,r[e]=255&t,t>>>=8}function v(r,n,e,t,o,i){var a,f,u,c,w=new Uint32Array(17),y=new Uint32Array(17),s=new Uint32Array(17),l=new Uint32Array(17),h=new Uint32Array(17);for(u=0;17>u;u++)y[u]=s[u]=0;for(u=0;16>u;u++)y[u]=i[u];for(y[3]&=15,y[4]&=252,y[7]&=15,y[8]&=252,y[11]&=15,y[12]&=252,y[15]&=15;o>0;){for(u=0;17>u;u++)l[u]=0;for(u=0;16>u&&o>u;++u)l[u]=e[t+u];for(l[u]=1,t+=u,o-=u,p(s,l),f=0;17>f;f++)for(w[f]=0,u=0;17>u;u++)w[f]=w[f]+s[u]*(f>=u?y[f-u]:320*y[f+17-u]|0)|0|0;for(f=0;17>f;f++)s[f]=w[f];for(c=0,u=0;16>u;u++)c=c+s[u]|0,s[u]=255&c,c>>>=8;for(c=c+s[16]|0,s[16]=3&c,c=5*(c>>>2)|0,u=0;16>u;u++)c=c+s[u]|0,s[u]=255&c,c>>>=8;c=c+s[16]|0,s[16]=c}for(u=0;17>u;u++)h[u]=s[u];for(p(s,Sr),a=0|-(s[16]>>>7),u=0;17>u;u++)s[u]^=a&(h[u]^s[u]);for(u=0;16>u;u++)l[u]=i[u+16];for(l[16]=0,p(s,l),u=0;16>u;u++)r[n+u]=s[u];return 0}function b(r,n,e,t,o,i){var a=new Uint8Array(16);return v(a,0,e,t,o,i),f(r,n,a,0)}function A(r,n,e,t,o){var i;if(32>e)return-1;for(g(r,0,n,0,e,t,o),v(r,16,r,32,e-32,r),i=0;16>i;i++)r[i]=0;return 0}function U(r,n,e,t,o){var i,a=new Uint8Array(32);if(32>e)return-1;if(h(a,0,32,t,o),0!==b(n,16,n,32,e-32,a))return-1;for(g(r,0,n,0,e,t,o),i=0;32>i;i++)r[i]=0;return 0}function _(r,n){var e;for(e=0;16>e;e++)r[e]=0|n[e]}function d(r){var n,e;for(e=0;16>e;e++)r[e]+=65536,n=Math.floor(r[e]/65536),r[(e+1)*(15>e?1:0)]+=n-1+37*(n-1)*(15===e?1:0),r[e]-=65536*n}function E(r,n,e){for(var t,o=~(e-1),i=0;16>i;i++)t=o&(r[i]^n[i]),r[i]^=t,n[i]^=t}function x(r,n){var e,t,o,i=hr(),a=hr();for(e=0;16>e;e++)a[e]=n[e];for(d(a),d(a),d(a),t=0;2>t;t++){for(i[0]=a[0]-65517,e=1;15>e;e++)i[e]=a[e]-65535-(i[e-1]>>16&1),i[e-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,E(a,i,1-o)}for(e=0;16>e;e++)r[2*e]=255&a[e],r[2*e+1]=a[e]>>8}function m(r,n){var e=new Uint8Array(32),t=new Uint8Array(32);return x(e,r),x(t,n),u(e,0,t,0)}function B(r){var n=new Uint8Array(32);return x(n,r),1&n[0]}function S(r,n){var e;for(e=0;16>e;e++)r[e]=n[2*e]+(n[2*e+1]<<8);r[15]&=32767}function K(r,n,e){var t;for(t=0;16>t;t++)r[t]=n[t]+e[t]|0}function T(r,n,e){var t;for(t=0;16>t;t++)r[t]=n[t]-e[t]|0}function Y(r,n,e){var t,o,i=new Float64Array(31);for(t=0;31>t;t++)i[t]=0;for(t=0;16>t;t++)for(o=0;16>o;o++)i[t+o]+=n[t]*e[o];for(t=0;15>t;t++)i[t]+=38*i[t+16];for(t=0;16>t;t++)r[t]=i[t];d(r),d(r)}function L(r,n){Y(r,n,n)}function C(r,n){var e,t=hr();for(e=0;16>e;e++)t[e]=n[e];for(e=253;e>=0;e--)L(t,t),2!==e&&4!==e&&Y(t,t,n);for(e=0;16>e;e++)r[e]=t[e]}function R(r,n){var e,t=hr();for(e=0;16>e;e++)t[e]=n[e];for(e=250;e>=0;e--)L(t,t),1!==e&&Y(t,t,n);for(e=0;16>e;e++)r[e]=t[e]}function k(r,n,e){var t,o,i=new Uint8Array(32),a=new Float64Array(80),f=hr(),u=hr(),c=hr(),w=hr(),y=hr(),s=hr();for(o=0;31>o;o++)i[o]=n[o];for(i[31]=127&n[31]|64,i[0]&=248,S(a,e),o=0;16>o;o++)u[o]=a[o],w[o]=f[o]=c[o]=0;for(f[0]=w[0]=1,o=254;o>=0;--o)t=i[o>>>3]>>>(7&o)&1,E(f,u,t),E(c,w,t),K(y,f,c),T(f,f,c),K(c,u,w),T(u,u,w),L(w,y),L(s,f),Y(f,c,f),Y(c,u,y),K(y,f,c),T(f,f,c),L(u,f),T(c,w,s),Y(f,c,Ur),K(f,f,w),Y(c,c,f),Y(f,w,s),Y(w,u,a),L(u,y),E(f,u,t),E(c,w,t);for(o=0;16>o;o++)a[o+16]=f[o],a[o+32]=c[o],a[o+48]=u[o],a[o+64]=w[o];var l=a.subarray(32),h=a.subarray(16);return C(l,l),Y(h,h,l),x(r,h),0}function z(r,n){return k(r,n,vr)}function P(r,n){return gr(n,32),z(r,n)}function O(r,n,e){var t=new Uint8Array(32);return k(t,e,n),y(r,pr,t,Br)}function F(r,n,e,t,o,i){var a=new Uint8Array(32);return O(a,o,i),Kr(r,n,e,t,a)}function N(r,n,e,t,o,i){var a=new Uint8Array(32);return O(a,o,i),Tr(r,n,e,t,a)}function M(){var r,n,e,t=0,o=0,i=0,a=0,f=65535;for(e=0;e>>16,i+=n&f,a+=n>>>16;return o+=t>>>16,i+=o>>>16,a+=i>>>16,new lr(i&f|a<<16,t&f|o<<16)}function j(r,n){return new lr(r.hi>>>n,r.lo>>>n|r.hi<<32-n)}function G(){var r,n=0,e=0;for(r=0;rn?(e=r.hi>>>n|r.lo<>>n|r.hi<n&&(e=r.lo>>>n|r.hi<>>n|r.lo<a;a++)u[a]=w[a]=t(r,8*a);for(var s=0;e>=128;){for(a=0;16>a;a++)y[a]=t(n,8*a+s);for(a=0;80>a;a++){for(f=0;8>f;f++)c[f]=w[f];for(o=M(w[7],X(w[4]),Z(w[4],w[5],w[6]),Yr[a],y[a%16]),c[7]=M(o,q(w[0]),V(w[0],w[1],w[2])),c[3]=M(c[3],o),f=0;8>f;f++)w[(f+1)%8]=c[f];if(a%16===15)for(f=0;16>f;f++)y[f]=M(y[f],y[(f+9)%16],D(y[(f+1)%16]),H(y[(f+14)%16]))}for(a=0;8>a;a++)w[a]=M(w[a],u[a]),u[a]=w[a];s+=128,e-=128}for(a=0;8>a;a++)i(r,8*a,u[a]);return e}function Q(r,n,e){var t,o=new Uint8Array(64),a=new Uint8Array(256),f=e;for(t=0;64>t;t++)o[t]=Lr[t];for(J(o,n,e),e%=128,t=0;256>t;t++)a[t]=0;for(t=0;e>t;t++)a[t]=n[f-e+t];for(a[e]=128,e=256-128*(112>e?1:0),a[e-9]=0,i(a,e-8,new lr(f/536870912|0,f<<3)),J(o,a,e),t=0;64>t;t++)r[t]=o[t];return 0}function W(r,n){var e=hr(),t=hr(),o=hr(),i=hr(),a=hr(),f=hr(),u=hr(),c=hr(),w=hr();T(e,r[1],r[0]),T(w,n[1],n[0]),Y(e,e,w),K(t,r[0],r[1]),K(w,n[0],n[1]),Y(t,t,w),Y(o,r[3],n[3]),Y(o,o,dr),Y(i,r[2],n[2]),K(i,i,i),T(a,t,e),T(f,i,o),K(u,i,o),K(c,t,e),Y(r[0],a,f),Y(r[1],c,u),Y(r[2],u,f),Y(r[3],a,c)}function $(r,n,e){var t;for(t=0;4>t;t++)E(r[t],n[t],e)}function rr(r,n){var e=hr(),t=hr(),o=hr();C(o,n[2]),Y(e,n[0],o),Y(t,n[1],o),x(r,t),r[31]^=B(e)<<7}function nr(r,n,e){var t,o;for(_(r[0],br),_(r[1],Ar),_(r[2],Ar),_(r[3],br),o=255;o>=0;--o)t=e[o/8|0]>>(7&o)&1,$(r,n,t),W(n,r),W(r,r),$(r,n,t)}function er(r,n){var e=[hr(),hr(),hr(),hr()];_(e[0],Er),_(e[1],xr),_(e[2],Ar),Y(e[3],Er,xr),nr(r,e,n)}function tr(r,n,e){var t,o=new Uint8Array(64),i=[hr(),hr(),hr(),hr()];for(e||gr(n,32),Q(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,er(i,o),rr(r,i),t=0;32>t;t++)n[t+32]=r[t];return 0}function or(r,n){var e,t,o,i;for(t=63;t>=32;--t){for(e=0,o=t-32,i=t-12;i>o;++o)n[o]+=e-16*n[t]*Cr[o-(t-32)],e=n[o]+128>>8,n[o]-=256*e;n[o]+=e,n[t]=0}for(e=0,o=0;32>o;o++)n[o]+=e-(n[31]>>4)*Cr[o],e=n[o]>>8,n[o]&=255;for(o=0;32>o;o++)n[o]-=e*Cr[o];for(t=0;32>t;t++)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function ir(r){var n,e=new Float64Array(64);for(n=0;64>n;n++)e[n]=r[n];for(n=0;64>n;n++)r[n]=0;or(r,e)}function ar(r,n,e,t){var o,i,a=new Uint8Array(64),f=new Uint8Array(64),u=new Uint8Array(64),c=new Float64Array(64),w=[hr(),hr(),hr(),hr()];Q(a,t,32),a[0]&=248,a[31]&=127,a[31]|=64;var y=e+64;for(o=0;e>o;o++)r[64+o]=n[o];for(o=0;32>o;o++)r[32+o]=a[32+o];for(Q(u,r.subarray(32),e+32),ir(u),er(w,u),rr(r,w),o=32;64>o;o++)r[o]=t[o];for(Q(f,r,e+64),ir(f),o=0;64>o;o++)c[o]=0;for(o=0;32>o;o++)c[o]=u[o];for(o=0;32>o;o++)for(i=0;32>i;i++)c[o+i]+=f[o]*a[i];return or(r.subarray(32),c),y}function fr(r,n){var e=hr(),t=hr(),o=hr(),i=hr(),a=hr(),f=hr(),u=hr();return _(r[2],Ar),S(r[1],n),L(o,r[1]),Y(i,o,_r),T(o,o,r[2]),K(i,r[2],i),L(a,i),L(f,a),Y(u,f,a),Y(e,u,o),Y(e,e,i),R(e,e),Y(e,e,o),Y(e,e,i),Y(e,e,i),Y(r[0],e,i),L(t,r[0]),Y(t,t,i),m(t,o)&&Y(r[0],r[0],mr),L(t,r[0]),Y(t,t,i),m(t,o)?-1:(B(r[0])===n[31]>>7&&T(r[0],br,r[0]),Y(r[3],r[0],r[1]),0)}function ur(r,n,e,t){var o,i,a=new Uint8Array(32),f=new Uint8Array(64),c=[hr(),hr(),hr(),hr()],w=[hr(),hr(),hr(),hr()];if(i=-1,64>e)return-1;if(fr(w,t))return-1;for(o=0;e>o;o++)r[o]=n[o];for(o=0;32>o;o++)r[o+32]=t[o];if(Q(f,r,e),ir(f),nr(c,w,f),er(w,n.subarray(32)),W(c,w),rr(a,c),e-=64,u(n,0,a,0)){for(o=0;e>o;o++)r[o]=0;return-1}for(o=0;e>o;o++)r[o]=n[o+64];return i=e}function cr(r,n){if(r.length!==Rr)throw new Error("bad key size");if(n.length!==kr)throw new Error("bad nonce size")}function wr(r,n){if(r.length!==Nr)throw new Error("bad public key size");if(n.length!==Mr)throw new Error("bad secret key size")}function yr(){var r,n;for(n=0;nn;n++)e.push(String.fromCharCode(r[n]));return btoa(e.join(""))},r.util.decodeBase64=function(r){if("undefined"==typeof atob)return new Uint8Array(Array.prototype.slice.call(new Buffer(r,"base64"),0));var n,e=atob(r),t=new Uint8Array(e.length);for(n=0;nt)return null;for(var o=new Uint8Array(t),i=0;it;t++)o[t]=n[t];for(t=0;t=0},r.sign.keyPair=function(){var r=new Uint8Array(qr),n=new Uint8Array(Xr);return tr(r,n),{publicKey:r,secretKey:n}},r.sign.keyPair.fromSecretKey=function(r){if(yr(r),r.length!==Xr)throw new Error("bad secret key size");for(var n=new Uint8Array(qr),e=0;et;t++)e[t]=r[t];return tr(n,e,!0),{publicKey:n,secretKey:e}},r.sign.publicKeyLength=qr,r.sign.secretKeyLength=Xr,r.sign.seedLength=Dr,r.sign.signatureLength=Vr,r.hash=function(r){yr(r);var n=new Uint8Array(Hr);return Q(n,r,r.length),n},r.hash.hashLength=Hr,r.verify=function(r,n){return yr(r,n),0===r.length||0===n.length?!1:r.length!==n.length?!1:0===a(r,0,n,0,r.length)?!0:!1},r.setPRNG=function(r){gr=r},function(){var n;"undefined"!=typeof window?(window.crypto&&window.crypto.getRandomValues?n=window.crypto:window.msCrypto&&window.msCrypto.getRandomValues&&(n=window.msCrypto),n&&r.setPRNG(function(r,e){var t,o=new Uint8Array(e);for(n.getRandomValues(o),t=0;e>t;t++)r[t]=o[t];sr(o)})):"undefined"!=typeof require&&(n=require("crypto"),n&&r.setPRNG(function(r,e){var t,o=n.randomBytes(e);for(t=0;e>t;t++)r[t]=o[t];sr(o)}))}()}("undefined"!=typeof module&&module.exports?module.exports:window.nacl=window.nacl||{}); \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json deleted file mode 100644 index 44203e03..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/node_modules/tweetnacl/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "name": "tweetnacl", - "version": "0.13.3", - "description": "Port of TweetNaCl cryptographic library to JavaScript", - "main": "nacl-fast.js", - "directories": { - "test": "test" - }, - "scripts": { - "build": "uglifyjs nacl.js -c -m -o nacl.min.js && uglifyjs nacl-fast.js -c -m -o nacl-fast.min.js", - "test": "tape test/*.js | faucet", - "testall": "make -C test/c && tape test/*.js test/c/*.js | faucet", - "browser": "browserify test/browser/init.js test/*.js | uglifyjs -c -m -o test/browser/_bundle.js 2>/dev/null", - "browser-quick": "browserify test/browser/init.js test/*.quick.js | uglifyjs -c -m -o test/browser/_bundle-quick.js 2>/dev/null", - "testling": "browserify test/browser/testling_init.js test/*.js | testling | faucet", - "firefox": "browserify test/browser/testling_init.js test/*.js | testling -x firefox | faucet", - "chrome": "browserify test/browser/testling_init.js test/*.js | testling -x google-chrome | faucet", - "bench": "node test/benchmark/bench.js", - "lint": "eslint nacl.js nacl-fast.js test/*.js test/benchmark/*.js" - }, - "testling": { - "files": "test/*.js", - "browsers": [ - "chrome/22..latest", - "firefox/16..latest", - "safari/latest", - "opera/11.0..latest", - "iphone/6..latest", - "ipad/6..latest", - "android-browser/latest" - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/dchest/tweetnacl-js.git" - }, - "keywords": [ - "crypto", - "cryptography", - "curve25519", - "ed25519", - "encrypt", - "hash", - "key", - "nacl", - "poly1305", - "public", - "salsa20", - "signatures" - ], - "author": { - "name": "TweetNaCl-js contributors" - }, - "license": "Public domain", - "bugs": { - "url": "https://github.com/dchest/tweetnacl-js/issues" - }, - "homepage": "https://dchest.github.io/tweetnacl-js", - "devDependencies": { - "browserify": "^10.1.3", - "eslint": "^1.4.3", - "faucet": "0.0.1", - "tap-browser-color": "^0.1.2", - "tape": "^4.0.0", - "testling": "^1.7.1", - "uglify-js": "^2.4.21" - }, - "browser": { - "buffer": false, - "crypto": false - }, - "gitHead": "2bb422cb707fba4a5ec9654688564a4fb861b068", - "_id": "tweetnacl@0.13.3", - "_shasum": "d628b56f3bcc3d5ae74ba9d4c1a704def5ab4b56", - "_from": "tweetnacl@~0.13.0", - "_npmVersion": "2.14.7", - "_nodeVersion": "4.2.3", - "_npmUser": { - "name": "dchest", - "email": "dmitry@codingrobots.com" - }, - "dist": { - "shasum": "d628b56f3bcc3d5ae74ba9d4c1a704def5ab4b56", - "tarball": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.13.3.tgz" - }, - "maintainers": [ - { - "name": "dchest", - "email": "dmitry@codingrobots.com" - } - ], - "_resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.13.3.tgz" -} diff --git a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json b/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json deleted file mode 100644 index d7933972..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/node_modules/sshpk/package.json +++ /dev/null @@ -1,100 +0,0 @@ -{ - "name": "sshpk", - "version": "1.8.3", - "description": "A library for finding and using SSH public keys", - "main": "lib/index.js", - "scripts": { - "test": "tape test/*.js" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/arekinath/node-sshpk.git" - }, - "author": { - "name": "Joyent, Inc" - }, - "contributors": [ - { - "name": "Dave Eddy", - "email": "dave@daveeddy.com" - }, - { - "name": "Mark Cavage", - "email": "mcavage@gmail.com" - }, - { - "name": "Alex Wilson", - "email": "alex@cooperi.net" - } - ], - "license": "MIT", - "bugs": { - "url": "https://github.com/arekinath/node-sshpk/issues" - }, - "engines": { - "node": ">=0.10.0" - }, - "directories": { - "bin": "./bin", - "lib": "./lib", - "man": "./man/man1" - }, - "homepage": "https://github.com/arekinath/node-sshpk#readme", - "dependencies": { - "asn1": "~0.2.3", - "assert-plus": "^1.0.0", - "dashdash": "^1.12.0", - "getpass": "^0.1.1", - "jsbn": "~0.1.0", - "tweetnacl": "~0.13.0", - "jodid25519": "^1.0.0", - "ecc-jsbn": "~0.1.1" - }, - "optionalDependencies": { - "jsbn": "~0.1.0", - "tweetnacl": "~0.13.0", - "jodid25519": "^1.0.0", - "ecc-jsbn": "~0.1.1" - }, - "devDependencies": { - "tape": "^3.5.0", - "benchmark": "^1.0.0", - "sinon": "^1.17.2", - "temp": "^0.8.2" - }, - "man": [ - "/Users/alex.wilson/dev/sshpk/man/man1/sshpk-conv.1", - "/Users/alex.wilson/dev/sshpk/man/man1/sshpk-sign.1", - "/Users/alex.wilson/dev/sshpk/man/man1/sshpk-verify.1" - ], - "bin": { - "sshpk-conv": "bin/sshpk-conv", - "sshpk-sign": "bin/sshpk-sign", - "sshpk-verify": "bin/sshpk-verify" - }, - "gitHead": "82d39066b2df4e8284350ff5ebb08c5b95c74652", - "_id": "sshpk@1.8.3", - "_shasum": "890cc9d614dc5292e5cb1a543b03c9abaa5c374e", - "_from": "sshpk@^1.7.0", - "_npmVersion": "2.15.1", - "_nodeVersion": "0.12.13", - "_npmUser": { - "name": "arekinath", - "email": "alex@cooperi.net" - }, - "dist": { - "shasum": "890cc9d614dc5292e5cb1a543b03c9abaa5c374e", - "tarball": "https://registry.npmjs.org/sshpk/-/sshpk-1.8.3.tgz" - }, - "maintainers": [ - { - "name": "arekinath", - "email": "alex@cooperi.net" - } - ], - "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/sshpk-1.8.3.tgz_1461968607532_0.32797130732797086" - }, - "_resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.8.3.tgz" -} diff --git a/APIs/node_modules/request/node_modules/http-signature/package.json b/APIs/node_modules/request/node_modules/http-signature/package.json deleted file mode 100644 index 33ffa008..00000000 --- a/APIs/node_modules/request/node_modules/http-signature/package.json +++ /dev/null @@ -1,82 +0,0 @@ -{ - "name": "http-signature", - "description": "Reference implementation of Joyent's HTTP Signature scheme.", - "version": "1.1.1", - "license": "MIT", - "author": { - "name": "Joyent, Inc" - }, - "contributors": [ - { - "name": "Mark Cavage", - "email": "mcavage@gmail.com" - }, - { - "name": "David I. Lehn", - "email": "dil@lehn.org" - }, - { - "name": "Patrick Mooney", - "email": "patrick.f.mooney@gmail.com" - } - ], - "repository": { - "type": "git", - "url": "git://github.com/joyent/node-http-signature.git" - }, - "homepage": "https://github.com/joyent/node-http-signature/", - "bugs": { - "url": "https://github.com/joyent/node-http-signature/issues" - }, - "keywords": [ - "https", - "request" - ], - "engines": { - "node": ">=0.8", - "npm": ">=1.3.7" - }, - "main": "lib/index.js", - "scripts": { - "test": "tap test/*.js" - }, - "dependencies": { - "assert-plus": "^0.2.0", - "jsprim": "^1.2.2", - "sshpk": "^1.7.0" - }, - "devDependencies": { - "node-uuid": "^1.4.1", - "tap": "0.4.2" - }, - "gitHead": "74d3f35e3aa436d83723c53b01e266f448e8149a", - "_id": "http-signature@1.1.1", - "_shasum": "df72e267066cd0ac67fb76adf8e134a8fbcf91bf", - "_from": "http-signature@~1.1.0", - "_npmVersion": "2.14.9", - "_nodeVersion": "0.12.9", - "_npmUser": { - "name": "arekinath", - "email": "alex@cooperi.net" - }, - "dist": { - "shasum": "df72e267066cd0ac67fb76adf8e134a8fbcf91bf", - "tarball": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz" - }, - "maintainers": [ - { - "name": "arekinath", - "email": "alex@cooperi.net" - }, - { - "name": "mcavage", - "email": "mcavage@gmail.com" - }, - { - "name": "pfmooney", - "email": "patrick.f.mooney@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.1.1.tgz" -} diff --git a/APIs/node_modules/request/node_modules/is-typedarray/LICENSE.md b/APIs/node_modules/request/node_modules/is-typedarray/LICENSE.md deleted file mode 100644 index ee27ba4b..00000000 --- a/APIs/node_modules/request/node_modules/is-typedarray/LICENSE.md +++ /dev/null @@ -1,18 +0,0 @@ -This software is released under the MIT license: - -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/APIs/node_modules/request/node_modules/is-typedarray/README.md b/APIs/node_modules/request/node_modules/is-typedarray/README.md deleted file mode 100644 index 27528639..00000000 --- a/APIs/node_modules/request/node_modules/is-typedarray/README.md +++ /dev/null @@ -1,16 +0,0 @@ -# is-typedarray [![locked](http://badges.github.io/stability-badges/dist/locked.svg)](http://github.com/badges/stability-badges) - -Detect whether or not an object is a -[Typed Array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays). - -## Usage - -[![NPM](https://nodei.co/npm/is-typedarray.png)](https://nodei.co/npm/is-typedarray/) - -### isTypedArray(array) - -Returns `true` when array is a Typed Array, and `false` when it is not. - -## License - -MIT. See [LICENSE.md](http://github.com/hughsk/is-typedarray/blob/master/LICENSE.md) for details. diff --git a/APIs/node_modules/request/node_modules/is-typedarray/index.js b/APIs/node_modules/request/node_modules/is-typedarray/index.js deleted file mode 100644 index 58596036..00000000 --- a/APIs/node_modules/request/node_modules/is-typedarray/index.js +++ /dev/null @@ -1,41 +0,0 @@ -module.exports = isTypedArray -isTypedArray.strict = isStrictTypedArray -isTypedArray.loose = isLooseTypedArray - -var toString = Object.prototype.toString -var names = { - '[object Int8Array]': true - , '[object Int16Array]': true - , '[object Int32Array]': true - , '[object Uint8Array]': true - , '[object Uint8ClampedArray]': true - , '[object Uint16Array]': true - , '[object Uint32Array]': true - , '[object Float32Array]': true - , '[object Float64Array]': true -} - -function isTypedArray(arr) { - return ( - isStrictTypedArray(arr) - || isLooseTypedArray(arr) - ) -} - -function isStrictTypedArray(arr) { - return ( - arr instanceof Int8Array - || arr instanceof Int16Array - || arr instanceof Int32Array - || arr instanceof Uint8Array - || arr instanceof Uint8ClampedArray - || arr instanceof Uint16Array - || arr instanceof Uint32Array - || arr instanceof Float32Array - || arr instanceof Float64Array - ) -} - -function isLooseTypedArray(arr) { - return names[toString.call(arr)] -} diff --git a/APIs/node_modules/request/node_modules/is-typedarray/package.json b/APIs/node_modules/request/node_modules/is-typedarray/package.json deleted file mode 100644 index 8387a752..00000000 --- a/APIs/node_modules/request/node_modules/is-typedarray/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "is-typedarray", - "version": "1.0.0", - "description": "Detect whether or not an object is a Typed Array", - "main": "index.js", - "scripts": { - "test": "node test" - }, - "author": { - "name": "Hugh Kennedy", - "email": "hughskennedy@gmail.com", - "url": "http://hughsk.io/" - }, - "license": "MIT", - "dependencies": {}, - "devDependencies": { - "tape": "^2.13.1" - }, - "repository": { - "type": "git", - "url": "git://github.com/hughsk/is-typedarray.git" - }, - "keywords": [ - "typed", - "array", - "detect", - "is", - "util" - ], - "bugs": { - "url": "https://github.com/hughsk/is-typedarray/issues" - }, - "homepage": "https://github.com/hughsk/is-typedarray", - "gitHead": "0617cfa871686cf541af62b144f130488f44f6fe", - "_id": "is-typedarray@1.0.0", - "_shasum": "e479c80858df0c1b11ddda6940f96011fcda4a9a", - "_from": "is-typedarray@~1.0.0", - "_npmVersion": "2.7.5", - "_nodeVersion": "0.10.36", - "_npmUser": { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - }, - "dist": { - "shasum": "e479c80858df0c1b11ddda6940f96011fcda4a9a", - "tarball": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" - }, - "maintainers": [ - { - "name": "hughsk", - "email": "hughskennedy@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz" -} diff --git a/APIs/node_modules/request/node_modules/is-typedarray/test.js b/APIs/node_modules/request/node_modules/is-typedarray/test.js deleted file mode 100644 index b0c176fa..00000000 --- a/APIs/node_modules/request/node_modules/is-typedarray/test.js +++ /dev/null @@ -1,34 +0,0 @@ -var test = require('tape') -var ista = require('./') - -test('strict', function(t) { - t.ok(ista.strict(new Int8Array), 'Int8Array') - t.ok(ista.strict(new Int16Array), 'Int16Array') - t.ok(ista.strict(new Int32Array), 'Int32Array') - t.ok(ista.strict(new Uint8Array), 'Uint8Array') - t.ok(ista.strict(new Uint16Array), 'Uint16Array') - t.ok(ista.strict(new Uint32Array), 'Uint32Array') - t.ok(ista.strict(new Float32Array), 'Float32Array') - t.ok(ista.strict(new Float64Array), 'Float64Array') - - t.ok(!ista.strict(new Array), 'Array') - t.ok(!ista.strict([]), '[]') - - t.end() -}) - -test('loose', function(t) { - t.ok(ista.loose(new Int8Array), 'Int8Array') - t.ok(ista.loose(new Int16Array), 'Int16Array') - t.ok(ista.loose(new Int32Array), 'Int32Array') - t.ok(ista.loose(new Uint8Array), 'Uint8Array') - t.ok(ista.loose(new Uint16Array), 'Uint16Array') - t.ok(ista.loose(new Uint32Array), 'Uint32Array') - t.ok(ista.loose(new Float32Array), 'Float32Array') - t.ok(ista.loose(new Float64Array), 'Float64Array') - - t.ok(!ista.loose(new Array), 'Array') - t.ok(!ista.loose([]), '[]') - - t.end() -}) diff --git a/APIs/node_modules/request/node_modules/isstream/.jshintrc b/APIs/node_modules/request/node_modules/isstream/.jshintrc deleted file mode 100644 index c8ef3ca4..00000000 --- a/APIs/node_modules/request/node_modules/isstream/.jshintrc +++ /dev/null @@ -1,59 +0,0 @@ -{ - "predef": [ ] - , "bitwise": false - , "camelcase": false - , "curly": false - , "eqeqeq": false - , "forin": false - , "immed": false - , "latedef": false - , "noarg": true - , "noempty": true - , "nonew": true - , "plusplus": false - , "quotmark": true - , "regexp": false - , "undef": true - , "unused": true - , "strict": false - , "trailing": true - , "maxlen": 120 - , "asi": true - , "boss": true - , "debug": true - , "eqnull": true - , "esnext": true - , "evil": true - , "expr": true - , "funcscope": false - , "globalstrict": false - , "iterator": false - , "lastsemic": true - , "laxbreak": true - , "laxcomma": true - , "loopfunc": true - , "multistr": false - , "onecase": false - , "proto": false - , "regexdash": false - , "scripturl": true - , "smarttabs": false - , "shadow": false - , "sub": true - , "supernew": false - , "validthis": true - , "browser": true - , "couch": false - , "devel": false - , "dojo": false - , "mootools": false - , "node": true - , "nonstandard": true - , "prototypejs": false - , "rhino": false - , "worker": true - , "wsh": false - , "nomen": false - , "onevar": false - , "passfail": false -} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/isstream/.npmignore b/APIs/node_modules/request/node_modules/isstream/.npmignore deleted file mode 100644 index aa1ec1ea..00000000 --- a/APIs/node_modules/request/node_modules/isstream/.npmignore +++ /dev/null @@ -1 +0,0 @@ -*.tgz diff --git a/APIs/node_modules/request/node_modules/isstream/.travis.yml b/APIs/node_modules/request/node_modules/isstream/.travis.yml deleted file mode 100644 index 1fec2ab9..00000000 --- a/APIs/node_modules/request/node_modules/isstream/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.11" -branches: - only: - - master -notifications: - email: - - rod@vagg.org -script: npm test diff --git a/APIs/node_modules/request/node_modules/isstream/LICENSE.md b/APIs/node_modules/request/node_modules/isstream/LICENSE.md deleted file mode 100644 index 43f7153f..00000000 --- a/APIs/node_modules/request/node_modules/isstream/LICENSE.md +++ /dev/null @@ -1,11 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2015 Rod Vagg ---------------------------- - -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/APIs/node_modules/request/node_modules/isstream/README.md b/APIs/node_modules/request/node_modules/isstream/README.md deleted file mode 100644 index 06770e82..00000000 --- a/APIs/node_modules/request/node_modules/isstream/README.md +++ /dev/null @@ -1,66 +0,0 @@ -# isStream - -[![Build Status](https://secure.travis-ci.org/rvagg/isstream.png)](http://travis-ci.org/rvagg/isstream) - -**Test if an object is a `Stream`** - -[![NPM](https://nodei.co/npm/isstream.svg)](https://nodei.co/npm/isstream/) - -The missing `Stream.isStream(obj)`: determine if an object is standard Node.js `Stream`. Works for Node-core `Stream` objects (for 0.8, 0.10, 0.11, and in theory, older and newer versions) and all versions of **[readable-stream](https://github.com/isaacs/readable-stream)**. - -## Usage: - -```js -var isStream = require('isstream') -var Stream = require('stream') - -isStream(new Stream()) // true - -isStream({}) // false - -isStream(new Stream.Readable()) // true -isStream(new Stream.Writable()) // true -isStream(new Stream.Duplex()) // true -isStream(new Stream.Transform()) // true -isStream(new Stream.PassThrough()) // true -``` - -## But wait! There's more! - -You can also test for `isReadable(obj)`, `isWritable(obj)` and `isDuplex(obj)` to test for implementations of Streams2 (and Streams3) base classes. - -```js -var isReadable = require('isstream').isReadable -var isWritable = require('isstream').isWritable -var isDuplex = require('isstream').isDuplex -var Stream = require('stream') - -isReadable(new Stream()) // false -isWritable(new Stream()) // false -isDuplex(new Stream()) // false - -isReadable(new Stream.Readable()) // true -isReadable(new Stream.Writable()) // false -isReadable(new Stream.Duplex()) // true -isReadable(new Stream.Transform()) // true -isReadable(new Stream.PassThrough()) // true - -isWritable(new Stream.Readable()) // false -isWritable(new Stream.Writable()) // true -isWritable(new Stream.Duplex()) // true -isWritable(new Stream.Transform()) // true -isWritable(new Stream.PassThrough()) // true - -isDuplex(new Stream.Readable()) // false -isDuplex(new Stream.Writable()) // false -isDuplex(new Stream.Duplex()) // true -isDuplex(new Stream.Transform()) // true -isDuplex(new Stream.PassThrough()) // true -``` - -*Reminder: when implementing your own streams, please [use **readable-stream** rather than core streams](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).* - - -## License - -**isStream** is Copyright (c) 2015 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licenced under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details. diff --git a/APIs/node_modules/request/node_modules/isstream/isstream.js b/APIs/node_modules/request/node_modules/isstream/isstream.js deleted file mode 100644 index a1d104a7..00000000 --- a/APIs/node_modules/request/node_modules/isstream/isstream.js +++ /dev/null @@ -1,27 +0,0 @@ -var stream = require('stream') - - -function isStream (obj) { - return obj instanceof stream.Stream -} - - -function isReadable (obj) { - return isStream(obj) && typeof obj._read == 'function' && typeof obj._readableState == 'object' -} - - -function isWritable (obj) { - return isStream(obj) && typeof obj._write == 'function' && typeof obj._writableState == 'object' -} - - -function isDuplex (obj) { - return isReadable(obj) && isWritable(obj) -} - - -module.exports = isStream -module.exports.isReadable = isReadable -module.exports.isWritable = isWritable -module.exports.isDuplex = isDuplex diff --git a/APIs/node_modules/request/node_modules/isstream/package.json b/APIs/node_modules/request/node_modules/isstream/package.json deleted file mode 100644 index 178986b7..00000000 --- a/APIs/node_modules/request/node_modules/isstream/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "isstream", - "version": "0.1.2", - "description": "Determine if an object is a Stream", - "main": "isstream.js", - "scripts": { - "test": "tar --xform 's/^package/readable-stream-1.0/' -zxf readable-stream-1.0.*.tgz && tar --xform 's/^package/readable-stream-1.1/' -zxf readable-stream-1.1.*.tgz && node test.js; rm -rf readable-stream-1.?/" - }, - "repository": { - "type": "git", - "url": "https://github.com/rvagg/isstream.git" - }, - "keywords": [ - "stream", - "type", - "streams", - "readable-stream", - "hippo" - ], - "devDependencies": { - "tape": "~2.12.3", - "core-util-is": "~1.0.0", - "isarray": "0.0.1", - "string_decoder": "~0.10.x", - "inherits": "~2.0.1" - }, - "author": { - "name": "Rod Vagg", - "email": "rod@vagg.org" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/rvagg/isstream/issues" - }, - "homepage": "https://github.com/rvagg/isstream", - "gitHead": "cd39cba6da939b4fc9110825203adc506422c3dc", - "_id": "isstream@0.1.2", - "_shasum": "47e63f7af55afa6f92e1500e690eb8b8529c099a", - "_from": "isstream@~0.1.2", - "_npmVersion": "2.6.1", - "_nodeVersion": "1.4.3", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "47e63f7af55afa6f92e1500e690eb8b8529c099a", - "tarball": "http://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/isstream/test.js b/APIs/node_modules/request/node_modules/isstream/test.js deleted file mode 100644 index 8c950c55..00000000 --- a/APIs/node_modules/request/node_modules/isstream/test.js +++ /dev/null @@ -1,168 +0,0 @@ -var tape = require('tape') - , EE = require('events').EventEmitter - , util = require('util') - - - , isStream = require('./') - , isReadable = require('./').isReadable - , isWritable = require('./').isWritable - , isDuplex = require('./').isDuplex - - , CoreStreams = require('stream') - , ReadableStream10 = require('./readable-stream-1.0/') - , ReadableStream11 = require('./readable-stream-1.1/') - - -function test (pass, type, stream) { - tape('isStream(' + type + ')', function (t) { - t.plan(1) - t.ok(pass === isStream(stream), type) - }) -} - - -function testReadable (pass, type, stream) { - tape('isReadable(' + type + ')', function (t) { - t.plan(1) - t.ok(pass === isReadable(stream), type) - }) -} - - -function testWritable (pass, type, stream) { - tape('isWritable(' + type + ')', function (t) { - t.plan(1) - t.ok(pass === isWritable(stream), type) - }) -} - - -function testDuplex (pass, type, stream) { - tape('isDuplex(' + type + ')', function (t) { - t.plan(1) - t.ok(pass === isDuplex(stream), type) - }) -} - - -[ undefined, null, '', true, false, 0, 1, 1.0, 'string', {}, function foo () {} ].forEach(function (o) { - test(false, 'non-stream / primitive: ' + (JSON.stringify(o) || (o && o.toString()) || o), o) -}) - - -test(false, 'fake stream obj', { pipe: function () {} }) - - -;(function () { - - // looks like a stream! - - function Stream () { - EE.call(this) - } - util.inherits(Stream, EE) - Stream.prototype.pipe = function () {} - Stream.Stream = Stream - - test(false, 'fake stream "new Stream()"', new Stream()) - -}()) - - -test(true, 'CoreStreams.Stream', new (CoreStreams.Stream)()) -test(true, 'CoreStreams.Readable', new (CoreStreams.Readable)()) -test(true, 'CoreStreams.Writable', new (CoreStreams.Writable)()) -test(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) -test(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) -test(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) - -test(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) -test(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) -test(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) -test(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) -test(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) - -test(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) -test(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) -test(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) -test(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) -test(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) - - -testReadable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)()) -testReadable(true, 'CoreStreams.Readable', new (CoreStreams.Readable)()) -testReadable(false, 'CoreStreams.Writable', new (CoreStreams.Writable)()) -testReadable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) -testReadable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) -testReadable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) - -testReadable(true, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) -testReadable(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) -testReadable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) -testReadable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) -testReadable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) - -testReadable(true, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) -testReadable(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) -testReadable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) -testReadable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) -testReadable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) - - -testWritable(false, 'CoreStreams.Stream', new (CoreStreams.Stream)()) -testWritable(false, 'CoreStreams.Readable', new (CoreStreams.Readable)()) -testWritable(true, 'CoreStreams.Writable', new (CoreStreams.Writable)()) -testWritable(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) -testWritable(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) -testWritable(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) - -testWritable(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) -testWritable(true, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) -testWritable(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) -testWritable(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) -testWritable(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) - -testWritable(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) -testWritable(true, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) -testWritable(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) -testWritable(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) -testWritable(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) - - -testDuplex(false, 'CoreStreams.Stream', new (CoreStreams.Stream)()) -testDuplex(false, 'CoreStreams.Readable', new (CoreStreams.Readable)()) -testDuplex(false, 'CoreStreams.Writable', new (CoreStreams.Writable)()) -testDuplex(true, 'CoreStreams.Duplex', new (CoreStreams.Duplex)()) -testDuplex(true, 'CoreStreams.Transform', new (CoreStreams.Transform)()) -testDuplex(true, 'CoreStreams.PassThrough', new (CoreStreams.PassThrough)()) - -testDuplex(false, 'ReadableStream10.Readable', new (ReadableStream10.Readable)()) -testDuplex(false, 'ReadableStream10.Writable', new (ReadableStream10.Writable)()) -testDuplex(true, 'ReadableStream10.Duplex', new (ReadableStream10.Duplex)()) -testDuplex(true, 'ReadableStream10.Transform', new (ReadableStream10.Transform)()) -testDuplex(true, 'ReadableStream10.PassThrough', new (ReadableStream10.PassThrough)()) - -testDuplex(false, 'ReadableStream11.Readable', new (ReadableStream11.Readable)()) -testDuplex(false, 'ReadableStream11.Writable', new (ReadableStream11.Writable)()) -testDuplex(true, 'ReadableStream11.Duplex', new (ReadableStream11.Duplex)()) -testDuplex(true, 'ReadableStream11.Transform', new (ReadableStream11.Transform)()) -testDuplex(true, 'ReadableStream11.PassThrough', new (ReadableStream11.PassThrough)()) - - -;[ CoreStreams, ReadableStream10, ReadableStream11 ].forEach(function (p) { - [ 'Stream', 'Readable', 'Writable', 'Duplex', 'Transform', 'PassThrough' ].forEach(function (k) { - if (!p[k]) - return - - function SubStream () { - p[k].call(this) - } - util.inherits(SubStream, p[k]) - - test(true, 'Stream subclass: ' + p.name + '.' + k, new SubStream()) - - }) -}) - - - diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/.npmignore b/APIs/node_modules/request/node_modules/json-stringify-safe/.npmignore deleted file mode 100644 index 17d6b367..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/.npmignore +++ /dev/null @@ -1 +0,0 @@ -/*.tgz diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md b/APIs/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md deleted file mode 100644 index 42bcb60a..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/CHANGELOG.md +++ /dev/null @@ -1,14 +0,0 @@ -## Unreleased -- Fixes stringify to only take ancestors into account when checking - circularity. - It previously assumed every visited object was circular which led to [false - positives][issue9]. - Uses the tiny serializer I wrote for [Must.js][must] a year and a half ago. -- Fixes calling the `replacer` function in the proper context (`thisArg`). -- Fixes calling the `cycleReplacer` function in the proper context (`thisArg`). -- Speeds serializing by a factor of - Big-O(h-my-god-it-linearly-searched-every-object) it had ever seen. Searching - only the ancestors for a circular references speeds up things considerably. - -[must]: https://github.com/moll/js-must -[issue9]: https://github.com/isaacs/json-stringify-safe/issues/9 diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/LICENSE b/APIs/node_modules/request/node_modules/json-stringify-safe/LICENSE deleted file mode 100644 index 19129e31..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -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. diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/Makefile b/APIs/node_modules/request/node_modules/json-stringify-safe/Makefile deleted file mode 100644 index 36088c72..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/Makefile +++ /dev/null @@ -1,35 +0,0 @@ -NODE_OPTS = -TEST_OPTS = - -love: - @echo "Feel like makin' love." - -test: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot $(TEST_OPTS) - -spec: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec $(TEST_OPTS) - -autotest: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R dot --watch $(TEST_OPTS) - -autospec: - @node $(NODE_OPTS) ./node_modules/.bin/_mocha -R spec --watch $(TEST_OPTS) - -pack: - @file=$$(npm pack); echo "$$file"; tar tf "$$file" - -publish: - npm publish - -tag: - git tag "v$$(node -e 'console.log(require("./package").version)')" - -clean: - rm -f *.tgz - npm prune --production - -.PHONY: love -.PHONY: test spec autotest autospec -.PHONY: pack publish tag -.PHONY: clean diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/README.md b/APIs/node_modules/request/node_modules/json-stringify-safe/README.md deleted file mode 100644 index a11f302a..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/README.md +++ /dev/null @@ -1,52 +0,0 @@ -# json-stringify-safe - -Like JSON.stringify, but doesn't throw on circular references. - -## Usage - -Takes the same arguments as `JSON.stringify`. - -```javascript -var stringify = require('json-stringify-safe'); -var circularObj = {}; -circularObj.circularRef = circularObj; -circularObj.list = [ circularObj, circularObj ]; -console.log(stringify(circularObj, null, 2)); -``` - -Output: - -```json -{ - "circularRef": "[Circular]", - "list": [ - "[Circular]", - "[Circular]" - ] -} -``` - -## Details - -``` -stringify(obj, serializer, indent, decycler) -``` - -The first three arguments are the same as to JSON.stringify. The last -is an argument that's only used when the object has been seen already. - -The default `decycler` function returns the string `'[Circular]'`. -If, for example, you pass in `function(k,v){}` (return nothing) then it -will prune cycles. If you pass in `function(k,v){ return {foo: 'bar'}}`, -then cyclical objects will always be represented as `{"foo":"bar"}` in -the result. - -``` -stringify.getSerialize(serializer, decycler) -``` - -Returns a serializer that can be used elsewhere. This is the actual -function that's passed to JSON.stringify. - -**Note** that the function returned from `getSerialize` is stateful for now, so -do **not** use it more than once. diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/package.json b/APIs/node_modules/request/node_modules/json-stringify-safe/package.json deleted file mode 100644 index 37f831bf..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "json-stringify-safe", - "version": "5.0.1", - "description": "Like JSON.stringify, but doesn't blow up on circular refs.", - "keywords": [ - "json", - "stringify", - "circular", - "safe" - ], - "homepage": "https://github.com/isaacs/json-stringify-safe", - "bugs": { - "url": "https://github.com/isaacs/json-stringify-safe/issues" - }, - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me" - }, - "contributors": [ - { - "name": "Andri Möll", - "email": "andri@dot.ee", - "url": "http://themoll.com" - } - ], - "license": "ISC", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/json-stringify-safe.git" - }, - "main": "stringify.js", - "scripts": { - "test": "node test.js" - }, - "devDependencies": { - "mocha": ">= 2.1.0 < 3", - "must": ">= 0.12 < 0.13", - "sinon": ">= 1.12.2 < 2" - }, - "gitHead": "3890dceab3ad14f8701e38ca74f38276abc76de5", - "_id": "json-stringify-safe@5.0.1", - "_shasum": "1296a2d58fd45f19a0f6ce01d65701e2c735b6eb", - "_from": "json-stringify-safe@~5.0.1", - "_npmVersion": "2.10.0", - "_nodeVersion": "2.0.1", - "_npmUser": { - "name": "isaacs", - "email": "isaacs@npmjs.com" - }, - "dist": { - "shasum": "1296a2d58fd45f19a0f6ce01d65701e2c735b6eb", - "tarball": "http://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "moll", - "email": "andri@dot.ee" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/stringify.js b/APIs/node_modules/request/node_modules/json-stringify-safe/stringify.js deleted file mode 100644 index 124a4521..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/stringify.js +++ /dev/null @@ -1,27 +0,0 @@ -exports = module.exports = stringify -exports.getSerialize = serializer - -function stringify(obj, replacer, spaces, cycleReplacer) { - return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces) -} - -function serializer(replacer, cycleReplacer) { - var stack = [], keys = [] - - if (cycleReplacer == null) cycleReplacer = function(key, value) { - if (stack[0] === value) return "[Circular ~]" - return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]" - } - - return function(key, value) { - if (stack.length > 0) { - var thisPos = stack.indexOf(this) - ~thisPos ? stack.splice(thisPos + 1) : stack.push(this) - ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key) - if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value) - } - else stack.push(value) - - return replacer == null ? value : replacer.call(this, key, value) - } -} diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts b/APIs/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts deleted file mode 100644 index 2544e586..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/test/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---recursive ---require must diff --git a/APIs/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js b/APIs/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js deleted file mode 100644 index 5b325831..00000000 --- a/APIs/node_modules/request/node_modules/json-stringify-safe/test/stringify_test.js +++ /dev/null @@ -1,246 +0,0 @@ -var Sinon = require("sinon") -var stringify = require("..") -function jsonify(obj) { return JSON.stringify(obj, null, 2) } - -describe("Stringify", function() { - it("must stringify circular objects", function() { - var obj = {name: "Alice"} - obj.self = obj - var json = stringify(obj, null, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - }) - - it("must stringify circular objects with intermediaries", function() { - var obj = {name: "Alice"} - obj.identity = {self: obj} - var json = stringify(obj, null, 2) - json.must.eql(jsonify({name: "Alice", identity: {self: "[Circular ~]"}})) - }) - - it("must stringify circular objects deeper", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - obj.child.self = obj.child - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - child: {name: "Bob", self: "[Circular ~.child]"} - })) - }) - - it("must stringify circular objects deeper with intermediaries", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - obj.child.identity = {self: obj.child} - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - child: {name: "Bob", identity: {self: "[Circular ~.child]"}} - })) - }) - - it("must stringify circular objects in an array", function() { - var obj = {name: "Alice"} - obj.self = [obj, obj] - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", self: ["[Circular ~]", "[Circular ~]"] - })) - }) - - it("must stringify circular objects deeper in an array", function() { - var obj = {name: "Alice", children: [{name: "Bob"}, {name: "Eve"}]} - obj.children[0].self = obj.children[0] - obj.children[1].self = obj.children[1] - - stringify(obj, null, 2).must.eql(jsonify({ - name: "Alice", - children: [ - {name: "Bob", self: "[Circular ~.children.0]"}, - {name: "Eve", self: "[Circular ~.children.1]"} - ] - })) - }) - - it("must stringify circular arrays", function() { - var obj = [] - obj.push(obj) - obj.push(obj) - var json = stringify(obj, null, 2) - json.must.eql(jsonify(["[Circular ~]", "[Circular ~]"])) - }) - - it("must stringify circular arrays with intermediaries", function() { - var obj = [] - obj.push({name: "Alice", self: obj}) - obj.push({name: "Bob", self: obj}) - - stringify(obj, null, 2).must.eql(jsonify([ - {name: "Alice", self: "[Circular ~]"}, - {name: "Bob", self: "[Circular ~]"} - ])) - }) - - it("must stringify repeated objects in objects", function() { - var obj = {} - var alice = {name: "Alice"} - obj.alice1 = alice - obj.alice2 = alice - - stringify(obj, null, 2).must.eql(jsonify({ - alice1: {name: "Alice"}, - alice2: {name: "Alice"} - })) - }) - - it("must stringify repeated objects in arrays", function() { - var alice = {name: "Alice"} - var obj = [alice, alice] - var json = stringify(obj, null, 2) - json.must.eql(jsonify([{name: "Alice"}, {name: "Alice"}])) - }) - - it("must call given decycler and use its output", function() { - var obj = {} - obj.a = obj - obj.b = obj - - var decycle = Sinon.spy(function() { return decycle.callCount }) - var json = stringify(obj, null, 2, decycle) - json.must.eql(jsonify({a: 1, b: 2}, null, 2)) - - decycle.callCount.must.equal(2) - decycle.thisValues[0].must.equal(obj) - decycle.args[0][0].must.equal("a") - decycle.args[0][1].must.equal(obj) - decycle.thisValues[1].must.equal(obj) - decycle.args[1][0].must.equal("b") - decycle.args[1][1].must.equal(obj) - }) - - it("must call replacer and use its output", function() { - var obj = {name: "Alice", child: {name: "Bob"}} - - var replacer = Sinon.spy(bangString) - var json = stringify(obj, replacer, 2) - json.must.eql(jsonify({name: "Alice!", child: {name: "Bob!"}})) - - replacer.callCount.must.equal(4) - replacer.args[0][0].must.equal("") - replacer.args[0][1].must.equal(obj) - replacer.thisValues[1].must.equal(obj) - replacer.args[1][0].must.equal("name") - replacer.args[1][1].must.equal("Alice") - replacer.thisValues[2].must.equal(obj) - replacer.args[2][0].must.equal("child") - replacer.args[2][1].must.equal(obj.child) - replacer.thisValues[3].must.equal(obj.child) - replacer.args[3][0].must.equal("name") - replacer.args[3][1].must.equal("Bob") - }) - - it("must call replacer after describing circular references", function() { - var obj = {name: "Alice"} - obj.self = obj - - var replacer = Sinon.spy(bangString) - var json = stringify(obj, replacer, 2) - json.must.eql(jsonify({name: "Alice!", self: "[Circular ~]!"})) - - replacer.callCount.must.equal(3) - replacer.args[0][0].must.equal("") - replacer.args[0][1].must.equal(obj) - replacer.thisValues[1].must.equal(obj) - replacer.args[1][0].must.equal("name") - replacer.args[1][1].must.equal("Alice") - replacer.thisValues[2].must.equal(obj) - replacer.args[2][0].must.equal("self") - replacer.args[2][1].must.equal("[Circular ~]") - }) - - it("must call given decycler and use its output for nested objects", - function() { - var obj = {} - obj.a = obj - obj.b = {self: obj} - - var decycle = Sinon.spy(function() { return decycle.callCount }) - var json = stringify(obj, null, 2, decycle) - json.must.eql(jsonify({a: 1, b: {self: 2}})) - - decycle.callCount.must.equal(2) - decycle.args[0][0].must.equal("a") - decycle.args[0][1].must.equal(obj) - decycle.args[1][0].must.equal("self") - decycle.args[1][1].must.equal(obj) - }) - - it("must use decycler's output when it returned null", function() { - var obj = {a: "b"} - obj.self = obj - obj.selves = [obj, obj] - - function decycle() { return null } - stringify(obj, null, 2, decycle).must.eql(jsonify({ - a: "b", - self: null, - selves: [null, null] - })) - }) - - it("must use decycler's output when it returned undefined", function() { - var obj = {a: "b"} - obj.self = obj - obj.selves = [obj, obj] - - function decycle() {} - stringify(obj, null, 2, decycle).must.eql(jsonify({ - a: "b", - selves: [null, null] - })) - }) - - it("must throw given a decycler that returns a cycle", function() { - var obj = {} - obj.self = obj - var err - function identity(key, value) { return value } - try { stringify(obj, null, 2, identity) } catch (ex) { err = ex } - err.must.be.an.instanceof(TypeError) - }) - - describe(".getSerialize", function() { - it("must stringify circular objects", function() { - var obj = {a: "b"} - obj.circularRef = obj - obj.list = [obj, obj] - - var json = JSON.stringify(obj, stringify.getSerialize(), 2) - json.must.eql(jsonify({ - "a": "b", - "circularRef": "[Circular ~]", - "list": ["[Circular ~]", "[Circular ~]"] - })) - }) - - // This is the behavior as of Mar 3, 2015. - // The serializer function keeps state inside the returned function and - // so far I'm not sure how to not do that. JSON.stringify's replacer is not - // called _after_ serialization. - xit("must return a function that could be called twice", function() { - var obj = {name: "Alice"} - obj.self = obj - - var json - var serializer = stringify.getSerialize() - - json = JSON.stringify(obj, serializer, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - - json = JSON.stringify(obj, serializer, 2) - json.must.eql(jsonify({name: "Alice", self: "[Circular ~]"})) - }) - }) -}) - -function bangString(key, value) { - return typeof value == "string" ? value + "!" : value -} diff --git a/APIs/node_modules/request/node_modules/mime-types/HISTORY.md b/APIs/node_modules/request/node_modules/mime-types/HISTORY.md deleted file mode 100644 index 63bd4ea0..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/HISTORY.md +++ /dev/null @@ -1,197 +0,0 @@ -2.1.11 / 2016-05-01 -=================== - - * deps: mime-db@~1.23.0 - - Add new mime types - -2.1.10 / 2016-02-15 -=================== - - * deps: mime-db@~1.22.0 - - Add new mime types - - Fix extension of `application/dash+xml` - - Update primary extension for `audio/mp4` - -2.1.9 / 2016-01-06 -================== - - * deps: mime-db@~1.21.0 - - Add new mime types - -2.1.8 / 2015-11-30 -================== - - * deps: mime-db@~1.20.0 - - Add new mime types - -2.1.7 / 2015-09-20 -================== - - * deps: mime-db@~1.19.0 - - Add new mime types - -2.1.6 / 2015-09-03 -================== - - * deps: mime-db@~1.18.0 - - Add new mime types - -2.1.5 / 2015-08-20 -================== - - * deps: mime-db@~1.17.0 - - Add new mime types - -2.1.4 / 2015-07-30 -================== - - * deps: mime-db@~1.16.0 - - Add new mime types - -2.1.3 / 2015-07-13 -================== - - * deps: mime-db@~1.15.0 - - Add new mime types - -2.1.2 / 2015-06-25 -================== - - * deps: mime-db@~1.14.0 - - Add new mime types - -2.1.1 / 2015-06-08 -================== - - * perf: fix deopt during mapping - -2.1.0 / 2015-06-07 -================== - - * Fix incorrectly treating extension-less file name as extension - - i.e. `'path/to/json'` will no longer return `application/json` - * Fix `.charset(type)` to accept parameters - * Fix `.charset(type)` to match case-insensitive - * Improve generation of extension to MIME mapping - * Refactor internals for readability and no argument reassignment - * Prefer `application/*` MIME types from the same source - * Prefer any type over `application/octet-stream` - * deps: mime-db@~1.13.0 - - Add nginx as a source - - Add new mime types - -2.0.14 / 2015-06-06 -=================== - - * deps: mime-db@~1.12.0 - - Add new mime types - -2.0.13 / 2015-05-31 -=================== - - * deps: mime-db@~1.11.0 - - Add new mime types - -2.0.12 / 2015-05-19 -=================== - - * deps: mime-db@~1.10.0 - - Add new mime types - -2.0.11 / 2015-05-05 -=================== - - * deps: mime-db@~1.9.1 - - Add new mime types - -2.0.10 / 2015-03-13 -=================== - - * deps: mime-db@~1.8.0 - - Add new mime types - -2.0.9 / 2015-02-09 -================== - - * deps: mime-db@~1.7.0 - - Add new mime types - - Community extensions ownership transferred from `node-mime` - -2.0.8 / 2015-01-29 -================== - - * deps: mime-db@~1.6.0 - - Add new mime types - -2.0.7 / 2014-12-30 -================== - - * deps: mime-db@~1.5.0 - - Add new mime types - - Fix various invalid MIME type entries - -2.0.6 / 2014-12-30 -================== - - * deps: mime-db@~1.4.0 - - Add new mime types - - Fix various invalid MIME type entries - - Remove example template MIME types - -2.0.5 / 2014-12-29 -================== - - * deps: mime-db@~1.3.1 - - Fix missing extensions - -2.0.4 / 2014-12-10 -================== - - * deps: mime-db@~1.3.0 - - Add new mime types - -2.0.3 / 2014-11-09 -================== - - * deps: mime-db@~1.2.0 - - Add new mime types - -2.0.2 / 2014-09-28 -================== - - * deps: mime-db@~1.1.0 - - Add new mime types - - Add additional compressible - - Update charsets - -2.0.1 / 2014-09-07 -================== - - * Support Node.js 0.6 - -2.0.0 / 2014-09-02 -================== - - * Use `mime-db` - * Remove `.define()` - -1.0.2 / 2014-08-04 -================== - - * Set charset=utf-8 for `text/javascript` - -1.0.1 / 2014-06-24 -================== - - * Add `text/jsx` type - -1.0.0 / 2014-05-12 -================== - - * Return `false` for unknown types - * Set charset=utf-8 for `application/json` - -0.1.0 / 2014-05-02 -================== - - * Initial release diff --git a/APIs/node_modules/request/node_modules/mime-types/LICENSE b/APIs/node_modules/request/node_modules/mime-types/LICENSE deleted file mode 100644 index 06166077..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/LICENSE +++ /dev/null @@ -1,23 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Jonathan Ong -Copyright (c) 2015 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/APIs/node_modules/request/node_modules/mime-types/README.md b/APIs/node_modules/request/node_modules/mime-types/README.md deleted file mode 100644 index e77d615d..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/README.md +++ /dev/null @@ -1,103 +0,0 @@ -# mime-types - -[![NPM Version][npm-image]][npm-url] -[![NPM Downloads][downloads-image]][downloads-url] -[![Node.js Version][node-version-image]][node-version-url] -[![Build Status][travis-image]][travis-url] -[![Test Coverage][coveralls-image]][coveralls-url] - -The ultimate javascript content-type utility. - -Similar to [node-mime](https://github.com/broofa/node-mime), except: - -- __No fallbacks.__ Instead of naively returning the first available type, `mime-types` simply returns `false`, - so do `var type = mime.lookup('unrecognized') || 'application/octet-stream'`. -- No `new Mime()` business, so you could do `var lookup = require('mime-types').lookup`. -- Additional mime types are added such as jade and stylus via [mime-db](https://github.com/jshttp/mime-db) -- No `.define()` functionality - -Otherwise, the API is compatible. - -## Install - -```sh -$ npm install mime-types -``` - -## Adding Types - -All mime types are based on [mime-db](https://github.com/jshttp/mime-db), -so open a PR there if you'd like to add mime types. - -## API - -```js -var mime = require('mime-types') -``` - -All functions return `false` if input is invalid or not found. - -### mime.lookup(path) - -Lookup the content-type associated with a file. - -```js -mime.lookup('json') // 'application/json' -mime.lookup('.md') // 'text/x-markdown' -mime.lookup('file.html') // 'text/html' -mime.lookup('folder/file.js') // 'application/javascript' -mime.lookup('folder/.htaccess') // false - -mime.lookup('cats') // false -``` - -### mime.contentType(type) - -Create a full content-type header given a content-type or extension. - -```js -mime.contentType('markdown') // 'text/x-markdown; charset=utf-8' -mime.contentType('file.json') // 'application/json; charset=utf-8' - -// from a full path -mime.contentType(path.extname('/path/to/file.json')) // 'application/json; charset=utf-8' -``` - -### mime.extension(type) - -Get the default extension for a content-type. - -```js -mime.extension('application/octet-stream') // 'bin' -``` - -### mime.charset(type) - -Lookup the implied default charset of a content-type. - -```js -mime.charset('text/x-markdown') // 'UTF-8' -``` - -### var type = mime.types[extension] - -A map of content-types by extension. - -### [extensions...] = mime.extensions[type] - -A map of extensions by content-type. - -## License - -[MIT](LICENSE) - -[npm-image]: https://img.shields.io/npm/v/mime-types.svg -[npm-url]: https://npmjs.org/package/mime-types -[node-version-image]: https://img.shields.io/node/v/mime-types.svg -[node-version-url]: https://nodejs.org/en/download/ -[travis-image]: https://img.shields.io/travis/jshttp/mime-types/master.svg -[travis-url]: https://travis-ci.org/jshttp/mime-types -[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-types/master.svg -[coveralls-url]: https://coveralls.io/r/jshttp/mime-types -[downloads-image]: https://img.shields.io/npm/dm/mime-types.svg -[downloads-url]: https://npmjs.org/package/mime-types diff --git a/APIs/node_modules/request/node_modules/mime-types/index.js b/APIs/node_modules/request/node_modules/mime-types/index.js deleted file mode 100644 index f7008b24..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/index.js +++ /dev/null @@ -1,188 +0,0 @@ -/*! - * mime-types - * Copyright(c) 2014 Jonathan Ong - * Copyright(c) 2015 Douglas Christopher Wilson - * MIT Licensed - */ - -'use strict' - -/** - * Module dependencies. - * @private - */ - -var db = require('mime-db') -var extname = require('path').extname - -/** - * Module variables. - * @private - */ - -var extractTypeRegExp = /^\s*([^;\s]*)(?:;|\s|$)/ -var textTypeRegExp = /^text\//i - -/** - * Module exports. - * @public - */ - -exports.charset = charset -exports.charsets = { lookup: charset } -exports.contentType = contentType -exports.extension = extension -exports.extensions = Object.create(null) -exports.lookup = lookup -exports.types = Object.create(null) - -// Populate the extensions/types maps -populateMaps(exports.extensions, exports.types) - -/** - * Get the default charset for a MIME type. - * - * @param {string} type - * @return {boolean|string} - */ - -function charset(type) { - if (!type || typeof type !== 'string') { - return false - } - - // TODO: use media-typer - var match = extractTypeRegExp.exec(type) - var mime = match && db[match[1].toLowerCase()] - - if (mime && mime.charset) { - return mime.charset - } - - // default text/* to utf-8 - if (match && textTypeRegExp.test(match[1])) { - return 'UTF-8' - } - - return false -} - -/** - * Create a full Content-Type header given a MIME type or extension. - * - * @param {string} str - * @return {boolean|string} - */ - -function contentType(str) { - // TODO: should this even be in this module? - if (!str || typeof str !== 'string') { - return false - } - - var mime = str.indexOf('/') === -1 - ? exports.lookup(str) - : str - - if (!mime) { - return false - } - - // TODO: use content-type or other module - if (mime.indexOf('charset') === -1) { - var charset = exports.charset(mime) - if (charset) mime += '; charset=' + charset.toLowerCase() - } - - return mime -} - -/** - * Get the default extension for a MIME type. - * - * @param {string} type - * @return {boolean|string} - */ - -function extension(type) { - if (!type || typeof type !== 'string') { - return false - } - - // TODO: use media-typer - var match = extractTypeRegExp.exec(type) - - // get extensions - var exts = match && exports.extensions[match[1].toLowerCase()] - - if (!exts || !exts.length) { - return false - } - - return exts[0] -} - -/** - * Lookup the MIME type for a file path/extension. - * - * @param {string} path - * @return {boolean|string} - */ - -function lookup(path) { - if (!path || typeof path !== 'string') { - return false - } - - // get the extension ("ext" or ".ext" or full path) - var extension = extname('x.' + path) - .toLowerCase() - .substr(1) - - if (!extension) { - return false - } - - return exports.types[extension] || false -} - -/** - * Populate the extensions and types maps. - * @private - */ - -function populateMaps(extensions, types) { - // source preference (least -> most) - var preference = ['nginx', 'apache', undefined, 'iana'] - - Object.keys(db).forEach(function forEachMimeType(type) { - var mime = db[type] - var exts = mime.extensions - - if (!exts || !exts.length) { - return - } - - // mime -> extensions - extensions[type] = exts - - // extension -> mime - for (var i = 0; i < exts.length; i++) { - var extension = exts[i] - - if (types[extension]) { - var from = preference.indexOf(db[types[extension]].source) - var to = preference.indexOf(mime.source) - - if (types[extension] !== 'application/octet-stream' - && from > to || (from === to && types[extension].substr(0, 12) === 'application/')) { - // skip the remapping - continue - } - } - - // set the extension -> mime - types[extension] = type - } - }) -} diff --git a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md b/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md deleted file mode 100644 index d6705ac8..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/HISTORY.md +++ /dev/null @@ -1,341 +0,0 @@ -1.23.0 / 2016-05-01 -=================== - - * Add `application/efi` - * Add `application/vnd.3gpp.sms+xml` - * Add `application/vnd.3lightssoftware.imagescal` - * Add `application/vnd.coreos.ignition+json` - * Add `application/vnd.desmume.movie` - * Add `application/vnd.onepager` - * Add `application/vnd.vel+json` - * Add `text/prs.prop.logic` - * Add `video/encaprtp` - * Add `video/h265` - * Add `video/iso.segment` - * Add `video/raptorfec` - * Add `video/rtploopback` - * Add `video/vnd.radgamettools.bink` - * Add `video/vnd.radgamettools.smacker` - * Add `video/vp8` - * Add extension `.3gpp` to `audio/3gpp` - -1.22.0 / 2016-02-15 -=================== - - * Add `application/ppsp-tracker+json` - * Add `application/problem+json` - * Add `application/problem+xml` - * Add `application/vnd.hdt` - * Add `application/vnd.ms-printschematicket+xml` - * Add `model/vnd.rosette.annotated-data-model` - * Add `text/slim` - * Add extension `.rng` to `application/xml` - * Fix extension of `application/dash+xml` to be `.mpd` - * Update primary extension to `.m4a` for `audio/mp4` - -1.21.0 / 2016-01-06 -=================== - - * Add `application/emergencycalldata.comment+xml` - * Add `application/emergencycalldata.deviceinfo+xml` - * Add `application/emergencycalldata.providerinfo+xml` - * Add `application/emergencycalldata.serviceinfo+xml` - * Add `application/emergencycalldata.subscriberinfo+xml` - * Add `application/vnd.filmit.zfc` - * Add `application/vnd.google-apps.document` - * Add `application/vnd.google-apps.presentation` - * Add `application/vnd.google-apps.spreadsheet` - * Add `application/vnd.mapbox-vector-tile` - * Add `application/vnd.ms-printdevicecapabilities+xml` - * Add `application/vnd.ms-windows.devicepairing` - * Add `application/vnd.ms-windows.nwprinting.oob` - * Add `application/vnd.tml` - * Add `audio/evs` - -1.20.0 / 2015-11-10 -=================== - - * Add `application/cdni` - * Add `application/csvm+json` - * Add `application/rfc+xml` - * Add `application/vnd.3gpp.access-transfer-events+xml` - * Add `application/vnd.3gpp.srvcc-ext+xml` - * Add `application/vnd.ms-windows.wsd.oob` - * Add `application/vnd.oxli.countgraph` - * Add `application/vnd.pagerduty+json` - * Add `text/x-suse-ymp` - -1.19.0 / 2015-09-17 -=================== - - * Add `application/vnd.3gpp-prose-pc3ch+xml` - * Add `application/vnd.3gpp.srvcc-info+xml` - * Add `application/vnd.apple.pkpass` - * Add `application/vnd.drive+json` - -1.18.0 / 2015-09-03 -=================== - - * Add `application/pkcs12` - * Add `application/vnd.3gpp-prose+xml` - * Add `application/vnd.3gpp.mid-call+xml` - * Add `application/vnd.3gpp.state-and-event-info+xml` - * Add `application/vnd.anki` - * Add `application/vnd.firemonkeys.cloudcell` - * Add `application/vnd.openblox.game+xml` - * Add `application/vnd.openblox.game-binary` - -1.17.0 / 2015-08-13 -=================== - - * Add `application/x-msdos-program` - * Add `audio/g711-0` - * Add `image/vnd.mozilla.apng` - * Add extension `.exe` to `application/x-msdos-program` - -1.16.0 / 2015-07-29 -=================== - - * Add `application/vnd.uri-map` - -1.15.0 / 2015-07-13 -=================== - - * Add `application/x-httpd-php` - -1.14.0 / 2015-06-25 -=================== - - * Add `application/scim+json` - * Add `application/vnd.3gpp.ussd+xml` - * Add `application/vnd.biopax.rdf+xml` - * Add `text/x-processing` - -1.13.0 / 2015-06-07 -=================== - - * Add nginx as a source - * Add `application/x-cocoa` - * Add `application/x-java-archive-diff` - * Add `application/x-makeself` - * Add `application/x-perl` - * Add `application/x-pilot` - * Add `application/x-redhat-package-manager` - * Add `application/x-sea` - * Add `audio/x-m4a` - * Add `audio/x-realaudio` - * Add `image/x-jng` - * Add `text/mathml` - -1.12.0 / 2015-06-05 -=================== - - * Add `application/bdoc` - * Add `application/vnd.hyperdrive+json` - * Add `application/x-bdoc` - * Add extension `.rtf` to `text/rtf` - -1.11.0 / 2015-05-31 -=================== - - * Add `audio/wav` - * Add `audio/wave` - * Add extension `.litcoffee` to `text/coffeescript` - * Add extension `.sfd-hdstx` to `application/vnd.hydrostatix.sof-data` - * Add extension `.n-gage` to `application/vnd.nokia.n-gage.symbian.install` - -1.10.0 / 2015-05-19 -=================== - - * Add `application/vnd.balsamiq.bmpr` - * Add `application/vnd.microsoft.portable-executable` - * Add `application/x-ns-proxy-autoconfig` - -1.9.1 / 2015-04-19 -================== - - * Remove `.json` extension from `application/manifest+json` - - This is causing bugs downstream - -1.9.0 / 2015-04-19 -================== - - * Add `application/manifest+json` - * Add `application/vnd.micro+json` - * Add `image/vnd.zbrush.pcx` - * Add `image/x-ms-bmp` - -1.8.0 / 2015-03-13 -================== - - * Add `application/vnd.citationstyles.style+xml` - * Add `application/vnd.fastcopy-disk-image` - * Add `application/vnd.gov.sk.xmldatacontainer+xml` - * Add extension `.jsonld` to `application/ld+json` - -1.7.0 / 2015-02-08 -================== - - * Add `application/vnd.gerber` - * Add `application/vnd.msa-disk-image` - -1.6.1 / 2015-02-05 -================== - - * Community extensions ownership transferred from `node-mime` - -1.6.0 / 2015-01-29 -================== - - * Add `application/jose` - * Add `application/jose+json` - * Add `application/json-seq` - * Add `application/jwk+json` - * Add `application/jwk-set+json` - * Add `application/jwt` - * Add `application/rdap+json` - * Add `application/vnd.gov.sk.e-form+xml` - * Add `application/vnd.ims.imsccv1p3` - -1.5.0 / 2014-12-30 -================== - - * Add `application/vnd.oracle.resource+json` - * Fix various invalid MIME type entries - - `application/mbox+xml` - - `application/oscp-response` - - `application/vwg-multiplexed` - - `audio/g721` - -1.4.0 / 2014-12-21 -================== - - * Add `application/vnd.ims.imsccv1p2` - * Fix various invalid MIME type entries - - `application/vnd-acucobol` - - `application/vnd-curl` - - `application/vnd-dart` - - `application/vnd-dxr` - - `application/vnd-fdf` - - `application/vnd-mif` - - `application/vnd-sema` - - `application/vnd-wap-wmlc` - - `application/vnd.adobe.flash-movie` - - `application/vnd.dece-zip` - - `application/vnd.dvb_service` - - `application/vnd.micrografx-igx` - - `application/vnd.sealed-doc` - - `application/vnd.sealed-eml` - - `application/vnd.sealed-mht` - - `application/vnd.sealed-ppt` - - `application/vnd.sealed-tiff` - - `application/vnd.sealed-xls` - - `application/vnd.sealedmedia.softseal-html` - - `application/vnd.sealedmedia.softseal-pdf` - - `application/vnd.wap-slc` - - `application/vnd.wap-wbxml` - - `audio/vnd.sealedmedia.softseal-mpeg` - - `image/vnd-djvu` - - `image/vnd-svf` - - `image/vnd-wap-wbmp` - - `image/vnd.sealed-png` - - `image/vnd.sealedmedia.softseal-gif` - - `image/vnd.sealedmedia.softseal-jpg` - - `model/vnd-dwf` - - `model/vnd.parasolid.transmit-binary` - - `model/vnd.parasolid.transmit-text` - - `text/vnd-a` - - `text/vnd-curl` - - `text/vnd.wap-wml` - * Remove example template MIME types - - `application/example` - - `audio/example` - - `image/example` - - `message/example` - - `model/example` - - `multipart/example` - - `text/example` - - `video/example` - -1.3.1 / 2014-12-16 -================== - - * Fix missing extensions - - `application/json5` - - `text/hjson` - -1.3.0 / 2014-12-07 -================== - - * Add `application/a2l` - * Add `application/aml` - * Add `application/atfx` - * Add `application/atxml` - * Add `application/cdfx+xml` - * Add `application/dii` - * Add `application/json5` - * Add `application/lxf` - * Add `application/mf4` - * Add `application/vnd.apache.thrift.compact` - * Add `application/vnd.apache.thrift.json` - * Add `application/vnd.coffeescript` - * Add `application/vnd.enphase.envoy` - * Add `application/vnd.ims.imsccv1p1` - * Add `text/csv-schema` - * Add `text/hjson` - * Add `text/markdown` - * Add `text/yaml` - -1.2.0 / 2014-11-09 -================== - - * Add `application/cea` - * Add `application/dit` - * Add `application/vnd.gov.sk.e-form+zip` - * Add `application/vnd.tmd.mediaflex.api+xml` - * Type `application/epub+zip` is now IANA-registered - -1.1.2 / 2014-10-23 -================== - - * Rebuild database for `application/x-www-form-urlencoded` change - -1.1.1 / 2014-10-20 -================== - - * Mark `application/x-www-form-urlencoded` as compressible. - -1.1.0 / 2014-09-28 -================== - - * Add `application/font-woff2` - -1.0.3 / 2014-09-25 -================== - - * Fix engine requirement in package - -1.0.2 / 2014-09-25 -================== - - * Add `application/coap-group+json` - * Add `application/dcd` - * Add `application/vnd.apache.thrift.binary` - * Add `image/vnd.tencent.tap` - * Mark all JSON-derived types as compressible - * Update `text/vtt` data - -1.0.1 / 2014-08-30 -================== - - * Fix extension ordering - -1.0.0 / 2014-08-30 -================== - - * Add `application/atf` - * Add `application/merge-patch+json` - * Add `multipart/x-mixed-replace` - * Add `source: 'apache'` metadata - * Add `source: 'iana'` metadata - * Remove badly-assumed charset data diff --git a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/LICENSE b/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/LICENSE deleted file mode 100644 index a7ae8ee9..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/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/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/README.md b/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/README.md deleted file mode 100644 index 7662440b..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/README.md +++ /dev/null @@ -1,82 +0,0 @@ -# mime-db - -[![NPM Version][npm-version-image]][npm-url] -[![NPM Downloads][npm-downloads-image]][npm-url] -[![Node.js Version][node-image]][node-url] -[![Build Status][travis-image]][travis-url] -[![Coverage Status][coveralls-image]][coveralls-url] - -This is a database of all mime types. -It consists of a single, public JSON file and does not include any logic, -allowing it to remain as un-opinionated as possible with an API. -It aggregates data from the following sources: - -- http://www.iana.org/assignments/media-types/media-types.xhtml -- http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types -- http://hg.nginx.org/nginx/raw-file/default/conf/mime.types - -## Installation - -```bash -npm install mime-db -``` - -### Database Download - -If you're crazy enough to use this in the browser, you can just grab the -JSON file using [RawGit](https://rawgit.com/). It is recommended to replace -`master` with [a release tag](https://github.com/jshttp/mime-db/tags) as the -JSON format may change in the future. - -``` -https://cdn.rawgit.com/jshttp/mime-db/master/db.json -``` - -## Usage - -```js -var db = require('mime-db'); - -// grab data on .js files -var data = db['application/javascript']; -``` - -## Data Structure - -The JSON file is a map lookup for lowercased mime types. -Each mime type has the following properties: - -- `.source` - where the mime type is defined. - If not set, it's probably a custom media type. - - `apache` - [Apache common media types](http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types) - - `iana` - [IANA-defined media types](http://www.iana.org/assignments/media-types/media-types.xhtml) - - `nginx` - [nginx media types](http://hg.nginx.org/nginx/raw-file/default/conf/mime.types) -- `.extensions[]` - known extensions associated with this mime type. -- `.compressible` - whether a file of this type can be gzipped. -- `.charset` - the default charset associated with this type, if any. - -If unknown, every property could be `undefined`. - -## Contributing - -To edit the database, only make PRs against `src/custom.json` or -`src/custom-suffix.json`. - -To update the build, run `npm run build`. - -## Adding Custom Media Types - -The best way to get new media types included in this library is to register -them with the IANA. The community registration procedure is outlined in -[RFC 6838 section 5](http://tools.ietf.org/html/rfc6838#section-5). Types -registered with the IANA are automatically pulled into this library. - -[npm-version-image]: https://img.shields.io/npm/v/mime-db.svg -[npm-downloads-image]: https://img.shields.io/npm/dm/mime-db.svg -[npm-url]: https://npmjs.org/package/mime-db -[travis-image]: https://img.shields.io/travis/jshttp/mime-db/master.svg -[travis-url]: https://travis-ci.org/jshttp/mime-db -[coveralls-image]: https://img.shields.io/coveralls/jshttp/mime-db/master.svg -[coveralls-url]: https://coveralls.io/r/jshttp/mime-db?branch=master -[node-image]: https://img.shields.io/node/v/mime-db.svg -[node-url]: http://nodejs.org/download/ diff --git a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json b/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json deleted file mode 100644 index 0a5a8a7b..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/db.json +++ /dev/null @@ -1,6627 +0,0 @@ -{ - "application/1d-interleaved-parityfec": { - "source": "iana" - }, - "application/3gpdash-qoe-report+xml": { - "source": "iana" - }, - "application/3gpp-ims+xml": { - "source": "iana" - }, - "application/a2l": { - "source": "iana" - }, - "application/activemessage": { - "source": "iana" - }, - "application/alto-costmap+json": { - "source": "iana", - "compressible": true - }, - "application/alto-costmapfilter+json": { - "source": "iana", - "compressible": true - }, - "application/alto-directory+json": { - "source": "iana", - "compressible": true - }, - "application/alto-endpointcost+json": { - "source": "iana", - "compressible": true - }, - "application/alto-endpointcostparams+json": { - "source": "iana", - "compressible": true - }, - "application/alto-endpointprop+json": { - "source": "iana", - "compressible": true - }, - "application/alto-endpointpropparams+json": { - "source": "iana", - "compressible": true - }, - "application/alto-error+json": { - "source": "iana", - "compressible": true - }, - "application/alto-networkmap+json": { - "source": "iana", - "compressible": true - }, - "application/alto-networkmapfilter+json": { - "source": "iana", - "compressible": true - }, - "application/aml": { - "source": "iana" - }, - "application/andrew-inset": { - "source": "iana", - "extensions": ["ez"] - }, - "application/applefile": { - "source": "iana" - }, - "application/applixware": { - "source": "apache", - "extensions": ["aw"] - }, - "application/atf": { - "source": "iana" - }, - "application/atfx": { - "source": "iana" - }, - "application/atom+xml": { - "source": "iana", - "compressible": true, - "extensions": ["atom"] - }, - "application/atomcat+xml": { - "source": "iana", - "extensions": ["atomcat"] - }, - "application/atomdeleted+xml": { - "source": "iana" - }, - "application/atomicmail": { - "source": "iana" - }, - "application/atomsvc+xml": { - "source": "iana", - "extensions": ["atomsvc"] - }, - "application/atxml": { - "source": "iana" - }, - "application/auth-policy+xml": { - "source": "iana" - }, - "application/bacnet-xdd+zip": { - "source": "iana" - }, - "application/batch-smtp": { - "source": "iana" - }, - "application/bdoc": { - "compressible": false, - "extensions": ["bdoc"] - }, - "application/beep+xml": { - "source": "iana" - }, - "application/calendar+json": { - "source": "iana", - "compressible": true - }, - "application/calendar+xml": { - "source": "iana" - }, - "application/call-completion": { - "source": "iana" - }, - "application/cals-1840": { - "source": "iana" - }, - "application/cbor": { - "source": "iana" - }, - "application/ccmp+xml": { - "source": "iana" - }, - "application/ccxml+xml": { - "source": "iana", - "extensions": ["ccxml"] - }, - "application/cdfx+xml": { - "source": "iana" - }, - "application/cdmi-capability": { - "source": "iana", - "extensions": ["cdmia"] - }, - "application/cdmi-container": { - "source": "iana", - "extensions": ["cdmic"] - }, - "application/cdmi-domain": { - "source": "iana", - "extensions": ["cdmid"] - }, - "application/cdmi-object": { - "source": "iana", - "extensions": ["cdmio"] - }, - "application/cdmi-queue": { - "source": "iana", - "extensions": ["cdmiq"] - }, - "application/cdni": { - "source": "iana" - }, - "application/cea": { - "source": "iana" - }, - "application/cea-2018+xml": { - "source": "iana" - }, - "application/cellml+xml": { - "source": "iana" - }, - "application/cfw": { - "source": "iana" - }, - "application/cms": { - "source": "iana" - }, - "application/cnrp+xml": { - "source": "iana" - }, - "application/coap-group+json": { - "source": "iana", - "compressible": true - }, - "application/commonground": { - "source": "iana" - }, - "application/conference-info+xml": { - "source": "iana" - }, - "application/cpl+xml": { - "source": "iana" - }, - "application/csrattrs": { - "source": "iana" - }, - "application/csta+xml": { - "source": "iana" - }, - "application/cstadata+xml": { - "source": "iana" - }, - "application/csvm+json": { - "source": "iana", - "compressible": true - }, - "application/cu-seeme": { - "source": "apache", - "extensions": ["cu"] - }, - "application/cybercash": { - "source": "iana" - }, - "application/dart": { - "compressible": true - }, - "application/dash+xml": { - "source": "iana", - "extensions": ["mpd"] - }, - "application/dashdelta": { - "source": "iana" - }, - "application/davmount+xml": { - "source": "iana", - "extensions": ["davmount"] - }, - "application/dca-rft": { - "source": "iana" - }, - "application/dcd": { - "source": "iana" - }, - "application/dec-dx": { - "source": "iana" - }, - "application/dialog-info+xml": { - "source": "iana" - }, - "application/dicom": { - "source": "iana" - }, - "application/dii": { - "source": "iana" - }, - "application/dit": { - "source": "iana" - }, - "application/dns": { - "source": "iana" - }, - "application/docbook+xml": { - "source": "apache", - "extensions": ["dbk"] - }, - "application/dskpp+xml": { - "source": "iana" - }, - "application/dssc+der": { - "source": "iana", - "extensions": ["dssc"] - }, - "application/dssc+xml": { - "source": "iana", - "extensions": ["xdssc"] - }, - "application/dvcs": { - "source": "iana" - }, - "application/ecmascript": { - "source": "iana", - "compressible": true, - "extensions": ["ecma"] - }, - "application/edi-consent": { - "source": "iana" - }, - "application/edi-x12": { - "source": "iana", - "compressible": false - }, - "application/edifact": { - "source": "iana", - "compressible": false - }, - "application/efi": { - "source": "iana" - }, - "application/emergencycalldata.comment+xml": { - "source": "iana" - }, - "application/emergencycalldata.deviceinfo+xml": { - "source": "iana" - }, - "application/emergencycalldata.providerinfo+xml": { - "source": "iana" - }, - "application/emergencycalldata.serviceinfo+xml": { - "source": "iana" - }, - "application/emergencycalldata.subscriberinfo+xml": { - "source": "iana" - }, - "application/emma+xml": { - "source": "iana", - "extensions": ["emma"] - }, - "application/emotionml+xml": { - "source": "iana" - }, - "application/encaprtp": { - "source": "iana" - }, - "application/epp+xml": { - "source": "iana" - }, - "application/epub+zip": { - "source": "iana", - "extensions": ["epub"] - }, - "application/eshop": { - "source": "iana" - }, - "application/exi": { - "source": "iana", - "extensions": ["exi"] - }, - "application/fastinfoset": { - "source": "iana" - }, - "application/fastsoap": { - "source": "iana" - }, - "application/fdt+xml": { - "source": "iana" - }, - "application/fits": { - "source": "iana" - }, - "application/font-sfnt": { - "source": "iana" - }, - "application/font-tdpfr": { - "source": "iana", - "extensions": ["pfr"] - }, - "application/font-woff": { - "source": "iana", - "compressible": false, - "extensions": ["woff"] - }, - "application/font-woff2": { - "compressible": false, - "extensions": ["woff2"] - }, - "application/framework-attributes+xml": { - "source": "iana" - }, - "application/gml+xml": { - "source": "apache", - "extensions": ["gml"] - }, - "application/gpx+xml": { - "source": "apache", - "extensions": ["gpx"] - }, - "application/gxf": { - "source": "apache", - "extensions": ["gxf"] - }, - "application/gzip": { - "source": "iana", - "compressible": false - }, - "application/h224": { - "source": "iana" - }, - "application/held+xml": { - "source": "iana" - }, - "application/http": { - "source": "iana" - }, - "application/hyperstudio": { - "source": "iana", - "extensions": ["stk"] - }, - "application/ibe-key-request+xml": { - "source": "iana" - }, - "application/ibe-pkg-reply+xml": { - "source": "iana" - }, - "application/ibe-pp-data": { - "source": "iana" - }, - "application/iges": { - "source": "iana" - }, - "application/im-iscomposing+xml": { - "source": "iana" - }, - "application/index": { - "source": "iana" - }, - "application/index.cmd": { - "source": "iana" - }, - "application/index.obj": { - "source": "iana" - }, - "application/index.response": { - "source": "iana" - }, - "application/index.vnd": { - "source": "iana" - }, - "application/inkml+xml": { - "source": "iana", - "extensions": ["ink","inkml"] - }, - "application/iotp": { - "source": "iana" - }, - "application/ipfix": { - "source": "iana", - "extensions": ["ipfix"] - }, - "application/ipp": { - "source": "iana" - }, - "application/isup": { - "source": "iana" - }, - "application/its+xml": { - "source": "iana" - }, - "application/java-archive": { - "source": "apache", - "compressible": false, - "extensions": ["jar","war","ear"] - }, - "application/java-serialized-object": { - "source": "apache", - "compressible": false, - "extensions": ["ser"] - }, - "application/java-vm": { - "source": "apache", - "compressible": false, - "extensions": ["class"] - }, - "application/javascript": { - "source": "iana", - "charset": "UTF-8", - "compressible": true, - "extensions": ["js"] - }, - "application/jose": { - "source": "iana" - }, - "application/jose+json": { - "source": "iana", - "compressible": true - }, - "application/jrd+json": { - "source": "iana", - "compressible": true - }, - "application/json": { - "source": "iana", - "charset": "UTF-8", - "compressible": true, - "extensions": ["json","map"] - }, - "application/json-patch+json": { - "source": "iana", - "compressible": true - }, - "application/json-seq": { - "source": "iana" - }, - "application/json5": { - "extensions": ["json5"] - }, - "application/jsonml+json": { - "source": "apache", - "compressible": true, - "extensions": ["jsonml"] - }, - "application/jwk+json": { - "source": "iana", - "compressible": true - }, - "application/jwk-set+json": { - "source": "iana", - "compressible": true - }, - "application/jwt": { - "source": "iana" - }, - "application/kpml-request+xml": { - "source": "iana" - }, - "application/kpml-response+xml": { - "source": "iana" - }, - "application/ld+json": { - "source": "iana", - "compressible": true, - "extensions": ["jsonld"] - }, - "application/link-format": { - "source": "iana" - }, - "application/load-control+xml": { - "source": "iana" - }, - "application/lost+xml": { - "source": "iana", - "extensions": ["lostxml"] - }, - "application/lostsync+xml": { - "source": "iana" - }, - "application/lxf": { - "source": "iana" - }, - "application/mac-binhex40": { - "source": "iana", - "extensions": ["hqx"] - }, - "application/mac-compactpro": { - "source": "apache", - "extensions": ["cpt"] - }, - "application/macwriteii": { - "source": "iana" - }, - "application/mads+xml": { - "source": "iana", - "extensions": ["mads"] - }, - "application/manifest+json": { - "charset": "UTF-8", - "compressible": true, - "extensions": ["webmanifest"] - }, - "application/marc": { - "source": "iana", - "extensions": ["mrc"] - }, - "application/marcxml+xml": { - "source": "iana", - "extensions": ["mrcx"] - }, - "application/mathematica": { - "source": "iana", - "extensions": ["ma","nb","mb"] - }, - "application/mathml+xml": { - "source": "iana", - "extensions": ["mathml"] - }, - "application/mathml-content+xml": { - "source": "iana" - }, - "application/mathml-presentation+xml": { - "source": "iana" - }, - "application/mbms-associated-procedure-description+xml": { - "source": "iana" - }, - "application/mbms-deregister+xml": { - "source": "iana" - }, - "application/mbms-envelope+xml": { - "source": "iana" - }, - "application/mbms-msk+xml": { - "source": "iana" - }, - "application/mbms-msk-response+xml": { - "source": "iana" - }, - "application/mbms-protection-description+xml": { - "source": "iana" - }, - "application/mbms-reception-report+xml": { - "source": "iana" - }, - "application/mbms-register+xml": { - "source": "iana" - }, - "application/mbms-register-response+xml": { - "source": "iana" - }, - "application/mbms-schedule+xml": { - "source": "iana" - }, - "application/mbms-user-service-description+xml": { - "source": "iana" - }, - "application/mbox": { - "source": "iana", - "extensions": ["mbox"] - }, - "application/media-policy-dataset+xml": { - "source": "iana" - }, - "application/media_control+xml": { - "source": "iana" - }, - "application/mediaservercontrol+xml": { - "source": "iana", - "extensions": ["mscml"] - }, - "application/merge-patch+json": { - "source": "iana", - "compressible": true - }, - "application/metalink+xml": { - "source": "apache", - "extensions": ["metalink"] - }, - "application/metalink4+xml": { - "source": "iana", - "extensions": ["meta4"] - }, - "application/mets+xml": { - "source": "iana", - "extensions": ["mets"] - }, - "application/mf4": { - "source": "iana" - }, - "application/mikey": { - "source": "iana" - }, - "application/mods+xml": { - "source": "iana", - "extensions": ["mods"] - }, - "application/moss-keys": { - "source": "iana" - }, - "application/moss-signature": { - "source": "iana" - }, - "application/mosskey-data": { - "source": "iana" - }, - "application/mosskey-request": { - "source": "iana" - }, - "application/mp21": { - "source": "iana", - "extensions": ["m21","mp21"] - }, - "application/mp4": { - "source": "iana", - "extensions": ["mp4s","m4p"] - }, - "application/mpeg4-generic": { - "source": "iana" - }, - "application/mpeg4-iod": { - "source": "iana" - }, - "application/mpeg4-iod-xmt": { - "source": "iana" - }, - "application/mrb-consumer+xml": { - "source": "iana" - }, - "application/mrb-publish+xml": { - "source": "iana" - }, - "application/msc-ivr+xml": { - "source": "iana" - }, - "application/msc-mixer+xml": { - "source": "iana" - }, - "application/msword": { - "source": "iana", - "compressible": false, - "extensions": ["doc","dot"] - }, - "application/mxf": { - "source": "iana", - "extensions": ["mxf"] - }, - "application/nasdata": { - "source": "iana" - }, - "application/news-checkgroups": { - "source": "iana" - }, - "application/news-groupinfo": { - "source": "iana" - }, - "application/news-transmission": { - "source": "iana" - }, - "application/nlsml+xml": { - "source": "iana" - }, - "application/nss": { - "source": "iana" - }, - "application/ocsp-request": { - "source": "iana" - }, - "application/ocsp-response": { - "source": "iana" - }, - "application/octet-stream": { - "source": "iana", - "compressible": false, - "extensions": ["bin","dms","lrf","mar","so","dist","distz","pkg","bpk","dump","elc","deploy","exe","dll","deb","dmg","iso","img","msi","msp","msm","buffer"] - }, - "application/oda": { - "source": "iana", - "extensions": ["oda"] - }, - "application/odx": { - "source": "iana" - }, - "application/oebps-package+xml": { - "source": "iana", - "extensions": ["opf"] - }, - "application/ogg": { - "source": "iana", - "compressible": false, - "extensions": ["ogx"] - }, - "application/omdoc+xml": { - "source": "apache", - "extensions": ["omdoc"] - }, - "application/onenote": { - "source": "apache", - "extensions": ["onetoc","onetoc2","onetmp","onepkg"] - }, - "application/oxps": { - "source": "iana", - "extensions": ["oxps"] - }, - "application/p2p-overlay+xml": { - "source": "iana" - }, - "application/parityfec": { - "source": "iana" - }, - "application/patch-ops-error+xml": { - "source": "iana", - "extensions": ["xer"] - }, - "application/pdf": { - "source": "iana", - "compressible": false, - "extensions": ["pdf"] - }, - "application/pdx": { - "source": "iana" - }, - "application/pgp-encrypted": { - "source": "iana", - "compressible": false, - "extensions": ["pgp"] - }, - "application/pgp-keys": { - "source": "iana" - }, - "application/pgp-signature": { - "source": "iana", - "extensions": ["asc","sig"] - }, - "application/pics-rules": { - "source": "apache", - "extensions": ["prf"] - }, - "application/pidf+xml": { - "source": "iana" - }, - "application/pidf-diff+xml": { - "source": "iana" - }, - "application/pkcs10": { - "source": "iana", - "extensions": ["p10"] - }, - "application/pkcs12": { - "source": "iana" - }, - "application/pkcs7-mime": { - "source": "iana", - "extensions": ["p7m","p7c"] - }, - "application/pkcs7-signature": { - "source": "iana", - "extensions": ["p7s"] - }, - "application/pkcs8": { - "source": "iana", - "extensions": ["p8"] - }, - "application/pkix-attr-cert": { - "source": "iana", - "extensions": ["ac"] - }, - "application/pkix-cert": { - "source": "iana", - "extensions": ["cer"] - }, - "application/pkix-crl": { - "source": "iana", - "extensions": ["crl"] - }, - "application/pkix-pkipath": { - "source": "iana", - "extensions": ["pkipath"] - }, - "application/pkixcmp": { - "source": "iana", - "extensions": ["pki"] - }, - "application/pls+xml": { - "source": "iana", - "extensions": ["pls"] - }, - "application/poc-settings+xml": { - "source": "iana" - }, - "application/postscript": { - "source": "iana", - "compressible": true, - "extensions": ["ai","eps","ps"] - }, - "application/ppsp-tracker+json": { - "source": "iana", - "compressible": true - }, - "application/problem+json": { - "source": "iana", - "compressible": true - }, - "application/problem+xml": { - "source": "iana" - }, - "application/provenance+xml": { - "source": "iana" - }, - "application/prs.alvestrand.titrax-sheet": { - "source": "iana" - }, - "application/prs.cww": { - "source": "iana", - "extensions": ["cww"] - }, - "application/prs.hpub+zip": { - "source": "iana" - }, - "application/prs.nprend": { - "source": "iana" - }, - "application/prs.plucker": { - "source": "iana" - }, - "application/prs.rdf-xml-crypt": { - "source": "iana" - }, - "application/prs.xsf+xml": { - "source": "iana" - }, - "application/pskc+xml": { - "source": "iana", - "extensions": ["pskcxml"] - }, - "application/qsig": { - "source": "iana" - }, - "application/raptorfec": { - "source": "iana" - }, - "application/rdap+json": { - "source": "iana", - "compressible": true - }, - "application/rdf+xml": { - "source": "iana", - "compressible": true, - "extensions": ["rdf"] - }, - "application/reginfo+xml": { - "source": "iana", - "extensions": ["rif"] - }, - "application/relax-ng-compact-syntax": { - "source": "iana", - "extensions": ["rnc"] - }, - "application/remote-printing": { - "source": "iana" - }, - "application/reputon+json": { - "source": "iana", - "compressible": true - }, - "application/resource-lists+xml": { - "source": "iana", - "extensions": ["rl"] - }, - "application/resource-lists-diff+xml": { - "source": "iana", - "extensions": ["rld"] - }, - "application/rfc+xml": { - "source": "iana" - }, - "application/riscos": { - "source": "iana" - }, - "application/rlmi+xml": { - "source": "iana" - }, - "application/rls-services+xml": { - "source": "iana", - "extensions": ["rs"] - }, - "application/rpki-ghostbusters": { - "source": "iana", - "extensions": ["gbr"] - }, - "application/rpki-manifest": { - "source": "iana", - "extensions": ["mft"] - }, - "application/rpki-roa": { - "source": "iana", - "extensions": ["roa"] - }, - "application/rpki-updown": { - "source": "iana" - }, - "application/rsd+xml": { - "source": "apache", - "extensions": ["rsd"] - }, - "application/rss+xml": { - "source": "apache", - "compressible": true, - "extensions": ["rss"] - }, - "application/rtf": { - "source": "iana", - "compressible": true, - "extensions": ["rtf"] - }, - "application/rtploopback": { - "source": "iana" - }, - "application/rtx": { - "source": "iana" - }, - "application/samlassertion+xml": { - "source": "iana" - }, - "application/samlmetadata+xml": { - "source": "iana" - }, - "application/sbml+xml": { - "source": "iana", - "extensions": ["sbml"] - }, - "application/scaip+xml": { - "source": "iana" - }, - "application/scim+json": { - "source": "iana", - "compressible": true - }, - "application/scvp-cv-request": { - "source": "iana", - "extensions": ["scq"] - }, - "application/scvp-cv-response": { - "source": "iana", - "extensions": ["scs"] - }, - "application/scvp-vp-request": { - "source": "iana", - "extensions": ["spq"] - }, - "application/scvp-vp-response": { - "source": "iana", - "extensions": ["spp"] - }, - "application/sdp": { - "source": "iana", - "extensions": ["sdp"] - }, - "application/sep+xml": { - "source": "iana" - }, - "application/sep-exi": { - "source": "iana" - }, - "application/session-info": { - "source": "iana" - }, - "application/set-payment": { - "source": "iana" - }, - "application/set-payment-initiation": { - "source": "iana", - "extensions": ["setpay"] - }, - "application/set-registration": { - "source": "iana" - }, - "application/set-registration-initiation": { - "source": "iana", - "extensions": ["setreg"] - }, - "application/sgml": { - "source": "iana" - }, - "application/sgml-open-catalog": { - "source": "iana" - }, - "application/shf+xml": { - "source": "iana", - "extensions": ["shf"] - }, - "application/sieve": { - "source": "iana" - }, - "application/simple-filter+xml": { - "source": "iana" - }, - "application/simple-message-summary": { - "source": "iana" - }, - "application/simplesymbolcontainer": { - "source": "iana" - }, - "application/slate": { - "source": "iana" - }, - "application/smil": { - "source": "iana" - }, - "application/smil+xml": { - "source": "iana", - "extensions": ["smi","smil"] - }, - "application/smpte336m": { - "source": "iana" - }, - "application/soap+fastinfoset": { - "source": "iana" - }, - "application/soap+xml": { - "source": "iana", - "compressible": true - }, - "application/sparql-query": { - "source": "iana", - "extensions": ["rq"] - }, - "application/sparql-results+xml": { - "source": "iana", - "extensions": ["srx"] - }, - "application/spirits-event+xml": { - "source": "iana" - }, - "application/sql": { - "source": "iana" - }, - "application/srgs": { - "source": "iana", - "extensions": ["gram"] - }, - "application/srgs+xml": { - "source": "iana", - "extensions": ["grxml"] - }, - "application/sru+xml": { - "source": "iana", - "extensions": ["sru"] - }, - "application/ssdl+xml": { - "source": "apache", - "extensions": ["ssdl"] - }, - "application/ssml+xml": { - "source": "iana", - "extensions": ["ssml"] - }, - "application/tamp-apex-update": { - "source": "iana" - }, - "application/tamp-apex-update-confirm": { - "source": "iana" - }, - "application/tamp-community-update": { - "source": "iana" - }, - "application/tamp-community-update-confirm": { - "source": "iana" - }, - "application/tamp-error": { - "source": "iana" - }, - "application/tamp-sequence-adjust": { - "source": "iana" - }, - "application/tamp-sequence-adjust-confirm": { - "source": "iana" - }, - "application/tamp-status-query": { - "source": "iana" - }, - "application/tamp-status-response": { - "source": "iana" - }, - "application/tamp-update": { - "source": "iana" - }, - "application/tamp-update-confirm": { - "source": "iana" - }, - "application/tar": { - "compressible": true - }, - "application/tei+xml": { - "source": "iana", - "extensions": ["tei","teicorpus"] - }, - "application/thraud+xml": { - "source": "iana", - "extensions": ["tfi"] - }, - "application/timestamp-query": { - "source": "iana" - }, - "application/timestamp-reply": { - "source": "iana" - }, - "application/timestamped-data": { - "source": "iana", - "extensions": ["tsd"] - }, - "application/ttml+xml": { - "source": "iana" - }, - "application/tve-trigger": { - "source": "iana" - }, - "application/ulpfec": { - "source": "iana" - }, - "application/urc-grpsheet+xml": { - "source": "iana" - }, - "application/urc-ressheet+xml": { - "source": "iana" - }, - "application/urc-targetdesc+xml": { - "source": "iana" - }, - "application/urc-uisocketdesc+xml": { - "source": "iana" - }, - "application/vcard+json": { - "source": "iana", - "compressible": true - }, - "application/vcard+xml": { - "source": "iana" - }, - "application/vemmi": { - "source": "iana" - }, - "application/vividence.scriptfile": { - "source": "apache" - }, - "application/vnd.3gpp-prose+xml": { - "source": "iana" - }, - "application/vnd.3gpp-prose-pc3ch+xml": { - "source": "iana" - }, - "application/vnd.3gpp.access-transfer-events+xml": { - "source": "iana" - }, - "application/vnd.3gpp.bsf+xml": { - "source": "iana" - }, - "application/vnd.3gpp.mid-call+xml": { - "source": "iana" - }, - "application/vnd.3gpp.pic-bw-large": { - "source": "iana", - "extensions": ["plb"] - }, - "application/vnd.3gpp.pic-bw-small": { - "source": "iana", - "extensions": ["psb"] - }, - "application/vnd.3gpp.pic-bw-var": { - "source": "iana", - "extensions": ["pvb"] - }, - "application/vnd.3gpp.sms": { - "source": "iana" - }, - "application/vnd.3gpp.sms+xml": { - "source": "iana" - }, - "application/vnd.3gpp.srvcc-ext+xml": { - "source": "iana" - }, - "application/vnd.3gpp.srvcc-info+xml": { - "source": "iana" - }, - "application/vnd.3gpp.state-and-event-info+xml": { - "source": "iana" - }, - "application/vnd.3gpp.ussd+xml": { - "source": "iana" - }, - "application/vnd.3gpp2.bcmcsinfo+xml": { - "source": "iana" - }, - "application/vnd.3gpp2.sms": { - "source": "iana" - }, - "application/vnd.3gpp2.tcap": { - "source": "iana", - "extensions": ["tcap"] - }, - "application/vnd.3lightssoftware.imagescal": { - "source": "iana" - }, - "application/vnd.3m.post-it-notes": { - "source": "iana", - "extensions": ["pwn"] - }, - "application/vnd.accpac.simply.aso": { - "source": "iana", - "extensions": ["aso"] - }, - "application/vnd.accpac.simply.imp": { - "source": "iana", - "extensions": ["imp"] - }, - "application/vnd.acucobol": { - "source": "iana", - "extensions": ["acu"] - }, - "application/vnd.acucorp": { - "source": "iana", - "extensions": ["atc","acutc"] - }, - "application/vnd.adobe.air-application-installer-package+zip": { - "source": "apache", - "extensions": ["air"] - }, - "application/vnd.adobe.flash.movie": { - "source": "iana" - }, - "application/vnd.adobe.formscentral.fcdt": { - "source": "iana", - "extensions": ["fcdt"] - }, - "application/vnd.adobe.fxp": { - "source": "iana", - "extensions": ["fxp","fxpl"] - }, - "application/vnd.adobe.partial-upload": { - "source": "iana" - }, - "application/vnd.adobe.xdp+xml": { - "source": "iana", - "extensions": ["xdp"] - }, - "application/vnd.adobe.xfdf": { - "source": "iana", - "extensions": ["xfdf"] - }, - "application/vnd.aether.imp": { - "source": "iana" - }, - "application/vnd.ah-barcode": { - "source": "iana" - }, - "application/vnd.ahead.space": { - "source": "iana", - "extensions": ["ahead"] - }, - "application/vnd.airzip.filesecure.azf": { - "source": "iana", - "extensions": ["azf"] - }, - "application/vnd.airzip.filesecure.azs": { - "source": "iana", - "extensions": ["azs"] - }, - "application/vnd.amazon.ebook": { - "source": "apache", - "extensions": ["azw"] - }, - "application/vnd.americandynamics.acc": { - "source": "iana", - "extensions": ["acc"] - }, - "application/vnd.amiga.ami": { - "source": "iana", - "extensions": ["ami"] - }, - "application/vnd.amundsen.maze+xml": { - "source": "iana" - }, - "application/vnd.android.package-archive": { - "source": "apache", - "compressible": false, - "extensions": ["apk"] - }, - "application/vnd.anki": { - "source": "iana" - }, - "application/vnd.anser-web-certificate-issue-initiation": { - "source": "iana", - "extensions": ["cii"] - }, - "application/vnd.anser-web-funds-transfer-initiation": { - "source": "apache", - "extensions": ["fti"] - }, - "application/vnd.antix.game-component": { - "source": "iana", - "extensions": ["atx"] - }, - "application/vnd.apache.thrift.binary": { - "source": "iana" - }, - "application/vnd.apache.thrift.compact": { - "source": "iana" - }, - "application/vnd.apache.thrift.json": { - "source": "iana" - }, - "application/vnd.api+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.apple.installer+xml": { - "source": "iana", - "extensions": ["mpkg"] - }, - "application/vnd.apple.mpegurl": { - "source": "iana", - "extensions": ["m3u8"] - }, - "application/vnd.apple.pkpass": { - "compressible": false, - "extensions": ["pkpass"] - }, - "application/vnd.arastra.swi": { - "source": "iana" - }, - "application/vnd.aristanetworks.swi": { - "source": "iana", - "extensions": ["swi"] - }, - "application/vnd.artsquare": { - "source": "iana" - }, - "application/vnd.astraea-software.iota": { - "source": "iana", - "extensions": ["iota"] - }, - "application/vnd.audiograph": { - "source": "iana", - "extensions": ["aep"] - }, - "application/vnd.autopackage": { - "source": "iana" - }, - "application/vnd.avistar+xml": { - "source": "iana" - }, - "application/vnd.balsamiq.bmml+xml": { - "source": "iana" - }, - "application/vnd.balsamiq.bmpr": { - "source": "iana" - }, - "application/vnd.bekitzur-stech+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.biopax.rdf+xml": { - "source": "iana" - }, - "application/vnd.blueice.multipass": { - "source": "iana", - "extensions": ["mpm"] - }, - "application/vnd.bluetooth.ep.oob": { - "source": "iana" - }, - "application/vnd.bluetooth.le.oob": { - "source": "iana" - }, - "application/vnd.bmi": { - "source": "iana", - "extensions": ["bmi"] - }, - "application/vnd.businessobjects": { - "source": "iana", - "extensions": ["rep"] - }, - "application/vnd.cab-jscript": { - "source": "iana" - }, - "application/vnd.canon-cpdl": { - "source": "iana" - }, - "application/vnd.canon-lips": { - "source": "iana" - }, - "application/vnd.cendio.thinlinc.clientconf": { - "source": "iana" - }, - "application/vnd.century-systems.tcp_stream": { - "source": "iana" - }, - "application/vnd.chemdraw+xml": { - "source": "iana", - "extensions": ["cdxml"] - }, - "application/vnd.chipnuts.karaoke-mmd": { - "source": "iana", - "extensions": ["mmd"] - }, - "application/vnd.cinderella": { - "source": "iana", - "extensions": ["cdy"] - }, - "application/vnd.cirpack.isdn-ext": { - "source": "iana" - }, - "application/vnd.citationstyles.style+xml": { - "source": "iana" - }, - "application/vnd.claymore": { - "source": "iana", - "extensions": ["cla"] - }, - "application/vnd.cloanto.rp9": { - "source": "iana", - "extensions": ["rp9"] - }, - "application/vnd.clonk.c4group": { - "source": "iana", - "extensions": ["c4g","c4d","c4f","c4p","c4u"] - }, - "application/vnd.cluetrust.cartomobile-config": { - "source": "iana", - "extensions": ["c11amc"] - }, - "application/vnd.cluetrust.cartomobile-config-pkg": { - "source": "iana", - "extensions": ["c11amz"] - }, - "application/vnd.coffeescript": { - "source": "iana" - }, - "application/vnd.collection+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.collection.doc+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.collection.next+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.commerce-battelle": { - "source": "iana" - }, - "application/vnd.commonspace": { - "source": "iana", - "extensions": ["csp"] - }, - "application/vnd.contact.cmsg": { - "source": "iana", - "extensions": ["cdbcmsg"] - }, - "application/vnd.coreos.ignition+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.cosmocaller": { - "source": "iana", - "extensions": ["cmc"] - }, - "application/vnd.crick.clicker": { - "source": "iana", - "extensions": ["clkx"] - }, - "application/vnd.crick.clicker.keyboard": { - "source": "iana", - "extensions": ["clkk"] - }, - "application/vnd.crick.clicker.palette": { - "source": "iana", - "extensions": ["clkp"] - }, - "application/vnd.crick.clicker.template": { - "source": "iana", - "extensions": ["clkt"] - }, - "application/vnd.crick.clicker.wordbank": { - "source": "iana", - "extensions": ["clkw"] - }, - "application/vnd.criticaltools.wbs+xml": { - "source": "iana", - "extensions": ["wbs"] - }, - "application/vnd.ctc-posml": { - "source": "iana", - "extensions": ["pml"] - }, - "application/vnd.ctct.ws+xml": { - "source": "iana" - }, - "application/vnd.cups-pdf": { - "source": "iana" - }, - "application/vnd.cups-postscript": { - "source": "iana" - }, - "application/vnd.cups-ppd": { - "source": "iana", - "extensions": ["ppd"] - }, - "application/vnd.cups-raster": { - "source": "iana" - }, - "application/vnd.cups-raw": { - "source": "iana" - }, - "application/vnd.curl": { - "source": "iana" - }, - "application/vnd.curl.car": { - "source": "apache", - "extensions": ["car"] - }, - "application/vnd.curl.pcurl": { - "source": "apache", - "extensions": ["pcurl"] - }, - "application/vnd.cyan.dean.root+xml": { - "source": "iana" - }, - "application/vnd.cybank": { - "source": "iana" - }, - "application/vnd.dart": { - "source": "iana", - "compressible": true, - "extensions": ["dart"] - }, - "application/vnd.data-vision.rdz": { - "source": "iana", - "extensions": ["rdz"] - }, - "application/vnd.debian.binary-package": { - "source": "iana" - }, - "application/vnd.dece.data": { - "source": "iana", - "extensions": ["uvf","uvvf","uvd","uvvd"] - }, - "application/vnd.dece.ttml+xml": { - "source": "iana", - "extensions": ["uvt","uvvt"] - }, - "application/vnd.dece.unspecified": { - "source": "iana", - "extensions": ["uvx","uvvx"] - }, - "application/vnd.dece.zip": { - "source": "iana", - "extensions": ["uvz","uvvz"] - }, - "application/vnd.denovo.fcselayout-link": { - "source": "iana", - "extensions": ["fe_launch"] - }, - "application/vnd.desmume-movie": { - "source": "iana" - }, - "application/vnd.desmume.movie": { - "source": "apache" - }, - "application/vnd.dir-bi.plate-dl-nosuffix": { - "source": "iana" - }, - "application/vnd.dm.delegation+xml": { - "source": "iana" - }, - "application/vnd.dna": { - "source": "iana", - "extensions": ["dna"] - }, - "application/vnd.document+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.dolby.mlp": { - "source": "apache", - "extensions": ["mlp"] - }, - "application/vnd.dolby.mobile.1": { - "source": "iana" - }, - "application/vnd.dolby.mobile.2": { - "source": "iana" - }, - "application/vnd.doremir.scorecloud-binary-document": { - "source": "iana" - }, - "application/vnd.dpgraph": { - "source": "iana", - "extensions": ["dpg"] - }, - "application/vnd.dreamfactory": { - "source": "iana", - "extensions": ["dfac"] - }, - "application/vnd.drive+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.ds-keypoint": { - "source": "apache", - "extensions": ["kpxx"] - }, - "application/vnd.dtg.local": { - "source": "iana" - }, - "application/vnd.dtg.local.flash": { - "source": "iana" - }, - "application/vnd.dtg.local.html": { - "source": "iana" - }, - "application/vnd.dvb.ait": { - "source": "iana", - "extensions": ["ait"] - }, - "application/vnd.dvb.dvbj": { - "source": "iana" - }, - "application/vnd.dvb.esgcontainer": { - "source": "iana" - }, - "application/vnd.dvb.ipdcdftnotifaccess": { - "source": "iana" - }, - "application/vnd.dvb.ipdcesgaccess": { - "source": "iana" - }, - "application/vnd.dvb.ipdcesgaccess2": { - "source": "iana" - }, - "application/vnd.dvb.ipdcesgpdd": { - "source": "iana" - }, - "application/vnd.dvb.ipdcroaming": { - "source": "iana" - }, - "application/vnd.dvb.iptv.alfec-base": { - "source": "iana" - }, - "application/vnd.dvb.iptv.alfec-enhancement": { - "source": "iana" - }, - "application/vnd.dvb.notif-aggregate-root+xml": { - "source": "iana" - }, - "application/vnd.dvb.notif-container+xml": { - "source": "iana" - }, - "application/vnd.dvb.notif-generic+xml": { - "source": "iana" - }, - "application/vnd.dvb.notif-ia-msglist+xml": { - "source": "iana" - }, - "application/vnd.dvb.notif-ia-registration-request+xml": { - "source": "iana" - }, - "application/vnd.dvb.notif-ia-registration-response+xml": { - "source": "iana" - }, - "application/vnd.dvb.notif-init+xml": { - "source": "iana" - }, - "application/vnd.dvb.pfr": { - "source": "iana" - }, - "application/vnd.dvb.service": { - "source": "iana", - "extensions": ["svc"] - }, - "application/vnd.dxr": { - "source": "iana" - }, - "application/vnd.dynageo": { - "source": "iana", - "extensions": ["geo"] - }, - "application/vnd.dzr": { - "source": "iana" - }, - "application/vnd.easykaraoke.cdgdownload": { - "source": "iana" - }, - "application/vnd.ecdis-update": { - "source": "iana" - }, - "application/vnd.ecowin.chart": { - "source": "iana", - "extensions": ["mag"] - }, - "application/vnd.ecowin.filerequest": { - "source": "iana" - }, - "application/vnd.ecowin.fileupdate": { - "source": "iana" - }, - "application/vnd.ecowin.series": { - "source": "iana" - }, - "application/vnd.ecowin.seriesrequest": { - "source": "iana" - }, - "application/vnd.ecowin.seriesupdate": { - "source": "iana" - }, - "application/vnd.emclient.accessrequest+xml": { - "source": "iana" - }, - "application/vnd.enliven": { - "source": "iana", - "extensions": ["nml"] - }, - "application/vnd.enphase.envoy": { - "source": "iana" - }, - "application/vnd.eprints.data+xml": { - "source": "iana" - }, - "application/vnd.epson.esf": { - "source": "iana", - "extensions": ["esf"] - }, - "application/vnd.epson.msf": { - "source": "iana", - "extensions": ["msf"] - }, - "application/vnd.epson.quickanime": { - "source": "iana", - "extensions": ["qam"] - }, - "application/vnd.epson.salt": { - "source": "iana", - "extensions": ["slt"] - }, - "application/vnd.epson.ssf": { - "source": "iana", - "extensions": ["ssf"] - }, - "application/vnd.ericsson.quickcall": { - "source": "iana" - }, - "application/vnd.eszigno3+xml": { - "source": "iana", - "extensions": ["es3","et3"] - }, - "application/vnd.etsi.aoc+xml": { - "source": "iana" - }, - "application/vnd.etsi.asic-e+zip": { - "source": "iana" - }, - "application/vnd.etsi.asic-s+zip": { - "source": "iana" - }, - "application/vnd.etsi.cug+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvcommand+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvdiscovery+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvprofile+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvsad-bc+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvsad-cod+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvsad-npvr+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvservice+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvsync+xml": { - "source": "iana" - }, - "application/vnd.etsi.iptvueprofile+xml": { - "source": "iana" - }, - "application/vnd.etsi.mcid+xml": { - "source": "iana" - }, - "application/vnd.etsi.mheg5": { - "source": "iana" - }, - "application/vnd.etsi.overload-control-policy-dataset+xml": { - "source": "iana" - }, - "application/vnd.etsi.pstn+xml": { - "source": "iana" - }, - "application/vnd.etsi.sci+xml": { - "source": "iana" - }, - "application/vnd.etsi.simservs+xml": { - "source": "iana" - }, - "application/vnd.etsi.timestamp-token": { - "source": "iana" - }, - "application/vnd.etsi.tsl+xml": { - "source": "iana" - }, - "application/vnd.etsi.tsl.der": { - "source": "iana" - }, - "application/vnd.eudora.data": { - "source": "iana" - }, - "application/vnd.ezpix-album": { - "source": "iana", - "extensions": ["ez2"] - }, - "application/vnd.ezpix-package": { - "source": "iana", - "extensions": ["ez3"] - }, - "application/vnd.f-secure.mobile": { - "source": "iana" - }, - "application/vnd.fastcopy-disk-image": { - "source": "iana" - }, - "application/vnd.fdf": { - "source": "iana", - "extensions": ["fdf"] - }, - "application/vnd.fdsn.mseed": { - "source": "iana", - "extensions": ["mseed"] - }, - "application/vnd.fdsn.seed": { - "source": "iana", - "extensions": ["seed","dataless"] - }, - "application/vnd.ffsns": { - "source": "iana" - }, - "application/vnd.filmit.zfc": { - "source": "iana" - }, - "application/vnd.fints": { - "source": "iana" - }, - "application/vnd.firemonkeys.cloudcell": { - "source": "iana" - }, - "application/vnd.flographit": { - "source": "iana", - "extensions": ["gph"] - }, - "application/vnd.fluxtime.clip": { - "source": "iana", - "extensions": ["ftc"] - }, - "application/vnd.font-fontforge-sfd": { - "source": "iana" - }, - "application/vnd.framemaker": { - "source": "iana", - "extensions": ["fm","frame","maker","book"] - }, - "application/vnd.frogans.fnc": { - "source": "iana", - "extensions": ["fnc"] - }, - "application/vnd.frogans.ltf": { - "source": "iana", - "extensions": ["ltf"] - }, - "application/vnd.fsc.weblaunch": { - "source": "iana", - "extensions": ["fsc"] - }, - "application/vnd.fujitsu.oasys": { - "source": "iana", - "extensions": ["oas"] - }, - "application/vnd.fujitsu.oasys2": { - "source": "iana", - "extensions": ["oa2"] - }, - "application/vnd.fujitsu.oasys3": { - "source": "iana", - "extensions": ["oa3"] - }, - "application/vnd.fujitsu.oasysgp": { - "source": "iana", - "extensions": ["fg5"] - }, - "application/vnd.fujitsu.oasysprs": { - "source": "iana", - "extensions": ["bh2"] - }, - "application/vnd.fujixerox.art-ex": { - "source": "iana" - }, - "application/vnd.fujixerox.art4": { - "source": "iana" - }, - "application/vnd.fujixerox.ddd": { - "source": "iana", - "extensions": ["ddd"] - }, - "application/vnd.fujixerox.docuworks": { - "source": "iana", - "extensions": ["xdw"] - }, - "application/vnd.fujixerox.docuworks.binder": { - "source": "iana", - "extensions": ["xbd"] - }, - "application/vnd.fujixerox.docuworks.container": { - "source": "iana" - }, - "application/vnd.fujixerox.hbpl": { - "source": "iana" - }, - "application/vnd.fut-misnet": { - "source": "iana" - }, - "application/vnd.fuzzysheet": { - "source": "iana", - "extensions": ["fzs"] - }, - "application/vnd.genomatix.tuxedo": { - "source": "iana", - "extensions": ["txd"] - }, - "application/vnd.geo+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.geocube+xml": { - "source": "iana" - }, - "application/vnd.geogebra.file": { - "source": "iana", - "extensions": ["ggb"] - }, - "application/vnd.geogebra.tool": { - "source": "iana", - "extensions": ["ggt"] - }, - "application/vnd.geometry-explorer": { - "source": "iana", - "extensions": ["gex","gre"] - }, - "application/vnd.geonext": { - "source": "iana", - "extensions": ["gxt"] - }, - "application/vnd.geoplan": { - "source": "iana", - "extensions": ["g2w"] - }, - "application/vnd.geospace": { - "source": "iana", - "extensions": ["g3w"] - }, - "application/vnd.gerber": { - "source": "iana" - }, - "application/vnd.globalplatform.card-content-mgt": { - "source": "iana" - }, - "application/vnd.globalplatform.card-content-mgt-response": { - "source": "iana" - }, - "application/vnd.gmx": { - "source": "iana", - "extensions": ["gmx"] - }, - "application/vnd.google-apps.document": { - "compressible": false, - "extensions": ["gdoc"] - }, - "application/vnd.google-apps.presentation": { - "compressible": false, - "extensions": ["gslides"] - }, - "application/vnd.google-apps.spreadsheet": { - "compressible": false, - "extensions": ["gsheet"] - }, - "application/vnd.google-earth.kml+xml": { - "source": "iana", - "compressible": true, - "extensions": ["kml"] - }, - "application/vnd.google-earth.kmz": { - "source": "iana", - "compressible": false, - "extensions": ["kmz"] - }, - "application/vnd.gov.sk.e-form+xml": { - "source": "iana" - }, - "application/vnd.gov.sk.e-form+zip": { - "source": "iana" - }, - "application/vnd.gov.sk.xmldatacontainer+xml": { - "source": "iana" - }, - "application/vnd.grafeq": { - "source": "iana", - "extensions": ["gqf","gqs"] - }, - "application/vnd.gridmp": { - "source": "iana" - }, - "application/vnd.groove-account": { - "source": "iana", - "extensions": ["gac"] - }, - "application/vnd.groove-help": { - "source": "iana", - "extensions": ["ghf"] - }, - "application/vnd.groove-identity-message": { - "source": "iana", - "extensions": ["gim"] - }, - "application/vnd.groove-injector": { - "source": "iana", - "extensions": ["grv"] - }, - "application/vnd.groove-tool-message": { - "source": "iana", - "extensions": ["gtm"] - }, - "application/vnd.groove-tool-template": { - "source": "iana", - "extensions": ["tpl"] - }, - "application/vnd.groove-vcard": { - "source": "iana", - "extensions": ["vcg"] - }, - "application/vnd.hal+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.hal+xml": { - "source": "iana", - "extensions": ["hal"] - }, - "application/vnd.handheld-entertainment+xml": { - "source": "iana", - "extensions": ["zmm"] - }, - "application/vnd.hbci": { - "source": "iana", - "extensions": ["hbci"] - }, - "application/vnd.hcl-bireports": { - "source": "iana" - }, - "application/vnd.hdt": { - "source": "iana" - }, - "application/vnd.heroku+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.hhe.lesson-player": { - "source": "iana", - "extensions": ["les"] - }, - "application/vnd.hp-hpgl": { - "source": "iana", - "extensions": ["hpgl"] - }, - "application/vnd.hp-hpid": { - "source": "iana", - "extensions": ["hpid"] - }, - "application/vnd.hp-hps": { - "source": "iana", - "extensions": ["hps"] - }, - "application/vnd.hp-jlyt": { - "source": "iana", - "extensions": ["jlt"] - }, - "application/vnd.hp-pcl": { - "source": "iana", - "extensions": ["pcl"] - }, - "application/vnd.hp-pclxl": { - "source": "iana", - "extensions": ["pclxl"] - }, - "application/vnd.httphone": { - "source": "iana" - }, - "application/vnd.hydrostatix.sof-data": { - "source": "iana", - "extensions": ["sfd-hdstx"] - }, - "application/vnd.hyperdrive+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.hzn-3d-crossword": { - "source": "iana" - }, - "application/vnd.ibm.afplinedata": { - "source": "iana" - }, - "application/vnd.ibm.electronic-media": { - "source": "iana" - }, - "application/vnd.ibm.minipay": { - "source": "iana", - "extensions": ["mpy"] - }, - "application/vnd.ibm.modcap": { - "source": "iana", - "extensions": ["afp","listafp","list3820"] - }, - "application/vnd.ibm.rights-management": { - "source": "iana", - "extensions": ["irm"] - }, - "application/vnd.ibm.secure-container": { - "source": "iana", - "extensions": ["sc"] - }, - "application/vnd.iccprofile": { - "source": "iana", - "extensions": ["icc","icm"] - }, - "application/vnd.ieee.1905": { - "source": "iana" - }, - "application/vnd.igloader": { - "source": "iana", - "extensions": ["igl"] - }, - "application/vnd.immervision-ivp": { - "source": "iana", - "extensions": ["ivp"] - }, - "application/vnd.immervision-ivu": { - "source": "iana", - "extensions": ["ivu"] - }, - "application/vnd.ims.imsccv1p1": { - "source": "iana" - }, - "application/vnd.ims.imsccv1p2": { - "source": "iana" - }, - "application/vnd.ims.imsccv1p3": { - "source": "iana" - }, - "application/vnd.ims.lis.v2.result+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.ims.lti.v2.toolconsumerprofile+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.ims.lti.v2.toolproxy+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.ims.lti.v2.toolproxy.id+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.ims.lti.v2.toolsettings+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.ims.lti.v2.toolsettings.simple+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.informedcontrol.rms+xml": { - "source": "iana" - }, - "application/vnd.informix-visionary": { - "source": "iana" - }, - "application/vnd.infotech.project": { - "source": "iana" - }, - "application/vnd.infotech.project+xml": { - "source": "iana" - }, - "application/vnd.innopath.wamp.notification": { - "source": "iana" - }, - "application/vnd.insors.igm": { - "source": "iana", - "extensions": ["igm"] - }, - "application/vnd.intercon.formnet": { - "source": "iana", - "extensions": ["xpw","xpx"] - }, - "application/vnd.intergeo": { - "source": "iana", - "extensions": ["i2g"] - }, - "application/vnd.intertrust.digibox": { - "source": "iana" - }, - "application/vnd.intertrust.nncp": { - "source": "iana" - }, - "application/vnd.intu.qbo": { - "source": "iana", - "extensions": ["qbo"] - }, - "application/vnd.intu.qfx": { - "source": "iana", - "extensions": ["qfx"] - }, - "application/vnd.iptc.g2.catalogitem+xml": { - "source": "iana" - }, - "application/vnd.iptc.g2.conceptitem+xml": { - "source": "iana" - }, - "application/vnd.iptc.g2.knowledgeitem+xml": { - "source": "iana" - }, - "application/vnd.iptc.g2.newsitem+xml": { - "source": "iana" - }, - "application/vnd.iptc.g2.newsmessage+xml": { - "source": "iana" - }, - "application/vnd.iptc.g2.packageitem+xml": { - "source": "iana" - }, - "application/vnd.iptc.g2.planningitem+xml": { - "source": "iana" - }, - "application/vnd.ipunplugged.rcprofile": { - "source": "iana", - "extensions": ["rcprofile"] - }, - "application/vnd.irepository.package+xml": { - "source": "iana", - "extensions": ["irp"] - }, - "application/vnd.is-xpr": { - "source": "iana", - "extensions": ["xpr"] - }, - "application/vnd.isac.fcs": { - "source": "iana", - "extensions": ["fcs"] - }, - "application/vnd.jam": { - "source": "iana", - "extensions": ["jam"] - }, - "application/vnd.japannet-directory-service": { - "source": "iana" - }, - "application/vnd.japannet-jpnstore-wakeup": { - "source": "iana" - }, - "application/vnd.japannet-payment-wakeup": { - "source": "iana" - }, - "application/vnd.japannet-registration": { - "source": "iana" - }, - "application/vnd.japannet-registration-wakeup": { - "source": "iana" - }, - "application/vnd.japannet-setstore-wakeup": { - "source": "iana" - }, - "application/vnd.japannet-verification": { - "source": "iana" - }, - "application/vnd.japannet-verification-wakeup": { - "source": "iana" - }, - "application/vnd.jcp.javame.midlet-rms": { - "source": "iana", - "extensions": ["rms"] - }, - "application/vnd.jisp": { - "source": "iana", - "extensions": ["jisp"] - }, - "application/vnd.joost.joda-archive": { - "source": "iana", - "extensions": ["joda"] - }, - "application/vnd.jsk.isdn-ngn": { - "source": "iana" - }, - "application/vnd.kahootz": { - "source": "iana", - "extensions": ["ktz","ktr"] - }, - "application/vnd.kde.karbon": { - "source": "iana", - "extensions": ["karbon"] - }, - "application/vnd.kde.kchart": { - "source": "iana", - "extensions": ["chrt"] - }, - "application/vnd.kde.kformula": { - "source": "iana", - "extensions": ["kfo"] - }, - "application/vnd.kde.kivio": { - "source": "iana", - "extensions": ["flw"] - }, - "application/vnd.kde.kontour": { - "source": "iana", - "extensions": ["kon"] - }, - "application/vnd.kde.kpresenter": { - "source": "iana", - "extensions": ["kpr","kpt"] - }, - "application/vnd.kde.kspread": { - "source": "iana", - "extensions": ["ksp"] - }, - "application/vnd.kde.kword": { - "source": "iana", - "extensions": ["kwd","kwt"] - }, - "application/vnd.kenameaapp": { - "source": "iana", - "extensions": ["htke"] - }, - "application/vnd.kidspiration": { - "source": "iana", - "extensions": ["kia"] - }, - "application/vnd.kinar": { - "source": "iana", - "extensions": ["kne","knp"] - }, - "application/vnd.koan": { - "source": "iana", - "extensions": ["skp","skd","skt","skm"] - }, - "application/vnd.kodak-descriptor": { - "source": "iana", - "extensions": ["sse"] - }, - "application/vnd.las.las+xml": { - "source": "iana", - "extensions": ["lasxml"] - }, - "application/vnd.liberty-request+xml": { - "source": "iana" - }, - "application/vnd.llamagraphics.life-balance.desktop": { - "source": "iana", - "extensions": ["lbd"] - }, - "application/vnd.llamagraphics.life-balance.exchange+xml": { - "source": "iana", - "extensions": ["lbe"] - }, - "application/vnd.lotus-1-2-3": { - "source": "iana", - "extensions": ["123"] - }, - "application/vnd.lotus-approach": { - "source": "iana", - "extensions": ["apr"] - }, - "application/vnd.lotus-freelance": { - "source": "iana", - "extensions": ["pre"] - }, - "application/vnd.lotus-notes": { - "source": "iana", - "extensions": ["nsf"] - }, - "application/vnd.lotus-organizer": { - "source": "iana", - "extensions": ["org"] - }, - "application/vnd.lotus-screencam": { - "source": "iana", - "extensions": ["scm"] - }, - "application/vnd.lotus-wordpro": { - "source": "iana", - "extensions": ["lwp"] - }, - "application/vnd.macports.portpkg": { - "source": "iana", - "extensions": ["portpkg"] - }, - "application/vnd.mapbox-vector-tile": { - "source": "iana" - }, - "application/vnd.marlin.drm.actiontoken+xml": { - "source": "iana" - }, - "application/vnd.marlin.drm.conftoken+xml": { - "source": "iana" - }, - "application/vnd.marlin.drm.license+xml": { - "source": "iana" - }, - "application/vnd.marlin.drm.mdcf": { - "source": "iana" - }, - "application/vnd.mason+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.maxmind.maxmind-db": { - "source": "iana" - }, - "application/vnd.mcd": { - "source": "iana", - "extensions": ["mcd"] - }, - "application/vnd.medcalcdata": { - "source": "iana", - "extensions": ["mc1"] - }, - "application/vnd.mediastation.cdkey": { - "source": "iana", - "extensions": ["cdkey"] - }, - "application/vnd.meridian-slingshot": { - "source": "iana" - }, - "application/vnd.mfer": { - "source": "iana", - "extensions": ["mwf"] - }, - "application/vnd.mfmp": { - "source": "iana", - "extensions": ["mfm"] - }, - "application/vnd.micro+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.micrografx.flo": { - "source": "iana", - "extensions": ["flo"] - }, - "application/vnd.micrografx.igx": { - "source": "iana", - "extensions": ["igx"] - }, - "application/vnd.microsoft.portable-executable": { - "source": "iana" - }, - "application/vnd.miele+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.mif": { - "source": "iana", - "extensions": ["mif"] - }, - "application/vnd.minisoft-hp3000-save": { - "source": "iana" - }, - "application/vnd.mitsubishi.misty-guard.trustweb": { - "source": "iana" - }, - "application/vnd.mobius.daf": { - "source": "iana", - "extensions": ["daf"] - }, - "application/vnd.mobius.dis": { - "source": "iana", - "extensions": ["dis"] - }, - "application/vnd.mobius.mbk": { - "source": "iana", - "extensions": ["mbk"] - }, - "application/vnd.mobius.mqy": { - "source": "iana", - "extensions": ["mqy"] - }, - "application/vnd.mobius.msl": { - "source": "iana", - "extensions": ["msl"] - }, - "application/vnd.mobius.plc": { - "source": "iana", - "extensions": ["plc"] - }, - "application/vnd.mobius.txf": { - "source": "iana", - "extensions": ["txf"] - }, - "application/vnd.mophun.application": { - "source": "iana", - "extensions": ["mpn"] - }, - "application/vnd.mophun.certificate": { - "source": "iana", - "extensions": ["mpc"] - }, - "application/vnd.motorola.flexsuite": { - "source": "iana" - }, - "application/vnd.motorola.flexsuite.adsi": { - "source": "iana" - }, - "application/vnd.motorola.flexsuite.fis": { - "source": "iana" - }, - "application/vnd.motorola.flexsuite.gotap": { - "source": "iana" - }, - "application/vnd.motorola.flexsuite.kmr": { - "source": "iana" - }, - "application/vnd.motorola.flexsuite.ttc": { - "source": "iana" - }, - "application/vnd.motorola.flexsuite.wem": { - "source": "iana" - }, - "application/vnd.motorola.iprm": { - "source": "iana" - }, - "application/vnd.mozilla.xul+xml": { - "source": "iana", - "compressible": true, - "extensions": ["xul"] - }, - "application/vnd.ms-3mfdocument": { - "source": "iana" - }, - "application/vnd.ms-artgalry": { - "source": "iana", - "extensions": ["cil"] - }, - "application/vnd.ms-asf": { - "source": "iana" - }, - "application/vnd.ms-cab-compressed": { - "source": "iana", - "extensions": ["cab"] - }, - "application/vnd.ms-color.iccprofile": { - "source": "apache" - }, - "application/vnd.ms-excel": { - "source": "iana", - "compressible": false, - "extensions": ["xls","xlm","xla","xlc","xlt","xlw"] - }, - "application/vnd.ms-excel.addin.macroenabled.12": { - "source": "iana", - "extensions": ["xlam"] - }, - "application/vnd.ms-excel.sheet.binary.macroenabled.12": { - "source": "iana", - "extensions": ["xlsb"] - }, - "application/vnd.ms-excel.sheet.macroenabled.12": { - "source": "iana", - "extensions": ["xlsm"] - }, - "application/vnd.ms-excel.template.macroenabled.12": { - "source": "iana", - "extensions": ["xltm"] - }, - "application/vnd.ms-fontobject": { - "source": "iana", - "compressible": true, - "extensions": ["eot"] - }, - "application/vnd.ms-htmlhelp": { - "source": "iana", - "extensions": ["chm"] - }, - "application/vnd.ms-ims": { - "source": "iana", - "extensions": ["ims"] - }, - "application/vnd.ms-lrm": { - "source": "iana", - "extensions": ["lrm"] - }, - "application/vnd.ms-office.activex+xml": { - "source": "iana" - }, - "application/vnd.ms-officetheme": { - "source": "iana", - "extensions": ["thmx"] - }, - "application/vnd.ms-opentype": { - "source": "apache", - "compressible": true - }, - "application/vnd.ms-package.obfuscated-opentype": { - "source": "apache" - }, - "application/vnd.ms-pki.seccat": { - "source": "apache", - "extensions": ["cat"] - }, - "application/vnd.ms-pki.stl": { - "source": "apache", - "extensions": ["stl"] - }, - "application/vnd.ms-playready.initiator+xml": { - "source": "iana" - }, - "application/vnd.ms-powerpoint": { - "source": "iana", - "compressible": false, - "extensions": ["ppt","pps","pot"] - }, - "application/vnd.ms-powerpoint.addin.macroenabled.12": { - "source": "iana", - "extensions": ["ppam"] - }, - "application/vnd.ms-powerpoint.presentation.macroenabled.12": { - "source": "iana", - "extensions": ["pptm"] - }, - "application/vnd.ms-powerpoint.slide.macroenabled.12": { - "source": "iana", - "extensions": ["sldm"] - }, - "application/vnd.ms-powerpoint.slideshow.macroenabled.12": { - "source": "iana", - "extensions": ["ppsm"] - }, - "application/vnd.ms-powerpoint.template.macroenabled.12": { - "source": "iana", - "extensions": ["potm"] - }, - "application/vnd.ms-printdevicecapabilities+xml": { - "source": "iana" - }, - "application/vnd.ms-printing.printticket+xml": { - "source": "apache" - }, - "application/vnd.ms-printschematicket+xml": { - "source": "iana" - }, - "application/vnd.ms-project": { - "source": "iana", - "extensions": ["mpp","mpt"] - }, - "application/vnd.ms-tnef": { - "source": "iana" - }, - "application/vnd.ms-windows.devicepairing": { - "source": "iana" - }, - "application/vnd.ms-windows.nwprinting.oob": { - "source": "iana" - }, - "application/vnd.ms-windows.printerpairing": { - "source": "iana" - }, - "application/vnd.ms-windows.wsd.oob": { - "source": "iana" - }, - "application/vnd.ms-wmdrm.lic-chlg-req": { - "source": "iana" - }, - "application/vnd.ms-wmdrm.lic-resp": { - "source": "iana" - }, - "application/vnd.ms-wmdrm.meter-chlg-req": { - "source": "iana" - }, - "application/vnd.ms-wmdrm.meter-resp": { - "source": "iana" - }, - "application/vnd.ms-word.document.macroenabled.12": { - "source": "iana", - "extensions": ["docm"] - }, - "application/vnd.ms-word.template.macroenabled.12": { - "source": "iana", - "extensions": ["dotm"] - }, - "application/vnd.ms-works": { - "source": "iana", - "extensions": ["wps","wks","wcm","wdb"] - }, - "application/vnd.ms-wpl": { - "source": "iana", - "extensions": ["wpl"] - }, - "application/vnd.ms-xpsdocument": { - "source": "iana", - "compressible": false, - "extensions": ["xps"] - }, - "application/vnd.msa-disk-image": { - "source": "iana" - }, - "application/vnd.mseq": { - "source": "iana", - "extensions": ["mseq"] - }, - "application/vnd.msign": { - "source": "iana" - }, - "application/vnd.multiad.creator": { - "source": "iana" - }, - "application/vnd.multiad.creator.cif": { - "source": "iana" - }, - "application/vnd.music-niff": { - "source": "iana" - }, - "application/vnd.musician": { - "source": "iana", - "extensions": ["mus"] - }, - "application/vnd.muvee.style": { - "source": "iana", - "extensions": ["msty"] - }, - "application/vnd.mynfc": { - "source": "iana", - "extensions": ["taglet"] - }, - "application/vnd.ncd.control": { - "source": "iana" - }, - "application/vnd.ncd.reference": { - "source": "iana" - }, - "application/vnd.nervana": { - "source": "iana" - }, - "application/vnd.netfpx": { - "source": "iana" - }, - "application/vnd.neurolanguage.nlu": { - "source": "iana", - "extensions": ["nlu"] - }, - "application/vnd.nintendo.nitro.rom": { - "source": "iana" - }, - "application/vnd.nintendo.snes.rom": { - "source": "iana" - }, - "application/vnd.nitf": { - "source": "iana", - "extensions": ["ntf","nitf"] - }, - "application/vnd.noblenet-directory": { - "source": "iana", - "extensions": ["nnd"] - }, - "application/vnd.noblenet-sealer": { - "source": "iana", - "extensions": ["nns"] - }, - "application/vnd.noblenet-web": { - "source": "iana", - "extensions": ["nnw"] - }, - "application/vnd.nokia.catalogs": { - "source": "iana" - }, - "application/vnd.nokia.conml+wbxml": { - "source": "iana" - }, - "application/vnd.nokia.conml+xml": { - "source": "iana" - }, - "application/vnd.nokia.iptv.config+xml": { - "source": "iana" - }, - "application/vnd.nokia.isds-radio-presets": { - "source": "iana" - }, - "application/vnd.nokia.landmark+wbxml": { - "source": "iana" - }, - "application/vnd.nokia.landmark+xml": { - "source": "iana" - }, - "application/vnd.nokia.landmarkcollection+xml": { - "source": "iana" - }, - "application/vnd.nokia.n-gage.ac+xml": { - "source": "iana" - }, - "application/vnd.nokia.n-gage.data": { - "source": "iana", - "extensions": ["ngdat"] - }, - "application/vnd.nokia.n-gage.symbian.install": { - "source": "iana", - "extensions": ["n-gage"] - }, - "application/vnd.nokia.ncd": { - "source": "iana" - }, - "application/vnd.nokia.pcd+wbxml": { - "source": "iana" - }, - "application/vnd.nokia.pcd+xml": { - "source": "iana" - }, - "application/vnd.nokia.radio-preset": { - "source": "iana", - "extensions": ["rpst"] - }, - "application/vnd.nokia.radio-presets": { - "source": "iana", - "extensions": ["rpss"] - }, - "application/vnd.novadigm.edm": { - "source": "iana", - "extensions": ["edm"] - }, - "application/vnd.novadigm.edx": { - "source": "iana", - "extensions": ["edx"] - }, - "application/vnd.novadigm.ext": { - "source": "iana", - "extensions": ["ext"] - }, - "application/vnd.ntt-local.content-share": { - "source": "iana" - }, - "application/vnd.ntt-local.file-transfer": { - "source": "iana" - }, - "application/vnd.ntt-local.ogw_remote-access": { - "source": "iana" - }, - "application/vnd.ntt-local.sip-ta_remote": { - "source": "iana" - }, - "application/vnd.ntt-local.sip-ta_tcp_stream": { - "source": "iana" - }, - "application/vnd.oasis.opendocument.chart": { - "source": "iana", - "extensions": ["odc"] - }, - "application/vnd.oasis.opendocument.chart-template": { - "source": "iana", - "extensions": ["otc"] - }, - "application/vnd.oasis.opendocument.database": { - "source": "iana", - "extensions": ["odb"] - }, - "application/vnd.oasis.opendocument.formula": { - "source": "iana", - "extensions": ["odf"] - }, - "application/vnd.oasis.opendocument.formula-template": { - "source": "iana", - "extensions": ["odft"] - }, - "application/vnd.oasis.opendocument.graphics": { - "source": "iana", - "compressible": false, - "extensions": ["odg"] - }, - "application/vnd.oasis.opendocument.graphics-template": { - "source": "iana", - "extensions": ["otg"] - }, - "application/vnd.oasis.opendocument.image": { - "source": "iana", - "extensions": ["odi"] - }, - "application/vnd.oasis.opendocument.image-template": { - "source": "iana", - "extensions": ["oti"] - }, - "application/vnd.oasis.opendocument.presentation": { - "source": "iana", - "compressible": false, - "extensions": ["odp"] - }, - "application/vnd.oasis.opendocument.presentation-template": { - "source": "iana", - "extensions": ["otp"] - }, - "application/vnd.oasis.opendocument.spreadsheet": { - "source": "iana", - "compressible": false, - "extensions": ["ods"] - }, - "application/vnd.oasis.opendocument.spreadsheet-template": { - "source": "iana", - "extensions": ["ots"] - }, - "application/vnd.oasis.opendocument.text": { - "source": "iana", - "compressible": false, - "extensions": ["odt"] - }, - "application/vnd.oasis.opendocument.text-master": { - "source": "iana", - "extensions": ["odm"] - }, - "application/vnd.oasis.opendocument.text-template": { - "source": "iana", - "extensions": ["ott"] - }, - "application/vnd.oasis.opendocument.text-web": { - "source": "iana", - "extensions": ["oth"] - }, - "application/vnd.obn": { - "source": "iana" - }, - "application/vnd.oftn.l10n+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.oipf.contentaccessdownload+xml": { - "source": "iana" - }, - "application/vnd.oipf.contentaccessstreaming+xml": { - "source": "iana" - }, - "application/vnd.oipf.cspg-hexbinary": { - "source": "iana" - }, - "application/vnd.oipf.dae.svg+xml": { - "source": "iana" - }, - "application/vnd.oipf.dae.xhtml+xml": { - "source": "iana" - }, - "application/vnd.oipf.mippvcontrolmessage+xml": { - "source": "iana" - }, - "application/vnd.oipf.pae.gem": { - "source": "iana" - }, - "application/vnd.oipf.spdiscovery+xml": { - "source": "iana" - }, - "application/vnd.oipf.spdlist+xml": { - "source": "iana" - }, - "application/vnd.oipf.ueprofile+xml": { - "source": "iana" - }, - "application/vnd.oipf.userprofile+xml": { - "source": "iana" - }, - "application/vnd.olpc-sugar": { - "source": "iana", - "extensions": ["xo"] - }, - "application/vnd.oma-scws-config": { - "source": "iana" - }, - "application/vnd.oma-scws-http-request": { - "source": "iana" - }, - "application/vnd.oma-scws-http-response": { - "source": "iana" - }, - "application/vnd.oma.bcast.associated-procedure-parameter+xml": { - "source": "iana" - }, - "application/vnd.oma.bcast.drm-trigger+xml": { - "source": "iana" - }, - "application/vnd.oma.bcast.imd+xml": { - "source": "iana" - }, - "application/vnd.oma.bcast.ltkm": { - "source": "iana" - }, - "application/vnd.oma.bcast.notification+xml": { - "source": "iana" - }, - "application/vnd.oma.bcast.provisioningtrigger": { - "source": "iana" - }, - "application/vnd.oma.bcast.sgboot": { - "source": "iana" - }, - "application/vnd.oma.bcast.sgdd+xml": { - "source": "iana" - }, - "application/vnd.oma.bcast.sgdu": { - "source": "iana" - }, - "application/vnd.oma.bcast.simple-symbol-container": { - "source": "iana" - }, - "application/vnd.oma.bcast.smartcard-trigger+xml": { - "source": "iana" - }, - "application/vnd.oma.bcast.sprov+xml": { - "source": "iana" - }, - "application/vnd.oma.bcast.stkm": { - "source": "iana" - }, - "application/vnd.oma.cab-address-book+xml": { - "source": "iana" - }, - "application/vnd.oma.cab-feature-handler+xml": { - "source": "iana" - }, - "application/vnd.oma.cab-pcc+xml": { - "source": "iana" - }, - "application/vnd.oma.cab-subs-invite+xml": { - "source": "iana" - }, - "application/vnd.oma.cab-user-prefs+xml": { - "source": "iana" - }, - "application/vnd.oma.dcd": { - "source": "iana" - }, - "application/vnd.oma.dcdc": { - "source": "iana" - }, - "application/vnd.oma.dd2+xml": { - "source": "iana", - "extensions": ["dd2"] - }, - "application/vnd.oma.drm.risd+xml": { - "source": "iana" - }, - "application/vnd.oma.group-usage-list+xml": { - "source": "iana" - }, - "application/vnd.oma.pal+xml": { - "source": "iana" - }, - "application/vnd.oma.poc.detailed-progress-report+xml": { - "source": "iana" - }, - "application/vnd.oma.poc.final-report+xml": { - "source": "iana" - }, - "application/vnd.oma.poc.groups+xml": { - "source": "iana" - }, - "application/vnd.oma.poc.invocation-descriptor+xml": { - "source": "iana" - }, - "application/vnd.oma.poc.optimized-progress-report+xml": { - "source": "iana" - }, - "application/vnd.oma.push": { - "source": "iana" - }, - "application/vnd.oma.scidm.messages+xml": { - "source": "iana" - }, - "application/vnd.oma.xcap-directory+xml": { - "source": "iana" - }, - "application/vnd.omads-email+xml": { - "source": "iana" - }, - "application/vnd.omads-file+xml": { - "source": "iana" - }, - "application/vnd.omads-folder+xml": { - "source": "iana" - }, - "application/vnd.omaloc-supl-init": { - "source": "iana" - }, - "application/vnd.onepager": { - "source": "iana" - }, - "application/vnd.openblox.game+xml": { - "source": "iana" - }, - "application/vnd.openblox.game-binary": { - "source": "iana" - }, - "application/vnd.openeye.oeb": { - "source": "iana" - }, - "application/vnd.openofficeorg.extension": { - "source": "apache", - "extensions": ["oxt"] - }, - "application/vnd.openxmlformats-officedocument.custom-properties+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.customxmlproperties+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.drawing+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.drawingml.chart+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.drawingml.chartshapes+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.drawingml.diagramcolors+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.drawingml.diagramdata+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.drawingml.diagramlayout+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.drawingml.diagramstyle+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.extended-properties+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml-template": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.commentauthors+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.comments+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.handoutmaster+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.notesmaster+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.notesslide+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.presentation": { - "source": "iana", - "compressible": false, - "extensions": ["pptx"] - }, - "application/vnd.openxmlformats-officedocument.presentationml.presentation.main+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.presprops+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.slide": { - "source": "iana", - "extensions": ["sldx"] - }, - "application/vnd.openxmlformats-officedocument.presentationml.slide+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.slidelayout+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.slidemaster+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.slideshow": { - "source": "iana", - "extensions": ["ppsx"] - }, - "application/vnd.openxmlformats-officedocument.presentationml.slideshow.main+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.slideupdateinfo+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.tablestyles+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.tags+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.template": { - "source": "apache", - "extensions": ["potx"] - }, - "application/vnd.openxmlformats-officedocument.presentationml.template.main+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.presentationml.viewprops+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml-template": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.calcchain+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.externallink+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcachedefinition+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.pivotcacherecords+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.pivottable+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.querytable+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionheaders+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.revisionlog+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sharedstrings+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": { - "source": "iana", - "compressible": false, - "extensions": ["xlsx"] - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheetmetadata+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.tablesinglecells+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.template": { - "source": "apache", - "extensions": ["xltx"] - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.usernames+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.volatiledependencies+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.theme+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.themeoverride+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.vmldrawing": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml-template": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.document": { - "source": "iana", - "compressible": false, - "extensions": ["docx"] - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.document.glossary+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.endnotes+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.fonttable+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.footer+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.footnotes+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.numbering+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.template": { - "source": "apache", - "extensions": ["dotx"] - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.template.main+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-officedocument.wordprocessingml.websettings+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-package.core-properties+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-package.digital-signature-xmlsignature+xml": { - "source": "iana" - }, - "application/vnd.openxmlformats-package.relationships+xml": { - "source": "iana" - }, - "application/vnd.oracle.resource+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.orange.indata": { - "source": "iana" - }, - "application/vnd.osa.netdeploy": { - "source": "iana" - }, - "application/vnd.osgeo.mapguide.package": { - "source": "iana", - "extensions": ["mgp"] - }, - "application/vnd.osgi.bundle": { - "source": "iana" - }, - "application/vnd.osgi.dp": { - "source": "iana", - "extensions": ["dp"] - }, - "application/vnd.osgi.subsystem": { - "source": "iana", - "extensions": ["esa"] - }, - "application/vnd.otps.ct-kip+xml": { - "source": "iana" - }, - "application/vnd.oxli.countgraph": { - "source": "iana" - }, - "application/vnd.pagerduty+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.palm": { - "source": "iana", - "extensions": ["pdb","pqa","oprc"] - }, - "application/vnd.panoply": { - "source": "iana" - }, - "application/vnd.paos+xml": { - "source": "iana" - }, - "application/vnd.paos.xml": { - "source": "apache" - }, - "application/vnd.pawaafile": { - "source": "iana", - "extensions": ["paw"] - }, - "application/vnd.pcos": { - "source": "iana" - }, - "application/vnd.pg.format": { - "source": "iana", - "extensions": ["str"] - }, - "application/vnd.pg.osasli": { - "source": "iana", - "extensions": ["ei6"] - }, - "application/vnd.piaccess.application-licence": { - "source": "iana" - }, - "application/vnd.picsel": { - "source": "iana", - "extensions": ["efif"] - }, - "application/vnd.pmi.widget": { - "source": "iana", - "extensions": ["wg"] - }, - "application/vnd.poc.group-advertisement+xml": { - "source": "iana" - }, - "application/vnd.pocketlearn": { - "source": "iana", - "extensions": ["plf"] - }, - "application/vnd.powerbuilder6": { - "source": "iana", - "extensions": ["pbd"] - }, - "application/vnd.powerbuilder6-s": { - "source": "iana" - }, - "application/vnd.powerbuilder7": { - "source": "iana" - }, - "application/vnd.powerbuilder7-s": { - "source": "iana" - }, - "application/vnd.powerbuilder75": { - "source": "iana" - }, - "application/vnd.powerbuilder75-s": { - "source": "iana" - }, - "application/vnd.preminet": { - "source": "iana" - }, - "application/vnd.previewsystems.box": { - "source": "iana", - "extensions": ["box"] - }, - "application/vnd.proteus.magazine": { - "source": "iana", - "extensions": ["mgz"] - }, - "application/vnd.publishare-delta-tree": { - "source": "iana", - "extensions": ["qps"] - }, - "application/vnd.pvi.ptid1": { - "source": "iana", - "extensions": ["ptid"] - }, - "application/vnd.pwg-multiplexed": { - "source": "iana" - }, - "application/vnd.pwg-xhtml-print+xml": { - "source": "iana" - }, - "application/vnd.qualcomm.brew-app-res": { - "source": "iana" - }, - "application/vnd.quark.quarkxpress": { - "source": "iana", - "extensions": ["qxd","qxt","qwd","qwt","qxl","qxb"] - }, - "application/vnd.quobject-quoxdocument": { - "source": "iana" - }, - "application/vnd.radisys.moml+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-audit+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-audit-conf+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-audit-conn+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-audit-dialog+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-audit-stream+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-conf+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-dialog+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-dialog-base+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-dialog-fax-detect+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-dialog-fax-sendrecv+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-dialog-group+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-dialog-speech+xml": { - "source": "iana" - }, - "application/vnd.radisys.msml-dialog-transform+xml": { - "source": "iana" - }, - "application/vnd.rainstor.data": { - "source": "iana" - }, - "application/vnd.rapid": { - "source": "iana" - }, - "application/vnd.realvnc.bed": { - "source": "iana", - "extensions": ["bed"] - }, - "application/vnd.recordare.musicxml": { - "source": "iana", - "extensions": ["mxl"] - }, - "application/vnd.recordare.musicxml+xml": { - "source": "iana", - "extensions": ["musicxml"] - }, - "application/vnd.renlearn.rlprint": { - "source": "iana" - }, - "application/vnd.rig.cryptonote": { - "source": "iana", - "extensions": ["cryptonote"] - }, - "application/vnd.rim.cod": { - "source": "apache", - "extensions": ["cod"] - }, - "application/vnd.rn-realmedia": { - "source": "apache", - "extensions": ["rm"] - }, - "application/vnd.rn-realmedia-vbr": { - "source": "apache", - "extensions": ["rmvb"] - }, - "application/vnd.route66.link66+xml": { - "source": "iana", - "extensions": ["link66"] - }, - "application/vnd.rs-274x": { - "source": "iana" - }, - "application/vnd.ruckus.download": { - "source": "iana" - }, - "application/vnd.s3sms": { - "source": "iana" - }, - "application/vnd.sailingtracker.track": { - "source": "iana", - "extensions": ["st"] - }, - "application/vnd.sbm.cid": { - "source": "iana" - }, - "application/vnd.sbm.mid2": { - "source": "iana" - }, - "application/vnd.scribus": { - "source": "iana" - }, - "application/vnd.sealed.3df": { - "source": "iana" - }, - "application/vnd.sealed.csf": { - "source": "iana" - }, - "application/vnd.sealed.doc": { - "source": "iana" - }, - "application/vnd.sealed.eml": { - "source": "iana" - }, - "application/vnd.sealed.mht": { - "source": "iana" - }, - "application/vnd.sealed.net": { - "source": "iana" - }, - "application/vnd.sealed.ppt": { - "source": "iana" - }, - "application/vnd.sealed.tiff": { - "source": "iana" - }, - "application/vnd.sealed.xls": { - "source": "iana" - }, - "application/vnd.sealedmedia.softseal.html": { - "source": "iana" - }, - "application/vnd.sealedmedia.softseal.pdf": { - "source": "iana" - }, - "application/vnd.seemail": { - "source": "iana", - "extensions": ["see"] - }, - "application/vnd.sema": { - "source": "iana", - "extensions": ["sema"] - }, - "application/vnd.semd": { - "source": "iana", - "extensions": ["semd"] - }, - "application/vnd.semf": { - "source": "iana", - "extensions": ["semf"] - }, - "application/vnd.shana.informed.formdata": { - "source": "iana", - "extensions": ["ifm"] - }, - "application/vnd.shana.informed.formtemplate": { - "source": "iana", - "extensions": ["itp"] - }, - "application/vnd.shana.informed.interchange": { - "source": "iana", - "extensions": ["iif"] - }, - "application/vnd.shana.informed.package": { - "source": "iana", - "extensions": ["ipk"] - }, - "application/vnd.simtech-mindmapper": { - "source": "iana", - "extensions": ["twd","twds"] - }, - "application/vnd.siren+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.smaf": { - "source": "iana", - "extensions": ["mmf"] - }, - "application/vnd.smart.notebook": { - "source": "iana" - }, - "application/vnd.smart.teacher": { - "source": "iana", - "extensions": ["teacher"] - }, - "application/vnd.software602.filler.form+xml": { - "source": "iana" - }, - "application/vnd.software602.filler.form-xml-zip": { - "source": "iana" - }, - "application/vnd.solent.sdkm+xml": { - "source": "iana", - "extensions": ["sdkm","sdkd"] - }, - "application/vnd.spotfire.dxp": { - "source": "iana", - "extensions": ["dxp"] - }, - "application/vnd.spotfire.sfs": { - "source": "iana", - "extensions": ["sfs"] - }, - "application/vnd.sss-cod": { - "source": "iana" - }, - "application/vnd.sss-dtf": { - "source": "iana" - }, - "application/vnd.sss-ntf": { - "source": "iana" - }, - "application/vnd.stardivision.calc": { - "source": "apache", - "extensions": ["sdc"] - }, - "application/vnd.stardivision.draw": { - "source": "apache", - "extensions": ["sda"] - }, - "application/vnd.stardivision.impress": { - "source": "apache", - "extensions": ["sdd"] - }, - "application/vnd.stardivision.math": { - "source": "apache", - "extensions": ["smf"] - }, - "application/vnd.stardivision.writer": { - "source": "apache", - "extensions": ["sdw","vor"] - }, - "application/vnd.stardivision.writer-global": { - "source": "apache", - "extensions": ["sgl"] - }, - "application/vnd.stepmania.package": { - "source": "iana", - "extensions": ["smzip"] - }, - "application/vnd.stepmania.stepchart": { - "source": "iana", - "extensions": ["sm"] - }, - "application/vnd.street-stream": { - "source": "iana" - }, - "application/vnd.sun.wadl+xml": { - "source": "iana" - }, - "application/vnd.sun.xml.calc": { - "source": "apache", - "extensions": ["sxc"] - }, - "application/vnd.sun.xml.calc.template": { - "source": "apache", - "extensions": ["stc"] - }, - "application/vnd.sun.xml.draw": { - "source": "apache", - "extensions": ["sxd"] - }, - "application/vnd.sun.xml.draw.template": { - "source": "apache", - "extensions": ["std"] - }, - "application/vnd.sun.xml.impress": { - "source": "apache", - "extensions": ["sxi"] - }, - "application/vnd.sun.xml.impress.template": { - "source": "apache", - "extensions": ["sti"] - }, - "application/vnd.sun.xml.math": { - "source": "apache", - "extensions": ["sxm"] - }, - "application/vnd.sun.xml.writer": { - "source": "apache", - "extensions": ["sxw"] - }, - "application/vnd.sun.xml.writer.global": { - "source": "apache", - "extensions": ["sxg"] - }, - "application/vnd.sun.xml.writer.template": { - "source": "apache", - "extensions": ["stw"] - }, - "application/vnd.sus-calendar": { - "source": "iana", - "extensions": ["sus","susp"] - }, - "application/vnd.svd": { - "source": "iana", - "extensions": ["svd"] - }, - "application/vnd.swiftview-ics": { - "source": "iana" - }, - "application/vnd.symbian.install": { - "source": "apache", - "extensions": ["sis","sisx"] - }, - "application/vnd.syncml+xml": { - "source": "iana", - "extensions": ["xsm"] - }, - "application/vnd.syncml.dm+wbxml": { - "source": "iana", - "extensions": ["bdm"] - }, - "application/vnd.syncml.dm+xml": { - "source": "iana", - "extensions": ["xdm"] - }, - "application/vnd.syncml.dm.notification": { - "source": "iana" - }, - "application/vnd.syncml.dmddf+wbxml": { - "source": "iana" - }, - "application/vnd.syncml.dmddf+xml": { - "source": "iana" - }, - "application/vnd.syncml.dmtnds+wbxml": { - "source": "iana" - }, - "application/vnd.syncml.dmtnds+xml": { - "source": "iana" - }, - "application/vnd.syncml.ds.notification": { - "source": "iana" - }, - "application/vnd.tao.intent-module-archive": { - "source": "iana", - "extensions": ["tao"] - }, - "application/vnd.tcpdump.pcap": { - "source": "iana", - "extensions": ["pcap","cap","dmp"] - }, - "application/vnd.tmd.mediaflex.api+xml": { - "source": "iana" - }, - "application/vnd.tml": { - "source": "iana" - }, - "application/vnd.tmobile-livetv": { - "source": "iana", - "extensions": ["tmo"] - }, - "application/vnd.trid.tpt": { - "source": "iana", - "extensions": ["tpt"] - }, - "application/vnd.triscape.mxs": { - "source": "iana", - "extensions": ["mxs"] - }, - "application/vnd.trueapp": { - "source": "iana", - "extensions": ["tra"] - }, - "application/vnd.truedoc": { - "source": "iana" - }, - "application/vnd.ubisoft.webplayer": { - "source": "iana" - }, - "application/vnd.ufdl": { - "source": "iana", - "extensions": ["ufd","ufdl"] - }, - "application/vnd.uiq.theme": { - "source": "iana", - "extensions": ["utz"] - }, - "application/vnd.umajin": { - "source": "iana", - "extensions": ["umj"] - }, - "application/vnd.unity": { - "source": "iana", - "extensions": ["unityweb"] - }, - "application/vnd.uoml+xml": { - "source": "iana", - "extensions": ["uoml"] - }, - "application/vnd.uplanet.alert": { - "source": "iana" - }, - "application/vnd.uplanet.alert-wbxml": { - "source": "iana" - }, - "application/vnd.uplanet.bearer-choice": { - "source": "iana" - }, - "application/vnd.uplanet.bearer-choice-wbxml": { - "source": "iana" - }, - "application/vnd.uplanet.cacheop": { - "source": "iana" - }, - "application/vnd.uplanet.cacheop-wbxml": { - "source": "iana" - }, - "application/vnd.uplanet.channel": { - "source": "iana" - }, - "application/vnd.uplanet.channel-wbxml": { - "source": "iana" - }, - "application/vnd.uplanet.list": { - "source": "iana" - }, - "application/vnd.uplanet.list-wbxml": { - "source": "iana" - }, - "application/vnd.uplanet.listcmd": { - "source": "iana" - }, - "application/vnd.uplanet.listcmd-wbxml": { - "source": "iana" - }, - "application/vnd.uplanet.signal": { - "source": "iana" - }, - "application/vnd.uri-map": { - "source": "iana" - }, - "application/vnd.valve.source.material": { - "source": "iana" - }, - "application/vnd.vcx": { - "source": "iana", - "extensions": ["vcx"] - }, - "application/vnd.vd-study": { - "source": "iana" - }, - "application/vnd.vectorworks": { - "source": "iana" - }, - "application/vnd.vel+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.verimatrix.vcas": { - "source": "iana" - }, - "application/vnd.vidsoft.vidconference": { - "source": "iana" - }, - "application/vnd.visio": { - "source": "iana", - "extensions": ["vsd","vst","vss","vsw"] - }, - "application/vnd.visionary": { - "source": "iana", - "extensions": ["vis"] - }, - "application/vnd.vividence.scriptfile": { - "source": "iana" - }, - "application/vnd.vsf": { - "source": "iana", - "extensions": ["vsf"] - }, - "application/vnd.wap.sic": { - "source": "iana" - }, - "application/vnd.wap.slc": { - "source": "iana" - }, - "application/vnd.wap.wbxml": { - "source": "iana", - "extensions": ["wbxml"] - }, - "application/vnd.wap.wmlc": { - "source": "iana", - "extensions": ["wmlc"] - }, - "application/vnd.wap.wmlscriptc": { - "source": "iana", - "extensions": ["wmlsc"] - }, - "application/vnd.webturbo": { - "source": "iana", - "extensions": ["wtb"] - }, - "application/vnd.wfa.p2p": { - "source": "iana" - }, - "application/vnd.wfa.wsc": { - "source": "iana" - }, - "application/vnd.windows.devicepairing": { - "source": "iana" - }, - "application/vnd.wmc": { - "source": "iana" - }, - "application/vnd.wmf.bootstrap": { - "source": "iana" - }, - "application/vnd.wolfram.mathematica": { - "source": "iana" - }, - "application/vnd.wolfram.mathematica.package": { - "source": "iana" - }, - "application/vnd.wolfram.player": { - "source": "iana", - "extensions": ["nbp"] - }, - "application/vnd.wordperfect": { - "source": "iana", - "extensions": ["wpd"] - }, - "application/vnd.wqd": { - "source": "iana", - "extensions": ["wqd"] - }, - "application/vnd.wrq-hp3000-labelled": { - "source": "iana" - }, - "application/vnd.wt.stf": { - "source": "iana", - "extensions": ["stf"] - }, - "application/vnd.wv.csp+wbxml": { - "source": "iana" - }, - "application/vnd.wv.csp+xml": { - "source": "iana" - }, - "application/vnd.wv.ssp+xml": { - "source": "iana" - }, - "application/vnd.xacml+json": { - "source": "iana", - "compressible": true - }, - "application/vnd.xara": { - "source": "iana", - "extensions": ["xar"] - }, - "application/vnd.xfdl": { - "source": "iana", - "extensions": ["xfdl"] - }, - "application/vnd.xfdl.webform": { - "source": "iana" - }, - "application/vnd.xmi+xml": { - "source": "iana" - }, - "application/vnd.xmpie.cpkg": { - "source": "iana" - }, - "application/vnd.xmpie.dpkg": { - "source": "iana" - }, - "application/vnd.xmpie.plan": { - "source": "iana" - }, - "application/vnd.xmpie.ppkg": { - "source": "iana" - }, - "application/vnd.xmpie.xlim": { - "source": "iana" - }, - "application/vnd.yamaha.hv-dic": { - "source": "iana", - "extensions": ["hvd"] - }, - "application/vnd.yamaha.hv-script": { - "source": "iana", - "extensions": ["hvs"] - }, - "application/vnd.yamaha.hv-voice": { - "source": "iana", - "extensions": ["hvp"] - }, - "application/vnd.yamaha.openscoreformat": { - "source": "iana", - "extensions": ["osf"] - }, - "application/vnd.yamaha.openscoreformat.osfpvg+xml": { - "source": "iana", - "extensions": ["osfpvg"] - }, - "application/vnd.yamaha.remote-setup": { - "source": "iana" - }, - "application/vnd.yamaha.smaf-audio": { - "source": "iana", - "extensions": ["saf"] - }, - "application/vnd.yamaha.smaf-phrase": { - "source": "iana", - "extensions": ["spf"] - }, - "application/vnd.yamaha.through-ngn": { - "source": "iana" - }, - "application/vnd.yamaha.tunnel-udpencap": { - "source": "iana" - }, - "application/vnd.yaoweme": { - "source": "iana" - }, - "application/vnd.yellowriver-custom-menu": { - "source": "iana", - "extensions": ["cmp"] - }, - "application/vnd.zul": { - "source": "iana", - "extensions": ["zir","zirz"] - }, - "application/vnd.zzazz.deck+xml": { - "source": "iana", - "extensions": ["zaz"] - }, - "application/voicexml+xml": { - "source": "iana", - "extensions": ["vxml"] - }, - "application/vq-rtcpxr": { - "source": "iana" - }, - "application/watcherinfo+xml": { - "source": "iana" - }, - "application/whoispp-query": { - "source": "iana" - }, - "application/whoispp-response": { - "source": "iana" - }, - "application/widget": { - "source": "iana", - "extensions": ["wgt"] - }, - "application/winhlp": { - "source": "apache", - "extensions": ["hlp"] - }, - "application/wita": { - "source": "iana" - }, - "application/wordperfect5.1": { - "source": "iana" - }, - "application/wsdl+xml": { - "source": "iana", - "extensions": ["wsdl"] - }, - "application/wspolicy+xml": { - "source": "iana", - "extensions": ["wspolicy"] - }, - "application/x-7z-compressed": { - "source": "apache", - "compressible": false, - "extensions": ["7z"] - }, - "application/x-abiword": { - "source": "apache", - "extensions": ["abw"] - }, - "application/x-ace-compressed": { - "source": "apache", - "extensions": ["ace"] - }, - "application/x-amf": { - "source": "apache" - }, - "application/x-apple-diskimage": { - "source": "apache", - "extensions": ["dmg"] - }, - "application/x-authorware-bin": { - "source": "apache", - "extensions": ["aab","x32","u32","vox"] - }, - "application/x-authorware-map": { - "source": "apache", - "extensions": ["aam"] - }, - "application/x-authorware-seg": { - "source": "apache", - "extensions": ["aas"] - }, - "application/x-bcpio": { - "source": "apache", - "extensions": ["bcpio"] - }, - "application/x-bdoc": { - "compressible": false, - "extensions": ["bdoc"] - }, - "application/x-bittorrent": { - "source": "apache", - "extensions": ["torrent"] - }, - "application/x-blorb": { - "source": "apache", - "extensions": ["blb","blorb"] - }, - "application/x-bzip": { - "source": "apache", - "compressible": false, - "extensions": ["bz"] - }, - "application/x-bzip2": { - "source": "apache", - "compressible": false, - "extensions": ["bz2","boz"] - }, - "application/x-cbr": { - "source": "apache", - "extensions": ["cbr","cba","cbt","cbz","cb7"] - }, - "application/x-cdlink": { - "source": "apache", - "extensions": ["vcd"] - }, - "application/x-cfs-compressed": { - "source": "apache", - "extensions": ["cfs"] - }, - "application/x-chat": { - "source": "apache", - "extensions": ["chat"] - }, - "application/x-chess-pgn": { - "source": "apache", - "extensions": ["pgn"] - }, - "application/x-chrome-extension": { - "extensions": ["crx"] - }, - "application/x-cocoa": { - "source": "nginx", - "extensions": ["cco"] - }, - "application/x-compress": { - "source": "apache" - }, - "application/x-conference": { - "source": "apache", - "extensions": ["nsc"] - }, - "application/x-cpio": { - "source": "apache", - "extensions": ["cpio"] - }, - "application/x-csh": { - "source": "apache", - "extensions": ["csh"] - }, - "application/x-deb": { - "compressible": false - }, - "application/x-debian-package": { - "source": "apache", - "extensions": ["deb","udeb"] - }, - "application/x-dgc-compressed": { - "source": "apache", - "extensions": ["dgc"] - }, - "application/x-director": { - "source": "apache", - "extensions": ["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"] - }, - "application/x-doom": { - "source": "apache", - "extensions": ["wad"] - }, - "application/x-dtbncx+xml": { - "source": "apache", - "extensions": ["ncx"] - }, - "application/x-dtbook+xml": { - "source": "apache", - "extensions": ["dtb"] - }, - "application/x-dtbresource+xml": { - "source": "apache", - "extensions": ["res"] - }, - "application/x-dvi": { - "source": "apache", - "compressible": false, - "extensions": ["dvi"] - }, - "application/x-envoy": { - "source": "apache", - "extensions": ["evy"] - }, - "application/x-eva": { - "source": "apache", - "extensions": ["eva"] - }, - "application/x-font-bdf": { - "source": "apache", - "extensions": ["bdf"] - }, - "application/x-font-dos": { - "source": "apache" - }, - "application/x-font-framemaker": { - "source": "apache" - }, - "application/x-font-ghostscript": { - "source": "apache", - "extensions": ["gsf"] - }, - "application/x-font-libgrx": { - "source": "apache" - }, - "application/x-font-linux-psf": { - "source": "apache", - "extensions": ["psf"] - }, - "application/x-font-otf": { - "source": "apache", - "compressible": true, - "extensions": ["otf"] - }, - "application/x-font-pcf": { - "source": "apache", - "extensions": ["pcf"] - }, - "application/x-font-snf": { - "source": "apache", - "extensions": ["snf"] - }, - "application/x-font-speedo": { - "source": "apache" - }, - "application/x-font-sunos-news": { - "source": "apache" - }, - "application/x-font-ttf": { - "source": "apache", - "compressible": true, - "extensions": ["ttf","ttc"] - }, - "application/x-font-type1": { - "source": "apache", - "extensions": ["pfa","pfb","pfm","afm"] - }, - "application/x-font-vfont": { - "source": "apache" - }, - "application/x-freearc": { - "source": "apache", - "extensions": ["arc"] - }, - "application/x-futuresplash": { - "source": "apache", - "extensions": ["spl"] - }, - "application/x-gca-compressed": { - "source": "apache", - "extensions": ["gca"] - }, - "application/x-glulx": { - "source": "apache", - "extensions": ["ulx"] - }, - "application/x-gnumeric": { - "source": "apache", - "extensions": ["gnumeric"] - }, - "application/x-gramps-xml": { - "source": "apache", - "extensions": ["gramps"] - }, - "application/x-gtar": { - "source": "apache", - "extensions": ["gtar"] - }, - "application/x-gzip": { - "source": "apache" - }, - "application/x-hdf": { - "source": "apache", - "extensions": ["hdf"] - }, - "application/x-httpd-php": { - "compressible": true, - "extensions": ["php"] - }, - "application/x-install-instructions": { - "source": "apache", - "extensions": ["install"] - }, - "application/x-iso9660-image": { - "source": "apache", - "extensions": ["iso"] - }, - "application/x-java-archive-diff": { - "source": "nginx", - "extensions": ["jardiff"] - }, - "application/x-java-jnlp-file": { - "source": "apache", - "compressible": false, - "extensions": ["jnlp"] - }, - "application/x-javascript": { - "compressible": true - }, - "application/x-latex": { - "source": "apache", - "compressible": false, - "extensions": ["latex"] - }, - "application/x-lua-bytecode": { - "extensions": ["luac"] - }, - "application/x-lzh-compressed": { - "source": "apache", - "extensions": ["lzh","lha"] - }, - "application/x-makeself": { - "source": "nginx", - "extensions": ["run"] - }, - "application/x-mie": { - "source": "apache", - "extensions": ["mie"] - }, - "application/x-mobipocket-ebook": { - "source": "apache", - "extensions": ["prc","mobi"] - }, - "application/x-mpegurl": { - "compressible": false - }, - "application/x-ms-application": { - "source": "apache", - "extensions": ["application"] - }, - "application/x-ms-shortcut": { - "source": "apache", - "extensions": ["lnk"] - }, - "application/x-ms-wmd": { - "source": "apache", - "extensions": ["wmd"] - }, - "application/x-ms-wmz": { - "source": "apache", - "extensions": ["wmz"] - }, - "application/x-ms-xbap": { - "source": "apache", - "extensions": ["xbap"] - }, - "application/x-msaccess": { - "source": "apache", - "extensions": ["mdb"] - }, - "application/x-msbinder": { - "source": "apache", - "extensions": ["obd"] - }, - "application/x-mscardfile": { - "source": "apache", - "extensions": ["crd"] - }, - "application/x-msclip": { - "source": "apache", - "extensions": ["clp"] - }, - "application/x-msdos-program": { - "extensions": ["exe"] - }, - "application/x-msdownload": { - "source": "apache", - "extensions": ["exe","dll","com","bat","msi"] - }, - "application/x-msmediaview": { - "source": "apache", - "extensions": ["mvb","m13","m14"] - }, - "application/x-msmetafile": { - "source": "apache", - "extensions": ["wmf","wmz","emf","emz"] - }, - "application/x-msmoney": { - "source": "apache", - "extensions": ["mny"] - }, - "application/x-mspublisher": { - "source": "apache", - "extensions": ["pub"] - }, - "application/x-msschedule": { - "source": "apache", - "extensions": ["scd"] - }, - "application/x-msterminal": { - "source": "apache", - "extensions": ["trm"] - }, - "application/x-mswrite": { - "source": "apache", - "extensions": ["wri"] - }, - "application/x-netcdf": { - "source": "apache", - "extensions": ["nc","cdf"] - }, - "application/x-ns-proxy-autoconfig": { - "compressible": true, - "extensions": ["pac"] - }, - "application/x-nzb": { - "source": "apache", - "extensions": ["nzb"] - }, - "application/x-perl": { - "source": "nginx", - "extensions": ["pl","pm"] - }, - "application/x-pilot": { - "source": "nginx", - "extensions": ["prc","pdb"] - }, - "application/x-pkcs12": { - "source": "apache", - "compressible": false, - "extensions": ["p12","pfx"] - }, - "application/x-pkcs7-certificates": { - "source": "apache", - "extensions": ["p7b","spc"] - }, - "application/x-pkcs7-certreqresp": { - "source": "apache", - "extensions": ["p7r"] - }, - "application/x-rar-compressed": { - "source": "apache", - "compressible": false, - "extensions": ["rar"] - }, - "application/x-redhat-package-manager": { - "source": "nginx", - "extensions": ["rpm"] - }, - "application/x-research-info-systems": { - "source": "apache", - "extensions": ["ris"] - }, - "application/x-sea": { - "source": "nginx", - "extensions": ["sea"] - }, - "application/x-sh": { - "source": "apache", - "compressible": true, - "extensions": ["sh"] - }, - "application/x-shar": { - "source": "apache", - "extensions": ["shar"] - }, - "application/x-shockwave-flash": { - "source": "apache", - "compressible": false, - "extensions": ["swf"] - }, - "application/x-silverlight-app": { - "source": "apache", - "extensions": ["xap"] - }, - "application/x-sql": { - "source": "apache", - "extensions": ["sql"] - }, - "application/x-stuffit": { - "source": "apache", - "compressible": false, - "extensions": ["sit"] - }, - "application/x-stuffitx": { - "source": "apache", - "extensions": ["sitx"] - }, - "application/x-subrip": { - "source": "apache", - "extensions": ["srt"] - }, - "application/x-sv4cpio": { - "source": "apache", - "extensions": ["sv4cpio"] - }, - "application/x-sv4crc": { - "source": "apache", - "extensions": ["sv4crc"] - }, - "application/x-t3vm-image": { - "source": "apache", - "extensions": ["t3"] - }, - "application/x-tads": { - "source": "apache", - "extensions": ["gam"] - }, - "application/x-tar": { - "source": "apache", - "compressible": true, - "extensions": ["tar"] - }, - "application/x-tcl": { - "source": "apache", - "extensions": ["tcl","tk"] - }, - "application/x-tex": { - "source": "apache", - "extensions": ["tex"] - }, - "application/x-tex-tfm": { - "source": "apache", - "extensions": ["tfm"] - }, - "application/x-texinfo": { - "source": "apache", - "extensions": ["texinfo","texi"] - }, - "application/x-tgif": { - "source": "apache", - "extensions": ["obj"] - }, - "application/x-ustar": { - "source": "apache", - "extensions": ["ustar"] - }, - "application/x-wais-source": { - "source": "apache", - "extensions": ["src"] - }, - "application/x-web-app-manifest+json": { - "compressible": true, - "extensions": ["webapp"] - }, - "application/x-www-form-urlencoded": { - "source": "iana", - "compressible": true - }, - "application/x-x509-ca-cert": { - "source": "apache", - "extensions": ["der","crt","pem"] - }, - "application/x-xfig": { - "source": "apache", - "extensions": ["fig"] - }, - "application/x-xliff+xml": { - "source": "apache", - "extensions": ["xlf"] - }, - "application/x-xpinstall": { - "source": "apache", - "compressible": false, - "extensions": ["xpi"] - }, - "application/x-xz": { - "source": "apache", - "extensions": ["xz"] - }, - "application/x-zmachine": { - "source": "apache", - "extensions": ["z1","z2","z3","z4","z5","z6","z7","z8"] - }, - "application/x400-bp": { - "source": "iana" - }, - "application/xacml+xml": { - "source": "iana" - }, - "application/xaml+xml": { - "source": "apache", - "extensions": ["xaml"] - }, - "application/xcap-att+xml": { - "source": "iana" - }, - "application/xcap-caps+xml": { - "source": "iana" - }, - "application/xcap-diff+xml": { - "source": "iana", - "extensions": ["xdf"] - }, - "application/xcap-el+xml": { - "source": "iana" - }, - "application/xcap-error+xml": { - "source": "iana" - }, - "application/xcap-ns+xml": { - "source": "iana" - }, - "application/xcon-conference-info+xml": { - "source": "iana" - }, - "application/xcon-conference-info-diff+xml": { - "source": "iana" - }, - "application/xenc+xml": { - "source": "iana", - "extensions": ["xenc"] - }, - "application/xhtml+xml": { - "source": "iana", - "compressible": true, - "extensions": ["xhtml","xht"] - }, - "application/xhtml-voice+xml": { - "source": "apache" - }, - "application/xml": { - "source": "iana", - "compressible": true, - "extensions": ["xml","xsl","xsd","rng"] - }, - "application/xml-dtd": { - "source": "iana", - "compressible": true, - "extensions": ["dtd"] - }, - "application/xml-external-parsed-entity": { - "source": "iana" - }, - "application/xml-patch+xml": { - "source": "iana" - }, - "application/xmpp+xml": { - "source": "iana" - }, - "application/xop+xml": { - "source": "iana", - "compressible": true, - "extensions": ["xop"] - }, - "application/xproc+xml": { - "source": "apache", - "extensions": ["xpl"] - }, - "application/xslt+xml": { - "source": "iana", - "extensions": ["xslt"] - }, - "application/xspf+xml": { - "source": "apache", - "extensions": ["xspf"] - }, - "application/xv+xml": { - "source": "iana", - "extensions": ["mxml","xhvml","xvml","xvm"] - }, - "application/yang": { - "source": "iana", - "extensions": ["yang"] - }, - "application/yin+xml": { - "source": "iana", - "extensions": ["yin"] - }, - "application/zip": { - "source": "iana", - "compressible": false, - "extensions": ["zip"] - }, - "application/zlib": { - "source": "iana" - }, - "audio/1d-interleaved-parityfec": { - "source": "iana" - }, - "audio/32kadpcm": { - "source": "iana" - }, - "audio/3gpp": { - "source": "iana", - "compressible": false, - "extensions": ["3gpp"] - }, - "audio/3gpp2": { - "source": "iana" - }, - "audio/ac3": { - "source": "iana" - }, - "audio/adpcm": { - "source": "apache", - "extensions": ["adp"] - }, - "audio/amr": { - "source": "iana" - }, - "audio/amr-wb": { - "source": "iana" - }, - "audio/amr-wb+": { - "source": "iana" - }, - "audio/aptx": { - "source": "iana" - }, - "audio/asc": { - "source": "iana" - }, - "audio/atrac-advanced-lossless": { - "source": "iana" - }, - "audio/atrac-x": { - "source": "iana" - }, - "audio/atrac3": { - "source": "iana" - }, - "audio/basic": { - "source": "iana", - "compressible": false, - "extensions": ["au","snd"] - }, - "audio/bv16": { - "source": "iana" - }, - "audio/bv32": { - "source": "iana" - }, - "audio/clearmode": { - "source": "iana" - }, - "audio/cn": { - "source": "iana" - }, - "audio/dat12": { - "source": "iana" - }, - "audio/dls": { - "source": "iana" - }, - "audio/dsr-es201108": { - "source": "iana" - }, - "audio/dsr-es202050": { - "source": "iana" - }, - "audio/dsr-es202211": { - "source": "iana" - }, - "audio/dsr-es202212": { - "source": "iana" - }, - "audio/dv": { - "source": "iana" - }, - "audio/dvi4": { - "source": "iana" - }, - "audio/eac3": { - "source": "iana" - }, - "audio/encaprtp": { - "source": "iana" - }, - "audio/evrc": { - "source": "iana" - }, - "audio/evrc-qcp": { - "source": "iana" - }, - "audio/evrc0": { - "source": "iana" - }, - "audio/evrc1": { - "source": "iana" - }, - "audio/evrcb": { - "source": "iana" - }, - "audio/evrcb0": { - "source": "iana" - }, - "audio/evrcb1": { - "source": "iana" - }, - "audio/evrcnw": { - "source": "iana" - }, - "audio/evrcnw0": { - "source": "iana" - }, - "audio/evrcnw1": { - "source": "iana" - }, - "audio/evrcwb": { - "source": "iana" - }, - "audio/evrcwb0": { - "source": "iana" - }, - "audio/evrcwb1": { - "source": "iana" - }, - "audio/evs": { - "source": "iana" - }, - "audio/fwdred": { - "source": "iana" - }, - "audio/g711-0": { - "source": "iana" - }, - "audio/g719": { - "source": "iana" - }, - "audio/g722": { - "source": "iana" - }, - "audio/g7221": { - "source": "iana" - }, - "audio/g723": { - "source": "iana" - }, - "audio/g726-16": { - "source": "iana" - }, - "audio/g726-24": { - "source": "iana" - }, - "audio/g726-32": { - "source": "iana" - }, - "audio/g726-40": { - "source": "iana" - }, - "audio/g728": { - "source": "iana" - }, - "audio/g729": { - "source": "iana" - }, - "audio/g7291": { - "source": "iana" - }, - "audio/g729d": { - "source": "iana" - }, - "audio/g729e": { - "source": "iana" - }, - "audio/gsm": { - "source": "iana" - }, - "audio/gsm-efr": { - "source": "iana" - }, - "audio/gsm-hr-08": { - "source": "iana" - }, - "audio/ilbc": { - "source": "iana" - }, - "audio/ip-mr_v2.5": { - "source": "iana" - }, - "audio/isac": { - "source": "apache" - }, - "audio/l16": { - "source": "iana" - }, - "audio/l20": { - "source": "iana" - }, - "audio/l24": { - "source": "iana", - "compressible": false - }, - "audio/l8": { - "source": "iana" - }, - "audio/lpc": { - "source": "iana" - }, - "audio/midi": { - "source": "apache", - "extensions": ["mid","midi","kar","rmi"] - }, - "audio/mobile-xmf": { - "source": "iana" - }, - "audio/mp4": { - "source": "iana", - "compressible": false, - "extensions": ["m4a","mp4a"] - }, - "audio/mp4a-latm": { - "source": "iana" - }, - "audio/mpa": { - "source": "iana" - }, - "audio/mpa-robust": { - "source": "iana" - }, - "audio/mpeg": { - "source": "iana", - "compressible": false, - "extensions": ["mpga","mp2","mp2a","mp3","m2a","m3a"] - }, - "audio/mpeg4-generic": { - "source": "iana" - }, - "audio/musepack": { - "source": "apache" - }, - "audio/ogg": { - "source": "iana", - "compressible": false, - "extensions": ["oga","ogg","spx"] - }, - "audio/opus": { - "source": "iana" - }, - "audio/parityfec": { - "source": "iana" - }, - "audio/pcma": { - "source": "iana" - }, - "audio/pcma-wb": { - "source": "iana" - }, - "audio/pcmu": { - "source": "iana" - }, - "audio/pcmu-wb": { - "source": "iana" - }, - "audio/prs.sid": { - "source": "iana" - }, - "audio/qcelp": { - "source": "iana" - }, - "audio/raptorfec": { - "source": "iana" - }, - "audio/red": { - "source": "iana" - }, - "audio/rtp-enc-aescm128": { - "source": "iana" - }, - "audio/rtp-midi": { - "source": "iana" - }, - "audio/rtploopback": { - "source": "iana" - }, - "audio/rtx": { - "source": "iana" - }, - "audio/s3m": { - "source": "apache", - "extensions": ["s3m"] - }, - "audio/silk": { - "source": "apache", - "extensions": ["sil"] - }, - "audio/smv": { - "source": "iana" - }, - "audio/smv-qcp": { - "source": "iana" - }, - "audio/smv0": { - "source": "iana" - }, - "audio/sp-midi": { - "source": "iana" - }, - "audio/speex": { - "source": "iana" - }, - "audio/t140c": { - "source": "iana" - }, - "audio/t38": { - "source": "iana" - }, - "audio/telephone-event": { - "source": "iana" - }, - "audio/tone": { - "source": "iana" - }, - "audio/uemclip": { - "source": "iana" - }, - "audio/ulpfec": { - "source": "iana" - }, - "audio/vdvi": { - "source": "iana" - }, - "audio/vmr-wb": { - "source": "iana" - }, - "audio/vnd.3gpp.iufp": { - "source": "iana" - }, - "audio/vnd.4sb": { - "source": "iana" - }, - "audio/vnd.audiokoz": { - "source": "iana" - }, - "audio/vnd.celp": { - "source": "iana" - }, - "audio/vnd.cisco.nse": { - "source": "iana" - }, - "audio/vnd.cmles.radio-events": { - "source": "iana" - }, - "audio/vnd.cns.anp1": { - "source": "iana" - }, - "audio/vnd.cns.inf1": { - "source": "iana" - }, - "audio/vnd.dece.audio": { - "source": "iana", - "extensions": ["uva","uvva"] - }, - "audio/vnd.digital-winds": { - "source": "iana", - "extensions": ["eol"] - }, - "audio/vnd.dlna.adts": { - "source": "iana" - }, - "audio/vnd.dolby.heaac.1": { - "source": "iana" - }, - "audio/vnd.dolby.heaac.2": { - "source": "iana" - }, - "audio/vnd.dolby.mlp": { - "source": "iana" - }, - "audio/vnd.dolby.mps": { - "source": "iana" - }, - "audio/vnd.dolby.pl2": { - "source": "iana" - }, - "audio/vnd.dolby.pl2x": { - "source": "iana" - }, - "audio/vnd.dolby.pl2z": { - "source": "iana" - }, - "audio/vnd.dolby.pulse.1": { - "source": "iana" - }, - "audio/vnd.dra": { - "source": "iana", - "extensions": ["dra"] - }, - "audio/vnd.dts": { - "source": "iana", - "extensions": ["dts"] - }, - "audio/vnd.dts.hd": { - "source": "iana", - "extensions": ["dtshd"] - }, - "audio/vnd.dvb.file": { - "source": "iana" - }, - "audio/vnd.everad.plj": { - "source": "iana" - }, - "audio/vnd.hns.audio": { - "source": "iana" - }, - "audio/vnd.lucent.voice": { - "source": "iana", - "extensions": ["lvp"] - }, - "audio/vnd.ms-playready.media.pya": { - "source": "iana", - "extensions": ["pya"] - }, - "audio/vnd.nokia.mobile-xmf": { - "source": "iana" - }, - "audio/vnd.nortel.vbk": { - "source": "iana" - }, - "audio/vnd.nuera.ecelp4800": { - "source": "iana", - "extensions": ["ecelp4800"] - }, - "audio/vnd.nuera.ecelp7470": { - "source": "iana", - "extensions": ["ecelp7470"] - }, - "audio/vnd.nuera.ecelp9600": { - "source": "iana", - "extensions": ["ecelp9600"] - }, - "audio/vnd.octel.sbc": { - "source": "iana" - }, - "audio/vnd.qcelp": { - "source": "iana" - }, - "audio/vnd.rhetorex.32kadpcm": { - "source": "iana" - }, - "audio/vnd.rip": { - "source": "iana", - "extensions": ["rip"] - }, - "audio/vnd.rn-realaudio": { - "compressible": false - }, - "audio/vnd.sealedmedia.softseal.mpeg": { - "source": "iana" - }, - "audio/vnd.vmx.cvsd": { - "source": "iana" - }, - "audio/vnd.wave": { - "compressible": false - }, - "audio/vorbis": { - "source": "iana", - "compressible": false - }, - "audio/vorbis-config": { - "source": "iana" - }, - "audio/wav": { - "compressible": false, - "extensions": ["wav"] - }, - "audio/wave": { - "compressible": false, - "extensions": ["wav"] - }, - "audio/webm": { - "source": "apache", - "compressible": false, - "extensions": ["weba"] - }, - "audio/x-aac": { - "source": "apache", - "compressible": false, - "extensions": ["aac"] - }, - "audio/x-aiff": { - "source": "apache", - "extensions": ["aif","aiff","aifc"] - }, - "audio/x-caf": { - "source": "apache", - "compressible": false, - "extensions": ["caf"] - }, - "audio/x-flac": { - "source": "apache", - "extensions": ["flac"] - }, - "audio/x-m4a": { - "source": "nginx", - "extensions": ["m4a"] - }, - "audio/x-matroska": { - "source": "apache", - "extensions": ["mka"] - }, - "audio/x-mpegurl": { - "source": "apache", - "extensions": ["m3u"] - }, - "audio/x-ms-wax": { - "source": "apache", - "extensions": ["wax"] - }, - "audio/x-ms-wma": { - "source": "apache", - "extensions": ["wma"] - }, - "audio/x-pn-realaudio": { - "source": "apache", - "extensions": ["ram","ra"] - }, - "audio/x-pn-realaudio-plugin": { - "source": "apache", - "extensions": ["rmp"] - }, - "audio/x-realaudio": { - "source": "nginx", - "extensions": ["ra"] - }, - "audio/x-tta": { - "source": "apache" - }, - "audio/x-wav": { - "source": "apache", - "extensions": ["wav"] - }, - "audio/xm": { - "source": "apache", - "extensions": ["xm"] - }, - "chemical/x-cdx": { - "source": "apache", - "extensions": ["cdx"] - }, - "chemical/x-cif": { - "source": "apache", - "extensions": ["cif"] - }, - "chemical/x-cmdf": { - "source": "apache", - "extensions": ["cmdf"] - }, - "chemical/x-cml": { - "source": "apache", - "extensions": ["cml"] - }, - "chemical/x-csml": { - "source": "apache", - "extensions": ["csml"] - }, - "chemical/x-pdb": { - "source": "apache" - }, - "chemical/x-xyz": { - "source": "apache", - "extensions": ["xyz"] - }, - "font/opentype": { - "compressible": true, - "extensions": ["otf"] - }, - "image/bmp": { - "source": "apache", - "compressible": true, - "extensions": ["bmp"] - }, - "image/cgm": { - "source": "iana", - "extensions": ["cgm"] - }, - "image/fits": { - "source": "iana" - }, - "image/g3fax": { - "source": "iana", - "extensions": ["g3"] - }, - "image/gif": { - "source": "iana", - "compressible": false, - "extensions": ["gif"] - }, - "image/ief": { - "source": "iana", - "extensions": ["ief"] - }, - "image/jp2": { - "source": "iana" - }, - "image/jpeg": { - "source": "iana", - "compressible": false, - "extensions": ["jpeg","jpg","jpe"] - }, - "image/jpm": { - "source": "iana" - }, - "image/jpx": { - "source": "iana" - }, - "image/ktx": { - "source": "iana", - "extensions": ["ktx"] - }, - "image/naplps": { - "source": "iana" - }, - "image/pjpeg": { - "compressible": false - }, - "image/png": { - "source": "iana", - "compressible": false, - "extensions": ["png"] - }, - "image/prs.btif": { - "source": "iana", - "extensions": ["btif"] - }, - "image/prs.pti": { - "source": "iana" - }, - "image/pwg-raster": { - "source": "iana" - }, - "image/sgi": { - "source": "apache", - "extensions": ["sgi"] - }, - "image/svg+xml": { - "source": "iana", - "compressible": true, - "extensions": ["svg","svgz"] - }, - "image/t38": { - "source": "iana" - }, - "image/tiff": { - "source": "iana", - "compressible": false, - "extensions": ["tiff","tif"] - }, - "image/tiff-fx": { - "source": "iana" - }, - "image/vnd.adobe.photoshop": { - "source": "iana", - "compressible": true, - "extensions": ["psd"] - }, - "image/vnd.airzip.accelerator.azv": { - "source": "iana" - }, - "image/vnd.cns.inf2": { - "source": "iana" - }, - "image/vnd.dece.graphic": { - "source": "iana", - "extensions": ["uvi","uvvi","uvg","uvvg"] - }, - "image/vnd.djvu": { - "source": "iana", - "extensions": ["djvu","djv"] - }, - "image/vnd.dvb.subtitle": { - "source": "iana", - "extensions": ["sub"] - }, - "image/vnd.dwg": { - "source": "iana", - "extensions": ["dwg"] - }, - "image/vnd.dxf": { - "source": "iana", - "extensions": ["dxf"] - }, - "image/vnd.fastbidsheet": { - "source": "iana", - "extensions": ["fbs"] - }, - "image/vnd.fpx": { - "source": "iana", - "extensions": ["fpx"] - }, - "image/vnd.fst": { - "source": "iana", - "extensions": ["fst"] - }, - "image/vnd.fujixerox.edmics-mmr": { - "source": "iana", - "extensions": ["mmr"] - }, - "image/vnd.fujixerox.edmics-rlc": { - "source": "iana", - "extensions": ["rlc"] - }, - "image/vnd.globalgraphics.pgb": { - "source": "iana" - }, - "image/vnd.microsoft.icon": { - "source": "iana" - }, - "image/vnd.mix": { - "source": "iana" - }, - "image/vnd.mozilla.apng": { - "source": "iana" - }, - "image/vnd.ms-modi": { - "source": "iana", - "extensions": ["mdi"] - }, - "image/vnd.ms-photo": { - "source": "apache", - "extensions": ["wdp"] - }, - "image/vnd.net-fpx": { - "source": "iana", - "extensions": ["npx"] - }, - "image/vnd.radiance": { - "source": "iana" - }, - "image/vnd.sealed.png": { - "source": "iana" - }, - "image/vnd.sealedmedia.softseal.gif": { - "source": "iana" - }, - "image/vnd.sealedmedia.softseal.jpg": { - "source": "iana" - }, - "image/vnd.svf": { - "source": "iana" - }, - "image/vnd.tencent.tap": { - "source": "iana" - }, - "image/vnd.valve.source.texture": { - "source": "iana" - }, - "image/vnd.wap.wbmp": { - "source": "iana", - "extensions": ["wbmp"] - }, - "image/vnd.xiff": { - "source": "iana", - "extensions": ["xif"] - }, - "image/vnd.zbrush.pcx": { - "source": "iana" - }, - "image/webp": { - "source": "apache", - "extensions": ["webp"] - }, - "image/x-3ds": { - "source": "apache", - "extensions": ["3ds"] - }, - "image/x-cmu-raster": { - "source": "apache", - "extensions": ["ras"] - }, - "image/x-cmx": { - "source": "apache", - "extensions": ["cmx"] - }, - "image/x-freehand": { - "source": "apache", - "extensions": ["fh","fhc","fh4","fh5","fh7"] - }, - "image/x-icon": { - "source": "apache", - "compressible": true, - "extensions": ["ico"] - }, - "image/x-jng": { - "source": "nginx", - "extensions": ["jng"] - }, - "image/x-mrsid-image": { - "source": "apache", - "extensions": ["sid"] - }, - "image/x-ms-bmp": { - "source": "nginx", - "compressible": true, - "extensions": ["bmp"] - }, - "image/x-pcx": { - "source": "apache", - "extensions": ["pcx"] - }, - "image/x-pict": { - "source": "apache", - "extensions": ["pic","pct"] - }, - "image/x-portable-anymap": { - "source": "apache", - "extensions": ["pnm"] - }, - "image/x-portable-bitmap": { - "source": "apache", - "extensions": ["pbm"] - }, - "image/x-portable-graymap": { - "source": "apache", - "extensions": ["pgm"] - }, - "image/x-portable-pixmap": { - "source": "apache", - "extensions": ["ppm"] - }, - "image/x-rgb": { - "source": "apache", - "extensions": ["rgb"] - }, - "image/x-tga": { - "source": "apache", - "extensions": ["tga"] - }, - "image/x-xbitmap": { - "source": "apache", - "extensions": ["xbm"] - }, - "image/x-xcf": { - "compressible": false - }, - "image/x-xpixmap": { - "source": "apache", - "extensions": ["xpm"] - }, - "image/x-xwindowdump": { - "source": "apache", - "extensions": ["xwd"] - }, - "message/cpim": { - "source": "iana" - }, - "message/delivery-status": { - "source": "iana" - }, - "message/disposition-notification": { - "source": "iana" - }, - "message/external-body": { - "source": "iana" - }, - "message/feedback-report": { - "source": "iana" - }, - "message/global": { - "source": "iana" - }, - "message/global-delivery-status": { - "source": "iana" - }, - "message/global-disposition-notification": { - "source": "iana" - }, - "message/global-headers": { - "source": "iana" - }, - "message/http": { - "source": "iana", - "compressible": false - }, - "message/imdn+xml": { - "source": "iana", - "compressible": true - }, - "message/news": { - "source": "iana" - }, - "message/partial": { - "source": "iana", - "compressible": false - }, - "message/rfc822": { - "source": "iana", - "compressible": true, - "extensions": ["eml","mime"] - }, - "message/s-http": { - "source": "iana" - }, - "message/sip": { - "source": "iana" - }, - "message/sipfrag": { - "source": "iana" - }, - "message/tracking-status": { - "source": "iana" - }, - "message/vnd.si.simp": { - "source": "iana" - }, - "message/vnd.wfa.wsc": { - "source": "iana" - }, - "model/iges": { - "source": "iana", - "compressible": false, - "extensions": ["igs","iges"] - }, - "model/mesh": { - "source": "iana", - "compressible": false, - "extensions": ["msh","mesh","silo"] - }, - "model/vnd.collada+xml": { - "source": "iana", - "extensions": ["dae"] - }, - "model/vnd.dwf": { - "source": "iana", - "extensions": ["dwf"] - }, - "model/vnd.flatland.3dml": { - "source": "iana" - }, - "model/vnd.gdl": { - "source": "iana", - "extensions": ["gdl"] - }, - "model/vnd.gs-gdl": { - "source": "apache" - }, - "model/vnd.gs.gdl": { - "source": "iana" - }, - "model/vnd.gtw": { - "source": "iana", - "extensions": ["gtw"] - }, - "model/vnd.moml+xml": { - "source": "iana" - }, - "model/vnd.mts": { - "source": "iana", - "extensions": ["mts"] - }, - "model/vnd.opengex": { - "source": "iana" - }, - "model/vnd.parasolid.transmit.binary": { - "source": "iana" - }, - "model/vnd.parasolid.transmit.text": { - "source": "iana" - }, - "model/vnd.rosette.annotated-data-model": { - "source": "iana" - }, - "model/vnd.valve.source.compiled-map": { - "source": "iana" - }, - "model/vnd.vtu": { - "source": "iana", - "extensions": ["vtu"] - }, - "model/vrml": { - "source": "iana", - "compressible": false, - "extensions": ["wrl","vrml"] - }, - "model/x3d+binary": { - "source": "apache", - "compressible": false, - "extensions": ["x3db","x3dbz"] - }, - "model/x3d+fastinfoset": { - "source": "iana" - }, - "model/x3d+vrml": { - "source": "apache", - "compressible": false, - "extensions": ["x3dv","x3dvz"] - }, - "model/x3d+xml": { - "source": "iana", - "compressible": true, - "extensions": ["x3d","x3dz"] - }, - "model/x3d-vrml": { - "source": "iana" - }, - "multipart/alternative": { - "source": "iana", - "compressible": false - }, - "multipart/appledouble": { - "source": "iana" - }, - "multipart/byteranges": { - "source": "iana" - }, - "multipart/digest": { - "source": "iana" - }, - "multipart/encrypted": { - "source": "iana", - "compressible": false - }, - "multipart/form-data": { - "source": "iana", - "compressible": false - }, - "multipart/header-set": { - "source": "iana" - }, - "multipart/mixed": { - "source": "iana", - "compressible": false - }, - "multipart/parallel": { - "source": "iana" - }, - "multipart/related": { - "source": "iana", - "compressible": false - }, - "multipart/report": { - "source": "iana" - }, - "multipart/signed": { - "source": "iana", - "compressible": false - }, - "multipart/voice-message": { - "source": "iana" - }, - "multipart/x-mixed-replace": { - "source": "iana" - }, - "text/1d-interleaved-parityfec": { - "source": "iana" - }, - "text/cache-manifest": { - "source": "iana", - "compressible": true, - "extensions": ["appcache","manifest"] - }, - "text/calendar": { - "source": "iana", - "extensions": ["ics","ifb"] - }, - "text/calender": { - "compressible": true - }, - "text/cmd": { - "compressible": true - }, - "text/coffeescript": { - "extensions": ["coffee","litcoffee"] - }, - "text/css": { - "source": "iana", - "compressible": true, - "extensions": ["css"] - }, - "text/csv": { - "source": "iana", - "compressible": true, - "extensions": ["csv"] - }, - "text/csv-schema": { - "source": "iana" - }, - "text/directory": { - "source": "iana" - }, - "text/dns": { - "source": "iana" - }, - "text/ecmascript": { - "source": "iana" - }, - "text/encaprtp": { - "source": "iana" - }, - "text/enriched": { - "source": "iana" - }, - "text/fwdred": { - "source": "iana" - }, - "text/grammar-ref-list": { - "source": "iana" - }, - "text/hjson": { - "extensions": ["hjson"] - }, - "text/html": { - "source": "iana", - "compressible": true, - "extensions": ["html","htm","shtml"] - }, - "text/jade": { - "extensions": ["jade"] - }, - "text/javascript": { - "source": "iana", - "compressible": true - }, - "text/jcr-cnd": { - "source": "iana" - }, - "text/jsx": { - "compressible": true, - "extensions": ["jsx"] - }, - "text/less": { - "extensions": ["less"] - }, - "text/markdown": { - "source": "iana" - }, - "text/mathml": { - "source": "nginx", - "extensions": ["mml"] - }, - "text/mizar": { - "source": "iana" - }, - "text/n3": { - "source": "iana", - "compressible": true, - "extensions": ["n3"] - }, - "text/parameters": { - "source": "iana" - }, - "text/parityfec": { - "source": "iana" - }, - "text/plain": { - "source": "iana", - "compressible": true, - "extensions": ["txt","text","conf","def","list","log","in","ini"] - }, - "text/provenance-notation": { - "source": "iana" - }, - "text/prs.fallenstein.rst": { - "source": "iana" - }, - "text/prs.lines.tag": { - "source": "iana", - "extensions": ["dsc"] - }, - "text/prs.prop.logic": { - "source": "iana" - }, - "text/raptorfec": { - "source": "iana" - }, - "text/red": { - "source": "iana" - }, - "text/rfc822-headers": { - "source": "iana" - }, - "text/richtext": { - "source": "iana", - "compressible": true, - "extensions": ["rtx"] - }, - "text/rtf": { - "source": "iana", - "compressible": true, - "extensions": ["rtf"] - }, - "text/rtp-enc-aescm128": { - "source": "iana" - }, - "text/rtploopback": { - "source": "iana" - }, - "text/rtx": { - "source": "iana" - }, - "text/sgml": { - "source": "iana", - "extensions": ["sgml","sgm"] - }, - "text/slim": { - "extensions": ["slim","slm"] - }, - "text/stylus": { - "extensions": ["stylus","styl"] - }, - "text/t140": { - "source": "iana" - }, - "text/tab-separated-values": { - "source": "iana", - "compressible": true, - "extensions": ["tsv"] - }, - "text/troff": { - "source": "iana", - "extensions": ["t","tr","roff","man","me","ms"] - }, - "text/turtle": { - "source": "iana", - "extensions": ["ttl"] - }, - "text/ulpfec": { - "source": "iana" - }, - "text/uri-list": { - "source": "iana", - "compressible": true, - "extensions": ["uri","uris","urls"] - }, - "text/vcard": { - "source": "iana", - "compressible": true, - "extensions": ["vcard"] - }, - "text/vnd.a": { - "source": "iana" - }, - "text/vnd.abc": { - "source": "iana" - }, - "text/vnd.curl": { - "source": "iana", - "extensions": ["curl"] - }, - "text/vnd.curl.dcurl": { - "source": "apache", - "extensions": ["dcurl"] - }, - "text/vnd.curl.mcurl": { - "source": "apache", - "extensions": ["mcurl"] - }, - "text/vnd.curl.scurl": { - "source": "apache", - "extensions": ["scurl"] - }, - "text/vnd.debian.copyright": { - "source": "iana" - }, - "text/vnd.dmclientscript": { - "source": "iana" - }, - "text/vnd.dvb.subtitle": { - "source": "iana", - "extensions": ["sub"] - }, - "text/vnd.esmertec.theme-descriptor": { - "source": "iana" - }, - "text/vnd.fly": { - "source": "iana", - "extensions": ["fly"] - }, - "text/vnd.fmi.flexstor": { - "source": "iana", - "extensions": ["flx"] - }, - "text/vnd.graphviz": { - "source": "iana", - "extensions": ["gv"] - }, - "text/vnd.in3d.3dml": { - "source": "iana", - "extensions": ["3dml"] - }, - "text/vnd.in3d.spot": { - "source": "iana", - "extensions": ["spot"] - }, - "text/vnd.iptc.newsml": { - "source": "iana" - }, - "text/vnd.iptc.nitf": { - "source": "iana" - }, - "text/vnd.latex-z": { - "source": "iana" - }, - "text/vnd.motorola.reflex": { - "source": "iana" - }, - "text/vnd.ms-mediapackage": { - "source": "iana" - }, - "text/vnd.net2phone.commcenter.command": { - "source": "iana" - }, - "text/vnd.radisys.msml-basic-layout": { - "source": "iana" - }, - "text/vnd.si.uricatalogue": { - "source": "iana" - }, - "text/vnd.sun.j2me.app-descriptor": { - "source": "iana", - "extensions": ["jad"] - }, - "text/vnd.trolltech.linguist": { - "source": "iana" - }, - "text/vnd.wap.si": { - "source": "iana" - }, - "text/vnd.wap.sl": { - "source": "iana" - }, - "text/vnd.wap.wml": { - "source": "iana", - "extensions": ["wml"] - }, - "text/vnd.wap.wmlscript": { - "source": "iana", - "extensions": ["wmls"] - }, - "text/vtt": { - "charset": "UTF-8", - "compressible": true, - "extensions": ["vtt"] - }, - "text/x-asm": { - "source": "apache", - "extensions": ["s","asm"] - }, - "text/x-c": { - "source": "apache", - "extensions": ["c","cc","cxx","cpp","h","hh","dic"] - }, - "text/x-component": { - "source": "nginx", - "extensions": ["htc"] - }, - "text/x-fortran": { - "source": "apache", - "extensions": ["f","for","f77","f90"] - }, - "text/x-gwt-rpc": { - "compressible": true - }, - "text/x-handlebars-template": { - "extensions": ["hbs"] - }, - "text/x-java-source": { - "source": "apache", - "extensions": ["java"] - }, - "text/x-jquery-tmpl": { - "compressible": true - }, - "text/x-lua": { - "extensions": ["lua"] - }, - "text/x-markdown": { - "compressible": true, - "extensions": ["markdown","md","mkd"] - }, - "text/x-nfo": { - "source": "apache", - "extensions": ["nfo"] - }, - "text/x-opml": { - "source": "apache", - "extensions": ["opml"] - }, - "text/x-pascal": { - "source": "apache", - "extensions": ["p","pas"] - }, - "text/x-processing": { - "compressible": true, - "extensions": ["pde"] - }, - "text/x-sass": { - "extensions": ["sass"] - }, - "text/x-scss": { - "extensions": ["scss"] - }, - "text/x-setext": { - "source": "apache", - "extensions": ["etx"] - }, - "text/x-sfv": { - "source": "apache", - "extensions": ["sfv"] - }, - "text/x-suse-ymp": { - "compressible": true, - "extensions": ["ymp"] - }, - "text/x-uuencode": { - "source": "apache", - "extensions": ["uu"] - }, - "text/x-vcalendar": { - "source": "apache", - "extensions": ["vcs"] - }, - "text/x-vcard": { - "source": "apache", - "extensions": ["vcf"] - }, - "text/xml": { - "source": "iana", - "compressible": true, - "extensions": ["xml"] - }, - "text/xml-external-parsed-entity": { - "source": "iana" - }, - "text/yaml": { - "extensions": ["yaml","yml"] - }, - "video/1d-interleaved-parityfec": { - "source": "apache" - }, - "video/3gpp": { - "source": "apache", - "extensions": ["3gp","3gpp"] - }, - "video/3gpp-tt": { - "source": "apache" - }, - "video/3gpp2": { - "source": "apache", - "extensions": ["3g2"] - }, - "video/bmpeg": { - "source": "apache" - }, - "video/bt656": { - "source": "apache" - }, - "video/celb": { - "source": "apache" - }, - "video/dv": { - "source": "apache" - }, - "video/encaprtp": { - "source": "apache" - }, - "video/h261": { - "source": "apache", - "extensions": ["h261"] - }, - "video/h263": { - "source": "apache", - "extensions": ["h263"] - }, - "video/h263-1998": { - "source": "apache" - }, - "video/h263-2000": { - "source": "apache" - }, - "video/h264": { - "source": "apache", - "extensions": ["h264"] - }, - "video/h264-rcdo": { - "source": "apache" - }, - "video/h264-svc": { - "source": "apache" - }, - "video/h265": { - "source": "apache" - }, - "video/iso.segment": { - "source": "apache" - }, - "video/jpeg": { - "source": "apache", - "extensions": ["jpgv"] - }, - "video/jpeg2000": { - "source": "apache" - }, - "video/jpm": { - "source": "apache", - "extensions": ["jpm","jpgm"] - }, - "video/mj2": { - "source": "apache", - "extensions": ["mj2","mjp2"] - }, - "video/mp1s": { - "source": "apache" - }, - "video/mp2p": { - "source": "apache" - }, - "video/mp2t": { - "source": "apache", - "extensions": ["ts"] - }, - "video/mp4": { - "source": "apache", - "compressible": false, - "extensions": ["mp4","mp4v","mpg4"] - }, - "video/mp4v-es": { - "source": "apache" - }, - "video/mpeg": { - "source": "apache", - "compressible": false, - "extensions": ["mpeg","mpg","mpe","m1v","m2v"] - }, - "video/mpeg4-generic": { - "source": "apache" - }, - "video/mpv": { - "source": "apache" - }, - "video/nv": { - "source": "apache" - }, - "video/ogg": { - "source": "apache", - "compressible": false, - "extensions": ["ogv"] - }, - "video/parityfec": { - "source": "apache" - }, - "video/pointer": { - "source": "apache" - }, - "video/quicktime": { - "source": "apache", - "compressible": false, - "extensions": ["qt","mov"] - }, - "video/raptorfec": { - "source": "apache" - }, - "video/raw": { - "source": "apache" - }, - "video/rtp-enc-aescm128": { - "source": "apache" - }, - "video/rtploopback": { - "source": "apache" - }, - "video/rtx": { - "source": "apache" - }, - "video/smpte292m": { - "source": "apache" - }, - "video/ulpfec": { - "source": "apache" - }, - "video/vc1": { - "source": "apache" - }, - "video/vnd.cctv": { - "source": "apache" - }, - "video/vnd.dece.hd": { - "source": "apache", - "extensions": ["uvh","uvvh"] - }, - "video/vnd.dece.mobile": { - "source": "apache", - "extensions": ["uvm","uvvm"] - }, - "video/vnd.dece.mp4": { - "source": "apache" - }, - "video/vnd.dece.pd": { - "source": "apache", - "extensions": ["uvp","uvvp"] - }, - "video/vnd.dece.sd": { - "source": "apache", - "extensions": ["uvs","uvvs"] - }, - "video/vnd.dece.video": { - "source": "apache", - "extensions": ["uvv","uvvv"] - }, - "video/vnd.directv.mpeg": { - "source": "apache" - }, - "video/vnd.directv.mpeg-tts": { - "source": "apache" - }, - "video/vnd.dlna.mpeg-tts": { - "source": "apache" - }, - "video/vnd.dvb.file": { - "source": "apache", - "extensions": ["dvb"] - }, - "video/vnd.fvt": { - "source": "apache", - "extensions": ["fvt"] - }, - "video/vnd.hns.video": { - "source": "apache" - }, - "video/vnd.iptvforum.1dparityfec-1010": { - "source": "apache" - }, - "video/vnd.iptvforum.1dparityfec-2005": { - "source": "apache" - }, - "video/vnd.iptvforum.2dparityfec-1010": { - "source": "apache" - }, - "video/vnd.iptvforum.2dparityfec-2005": { - "source": "apache" - }, - "video/vnd.iptvforum.ttsavc": { - "source": "apache" - }, - "video/vnd.iptvforum.ttsmpeg2": { - "source": "apache" - }, - "video/vnd.motorola.video": { - "source": "apache" - }, - "video/vnd.motorola.videop": { - "source": "apache" - }, - "video/vnd.mpegurl": { - "source": "apache", - "extensions": ["mxu","m4u"] - }, - "video/vnd.ms-playready.media.pyv": { - "source": "apache", - "extensions": ["pyv"] - }, - "video/vnd.nokia.interleaved-multimedia": { - "source": "apache" - }, - "video/vnd.nokia.videovoip": { - "source": "apache" - }, - "video/vnd.objectvideo": { - "source": "apache" - }, - "video/vnd.radgamettools.bink": { - "source": "apache" - }, - "video/vnd.radgamettools.smacker": { - "source": "apache" - }, - "video/vnd.sealed.mpeg1": { - "source": "apache" - }, - "video/vnd.sealed.mpeg4": { - "source": "apache" - }, - "video/vnd.sealed.swf": { - "source": "apache" - }, - "video/vnd.sealedmedia.softseal.mov": { - "source": "apache" - }, - "video/vnd.uvvu.mp4": { - "source": "apache", - "extensions": ["uvu","uvvu"] - }, - "video/vnd.vivo": { - "source": "apache", - "extensions": ["viv"] - }, - "video/vp8": { - "source": "apache" - }, - "video/webm": { - "source": "apache", - "compressible": false, - "extensions": ["webm"] - }, - "video/x-f4v": { - "source": "apache", - "extensions": ["f4v"] - }, - "video/x-fli": { - "source": "apache", - "extensions": ["fli"] - }, - "video/x-flv": { - "source": "apache", - "compressible": false, - "extensions": ["flv"] - }, - "video/x-m4v": { - "source": "apache", - "extensions": ["m4v"] - }, - "video/x-matroska": { - "source": "apache", - "compressible": false, - "extensions": ["mkv","mk3d","mks"] - }, - "video/x-mng": { - "source": "apache", - "extensions": ["mng"] - }, - "video/x-ms-asf": { - "source": "apache", - "extensions": ["asf","asx"] - }, - "video/x-ms-vob": { - "source": "apache", - "extensions": ["vob"] - }, - "video/x-ms-wm": { - "source": "apache", - "extensions": ["wm"] - }, - "video/x-ms-wmv": { - "source": "apache", - "compressible": false, - "extensions": ["wmv"] - }, - "video/x-ms-wmx": { - "source": "apache", - "extensions": ["wmx"] - }, - "video/x-ms-wvx": { - "source": "apache", - "extensions": ["wvx"] - }, - "video/x-msvideo": { - "source": "apache", - "extensions": ["avi"] - }, - "video/x-sgi-movie": { - "source": "apache", - "extensions": ["movie"] - }, - "video/x-smv": { - "source": "apache", - "extensions": ["smv"] - }, - "x-conference/x-cooltalk": { - "source": "apache", - "extensions": ["ice"] - }, - "x-shader/x-fragment": { - "compressible": true - }, - "x-shader/x-vertex": { - "compressible": true - } -} diff --git a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/index.js b/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/index.js deleted file mode 100644 index 551031f6..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/index.js +++ /dev/null @@ -1,11 +0,0 @@ -/*! - * mime-db - * Copyright(c) 2014 Jonathan Ong - * MIT Licensed - */ - -/** - * Module exports. - */ - -module.exports = require('./db.json') diff --git a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json b/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json deleted file mode 100644 index 765311ec..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/node_modules/mime-db/package.json +++ /dev/null @@ -1,98 +0,0 @@ -{ - "name": "mime-db", - "description": "Media Type Database", - "version": "1.23.0", - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - }, - { - "name": "Robert Kieffer", - "email": "robert@broofa.com", - "url": "http://github.com/broofa" - } - ], - "license": "MIT", - "keywords": [ - "mime", - "db", - "type", - "types", - "database", - "charset", - "charsets" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/jshttp/mime-db.git" - }, - "devDependencies": { - "bluebird": "3.3.5", - "co": "4.6.0", - "cogent": "1.0.1", - "csv-parse": "1.1.0", - "gnode": "0.1.2", - "istanbul": "0.4.3", - "mocha": "1.21.5", - "raw-body": "2.1.6", - "stream-to-array": "2.3.0" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "README.md", - "db.json", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "build": "node scripts/build", - "fetch": "gnode scripts/fetch-apache && gnode scripts/fetch-iana && gnode scripts/fetch-nginx", - "test": "mocha --reporter spec --bail --check-leaks test/", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/", - "update": "npm run fetch && npm run build" - }, - "gitHead": "ba0d99fd05b3bfdc2ebcd78f858c25cb7db6af41", - "bugs": { - "url": "https://github.com/jshttp/mime-db/issues" - }, - "homepage": "https://github.com/jshttp/mime-db#readme", - "_id": "mime-db@1.23.0", - "_shasum": "a31b4070adaea27d732ea333740a64d0ec9a6659", - "_from": "mime-db@~1.23.0", - "_npmVersion": "2.15.1", - "_nodeVersion": "4.4.3", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "dist": { - "shasum": "a31b4070adaea27d732ea333740a64d0ec9a6659", - "tarball": "https://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/mime-db-1.23.0.tgz_1462163798086_0.43938886746764183" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.23.0.tgz" -} diff --git a/APIs/node_modules/request/node_modules/mime-types/package.json b/APIs/node_modules/request/node_modules/mime-types/package.json deleted file mode 100644 index 2fb8d17a..00000000 --- a/APIs/node_modules/request/node_modules/mime-types/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "mime-types", - "description": "The ultimate javascript content-type utility.", - "version": "2.1.11", - "contributors": [ - { - "name": "Douglas Christopher Wilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "Jeremiah Senkpiel", - "email": "fishrock123@rocketmail.com", - "url": "https://searchbeam.jit.su" - }, - { - "name": "Jonathan Ong", - "email": "me@jongleberry.com", - "url": "http://jongleberry.com" - } - ], - "license": "MIT", - "keywords": [ - "mime", - "types" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/jshttp/mime-types.git" - }, - "dependencies": { - "mime-db": "~1.23.0" - }, - "devDependencies": { - "istanbul": "0.4.3", - "mocha": "1.21.5" - }, - "files": [ - "HISTORY.md", - "LICENSE", - "index.js" - ], - "engines": { - "node": ">= 0.6" - }, - "scripts": { - "test": "mocha --reporter spec test/test.js", - "test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot test/test.js", - "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot test/test.js" - }, - "gitHead": "298ffcf490a5d6e60edea7bf7a69036df04846b1", - "bugs": { - "url": "https://github.com/jshttp/mime-types/issues" - }, - "homepage": "https://github.com/jshttp/mime-types#readme", - "_id": "mime-types@2.1.11", - "_shasum": "c259c471bda808a85d6cd193b430a5fae4473b3c", - "_from": "mime-types@~2.1.7", - "_npmVersion": "2.15.1", - "_nodeVersion": "4.4.3", - "_npmUser": { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - "dist": { - "shasum": "c259c471bda808a85d6cd193b430a5fae4473b3c", - "tarball": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz" - }, - "maintainers": [ - { - "name": "dougwilson", - "email": "doug@somethingdoug.com" - }, - { - "name": "fishrock123", - "email": "fishrock123@rocketmail.com" - }, - { - "name": "jongleberry", - "email": "jonathanrichardong@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/mime-types-2.1.11.tgz_1462165365027_0.7217204745393246" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.11.tgz" -} diff --git a/APIs/node_modules/request/node_modules/node-uuid/.npmignore b/APIs/node_modules/request/node_modules/node-uuid/.npmignore deleted file mode 100644 index 88861393..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -.DS_Store -.nyc_output -coverage diff --git a/APIs/node_modules/request/node_modules/node-uuid/LICENSE.md b/APIs/node_modules/request/node_modules/node-uuid/LICENSE.md deleted file mode 100644 index 652609b3..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/LICENSE.md +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2010-2012 Robert Kieffer - -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/APIs/node_modules/request/node_modules/node-uuid/README.md b/APIs/node_modules/request/node_modules/node-uuid/README.md deleted file mode 100644 index 5cd85550..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/README.md +++ /dev/null @@ -1,254 +0,0 @@ -# node-uuid - -Simple, fast generation of [RFC4122](http://www.ietf.org/rfc/rfc4122.txt) UUIDS. - -Features: - -* Generate RFC4122 version 1 or version 4 UUIDs -* Runs in node.js and all browsers. -* Registered as a [ComponentJS](https://github.com/component/component) [component](https://github.com/component/component/wiki/Components) ('broofa/node-uuid'). -* Cryptographically strong random # generation - * `crypto.randomBytes(n)` in node.js - * `window.crypto.getRandomValues(ta)` in [supported browsers](https://developer.mozilla.org/en-US/docs/Web/API/RandomSource/getRandomValues#Browser_Compatibility) -* 1.1K minified and gzip'ed (Want something smaller? Check this [crazy shit](https://gist.github.com/982883) out! ) -* [Annotated source code](http://broofa.github.com/node-uuid/docs/uuid.html) -* Comes with a Command Line Interface for generating uuids on the command line - -## Getting Started - -Install it in your browser: - -```html - -``` - -Or in node.js: - -``` -npm install node-uuid -``` - -```javascript -var uuid = require('node-uuid'); -``` - -Then create some ids ... - -```javascript -// Generate a v1 (time-based) id -uuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' - -// Generate a v4 (random) id -uuid.v4(); // -> '110ec58a-a0f2-4ac4-8393-c866d813b8d1' -``` - -## API - -### uuid.v1([`options` [, `buffer` [, `offset`]]]) - -Generate and return a RFC4122 v1 (timestamp-based) UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - - * `node` - (Array) Node id as Array of 6 bytes (per 4.1.6). Default: Randomly generated ID. See note 1. - * `clockseq` - (Number between 0 - 0x3fff) RFC clock sequence. Default: An internally maintained clockseq is used. - * `msecs` - (Number | Date) Time in milliseconds since unix Epoch. Default: The current time is used. - * `nsecs` - (Number between 0-9999) additional time, in 100-nanosecond units. Ignored if `msecs` is unspecified. Default: internal uuid counter is used, as per 4.2.1.2. - -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Notes: - -1. The randomly generated node id is only guaranteed to stay constant for the lifetime of the current JS runtime. (Future versions of this module may use persistent storage mechanisms to extend this guarantee.) - -Example: Generate string UUID with fully-specified options - -```javascript -uuid.v1({ - node: [0x01, 0x23, 0x45, 0x67, 0x89, 0xab], - clockseq: 0x1234, - msecs: new Date('2011-11-01').getTime(), - nsecs: 5678 -}); // -> "710b962e-041c-11e1-9234-0123456789ab" -``` - -Example: In-place generation of two binary IDs - -```javascript -// Generate two ids in an array -var arr = new Array(32); // -> [] -uuid.v1(null, arr, 0); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15] -uuid.v1(null, arr, 16); // -> [02 a2 ce 90 14 32 11 e1 85 58 0b 48 8e 4f c1 15 02 a3 1c b0 14 32 11 e1 85 58 0b 48 8e 4f c1 15] - -// Optionally use uuid.unparse() to get stringify the ids -uuid.unparse(buffer); // -> '02a2ce90-1432-11e1-8558-0b488e4fc115' -uuid.unparse(buffer, 16) // -> '02a31cb0-1432-11e1-8558-0b488e4fc115' -``` - -### uuid.v4([`options` [, `buffer` [, `offset`]]]) - -Generate and return a RFC4122 v4 UUID. - -* `options` - (Object) Optional uuid state to apply. Properties may include: - - * `random` - (Number[16]) Array of 16 numbers (0-255) to use in place of randomly generated values - * `rng` - (Function) Random # generator to use. Set to one of the built-in generators - `uuid.mathRNG` (all platforms), `uuid.nodeRNG` (node.js only), `uuid.whatwgRNG` (WebKit only) - or a custom function that returns an array[16] of byte values. - -* `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. -* `offset` - (Number) Starting index in `buffer` at which to begin writing. - -Returns `buffer`, if specified, otherwise the string form of the UUID - -Example: Generate string UUID with fully-specified options - -```javascript -uuid.v4({ - random: [ - 0x10, 0x91, 0x56, 0xbe, 0xc4, 0xfb, 0xc1, 0xea, - 0x71, 0xb4, 0xef, 0xe1, 0x67, 0x1c, 0x58, 0x36 - ] -}); -// -> "109156be-c4fb-41ea-b1b4-efe1671c5836" -``` - -Example: Generate two IDs in a single buffer - -```javascript -var buffer = new Array(32); // (or 'new Buffer' in node.js) -uuid.v4(null, buffer, 0); -uuid.v4(null, buffer, 16); -``` - -### uuid.parse(id[, buffer[, offset]]) -### uuid.unparse(buffer[, offset]) - -Parse and unparse UUIDs - - * `id` - (String) UUID(-like) string - * `buffer` - (Array | Buffer) Array or buffer where UUID bytes are to be written. Default: A new Array or Buffer is used - * `offset` - (Number) Starting index in `buffer` at which to begin writing. Default: 0 - -Example parsing and unparsing a UUID string - -```javascript -var bytes = uuid.parse('797ff043-11eb-11e1-80d6-510998755d10'); // -> -var string = uuid.unparse(bytes); // -> '797ff043-11eb-11e1-80d6-510998755d10' -``` - -### uuid.noConflict() - -(Browsers only) Set `uuid` property back to it's previous value. - -Returns the node-uuid object. - -Example: - -```javascript -var myUuid = uuid.noConflict(); -myUuid.v1(); // -> '6c84fb90-12c4-11e1-840d-7b25c5ee775a' -``` - -## Deprecated APIs - -Support for the following v1.2 APIs is available in v1.3, but is deprecated and will be removed in the next major version. - -### uuid([format [, buffer [, offset]]]) - -uuid() has become uuid.v4(), and the `format` argument is now implicit in the `buffer` argument. (i.e. if you specify a buffer, the format is assumed to be binary). - -### uuid.BufferClass - -The class of container created when generating binary uuid data if no buffer argument is specified. This is expected to go away, with no replacement API. - -## Command Line Interface - -To use the executable, it's probably best to install this library globally. - -`npm install -g node-uuid` - -Usage: - -``` -USAGE: uuid [version] [options] - - -options: - ---help Display this message and exit -``` - -`version` must be an RFC4122 version that is supported by this library, which is currently version 1 and version 4 (denoted by "v1" and "v4", respectively). `version` defaults to version 4 when not supplied. - -### Examples - -``` -> uuid -3a91f950-dec8-4688-ba14-5b7bbfc7a563 -``` - -``` -> uuid v1 -9d0b43e0-7696-11e3-964b-250efa37a98e -``` - -``` -> uuid v4 -6790ac7c-24ac-4f98-8464-42f6d98a53ae -``` - -## Testing - -In node.js - -``` -npm test -``` - -In Browser - -``` -open test/test.html -``` - -### Benchmarking - -Requires node.js - -``` -npm install uuid uuid-js -node benchmark/benchmark.js -``` - -For a more complete discussion of node-uuid performance, please see the `benchmark/README.md` file, and the [benchmark wiki](https://github.com/broofa/node-uuid/wiki/Benchmark) - -For browser performance [checkout the JSPerf tests](http://jsperf.com/node-uuid-performance). - -## Release notes - -### 1.4.6 - -* Properly detect node crypto and whatwg crypto -* Workaround phantomjs/browserify bug -* Explicit check for `window` rather implicit this-global -* Issue warning if Math.random() is being used -* "use strict"; -* A few jshint / stylistic updates (=== and such) - -### 1.4.0 - -* Improved module context detection -* Removed public RNG functions - -### 1.3.2 - -* Improve tests and handling of v1() options (Issue #24) -* Expose RNG option to allow for perf testing with different generators - -### 1.3.0 - -* Support for version 1 ids, thanks to [@ctavan](https://github.com/ctavan)! -* Support for node.js crypto API -* De-emphasizing performance in favor of a) cryptographic quality PRNGs where available and b) more manageable code diff --git a/APIs/node_modules/request/node_modules/node-uuid/benchmark/README.md b/APIs/node_modules/request/node_modules/node-uuid/benchmark/README.md deleted file mode 100644 index aaeb2ea0..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/benchmark/README.md +++ /dev/null @@ -1,53 +0,0 @@ -# node-uuid Benchmarks - -### Results - -To see the results of our benchmarks visit https://github.com/broofa/node-uuid/wiki/Benchmark - -### Run them yourself - -node-uuid comes with some benchmarks to measure performance of generating UUIDs. These can be run using node.js. node-uuid is being benchmarked against some other uuid modules, that are available through npm namely `uuid` and `uuid-js`. - -To prepare and run the benchmark issue; - -``` -npm install uuid uuid-js -node benchmark/benchmark.js -``` - -You'll see an output like this one: - -``` -# v4 -nodeuuid.v4(): 854700 uuids/second -nodeuuid.v4('binary'): 788643 uuids/second -nodeuuid.v4('binary', buffer): 1336898 uuids/second -uuid(): 479386 uuids/second -uuid('binary'): 582072 uuids/second -uuidjs.create(4): 312304 uuids/second - -# v1 -nodeuuid.v1(): 938086 uuids/second -nodeuuid.v1('binary'): 683060 uuids/second -nodeuuid.v1('binary', buffer): 1644736 uuids/second -uuidjs.create(1): 190621 uuids/second -``` - -* The `uuid()` entries are for Nikhil Marathe's [uuid module](https://bitbucket.org/nikhilm/uuidjs) which is a wrapper around the native libuuid library. -* The `uuidjs()` entries are for Patrick Negri's [uuid-js module](https://github.com/pnegri/uuid-js) which is a pure javascript implementation based on [UUID.js](https://github.com/LiosK/UUID.js) by LiosK. - -If you want to get more reliable results you can run the benchmark multiple times and write the output into a log file: - -``` -for i in {0..9}; do node benchmark/benchmark.js >> benchmark/bench_0.4.12.log; done; -``` - -If you're interested in how performance varies between different node versions, you can issue the above command multiple times. - -You can then use the shell script `bench.sh` provided in this directory to calculate the averages over all benchmark runs and draw a nice plot: - -``` -(cd benchmark/ && ./bench.sh) -``` - -This assumes you have [gnuplot](http://www.gnuplot.info/) and [ImageMagick](http://www.imagemagick.org/) installed. You'll find a nice `bench.png` graph in the `benchmark/` directory then. diff --git a/APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu b/APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu deleted file mode 100644 index a342fbbe..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.gnu +++ /dev/null @@ -1,174 +0,0 @@ -#!/opt/local/bin/gnuplot -persist -# -# -# G N U P L O T -# Version 4.4 patchlevel 3 -# last modified March 2011 -# System: Darwin 10.8.0 -# -# Copyright (C) 1986-1993, 1998, 2004, 2007-2010 -# Thomas Williams, Colin Kelley and many others -# -# gnuplot home: http://www.gnuplot.info -# faq, bugs, etc: type "help seeking-assistance" -# immediate help: type "help" -# plot window: hit 'h' -set terminal postscript eps noenhanced defaultplex \ - leveldefault color colortext \ - solid linewidth 1.2 butt noclip \ - palfuncparam 2000,0.003 \ - "Helvetica" 14 -set output 'bench.eps' -unset clip points -set clip one -unset clip two -set bar 1.000000 front -set border 31 front linetype -1 linewidth 1.000 -set xdata -set ydata -set zdata -set x2data -set y2data -set timefmt x "%d/%m/%y,%H:%M" -set timefmt y "%d/%m/%y,%H:%M" -set timefmt z "%d/%m/%y,%H:%M" -set timefmt x2 "%d/%m/%y,%H:%M" -set timefmt y2 "%d/%m/%y,%H:%M" -set timefmt cb "%d/%m/%y,%H:%M" -set boxwidth -set style fill empty border -set style rectangle back fc lt -3 fillstyle solid 1.00 border lt -1 -set style circle radius graph 0.02, first 0, 0 -set dummy x,y -set format x "% g" -set format y "% g" -set format x2 "% g" -set format y2 "% g" -set format z "% g" -set format cb "% g" -set angles radians -unset grid -set key title "" -set key outside left top horizontal Right noreverse enhanced autotitles columnhead nobox -set key noinvert samplen 4 spacing 1 width 0 height 0 -set key maxcolumns 2 maxrows 0 -unset label -unset arrow -set style increment default -unset style line -set style line 1 linetype 1 linewidth 2.000 pointtype 1 pointsize default pointinterval 0 -unset style arrow -set style histogram clustered gap 2 title offset character 0, 0, 0 -unset logscale -set offsets graph 0.05, 0.15, 0, 0 -set pointsize 1.5 -set pointintervalbox 1 -set encoding default -unset polar -unset parametric -unset decimalsign -set view 60, 30, 1, 1 -set samples 100, 100 -set isosamples 10, 10 -set surface -unset contour -set clabel '%8.3g' -set mapping cartesian -set datafile separator whitespace -unset hidden3d -set cntrparam order 4 -set cntrparam linear -set cntrparam levels auto 5 -set cntrparam points 5 -set size ratio 0 1,1 -set origin 0,0 -set style data points -set style function lines -set xzeroaxis linetype -2 linewidth 1.000 -set yzeroaxis linetype -2 linewidth 1.000 -set zzeroaxis linetype -2 linewidth 1.000 -set x2zeroaxis linetype -2 linewidth 1.000 -set y2zeroaxis linetype -2 linewidth 1.000 -set ticslevel 0.5 -set mxtics default -set mytics default -set mztics default -set mx2tics default -set my2tics default -set mcbtics default -set xtics border in scale 1,0.5 mirror norotate offset character 0, 0, 0 -set xtics norangelimit -set xtics () -set ytics border in scale 1,0.5 mirror norotate offset character 0, 0, 0 -set ytics autofreq norangelimit -set ztics border in scale 1,0.5 nomirror norotate offset character 0, 0, 0 -set ztics autofreq norangelimit -set nox2tics -set noy2tics -set cbtics border in scale 1,0.5 mirror norotate offset character 0, 0, 0 -set cbtics autofreq norangelimit -set title "" -set title offset character 0, 0, 0 font "" norotate -set timestamp bottom -set timestamp "" -set timestamp offset character 0, 0, 0 font "" norotate -set rrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] ) -set autoscale rfixmin -set autoscale rfixmax -set trange [ * : * ] noreverse nowriteback # (currently [-5.00000:5.00000] ) -set autoscale tfixmin -set autoscale tfixmax -set urange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) -set autoscale ufixmin -set autoscale ufixmax -set vrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) -set autoscale vfixmin -set autoscale vfixmax -set xlabel "" -set xlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate -set x2label "" -set x2label offset character 0, 0, 0 font "" textcolor lt -1 norotate -set xrange [ * : * ] noreverse nowriteback # (currently [-0.150000:3.15000] ) -set autoscale xfixmin -set autoscale xfixmax -set x2range [ * : * ] noreverse nowriteback # (currently [0.00000:3.00000] ) -set autoscale x2fixmin -set autoscale x2fixmax -set ylabel "" -set ylabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 -set y2label "" -set y2label offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 -set yrange [ 0.00000 : 1.90000e+06 ] noreverse nowriteback # (currently [:] ) -set autoscale yfixmin -set autoscale yfixmax -set y2range [ * : * ] noreverse nowriteback # (currently [0.00000:1.90000e+06] ) -set autoscale y2fixmin -set autoscale y2fixmax -set zlabel "" -set zlabel offset character 0, 0, 0 font "" textcolor lt -1 norotate -set zrange [ * : * ] noreverse nowriteback # (currently [-10.0000:10.0000] ) -set autoscale zfixmin -set autoscale zfixmax -set cblabel "" -set cblabel offset character 0, 0, 0 font "" textcolor lt -1 rotate by -270 -set cbrange [ * : * ] noreverse nowriteback # (currently [8.98847e+307:-8.98847e+307] ) -set autoscale cbfixmin -set autoscale cbfixmax -set zero 1e-08 -set lmargin -1 -set bmargin -1 -set rmargin -1 -set tmargin -1 -set pm3d explicit at s -set pm3d scansautomatic -set pm3d interpolate 1,1 flush begin noftriangles nohidden3d corners2color mean -set palette positive nops_allcF maxcolors 0 gamma 1.5 color model RGB -set palette rgbformulae 7, 5, 15 -set colorbox default -set colorbox vertical origin screen 0.9, 0.2, 0 size screen 0.05, 0.6, 0 front bdefault -set loadpath -set fontpath -set fit noerrorvariables -GNUTERM = "aqua" -plot 'bench_results.txt' using 2:xticlabel(1) w lp lw 2, '' using 3:xticlabel(1) w lp lw 2, '' using 4:xticlabel(1) w lp lw 2, '' using 5:xticlabel(1) w lp lw 2, '' using 6:xticlabel(1) w lp lw 2, '' using 7:xticlabel(1) w lp lw 2, '' using 8:xticlabel(1) w lp lw 2, '' using 9:xticlabel(1) w lp lw 2 -# EOF diff --git a/APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.sh b/APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.sh deleted file mode 100755 index d870a0cb..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/benchmark/bench.sh +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# for a given node version run: -# for i in {0..9}; do node benchmark.js >> bench_0.6.2.log; done; - -PATTERNS=('nodeuuid.v1()' "nodeuuid.v1('binary'," 'nodeuuid.v4()' "nodeuuid.v4('binary'," "uuid()" "uuid('binary')" 'uuidjs.create(1)' 'uuidjs.create(4)' '140byte') -FILES=(node_uuid_v1_string node_uuid_v1_buf node_uuid_v4_string node_uuid_v4_buf libuuid_v4_string libuuid_v4_binary uuidjs_v1_string uuidjs_v4_string 140byte_es) -INDICES=(2 3 2 3 2 2 2 2 2) -VERSIONS=$( ls bench_*.log | sed -e 's/^bench_\([0-9\.]*\)\.log/\1/' | tr "\\n" " " ) -TMPJOIN="tmp_join" -OUTPUT="bench_results.txt" - -for I in ${!FILES[*]}; do - F=${FILES[$I]} - P=${PATTERNS[$I]} - INDEX=${INDICES[$I]} - echo "version $F" > $F - for V in $VERSIONS; do - (VAL=$( grep "$P" bench_$V.log | LC_ALL=en_US awk '{ sum += $'$INDEX' } END { print sum/NR }' ); echo $V $VAL) >> $F - done - if [ $I == 0 ]; then - cat $F > $TMPJOIN - else - join $TMPJOIN $F > $OUTPUT - cp $OUTPUT $TMPJOIN - fi - rm $F -done - -rm $TMPJOIN - -gnuplot bench.gnu -convert -density 200 -resize 800x560 -flatten bench.eps bench.png -rm bench.eps diff --git a/APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c b/APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c deleted file mode 100644 index dbfc75f6..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark-native.c +++ /dev/null @@ -1,34 +0,0 @@ -/* -Test performance of native C UUID generation - -To Compile: cc -luuid benchmark-native.c -o benchmark-native -*/ - -#include -#include -#include -#include - -int main() { - uuid_t myid; - char buf[36+1]; - int i; - struct timeval t; - double start, finish; - - gettimeofday(&t, NULL); - start = t.tv_sec + t.tv_usec/1e6; - - int n = 2e5; - for (i = 0; i < n; i++) { - uuid_generate(myid); - uuid_unparse(myid, buf); - } - - gettimeofday(&t, NULL); - finish = t.tv_sec + t.tv_usec/1e6; - double dur = finish - start; - - printf("%d uuids/sec", (int)(n/dur)); - return 0; -} diff --git a/APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js b/APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js deleted file mode 100644 index 40e6efbe..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/benchmark/benchmark.js +++ /dev/null @@ -1,84 +0,0 @@ -try { - var nodeuuid = require('../uuid'); -} catch (e) { - console.error('node-uuid require failed - skipping tests'); -} - -try { - var uuid = require('uuid'); -} catch (e) { - console.error('uuid require failed - skipping tests'); -} - -try { - var uuidjs = require('uuid-js'); -} catch (e) { - console.error('uuid-js require failed - skipping tests'); -} - -var N = 5e5; - -function rate(msg, t) { - console.log(msg + ': ' + - (N / (Date.now() - t) * 1e3 | 0) + - ' uuids/second'); -} - -console.log('# v4'); - -// node-uuid - string form -if (nodeuuid) { - for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4(); - rate('nodeuuid.v4() - using node.js crypto RNG', t); - - for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4({rng: nodeuuid.mathRNG}); - rate('nodeuuid.v4() - using Math.random() RNG', t); - - for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary'); - rate('nodeuuid.v4(\'binary\')', t); - - var buffer = new nodeuuid.BufferClass(16); - for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v4('binary', buffer); - rate('nodeuuid.v4(\'binary\', buffer)', t); -} - -// libuuid - string form -if (uuid) { - for (var i = 0, t = Date.now(); i < N; i++) uuid(); - rate('uuid()', t); - - for (var i = 0, t = Date.now(); i < N; i++) uuid('binary'); - rate('uuid(\'binary\')', t); -} - -// uuid-js - string form -if (uuidjs) { - for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(4); - rate('uuidjs.create(4)', t); -} - -// 140byte.es -for (var i = 0, t = Date.now(); i < N; i++) 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,function(s,r){r=Math.random()*16|0;return (s=='x'?r:r&0x3|0x8).toString(16)}); -rate('140byte.es_v4', t); - -console.log(''); -console.log('# v1'); - -// node-uuid - v1 string form -if (nodeuuid) { - for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1(); - rate('nodeuuid.v1()', t); - - for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary'); - rate('nodeuuid.v1(\'binary\')', t); - - var buffer = new nodeuuid.BufferClass(16); - for (var i = 0, t = Date.now(); i < N; i++) nodeuuid.v1('binary', buffer); - rate('nodeuuid.v1(\'binary\', buffer)', t); -} - -// uuid-js - v1 string form -if (uuidjs) { - for (var i = 0, t = Date.now(); i < N; i++) uuidjs.create(1); - rate('uuidjs.create(1)', t); -} diff --git a/APIs/node_modules/request/node_modules/node-uuid/bin/uuid b/APIs/node_modules/request/node_modules/node-uuid/bin/uuid deleted file mode 100755 index f732e991..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/bin/uuid +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env node - -var path = require('path'); -var uuid = require(path.join(__dirname, '..')); - -var arg = process.argv[2]; - -if ('--help' === arg) { - console.log('\n USAGE: uuid [version] [options]\n\n'); - console.log(' options:\n'); - console.log(' --help Display this message and exit\n'); - process.exit(0); -} - -if (null == arg) { - console.log(uuid()); - process.exit(0); -} - -if ('v1' !== arg && 'v4' !== arg) { - console.error('Version must be RFC4122 version 1 or version 4, denoted as "v1" or "v4"'); - process.exit(1); -} - -console.log(uuid[arg]()); -process.exit(0); diff --git a/APIs/node_modules/request/node_modules/node-uuid/bower.json b/APIs/node_modules/request/node_modules/node-uuid/bower.json deleted file mode 100644 index c0925e19..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/bower.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "node-uuid", - "version": "1.4.7", - "homepage": "https://github.com/broofa/node-uuid", - "authors": [ - "Robert Kieffer " - ], - "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", - "main": "uuid.js", - "keywords": [ - "uuid", - "gid", - "rfc4122" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/APIs/node_modules/request/node_modules/node-uuid/component.json b/APIs/node_modules/request/node_modules/node-uuid/component.json deleted file mode 100644 index 3ff46336..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/component.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "name": "node-uuid", - "repo": "broofa/node-uuid", - "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", - "version": "1.4.7", - "author": "Robert Kieffer ", - "contributors": [ - { - "name": "Christoph Tavan ", - "github": "https://github.com/ctavan" - } - ], - "keywords": [ - "uuid", - "guid", - "rfc4122" - ], - "dependencies": {}, - "development": {}, - "main": "uuid.js", - "scripts": [ - "uuid.js" - ], - "license": "MIT" -} \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/node-uuid/package.json b/APIs/node_modules/request/node_modules/node-uuid/package.json deleted file mode 100644 index 1dd9d9ae..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/package.json +++ /dev/null @@ -1,80 +0,0 @@ -{ - "author": { - "name": "Robert Kieffer", - "email": "robert@broofa.com" - }, - "bin": { - "uuid": "./bin/uuid" - }, - "bugs": { - "url": "https://github.com/broofa/node-uuid/issues" - }, - "contributors": [ - { - "name": "AJ ONeal", - "email": "coolaj86@gmail.com" - }, - { - "name": "Christoph Tavan", - "email": "dev@tavan.de" - } - ], - "dependencies": {}, - "description": "Rigorous implementation of RFC4122 (v1 and v4) UUIDs.", - "devDependencies": { - "nyc": "^2.2.0" - }, - "directories": {}, - "homepage": "https://github.com/broofa/node-uuid", - "installable": true, - "keywords": [ - "guid", - "rfc4122", - "uuid" - ], - "lib": ".", - "licenses": [ - { - "type": "MIT", - "url": "https://raw.github.com/broofa/node-uuid/master/LICENSE.md" - } - ], - "main": "./uuid.js", - "maintainers": [ - { - "name": "broofa", - "email": "robert@broofa.com" - }, - { - "name": "coolaj86", - "email": "coolaj86@gmail.com" - } - ], - "name": "node-uuid", - "optionalDependencies": {}, - "repository": { - "type": "git", - "url": "git+https://github.com/broofa/node-uuid.git" - }, - "scripts": { - "coverage": "nyc npm test && nyc report", - "test": "node test/test.js" - }, - "url": "http://github.com/broofa/node-uuid", - "version": "1.4.7", - "gitHead": "309512573ec1c60143c257157479a20f7f1f51cd", - "_id": "node-uuid@1.4.7", - "_shasum": "6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f", - "_from": "node-uuid@~1.4.7", - "_npmVersion": "3.3.6", - "_nodeVersion": "5.0.0", - "_npmUser": { - "name": "coolaj86", - "email": "coolaj86@gmail.com" - }, - "dist": { - "shasum": "6da5a17668c4b3dd59623bda11cf7fa4c1f60a6f", - "tarball": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz" - }, - "_resolved": "https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz" -} diff --git a/APIs/node_modules/request/node_modules/node-uuid/test/compare_v1.js b/APIs/node_modules/request/node_modules/node-uuid/test/compare_v1.js deleted file mode 100644 index 05af8221..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/test/compare_v1.js +++ /dev/null @@ -1,63 +0,0 @@ -var assert = require('assert'), - nodeuuid = require('../uuid'), - uuidjs = require('uuid-js'), - libuuid = require('uuid').generate, - util = require('util'), - exec = require('child_process').exec, - os = require('os'); - -// On Mac Os X / macports there's only the ossp-uuid package that provides uuid -// On Linux there's uuid-runtime which provides uuidgen -var uuidCmd = os.type() === 'Darwin' ? 'uuid -1' : 'uuidgen -t'; - -function compare(ids) { - console.log(ids); - for (var i = 0; i < ids.length; i++) { - var id = ids[i].split('-'); - id = [id[2], id[1], id[0]].join(''); - ids[i] = id; - } - var sorted = ([].concat(ids)).sort(); - - if (sorted.toString() !== ids.toString()) { - console.log('Warning: sorted !== ids'); - } else { - console.log('everything in order!'); - } -} - -// Test time order of v1 uuids -var ids = []; -while (ids.length < 10e3) ids.push(nodeuuid.v1()); - -var max = 10; -console.log('node-uuid:'); -ids = []; -for (var i = 0; i < max; i++) ids.push(nodeuuid.v1()); -compare(ids); - -console.log(''); -console.log('uuidjs:'); -ids = []; -for (var i = 0; i < max; i++) ids.push(uuidjs.create(1).toString()); -compare(ids); - -console.log(''); -console.log('libuuid:'); -ids = []; -var count = 0; -var last = function() { - compare(ids); -} -var cb = function(err, stdout, stderr) { - ids.push(stdout.substring(0, stdout.length-1)); - count++; - if (count < max) { - return next(); - } - last(); -}; -var next = function() { - exec(uuidCmd, cb); -}; -next(); diff --git a/APIs/node_modules/request/node_modules/node-uuid/test/test.html b/APIs/node_modules/request/node_modules/node-uuid/test/test.html deleted file mode 100644 index d80326ec..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/test/test.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/APIs/node_modules/request/node_modules/node-uuid/test/test.js b/APIs/node_modules/request/node_modules/node-uuid/test/test.js deleted file mode 100644 index 5f1113d8..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/test/test.js +++ /dev/null @@ -1,231 +0,0 @@ -if (!this.uuid) { - // node.js - uuid = require('../uuid'); - if (!/_rb/.test(uuid._rng.toString())) { - throw new Error("should use crypto for node.js"); - } -} - -// -// x-platform log/assert shims -// - -function _log(msg, type) { - type = type || 'log'; - - if (typeof(document) != 'undefined') { - document.write('
    ' + msg.replace(/\n/g, '
    ') + '
    '); - } - if (typeof(console) != 'undefined') { - var color = { - log: '\033[39m', - warn: '\033[33m', - error: '\033[31m' - }; - console[type](color[type] + msg + color.log); - } -} - -function log(msg) {_log(msg, 'log');} -function warn(msg) {_log(msg, 'warn');} -function error(msg) {_log(msg, 'error');} - -function assert(res, msg) { - if (!res) { - error('FAIL: ' + msg); - } else { - log('Pass: ' + msg); - } -} - -// -// Unit tests -// - -// Verify ordering of v1 ids created with explicit times -var TIME = 1321644961388; // 2011-11-18 11:36:01.388-08:00 - -function compare(name, ids) { - ids = ids.map(function(id) { - return id.split('-').reverse().join('-'); - }).sort(); - var sorted = ([].concat(ids)).sort(); - - assert(sorted.toString() == ids.toString(), name + ' have expected order'); -} - -// Verify ordering of v1 ids created using default behavior -compare('uuids with current time', [ - uuid.v1(), - uuid.v1(), - uuid.v1(), - uuid.v1(), - uuid.v1() -]); - -// Verify ordering of v1 ids created with explicit times -compare('uuids with time option', [ - uuid.v1({msecs: TIME - 10*3600*1000}), - uuid.v1({msecs: TIME - 1}), - uuid.v1({msecs: TIME}), - uuid.v1({msecs: TIME + 1}), - uuid.v1({msecs: TIME + 28*24*3600*1000}) -]); - -assert( - uuid.v1({msecs: TIME}) != uuid.v1({msecs: TIME}), - 'IDs created at same msec are different' -); - -// Verify throw if too many ids created -var thrown = false; -try { - uuid.v1({msecs: TIME, nsecs: 10000}); -} catch (e) { - thrown = true; -} -assert(thrown, 'Exception thrown when > 10K ids created in 1 ms'); - -// Verify clock regression bumps clockseq -var uidt = uuid.v1({msecs: TIME}); -var uidtb = uuid.v1({msecs: TIME - 1}); -assert( - parseInt(uidtb.split('-')[3], 16) - parseInt(uidt.split('-')[3], 16) === 1, - 'Clock regression by msec increments the clockseq' -); - -// Verify clock regression bumps clockseq -var uidtn = uuid.v1({msecs: TIME, nsecs: 10}); -var uidtnb = uuid.v1({msecs: TIME, nsecs: 9}); -assert( - parseInt(uidtnb.split('-')[3], 16) - parseInt(uidtn.split('-')[3], 16) === 1, - 'Clock regression by nsec increments the clockseq' -); - -// Verify explicit options produce expected id -var id = uuid.v1({ - msecs: 1321651533573, - nsecs: 5432, - clockseq: 0x385c, - node: [ 0x61, 0xcd, 0x3c, 0xbb, 0x32, 0x10 ] -}); -assert(id == 'd9428888-122b-11e1-b85c-61cd3cbb3210', 'Explicit options produce expected id'); - -// Verify adjacent ids across a msec boundary are 1 time unit apart -var u0 = uuid.v1({msecs: TIME, nsecs: 9999}); -var u1 = uuid.v1({msecs: TIME + 1, nsecs: 0}); - -var before = u0.split('-')[0], after = u1.split('-')[0]; -var dt = parseInt(after, 16) - parseInt(before, 16); -assert(dt === 1, 'Ids spanning 1ms boundary are 100ns apart'); - -// -// Test parse/unparse -// - -id = '00112233445566778899aabbccddeeff'; -assert(uuid.unparse(uuid.parse(id.substr(0,10))) == - '00112233-4400-0000-0000-000000000000', 'Short parse'); -assert(uuid.unparse(uuid.parse('(this is the uuid -> ' + id + id)) == - '00112233-4455-6677-8899-aabbccddeeff', 'Dirty parse'); - -// -// Perf tests -// - -var generators = { - v1: uuid.v1, - v4: uuid.v4 -}; - -var UUID_FORMAT = { - v1: /[0-9a-f]{8}-[0-9a-f]{4}-1[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i, - v4: /[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}/i -}; - -var N = 1e4; - -// Get %'age an actual value differs from the ideal value -function divergence(actual, ideal) { - return Math.round(100*100*(actual - ideal)/ideal)/100; -} - -function rate(msg, t) { - log(msg + ': ' + (N / (Date.now() - t) * 1e3 | 0) + ' uuids\/second'); -} - -for (var version in generators) { - var counts = {}, max = 0; - var generator = generators[version]; - var format = UUID_FORMAT[version]; - - log('\nSanity check ' + N + ' ' + version + ' uuids'); - for (var i = 0, ok = 0; i < N; i++) { - id = generator(); - if (!format.test(id)) { - throw Error(id + ' is not a valid UUID string'); - } - - if (id != uuid.unparse(uuid.parse(id))) { - assert(fail, id + ' is not a valid id'); - } - - // Count digits for our randomness check - if (version == 'v4') { - var digits = id.replace(/-/g, '').split(''); - for (var j = digits.length-1; j >= 0; j--) { - var c = digits[j]; - max = Math.max(max, counts[c] = (counts[c] || 0) + 1); - } - } - } - - // Check randomness for v4 UUIDs - if (version == 'v4') { - // Limit that we get worried about randomness. (Purely empirical choice, this!) - var limit = 2*100*Math.sqrt(1/N); - - log('\nChecking v4 randomness. Distribution of Hex Digits (% deviation from ideal)'); - - for (var i = 0; i < 16; i++) { - var c = i.toString(16); - var bar = '', n = counts[c], p = Math.round(n/max*100|0); - - // 1-3,5-8, and D-F: 1:16 odds over 30 digits - var ideal = N*30/16; - if (i == 4) { - // 4: 1:1 odds on 1 digit, plus 1:16 odds on 30 digits - ideal = N*(1 + 30/16); - } else if (i >= 8 && i <= 11) { - // 8-B: 1:4 odds on 1 digit, plus 1:16 odds on 30 digits - ideal = N*(1/4 + 30/16); - } else { - // Otherwise: 1:16 odds on 30 digits - ideal = N*30/16; - } - var d = divergence(n, ideal); - - // Draw bar using UTF squares (just for grins) - var s = n/max*50 | 0; - while (s--) bar += '='; - - assert(Math.abs(d) < limit, c + ' |' + bar + '| ' + counts[c] + ' (' + d + '% < ' + limit + '%)'); - } - } -} - -// Perf tests -for (var version in generators) { - log('\nPerformance testing ' + version + ' UUIDs'); - var generator = generators[version]; - var buf = new uuid.BufferClass(16); - - for (var i = 0, t = Date.now(); i < N; i++) generator(); - rate('uuid.' + version + '()', t); - - for (var i = 0, t = Date.now(); i < N; i++) generator('binary'); - rate('uuid.' + version + '(\'binary\')', t); - - for (var i = 0, t = Date.now(); i < N; i++) generator('binary', buf); - rate('uuid.' + version + '(\'binary\', buffer)', t); -} diff --git a/APIs/node_modules/request/node_modules/node-uuid/uuid.js b/APIs/node_modules/request/node_modules/node-uuid/uuid.js deleted file mode 100644 index 89c5b8fb..00000000 --- a/APIs/node_modules/request/node_modules/node-uuid/uuid.js +++ /dev/null @@ -1,272 +0,0 @@ -// uuid.js -// -// Copyright (c) 2010-2012 Robert Kieffer -// MIT License - http://opensource.org/licenses/mit-license.php - -/*global window, require, define */ -(function(_window) { - 'use strict'; - - // Unique ID creation requires a high quality random # generator. We feature - // detect to determine the best RNG source, normalizing to a function that - // returns 128-bits of randomness, since that's what's usually required - var _rng, _mathRNG, _nodeRNG, _whatwgRNG, _previousRoot; - - function setupBrowser() { - // Allow for MSIE11 msCrypto - var _crypto = _window.crypto || _window.msCrypto; - - if (!_rng && _crypto && _crypto.getRandomValues) { - // WHATWG crypto-based RNG - http://wiki.whatwg.org/wiki/Crypto - // - // Moderately fast, high quality - try { - var _rnds8 = new Uint8Array(16); - _whatwgRNG = _rng = function whatwgRNG() { - _crypto.getRandomValues(_rnds8); - return _rnds8; - }; - _rng(); - } catch(e) {} - } - - if (!_rng) { - // Math.random()-based (RNG) - // - // If all else fails, use Math.random(). It's fast, but is of unspecified - // quality. - var _rnds = new Array(16); - _mathRNG = _rng = function() { - for (var i = 0, r; i < 16; i++) { - if ((i & 0x03) === 0) { r = Math.random() * 0x100000000; } - _rnds[i] = r >>> ((i & 0x03) << 3) & 0xff; - } - - return _rnds; - }; - if ('undefined' !== typeof console && console.warn) { - console.warn("[SECURITY] node-uuid: crypto not usable, falling back to insecure Math.random()"); - } - } - } - - function setupNode() { - // Node.js crypto-based RNG - http://nodejs.org/docs/v0.6.2/api/crypto.html - // - // Moderately fast, high quality - if ('function' === typeof require) { - try { - var _rb = require('crypto').randomBytes; - _nodeRNG = _rng = _rb && function() {return _rb(16);}; - _rng(); - } catch(e) {} - } - } - - if (_window) { - setupBrowser(); - } else { - setupNode(); - } - - // Buffer class to use - var BufferClass = ('function' === typeof Buffer) ? Buffer : Array; - - // Maps for number <-> hex string conversion - var _byteToHex = []; - var _hexToByte = {}; - for (var i = 0; i < 256; i++) { - _byteToHex[i] = (i + 0x100).toString(16).substr(1); - _hexToByte[_byteToHex[i]] = i; - } - - // **`parse()` - Parse a UUID into it's component bytes** - function parse(s, buf, offset) { - var i = (buf && offset) || 0, ii = 0; - - buf = buf || []; - s.toLowerCase().replace(/[0-9a-f]{2}/g, function(oct) { - if (ii < 16) { // Don't overflow! - buf[i + ii++] = _hexToByte[oct]; - } - }); - - // Zero out remaining bytes if string was short - while (ii < 16) { - buf[i + ii++] = 0; - } - - return buf; - } - - // **`unparse()` - Convert UUID byte array (ala parse()) into a string** - function unparse(buf, offset) { - var i = offset || 0, bth = _byteToHex; - return bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + '-' + - bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]] + - bth[buf[i++]] + bth[buf[i++]]; - } - - // **`v1()` - Generate time-based UUID** - // - // Inspired by https://github.com/LiosK/UUID.js - // and http://docs.python.org/library/uuid.html - - // random #'s we need to init node and clockseq - var _seedBytes = _rng(); - - // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) - var _nodeId = [ - _seedBytes[0] | 0x01, - _seedBytes[1], _seedBytes[2], _seedBytes[3], _seedBytes[4], _seedBytes[5] - ]; - - // Per 4.2.2, randomize (14 bit) clockseq - var _clockseq = (_seedBytes[6] << 8 | _seedBytes[7]) & 0x3fff; - - // Previous uuid creation time - var _lastMSecs = 0, _lastNSecs = 0; - - // See https://github.com/broofa/node-uuid for API details - function v1(options, buf, offset) { - var i = buf && offset || 0; - var b = buf || []; - - options = options || {}; - - var clockseq = (options.clockseq != null) ? options.clockseq : _clockseq; - - // UUID timestamps are 100 nano-second units since the Gregorian epoch, - // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so - // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' - // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. - var msecs = (options.msecs != null) ? options.msecs : new Date().getTime(); - - // Per 4.2.1.2, use count of uuid's generated during the current clock - // cycle to simulate higher resolution clock - var nsecs = (options.nsecs != null) ? options.nsecs : _lastNSecs + 1; - - // Time since last uuid creation (in msecs) - var dt = (msecs - _lastMSecs) + (nsecs - _lastNSecs)/10000; - - // Per 4.2.1.2, Bump clockseq on clock regression - if (dt < 0 && options.clockseq == null) { - clockseq = clockseq + 1 & 0x3fff; - } - - // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new - // time interval - if ((dt < 0 || msecs > _lastMSecs) && options.nsecs == null) { - nsecs = 0; - } - - // Per 4.2.1.2 Throw error if too many uuids are requested - if (nsecs >= 10000) { - throw new Error('uuid.v1(): Can\'t create more than 10M uuids/sec'); - } - - _lastMSecs = msecs; - _lastNSecs = nsecs; - _clockseq = clockseq; - - // Per 4.1.4 - Convert from unix epoch to Gregorian epoch - msecs += 12219292800000; - - // `time_low` - var tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; - b[i++] = tl >>> 24 & 0xff; - b[i++] = tl >>> 16 & 0xff; - b[i++] = tl >>> 8 & 0xff; - b[i++] = tl & 0xff; - - // `time_mid` - var tmh = (msecs / 0x100000000 * 10000) & 0xfffffff; - b[i++] = tmh >>> 8 & 0xff; - b[i++] = tmh & 0xff; - - // `time_high_and_version` - b[i++] = tmh >>> 24 & 0xf | 0x10; // include version - b[i++] = tmh >>> 16 & 0xff; - - // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) - b[i++] = clockseq >>> 8 | 0x80; - - // `clock_seq_low` - b[i++] = clockseq & 0xff; - - // `node` - var node = options.node || _nodeId; - for (var n = 0; n < 6; n++) { - b[i + n] = node[n]; - } - - return buf ? buf : unparse(b); - } - - // **`v4()` - Generate random UUID** - - // See https://github.com/broofa/node-uuid for API details - function v4(options, buf, offset) { - // Deprecated - 'format' argument, as supported in v1.2 - var i = buf && offset || 0; - - if (typeof(options) === 'string') { - buf = (options === 'binary') ? new BufferClass(16) : null; - options = null; - } - options = options || {}; - - var rnds = options.random || (options.rng || _rng)(); - - // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` - rnds[6] = (rnds[6] & 0x0f) | 0x40; - rnds[8] = (rnds[8] & 0x3f) | 0x80; - - // Copy bytes to buffer, if provided - if (buf) { - for (var ii = 0; ii < 16; ii++) { - buf[i + ii] = rnds[ii]; - } - } - - return buf || unparse(rnds); - } - - // Export public API - var uuid = v4; - uuid.v1 = v1; - uuid.v4 = v4; - uuid.parse = parse; - uuid.unparse = unparse; - uuid.BufferClass = BufferClass; - uuid._rng = _rng; - uuid._mathRNG = _mathRNG; - uuid._nodeRNG = _nodeRNG; - uuid._whatwgRNG = _whatwgRNG; - - if (('undefined' !== typeof module) && module.exports) { - // Publish as node.js module - module.exports = uuid; - } else if (typeof define === 'function' && define.amd) { - // Publish as AMD module - define(function() {return uuid;}); - - - } else { - // Publish as global (in browsers) - _previousRoot = _window.uuid; - - // **`noConflict()` - (browser only) to reset global 'uuid' var** - uuid.noConflict = function() { - _window.uuid = _previousRoot; - return uuid; - }; - - _window.uuid = uuid; - } -})('undefined' !== typeof window ? window : null); diff --git a/APIs/node_modules/request/node_modules/oauth-sign/LICENSE b/APIs/node_modules/request/node_modules/oauth-sign/LICENSE deleted file mode 100644 index a4a9aee0..00000000 --- a/APIs/node_modules/request/node_modules/oauth-sign/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/oauth-sign/README.md b/APIs/node_modules/request/node_modules/oauth-sign/README.md deleted file mode 100644 index 34c4a85d..00000000 --- a/APIs/node_modules/request/node_modules/oauth-sign/README.md +++ /dev/null @@ -1,4 +0,0 @@ -oauth-sign -========== - -OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module. diff --git a/APIs/node_modules/request/node_modules/oauth-sign/index.js b/APIs/node_modules/request/node_modules/oauth-sign/index.js deleted file mode 100644 index dadcba97..00000000 --- a/APIs/node_modules/request/node_modules/oauth-sign/index.js +++ /dev/null @@ -1,136 +0,0 @@ -var crypto = require('crypto') - , qs = require('querystring') - ; - -function sha1 (key, body) { - return crypto.createHmac('sha1', key).update(body).digest('base64') -} - -function rsa (key, body) { - return crypto.createSign("RSA-SHA1").update(body).sign(key, 'base64'); -} - -function rfc3986 (str) { - return encodeURIComponent(str) - .replace(/!/g,'%21') - .replace(/\*/g,'%2A') - .replace(/\(/g,'%28') - .replace(/\)/g,'%29') - .replace(/'/g,'%27') - ; -} - -// Maps object to bi-dimensional array -// Converts { foo: 'A', bar: [ 'b', 'B' ]} to -// [ ['foo', 'A'], ['bar', 'b'], ['bar', 'B'] ] -function map (obj) { - var key, val, arr = [] - for (key in obj) { - val = obj[key] - if (Array.isArray(val)) - for (var i = 0; i < val.length; i++) - arr.push([key, val[i]]) - else if (typeof val === "object") - for (var prop in val) - arr.push([key + '[' + prop + ']', val[prop]]); - else - arr.push([key, val]) - } - return arr -} - -// Compare function for sort -function compare (a, b) { - return a > b ? 1 : a < b ? -1 : 0 -} - -function generateBase (httpMethod, base_uri, params) { - // adapted from https://dev.twitter.com/docs/auth/oauth and - // https://dev.twitter.com/docs/auth/creating-signature - - // Parameter normalization - // http://tools.ietf.org/html/rfc5849#section-3.4.1.3.2 - var normalized = map(params) - // 1. First, the name and value of each parameter are encoded - .map(function (p) { - return [ rfc3986(p[0]), rfc3986(p[1] || '') ] - }) - // 2. The parameters are sorted by name, using ascending byte value - // ordering. If two or more parameters share the same name, they - // are sorted by their value. - .sort(function (a, b) { - return compare(a[0], b[0]) || compare(a[1], b[1]) - }) - // 3. The name of each parameter is concatenated to its corresponding - // value using an "=" character (ASCII code 61) as a separator, even - // if the value is empty. - .map(function (p) { return p.join('=') }) - // 4. The sorted name/value pairs are concatenated together into a - // single string by using an "&" character (ASCII code 38) as - // separator. - .join('&') - - var base = [ - rfc3986(httpMethod ? httpMethod.toUpperCase() : 'GET'), - rfc3986(base_uri), - rfc3986(normalized) - ].join('&') - - return base -} - -function hmacsign (httpMethod, base_uri, params, consumer_secret, token_secret) { - var base = generateBase(httpMethod, base_uri, params) - var key = [ - consumer_secret || '', - token_secret || '' - ].map(rfc3986).join('&') - - return sha1(key, base) -} - -function rsasign (httpMethod, base_uri, params, private_key, token_secret) { - var base = generateBase(httpMethod, base_uri, params) - var key = private_key || '' - - return rsa(key, base) -} - -function plaintext (consumer_secret, token_secret) { - var key = [ - consumer_secret || '', - token_secret || '' - ].map(rfc3986).join('&') - - return key -} - -function sign (signMethod, httpMethod, base_uri, params, consumer_secret, token_secret) { - var method - var skipArgs = 1 - - switch (signMethod) { - case 'RSA-SHA1': - method = rsasign - break - case 'HMAC-SHA1': - method = hmacsign - break - case 'PLAINTEXT': - method = plaintext - skipArgs = 4 - break - default: - throw new Error("Signature method not supported: " + signMethod) - } - - return method.apply(null, [].slice.call(arguments, skipArgs)) -} - -exports.hmacsign = hmacsign -exports.rsasign = rsasign -exports.plaintext = plaintext -exports.sign = sign -exports.rfc3986 = rfc3986 -exports.generateBase = generateBase - diff --git a/APIs/node_modules/request/node_modules/oauth-sign/package.json b/APIs/node_modules/request/node_modules/oauth-sign/package.json deleted file mode 100644 index e83ee4eb..00000000 --- a/APIs/node_modules/request/node_modules/oauth-sign/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com", - "url": "http://www.futurealoof.com" - }, - "name": "oauth-sign", - "description": "OAuth 1 signing. Formerly a vendor lib in mikeal/request, now a standalone module.", - "version": "0.8.2", - "license": "Apache-2.0", - "repository": { - "url": "git+https://github.com/mikeal/oauth-sign.git" - }, - "main": "index.js", - "files": [ - "index.js" - ], - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "scripts": { - "test": "node test.js" - }, - "gitHead": "0b034206316132f57e26970152c2fb18e71bddd5", - "bugs": { - "url": "https://github.com/mikeal/oauth-sign/issues" - }, - "homepage": "https://github.com/mikeal/oauth-sign#readme", - "_id": "oauth-sign@0.8.2", - "_shasum": "46a6ab7f0aead8deae9ec0565780b7d4efeb9d43", - "_from": "oauth-sign@~0.8.1", - "_npmVersion": "2.15.3", - "_nodeVersion": "5.9.0", - "_npmUser": { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - }, - "dist": { - "shasum": "46a6ab7f0aead8deae9ec0565780b7d4efeb9d43", - "tarball": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - { - "name": "nylen", - "email": "jnylen@gmail.com" - }, - { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/oauth-sign-0.8.2.tgz_1462396399020_0.8175400267355144" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.2.tgz" -} diff --git a/APIs/node_modules/request/node_modules/qs/.eslintignore b/APIs/node_modules/request/node_modules/qs/.eslintignore deleted file mode 100644 index 1521c8b7..00000000 --- a/APIs/node_modules/request/node_modules/qs/.eslintignore +++ /dev/null @@ -1 +0,0 @@ -dist diff --git a/APIs/node_modules/request/node_modules/qs/.eslintrc b/APIs/node_modules/request/node_modules/qs/.eslintrc deleted file mode 100644 index 24a8fe48..00000000 --- a/APIs/node_modules/request/node_modules/qs/.eslintrc +++ /dev/null @@ -1,17 +0,0 @@ -{ - "root": true, - - "extends": "@ljharb", - - "rules": { - "complexity": [2, 19], - "consistent-return": [1], - "max-params": [2, 9], - "max-statements": [2, 33], - "no-extra-parens": [1], - "no-continue": [1], - "no-magic-numbers": 0, - "no-restricted-syntax": [2, "BreakStatement", "DebuggerStatement", "ForInStatement", "LabeledStatement", "WithStatement"], - "operator-linebreak": 1 - } -} diff --git a/APIs/node_modules/request/node_modules/qs/.npmignore b/APIs/node_modules/request/node_modules/qs/.npmignore deleted file mode 100644 index 7e1574dc..00000000 --- a/APIs/node_modules/request/node_modules/qs/.npmignore +++ /dev/null @@ -1,18 +0,0 @@ -.idea -*.iml -npm-debug.log -dump.rdb -node_modules -results.tap -results.xml -npm-shrinkwrap.json -config.json -.DS_Store -*/.DS_Store -*/*/.DS_Store -._* -*/._* -*/*/._* -coverage.* -lib-cov -complexity.md diff --git a/APIs/node_modules/request/node_modules/qs/.travis.yml b/APIs/node_modules/request/node_modules/qs/.travis.yml deleted file mode 100644 index 63bdc12b..00000000 --- a/APIs/node_modules/request/node_modules/qs/.travis.yml +++ /dev/null @@ -1,69 +0,0 @@ -language: node_js -node_js: - - "5.3" - - "5.2" - - "5.1" - - "5.0" - - "4.2" - - "4.1" - - "4.0" - - "iojs-v3.3" - - "iojs-v3.2" - - "iojs-v3.1" - - "iojs-v3.0" - - "iojs-v2.5" - - "iojs-v2.4" - - "iojs-v2.3" - - "iojs-v2.2" - - "iojs-v2.1" - - "iojs-v2.0" - - "iojs-v1.8" - - "iojs-v1.7" - - "iojs-v1.6" - - "iojs-v1.5" - - "iojs-v1.4" - - "iojs-v1.3" - - "iojs-v1.2" - - "iojs-v1.1" - - "iojs-v1.0" - - "0.12" - - "0.11" - - "0.10" - - "0.9" - - "0.8" - - "0.6" - - "0.4" -before_install: - - 'if [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then case "$(npm --version)" in 1.*) npm install -g npm@1.4.28 ;; 2.*) npm install -g npm@2 ;; esac ; fi' - - 'if [ "${TRAVIS_NODE_VERSION}" != "0.6" ] && [ "${TRAVIS_NODE_VERSION}" != "0.9" ]; then npm install -g npm; fi' -script: - - 'if [ "${TRAVIS_NODE_VERSION}" != "4.2" ]; then npm run tests-only ; else npm test ; fi' -sudo: false -matrix: - fast_finish: true - allow_failures: - - node_js: "5.2" - - node_js: "5.1" - - node_js: "5.0" - - node_js: "4.1" - - node_js: "4.0" - - node_js: "iojs-v3.2" - - node_js: "iojs-v3.1" - - node_js: "iojs-v3.0" - - node_js: "iojs-v2.4" - - node_js: "iojs-v2.3" - - node_js: "iojs-v2.2" - - node_js: "iojs-v2.1" - - node_js: "iojs-v2.0" - - node_js: "iojs-v1.7" - - node_js: "iojs-v1.6" - - node_js: "iojs-v1.5" - - node_js: "iojs-v1.4" - - node_js: "iojs-v1.3" - - node_js: "iojs-v1.2" - - node_js: "iojs-v1.1" - - node_js: "iojs-v1.0" - - node_js: "0.11" - - node_js: "0.9" - - node_js: "0.6" - - node_js: "0.4" diff --git a/APIs/node_modules/request/node_modules/qs/CHANGELOG.md b/APIs/node_modules/request/node_modules/qs/CHANGELOG.md deleted file mode 100644 index 5c66ea44..00000000 --- a/APIs/node_modules/request/node_modules/qs/CHANGELOG.md +++ /dev/null @@ -1,115 +0,0 @@ -## [**6.1.0**](https://github.com/ljharb/qs/issues?milestone=34&state=closed) -- [New] allowDots option for `stringify` (#151) -- [Fix] "sort" option should work at a depth of 3 or more (#151) -- [Fix] Restore `dist` directory; will be removed in v7 (#148) - -## [**6.0.2**](https://github.com/ljharb/qs/issues?milestone=33&state=closed) -- Revert ES6 requirement and restore support for node down to v0.8. - -## [**6.0.1**](https://github.com/ljharb/qs/issues?milestone=32&state=closed) -- [**#127**](https://github.com/ljharb/qs/pull/127) Fix engines definition in package.json - -## [**6.0.0**](https://github.com/ljharb/qs/issues?milestone=31&state=closed) -- [**#124**](https://github.com/ljharb/qs/issues/124) Use ES6 and drop support for node < v4 - -## [**5.2.0**](https://github.com/ljharb/qs/issues?milestone=30&state=closed) -- [**#64**](https://github.com/ljharb/qs/issues/64) Add option to sort object keys in the query string - -## [**5.1.0**](https://github.com/ljharb/qs/issues?milestone=29&state=closed) -- [**#117**](https://github.com/ljharb/qs/issues/117) make URI encoding stringified results optional -- [**#106**](https://github.com/ljharb/qs/issues/106) Add flag `skipNulls` to optionally skip null values in stringify - -## [**5.0.0**](https://github.com/ljharb/qs/issues?milestone=28&state=closed) -- [**#114**](https://github.com/ljharb/qs/issues/114) default allowDots to false -- [**#100**](https://github.com/ljharb/qs/issues/100) include dist to npm - -## [**4.0.0**](https://github.com/ljharb/qs/issues?milestone=26&state=closed) -- [**#98**](https://github.com/ljharb/qs/issues/98) make returning plain objects and allowing prototype overwriting properties optional - -## [**3.1.0**](https://github.com/ljharb/qs/issues?milestone=24&state=closed) -- [**#89**](https://github.com/ljharb/qs/issues/89) Add option to disable "Transform dot notation to bracket notation" - -## [**3.0.0**](https://github.com/ljharb/qs/issues?milestone=23&state=closed) -- [**#80**](https://github.com/ljharb/qs/issues/80) qs.parse silently drops properties -- [**#77**](https://github.com/ljharb/qs/issues/77) Perf boost -- [**#60**](https://github.com/ljharb/qs/issues/60) Add explicit option to disable array parsing -- [**#74**](https://github.com/ljharb/qs/issues/74) Bad parse when turning array into object -- [**#81**](https://github.com/ljharb/qs/issues/81) Add a `filter` option -- [**#68**](https://github.com/ljharb/qs/issues/68) Fixed issue with recursion and passing strings into objects. -- [**#66**](https://github.com/ljharb/qs/issues/66) Add mixed array and object dot notation support Closes: #47 -- [**#76**](https://github.com/ljharb/qs/issues/76) RFC 3986 -- [**#85**](https://github.com/ljharb/qs/issues/85) No equal sign -- [**#84**](https://github.com/ljharb/qs/issues/84) update license attribute - -## [**2.4.1**](https://github.com/ljharb/qs/issues?milestone=20&state=closed) -- [**#73**](https://github.com/ljharb/qs/issues/73) Property 'hasOwnProperty' of object # is not a function - -## [**2.4.0**](https://github.com/ljharb/qs/issues?milestone=19&state=closed) -- [**#70**](https://github.com/ljharb/qs/issues/70) Add arrayFormat option - -## [**2.3.3**](https://github.com/ljharb/qs/issues?milestone=18&state=closed) -- [**#59**](https://github.com/ljharb/qs/issues/59) make sure array indexes are >= 0, closes #57 -- [**#58**](https://github.com/ljharb/qs/issues/58) make qs usable for browser loader - -## [**2.3.2**](https://github.com/ljharb/qs/issues?milestone=17&state=closed) -- [**#55**](https://github.com/ljharb/qs/issues/55) allow merging a string into an object - -## [**2.3.1**](https://github.com/ljharb/qs/issues?milestone=16&state=closed) -- [**#52**](https://github.com/ljharb/qs/issues/52) Return "undefined" and "false" instead of throwing "TypeError". - -## [**2.3.0**](https://github.com/ljharb/qs/issues?milestone=15&state=closed) -- [**#50**](https://github.com/ljharb/qs/issues/50) add option to omit array indices, closes #46 - -## [**2.2.5**](https://github.com/ljharb/qs/issues?milestone=14&state=closed) -- [**#39**](https://github.com/ljharb/qs/issues/39) Is there an alternative to Buffer.isBuffer? -- [**#49**](https://github.com/ljharb/qs/issues/49) refactor utils.merge, fixes #45 -- [**#41**](https://github.com/ljharb/qs/issues/41) avoid browserifying Buffer, for #39 - -## [**2.2.4**](https://github.com/ljharb/qs/issues?milestone=13&state=closed) -- [**#38**](https://github.com/ljharb/qs/issues/38) how to handle object keys beginning with a number - -## [**2.2.3**](https://github.com/ljharb/qs/issues?milestone=12&state=closed) -- [**#37**](https://github.com/ljharb/qs/issues/37) parser discards first empty value in array -- [**#36**](https://github.com/ljharb/qs/issues/36) Update to lab 4.x - -## [**2.2.2**](https://github.com/ljharb/qs/issues?milestone=11&state=closed) -- [**#33**](https://github.com/ljharb/qs/issues/33) Error when plain object in a value -- [**#34**](https://github.com/ljharb/qs/issues/34) use Object.prototype.hasOwnProperty.call instead of obj.hasOwnProperty -- [**#24**](https://github.com/ljharb/qs/issues/24) Changelog? Semver? - -## [**2.2.1**](https://github.com/ljharb/qs/issues?milestone=10&state=closed) -- [**#32**](https://github.com/ljharb/qs/issues/32) account for circular references properly, closes #31 -- [**#31**](https://github.com/ljharb/qs/issues/31) qs.parse stackoverflow on circular objects - -## [**2.2.0**](https://github.com/ljharb/qs/issues?milestone=9&state=closed) -- [**#26**](https://github.com/ljharb/qs/issues/26) Don't use Buffer global if it's not present -- [**#30**](https://github.com/ljharb/qs/issues/30) Bug when merging non-object values into arrays -- [**#29**](https://github.com/ljharb/qs/issues/29) Don't call Utils.clone at the top of Utils.merge -- [**#23**](https://github.com/ljharb/qs/issues/23) Ability to not limit parameters? - -## [**2.1.0**](https://github.com/ljharb/qs/issues?milestone=8&state=closed) -- [**#22**](https://github.com/ljharb/qs/issues/22) Enable using a RegExp as delimiter - -## [**2.0.0**](https://github.com/ljharb/qs/issues?milestone=7&state=closed) -- [**#18**](https://github.com/ljharb/qs/issues/18) Why is there arrayLimit? -- [**#20**](https://github.com/ljharb/qs/issues/20) Configurable parametersLimit -- [**#21**](https://github.com/ljharb/qs/issues/21) make all limits optional, for #18, for #20 - -## [**1.2.2**](https://github.com/ljharb/qs/issues?milestone=6&state=closed) -- [**#19**](https://github.com/ljharb/qs/issues/19) Don't overwrite null values - -## [**1.2.1**](https://github.com/ljharb/qs/issues?milestone=5&state=closed) -- [**#16**](https://github.com/ljharb/qs/issues/16) ignore non-string delimiters -- [**#15**](https://github.com/ljharb/qs/issues/15) Close code block - -## [**1.2.0**](https://github.com/ljharb/qs/issues?milestone=4&state=closed) -- [**#12**](https://github.com/ljharb/qs/issues/12) Add optional delim argument -- [**#13**](https://github.com/ljharb/qs/issues/13) fix #11: flattened keys in array are now correctly parsed - -## [**1.1.0**](https://github.com/ljharb/qs/issues?milestone=3&state=closed) -- [**#7**](https://github.com/ljharb/qs/issues/7) Empty values of a POST array disappear after being submitted -- [**#9**](https://github.com/ljharb/qs/issues/9) Should not omit equals signs (=) when value is null -- [**#6**](https://github.com/ljharb/qs/issues/6) Minor grammar fix in README - -## [**1.0.2**](https://github.com/ljharb/qs/issues?milestone=2&state=closed) -- [**#5**](https://github.com/ljharb/qs/issues/5) array holes incorrectly copied into object on large index diff --git a/APIs/node_modules/request/node_modules/qs/CONTRIBUTING.md b/APIs/node_modules/request/node_modules/qs/CONTRIBUTING.md deleted file mode 100644 index 89283615..00000000 --- a/APIs/node_modules/request/node_modules/qs/CONTRIBUTING.md +++ /dev/null @@ -1 +0,0 @@ -Please view our [hapijs contributing guide](https://github.com/hapijs/hapi/blob/master/CONTRIBUTING.md). diff --git a/APIs/node_modules/request/node_modules/qs/LICENSE b/APIs/node_modules/request/node_modules/qs/LICENSE deleted file mode 100644 index d4569487..00000000 --- a/APIs/node_modules/request/node_modules/qs/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -Copyright (c) 2014 Nathan LaFreniere and other contributors. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - * The names of any contributors may not be used to endorse or promote - products derived from this software without specific prior written - permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY -DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS -SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - * * * - -The complete list of contributors can be found at: https://github.com/hapijs/qs/graphs/contributors diff --git a/APIs/node_modules/request/node_modules/qs/README.md b/APIs/node_modules/request/node_modules/qs/README.md deleted file mode 100644 index 335eafb4..00000000 --- a/APIs/node_modules/request/node_modules/qs/README.md +++ /dev/null @@ -1,335 +0,0 @@ -# qs - -A querystring parsing and stringifying library with some added security. - -[![Build Status](https://api.travis-ci.org/ljharb/qs.svg)](http://travis-ci.org/ljharb/qs) - -Lead Maintainer: [Jordan Harband](https://github.com/ljharb) - -The **qs** module was originally created and maintained by [TJ Holowaychuk](https://github.com/visionmedia/node-querystring). - -## Usage - -```javascript -var qs = require('qs'); -var assert = require('assert'); - -var obj = qs.parse('a=c'); -assert.deepEqual(obj, { a: 'c' }); - -var str = qs.stringify(obj); -assert.equal(str, 'a=c'); -``` - -### Parsing Objects - -[](#preventEval) -```javascript -qs.parse(string, [options]); -``` - -**qs** allows you to create nested objects within your query strings, by surrounding the name of sub-keys with square brackets `[]`. -For example, the string `'foo[bar]=baz'` converts to: - -```javascript -assert.deepEqual(qs.parse('foo[bar]=baz'), { - foo: { - bar: 'baz' - } -}); -``` - -When using the `plainObjects` option the parsed value is returned as a plain object, created via `Object.create(null)` and as such you should be aware that prototype methods will not exist on it and a user may set those names to whatever value they like: - -```javascript -var plainObject = qs.parse('a[hasOwnProperty]=b', { plainObjects: true }); -assert.deepEqual(plainObject, { a: { hasOwnProperty: 'b' } }); -``` - -By default parameters that would overwrite properties on the object prototype are ignored, if you wish to keep the data from those fields either use `plainObjects` as mentioned above, or set `allowPrototypes` to `true` which will allow user input to overwrite those properties. *WARNING* It is generally a bad idea to enable this option as it can cause problems when attempting to use the properties that have been overwritten. Always be careful with this option. - -```javascript -var protoObject = qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }); -assert.deepEqual(protoObject, { a: { hasOwnProperty: 'b' } }); -``` - -URI encoded strings work too: - -```javascript -assert.deepEqual(qs.parse('a%5Bb%5D=c'), { - a: { b: 'c' } -}); -``` - -You can also nest your objects, like `'foo[bar][baz]=foobarbaz'`: - -```javascript -assert.deepEqual(qs.parse('foo[bar][baz]=foobarbaz'), { - foo: { - bar: { - baz: 'foobarbaz' - } - } -}); -``` - -By default, when nesting objects **qs** will only parse up to 5 children deep. This means if you attempt to parse a string like -`'a[b][c][d][e][f][g][h][i]=j'` your resulting object will be: - -```javascript -var expected = { - a: { - b: { - c: { - d: { - e: { - f: { - '[g][h][i]': 'j' - } - } - } - } - } - } -}; -var string = 'a[b][c][d][e][f][g][h][i]=j'; -assert.deepEqual(qs.parse(string), expected); -``` - -This depth can be overridden by passing a `depth` option to `qs.parse(string, [options])`: - -```javascript -var deep = qs.parse('a[b][c][d][e][f][g][h][i]=j', { depth: 1 }); -assert.deepEqual(deep, { a: { b: { '[c][d][e][f][g][h][i]': 'j' } } }); -``` - -The depth limit helps mitigate abuse when **qs** is used to parse user input, and it is recommended to keep it a reasonably small number. - -For similar reasons, by default **qs** will only parse up to 1000 parameters. This can be overridden by passing a `parameterLimit` option: - -```javascript -var limited = qs.parse('a=b&c=d', { parameterLimit: 1 }); -assert.deepEqual(limited, { a: 'b' }); -``` - -An optional delimiter can also be passed: - -```javascript -var delimited = qs.parse('a=b;c=d', { delimiter: ';' }); -assert.deepEqual(delimited, { a: 'b', c: 'd' }); -``` - -Delimiters can be a regular expression too: - -```javascript -var regexed = qs.parse('a=b;c=d,e=f', { delimiter: /[;,]/ }); -assert.deepEqual(regexed, { a: 'b', c: 'd', e: 'f' }); -``` - -Option `allowDots` can be used to enable dot notation: - -```javascript -var withDots = qs.parse('a.b=c', { allowDots: true }); -assert.deepEqual(withDots, { a: { b: 'c' } }); -``` - -### Parsing Arrays - -**qs** can also parse arrays using a similar `[]` notation: - -```javascript -var withArray = qs.parse('a[]=b&a[]=c'); -assert.deepEqual(withArray, { a: ['b', 'c'] }); -``` - -You may specify an index as well: - -```javascript -var withIndexes = qs.parse('a[1]=c&a[0]=b'); -assert.deepEqual(withIndexes, { a: ['b', 'c'] }); -``` - -Note that the only difference between an index in an array and a key in an object is that the value between the brackets must be a number -to create an array. When creating arrays with specific indices, **qs** will compact a sparse array to only the existing values preserving -their order: - -```javascript -var noSparse = qs.parse('a[1]=b&a[15]=c'); -assert.deepEqual(noSparse, { a: ['b', 'c'] }); -``` - -Note that an empty string is also a value, and will be preserved: - -```javascript -var withEmptyString = qs.parse('a[]=&a[]=b'); -assert.deepEqual(withEmptyString, { a: ['', 'b'] }); - -var withIndexedEmptyString = qs.parse('a[0]=b&a[1]=&a[2]=c'); -assert.deepEqual(withIndexedEmptyString, { a: ['b', '', 'c'] }); -``` - -**qs** will also limit specifying indices in an array to a maximum index of `20`. Any array members with an index of greater than `20` will -instead be converted to an object with the index as the key: - -```javascript -var withMaxIndex = qs.parse('a[100]=b'); -assert.deepEqual(withMaxIndex, { a: { '100': 'b' } }); -``` - -This limit can be overridden by passing an `arrayLimit` option: - -```javascript -var withArrayLimit = qs.parse('a[1]=b', { arrayLimit: 0 }); -assert.deepEqual(withArrayLimit, { a: { '1': 'b' } }); -``` - -To disable array parsing entirely, set `parseArrays` to `false`. - -```javascript -var noParsingArrays = qs.parse('a[]=b', { parseArrays: false }); -assert.deepEqual(noParsingArrays, { a: { '0': 'b' } }); -``` - -If you mix notations, **qs** will merge the two items into an object: - -```javascript -var mixedNotation = qs.parse('a[0]=b&a[b]=c'); -assert.deepEqual(mixedNotation, { a: { '0': 'b', b: 'c' } }); -``` - -You can also create arrays of objects: - -```javascript -var arraysOfObjects = qs.parse('a[][b]=c'); -assert.deepEqual(arraysOfObjects, { a: [{ b: 'c' }] }); -``` - -### Stringifying - -[](#preventEval) -```javascript -qs.stringify(object, [options]); -``` - -When stringifying, **qs** by default URI encodes output. Objects are stringified as you would expect: - -```javascript -assert.equal(qs.stringify({ a: 'b' }), 'a=b'); -assert.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); -``` - -This encoding can be disabled by setting the `encode` option to `false`: - -```javascript -var unencoded = qs.stringify({ a: { b: 'c' } }, { encode: false }); -assert.equal(unencoded, 'a[b]=c'); -``` - -Examples beyond this point will be shown as though the output is not URI encoded for clarity. Please note that the return values in these cases *will* be URI encoded during real usage. - -When arrays are stringified, by default they are given explicit indices: - -```javascript -qs.stringify({ a: ['b', 'c', 'd'] }); -// 'a[0]=b&a[1]=c&a[2]=d' -``` - -You may override this by setting the `indices` option to `false`: - -```javascript -qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }); -// 'a=b&a=c&a=d' -``` - -You may use the `arrayFormat` option to specify the format of the output array - -```javascript -qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }) -// 'a[0]=b&a[1]=c' -qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }) -// 'a[]=b&a[]=c' -qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }) -// 'a=b&a=c' -``` - -Empty strings and null values will omit the value, but the equals sign (=) remains in place: - -```javascript -assert.equal(qs.stringify({ a: '' }), 'a='); -``` - -Properties that are set to `undefined` will be omitted entirely: - -```javascript -assert.equal(qs.stringify({ a: null, b: undefined }), 'a='); -``` - -The delimiter may be overridden with stringify as well: - -```javascript -assert.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); -``` - -Finally, you can use the `filter` option to restrict which keys will be included in the stringified output. -If you pass a function, it will be called for each key to obtain the replacement value. Otherwise, if you -pass an array, it will be used to select properties and array indices for stringification: - -```javascript -function filterFunc(prefix, value) { - if (prefix == 'b') { - // Return an `undefined` value to omit a property. - return; - } - if (prefix == 'e[f]') { - return value.getTime(); - } - if (prefix == 'e[g][0]') { - return value * 2; - } - return value; -} -qs.stringify({ a: 'b', c: 'd', e: { f: new Date(123), g: [2] } }, { filter: filterFunc }); -// 'a=b&c=d&e[f]=123&e[g][0]=4' -qs.stringify({ a: 'b', c: 'd', e: 'f' }, { filter: ['a', 'e'] }); -// 'a=b&e=f' -qs.stringify({ a: ['b', 'c', 'd'], e: 'f' }, { filter: ['a', 0, 2] }); -// 'a[0]=b&a[2]=d' -``` - -### Handling of `null` values - -By default, `null` values are treated like empty strings: - -```javascript -var withNull = qs.stringify({ a: null, b: '' }); -assert.equal(withNull, 'a=&b='); -``` - -Parsing does not distinguish between parameters with and without equal signs. Both are converted to empty strings. - -```javascript -var equalsInsensitive = qs.parse('a&b='); -assert.deepEqual(equalsInsensitive, { a: '', b: '' }); -``` - -To distinguish between `null` values and empty strings use the `strictNullHandling` flag. In the result string the `null` -values have no `=` sign: - -```javascript -var strictNull = qs.stringify({ a: null, b: '' }, { strictNullHandling: true }); -assert.equal(strictNull, 'a&b='); -``` - -To parse values without `=` back to `null` use the `strictNullHandling` flag: - -```javascript -var parsedStrictNull = qs.parse('a&b=', { strictNullHandling: true }); -assert.deepEqual(parsedStrictNull, { a: null, b: '' }); -``` - -To completely skip rendering keys with `null` values, use the `skipNulls` flag: - -```javascript -var nullsSkipped = qs.stringify({ a: 'b', c: null}, { skipNulls: true }); -assert.equal(nullsSkipped, 'a=b'); -``` diff --git a/APIs/node_modules/request/node_modules/qs/bower.json b/APIs/node_modules/request/node_modules/qs/bower.json deleted file mode 100644 index 44f05064..00000000 --- a/APIs/node_modules/request/node_modules/qs/bower.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "qs", - "main": "dist/qs.js", - "homepage": "https://github.com/hapijs/qs", - "authors": [ - "Nathan LaFreniere " - ], - "description": "A querystring parser that supports nesting and arrays, with a depth limit", - "keywords": [ - "querystring", - "qs" - ], - "license": "BSD-3-Clause", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/APIs/node_modules/request/node_modules/qs/component.json b/APIs/node_modules/request/node_modules/qs/component.json deleted file mode 100644 index cb8d93fb..00000000 --- a/APIs/node_modules/request/node_modules/qs/component.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "qs", - "repository": "hapijs/qs", - "description": "query-string parser / stringifier with nesting support", - "version": "6.1.0", - "keywords": ["querystring", "query", "parser"], - "main": "lib/index.js", - "scripts": [ - "lib/index.js", - "lib/parse.js", - "lib/stringify.js", - "lib/utils.js" - ], - "license": "BSD-3-Clause" -} diff --git a/APIs/node_modules/request/node_modules/qs/dist/qs.js b/APIs/node_modules/request/node_modules/qs/dist/qs.js deleted file mode 100644 index bb8ea31a..00000000 --- a/APIs/node_modules/request/node_modules/qs/dist/qs.js +++ /dev/null @@ -1,476 +0,0 @@ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Qs = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o= 0 && - (options.parseArrays && index <= options.arrayLimit) - ) { - obj = []; - obj[index] = internals.parseObject(chain, val, options); - } else { - obj[cleanRoot] = internals.parseObject(chain, val, options); - } - } - - return obj; -}; - -internals.parseKeys = function (givenKey, val, options) { - if (!givenKey) { - return; - } - - // Transform dot notation to bracket notation - var key = options.allowDots ? givenKey.replace(/\.([^\.\[]+)/g, '[$1]') : givenKey; - - // The regex chunks - - var parent = /^([^\[\]]*)/; - var child = /(\[[^\[\]]*\])/g; - - // Get the parent - - var segment = parent.exec(key); - - // Stash the parent if it exists - - var keys = []; - if (segment[1]) { - // If we aren't using plain objects, optionally prefix keys - // that would overwrite object prototype properties - if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) { - if (!options.allowPrototypes) { - return; - } - } - - keys.push(segment[1]); - } - - // Loop through children appending to the array until we hit depth - - var i = 0; - while ((segment = child.exec(key)) !== null && i < options.depth) { - i += 1; - if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) { - if (!options.allowPrototypes) { - continue; - } - } - keys.push(segment[1]); - } - - // If there's a remainder, just add whatever is left - - if (segment) { - keys.push('[' + key.slice(segment.index) + ']'); - } - - return internals.parseObject(keys, val, options); -}; - -module.exports = function (str, opts) { - var options = opts || {}; - options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; - options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; - options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; - options.parseArrays = options.parseArrays !== false; - options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots; - options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects; - options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes; - options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; - options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling; - - if ( - str === '' || - str === null || - typeof str === 'undefined' - ) { - return options.plainObjects ? Object.create(null) : {}; - } - - var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; - var obj = options.plainObjects ? Object.create(null) : {}; - - // Iterate over the keys and setup the new object - - var keys = Object.keys(tempObj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var newObj = internals.parseKeys(key, tempObj[key], options); - obj = Utils.merge(obj, newObj, options); - } - - return Utils.compact(obj); -}; - -},{"./utils":4}],3:[function(require,module,exports){ -'use strict'; - -var Utils = require('./utils'); - -var internals = { - delimiter: '&', - arrayPrefixGenerators: { - brackets: function (prefix) { - return prefix + '[]'; - }, - indices: function (prefix, key) { - return prefix + '[' + key + ']'; - }, - repeat: function (prefix) { - return prefix; - } - }, - strictNullHandling: false, - skipNulls: false, - encode: true -}; - -internals.stringify = function (object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots) { - var obj = object; - if (typeof filter === 'function') { - obj = filter(prefix, obj); - } else if (Utils.isBuffer(obj)) { - obj = String(obj); - } else if (obj instanceof Date) { - obj = obj.toISOString(); - } else if (obj === null) { - if (strictNullHandling) { - return encode ? Utils.encode(prefix) : prefix; - } - - obj = ''; - } - - if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') { - if (encode) { - return [Utils.encode(prefix) + '=' + Utils.encode(obj)]; - } - return [prefix + '=' + obj]; - } - - var values = []; - - if (typeof obj === 'undefined') { - return values; - } - - var objKeys; - if (Array.isArray(filter)) { - objKeys = filter; - } else { - var keys = Object.keys(obj); - objKeys = sort ? keys.sort(sort) : keys; - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - - if (skipNulls && obj[key] === null) { - continue; - } - - if (Array.isArray(obj)) { - values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots)); - } else { - values = values.concat(internals.stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots)); - } - } - - return values; -}; - -module.exports = function (object, opts) { - var obj = object; - var options = opts || {}; - var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter; - var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling; - var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls; - var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode; - var sort = typeof options.sort === 'function' ? options.sort : null; - var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; - var objKeys; - var filter; - if (typeof options.filter === 'function') { - filter = options.filter; - obj = filter('', obj); - } else if (Array.isArray(options.filter)) { - objKeys = filter = options.filter; - } - - var keys = []; - - if (typeof obj !== 'object' || obj === null) { - return ''; - } - - var arrayFormat; - if (options.arrayFormat in internals.arrayPrefixGenerators) { - arrayFormat = options.arrayFormat; - } else if ('indices' in options) { - arrayFormat = options.indices ? 'indices' : 'repeat'; - } else { - arrayFormat = 'indices'; - } - - var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat]; - - if (!objKeys) { - objKeys = Object.keys(obj); - } - - if (sort) { - objKeys.sort(sort); - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - - if (skipNulls && obj[key] === null) { - continue; - } - - keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots)); - } - - return keys.join(delimiter); -}; - -},{"./utils":4}],4:[function(require,module,exports){ -'use strict'; - -var hexTable = (function () { - var array = new Array(256); - for (var i = 0; i < 256; ++i) { - array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase(); - } - - return array; -}()); - -exports.arrayToObject = function (source, options) { - var obj = options.plainObjects ? Object.create(null) : {}; - for (var i = 0; i < source.length; ++i) { - if (typeof source[i] !== 'undefined') { - obj[i] = source[i]; - } - } - - return obj; -}; - -exports.merge = function (target, source, options) { - if (!source) { - return target; - } - - if (typeof source !== 'object') { - if (Array.isArray(target)) { - target.push(source); - } else if (typeof target === 'object') { - target[source] = true; - } else { - return [target, source]; - } - - return target; - } - - if (typeof target !== 'object') { - return [target].concat(source); - } - - var mergeTarget = target; - if (Array.isArray(target) && !Array.isArray(source)) { - mergeTarget = exports.arrayToObject(target, options); - } - - return Object.keys(source).reduce(function (acc, key) { - var value = source[key]; - - if (Object.prototype.hasOwnProperty.call(acc, key)) { - acc[key] = exports.merge(acc[key], value, options); - } else { - acc[key] = value; - } - return acc; - }, mergeTarget); -}; - -exports.decode = function (str) { - try { - return decodeURIComponent(str.replace(/\+/g, ' ')); - } catch (e) { - return str; - } -}; - -exports.encode = function (str) { - // This code was originally written by Brian White (mscdex) for the io.js core querystring library. - // It has been adapted here for stricter adherence to RFC 3986 - if (str.length === 0) { - return str; - } - - var string = typeof str === 'string' ? str : String(str); - - var out = ''; - for (var i = 0; i < string.length; ++i) { - var c = string.charCodeAt(i); - - if ( - c === 0x2D || // - - c === 0x2E || // . - c === 0x5F || // _ - c === 0x7E || // ~ - (c >= 0x30 && c <= 0x39) || // 0-9 - (c >= 0x41 && c <= 0x5A) || // a-z - (c >= 0x61 && c <= 0x7A) // A-Z - ) { - out += string.charAt(i); - continue; - } - - if (c < 0x80) { - out = out + hexTable[c]; - continue; - } - - if (c < 0x800) { - out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); - continue; - } - - if (c < 0xD800 || c >= 0xE000) { - out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); - continue; - } - - i += 1; - c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); - out += (hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); - } - - return out; -}; - -exports.compact = function (obj, references) { - if (typeof obj !== 'object' || obj === null) { - return obj; - } - - var refs = references || []; - var lookup = refs.indexOf(obj); - if (lookup !== -1) { - return refs[lookup]; - } - - refs.push(obj); - - if (Array.isArray(obj)) { - var compacted = []; - - for (var i = 0; i < obj.length; ++i) { - if (typeof obj[i] !== 'undefined') { - compacted.push(obj[i]); - } - } - - return compacted; - } - - var keys = Object.keys(obj); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - obj[key] = exports.compact(obj[key], refs); - } - - return obj; -}; - -exports.isRegExp = function (obj) { - return Object.prototype.toString.call(obj) === '[object RegExp]'; -}; - -exports.isBuffer = function (obj) { - if (obj === null || typeof obj === 'undefined') { - return false; - } - - return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); -}; - -},{}]},{},[1])(1) -}); \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/qs/lib/index.js b/APIs/node_modules/request/node_modules/qs/lib/index.js deleted file mode 100755 index 19019590..00000000 --- a/APIs/node_modules/request/node_modules/qs/lib/index.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -var Stringify = require('./stringify'); -var Parse = require('./parse'); - -module.exports = { - stringify: Stringify, - parse: Parse -}; diff --git a/APIs/node_modules/request/node_modules/qs/lib/parse.js b/APIs/node_modules/request/node_modules/qs/lib/parse.js deleted file mode 100755 index 9b6cbd22..00000000 --- a/APIs/node_modules/request/node_modules/qs/lib/parse.js +++ /dev/null @@ -1,164 +0,0 @@ -'use strict'; - -var Utils = require('./utils'); - -var internals = { - delimiter: '&', - depth: 5, - arrayLimit: 20, - parameterLimit: 1000, - strictNullHandling: false, - plainObjects: false, - allowPrototypes: false, - allowDots: false -}; - -internals.parseValues = function (str, options) { - var obj = {}; - var parts = str.split(options.delimiter, options.parameterLimit === Infinity ? undefined : options.parameterLimit); - - for (var i = 0; i < parts.length; ++i) { - var part = parts[i]; - var pos = part.indexOf(']=') === -1 ? part.indexOf('=') : part.indexOf(']=') + 1; - - if (pos === -1) { - obj[Utils.decode(part)] = ''; - - if (options.strictNullHandling) { - obj[Utils.decode(part)] = null; - } - } else { - var key = Utils.decode(part.slice(0, pos)); - var val = Utils.decode(part.slice(pos + 1)); - - if (Object.prototype.hasOwnProperty.call(obj, key)) { - obj[key] = [].concat(obj[key]).concat(val); - } else { - obj[key] = val; - } - } - } - - return obj; -}; - -internals.parseObject = function (chain, val, options) { - if (!chain.length) { - return val; - } - - var root = chain.shift(); - - var obj; - if (root === '[]') { - obj = []; - obj = obj.concat(internals.parseObject(chain, val, options)); - } else { - obj = options.plainObjects ? Object.create(null) : {}; - var cleanRoot = root[0] === '[' && root[root.length - 1] === ']' ? root.slice(1, root.length - 1) : root; - var index = parseInt(cleanRoot, 10); - if ( - !isNaN(index) && - root !== cleanRoot && - String(index) === cleanRoot && - index >= 0 && - (options.parseArrays && index <= options.arrayLimit) - ) { - obj = []; - obj[index] = internals.parseObject(chain, val, options); - } else { - obj[cleanRoot] = internals.parseObject(chain, val, options); - } - } - - return obj; -}; - -internals.parseKeys = function (givenKey, val, options) { - if (!givenKey) { - return; - } - - // Transform dot notation to bracket notation - var key = options.allowDots ? givenKey.replace(/\.([^\.\[]+)/g, '[$1]') : givenKey; - - // The regex chunks - - var parent = /^([^\[\]]*)/; - var child = /(\[[^\[\]]*\])/g; - - // Get the parent - - var segment = parent.exec(key); - - // Stash the parent if it exists - - var keys = []; - if (segment[1]) { - // If we aren't using plain objects, optionally prefix keys - // that would overwrite object prototype properties - if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1])) { - if (!options.allowPrototypes) { - return; - } - } - - keys.push(segment[1]); - } - - // Loop through children appending to the array until we hit depth - - var i = 0; - while ((segment = child.exec(key)) !== null && i < options.depth) { - i += 1; - if (!options.plainObjects && Object.prototype.hasOwnProperty(segment[1].replace(/\[|\]/g, ''))) { - if (!options.allowPrototypes) { - continue; - } - } - keys.push(segment[1]); - } - - // If there's a remainder, just add whatever is left - - if (segment) { - keys.push('[' + key.slice(segment.index) + ']'); - } - - return internals.parseObject(keys, val, options); -}; - -module.exports = function (str, opts) { - var options = opts || {}; - options.delimiter = typeof options.delimiter === 'string' || Utils.isRegExp(options.delimiter) ? options.delimiter : internals.delimiter; - options.depth = typeof options.depth === 'number' ? options.depth : internals.depth; - options.arrayLimit = typeof options.arrayLimit === 'number' ? options.arrayLimit : internals.arrayLimit; - options.parseArrays = options.parseArrays !== false; - options.allowDots = typeof options.allowDots === 'boolean' ? options.allowDots : internals.allowDots; - options.plainObjects = typeof options.plainObjects === 'boolean' ? options.plainObjects : internals.plainObjects; - options.allowPrototypes = typeof options.allowPrototypes === 'boolean' ? options.allowPrototypes : internals.allowPrototypes; - options.parameterLimit = typeof options.parameterLimit === 'number' ? options.parameterLimit : internals.parameterLimit; - options.strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling; - - if ( - str === '' || - str === null || - typeof str === 'undefined' - ) { - return options.plainObjects ? Object.create(null) : {}; - } - - var tempObj = typeof str === 'string' ? internals.parseValues(str, options) : str; - var obj = options.plainObjects ? Object.create(null) : {}; - - // Iterate over the keys and setup the new object - - var keys = Object.keys(tempObj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var newObj = internals.parseKeys(key, tempObj[key], options); - obj = Utils.merge(obj, newObj, options); - } - - return Utils.compact(obj); -}; diff --git a/APIs/node_modules/request/node_modules/qs/lib/stringify.js b/APIs/node_modules/request/node_modules/qs/lib/stringify.js deleted file mode 100755 index 892dad45..00000000 --- a/APIs/node_modules/request/node_modules/qs/lib/stringify.js +++ /dev/null @@ -1,131 +0,0 @@ -'use strict'; - -var Utils = require('./utils'); - -var internals = { - delimiter: '&', - arrayPrefixGenerators: { - brackets: function (prefix) { - return prefix + '[]'; - }, - indices: function (prefix, key) { - return prefix + '[' + key + ']'; - }, - repeat: function (prefix) { - return prefix; - } - }, - strictNullHandling: false, - skipNulls: false, - encode: true -}; - -internals.stringify = function (object, prefix, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots) { - var obj = object; - if (typeof filter === 'function') { - obj = filter(prefix, obj); - } else if (Utils.isBuffer(obj)) { - obj = String(obj); - } else if (obj instanceof Date) { - obj = obj.toISOString(); - } else if (obj === null) { - if (strictNullHandling) { - return encode ? Utils.encode(prefix) : prefix; - } - - obj = ''; - } - - if (typeof obj === 'string' || typeof obj === 'number' || typeof obj === 'boolean') { - if (encode) { - return [Utils.encode(prefix) + '=' + Utils.encode(obj)]; - } - return [prefix + '=' + obj]; - } - - var values = []; - - if (typeof obj === 'undefined') { - return values; - } - - var objKeys; - if (Array.isArray(filter)) { - objKeys = filter; - } else { - var keys = Object.keys(obj); - objKeys = sort ? keys.sort(sort) : keys; - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - - if (skipNulls && obj[key] === null) { - continue; - } - - if (Array.isArray(obj)) { - values = values.concat(internals.stringify(obj[key], generateArrayPrefix(prefix, key), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots)); - } else { - values = values.concat(internals.stringify(obj[key], prefix + (allowDots ? '.' + key : '[' + key + ']'), generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots)); - } - } - - return values; -}; - -module.exports = function (object, opts) { - var obj = object; - var options = opts || {}; - var delimiter = typeof options.delimiter === 'undefined' ? internals.delimiter : options.delimiter; - var strictNullHandling = typeof options.strictNullHandling === 'boolean' ? options.strictNullHandling : internals.strictNullHandling; - var skipNulls = typeof options.skipNulls === 'boolean' ? options.skipNulls : internals.skipNulls; - var encode = typeof options.encode === 'boolean' ? options.encode : internals.encode; - var sort = typeof options.sort === 'function' ? options.sort : null; - var allowDots = typeof options.allowDots === 'undefined' ? false : options.allowDots; - var objKeys; - var filter; - if (typeof options.filter === 'function') { - filter = options.filter; - obj = filter('', obj); - } else if (Array.isArray(options.filter)) { - objKeys = filter = options.filter; - } - - var keys = []; - - if (typeof obj !== 'object' || obj === null) { - return ''; - } - - var arrayFormat; - if (options.arrayFormat in internals.arrayPrefixGenerators) { - arrayFormat = options.arrayFormat; - } else if ('indices' in options) { - arrayFormat = options.indices ? 'indices' : 'repeat'; - } else { - arrayFormat = 'indices'; - } - - var generateArrayPrefix = internals.arrayPrefixGenerators[arrayFormat]; - - if (!objKeys) { - objKeys = Object.keys(obj); - } - - if (sort) { - objKeys.sort(sort); - } - - for (var i = 0; i < objKeys.length; ++i) { - var key = objKeys[i]; - - if (skipNulls && obj[key] === null) { - continue; - } - - keys = keys.concat(internals.stringify(obj[key], key, generateArrayPrefix, strictNullHandling, skipNulls, encode, filter, sort, allowDots)); - } - - return keys.join(delimiter); -}; diff --git a/APIs/node_modules/request/node_modules/qs/lib/utils.js b/APIs/node_modules/request/node_modules/qs/lib/utils.js deleted file mode 100755 index 5d433560..00000000 --- a/APIs/node_modules/request/node_modules/qs/lib/utils.js +++ /dev/null @@ -1,162 +0,0 @@ -'use strict'; - -var hexTable = (function () { - var array = new Array(256); - for (var i = 0; i < 256; ++i) { - array[i] = '%' + ((i < 16 ? '0' : '') + i.toString(16)).toUpperCase(); - } - - return array; -}()); - -exports.arrayToObject = function (source, options) { - var obj = options.plainObjects ? Object.create(null) : {}; - for (var i = 0; i < source.length; ++i) { - if (typeof source[i] !== 'undefined') { - obj[i] = source[i]; - } - } - - return obj; -}; - -exports.merge = function (target, source, options) { - if (!source) { - return target; - } - - if (typeof source !== 'object') { - if (Array.isArray(target)) { - target.push(source); - } else if (typeof target === 'object') { - target[source] = true; - } else { - return [target, source]; - } - - return target; - } - - if (typeof target !== 'object') { - return [target].concat(source); - } - - var mergeTarget = target; - if (Array.isArray(target) && !Array.isArray(source)) { - mergeTarget = exports.arrayToObject(target, options); - } - - return Object.keys(source).reduce(function (acc, key) { - var value = source[key]; - - if (Object.prototype.hasOwnProperty.call(acc, key)) { - acc[key] = exports.merge(acc[key], value, options); - } else { - acc[key] = value; - } - return acc; - }, mergeTarget); -}; - -exports.decode = function (str) { - try { - return decodeURIComponent(str.replace(/\+/g, ' ')); - } catch (e) { - return str; - } -}; - -exports.encode = function (str) { - // This code was originally written by Brian White (mscdex) for the io.js core querystring library. - // It has been adapted here for stricter adherence to RFC 3986 - if (str.length === 0) { - return str; - } - - var string = typeof str === 'string' ? str : String(str); - - var out = ''; - for (var i = 0; i < string.length; ++i) { - var c = string.charCodeAt(i); - - if ( - c === 0x2D || // - - c === 0x2E || // . - c === 0x5F || // _ - c === 0x7E || // ~ - (c >= 0x30 && c <= 0x39) || // 0-9 - (c >= 0x41 && c <= 0x5A) || // a-z - (c >= 0x61 && c <= 0x7A) // A-Z - ) { - out += string.charAt(i); - continue; - } - - if (c < 0x80) { - out = out + hexTable[c]; - continue; - } - - if (c < 0x800) { - out = out + (hexTable[0xC0 | (c >> 6)] + hexTable[0x80 | (c & 0x3F)]); - continue; - } - - if (c < 0xD800 || c >= 0xE000) { - out = out + (hexTable[0xE0 | (c >> 12)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); - continue; - } - - i += 1; - c = 0x10000 + (((c & 0x3FF) << 10) | (string.charCodeAt(i) & 0x3FF)); - out += (hexTable[0xF0 | (c >> 18)] + hexTable[0x80 | ((c >> 12) & 0x3F)] + hexTable[0x80 | ((c >> 6) & 0x3F)] + hexTable[0x80 | (c & 0x3F)]); - } - - return out; -}; - -exports.compact = function (obj, references) { - if (typeof obj !== 'object' || obj === null) { - return obj; - } - - var refs = references || []; - var lookup = refs.indexOf(obj); - if (lookup !== -1) { - return refs[lookup]; - } - - refs.push(obj); - - if (Array.isArray(obj)) { - var compacted = []; - - for (var i = 0; i < obj.length; ++i) { - if (typeof obj[i] !== 'undefined') { - compacted.push(obj[i]); - } - } - - return compacted; - } - - var keys = Object.keys(obj); - for (var j = 0; j < keys.length; ++j) { - var key = keys[j]; - obj[key] = exports.compact(obj[key], refs); - } - - return obj; -}; - -exports.isRegExp = function (obj) { - return Object.prototype.toString.call(obj) === '[object RegExp]'; -}; - -exports.isBuffer = function (obj) { - if (obj === null || typeof obj === 'undefined') { - return false; - } - - return !!(obj.constructor && obj.constructor.isBuffer && obj.constructor.isBuffer(obj)); -}; diff --git a/APIs/node_modules/request/node_modules/qs/package.json b/APIs/node_modules/request/node_modules/qs/package.json deleted file mode 100644 index 6b5dbeb6..00000000 --- a/APIs/node_modules/request/node_modules/qs/package.json +++ /dev/null @@ -1,83 +0,0 @@ -{ - "name": "qs", - "description": "A querystring parser that supports nesting and arrays, with a depth limit", - "homepage": "https://github.com/ljharb/qs", - "version": "6.1.0", - "repository": { - "type": "git", - "url": "git+https://github.com/ljharb/qs.git" - }, - "main": "lib/index.js", - "contributors": [ - { - "name": "Jordan Harband", - "email": "ljharb@gmail.com", - "url": "http://ljharb.codes" - } - ], - "keywords": [ - "querystring", - "qs" - ], - "engines": { - "node": ">=0.6" - }, - "dependencies": {}, - "devDependencies": { - "browserify": "^12.0.1", - "tape": "^4.3.0", - "covert": "^1.1.0", - "mkdirp": "^0.5.1", - "eslint": "^1.10.3", - "@ljharb/eslint-config": "^1.6.1", - "parallelshell": "^2.0.0", - "evalmd": "^0.0.16" - }, - "scripts": { - "test": "parallelshell 'npm run readme' 'npm run lint' 'npm run coverage'", - "tests-only": "node test", - "readme": "evalmd README.md", - "lint": "eslint lib/*.js text/*.js", - "coverage": "covert test", - "dist": "mkdirp dist && browserify --standalone Qs lib/index.js > dist/qs.js", - "prepublish": "npm run dist" - }, - "license": "BSD-3-Clause", - "gitHead": "5bd79545edb33d6a43398fec7df9ecef2da005ea", - "bugs": { - "url": "https://github.com/ljharb/qs/issues" - }, - "_id": "qs@6.1.0", - "_shasum": "ec1d1626b24278d99f0fdf4549e524e24eceeb26", - "_from": "qs@~6.1.0", - "_npmVersion": "3.3.12", - "_nodeVersion": "5.5.0", - "_npmUser": { - "name": "ljharb", - "email": "ljharb@gmail.com" - }, - "dist": { - "shasum": "ec1d1626b24278d99f0fdf4549e524e24eceeb26", - "tarball": "https://registry.npmjs.org/qs/-/qs-6.1.0.tgz" - }, - "maintainers": [ - { - "name": "hueniverse", - "email": "eran@hammer.io" - }, - { - "name": "ljharb", - "email": "ljharb@gmail.com" - }, - { - "name": "nlf", - "email": "quitlahok@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-5-east.internal.npmjs.com", - "tmp": "tmp/qs-6.1.0.tgz_1454565583082_0.44599376199766994" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/qs/-/qs-6.1.0.tgz" -} diff --git a/APIs/node_modules/request/node_modules/qs/test/index.js b/APIs/node_modules/request/node_modules/qs/test/index.js deleted file mode 100644 index b6a7d952..00000000 --- a/APIs/node_modules/request/node_modules/qs/test/index.js +++ /dev/null @@ -1,5 +0,0 @@ -require('./parse'); - -require('./stringify'); - -require('./utils'); diff --git a/APIs/node_modules/request/node_modules/qs/test/parse.js b/APIs/node_modules/request/node_modules/qs/test/parse.js deleted file mode 100755 index 5665d074..00000000 --- a/APIs/node_modules/request/node_modules/qs/test/parse.js +++ /dev/null @@ -1,393 +0,0 @@ -'use strict'; - -var test = require('tape'); -var qs = require('../'); - -test('parse()', function (t) { - t.test('parses a simple string', function (st) { - st.deepEqual(qs.parse('0=foo'), { '0': 'foo' }); - st.deepEqual(qs.parse('foo=c++'), { foo: 'c ' }); - st.deepEqual(qs.parse('a[>=]=23'), { a: { '>=': '23' } }); - st.deepEqual(qs.parse('a[<=>]==23'), { a: { '<=>': '=23' } }); - st.deepEqual(qs.parse('a[==]=23'), { a: { '==': '23' } }); - st.deepEqual(qs.parse('foo', { strictNullHandling: true }), { foo: null }); - st.deepEqual(qs.parse('foo'), { foo: '' }); - st.deepEqual(qs.parse('foo='), { foo: '' }); - st.deepEqual(qs.parse('foo=bar'), { foo: 'bar' }); - st.deepEqual(qs.parse(' foo = bar = baz '), { ' foo ': ' bar = baz ' }); - st.deepEqual(qs.parse('foo=bar=baz'), { foo: 'bar=baz' }); - st.deepEqual(qs.parse('foo=bar&bar=baz'), { foo: 'bar', bar: 'baz' }); - st.deepEqual(qs.parse('foo2=bar2&baz2='), { foo2: 'bar2', baz2: '' }); - st.deepEqual(qs.parse('foo=bar&baz', { strictNullHandling: true }), { foo: 'bar', baz: null }); - st.deepEqual(qs.parse('foo=bar&baz'), { foo: 'bar', baz: '' }); - st.deepEqual(qs.parse('cht=p3&chd=t:60,40&chs=250x100&chl=Hello|World'), { - cht: 'p3', - chd: 't:60,40', - chs: '250x100', - chl: 'Hello|World' - }); - st.end(); - }); - - t.test('allows enabling dot notation', function (st) { - st.deepEqual(qs.parse('a.b=c'), { 'a.b': 'c' }); - st.deepEqual(qs.parse('a.b=c', { allowDots: true }), { a: { b: 'c' } }); - st.end(); - }); - - t.deepEqual(qs.parse('a[b]=c'), { a: { b: 'c' } }, 'parses a single nested string'); - t.deepEqual(qs.parse('a[b][c]=d'), { a: { b: { c: 'd' } } }, 'parses a double nested string'); - t.deepEqual( - qs.parse('a[b][c][d][e][f][g][h]=i'), - { a: { b: { c: { d: { e: { f: { '[g][h]': 'i' } } } } } } }, - 'defaults to a depth of 5' - ); - - t.test('only parses one level when depth = 1', function (st) { - st.deepEqual(qs.parse('a[b][c]=d', { depth: 1 }), { a: { b: { '[c]': 'd' } } }); - st.deepEqual(qs.parse('a[b][c][d]=e', { depth: 1 }), { a: { b: { '[c][d]': 'e' } } }); - st.end(); - }); - - t.deepEqual(qs.parse('a=b&a=c'), { a: ['b', 'c'] }, 'parses a simple array'); - - t.test('parses an explicit array', function (st) { - st.deepEqual(qs.parse('a[]=b'), { a: ['b'] }); - st.deepEqual(qs.parse('a[]=b&a[]=c'), { a: ['b', 'c'] }); - st.deepEqual(qs.parse('a[]=b&a[]=c&a[]=d'), { a: ['b', 'c', 'd'] }); - st.end(); - }); - - t.test('parses a mix of simple and explicit arrays', function (st) { - st.deepEqual(qs.parse('a=b&a[]=c'), { a: ['b', 'c'] }); - st.deepEqual(qs.parse('a[]=b&a=c'), { a: ['b', 'c'] }); - st.deepEqual(qs.parse('a[0]=b&a=c'), { a: ['b', 'c'] }); - st.deepEqual(qs.parse('a=b&a[0]=c'), { a: ['b', 'c'] }); - st.deepEqual(qs.parse('a[1]=b&a=c'), { a: ['b', 'c'] }); - st.deepEqual(qs.parse('a=b&a[1]=c'), { a: ['b', 'c'] }); - st.end(); - }); - - t.test('parses a nested array', function (st) { - st.deepEqual(qs.parse('a[b][]=c&a[b][]=d'), { a: { b: ['c', 'd'] } }); - st.deepEqual(qs.parse('a[>=]=25'), { a: { '>=': '25' } }); - st.end(); - }); - - t.test('allows to specify array indices', function (st) { - st.deepEqual(qs.parse('a[1]=c&a[0]=b&a[2]=d'), { a: ['b', 'c', 'd'] }); - st.deepEqual(qs.parse('a[1]=c&a[0]=b'), { a: ['b', 'c'] }); - st.deepEqual(qs.parse('a[1]=c'), { a: ['c'] }); - st.end(); - }); - - t.test('limits specific array indices to 20', function (st) { - st.deepEqual(qs.parse('a[20]=a'), { a: ['a'] }); - st.deepEqual(qs.parse('a[21]=a'), { a: { '21': 'a' } }); - st.end(); - }); - - t.deepEqual(qs.parse('a[12b]=c'), { a: { '12b': 'c' } }, 'supports keys that begin with a number'); - - t.test('supports encoded = signs', function (st) { - st.deepEqual(qs.parse('he%3Dllo=th%3Dere'), { 'he=llo': 'th=ere' }); - st.end(); - }); - - t.test('is ok with url encoded strings', function (st) { - st.deepEqual(qs.parse('a[b%20c]=d'), { a: { 'b c': 'd' } }); - st.deepEqual(qs.parse('a[b]=c%20d'), { a: { b: 'c d' } }); - st.end(); - }); - - t.test('allows brackets in the value', function (st) { - st.deepEqual(qs.parse('pets=["tobi"]'), { pets: '["tobi"]' }); - st.deepEqual(qs.parse('operators=[">=", "<="]'), { operators: '[">=", "<="]' }); - st.end(); - }); - - t.test('allows empty values', function (st) { - st.deepEqual(qs.parse(''), {}); - st.deepEqual(qs.parse(null), {}); - st.deepEqual(qs.parse(undefined), {}); - st.end(); - }); - - t.test('transforms arrays to objects', function (st) { - st.deepEqual(qs.parse('foo[0]=bar&foo[bad]=baz'), { foo: { '0': 'bar', bad: 'baz' } }); - st.deepEqual(qs.parse('foo[bad]=baz&foo[0]=bar'), { foo: { bad: 'baz', '0': 'bar' } }); - st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar'), { foo: { bad: 'baz', '0': 'bar' } }); - st.deepEqual(qs.parse('foo[]=bar&foo[bad]=baz'), { foo: { '0': 'bar', bad: 'baz' } }); - st.deepEqual(qs.parse('foo[bad]=baz&foo[]=bar&foo[]=foo'), { foo: { bad: 'baz', '0': 'bar', '1': 'foo' } }); - st.deepEqual(qs.parse('foo[0][a]=a&foo[0][b]=b&foo[1][a]=aa&foo[1][b]=bb'), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); - st.deepEqual(qs.parse('a[]=b&a[t]=u&a[hasOwnProperty]=c'), { a: { '0': 'b', t: 'u', c: true } }); - st.deepEqual(qs.parse('a[]=b&a[hasOwnProperty]=c&a[x]=y'), { a: { '0': 'b', '1': 'c', x: 'y' } }); - st.end(); - }); - - t.test('transforms arrays to objects (dot notation)', function (st) { - st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: 'baz' } }); - st.deepEqual(qs.parse('foo[0].baz=bar&fool.bad.boo=baz', { allowDots: true }), { foo: [{ baz: 'bar' }], fool: { bad: { boo: 'baz' } } }); - st.deepEqual(qs.parse('foo[0][0].baz=bar&fool.bad=baz', { allowDots: true }), { foo: [[{ baz: 'bar' }]], fool: { bad: 'baz' } }); - st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15'], bar: '2' }] }); - st.deepEqual(qs.parse('foo[0].baz[0]=15&foo[0].baz[1]=16&foo[0].bar=2', { allowDots: true }), { foo: [{ baz: ['15', '16'], bar: '2' }] }); - st.deepEqual(qs.parse('foo.bad=baz&foo[0]=bar', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar' } }); - st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar' } }); - st.deepEqual(qs.parse('foo[]=bar&foo.bad=baz', { allowDots: true }), { foo: { '0': 'bar', bad: 'baz' } }); - st.deepEqual(qs.parse('foo.bad=baz&foo[]=bar&foo[]=foo', { allowDots: true }), { foo: { bad: 'baz', '0': 'bar', '1': 'foo' } }); - st.deepEqual(qs.parse('foo[0].a=a&foo[0].b=b&foo[1].a=aa&foo[1].b=bb', { allowDots: true }), { foo: [{ a: 'a', b: 'b' }, { a: 'aa', b: 'bb' }] }); - st.end(); - }); - - t.deepEqual(qs.parse('a[b]=c&a=d'), { a: { b: 'c', d: true } }, 'can add keys to objects'); - - t.test('correctly prunes undefined values when converting an array to an object', function (st) { - st.deepEqual(qs.parse('a[2]=b&a[99999999]=c'), { a: { '2': 'b', '99999999': 'c' } }); - st.end(); - }); - - t.test('supports malformed uri characters', function (st) { - st.deepEqual(qs.parse('{%:%}', { strictNullHandling: true }), { '{%:%}': null }); - st.deepEqual(qs.parse('{%:%}='), { '{%:%}': '' }); - st.deepEqual(qs.parse('foo=%:%}'), { foo: '%:%}' }); - st.end(); - }); - - t.test('doesn\'t produce empty keys', function (st) { - st.deepEqual(qs.parse('_r=1&'), { '_r': '1' }); - st.end(); - }); - - t.test('cannot access Object prototype', function (st) { - qs.parse('constructor[prototype][bad]=bad'); - qs.parse('bad[constructor][prototype][bad]=bad'); - st.equal(typeof Object.prototype.bad, 'undefined'); - st.end(); - }); - - t.test('parses arrays of objects', function (st) { - st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); - st.deepEqual(qs.parse('a[0][b]=c'), { a: [{ b: 'c' }] }); - st.end(); - }); - - t.test('allows for empty strings in arrays', function (st) { - st.deepEqual(qs.parse('a[]=b&a[]=&a[]=c'), { a: ['b', '', 'c'] }); - st.deepEqual(qs.parse('a[0]=b&a[1]&a[2]=c&a[19]=', { strictNullHandling: true }), { a: ['b', null, 'c', ''] }); - st.deepEqual(qs.parse('a[0]=b&a[1]=&a[2]=c&a[19]', { strictNullHandling: true }), { a: ['b', '', 'c', null] }); - st.deepEqual(qs.parse('a[]=&a[]=b&a[]=c'), { a: ['', 'b', 'c'] }); - st.end(); - }); - - t.test('compacts sparse arrays', function (st) { - st.deepEqual(qs.parse('a[10]=1&a[2]=2'), { a: ['2', '1'] }); - st.end(); - }); - - t.test('parses semi-parsed strings', function (st) { - st.deepEqual(qs.parse({ 'a[b]': 'c' }), { a: { b: 'c' } }); - st.deepEqual(qs.parse({ 'a[b]': 'c', 'a[d]': 'e' }), { a: { b: 'c', d: 'e' } }); - st.end(); - }); - - t.test('parses buffers correctly', function (st) { - var b = new Buffer('test'); - st.deepEqual(qs.parse({ a: b }), { a: b }); - st.end(); - }); - - t.test('continues parsing when no parent is found', function (st) { - st.deepEqual(qs.parse('[]=&a=b'), { '0': '', a: 'b' }); - st.deepEqual(qs.parse('[]&a=b', { strictNullHandling: true }), { '0': null, a: 'b' }); - st.deepEqual(qs.parse('[foo]=bar'), { foo: 'bar' }); - st.end(); - }); - - t.test('does not error when parsing a very long array', function (st) { - var str = 'a[]=a'; - while (Buffer.byteLength(str) < 128 * 1024) { - str = str + '&' + str; - } - - st.doesNotThrow(function () { qs.parse(str); }); - - st.end(); - }); - - t.test('should not throw when a native prototype has an enumerable property', { parallel: false }, function (st) { - Object.prototype.crash = ''; - Array.prototype.crash = ''; - st.doesNotThrow(qs.parse.bind(null, 'a=b')); - st.deepEqual(qs.parse('a=b'), { a: 'b' }); - st.doesNotThrow(qs.parse.bind(null, 'a[][b]=c')); - st.deepEqual(qs.parse('a[][b]=c'), { a: [{ b: 'c' }] }); - delete Object.prototype.crash; - delete Array.prototype.crash; - st.end(); - }); - - t.test('parses a string with an alternative string delimiter', function (st) { - st.deepEqual(qs.parse('a=b;c=d', { delimiter: ';' }), { a: 'b', c: 'd' }); - st.end(); - }); - - t.test('parses a string with an alternative RegExp delimiter', function (st) { - st.deepEqual(qs.parse('a=b; c=d', { delimiter: /[;,] */ }), { a: 'b', c: 'd' }); - st.end(); - }); - - t.test('does not use non-splittable objects as delimiters', function (st) { - st.deepEqual(qs.parse('a=b&c=d', { delimiter: true }), { a: 'b', c: 'd' }); - st.end(); - }); - - t.test('allows overriding parameter limit', function (st) { - st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: 1 }), { a: 'b' }); - st.end(); - }); - - t.test('allows setting the parameter limit to Infinity', function (st) { - st.deepEqual(qs.parse('a=b&c=d', { parameterLimit: Infinity }), { a: 'b', c: 'd' }); - st.end(); - }); - - t.test('allows overriding array limit', function (st) { - st.deepEqual(qs.parse('a[0]=b', { arrayLimit: -1 }), { a: { '0': 'b' } }); - st.deepEqual(qs.parse('a[-1]=b', { arrayLimit: -1 }), { a: { '-1': 'b' } }); - st.deepEqual(qs.parse('a[0]=b&a[1]=c', { arrayLimit: 0 }), { a: { '0': 'b', '1': 'c' } }); - st.end(); - }); - - t.test('allows disabling array parsing', function (st) { - st.deepEqual(qs.parse('a[0]=b&a[1]=c', { parseArrays: false }), { a: { '0': 'b', '1': 'c' } }); - st.end(); - }); - - t.test('parses an object', function (st) { - var input = { - 'user[name]': { 'pop[bob]': 3 }, - 'user[email]': null - }; - - var expected = { - user: { - name: { 'pop[bob]': 3 }, - email: null - } - }; - - var result = qs.parse(input); - - st.deepEqual(result, expected); - st.end(); - }); - - t.test('parses an object in dot notation', function (st) { - var input = { - 'user.name': { 'pop[bob]': 3 }, - 'user.email.': null - }; - - var expected = { - user: { - name: { 'pop[bob]': 3 }, - email: null - } - }; - - var result = qs.parse(input, { allowDots: true }); - - st.deepEqual(result, expected); - st.end(); - }); - - t.test('parses an object and not child values', function (st) { - var input = { - 'user[name]': { 'pop[bob]': { 'test': 3 } }, - 'user[email]': null - }; - - var expected = { - user: { - name: { 'pop[bob]': { 'test': 3 } }, - email: null - } - }; - - var result = qs.parse(input); - - st.deepEqual(result, expected); - st.end(); - }); - - t.test('does not blow up when Buffer global is missing', function (st) { - var tempBuffer = global.Buffer; - delete global.Buffer; - var result = qs.parse('a=b&c=d'); - global.Buffer = tempBuffer; - st.deepEqual(result, { a: 'b', c: 'd' }); - st.end(); - }); - - t.test('does not crash when parsing circular references', function (st) { - var a = {}; - a.b = a; - - var parsed; - - st.doesNotThrow(function () { - parsed = qs.parse({ 'foo[bar]': 'baz', 'foo[baz]': a }); - }); - - st.equal('foo' in parsed, true, 'parsed has "foo" property'); - st.equal('bar' in parsed.foo, true); - st.equal('baz' in parsed.foo, true); - st.equal(parsed.foo.bar, 'baz'); - st.deepEqual(parsed.foo.baz, a); - st.end(); - }); - - t.test('parses plain objects correctly', function (st) { - var a = Object.create(null); - a.b = 'c'; - - st.deepEqual(qs.parse(a), { b: 'c' }); - var result = qs.parse({ a: a }); - st.equal('a' in result, true, 'result has "a" property'); - st.deepEqual(result.a, a); - st.end(); - }); - - t.test('parses dates correctly', function (st) { - var now = new Date(); - st.deepEqual(qs.parse({ a: now }), { a: now }); - st.end(); - }); - - t.test('parses regular expressions correctly', function (st) { - var re = /^test$/; - st.deepEqual(qs.parse({ a: re }), { a: re }); - st.end(); - }); - - t.test('can allow overwriting prototype properties', function (st) { - st.deepEqual(qs.parse('a[hasOwnProperty]=b', { allowPrototypes: true }), { a: { hasOwnProperty: 'b' } }, { prototype: false }); - st.deepEqual(qs.parse('hasOwnProperty=b', { allowPrototypes: true }), { hasOwnProperty: 'b' }, { prototype: false }); - st.end(); - }); - - t.test('can return plain objects', function (st) { - var expected = Object.create(null); - expected.a = Object.create(null); - expected.a.b = 'c'; - expected.a.hasOwnProperty = 'd'; - st.deepEqual(qs.parse('a[b]=c&a[hasOwnProperty]=d', { plainObjects: true }), expected); - st.deepEqual(qs.parse(null, { plainObjects: true }), Object.create(null)); - var expectedArray = Object.create(null); - expectedArray.a = Object.create(null); - expectedArray.a['0'] = 'b'; - expectedArray.a.c = 'd'; - st.deepEqual(qs.parse('a[]=b&a[c]=d', { plainObjects: true }), expectedArray); - st.end(); - }); -}); diff --git a/APIs/node_modules/request/node_modules/qs/test/stringify.js b/APIs/node_modules/request/node_modules/qs/test/stringify.js deleted file mode 100755 index da72839d..00000000 --- a/APIs/node_modules/request/node_modules/qs/test/stringify.js +++ /dev/null @@ -1,259 +0,0 @@ -'use strict'; - -var test = require('tape'); -var qs = require('../'); - -test('stringify()', function (t) { - t.test('stringifies a querystring object', function (st) { - st.equal(qs.stringify({ a: 'b' }), 'a=b'); - st.equal(qs.stringify({ a: 1 }), 'a=1'); - st.equal(qs.stringify({ a: 1, b: 2 }), 'a=1&b=2'); - st.equal(qs.stringify({ a: 'A_Z' }), 'a=A_Z'); - st.equal(qs.stringify({ a: '€' }), 'a=%E2%82%AC'); - st.equal(qs.stringify({ a: '' }), 'a=%EE%80%80'); - st.equal(qs.stringify({ a: 'א' }), 'a=%D7%90'); - st.equal(qs.stringify({ a: '𐐷' }), 'a=%F0%90%90%B7'); - st.end(); - }); - - t.test('stringifies a nested object', function (st) { - st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); - st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }), 'a%5Bb%5D%5Bc%5D%5Bd%5D=e'); - st.end(); - }); - - t.test('stringifies a nested object with dots notation', function (st) { - st.equal(qs.stringify({ a: { b: 'c' } }, { allowDots: true }), 'a.b=c'); - st.equal(qs.stringify({ a: { b: { c: { d: 'e' } } } }, { allowDots: true }), 'a.b.c.d=e'); - st.end(); - }); - - t.test('stringifies an array value', function (st) { - st.equal(qs.stringify({ a: ['b', 'c', 'd'] }), 'a%5B0%5D=b&a%5B1%5D=c&a%5B2%5D=d'); - st.end(); - }); - - t.test('omits nulls when asked', function (st) { - st.equal(qs.stringify({ a: 'b', c: null }, { skipNulls: true }), 'a=b'); - st.end(); - }); - - - t.test('omits nested nulls when asked', function (st) { - st.equal(qs.stringify({ a: { b: 'c', d: null } }, { skipNulls: true }), 'a%5Bb%5D=c'); - st.end(); - }); - - t.test('omits array indices when asked', function (st) { - st.equal(qs.stringify({ a: ['b', 'c', 'd'] }, { indices: false }), 'a=b&a=c&a=d'); - st.end(); - }); - - t.test('stringifies a nested array value', function (st) { - st.equal(qs.stringify({ a: { b: ['c', 'd'] } }), 'a%5Bb%5D%5B0%5D=c&a%5Bb%5D%5B1%5D=d'); - st.end(); - }); - - t.test('stringifies a nested array value with dots notation', function (st) { - st.equal(qs.stringify({ a: { b: ['c', 'd'] } }, { allowDots: true, encode: false }), 'a.b[0]=c&a.b[1]=d'); - st.end(); - }); - - t.test('stringifies an object inside an array', function (st) { - st.equal(qs.stringify({ a: [{ b: 'c' }] }), 'a%5B0%5D%5Bb%5D=c'); - st.equal(qs.stringify({ a: [{ b: { c: [1] } }] }), 'a%5B0%5D%5Bb%5D%5Bc%5D%5B0%5D=1'); - st.end(); - }); - - t.test('stringifies an object inside an array with dots notation', function (st) { - st.equal(qs.stringify({ a: [{ b: 'c' }] }, { allowDots: true, encode: false }), 'a[0].b=c'); - st.equal(qs.stringify({ a: [{ b: { c: [1] } }] }, { allowDots: true, encode: false }), 'a[0].b.c[0]=1'); - st.end(); - }); - - t.test('does not omit object keys when indices = false', function (st) { - st.equal(qs.stringify({ a: [{ b: 'c' }] }, { indices: false }), 'a%5Bb%5D=c'); - st.end(); - }); - - t.test('uses indices notation for arrays when indices=true', function (st) { - st.equal(qs.stringify({ a: ['b', 'c'] }, { indices: true }), 'a%5B0%5D=b&a%5B1%5D=c'); - st.end(); - }); - - t.test('uses indices notation for arrays when no arrayFormat is specified', function (st) { - st.equal(qs.stringify({ a: ['b', 'c'] }), 'a%5B0%5D=b&a%5B1%5D=c'); - st.end(); - }); - - t.test('uses indices notation for arrays when no arrayFormat=indices', function (st) { - st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'indices' }), 'a%5B0%5D=b&a%5B1%5D=c'); - st.end(); - }); - - t.test('uses repeat notation for arrays when no arrayFormat=repeat', function (st) { - st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'repeat' }), 'a=b&a=c'); - st.end(); - }); - - t.test('uses brackets notation for arrays when no arrayFormat=brackets', function (st) { - st.equal(qs.stringify({ a: ['b', 'c'] }, { arrayFormat: 'brackets' }), 'a%5B%5D=b&a%5B%5D=c'); - st.end(); - }); - - t.test('stringifies a complicated object', function (st) { - st.equal(qs.stringify({ a: { b: 'c', d: 'e' } }), 'a%5Bb%5D=c&a%5Bd%5D=e'); - st.end(); - }); - - t.test('stringifies an empty value', function (st) { - st.equal(qs.stringify({ a: '' }), 'a='); - st.equal(qs.stringify({ a: null }, { strictNullHandling: true }), 'a'); - - st.equal(qs.stringify({ a: '', b: '' }), 'a=&b='); - st.equal(qs.stringify({ a: null, b: '' }, { strictNullHandling: true }), 'a&b='); - - st.equal(qs.stringify({ a: { b: '' } }), 'a%5Bb%5D='); - st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: true }), 'a%5Bb%5D'); - st.equal(qs.stringify({ a: { b: null } }, { strictNullHandling: false }), 'a%5Bb%5D='); - - st.end(); - }); - - t.test('stringifies an empty object', function (st) { - var obj = Object.create(null); - obj.a = 'b'; - st.equal(qs.stringify(obj), 'a=b'); - st.end(); - }); - - t.test('returns an empty string for invalid input', function (st) { - st.equal(qs.stringify(undefined), ''); - st.equal(qs.stringify(false), ''); - st.equal(qs.stringify(null), ''); - st.equal(qs.stringify(''), ''); - st.end(); - }); - - t.test('stringifies an object with an empty object as a child', function (st) { - var obj = { - a: Object.create(null) - }; - - obj.a.b = 'c'; - st.equal(qs.stringify(obj), 'a%5Bb%5D=c'); - st.end(); - }); - - t.test('drops keys with a value of undefined', function (st) { - st.equal(qs.stringify({ a: undefined }), ''); - - st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: true }), 'a%5Bc%5D'); - st.equal(qs.stringify({ a: { b: undefined, c: null } }, { strictNullHandling: false }), 'a%5Bc%5D='); - st.equal(qs.stringify({ a: { b: undefined, c: '' } }), 'a%5Bc%5D='); - st.end(); - }); - - t.test('url encodes values', function (st) { - st.equal(qs.stringify({ a: 'b c' }), 'a=b%20c'); - st.end(); - }); - - t.test('stringifies a date', function (st) { - var now = new Date(); - var str = 'a=' + encodeURIComponent(now.toISOString()); - st.equal(qs.stringify({ a: now }), str); - st.end(); - }); - - t.test('stringifies the weird object from qs', function (st) { - st.equal(qs.stringify({ 'my weird field': '~q1!2"\'w$5&7/z8)?' }), 'my%20weird%20field=~q1%212%22%27w%245%267%2Fz8%29%3F'); - st.end(); - }); - - t.test('skips properties that are part of the object prototype', function (st) { - Object.prototype.crash = 'test'; - st.equal(qs.stringify({ a: 'b' }), 'a=b'); - st.equal(qs.stringify({ a: { b: 'c' } }), 'a%5Bb%5D=c'); - delete Object.prototype.crash; - st.end(); - }); - - t.test('stringifies boolean values', function (st) { - st.equal(qs.stringify({ a: true }), 'a=true'); - st.equal(qs.stringify({ a: { b: true } }), 'a%5Bb%5D=true'); - st.equal(qs.stringify({ b: false }), 'b=false'); - st.equal(qs.stringify({ b: { c: false } }), 'b%5Bc%5D=false'); - st.end(); - }); - - t.test('stringifies buffer values', function (st) { - st.equal(qs.stringify({ a: new Buffer('test') }), 'a=test'); - st.equal(qs.stringify({ a: { b: new Buffer('test') } }), 'a%5Bb%5D=test'); - st.end(); - }); - - t.test('stringifies an object using an alternative delimiter', function (st) { - st.equal(qs.stringify({ a: 'b', c: 'd' }, { delimiter: ';' }), 'a=b;c=d'); - st.end(); - }); - - t.test('doesn\'t blow up when Buffer global is missing', function (st) { - var tempBuffer = global.Buffer; - delete global.Buffer; - var result = qs.stringify({ a: 'b', c: 'd' }); - global.Buffer = tempBuffer; - st.equal(result, 'a=b&c=d'); - st.end(); - }); - - t.test('selects properties when filter=array', function (st) { - st.equal(qs.stringify({ a: 'b' }, { filter: ['a'] }), 'a=b'); - st.equal(qs.stringify({ a: 1 }, { filter: [] }), ''); - st.equal(qs.stringify({ a: { b: [1, 2, 3, 4], c: 'd' }, c: 'f' }, { filter: ['a', 'b', 0, 2] }), 'a%5Bb%5D%5B0%5D=1&a%5Bb%5D%5B2%5D=3'); - st.end(); - }); - - t.test('supports custom representations when filter=function', function (st) { - var calls = 0; - var obj = { a: 'b', c: 'd', e: { f: new Date(1257894000000) } }; - var filterFunc = function (prefix, value) { - calls++; - if (calls === 1) { - st.equal(prefix, '', 'prefix is empty'); - st.equal(value, obj); - } else if (prefix === 'c') { - return; - } else if (value instanceof Date) { - st.equal(prefix, 'e[f]'); - return value.getTime(); - } - return value; - }; - - st.equal(qs.stringify(obj, { filter: filterFunc }), 'a=b&e%5Bf%5D=1257894000000'); - st.equal(calls, 5); - st.end(); - }); - - t.test('can disable uri encoding', function (st) { - st.equal(qs.stringify({ a: 'b' }, { encode: false }), 'a=b'); - st.equal(qs.stringify({ a: { b: 'c' } }, { encode: false }), 'a[b]=c'); - st.equal(qs.stringify({ a: 'b', c: null }, { strictNullHandling: true, encode: false }), 'a=b&c'); - st.end(); - }); - - t.test('can sort the keys', function (st) { - var sort = function (a, b) { return a.localeCompare(b); }; - st.equal(qs.stringify({ a: 'c', z: 'y', b: 'f' }, { sort: sort }), 'a=c&b=f&z=y'); - st.equal(qs.stringify({ a: 'c', z: { j: 'a', i: 'b' }, b: 'f' }, { sort: sort }), 'a=c&b=f&z%5Bi%5D=b&z%5Bj%5D=a'); - st.end(); - }); - - t.test('can sort the keys at depth 3 or more too', function (st) { - var sort = function (a, b) { return a.localeCompare(b); }; - st.equal(qs.stringify({ a: 'a', z: { zj: {zjb: 'zjb', zja: 'zja'}, zi: {zib: 'zib', zia: 'zia'} }, b: 'b' }, { sort: sort, encode: false }), 'a=a&b=b&z[zi][zia]=zia&z[zi][zib]=zib&z[zj][zja]=zja&z[zj][zjb]=zjb'); - st.equal(qs.stringify({ a: 'a', z: { zj: {zjb: 'zjb', zja: 'zja'}, zi: {zib: 'zib', zia: 'zia'} }, b: 'b' }, { sort: null, encode: false }), 'a=a&z[zj][zjb]=zjb&z[zj][zja]=zja&z[zi][zib]=zib&z[zi][zia]=zia&b=b'); - st.end(); - }); -}); diff --git a/APIs/node_modules/request/node_modules/qs/test/utils.js b/APIs/node_modules/request/node_modules/qs/test/utils.js deleted file mode 100755 index 4a8d8246..00000000 --- a/APIs/node_modules/request/node_modules/qs/test/utils.js +++ /dev/null @@ -1,9 +0,0 @@ -'use strict'; - -var test = require('tape'); -var utils = require('../lib/utils'); - -test('merge()', function (t) { - t.deepEqual(utils.merge({ a: 'b' }, { a: 'c' }), { a: ['b', 'c'] }, 'merges two objects with the same key'); - t.end(); -}); diff --git a/APIs/node_modules/request/node_modules/stringstream/.npmignore b/APIs/node_modules/request/node_modules/stringstream/.npmignore deleted file mode 100644 index 7dccd970..00000000 --- a/APIs/node_modules/request/node_modules/stringstream/.npmignore +++ /dev/null @@ -1,15 +0,0 @@ -lib-cov -*.seed -*.log -*.csv -*.dat -*.out -*.pid -*.gz - -pids -logs -results - -node_modules -npm-debug.log \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/stringstream/.travis.yml b/APIs/node_modules/request/node_modules/stringstream/.travis.yml deleted file mode 100644 index f1d0f13c..00000000 --- a/APIs/node_modules/request/node_modules/stringstream/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.4 - - 0.6 diff --git a/APIs/node_modules/request/node_modules/stringstream/LICENSE.txt b/APIs/node_modules/request/node_modules/stringstream/LICENSE.txt deleted file mode 100644 index ab861acd..00000000 --- a/APIs/node_modules/request/node_modules/stringstream/LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -Copyright (c) 2012 Michael Hart (michael.hart.au@gmail.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/APIs/node_modules/request/node_modules/stringstream/README.md b/APIs/node_modules/request/node_modules/stringstream/README.md deleted file mode 100644 index 32fc9825..00000000 --- a/APIs/node_modules/request/node_modules/stringstream/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# Decode streams into strings The Right Way(tm) - -```javascript -var fs = require('fs') -var zlib = require('zlib') -var strs = require('stringstream') - -var utf8Stream = fs.createReadStream('massiveLogFile.gz') - .pipe(zlib.createGunzip()) - .pipe(strs('utf8')) -``` - -No need to deal with `setEncoding()` weirdness, just compose streams -like they were supposed to be! - -Handles input and output encoding: - -```javascript -// Stream from utf8 to hex to base64... Why not, ay. -var hex64Stream = fs.createReadStream('myFile') - .pipe(strs('utf8', 'hex')) - .pipe(strs('hex', 'base64')) -``` - -Also deals with `base64` output correctly by aligning each emitted data -chunk so that there are no dangling `=` characters: - -```javascript -var stream = fs.createReadStream('myFile').pipe(strs('base64')) - -var base64Str = '' - -stream.on('data', function(data) { base64Str += data }) -stream.on('end', function() { - console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding() - console.log('Original file is: ' + new Buffer(base64Str, 'base64')) -}) -``` diff --git a/APIs/node_modules/request/node_modules/stringstream/example.js b/APIs/node_modules/request/node_modules/stringstream/example.js deleted file mode 100644 index f82b85ed..00000000 --- a/APIs/node_modules/request/node_modules/stringstream/example.js +++ /dev/null @@ -1,27 +0,0 @@ -var fs = require('fs') -var zlib = require('zlib') -var strs = require('stringstream') - -var utf8Stream = fs.createReadStream('massiveLogFile.gz') - .pipe(zlib.createGunzip()) - .pipe(strs('utf8')) - -utf8Stream.pipe(process.stdout) - -// Stream from utf8 to hex to base64... Why not, ay. -var hex64Stream = fs.createReadStream('myFile') - .pipe(strs('utf8', 'hex')) - .pipe(strs('hex', 'base64')) - -hex64Stream.pipe(process.stdout) - -// Deals with base64 correctly by aligning chunks -var stream = fs.createReadStream('myFile').pipe(strs('base64')) - -var base64Str = '' - -stream.on('data', function(data) { base64Str += data }) -stream.on('end', function() { - console.log('My base64 encoded file is: ' + base64Str) // Wouldn't work with setEncoding() - console.log('Original file is: ' + new Buffer(base64Str, 'base64')) -}) diff --git a/APIs/node_modules/request/node_modules/stringstream/package.json b/APIs/node_modules/request/node_modules/stringstream/package.json deleted file mode 100644 index 6d64cb4b..00000000 --- a/APIs/node_modules/request/node_modules/stringstream/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "stringstream", - "version": "0.0.5", - "description": "Encode and decode streams into string streams", - "author": { - "name": "Michael Hart", - "email": "michael.hart.au@gmail.com", - "url": "http://github.com/mhart" - }, - "main": "stringstream.js", - "keywords": [ - "string", - "stream", - "base64", - "gzip" - ], - "repository": { - "type": "git", - "url": "git+https://github.com/mhart/StringStream.git" - }, - "license": "MIT", - "gitHead": "1efe3bf507bf3a1161f8473908b60e881d41422b", - "bugs": { - "url": "https://github.com/mhart/StringStream/issues" - }, - "homepage": "https://github.com/mhart/StringStream#readme", - "_id": "stringstream@0.0.5", - "scripts": {}, - "_shasum": "4e484cd4de5a0bbbee18e46307710a8a81621878", - "_from": "stringstream@~0.0.4", - "_npmVersion": "2.14.8", - "_nodeVersion": "4.2.1", - "_npmUser": { - "name": "hichaelmart", - "email": "michael.hart.au@gmail.com" - }, - "maintainers": [ - { - "name": "hichaelmart", - "email": "michael.hart.au@gmail.com" - } - ], - "dist": { - "shasum": "4e484cd4de5a0bbbee18e46307710a8a81621878", - "tarball": "http://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/APIs/node_modules/request/node_modules/stringstream/stringstream.js b/APIs/node_modules/request/node_modules/stringstream/stringstream.js deleted file mode 100644 index 4ece1275..00000000 --- a/APIs/node_modules/request/node_modules/stringstream/stringstream.js +++ /dev/null @@ -1,102 +0,0 @@ -var util = require('util') -var Stream = require('stream') -var StringDecoder = require('string_decoder').StringDecoder - -module.exports = StringStream -module.exports.AlignedStringDecoder = AlignedStringDecoder - -function StringStream(from, to) { - if (!(this instanceof StringStream)) return new StringStream(from, to) - - Stream.call(this) - - if (from == null) from = 'utf8' - - this.readable = this.writable = true - this.paused = false - this.toEncoding = (to == null ? from : to) - this.fromEncoding = (to == null ? '' : from) - this.decoder = new AlignedStringDecoder(this.toEncoding) -} -util.inherits(StringStream, Stream) - -StringStream.prototype.write = function(data) { - if (!this.writable) { - var err = new Error('stream not writable') - err.code = 'EPIPE' - this.emit('error', err) - return false - } - if (this.fromEncoding) { - if (Buffer.isBuffer(data)) data = data.toString() - data = new Buffer(data, this.fromEncoding) - } - var string = this.decoder.write(data) - if (string.length) this.emit('data', string) - return !this.paused -} - -StringStream.prototype.flush = function() { - if (this.decoder.flush) { - var string = this.decoder.flush() - if (string.length) this.emit('data', string) - } -} - -StringStream.prototype.end = function() { - if (!this.writable && !this.readable) return - this.flush() - this.emit('end') - this.writable = this.readable = false - this.destroy() -} - -StringStream.prototype.destroy = function() { - this.decoder = null - this.writable = this.readable = false - this.emit('close') -} - -StringStream.prototype.pause = function() { - this.paused = true -} - -StringStream.prototype.resume = function () { - if (this.paused) this.emit('drain') - this.paused = false -} - -function AlignedStringDecoder(encoding) { - StringDecoder.call(this, encoding) - - switch (this.encoding) { - case 'base64': - this.write = alignedWrite - this.alignedBuffer = new Buffer(3) - this.alignedBytes = 0 - break - } -} -util.inherits(AlignedStringDecoder, StringDecoder) - -AlignedStringDecoder.prototype.flush = function() { - if (!this.alignedBuffer || !this.alignedBytes) return '' - var leftover = this.alignedBuffer.toString(this.encoding, 0, this.alignedBytes) - this.alignedBytes = 0 - return leftover -} - -function alignedWrite(buffer) { - var rem = (this.alignedBytes + buffer.length) % this.alignedBuffer.length - if (!rem && !this.alignedBytes) return buffer.toString(this.encoding) - - var returnBuffer = new Buffer(this.alignedBytes + buffer.length - rem) - - this.alignedBuffer.copy(returnBuffer, 0, 0, this.alignedBytes) - buffer.copy(returnBuffer, this.alignedBytes, 0, buffer.length - rem) - - buffer.copy(this.alignedBuffer, 0, buffer.length - rem, buffer.length) - this.alignedBytes = rem - - return returnBuffer.toString(this.encoding) -} diff --git a/APIs/node_modules/request/node_modules/tough-cookie/LICENSE b/APIs/node_modules/request/node_modules/tough-cookie/LICENSE deleted file mode 100644 index 1bc286fb..00000000 --- a/APIs/node_modules/request/node_modules/tough-cookie/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2015, Salesforce.com, Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - -3. Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -=== - -The following exceptions apply: - -=== - -`public_suffix_list.dat` was obtained from - via -. The license for this file is MPL/2.0. The header of -that file reads as follows: - - // This Source Code Form is subject to the terms of the Mozilla Public - // License, v. 2.0. If a copy of the MPL was not distributed with this - // file, You can obtain one at http://mozilla.org/MPL/2.0/. diff --git a/APIs/node_modules/request/node_modules/tough-cookie/README.md b/APIs/node_modules/request/node_modules/tough-cookie/README.md deleted file mode 100644 index 9899dbf6..00000000 --- a/APIs/node_modules/request/node_modules/tough-cookie/README.md +++ /dev/null @@ -1,492 +0,0 @@ -[RFC6265](https://tools.ietf.org/html/rfc6265) Cookies and CookieJar for Node.js - -[![Build Status](https://travis-ci.org/SalesforceEng/tough-cookie.png?branch=master)](https://travis-ci.org/SalesforceEng/tough-cookie) - -[![NPM Stats](https://nodei.co/npm/tough-cookie.png?downloads=true&stars=true)](https://npmjs.org/package/tough-cookie) -![NPM Downloads](https://nodei.co/npm-dl/tough-cookie.png?months=9) - -# Synopsis - -``` javascript -var tough = require('tough-cookie'); -var Cookie = tough.Cookie; -var cookie = Cookie.parse(header); -cookie.value = 'somethingdifferent'; -header = cookie.toString(); - -var cookiejar = new tough.CookieJar(); -cookiejar.setCookie(cookie, 'http://currentdomain.example.com/path', cb); -// ... -cookiejar.getCookies('http://example.com/otherpath',function(err,cookies) { - res.headers['cookie'] = cookies.join('; '); -}); -``` - -# Installation - -It's _so_ easy! - -`npm install tough-cookie` - -Why the name? NPM modules `cookie`, `cookies` and `cookiejar` were already taken. - -# API - -## tough - -Functions on the module you get from `require('tough-cookie')`. All can be used as pure functions and don't need to be "bound". - -**Note**: prior to 1.0.x, several of these functions took a `strict` parameter. This has since been removed from the API as it was no longer necessary. - -### `parseDate(string)` - -Parse a cookie date string into a `Date`. Parses according to RFC6265 Section 5.1.1, not `Date.parse()`. - -### `formatDate(date)` - -Format a Date into a RFC1123 string (the RFC6265-recommended format). - -### `canonicalDomain(str)` - -Transforms a domain-name into a canonical domain-name. The canonical domain-name is a trimmed, lowercased, stripped-of-leading-dot and optionally punycode-encoded domain-name (Section 5.1.2 of RFC6265). For the most part, this function is idempotent (can be run again on its output without ill effects). - -### `domainMatch(str,domStr[,canonicalize=true])` - -Answers "does this real domain match the domain in a cookie?". The `str` is the "current" domain-name and the `domStr` is the "cookie" domain-name. Matches according to RFC6265 Section 5.1.3, but it helps to think of it as a "suffix match". - -The `canonicalize` parameter will run the other two paramters through `canonicalDomain` or not. - -### `defaultPath(path)` - -Given a current request/response path, gives the Path apropriate for storing in a cookie. This is basically the "directory" of a "file" in the path, but is specified by Section 5.1.4 of the RFC. - -The `path` parameter MUST be _only_ the pathname part of a URI (i.e. excludes the hostname, query, fragment, etc.). This is the `.pathname` property of node's `uri.parse()` output. - -### `pathMatch(reqPath,cookiePath)` - -Answers "does the request-path path-match a given cookie-path?" as per RFC6265 Section 5.1.4. Returns a boolean. - -This is essentially a prefix-match where `cookiePath` is a prefix of `reqPath`. - -### `parse(cookieString[, options])` - -alias for `Cookie.parse(cookieString[, options])` - -### `fromJSON(string)` - -alias for `Cookie.fromJSON(string)` - -### `getPublicSuffix(hostname)` - -Returns the public suffix of this hostname. The public suffix is the shortest domain-name upon which a cookie can be set. Returns `null` if the hostname cannot have cookies set for it. - -For example: `www.example.com` and `www.subdomain.example.com` both have public suffix `example.com`. - -For further information, see http://publicsuffix.org/. This module derives its list from that site. - -### `cookieCompare(a,b)` - -For use with `.sort()`, sorts a list of cookies into the recommended order given in the RFC (Section 5.4 step 2). The sort algorithm is, in order of precedence: - -* Longest `.path` -* oldest `.creation` (which has a 1ms precision, same as `Date`) -* lowest `.creationIndex` (to get beyond the 1ms precision) - -``` javascript -var cookies = [ /* unsorted array of Cookie objects */ ]; -cookies = cookies.sort(cookieCompare); -``` - -**Note**: Since JavaScript's `Date` is limited to a 1ms precision, cookies within the same milisecond are entirely possible. This is especially true when using the `now` option to `.setCookie()`. The `.creationIndex` property is a per-process global counter, assigned during construction with `new Cookie()`. This preserves the spirit of the RFC sorting: older cookies go first. This works great for `MemoryCookieStore`, since `Set-Cookie` headers are parsed in order, but may not be so great for distributed systems. Sophisticated `Store`s may wish to set this to some other _logical clock_ such that if cookies A and B are created in the same millisecond, but cookie A is created before cookie B, then `A.creationIndex < B.creationIndex`. If you want to alter the global counter, which you probably _shouldn't_ do, it's stored in `Cookie.cookiesCreated`. - -### `permuteDomain(domain)` - -Generates a list of all possible domains that `domainMatch()` the parameter. May be handy for implementing cookie stores. - -### `permutePath(path)` - -Generates a list of all possible paths that `pathMatch()` the parameter. May be handy for implementing cookie stores. - - -## Cookie - -Exported via `tough.Cookie`. - -### `Cookie.parse(cookieString[, options])` - -Parses a single Cookie or Set-Cookie HTTP header into a `Cookie` object. Returns `undefined` if the string can't be parsed. - -The options parameter is not required and currently has only one property: - - * _loose_ - boolean - if `true` enable parsing of key-less cookies like `=abc` and `=`, which are not RFC-compliant. - -If options is not an object, it is ignored, which means you can use `Array#map` with it. - -Here's how to process the Set-Cookie header(s) on a node HTTP/HTTPS response: - -``` javascript -if (res.headers['set-cookie'] instanceof Array) - cookies = res.headers['set-cookie'].map(Cookie.parse); -else - cookies = [Cookie.parse(res.headers['set-cookie'])]; -``` - -### Properties - -Cookie object properties: - - * _key_ - string - the name or key of the cookie (default "") - * _value_ - string - the value of the cookie (default "") - * _expires_ - `Date` - if set, the `Expires=` attribute of the cookie (defaults to the string `"Infinity"`). See `setExpires()` - * _maxAge_ - seconds - if set, the `Max-Age=` attribute _in seconds_ of the cookie. May also be set to strings `"Infinity"` and `"-Infinity"` for non-expiry and immediate-expiry, respectively. See `setMaxAge()` - * _domain_ - string - the `Domain=` attribute of the cookie - * _path_ - string - the `Path=` of the cookie - * _secure_ - boolean - the `Secure` cookie flag - * _httpOnly_ - boolean - the `HttpOnly` cookie flag - * _extensions_ - `Array` - any unrecognized cookie attributes as strings (even if equal-signs inside) - * _creation_ - `Date` - when this cookie was constructed - * _creationIndex_ - number - set at construction, used to provide greater sort precision (please see `cookieCompare(a,b)` for a full explanation) - -After a cookie has been passed through `CookieJar.setCookie()` it will have the following additional attributes: - - * _hostOnly_ - boolean - is this a host-only cookie (i.e. no Domain field was set, but was instead implied) - * _pathIsDefault_ - boolean - if true, there was no Path field on the cookie and `defaultPath()` was used to derive one. - * _creation_ - `Date` - **modified** from construction to when the cookie was added to the jar - * _lastAccessed_ - `Date` - last time the cookie got accessed. Will affect cookie cleaning once implemented. Using `cookiejar.getCookies(...)` will update this attribute. - -### `Cookie([{properties}])` - -Receives an options object that can contain any of the above Cookie properties, uses the default for unspecified properties. - -### `.toString()` - -encode to a Set-Cookie header value. The Expires cookie field is set using `formatDate()`, but is omitted entirely if `.expires` is `Infinity`. - -### `.cookieString()` - -encode to a Cookie header value (i.e. the `.key` and `.value` properties joined with '='). - -### `.setExpires(String)` - -sets the expiry based on a date-string passed through `parseDate()`. If parseDate returns `null` (i.e. can't parse this date string), `.expires` is set to `"Infinity"` (a string) is set. - -### `.setMaxAge(number)` - -sets the maxAge in seconds. Coerces `-Infinity` to `"-Infinity"` and `Infinity` to `"Infinity"` so it JSON serializes correctly. - -### `.expiryTime([now=Date.now()])` - -### `.expiryDate([now=Date.now()])` - -expiryTime() Computes the absolute unix-epoch milliseconds that this cookie expires. expiryDate() works similarly, except it returns a `Date` object. Note that in both cases the `now` parameter should be milliseconds. - -Max-Age takes precedence over Expires (as per the RFC). The `.creation` attribute -- or, by default, the `now` paramter -- is used to offset the `.maxAge` attribute. - -If Expires (`.expires`) is set, that's returned. - -Otherwise, `expiryTime()` returns `Infinity` and `expiryDate()` returns a `Date` object for "Tue, 19 Jan 2038 03:14:07 GMT" (latest date that can be expressed by a 32-bit `time_t`; the common limit for most user-agents). - -### `.TTL([now=Date.now()])` - -compute the TTL relative to `now` (milliseconds). The same precedence rules as for `expiryTime`/`expiryDate` apply. - -The "number" `Infinity` is returned for cookies without an explicit expiry and `0` is returned if the cookie is expired. Otherwise a time-to-live in milliseconds is returned. - -### `.canonicalizedDoman()` - -### `.cdomain()` - -return the canonicalized `.domain` field. This is lower-cased and punycode (RFC3490) encoded if the domain has any non-ASCII characters. - -### `.toJSON()` - -For convenience in using `JSON.serialize(cookie)`. Returns a plain-old `Object` that can be JSON-serialized. - -Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are exported in ISO format (`.toISOString()`). - -**NOTE**: Custom `Cookie` properties will be discarded. In tough-cookie 1.x, since there was no `.toJSON` method explicitly defined, all enumerable properties were captured. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array. - -### `Cookie.fromJSON(strOrObj)` - -Does the reverse of `cookie.toJSON()`. If passed a string, will `JSON.parse()` that first. - -Any `Date` properties (i.e., `.expires`, `.creation`, and `.lastAccessed`) are parsed via `Date.parse()`, not the tough-cookie `parseDate`, since it's JavaScript/JSON-y timestamps being handled at this layer. - -Returns `null` upon JSON parsing error. - -### `.clone()` - -Does a deep clone of this cookie, exactly implemented as `Cookie.fromJSON(cookie.toJSON())`. - -### `.validate()` - -Status: *IN PROGRESS*. Works for a few things, but is by no means comprehensive. - -validates cookie attributes for semantic correctness. Useful for "lint" checking any Set-Cookie headers you generate. For now, it returns a boolean, but eventually could return a reason string -- you can future-proof with this construct: - -``` javascript -if (cookie.validate() === true) { - // it's tasty -} else { - // yuck! -} -``` - - -## CookieJar - -Exported via `tough.CookieJar`. - -### `CookieJar([store],[options])` - -Simply use `new CookieJar()`. If you'd like to use a custom store, pass that to the constructor otherwise a `MemoryCookieStore` will be created and used. - -The `options` object can be omitted and can have the following properties: - - * _rejectPublicSuffixes_ - boolean - default `true` - reject cookies with domains like "com" and "co.uk" - * _looseMode_ - boolean - default `false` - accept malformed cookies like `bar` and `=bar`, which have an implied empty name. - This is not in the standard, but is used sometimes on the web and is accepted by (most) browsers. - -Since eventually this module would like to support database/remote/etc. CookieJars, continuation passing style is used for CookieJar methods. - -### `.setCookie(cookieOrString, currentUrl, [{options},] cb(err,cookie))` - -Attempt to set the cookie in the cookie jar. If the operation fails, an error will be given to the callback `cb`, otherwise the cookie is passed through. The cookie will have updated `.creation`, `.lastAccessed` and `.hostOnly` properties. - -The `options` object can be omitted and can have the following properties: - - * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies. - * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`. - * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies - * _ignoreError_ - boolean - default `false` - silently ignore things like parse errors and invalid domains. `Store` errors aren't ignored by this option. - -As per the RFC, the `.hostOnly` property is set if there was no "Domain=" parameter in the cookie string (or `.domain` was null on the Cookie object). The `.domain` property is set to the fully-qualified hostname of `currentUrl` in this case. Matching this cookie requires an exact hostname match (not a `domainMatch` as per usual). - -### `.setCookieSync(cookieOrString, currentUrl, [{options}])` - -Synchronous version of `setCookie`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). - -### `.getCookies(currentUrl, [{options},] cb(err,cookies))` - -Retrieve the list of cookies that can be sent in a Cookie header for the current url. - -If an error is encountered, that's passed as `err` to the callback, otherwise an `Array` of `Cookie` objects is passed. The array is sorted with `cookieCompare()` unless the `{sort:false}` option is given. - -The `options` object can be omitted and can have the following properties: - - * _http_ - boolean - default `true` - indicates if this is an HTTP or non-HTTP API. Affects HttpOnly cookies. - * _secure_ - boolean - autodetect from url - indicates if this is a "Secure" API. If the currentUrl starts with `https:` or `wss:` then this is defaulted to `true`, otherwise `false`. - * _now_ - Date - default `new Date()` - what to use for the creation/access time of cookies - * _expire_ - boolean - default `true` - perform expiry-time checking of cookies and asynchronously remove expired cookies from the store. Using `false` will return expired cookies and **not** remove them from the store (which is useful for replaying Set-Cookie headers, potentially). - * _allPaths_ - boolean - default `false` - if `true`, do not scope cookies by path. The default uses RFC-compliant path scoping. **Note**: may not be supported by the underlying store (the default `MemoryCookieStore` supports it). - -The `.lastAccessed` property of the returned cookies will have been updated. - -### `.getCookiesSync(currentUrl, [{options}])` - -Synchronous version of `getCookies`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). - -### `.getCookieString(...)` - -Accepts the same options as `.getCookies()` but passes a string suitable for a Cookie header rather than an array to the callback. Simply maps the `Cookie` array via `.cookieString()`. - -### `.getCookieStringSync(...)` - -Synchronous version of `getCookieString`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). - -### `.getSetCookieStrings(...)` - -Returns an array of strings suitable for **Set-Cookie** headers. Accepts the same options as `.getCookies()`. Simply maps the cookie array via `.toString()`. - -### `.getSetCookieStringsSync(...)` - -Synchronous version of `getSetCookieStrings`; only works with synchronous stores (e.g. the default `MemoryCookieStore`). - -### `.serialize(cb(err,serializedObject))` - -Serialize the Jar if the underlying store supports `.getAllCookies`. - -**NOTE**: Custom `Cookie` properties will be discarded. If you want a property to be serialized, add the property name to the `Cookie.serializableProperties` Array. - -See [Serialization Format]. - -### `.serializeSync()` - -Sync version of .serialize - -### `.toJSON()` - -Alias of .serializeSync() for the convenience of `JSON.stringify(cookiejar)`. - -### `CookieJar.deserialize(serialized, [store], cb(err,object))` - -A new Jar is created and the serialized Cookies are added to the underlying store. Each `Cookie` is added via `store.putCookie` in the order in which they appear in the serialization. - -The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. - -As a convenience, if `serialized` is a string, it is passed through `JSON.parse` first. If that throws an error, this is passed to the callback. - -### `CookieJar.deserializeSync(serialized, [store])` - -Sync version of `.deserialize`. _Note_ that the `store` must be synchronous for this to work. - -### `CookieJar.fromJSON(string)` - -Alias of `.deserializeSync` to provide consistency with `Cookie.fromJSON()`. - -### `.clone([store,]cb(err,newJar))` - -Produces a deep clone of this jar. Modifications to the original won't affect the clone, and vice versa. - -The `store` argument is optional, but should be an instance of `Store`. By default, a new instance of `MemoryCookieStore` is created. Transferring between store types is supported so long as the source implements `.getAllCookies()` and the destination implements `.putCookie()`. - -### `.cloneSync([store])` - -Synchronous version of `.clone`, returning a new `CookieJar` instance. - -The `store` argument is optional, but must be a _synchronous_ `Store` instance if specified. If not passed, a new instance of `MemoryCookieStore` is used. - -The _source_ and _destination_ must both be synchronous `Store`s. If one or both stores are asynchronous, use `.clone` instead. Recall that `MemoryCookieStore` supports both synchronous and asynchronous API calls. - -## Store - -Base class for CookieJar stores. Available as `tough.Store`. - -## Store API - -The storage model for each `CookieJar` instance can be replaced with a custom implementation. The default is `MemoryCookieStore` which can be found in the `lib/memstore.js` file. The API uses continuation-passing-style to allow for asynchronous stores. - -Stores should inherit from the base `Store` class, which is available as `require('tough-cookie').Store`. - -Stores are asynchronous by default, but if `store.synchronous` is set to `true`, then the `*Sync` methods on the of the containing `CookieJar` can be used (however, the continuation-passing style - -All `domain` parameters will have been normalized before calling. - -The Cookie store must have all of the following methods. - -### `store.findCookie(domain, path, key, cb(err,cookie))` - -Retrieve a cookie with the given domain, path and key (a.k.a. name). The RFC maintains that exactly one of these cookies should exist in a store. If the store is using versioning, this means that the latest/newest such cookie should be returned. - -Callback takes an error and the resulting `Cookie` object. If no cookie is found then `null` MUST be passed instead (i.e. not an error). - -### `store.findCookies(domain, path, cb(err,cookies))` - -Locates cookies matching the given domain and path. This is most often called in the context of `cookiejar.getCookies()` above. - -If no cookies are found, the callback MUST be passed an empty array. - -The resulting list will be checked for applicability to the current request according to the RFC (domain-match, path-match, http-only-flag, secure-flag, expiry, etc.), so it's OK to use an optimistic search algorithm when implementing this method. However, the search algorithm used SHOULD try to find cookies that `domainMatch()` the domain and `pathMatch()` the path in order to limit the amount of checking that needs to be done. - -As of version 0.9.12, the `allPaths` option to `cookiejar.getCookies()` above will cause the path here to be `null`. If the path is `null`, path-matching MUST NOT be performed (i.e. domain-matching only). - -### `store.putCookie(cookie, cb(err))` - -Adds a new cookie to the store. The implementation SHOULD replace any existing cookie with the same `.domain`, `.path`, and `.key` properties -- depending on the nature of the implementation, it's possible that between the call to `fetchCookie` and `putCookie` that a duplicate `putCookie` can occur. - -The `cookie` object MUST NOT be modified; the caller will have already updated the `.creation` and `.lastAccessed` properties. - -Pass an error if the cookie cannot be stored. - -### `store.updateCookie(oldCookie, newCookie, cb(err))` - -Update an existing cookie. The implementation MUST update the `.value` for a cookie with the same `domain`, `.path` and `.key`. The implementation SHOULD check that the old value in the store is equivalent to `oldCookie` - how the conflict is resolved is up to the store. - -The `.lastAccessed` property will always be different between the two objects (to the precision possible via JavaScript's clock). Both `.creation` and `.creationIndex` are guaranteed to be the same. Stores MAY ignore or defer the `.lastAccessed` change at the cost of affecting how cookies are selected for automatic deletion (e.g., least-recently-used, which is up to the store to implement). - -Stores may wish to optimize changing the `.value` of the cookie in the store versus storing a new cookie. If the implementation doesn't define this method a stub that calls `putCookie(newCookie,cb)` will be added to the store object. - -The `newCookie` and `oldCookie` objects MUST NOT be modified. - -Pass an error if the newCookie cannot be stored. - -### `store.removeCookie(domain, path, key, cb(err))` - -Remove a cookie from the store (see notes on `findCookie` about the uniqueness constraint). - -The implementation MUST NOT pass an error if the cookie doesn't exist; only pass an error due to the failure to remove an existing cookie. - -### `store.removeCookies(domain, path, cb(err))` - -Removes matching cookies from the store. The `path` parameter is optional, and if missing means all paths in a domain should be removed. - -Pass an error ONLY if removing any existing cookies failed. - -### `store.getAllCookies(cb(err, cookies))` - -Produces an `Array` of all cookies during `jar.serialize()`. The items in the array can be true `Cookie` objects or generic `Object`s with the [Serialization Format] data structure. - -Cookies SHOULD be returned in creation order to preserve sorting via `compareCookies()`. For reference, `MemoryCookieStore` will sort by `.creationIndex` since it uses true `Cookie` objects internally. If you don't return the cookies in creation order, they'll still be sorted by creation time, but this only has a precision of 1ms. See `compareCookies` for more detail. - -Pass an error if retrieval fails. - -## MemoryCookieStore - -Inherits from `Store`. - -A just-in-memory CookieJar synchronous store implementation, used by default. Despite being a synchronous implementation, it's usable with both the synchronous and asynchronous forms of the `CookieJar` API. - -# Serialization Format - -**NOTE**: if you want to have custom `Cookie` properties serialized, add the property name to `Cookie.serializableProperties`. - -```js - { - // The version of tough-cookie that serialized this jar. - version: 'tough-cookie@1.x.y', - - // add the store type, to make humans happy: - storeType: 'MemoryCookieStore', - - // CookieJar configuration: - rejectPublicSuffixes: true, - // ... future items go here - - // Gets filled from jar.store.getAllCookies(): - cookies: [ - { - key: 'string', - value: 'string', - // ... - /* other Cookie.serializableProperties go here */ - } - ] - } -``` - -# Copyright and License - -(tl;dr: BSD-3-Clause with some MPL/2.0) - -```text - Copyright (c) 2015, Salesforce.com, Inc. - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - - 1. Redistributions of source code must retain the above copyright notice, - this list of conditions and the following disclaimer. - - 2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - - 3. Neither the name of Salesforce.com nor the names of its contributors may - be used to endorse or promote products derived from this software without - specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - POSSIBILITY OF SUCH DAMAGE. -``` - -Portions may be licensed under different licenses (in particular `public_suffix_list.dat` is MPL/2.0); please read that file and the LICENSE file for full details. diff --git a/APIs/node_modules/request/node_modules/tough-cookie/lib/cookie.js b/APIs/node_modules/request/node_modules/tough-cookie/lib/cookie.js deleted file mode 100644 index 12da297a..00000000 --- a/APIs/node_modules/request/node_modules/tough-cookie/lib/cookie.js +++ /dev/null @@ -1,1342 +0,0 @@ -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -'use strict'; -var net = require('net'); -var urlParse = require('url').parse; -var pubsuffix = require('./pubsuffix'); -var Store = require('./store').Store; -var MemoryCookieStore = require('./memstore').MemoryCookieStore; -var pathMatch = require('./pathMatch').pathMatch; -var VERSION = require('../package.json').version; - -var punycode; -try { - punycode = require('punycode'); -} catch(e) { - console.warn("cookie: can't load punycode; won't use punycode for domain normalization"); -} - -var DATE_DELIM = /[\x09\x20-\x2F\x3B-\x40\x5B-\x60\x7B-\x7E]/; - -// From RFC6265 S4.1.1 -// note that it excludes \x3B ";" -var COOKIE_OCTET = /[\x21\x23-\x2B\x2D-\x3A\x3C-\x5B\x5D-\x7E]/; -var COOKIE_OCTETS = new RegExp('^'+COOKIE_OCTET.source+'+$'); - -var CONTROL_CHARS = /[\x00-\x1F]/; - -// Double quotes are part of the value (see: S4.1.1). -// '\r', '\n' and '\0' should be treated as a terminator in the "relaxed" mode -// (see: https://github.com/ChromiumWebApps/chromium/blob/b3d3b4da8bb94c1b2e061600df106d590fda3620/net/cookies/parsed_cookie.cc#L60) -// '=' and ';' are attribute/values separators -// (see: https://github.com/ChromiumWebApps/chromium/blob/b3d3b4da8bb94c1b2e061600df106d590fda3620/net/cookies/parsed_cookie.cc#L64) -var COOKIE_PAIR = /^(([^=;]+))\s*=\s*([^\n\r\0]*)/; - -// Used to parse non-RFC-compliant cookies like '=abc' when given the `loose` -// option in Cookie.parse: -var LOOSE_COOKIE_PAIR = /^((?:=)?([^=;]*)\s*=\s*)?([^\n\r\0]*)/; - -// RFC6265 S4.1.1 defines path value as 'any CHAR except CTLs or ";"' -// Note ';' is \x3B -var PATH_VALUE = /[\x20-\x3A\x3C-\x7E]+/; - -// Used for checking whether or not there is a trailing semi-colon -var TRAILING_SEMICOLON = /;+$/; - -var DAY_OF_MONTH = /^(\d{1,2})[^\d]*$/; -var TIME = /^(\d{1,2})[^\d]*:(\d{1,2})[^\d]*:(\d{1,2})[^\d]*$/; -var MONTH = /^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)/i; - -var MONTH_TO_NUM = { - jan:0, feb:1, mar:2, apr:3, may:4, jun:5, - jul:6, aug:7, sep:8, oct:9, nov:10, dec:11 -}; -var NUM_TO_MONTH = [ - 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' -]; -var NUM_TO_DAY = [ - 'Sun','Mon','Tue','Wed','Thu','Fri','Sat' -]; - -var YEAR = /^(\d{2}|\d{4})$/; // 2 to 4 digits - -var MAX_TIME = 2147483647000; // 31-bit max -var MIN_TIME = 0; // 31-bit min - - -// RFC6265 S5.1.1 date parser: -function parseDate(str) { - if (!str) { - return; - } - - /* RFC6265 S5.1.1: - * 2. Process each date-token sequentially in the order the date-tokens - * appear in the cookie-date - */ - var tokens = str.split(DATE_DELIM); - if (!tokens) { - return; - } - - var hour = null; - var minutes = null; - var seconds = null; - var day = null; - var month = null; - var year = null; - - for (var i=0; i 23 || minutes > 59 || seconds > 59) { - return; - } - - continue; - } - } - - /* 2.2. If the found-day-of-month flag is not set and the date-token matches - * the day-of-month production, set the found-day-of- month flag and set - * the day-of-month-value to the number denoted by the date-token. Skip - * the remaining sub-steps and continue to the next date-token. - */ - if (day === null) { - result = DAY_OF_MONTH.exec(token); - if (result) { - day = parseInt(result, 10); - /* RFC6265 S5.1.1.5: - * [fail if] the day-of-month-value is less than 1 or greater than 31 - */ - if(day < 1 || day > 31) { - return; - } - continue; - } - } - - /* 2.3. If the found-month flag is not set and the date-token matches the - * month production, set the found-month flag and set the month-value to - * the month denoted by the date-token. Skip the remaining sub-steps and - * continue to the next date-token. - */ - if (month === null) { - result = MONTH.exec(token); - if (result) { - month = MONTH_TO_NUM[result[1].toLowerCase()]; - continue; - } - } - - /* 2.4. If the found-year flag is not set and the date-token matches the year - * production, set the found-year flag and set the year-value to the number - * denoted by the date-token. Skip the remaining sub-steps and continue to - * the next date-token. - */ - if (year === null) { - result = YEAR.exec(token); - if (result) { - year = parseInt(result[0], 10); - /* From S5.1.1: - * 3. If the year-value is greater than or equal to 70 and less - * than or equal to 99, increment the year-value by 1900. - * 4. If the year-value is greater than or equal to 0 and less - * than or equal to 69, increment the year-value by 2000. - */ - if (70 <= year && year <= 99) { - year += 1900; - } else if (0 <= year && year <= 69) { - year += 2000; - } - - if (year < 1601) { - return; // 5. ... the year-value is less than 1601 - } - } - } - } - - if (seconds === null || day === null || month === null || year === null) { - return; // 5. ... at least one of the found-day-of-month, found-month, found- - // year, or found-time flags is not set, - } - - return new Date(Date.UTC(year, month, day, hour, minutes, seconds)); -} - -function formatDate(date) { - var d = date.getUTCDate(); d = d >= 10 ? d : '0'+d; - var h = date.getUTCHours(); h = h >= 10 ? h : '0'+h; - var m = date.getUTCMinutes(); m = m >= 10 ? m : '0'+m; - var s = date.getUTCSeconds(); s = s >= 10 ? s : '0'+s; - return NUM_TO_DAY[date.getUTCDay()] + ', ' + - d+' '+ NUM_TO_MONTH[date.getUTCMonth()] +' '+ date.getUTCFullYear() +' '+ - h+':'+m+':'+s+' GMT'; -} - -// S5.1.2 Canonicalized Host Names -function canonicalDomain(str) { - if (str == null) { - return null; - } - str = str.trim().replace(/^\./,''); // S4.1.2.3 & S5.2.3: ignore leading . - - // convert to IDN if any non-ASCII characters - if (punycode && /[^\u0001-\u007f]/.test(str)) { - str = punycode.toASCII(str); - } - - return str.toLowerCase(); -} - -// S5.1.3 Domain Matching -function domainMatch(str, domStr, canonicalize) { - if (str == null || domStr == null) { - return null; - } - if (canonicalize !== false) { - str = canonicalDomain(str); - domStr = canonicalDomain(domStr); - } - - /* - * "The domain string and the string are identical. (Note that both the - * domain string and the string will have been canonicalized to lower case at - * this point)" - */ - if (str == domStr) { - return true; - } - - /* "All of the following [three] conditions hold:" (order adjusted from the RFC) */ - - /* "* The string is a host name (i.e., not an IP address)." */ - if (net.isIP(str)) { - return false; - } - - /* "* The domain string is a suffix of the string" */ - var idx = str.indexOf(domStr); - if (idx <= 0) { - return false; // it's a non-match (-1) or prefix (0) - } - - // e.g "a.b.c".indexOf("b.c") === 2 - // 5 === 3+2 - if (str.length !== domStr.length + idx) { // it's not a suffix - return false; - } - - /* "* The last character of the string that is not included in the domain - * string is a %x2E (".") character." */ - if (str.substr(idx-1,1) !== '.') { - return false; - } - - return true; -} - - -// RFC6265 S5.1.4 Paths and Path-Match - -/* - * "The user agent MUST use an algorithm equivalent to the following algorithm - * to compute the default-path of a cookie:" - * - * Assumption: the path (and not query part or absolute uri) is passed in. - */ -function defaultPath(path) { - // "2. If the uri-path is empty or if the first character of the uri-path is not - // a %x2F ("/") character, output %x2F ("/") and skip the remaining steps. - if (!path || path.substr(0,1) !== "/") { - return "/"; - } - - // "3. If the uri-path contains no more than one %x2F ("/") character, output - // %x2F ("/") and skip the remaining step." - if (path === "/") { - return path; - } - - var rightSlash = path.lastIndexOf("/"); - if (rightSlash === 0) { - return "/"; - } - - // "4. Output the characters of the uri-path from the first character up to, - // but not including, the right-most %x2F ("/")." - return path.slice(0, rightSlash); -} - - -function parse(str, options) { - if (!options || typeof options !== 'object') { - options = {}; - } - str = str.trim(); - - // S4.1.1 Trailing semi-colons are not part of the specification. - var semiColonCheck = TRAILING_SEMICOLON.exec(str); - if (semiColonCheck) { - str = str.slice(0, semiColonCheck.index); - } - - // We use a regex to parse the "name-value-pair" part of S5.2 - var firstSemi = str.indexOf(';'); // S5.2 step 1 - var pairRe = options.loose ? LOOSE_COOKIE_PAIR : COOKIE_PAIR; - var result = pairRe.exec(firstSemi === -1 ? str : str.substr(0,firstSemi)); - - // Rx satisfies the "the name string is empty" and "lacks a %x3D ("=")" - // constraints as well as trimming any whitespace. - if (!result) { - return; - } - - var c = new Cookie(); - if (result[1]) { - c.key = result[2].trim(); - } else { - c.key = ''; - } - c.value = result[3].trim(); - if (CONTROL_CHARS.test(c.key) || CONTROL_CHARS.test(c.value)) { - return; - } - - if (firstSemi === -1) { - return c; - } - - // S5.2.3 "unparsed-attributes consist of the remainder of the set-cookie-string - // (including the %x3B (";") in question)." plus later on in the same section - // "discard the first ";" and trim". - var unparsed = str.slice(firstSemi).replace(/^\s*;\s*/,'').trim(); - - // "If the unparsed-attributes string is empty, skip the rest of these - // steps." - if (unparsed.length === 0) { - return c; - } - - /* - * S5.2 says that when looping over the items "[p]rocess the attribute-name - * and attribute-value according to the requirements in the following - * subsections" for every item. Plus, for many of the individual attributes - * in S5.3 it says to use the "attribute-value of the last attribute in the - * cookie-attribute-list". Therefore, in this implementation, we overwrite - * the previous value. - */ - var cookie_avs = unparsed.split(/\s*;\s*/); - while (cookie_avs.length) { - var av = cookie_avs.shift(); - var av_sep = av.indexOf('='); - var av_key, av_value; - - if (av_sep === -1) { - av_key = av; - av_value = null; - } else { - av_key = av.substr(0,av_sep); - av_value = av.substr(av_sep+1); - } - - av_key = av_key.trim().toLowerCase(); - - if (av_value) { - av_value = av_value.trim(); - } - - switch(av_key) { - case 'expires': // S5.2.1 - if (av_value) { - var exp = parseDate(av_value); - // "If the attribute-value failed to parse as a cookie date, ignore the - // cookie-av." - if (exp) { - // over and underflow not realistically a concern: V8's getTime() seems to - // store something larger than a 32-bit time_t (even with 32-bit node) - c.expires = exp; - } - } - break; - - case 'max-age': // S5.2.2 - if (av_value) { - // "If the first character of the attribute-value is not a DIGIT or a "-" - // character ...[or]... If the remainder of attribute-value contains a - // non-DIGIT character, ignore the cookie-av." - if (/^-?[0-9]+$/.test(av_value)) { - var delta = parseInt(av_value, 10); - // "If delta-seconds is less than or equal to zero (0), let expiry-time - // be the earliest representable date and time." - c.setMaxAge(delta); - } - } - break; - - case 'domain': // S5.2.3 - // "If the attribute-value is empty, the behavior is undefined. However, - // the user agent SHOULD ignore the cookie-av entirely." - if (av_value) { - // S5.2.3 "Let cookie-domain be the attribute-value without the leading %x2E - // (".") character." - var domain = av_value.trim().replace(/^\./, ''); - if (domain) { - // "Convert the cookie-domain to lower case." - c.domain = domain.toLowerCase(); - } - } - break; - - case 'path': // S5.2.4 - /* - * "If the attribute-value is empty or if the first character of the - * attribute-value is not %x2F ("/"): - * Let cookie-path be the default-path. - * Otherwise: - * Let cookie-path be the attribute-value." - * - * We'll represent the default-path as null since it depends on the - * context of the parsing. - */ - c.path = av_value && av_value[0] === "/" ? av_value : null; - break; - - case 'secure': // S5.2.5 - /* - * "If the attribute-name case-insensitively matches the string "Secure", - * the user agent MUST append an attribute to the cookie-attribute-list - * with an attribute-name of Secure and an empty attribute-value." - */ - c.secure = true; - break; - - case 'httponly': // S5.2.6 -- effectively the same as 'secure' - c.httpOnly = true; - break; - - default: - c.extensions = c.extensions || []; - c.extensions.push(av); - break; - } - } - - return c; -} - -// avoid the V8 deoptimization monster! -function jsonParse(str) { - var obj; - try { - obj = JSON.parse(str); - } catch (e) { - return e; - } - return obj; -} - -function fromJSON(str) { - if (!str) { - return null; - } - - var obj; - if (typeof str === 'string') { - obj = jsonParse(str); - if (obj instanceof Error) { - return null; - } - } else { - // assume it's an Object - obj = str; - } - - var c = new Cookie(); - for (var i=0; i 1) { - var lindex = path.lastIndexOf('/'); - if (lindex === 0) { - break; - } - path = path.substr(0,lindex); - permutations.push(path); - } - permutations.push('/'); - return permutations; -} - -function getCookieContext(url) { - if (url instanceof Object) { - return url; - } - // NOTE: decodeURI will throw on malformed URIs (see GH-32). - // Therefore, we will just skip decoding for such URIs. - try { - url = decodeURI(url); - } - catch(err) { - // Silently swallow error - } - - return urlParse(url); -} - -function Cookie(options) { - options = options || {}; - - Object.keys(options).forEach(function(prop) { - if (Cookie.prototype.hasOwnProperty(prop) && - Cookie.prototype[prop] !== options[prop] && - prop.substr(0,1) !== '_') - { - this[prop] = options[prop]; - } - }, this); - - this.creation = this.creation || new Date(); - - // used to break creation ties in cookieCompare(): - Object.defineProperty(this, 'creationIndex', { - configurable: false, - enumerable: false, // important for assert.deepEqual checks - writable: true, - value: ++Cookie.cookiesCreated - }); -} - -Cookie.cookiesCreated = 0; // incremented each time a cookie is created - -Cookie.parse = parse; -Cookie.fromJSON = fromJSON; - -Cookie.prototype.key = ""; -Cookie.prototype.value = ""; - -// the order in which the RFC has them: -Cookie.prototype.expires = "Infinity"; // coerces to literal Infinity -Cookie.prototype.maxAge = null; // takes precedence over expires for TTL -Cookie.prototype.domain = null; -Cookie.prototype.path = null; -Cookie.prototype.secure = false; -Cookie.prototype.httpOnly = false; -Cookie.prototype.extensions = null; - -// set by the CookieJar: -Cookie.prototype.hostOnly = null; // boolean when set -Cookie.prototype.pathIsDefault = null; // boolean when set -Cookie.prototype.creation = null; // Date when set; defaulted by Cookie.parse -Cookie.prototype.lastAccessed = null; // Date when set -Object.defineProperty(Cookie.prototype, 'creationIndex', { - configurable: true, - enumerable: false, - writable: true, - value: 0 -}); - -Cookie.serializableProperties = Object.keys(Cookie.prototype) - .filter(function(prop) { - return !( - Cookie.prototype[prop] instanceof Function || - prop === 'creationIndex' || - prop.substr(0,1) === '_' - ); - }); - -Cookie.prototype.inspect = function inspect() { - var now = Date.now(); - return 'Cookie="'+this.toString() + - '; hostOnly='+(this.hostOnly != null ? this.hostOnly : '?') + - '; aAge='+(this.lastAccessed ? (now-this.lastAccessed.getTime())+'ms' : '?') + - '; cAge='+(this.creation ? (now-this.creation.getTime())+'ms' : '?') + - '"'; -}; - -Cookie.prototype.toJSON = function() { - var obj = {}; - - var props = Cookie.serializableProperties; - for (var i=0; i suffixLen) { - var publicSuffix = parts.slice(0,suffixLen+1).reverse().join('.'); - return converted ? punycode.toUnicode(publicSuffix) : publicSuffix; - } - - return null; -}; - -// The following generated structure is used under the MPL version 2.0 -// See public-suffix.txt for more information - -var index = module.exports.index = Object.freeze( -{"ac":true,"com.ac":true,"edu.ac":true,"gov.ac":true,"net.ac":true,"mil.ac":true,"org.ac":true,"ad":true,"nom.ad":true,"ae":true,"co.ae":true,"net.ae":true,"org.ae":true,"sch.ae":true,"ac.ae":true,"gov.ae":true,"mil.ae":true,"aero":true,"accident-investigation.aero":true,"accident-prevention.aero":true,"aerobatic.aero":true,"aeroclub.aero":true,"aerodrome.aero":true,"agents.aero":true,"aircraft.aero":true,"airline.aero":true,"airport.aero":true,"air-surveillance.aero":true,"airtraffic.aero":true,"air-traffic-control.aero":true,"ambulance.aero":true,"amusement.aero":true,"association.aero":true,"author.aero":true,"ballooning.aero":true,"broker.aero":true,"caa.aero":true,"cargo.aero":true,"catering.aero":true,"certification.aero":true,"championship.aero":true,"charter.aero":true,"civilaviation.aero":true,"club.aero":true,"conference.aero":true,"consultant.aero":true,"consulting.aero":true,"control.aero":true,"council.aero":true,"crew.aero":true,"design.aero":true,"dgca.aero":true,"educator.aero":true,"emergency.aero":true,"engine.aero":true,"engineer.aero":true,"entertainment.aero":true,"equipment.aero":true,"exchange.aero":true,"express.aero":true,"federation.aero":true,"flight.aero":true,"freight.aero":true,"fuel.aero":true,"gliding.aero":true,"government.aero":true,"groundhandling.aero":true,"group.aero":true,"hanggliding.aero":true,"homebuilt.aero":true,"insurance.aero":true,"journal.aero":true,"journalist.aero":true,"leasing.aero":true,"logistics.aero":true,"magazine.aero":true,"maintenance.aero":true,"marketplace.aero":true,"media.aero":true,"microlight.aero":true,"modelling.aero":true,"navigation.aero":true,"parachuting.aero":true,"paragliding.aero":true,"passenger-association.aero":true,"pilot.aero":true,"press.aero":true,"production.aero":true,"recreation.aero":true,"repbody.aero":true,"res.aero":true,"research.aero":true,"rotorcraft.aero":true,"safety.aero":true,"scientist.aero":true,"services.aero":true,"show.aero":true,"skydiving.aero":true,"software.aero":true,"student.aero":true,"taxi.aero":true,"trader.aero":true,"trading.aero":true,"trainer.aero":true,"union.aero":true,"workinggroup.aero":true,"works.aero":true,"af":true,"gov.af":true,"com.af":true,"org.af":true,"net.af":true,"edu.af":true,"ag":true,"com.ag":true,"org.ag":true,"net.ag":true,"co.ag":true,"nom.ag":true,"ai":true,"off.ai":true,"com.ai":true,"net.ai":true,"org.ai":true,"al":true,"com.al":true,"edu.al":true,"gov.al":true,"mil.al":true,"net.al":true,"org.al":true,"am":true,"an":true,"com.an":true,"net.an":true,"org.an":true,"edu.an":true,"ao":true,"ed.ao":true,"gv.ao":true,"og.ao":true,"co.ao":true,"pb.ao":true,"it.ao":true,"aq":true,"ar":true,"com.ar":true,"edu.ar":true,"gob.ar":true,"gov.ar":true,"int.ar":true,"mil.ar":true,"net.ar":true,"org.ar":true,"tur.ar":true,"arpa":true,"e164.arpa":true,"in-addr.arpa":true,"ip6.arpa":true,"iris.arpa":true,"uri.arpa":true,"urn.arpa":true,"as":true,"gov.as":true,"asia":true,"at":true,"ac.at":true,"co.at":true,"gv.at":true,"or.at":true,"au":true,"com.au":true,"net.au":true,"org.au":true,"edu.au":true,"gov.au":true,"asn.au":true,"id.au":true,"info.au":true,"conf.au":true,"oz.au":true,"act.au":true,"nsw.au":true,"nt.au":true,"qld.au":true,"sa.au":true,"tas.au":true,"vic.au":true,"wa.au":true,"act.edu.au":true,"nsw.edu.au":true,"nt.edu.au":true,"qld.edu.au":true,"sa.edu.au":true,"tas.edu.au":true,"vic.edu.au":true,"wa.edu.au":true,"qld.gov.au":true,"sa.gov.au":true,"tas.gov.au":true,"vic.gov.au":true,"wa.gov.au":true,"aw":true,"com.aw":true,"ax":true,"az":true,"com.az":true,"net.az":true,"int.az":true,"gov.az":true,"org.az":true,"edu.az":true,"info.az":true,"pp.az":true,"mil.az":true,"name.az":true,"pro.az":true,"biz.az":true,"ba":true,"org.ba":true,"net.ba":true,"edu.ba":true,"gov.ba":true,"mil.ba":true,"unsa.ba":true,"unbi.ba":true,"co.ba":true,"com.ba":true,"rs.ba":true,"bb":true,"biz.bb":true,"co.bb":true,"com.bb":true,"edu.bb":true,"gov.bb":true,"info.bb":true,"net.bb":true,"org.bb":true,"store.bb":true,"tv.bb":true,"*.bd":true,"be":true,"ac.be":true,"bf":true,"gov.bf":true,"bg":true,"a.bg":true,"b.bg":true,"c.bg":true,"d.bg":true,"e.bg":true,"f.bg":true,"g.bg":true,"h.bg":true,"i.bg":true,"j.bg":true,"k.bg":true,"l.bg":true,"m.bg":true,"n.bg":true,"o.bg":true,"p.bg":true,"q.bg":true,"r.bg":true,"s.bg":true,"t.bg":true,"u.bg":true,"v.bg":true,"w.bg":true,"x.bg":true,"y.bg":true,"z.bg":true,"0.bg":true,"1.bg":true,"2.bg":true,"3.bg":true,"4.bg":true,"5.bg":true,"6.bg":true,"7.bg":true,"8.bg":true,"9.bg":true,"bh":true,"com.bh":true,"edu.bh":true,"net.bh":true,"org.bh":true,"gov.bh":true,"bi":true,"co.bi":true,"com.bi":true,"edu.bi":true,"or.bi":true,"org.bi":true,"biz":true,"bj":true,"asso.bj":true,"barreau.bj":true,"gouv.bj":true,"bm":true,"com.bm":true,"edu.bm":true,"gov.bm":true,"net.bm":true,"org.bm":true,"*.bn":true,"bo":true,"com.bo":true,"edu.bo":true,"gov.bo":true,"gob.bo":true,"int.bo":true,"org.bo":true,"net.bo":true,"mil.bo":true,"tv.bo":true,"br":true,"adm.br":true,"adv.br":true,"agr.br":true,"am.br":true,"arq.br":true,"art.br":true,"ato.br":true,"b.br":true,"bio.br":true,"blog.br":true,"bmd.br":true,"cim.br":true,"cng.br":true,"cnt.br":true,"com.br":true,"coop.br":true,"ecn.br":true,"eco.br":true,"edu.br":true,"emp.br":true,"eng.br":true,"esp.br":true,"etc.br":true,"eti.br":true,"far.br":true,"flog.br":true,"fm.br":true,"fnd.br":true,"fot.br":true,"fst.br":true,"g12.br":true,"ggf.br":true,"gov.br":true,"imb.br":true,"ind.br":true,"inf.br":true,"jor.br":true,"jus.br":true,"leg.br":true,"lel.br":true,"mat.br":true,"med.br":true,"mil.br":true,"mp.br":true,"mus.br":true,"net.br":true,"*.nom.br":true,"not.br":true,"ntr.br":true,"odo.br":true,"org.br":true,"ppg.br":true,"pro.br":true,"psc.br":true,"psi.br":true,"qsl.br":true,"radio.br":true,"rec.br":true,"slg.br":true,"srv.br":true,"taxi.br":true,"teo.br":true,"tmp.br":true,"trd.br":true,"tur.br":true,"tv.br":true,"vet.br":true,"vlog.br":true,"wiki.br":true,"zlg.br":true,"bs":true,"com.bs":true,"net.bs":true,"org.bs":true,"edu.bs":true,"gov.bs":true,"bt":true,"com.bt":true,"edu.bt":true,"gov.bt":true,"net.bt":true,"org.bt":true,"bv":true,"bw":true,"co.bw":true,"org.bw":true,"by":true,"gov.by":true,"mil.by":true,"com.by":true,"of.by":true,"bz":true,"com.bz":true,"net.bz":true,"org.bz":true,"edu.bz":true,"gov.bz":true,"ca":true,"ab.ca":true,"bc.ca":true,"mb.ca":true,"nb.ca":true,"nf.ca":true,"nl.ca":true,"ns.ca":true,"nt.ca":true,"nu.ca":true,"on.ca":true,"pe.ca":true,"qc.ca":true,"sk.ca":true,"yk.ca":true,"gc.ca":true,"cat":true,"cc":true,"cd":true,"gov.cd":true,"cf":true,"cg":true,"ch":true,"ci":true,"org.ci":true,"or.ci":true,"com.ci":true,"co.ci":true,"edu.ci":true,"ed.ci":true,"ac.ci":true,"net.ci":true,"go.ci":true,"asso.ci":true,"xn--aroport-bya.ci":true,"int.ci":true,"presse.ci":true,"md.ci":true,"gouv.ci":true,"*.ck":true,"www.ck":false,"cl":true,"gov.cl":true,"gob.cl":true,"co.cl":true,"mil.cl":true,"cm":true,"co.cm":true,"com.cm":true,"gov.cm":true,"net.cm":true,"cn":true,"ac.cn":true,"com.cn":true,"edu.cn":true,"gov.cn":true,"net.cn":true,"org.cn":true,"mil.cn":true,"xn--55qx5d.cn":true,"xn--io0a7i.cn":true,"xn--od0alg.cn":true,"ah.cn":true,"bj.cn":true,"cq.cn":true,"fj.cn":true,"gd.cn":true,"gs.cn":true,"gz.cn":true,"gx.cn":true,"ha.cn":true,"hb.cn":true,"he.cn":true,"hi.cn":true,"hl.cn":true,"hn.cn":true,"jl.cn":true,"js.cn":true,"jx.cn":true,"ln.cn":true,"nm.cn":true,"nx.cn":true,"qh.cn":true,"sc.cn":true,"sd.cn":true,"sh.cn":true,"sn.cn":true,"sx.cn":true,"tj.cn":true,"xj.cn":true,"xz.cn":true,"yn.cn":true,"zj.cn":true,"hk.cn":true,"mo.cn":true,"tw.cn":true,"co":true,"arts.co":true,"com.co":true,"edu.co":true,"firm.co":true,"gov.co":true,"info.co":true,"int.co":true,"mil.co":true,"net.co":true,"nom.co":true,"org.co":true,"rec.co":true,"web.co":true,"com":true,"coop":true,"cr":true,"ac.cr":true,"co.cr":true,"ed.cr":true,"fi.cr":true,"go.cr":true,"or.cr":true,"sa.cr":true,"cu":true,"com.cu":true,"edu.cu":true,"org.cu":true,"net.cu":true,"gov.cu":true,"inf.cu":true,"cv":true,"cw":true,"com.cw":true,"edu.cw":true,"net.cw":true,"org.cw":true,"cx":true,"gov.cx":true,"ac.cy":true,"biz.cy":true,"com.cy":true,"ekloges.cy":true,"gov.cy":true,"ltd.cy":true,"name.cy":true,"net.cy":true,"org.cy":true,"parliament.cy":true,"press.cy":true,"pro.cy":true,"tm.cy":true,"cz":true,"de":true,"dj":true,"dk":true,"dm":true,"com.dm":true,"net.dm":true,"org.dm":true,"edu.dm":true,"gov.dm":true,"do":true,"art.do":true,"com.do":true,"edu.do":true,"gob.do":true,"gov.do":true,"mil.do":true,"net.do":true,"org.do":true,"sld.do":true,"web.do":true,"dz":true,"com.dz":true,"org.dz":true,"net.dz":true,"gov.dz":true,"edu.dz":true,"asso.dz":true,"pol.dz":true,"art.dz":true,"ec":true,"com.ec":true,"info.ec":true,"net.ec":true,"fin.ec":true,"k12.ec":true,"med.ec":true,"pro.ec":true,"org.ec":true,"edu.ec":true,"gov.ec":true,"gob.ec":true,"mil.ec":true,"edu":true,"ee":true,"edu.ee":true,"gov.ee":true,"riik.ee":true,"lib.ee":true,"med.ee":true,"com.ee":true,"pri.ee":true,"aip.ee":true,"org.ee":true,"fie.ee":true,"eg":true,"com.eg":true,"edu.eg":true,"eun.eg":true,"gov.eg":true,"mil.eg":true,"name.eg":true,"net.eg":true,"org.eg":true,"sci.eg":true,"*.er":true,"es":true,"com.es":true,"nom.es":true,"org.es":true,"gob.es":true,"edu.es":true,"et":true,"com.et":true,"gov.et":true,"org.et":true,"edu.et":true,"biz.et":true,"name.et":true,"info.et":true,"net.et":true,"eu":true,"fi":true,"aland.fi":true,"*.fj":true,"*.fk":true,"fm":true,"fo":true,"fr":true,"com.fr":true,"asso.fr":true,"nom.fr":true,"prd.fr":true,"presse.fr":true,"tm.fr":true,"aeroport.fr":true,"assedic.fr":true,"avocat.fr":true,"avoues.fr":true,"cci.fr":true,"chambagri.fr":true,"chirurgiens-dentistes.fr":true,"experts-comptables.fr":true,"geometre-expert.fr":true,"gouv.fr":true,"greta.fr":true,"huissier-justice.fr":true,"medecin.fr":true,"notaires.fr":true,"pharmacien.fr":true,"port.fr":true,"veterinaire.fr":true,"ga":true,"gb":true,"gd":true,"ge":true,"com.ge":true,"edu.ge":true,"gov.ge":true,"org.ge":true,"mil.ge":true,"net.ge":true,"pvt.ge":true,"gf":true,"gg":true,"co.gg":true,"net.gg":true,"org.gg":true,"gh":true,"com.gh":true,"edu.gh":true,"gov.gh":true,"org.gh":true,"mil.gh":true,"gi":true,"com.gi":true,"ltd.gi":true,"gov.gi":true,"mod.gi":true,"edu.gi":true,"org.gi":true,"gl":true,"co.gl":true,"com.gl":true,"edu.gl":true,"net.gl":true,"org.gl":true,"gm":true,"gn":true,"ac.gn":true,"com.gn":true,"edu.gn":true,"gov.gn":true,"org.gn":true,"net.gn":true,"gov":true,"gp":true,"com.gp":true,"net.gp":true,"mobi.gp":true,"edu.gp":true,"org.gp":true,"asso.gp":true,"gq":true,"gr":true,"com.gr":true,"edu.gr":true,"net.gr":true,"org.gr":true,"gov.gr":true,"gs":true,"gt":true,"com.gt":true,"edu.gt":true,"gob.gt":true,"ind.gt":true,"mil.gt":true,"net.gt":true,"org.gt":true,"*.gu":true,"gw":true,"gy":true,"co.gy":true,"com.gy":true,"net.gy":true,"hk":true,"com.hk":true,"edu.hk":true,"gov.hk":true,"idv.hk":true,"net.hk":true,"org.hk":true,"xn--55qx5d.hk":true,"xn--wcvs22d.hk":true,"xn--lcvr32d.hk":true,"xn--mxtq1m.hk":true,"xn--gmqw5a.hk":true,"xn--ciqpn.hk":true,"xn--gmq050i.hk":true,"xn--zf0avx.hk":true,"xn--io0a7i.hk":true,"xn--mk0axi.hk":true,"xn--od0alg.hk":true,"xn--od0aq3b.hk":true,"xn--tn0ag.hk":true,"xn--uc0atv.hk":true,"xn--uc0ay4a.hk":true,"hm":true,"hn":true,"com.hn":true,"edu.hn":true,"org.hn":true,"net.hn":true,"mil.hn":true,"gob.hn":true,"hr":true,"iz.hr":true,"from.hr":true,"name.hr":true,"com.hr":true,"ht":true,"com.ht":true,"shop.ht":true,"firm.ht":true,"info.ht":true,"adult.ht":true,"net.ht":true,"pro.ht":true,"org.ht":true,"med.ht":true,"art.ht":true,"coop.ht":true,"pol.ht":true,"asso.ht":true,"edu.ht":true,"rel.ht":true,"gouv.ht":true,"perso.ht":true,"hu":true,"co.hu":true,"info.hu":true,"org.hu":true,"priv.hu":true,"sport.hu":true,"tm.hu":true,"2000.hu":true,"agrar.hu":true,"bolt.hu":true,"casino.hu":true,"city.hu":true,"erotica.hu":true,"erotika.hu":true,"film.hu":true,"forum.hu":true,"games.hu":true,"hotel.hu":true,"ingatlan.hu":true,"jogasz.hu":true,"konyvelo.hu":true,"lakas.hu":true,"media.hu":true,"news.hu":true,"reklam.hu":true,"sex.hu":true,"shop.hu":true,"suli.hu":true,"szex.hu":true,"tozsde.hu":true,"utazas.hu":true,"video.hu":true,"id":true,"ac.id":true,"biz.id":true,"co.id":true,"desa.id":true,"go.id":true,"mil.id":true,"my.id":true,"net.id":true,"or.id":true,"sch.id":true,"web.id":true,"ie":true,"gov.ie":true,"il":true,"ac.il":true,"co.il":true,"gov.il":true,"idf.il":true,"k12.il":true,"muni.il":true,"net.il":true,"org.il":true,"im":true,"ac.im":true,"co.im":true,"com.im":true,"ltd.co.im":true,"net.im":true,"org.im":true,"plc.co.im":true,"tt.im":true,"tv.im":true,"in":true,"co.in":true,"firm.in":true,"net.in":true,"org.in":true,"gen.in":true,"ind.in":true,"nic.in":true,"ac.in":true,"edu.in":true,"res.in":true,"gov.in":true,"mil.in":true,"info":true,"int":true,"eu.int":true,"io":true,"com.io":true,"iq":true,"gov.iq":true,"edu.iq":true,"mil.iq":true,"com.iq":true,"org.iq":true,"net.iq":true,"ir":true,"ac.ir":true,"co.ir":true,"gov.ir":true,"id.ir":true,"net.ir":true,"org.ir":true,"sch.ir":true,"xn--mgba3a4f16a.ir":true,"xn--mgba3a4fra.ir":true,"is":true,"net.is":true,"com.is":true,"edu.is":true,"gov.is":true,"org.is":true,"int.is":true,"it":true,"gov.it":true,"edu.it":true,"abr.it":true,"abruzzo.it":true,"aosta-valley.it":true,"aostavalley.it":true,"bas.it":true,"basilicata.it":true,"cal.it":true,"calabria.it":true,"cam.it":true,"campania.it":true,"emilia-romagna.it":true,"emiliaromagna.it":true,"emr.it":true,"friuli-v-giulia.it":true,"friuli-ve-giulia.it":true,"friuli-vegiulia.it":true,"friuli-venezia-giulia.it":true,"friuli-veneziagiulia.it":true,"friuli-vgiulia.it":true,"friuliv-giulia.it":true,"friulive-giulia.it":true,"friulivegiulia.it":true,"friulivenezia-giulia.it":true,"friuliveneziagiulia.it":true,"friulivgiulia.it":true,"fvg.it":true,"laz.it":true,"lazio.it":true,"lig.it":true,"liguria.it":true,"lom.it":true,"lombardia.it":true,"lombardy.it":true,"lucania.it":true,"mar.it":true,"marche.it":true,"mol.it":true,"molise.it":true,"piedmont.it":true,"piemonte.it":true,"pmn.it":true,"pug.it":true,"puglia.it":true,"sar.it":true,"sardegna.it":true,"sardinia.it":true,"sic.it":true,"sicilia.it":true,"sicily.it":true,"taa.it":true,"tos.it":true,"toscana.it":true,"trentino-a-adige.it":true,"trentino-aadige.it":true,"trentino-alto-adige.it":true,"trentino-altoadige.it":true,"trentino-s-tirol.it":true,"trentino-stirol.it":true,"trentino-sud-tirol.it":true,"trentino-sudtirol.it":true,"trentino-sued-tirol.it":true,"trentino-suedtirol.it":true,"trentinoa-adige.it":true,"trentinoaadige.it":true,"trentinoalto-adige.it":true,"trentinoaltoadige.it":true,"trentinos-tirol.it":true,"trentinostirol.it":true,"trentinosud-tirol.it":true,"trentinosudtirol.it":true,"trentinosued-tirol.it":true,"trentinosuedtirol.it":true,"tuscany.it":true,"umb.it":true,"umbria.it":true,"val-d-aosta.it":true,"val-daosta.it":true,"vald-aosta.it":true,"valdaosta.it":true,"valle-aosta.it":true,"valle-d-aosta.it":true,"valle-daosta.it":true,"valleaosta.it":true,"valled-aosta.it":true,"valledaosta.it":true,"vallee-aoste.it":true,"valleeaoste.it":true,"vao.it":true,"vda.it":true,"ven.it":true,"veneto.it":true,"ag.it":true,"agrigento.it":true,"al.it":true,"alessandria.it":true,"alto-adige.it":true,"altoadige.it":true,"an.it":true,"ancona.it":true,"andria-barletta-trani.it":true,"andria-trani-barletta.it":true,"andriabarlettatrani.it":true,"andriatranibarletta.it":true,"ao.it":true,"aosta.it":true,"aoste.it":true,"ap.it":true,"aq.it":true,"aquila.it":true,"ar.it":true,"arezzo.it":true,"ascoli-piceno.it":true,"ascolipiceno.it":true,"asti.it":true,"at.it":true,"av.it":true,"avellino.it":true,"ba.it":true,"balsan.it":true,"bari.it":true,"barletta-trani-andria.it":true,"barlettatraniandria.it":true,"belluno.it":true,"benevento.it":true,"bergamo.it":true,"bg.it":true,"bi.it":true,"biella.it":true,"bl.it":true,"bn.it":true,"bo.it":true,"bologna.it":true,"bolzano.it":true,"bozen.it":true,"br.it":true,"brescia.it":true,"brindisi.it":true,"bs.it":true,"bt.it":true,"bz.it":true,"ca.it":true,"cagliari.it":true,"caltanissetta.it":true,"campidano-medio.it":true,"campidanomedio.it":true,"campobasso.it":true,"carbonia-iglesias.it":true,"carboniaiglesias.it":true,"carrara-massa.it":true,"carraramassa.it":true,"caserta.it":true,"catania.it":true,"catanzaro.it":true,"cb.it":true,"ce.it":true,"cesena-forli.it":true,"cesenaforli.it":true,"ch.it":true,"chieti.it":true,"ci.it":true,"cl.it":true,"cn.it":true,"co.it":true,"como.it":true,"cosenza.it":true,"cr.it":true,"cremona.it":true,"crotone.it":true,"cs.it":true,"ct.it":true,"cuneo.it":true,"cz.it":true,"dell-ogliastra.it":true,"dellogliastra.it":true,"en.it":true,"enna.it":true,"fc.it":true,"fe.it":true,"fermo.it":true,"ferrara.it":true,"fg.it":true,"fi.it":true,"firenze.it":true,"florence.it":true,"fm.it":true,"foggia.it":true,"forli-cesena.it":true,"forlicesena.it":true,"fr.it":true,"frosinone.it":true,"ge.it":true,"genoa.it":true,"genova.it":true,"go.it":true,"gorizia.it":true,"gr.it":true,"grosseto.it":true,"iglesias-carbonia.it":true,"iglesiascarbonia.it":true,"im.it":true,"imperia.it":true,"is.it":true,"isernia.it":true,"kr.it":true,"la-spezia.it":true,"laquila.it":true,"laspezia.it":true,"latina.it":true,"lc.it":true,"le.it":true,"lecce.it":true,"lecco.it":true,"li.it":true,"livorno.it":true,"lo.it":true,"lodi.it":true,"lt.it":true,"lu.it":true,"lucca.it":true,"macerata.it":true,"mantova.it":true,"massa-carrara.it":true,"massacarrara.it":true,"matera.it":true,"mb.it":true,"mc.it":true,"me.it":true,"medio-campidano.it":true,"mediocampidano.it":true,"messina.it":true,"mi.it":true,"milan.it":true,"milano.it":true,"mn.it":true,"mo.it":true,"modena.it":true,"monza-brianza.it":true,"monza-e-della-brianza.it":true,"monza.it":true,"monzabrianza.it":true,"monzaebrianza.it":true,"monzaedellabrianza.it":true,"ms.it":true,"mt.it":true,"na.it":true,"naples.it":true,"napoli.it":true,"no.it":true,"novara.it":true,"nu.it":true,"nuoro.it":true,"og.it":true,"ogliastra.it":true,"olbia-tempio.it":true,"olbiatempio.it":true,"or.it":true,"oristano.it":true,"ot.it":true,"pa.it":true,"padova.it":true,"padua.it":true,"palermo.it":true,"parma.it":true,"pavia.it":true,"pc.it":true,"pd.it":true,"pe.it":true,"perugia.it":true,"pesaro-urbino.it":true,"pesarourbino.it":true,"pescara.it":true,"pg.it":true,"pi.it":true,"piacenza.it":true,"pisa.it":true,"pistoia.it":true,"pn.it":true,"po.it":true,"pordenone.it":true,"potenza.it":true,"pr.it":true,"prato.it":true,"pt.it":true,"pu.it":true,"pv.it":true,"pz.it":true,"ra.it":true,"ragusa.it":true,"ravenna.it":true,"rc.it":true,"re.it":true,"reggio-calabria.it":true,"reggio-emilia.it":true,"reggiocalabria.it":true,"reggioemilia.it":true,"rg.it":true,"ri.it":true,"rieti.it":true,"rimini.it":true,"rm.it":true,"rn.it":true,"ro.it":true,"roma.it":true,"rome.it":true,"rovigo.it":true,"sa.it":true,"salerno.it":true,"sassari.it":true,"savona.it":true,"si.it":true,"siena.it":true,"siracusa.it":true,"so.it":true,"sondrio.it":true,"sp.it":true,"sr.it":true,"ss.it":true,"suedtirol.it":true,"sv.it":true,"ta.it":true,"taranto.it":true,"te.it":true,"tempio-olbia.it":true,"tempioolbia.it":true,"teramo.it":true,"terni.it":true,"tn.it":true,"to.it":true,"torino.it":true,"tp.it":true,"tr.it":true,"trani-andria-barletta.it":true,"trani-barletta-andria.it":true,"traniandriabarletta.it":true,"tranibarlettaandria.it":true,"trapani.it":true,"trentino.it":true,"trento.it":true,"treviso.it":true,"trieste.it":true,"ts.it":true,"turin.it":true,"tv.it":true,"ud.it":true,"udine.it":true,"urbino-pesaro.it":true,"urbinopesaro.it":true,"va.it":true,"varese.it":true,"vb.it":true,"vc.it":true,"ve.it":true,"venezia.it":true,"venice.it":true,"verbania.it":true,"vercelli.it":true,"verona.it":true,"vi.it":true,"vibo-valentia.it":true,"vibovalentia.it":true,"vicenza.it":true,"viterbo.it":true,"vr.it":true,"vs.it":true,"vt.it":true,"vv.it":true,"je":true,"co.je":true,"net.je":true,"org.je":true,"*.jm":true,"jo":true,"com.jo":true,"org.jo":true,"net.jo":true,"edu.jo":true,"sch.jo":true,"gov.jo":true,"mil.jo":true,"name.jo":true,"jobs":true,"jp":true,"ac.jp":true,"ad.jp":true,"co.jp":true,"ed.jp":true,"go.jp":true,"gr.jp":true,"lg.jp":true,"ne.jp":true,"or.jp":true,"aichi.jp":true,"akita.jp":true,"aomori.jp":true,"chiba.jp":true,"ehime.jp":true,"fukui.jp":true,"fukuoka.jp":true,"fukushima.jp":true,"gifu.jp":true,"gunma.jp":true,"hiroshima.jp":true,"hokkaido.jp":true,"hyogo.jp":true,"ibaraki.jp":true,"ishikawa.jp":true,"iwate.jp":true,"kagawa.jp":true,"kagoshima.jp":true,"kanagawa.jp":true,"kochi.jp":true,"kumamoto.jp":true,"kyoto.jp":true,"mie.jp":true,"miyagi.jp":true,"miyazaki.jp":true,"nagano.jp":true,"nagasaki.jp":true,"nara.jp":true,"niigata.jp":true,"oita.jp":true,"okayama.jp":true,"okinawa.jp":true,"osaka.jp":true,"saga.jp":true,"saitama.jp":true,"shiga.jp":true,"shimane.jp":true,"shizuoka.jp":true,"tochigi.jp":true,"tokushima.jp":true,"tokyo.jp":true,"tottori.jp":true,"toyama.jp":true,"wakayama.jp":true,"yamagata.jp":true,"yamaguchi.jp":true,"yamanashi.jp":true,"xn--4pvxs.jp":true,"xn--vgu402c.jp":true,"xn--c3s14m.jp":true,"xn--f6qx53a.jp":true,"xn--8pvr4u.jp":true,"xn--uist22h.jp":true,"xn--djrs72d6uy.jp":true,"xn--mkru45i.jp":true,"xn--0trq7p7nn.jp":true,"xn--8ltr62k.jp":true,"xn--2m4a15e.jp":true,"xn--efvn9s.jp":true,"xn--32vp30h.jp":true,"xn--4it797k.jp":true,"xn--1lqs71d.jp":true,"xn--5rtp49c.jp":true,"xn--5js045d.jp":true,"xn--ehqz56n.jp":true,"xn--1lqs03n.jp":true,"xn--qqqt11m.jp":true,"xn--kbrq7o.jp":true,"xn--pssu33l.jp":true,"xn--ntsq17g.jp":true,"xn--uisz3g.jp":true,"xn--6btw5a.jp":true,"xn--1ctwo.jp":true,"xn--6orx2r.jp":true,"xn--rht61e.jp":true,"xn--rht27z.jp":true,"xn--djty4k.jp":true,"xn--nit225k.jp":true,"xn--rht3d.jp":true,"xn--klty5x.jp":true,"xn--kltx9a.jp":true,"xn--kltp7d.jp":true,"xn--uuwu58a.jp":true,"xn--zbx025d.jp":true,"xn--ntso0iqx3a.jp":true,"xn--elqq16h.jp":true,"xn--4it168d.jp":true,"xn--klt787d.jp":true,"xn--rny31h.jp":true,"xn--7t0a264c.jp":true,"xn--5rtq34k.jp":true,"xn--k7yn95e.jp":true,"xn--tor131o.jp":true,"xn--d5qv7z876c.jp":true,"*.kawasaki.jp":true,"*.kitakyushu.jp":true,"*.kobe.jp":true,"*.nagoya.jp":true,"*.sapporo.jp":true,"*.sendai.jp":true,"*.yokohama.jp":true,"city.kawasaki.jp":false,"city.kitakyushu.jp":false,"city.kobe.jp":false,"city.nagoya.jp":false,"city.sapporo.jp":false,"city.sendai.jp":false,"city.yokohama.jp":false,"aisai.aichi.jp":true,"ama.aichi.jp":true,"anjo.aichi.jp":true,"asuke.aichi.jp":true,"chiryu.aichi.jp":true,"chita.aichi.jp":true,"fuso.aichi.jp":true,"gamagori.aichi.jp":true,"handa.aichi.jp":true,"hazu.aichi.jp":true,"hekinan.aichi.jp":true,"higashiura.aichi.jp":true,"ichinomiya.aichi.jp":true,"inazawa.aichi.jp":true,"inuyama.aichi.jp":true,"isshiki.aichi.jp":true,"iwakura.aichi.jp":true,"kanie.aichi.jp":true,"kariya.aichi.jp":true,"kasugai.aichi.jp":true,"kira.aichi.jp":true,"kiyosu.aichi.jp":true,"komaki.aichi.jp":true,"konan.aichi.jp":true,"kota.aichi.jp":true,"mihama.aichi.jp":true,"miyoshi.aichi.jp":true,"nishio.aichi.jp":true,"nisshin.aichi.jp":true,"obu.aichi.jp":true,"oguchi.aichi.jp":true,"oharu.aichi.jp":true,"okazaki.aichi.jp":true,"owariasahi.aichi.jp":true,"seto.aichi.jp":true,"shikatsu.aichi.jp":true,"shinshiro.aichi.jp":true,"shitara.aichi.jp":true,"tahara.aichi.jp":true,"takahama.aichi.jp":true,"tobishima.aichi.jp":true,"toei.aichi.jp":true,"togo.aichi.jp":true,"tokai.aichi.jp":true,"tokoname.aichi.jp":true,"toyoake.aichi.jp":true,"toyohashi.aichi.jp":true,"toyokawa.aichi.jp":true,"toyone.aichi.jp":true,"toyota.aichi.jp":true,"tsushima.aichi.jp":true,"yatomi.aichi.jp":true,"akita.akita.jp":true,"daisen.akita.jp":true,"fujisato.akita.jp":true,"gojome.akita.jp":true,"hachirogata.akita.jp":true,"happou.akita.jp":true,"higashinaruse.akita.jp":true,"honjo.akita.jp":true,"honjyo.akita.jp":true,"ikawa.akita.jp":true,"kamikoani.akita.jp":true,"kamioka.akita.jp":true,"katagami.akita.jp":true,"kazuno.akita.jp":true,"kitaakita.akita.jp":true,"kosaka.akita.jp":true,"kyowa.akita.jp":true,"misato.akita.jp":true,"mitane.akita.jp":true,"moriyoshi.akita.jp":true,"nikaho.akita.jp":true,"noshiro.akita.jp":true,"odate.akita.jp":true,"oga.akita.jp":true,"ogata.akita.jp":true,"semboku.akita.jp":true,"yokote.akita.jp":true,"yurihonjo.akita.jp":true,"aomori.aomori.jp":true,"gonohe.aomori.jp":true,"hachinohe.aomori.jp":true,"hashikami.aomori.jp":true,"hiranai.aomori.jp":true,"hirosaki.aomori.jp":true,"itayanagi.aomori.jp":true,"kuroishi.aomori.jp":true,"misawa.aomori.jp":true,"mutsu.aomori.jp":true,"nakadomari.aomori.jp":true,"noheji.aomori.jp":true,"oirase.aomori.jp":true,"owani.aomori.jp":true,"rokunohe.aomori.jp":true,"sannohe.aomori.jp":true,"shichinohe.aomori.jp":true,"shingo.aomori.jp":true,"takko.aomori.jp":true,"towada.aomori.jp":true,"tsugaru.aomori.jp":true,"tsuruta.aomori.jp":true,"abiko.chiba.jp":true,"asahi.chiba.jp":true,"chonan.chiba.jp":true,"chosei.chiba.jp":true,"choshi.chiba.jp":true,"chuo.chiba.jp":true,"funabashi.chiba.jp":true,"futtsu.chiba.jp":true,"hanamigawa.chiba.jp":true,"ichihara.chiba.jp":true,"ichikawa.chiba.jp":true,"ichinomiya.chiba.jp":true,"inzai.chiba.jp":true,"isumi.chiba.jp":true,"kamagaya.chiba.jp":true,"kamogawa.chiba.jp":true,"kashiwa.chiba.jp":true,"katori.chiba.jp":true,"katsuura.chiba.jp":true,"kimitsu.chiba.jp":true,"kisarazu.chiba.jp":true,"kozaki.chiba.jp":true,"kujukuri.chiba.jp":true,"kyonan.chiba.jp":true,"matsudo.chiba.jp":true,"midori.chiba.jp":true,"mihama.chiba.jp":true,"minamiboso.chiba.jp":true,"mobara.chiba.jp":true,"mutsuzawa.chiba.jp":true,"nagara.chiba.jp":true,"nagareyama.chiba.jp":true,"narashino.chiba.jp":true,"narita.chiba.jp":true,"noda.chiba.jp":true,"oamishirasato.chiba.jp":true,"omigawa.chiba.jp":true,"onjuku.chiba.jp":true,"otaki.chiba.jp":true,"sakae.chiba.jp":true,"sakura.chiba.jp":true,"shimofusa.chiba.jp":true,"shirako.chiba.jp":true,"shiroi.chiba.jp":true,"shisui.chiba.jp":true,"sodegaura.chiba.jp":true,"sosa.chiba.jp":true,"tako.chiba.jp":true,"tateyama.chiba.jp":true,"togane.chiba.jp":true,"tohnosho.chiba.jp":true,"tomisato.chiba.jp":true,"urayasu.chiba.jp":true,"yachimata.chiba.jp":true,"yachiyo.chiba.jp":true,"yokaichiba.chiba.jp":true,"yokoshibahikari.chiba.jp":true,"yotsukaido.chiba.jp":true,"ainan.ehime.jp":true,"honai.ehime.jp":true,"ikata.ehime.jp":true,"imabari.ehime.jp":true,"iyo.ehime.jp":true,"kamijima.ehime.jp":true,"kihoku.ehime.jp":true,"kumakogen.ehime.jp":true,"masaki.ehime.jp":true,"matsuno.ehime.jp":true,"matsuyama.ehime.jp":true,"namikata.ehime.jp":true,"niihama.ehime.jp":true,"ozu.ehime.jp":true,"saijo.ehime.jp":true,"seiyo.ehime.jp":true,"shikokuchuo.ehime.jp":true,"tobe.ehime.jp":true,"toon.ehime.jp":true,"uchiko.ehime.jp":true,"uwajima.ehime.jp":true,"yawatahama.ehime.jp":true,"echizen.fukui.jp":true,"eiheiji.fukui.jp":true,"fukui.fukui.jp":true,"ikeda.fukui.jp":true,"katsuyama.fukui.jp":true,"mihama.fukui.jp":true,"minamiechizen.fukui.jp":true,"obama.fukui.jp":true,"ohi.fukui.jp":true,"ono.fukui.jp":true,"sabae.fukui.jp":true,"sakai.fukui.jp":true,"takahama.fukui.jp":true,"tsuruga.fukui.jp":true,"wakasa.fukui.jp":true,"ashiya.fukuoka.jp":true,"buzen.fukuoka.jp":true,"chikugo.fukuoka.jp":true,"chikuho.fukuoka.jp":true,"chikujo.fukuoka.jp":true,"chikushino.fukuoka.jp":true,"chikuzen.fukuoka.jp":true,"chuo.fukuoka.jp":true,"dazaifu.fukuoka.jp":true,"fukuchi.fukuoka.jp":true,"hakata.fukuoka.jp":true,"higashi.fukuoka.jp":true,"hirokawa.fukuoka.jp":true,"hisayama.fukuoka.jp":true,"iizuka.fukuoka.jp":true,"inatsuki.fukuoka.jp":true,"kaho.fukuoka.jp":true,"kasuga.fukuoka.jp":true,"kasuya.fukuoka.jp":true,"kawara.fukuoka.jp":true,"keisen.fukuoka.jp":true,"koga.fukuoka.jp":true,"kurate.fukuoka.jp":true,"kurogi.fukuoka.jp":true,"kurume.fukuoka.jp":true,"minami.fukuoka.jp":true,"miyako.fukuoka.jp":true,"miyama.fukuoka.jp":true,"miyawaka.fukuoka.jp":true,"mizumaki.fukuoka.jp":true,"munakata.fukuoka.jp":true,"nakagawa.fukuoka.jp":true,"nakama.fukuoka.jp":true,"nishi.fukuoka.jp":true,"nogata.fukuoka.jp":true,"ogori.fukuoka.jp":true,"okagaki.fukuoka.jp":true,"okawa.fukuoka.jp":true,"oki.fukuoka.jp":true,"omuta.fukuoka.jp":true,"onga.fukuoka.jp":true,"onojo.fukuoka.jp":true,"oto.fukuoka.jp":true,"saigawa.fukuoka.jp":true,"sasaguri.fukuoka.jp":true,"shingu.fukuoka.jp":true,"shinyoshitomi.fukuoka.jp":true,"shonai.fukuoka.jp":true,"soeda.fukuoka.jp":true,"sue.fukuoka.jp":true,"tachiarai.fukuoka.jp":true,"tagawa.fukuoka.jp":true,"takata.fukuoka.jp":true,"toho.fukuoka.jp":true,"toyotsu.fukuoka.jp":true,"tsuiki.fukuoka.jp":true,"ukiha.fukuoka.jp":true,"umi.fukuoka.jp":true,"usui.fukuoka.jp":true,"yamada.fukuoka.jp":true,"yame.fukuoka.jp":true,"yanagawa.fukuoka.jp":true,"yukuhashi.fukuoka.jp":true,"aizubange.fukushima.jp":true,"aizumisato.fukushima.jp":true,"aizuwakamatsu.fukushima.jp":true,"asakawa.fukushima.jp":true,"bandai.fukushima.jp":true,"date.fukushima.jp":true,"fukushima.fukushima.jp":true,"furudono.fukushima.jp":true,"futaba.fukushima.jp":true,"hanawa.fukushima.jp":true,"higashi.fukushima.jp":true,"hirata.fukushima.jp":true,"hirono.fukushima.jp":true,"iitate.fukushima.jp":true,"inawashiro.fukushima.jp":true,"ishikawa.fukushima.jp":true,"iwaki.fukushima.jp":true,"izumizaki.fukushima.jp":true,"kagamiishi.fukushima.jp":true,"kaneyama.fukushima.jp":true,"kawamata.fukushima.jp":true,"kitakata.fukushima.jp":true,"kitashiobara.fukushima.jp":true,"koori.fukushima.jp":true,"koriyama.fukushima.jp":true,"kunimi.fukushima.jp":true,"miharu.fukushima.jp":true,"mishima.fukushima.jp":true,"namie.fukushima.jp":true,"nango.fukushima.jp":true,"nishiaizu.fukushima.jp":true,"nishigo.fukushima.jp":true,"okuma.fukushima.jp":true,"omotego.fukushima.jp":true,"ono.fukushima.jp":true,"otama.fukushima.jp":true,"samegawa.fukushima.jp":true,"shimogo.fukushima.jp":true,"shirakawa.fukushima.jp":true,"showa.fukushima.jp":true,"soma.fukushima.jp":true,"sukagawa.fukushima.jp":true,"taishin.fukushima.jp":true,"tamakawa.fukushima.jp":true,"tanagura.fukushima.jp":true,"tenei.fukushima.jp":true,"yabuki.fukushima.jp":true,"yamato.fukushima.jp":true,"yamatsuri.fukushima.jp":true,"yanaizu.fukushima.jp":true,"yugawa.fukushima.jp":true,"anpachi.gifu.jp":true,"ena.gifu.jp":true,"gifu.gifu.jp":true,"ginan.gifu.jp":true,"godo.gifu.jp":true,"gujo.gifu.jp":true,"hashima.gifu.jp":true,"hichiso.gifu.jp":true,"hida.gifu.jp":true,"higashishirakawa.gifu.jp":true,"ibigawa.gifu.jp":true,"ikeda.gifu.jp":true,"kakamigahara.gifu.jp":true,"kani.gifu.jp":true,"kasahara.gifu.jp":true,"kasamatsu.gifu.jp":true,"kawaue.gifu.jp":true,"kitagata.gifu.jp":true,"mino.gifu.jp":true,"minokamo.gifu.jp":true,"mitake.gifu.jp":true,"mizunami.gifu.jp":true,"motosu.gifu.jp":true,"nakatsugawa.gifu.jp":true,"ogaki.gifu.jp":true,"sakahogi.gifu.jp":true,"seki.gifu.jp":true,"sekigahara.gifu.jp":true,"shirakawa.gifu.jp":true,"tajimi.gifu.jp":true,"takayama.gifu.jp":true,"tarui.gifu.jp":true,"toki.gifu.jp":true,"tomika.gifu.jp":true,"wanouchi.gifu.jp":true,"yamagata.gifu.jp":true,"yaotsu.gifu.jp":true,"yoro.gifu.jp":true,"annaka.gunma.jp":true,"chiyoda.gunma.jp":true,"fujioka.gunma.jp":true,"higashiagatsuma.gunma.jp":true,"isesaki.gunma.jp":true,"itakura.gunma.jp":true,"kanna.gunma.jp":true,"kanra.gunma.jp":true,"katashina.gunma.jp":true,"kawaba.gunma.jp":true,"kiryu.gunma.jp":true,"kusatsu.gunma.jp":true,"maebashi.gunma.jp":true,"meiwa.gunma.jp":true,"midori.gunma.jp":true,"minakami.gunma.jp":true,"naganohara.gunma.jp":true,"nakanojo.gunma.jp":true,"nanmoku.gunma.jp":true,"numata.gunma.jp":true,"oizumi.gunma.jp":true,"ora.gunma.jp":true,"ota.gunma.jp":true,"shibukawa.gunma.jp":true,"shimonita.gunma.jp":true,"shinto.gunma.jp":true,"showa.gunma.jp":true,"takasaki.gunma.jp":true,"takayama.gunma.jp":true,"tamamura.gunma.jp":true,"tatebayashi.gunma.jp":true,"tomioka.gunma.jp":true,"tsukiyono.gunma.jp":true,"tsumagoi.gunma.jp":true,"ueno.gunma.jp":true,"yoshioka.gunma.jp":true,"asaminami.hiroshima.jp":true,"daiwa.hiroshima.jp":true,"etajima.hiroshima.jp":true,"fuchu.hiroshima.jp":true,"fukuyama.hiroshima.jp":true,"hatsukaichi.hiroshima.jp":true,"higashihiroshima.hiroshima.jp":true,"hongo.hiroshima.jp":true,"jinsekikogen.hiroshima.jp":true,"kaita.hiroshima.jp":true,"kui.hiroshima.jp":true,"kumano.hiroshima.jp":true,"kure.hiroshima.jp":true,"mihara.hiroshima.jp":true,"miyoshi.hiroshima.jp":true,"naka.hiroshima.jp":true,"onomichi.hiroshima.jp":true,"osakikamijima.hiroshima.jp":true,"otake.hiroshima.jp":true,"saka.hiroshima.jp":true,"sera.hiroshima.jp":true,"seranishi.hiroshima.jp":true,"shinichi.hiroshima.jp":true,"shobara.hiroshima.jp":true,"takehara.hiroshima.jp":true,"abashiri.hokkaido.jp":true,"abira.hokkaido.jp":true,"aibetsu.hokkaido.jp":true,"akabira.hokkaido.jp":true,"akkeshi.hokkaido.jp":true,"asahikawa.hokkaido.jp":true,"ashibetsu.hokkaido.jp":true,"ashoro.hokkaido.jp":true,"assabu.hokkaido.jp":true,"atsuma.hokkaido.jp":true,"bibai.hokkaido.jp":true,"biei.hokkaido.jp":true,"bifuka.hokkaido.jp":true,"bihoro.hokkaido.jp":true,"biratori.hokkaido.jp":true,"chippubetsu.hokkaido.jp":true,"chitose.hokkaido.jp":true,"date.hokkaido.jp":true,"ebetsu.hokkaido.jp":true,"embetsu.hokkaido.jp":true,"eniwa.hokkaido.jp":true,"erimo.hokkaido.jp":true,"esan.hokkaido.jp":true,"esashi.hokkaido.jp":true,"fukagawa.hokkaido.jp":true,"fukushima.hokkaido.jp":true,"furano.hokkaido.jp":true,"furubira.hokkaido.jp":true,"haboro.hokkaido.jp":true,"hakodate.hokkaido.jp":true,"hamatonbetsu.hokkaido.jp":true,"hidaka.hokkaido.jp":true,"higashikagura.hokkaido.jp":true,"higashikawa.hokkaido.jp":true,"hiroo.hokkaido.jp":true,"hokuryu.hokkaido.jp":true,"hokuto.hokkaido.jp":true,"honbetsu.hokkaido.jp":true,"horokanai.hokkaido.jp":true,"horonobe.hokkaido.jp":true,"ikeda.hokkaido.jp":true,"imakane.hokkaido.jp":true,"ishikari.hokkaido.jp":true,"iwamizawa.hokkaido.jp":true,"iwanai.hokkaido.jp":true,"kamifurano.hokkaido.jp":true,"kamikawa.hokkaido.jp":true,"kamishihoro.hokkaido.jp":true,"kamisunagawa.hokkaido.jp":true,"kamoenai.hokkaido.jp":true,"kayabe.hokkaido.jp":true,"kembuchi.hokkaido.jp":true,"kikonai.hokkaido.jp":true,"kimobetsu.hokkaido.jp":true,"kitahiroshima.hokkaido.jp":true,"kitami.hokkaido.jp":true,"kiyosato.hokkaido.jp":true,"koshimizu.hokkaido.jp":true,"kunneppu.hokkaido.jp":true,"kuriyama.hokkaido.jp":true,"kuromatsunai.hokkaido.jp":true,"kushiro.hokkaido.jp":true,"kutchan.hokkaido.jp":true,"kyowa.hokkaido.jp":true,"mashike.hokkaido.jp":true,"matsumae.hokkaido.jp":true,"mikasa.hokkaido.jp":true,"minamifurano.hokkaido.jp":true,"mombetsu.hokkaido.jp":true,"moseushi.hokkaido.jp":true,"mukawa.hokkaido.jp":true,"muroran.hokkaido.jp":true,"naie.hokkaido.jp":true,"nakagawa.hokkaido.jp":true,"nakasatsunai.hokkaido.jp":true,"nakatombetsu.hokkaido.jp":true,"nanae.hokkaido.jp":true,"nanporo.hokkaido.jp":true,"nayoro.hokkaido.jp":true,"nemuro.hokkaido.jp":true,"niikappu.hokkaido.jp":true,"niki.hokkaido.jp":true,"nishiokoppe.hokkaido.jp":true,"noboribetsu.hokkaido.jp":true,"numata.hokkaido.jp":true,"obihiro.hokkaido.jp":true,"obira.hokkaido.jp":true,"oketo.hokkaido.jp":true,"okoppe.hokkaido.jp":true,"otaru.hokkaido.jp":true,"otobe.hokkaido.jp":true,"otofuke.hokkaido.jp":true,"otoineppu.hokkaido.jp":true,"oumu.hokkaido.jp":true,"ozora.hokkaido.jp":true,"pippu.hokkaido.jp":true,"rankoshi.hokkaido.jp":true,"rebun.hokkaido.jp":true,"rikubetsu.hokkaido.jp":true,"rishiri.hokkaido.jp":true,"rishirifuji.hokkaido.jp":true,"saroma.hokkaido.jp":true,"sarufutsu.hokkaido.jp":true,"shakotan.hokkaido.jp":true,"shari.hokkaido.jp":true,"shibecha.hokkaido.jp":true,"shibetsu.hokkaido.jp":true,"shikabe.hokkaido.jp":true,"shikaoi.hokkaido.jp":true,"shimamaki.hokkaido.jp":true,"shimizu.hokkaido.jp":true,"shimokawa.hokkaido.jp":true,"shinshinotsu.hokkaido.jp":true,"shintoku.hokkaido.jp":true,"shiranuka.hokkaido.jp":true,"shiraoi.hokkaido.jp":true,"shiriuchi.hokkaido.jp":true,"sobetsu.hokkaido.jp":true,"sunagawa.hokkaido.jp":true,"taiki.hokkaido.jp":true,"takasu.hokkaido.jp":true,"takikawa.hokkaido.jp":true,"takinoue.hokkaido.jp":true,"teshikaga.hokkaido.jp":true,"tobetsu.hokkaido.jp":true,"tohma.hokkaido.jp":true,"tomakomai.hokkaido.jp":true,"tomari.hokkaido.jp":true,"toya.hokkaido.jp":true,"toyako.hokkaido.jp":true,"toyotomi.hokkaido.jp":true,"toyoura.hokkaido.jp":true,"tsubetsu.hokkaido.jp":true,"tsukigata.hokkaido.jp":true,"urakawa.hokkaido.jp":true,"urausu.hokkaido.jp":true,"uryu.hokkaido.jp":true,"utashinai.hokkaido.jp":true,"wakkanai.hokkaido.jp":true,"wassamu.hokkaido.jp":true,"yakumo.hokkaido.jp":true,"yoichi.hokkaido.jp":true,"aioi.hyogo.jp":true,"akashi.hyogo.jp":true,"ako.hyogo.jp":true,"amagasaki.hyogo.jp":true,"aogaki.hyogo.jp":true,"asago.hyogo.jp":true,"ashiya.hyogo.jp":true,"awaji.hyogo.jp":true,"fukusaki.hyogo.jp":true,"goshiki.hyogo.jp":true,"harima.hyogo.jp":true,"himeji.hyogo.jp":true,"ichikawa.hyogo.jp":true,"inagawa.hyogo.jp":true,"itami.hyogo.jp":true,"kakogawa.hyogo.jp":true,"kamigori.hyogo.jp":true,"kamikawa.hyogo.jp":true,"kasai.hyogo.jp":true,"kasuga.hyogo.jp":true,"kawanishi.hyogo.jp":true,"miki.hyogo.jp":true,"minamiawaji.hyogo.jp":true,"nishinomiya.hyogo.jp":true,"nishiwaki.hyogo.jp":true,"ono.hyogo.jp":true,"sanda.hyogo.jp":true,"sannan.hyogo.jp":true,"sasayama.hyogo.jp":true,"sayo.hyogo.jp":true,"shingu.hyogo.jp":true,"shinonsen.hyogo.jp":true,"shiso.hyogo.jp":true,"sumoto.hyogo.jp":true,"taishi.hyogo.jp":true,"taka.hyogo.jp":true,"takarazuka.hyogo.jp":true,"takasago.hyogo.jp":true,"takino.hyogo.jp":true,"tamba.hyogo.jp":true,"tatsuno.hyogo.jp":true,"toyooka.hyogo.jp":true,"yabu.hyogo.jp":true,"yashiro.hyogo.jp":true,"yoka.hyogo.jp":true,"yokawa.hyogo.jp":true,"ami.ibaraki.jp":true,"asahi.ibaraki.jp":true,"bando.ibaraki.jp":true,"chikusei.ibaraki.jp":true,"daigo.ibaraki.jp":true,"fujishiro.ibaraki.jp":true,"hitachi.ibaraki.jp":true,"hitachinaka.ibaraki.jp":true,"hitachiomiya.ibaraki.jp":true,"hitachiota.ibaraki.jp":true,"ibaraki.ibaraki.jp":true,"ina.ibaraki.jp":true,"inashiki.ibaraki.jp":true,"itako.ibaraki.jp":true,"iwama.ibaraki.jp":true,"joso.ibaraki.jp":true,"kamisu.ibaraki.jp":true,"kasama.ibaraki.jp":true,"kashima.ibaraki.jp":true,"kasumigaura.ibaraki.jp":true,"koga.ibaraki.jp":true,"miho.ibaraki.jp":true,"mito.ibaraki.jp":true,"moriya.ibaraki.jp":true,"naka.ibaraki.jp":true,"namegata.ibaraki.jp":true,"oarai.ibaraki.jp":true,"ogawa.ibaraki.jp":true,"omitama.ibaraki.jp":true,"ryugasaki.ibaraki.jp":true,"sakai.ibaraki.jp":true,"sakuragawa.ibaraki.jp":true,"shimodate.ibaraki.jp":true,"shimotsuma.ibaraki.jp":true,"shirosato.ibaraki.jp":true,"sowa.ibaraki.jp":true,"suifu.ibaraki.jp":true,"takahagi.ibaraki.jp":true,"tamatsukuri.ibaraki.jp":true,"tokai.ibaraki.jp":true,"tomobe.ibaraki.jp":true,"tone.ibaraki.jp":true,"toride.ibaraki.jp":true,"tsuchiura.ibaraki.jp":true,"tsukuba.ibaraki.jp":true,"uchihara.ibaraki.jp":true,"ushiku.ibaraki.jp":true,"yachiyo.ibaraki.jp":true,"yamagata.ibaraki.jp":true,"yawara.ibaraki.jp":true,"yuki.ibaraki.jp":true,"anamizu.ishikawa.jp":true,"hakui.ishikawa.jp":true,"hakusan.ishikawa.jp":true,"kaga.ishikawa.jp":true,"kahoku.ishikawa.jp":true,"kanazawa.ishikawa.jp":true,"kawakita.ishikawa.jp":true,"komatsu.ishikawa.jp":true,"nakanoto.ishikawa.jp":true,"nanao.ishikawa.jp":true,"nomi.ishikawa.jp":true,"nonoichi.ishikawa.jp":true,"noto.ishikawa.jp":true,"shika.ishikawa.jp":true,"suzu.ishikawa.jp":true,"tsubata.ishikawa.jp":true,"tsurugi.ishikawa.jp":true,"uchinada.ishikawa.jp":true,"wajima.ishikawa.jp":true,"fudai.iwate.jp":true,"fujisawa.iwate.jp":true,"hanamaki.iwate.jp":true,"hiraizumi.iwate.jp":true,"hirono.iwate.jp":true,"ichinohe.iwate.jp":true,"ichinoseki.iwate.jp":true,"iwaizumi.iwate.jp":true,"iwate.iwate.jp":true,"joboji.iwate.jp":true,"kamaishi.iwate.jp":true,"kanegasaki.iwate.jp":true,"karumai.iwate.jp":true,"kawai.iwate.jp":true,"kitakami.iwate.jp":true,"kuji.iwate.jp":true,"kunohe.iwate.jp":true,"kuzumaki.iwate.jp":true,"miyako.iwate.jp":true,"mizusawa.iwate.jp":true,"morioka.iwate.jp":true,"ninohe.iwate.jp":true,"noda.iwate.jp":true,"ofunato.iwate.jp":true,"oshu.iwate.jp":true,"otsuchi.iwate.jp":true,"rikuzentakata.iwate.jp":true,"shiwa.iwate.jp":true,"shizukuishi.iwate.jp":true,"sumita.iwate.jp":true,"tanohata.iwate.jp":true,"tono.iwate.jp":true,"yahaba.iwate.jp":true,"yamada.iwate.jp":true,"ayagawa.kagawa.jp":true,"higashikagawa.kagawa.jp":true,"kanonji.kagawa.jp":true,"kotohira.kagawa.jp":true,"manno.kagawa.jp":true,"marugame.kagawa.jp":true,"mitoyo.kagawa.jp":true,"naoshima.kagawa.jp":true,"sanuki.kagawa.jp":true,"tadotsu.kagawa.jp":true,"takamatsu.kagawa.jp":true,"tonosho.kagawa.jp":true,"uchinomi.kagawa.jp":true,"utazu.kagawa.jp":true,"zentsuji.kagawa.jp":true,"akune.kagoshima.jp":true,"amami.kagoshima.jp":true,"hioki.kagoshima.jp":true,"isa.kagoshima.jp":true,"isen.kagoshima.jp":true,"izumi.kagoshima.jp":true,"kagoshima.kagoshima.jp":true,"kanoya.kagoshima.jp":true,"kawanabe.kagoshima.jp":true,"kinko.kagoshima.jp":true,"kouyama.kagoshima.jp":true,"makurazaki.kagoshima.jp":true,"matsumoto.kagoshima.jp":true,"minamitane.kagoshima.jp":true,"nakatane.kagoshima.jp":true,"nishinoomote.kagoshima.jp":true,"satsumasendai.kagoshima.jp":true,"soo.kagoshima.jp":true,"tarumizu.kagoshima.jp":true,"yusui.kagoshima.jp":true,"aikawa.kanagawa.jp":true,"atsugi.kanagawa.jp":true,"ayase.kanagawa.jp":true,"chigasaki.kanagawa.jp":true,"ebina.kanagawa.jp":true,"fujisawa.kanagawa.jp":true,"hadano.kanagawa.jp":true,"hakone.kanagawa.jp":true,"hiratsuka.kanagawa.jp":true,"isehara.kanagawa.jp":true,"kaisei.kanagawa.jp":true,"kamakura.kanagawa.jp":true,"kiyokawa.kanagawa.jp":true,"matsuda.kanagawa.jp":true,"minamiashigara.kanagawa.jp":true,"miura.kanagawa.jp":true,"nakai.kanagawa.jp":true,"ninomiya.kanagawa.jp":true,"odawara.kanagawa.jp":true,"oi.kanagawa.jp":true,"oiso.kanagawa.jp":true,"sagamihara.kanagawa.jp":true,"samukawa.kanagawa.jp":true,"tsukui.kanagawa.jp":true,"yamakita.kanagawa.jp":true,"yamato.kanagawa.jp":true,"yokosuka.kanagawa.jp":true,"yugawara.kanagawa.jp":true,"zama.kanagawa.jp":true,"zushi.kanagawa.jp":true,"aki.kochi.jp":true,"geisei.kochi.jp":true,"hidaka.kochi.jp":true,"higashitsuno.kochi.jp":true,"ino.kochi.jp":true,"kagami.kochi.jp":true,"kami.kochi.jp":true,"kitagawa.kochi.jp":true,"kochi.kochi.jp":true,"mihara.kochi.jp":true,"motoyama.kochi.jp":true,"muroto.kochi.jp":true,"nahari.kochi.jp":true,"nakamura.kochi.jp":true,"nankoku.kochi.jp":true,"nishitosa.kochi.jp":true,"niyodogawa.kochi.jp":true,"ochi.kochi.jp":true,"okawa.kochi.jp":true,"otoyo.kochi.jp":true,"otsuki.kochi.jp":true,"sakawa.kochi.jp":true,"sukumo.kochi.jp":true,"susaki.kochi.jp":true,"tosa.kochi.jp":true,"tosashimizu.kochi.jp":true,"toyo.kochi.jp":true,"tsuno.kochi.jp":true,"umaji.kochi.jp":true,"yasuda.kochi.jp":true,"yusuhara.kochi.jp":true,"amakusa.kumamoto.jp":true,"arao.kumamoto.jp":true,"aso.kumamoto.jp":true,"choyo.kumamoto.jp":true,"gyokuto.kumamoto.jp":true,"hitoyoshi.kumamoto.jp":true,"kamiamakusa.kumamoto.jp":true,"kashima.kumamoto.jp":true,"kikuchi.kumamoto.jp":true,"kosa.kumamoto.jp":true,"kumamoto.kumamoto.jp":true,"mashiki.kumamoto.jp":true,"mifune.kumamoto.jp":true,"minamata.kumamoto.jp":true,"minamioguni.kumamoto.jp":true,"nagasu.kumamoto.jp":true,"nishihara.kumamoto.jp":true,"oguni.kumamoto.jp":true,"ozu.kumamoto.jp":true,"sumoto.kumamoto.jp":true,"takamori.kumamoto.jp":true,"uki.kumamoto.jp":true,"uto.kumamoto.jp":true,"yamaga.kumamoto.jp":true,"yamato.kumamoto.jp":true,"yatsushiro.kumamoto.jp":true,"ayabe.kyoto.jp":true,"fukuchiyama.kyoto.jp":true,"higashiyama.kyoto.jp":true,"ide.kyoto.jp":true,"ine.kyoto.jp":true,"joyo.kyoto.jp":true,"kameoka.kyoto.jp":true,"kamo.kyoto.jp":true,"kita.kyoto.jp":true,"kizu.kyoto.jp":true,"kumiyama.kyoto.jp":true,"kyotamba.kyoto.jp":true,"kyotanabe.kyoto.jp":true,"kyotango.kyoto.jp":true,"maizuru.kyoto.jp":true,"minami.kyoto.jp":true,"minamiyamashiro.kyoto.jp":true,"miyazu.kyoto.jp":true,"muko.kyoto.jp":true,"nagaokakyo.kyoto.jp":true,"nakagyo.kyoto.jp":true,"nantan.kyoto.jp":true,"oyamazaki.kyoto.jp":true,"sakyo.kyoto.jp":true,"seika.kyoto.jp":true,"tanabe.kyoto.jp":true,"uji.kyoto.jp":true,"ujitawara.kyoto.jp":true,"wazuka.kyoto.jp":true,"yamashina.kyoto.jp":true,"yawata.kyoto.jp":true,"asahi.mie.jp":true,"inabe.mie.jp":true,"ise.mie.jp":true,"kameyama.mie.jp":true,"kawagoe.mie.jp":true,"kiho.mie.jp":true,"kisosaki.mie.jp":true,"kiwa.mie.jp":true,"komono.mie.jp":true,"kumano.mie.jp":true,"kuwana.mie.jp":true,"matsusaka.mie.jp":true,"meiwa.mie.jp":true,"mihama.mie.jp":true,"minamiise.mie.jp":true,"misugi.mie.jp":true,"miyama.mie.jp":true,"nabari.mie.jp":true,"shima.mie.jp":true,"suzuka.mie.jp":true,"tado.mie.jp":true,"taiki.mie.jp":true,"taki.mie.jp":true,"tamaki.mie.jp":true,"toba.mie.jp":true,"tsu.mie.jp":true,"udono.mie.jp":true,"ureshino.mie.jp":true,"watarai.mie.jp":true,"yokkaichi.mie.jp":true,"furukawa.miyagi.jp":true,"higashimatsushima.miyagi.jp":true,"ishinomaki.miyagi.jp":true,"iwanuma.miyagi.jp":true,"kakuda.miyagi.jp":true,"kami.miyagi.jp":true,"kawasaki.miyagi.jp":true,"kesennuma.miyagi.jp":true,"marumori.miyagi.jp":true,"matsushima.miyagi.jp":true,"minamisanriku.miyagi.jp":true,"misato.miyagi.jp":true,"murata.miyagi.jp":true,"natori.miyagi.jp":true,"ogawara.miyagi.jp":true,"ohira.miyagi.jp":true,"onagawa.miyagi.jp":true,"osaki.miyagi.jp":true,"rifu.miyagi.jp":true,"semine.miyagi.jp":true,"shibata.miyagi.jp":true,"shichikashuku.miyagi.jp":true,"shikama.miyagi.jp":true,"shiogama.miyagi.jp":true,"shiroishi.miyagi.jp":true,"tagajo.miyagi.jp":true,"taiwa.miyagi.jp":true,"tome.miyagi.jp":true,"tomiya.miyagi.jp":true,"wakuya.miyagi.jp":true,"watari.miyagi.jp":true,"yamamoto.miyagi.jp":true,"zao.miyagi.jp":true,"aya.miyazaki.jp":true,"ebino.miyazaki.jp":true,"gokase.miyazaki.jp":true,"hyuga.miyazaki.jp":true,"kadogawa.miyazaki.jp":true,"kawaminami.miyazaki.jp":true,"kijo.miyazaki.jp":true,"kitagawa.miyazaki.jp":true,"kitakata.miyazaki.jp":true,"kitaura.miyazaki.jp":true,"kobayashi.miyazaki.jp":true,"kunitomi.miyazaki.jp":true,"kushima.miyazaki.jp":true,"mimata.miyazaki.jp":true,"miyakonojo.miyazaki.jp":true,"miyazaki.miyazaki.jp":true,"morotsuka.miyazaki.jp":true,"nichinan.miyazaki.jp":true,"nishimera.miyazaki.jp":true,"nobeoka.miyazaki.jp":true,"saito.miyazaki.jp":true,"shiiba.miyazaki.jp":true,"shintomi.miyazaki.jp":true,"takaharu.miyazaki.jp":true,"takanabe.miyazaki.jp":true,"takazaki.miyazaki.jp":true,"tsuno.miyazaki.jp":true,"achi.nagano.jp":true,"agematsu.nagano.jp":true,"anan.nagano.jp":true,"aoki.nagano.jp":true,"asahi.nagano.jp":true,"azumino.nagano.jp":true,"chikuhoku.nagano.jp":true,"chikuma.nagano.jp":true,"chino.nagano.jp":true,"fujimi.nagano.jp":true,"hakuba.nagano.jp":true,"hara.nagano.jp":true,"hiraya.nagano.jp":true,"iida.nagano.jp":true,"iijima.nagano.jp":true,"iiyama.nagano.jp":true,"iizuna.nagano.jp":true,"ikeda.nagano.jp":true,"ikusaka.nagano.jp":true,"ina.nagano.jp":true,"karuizawa.nagano.jp":true,"kawakami.nagano.jp":true,"kiso.nagano.jp":true,"kisofukushima.nagano.jp":true,"kitaaiki.nagano.jp":true,"komagane.nagano.jp":true,"komoro.nagano.jp":true,"matsukawa.nagano.jp":true,"matsumoto.nagano.jp":true,"miasa.nagano.jp":true,"minamiaiki.nagano.jp":true,"minamimaki.nagano.jp":true,"minamiminowa.nagano.jp":true,"minowa.nagano.jp":true,"miyada.nagano.jp":true,"miyota.nagano.jp":true,"mochizuki.nagano.jp":true,"nagano.nagano.jp":true,"nagawa.nagano.jp":true,"nagiso.nagano.jp":true,"nakagawa.nagano.jp":true,"nakano.nagano.jp":true,"nozawaonsen.nagano.jp":true,"obuse.nagano.jp":true,"ogawa.nagano.jp":true,"okaya.nagano.jp":true,"omachi.nagano.jp":true,"omi.nagano.jp":true,"ookuwa.nagano.jp":true,"ooshika.nagano.jp":true,"otaki.nagano.jp":true,"otari.nagano.jp":true,"sakae.nagano.jp":true,"sakaki.nagano.jp":true,"saku.nagano.jp":true,"sakuho.nagano.jp":true,"shimosuwa.nagano.jp":true,"shinanomachi.nagano.jp":true,"shiojiri.nagano.jp":true,"suwa.nagano.jp":true,"suzaka.nagano.jp":true,"takagi.nagano.jp":true,"takamori.nagano.jp":true,"takayama.nagano.jp":true,"tateshina.nagano.jp":true,"tatsuno.nagano.jp":true,"togakushi.nagano.jp":true,"togura.nagano.jp":true,"tomi.nagano.jp":true,"ueda.nagano.jp":true,"wada.nagano.jp":true,"yamagata.nagano.jp":true,"yamanouchi.nagano.jp":true,"yasaka.nagano.jp":true,"yasuoka.nagano.jp":true,"chijiwa.nagasaki.jp":true,"futsu.nagasaki.jp":true,"goto.nagasaki.jp":true,"hasami.nagasaki.jp":true,"hirado.nagasaki.jp":true,"iki.nagasaki.jp":true,"isahaya.nagasaki.jp":true,"kawatana.nagasaki.jp":true,"kuchinotsu.nagasaki.jp":true,"matsuura.nagasaki.jp":true,"nagasaki.nagasaki.jp":true,"obama.nagasaki.jp":true,"omura.nagasaki.jp":true,"oseto.nagasaki.jp":true,"saikai.nagasaki.jp":true,"sasebo.nagasaki.jp":true,"seihi.nagasaki.jp":true,"shimabara.nagasaki.jp":true,"shinkamigoto.nagasaki.jp":true,"togitsu.nagasaki.jp":true,"tsushima.nagasaki.jp":true,"unzen.nagasaki.jp":true,"ando.nara.jp":true,"gose.nara.jp":true,"heguri.nara.jp":true,"higashiyoshino.nara.jp":true,"ikaruga.nara.jp":true,"ikoma.nara.jp":true,"kamikitayama.nara.jp":true,"kanmaki.nara.jp":true,"kashiba.nara.jp":true,"kashihara.nara.jp":true,"katsuragi.nara.jp":true,"kawai.nara.jp":true,"kawakami.nara.jp":true,"kawanishi.nara.jp":true,"koryo.nara.jp":true,"kurotaki.nara.jp":true,"mitsue.nara.jp":true,"miyake.nara.jp":true,"nara.nara.jp":true,"nosegawa.nara.jp":true,"oji.nara.jp":true,"ouda.nara.jp":true,"oyodo.nara.jp":true,"sakurai.nara.jp":true,"sango.nara.jp":true,"shimoichi.nara.jp":true,"shimokitayama.nara.jp":true,"shinjo.nara.jp":true,"soni.nara.jp":true,"takatori.nara.jp":true,"tawaramoto.nara.jp":true,"tenkawa.nara.jp":true,"tenri.nara.jp":true,"uda.nara.jp":true,"yamatokoriyama.nara.jp":true,"yamatotakada.nara.jp":true,"yamazoe.nara.jp":true,"yoshino.nara.jp":true,"aga.niigata.jp":true,"agano.niigata.jp":true,"gosen.niigata.jp":true,"itoigawa.niigata.jp":true,"izumozaki.niigata.jp":true,"joetsu.niigata.jp":true,"kamo.niigata.jp":true,"kariwa.niigata.jp":true,"kashiwazaki.niigata.jp":true,"minamiuonuma.niigata.jp":true,"mitsuke.niigata.jp":true,"muika.niigata.jp":true,"murakami.niigata.jp":true,"myoko.niigata.jp":true,"nagaoka.niigata.jp":true,"niigata.niigata.jp":true,"ojiya.niigata.jp":true,"omi.niigata.jp":true,"sado.niigata.jp":true,"sanjo.niigata.jp":true,"seiro.niigata.jp":true,"seirou.niigata.jp":true,"sekikawa.niigata.jp":true,"shibata.niigata.jp":true,"tagami.niigata.jp":true,"tainai.niigata.jp":true,"tochio.niigata.jp":true,"tokamachi.niigata.jp":true,"tsubame.niigata.jp":true,"tsunan.niigata.jp":true,"uonuma.niigata.jp":true,"yahiko.niigata.jp":true,"yoita.niigata.jp":true,"yuzawa.niigata.jp":true,"beppu.oita.jp":true,"bungoono.oita.jp":true,"bungotakada.oita.jp":true,"hasama.oita.jp":true,"hiji.oita.jp":true,"himeshima.oita.jp":true,"hita.oita.jp":true,"kamitsue.oita.jp":true,"kokonoe.oita.jp":true,"kuju.oita.jp":true,"kunisaki.oita.jp":true,"kusu.oita.jp":true,"oita.oita.jp":true,"saiki.oita.jp":true,"taketa.oita.jp":true,"tsukumi.oita.jp":true,"usa.oita.jp":true,"usuki.oita.jp":true,"yufu.oita.jp":true,"akaiwa.okayama.jp":true,"asakuchi.okayama.jp":true,"bizen.okayama.jp":true,"hayashima.okayama.jp":true,"ibara.okayama.jp":true,"kagamino.okayama.jp":true,"kasaoka.okayama.jp":true,"kibichuo.okayama.jp":true,"kumenan.okayama.jp":true,"kurashiki.okayama.jp":true,"maniwa.okayama.jp":true,"misaki.okayama.jp":true,"nagi.okayama.jp":true,"niimi.okayama.jp":true,"nishiawakura.okayama.jp":true,"okayama.okayama.jp":true,"satosho.okayama.jp":true,"setouchi.okayama.jp":true,"shinjo.okayama.jp":true,"shoo.okayama.jp":true,"soja.okayama.jp":true,"takahashi.okayama.jp":true,"tamano.okayama.jp":true,"tsuyama.okayama.jp":true,"wake.okayama.jp":true,"yakage.okayama.jp":true,"aguni.okinawa.jp":true,"ginowan.okinawa.jp":true,"ginoza.okinawa.jp":true,"gushikami.okinawa.jp":true,"haebaru.okinawa.jp":true,"higashi.okinawa.jp":true,"hirara.okinawa.jp":true,"iheya.okinawa.jp":true,"ishigaki.okinawa.jp":true,"ishikawa.okinawa.jp":true,"itoman.okinawa.jp":true,"izena.okinawa.jp":true,"kadena.okinawa.jp":true,"kin.okinawa.jp":true,"kitadaito.okinawa.jp":true,"kitanakagusuku.okinawa.jp":true,"kumejima.okinawa.jp":true,"kunigami.okinawa.jp":true,"minamidaito.okinawa.jp":true,"motobu.okinawa.jp":true,"nago.okinawa.jp":true,"naha.okinawa.jp":true,"nakagusuku.okinawa.jp":true,"nakijin.okinawa.jp":true,"nanjo.okinawa.jp":true,"nishihara.okinawa.jp":true,"ogimi.okinawa.jp":true,"okinawa.okinawa.jp":true,"onna.okinawa.jp":true,"shimoji.okinawa.jp":true,"taketomi.okinawa.jp":true,"tarama.okinawa.jp":true,"tokashiki.okinawa.jp":true,"tomigusuku.okinawa.jp":true,"tonaki.okinawa.jp":true,"urasoe.okinawa.jp":true,"uruma.okinawa.jp":true,"yaese.okinawa.jp":true,"yomitan.okinawa.jp":true,"yonabaru.okinawa.jp":true,"yonaguni.okinawa.jp":true,"zamami.okinawa.jp":true,"abeno.osaka.jp":true,"chihayaakasaka.osaka.jp":true,"chuo.osaka.jp":true,"daito.osaka.jp":true,"fujiidera.osaka.jp":true,"habikino.osaka.jp":true,"hannan.osaka.jp":true,"higashiosaka.osaka.jp":true,"higashisumiyoshi.osaka.jp":true,"higashiyodogawa.osaka.jp":true,"hirakata.osaka.jp":true,"ibaraki.osaka.jp":true,"ikeda.osaka.jp":true,"izumi.osaka.jp":true,"izumiotsu.osaka.jp":true,"izumisano.osaka.jp":true,"kadoma.osaka.jp":true,"kaizuka.osaka.jp":true,"kanan.osaka.jp":true,"kashiwara.osaka.jp":true,"katano.osaka.jp":true,"kawachinagano.osaka.jp":true,"kishiwada.osaka.jp":true,"kita.osaka.jp":true,"kumatori.osaka.jp":true,"matsubara.osaka.jp":true,"minato.osaka.jp":true,"minoh.osaka.jp":true,"misaki.osaka.jp":true,"moriguchi.osaka.jp":true,"neyagawa.osaka.jp":true,"nishi.osaka.jp":true,"nose.osaka.jp":true,"osakasayama.osaka.jp":true,"sakai.osaka.jp":true,"sayama.osaka.jp":true,"sennan.osaka.jp":true,"settsu.osaka.jp":true,"shijonawate.osaka.jp":true,"shimamoto.osaka.jp":true,"suita.osaka.jp":true,"tadaoka.osaka.jp":true,"taishi.osaka.jp":true,"tajiri.osaka.jp":true,"takaishi.osaka.jp":true,"takatsuki.osaka.jp":true,"tondabayashi.osaka.jp":true,"toyonaka.osaka.jp":true,"toyono.osaka.jp":true,"yao.osaka.jp":true,"ariake.saga.jp":true,"arita.saga.jp":true,"fukudomi.saga.jp":true,"genkai.saga.jp":true,"hamatama.saga.jp":true,"hizen.saga.jp":true,"imari.saga.jp":true,"kamimine.saga.jp":true,"kanzaki.saga.jp":true,"karatsu.saga.jp":true,"kashima.saga.jp":true,"kitagata.saga.jp":true,"kitahata.saga.jp":true,"kiyama.saga.jp":true,"kouhoku.saga.jp":true,"kyuragi.saga.jp":true,"nishiarita.saga.jp":true,"ogi.saga.jp":true,"omachi.saga.jp":true,"ouchi.saga.jp":true,"saga.saga.jp":true,"shiroishi.saga.jp":true,"taku.saga.jp":true,"tara.saga.jp":true,"tosu.saga.jp":true,"yoshinogari.saga.jp":true,"arakawa.saitama.jp":true,"asaka.saitama.jp":true,"chichibu.saitama.jp":true,"fujimi.saitama.jp":true,"fujimino.saitama.jp":true,"fukaya.saitama.jp":true,"hanno.saitama.jp":true,"hanyu.saitama.jp":true,"hasuda.saitama.jp":true,"hatogaya.saitama.jp":true,"hatoyama.saitama.jp":true,"hidaka.saitama.jp":true,"higashichichibu.saitama.jp":true,"higashimatsuyama.saitama.jp":true,"honjo.saitama.jp":true,"ina.saitama.jp":true,"iruma.saitama.jp":true,"iwatsuki.saitama.jp":true,"kamiizumi.saitama.jp":true,"kamikawa.saitama.jp":true,"kamisato.saitama.jp":true,"kasukabe.saitama.jp":true,"kawagoe.saitama.jp":true,"kawaguchi.saitama.jp":true,"kawajima.saitama.jp":true,"kazo.saitama.jp":true,"kitamoto.saitama.jp":true,"koshigaya.saitama.jp":true,"kounosu.saitama.jp":true,"kuki.saitama.jp":true,"kumagaya.saitama.jp":true,"matsubushi.saitama.jp":true,"minano.saitama.jp":true,"misato.saitama.jp":true,"miyashiro.saitama.jp":true,"miyoshi.saitama.jp":true,"moroyama.saitama.jp":true,"nagatoro.saitama.jp":true,"namegawa.saitama.jp":true,"niiza.saitama.jp":true,"ogano.saitama.jp":true,"ogawa.saitama.jp":true,"ogose.saitama.jp":true,"okegawa.saitama.jp":true,"omiya.saitama.jp":true,"otaki.saitama.jp":true,"ranzan.saitama.jp":true,"ryokami.saitama.jp":true,"saitama.saitama.jp":true,"sakado.saitama.jp":true,"satte.saitama.jp":true,"sayama.saitama.jp":true,"shiki.saitama.jp":true,"shiraoka.saitama.jp":true,"soka.saitama.jp":true,"sugito.saitama.jp":true,"toda.saitama.jp":true,"tokigawa.saitama.jp":true,"tokorozawa.saitama.jp":true,"tsurugashima.saitama.jp":true,"urawa.saitama.jp":true,"warabi.saitama.jp":true,"yashio.saitama.jp":true,"yokoze.saitama.jp":true,"yono.saitama.jp":true,"yorii.saitama.jp":true,"yoshida.saitama.jp":true,"yoshikawa.saitama.jp":true,"yoshimi.saitama.jp":true,"aisho.shiga.jp":true,"gamo.shiga.jp":true,"higashiomi.shiga.jp":true,"hikone.shiga.jp":true,"koka.shiga.jp":true,"konan.shiga.jp":true,"kosei.shiga.jp":true,"koto.shiga.jp":true,"kusatsu.shiga.jp":true,"maibara.shiga.jp":true,"moriyama.shiga.jp":true,"nagahama.shiga.jp":true,"nishiazai.shiga.jp":true,"notogawa.shiga.jp":true,"omihachiman.shiga.jp":true,"otsu.shiga.jp":true,"ritto.shiga.jp":true,"ryuoh.shiga.jp":true,"takashima.shiga.jp":true,"takatsuki.shiga.jp":true,"torahime.shiga.jp":true,"toyosato.shiga.jp":true,"yasu.shiga.jp":true,"akagi.shimane.jp":true,"ama.shimane.jp":true,"gotsu.shimane.jp":true,"hamada.shimane.jp":true,"higashiizumo.shimane.jp":true,"hikawa.shimane.jp":true,"hikimi.shimane.jp":true,"izumo.shimane.jp":true,"kakinoki.shimane.jp":true,"masuda.shimane.jp":true,"matsue.shimane.jp":true,"misato.shimane.jp":true,"nishinoshima.shimane.jp":true,"ohda.shimane.jp":true,"okinoshima.shimane.jp":true,"okuizumo.shimane.jp":true,"shimane.shimane.jp":true,"tamayu.shimane.jp":true,"tsuwano.shimane.jp":true,"unnan.shimane.jp":true,"yakumo.shimane.jp":true,"yasugi.shimane.jp":true,"yatsuka.shimane.jp":true,"arai.shizuoka.jp":true,"atami.shizuoka.jp":true,"fuji.shizuoka.jp":true,"fujieda.shizuoka.jp":true,"fujikawa.shizuoka.jp":true,"fujinomiya.shizuoka.jp":true,"fukuroi.shizuoka.jp":true,"gotemba.shizuoka.jp":true,"haibara.shizuoka.jp":true,"hamamatsu.shizuoka.jp":true,"higashiizu.shizuoka.jp":true,"ito.shizuoka.jp":true,"iwata.shizuoka.jp":true,"izu.shizuoka.jp":true,"izunokuni.shizuoka.jp":true,"kakegawa.shizuoka.jp":true,"kannami.shizuoka.jp":true,"kawanehon.shizuoka.jp":true,"kawazu.shizuoka.jp":true,"kikugawa.shizuoka.jp":true,"kosai.shizuoka.jp":true,"makinohara.shizuoka.jp":true,"matsuzaki.shizuoka.jp":true,"minamiizu.shizuoka.jp":true,"mishima.shizuoka.jp":true,"morimachi.shizuoka.jp":true,"nishiizu.shizuoka.jp":true,"numazu.shizuoka.jp":true,"omaezaki.shizuoka.jp":true,"shimada.shizuoka.jp":true,"shimizu.shizuoka.jp":true,"shimoda.shizuoka.jp":true,"shizuoka.shizuoka.jp":true,"susono.shizuoka.jp":true,"yaizu.shizuoka.jp":true,"yoshida.shizuoka.jp":true,"ashikaga.tochigi.jp":true,"bato.tochigi.jp":true,"haga.tochigi.jp":true,"ichikai.tochigi.jp":true,"iwafune.tochigi.jp":true,"kaminokawa.tochigi.jp":true,"kanuma.tochigi.jp":true,"karasuyama.tochigi.jp":true,"kuroiso.tochigi.jp":true,"mashiko.tochigi.jp":true,"mibu.tochigi.jp":true,"moka.tochigi.jp":true,"motegi.tochigi.jp":true,"nasu.tochigi.jp":true,"nasushiobara.tochigi.jp":true,"nikko.tochigi.jp":true,"nishikata.tochigi.jp":true,"nogi.tochigi.jp":true,"ohira.tochigi.jp":true,"ohtawara.tochigi.jp":true,"oyama.tochigi.jp":true,"sakura.tochigi.jp":true,"sano.tochigi.jp":true,"shimotsuke.tochigi.jp":true,"shioya.tochigi.jp":true,"takanezawa.tochigi.jp":true,"tochigi.tochigi.jp":true,"tsuga.tochigi.jp":true,"ujiie.tochigi.jp":true,"utsunomiya.tochigi.jp":true,"yaita.tochigi.jp":true,"aizumi.tokushima.jp":true,"anan.tokushima.jp":true,"ichiba.tokushima.jp":true,"itano.tokushima.jp":true,"kainan.tokushima.jp":true,"komatsushima.tokushima.jp":true,"matsushige.tokushima.jp":true,"mima.tokushima.jp":true,"minami.tokushima.jp":true,"miyoshi.tokushima.jp":true,"mugi.tokushima.jp":true,"nakagawa.tokushima.jp":true,"naruto.tokushima.jp":true,"sanagochi.tokushima.jp":true,"shishikui.tokushima.jp":true,"tokushima.tokushima.jp":true,"wajiki.tokushima.jp":true,"adachi.tokyo.jp":true,"akiruno.tokyo.jp":true,"akishima.tokyo.jp":true,"aogashima.tokyo.jp":true,"arakawa.tokyo.jp":true,"bunkyo.tokyo.jp":true,"chiyoda.tokyo.jp":true,"chofu.tokyo.jp":true,"chuo.tokyo.jp":true,"edogawa.tokyo.jp":true,"fuchu.tokyo.jp":true,"fussa.tokyo.jp":true,"hachijo.tokyo.jp":true,"hachioji.tokyo.jp":true,"hamura.tokyo.jp":true,"higashikurume.tokyo.jp":true,"higashimurayama.tokyo.jp":true,"higashiyamato.tokyo.jp":true,"hino.tokyo.jp":true,"hinode.tokyo.jp":true,"hinohara.tokyo.jp":true,"inagi.tokyo.jp":true,"itabashi.tokyo.jp":true,"katsushika.tokyo.jp":true,"kita.tokyo.jp":true,"kiyose.tokyo.jp":true,"kodaira.tokyo.jp":true,"koganei.tokyo.jp":true,"kokubunji.tokyo.jp":true,"komae.tokyo.jp":true,"koto.tokyo.jp":true,"kouzushima.tokyo.jp":true,"kunitachi.tokyo.jp":true,"machida.tokyo.jp":true,"meguro.tokyo.jp":true,"minato.tokyo.jp":true,"mitaka.tokyo.jp":true,"mizuho.tokyo.jp":true,"musashimurayama.tokyo.jp":true,"musashino.tokyo.jp":true,"nakano.tokyo.jp":true,"nerima.tokyo.jp":true,"ogasawara.tokyo.jp":true,"okutama.tokyo.jp":true,"ome.tokyo.jp":true,"oshima.tokyo.jp":true,"ota.tokyo.jp":true,"setagaya.tokyo.jp":true,"shibuya.tokyo.jp":true,"shinagawa.tokyo.jp":true,"shinjuku.tokyo.jp":true,"suginami.tokyo.jp":true,"sumida.tokyo.jp":true,"tachikawa.tokyo.jp":true,"taito.tokyo.jp":true,"tama.tokyo.jp":true,"toshima.tokyo.jp":true,"chizu.tottori.jp":true,"hino.tottori.jp":true,"kawahara.tottori.jp":true,"koge.tottori.jp":true,"kotoura.tottori.jp":true,"misasa.tottori.jp":true,"nanbu.tottori.jp":true,"nichinan.tottori.jp":true,"sakaiminato.tottori.jp":true,"tottori.tottori.jp":true,"wakasa.tottori.jp":true,"yazu.tottori.jp":true,"yonago.tottori.jp":true,"asahi.toyama.jp":true,"fuchu.toyama.jp":true,"fukumitsu.toyama.jp":true,"funahashi.toyama.jp":true,"himi.toyama.jp":true,"imizu.toyama.jp":true,"inami.toyama.jp":true,"johana.toyama.jp":true,"kamiichi.toyama.jp":true,"kurobe.toyama.jp":true,"nakaniikawa.toyama.jp":true,"namerikawa.toyama.jp":true,"nanto.toyama.jp":true,"nyuzen.toyama.jp":true,"oyabe.toyama.jp":true,"taira.toyama.jp":true,"takaoka.toyama.jp":true,"tateyama.toyama.jp":true,"toga.toyama.jp":true,"tonami.toyama.jp":true,"toyama.toyama.jp":true,"unazuki.toyama.jp":true,"uozu.toyama.jp":true,"yamada.toyama.jp":true,"arida.wakayama.jp":true,"aridagawa.wakayama.jp":true,"gobo.wakayama.jp":true,"hashimoto.wakayama.jp":true,"hidaka.wakayama.jp":true,"hirogawa.wakayama.jp":true,"inami.wakayama.jp":true,"iwade.wakayama.jp":true,"kainan.wakayama.jp":true,"kamitonda.wakayama.jp":true,"katsuragi.wakayama.jp":true,"kimino.wakayama.jp":true,"kinokawa.wakayama.jp":true,"kitayama.wakayama.jp":true,"koya.wakayama.jp":true,"koza.wakayama.jp":true,"kozagawa.wakayama.jp":true,"kudoyama.wakayama.jp":true,"kushimoto.wakayama.jp":true,"mihama.wakayama.jp":true,"misato.wakayama.jp":true,"nachikatsuura.wakayama.jp":true,"shingu.wakayama.jp":true,"shirahama.wakayama.jp":true,"taiji.wakayama.jp":true,"tanabe.wakayama.jp":true,"wakayama.wakayama.jp":true,"yuasa.wakayama.jp":true,"yura.wakayama.jp":true,"asahi.yamagata.jp":true,"funagata.yamagata.jp":true,"higashine.yamagata.jp":true,"iide.yamagata.jp":true,"kahoku.yamagata.jp":true,"kaminoyama.yamagata.jp":true,"kaneyama.yamagata.jp":true,"kawanishi.yamagata.jp":true,"mamurogawa.yamagata.jp":true,"mikawa.yamagata.jp":true,"murayama.yamagata.jp":true,"nagai.yamagata.jp":true,"nakayama.yamagata.jp":true,"nanyo.yamagata.jp":true,"nishikawa.yamagata.jp":true,"obanazawa.yamagata.jp":true,"oe.yamagata.jp":true,"oguni.yamagata.jp":true,"ohkura.yamagata.jp":true,"oishida.yamagata.jp":true,"sagae.yamagata.jp":true,"sakata.yamagata.jp":true,"sakegawa.yamagata.jp":true,"shinjo.yamagata.jp":true,"shirataka.yamagata.jp":true,"shonai.yamagata.jp":true,"takahata.yamagata.jp":true,"tendo.yamagata.jp":true,"tozawa.yamagata.jp":true,"tsuruoka.yamagata.jp":true,"yamagata.yamagata.jp":true,"yamanobe.yamagata.jp":true,"yonezawa.yamagata.jp":true,"yuza.yamagata.jp":true,"abu.yamaguchi.jp":true,"hagi.yamaguchi.jp":true,"hikari.yamaguchi.jp":true,"hofu.yamaguchi.jp":true,"iwakuni.yamaguchi.jp":true,"kudamatsu.yamaguchi.jp":true,"mitou.yamaguchi.jp":true,"nagato.yamaguchi.jp":true,"oshima.yamaguchi.jp":true,"shimonoseki.yamaguchi.jp":true,"shunan.yamaguchi.jp":true,"tabuse.yamaguchi.jp":true,"tokuyama.yamaguchi.jp":true,"toyota.yamaguchi.jp":true,"ube.yamaguchi.jp":true,"yuu.yamaguchi.jp":true,"chuo.yamanashi.jp":true,"doshi.yamanashi.jp":true,"fuefuki.yamanashi.jp":true,"fujikawa.yamanashi.jp":true,"fujikawaguchiko.yamanashi.jp":true,"fujiyoshida.yamanashi.jp":true,"hayakawa.yamanashi.jp":true,"hokuto.yamanashi.jp":true,"ichikawamisato.yamanashi.jp":true,"kai.yamanashi.jp":true,"kofu.yamanashi.jp":true,"koshu.yamanashi.jp":true,"kosuge.yamanashi.jp":true,"minami-alps.yamanashi.jp":true,"minobu.yamanashi.jp":true,"nakamichi.yamanashi.jp":true,"nanbu.yamanashi.jp":true,"narusawa.yamanashi.jp":true,"nirasaki.yamanashi.jp":true,"nishikatsura.yamanashi.jp":true,"oshino.yamanashi.jp":true,"otsuki.yamanashi.jp":true,"showa.yamanashi.jp":true,"tabayama.yamanashi.jp":true,"tsuru.yamanashi.jp":true,"uenohara.yamanashi.jp":true,"yamanakako.yamanashi.jp":true,"yamanashi.yamanashi.jp":true,"*.ke":true,"kg":true,"org.kg":true,"net.kg":true,"com.kg":true,"edu.kg":true,"gov.kg":true,"mil.kg":true,"*.kh":true,"ki":true,"edu.ki":true,"biz.ki":true,"net.ki":true,"org.ki":true,"gov.ki":true,"info.ki":true,"com.ki":true,"km":true,"org.km":true,"nom.km":true,"gov.km":true,"prd.km":true,"tm.km":true,"edu.km":true,"mil.km":true,"ass.km":true,"com.km":true,"coop.km":true,"asso.km":true,"presse.km":true,"medecin.km":true,"notaires.km":true,"pharmaciens.km":true,"veterinaire.km":true,"gouv.km":true,"kn":true,"net.kn":true,"org.kn":true,"edu.kn":true,"gov.kn":true,"kp":true,"com.kp":true,"edu.kp":true,"gov.kp":true,"org.kp":true,"rep.kp":true,"tra.kp":true,"kr":true,"ac.kr":true,"co.kr":true,"es.kr":true,"go.kr":true,"hs.kr":true,"kg.kr":true,"mil.kr":true,"ms.kr":true,"ne.kr":true,"or.kr":true,"pe.kr":true,"re.kr":true,"sc.kr":true,"busan.kr":true,"chungbuk.kr":true,"chungnam.kr":true,"daegu.kr":true,"daejeon.kr":true,"gangwon.kr":true,"gwangju.kr":true,"gyeongbuk.kr":true,"gyeonggi.kr":true,"gyeongnam.kr":true,"incheon.kr":true,"jeju.kr":true,"jeonbuk.kr":true,"jeonnam.kr":true,"seoul.kr":true,"ulsan.kr":true,"*.kw":true,"ky":true,"edu.ky":true,"gov.ky":true,"com.ky":true,"org.ky":true,"net.ky":true,"kz":true,"org.kz":true,"edu.kz":true,"net.kz":true,"gov.kz":true,"mil.kz":true,"com.kz":true,"la":true,"int.la":true,"net.la":true,"info.la":true,"edu.la":true,"gov.la":true,"per.la":true,"com.la":true,"org.la":true,"lb":true,"com.lb":true,"edu.lb":true,"gov.lb":true,"net.lb":true,"org.lb":true,"lc":true,"com.lc":true,"net.lc":true,"co.lc":true,"org.lc":true,"edu.lc":true,"gov.lc":true,"li":true,"lk":true,"gov.lk":true,"sch.lk":true,"net.lk":true,"int.lk":true,"com.lk":true,"org.lk":true,"edu.lk":true,"ngo.lk":true,"soc.lk":true,"web.lk":true,"ltd.lk":true,"assn.lk":true,"grp.lk":true,"hotel.lk":true,"ac.lk":true,"lr":true,"com.lr":true,"edu.lr":true,"gov.lr":true,"org.lr":true,"net.lr":true,"ls":true,"co.ls":true,"org.ls":true,"lt":true,"gov.lt":true,"lu":true,"lv":true,"com.lv":true,"edu.lv":true,"gov.lv":true,"org.lv":true,"mil.lv":true,"id.lv":true,"net.lv":true,"asn.lv":true,"conf.lv":true,"ly":true,"com.ly":true,"net.ly":true,"gov.ly":true,"plc.ly":true,"edu.ly":true,"sch.ly":true,"med.ly":true,"org.ly":true,"id.ly":true,"ma":true,"co.ma":true,"net.ma":true,"gov.ma":true,"org.ma":true,"ac.ma":true,"press.ma":true,"mc":true,"tm.mc":true,"asso.mc":true,"md":true,"me":true,"co.me":true,"net.me":true,"org.me":true,"edu.me":true,"ac.me":true,"gov.me":true,"its.me":true,"priv.me":true,"mg":true,"org.mg":true,"nom.mg":true,"gov.mg":true,"prd.mg":true,"tm.mg":true,"edu.mg":true,"mil.mg":true,"com.mg":true,"co.mg":true,"mh":true,"mil":true,"mk":true,"com.mk":true,"org.mk":true,"net.mk":true,"edu.mk":true,"gov.mk":true,"inf.mk":true,"name.mk":true,"ml":true,"com.ml":true,"edu.ml":true,"gouv.ml":true,"gov.ml":true,"net.ml":true,"org.ml":true,"presse.ml":true,"*.mm":true,"mn":true,"gov.mn":true,"edu.mn":true,"org.mn":true,"mo":true,"com.mo":true,"net.mo":true,"org.mo":true,"edu.mo":true,"gov.mo":true,"mobi":true,"mp":true,"mq":true,"mr":true,"gov.mr":true,"ms":true,"com.ms":true,"edu.ms":true,"gov.ms":true,"net.ms":true,"org.ms":true,"mt":true,"com.mt":true,"edu.mt":true,"net.mt":true,"org.mt":true,"mu":true,"com.mu":true,"net.mu":true,"org.mu":true,"gov.mu":true,"ac.mu":true,"co.mu":true,"or.mu":true,"museum":true,"academy.museum":true,"agriculture.museum":true,"air.museum":true,"airguard.museum":true,"alabama.museum":true,"alaska.museum":true,"amber.museum":true,"ambulance.museum":true,"american.museum":true,"americana.museum":true,"americanantiques.museum":true,"americanart.museum":true,"amsterdam.museum":true,"and.museum":true,"annefrank.museum":true,"anthro.museum":true,"anthropology.museum":true,"antiques.museum":true,"aquarium.museum":true,"arboretum.museum":true,"archaeological.museum":true,"archaeology.museum":true,"architecture.museum":true,"art.museum":true,"artanddesign.museum":true,"artcenter.museum":true,"artdeco.museum":true,"arteducation.museum":true,"artgallery.museum":true,"arts.museum":true,"artsandcrafts.museum":true,"asmatart.museum":true,"assassination.museum":true,"assisi.museum":true,"association.museum":true,"astronomy.museum":true,"atlanta.museum":true,"austin.museum":true,"australia.museum":true,"automotive.museum":true,"aviation.museum":true,"axis.museum":true,"badajoz.museum":true,"baghdad.museum":true,"bahn.museum":true,"bale.museum":true,"baltimore.museum":true,"barcelona.museum":true,"baseball.museum":true,"basel.museum":true,"baths.museum":true,"bauern.museum":true,"beauxarts.museum":true,"beeldengeluid.museum":true,"bellevue.museum":true,"bergbau.museum":true,"berkeley.museum":true,"berlin.museum":true,"bern.museum":true,"bible.museum":true,"bilbao.museum":true,"bill.museum":true,"birdart.museum":true,"birthplace.museum":true,"bonn.museum":true,"boston.museum":true,"botanical.museum":true,"botanicalgarden.museum":true,"botanicgarden.museum":true,"botany.museum":true,"brandywinevalley.museum":true,"brasil.museum":true,"bristol.museum":true,"british.museum":true,"britishcolumbia.museum":true,"broadcast.museum":true,"brunel.museum":true,"brussel.museum":true,"brussels.museum":true,"bruxelles.museum":true,"building.museum":true,"burghof.museum":true,"bus.museum":true,"bushey.museum":true,"cadaques.museum":true,"california.museum":true,"cambridge.museum":true,"can.museum":true,"canada.museum":true,"capebreton.museum":true,"carrier.museum":true,"cartoonart.museum":true,"casadelamoneda.museum":true,"castle.museum":true,"castres.museum":true,"celtic.museum":true,"center.museum":true,"chattanooga.museum":true,"cheltenham.museum":true,"chesapeakebay.museum":true,"chicago.museum":true,"children.museum":true,"childrens.museum":true,"childrensgarden.museum":true,"chiropractic.museum":true,"chocolate.museum":true,"christiansburg.museum":true,"cincinnati.museum":true,"cinema.museum":true,"circus.museum":true,"civilisation.museum":true,"civilization.museum":true,"civilwar.museum":true,"clinton.museum":true,"clock.museum":true,"coal.museum":true,"coastaldefence.museum":true,"cody.museum":true,"coldwar.museum":true,"collection.museum":true,"colonialwilliamsburg.museum":true,"coloradoplateau.museum":true,"columbia.museum":true,"columbus.museum":true,"communication.museum":true,"communications.museum":true,"community.museum":true,"computer.museum":true,"computerhistory.museum":true,"xn--comunicaes-v6a2o.museum":true,"contemporary.museum":true,"contemporaryart.museum":true,"convent.museum":true,"copenhagen.museum":true,"corporation.museum":true,"xn--correios-e-telecomunicaes-ghc29a.museum":true,"corvette.museum":true,"costume.museum":true,"countryestate.museum":true,"county.museum":true,"crafts.museum":true,"cranbrook.museum":true,"creation.museum":true,"cultural.museum":true,"culturalcenter.museum":true,"culture.museum":true,"cyber.museum":true,"cymru.museum":true,"dali.museum":true,"dallas.museum":true,"database.museum":true,"ddr.museum":true,"decorativearts.museum":true,"delaware.museum":true,"delmenhorst.museum":true,"denmark.museum":true,"depot.museum":true,"design.museum":true,"detroit.museum":true,"dinosaur.museum":true,"discovery.museum":true,"dolls.museum":true,"donostia.museum":true,"durham.museum":true,"eastafrica.museum":true,"eastcoast.museum":true,"education.museum":true,"educational.museum":true,"egyptian.museum":true,"eisenbahn.museum":true,"elburg.museum":true,"elvendrell.museum":true,"embroidery.museum":true,"encyclopedic.museum":true,"england.museum":true,"entomology.museum":true,"environment.museum":true,"environmentalconservation.museum":true,"epilepsy.museum":true,"essex.museum":true,"estate.museum":true,"ethnology.museum":true,"exeter.museum":true,"exhibition.museum":true,"family.museum":true,"farm.museum":true,"farmequipment.museum":true,"farmers.museum":true,"farmstead.museum":true,"field.museum":true,"figueres.museum":true,"filatelia.museum":true,"film.museum":true,"fineart.museum":true,"finearts.museum":true,"finland.museum":true,"flanders.museum":true,"florida.museum":true,"force.museum":true,"fortmissoula.museum":true,"fortworth.museum":true,"foundation.museum":true,"francaise.museum":true,"frankfurt.museum":true,"franziskaner.museum":true,"freemasonry.museum":true,"freiburg.museum":true,"fribourg.museum":true,"frog.museum":true,"fundacio.museum":true,"furniture.museum":true,"gallery.museum":true,"garden.museum":true,"gateway.museum":true,"geelvinck.museum":true,"gemological.museum":true,"geology.museum":true,"georgia.museum":true,"giessen.museum":true,"glas.museum":true,"glass.museum":true,"gorge.museum":true,"grandrapids.museum":true,"graz.museum":true,"guernsey.museum":true,"halloffame.museum":true,"hamburg.museum":true,"handson.museum":true,"harvestcelebration.museum":true,"hawaii.museum":true,"health.museum":true,"heimatunduhren.museum":true,"hellas.museum":true,"helsinki.museum":true,"hembygdsforbund.museum":true,"heritage.museum":true,"histoire.museum":true,"historical.museum":true,"historicalsociety.museum":true,"historichouses.museum":true,"historisch.museum":true,"historisches.museum":true,"history.museum":true,"historyofscience.museum":true,"horology.museum":true,"house.museum":true,"humanities.museum":true,"illustration.museum":true,"imageandsound.museum":true,"indian.museum":true,"indiana.museum":true,"indianapolis.museum":true,"indianmarket.museum":true,"intelligence.museum":true,"interactive.museum":true,"iraq.museum":true,"iron.museum":true,"isleofman.museum":true,"jamison.museum":true,"jefferson.museum":true,"jerusalem.museum":true,"jewelry.museum":true,"jewish.museum":true,"jewishart.museum":true,"jfk.museum":true,"journalism.museum":true,"judaica.museum":true,"judygarland.museum":true,"juedisches.museum":true,"juif.museum":true,"karate.museum":true,"karikatur.museum":true,"kids.museum":true,"koebenhavn.museum":true,"koeln.museum":true,"kunst.museum":true,"kunstsammlung.museum":true,"kunstunddesign.museum":true,"labor.museum":true,"labour.museum":true,"lajolla.museum":true,"lancashire.museum":true,"landes.museum":true,"lans.museum":true,"xn--lns-qla.museum":true,"larsson.museum":true,"lewismiller.museum":true,"lincoln.museum":true,"linz.museum":true,"living.museum":true,"livinghistory.museum":true,"localhistory.museum":true,"london.museum":true,"losangeles.museum":true,"louvre.museum":true,"loyalist.museum":true,"lucerne.museum":true,"luxembourg.museum":true,"luzern.museum":true,"mad.museum":true,"madrid.museum":true,"mallorca.museum":true,"manchester.museum":true,"mansion.museum":true,"mansions.museum":true,"manx.museum":true,"marburg.museum":true,"maritime.museum":true,"maritimo.museum":true,"maryland.museum":true,"marylhurst.museum":true,"media.museum":true,"medical.museum":true,"medizinhistorisches.museum":true,"meeres.museum":true,"memorial.museum":true,"mesaverde.museum":true,"michigan.museum":true,"midatlantic.museum":true,"military.museum":true,"mill.museum":true,"miners.museum":true,"mining.museum":true,"minnesota.museum":true,"missile.museum":true,"missoula.museum":true,"modern.museum":true,"moma.museum":true,"money.museum":true,"monmouth.museum":true,"monticello.museum":true,"montreal.museum":true,"moscow.museum":true,"motorcycle.museum":true,"muenchen.museum":true,"muenster.museum":true,"mulhouse.museum":true,"muncie.museum":true,"museet.museum":true,"museumcenter.museum":true,"museumvereniging.museum":true,"music.museum":true,"national.museum":true,"nationalfirearms.museum":true,"nationalheritage.museum":true,"nativeamerican.museum":true,"naturalhistory.museum":true,"naturalhistorymuseum.museum":true,"naturalsciences.museum":true,"nature.museum":true,"naturhistorisches.museum":true,"natuurwetenschappen.museum":true,"naumburg.museum":true,"naval.museum":true,"nebraska.museum":true,"neues.museum":true,"newhampshire.museum":true,"newjersey.museum":true,"newmexico.museum":true,"newport.museum":true,"newspaper.museum":true,"newyork.museum":true,"niepce.museum":true,"norfolk.museum":true,"north.museum":true,"nrw.museum":true,"nuernberg.museum":true,"nuremberg.museum":true,"nyc.museum":true,"nyny.museum":true,"oceanographic.museum":true,"oceanographique.museum":true,"omaha.museum":true,"online.museum":true,"ontario.museum":true,"openair.museum":true,"oregon.museum":true,"oregontrail.museum":true,"otago.museum":true,"oxford.museum":true,"pacific.museum":true,"paderborn.museum":true,"palace.museum":true,"paleo.museum":true,"palmsprings.museum":true,"panama.museum":true,"paris.museum":true,"pasadena.museum":true,"pharmacy.museum":true,"philadelphia.museum":true,"philadelphiaarea.museum":true,"philately.museum":true,"phoenix.museum":true,"photography.museum":true,"pilots.museum":true,"pittsburgh.museum":true,"planetarium.museum":true,"plantation.museum":true,"plants.museum":true,"plaza.museum":true,"portal.museum":true,"portland.museum":true,"portlligat.museum":true,"posts-and-telecommunications.museum":true,"preservation.museum":true,"presidio.museum":true,"press.museum":true,"project.museum":true,"public.museum":true,"pubol.museum":true,"quebec.museum":true,"railroad.museum":true,"railway.museum":true,"research.museum":true,"resistance.museum":true,"riodejaneiro.museum":true,"rochester.museum":true,"rockart.museum":true,"roma.museum":true,"russia.museum":true,"saintlouis.museum":true,"salem.museum":true,"salvadordali.museum":true,"salzburg.museum":true,"sandiego.museum":true,"sanfrancisco.museum":true,"santabarbara.museum":true,"santacruz.museum":true,"santafe.museum":true,"saskatchewan.museum":true,"satx.museum":true,"savannahga.museum":true,"schlesisches.museum":true,"schoenbrunn.museum":true,"schokoladen.museum":true,"school.museum":true,"schweiz.museum":true,"science.museum":true,"scienceandhistory.museum":true,"scienceandindustry.museum":true,"sciencecenter.museum":true,"sciencecenters.museum":true,"science-fiction.museum":true,"sciencehistory.museum":true,"sciences.museum":true,"sciencesnaturelles.museum":true,"scotland.museum":true,"seaport.museum":true,"settlement.museum":true,"settlers.museum":true,"shell.museum":true,"sherbrooke.museum":true,"sibenik.museum":true,"silk.museum":true,"ski.museum":true,"skole.museum":true,"society.museum":true,"sologne.museum":true,"soundandvision.museum":true,"southcarolina.museum":true,"southwest.museum":true,"space.museum":true,"spy.museum":true,"square.museum":true,"stadt.museum":true,"stalbans.museum":true,"starnberg.museum":true,"state.museum":true,"stateofdelaware.museum":true,"station.museum":true,"steam.museum":true,"steiermark.museum":true,"stjohn.museum":true,"stockholm.museum":true,"stpetersburg.museum":true,"stuttgart.museum":true,"suisse.museum":true,"surgeonshall.museum":true,"surrey.museum":true,"svizzera.museum":true,"sweden.museum":true,"sydney.museum":true,"tank.museum":true,"tcm.museum":true,"technology.museum":true,"telekommunikation.museum":true,"television.museum":true,"texas.museum":true,"textile.museum":true,"theater.museum":true,"time.museum":true,"timekeeping.museum":true,"topology.museum":true,"torino.museum":true,"touch.museum":true,"town.museum":true,"transport.museum":true,"tree.museum":true,"trolley.museum":true,"trust.museum":true,"trustee.museum":true,"uhren.museum":true,"ulm.museum":true,"undersea.museum":true,"university.museum":true,"usa.museum":true,"usantiques.museum":true,"usarts.museum":true,"uscountryestate.museum":true,"usculture.museum":true,"usdecorativearts.museum":true,"usgarden.museum":true,"ushistory.museum":true,"ushuaia.museum":true,"uslivinghistory.museum":true,"utah.museum":true,"uvic.museum":true,"valley.museum":true,"vantaa.museum":true,"versailles.museum":true,"viking.museum":true,"village.museum":true,"virginia.museum":true,"virtual.museum":true,"virtuel.museum":true,"vlaanderen.museum":true,"volkenkunde.museum":true,"wales.museum":true,"wallonie.museum":true,"war.museum":true,"washingtondc.museum":true,"watchandclock.museum":true,"watch-and-clock.museum":true,"western.museum":true,"westfalen.museum":true,"whaling.museum":true,"wildlife.museum":true,"williamsburg.museum":true,"windmill.museum":true,"workshop.museum":true,"york.museum":true,"yorkshire.museum":true,"yosemite.museum":true,"youth.museum":true,"zoological.museum":true,"zoology.museum":true,"xn--9dbhblg6di.museum":true,"xn--h1aegh.museum":true,"mv":true,"aero.mv":true,"biz.mv":true,"com.mv":true,"coop.mv":true,"edu.mv":true,"gov.mv":true,"info.mv":true,"int.mv":true,"mil.mv":true,"museum.mv":true,"name.mv":true,"net.mv":true,"org.mv":true,"pro.mv":true,"mw":true,"ac.mw":true,"biz.mw":true,"co.mw":true,"com.mw":true,"coop.mw":true,"edu.mw":true,"gov.mw":true,"int.mw":true,"museum.mw":true,"net.mw":true,"org.mw":true,"mx":true,"com.mx":true,"org.mx":true,"gob.mx":true,"edu.mx":true,"net.mx":true,"my":true,"com.my":true,"net.my":true,"org.my":true,"gov.my":true,"edu.my":true,"mil.my":true,"name.my":true,"*.mz":true,"teledata.mz":false,"na":true,"info.na":true,"pro.na":true,"name.na":true,"school.na":true,"or.na":true,"dr.na":true,"us.na":true,"mx.na":true,"ca.na":true,"in.na":true,"cc.na":true,"tv.na":true,"ws.na":true,"mobi.na":true,"co.na":true,"com.na":true,"org.na":true,"name":true,"nc":true,"asso.nc":true,"ne":true,"net":true,"nf":true,"com.nf":true,"net.nf":true,"per.nf":true,"rec.nf":true,"web.nf":true,"arts.nf":true,"firm.nf":true,"info.nf":true,"other.nf":true,"store.nf":true,"ng":true,"com.ng":true,"edu.ng":true,"name.ng":true,"net.ng":true,"org.ng":true,"sch.ng":true,"gov.ng":true,"mil.ng":true,"mobi.ng":true,"*.ni":true,"nl":true,"bv.nl":true,"no":true,"fhs.no":true,"vgs.no":true,"fylkesbibl.no":true,"folkebibl.no":true,"museum.no":true,"idrett.no":true,"priv.no":true,"mil.no":true,"stat.no":true,"dep.no":true,"kommune.no":true,"herad.no":true,"aa.no":true,"ah.no":true,"bu.no":true,"fm.no":true,"hl.no":true,"hm.no":true,"jan-mayen.no":true,"mr.no":true,"nl.no":true,"nt.no":true,"of.no":true,"ol.no":true,"oslo.no":true,"rl.no":true,"sf.no":true,"st.no":true,"svalbard.no":true,"tm.no":true,"tr.no":true,"va.no":true,"vf.no":true,"gs.aa.no":true,"gs.ah.no":true,"gs.bu.no":true,"gs.fm.no":true,"gs.hl.no":true,"gs.hm.no":true,"gs.jan-mayen.no":true,"gs.mr.no":true,"gs.nl.no":true,"gs.nt.no":true,"gs.of.no":true,"gs.ol.no":true,"gs.oslo.no":true,"gs.rl.no":true,"gs.sf.no":true,"gs.st.no":true,"gs.svalbard.no":true,"gs.tm.no":true,"gs.tr.no":true,"gs.va.no":true,"gs.vf.no":true,"akrehamn.no":true,"xn--krehamn-dxa.no":true,"algard.no":true,"xn--lgrd-poac.no":true,"arna.no":true,"brumunddal.no":true,"bryne.no":true,"bronnoysund.no":true,"xn--brnnysund-m8ac.no":true,"drobak.no":true,"xn--drbak-wua.no":true,"egersund.no":true,"fetsund.no":true,"floro.no":true,"xn--flor-jra.no":true,"fredrikstad.no":true,"hokksund.no":true,"honefoss.no":true,"xn--hnefoss-q1a.no":true,"jessheim.no":true,"jorpeland.no":true,"xn--jrpeland-54a.no":true,"kirkenes.no":true,"kopervik.no":true,"krokstadelva.no":true,"langevag.no":true,"xn--langevg-jxa.no":true,"leirvik.no":true,"mjondalen.no":true,"xn--mjndalen-64a.no":true,"mo-i-rana.no":true,"mosjoen.no":true,"xn--mosjen-eya.no":true,"nesoddtangen.no":true,"orkanger.no":true,"osoyro.no":true,"xn--osyro-wua.no":true,"raholt.no":true,"xn--rholt-mra.no":true,"sandnessjoen.no":true,"xn--sandnessjen-ogb.no":true,"skedsmokorset.no":true,"slattum.no":true,"spjelkavik.no":true,"stathelle.no":true,"stavern.no":true,"stjordalshalsen.no":true,"xn--stjrdalshalsen-sqb.no":true,"tananger.no":true,"tranby.no":true,"vossevangen.no":true,"afjord.no":true,"xn--fjord-lra.no":true,"agdenes.no":true,"al.no":true,"xn--l-1fa.no":true,"alesund.no":true,"xn--lesund-hua.no":true,"alstahaug.no":true,"alta.no":true,"xn--lt-liac.no":true,"alaheadju.no":true,"xn--laheadju-7ya.no":true,"alvdal.no":true,"amli.no":true,"xn--mli-tla.no":true,"amot.no":true,"xn--mot-tla.no":true,"andebu.no":true,"andoy.no":true,"xn--andy-ira.no":true,"andasuolo.no":true,"ardal.no":true,"xn--rdal-poa.no":true,"aremark.no":true,"arendal.no":true,"xn--s-1fa.no":true,"aseral.no":true,"xn--seral-lra.no":true,"asker.no":true,"askim.no":true,"askvoll.no":true,"askoy.no":true,"xn--asky-ira.no":true,"asnes.no":true,"xn--snes-poa.no":true,"audnedaln.no":true,"aukra.no":true,"aure.no":true,"aurland.no":true,"aurskog-holand.no":true,"xn--aurskog-hland-jnb.no":true,"austevoll.no":true,"austrheim.no":true,"averoy.no":true,"xn--avery-yua.no":true,"balestrand.no":true,"ballangen.no":true,"balat.no":true,"xn--blt-elab.no":true,"balsfjord.no":true,"bahccavuotna.no":true,"xn--bhccavuotna-k7a.no":true,"bamble.no":true,"bardu.no":true,"beardu.no":true,"beiarn.no":true,"bajddar.no":true,"xn--bjddar-pta.no":true,"baidar.no":true,"xn--bidr-5nac.no":true,"berg.no":true,"bergen.no":true,"berlevag.no":true,"xn--berlevg-jxa.no":true,"bearalvahki.no":true,"xn--bearalvhki-y4a.no":true,"bindal.no":true,"birkenes.no":true,"bjarkoy.no":true,"xn--bjarky-fya.no":true,"bjerkreim.no":true,"bjugn.no":true,"bodo.no":true,"xn--bod-2na.no":true,"badaddja.no":true,"xn--bdddj-mrabd.no":true,"budejju.no":true,"bokn.no":true,"bremanger.no":true,"bronnoy.no":true,"xn--brnny-wuac.no":true,"bygland.no":true,"bykle.no":true,"barum.no":true,"xn--brum-voa.no":true,"bo.telemark.no":true,"xn--b-5ga.telemark.no":true,"bo.nordland.no":true,"xn--b-5ga.nordland.no":true,"bievat.no":true,"xn--bievt-0qa.no":true,"bomlo.no":true,"xn--bmlo-gra.no":true,"batsfjord.no":true,"xn--btsfjord-9za.no":true,"bahcavuotna.no":true,"xn--bhcavuotna-s4a.no":true,"dovre.no":true,"drammen.no":true,"drangedal.no":true,"dyroy.no":true,"xn--dyry-ira.no":true,"donna.no":true,"xn--dnna-gra.no":true,"eid.no":true,"eidfjord.no":true,"eidsberg.no":true,"eidskog.no":true,"eidsvoll.no":true,"eigersund.no":true,"elverum.no":true,"enebakk.no":true,"engerdal.no":true,"etne.no":true,"etnedal.no":true,"evenes.no":true,"evenassi.no":true,"xn--eveni-0qa01ga.no":true,"evje-og-hornnes.no":true,"farsund.no":true,"fauske.no":true,"fuossko.no":true,"fuoisku.no":true,"fedje.no":true,"fet.no":true,"finnoy.no":true,"xn--finny-yua.no":true,"fitjar.no":true,"fjaler.no":true,"fjell.no":true,"flakstad.no":true,"flatanger.no":true,"flekkefjord.no":true,"flesberg.no":true,"flora.no":true,"fla.no":true,"xn--fl-zia.no":true,"folldal.no":true,"forsand.no":true,"fosnes.no":true,"frei.no":true,"frogn.no":true,"froland.no":true,"frosta.no":true,"frana.no":true,"xn--frna-woa.no":true,"froya.no":true,"xn--frya-hra.no":true,"fusa.no":true,"fyresdal.no":true,"forde.no":true,"xn--frde-gra.no":true,"gamvik.no":true,"gangaviika.no":true,"xn--ggaviika-8ya47h.no":true,"gaular.no":true,"gausdal.no":true,"gildeskal.no":true,"xn--gildeskl-g0a.no":true,"giske.no":true,"gjemnes.no":true,"gjerdrum.no":true,"gjerstad.no":true,"gjesdal.no":true,"gjovik.no":true,"xn--gjvik-wua.no":true,"gloppen.no":true,"gol.no":true,"gran.no":true,"grane.no":true,"granvin.no":true,"gratangen.no":true,"grimstad.no":true,"grong.no":true,"kraanghke.no":true,"xn--kranghke-b0a.no":true,"grue.no":true,"gulen.no":true,"hadsel.no":true,"halden.no":true,"halsa.no":true,"hamar.no":true,"hamaroy.no":true,"habmer.no":true,"xn--hbmer-xqa.no":true,"hapmir.no":true,"xn--hpmir-xqa.no":true,"hammerfest.no":true,"hammarfeasta.no":true,"xn--hmmrfeasta-s4ac.no":true,"haram.no":true,"hareid.no":true,"harstad.no":true,"hasvik.no":true,"aknoluokta.no":true,"xn--koluokta-7ya57h.no":true,"hattfjelldal.no":true,"aarborte.no":true,"haugesund.no":true,"hemne.no":true,"hemnes.no":true,"hemsedal.no":true,"heroy.more-og-romsdal.no":true,"xn--hery-ira.xn--mre-og-romsdal-qqb.no":true,"heroy.nordland.no":true,"xn--hery-ira.nordland.no":true,"hitra.no":true,"hjartdal.no":true,"hjelmeland.no":true,"hobol.no":true,"xn--hobl-ira.no":true,"hof.no":true,"hol.no":true,"hole.no":true,"holmestrand.no":true,"holtalen.no":true,"xn--holtlen-hxa.no":true,"hornindal.no":true,"horten.no":true,"hurdal.no":true,"hurum.no":true,"hvaler.no":true,"hyllestad.no":true,"hagebostad.no":true,"xn--hgebostad-g3a.no":true,"hoyanger.no":true,"xn--hyanger-q1a.no":true,"hoylandet.no":true,"xn--hylandet-54a.no":true,"ha.no":true,"xn--h-2fa.no":true,"ibestad.no":true,"inderoy.no":true,"xn--indery-fya.no":true,"iveland.no":true,"jevnaker.no":true,"jondal.no":true,"jolster.no":true,"xn--jlster-bya.no":true,"karasjok.no":true,"karasjohka.no":true,"xn--krjohka-hwab49j.no":true,"karlsoy.no":true,"galsa.no":true,"xn--gls-elac.no":true,"karmoy.no":true,"xn--karmy-yua.no":true,"kautokeino.no":true,"guovdageaidnu.no":true,"klepp.no":true,"klabu.no":true,"xn--klbu-woa.no":true,"kongsberg.no":true,"kongsvinger.no":true,"kragero.no":true,"xn--krager-gya.no":true,"kristiansand.no":true,"kristiansund.no":true,"krodsherad.no":true,"xn--krdsherad-m8a.no":true,"kvalsund.no":true,"rahkkeravju.no":true,"xn--rhkkervju-01af.no":true,"kvam.no":true,"kvinesdal.no":true,"kvinnherad.no":true,"kviteseid.no":true,"kvitsoy.no":true,"xn--kvitsy-fya.no":true,"kvafjord.no":true,"xn--kvfjord-nxa.no":true,"giehtavuoatna.no":true,"kvanangen.no":true,"xn--kvnangen-k0a.no":true,"navuotna.no":true,"xn--nvuotna-hwa.no":true,"kafjord.no":true,"xn--kfjord-iua.no":true,"gaivuotna.no":true,"xn--givuotna-8ya.no":true,"larvik.no":true,"lavangen.no":true,"lavagis.no":true,"loabat.no":true,"xn--loabt-0qa.no":true,"lebesby.no":true,"davvesiida.no":true,"leikanger.no":true,"leirfjord.no":true,"leka.no":true,"leksvik.no":true,"lenvik.no":true,"leangaviika.no":true,"xn--leagaviika-52b.no":true,"lesja.no":true,"levanger.no":true,"lier.no":true,"lierne.no":true,"lillehammer.no":true,"lillesand.no":true,"lindesnes.no":true,"lindas.no":true,"xn--linds-pra.no":true,"lom.no":true,"loppa.no":true,"lahppi.no":true,"xn--lhppi-xqa.no":true,"lund.no":true,"lunner.no":true,"luroy.no":true,"xn--lury-ira.no":true,"luster.no":true,"lyngdal.no":true,"lyngen.no":true,"ivgu.no":true,"lardal.no":true,"lerdal.no":true,"xn--lrdal-sra.no":true,"lodingen.no":true,"xn--ldingen-q1a.no":true,"lorenskog.no":true,"xn--lrenskog-54a.no":true,"loten.no":true,"xn--lten-gra.no":true,"malvik.no":true,"masoy.no":true,"xn--msy-ula0h.no":true,"muosat.no":true,"xn--muost-0qa.no":true,"mandal.no":true,"marker.no":true,"marnardal.no":true,"masfjorden.no":true,"meland.no":true,"meldal.no":true,"melhus.no":true,"meloy.no":true,"xn--mely-ira.no":true,"meraker.no":true,"xn--merker-kua.no":true,"moareke.no":true,"xn--moreke-jua.no":true,"midsund.no":true,"midtre-gauldal.no":true,"modalen.no":true,"modum.no":true,"molde.no":true,"moskenes.no":true,"moss.no":true,"mosvik.no":true,"malselv.no":true,"xn--mlselv-iua.no":true,"malatvuopmi.no":true,"xn--mlatvuopmi-s4a.no":true,"namdalseid.no":true,"aejrie.no":true,"namsos.no":true,"namsskogan.no":true,"naamesjevuemie.no":true,"xn--nmesjevuemie-tcba.no":true,"laakesvuemie.no":true,"nannestad.no":true,"narvik.no":true,"narviika.no":true,"naustdal.no":true,"nedre-eiker.no":true,"nes.akershus.no":true,"nes.buskerud.no":true,"nesna.no":true,"nesodden.no":true,"nesseby.no":true,"unjarga.no":true,"xn--unjrga-rta.no":true,"nesset.no":true,"nissedal.no":true,"nittedal.no":true,"nord-aurdal.no":true,"nord-fron.no":true,"nord-odal.no":true,"norddal.no":true,"nordkapp.no":true,"davvenjarga.no":true,"xn--davvenjrga-y4a.no":true,"nordre-land.no":true,"nordreisa.no":true,"raisa.no":true,"xn--risa-5na.no":true,"nore-og-uvdal.no":true,"notodden.no":true,"naroy.no":true,"xn--nry-yla5g.no":true,"notteroy.no":true,"xn--nttery-byae.no":true,"odda.no":true,"oksnes.no":true,"xn--ksnes-uua.no":true,"oppdal.no":true,"oppegard.no":true,"xn--oppegrd-ixa.no":true,"orkdal.no":true,"orland.no":true,"xn--rland-uua.no":true,"orskog.no":true,"xn--rskog-uua.no":true,"orsta.no":true,"xn--rsta-fra.no":true,"os.hedmark.no":true,"os.hordaland.no":true,"osen.no":true,"osteroy.no":true,"xn--ostery-fya.no":true,"ostre-toten.no":true,"xn--stre-toten-zcb.no":true,"overhalla.no":true,"ovre-eiker.no":true,"xn--vre-eiker-k8a.no":true,"oyer.no":true,"xn--yer-zna.no":true,"oygarden.no":true,"xn--ygarden-p1a.no":true,"oystre-slidre.no":true,"xn--ystre-slidre-ujb.no":true,"porsanger.no":true,"porsangu.no":true,"xn--porsgu-sta26f.no":true,"porsgrunn.no":true,"radoy.no":true,"xn--rady-ira.no":true,"rakkestad.no":true,"rana.no":true,"ruovat.no":true,"randaberg.no":true,"rauma.no":true,"rendalen.no":true,"rennebu.no":true,"rennesoy.no":true,"xn--rennesy-v1a.no":true,"rindal.no":true,"ringebu.no":true,"ringerike.no":true,"ringsaker.no":true,"rissa.no":true,"risor.no":true,"xn--risr-ira.no":true,"roan.no":true,"rollag.no":true,"rygge.no":true,"ralingen.no":true,"xn--rlingen-mxa.no":true,"rodoy.no":true,"xn--rdy-0nab.no":true,"romskog.no":true,"xn--rmskog-bya.no":true,"roros.no":true,"xn--rros-gra.no":true,"rost.no":true,"xn--rst-0na.no":true,"royken.no":true,"xn--ryken-vua.no":true,"royrvik.no":true,"xn--ryrvik-bya.no":true,"rade.no":true,"xn--rde-ula.no":true,"salangen.no":true,"siellak.no":true,"saltdal.no":true,"salat.no":true,"xn--slt-elab.no":true,"xn--slat-5na.no":true,"samnanger.no":true,"sande.more-og-romsdal.no":true,"sande.xn--mre-og-romsdal-qqb.no":true,"sande.vestfold.no":true,"sandefjord.no":true,"sandnes.no":true,"sandoy.no":true,"xn--sandy-yua.no":true,"sarpsborg.no":true,"sauda.no":true,"sauherad.no":true,"sel.no":true,"selbu.no":true,"selje.no":true,"seljord.no":true,"sigdal.no":true,"siljan.no":true,"sirdal.no":true,"skaun.no":true,"skedsmo.no":true,"ski.no":true,"skien.no":true,"skiptvet.no":true,"skjervoy.no":true,"xn--skjervy-v1a.no":true,"skierva.no":true,"xn--skierv-uta.no":true,"skjak.no":true,"xn--skjk-soa.no":true,"skodje.no":true,"skanland.no":true,"xn--sknland-fxa.no":true,"skanit.no":true,"xn--sknit-yqa.no":true,"smola.no":true,"xn--smla-hra.no":true,"snillfjord.no":true,"snasa.no":true,"xn--snsa-roa.no":true,"snoasa.no":true,"snaase.no":true,"xn--snase-nra.no":true,"sogndal.no":true,"sokndal.no":true,"sola.no":true,"solund.no":true,"songdalen.no":true,"sortland.no":true,"spydeberg.no":true,"stange.no":true,"stavanger.no":true,"steigen.no":true,"steinkjer.no":true,"stjordal.no":true,"xn--stjrdal-s1a.no":true,"stokke.no":true,"stor-elvdal.no":true,"stord.no":true,"stordal.no":true,"storfjord.no":true,"omasvuotna.no":true,"strand.no":true,"stranda.no":true,"stryn.no":true,"sula.no":true,"suldal.no":true,"sund.no":true,"sunndal.no":true,"surnadal.no":true,"sveio.no":true,"svelvik.no":true,"sykkylven.no":true,"sogne.no":true,"xn--sgne-gra.no":true,"somna.no":true,"xn--smna-gra.no":true,"sondre-land.no":true,"xn--sndre-land-0cb.no":true,"sor-aurdal.no":true,"xn--sr-aurdal-l8a.no":true,"sor-fron.no":true,"xn--sr-fron-q1a.no":true,"sor-odal.no":true,"xn--sr-odal-q1a.no":true,"sor-varanger.no":true,"xn--sr-varanger-ggb.no":true,"matta-varjjat.no":true,"xn--mtta-vrjjat-k7af.no":true,"sorfold.no":true,"xn--srfold-bya.no":true,"sorreisa.no":true,"xn--srreisa-q1a.no":true,"sorum.no":true,"xn--srum-gra.no":true,"tana.no":true,"deatnu.no":true,"time.no":true,"tingvoll.no":true,"tinn.no":true,"tjeldsund.no":true,"dielddanuorri.no":true,"tjome.no":true,"xn--tjme-hra.no":true,"tokke.no":true,"tolga.no":true,"torsken.no":true,"tranoy.no":true,"xn--trany-yua.no":true,"tromso.no":true,"xn--troms-zua.no":true,"tromsa.no":true,"romsa.no":true,"trondheim.no":true,"troandin.no":true,"trysil.no":true,"trana.no":true,"xn--trna-woa.no":true,"trogstad.no":true,"xn--trgstad-r1a.no":true,"tvedestrand.no":true,"tydal.no":true,"tynset.no":true,"tysfjord.no":true,"divtasvuodna.no":true,"divttasvuotna.no":true,"tysnes.no":true,"tysvar.no":true,"xn--tysvr-vra.no":true,"tonsberg.no":true,"xn--tnsberg-q1a.no":true,"ullensaker.no":true,"ullensvang.no":true,"ulvik.no":true,"utsira.no":true,"vadso.no":true,"xn--vads-jra.no":true,"cahcesuolo.no":true,"xn--hcesuolo-7ya35b.no":true,"vaksdal.no":true,"valle.no":true,"vang.no":true,"vanylven.no":true,"vardo.no":true,"xn--vard-jra.no":true,"varggat.no":true,"xn--vrggt-xqad.no":true,"vefsn.no":true,"vaapste.no":true,"vega.no":true,"vegarshei.no":true,"xn--vegrshei-c0a.no":true,"vennesla.no":true,"verdal.no":true,"verran.no":true,"vestby.no":true,"vestnes.no":true,"vestre-slidre.no":true,"vestre-toten.no":true,"vestvagoy.no":true,"xn--vestvgy-ixa6o.no":true,"vevelstad.no":true,"vik.no":true,"vikna.no":true,"vindafjord.no":true,"volda.no":true,"voss.no":true,"varoy.no":true,"xn--vry-yla5g.no":true,"vagan.no":true,"xn--vgan-qoa.no":true,"voagat.no":true,"vagsoy.no":true,"xn--vgsy-qoa0j.no":true,"vaga.no":true,"xn--vg-yiab.no":true,"valer.ostfold.no":true,"xn--vler-qoa.xn--stfold-9xa.no":true,"valer.hedmark.no":true,"xn--vler-qoa.hedmark.no":true,"*.np":true,"nr":true,"biz.nr":true,"info.nr":true,"gov.nr":true,"edu.nr":true,"org.nr":true,"net.nr":true,"com.nr":true,"nu":true,"nz":true,"ac.nz":true,"co.nz":true,"cri.nz":true,"geek.nz":true,"gen.nz":true,"govt.nz":true,"health.nz":true,"iwi.nz":true,"kiwi.nz":true,"maori.nz":true,"mil.nz":true,"xn--mori-qsa.nz":true,"net.nz":true,"org.nz":true,"parliament.nz":true,"school.nz":true,"om":true,"co.om":true,"com.om":true,"edu.om":true,"gov.om":true,"med.om":true,"museum.om":true,"net.om":true,"org.om":true,"pro.om":true,"org":true,"pa":true,"ac.pa":true,"gob.pa":true,"com.pa":true,"org.pa":true,"sld.pa":true,"edu.pa":true,"net.pa":true,"ing.pa":true,"abo.pa":true,"med.pa":true,"nom.pa":true,"pe":true,"edu.pe":true,"gob.pe":true,"nom.pe":true,"mil.pe":true,"org.pe":true,"com.pe":true,"net.pe":true,"pf":true,"com.pf":true,"org.pf":true,"edu.pf":true,"*.pg":true,"ph":true,"com.ph":true,"net.ph":true,"org.ph":true,"gov.ph":true,"edu.ph":true,"ngo.ph":true,"mil.ph":true,"i.ph":true,"pk":true,"com.pk":true,"net.pk":true,"edu.pk":true,"org.pk":true,"fam.pk":true,"biz.pk":true,"web.pk":true,"gov.pk":true,"gob.pk":true,"gok.pk":true,"gon.pk":true,"gop.pk":true,"gos.pk":true,"info.pk":true,"pl":true,"com.pl":true,"net.pl":true,"org.pl":true,"aid.pl":true,"agro.pl":true,"atm.pl":true,"auto.pl":true,"biz.pl":true,"edu.pl":true,"gmina.pl":true,"gsm.pl":true,"info.pl":true,"mail.pl":true,"miasta.pl":true,"media.pl":true,"mil.pl":true,"nieruchomosci.pl":true,"nom.pl":true,"pc.pl":true,"powiat.pl":true,"priv.pl":true,"realestate.pl":true,"rel.pl":true,"sex.pl":true,"shop.pl":true,"sklep.pl":true,"sos.pl":true,"szkola.pl":true,"targi.pl":true,"tm.pl":true,"tourism.pl":true,"travel.pl":true,"turystyka.pl":true,"gov.pl":true,"ap.gov.pl":true,"ic.gov.pl":true,"is.gov.pl":true,"us.gov.pl":true,"kmpsp.gov.pl":true,"kppsp.gov.pl":true,"kwpsp.gov.pl":true,"psp.gov.pl":true,"wskr.gov.pl":true,"kwp.gov.pl":true,"mw.gov.pl":true,"ug.gov.pl":true,"um.gov.pl":true,"umig.gov.pl":true,"ugim.gov.pl":true,"upow.gov.pl":true,"uw.gov.pl":true,"starostwo.gov.pl":true,"pa.gov.pl":true,"po.gov.pl":true,"psse.gov.pl":true,"pup.gov.pl":true,"rzgw.gov.pl":true,"sa.gov.pl":true,"so.gov.pl":true,"sr.gov.pl":true,"wsa.gov.pl":true,"sko.gov.pl":true,"uzs.gov.pl":true,"wiih.gov.pl":true,"winb.gov.pl":true,"pinb.gov.pl":true,"wios.gov.pl":true,"witd.gov.pl":true,"wzmiuw.gov.pl":true,"piw.gov.pl":true,"wiw.gov.pl":true,"griw.gov.pl":true,"wif.gov.pl":true,"oum.gov.pl":true,"sdn.gov.pl":true,"zp.gov.pl":true,"uppo.gov.pl":true,"mup.gov.pl":true,"wuoz.gov.pl":true,"konsulat.gov.pl":true,"oirm.gov.pl":true,"augustow.pl":true,"babia-gora.pl":true,"bedzin.pl":true,"beskidy.pl":true,"bialowieza.pl":true,"bialystok.pl":true,"bielawa.pl":true,"bieszczady.pl":true,"boleslawiec.pl":true,"bydgoszcz.pl":true,"bytom.pl":true,"cieszyn.pl":true,"czeladz.pl":true,"czest.pl":true,"dlugoleka.pl":true,"elblag.pl":true,"elk.pl":true,"glogow.pl":true,"gniezno.pl":true,"gorlice.pl":true,"grajewo.pl":true,"ilawa.pl":true,"jaworzno.pl":true,"jelenia-gora.pl":true,"jgora.pl":true,"kalisz.pl":true,"kazimierz-dolny.pl":true,"karpacz.pl":true,"kartuzy.pl":true,"kaszuby.pl":true,"katowice.pl":true,"kepno.pl":true,"ketrzyn.pl":true,"klodzko.pl":true,"kobierzyce.pl":true,"kolobrzeg.pl":true,"konin.pl":true,"konskowola.pl":true,"kutno.pl":true,"lapy.pl":true,"lebork.pl":true,"legnica.pl":true,"lezajsk.pl":true,"limanowa.pl":true,"lomza.pl":true,"lowicz.pl":true,"lubin.pl":true,"lukow.pl":true,"malbork.pl":true,"malopolska.pl":true,"mazowsze.pl":true,"mazury.pl":true,"mielec.pl":true,"mielno.pl":true,"mragowo.pl":true,"naklo.pl":true,"nowaruda.pl":true,"nysa.pl":true,"olawa.pl":true,"olecko.pl":true,"olkusz.pl":true,"olsztyn.pl":true,"opoczno.pl":true,"opole.pl":true,"ostroda.pl":true,"ostroleka.pl":true,"ostrowiec.pl":true,"ostrowwlkp.pl":true,"pila.pl":true,"pisz.pl":true,"podhale.pl":true,"podlasie.pl":true,"polkowice.pl":true,"pomorze.pl":true,"pomorskie.pl":true,"prochowice.pl":true,"pruszkow.pl":true,"przeworsk.pl":true,"pulawy.pl":true,"radom.pl":true,"rawa-maz.pl":true,"rybnik.pl":true,"rzeszow.pl":true,"sanok.pl":true,"sejny.pl":true,"slask.pl":true,"slupsk.pl":true,"sosnowiec.pl":true,"stalowa-wola.pl":true,"skoczow.pl":true,"starachowice.pl":true,"stargard.pl":true,"suwalki.pl":true,"swidnica.pl":true,"swiebodzin.pl":true,"swinoujscie.pl":true,"szczecin.pl":true,"szczytno.pl":true,"tarnobrzeg.pl":true,"tgory.pl":true,"turek.pl":true,"tychy.pl":true,"ustka.pl":true,"walbrzych.pl":true,"warmia.pl":true,"warszawa.pl":true,"waw.pl":true,"wegrow.pl":true,"wielun.pl":true,"wlocl.pl":true,"wloclawek.pl":true,"wodzislaw.pl":true,"wolomin.pl":true,"wroclaw.pl":true,"zachpomor.pl":true,"zagan.pl":true,"zarow.pl":true,"zgora.pl":true,"zgorzelec.pl":true,"pm":true,"pn":true,"gov.pn":true,"co.pn":true,"org.pn":true,"edu.pn":true,"net.pn":true,"post":true,"pr":true,"com.pr":true,"net.pr":true,"org.pr":true,"gov.pr":true,"edu.pr":true,"isla.pr":true,"pro.pr":true,"biz.pr":true,"info.pr":true,"name.pr":true,"est.pr":true,"prof.pr":true,"ac.pr":true,"pro":true,"aca.pro":true,"bar.pro":true,"cpa.pro":true,"jur.pro":true,"law.pro":true,"med.pro":true,"eng.pro":true,"ps":true,"edu.ps":true,"gov.ps":true,"sec.ps":true,"plo.ps":true,"com.ps":true,"org.ps":true,"net.ps":true,"pt":true,"net.pt":true,"gov.pt":true,"org.pt":true,"edu.pt":true,"int.pt":true,"publ.pt":true,"com.pt":true,"nome.pt":true,"pw":true,"co.pw":true,"ne.pw":true,"or.pw":true,"ed.pw":true,"go.pw":true,"belau.pw":true,"py":true,"com.py":true,"coop.py":true,"edu.py":true,"gov.py":true,"mil.py":true,"net.py":true,"org.py":true,"qa":true,"com.qa":true,"edu.qa":true,"gov.qa":true,"mil.qa":true,"name.qa":true,"net.qa":true,"org.qa":true,"sch.qa":true,"re":true,"com.re":true,"asso.re":true,"nom.re":true,"ro":true,"com.ro":true,"org.ro":true,"tm.ro":true,"nt.ro":true,"nom.ro":true,"info.ro":true,"rec.ro":true,"arts.ro":true,"firm.ro":true,"store.ro":true,"www.ro":true,"rs":true,"co.rs":true,"org.rs":true,"edu.rs":true,"ac.rs":true,"gov.rs":true,"in.rs":true,"ru":true,"ac.ru":true,"com.ru":true,"edu.ru":true,"int.ru":true,"net.ru":true,"org.ru":true,"pp.ru":true,"adygeya.ru":true,"altai.ru":true,"amur.ru":true,"arkhangelsk.ru":true,"astrakhan.ru":true,"bashkiria.ru":true,"belgorod.ru":true,"bir.ru":true,"bryansk.ru":true,"buryatia.ru":true,"cbg.ru":true,"chel.ru":true,"chelyabinsk.ru":true,"chita.ru":true,"chukotka.ru":true,"chuvashia.ru":true,"dagestan.ru":true,"dudinka.ru":true,"e-burg.ru":true,"grozny.ru":true,"irkutsk.ru":true,"ivanovo.ru":true,"izhevsk.ru":true,"jar.ru":true,"joshkar-ola.ru":true,"kalmykia.ru":true,"kaluga.ru":true,"kamchatka.ru":true,"karelia.ru":true,"kazan.ru":true,"kchr.ru":true,"kemerovo.ru":true,"khabarovsk.ru":true,"khakassia.ru":true,"khv.ru":true,"kirov.ru":true,"koenig.ru":true,"komi.ru":true,"kostroma.ru":true,"krasnoyarsk.ru":true,"kuban.ru":true,"kurgan.ru":true,"kursk.ru":true,"lipetsk.ru":true,"magadan.ru":true,"mari.ru":true,"mari-el.ru":true,"marine.ru":true,"mordovia.ru":true,"msk.ru":true,"murmansk.ru":true,"nalchik.ru":true,"nnov.ru":true,"nov.ru":true,"novosibirsk.ru":true,"nsk.ru":true,"omsk.ru":true,"orenburg.ru":true,"oryol.ru":true,"palana.ru":true,"penza.ru":true,"perm.ru":true,"ptz.ru":true,"rnd.ru":true,"ryazan.ru":true,"sakhalin.ru":true,"samara.ru":true,"saratov.ru":true,"simbirsk.ru":true,"smolensk.ru":true,"spb.ru":true,"stavropol.ru":true,"stv.ru":true,"surgut.ru":true,"tambov.ru":true,"tatarstan.ru":true,"tom.ru":true,"tomsk.ru":true,"tsaritsyn.ru":true,"tsk.ru":true,"tula.ru":true,"tuva.ru":true,"tver.ru":true,"tyumen.ru":true,"udm.ru":true,"udmurtia.ru":true,"ulan-ude.ru":true,"vladikavkaz.ru":true,"vladimir.ru":true,"vladivostok.ru":true,"volgograd.ru":true,"vologda.ru":true,"voronezh.ru":true,"vrn.ru":true,"vyatka.ru":true,"yakutia.ru":true,"yamal.ru":true,"yaroslavl.ru":true,"yekaterinburg.ru":true,"yuzhno-sakhalinsk.ru":true,"amursk.ru":true,"baikal.ru":true,"cmw.ru":true,"fareast.ru":true,"jamal.ru":true,"kms.ru":true,"k-uralsk.ru":true,"kustanai.ru":true,"kuzbass.ru":true,"magnitka.ru":true,"mytis.ru":true,"nakhodka.ru":true,"nkz.ru":true,"norilsk.ru":true,"oskol.ru":true,"pyatigorsk.ru":true,"rubtsovsk.ru":true,"snz.ru":true,"syzran.ru":true,"vdonsk.ru":true,"zgrad.ru":true,"gov.ru":true,"mil.ru":true,"test.ru":true,"rw":true,"gov.rw":true,"net.rw":true,"edu.rw":true,"ac.rw":true,"com.rw":true,"co.rw":true,"int.rw":true,"mil.rw":true,"gouv.rw":true,"sa":true,"com.sa":true,"net.sa":true,"org.sa":true,"gov.sa":true,"med.sa":true,"pub.sa":true,"edu.sa":true,"sch.sa":true,"sb":true,"com.sb":true,"edu.sb":true,"gov.sb":true,"net.sb":true,"org.sb":true,"sc":true,"com.sc":true,"gov.sc":true,"net.sc":true,"org.sc":true,"edu.sc":true,"sd":true,"com.sd":true,"net.sd":true,"org.sd":true,"edu.sd":true,"med.sd":true,"tv.sd":true,"gov.sd":true,"info.sd":true,"se":true,"a.se":true,"ac.se":true,"b.se":true,"bd.se":true,"brand.se":true,"c.se":true,"d.se":true,"e.se":true,"f.se":true,"fh.se":true,"fhsk.se":true,"fhv.se":true,"g.se":true,"h.se":true,"i.se":true,"k.se":true,"komforb.se":true,"kommunalforbund.se":true,"komvux.se":true,"l.se":true,"lanbib.se":true,"m.se":true,"n.se":true,"naturbruksgymn.se":true,"o.se":true,"org.se":true,"p.se":true,"parti.se":true,"pp.se":true,"press.se":true,"r.se":true,"s.se":true,"t.se":true,"tm.se":true,"u.se":true,"w.se":true,"x.se":true,"y.se":true,"z.se":true,"sg":true,"com.sg":true,"net.sg":true,"org.sg":true,"gov.sg":true,"edu.sg":true,"per.sg":true,"sh":true,"com.sh":true,"net.sh":true,"gov.sh":true,"org.sh":true,"mil.sh":true,"si":true,"sj":true,"sk":true,"sl":true,"com.sl":true,"net.sl":true,"edu.sl":true,"gov.sl":true,"org.sl":true,"sm":true,"sn":true,"art.sn":true,"com.sn":true,"edu.sn":true,"gouv.sn":true,"org.sn":true,"perso.sn":true,"univ.sn":true,"so":true,"com.so":true,"net.so":true,"org.so":true,"sr":true,"st":true,"co.st":true,"com.st":true,"consulado.st":true,"edu.st":true,"embaixada.st":true,"gov.st":true,"mil.st":true,"net.st":true,"org.st":true,"principe.st":true,"saotome.st":true,"store.st":true,"su":true,"adygeya.su":true,"arkhangelsk.su":true,"balashov.su":true,"bashkiria.su":true,"bryansk.su":true,"dagestan.su":true,"grozny.su":true,"ivanovo.su":true,"kalmykia.su":true,"kaluga.su":true,"karelia.su":true,"khakassia.su":true,"krasnodar.su":true,"kurgan.su":true,"lenug.su":true,"mordovia.su":true,"msk.su":true,"murmansk.su":true,"nalchik.su":true,"nov.su":true,"obninsk.su":true,"penza.su":true,"pokrovsk.su":true,"sochi.su":true,"spb.su":true,"togliatti.su":true,"troitsk.su":true,"tula.su":true,"tuva.su":true,"vladikavkaz.su":true,"vladimir.su":true,"vologda.su":true,"sv":true,"com.sv":true,"edu.sv":true,"gob.sv":true,"org.sv":true,"red.sv":true,"sx":true,"gov.sx":true,"sy":true,"edu.sy":true,"gov.sy":true,"net.sy":true,"mil.sy":true,"com.sy":true,"org.sy":true,"sz":true,"co.sz":true,"ac.sz":true,"org.sz":true,"tc":true,"td":true,"tel":true,"tf":true,"tg":true,"th":true,"ac.th":true,"co.th":true,"go.th":true,"in.th":true,"mi.th":true,"net.th":true,"or.th":true,"tj":true,"ac.tj":true,"biz.tj":true,"co.tj":true,"com.tj":true,"edu.tj":true,"go.tj":true,"gov.tj":true,"int.tj":true,"mil.tj":true,"name.tj":true,"net.tj":true,"nic.tj":true,"org.tj":true,"test.tj":true,"web.tj":true,"tk":true,"tl":true,"gov.tl":true,"tm":true,"com.tm":true,"co.tm":true,"org.tm":true,"net.tm":true,"nom.tm":true,"gov.tm":true,"mil.tm":true,"edu.tm":true,"tn":true,"com.tn":true,"ens.tn":true,"fin.tn":true,"gov.tn":true,"ind.tn":true,"intl.tn":true,"nat.tn":true,"net.tn":true,"org.tn":true,"info.tn":true,"perso.tn":true,"tourism.tn":true,"edunet.tn":true,"rnrt.tn":true,"rns.tn":true,"rnu.tn":true,"mincom.tn":true,"agrinet.tn":true,"defense.tn":true,"turen.tn":true,"to":true,"com.to":true,"gov.to":true,"net.to":true,"org.to":true,"edu.to":true,"mil.to":true,"tp":true,"tr":true,"com.tr":true,"info.tr":true,"biz.tr":true,"net.tr":true,"org.tr":true,"web.tr":true,"gen.tr":true,"tv.tr":true,"av.tr":true,"dr.tr":true,"bbs.tr":true,"name.tr":true,"tel.tr":true,"gov.tr":true,"bel.tr":true,"pol.tr":true,"mil.tr":true,"k12.tr":true,"edu.tr":true,"kep.tr":true,"nc.tr":true,"gov.nc.tr":true,"travel":true,"tt":true,"co.tt":true,"com.tt":true,"org.tt":true,"net.tt":true,"biz.tt":true,"info.tt":true,"pro.tt":true,"int.tt":true,"coop.tt":true,"jobs.tt":true,"mobi.tt":true,"travel.tt":true,"museum.tt":true,"aero.tt":true,"name.tt":true,"gov.tt":true,"edu.tt":true,"tv":true,"tw":true,"edu.tw":true,"gov.tw":true,"mil.tw":true,"com.tw":true,"net.tw":true,"org.tw":true,"idv.tw":true,"game.tw":true,"ebiz.tw":true,"club.tw":true,"xn--zf0ao64a.tw":true,"xn--uc0atv.tw":true,"xn--czrw28b.tw":true,"tz":true,"ac.tz":true,"co.tz":true,"go.tz":true,"hotel.tz":true,"info.tz":true,"me.tz":true,"mil.tz":true,"mobi.tz":true,"ne.tz":true,"or.tz":true,"sc.tz":true,"tv.tz":true,"ua":true,"com.ua":true,"edu.ua":true,"gov.ua":true,"in.ua":true,"net.ua":true,"org.ua":true,"cherkassy.ua":true,"cherkasy.ua":true,"chernigov.ua":true,"chernihiv.ua":true,"chernivtsi.ua":true,"chernovtsy.ua":true,"ck.ua":true,"cn.ua":true,"cr.ua":true,"crimea.ua":true,"cv.ua":true,"dn.ua":true,"dnepropetrovsk.ua":true,"dnipropetrovsk.ua":true,"dominic.ua":true,"donetsk.ua":true,"dp.ua":true,"if.ua":true,"ivano-frankivsk.ua":true,"kh.ua":true,"kharkiv.ua":true,"kharkov.ua":true,"kherson.ua":true,"khmelnitskiy.ua":true,"khmelnytskyi.ua":true,"kiev.ua":true,"kirovograd.ua":true,"km.ua":true,"kr.ua":true,"krym.ua":true,"ks.ua":true,"kv.ua":true,"kyiv.ua":true,"lg.ua":true,"lt.ua":true,"lugansk.ua":true,"lutsk.ua":true,"lv.ua":true,"lviv.ua":true,"mk.ua":true,"mykolaiv.ua":true,"nikolaev.ua":true,"od.ua":true,"odesa.ua":true,"odessa.ua":true,"pl.ua":true,"poltava.ua":true,"rivne.ua":true,"rovno.ua":true,"rv.ua":true,"sb.ua":true,"sebastopol.ua":true,"sevastopol.ua":true,"sm.ua":true,"sumy.ua":true,"te.ua":true,"ternopil.ua":true,"uz.ua":true,"uzhgorod.ua":true,"vinnica.ua":true,"vinnytsia.ua":true,"vn.ua":true,"volyn.ua":true,"yalta.ua":true,"zaporizhzhe.ua":true,"zaporizhzhia.ua":true,"zhitomir.ua":true,"zhytomyr.ua":true,"zp.ua":true,"zt.ua":true,"ug":true,"co.ug":true,"or.ug":true,"ac.ug":true,"sc.ug":true,"go.ug":true,"ne.ug":true,"com.ug":true,"org.ug":true,"uk":true,"ac.uk":true,"co.uk":true,"gov.uk":true,"ltd.uk":true,"me.uk":true,"net.uk":true,"nhs.uk":true,"org.uk":true,"plc.uk":true,"police.uk":true,"*.sch.uk":true,"us":true,"dni.us":true,"fed.us":true,"isa.us":true,"kids.us":true,"nsn.us":true,"ak.us":true,"al.us":true,"ar.us":true,"as.us":true,"az.us":true,"ca.us":true,"co.us":true,"ct.us":true,"dc.us":true,"de.us":true,"fl.us":true,"ga.us":true,"gu.us":true,"hi.us":true,"ia.us":true,"id.us":true,"il.us":true,"in.us":true,"ks.us":true,"ky.us":true,"la.us":true,"ma.us":true,"md.us":true,"me.us":true,"mi.us":true,"mn.us":true,"mo.us":true,"ms.us":true,"mt.us":true,"nc.us":true,"nd.us":true,"ne.us":true,"nh.us":true,"nj.us":true,"nm.us":true,"nv.us":true,"ny.us":true,"oh.us":true,"ok.us":true,"or.us":true,"pa.us":true,"pr.us":true,"ri.us":true,"sc.us":true,"sd.us":true,"tn.us":true,"tx.us":true,"ut.us":true,"vi.us":true,"vt.us":true,"va.us":true,"wa.us":true,"wi.us":true,"wv.us":true,"wy.us":true,"k12.ak.us":true,"k12.al.us":true,"k12.ar.us":true,"k12.as.us":true,"k12.az.us":true,"k12.ca.us":true,"k12.co.us":true,"k12.ct.us":true,"k12.dc.us":true,"k12.de.us":true,"k12.fl.us":true,"k12.ga.us":true,"k12.gu.us":true,"k12.ia.us":true,"k12.id.us":true,"k12.il.us":true,"k12.in.us":true,"k12.ks.us":true,"k12.ky.us":true,"k12.la.us":true,"k12.ma.us":true,"k12.md.us":true,"k12.me.us":true,"k12.mi.us":true,"k12.mn.us":true,"k12.mo.us":true,"k12.ms.us":true,"k12.mt.us":true,"k12.nc.us":true,"k12.ne.us":true,"k12.nh.us":true,"k12.nj.us":true,"k12.nm.us":true,"k12.nv.us":true,"k12.ny.us":true,"k12.oh.us":true,"k12.ok.us":true,"k12.or.us":true,"k12.pa.us":true,"k12.pr.us":true,"k12.ri.us":true,"k12.sc.us":true,"k12.tn.us":true,"k12.tx.us":true,"k12.ut.us":true,"k12.vi.us":true,"k12.vt.us":true,"k12.va.us":true,"k12.wa.us":true,"k12.wi.us":true,"k12.wy.us":true,"cc.ak.us":true,"cc.al.us":true,"cc.ar.us":true,"cc.as.us":true,"cc.az.us":true,"cc.ca.us":true,"cc.co.us":true,"cc.ct.us":true,"cc.dc.us":true,"cc.de.us":true,"cc.fl.us":true,"cc.ga.us":true,"cc.gu.us":true,"cc.hi.us":true,"cc.ia.us":true,"cc.id.us":true,"cc.il.us":true,"cc.in.us":true,"cc.ks.us":true,"cc.ky.us":true,"cc.la.us":true,"cc.ma.us":true,"cc.md.us":true,"cc.me.us":true,"cc.mi.us":true,"cc.mn.us":true,"cc.mo.us":true,"cc.ms.us":true,"cc.mt.us":true,"cc.nc.us":true,"cc.nd.us":true,"cc.ne.us":true,"cc.nh.us":true,"cc.nj.us":true,"cc.nm.us":true,"cc.nv.us":true,"cc.ny.us":true,"cc.oh.us":true,"cc.ok.us":true,"cc.or.us":true,"cc.pa.us":true,"cc.pr.us":true,"cc.ri.us":true,"cc.sc.us":true,"cc.sd.us":true,"cc.tn.us":true,"cc.tx.us":true,"cc.ut.us":true,"cc.vi.us":true,"cc.vt.us":true,"cc.va.us":true,"cc.wa.us":true,"cc.wi.us":true,"cc.wv.us":true,"cc.wy.us":true,"lib.ak.us":true,"lib.al.us":true,"lib.ar.us":true,"lib.as.us":true,"lib.az.us":true,"lib.ca.us":true,"lib.co.us":true,"lib.ct.us":true,"lib.dc.us":true,"lib.de.us":true,"lib.fl.us":true,"lib.ga.us":true,"lib.gu.us":true,"lib.hi.us":true,"lib.ia.us":true,"lib.id.us":true,"lib.il.us":true,"lib.in.us":true,"lib.ks.us":true,"lib.ky.us":true,"lib.la.us":true,"lib.ma.us":true,"lib.md.us":true,"lib.me.us":true,"lib.mi.us":true,"lib.mn.us":true,"lib.mo.us":true,"lib.ms.us":true,"lib.mt.us":true,"lib.nc.us":true,"lib.nd.us":true,"lib.ne.us":true,"lib.nh.us":true,"lib.nj.us":true,"lib.nm.us":true,"lib.nv.us":true,"lib.ny.us":true,"lib.oh.us":true,"lib.ok.us":true,"lib.or.us":true,"lib.pa.us":true,"lib.pr.us":true,"lib.ri.us":true,"lib.sc.us":true,"lib.sd.us":true,"lib.tn.us":true,"lib.tx.us":true,"lib.ut.us":true,"lib.vi.us":true,"lib.vt.us":true,"lib.va.us":true,"lib.wa.us":true,"lib.wi.us":true,"lib.wy.us":true,"pvt.k12.ma.us":true,"chtr.k12.ma.us":true,"paroch.k12.ma.us":true,"uy":true,"com.uy":true,"edu.uy":true,"gub.uy":true,"mil.uy":true,"net.uy":true,"org.uy":true,"uz":true,"co.uz":true,"com.uz":true,"net.uz":true,"org.uz":true,"va":true,"vc":true,"com.vc":true,"net.vc":true,"org.vc":true,"gov.vc":true,"mil.vc":true,"edu.vc":true,"ve":true,"arts.ve":true,"co.ve":true,"com.ve":true,"e12.ve":true,"edu.ve":true,"firm.ve":true,"gob.ve":true,"gov.ve":true,"info.ve":true,"int.ve":true,"mil.ve":true,"net.ve":true,"org.ve":true,"rec.ve":true,"store.ve":true,"tec.ve":true,"web.ve":true,"vg":true,"vi":true,"co.vi":true,"com.vi":true,"k12.vi":true,"net.vi":true,"org.vi":true,"vn":true,"com.vn":true,"net.vn":true,"org.vn":true,"edu.vn":true,"gov.vn":true,"int.vn":true,"ac.vn":true,"biz.vn":true,"info.vn":true,"name.vn":true,"pro.vn":true,"health.vn":true,"vu":true,"com.vu":true,"edu.vu":true,"net.vu":true,"org.vu":true,"wf":true,"ws":true,"com.ws":true,"net.ws":true,"org.ws":true,"gov.ws":true,"edu.ws":true,"yt":true,"xn--mgbaam7a8h":true,"xn--y9a3aq":true,"xn--54b7fta0cc":true,"xn--90ais":true,"xn--fiqs8s":true,"xn--fiqz9s":true,"xn--lgbbat1ad8j":true,"xn--wgbh1c":true,"xn--node":true,"xn--qxam":true,"xn--j6w193g":true,"xn--h2brj9c":true,"xn--mgbbh1a71e":true,"xn--fpcrj9c3d":true,"xn--gecrj9c":true,"xn--s9brj9c":true,"xn--45brj9c":true,"xn--xkc2dl3a5ee0h":true,"xn--mgba3a4f16a":true,"xn--mgba3a4fra":true,"xn--mgbtx2b":true,"xn--mgbayh7gpa":true,"xn--3e0b707e":true,"xn--80ao21a":true,"xn--fzc2c9e2c":true,"xn--xkc2al3hye2a":true,"xn--mgbc0a9azcg":true,"xn--d1alf":true,"xn--l1acc":true,"xn--mix891f":true,"xn--mix082f":true,"xn--mgbx4cd0ab":true,"xn--mgb9awbf":true,"xn--mgbai9azgqp6j":true,"xn--mgbai9a5eva00b":true,"xn--ygbi2ammx":true,"xn--90a3ac":true,"xn--o1ac.xn--90a3ac":true,"xn--c1avg.xn--90a3ac":true,"xn--90azh.xn--90a3ac":true,"xn--d1at.xn--90a3ac":true,"xn--o1ach.xn--90a3ac":true,"xn--80au.xn--90a3ac":true,"xn--p1ai":true,"xn--wgbl6a":true,"xn--mgberp4a5d4ar":true,"xn--mgberp4a5d4a87g":true,"xn--mgbqly7c0a67fbc":true,"xn--mgbqly7cvafr":true,"xn--mgbpl2fh":true,"xn--yfro4i67o":true,"xn--clchc0ea0b2g2a9gcd":true,"xn--ogbpf8fl":true,"xn--mgbtf8fl":true,"xn--o3cw4h":true,"xn--pgbs0dh":true,"xn--kpry57d":true,"xn--kprw13d":true,"xn--nnx388a":true,"xn--j1amh":true,"xn--mgb2ddes":true,"xxx":true,"*.ye":true,"ac.za":true,"agrica.za":true,"alt.za":true,"co.za":true,"edu.za":true,"gov.za":true,"grondar.za":true,"law.za":true,"mil.za":true,"net.za":true,"ngo.za":true,"nis.za":true,"nom.za":true,"org.za":true,"school.za":true,"tm.za":true,"web.za":true,"*.zm":true,"*.zw":true,"aaa":true,"aarp":true,"abarth":true,"abb":true,"abbott":true,"abbvie":true,"abc":true,"able":true,"abogado":true,"abudhabi":true,"academy":true,"accenture":true,"accountant":true,"accountants":true,"aco":true,"active":true,"actor":true,"adac":true,"ads":true,"adult":true,"aeg":true,"aetna":true,"afamilycompany":true,"afl":true,"africa":true,"africamagic":true,"agakhan":true,"agency":true,"aig":true,"aigo":true,"airbus":true,"airforce":true,"airtel":true,"akdn":true,"alfaromeo":true,"alibaba":true,"alipay":true,"allfinanz":true,"allstate":true,"ally":true,"alsace":true,"alstom":true,"americanexpress":true,"americanfamily":true,"amex":true,"amfam":true,"amica":true,"amsterdam":true,"analytics":true,"android":true,"anquan":true,"anz":true,"aol":true,"apartments":true,"app":true,"apple":true,"aquarelle":true,"aramco":true,"archi":true,"army":true,"arte":true,"asda":true,"associates":true,"athleta":true,"attorney":true,"auction":true,"audi":true,"audible":true,"audio":true,"auspost":true,"author":true,"auto":true,"autos":true,"avianca":true,"aws":true,"axa":true,"azure":true,"baby":true,"baidu":true,"banamex":true,"bananarepublic":true,"band":true,"bank":true,"bar":true,"barcelona":true,"barclaycard":true,"barclays":true,"barefoot":true,"bargains":true,"basketball":true,"bauhaus":true,"bayern":true,"bbc":true,"bbt":true,"bbva":true,"bcg":true,"bcn":true,"beats":true,"beer":true,"bentley":true,"berlin":true,"best":true,"bestbuy":true,"bet":true,"bharti":true,"bible":true,"bid":true,"bike":true,"bing":true,"bingo":true,"bio":true,"black":true,"blackfriday":true,"blanco":true,"blockbuster":true,"blog":true,"bloomberg":true,"blue":true,"bms":true,"bmw":true,"bnl":true,"bnpparibas":true,"boats":true,"boehringer":true,"bofa":true,"bom":true,"bond":true,"boo":true,"book":true,"booking":true,"boots":true,"bosch":true,"bostik":true,"bot":true,"boutique":true,"bradesco":true,"bridgestone":true,"broadway":true,"broker":true,"brother":true,"brussels":true,"budapest":true,"bugatti":true,"build":true,"builders":true,"business":true,"buy":true,"buzz":true,"bzh":true,"cab":true,"cafe":true,"cal":true,"call":true,"calvinklein":true,"camera":true,"camp":true,"cancerresearch":true,"canon":true,"capetown":true,"capital":true,"capitalone":true,"car":true,"caravan":true,"cards":true,"care":true,"career":true,"careers":true,"cars":true,"cartier":true,"casa":true,"case":true,"caseih":true,"cash":true,"casino":true,"catering":true,"cba":true,"cbn":true,"cbre":true,"cbs":true,"ceb":true,"center":true,"ceo":true,"cern":true,"cfa":true,"cfd":true,"chanel":true,"channel":true,"chase":true,"chat":true,"cheap":true,"chintai":true,"chloe":true,"christmas":true,"chrome":true,"chrysler":true,"church":true,"cipriani":true,"circle":true,"cisco":true,"citadel":true,"citi":true,"citic":true,"city":true,"cityeats":true,"claims":true,"cleaning":true,"click":true,"clinic":true,"clothing":true,"cloud":true,"club":true,"clubmed":true,"coach":true,"codes":true,"coffee":true,"college":true,"cologne":true,"comcast":true,"commbank":true,"community":true,"company":true,"computer":true,"comsec":true,"condos":true,"construction":true,"consulting":true,"contact":true,"contractors":true,"cooking":true,"cookingchannel":true,"cool":true,"corsica":true,"country":true,"coupon":true,"coupons":true,"courses":true,"credit":true,"creditcard":true,"creditunion":true,"cricket":true,"crown":true,"crs":true,"cruises":true,"csc":true,"cuisinella":true,"cymru":true,"cyou":true,"dabur":true,"dad":true,"dance":true,"date":true,"dating":true,"datsun":true,"day":true,"dclk":true,"dds":true,"deal":true,"dealer":true,"deals":true,"degree":true,"delivery":true,"dell":true,"deloitte":true,"delta":true,"democrat":true,"dental":true,"dentist":true,"desi":true,"design":true,"dev":true,"dhl":true,"diamonds":true,"diet":true,"digital":true,"direct":true,"directory":true,"discount":true,"discover":true,"dish":true,"dnp":true,"docs":true,"dodge":true,"dog":true,"doha":true,"domains":true,"doosan":true,"dot":true,"download":true,"drive":true,"dstv":true,"dtv":true,"dubai":true,"duck":true,"dunlop":true,"duns":true,"dupont":true,"durban":true,"dvag":true,"dwg":true,"earth":true,"eat":true,"edeka":true,"education":true,"email":true,"emerck":true,"emerson":true,"energy":true,"engineer":true,"engineering":true,"enterprises":true,"epost":true,"epson":true,"equipment":true,"ericsson":true,"erni":true,"esq":true,"estate":true,"esurance":true,"etisalat":true,"eurovision":true,"eus":true,"events":true,"everbank":true,"exchange":true,"expert":true,"exposed":true,"express":true,"extraspace":true,"fage":true,"fail":true,"fairwinds":true,"faith":true,"family":true,"fan":true,"fans":true,"farm":true,"farmers":true,"fashion":true,"fast":true,"fedex":true,"feedback":true,"ferrari":true,"ferrero":true,"fiat":true,"fidelity":true,"fido":true,"film":true,"final":true,"finance":true,"financial":true,"fire":true,"firestone":true,"firmdale":true,"fish":true,"fishing":true,"fit":true,"fitness":true,"flickr":true,"flights":true,"flir":true,"florist":true,"flowers":true,"flsmidth":true,"fly":true,"foo":true,"foodnetwork":true,"football":true,"ford":true,"forex":true,"forsale":true,"forum":true,"foundation":true,"fox":true,"fresenius":true,"frl":true,"frogans":true,"frontdoor":true,"frontier":true,"ftr":true,"fujitsu":true,"fujixerox":true,"fund":true,"furniture":true,"futbol":true,"fyi":true,"gal":true,"gallery":true,"gallo":true,"gallup":true,"game":true,"games":true,"gap":true,"garden":true,"gbiz":true,"gdn":true,"gea":true,"gent":true,"genting":true,"george":true,"ggee":true,"gift":true,"gifts":true,"gives":true,"giving":true,"glade":true,"glass":true,"gle":true,"global":true,"globo":true,"gmail":true,"gmo":true,"gmx":true,"godaddy":true,"gold":true,"goldpoint":true,"golf":true,"goo":true,"goodhands":true,"goodyear":true,"goog":true,"google":true,"gop":true,"got":true,"gotv":true,"grainger":true,"graphics":true,"gratis":true,"green":true,"gripe":true,"group":true,"guardian":true,"gucci":true,"guge":true,"guide":true,"guitars":true,"guru":true,"hamburg":true,"hangout":true,"haus":true,"hbo":true,"hdfc":true,"hdfcbank":true,"health":true,"healthcare":true,"help":true,"helsinki":true,"here":true,"hermes":true,"hgtv":true,"hiphop":true,"hisamitsu":true,"hitachi":true,"hiv":true,"hkt":true,"hockey":true,"holdings":true,"holiday":true,"homedepot":true,"homegoods":true,"homes":true,"homesense":true,"honda":true,"honeywell":true,"horse":true,"host":true,"hosting":true,"hot":true,"hoteles":true,"hotmail":true,"house":true,"how":true,"hsbc":true,"htc":true,"hughes":true,"hyatt":true,"hyundai":true,"ibm":true,"icbc":true,"ice":true,"icu":true,"ieee":true,"ifm":true,"iinet":true,"ikano":true,"imamat":true,"imdb":true,"immo":true,"immobilien":true,"industries":true,"infiniti":true,"ing":true,"ink":true,"institute":true,"insurance":true,"insure":true,"intel":true,"international":true,"intuit":true,"investments":true,"ipiranga":true,"irish":true,"iselect":true,"ismaili":true,"ist":true,"istanbul":true,"itau":true,"itv":true,"iveco":true,"iwc":true,"jaguar":true,"java":true,"jcb":true,"jcp":true,"jeep":true,"jetzt":true,"jewelry":true,"jio":true,"jlc":true,"jll":true,"jmp":true,"jnj":true,"joburg":true,"jot":true,"joy":true,"jpmorgan":true,"jprs":true,"juegos":true,"juniper":true,"kaufen":true,"kddi":true,"kerryhotels":true,"kerrylogistics":true,"kerryproperties":true,"kfh":true,"kia":true,"kim":true,"kinder":true,"kindle":true,"kitchen":true,"kiwi":true,"koeln":true,"komatsu":true,"kosher":true,"kpmg":true,"kpn":true,"krd":true,"kred":true,"kuokgroup":true,"kyknet":true,"kyoto":true,"lacaixa":true,"ladbrokes":true,"lamborghini":true,"lancaster":true,"lancia":true,"lancome":true,"land":true,"landrover":true,"lanxess":true,"lasalle":true,"lat":true,"latino":true,"latrobe":true,"law":true,"lawyer":true,"lds":true,"lease":true,"leclerc":true,"lefrak":true,"legal":true,"lego":true,"lexus":true,"lgbt":true,"liaison":true,"lidl":true,"life":true,"lifeinsurance":true,"lifestyle":true,"lighting":true,"like":true,"lilly":true,"limited":true,"limo":true,"lincoln":true,"linde":true,"link":true,"lipsy":true,"live":true,"living":true,"lixil":true,"loan":true,"loans":true,"locker":true,"locus":true,"loft":true,"lol":true,"london":true,"lotte":true,"lotto":true,"love":true,"lpl":true,"lplfinancial":true,"ltd":true,"ltda":true,"lundbeck":true,"lupin":true,"luxe":true,"luxury":true,"macys":true,"madrid":true,"maif":true,"maison":true,"makeup":true,"man":true,"management":true,"mango":true,"market":true,"marketing":true,"markets":true,"marriott":true,"marshalls":true,"maserati":true,"mattel":true,"mba":true,"mcd":true,"mcdonalds":true,"mckinsey":true,"med":true,"media":true,"meet":true,"melbourne":true,"meme":true,"memorial":true,"men":true,"menu":true,"meo":true,"metlife":true,"miami":true,"microsoft":true,"mini":true,"mint":true,"mit":true,"mitsubishi":true,"mlb":true,"mls":true,"mma":true,"mnet":true,"mobily":true,"moda":true,"moe":true,"moi":true,"mom":true,"monash":true,"money":true,"monster":true,"montblanc":true,"mopar":true,"mormon":true,"mortgage":true,"moscow":true,"moto":true,"motorcycles":true,"mov":true,"movie":true,"movistar":true,"msd":true,"mtn":true,"mtpc":true,"mtr":true,"multichoice":true,"mutual":true,"mutuelle":true,"mzansimagic":true,"nab":true,"nadex":true,"nagoya":true,"naspers":true,"nationwide":true,"natura":true,"navy":true,"nba":true,"nec":true,"netbank":true,"netflix":true,"network":true,"neustar":true,"new":true,"newholland":true,"news":true,"next":true,"nextdirect":true,"nexus":true,"nfl":true,"ngo":true,"nhk":true,"nico":true,"nike":true,"nikon":true,"ninja":true,"nissan":true,"nokia":true,"northwesternmutual":true,"norton":true,"now":true,"nowruz":true,"nowtv":true,"nra":true,"nrw":true,"ntt":true,"nyc":true,"obi":true,"observer":true,"off":true,"office":true,"okinawa":true,"olayan":true,"olayangroup":true,"oldnavy":true,"ollo":true,"omega":true,"one":true,"ong":true,"onl":true,"online":true,"onyourside":true,"ooo":true,"open":true,"oracle":true,"orange":true,"organic":true,"orientexpress":true,"osaka":true,"otsuka":true,"ott":true,"ovh":true,"page":true,"pamperedchef":true,"panasonic":true,"panerai":true,"paris":true,"pars":true,"partners":true,"parts":true,"party":true,"passagens":true,"pay":true,"payu":true,"pccw":true,"pet":true,"pfizer":true,"pharmacy":true,"philips":true,"photo":true,"photography":true,"photos":true,"physio":true,"piaget":true,"pics":true,"pictet":true,"pictures":true,"pid":true,"pin":true,"ping":true,"pink":true,"pioneer":true,"pizza":true,"place":true,"play":true,"playstation":true,"plumbing":true,"plus":true,"pnc":true,"pohl":true,"poker":true,"politie":true,"porn":true,"pramerica":true,"praxi":true,"press":true,"prime":true,"prod":true,"productions":true,"prof":true,"progressive":true,"promo":true,"properties":true,"property":true,"protection":true,"pru":true,"prudential":true,"pub":true,"qpon":true,"quebec":true,"quest":true,"qvc":true,"racing":true,"raid":true,"read":true,"realestate":true,"realtor":true,"realty":true,"recipes":true,"red":true,"redstone":true,"redumbrella":true,"rehab":true,"reise":true,"reisen":true,"reit":true,"reliance":true,"ren":true,"rent":true,"rentals":true,"repair":true,"report":true,"republican":true,"rest":true,"restaurant":true,"review":true,"reviews":true,"rexroth":true,"rich":true,"richardli":true,"ricoh":true,"rightathome":true,"ril":true,"rio":true,"rip":true,"rocher":true,"rocks":true,"rodeo":true,"rogers":true,"room":true,"rsvp":true,"ruhr":true,"run":true,"rwe":true,"ryukyu":true,"saarland":true,"safe":true,"safety":true,"sakura":true,"sale":true,"salon":true,"samsclub":true,"samsung":true,"sandvik":true,"sandvikcoromant":true,"sanofi":true,"sap":true,"sapo":true,"sarl":true,"sas":true,"save":true,"saxo":true,"sbi":true,"sbs":true,"sca":true,"scb":true,"schaeffler":true,"schmidt":true,"scholarships":true,"school":true,"schule":true,"schwarz":true,"science":true,"scjohnson":true,"scor":true,"scot":true,"seat":true,"secure":true,"security":true,"seek":true,"sener":true,"services":true,"ses":true,"seven":true,"sew":true,"sex":true,"sexy":true,"sfr":true,"shangrila":true,"sharp":true,"shaw":true,"shell":true,"shia":true,"shiksha":true,"shoes":true,"shouji":true,"show":true,"showtime":true,"shriram":true,"silk":true,"sina":true,"singles":true,"site":true,"ski":true,"skin":true,"sky":true,"skype":true,"sling":true,"smart":true,"smile":true,"sncf":true,"soccer":true,"social":true,"softbank":true,"software":true,"sohu":true,"solar":true,"solutions":true,"song":true,"sony":true,"soy":true,"space":true,"spiegel":true,"spot":true,"spreadbetting":true,"srl":true,"srt":true,"stada":true,"staples":true,"star":true,"starhub":true,"statebank":true,"statefarm":true,"statoil":true,"stc":true,"stcgroup":true,"stockholm":true,"storage":true,"store":true,"studio":true,"study":true,"style":true,"sucks":true,"supersport":true,"supplies":true,"supply":true,"support":true,"surf":true,"surgery":true,"suzuki":true,"swatch":true,"swiftcover":true,"swiss":true,"sydney":true,"symantec":true,"systems":true,"tab":true,"taipei":true,"talk":true,"taobao":true,"target":true,"tatamotors":true,"tatar":true,"tattoo":true,"tax":true,"taxi":true,"tci":true,"tdk":true,"team":true,"tech":true,"technology":true,"telecity":true,"telefonica":true,"temasek":true,"tennis":true,"teva":true,"thd":true,"theater":true,"theatre":true,"theguardian":true,"tiaa":true,"tickets":true,"tienda":true,"tiffany":true,"tips":true,"tires":true,"tirol":true,"tjmaxx":true,"tjx":true,"tkmaxx":true,"tmall":true,"today":true,"tokyo":true,"tools":true,"top":true,"toray":true,"toshiba":true,"total":true,"tours":true,"town":true,"toyota":true,"toys":true,"trade":true,"trading":true,"training":true,"travelchannel":true,"travelers":true,"travelersinsurance":true,"trust":true,"trv":true,"tube":true,"tui":true,"tunes":true,"tushu":true,"tvs":true,"ubank":true,"ubs":true,"uconnect":true,"university":true,"uno":true,"uol":true,"ups":true,"vacations":true,"vana":true,"vanguard":true,"vegas":true,"ventures":true,"verisign":true,"versicherung":true,"vet":true,"viajes":true,"video":true,"vig":true,"viking":true,"villas":true,"vin":true,"vip":true,"virgin":true,"visa":true,"vision":true,"vista":true,"vistaprint":true,"viva":true,"vivo":true,"vlaanderen":true,"vodka":true,"volkswagen":true,"vote":true,"voting":true,"voto":true,"voyage":true,"vuelos":true,"wales":true,"walmart":true,"walter":true,"wang":true,"wanggou":true,"warman":true,"watch":true,"watches":true,"weather":true,"weatherchannel":true,"webcam":true,"weber":true,"website":true,"wed":true,"wedding":true,"weibo":true,"weir":true,"whoswho":true,"wien":true,"wiki":true,"williamhill":true,"win":true,"windows":true,"wine":true,"winners":true,"wme":true,"wolterskluwer":true,"woodside":true,"work":true,"works":true,"world":true,"wtc":true,"wtf":true,"xbox":true,"xerox":true,"xfinity":true,"xihuan":true,"xin":true,"xn--11b4c3d":true,"xn--1ck2e1b":true,"xn--1qqw23a":true,"xn--30rr7y":true,"xn--3bst00m":true,"xn--3ds443g":true,"xn--3oq18vl8pn36a":true,"xn--3pxu8k":true,"xn--42c2d9a":true,"xn--45q11c":true,"xn--4gbrim":true,"xn--4gq48lf9j":true,"xn--55qw42g":true,"xn--55qx5d":true,"xn--5su34j936bgsg":true,"xn--5tzm5g":true,"xn--6frz82g":true,"xn--6qq986b3xl":true,"xn--80adxhks":true,"xn--80asehdb":true,"xn--80aswg":true,"xn--8y0a063a":true,"xn--9dbq2a":true,"xn--9et52u":true,"xn--9krt00a":true,"xn--b4w605ferd":true,"xn--bck1b9a5dre4c":true,"xn--c1avg":true,"xn--c2br7g":true,"xn--cck2b3b":true,"xn--cg4bki":true,"xn--czr694b":true,"xn--czrs0t":true,"xn--czru2d":true,"xn--d1acj3b":true,"xn--eckvdtc9d":true,"xn--efvy88h":true,"xn--estv75g":true,"xn--fct429k":true,"xn--fhbei":true,"xn--fiq228c5hs":true,"xn--fiq64b":true,"xn--fjq720a":true,"xn--flw351e":true,"xn--fzys8d69uvgm":true,"xn--g2xx48c":true,"xn--gckr3f0f":true,"xn--hxt814e":true,"xn--i1b6b1a6a2e":true,"xn--imr513n":true,"xn--io0a7i":true,"xn--j1aef":true,"xn--jlq61u9w7b":true,"xn--jvr189m":true,"xn--kcrx77d1x4a":true,"xn--kpu716f":true,"xn--kput3i":true,"xn--mgba3a3ejt":true,"xn--mgba7c0bbn0a":true,"xn--mgbaakc7dvf":true,"xn--mgbab2bd":true,"xn--mgbb9fbpob":true,"xn--mgbca7dzdo":true,"xn--mgbt3dhd":true,"xn--mk1bu44c":true,"xn--mxtq1m":true,"xn--ngbc5azd":true,"xn--ngbe9e0a":true,"xn--nqv7f":true,"xn--nqv7fs00ema":true,"xn--nyqy26a":true,"xn--p1acf":true,"xn--pbt977c":true,"xn--pssy2u":true,"xn--q9jyb4c":true,"xn--qcka1pmc":true,"xn--rhqv96g":true,"xn--rovu88b":true,"xn--ses554g":true,"xn--t60b56a":true,"xn--tckwe":true,"xn--unup4y":true,"xn--vermgensberater-ctb":true,"xn--vermgensberatung-pwb":true,"xn--vhquv":true,"xn--vuq861b":true,"xn--w4r85el8fhu5dnra":true,"xn--w4rs40l":true,"xn--xhq521b":true,"xn--zfr164b":true,"xperia":true,"xyz":true,"yachts":true,"yahoo":true,"yamaxun":true,"yandex":true,"yodobashi":true,"yoga":true,"yokohama":true,"you":true,"youtube":true,"yun":true,"zappos":true,"zara":true,"zero":true,"zip":true,"zippo":true,"zone":true,"zuerich":true,"cloudfront.net":true,"ap-northeast-1.compute.amazonaws.com":true,"ap-southeast-1.compute.amazonaws.com":true,"ap-southeast-2.compute.amazonaws.com":true,"cn-north-1.compute.amazonaws.cn":true,"compute.amazonaws.cn":true,"compute.amazonaws.com":true,"compute-1.amazonaws.com":true,"eu-west-1.compute.amazonaws.com":true,"eu-central-1.compute.amazonaws.com":true,"sa-east-1.compute.amazonaws.com":true,"us-east-1.amazonaws.com":true,"us-gov-west-1.compute.amazonaws.com":true,"us-west-1.compute.amazonaws.com":true,"us-west-2.compute.amazonaws.com":true,"z-1.compute-1.amazonaws.com":true,"z-2.compute-1.amazonaws.com":true,"elasticbeanstalk.com":true,"elb.amazonaws.com":true,"s3.amazonaws.com":true,"s3-ap-northeast-1.amazonaws.com":true,"s3-ap-southeast-1.amazonaws.com":true,"s3-ap-southeast-2.amazonaws.com":true,"s3-external-1.amazonaws.com":true,"s3-external-2.amazonaws.com":true,"s3-fips-us-gov-west-1.amazonaws.com":true,"s3-eu-central-1.amazonaws.com":true,"s3-eu-west-1.amazonaws.com":true,"s3-sa-east-1.amazonaws.com":true,"s3-us-gov-west-1.amazonaws.com":true,"s3-us-west-1.amazonaws.com":true,"s3-us-west-2.amazonaws.com":true,"s3.cn-north-1.amazonaws.com.cn":true,"s3.eu-central-1.amazonaws.com":true,"betainabox.com":true,"ae.org":true,"ar.com":true,"br.com":true,"cn.com":true,"com.de":true,"com.se":true,"de.com":true,"eu.com":true,"gb.com":true,"gb.net":true,"hu.com":true,"hu.net":true,"jp.net":true,"jpn.com":true,"kr.com":true,"mex.com":true,"no.com":true,"qc.com":true,"ru.com":true,"sa.com":true,"se.com":true,"se.net":true,"uk.com":true,"uk.net":true,"us.com":true,"uy.com":true,"za.bz":true,"za.com":true,"africa.com":true,"gr.com":true,"in.net":true,"us.org":true,"co.com":true,"c.la":true,"cloudcontrolled.com":true,"cloudcontrolapp.com":true,"co.ca":true,"c.cdn77.org":true,"cdn77-ssl.net":true,"r.cdn77.net":true,"rsc.cdn77.org":true,"ssl.origin.cdn77-secure.org":true,"co.nl":true,"co.no":true,"*.platform.sh":true,"cupcake.is":true,"dreamhosters.com":true,"duckdns.org":true,"dyndns-at-home.com":true,"dyndns-at-work.com":true,"dyndns-blog.com":true,"dyndns-free.com":true,"dyndns-home.com":true,"dyndns-ip.com":true,"dyndns-mail.com":true,"dyndns-office.com":true,"dyndns-pics.com":true,"dyndns-remote.com":true,"dyndns-server.com":true,"dyndns-web.com":true,"dyndns-wiki.com":true,"dyndns-work.com":true,"dyndns.biz":true,"dyndns.info":true,"dyndns.org":true,"dyndns.tv":true,"at-band-camp.net":true,"ath.cx":true,"barrel-of-knowledge.info":true,"barrell-of-knowledge.info":true,"better-than.tv":true,"blogdns.com":true,"blogdns.net":true,"blogdns.org":true,"blogsite.org":true,"boldlygoingnowhere.org":true,"broke-it.net":true,"buyshouses.net":true,"cechire.com":true,"dnsalias.com":true,"dnsalias.net":true,"dnsalias.org":true,"dnsdojo.com":true,"dnsdojo.net":true,"dnsdojo.org":true,"does-it.net":true,"doesntexist.com":true,"doesntexist.org":true,"dontexist.com":true,"dontexist.net":true,"dontexist.org":true,"doomdns.com":true,"doomdns.org":true,"dvrdns.org":true,"dyn-o-saur.com":true,"dynalias.com":true,"dynalias.net":true,"dynalias.org":true,"dynathome.net":true,"dyndns.ws":true,"endofinternet.net":true,"endofinternet.org":true,"endoftheinternet.org":true,"est-a-la-maison.com":true,"est-a-la-masion.com":true,"est-le-patron.com":true,"est-mon-blogueur.com":true,"for-better.biz":true,"for-more.biz":true,"for-our.info":true,"for-some.biz":true,"for-the.biz":true,"forgot.her.name":true,"forgot.his.name":true,"from-ak.com":true,"from-al.com":true,"from-ar.com":true,"from-az.net":true,"from-ca.com":true,"from-co.net":true,"from-ct.com":true,"from-dc.com":true,"from-de.com":true,"from-fl.com":true,"from-ga.com":true,"from-hi.com":true,"from-ia.com":true,"from-id.com":true,"from-il.com":true,"from-in.com":true,"from-ks.com":true,"from-ky.com":true,"from-la.net":true,"from-ma.com":true,"from-md.com":true,"from-me.org":true,"from-mi.com":true,"from-mn.com":true,"from-mo.com":true,"from-ms.com":true,"from-mt.com":true,"from-nc.com":true,"from-nd.com":true,"from-ne.com":true,"from-nh.com":true,"from-nj.com":true,"from-nm.com":true,"from-nv.com":true,"from-ny.net":true,"from-oh.com":true,"from-ok.com":true,"from-or.com":true,"from-pa.com":true,"from-pr.com":true,"from-ri.com":true,"from-sc.com":true,"from-sd.com":true,"from-tn.com":true,"from-tx.com":true,"from-ut.com":true,"from-va.com":true,"from-vt.com":true,"from-wa.com":true,"from-wi.com":true,"from-wv.com":true,"from-wy.com":true,"ftpaccess.cc":true,"fuettertdasnetz.de":true,"game-host.org":true,"game-server.cc":true,"getmyip.com":true,"gets-it.net":true,"go.dyndns.org":true,"gotdns.com":true,"gotdns.org":true,"groks-the.info":true,"groks-this.info":true,"ham-radio-op.net":true,"here-for-more.info":true,"hobby-site.com":true,"hobby-site.org":true,"home.dyndns.org":true,"homedns.org":true,"homeftp.net":true,"homeftp.org":true,"homeip.net":true,"homelinux.com":true,"homelinux.net":true,"homelinux.org":true,"homeunix.com":true,"homeunix.net":true,"homeunix.org":true,"iamallama.com":true,"in-the-band.net":true,"is-a-anarchist.com":true,"is-a-blogger.com":true,"is-a-bookkeeper.com":true,"is-a-bruinsfan.org":true,"is-a-bulls-fan.com":true,"is-a-candidate.org":true,"is-a-caterer.com":true,"is-a-celticsfan.org":true,"is-a-chef.com":true,"is-a-chef.net":true,"is-a-chef.org":true,"is-a-conservative.com":true,"is-a-cpa.com":true,"is-a-cubicle-slave.com":true,"is-a-democrat.com":true,"is-a-designer.com":true,"is-a-doctor.com":true,"is-a-financialadvisor.com":true,"is-a-geek.com":true,"is-a-geek.net":true,"is-a-geek.org":true,"is-a-green.com":true,"is-a-guru.com":true,"is-a-hard-worker.com":true,"is-a-hunter.com":true,"is-a-knight.org":true,"is-a-landscaper.com":true,"is-a-lawyer.com":true,"is-a-liberal.com":true,"is-a-libertarian.com":true,"is-a-linux-user.org":true,"is-a-llama.com":true,"is-a-musician.com":true,"is-a-nascarfan.com":true,"is-a-nurse.com":true,"is-a-painter.com":true,"is-a-patsfan.org":true,"is-a-personaltrainer.com":true,"is-a-photographer.com":true,"is-a-player.com":true,"is-a-republican.com":true,"is-a-rockstar.com":true,"is-a-socialist.com":true,"is-a-soxfan.org":true,"is-a-student.com":true,"is-a-teacher.com":true,"is-a-techie.com":true,"is-a-therapist.com":true,"is-an-accountant.com":true,"is-an-actor.com":true,"is-an-actress.com":true,"is-an-anarchist.com":true,"is-an-artist.com":true,"is-an-engineer.com":true,"is-an-entertainer.com":true,"is-by.us":true,"is-certified.com":true,"is-found.org":true,"is-gone.com":true,"is-into-anime.com":true,"is-into-cars.com":true,"is-into-cartoons.com":true,"is-into-games.com":true,"is-leet.com":true,"is-lost.org":true,"is-not-certified.com":true,"is-saved.org":true,"is-slick.com":true,"is-uberleet.com":true,"is-very-bad.org":true,"is-very-evil.org":true,"is-very-good.org":true,"is-very-nice.org":true,"is-very-sweet.org":true,"is-with-theband.com":true,"isa-geek.com":true,"isa-geek.net":true,"isa-geek.org":true,"isa-hockeynut.com":true,"issmarterthanyou.com":true,"isteingeek.de":true,"istmein.de":true,"kicks-ass.net":true,"kicks-ass.org":true,"knowsitall.info":true,"land-4-sale.us":true,"lebtimnetz.de":true,"leitungsen.de":true,"likes-pie.com":true,"likescandy.com":true,"merseine.nu":true,"mine.nu":true,"misconfused.org":true,"mypets.ws":true,"myphotos.cc":true,"neat-url.com":true,"office-on-the.net":true,"on-the-web.tv":true,"podzone.net":true,"podzone.org":true,"readmyblog.org":true,"saves-the-whales.com":true,"scrapper-site.net":true,"scrapping.cc":true,"selfip.biz":true,"selfip.com":true,"selfip.info":true,"selfip.net":true,"selfip.org":true,"sells-for-less.com":true,"sells-for-u.com":true,"sells-it.net":true,"sellsyourhome.org":true,"servebbs.com":true,"servebbs.net":true,"servebbs.org":true,"serveftp.net":true,"serveftp.org":true,"servegame.org":true,"shacknet.nu":true,"simple-url.com":true,"space-to-rent.com":true,"stuff-4-sale.org":true,"stuff-4-sale.us":true,"teaches-yoga.com":true,"thruhere.net":true,"traeumtgerade.de":true,"webhop.biz":true,"webhop.info":true,"webhop.net":true,"webhop.org":true,"worse-than.tv":true,"writesthisblog.com":true,"eu.org":true,"al.eu.org":true,"asso.eu.org":true,"at.eu.org":true,"au.eu.org":true,"be.eu.org":true,"bg.eu.org":true,"ca.eu.org":true,"cd.eu.org":true,"ch.eu.org":true,"cn.eu.org":true,"cy.eu.org":true,"cz.eu.org":true,"de.eu.org":true,"dk.eu.org":true,"edu.eu.org":true,"ee.eu.org":true,"es.eu.org":true,"fi.eu.org":true,"fr.eu.org":true,"gr.eu.org":true,"hr.eu.org":true,"hu.eu.org":true,"ie.eu.org":true,"il.eu.org":true,"in.eu.org":true,"int.eu.org":true,"is.eu.org":true,"it.eu.org":true,"jp.eu.org":true,"kr.eu.org":true,"lt.eu.org":true,"lu.eu.org":true,"lv.eu.org":true,"mc.eu.org":true,"me.eu.org":true,"mk.eu.org":true,"mt.eu.org":true,"my.eu.org":true,"net.eu.org":true,"ng.eu.org":true,"nl.eu.org":true,"no.eu.org":true,"nz.eu.org":true,"paris.eu.org":true,"pl.eu.org":true,"pt.eu.org":true,"q-a.eu.org":true,"ro.eu.org":true,"ru.eu.org":true,"se.eu.org":true,"si.eu.org":true,"sk.eu.org":true,"tr.eu.org":true,"uk.eu.org":true,"us.eu.org":true,"a.ssl.fastly.net":true,"b.ssl.fastly.net":true,"global.ssl.fastly.net":true,"a.prod.fastly.net":true,"global.prod.fastly.net":true,"firebaseapp.com":true,"flynnhub.com":true,"service.gov.uk":true,"github.io":true,"githubusercontent.com":true,"ro.com":true,"appspot.com":true,"blogspot.ae":true,"blogspot.al":true,"blogspot.am":true,"blogspot.ba":true,"blogspot.be":true,"blogspot.bg":true,"blogspot.bj":true,"blogspot.ca":true,"blogspot.cf":true,"blogspot.ch":true,"blogspot.cl":true,"blogspot.co.at":true,"blogspot.co.id":true,"blogspot.co.il":true,"blogspot.co.ke":true,"blogspot.co.nz":true,"blogspot.co.uk":true,"blogspot.co.za":true,"blogspot.com":true,"blogspot.com.ar":true,"blogspot.com.au":true,"blogspot.com.br":true,"blogspot.com.by":true,"blogspot.com.co":true,"blogspot.com.cy":true,"blogspot.com.ee":true,"blogspot.com.eg":true,"blogspot.com.es":true,"blogspot.com.mt":true,"blogspot.com.ng":true,"blogspot.com.tr":true,"blogspot.com.uy":true,"blogspot.cv":true,"blogspot.cz":true,"blogspot.de":true,"blogspot.dk":true,"blogspot.fi":true,"blogspot.fr":true,"blogspot.gr":true,"blogspot.hk":true,"blogspot.hr":true,"blogspot.hu":true,"blogspot.ie":true,"blogspot.in":true,"blogspot.is":true,"blogspot.it":true,"blogspot.jp":true,"blogspot.kr":true,"blogspot.li":true,"blogspot.lt":true,"blogspot.lu":true,"blogspot.md":true,"blogspot.mk":true,"blogspot.mr":true,"blogspot.mx":true,"blogspot.my":true,"blogspot.nl":true,"blogspot.no":true,"blogspot.pe":true,"blogspot.pt":true,"blogspot.qa":true,"blogspot.re":true,"blogspot.ro":true,"blogspot.rs":true,"blogspot.ru":true,"blogspot.se":true,"blogspot.sg":true,"blogspot.si":true,"blogspot.sk":true,"blogspot.sn":true,"blogspot.td":true,"blogspot.tw":true,"blogspot.ug":true,"blogspot.vn":true,"codespot.com":true,"googleapis.com":true,"googlecode.com":true,"pagespeedmobilizer.com":true,"withgoogle.com":true,"withyoutube.com":true,"herokuapp.com":true,"herokussl.com":true,"iki.fi":true,"biz.at":true,"info.at":true,"co.pl":true,"azurewebsites.net":true,"azure-mobile.net":true,"cloudapp.net":true,"bmoattachments.org":true,"4u.com":true,"nfshost.com":true,"nyc.mn":true,"nid.io":true,"operaunite.com":true,"outsystemscloud.com":true,"art.pl":true,"gliwice.pl":true,"krakow.pl":true,"poznan.pl":true,"wroc.pl":true,"zakopane.pl":true,"pantheon.io":true,"gotpantheon.com":true,"priv.at":true,"qa2.com":true,"rhcloud.com":true,"sandcats.io":true,"biz.ua":true,"co.ua":true,"pp.ua":true,"sinaapp.com":true,"vipsinaapp.com":true,"1kapp.com":true,"gda.pl":true,"gdansk.pl":true,"gdynia.pl":true,"med.pl":true,"sopot.pl":true,"hk.com":true,"hk.org":true,"ltd.hk":true,"inc.hk":true,"yolasite.com":true,"za.net":true,"za.org":true}); - -// END of automatically generated file diff --git a/APIs/node_modules/request/node_modules/tough-cookie/lib/store.js b/APIs/node_modules/request/node_modules/tough-cookie/lib/store.js deleted file mode 100644 index bce52925..00000000 --- a/APIs/node_modules/request/node_modules/tough-cookie/lib/store.js +++ /dev/null @@ -1,71 +0,0 @@ -/*! - * Copyright (c) 2015, Salesforce.com, Inc. - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * 3. Neither the name of Salesforce.com nor the names of its contributors may - * be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ -'use strict'; -/*jshint unused:false */ - -function Store() { -} -exports.Store = Store; - -// Stores may be synchronous, but are still required to use a -// Continuation-Passing Style API. The CookieJar itself will expose a "*Sync" -// API that converts from synchronous-callbacks to imperative style. -Store.prototype.synchronous = false; - -Store.prototype.findCookie = function(domain, path, key, cb) { - throw new Error('findCookie is not implemented'); -}; - -Store.prototype.findCookies = function(domain, path, cb) { - throw new Error('findCookies is not implemented'); -}; - -Store.prototype.putCookie = function(cookie, cb) { - throw new Error('putCookie is not implemented'); -}; - -Store.prototype.updateCookie = function(oldCookie, newCookie, cb) { - // recommended default implementation: - // return this.putCookie(newCookie, cb); - throw new Error('updateCookie is not implemented'); -}; - -Store.prototype.removeCookie = function(domain, path, key, cb) { - throw new Error('removeCookie is not implemented'); -}; - -Store.prototype.removeCookies = function(domain, path, cb) { - throw new Error('removeCookies is not implemented'); -}; - -Store.prototype.getAllCookies = function(cb) { - throw new Error('getAllCookies is not implemented (therefore jar cannot be serialized)'); -}; diff --git a/APIs/node_modules/request/node_modules/tough-cookie/package.json b/APIs/node_modules/request/node_modules/tough-cookie/package.json deleted file mode 100644 index 2fd82025..00000000 --- a/APIs/node_modules/request/node_modules/tough-cookie/package.json +++ /dev/null @@ -1,93 +0,0 @@ -{ - "author": { - "name": "Jeremy Stashewsky", - "email": "jstashewsky@salesforce.com" - }, - "contributors": [ - { - "name": "Alexander Savin" - }, - { - "name": "Ian Livingstone" - }, - { - "name": "Ivan Nikulin" - }, - { - "name": "Lalit Kapoor" - }, - { - "name": "Sam Thompson" - }, - { - "name": "Sebastian Mayr" - } - ], - "license": "BSD-3-Clause", - "name": "tough-cookie", - "description": "RFC6265 Cookies and Cookie Jar for node.js", - "keywords": [ - "HTTP", - "cookie", - "cookies", - "set-cookie", - "cookiejar", - "jar", - "RFC6265", - "RFC2965" - ], - "version": "2.2.2", - "homepage": "https://github.com/SalesforceEng/tough-cookie", - "repository": { - "type": "git", - "url": "git://github.com/SalesforceEng/tough-cookie.git" - }, - "bugs": { - "url": "https://github.com/SalesforceEng/tough-cookie/issues" - }, - "main": "./lib/cookie", - "files": [ - "lib" - ], - "scripts": { - "suffixup": "curl -o public_suffix_list.dat https://publicsuffix.org/list/public_suffix_list.dat && ./generate-pubsuffix.js", - "test": "vows test/*_test.js" - }, - "engines": { - "node": ">=0.10.0" - }, - "devDependencies": { - "async": "^1.4.2", - "vows": "^0.8.1" - }, - "gitHead": "cc46628c4d7d2e8c372ecba29293ca8a207ec192", - "_id": "tough-cookie@2.2.2", - "_shasum": "c83a1830f4e5ef0b93ef2a3488e724f8de016ac7", - "_from": "tough-cookie@~2.2.0", - "_npmVersion": "3.3.12", - "_nodeVersion": "5.1.1", - "_npmUser": { - "name": "jstash", - "email": "jstash@gmail.com" - }, - "dist": { - "shasum": "c83a1830f4e5ef0b93ef2a3488e724f8de016ac7", - "tarball": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.2.tgz" - }, - "maintainers": [ - { - "name": "jstash", - "email": "jeremy@goinstant.com" - }, - { - "name": "goinstant", - "email": "services@goinstant.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-13-west.internal.npmjs.com", - "tmp": "tmp/tough-cookie-2.2.2.tgz_1457564639182_0.5129188685677946" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.2.tgz" -} diff --git a/APIs/node_modules/request/node_modules/tunnel-agent/LICENSE b/APIs/node_modules/request/node_modules/tunnel-agent/LICENSE deleted file mode 100644 index a4a9aee0..00000000 --- a/APIs/node_modules/request/node_modules/tunnel-agent/LICENSE +++ /dev/null @@ -1,55 +0,0 @@ -Apache License - -Version 2.0, January 2004 - -http://www.apache.org/licenses/ - -TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - -1. Definitions. - -"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document. - -"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License. - -"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity. - -"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License. - -"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files. - -"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types. - -"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below). - -"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof. - -"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution." - -"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work. - -2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form. - -3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed. - -4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions: - -You must give any other recipients of the Work or Derivative Works a copy of this License; and - -You must cause any modified files to carry prominent notices stating that You changed the files; and - -You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and - -If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License. - -5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions. - -6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file. - -7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License. - -8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages. - -9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability. - -END OF TERMS AND CONDITIONS \ No newline at end of file diff --git a/APIs/node_modules/request/node_modules/tunnel-agent/README.md b/APIs/node_modules/request/node_modules/tunnel-agent/README.md deleted file mode 100644 index bb533d56..00000000 --- a/APIs/node_modules/request/node_modules/tunnel-agent/README.md +++ /dev/null @@ -1,4 +0,0 @@ -tunnel-agent -============ - -HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module. diff --git a/APIs/node_modules/request/node_modules/tunnel-agent/index.js b/APIs/node_modules/request/node_modules/tunnel-agent/index.js deleted file mode 100644 index 68013ac1..00000000 --- a/APIs/node_modules/request/node_modules/tunnel-agent/index.js +++ /dev/null @@ -1,243 +0,0 @@ -'use strict' - -var net = require('net') - , tls = require('tls') - , http = require('http') - , https = require('https') - , events = require('events') - , assert = require('assert') - , util = require('util') - ; - -exports.httpOverHttp = httpOverHttp -exports.httpsOverHttp = httpsOverHttp -exports.httpOverHttps = httpOverHttps -exports.httpsOverHttps = httpsOverHttps - - -function httpOverHttp(options) { - var agent = new TunnelingAgent(options) - agent.request = http.request - return agent -} - -function httpsOverHttp(options) { - var agent = new TunnelingAgent(options) - agent.request = http.request - agent.createSocket = createSecureSocket - agent.defaultPort = 443 - return agent -} - -function httpOverHttps(options) { - var agent = new TunnelingAgent(options) - agent.request = https.request - return agent -} - -function httpsOverHttps(options) { - var agent = new TunnelingAgent(options) - agent.request = https.request - agent.createSocket = createSecureSocket - agent.defaultPort = 443 - return agent -} - - -function TunnelingAgent(options) { - var self = this - self.options = options || {} - self.proxyOptions = self.options.proxy || {} - self.maxSockets = self.options.maxSockets || http.Agent.defaultMaxSockets - self.requests = [] - self.sockets = [] - - self.on('free', function onFree(socket, host, port) { - for (var i = 0, len = self.requests.length; i < len; ++i) { - var pending = self.requests[i] - if (pending.host === host && pending.port === port) { - // Detect the request to connect same origin server, - // reuse the connection. - self.requests.splice(i, 1) - pending.request.onSocket(socket) - return - } - } - socket.destroy() - self.removeSocket(socket) - }) -} -util.inherits(TunnelingAgent, events.EventEmitter) - -TunnelingAgent.prototype.addRequest = function addRequest(req, options) { - var self = this - - // Legacy API: addRequest(req, host, port, path) - if (typeof options === 'string') { - options = { - host: options, - port: arguments[2], - path: arguments[3] - }; - } - - if (self.sockets.length >= this.maxSockets) { - // We are over limit so we'll add it to the queue. - self.requests.push({host: options.host, port: options.port, request: req}) - return - } - - // If we are under maxSockets create a new one. - self.createConnection({host: options.host, port: options.port, request: req}) -} - -TunnelingAgent.prototype.createConnection = function createConnection(pending) { - var self = this - - self.createSocket(pending, function(socket) { - socket.on('free', onFree) - socket.on('close', onCloseOrRemove) - socket.on('agentRemove', onCloseOrRemove) - pending.request.onSocket(socket) - - function onFree() { - self.emit('free', socket, pending.host, pending.port) - } - - function onCloseOrRemove(err) { - self.removeSocket(socket) - socket.removeListener('free', onFree) - socket.removeListener('close', onCloseOrRemove) - socket.removeListener('agentRemove', onCloseOrRemove) - } - }) -} - -TunnelingAgent.prototype.createSocket = function createSocket(options, cb) { - var self = this - var placeholder = {} - self.sockets.push(placeholder) - - var connectOptions = mergeOptions({}, self.proxyOptions, - { method: 'CONNECT' - , path: options.host + ':' + options.port - , agent: false - } - ) - if (connectOptions.proxyAuth) { - connectOptions.headers = connectOptions.headers || {} - connectOptions.headers['Proxy-Authorization'] = 'Basic ' + - new Buffer(connectOptions.proxyAuth).toString('base64') - } - - debug('making CONNECT request') - var connectReq = self.request(connectOptions) - connectReq.useChunkedEncodingByDefault = false // for v0.6 - connectReq.once('response', onResponse) // for v0.6 - connectReq.once('upgrade', onUpgrade) // for v0.6 - connectReq.once('connect', onConnect) // for v0.7 or later - connectReq.once('error', onError) - connectReq.end() - - function onResponse(res) { - // Very hacky. This is necessary to avoid http-parser leaks. - res.upgrade = true - } - - function onUpgrade(res, socket, head) { - // Hacky. - process.nextTick(function() { - onConnect(res, socket, head) - }) - } - - function onConnect(res, socket, head) { - connectReq.removeAllListeners() - socket.removeAllListeners() - - if (res.statusCode === 200) { - assert.equal(head.length, 0) - debug('tunneling connection has established') - self.sockets[self.sockets.indexOf(placeholder)] = socket - cb(socket) - } else { - debug('tunneling socket could not be established, statusCode=%d', res.statusCode) - var error = new Error('tunneling socket could not be established, ' + 'statusCode=' + res.statusCode) - error.code = 'ECONNRESET' - options.request.emit('error', error) - self.removeSocket(placeholder) - } - } - - function onError(cause) { - connectReq.removeAllListeners() - - debug('tunneling socket could not be established, cause=%s\n', cause.message, cause.stack) - var error = new Error('tunneling socket could not be established, ' + 'cause=' + cause.message) - error.code = 'ECONNRESET' - options.request.emit('error', error) - self.removeSocket(placeholder) - } -} - -TunnelingAgent.prototype.removeSocket = function removeSocket(socket) { - var pos = this.sockets.indexOf(socket) - if (pos === -1) return - - this.sockets.splice(pos, 1) - - var pending = this.requests.shift() - if (pending) { - // If we have pending requests and a socket gets closed a new one - // needs to be created to take over in the pool for the one that closed. - this.createConnection(pending) - } -} - -function createSecureSocket(options, cb) { - var self = this - TunnelingAgent.prototype.createSocket.call(self, options, function(socket) { - // 0 is dummy port for v0.6 - var secureSocket = tls.connect(0, mergeOptions({}, self.options, - { servername: options.host - , socket: socket - } - )) - self.sockets[self.sockets.indexOf(socket)] = secureSocket - cb(secureSocket) - }) -} - - -function mergeOptions(target) { - for (var i = 1, len = arguments.length; i < len; ++i) { - var overrides = arguments[i] - if (typeof overrides === 'object') { - var keys = Object.keys(overrides) - for (var j = 0, keyLen = keys.length; j < keyLen; ++j) { - var k = keys[j] - if (overrides[k] !== undefined) { - target[k] = overrides[k] - } - } - } - } - return target -} - - -var debug -if (process.env.NODE_DEBUG && /\btunnel\b/.test(process.env.NODE_DEBUG)) { - debug = function() { - var args = Array.prototype.slice.call(arguments) - if (typeof args[0] === 'string') { - args[0] = 'TUNNEL: ' + args[0] - } else { - args.unshift('TUNNEL:') - } - console.error.apply(console, args) - } -} else { - debug = function() {} -} -exports.debug = debug // for test diff --git a/APIs/node_modules/request/node_modules/tunnel-agent/package.json b/APIs/node_modules/request/node_modules/tunnel-agent/package.json deleted file mode 100644 index b8a7f58f..00000000 --- a/APIs/node_modules/request/node_modules/tunnel-agent/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com", - "url": "http://www.futurealoof.com" - }, - "name": "tunnel-agent", - "license": "Apache-2.0", - "description": "HTTP proxy tunneling agent. Formerly part of mikeal/request, now a standalone module.", - "version": "0.4.3", - "repository": { - "url": "git+https://github.com/mikeal/tunnel-agent.git" - }, - "main": "index.js", - "files": [ - "index.js" - ], - "dependencies": {}, - "devDependencies": {}, - "optionalDependencies": {}, - "engines": { - "node": "*" - }, - "gitHead": "e72d830f5ed388a2a71d37ce062c38e3fb34bdde", - "bugs": { - "url": "https://github.com/mikeal/tunnel-agent/issues" - }, - "homepage": "https://github.com/mikeal/tunnel-agent#readme", - "_id": "tunnel-agent@0.4.3", - "scripts": {}, - "_shasum": "6373db76909fe570e08d73583365ed828a74eeeb", - "_from": "tunnel-agent@~0.4.1", - "_npmVersion": "2.15.3", - "_nodeVersion": "5.9.0", - "_npmUser": { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - }, - "dist": { - "shasum": "6373db76909fe570e08d73583365ed828a74eeeb", - "tarball": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - { - "name": "nylen", - "email": "jnylen@gmail.com" - }, - { - "name": "fredkschott", - "email": "fkschott@gmail.com" - }, - { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-16-east.internal.npmjs.com", - "tmp": "tmp/tunnel-agent-0.4.3.tgz_1462396470295_0.23639482469297945" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.3.tgz" -} diff --git a/APIs/node_modules/request/package.json b/APIs/node_modules/request/package.json deleted file mode 100644 index 6309f943..00000000 --- a/APIs/node_modules/request/package.json +++ /dev/null @@ -1,118 +0,0 @@ -{ - "name": "request", - "description": "Simplified HTTP request client.", - "tags": [ - "http", - "simple", - "util", - "utility" - ], - "version": "2.72.0", - "author": { - "name": "Mikeal Rogers", - "email": "mikeal.rogers@gmail.com" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/request/request.git" - }, - "bugs": { - "url": "http://github.com/request/request/issues" - }, - "license": "Apache-2.0", - "engines": { - "node": ">=0.8.0" - }, - "main": "index.js", - "dependencies": { - "aws-sign2": "~0.6.0", - "aws4": "^1.2.1", - "bl": "~1.1.2", - "caseless": "~0.11.0", - "combined-stream": "~1.0.5", - "extend": "~3.0.0", - "forever-agent": "~0.6.1", - "form-data": "~1.0.0-rc3", - "har-validator": "~2.0.6", - "hawk": "~3.1.3", - "http-signature": "~1.1.0", - "is-typedarray": "~1.0.0", - "isstream": "~0.1.2", - "json-stringify-safe": "~5.0.1", - "mime-types": "~2.1.7", - "node-uuid": "~1.4.7", - "oauth-sign": "~0.8.1", - "qs": "~6.1.0", - "stringstream": "~0.0.4", - "tough-cookie": "~2.2.0", - "tunnel-agent": "~0.4.1" - }, - "scripts": { - "test": "npm run lint && npm run test-ci && npm run test-browser", - "test-ci": "taper tests/test-*.js", - "test-cov": "istanbul cover tape tests/test-*.js", - "test-browser": "node tests/browser/start.js", - "lint": "eslint lib/ *.js tests/ && echo Lint passed." - }, - "devDependencies": { - "bluebird": "^3.2.1", - "browserify": "^12.0.2", - "browserify-istanbul": "^2.0.0", - "buffer-equal": "^1.0.0", - "codecov.io": "^0.1.6", - "coveralls": "^2.11.4", - "eslint": "^2.5.3", - "function-bind": "^1.0.2", - "istanbul": "^0.4.0", - "karma": "^0.13.10", - "karma-browserify": "^5.0.1", - "karma-cli": "^0.1.1", - "karma-coverage": "^0.5.3", - "karma-phantomjs-launcher": "^1.0.0", - "karma-tap": "^1.0.3", - "phantomjs-prebuilt": "^2.1.3", - "rimraf": "^2.2.8", - "server-destroy": "^1.0.1", - "tape": "^4.2.0", - "taper": "^0.4.0" - }, - "gitHead": "6dcac13642955577592fdafb5ff3cdc8a6ff1b1b", - "homepage": "https://github.com/request/request#readme", - "_id": "request@2.72.0", - "_shasum": "0ce3a179512620b10441f14c82e21c12c0ddb4e1", - "_from": "request@", - "_npmVersion": "3.8.5", - "_nodeVersion": "5.9.0", - "_npmUser": { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - }, - "dist": { - "shasum": "0ce3a179512620b10441f14c82e21c12c0ddb4e1", - "tarball": "https://registry.npmjs.org/request/-/request-2.72.0.tgz" - }, - "maintainers": [ - { - "name": "mikeal", - "email": "mikeal.rogers@gmail.com" - }, - { - "name": "nylen", - "email": "jnylen@gmail.com" - }, - { - "name": "fredkschott", - "email": "fkschott@gmail.com" - }, - { - "name": "simov", - "email": "simeonvelichkov@gmail.com" - } - ], - "_npmOperationalInternal": { - "host": "packages-12-west.internal.npmjs.com", - "tmp": "tmp/request-2.72.0.tgz_1460901215210_0.9173020373564214" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/request/-/request-2.72.0.tgz" -} diff --git a/APIs/node_modules/request/request.js b/APIs/node_modules/request/request.js deleted file mode 100644 index 124157e8..00000000 --- a/APIs/node_modules/request/request.js +++ /dev/null @@ -1,1458 +0,0 @@ -'use strict' - -var http = require('http') - , https = require('https') - , url = require('url') - , util = require('util') - , stream = require('stream') - , zlib = require('zlib') - , bl = require('bl') - , hawk = require('hawk') - , aws2 = require('aws-sign2') - , httpSignature = require('http-signature') - , mime = require('mime-types') - , stringstream = require('stringstream') - , caseless = require('caseless') - , ForeverAgent = require('forever-agent') - , FormData = require('form-data') - , extend = require('extend') - , isstream = require('isstream') - , isTypedArray = require('is-typedarray').strict - , helpers = require('./lib/helpers') - , cookies = require('./lib/cookies') - , getProxyFromURI = require('./lib/getProxyFromURI') - , Querystring = require('./lib/querystring').Querystring - , Har = require('./lib/har').Har - , Auth = require('./lib/auth').Auth - , OAuth = require('./lib/oauth').OAuth - , Multipart = require('./lib/multipart').Multipart - , Redirect = require('./lib/redirect').Redirect - , Tunnel = require('./lib/tunnel').Tunnel - -var safeStringify = helpers.safeStringify - , isReadStream = helpers.isReadStream - , toBase64 = helpers.toBase64 - , defer = helpers.defer - , copy = helpers.copy - , version = helpers.version - , globalCookieJar = cookies.jar() - - -var globalPool = {} - -function filterForNonReserved(reserved, options) { - // Filter out properties that are not reserved. - // Reserved values are passed in at call site. - - var object = {} - for (var i in options) { - var notReserved = (reserved.indexOf(i) === -1) - if (notReserved) { - object[i] = options[i] - } - } - return object -} - -function filterOutReservedFunctions(reserved, options) { - // Filter out properties that are functions and are reserved. - // Reserved values are passed in at call site. - - var object = {} - for (var i in options) { - var isReserved = !(reserved.indexOf(i) === -1) - var isFunction = (typeof options[i] === 'function') - if (!(isReserved && isFunction)) { - object[i] = options[i] - } - } - return object - -} - -// Function for properly handling a connection error -function connectionErrorHandler(error) { - var socket = this - if (socket.res) { - if (socket.res.request) { - socket.res.request.emit('error', error) - } else { - socket.res.emit('error', error) - } - } else { - socket._httpMessage.emit('error', error) - } -} - -// Return a simpler request object to allow serialization -function requestToJSON() { - var self = this - return { - uri: self.uri, - method: self.method, - headers: self.headers - } -} - -// Return a simpler response object to allow serialization -function responseToJSON() { - var self = this - return { - statusCode: self.statusCode, - body: self.body, - headers: self.headers, - request: requestToJSON.call(self.request) - } -} - -function Request (options) { - // if given the method property in options, set property explicitMethod to true - - // extend the Request instance with any non-reserved properties - // remove any reserved functions from the options object - // set Request instance to be readable and writable - // call init - - var self = this - - // start with HAR, then override with additional options - if (options.har) { - self._har = new Har(self) - options = self._har.options(options) - } - - stream.Stream.call(self) - var reserved = Object.keys(Request.prototype) - var nonReserved = filterForNonReserved(reserved, options) - - extend(self, nonReserved) - options = filterOutReservedFunctions(reserved, options) - - self.readable = true - self.writable = true - if (options.method) { - self.explicitMethod = true - } - self._qs = new Querystring(self) - self._auth = new Auth(self) - self._oauth = new OAuth(self) - self._multipart = new Multipart(self) - self._redirect = new Redirect(self) - self._tunnel = new Tunnel(self) - self.init(options) -} - -util.inherits(Request, stream.Stream) - -// Debugging -Request.debug = process.env.NODE_DEBUG && /\brequest\b/.test(process.env.NODE_DEBUG) -function debug() { - if (Request.debug) { - console.error('REQUEST %s', util.format.apply(util, arguments)) - } -} -Request.prototype.debug = debug - -Request.prototype.init = function (options) { - // init() contains all the code to setup the request object. - // the actual outgoing request is not started until start() is called - // this function is called from both the constructor and on redirect. - var self = this - if (!options) { - options = {} - } - self.headers = self.headers ? copy(self.headers) : {} - - // Delete headers with value undefined since they break - // ClientRequest.OutgoingMessage.setHeader in node 0.12 - for (var headerName in self.headers) { - if (typeof self.headers[headerName] === 'undefined') { - delete self.headers[headerName] - } - } - - caseless.httpify(self, self.headers) - - if (!self.method) { - self.method = options.method || 'GET' - } - if (!self.localAddress) { - self.localAddress = options.localAddress - } - - self._qs.init(options) - - debug(options) - if (!self.pool && self.pool !== false) { - self.pool = globalPool - } - self.dests = self.dests || [] - self.__isRequestRequest = true - - // Protect against double callback - if (!self._callback && self.callback) { - self._callback = self.callback - self.callback = function () { - if (self._callbackCalled) { - return // Print a warning maybe? - } - self._callbackCalled = true - self._callback.apply(self, arguments) - } - self.on('error', self.callback.bind()) - self.on('complete', self.callback.bind(self, null)) - } - - // People use this property instead all the time, so support it - if (!self.uri && self.url) { - self.uri = self.url - delete self.url - } - - // If there's a baseUrl, then use it as the base URL (i.e. uri must be - // specified as a relative path and is appended to baseUrl). - if (self.baseUrl) { - if (typeof self.baseUrl !== 'string') { - return self.emit('error', new Error('options.baseUrl must be a string')) - } - - if (typeof self.uri !== 'string') { - return self.emit('error', new Error('options.uri must be a string when using options.baseUrl')) - } - - if (self.uri.indexOf('//') === 0 || self.uri.indexOf('://') !== -1) { - return self.emit('error', new Error('options.uri must be a path when using options.baseUrl')) - } - - // Handle all cases to make sure that there's only one slash between - // baseUrl and uri. - var baseUrlEndsWithSlash = self.baseUrl.lastIndexOf('/') === self.baseUrl.length - 1 - var uriStartsWithSlash = self.uri.indexOf('/') === 0 - - if (baseUrlEndsWithSlash && uriStartsWithSlash) { - self.uri = self.baseUrl + self.uri.slice(1) - } else if (baseUrlEndsWithSlash || uriStartsWithSlash) { - self.uri = self.baseUrl + self.uri - } else if (self.uri === '') { - self.uri = self.baseUrl - } else { - self.uri = self.baseUrl + '/' + self.uri - } - delete self.baseUrl - } - - // A URI is needed by this point, emit error if we haven't been able to get one - if (!self.uri) { - return self.emit('error', new Error('options.uri is a required argument')) - } - - // If a string URI/URL was given, parse it into a URL object - if (typeof self.uri === 'string') { - self.uri = url.parse(self.uri) - } - - // Some URL objects are not from a URL parsed string and need href added - if (!self.uri.href) { - self.uri.href = url.format(self.uri) - } - - // DEPRECATED: Warning for users of the old Unix Sockets URL Scheme - if (self.uri.protocol === 'unix:') { - return self.emit('error', new Error('`unix://` URL scheme is no longer supported. Please use the format `http://unix:SOCKET:PATH`')) - } - - // Support Unix Sockets - if (self.uri.host === 'unix') { - self.enableUnixSocket() - } - - if (self.strictSSL === false) { - self.rejectUnauthorized = false - } - - if (!self.uri.pathname) {self.uri.pathname = '/'} - - if (!(self.uri.host || (self.uri.hostname && self.uri.port)) && !self.uri.isUnix) { - // Invalid URI: it may generate lot of bad errors, like 'TypeError: Cannot call method `indexOf` of undefined' in CookieJar - // Detect and reject it as soon as possible - var faultyUri = url.format(self.uri) - var message = 'Invalid URI "' + faultyUri + '"' - if (Object.keys(options).length === 0) { - // No option ? This can be the sign of a redirect - // As this is a case where the user cannot do anything (they didn't call request directly with this URL) - // they should be warned that it can be caused by a redirection (can save some hair) - message += '. This can be caused by a crappy redirection.' - } - // This error was fatal - self.abort() - return self.emit('error', new Error(message)) - } - - if (!self.hasOwnProperty('proxy')) { - self.proxy = getProxyFromURI(self.uri) - } - - self.tunnel = self._tunnel.isEnabled() - if (self.proxy) { - self._tunnel.setup(options) - } - - self._redirect.onRequest(options) - - self.setHost = false - if (!self.hasHeader('host')) { - var hostHeaderName = self.originalHostHeaderName || 'host' - self.setHeader(hostHeaderName, self.uri.hostname) - if (self.uri.port) { - if ( !(self.uri.port === 80 && self.uri.protocol === 'http:') && - !(self.uri.port === 443 && self.uri.protocol === 'https:') ) { - self.setHeader(hostHeaderName, self.getHeader('host') + (':' + self.uri.port) ) - } - } - self.setHost = true - } - - self.jar(self._jar || options.jar) - - if (!self.uri.port) { - if (self.uri.protocol === 'http:') {self.uri.port = 80} - else if (self.uri.protocol === 'https:') {self.uri.port = 443} - } - - if (self.proxy && !self.tunnel) { - self.port = self.proxy.port - self.host = self.proxy.hostname - } else { - self.port = self.uri.port - self.host = self.uri.hostname - } - - if (options.form) { - self.form(options.form) - } - - if (options.formData) { - var formData = options.formData - var requestForm = self.form() - var appendFormValue = function (key, value) { - if (value.hasOwnProperty('value') && value.hasOwnProperty('options')) { - requestForm.append(key, value.value, value.options) - } else { - requestForm.append(key, value) - } - } - for (var formKey in formData) { - if (formData.hasOwnProperty(formKey)) { - var formValue = formData[formKey] - if (formValue instanceof Array) { - for (var j = 0; j < formValue.length; j++) { - appendFormValue(formKey, formValue[j]) - } - } else { - appendFormValue(formKey, formValue) - } - } - } - } - - if (options.qs) { - self.qs(options.qs) - } - - if (self.uri.path) { - self.path = self.uri.path - } else { - self.path = self.uri.pathname + (self.uri.search || '') - } - - if (self.path.length === 0) { - self.path = '/' - } - - // Auth must happen last in case signing is dependent on other headers - if (options.aws) { - self.aws(options.aws) - } - - if (options.hawk) { - self.hawk(options.hawk) - } - - if (options.httpSignature) { - self.httpSignature(options.httpSignature) - } - - if (options.auth) { - if (Object.prototype.hasOwnProperty.call(options.auth, 'username')) { - options.auth.user = options.auth.username - } - if (Object.prototype.hasOwnProperty.call(options.auth, 'password')) { - options.auth.pass = options.auth.password - } - - self.auth( - options.auth.user, - options.auth.pass, - options.auth.sendImmediately, - options.auth.bearer - ) - } - - if (self.gzip && !self.hasHeader('accept-encoding')) { - self.setHeader('accept-encoding', 'gzip, deflate') - } - - if (self.uri.auth && !self.hasHeader('authorization')) { - var uriAuthPieces = self.uri.auth.split(':').map(function(item) {return self._qs.unescape(item)}) - self.auth(uriAuthPieces[0], uriAuthPieces.slice(1).join(':'), true) - } - - if (!self.tunnel && self.proxy && self.proxy.auth && !self.hasHeader('proxy-authorization')) { - var proxyAuthPieces = self.proxy.auth.split(':').map(function(item) {return self._qs.unescape(item)}) - var authHeader = 'Basic ' + toBase64(proxyAuthPieces.join(':')) - self.setHeader('proxy-authorization', authHeader) - } - - if (self.proxy && !self.tunnel) { - self.path = (self.uri.protocol + '//' + self.uri.host + self.path) - } - - if (options.json) { - self.json(options.json) - } - if (options.multipart) { - self.multipart(options.multipart) - } - - if (options.time) { - self.timing = true - self.elapsedTime = self.elapsedTime || 0 - } - - function setContentLength () { - if (isTypedArray(self.body)) { - self.body = new Buffer(self.body) - } - - if (!self.hasHeader('content-length')) { - var length - if (typeof self.body === 'string') { - length = Buffer.byteLength(self.body) - } - else if (Array.isArray(self.body)) { - length = self.body.reduce(function (a, b) {return a + b.length}, 0) - } - else { - length = self.body.length - } - - if (length) { - self.setHeader('content-length', length) - } else { - self.emit('error', new Error('Argument error, options.body.')) - } - } - } - if (self.body && !isstream(self.body)) { - setContentLength() - } - - if (options.oauth) { - self.oauth(options.oauth) - } else if (self._oauth.params && self.hasHeader('authorization')) { - self.oauth(self._oauth.params) - } - - var protocol = self.proxy && !self.tunnel ? self.proxy.protocol : self.uri.protocol - , defaultModules = {'http:':http, 'https:':https} - , httpModules = self.httpModules || {} - - self.httpModule = httpModules[protocol] || defaultModules[protocol] - - if (!self.httpModule) { - return self.emit('error', new Error('Invalid protocol: ' + protocol)) - } - - if (options.ca) { - self.ca = options.ca - } - - if (!self.agent) { - if (options.agentOptions) { - self.agentOptions = options.agentOptions - } - - if (options.agentClass) { - self.agentClass = options.agentClass - } else if (options.forever) { - var v = version() - // use ForeverAgent in node 0.10- only - if (v.major === 0 && v.minor <= 10) { - self.agentClass = protocol === 'http:' ? ForeverAgent : ForeverAgent.SSL - } else { - self.agentClass = self.httpModule.Agent - self.agentOptions = self.agentOptions || {} - self.agentOptions.keepAlive = true - } - } else { - self.agentClass = self.httpModule.Agent - } - } - - if (self.pool === false) { - self.agent = false - } else { - self.agent = self.agent || self.getNewAgent() - } - - self.on('pipe', function (src) { - if (self.ntick && self._started) { - self.emit('error', new Error('You cannot pipe to this stream after the outbound request has started.')) - } - self.src = src - if (isReadStream(src)) { - if (!self.hasHeader('content-type')) { - self.setHeader('content-type', mime.lookup(src.path)) - } - } else { - if (src.headers) { - for (var i in src.headers) { - if (!self.hasHeader(i)) { - self.setHeader(i, src.headers[i]) - } - } - } - if (self._json && !self.hasHeader('content-type')) { - self.setHeader('content-type', 'application/json') - } - if (src.method && !self.explicitMethod) { - self.method = src.method - } - } - - // self.on('pipe', function () { - // console.error('You have already piped to this stream. Pipeing twice is likely to break the request.') - // }) - }) - - defer(function () { - if (self._aborted) { - return - } - - var end = function () { - if (self._form) { - if (!self._auth.hasAuth) { - self._form.pipe(self) - } - else if (self._auth.hasAuth && self._auth.sentAuth) { - self._form.pipe(self) - } - } - if (self._multipart && self._multipart.chunked) { - self._multipart.body.pipe(self) - } - if (self.body) { - if (isstream(self.body)) { - self.body.pipe(self) - } else { - setContentLength() - if (Array.isArray(self.body)) { - self.body.forEach(function (part) { - self.write(part) - }) - } else { - self.write(self.body) - } - self.end() - } - } else if (self.requestBodyStream) { - console.warn('options.requestBodyStream is deprecated, please pass the request object to stream.pipe.') - self.requestBodyStream.pipe(self) - } else if (!self.src) { - if (self._auth.hasAuth && !self._auth.sentAuth) { - self.end() - return - } - if (self.method !== 'GET' && typeof self.method !== 'undefined') { - self.setHeader('content-length', 0) - } - self.end() - } - } - - if (self._form && !self.hasHeader('content-length')) { - // Before ending the request, we had to compute the length of the whole form, asyncly - self.setHeader(self._form.getHeaders(), true) - self._form.getLength(function (err, length) { - if (!err && !isNaN(length)) { - self.setHeader('content-length', length) - } - end() - }) - } else { - end() - } - - self.ntick = true - }) - -} - -Request.prototype.getNewAgent = function () { - var self = this - var Agent = self.agentClass - var options = {} - if (self.agentOptions) { - for (var i in self.agentOptions) { - options[i] = self.agentOptions[i] - } - } - if (self.ca) { - options.ca = self.ca - } - if (self.ciphers) { - options.ciphers = self.ciphers - } - if (self.secureProtocol) { - options.secureProtocol = self.secureProtocol - } - if (self.secureOptions) { - options.secureOptions = self.secureOptions - } - if (typeof self.rejectUnauthorized !== 'undefined') { - options.rejectUnauthorized = self.rejectUnauthorized - } - - if (self.cert && self.key) { - options.key = self.key - options.cert = self.cert - } - - if (self.pfx) { - options.pfx = self.pfx - } - - if (self.passphrase) { - options.passphrase = self.passphrase - } - - var poolKey = '' - - // different types of agents are in different pools - if (Agent !== self.httpModule.Agent) { - poolKey += Agent.name - } - - // ca option is only relevant if proxy or destination are https - var proxy = self.proxy - if (typeof proxy === 'string') { - proxy = url.parse(proxy) - } - var isHttps = (proxy && proxy.protocol === 'https:') || this.uri.protocol === 'https:' - - if (isHttps) { - if (options.ca) { - if (poolKey) { - poolKey += ':' - } - poolKey += options.ca - } - - if (typeof options.rejectUnauthorized !== 'undefined') { - if (poolKey) { - poolKey += ':' - } - poolKey += options.rejectUnauthorized - } - - if (options.cert) { - if (poolKey) { - poolKey += ':' - } - poolKey += options.cert.toString('ascii') + options.key.toString('ascii') - } - - if (options.pfx) { - if (poolKey) { - poolKey += ':' - } - poolKey += options.pfx.toString('ascii') - } - - if (options.ciphers) { - if (poolKey) { - poolKey += ':' - } - poolKey += options.ciphers - } - - if (options.secureProtocol) { - if (poolKey) { - poolKey += ':' - } - poolKey += options.secureProtocol - } - - if (options.secureOptions) { - if (poolKey) { - poolKey += ':' - } - poolKey += options.secureOptions - } - } - - if (self.pool === globalPool && !poolKey && Object.keys(options).length === 0 && self.httpModule.globalAgent) { - // not doing anything special. Use the globalAgent - return self.httpModule.globalAgent - } - - // we're using a stored agent. Make sure it's protocol-specific - poolKey = self.uri.protocol + poolKey - - // generate a new agent for this setting if none yet exists - if (!self.pool[poolKey]) { - self.pool[poolKey] = new Agent(options) - // properly set maxSockets on new agents - if (self.pool.maxSockets) { - self.pool[poolKey].maxSockets = self.pool.maxSockets - } - } - - return self.pool[poolKey] -} - -Request.prototype.start = function () { - // start() is called once we are ready to send the outgoing HTTP request. - // this is usually called on the first write(), end() or on nextTick() - var self = this - - if (self._aborted) { - return - } - - self._started = true - self.method = self.method || 'GET' - self.href = self.uri.href - - if (self.src && self.src.stat && self.src.stat.size && !self.hasHeader('content-length')) { - self.setHeader('content-length', self.src.stat.size) - } - if (self._aws) { - self.aws(self._aws, true) - } - - // We have a method named auth, which is completely different from the http.request - // auth option. If we don't remove it, we're gonna have a bad time. - var reqOptions = copy(self) - delete reqOptions.auth - - debug('make request', self.uri.href) - - try { - self.req = self.httpModule.request(reqOptions) - } catch (err) { - self.emit('error', err) - return - } - - if (self.timing) { - self.startTime = new Date().getTime() - } - - if (self.timeout && !self.timeoutTimer) { - var timeout = self.timeout < 0 ? 0 : self.timeout - // Set a timeout in memory - this block will throw if the server takes more - // than `timeout` to write the HTTP status and headers (corresponding to - // the on('response') event on the client). NB: this measures wall-clock - // time, not the time between bytes sent by the server. - self.timeoutTimer = setTimeout(function () { - var connectTimeout = self.req.socket && self.req.socket.readable === false - self.abort() - var e = new Error('ETIMEDOUT') - e.code = 'ETIMEDOUT' - e.connect = connectTimeout - self.emit('error', e) - }, timeout) - - if (self.req.setTimeout) { // only works on node 0.6+ - // Set an additional timeout on the socket, via the `setsockopt` syscall. - // This timeout sets the amount of time to wait *between* bytes sent - // from the server, and may or may not correspond to the wall-clock time - // elapsed from the start of the request. - // - // In particular, it's useful for erroring if the server fails to send - // data halfway through streaming a response. - self.req.setTimeout(timeout, function () { - if (self.req) { - self.req.abort() - var e = new Error('ESOCKETTIMEDOUT') - e.code = 'ESOCKETTIMEDOUT' - e.connect = false - self.emit('error', e) - } - }) - } - } - - self.req.on('response', self.onRequestResponse.bind(self)) - self.req.on('error', self.onRequestError.bind(self)) - self.req.on('drain', function() { - self.emit('drain') - }) - self.req.on('socket', function(socket) { - self.emit('socket', socket) - }) - - self.on('end', function() { - if ( self.req.connection ) { - self.req.connection.removeListener('error', connectionErrorHandler) - } - }) - self.emit('request', self.req) -} - -Request.prototype.onRequestError = function (error) { - var self = this - if (self._aborted) { - return - } - if (self.req && self.req._reusedSocket && error.code === 'ECONNRESET' - && self.agent.addRequestNoreuse) { - self.agent = { addRequest: self.agent.addRequestNoreuse.bind(self.agent) } - self.start() - self.req.end() - return - } - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer) - self.timeoutTimer = null - } - self.emit('error', error) -} - -Request.prototype.onRequestResponse = function (response) { - var self = this - debug('onRequestResponse', self.uri.href, response.statusCode, response.headers) - response.on('end', function() { - if (self.timing) { - self.elapsedTime += (new Date().getTime() - self.startTime) - debug('elapsed time', self.elapsedTime) - response.elapsedTime = self.elapsedTime - } - debug('response end', self.uri.href, response.statusCode, response.headers) - }) - - // The check on response.connection is a workaround for browserify. - if (response.connection && response.connection.listeners('error').indexOf(connectionErrorHandler) === -1) { - response.connection.setMaxListeners(0) - response.connection.once('error', connectionErrorHandler) - } - if (self._aborted) { - debug('aborted', self.uri.href) - response.resume() - return - } - - self.response = response - response.request = self - response.toJSON = responseToJSON - - // XXX This is different on 0.10, because SSL is strict by default - if (self.httpModule === https && - self.strictSSL && (!response.hasOwnProperty('socket') || - !response.socket.authorized)) { - debug('strict ssl error', self.uri.href) - var sslErr = response.hasOwnProperty('socket') ? response.socket.authorizationError : self.uri.href + ' does not support SSL' - self.emit('error', new Error('SSL Error: ' + sslErr)) - return - } - - // Save the original host before any redirect (if it changes, we need to - // remove any authorization headers). Also remember the case of the header - // name because lots of broken servers expect Host instead of host and we - // want the caller to be able to specify this. - self.originalHost = self.getHeader('host') - if (!self.originalHostHeaderName) { - self.originalHostHeaderName = self.hasHeader('host') - } - if (self.setHost) { - self.removeHeader('host') - } - if (self.timeout && self.timeoutTimer) { - clearTimeout(self.timeoutTimer) - self.timeoutTimer = null - } - - var targetCookieJar = (self._jar && self._jar.setCookie) ? self._jar : globalCookieJar - var addCookie = function (cookie) { - //set the cookie if it's domain in the href's domain. - try { - targetCookieJar.setCookie(cookie, self.uri.href, {ignoreError: true}) - } catch (e) { - self.emit('error', e) - } - } - - response.caseless = caseless(response.headers) - - if (response.caseless.has('set-cookie') && (!self._disableCookies)) { - var headerName = response.caseless.has('set-cookie') - if (Array.isArray(response.headers[headerName])) { - response.headers[headerName].forEach(addCookie) - } else { - addCookie(response.headers[headerName]) - } - } - - if (self._redirect.onResponse(response)) { - return // Ignore the rest of the response - } else { - // Be a good stream and emit end when the response is finished. - // Hack to emit end on close because of a core bug that never fires end - response.on('close', function () { - if (!self._ended) { - self.response.emit('end') - } - }) - - response.on('end', function () { - self._ended = true - }) - - var noBody = function (code) { - return ( - self.method === 'HEAD' - // Informational - || (code >= 100 && code < 200) - // No Content - || code === 204 - // Not Modified - || code === 304 - ) - } - - var responseContent - if (self.gzip && !noBody(response.statusCode)) { - var contentEncoding = response.headers['content-encoding'] || 'identity' - contentEncoding = contentEncoding.trim().toLowerCase() - - if (contentEncoding === 'gzip') { - responseContent = zlib.createGunzip() - response.pipe(responseContent) - } else if (contentEncoding === 'deflate') { - responseContent = zlib.createInflate() - response.pipe(responseContent) - } else { - // Since previous versions didn't check for Content-Encoding header, - // ignore any invalid values to preserve backwards-compatibility - if (contentEncoding !== 'identity') { - debug('ignoring unrecognized Content-Encoding ' + contentEncoding) - } - responseContent = response - } - } else { - responseContent = response - } - - if (self.encoding) { - if (self.dests.length !== 0) { - console.error('Ignoring encoding parameter as this stream is being piped to another stream which makes the encoding option invalid.') - } else if (responseContent.setEncoding) { - responseContent.setEncoding(self.encoding) - } else { - // Should only occur on node pre-v0.9.4 (joyent/node@9b5abe5) with - // zlib streams. - // If/When support for 0.9.4 is dropped, this should be unnecessary. - responseContent = responseContent.pipe(stringstream(self.encoding)) - } - } - - if (self._paused) { - responseContent.pause() - } - - self.responseContent = responseContent - - self.emit('response', response) - - self.dests.forEach(function (dest) { - self.pipeDest(dest) - }) - - responseContent.on('data', function (chunk) { - self._destdata = true - self.emit('data', chunk) - }) - responseContent.on('end', function (chunk) { - self.emit('end', chunk) - }) - responseContent.on('error', function (error) { - self.emit('error', error) - }) - responseContent.on('close', function () {self.emit('close')}) - - if (self.callback) { - self.readResponseBody(response) - } - //if no callback - else { - self.on('end', function () { - if (self._aborted) { - debug('aborted', self.uri.href) - return - } - self.emit('complete', response) - }) - } - } - debug('finish init function', self.uri.href) -} - -Request.prototype.readResponseBody = function (response) { - var self = this - debug('reading response\'s body') - var buffer = bl() - , strings = [] - - self.on('data', function (chunk) { - if (Buffer.isBuffer(chunk)) { - buffer.append(chunk) - } else { - strings.push(chunk) - } - }) - self.on('end', function () { - debug('end event', self.uri.href) - if (self._aborted) { - debug('aborted', self.uri.href) - // `buffer` is defined in the parent scope and used in a closure it exists for the life of the request. - // This can lead to leaky behavior if the user retains a reference to the request object. - buffer.destroy() - return - } - - if (buffer.length) { - debug('has body', self.uri.href, buffer.length) - if (self.encoding === null) { - // response.body = buffer - // can't move to this until https://github.com/rvagg/bl/issues/13 - response.body = buffer.slice() - } else { - response.body = buffer.toString(self.encoding) - } - // `buffer` is defined in the parent scope and used in a closure it exists for the life of the Request. - // This can lead to leaky behavior if the user retains a reference to the request object. - buffer.destroy() - } else if (strings.length) { - // The UTF8 BOM [0xEF,0xBB,0xBF] is converted to [0xFE,0xFF] in the JS UTC16/UCS2 representation. - // Strip this value out when the encoding is set to 'utf8', as upstream consumers won't expect it and it breaks JSON.parse(). - if (self.encoding === 'utf8' && strings[0].length > 0 && strings[0][0] === '\uFEFF') { - strings[0] = strings[0].substring(1) - } - response.body = strings.join('') - } - - if (self._json) { - try { - response.body = JSON.parse(response.body, self._jsonReviver) - } catch (e) { - debug('invalid JSON received', self.uri.href) - } - } - debug('emitting complete', self.uri.href) - if (typeof response.body === 'undefined' && !self._json) { - response.body = self.encoding === null ? new Buffer(0) : '' - } - self.emit('complete', response, response.body) - }) -} - -Request.prototype.abort = function () { - var self = this - self._aborted = true - - if (self.req) { - self.req.abort() - } - else if (self.response) { - self.response.destroy() - } - - self.emit('abort') -} - -Request.prototype.pipeDest = function (dest) { - var self = this - var response = self.response - // Called after the response is received - if (dest.headers && !dest.headersSent) { - if (response.caseless.has('content-type')) { - var ctname = response.caseless.has('content-type') - if (dest.setHeader) { - dest.setHeader(ctname, response.headers[ctname]) - } - else { - dest.headers[ctname] = response.headers[ctname] - } - } - - if (response.caseless.has('content-length')) { - var clname = response.caseless.has('content-length') - if (dest.setHeader) { - dest.setHeader(clname, response.headers[clname]) - } else { - dest.headers[clname] = response.headers[clname] - } - } - } - if (dest.setHeader && !dest.headersSent) { - for (var i in response.headers) { - // If the response content is being decoded, the Content-Encoding header - // of the response doesn't represent the piped content, so don't pass it. - if (!self.gzip || i !== 'content-encoding') { - dest.setHeader(i, response.headers[i]) - } - } - dest.statusCode = response.statusCode - } - if (self.pipefilter) { - self.pipefilter(response, dest) - } -} - -Request.prototype.qs = function (q, clobber) { - var self = this - var base - if (!clobber && self.uri.query) { - base = self._qs.parse(self.uri.query) - } else { - base = {} - } - - for (var i in q) { - base[i] = q[i] - } - - var qs = self._qs.stringify(base) - - if (qs === '') { - return self - } - - self.uri = url.parse(self.uri.href.split('?')[0] + '?' + qs) - self.url = self.uri - self.path = self.uri.path - - if (self.uri.host === 'unix') { - self.enableUnixSocket() - } - - return self -} -Request.prototype.form = function (form) { - var self = this - if (form) { - if (!/^application\/x-www-form-urlencoded\b/.test(self.getHeader('content-type'))) { - self.setHeader('content-type', 'application/x-www-form-urlencoded') - } - self.body = (typeof form === 'string') - ? self._qs.rfc3986(form.toString('utf8')) - : self._qs.stringify(form).toString('utf8') - return self - } - // create form-data object - self._form = new FormData() - self._form.on('error', function(err) { - err.message = 'form-data: ' + err.message - self.emit('error', err) - self.abort() - }) - return self._form -} -Request.prototype.multipart = function (multipart) { - var self = this - - self._multipart.onRequest(multipart) - - if (!self._multipart.chunked) { - self.body = self._multipart.body - } - - return self -} -Request.prototype.json = function (val) { - var self = this - - if (!self.hasHeader('accept')) { - self.setHeader('accept', 'application/json') - } - - if (typeof self.jsonReplacer === 'function') { - self._jsonReplacer = self.jsonReplacer - } - - self._json = true - if (typeof val === 'boolean') { - if (self.body !== undefined) { - if (!/^application\/x-www-form-urlencoded\b/.test(self.getHeader('content-type'))) { - self.body = safeStringify(self.body, self._jsonReplacer) - } else { - self.body = self._qs.rfc3986(self.body) - } - if (!self.hasHeader('content-type')) { - self.setHeader('content-type', 'application/json') - } - } - } else { - self.body = safeStringify(val, self._jsonReplacer) - if (!self.hasHeader('content-type')) { - self.setHeader('content-type', 'application/json') - } - } - - if (typeof self.jsonReviver === 'function') { - self._jsonReviver = self.jsonReviver - } - - return self -} -Request.prototype.getHeader = function (name, headers) { - var self = this - var result, re, match - if (!headers) { - headers = self.headers - } - Object.keys(headers).forEach(function (key) { - if (key.length !== name.length) { - return - } - re = new RegExp(name, 'i') - match = key.match(re) - if (match) { - result = headers[key] - } - }) - return result -} -Request.prototype.enableUnixSocket = function () { - // Get the socket & request paths from the URL - var unixParts = this.uri.path.split(':') - , host = unixParts[0] - , path = unixParts[1] - // Apply unix properties to request - this.socketPath = host - this.uri.pathname = path - this.uri.path = path - this.uri.host = host - this.uri.hostname = host - this.uri.isUnix = true -} - - -Request.prototype.auth = function (user, pass, sendImmediately, bearer) { - var self = this - - self._auth.onRequest(user, pass, sendImmediately, bearer) - - return self -} -Request.prototype.aws = function (opts, now) { - var self = this - - if (!now) { - self._aws = opts - return self - } - - if (opts.sign_version == 4 || opts.sign_version == '4') { - var aws4 = require('aws4') - // use aws4 - var options = { - host: self.uri.host, - path: self.uri.path, - method: self.method, - headers: { - 'content-type': self.getHeader('content-type') || '' - }, - body: self.body - } - var signRes = aws4.sign(options, { - accessKeyId: opts.key, - secretAccessKey: opts.secret - }) - self.setHeader('authorization', signRes.headers.Authorization) - self.setHeader('x-amz-date', signRes.headers['X-Amz-Date']) - } - else { - // default: use aws-sign2 - var date = new Date() - self.setHeader('date', date.toUTCString()) - var auth = - { key: opts.key - , secret: opts.secret - , verb: self.method.toUpperCase() - , date: date - , contentType: self.getHeader('content-type') || '' - , md5: self.getHeader('content-md5') || '' - , amazonHeaders: aws2.canonicalizeHeaders(self.headers) - } - var path = self.uri.path - if (opts.bucket && path) { - auth.resource = '/' + opts.bucket + path - } else if (opts.bucket && !path) { - auth.resource = '/' + opts.bucket - } else if (!opts.bucket && path) { - auth.resource = path - } else if (!opts.bucket && !path) { - auth.resource = '/' - } - auth.resource = aws2.canonicalizeResource(auth.resource) - self.setHeader('authorization', aws2.authorization(auth)) - } - - return self -} -Request.prototype.httpSignature = function (opts) { - var self = this - httpSignature.signRequest({ - getHeader: function(header) { - return self.getHeader(header, self.headers) - }, - setHeader: function(header, value) { - self.setHeader(header, value) - }, - method: self.method, - path: self.path - }, opts) - debug('httpSignature authorization', self.getHeader('authorization')) - - return self -} -Request.prototype.hawk = function (opts) { - var self = this - self.setHeader('Authorization', hawk.client.header(self.uri, self.method, opts).field) -} -Request.prototype.oauth = function (_oauth) { - var self = this - - self._oauth.onRequest(_oauth) - - return self -} - -Request.prototype.jar = function (jar) { - var self = this - var cookies - - if (self._redirect.redirectsFollowed === 0) { - self.originalCookieHeader = self.getHeader('cookie') - } - - if (!jar) { - // disable cookies - cookies = false - self._disableCookies = true - } else { - var targetCookieJar = (jar && jar.getCookieString) ? jar : globalCookieJar - var urihref = self.uri.href - //fetch cookie in the Specified host - if (targetCookieJar) { - cookies = targetCookieJar.getCookieString(urihref) - } - } - - //if need cookie and cookie is not empty - if (cookies && cookies.length) { - if (self.originalCookieHeader) { - // Don't overwrite existing Cookie header - self.setHeader('cookie', self.originalCookieHeader + '; ' + cookies) - } else { - self.setHeader('cookie', cookies) - } - } - self._jar = jar - return self -} - - -// Stream API -Request.prototype.pipe = function (dest, opts) { - var self = this - - if (self.response) { - if (self._destdata) { - self.emit('error', new Error('You cannot pipe after data has been emitted from the response.')) - } else if (self._ended) { - self.emit('error', new Error('You cannot pipe after the response has been ended.')) - } else { - stream.Stream.prototype.pipe.call(self, dest, opts) - self.pipeDest(dest) - return dest - } - } else { - self.dests.push(dest) - stream.Stream.prototype.pipe.call(self, dest, opts) - return dest - } -} -Request.prototype.write = function () { - var self = this - if (self._aborted) {return} - - if (!self._started) { - self.start() - } - if (self.req) { - return self.req.write.apply(self.req, arguments) - } -} -Request.prototype.end = function (chunk) { - var self = this - if (self._aborted) {return} - - if (chunk) { - self.write(chunk) - } - if (!self._started) { - self.start() - } - if (self.req) { - self.req.end() - } -} -Request.prototype.pause = function () { - var self = this - if (!self.responseContent) { - self._paused = true - } else { - self.responseContent.pause.apply(self.responseContent, arguments) - } -} -Request.prototype.resume = function () { - var self = this - if (!self.responseContent) { - self._paused = false - } else { - self.responseContent.resume.apply(self.responseContent, arguments) - } -} -Request.prototype.destroy = function () { - var self = this - if (!self._ended) { - self.end() - } else if (self.response) { - self.response.destroy() - } -} - -Request.defaultProxyHeaderWhiteList = - Tunnel.defaultProxyHeaderWhiteList.slice() - -Request.defaultProxyHeaderExclusiveList = - Tunnel.defaultProxyHeaderExclusiveList.slice() - -// Exports - -Request.prototype.toJSON = requestToJSON -module.exports = Request diff --git a/Associations/node_modules/mongoose/.eslintignore b/Associations/node_modules/mongoose/.eslintignore deleted file mode 100644 index 235bdcd4..00000000 --- a/Associations/node_modules/mongoose/.eslintignore +++ /dev/null @@ -1,3 +0,0 @@ -docs/ -bin/ -test/triage/ diff --git a/Associations/node_modules/mongoose/.eslintrc b/Associations/node_modules/mongoose/.eslintrc deleted file mode 100644 index 82486700..00000000 --- a/Associations/node_modules/mongoose/.eslintrc +++ /dev/null @@ -1,30 +0,0 @@ -extends: 'eslint:recommended' - -env: - node: true - mocha: true - -rules: - indent: - - 1 - - 2 - - SwitchCase: 1 - VariableDeclarator: 2 - no-trailing-spaces: 2 - comma-style: 1 - no-spaced-func: 2 - no-multi-spaces: 1 - space-after-keywords: 2 - space-before-blocks: 2 - space-before-function-paren: - - 2 - - never - space-before-keywords: 2 - space-infix-ops: 2 - space-return-throw-case: 2 - space-unary-ops: 1 - no-console: 0 - consistent-this: - - 1 - - _this - semi: 2 diff --git a/Associations/node_modules/mongoose/.npmignore b/Associations/node_modules/mongoose/.npmignore deleted file mode 100644 index 377d63fa..00000000 --- a/Associations/node_modules/mongoose/.npmignore +++ /dev/null @@ -1,16 +0,0 @@ -lib-cov -**.swp -*.sw* -*.orig -.DS_Store -node_modules/ -benchmarks/ -docs/ -test/ -Makefile -CNAME -index.html -index.jade -bin/ -karma.*.js -format_deps.js diff --git a/Associations/node_modules/mongoose/.travis.yml b/Associations/node_modules/mongoose/.travis.yml deleted file mode 100644 index a8086538..00000000 --- a/Associations/node_modules/mongoose/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: node_js -sudo: false -node_js: - - "4.0" - - "0.12" - - "0.10" - - "iojs" -services: - - mongodb diff --git a/Associations/node_modules/mongoose/CONTRIBUTING.md b/Associations/node_modules/mongoose/CONTRIBUTING.md deleted file mode 100644 index 514657e4..00000000 --- a/Associations/node_modules/mongoose/CONTRIBUTING.md +++ /dev/null @@ -1,58 +0,0 @@ -## Contributing to Mongoose - -If you have a question about Mongoose (not a bug report) please post it to either [StackOverflow](http://stackoverflow.com/questions/tagged/mongoose), our [Google Group](http://groups.google.com/group/mongoose-orm), or on the #mongoosejs irc channel on freenode. - -### Reporting bugs - -- Before opening a new issue, look for existing [issues](https://github.com/learnboost/mongoose/issues) to avoid duplication. If the issue does not yet exist, [create one](https://github.com/learnboost/mongoose/issues/new). - - Please describe the issue you are experiencing, along with any associated stack trace. - - Please post code that reproduces the issue, the version of mongoose, node version, and mongodb version. - - _The source of this project is written in javascript, not coffeescript, therefore your bug reports should be written in javascript_. - - In general, adding a "+1" comment to an existing issue does little to help get it resolved. A better way is to submit a well documented pull request with clean code and passing tests. - -### Requesting new features - -- Before opening a new issue, look for existing [issues](https://github.com/learnboost/mongoose/issues) to avoid duplication. If the issue does not yet exist, [create one](https://github.com/learnboost/mongoose/issues/new). -- Please describe a use case for it -- it would be ideal to include test cases as well -- In general, adding a "+1" comment to an existing issue does little to help get it resolved. A better way is to submit a well documented pull request with clean code and passing tests. - -### Fixing bugs / Adding features - -- Before starting to write code, look for existing [issues](https://github.com/learnboost/mongoose/issues). That way you avoid working on something that might not be of interest or that has been addressed already in a different branch. You can create a new issue [here](https://github.com/learnboost/mongoose/issues/new). - - _The source of this project is written in javascript, not coffeescript, therefore your bug reports should be written in javascript_. -- Fork the [repo](https://github.com/learnboost/mongoose) _or_ for small documentation changes, navigate to the source on github and click the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button. -- Follow the general coding style of the rest of the project: - - 2 space tabs - - no trailing whitespace - - comma first - - inline documentation for new methods, class members, etc - - 1 space between conditionals/functions, and their parenthesis and curly braces - - `if (..) {` - - `for (..) {` - - `while (..) {` - - `function (err) {` -- Write tests and make sure they pass (tests are in the [test](https://github.com/LearnBoost/mongoose/tree/master/test) directory). - -### Running the tests -- Open a terminal and navigate to the root of the project -- execute `npm install` to install the necessary dependencies -- execute `make test` to run the tests (we're using [mocha](http://visionmedia.github.com/mocha/)) - - or to execute a single test `T="-g 'some regexp that matches the test description'" make test` - - any mocha flags can be specified with `T="..."` - -### Documentation - -To contribute to the [API documentation](http://mongoosejs.com/docs/api.html) just make your changes to the inline documentation of the appropriate [source code](https://github.com/LearnBoost/mongoose/tree/master/lib) in the master branch and submit a [pull request](https://help.github.com/articles/using-pull-requests/). You might also use the github [Edit](https://github.com/blog/844-forking-with-the-edit-button) button. - -To contribute to the [guide](http://mongoosejs.com/docs/guide.html) or [quick start](http://mongoosejs.com/docs/index.html) docs, make your changes to the appropriate `.jade` files in the [docs](https://github.com/LearnBoost/mongoose/tree/master/docs) directory of the master branch and submit a pull request. Again, the [Edit](https://github.com/blog/844-forking-with-the-edit-button) button might work for you here. - -If you'd like to preview your documentation changes, first commit your changes to your local master branch, then execute `make docs` from the project root, which switches to the gh-pages branch, merges from the master branch and builds all the static pages for you. Now execute `node static.js` from the project root which will launch a local webserver where you can browse the documentation site locally. If all looks good, submit a [pull request](https://help.github.com/articles/using-pull-requests/) to the master branch with your changes. - -### Plugins website - -The [plugins](http://plugins.mongoosejs.com/) site is also an [open source project](https://github.com/aheckmann/mongooseplugins) that you can get involved with. Feel free to fork and improve it as well! - -### Sharing your projects - -All are welcome to share their creations which use mongoose on our [tumbler](http://mongoosejs.tumblr.com/). Just fill out the [simple submission form](http://mongoosejs.tumblr.com/submit). diff --git a/Associations/node_modules/mongoose/History.md b/Associations/node_modules/mongoose/History.md deleted file mode 100644 index 4d5c55ed..00000000 --- a/Associations/node_modules/mongoose/History.md +++ /dev/null @@ -1,2637 +0,0 @@ -4.1.12 / 2015-10-19 -=================== - * docs; use readPreference instead of slaveOk for Query.setOptions docs #3471 [buunguyen](https://github.com/buunguyen) - * fixed; more helpful error when regexp contains null bytes #3456 - * fixed; x509 auth issue #3454 [NoxHarmonium](https://github.com/NoxHarmonium) - -3.8.36 / 2015-10-18 -=================== - * fixed; Make array props non-enumerable #3461 [boblauer](https://github.com/boblauer) - -4.1.11 / 2015-10-12 -=================== - * fixed; update timestamps for update() if they're enabled #3450 [isayme](https://github.com/isayme) - * fixed; unit test error on node 0.10 #3449 [isayme](https://github.com/isayme) - * docs; timestamp option docs #3448 [isayme](https://github.com/isayme) - * docs; fix unexpected indent #3443 [isayme](https://github.com/isayme) - * fixed; use ES6 promises for Model.prototype.remove() #3442 - * fixed; don't use unused 'safe' option for index builds #3439 - * fixed; elemMatch casting bug #3437 #3435 [DefinitelyCarter](https://github.com/DefinitelyCarter) - * docs; schema.index docs #3434 - * fixed; exceptions in save() callback getting swallowed on mongodb 2.4 #3371 - -4.1.10 / 2015-10-05 -=================== - * docs; improve virtuals docs to explain virtuals schema option #3433 [zoyaH](https://github.com/zoyaH) - * docs; MongoDB server version compatibility guide #3427 - * docs; clarify that findById and findByIdAndUpdate fire hooks #3422 - * docs; clean up Model.save() docs #3420 - * fixed; properly handle projection with just id #3407 #3412 - * fixed; infinite loop when database document is corrupted #3405 - * docs; clarify remove middleware #3388 - -4.1.9 / 2015-09-28 -================== - * docs; minlength and maxlength string validation docs #3368 #3413 [cosmosgenius](https://github.com/cosmosgenius) - * fixed; linting for infix operators #3397 [ChristianMurphy](https://github.com/ChristianMurphy) - * fixed; proper casting for $all #3394 - * fixed; unhandled rejection warnings with .create() #3391 - * docs; clarify update validators on paths that aren't explicitly set #3386 - * docs; custom validator examples #2778 - -4.1.8 / 2015-09-21 -================== - * docs; fixed typo in example #3390 [kmctown](https://github.com/kmctown) - * fixed; error in toObject() #3387 [guumaster](https://github.com/guumaster) - * fixed; handling for casting null dates #3383 [alexmingoia](https://github.com/alexmingoia) - * fixed; passing composite ids to `findByIdAndUpdate` #3380 - * fixed; linting #3376 #3375 [ChristianMurphy](https://github.com/ChristianMurphy) - * fixed; added NodeJS v4 to Travis #3374 [ChristianMurphy](https://github.com/ChristianMurphy) - * fixed; casting $elemMatch inside of $not #3373 [gaguirre](https://github.com/gaguirre) - * fixed; handle case where $slice is 0 #3369 - * fixed; avoid running getters if path is populated #3357 - * fixed; cast documents to objects when setting to a nested path #3346 - -4.1.7 / 2015-09-14 -================== - * docs; typos in SchemaType documentation #3367 [jasson15](https://github.com/jasson15) - * fixed; MONGOOSE_DRIVER_PATH env variable again #3360 - * docs; added validateSync docs #3353 - * fixed; set findOne op synchronously in query #3344 - * fixed; handling for `.pull()` on a documentarray without an id #3341 - * fixed; use natural order for cloning update conditions #3338 - * fixed; issue with strict mode casting for mixed type updates #3337 - -4.1.6 / 2015-09-08 -================== - * fixed; MONGOOSE_DRIVER_PATH env variable #3345 [g13013](https://github.com/g13013) - * docs; global autoIndex option #3335 [albertorestifo](https://github.com/albertorestifo) - * docs; model documentation typos #3330 - * fixed; report reason for CastError #3320 - * fixed; .populate() no longer returns true after re-assigning #3308 - * fixed; discriminators with aggregation geoNear #3304 - * docs; discriminator docs #2743 - -4.1.5 / 2015-09-01 -================== - * fixed; document.remove() removing all docs #3326 #3325 - * fixed; connect() checks for rs_name in options #3299 - * docs; examples for schema.set() #3288 - * fixed; checkKeys issue with bluebird #3286 [gregthegeek](https://github.com/gregthegeek) - -4.1.4 / 2015-08-31 -================== - * fixed; ability to set strict: false for update #3305 - * fixed; .create() properly uses ES6 promises #3297 - * fixed; pre hooks on nested subdocs #3291 #3284 [aliatsis](https://github.com/aliatsis) - * docs; remove unclear text in .remove() docs #3282 - * fixed; pre hooks called twice for 3rd-level nested doc #3281 - * fixed; nested transforms #3279 - * upgraded; mquery -> 1.6.3 #3278 #3272 - * fixed; don't swallow callback errors by default #3273 #3222 - * fixed; properly get nested paths from nested schemas #3265 - * fixed; remove() with id undefined deleting all docs #3260 [thanpolas](https://github.com/thanpolas) - * fixed; handling for non-numeric projections #3256 - * fixed; findById with id undefined returning first doc #3255 - * fixed; use retainKeyOrder for update #3215 - * added; passRawResult option to findOneAndUpdate for backwards compat #3173 - -4.1.3 / 2015-08-16 -================== - * fixed; getUpdate() in pre update hooks #3520 [gregthegeek](https://github.com/gregthegeek) - * fixed; handleArray() ensures arg is an array #3238 [jloveridge](https://github.com/jloveridge) - * fixed; refresh required path cache when recreating docs #3199 - * fixed; $ operator on unwind aggregation helper #3197 - * fixed; findOneAndUpdate() properly returns raw result as third arg to callback #3173 - * fixed; querystream with dynamic refs #3108 - -3.8.35 / 2015-08-14 -=================== - * fixed; handling for minimize on nested objects #2930 - * fixed; don't crash when schema.path.options undefined #1824 - -4.1.2 / 2015-08-10 -================== - * fixed; better handling for Jade templates #3241 [kbadk](https://github.com/kbadk) - * added; ESlint trailing spaces #3234 [ChristianMurphy](https://github.com/ChristianMurphy) - * added; ESlint #3191 [ChristianMurphy](https://github.com/ChristianMurphy) - * fixed; properly emit event on disconnect #3183 - * fixed; copy options properly using Query.toConstructor() #3176 - * fixed; setMaxListeners() issue in browser build #3170 - * fixed; node driver -> 2.0.40 to not store undefined keys as null #3169 - * fixed; update validators handle positional operator #3167 - * fixed; handle $all + $elemMatch query casting #3163 - * fixed; post save hooks don't swallow extra args #3155 - * docs; spelling mistake in index.jade #3154 - * fixed; don't crash when toObject() has no fields #3130 - * fixed; apply toObject() recursively for find and update queries #3086 [naoina](https://github.com/naoina) - -4.1.1 / 2015-08-03 -================== - * fixed; aggregate exec() crash with no callback #3212 #3198 [jpgarcia](https://github.com/jpgarcia) - * fixed; pre init hooks now properly synchronous #3207 [burtonjc](https://github.com/burtonjc) - * fixed; updateValidators doesn't flatten dates #3206 #3194 [victorkohl](https://github.com/victorkohl) - * fixed; default fields don't make document dirty between saves #3205 [burtonjc](https://github.com/burtonjc) - * fixed; save passes 0 as numAffected rather than undefined when no change #3195 [burtonjc](https://github.com/burtonjc) - * fixed; better handling for positional operator in update #3185 - * fixed; use Travis containers #3181 [ChristianMurphy](https://github.com/ChristianMurphy) - * fixed; leaked variable #3180 [ChristianMurphy](https://github.com/ChristianMurphy) - -4.1.0 / 2015-07-24 -================== - * added; `schema.queue()` now public #3193 - * added; raw result as third parameter to findOneAndX callback #3173 - * added; ability to run validateSync() on only certain fields #3153 - * added; subPopulate #3103 [timbur](https://github.com/timbur) - * added; $isDefault function on documents #3077 - * added; additional properties for built-in validator messages #3063 [KLicheR](https://github.com/KLicheR) - * added; getQuery() and getUpdate() functions for Query #3013 - * added; export DocumentProvider #2996 - * added; ability to remove path from schema #2993 [JohnnyEstilles](https://github.com/JohnnyEstilles) - * added; .explain() helper for aggregate #2714 - * added; ability to specify which ES6-compatible promises library mongoose uses #2688 - * added; export Aggregate #1910 - -4.0.8 / 2015-07-20 -================== - * fixed; assignment with document arrays #3178 [rosston](https://github.com/rosston) - * docs; remove duplicate paragraph #3164 [rhmeeuwisse](https://github.com/rhmeeuwisse) - * docs; improve findOneAndXYZ parameter descriptions #3159 [rhmeeuwisse](https://github.com/rhmeeuwisse) - * docs; add findOneAndRemove to list of supported middleware #3158 - * docs; clarify ensureIndex #3156 - * fixed; refuse to save/remove document without id #3118 - * fixed; hooks next() no longer accidentally returns promise #3104 - * fixed; strict mode for findOneAndUpdate #2947 - * added; .min.js.gz file for browser component #2806 - -3.8.34 / 2015-07-20 -=================== - * fixed; allow using $rename #3171 - * fixed; no longer modifies update arguments #3008 - -4.0.7 / 2015-07-11 -================== - * fixed; documentarray id method when using object id #3157 [siboulet](https://github.com/siboulet) - * docs; improve findById docs #3147 - * fixed; update validators handle null properly #3136 [odeke-em](https://github.com/odeke-em) - * docs; jsdoc syntax errors #3128 [rhmeeuwisse](https://github.com/rhmeeuwisse) - * docs; fix typo #3126 [rhmeeuwisse](https://github.com/rhmeeuwisse) - * docs; proper formatting in queries.jade #3121 [rhmeeuwisse](https://github.com/rhmeeuwisse) - * docs; correct example for string maxlength validator #3111 [rhmeeuwisse](https://github.com/rhmeeuwisse) - * fixed; setDefaultsOnInsert with arrays #3107 - * docs; LearnBoost -> Automattic in package.json #3099 - * docs; pre update hook example #3094 [danpe](https://github.com/danpe) - * docs; clarify query middleware example #3051 - * fixed; ValidationErrors in strict mode #3046 - * fixed; set findOneAndUpdate properties before hooks run #3024 - -3.8.33 / 2015-07-10 -=================== - * upgraded; node driver -> 1.4.38 - * fixed; dont crash when `match` validator undefined - -4.0.6 / 2015-06-21 -================== - * upgraded; node driver -> 2.0.34 #3087 - * fixed; apply setters on addToSet, etc #3067 [victorkohl](https://github.com/victorkohl) - * fixed; missing semicolons #3065 [sokolikp](https://github.com/sokolikp) - * fixed; proper handling for async doc hooks #3062 [gregthegeek](https://github.com/gregthegeek) - * fixed; dont set failed populate field to null if other docs are successfully populated #3055 [eloytoro](https://github.com/eloytoro) - * fixed; setDefaultsOnInsert with document arrays #3034 [taxilian](https://github.com/taxilian) - * fixed; setters fired on array items #3032 - * fixed; stop validateSync() on first error #3025 [victorkohl](https://github.com/victorkohl) - * docs; improve query docs #3016 - * fixed; always exclude _id when its deselected #3010 - * fixed; enum validator kind property #3009 - * fixed; mquery collection names #3005 - * docs; clarify mongos option #3000 - * docs; clarify that query builder has a .then() #2995 - * fixed; race condition in dynamic ref #2992 - -3.8.31 / 2015-06-20 -=================== - * fixed; properly handle text search with discriminators and $meta #2166 - -4.0.5 / 2015-06-05 -================== - * fixed; ObjectIds and buffers when mongodb driver is a sibling dependency #3050 #3048 #3040 #3031 #3020 #2988 #2951 - * fixed; warn user when 'increment' is used in schema #3039 - * fixed; setDefaultsOnInsert with array in schema #3035 - * fixed; dont use default Object toString to cast to string #3030 - * added; npm badge #3020 [odeke-em](https://github.com/odeke-em) - * fixed; proper handling for calling .set() with a subdoc #2782 - * fixed; dont throw cast error when using $rename on non-string path #1845 - -3.8.30 / 2015-06-05 -=================== - * fixed; enable users to set all options with tailable() #2883 - -4.0.4 / 2015-05-28 -================== - * docs; findAndModify new parameter correct default value #3012 [JonForest](https://github.com/JonForest) - * docs; clarify pluralization rules #2999 [anonmily](https://github.com/anonmily) - * fix; discriminators with schema methods #2978 - * fix; make `isModified` a schema reserved keyword #2975 - * fix; properly fire setters when initializing path with object #2943 - * fix; can use `setDefaultsOnInsert` without specifying `runValidators` #2938 - * fix; always set validation errors `kind` property #2885 - * upgraded; node driver -> 2.0.33 #2865 - -3.8.29 / 2015-05-27 -=================== - * fixed; Handle JSON.stringify properly for nested docs #2990 - -4.0.3 / 2015-05-13 -================== - * upgraded; mquery -> 1.5.1 #2983 - * docs; clarify context for query middleware #2974 - * docs; fix missing type -> kind rename in History.md #2961 - * fixed; broken ReadPreference include on Heroku #2957 - * docs; correct form for cursor aggregate option #2955 - * fixed; sync post hooks now properly called after function #2949 #2925 - * fixed; fix sub-doc validate() function #2929 - * upgraded; node driver -> 2.0.30 #2926 - * docs; retainKeyOrder for save() #2924 - * docs; fix broken class names #2913 - * fixed; error when using node-clone on a doc #2909 - * fixed; no more hard references to bson #2908 #2906 - * fixed; dont overwrite array values #2907 [naoina](https://github.com/naoina) - * fixed; use readPreference=primary for findOneAndUpdate #2899 #2823 - * docs; clarify that update validators only run on $set and $unset #2889 - * fixed; set kind consistently for built-in validators #2885 - * docs; single field populated documents #2884 - * fixed; nested objects are now enumerable #2880 [toblerpwn](https://github.com/toblerpwn) - * fixed; properly populate field when ref, lean, stream used together #2841 - * docs; fixed migration guide jade error #2807 - -3.8.28 / 2015-05-12 -=================== - * fixed; proper handling for toJSON options #2910 - * fixed; dont attach virtuals to embedded docs in update() #2046 - -4.0.2 / 2015-04-23 -================== - * fixed; error thrown when calling .validate() on subdoc not in an array #2902 - * fixed; rename define() to play nice with webpack #2900 [jspears](https://github.com/jspears) - * fixed; pre validate called twice with discriminators #2892 - * fixed; .inspect() on mongoose.Types #2875 - * docs; correct callback params for Model.update #2872 - * fixed; setDefaultsOnInsert now works when runValidators not specified #2870 - * fixed; Document now wraps EventEmitter.addListener #2867 - * fixed; call non-hook functions in schema queue #2856 - * fixed; statics can be mocked out for tests #2848 [ninelb](https://github.com/ninelb) - * upgraded; mquery 1.4.0 for bluebird bug fix #2846 - * fixed; required validators run first #2843 - * docs; improved docs for new option to findAndMody #2838 - * docs; populate example now uses correct field #2837 [swilliams](https://github.com/swilliams) - * fixed; pre validate changes causing VersionError #2835 - * fixed; get path from correct place when setting CastError #2832 - * docs; improve docs for Model.update() function signature #2827 [irnc](https://github.com/irnc) - * fixed; populating discriminators #2825 [chetverikov](https://github.com/chetverikov) - * fixed; discriminators with nested schemas #2821 - * fixed; CastErrors with embedded docs #2819 - * fixed; post save hook context #2816 - * docs; 3.8.x -> 4.x migration guide #2807 - * fixed; proper _distinct copying for query #2765 [cdelauder](https://github.com/cdelauder) - -3.8.27 / 2015-04-22 -=================== - * fixed; dont duplicate db calls on Q.ninvoke() #2864 - * fixed; Model.find arguments naming in docs #2828 - * fixed; Support ipv6 in connection strings #2298 - -3.8.26 / 2015-04-07 -=================== - * fixed; TypeError when setting date to undefined #2833 - * fixed; handle CastError properly in distinct() with no callback #2786 - * fixed; broken links in queries docs #2779 - * fixed; dont mark buffer as modified when setting type initially #2738 - * fixed; dont crash when using slice with populate #1934 - -4.0.1 / 2015-03-28 -================== - * fixed; properly handle empty cast doc in update() with promises #2796 - * fixed; unstable warning #2794 - * fixed; findAndModify docs now show new option is false by default #2793 - -4.0.0 / 2015-03-25 -================== - * fixed; on-the-fly schema docs typo #2783 [artiifix](https://github.com/artiifix) - * fixed; cast error validation handling #2775 #2766 #2678 - * fixed; discriminators with populate() #2773 #2719 [chetverikov](https://github.com/chetverikov) - * fixed; increment now a reserved path #2709 - * fixed; avoid sending duplicate object ids in populate() #2683 - * upgraded; mongodb to 2.0.24 to properly emit reconnect event multiple times #2656 - -4.0.0-rc4 / 2015-03-14 -====================== - * fixed; toObject virtuals schema option handled properly #2751 - * fixed; update validators work on document arrays #2733 - * fixed; check for cast errors on $set #2729 - * fixed; instance field set for all schema types #2727 [csdco](https://github.com/csdco) - * fixed; dont run other validators if required fails #2725 - * fixed; custom getters execute on ref paths #2610 - * fixed; save defaults if they were set when doc was loaded from db #2558 - * fixed; pre validate now runs before pre save #2462 - * fixed; no longer throws errors with --use_strict #2281 - -3.8.25 / 2015-03-13 -=================== - * fixed; debug output reverses order of aggregation keys #2759 - * fixed; $eq is a valid query selector in 3.0 #2752 - * fixed; upgraded node driver to 1.4.32 for handling non-numeric poolSize #2682 - * fixed; update() with overwrite sets _id for nested docs #2658 - * fixed; casting for operators in $elemMatch #2199 - -4.0.0-rc3 / 2015-02-28 -====================== - * fixed; update() pre hooks run before validators #2706 - * fixed; setters not called on arrays of refs #2698 [brandom](https://github.com/brandom) - * fixed; use node driver 2.0.18 for nodejs 0.12 support #2685 - * fixed; comments reference file that no longer exists #2681 - * fixed; populated() returns _id of manually populated doc #2678 - * added; ability to exclude version key in toObject() #2675 - * fixed; dont allow setting nested path to a string #2592 - * fixed; can cast objects with _id field to ObjectIds #2581 - * fixed; on-the-fly schema getters #2360 - * added; strict option for findOneAndUpdate() #1967 - -3.8.24 / 2015-02-25 -=================== - * fixed; properly apply child schema transforms #2691 - * fixed; make copy of findOneAndUpdate options before modifying #2687 - * fixed; apply defaults when parent path is selected #2670 #2629 - * fixed; properly get ref property for nested paths #2665 - * fixed; node driver makes copy of authenticate options before modifying them #2619 - * fixed; dont block process exit when auth fails #2599 - * fixed; remove redundant clone in update() #2537 - -4.0.0-rc2 / 2015-02-10 -====================== - * added; io.js to travis build - * removed; browser build dependencies not installed by default - * added; dynamic refpaths #2640 [chetverikov](https://github.com/chetverikov) - * fixed; dont call child schema transforms on parent #2639 [chetverikov](https://github.com/chetverikov) - * fixed; get rid of remove option if new is set in findAndModify #2598 - * fixed; aggregate all document array validation errors #2589 - * fixed; custom setters called when setting value to undefined #1892 - -3.8.23 / 2015-02-06 -=================== - * fixed; unset opts.remove when upsert is true #2519 - * fixed; array saved as object when path is object in array #2442 - * fixed; inline transforms #2440 - * fixed; check for callback in count() #2204 - * fixed; documentation for selecting fields #1534 - -4.0.0-rc1 / 2015-02-01 -====================== - * fixed; use driver 2.0.14 - * changed; use transform: true by default #2245 - -4.0.0-rc0 / 2015-01-31 -=================== - * fixed; wrong order for distinct() params #2628 - * fixed; handling no query argument to remove() #2627 - * fixed; createModel and discriminators #2623 [ashaffer](https://github.com/ashaffer) - * added; pre('count') middleware #2621 - * fixed; double validation calls on document arrays #2618 - * added; validate() catches cast errors #2611 - * fixed; respect replicaSet parameter in connection string #2609 - * added; can explicitly exclude paths from versioning #2576 [csabapalfi](https://github.com/csabapalfi) - * upgraded; driver to 2.0.15 #2552 - * fixed; save() handles errors more gracefully in ES6 #2371 - * fixed; undefined is now a valid argument to findOneAndUpdate #2272 - * changed; `new` option to findAndModify ops is false by default #2262 - -3.8.22 / 2015-01-24 -=================== - * upgraded; node-mongodb-native to 1.4.28 #2587 [Climax777](https://github.com/Climax777) - * added; additional documentation for validators #2449 - * fixed; stack overflow when creating massive arrays #2423 - * fixed; undefined is a valid id for queries #2411 - * fixed; properly create nested schema index when same schema used twice #2322 - * added; link to plugin generator in docs #2085 [huei90](https://github.com/huei90) - * fixed; optional arguments documentation for findOne() #1971 [nachinius](https://github.com/nachinius) - -3.9.7 / 2014-12-19 -=================== - * added; proper cursors for aggregate #2539 [changyy](https://github.com/changyy) - * added; min/max built-in validators for dates #2531 [bshamblen](https://github.com/bshamblen) - * fixed; save and validate are now reserved keywords #2380 - * added; basic documentation for browser component #2256 - * added; find and findOne hooks (query middleware) #2138 - * fixed; throw a DivergentArrayError when saving positional operator queries #2031 - * added; ability to use options as a document property #1416 - * fixed; document no longer inherits from event emitter and so domain and _events are no longer reserved #1351 - * removed; setProfiling #1349 - -3.8.21 / 2014-12-18 -=================== - * fixed; syntax in index.jade #2517 [elderbas](https://github.com/elderbas) - * fixed; writable statics #2510 #2528 - * fixed; overwrite and explicit $set casting #2515 - -3.9.6 / 2014-12-05 -=================== - * added; correctly run validators on each element of array when entire array is modified #661 #1227 - * added; castErrors in validation #1013 [jondavidjohn](https://github.com/jondavidjohn) - * added; specify text indexes in schema fields #1401 [sr527](https://github.com/sr527) - * added; ability to set field with validators to undefined #1594 [alabid](https://github.com/alabid) - * added; .create() returns an array when passed an array #1746 [alabid](https://github.com/alabid) - * added; test suite and docs for use with co and yield #2177 #2474 - * fixed; subdocument toObject() transforms #2447 [chmanie](https://github.com/chmanie) - * fixed; Model.create() with save errors #2484 - * added; pass options to .save() and .remove() #2494 [jondavidjohn](https://github.com/jondavidjohn) - -3.8.20 / 2014-12-01 -=================== - * fixed; recursive readPref #2490 [kjvalencik](https://github.com/kjvalencik) - * fixed; make sure to copy parameters to update() before modifying #2406 [alabid](https://github.com/alabid) - * fixed; unclear documentation about query callbacks #2319 - * fixed; setting a schema-less field to an empty object #2314 [alabid](https://github.com/alabid) - * fixed; registering statics and methods for discriminators #2167 [alabid](https://github.com/alabid) - -3.9.5 / 2014-11-10 -=================== - * added; ability to disable autoIndex on a per-connection basis #1875 [sr527](https://github.com/sr527) - * fixed; `geoNear()` no longer enforces legacy coordinate pairs - supports GeoJSON #1987 [alabid](https://github.com/alabid) - * fixed; browser component works when minified with mangled variable names #2302 - * fixed; `doc.errors` now cleared before `validate()` called #2302 - * added; `execPopulate()` function to make `doc.populate()` compatible with promises #2317 - * fixed; `count()` no longer throws an error when used with `sort()` #2374 - * fixed; `save()` no longer recursively calls `save()` on populated fields #2418 - -3.8.19 / 2014-11-09 -=================== - * fixed; make sure to not override subdoc _ids on find #2276 [alabid](https://github.com/alabid) - * fixed; exception when comparing two documents when one lacks _id #2333 [slawo](https://github.com/slawo) - * fixed; getters for properties with non-strict schemas #2439 [alabid](https://github.com/alabid) - * fixed; inconsistent URI format in docs #2414 [sr527](https://github.com/sr527) - -3.9.4 / 2014-10-25 -================== - * fixed; statics no longer can be overwritten #2343 [nkcmr](https://github.com/chetverikov) - * added; ability to set single populated paths to documents #1530 - * added; setDefaultsOnInsert and runValidator options for findOneAndUpdate() #860 - -3.8.18 / 2014-10-22 -================== - * fixed; Dont use all toObject options in save #2340 [chetverikov](https://github.com/chetverikov) - -3.9.3 / 2014-10-01 -================= - * added; support for virtuals that return objects #2294 - * added; ability to manually hydrate POJOs into mongoose objects #2292 - * added; setDefaultsOnInsert and runValidator options for update() #860 - -3.8.17 / 2014-09-29 -================== - * fixed; use schema options retainKeyOrder in save() #2274 - * fixed; fix skip in populate when limit is set #2252 - * fixed; fix stack overflow when passing MongooseArray to findAndModify #2214 - * fixed; optimize .length usage in populate #2289 - -3.9.2 / 2014-09-08 -================== - * added; test coverage for browser component #2255 - * added; in-order execution of validators #2243 - * added; custom fields for validators #2132 - * removed; exception thrown when find() used with count() #1950 - -3.8.16 / 2014-09-08 -================== - * fixed; properly remove modified array paths if array has been overwritten #1638 - * fixed; key check errors #1884 - * fixed; make sure populate on an array always returns a Mongoose array #2214 - * fixed; SSL connections with node 0.11 #2234 - * fixed; return sensible strings for promise errors #2239 - -3.9.1 / 2014-08-17 -================== - * added; alpha version of browser-side schema validation #2254 - * added; support passing a function to schemas `required` field #2247 - * added; support for setting updatedAt and createdAt timestamps #2227 - * added; document.validate() returns a promise #2131 - -3.8.15 / 2014-08-17 -================== - * fixed; Replica set connection string example in docs #2246 - * fixed; bubble up parseError event #2229 - * fixed; removed buggy populate cache #2176 - * fixed; dont $inc versionKey if its being $set #1933 - * fixed; cast $or and $and in $pull #1932 - * fixed; properly cast to schema in stream() #1862 - * fixed; memory leak in nested objects #1565 #2211 [devongovett](https://github.com/devongovett) - -3.8.14 / 2014-07-26 -================== - * fixed; stringifying MongooseArray shows nested arrays #2002 - * fixed; use populated doc schema in toObject and toJSON by default #2035 - * fixed; dont crash on arrays containing null #2140 - * fixed; model.update w/ upsert has same return values on .exec and promise #2143 - * fixed; better handling for populate limit with multiple documents #2151 - * fixed; dont prevent users from adding weights to text index #2183 - * fixed; helper for aggregation cursor #2187 - * updated; node-mongodb-native to 1.4.7 - -3.8.13 / 2014-07-15 -================== - * fixed; memory leak with isNew events #2159 - * fixed; docs for overwrite option for update() #2144 - * fixed; storeShard() handles dates properly #2127 - * fixed; sub-doc changes not getting persisted to db after save #2082 - * fixed; populate with _id: 0 actually removes _id instead of setting to undefined #2123 - * fixed; save versionKey on findOneAndUpdate w/ upsert #2122 - * fixed; fix typo in 2.8 docs #2120 [shakirullahi](https://github.com/shakirullahi) - * fixed; support maxTimeMs #2102 [yuukinajima](https://github.com/yuukinajima) - * fixed; support $currentDate #2019 - * fixed; $addToSet handles objects without _ids properly #1973 - * fixed; dont crash on invalid nearSphere query #1874 - -3.8.12 / 2014-05-30 -================== - * fixed; single-server reconnect event fires #1672 - * fixed; sub-docs not saved when pushed into populated array #1794 - * fixed; .set() sometimes converts embedded docs to pojos #1954 [archangel-irk](https://github.com/archangel-irk) - * fixed; sub-doc changes not getting persisted to db after save #2082 - * fixed; custom getter might cause mongoose to mistakenly think a path is dirty #2100 [pgherveou](https://github.com/pgherveou) - * fixed; chainable helper for allowDiskUse option in aggregation #2114 - -3.9.0 (unstable) / 2014-05-22 -================== - * changed; added `domain` to reserved keywords #1338 #2052 [antoinepairet](https://github.com/antoinepairet) - * added; asynchronous post hooks #1977 #2081 [chopachom](https://github.com/chopachom) [JasonGhent](https://github.com/JasonGhent) - * added; using model for population, cross-db populate [mihai-chiorean](https://github.com/mihai-chiorean) - * added; can define a type for schema validators - * added; `doc.remove()` returns a promise #1619 [refack](https://github.com/refack) - * added; internal promises for hooks, pre-save hooks run in parallel #1732 [refack](https://github.com/refack) - * fixed; geoSearch hanging when no results returned #1846 [ghartnett](https://github.com/ghartnett) - * fixed; do not set .type property on ValidationError, use .kind instead #1323 - -3.8.11 / 2014-05-22 -================== - * updated; node-mongodb-native to 1.4.5 - * reverted; #2052, fixes #2097 - -3.8.10 / 2014-05-20 -================== - - * updated; node-mongodb-native to 1.4.4 - * fixed; _.isEqual false negatives bug in js-bson #2070 - * fixed; missing check for schema.options #2014 - * fixed; missing support for $position #2024 - * fixed; options object corruption #2049 - * fixed; improvements to virtuals docs #2055 - * fixed; added `domain` to reserved keywords #2052 #1338 - -3.8.9 / 2014-05-08 -================== - - * updated; mquery to 0.7.0 - * updated; node-mongodb-native to 1.4.3 - * fixed; $near failing against MongoDB 2.6 - * fixed; relying on .options() to determine if collection exists - * fixed; $out aggregate helper - * fixed; all test failures against MongoDB 2.6.1, with caveat #2065 - -3.8.8 / 2014-02-22 -================== - - * fixed; saving Buffers #1914 - * updated; expose connection states for user-land #1926 [yorkie](https://github.com/yorkie) - * updated; mquery to 0.5.3 - * updated; added get / set to reserved path list #1903 [tstrimple](https://github.com/tstrimple) - * docs; README code highlighting, syntax fixes #1930 [IonicaBizau](https://github.com/IonicaBizau) - * docs; fixes link in the doc at #1925 [kapeels](https://github.com/kapeels) - * docs; add a missed word 'hook' for the description of the post-hook api #1924 [ipoval](https://github.com/ipoval) - -3.8.7 / 2014-02-09 -================== - - * fixed; sending safe/read options in Query#exec #1895 - * fixed; findOneAnd..() with sort #1887 - -3.8.6 / 2014-01-30 -================== - - * fixed; setting readPreferences #1895 - -3.8.5 / 2014-01-23 -================== - - * fixed; ssl setting when using URI #1882 - * fixed; findByIdAndUpdate now respects the overwrite option #1809 [owenallenaz](https://github.com/owenallenaz) - -3.8.4 / 2014-01-07 -================== - - * updated; mongodb driver to 1.3.23 - * updated; mquery to 0.4.1 - * updated; mpromise to 0.4.3 - * fixed; discriminators now work when selecting fields #1820 [daemon1981](https://github.com/daemon1981) - * fixed; geoSearch with no results timeout #1846 [ghartnett](https://github.com/ghartnett) - * fixed; infitite recursion in ValidationError #1834 [chetverikov](https://github.com/chetverikov) - -3.8.3 / 2013-12-17 -================== - - * fixed; setting empty array with model.update #1838 - * docs; fix url - -3.8.2 / 2013-12-14 -================== - - * fixed; enum validation of multiple values #1778 [heroicyang](https://github.com/heroicyang) - * fixed; global var leak #1803 - * fixed; post remove now fires on subdocs #1810 - * fixed; no longer set default empty array for geospatial-indexed fields #1668 [shirish87](https://github.com/shirish87) - * fixed; model.stream() not hydrating discriminators correctly #1792 [j](https://github.com/j) - * docs: Stablility -> Stability [nikmartin](https://github.com/nikmartin) - * tests; improve shard error handling - -3.8.1 / 2013-11-19 -================== - - * fixed; mishandling of Dates with minimize/getters #1764 - * fixed; Normalize bugs.email, so `npm` will shut up #1769 [refack](https://github.com/refack) - * docs; Improve the grammar where "lets us" was used #1777 [alexyoung](https://github.com/alexyoung) - * docs; Fix some grammatical issues in the documentation #1777 [alexyoung](https://github.com/alexyoung) - * docs; fix Query api exposure - * docs; fix return description - * docs; Added Notes on findAndUpdate() #1750 [sstadelman](https://github.com/sstadelman) - * docs; Update version number in README #1762 [Fodi69](https://github.com/Fodi69) - -3.8.0 / 2013-10-31 -================== - - * updated; warn when using an unstable version - * updated; error message returned in doc.save() #1595 - * updated; mongodb driver to 1.3.19 (fix error swallowing behavior) - * updated; mquery to 0.3.2 - * updated; mocha to 1.12.0 - * updated; mpromise 0.3.0 - * updated; sliced 0.0.5 - * removed; mongoose.Error.DocumentError (never used) - * removed; namedscope (undocumented and broken) #679 #642 #455 #379 - * changed; no longer offically supporting node 0.6.x - * changed; query.within getter is now a method -> query.within() - * changed; query.intersects getter is now a method -> query.intersects() - * added; custom error msgs for built-in validators #747 - * added; discriminator support #1647 #1003 [j](https://github.com/j) - * added; support disabled collection name pluralization #1350 #1707 [refack](https://github.com/refack) - * added; support for GeoJSON to Query#near [ebensing](https://github.com/ebensing) - * added; stand-alone base query support - query.toConstructor() [ebensing](https://github.com/ebensing) - * added; promise support to geoSearch #1614 [ebensing](https://github.com/ebensing) - * added; promise support for geoNear #1614 [ebensing](https://github.com/ebensing) - * added; connection.useDb() #1124 [ebensing](https://github.com/ebensing) - * added; promise support to model.mapReduce() - * added; promise support to model.ensureIndexes() - * added; promise support to model.populate() - * added; benchmarks [ebensing](https://github.com/ebensing) - * added; publicly exposed connection states #1585 - * added; $geoWithin support #1529 $1455 [ebensing](https://github.com/ebensing) - * added; query method chain validation - * added; model.update `overwrite` option - * added; model.geoNear() support #1563 [ebensing](https://github.com/ebensing) - * added; model.geoSearch() support #1560 [ebensing](https://github.com/ebensing) - * added; MongooseBuffer#subtype() - * added; model.create() now returns a promise #1340 - * added; support for `awaitdata` query option - * added; pass the doc to doc.remove() callback #1419 [JoeWagner](https://github.com/JoeWagner) - * added; aggregation query builder #1404 [njoyard](https://github.com/njoyard) - * fixed; document.toObject when using `minimize` and `getters` options #1607 [JedWatson](https://github.com/JedWatson) - * fixed; Mixed types can now be required #1722 [Reggino](https://github.com/Reggino) - * fixed; do not pluralize model names not ending with letters #1703 [refack](https://github.com/refack) - * fixed; repopulating modified populated paths #1697 - * fixed; doc.equals() when _id option is set to false #1687 - * fixed; strict mode warnings #1686 - * fixed; $near GeoJSON casting #1683 - * fixed; nearSphere GeoJSON query builder - * fixed; population field selection w/ strings #1669 - * fixed; setters not firing on null values #1445 [ebensing](https://github.com/ebensing) - * fixed; handle another versioning edge case #1520 - * fixed; excluding subdocument fields #1280 [ebensing](https://github.com/ebensing) - * fixed; allow array properties to be set to null with findOneAndUpdate [aheuermann](https://github.com/aheuermann) - * fixed; subdocuments now use own toJSON opts #1376 [ebensing](https://github.com/ebensing) - * fixed; model#geoNear fulfills promise when results empty #1658 [ebensing](https://github.com/ebensing) - * fixed; utils.merge no longer overrides props and methods #1655 [j](https://github.com/j) - * fixed; subdocuments now use their own transform #1412 [ebensing](https://github.com/ebensing) - * fixed; model.remove() removes only what is necessary #1649 - * fixed; update() now only runs with cb or explicit true #1644 - * fixed; casting ref docs on creation #1606 [ebensing](https://github.com/ebensing) - * fixed; model.update "overwrite" option works as documented - * fixed; query#remove() works as documented - * fixed; "limit" correctly applies to individual items on population #1490 [ebensing](https://github.com/ebensing) - * fixed; issue with positional operator on ref docs #1572 [ebensing](https://github.com/ebensing) - * fixed; benchmarks to actually output valid json - * deprecated; promise#addBack (use promise#onResolve) - * deprecated; promise#complete (use promise#fulfill) - * deprecated; promise#addCallback (use promise#onFulFill) - * deprecated; promise#addErrback (use promise#onReject) - * deprecated; query.nearSphere() (use query.near) - * deprecated; query.center() (use query.circle) - * deprecated; query.centerSphere() (use query.circle) - * deprecated; query#slaveOk (use query#read) - * docs; custom validator messages - * docs; 10gen -> MongoDB - * docs; add Date method caveats #1598 - * docs; more validation details - * docs; state which branch is stable/unstable - * docs; mention that middleware does not run on Models - * docs; promise.fulfill() - * docs; fix readme spelling #1483 [yorchopolis](https://github.com/yorchopolis) - * docs; fixed up the README and examples [ebensing](https://github.com/ebensing) - * website; add "show code" for properties - * website; move "show code" links down - * website; update guide - * website; add unstable docs - * website; many improvements - * website; fix copyright #1439 - * website; server.js -> static.js #1546 [nikmartin](https://github.com/nikmartin) - * tests; refactor 1703 - * tests; add test generator - * tests; validate formatMessage() throws - * tests; add script for continuously running tests - * tests; fixed versioning tests - * tests; race conditions in tests - * tests; added for nested and/or queries - * tests; close some test connections - * tests; validate db contents - * tests; remove .only - * tests; close some test connections - * tests; validate db contents - * tests; remove .only - * tests; replace deprecated method names - * tests; convert id to string - * tests; fix sharding tests for MongoDB 2.4.5 - * tests; now 4-5 seconds faster - * tests; fix race condition - * make; suppress warning msg in test - * benchmarks; updated for pull requests - * examples; improved and expanded [ebensing](https://github.com/ebensing) - -3.7.4 (unstable) / 2013-10-01 -============================= - - * updated; mquery to 0.3.2 - * removed; mongoose.Error.DocumentError (never used) - * added; custom error msgs for built-in validators #747 - * added; discriminator support #1647 #1003 [j](https://github.com/j) - * added; support disabled collection name pluralization #1350 #1707 [refack](https://github.com/refack) - * fixed; do not pluralize model names not ending with letters #1703 [refack](https://github.com/refack) - * fixed; repopulating modified populated paths #1697 - * fixed; doc.equals() when _id option is set to false #1687 - * fixed; strict mode warnings #1686 - * fixed; $near GeoJSON casting #1683 - * fixed; nearSphere GeoJSON query builder - * fixed; population field selection w/ strings #1669 - * docs; custom validator messages - * docs; 10gen -> MongoDB - * docs; add Date method caveats #1598 - * docs; more validation details - * website; add "show code" for properties - * website; move "show code" links down - * tests; refactor 1703 - * tests; add test generator - * tests; validate formatMessage() throws - -3.7.3 (unstable) / 2013-08-22 -============================= - - * updated; warn when using an unstable version - * updated; mquery to 0.3.1 - * updated; mocha to 1.12.0 - * updated; mongodb driver to 1.3.19 (fix error swallowing behavior) - * changed; no longer offically supporting node 0.6.x - * added; support for GeoJSON to Query#near [ebensing](https://github.com/ebensing) - * added; stand-alone base query support - query.toConstructor() [ebensing](https://github.com/ebensing) - * added; promise support to geoSearch #1614 [ebensing](https://github.com/ebensing) - * added; promise support for geoNear #1614 [ebensing](https://github.com/ebensing) - * fixed; setters not firing on null values #1445 [ebensing](https://github.com/ebensing) - * fixed; handle another versioning edge case #1520 - * fixed; excluding subdocument fields #1280 [ebensing](https://github.com/ebensing) - * fixed; allow array properties to be set to null with findOneAndUpdate [aheuermann](https://github.com/aheuermann) - * fixed; subdocuments now use own toJSON opts #1376 [ebensing](https://github.com/ebensing) - * fixed; model#geoNear fulfills promise when results empty #1658 [ebensing](https://github.com/ebensing) - * fixed; utils.merge no longer overrides props and methods #1655 [j](https://github.com/j) - * fixed; subdocuments now use their own transform #1412 [ebensing](https://github.com/ebensing) - * make; suppress warning msg in test - * docs; state which branch is stable/unstable - * docs; mention that middleware does not run on Models - * tests; add script for continuously running tests - * tests; fixed versioning tests - * benchmarks; updated for pull requests - -3.7.2 (unstable) / 2013-08-15 -================== - - * fixed; model.remove() removes only what is necessary #1649 - * fixed; update() now only runs with cb or explicit true #1644 - * tests; race conditions in tests - * website; update guide - -3.7.1 (unstable) / 2013-08-13 -============================= - - * updated; driver to 1.3.18 (fixes memory leak) - * added; connection.useDb() #1124 [ebensing](https://github.com/ebensing) - * added; promise support to model.mapReduce() - * added; promise support to model.ensureIndexes() - * added; promise support to model.populate() - * fixed; casting ref docs on creation #1606 [ebensing](https://github.com/ebensing) - * fixed; model.update "overwrite" option works as documented - * fixed; query#remove() works as documented - * fixed; "limit" correctly applies to individual items on population #1490 [ebensing](https://github.com/ebensing) - * fixed; issue with positional operator on ref docs #1572 [ebensing](https://github.com/ebensing) - * fixed; benchmarks to actually output valid json - * tests; added for nested and/or queries - * tests; close some test connections - * tests; validate db contents - * tests; remove .only - * tests; close some test connections - * tests; validate db contents - * tests; remove .only - * tests; replace deprecated method names - * tests; convert id to string - * docs; promise.fulfill() - -3.7.0 (unstable) / 2013-08-05 -=================== - - * changed; query.within getter is now a method -> query.within() - * changed; query.intersects getter is now a method -> query.intersects() - * deprecated; promise#addBack (use promise#onResolve) - * deprecated; promise#complete (use promise#fulfill) - * deprecated; promise#addCallback (use promise#onFulFill) - * deprecated; promise#addErrback (use promise#onReject) - * deprecated; query.nearSphere() (use query.near) - * deprecated; query.center() (use query.circle) - * deprecated; query.centerSphere() (use query.circle) - * deprecated; query#slaveOk (use query#read) - * removed; namedscope (undocumented and broken) #679 #642 #455 #379 - * added; benchmarks [ebensing](https://github.com/ebensing) - * added; publicly exposed connection states #1585 - * added; $geoWithin support #1529 $1455 [ebensing](https://github.com/ebensing) - * added; query method chain validation - * added; model.update `overwrite` option - * added; model.geoNear() support #1563 [ebensing](https://github.com/ebensing) - * added; model.geoSearch() support #1560 [ebensing](https://github.com/ebensing) - * added; MongooseBuffer#subtype() - * added; model.create() now returns a promise #1340 - * added; support for `awaitdata` query option - * added; pass the doc to doc.remove() callback #1419 [JoeWagner](https://github.com/JoeWagner) - * added; aggregation query builder #1404 [njoyard](https://github.com/njoyard) - * updated; integrate mquery #1562 [ebensing](https://github.com/ebensing) - * updated; error msg in doc.save() #1595 - * updated; bump driver to 1.3.15 - * updated; mpromise 0.3.0 - * updated; sliced 0.0.5 - * tests; fix sharding tests for MongoDB 2.4.5 - * tests; now 4-5 seconds faster - * tests; fix race condition - * docs; fix readme spelling #1483 [yorchopolis](https://github.com/yorchopolis) - * docs; fixed up the README and examples [ebensing](https://github.com/ebensing) - * website; add unstable docs - * website; many improvements - * website; fix copyright #1439 - * website; server.js -> static.js #1546 [nikmartin](https://github.com/nikmartin) - * examples; improved and expanded [ebensing](https://github.com/ebensing) - -3.6.20 (stable) / 2013-09-23 -=================== - - * fixed; repopulating modified populated paths #1697 - * fixed; doc.equals w/ _id false #1687 - * fixed; strict mode warning #1686 - * docs; near/nearSphere - -3.6.19 (stable) / 2013-09-04 -================== - - * fixed; population field selection w/ strings #1669 - * docs; Date method caveats #1598 - -3.6.18 (stable) / 2013-08-22 -=================== - - * updated; warn when using an unstable version of mongoose - * updated; mocha to 1.12.0 - * updated; mongodb driver to 1.3.19 (fix error swallowing behavior) - * fixed; setters not firing on null values #1445 [ebensing](https://github.com/ebensing) - * fixed; properly exclude subdocument fields #1280 [ebensing](https://github.com/ebensing) - * fixed; cast error in findAndModify #1643 [aheuermann](https://github.com/aheuermann) - * website; update guide - * website; added documentation for safe:false and versioning interaction - * docs; mention that middleware dont run on Models - * docs; fix indexes link - * make; suppress warning msg in test - * tests; moar - -3.6.17 / 2013-08-13 -=================== - - * updated; driver to 1.3.18 (fixes memory leak) - * fixed; casting ref docs on creation #1606 - * docs; query options - -3.6.16 / 2013-08-08 -=================== - - * added; publicly expose connection states #1585 - * fixed; limit applies to individual items on population #1490 [ebensing](https://github.com/ebensing) - * fixed; positional operator casting in updates #1572 [ebensing](https://github.com/ebensing) - * updated; MongoDB driver to 1.3.17 - * updated; sliced to 0.0.5 - * website; tweak homepage - * tests; fixed + added - * docs; fix some examples - * docs; multi-mongos support details - * docs; auto open browser after starting static server - -3.6.15 / 2013-07-16 -================== - - * added; mongos failover support #1037 - * updated; make schematype return vals return self #1580 - * docs; add note to model.update #571 - * docs; document third param to document.save callback #1536 - * tests; tweek mongos test timeout - -3.6.14 / 2013-07-05 -=================== - - * updated; driver to 1.3.11 - * fixed; issue with findOneAndUpdate not returning null on upserts #1533 [ebensing](https://github.com/ebensing) - * fixed; missing return statement in SchemaArray#$geoIntersects() #1498 [bsrykt](https://github.com/bsrykt) - * fixed; wrong isSelected() behavior #1521 [kyano](https://github.com/kyano) - * docs; note about toObject behavior during save() - * docs; add callbacks details #1547 [nikmartin](https://github.com/nikmartin) - -3.6.13 / 2013-06-27 -=================== - - * fixed; calling model.distinct without conditions #1541 - * fixed; regression in Query#count() #1542 - * now working on 3.6.13 - -3.6.12 / 2013-06-25 -=================== - - * updated; driver to 1.3.10 - * updated; clearer capped collection error message #1509 [bitmage](https://github.com/bitmage) - * fixed; MongooseBuffer subtype loss during casting #1517 [zedgu](https://github.com/zedgu) - * fixed; docArray#id when doc.id is disabled #1492 - * fixed; docArray#id now supports matches on populated arrays #1492 [pgherveou](https://github.com/pgherveou) - * website; fix example - * website; improve _id disabling example - * website; fix typo #1494 [dejj](https://github.com/dejj) - * docs; added a 'Requesting new features' section #1504 [shovon](https://github.com/shovon) - * docs; improve subtypes description - * docs; clarify _id disabling - * docs: display by alphabetical order the methods list #1508 [nicolasleger](https://github.com/nicolasleger) - * tests; refactor isSelected checks - * tests; remove pointless test - * tests; fixed timeouts - -3.6.11 / 2013-05-15 -=================== - - * updated; driver to 1.3.5 - * fixed; compat w/ Object.create(null) #1484 #1485 - * fixed; cloning objects w/ missing constructors - * fixed; prevent multiple min number validators #1481 [nrako](https://github.com/nrako) - * docs; add doc.increment() example - * docs; add $size example - * docs; add "distinct" example - -3.6.10 / 2013-05-09 -================== - - * update driver to 1.3.3 - * fixed; increment() works without other changes #1475 - * website; fix links to posterous - * docs; fix link #1472 - -3.6.9 / 2013-05-02 -================== - - * fixed; depopulation of mixed documents #1471 - * fixed; use of $options in array #1462 - * tests; fix race condition - * docs; fix default example - -3.6.8 / 2013-04-25 -================== - - * updated; driver to 1.3.0 - * fixed; connection.model should retain options #1458 [vedmalex](https://github.com/vedmalex) - * tests; 4-5 seconds faster - -3.6.7 / 2013-04-19 -================== - - * fixed; population regression in 3.6.6 #1444 - -3.6.6 / 2013-04-18 -================== - - * fixed; saving populated new documents #1442 - * fixed; population regession in 3.6.5 #1441 - * website; fix copyright #1439 - -3.6.5 / 2013-04-15 -================== - - * fixed; strict:throw edge case using .set(path, val) - * fixed; schema.pathType() on some numbericAlpha paths - * fixed; numbericAlpha path versioning - * fixed; setting nested mixed paths #1418 - * fixed; setting nested objects with null prop #1326 - * fixed; regression in v3.6 population performance #1426 [vedmalex](https://github.com/vedmalex) - * fixed; read pref typos #1422 [kyano](https://github.com/kyano) - * docs; fix method example - * website; update faq - * website; add more deep links - * website; update poolSize docs - * website; add 3.6 release notes - * website; note about keepAlive - -3.6.4 / 2013-04-03 -================== - - * fixed; +field conflict with $slice #1370 - * fixed; nested deselection conflict #1333 - * fixed; RangeError in ValidationError.toString() #1296 - * fixed; do not save user defined transforms #1415 - * tests; fix race condition - -3.6.3 / 2013-04-02 -================== - - * fixed; setting subdocuments deeply nested fields #1394 - * fixed; regression: populated streams #1411 - * docs; mention hooks/validation with findAndModify - * docs; mention auth - * docs; add more links - * examples; add document methods example - * website; display "see" links for properties - * website; clean up homepage - -3.6.2 / 2013-03-29 -================== - - * fixed; corrupted sub-doc array #1408 - * fixed; document#update returns a Query #1397 - * docs; readpref strategy - -3.6.1 / 2013-03-27 -================== - - * added; populate support to findAndModify varients #1395 - * added; text index type to schematypes - * expose allowed index types as Schema.indexTypes - * fixed; use of `setMaxListeners` as path - * fixed; regression in node 0.6 on docs with > 10 arrays - * fixed; do not alter schema arguments #1364 - * fixed; subdoc#ownerDocument() #1385 - * website; change search id - * website; add search from google [jackdbernier](https://github.com/jackdbernier) - * website; fix link - * website; add 3.5.x docs release - * website; fix link - * docs; fix geometry - * docs; hide internal constructor - * docs; aggregation does not cast arguments #1399 - * docs; querystream options - * examples; added for population - -3.6.0 / 2013-03-18 -================== - - * changed; cast 'true'/'false' to boolean #1282 [mgrach](https://github.com/mgrach) - * changed; Buffer arrays can now contain nulls - * added; QueryStream transform option - * added; support for authSource driver option - * added; {mongoose,db}.modelNames() - * added; $push w/ $slice,$sort support (MongoDB 2.4) - * added; hashed index type (MongoDB 2.4) - * added; support for mongodb 2.4 geojson (MongoDB 2.4) - * added; value at time of validation error - * added; support for object literal schemas - * added; bufferCommands schema option - * added; allow auth option in connections #1360 [geoah](https://github.com/geoah) - * added; performance improvements to populate() [263ece9](https://github.com/LearnBoost/mongoose/commit/263ece9) - * added; allow adding uncasted docs to populated arrays and properties #570 - * added; doc#populated(path) stores original populated _ids - * added; lean population #1260 - * added; query.populate() now accepts an options object - * added; document#populate(opts, callback) - * added; Model.populate(docs, opts, callback) - * added; support for rich nested path population - * added; doc.array.remove(value) subdoc with _id value support #1278 - * added; optionally allow non-strict sets and updates - * added; promises/A+ comformancy with [mpromise](https://github.com/aheckmann/mpromise) - * added; promise#then - * added; promise#end - * fixed; use of `model` as doc property - * fixed; lean population #1382 - * fixed; empty object mixed defaults #1380 - * fixed; populate w/ deselected _id using string syntax - * fixed; attempted save of divergent populated arrays #1334 related - * fixed; better error msg when attempting toObject as property name - * fixed; non population buffer casting from doc - * fixed; setting populated paths #570 - * fixed; casting when added docs to populated arrays #570 - * fixed; prohibit updating arrays selected with $elemMatch #1334 - * fixed; pull / set subdoc combination #1303 - * fixed; multiple bg index creation #1365 - * fixed; manual reconnection to single mongod - * fixed; Constructor / version exposure #1124 - * fixed; CastError race condition - * fixed; no longer swallowing misuse of subdoc#invalidate() - * fixed; utils.clone retains RegExp opts - * fixed; population of non-schema property - * fixed; allow updating versionKey #1265 - * fixed; add EventEmitter props to reserved paths #1338 - * fixed; can now deselect populated doc _ids #1331 - * fixed; properly pass subtype to Binary in MongooseBuffer - * fixed; casting _id from document with non-ObjectId _id - * fixed; specifying schema type edge case { path: [{type: "String" }] } - * fixed; typo in schemdate #1329 [jplock](https://github.com/jplock) - * updated; driver to 1.2.14 - * updated; muri to 0.3.1 - * updated; mpromise to 0.2.1 - * updated; mocha 1.8.1 - * updated; mpath to 0.1.1 - * deprecated; pluralization will die in 4.x - * refactor; rename private methods to something unusable as doc properties - * refactor MongooseArray#remove - * refactor; move expires index to SchemaDate #1328 - * refactor; internal document properties #1171 #1184 - * tests; added - * docs; indexes - * docs; validation - * docs; populate - * docs; populate - * docs; add note about stream compatibility with node 0.8 - * docs; fix for private names - * docs; Buffer -> mongodb.Binary #1363 - * docs; auth options - * docs; improved - * website; update FAQ - * website; add more api links - * website; add 3.5.x docs to prior releases - * website; Change mongoose-types to an active repo [jackdbernier](https://github.com/jackdbernier) - * website; compat with node 0.10 - * website; add news section - * website; use T for generic type - * benchmark; make adjustable - -3.6.0rc1 / 2013-03-12 -====================== - - * refactor; rename private methods to something unusable as doc properties - * added; {mongoose,db}.modelNames() - * added; $push w/ $slice,$sort support (MongoDB 2.4) - * added; hashed index type (MongoDB 2.4) - * added; support for mongodb 2.4 geojson (MongoDB 2.4) - * added; value at time of validation error - * added; support for object literal schemas - * added; bufferCommands schema option - * added; allow auth option in connections #1360 [geoah](https://github.com/geoah) - * fixed; lean population #1382 - * fixed; empty object mixed defaults #1380 - * fixed; populate w/ deselected _id using string syntax - * fixed; attempted save of divergent populated arrays #1334 related - * fixed; better error msg when attempting toObject as property name - * fixed; non population buffer casting from doc - * fixed; setting populated paths #570 - * fixed; casting when added docs to populated arrays #570 - * fixed; prohibit updating arrays selected with $elemMatch #1334 - * fixed; pull / set subdoc combination #1303 - * fixed; multiple bg index creation #1365 - * fixed; manual reconnection to single mongod - * fixed; Constructor / version exposure #1124 - * fixed; CastError race condition - * fixed; no longer swallowing misuse of subdoc#invalidate() - * fixed; utils.clone retains RegExp opts - * fixed; population of non-schema property - * fixed; allow updating versionKey #1265 - * fixed; add EventEmitter props to reserved paths #1338 - * fixed; can now deselect populated doc _ids #1331 - * updated; muri to 0.3.1 - * updated; driver to 1.2.12 - * updated; mpromise to 0.2.1 - * deprecated; pluralization will die in 4.x - * docs; Buffer -> mongodb.Binary #1363 - * docs; auth options - * docs; improved - * website; add news section - * benchmark; make adjustable - -3.6.0rc0 / 2013-02-03 -====================== - - * changed; cast 'true'/'false' to boolean #1282 [mgrach](https://github.com/mgrach) - * changed; Buffer arrays can now contain nulls - * fixed; properly pass subtype to Binary in MongooseBuffer - * fixed; casting _id from document with non-ObjectId _id - * fixed; specifying schema type edge case { path: [{type: "String" }] } - * fixed; typo in schemdate #1329 [jplock](https://github.com/jplock) - * refactor; move expires index to SchemaDate #1328 - * refactor; internal document properties #1171 #1184 - * added; performance improvements to populate() [263ece9](https://github.com/LearnBoost/mongoose/commit/263ece9) - * added; allow adding uncasted docs to populated arrays and properties #570 - * added; doc#populated(path) stores original populated _ids - * added; lean population #1260 - * added; query.populate() now accepts an options object - * added; document#populate(opts, callback) - * added; Model.populate(docs, opts, callback) - * added; support for rich nested path population - * added; doc.array.remove(value) subdoc with _id value support #1278 - * added; optionally allow non-strict sets and updates - * added; promises/A+ comformancy with [mpromise](https://github.com/aheckmann/mpromise) - * added; promise#then - * added; promise#end - * updated; mocha 1.8.1 - * updated; muri to 0.3.0 - * updated; mpath to 0.1.1 - * updated; docs - -3.5.16 / 2013-08-13 -=================== - - * updated; driver to 1.3.18 - -3.5.15 / 2013-07-26 -================== - - * updated; sliced to 0.0.5 - * updated; driver to 1.3.12 - * fixed; regression in Query#count() due to driver change - * tests; fixed timeouts - * tests; handle differing test uris - -3.5.14 / 2013-05-15 -=================== - - * updated; driver to 1.3.5 - * fixed; compat w/ Object.create(null) #1484 #1485 - * fixed; cloning objects missing constructors - * fixed; prevent multiple min number validators #1481 [nrako](https://github.com/nrako) - -3.5.13 / 2013-05-09 -================== - - * update driver to 1.3.3 - * fixed; use of $options in array #1462 - -3.5.12 / 2013-04-25 -=================== - - * updated; driver to 1.3.0 - * fixed; connection.model should retain options #1458 [vedmalex](https://github.com/vedmalex) - * fixed; read pref typos #1422 [kyano](https://github.com/kyano) - -3.5.11 / 2013-04-03 -================== - - * fixed; +field conflict with $slice #1370 - * fixed; RangeError in ValidationError.toString() #1296 - * fixed; nested deselection conflict #1333 - * remove time from Makefile - -3.5.10 / 2013-04-02 -================== - - * fixed; setting subdocuments deeply nested fields #1394 - * fixed; do not alter schema arguments #1364 - -3.5.9 / 2013-03-15 -================== - - * updated; driver to 1.2.14 - * added; support for authSource driver option (mongodb 2.4) - * added; QueryStream transform option (node 0.10 helper) - * fixed; backport for saving required populated buffers - * fixed; pull / set subdoc combination #1303 - * fixed; multiple bg index creation #1365 - * test; added for saveable required populated buffers - * test; added for #1365 - * test; add authSource test - -3.5.8 / 2013-03-12 -================== - - * added; auth option in connection [geoah](https://github.com/geoah) - * fixed; CastError race condition - * docs; add note about stream compatibility with node 0.8 - -3.5.7 / 2013-02-22 -================== - - * updated; driver to 1.2.13 - * updated; muri to 0.3.1 #1347 - * fixed; utils.clone retains RegExp opts #1355 - * fixed; deepEquals RegExp support - * tests; fix a connection test - * website; clean up docs [afshinm](https://github.com/afshinm) - * website; update homepage - * website; migragtion: emphasize impact of strict docs #1264 - -3.5.6 / 2013-02-14 -================== - - * updated; driver to 1.2.12 - * fixed; properly pass Binary subtype - * fixed; add EventEmitter props to reserved paths #1338 - * fixed; use correct node engine version - * fixed; display empty docs as {} in log output #953 follow up - * improved; "bad $within $box argument" error message - * populate; add unscientific benchmark - * website; add stack overflow to help section - * website; use better code font #1336 [risseraka](https://github.com/risseraka) - * website; clarify where help is available - * website; fix source code links #1272 [floatingLomas](https://github.com/floatingLomas) - * docs; be specific about _id schema option #1103 - * docs; add ensureIndex error handling example - * docs; README - * docs; CONTRIBUTING.md - -3.5.5 / 2013-01-29 -================== - - * updated; driver to 1.2.11 - * removed; old node < 0.6x shims - * fixed; documents with Buffer _ids equality - * fixed; MongooseBuffer properly casts numbers - * fixed; reopening closed connection on alt host/port #1287 - * docs; fixed typo in Readme #1298 [rened](https://github.com/rened) - * docs; fixed typo in migration docs [Prinzhorn](https://github.com/Prinzhorn) - * docs; fixed incorrect annotation in SchemaNumber#min [bilalq](https://github.com/bilalq) - * docs; updated - -3.5.4 / 2013-01-07 -================== - - * changed; "_pres" & "_posts" are now reserved pathnames #1261 - * updated; driver to 1.2.8 - * fixed; exception when reopening a replica set. #1263 [ethankan](https://github.com/ethankan) - * website; updated - -3.5.3 / 2012-12-26 -================== - - * added; support for geo object notation #1257 - * fixed; $within query casting with arrays - * fixed; unix domain socket support #1254 - * updated; driver to 1.2.7 - * updated; muri to 0.0.5 - -3.5.2 / 2012-12-17 -================== - - * fixed; using auth with replica sets #1253 - -3.5.1 / 2012-12-12 -================== - - * fixed; regression when using subdoc with `path` as pathname #1245 [daeq](https://github.com/daeq) - * fixed; safer db option checks - * updated; driver to 1.2.5 - * website; add more examples - * website; clean up old docs - * website; fix prev release urls - * docs; clarify streaming with HTTP responses - -3.5.0 / 2012-12-10 -================== - - * added; paths to CastErrors #1239 - * added; support for mongodb connection string spec #1187 - * added; post validate event - * added; Schema#get (to retrieve schema options) - * added; VersionError #1071 - * added; npmignore [hidekiy](https://github.com/hidekiy) - * update; driver to 1.2.3 - * fixed; stackoverflow in setter #1234 - * fixed; utils.isObject() - * fixed; do not clobber user specified driver writeConcern #1227 - * fixed; always pass current document to post hooks - * fixed; throw error when user attempts to overwrite a model - * fixed; connection.model only caches on connection #1209 - * fixed; respect conn.model() creation when matching global model exists #1209 - * fixed; passing model name + collection name now always honors collection name - * fixed; setting virtual field to an empty object #1154 - * fixed; subclassed MongooseErrors exposure, now available in mongoose.Error.xxxx - * fixed; model.remove() ignoring callback when executed twice [daeq](https://github.com/daeq) #1210 - * docs; add collection option to schema api docs #1222 - * docs; NOTE about db safe options - * docs; add post hooks docs - * docs; connection string options - * docs; middleware is not executed with Model.remove #1241 - * docs; {g,s}etter introspection #777 - * docs; update validation docs - * docs; add link to plugins page - * docs; clarify error returned by unique indexes #1225 - * docs; more detail about disabling autoIndex behavior - * docs; add homepage section to package (npm docs mongoose) - * docs; more detail around collection name pluralization #1193 - * website; add .important css - * website; update models page - * website; update getting started - * website; update quick start - -3.4.0 / 2012-11-10 -================== - - * added; support for generic toJSON/toObject transforms #1160 #1020 #1197 - * added; doc.set() merge support #1148 [NuORDER](https://github.com/NuORDER) - * added; query#add support #1188 [aleclofabbro](https://github.com/aleclofabbro) - * changed; adding invalid nested paths to non-objects throws 4216f14 - * changed; fixed; stop invalid function cloning (internal fix) - * fixed; add query $and casting support #1180 [anotheri](https://github.com/anotheri) - * fixed; overwriting of query arguments #1176 - * docs; fix expires examples - * docs; transforms - * docs; schema `collection` option docs [hermanjunge](https://github.com/hermanjunge) - * website; updated - * tests; added - -3.3.1 / 2012-10-11 -================== - - * fixed; allow goose.connect(uris, dbname, opts) #1144 - * docs; persist API private checked state across page loads - -3.3.0 / 2012-10-10 -================== - - * fixed; passing options as 2nd arg to connect() #1144 - * fixed; race condition after no-op save #1139 - * fixed; schema field selection application in findAndModify #1150 - * fixed; directly setting arrays #1126 - * updated; driver to 1.1.11 - * updated; collection pluralization rules [mrickard](https://github.com/mrickard) - * tests; added - * docs; updated - -3.2.2 / 2012-10-08 -================== - - * updated; driver to 1.1.10 #1143 - * updated; use sliced 0.0.3 - * fixed; do not recast embedded docs unnecessarily - * fixed; expires schema option helper #1132 - * fixed; built in string setters #1131 - * fixed; debug output for Dates/ObjectId properties #1129 - * docs; fixed Javascript syntax error in example [olalonde](https://github.com/olalonde) - * docs; fix toJSON example #1137 - * docs; add ensureIndex production notes - * docs; fix spelling - * docs; add blogposts about v3 - * website; updated - * removed; undocumented inGroupsOf util - * tests; added - -3.2.1 / 2012-09-28 -================== - - * fixed; remove query batchSize option default of 1000 https://github.com/learnboost/mongoose/commit/3edaa8651 - * docs; updated - * website; updated - -3.2.0 / 2012-09-27 -================== - - * added; direct array index assignment with casting support `doc.array.set(index, value)` - * fixed; QueryStream#resume within same tick as pause() #1116 - * fixed; default value validatation #1109 - * fixed; array splice() not casting #1123 - * fixed; default array construction edge case #1108 - * fixed; query casting for inequalities in arrays #1101 [dpatti](https://github.com/dpatti) - * tests; added - * website; more documentation - * website; fixed layout issue #1111 [SlashmanX](https://github.com/SlashmanX) - * website; refactored [guille](https://github.com/guille) - -3.1.2 / 2012-09-10 -================== - - * added; ReadPreferrence schema option #1097 - * updated; driver to 1.1.7 - * updated; default query batchSize to 1000 - * fixed; we now cast the mapReduce query option #1095 - * fixed; $elemMatch+$in with field selection #1091 - * fixed; properly cast $elemMatch+$in conditions #1100 - * fixed; default field application of subdocs #1027 - * fixed; querystream prematurely dying #1092 - * fixed; querystream never resumes when paused at getMore boundries #1092 - * fixed; querystream occasionally emits data events after destroy #1092 - * fixed; remove unnecessary ObjectId creation in querystream - * fixed; allow ne(boolean) again #1093 - * docs; add populate/field selection syntax notes - * docs; add toObject/toJSON options detail - * docs; `read` schema option - -3.1.1 / 2012-08-31 -================== - - * updated; driver to 1.1.6 - -3.1.0 / 2012-08-29 -================== - - * changed; fixed; directly setting nested objects now overwrites entire object (previously incorrectly merged them) - * added; read pref support (mongodb 2.2) 205a709c - * added; aggregate support (mongodb 2.2) f3a5bd3d - * added; virtual {g,s}etter introspection (#1070) - * updated; docs [brettz9](https://github.com/brettz9) - * updated; driver to 1.1.5 - * fixed; retain virtual setter return values (#1069) - -3.0.3 / 2012-08-23 -================== - - * fixed; use of nested paths beginning w/ numbers #1062 - * fixed; query population edge case #1053 #1055 [jfremy](https://github.com/jfremy) - * fixed; simultaneous top and sub level array modifications #1073 - * added; id and _id schema option aliases + tests - * improve debug formatting to allow copy/paste logged queries into mongo shell [eknkc](https://github.com/eknkc) - * docs - -3.0.2 / 2012-08-17 -================== - - * added; missing support for v3 sort/select syntax to findAndModify helpers (#1058) - * fixed; replset fullsetup event emission - * fixed; reconnected event for replsets - * fixed; server reconnection setting discovery - * fixed; compat with non-schema path props using positional notation (#1048) - * fixed; setter/casting order (#665) - * docs; updated - -3.0.1 / 2012-08-11 -================== - - * fixed; throw Error on bad validators (1044) - * fixed; typo in EmbeddedDocument#parentArray [lackac] - * fixed; repair mongoose.SchemaTypes alias - * updated; docs - -3.0.0 / 2012-08-07 -================== - - * removed; old subdocument#commit method - * fixed; setting arrays of matching docs [6924cbc2] - * fixed; doc!remove event now emits in save order as save for consistency - * fixed; pre-save hooks no longer fire on subdocuments when validation fails - * added; subdoc#parent() and subdoc#parentArray() to access subdocument parent objects - * added; query#lean() helper - -3.0.0rc0 / 2012-08-01 -===================== - - * fixed; allow subdoc literal declarations containing "type" pathname (#993) - * fixed; unsetting a default array (#758) - * fixed; boolean $in queries (#998) - * fixed; allow use of `options` as a pathname (#529) - * fixed; `model` is again a permitted schema path name - * fixed; field selection option on subdocs (#1022) - * fixed; handle another edge case with subdoc saving (#975) - * added; emit save err on model if listening - * added; MongoDB TTL collection support (#1006) - * added; $center options support - * added; $nearSphere and $polygon support - * updated; driver version to 1.1.2 - -3.0.0alpha2 / 2012-07-18 -========================= - - * changed; index errors are now emitted on their model and passed to an optional callback (#984) - * fixed; specifying index along with sparse/unique option no longer overwrites (#1004) - * fixed; never swallow connection errors (#618) - * fixed; creating object from model with emded object no longer overwrites defaults [achurkin] (#859) - * fixed; stop needless validation of unchanged/unselected fields (#891) - * fixed; document#equals behavior of objectids (#974) - * fixed; honor the minimize schema option (#978) - * fixed; provide helpful error msgs when reserved schema path is used (#928) - * fixed; callback to conn#disconnect is optional (#875) - * fixed; handle missing protocols in connection urls (#987) - * fixed; validate args to query#where (#969) - * fixed; saving modified/removed subdocs (#975) - * fixed; update with $pull from Mixed array (#735) - * fixed; error with null shard key value - * fixed; allow unsetting enums (#967) - * added; support for manual index creation (#984) - * added; support for disabled auto-indexing (#984) - * added; support for preserving MongooseArray#sort changes (#752) - * added; emit state change events on connection - * added; support for specifying BSON subtype in MongooseBuffer#toObject [jcrugzz] - * added; support for disabled versioning (#977) - * added; implicit "new" support for models and Schemas - -3.0.0alpha1 / 2012-06-15 -========================= - - * removed; doc#commit (use doc#markModified) - * removed; doc.modified getter (#950) - * removed; mongoose{connectSet,createSetConnection}. use connect,createConnection instead - * removed; query alias methods 1149804c - * removed; MongooseNumber - * changed; now creating indexes in background by default - * changed; strict mode now enabled by default (#952) - * changed; doc#modifiedPaths is now a method (#950) - * changed; getters no longer cast (#820); casting happens during set - * fixed; no need to pass updateArg to findOneAndUpdate (#931) - * fixed: utils.merge bug when merging nested non-objects. [treygriffith] - * fixed; strict:throw should produce errors in findAndModify (#963) - * fixed; findAndUpdate no longer overwrites document (#962) - * fixed; setting default DocumentArrays (#953) - * fixed; selection of _id with schema deselection (#954) - * fixed; ensure promise#error emits instanceof Error - * fixed; CursorStream: No stack overflow on any size result (#929) - * fixed; doc#remove now passes safe options - * fixed; invalid use of $set during $pop - * fixed; array#{$pop,$shift} mirror MongoDB behavior - * fixed; no longer test non-required vals in string match (#934) - * fixed; edge case with doc#inspect - * fixed; setter order (#665) - * fixed; setting invalid paths in strict mode (#916) - * fixed; handle docs without id in DocumentArray#id method (#897) - * fixed; do not save virtuals during model.update (#894) - * fixed; sub doc toObject virtuals application (#889) - * fixed; MongooseArray#pull of ObjectId (#881) - * fixed; handle passing db name with any repl set string - * fixed; default application of selected fields (#870) - * fixed; subdoc paths reported in validation errors (#725) - * fixed; incorrect reported num of affected docs in update ops (#862) - * fixed; connection assignment in Model#model (#853) - * fixed; stringifying arrays of docs (#852) - * fixed; modifying subdoc and parent array works (#842) - * fixed; passing undefined to next hook (#785) - * fixed; Query#{update,remove}() works without callbacks (#788) - * fixed; set/updating nested objects by parent pathname (#843) - * fixed; allow null in number arrays (#840) - * fixed; isNew on sub doc after insertion error (#837) - * fixed; if an insert fails, set isNew back to false [boutell] - * fixed; isSelected when only _id is selected (#730) - * fixed; setting an unset default value (#742) - * fixed; query#sort error messaging (#671) - * fixed; support for passing $options with $regex - * added; array of object literal notation in schema creates DocumentArrays - * added; gt,gte,lt,lte query support for arrays (#902) - * added; capped collection support (#938) - * added; document versioning support - * added; inclusion of deselected schema path (#786) - * added; non-atomic array#pop - * added; EmbeddedDocument constructor is now exposed in DocArray#create 7cf8beec - * added; mapReduce support (#678) - * added; support for a configurable minimize option #to{Object,JSON}(option) (#848) - * added; support for strict: `throws` [regality] - * added; support for named schema types (#795) - * added; to{Object,JSON} schema options (#805) - * added; findByIdAnd{Update,Remove}() - * added; findOneAnd{Update,Remove}() - * added; query.setOptions() - * added; instance.update() (#794) - * added; support specifying model in populate() [DanielBaulig] - * added; `lean` query option [gitfy] - * added; multi-atomic support to MongooseArray#nonAtomicPush - * added; support for $set + other $atomic ops on single array - * added; tests - * updated; driver to 1.0.2 - * updated; query.sort() syntax to mirror query.select() - * updated; clearer cast error msg for array numbers - * updated; docs - * updated; doc.clone 3x faster (#950) - * updated; only create _id if necessary (#950) - -2.7.3 / 2012-08-01 -================== - - * fixed; boolean $in queries (#998) - * fixed field selection option on subdocs (#1022) - -2.7.2 / 2012-07-18 -================== - - * fixed; callback to conn#disconnect is optional (#875) - * fixed; handle missing protocols in connection urls (#987) - * fixed; saving modified/removed subdocs (#975) - * updated; tests - -2.7.1 / 2012-06-26 -=================== - - * fixed; sharding: when a document holds a null as a value of the shard key - * fixed; update() using $pull on an array of Mixed (gh-735) - * deprecated; MongooseNumber#{inc, increment, decrement} methods - * tests; now using mocha - -2.7.0 / 2012-06-14 -=================== - - * added; deprecation warnings to methods being removed in 3.x - -2.6.8 / 2012-06-14 -=================== - - * fixed; edge case when using 'options' as a path name (#961) - -2.6.7 / 2012-06-08 -=================== - - * fixed; ensure promise#error always emits instanceof Error - * fixed; selection of _id w/ another excluded path (#954) - * fixed; setting default DocumentArrays (#953) - -2.6.6 / 2012-06-06 -=================== - - * fixed; stack overflow in query stream with large result sets (#929) - * added; $gt, $gte, $lt, $lte support to arrays (#902) - * fixed; pass option `safe` along to doc#remove() calls - -2.6.5 / 2012-05-24 -=================== - - * fixed; do not save virtuals in Model.update (#894) - * added; missing $ prefixed query aliases (going away in 3.x) (#884) [timoxley] - * fixed; setting invalid paths in strict mode (#916) - * fixed; resetting isNew after insert failure (#837) [boutell] - -2.6.4 / 2012-05-15 -=================== - - * updated; backport string regex $options to 2.x - * updated; use driver 1.0.2 (performance improvements) (#914) - * fixed; calling MongooseDocumentArray#id when the doc has no _id (#897) - -2.6.3 / 2012-05-03 -=================== - - * fixed; repl-set connectivity issues during failover on MongoDB 2.0.1 - * updated; driver to 1.0.0 - * fixed; virtuals application of subdocs when using toObject({ virtuals: true }) (#889) - * fixed; MongooseArray#pull of ObjectId correctly updates the array itself (#881) - -2.6.2 / 2012-04-30 -=================== - - * fixed; default field application of selected fields (#870) - -2.6.1 / 2012-04-30 -=================== - - * fixed; connection assignment in mongoose#model (#853, #877) - * fixed; incorrect reported num of affected docs in update ops (#862) - -2.6.0 / 2012-04-19 -=================== - - * updated; hooks.js to 0.2.1 - * fixed; issue with passing undefined to a hook callback. thanks to [chrisleishman] for reporting. - * fixed; updating/setting nested objects in strict schemas (#843) as reported by [kof] - * fixed; Query#{update,remove}() work without callbacks again (#788) - * fixed; modifying subdoc along with parent array $atomic op (#842) - -2.5.14 / 2012-04-13 -=================== - - * fixed; setting an unset default value (#742) - * fixed; doc.isSelected(otherpath) when only _id is selected (#730) - * updated; docs - -2.5.13 / 2012-03-22 -=================== - - * fixed; failing validation of unselected required paths (#730,#713) - * fixed; emitting connection error when only one listener (#759) - * fixed; MongooseArray#splice was not returning values (#784) [chrisleishman] - -2.5.12 / 2012-03-21 -=================== - - * fixed; honor the `safe` option in all ensureIndex calls - * updated; node-mongodb-native driver to 0.9.9-7 - -2.5.11 / 2012-03-15 -=================== - - * added; introspection for getters/setters (#745) - * updated; node-mongodb-driver to 0.9.9-5 - * added; tailable method to Query (#769) [holic] - * fixed; Number min/max validation of null (#764) [btamas] - * added; more flexible user/password connection options (#738) [KarneAsada] - -2.5.10 / 2012-03-06 -=================== - - * updated; node-mongodb-native driver to 0.9.9-4 - * added; Query#comment() - * fixed; allow unsetting arrays - * fixed; hooking the set method of subdocuments (#746) - * fixed; edge case in hooks - * fixed; allow $id and $ref in queries (fixes compatibility with mongoose-dbref) (#749) [richtera] - * added; default path selection to SchemaTypes - -2.5.9 / 2012-02-22 -=================== - - * fixed; properly cast nested atomic update operators for sub-documents - -2.5.8 / 2012-02-21 -=================== - - * added; post 'remove' middleware includes model that was removed (#729) [timoxley] - -2.5.7 / 2012-02-09 -=================== - - * fixed; RegExp validators on node >= v0.6.x - -2.5.6 / 2012-02-09 -=================== - - * fixed; emit errors returned from db.collection() on the connection (were being swallowed) - * added; can add multiple validators in your schema at once (#718) [diogogmt] - * fixed; strict embedded documents (#717) - * updated; docs [niemyjski] - * added; pass number of affected docs back in model.update/save - -2.5.5 / 2012-02-03 -=================== - - * fixed; RangeError: maximum call stack exceed error when removing docs with Number _id (#714) - -2.5.4 / 2012-02-03 -=================== - - * fixed; RangeError: maximum call stack exceed error (#714) - -2.5.3 / 2012-02-02 -=================== - - * added; doc#isSelected(path) - * added; query#equals() - * added; beta sharding support - * added; more descript error msgs (#700) [obeleh] - * added; document.modifiedPaths (#709) [ljharb] - * fixed; only functions can be added as getters/setters (#707,704) [ljharb] - -2.5.2 / 2012-01-30 -=================== - - * fixed; rollback -native driver to 0.9.7-3-5 (was causing timeouts and other replica set weirdness) - * deprecated; MongooseNumber (will be moved to a separate repo for 3.x) - * added; init event is emitted on schemas - -2.5.1 / 2012-01-27 -=================== - - * fixed; honor strict schemas in Model.update (#699) - -2.5.0 / 2012-01-26 -=================== - - * added; doc.toJSON calls toJSON on embedded docs when exists [jerem] - * added; populate support for refs of type Buffer (#686) [jerem] - * added; $all support for ObjectIds and Dates (#690) - * fixed; virtual setter calling on instantiation when strict: true (#682) [hunterloftis] - * fixed; doc construction triggering getters (#685) - * fixed; MongooseBuffer check in deepEquals (#688) - * fixed; range error when using Number _ids with `instance.save()` (#691) - * fixed; isNew on embedded docs edge case (#680) - * updated; driver to 0.9.8-3 - * updated; expose `model()` method within static methods - -2.4.10 / 2012-01-10 -=================== - - * added; optional getter application in .toObject()/.toJSON() (#412) - * fixed; nested $operators in $all queries (#670) - * added; $nor support (#674) - * fixed; bug when adding nested schema (#662) [paulwe] - -2.4.9 / 2012-01-04 -=================== - - * updated; driver to 0.9.7-3-5 to fix Linux performance degradation on some boxes - -2.4.8 / 2011-12-22 -=================== - - * updated; bump -native to 0.9.7.2-5 - * fixed; compatibility with date.js (#646) [chrisleishman] - * changed; undocumented schema "lax" option to "strict" - * fixed; default value population for strict schemas - * updated; the nextTick helper for small performance gain. 1bee2a2 - -2.4.7 / 2011-12-16 -=================== - - * fixed; bug in 2.4.6 with path setting - * updated; bump -native to 0.9.7.2-1 - * added; strict schema option [nw] - -2.4.6 / 2011-12-16 -=================== - - * fixed; conflicting mods on update bug [sirlantis] - * improved; doc.id getter performance - -2.4.5 / 2011-12-14 -=================== - - * fixed; bad MongooseArray behavior in 2.4.2 - 2.4.4 - -2.4.4 / 2011-12-14 -=================== - - * fixed; MongooseArray#doAtomics throwing after sliced - -2.4.3 / 2011-12-14 -=================== - - * updated; system.profile schema for MongoDB 2x - -2.4.2 / 2011-12-12 -=================== - - * fixed; partially populating multiple children of subdocs (#639) [kenpratt] - * fixed; allow Update of numbers to null (#640) [jerem] - -2.4.1 / 2011-12-02 -=================== - - * added; options support for populate() queries - * updated; -native driver to 0.9.7-1.4 - -2.4.0 / 2011-11-29 -=================== - - * added; QueryStreams (#614) - * added; debug print mode for development - * added; $within support to Array queries (#586) [ggoodale] - * added; $centerSphere query support - * fixed; $within support - * added; $unset is now used when setting a path to undefined (#519) - * added; query#batchSize support - * updated; docs - * updated; -native driver to 0.9.7-1.3 (provides Windows support) - -2.3.13 / 2011-11-15 -=================== - - * fixed; required validation for Refs (#612) [ded] - * added; $nearSphere support for Arrays (#610) - -2.3.12 / 2011-11-09 -=================== - - * fixed; regression, objects passed to Model.update should not be changed (#605) - * fixed; regression, empty Model.update should not be executed - -2.3.11 / 2011-11-08 -=================== - - * fixed; using $elemMatch on arrays of Mixed types (#591) - * fixed; allow using $regex when querying Arrays (#599) - * fixed; calling Model.update with no atomic keys (#602) - -2.3.10 / 2011-11-05 -=================== - - * fixed; model.update casting for nested paths works (#542) - -2.3.9 / 2011-11-04 -================== - - * fixed; deepEquals check for MongooseArray returned false - * fixed; reset modified flags of embedded docs after save [gitfy] - * fixed; setting embedded doc with identical values no longer marks modified [gitfy] - * updated; -native driver to 0.9.6.23 [mlazarov] - * fixed; Model.update casting (#542, #545, #479) - * fixed; populated refs no longer fail required validators (#577) - * fixed; populating refs of objects with custom ids works - * fixed; $pop & $unset work with Model.update (#574) - * added; more helpful debugging message for Schema#add (#578) - * fixed; accessing .id when no _id exists now returns null (#590) - -2.3.8 / 2011-10-26 -================== - - * added; callback to query#findOne is now optional (#581) - -2.3.7 / 2011-10-24 -================== - - * fixed; wrapped save/remove callbacks in nextTick to mitigate -native swallowing thrown errors - -2.3.6 / 2011-10-21 -================== - - * fixed; exclusion of embedded doc _id from query results (#541) - -2.3.5 / 2011-10-19 -================== - - * fixed; calling queries without passing a callback works (#569) - * fixed; populate() works with String and Number _ids too (#568) - -2.3.4 / 2011-10-18 -================== - - * added; Model.create now accepts an array as a first arg - * fixed; calling toObject on a DocumentArray with nulls no longer throws - * fixed; calling inspect on a DocumentArray with nulls no longer throws - * added; MongooseArray#unshift support - * fixed; save hooks now fire on embedded documents [gitfy] (#456) - * updated; -native driver to 0.9.6-22 - * fixed; correctly pass $addToSet op instead of $push - * fixed; $addToSet properly detects dates - * fixed; $addToSet with multiple items works - * updated; better node 0.6 Buffer support - -2.3.3 / 2011-10-12 -================== - - * fixed; population conditions in multi-query settings [vedmalex] (#563) - * fixed; now compatible with Node v0.5.x - -2.3.2 / 2011-10-11 -================== - - * fixed; population of null subdoc properties no longer hangs (#561) - -2.3.1 / 2011-10-10 -================== - - * added; support for Query filters to populate() [eneko] - * fixed; querying with number no longer crashes mongodb (#555) [jlbyrey] - * updated; version of -native driver to 0.9.6-21 - * fixed; prevent query callbacks that throw errors from corrupting -native connection state - -2.3.0 / 2011-10-04 -================== - - * fixed; nulls as default values for Boolean now works as expected - * updated; version of -native driver to 0.9.6-20 - -2.2.4 / 2011-10-03 -================== - - * fixed; populate() works when returned array contains undefined/nulls - -2.2.3 / 2011-09-29 -================== - - * updated; version of -native driver to 0.9.6-19 - -2.2.2 / 2011-09-28 -================== - - * added; $regex support to String [davidandrewcope] - * added; support for other contexts like repl etc (#535) - * fixed; clear modified state properly after saving - * added; $addToSet support to Array - -2.2.1 / 2011-09-22 -================== - - * more descript error when casting undefined to string - * updated; version of -native driver to 0.9.6-18 - -2.2.0 / 2011-09-22 -================== - - * fixed; maxListeners warning on schemas with many arrays (#530) - * changed; return / apply defaults based on fields selected in query (#423) - * fixed; correctly detect Mixed types within schema arrays (#532) - -2.1.4 / 2011-09-20 -================== - - * fixed; new private methods that stomped on users code - * changed; finished removing old "compat" support which did nothing - -2.1.3 / 2011-09-16 -================== - - * updated; version of -native driver to 0.9.6-15 - * added; emit `error` on connection when open fails [edwardhotchkiss] - * added; index support to Buffers (thanks justmoon for helping track this down) - * fixed; passing collection name via schema in conn.model() now works (thanks vedmalex for reporting) - -2.1.2 / 2011-09-07 -================== - - * fixed; Query#find with no args no longer throws - -2.1.1 / 2011-09-07 -================== - - * added; support Model.count(fn) - * fixed; compatibility with node >=0.4.0 < 0.4.3 - * added; pass model.options.safe through with .save() so w:2, wtimeout:5000 options work [andrewjstone] - * added; support for $type queries - * added; support for Query#or - * added; more tests - * optimized populate queries - -2.1.0 / 2011-09-01 -================== - - * changed; document#validate is a public method - * fixed; setting number to same value no longer marks modified (#476) [gitfy] - * fixed; Buffers shouldn't have default vals - * added; allow specifying collection name in schema (#470) [ixti] - * fixed; reset modified paths and atomics after saved (#459) - * fixed; set isNew on embedded docs to false after save - * fixed; use self to ensure proper scope of options in doOpenSet (#483) [andrewjstone] - -2.0.4 / 2011-08-29 -================== - - * Fixed; Only send the depopulated ObjectId instead of the entire doc on save (DBRefs) - * Fixed; Properly cast nested array values in Model.update (the data was stored in Mongo incorrectly but recast on document fetch was "fixing" it) - -2.0.3 / 2011-08-28 -================== - - * Fixed; manipulating a populated array no longer causes infinite loop in BSON serializer during save (#477) - * Fixed; populating an empty array no longer hangs foreeeeeeeever (#481) - -2.0.2 / 2011-08-25 -================== - - * Fixed; Maintain query option key order (fixes 'bad hint' error from compound query hints) - -2.0.1 / 2011-08-25 -================== - - * Fixed; do not over-write the doc when no valide props exist in Model.update (#473) - -2.0.0 / 2011-08-24 -=================== - - * Added; support for Buffers [justmoon] - * Changed; improved error handling [maelstrom] - * Removed: unused utils.erase - * Fixed; support for passing other context object into Schemas (#234) [Sija] - * Fixed; getters are no longer circular refs to themselves (#366) - * Removed; unused compat.js - * Fixed; getter/setter scopes are set properly - * Changed; made several private properties more obvious by prefixing _ - * Added; DBRef support [guille] - * Changed; removed support for multiple collection names per model - * Fixed; no longer applying setters when document returned from db - * Changed; default auto_reconnect to true - * Changed; Query#bind no longer clones the query - * Fixed; Model.update now accepts $pull, $inc and friends (#404) - * Added; virtual type option support [nw] - -1.8.4 / 2011-08-21 -=================== - - * Fixed; validation bug when instantiated with non-schema properties (#464) [jmreidy] - -1.8.3 / 2011-08-19 -=================== - - * Fixed; regression in connection#open [jshaw86] - -1.8.2 / 2011-08-17 -=================== - - * fixed; reset connection.readyState after failure [tomseago] - * fixed; can now query positionally for non-embedded docs (arrays of numbers/strings etc) - * fixed; embedded document query casting - * added; support for passing options to node-mongo-native db, server, and replsetserver [tomseago] - -1.8.1 / 2011-08-10 -=================== - - * fixed; ObjectIds were always marked modified - * fixed; can now query using document instances - * fixed; can now query/update using documents with subdocs - -1.8.0 / 2011-08-04 -=================== - - * fixed; can now use $all with String and Number - * fixed; can query subdoc array with $ne: null - * fixed; instance.subdocs#id now works with custom _ids - * fixed; do not apply setters when doc returned from db (change in bad behavior) - -1.7.4 / 2011-07-25 -=================== - - * fixed; sparse now a valid seperate schema option - * fixed; now catching cast errors in queries - * fixed; calling new Schema with object created in vm.runInNewContext now works (#384) [Sija] - * fixed; String enum was disallowing null - * fixed; Find by nested document _id now works (#389) - -1.7.3 / 2011-07-16 -=================== - - * fixed; MongooseArray#indexOf now works with ObjectIds - * fixed; validation scope now set properly (#418) - * fixed; added missing colors dependency (#398) - -1.7.2 / 2011-07-13 -=================== - - * changed; node-mongodb-native driver to v0.9.6.7 - -1.7.1 / 2011-07-12 -=================== - - * changed; roll back node-mongodb-native driver to v0.9.6.4 - -1.7.0 / 2011-07-12 -=================== - - * fixed; collection name misspelling [mathrawka] - * fixed; 2nd param is required for ReplSetServers [kevinmarvin] - * fixed; MongooseArray behaves properly with Object.keys - * changed; node-mongodb-native driver to v0.9.6.6 - * fixed/changed; Mongodb segfault when passed invalid ObjectId (#407) - - This means invalid data passed to the ObjectId constructor will now error - -1.6.0 / 2011-07-07 -=================== - - * changed; .save() errors are now emitted on the instances db instead of the instance 9782463fc - * fixed; errors occurring when creating indexes now properly emit on db - * added; $maxDistance support to MongooseArrays - * fixed; RegExps now work with $all - * changed; node-mongodb-native driver to v0.9.6.4 - * fixed; model names are now accessible via .modelName - * added; Query#slaveOk support - -1.5.0 / 2011-06-27 -=================== - - * changed; saving without a callback no longer ignores the error (@bnoguchi) - * changed; hook-js version bump to 0.1.9 - * changed; node-mongodb-native version bumped to 0.9.6.1 - When .remove() doesn't - return an error, null is no longer passed. - * fixed; two memory leaks (@justmoon) - * added; sparse index support - * added; more ObjectId conditionals (gt, lt, gte, lte) (@phillyqueso) - * added; options are now passed in model#remote (@JerryLuke) - -1.4.0 / 2011-06-10 -=================== - - * bumped hooks-js dependency (fixes issue passing null as first arg to next()) - * fixed; document#inspect now works properly with nested docs - * fixed; 'set' now works as a schema attribute (GH-365) - * fixed; _id is now set properly within pre-init hooks (GH-289) - * added; Query#distinct / Model#distinct support (GH-155) - * fixed; embedded docs now can use instance methods (GH-249) - * fixed; can now overwrite strings conflicting with schema type - -1.3.7 / 2011-06-03 -=================== - - * added MongooseArray#splice support - * fixed; 'path' is now a valid Schema pathname - * improved hooks (utilizing https://github.com/bnoguchi/hooks-js) - * fixed; MongooseArray#$shift now works (never did) - * fixed; Document.modified no longer throws - * fixed; modifying subdoc property sets modified paths for subdoc and parent doc - * fixed; marking subdoc path as modified properly persists the value to the db - * fixed; RexExps can again be saved ( #357 ) - -1.3.6 / 2011-05-18 -=================== - - * fixed; corrected casting for queries against array types - * added; Document#set now accepts Document instances - -1.3.5 / 2011-05-17 -=================== - - * fixed; $ne queries work properly with single vals - * added; #inspect() methods to improve console.log output - -1.3.4 / 2011-05-17 -=================== - - * fixed; find by Date works as expected (#336) - * added; geospatial 2d index support - * added; support for $near (#309) - * updated; node-mongodb-native driver - * fixed; updating numbers work (#342) - * added; better error msg when try to remove an embedded doc without an _id (#307) - * added; support for 'on-the-fly' schemas (#227) - * changed; virtual id getters can now be skipped - * fixed; .index() called on subdoc schema now works as expected - * fixed; db.setProfile() now buffers until the db is open (#340) - -1.3.3 / 2011-04-27 -=================== - - * fixed; corrected query casting on nested mixed types - -1.3.2 / 2011-04-27 -=================== - - * fixed; query hints now retain key order - -1.3.1 / 2011-04-27 -=================== - - * fixed; setting a property on an embedded array no longer overwrites entire array (GH-310) - * fixed; setting nested properties works when sibling prop is named "type" - * fixed; isModified is now much finer grained when .set() is used (GH-323) - * fixed; mongoose.model() and connection.model() now return the Model (GH-308, GH-305) - * fixed; can now use $gt, $lt, $gte, $lte with String schema types (GH-317) - * fixed; .lowercase() -> .toLowerCase() in pluralize() - * fixed; updating an embedded document by index works (GH-334) - * changed; .save() now passes the instance to the callback (GH-294, GH-264) - * added; can now query system.profile and system.indexes collections - * added; db.model('system.profile') is now included as a default Schema - * added; db.setProfiling(level, ms, callback) - * added; Query#hint() support - * added; more tests - * updated node-mongodb-native to 0.9.3 - -1.3.0 / 2011-04-19 -=================== - - * changed; save() callbacks now fire only once on failed validation - * changed; Errors returned from save() callbacks now instances of ValidationError - * fixed; MongooseArray#indexOf now works properly - -1.2.0 / 2011-04-11 -=================== - - * changed; MongooseNumber now casts empty string to null - -1.1.25 / 2011-04-08 -=================== - - * fixed; post init now fires at proper time - -1.1.24 / 2011-04-03 -=================== - - * fixed; pushing an array onto an Array works on existing docs - -1.1.23 / 2011-04-01 -=================== - - * Added Model#model - -1.1.22 / 2011-03-31 -=================== - - * Fixed; $in queries on mixed types now work - -1.1.21 / 2011-03-31 -=================== - - * Fixed; setting object root to null/undefined works - -1.1.20 / 2011-03-31 -=================== - - * Fixed; setting multiple props on null field works - -1.1.19 / 2011-03-31 -=================== - - * Fixed; no longer using $set on paths to an unexisting fields - -1.1.18 / 2011-03-30 -=================== - - * Fixed; non-mixed type object setters work after initd from null - -1.1.17 / 2011-03-30 -=================== - - * Fixed; nested object property access works when root initd with null value - -1.1.16 / 2011-03-28 -=================== - - * Fixed; empty arrays are now saved - -1.1.15 / 2011-03-28 -=================== - - * Fixed; `null` and `undefined` are set atomically. - -1.1.14 / 2011-03-28 -=================== - - * Changed; more forgiving date casting, accepting '' as null. - -1.1.13 / 2011-03-26 -=================== - - * Fixed setting values as `undefined`. - -1.1.12 / 2011-03-26 -=================== - - * Fixed; nested objects now convert to JSON properly - * Fixed; setting nested objects directly now works - * Update node-mongodb-native - -1.1.11 / 2011-03-25 -=================== - - * Fixed for use of `type` as a key. - -1.1.10 / 2011-03-23 -=================== - - * Changed; Make sure to only ensure indexes while connected - -1.1.9 / 2011-03-2 -================== - - * Fixed; Mixed can now default to empty arrays - * Fixed; keys by the name 'type' are now valid - * Fixed; null values retrieved from the database are hydrated as null values. - * Fixed repeated atomic operations when saving a same document twice. - -1.1.8 / 2011-03-23 -================== - - * Fixed 'id' overriding. [bnoguchi] - -1.1.7 / 2011-03-22 -================== - - * Fixed RegExp query casting when querying against an Array of Strings [bnoguchi] - * Fixed getters/setters for nested virtualsl. [bnoguchi] - -1.1.6 / 2011-03-22 -================== - - * Only doValidate when path exists in Schema [aheckmann] - * Allow function defaults for Array types [aheckmann] - * Fix validation hang [aheckmann] - * Fix setting of isRequired of SchemaType [aheckmann] - * Fix SchemaType#required(false) filter [aheckmann] - * More backwards compatibility [aheckmann] - * More tests [aheckmann] - -1.1.5 / 2011-03-14 -================== - - * Added support for `uri, db, fn` and `uri, fn` signatures for replica sets. - * Improved/extended replica set tests. - -1.1.4 / 2011-03-09 -================== - - * Fixed; running an empty Query doesn't throw. [aheckmann] - * Changed; Promise#addBack returns promise. [aheckmann] - * Added streaming cursor support. [aheckmann] - * Changed; Query#update defaults to use$SetOnSave now. [brian] - * Added more docs. - -1.1.3 / 2011-03-04 -================== - - * Added Promise#resolve [aheckmann] - * Fixed backward compatibility with nulls [aheckmann] - * Changed; Query#{run,exec} return promises [aheckmann] - -1.1.2 / 2011-03-03 -================== - - * Restored Query#exec and added notion of default operation [brian] - * Fixed ValidatorError messages [brian] - -1.1.1 / 2011-03-01 -================== - - * Added SchemaType String `lowercase`, `uppercase`, `trim`. - * Public exports (`Model`, `Document`) and tests. - * Added ObjectId casting support for `Document`s. - -1.1.0 / 2011-02-25 -================== - - * Added support for replica sets. - -1.0.16 / 2011-02-18 -=================== - - * Added $nin as another whitelisted $conditional for SchemaArray [brian] - * Changed #with to #where [brian] - * Added ability to use $in conditional with Array types [brian] - -1.0.15 / 2011-02-18 -=================== - - * Added `id` virtual getter for documents to easily access the hexString of - the `_id`. - -1.0.14 / 2011-02-17 -=================== - - * Fix for arrays within subdocuments [brian] - -1.0.13 / 2011-02-16 -=================== - - * Fixed embedded documents saving. - -1.0.12 / 2011-02-14 -=================== - - * Minor refactorings [brian] - -1.0.11 / 2011-02-14 -=================== - - * Query refactor and $ne, $slice, $or, $size, $elemMatch, $nin, $exists support [brian] - * Named scopes sugar [brian] - -1.0.10 / 2011-02-11 -=================== - - * Updated node-mongodb-native driver [thanks John Allen] - -1.0.9 / 2011-02-09 -================== - - * Fixed single member arrays as defaults [brian] - -1.0.8 / 2011-02-09 -================== - - * Fixed for collection-level buffering of commands [gitfy] - * Fixed `Document#toJSON` [dalejefferson] - * Fixed `Connection` authentication [robrighter] - * Fixed clash of accessors in getters/setters [eirikurn] - * Improved `Model#save` promise handling - -1.0.7 / 2011-02-05 -================== - - * Fixed memory leak warnings for test suite on 0.3 - * Fixed querying documents that have an array that contain at least one - specified member. [brian] - * Fixed default value for Array types (fixes GH-210). [brian] - * Fixed example code. - -1.0.6 / 2011-02-03 -================== - - * Fixed `post` middleware - * Fixed; it's now possible to instantiate a model even when one of the paths maps - to an undefined value [brian] - -1.0.5 / 2011-02-02 -================== - - * Fixed; combo $push and $pushAll auto-converts into a $pushAll [brian] - * Fixed; combo $pull and $pullAll auto-converts to a single $pullAll [brian] - * Fixed; $pullAll now removes said members from array before save (so it acts just - like pushAll) [brian] - * Fixed; multiple $pulls and $pushes become a single $pullAll and $pushAll. - Moreover, $pull now modifies the array before save to reflect the immediate - change [brian] - * Added tests for nested shortcut getters [brian] - * Added tests that show that Schemas with nested Arrays don't apply defaults - [brian] - -1.0.4 / 2011-02-02 -================== - - * Added MongooseNumber#toString - * Added MongooseNumber unit tests - -1.0.3 / 2011-02-02 -================== - - * Make sure safe mode works with Model#save - * Changed Schema options: safe mode is now the default - * Updated node-mongodb-native to HEAD - -1.0.2 / 2011-02-02 -================== - - * Added a Model.create shortcut for creating documents. [brian] - * Fixed; we can now instantiate models with hashes that map to at least one - null value. [brian] - * Fixed Schema with more than 2 nested levels. [brian] - -1.0.1 / 2011-02-02 -================== - - * Improved `MongooseNumber`, works almost like the native except for `typeof` - not being `'number'`. diff --git a/Associations/node_modules/mongoose/README.md b/Associations/node_modules/mongoose/README.md deleted file mode 100644 index 0e9a7512..00000000 --- a/Associations/node_modules/mongoose/README.md +++ /dev/null @@ -1,318 +0,0 @@ -# Mongoose - -Mongoose is a [MongoDB](http://www.mongodb.org/) object modeling tool designed to work in an asynchronous environment. - -[![Build Status](https://api.travis-ci.org/Automattic/mongoose.png?branch=master)](https://travis-ci.org/Automattic/mongoose) -[![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/Automattic/mongoose?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) -[![NPM version](https://badge.fury.io/js/mongoose.svg)](http://badge.fury.io/js/mongoose) - -## Documentation - -[mongoosejs.com](http://mongoosejs.com/) - -## Support - - - [Stack Overflow](http://stackoverflow.com/questions/tagged/mongoose) - - [bug reports](https://github.com/Automattic/mongoose/issues/) - - [help forum](http://groups.google.com/group/mongoose-orm) - - [MongoDB support](http://www.mongodb.org/display/DOCS/Technical+Support) - - (irc) #mongoosejs on freenode - -## Plugins - -Check out the [plugins search site](http://plugins.mongoosejs.com/) to see hundreds of related modules from the community. - -Build your own Mongoose plugin through [generator-mongoose-plugin](https://github.com/huei90/generator-mongoose-plugin). - -## Contributors - -View all 100+ [contributors](https://github.com/Automattic/mongoose/graphs/contributors). Stand up and be counted as a [contributor](https://github.com/Automattic/mongoose/blob/master/CONTRIBUTING.md) too! - -## Live Examples - - -## Installation - -First install [node.js](http://nodejs.org/) and [mongodb](http://www.mongodb.org/downloads). Then: - -```sh -$ npm install mongoose -``` - -## Stability - -The current stable branch is [master](https://github.com/Automattic/mongoose/tree/master). The [3.8.x](https://github.com/Automattic/mongoose/tree/3.8.x) branch contains legacy support for the 3.x release series, which will continue to be actively maintained until September 1, 2015. - -## Overview - -### Connecting to MongoDB - -First, we need to define a connection. If your app uses only one database, you should use `mongoose.connect`. If you need to create additional connections, use `mongoose.createConnection`. - -Both `connect` and `createConnection` take a `mongodb://` URI, or the parameters `host, database, port, options`. - -```js -var mongoose = require('mongoose'); - -mongoose.connect('mongodb://localhost/my_database'); -``` - -Once connected, the `open` event is fired on the `Connection` instance. If you're using `mongoose.connect`, the `Connection` is `mongoose.connection`. Otherwise, `mongoose.createConnection` return value is a `Connection`. - -**Note:** _If the local connection fails then try using 127.0.0.1 instead of localhost. Sometimes issues may arise when the local hostname has been changed._ - -**Important!** Mongoose buffers all the commands until it's connected to the database. This means that you don't have to wait until it connects to MongoDB in order to define models, run queries, etc. - -### Defining a Model - -Models are defined through the `Schema` interface. - -```js -var Schema = mongoose.Schema - , ObjectId = Schema.ObjectId; - -var BlogPost = new Schema({ - author : ObjectId - , title : String - , body : String - , date : Date -}); -``` - -Aside from defining the structure of your documents and the types of data you're storing, a Schema handles the definition of: - -* [Validators](http://mongoosejs.com/docs/validation.html) (async and sync) -* [Defaults](http://mongoosejs.com/docs/api.html#schematype_SchemaType-default) -* [Getters](http://mongoosejs.com/docs/api.html#schematype_SchemaType-get) -* [Setters](http://mongoosejs.com/docs/api.html#schematype_SchemaType-set) -* [Indexes](http://mongoosejs.com/docs/guide.html#indexes) -* [Middleware](http://mongoosejs.com/docs/middleware.html) -* [Methods](http://mongoosejs.com/docs/guide.html#methods) definition -* [Statics](http://mongoosejs.com/docs/guide.html#statics) definition -* [Plugins](http://mongoosejs.com/docs/plugins.html) -* [pseudo-JOINs](http://mongoosejs.com/docs/populate.html) - -The following example shows some of these features: - -```js -var Comment = new Schema({ - name : { type: String, default: 'hahaha' } - , age : { type: Number, min: 18, index: true } - , bio : { type: String, match: /[a-z]/ } - , date : { type: Date, default: Date.now } - , buff : Buffer -}); - -// a setter -Comment.path('name').set(function (v) { - return capitalize(v); -}); - -// middleware -Comment.pre('save', function (next) { - notify(this.get('email')); - next(); -}); -``` - -Take a look at the example in `examples/schema.js` for an end-to-end example of a typical setup. - -### Accessing a Model - -Once we define a model through `mongoose.model('ModelName', mySchema)`, we can access it through the same function - -```js -var myModel = mongoose.model('ModelName'); -``` - -Or just do it all at once - -```js -var MyModel = mongoose.model('ModelName', mySchema); -``` - -The first argument is the _singular_ name of the collection your model is for. **Mongoose automatically looks for the _plural_ version of your model name.** For example, if you use - -```js -var MyModel = mongoose.model('Ticket', mySchema); -``` - -Then Mongoose will create the model for your __tickets__ collection, not your __ticket__ collection. - -Once we have our model, we can then instantiate it, and save it: - -```js -var instance = new MyModel(); -instance.my.key = 'hello'; -instance.save(function (err) { - // -}); -``` - -Or we can find documents from the same collection - -```js -MyModel.find({}, function (err, docs) { - // docs.forEach -}); -``` - -You can also `findOne`, `findById`, `update`, etc. For more details check out [the docs](http://mongoosejs.com/docs/queries.html). - -**Important!** If you opened a separate connection using `mongoose.createConnection()` but attempt to access the model through `mongoose.model('ModelName')` it will not work as expected since it is not hooked up to an active db connection. In this case access your model through the connection you created: - -```js -var conn = mongoose.createConnection('your connection string') - , MyModel = conn.model('ModelName', schema) - , m = new MyModel; -m.save(); // works -``` - -vs - -```js -var conn = mongoose.createConnection('your connection string') - , MyModel = mongoose.model('ModelName', schema) - , m = new MyModel; -m.save(); // does not work b/c the default connection object was never connected -``` - -### Embedded Documents - -In the first example snippet, we defined a key in the Schema that looks like: - -``` -comments: [Comment] -``` - -Where `Comment` is a `Schema` we created. This means that creating embedded documents is as simple as: - -```js -// retrieve my model -var BlogPost = mongoose.model('BlogPost'); - -// create a blog post -var post = new BlogPost(); - -// create a comment -post.comments.push({ title: 'My comment' }); - -post.save(function (err) { - if (!err) console.log('Success!'); -}); -``` - -The same goes for removing them: - -```js -BlogPost.findById(myId, function (err, post) { - if (!err) { - post.comments[0].remove(); - post.save(function (err) { - // do something - }); - } -}); -``` - -Embedded documents enjoy all the same features as your models. Defaults, validators, middleware. Whenever an error occurs, it's bubbled to the `save()` error callback, so error handling is a snap! - -Mongoose interacts with your embedded documents in arrays _atomically_, out of the box. - -### Middleware - -See the [docs](http://mongoosejs.com/docs/middleware.html) page. - -#### Intercepting and mutating method arguments - -You can intercept method arguments via middleware. - -For example, this would allow you to broadcast changes about your Documents every time someone `set`s a path in your Document to a new value: - -```js -schema.pre('set', function (next, path, val, typel) { - // `this` is the current Document - this.emit('set', path, val); - - // Pass control to the next pre - next(); -}); -``` - -Moreover, you can mutate the incoming `method` arguments so that subsequent middleware see different values for those arguments. To do so, just pass the new values to `next`: - -```js -.pre(method, function firstPre (next, methodArg1, methodArg2) { - // Mutate methodArg1 - next("altered-" + methodArg1.toString(), methodArg2); -}); - -// pre declaration is chainable -.pre(method, function secondPre (next, methodArg1, methodArg2) { - console.log(methodArg1); - // => 'altered-originalValOfMethodArg1' - - console.log(methodArg2); - // => 'originalValOfMethodArg2' - - // Passing no arguments to `next` automatically passes along the current argument values - // i.e., the following `next()` is equivalent to `next(methodArg1, methodArg2)` - // and also equivalent to, with the example method arg - // values, `next('altered-originalValOfMethodArg1', 'originalValOfMethodArg2')` - next(); -}); -``` - -#### Schema gotcha - -`type`, when used in a schema has special meaning within Mongoose. If your schema requires using `type` as a nested property you must use object notation: - -```js -new Schema({ - broken: { type: Boolean } - , asset : { - name: String - , type: String // uh oh, it broke. asset will be interpreted as String - } -}); - -new Schema({ - works: { type: Boolean } - , asset : { - name: String - , type: { type: String } // works. asset is an object with a type property - } -}); -``` - -### Driver access - -The driver being used defaults to [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) and is directly accessible through `YourModel.collection`. **Note**: using the driver directly bypasses all Mongoose power-tools like validation, getters, setters, hooks, etc. - -## API Docs - -Find the API docs [here](http://mongoosejs.com/docs/api.html), generated using [dox](http://github.com/visionmedia/dox) -and [acquit](http://github.com/vkarpov15/acquit). - -## License - -Copyright (c) 2010 LearnBoost <dev@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. diff --git a/Associations/node_modules/mongoose/contRun.sh b/Associations/node_modules/mongoose/contRun.sh deleted file mode 100755 index cd5610d9..00000000 --- a/Associations/node_modules/mongoose/contRun.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash - -make test - -ret=$? - -while [ $ret == 0 ]; do - make test - ret=$? -done diff --git a/Associations/node_modules/mongoose/examples/README.md b/Associations/node_modules/mongoose/examples/README.md deleted file mode 100644 index cb32898e..00000000 --- a/Associations/node_modules/mongoose/examples/README.md +++ /dev/null @@ -1,41 +0,0 @@ -This directory contains runnable sample mongoose programs. - -To run: - - - first install [Node.js](http://nodejs.org/) - - from the root of the project, execute `npm install -d` - - in the example directory, run `npm install -d` - - from the command line, execute: `node example.js`, replacing "example.js" with the name of a program. - - -Goal is to show: - -- ~~global schemas~~ -- ~~GeoJSON schemas / use (with crs)~~ -- text search (once MongoDB removes the "Experimental/beta" label) -- ~~lean queries~~ -- ~~statics~~ -- methods and statics on subdocs -- custom types -- ~~querybuilder~~ -- ~~promises~~ -- accessing driver collection, db -- ~~connecting to replica sets~~ -- connecting to sharded clusters -- enabling a fail fast mode -- on the fly schemas -- storing files -- ~~map reduce~~ -- ~~aggregation~~ -- advanced hooks -- using $elemMatch to return a subset of an array -- query casting -- upserts -- pagination -- express + mongoose session handling -- ~~group by (use aggregation)~~ -- authentication -- schema migration techniques -- converting documents to plain objects (show transforms) -- how to $unset - diff --git a/Associations/node_modules/mongoose/examples/aggregate/aggregate.js b/Associations/node_modules/mongoose/examples/aggregate/aggregate.js deleted file mode 100644 index 8ac2cf44..00000000 --- a/Associations/node_modules/mongoose/examples/aggregate/aggregate.js +++ /dev/null @@ -1,81 +0,0 @@ - -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./person.js')(); - -var Person = mongoose.model('Person'); - -// define some dummy data -var data = [ - { name : 'bill', age : 25, birthday : new Date().setFullYear((new - Date().getFullYear() - 25)), gender : "Male", - likes : ['movies', 'games', 'dogs']}, - { name : 'mary', age : 30, birthday : new Date().setFullYear((new - Date().getFullYear() - 30)), gender : "Female", - likes : ['movies', 'birds', 'cats']}, - { name : 'bob', age : 21, birthday : new Date().setFullYear((new - Date().getFullYear() - 21)), gender : "Male", - likes : ['tv', 'games', 'rabbits']}, - { name : 'lilly', age : 26, birthday : new Date().setFullYear((new - Date().getFullYear() - 26)), gender : "Female", - likes : ['books', 'cats', 'dogs']}, - { name : 'alucard', age : 1000, birthday : new Date().setFullYear((new - Date().getFullYear() - 1000)), gender : "Male", - likes : ['glasses', 'wine', 'the night']} -]; - - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - // create all of the dummy people - async.each(data, function(item, cb) { - Person.create(item, cb); - }, function(err) { - if (err) { - // handle error - } - - // run an aggregate query that will get all of the people who like a given - // item. To see the full documentation on ways to use the aggregate - // framework, see http://docs.mongodb.org/manual/core/aggregation/ - Person.aggregate( - // select the fields we want to deal with - { $project : { name : 1, likes : 1 } }, - // unwind 'likes', which will create a document for each like - { $unwind : "$likes" }, - // group everything by the like and then add each name with that like to - // the set for the like - { $group : { - _id : { likes : "$likes" }, - likers : { $addToSet : "$name" } - } }, - function(err, result) { - if (err) throw err; - console.log(result); - //[ { _id: { likes: 'the night' }, likers: [ 'alucard' ] }, - //{ _id: { likes: 'wine' }, likers: [ 'alucard' ] }, - //{ _id: { likes: 'books' }, likers: [ 'lilly' ] }, - //{ _id: { likes: 'glasses' }, likers: [ 'alucard' ] }, - //{ _id: { likes: 'birds' }, likers: [ 'mary' ] }, - //{ _id: { likes: 'rabbits' }, likers: [ 'bob' ] }, - //{ _id: { likes: 'cats' }, likers: [ 'lilly', 'mary' ] }, - //{ _id: { likes: 'dogs' }, likers: [ 'lilly', 'bill' ] }, - //{ _id: { likes: 'tv' }, likers: [ 'bob' ] }, - //{ _id: { likes: 'games' }, likers: [ 'bob', 'bill' ] }, - //{ _id: { likes: 'movies' }, likers: [ 'mary', 'bill' ] } ] - - cleanup(); - }); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/aggregate/package.json b/Associations/node_modules/mongoose/examples/aggregate/package.json deleted file mode 100644 index 53ed2e14..00000000 --- a/Associations/node_modules/mongoose/examples/aggregate/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "aggregate-example", - "private": "true", - "version": "0.0.0", - "description": "deps for aggregate example", - "main": "aggregate.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "async": "*" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/aggregate/person.js b/Associations/node_modules/mongoose/examples/aggregate/person.js deleted file mode 100644 index 5046b1fe..00000000 --- a/Associations/node_modules/mongoose/examples/aggregate/person.js +++ /dev/null @@ -1,17 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date, - gender: String, - likes: [String] - }); - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/doc-methods.js b/Associations/node_modules/mongoose/examples/doc-methods.js deleted file mode 100644 index 396ff791..00000000 --- a/Associations/node_modules/mongoose/examples/doc-methods.js +++ /dev/null @@ -1,70 +0,0 @@ - -var mongoose = require('mongoose'); -var Schema = mongoose.Schema; - -console.log('Running mongoose version %s', mongoose.version); - -/** - * Schema - */ - -var CharacterSchema = Schema({ - name: { type: String, required: true } - , health: { type: Number, min: 0, max: 100 } -}); - -/** - * Methods - */ - -CharacterSchema.methods.attack = function() { - console.log('%s is attacking', this.name); -}; - -/** - * Character model - */ - -var Character = mongoose.model('Character', CharacterSchema); - -/** - * Connect to the database on localhost with - * the default port (27017) - */ - -var dbname = 'mongoose-example-doc-methods-' + ((Math.random() * 10000) | 0); -var uri = 'mongodb://localhost/' + dbname; - -console.log('connecting to %s', uri); - -mongoose.connect(uri, function(err) { - // if we failed to connect, abort - if (err) throw err; - - // we connected ok - example(); -}); - -/** - * Use case - */ - -function example() { - Character.create({ name: 'Link', health: 100 }, function(err, link) { - if (err) return done(err); - console.log('found', link); - link.attack(); // 'Link is attacking' - done(); - }); -} - -/** - * Clean up - */ - -function done(err) { - if (err) console.error(err); - mongoose.connection.db.dropDatabase(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/express/README.md b/Associations/node_modules/mongoose/examples/express/README.md deleted file mode 100644 index 7ba07b8a..00000000 --- a/Associations/node_modules/mongoose/examples/express/README.md +++ /dev/null @@ -1 +0,0 @@ -Mongoose + Express examples diff --git a/Associations/node_modules/mongoose/examples/express/connection-sharing/README.md b/Associations/node_modules/mongoose/examples/express/connection-sharing/README.md deleted file mode 100644 index fc709a3a..00000000 --- a/Associations/node_modules/mongoose/examples/express/connection-sharing/README.md +++ /dev/null @@ -1,6 +0,0 @@ - -To run: - -- Execute `npm install` from this directory -- Execute `node app.js` -- Navigate to `localhost:8000` diff --git a/Associations/node_modules/mongoose/examples/express/connection-sharing/app.js b/Associations/node_modules/mongoose/examples/express/connection-sharing/app.js deleted file mode 100644 index 8fb2fee9..00000000 --- a/Associations/node_modules/mongoose/examples/express/connection-sharing/app.js +++ /dev/null @@ -1,17 +0,0 @@ - -var express = require('express'); -var mongoose = require('../../../lib'); - -var uri = 'mongodb://localhost/mongoose-shared-connection'; -global.db = mongoose.createConnection(uri); - -var routes = require('./routes'); - -var app = express(); -app.get('/', routes.home); -app.get('/insert', routes.insert); -app.get('/name', routes.modelName); - -app.listen(8000, function() { - console.log('listening on http://localhost:8000'); -}); diff --git a/Associations/node_modules/mongoose/examples/express/connection-sharing/modelA.js b/Associations/node_modules/mongoose/examples/express/connection-sharing/modelA.js deleted file mode 100644 index 31e9b937..00000000 --- a/Associations/node_modules/mongoose/examples/express/connection-sharing/modelA.js +++ /dev/null @@ -1,5 +0,0 @@ -var Schema = require('../../../lib').Schema; -var mySchema = Schema({ name: String }); - -/* global db */ -module.exports = db.model('MyModel', mySchema); diff --git a/Associations/node_modules/mongoose/examples/express/connection-sharing/package.json b/Associations/node_modules/mongoose/examples/express/connection-sharing/package.json deleted file mode 100644 index e3261655..00000000 --- a/Associations/node_modules/mongoose/examples/express/connection-sharing/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "connection-sharing", - "private": "true", - "version": "0.0.0", - "description": "ERROR: No README.md file found!", - "main": "app.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "express": "3.1.1" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/express/connection-sharing/routes.js b/Associations/node_modules/mongoose/examples/express/connection-sharing/routes.js deleted file mode 100644 index 5a70c183..00000000 --- a/Associations/node_modules/mongoose/examples/express/connection-sharing/routes.js +++ /dev/null @@ -1,20 +0,0 @@ - -var model = require('./modelA'); - -exports.home = function(req, res, next) { - model.find(function(err, docs) { - if (err) return next(err); - res.send(docs); - }); -}; - -exports.modelName = function(req, res) { - res.send('my model name is ' + model.modelName); -}; - -exports.insert = function(req, res, next) { - model.create({ name: 'inserting ' + Date.now() }, function(err, doc) { - if (err) return next(err); - res.send(doc); - }); -}; diff --git a/Associations/node_modules/mongoose/examples/geospatial/geoJSONSchema.js b/Associations/node_modules/mongoose/examples/geospatial/geoJSONSchema.js deleted file mode 100644 index bd1ec5af..00000000 --- a/Associations/node_modules/mongoose/examples/geospatial/geoJSONSchema.js +++ /dev/null @@ -1,22 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - // NOTE : This object must conform *precisely* to the geoJSON specification - // you cannot embed a geoJSON doc inside a model or anything like that- IT - // MUST BE VANILLA - var LocationObject = new Schema({ - loc: { - type: { type: String }, - coordinates: [] - } - }); - // define the index - LocationObject.index({ loc : '2dsphere' }); - - mongoose.model('Location', LocationObject); -}; diff --git a/Associations/node_modules/mongoose/examples/geospatial/geoJSONexample.js b/Associations/node_modules/mongoose/examples/geospatial/geoJSONexample.js deleted file mode 100644 index d4795952..00000000 --- a/Associations/node_modules/mongoose/examples/geospatial/geoJSONexample.js +++ /dev/null @@ -1,49 +0,0 @@ - -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./geoJSONSchema.js')(); - -var Location = mongoose.model('Location'); - -// define some dummy data -// note: the type can be Point, LineString, or Polygon -var data = [ - { loc: { type: 'Point', coordinates: [-20.0, 5.0] }}, - { loc: { type: 'Point', coordinates: [6.0, 10.0] }}, - { loc: { type: 'Point', coordinates: [34.0, -50.0] }}, - { loc: { type: 'Point', coordinates: [-100.0, 70.0] }}, - { loc: { type: 'Point', coordinates: [38.0, 38.0] }} -]; - - -mongoose.connect('mongodb://localhost/locations', function(err) { - if (err) throw err; - - Location.on('index', function(err) { - if (err) throw err; - // create all of the dummy locations - async.each(data, function(item, cb) { - Location.create(item, cb); - }, function(err) { - if (err) throw err; - // create the location we want to search for - var coords = { type : 'Point', coordinates : [-5, 5] }; - // search for it - Location.find({ loc : { $near : coords }}).limit(1).exec(function(err, res) { - if (err) throw err; - console.log("Closest to %s is %s", JSON.stringify(coords), res); - cleanup(); - }); - }); - }); -}); - -function cleanup() { - Location.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/geospatial/geospatial.js b/Associations/node_modules/mongoose/examples/geospatial/geospatial.js deleted file mode 100644 index d6e8ac1f..00000000 --- a/Associations/node_modules/mongoose/examples/geospatial/geospatial.js +++ /dev/null @@ -1,70 +0,0 @@ - -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./person.js')(); - -var Person = mongoose.model('Person'); - -// define some dummy data -var data = [ - { name : 'bill', age : 25, birthday : new Date().setFullYear((new - Date().getFullYear() - 25)), gender : "Male", - likes : ['movies', 'games', 'dogs'], loc : [0, 0]}, - { name : 'mary', age : 30, birthday : new Date().setFullYear((new - Date().getFullYear() - 30)), gender : "Female", - likes : ['movies', 'birds', 'cats'], loc : [1, 1]}, - { name : 'bob', age : 21, birthday : new Date().setFullYear((new - Date().getFullYear() - 21)), gender : "Male", - likes : ['tv', 'games', 'rabbits'], loc : [3, 3]}, - { name : 'lilly', age : 26, birthday : new Date().setFullYear((new - Date().getFullYear() - 26)), gender : "Female", - likes : ['books', 'cats', 'dogs'], loc : [6, 6]}, - { name : 'alucard', age : 1000, birthday : new Date().setFullYear((new - Date().getFullYear() - 1000)), gender : "Male", - likes : ['glasses', 'wine', 'the night'], loc : [10, 10]} -]; - - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - // create all of the dummy people - async.each(data, function(item, cb) { - Person.create(item, cb); - }, function(err) { - if (err) { - // handler error - } - - // let's find the closest person to bob - Person.find({ name : 'bob' }, function(err, res) { - if (err) throw err; - - res[0].findClosest(function(err, closest) { - if (err) throw err; - - console.log("%s is closest to %s", res[0].name, closest); - - - // we can also just query straight off of the model. For more - // information about geospatial queries and indexes, see - // http://docs.mongodb.org/manual/applications/geospatial-indexes/ - var coords = [7,7]; - Person.find({ loc : { $nearSphere : coords }}).limit(1).exec(function(err, res) { - console.log("Closest to %s is %s", coords, res); - cleanup(); - }); - }); - }); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/geospatial/package.json b/Associations/node_modules/mongoose/examples/geospatial/package.json deleted file mode 100644 index 75c2a0ee..00000000 --- a/Associations/node_modules/mongoose/examples/geospatial/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "geospatial-example", - "private": "true", - "version": "0.0.0", - "description": "deps for geospatial example", - "main": "geospatial.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "async": "*" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/geospatial/person.js b/Associations/node_modules/mongoose/examples/geospatial/person.js deleted file mode 100644 index d98434ef..00000000 --- a/Associations/node_modules/mongoose/examples/geospatial/person.js +++ /dev/null @@ -1,28 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date, - gender: String, - likes: [String], - // define the geospatial field - loc: { type : [Number], index: '2d' } - }); - - // define a method to find the closest person - PersonSchema.methods.findClosest = function(cb) { - return this.model('Person').find({ - loc : { $nearSphere : this.loc }, - name : { $ne : this.name } - }).limit(1).exec(cb); - }; - - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/globalschemas/gs_example.js b/Associations/node_modules/mongoose/examples/globalschemas/gs_example.js deleted file mode 100644 index 744d7bd9..00000000 --- a/Associations/node_modules/mongoose/examples/globalschemas/gs_example.js +++ /dev/null @@ -1,40 +0,0 @@ - -var mongoose = require('../../lib'); - - -// import the global schema, this can be done in any file that needs the model -require('./person.js')(); - -// grab the person model object -var Person = mongoose.model("Person"); - -// connect to a server to do a quick write / read example - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - Person.create({ - name : 'bill', - age : 25, - birthday : new Date().setFullYear((new Date().getFullYear() - 25)) - }, function(err, bill) { - if (err) throw err; - console.log("People added to db: %s", bill.toString()); - Person.find({}, function(err, people) { - if (err) throw err; - - people.forEach(function(person) { - console.log("People in the db: %s", person.toString()); - }); - - // make sure to clean things up after we're done - setTimeout(function() { cleanup(); }, 2000); - }); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/globalschemas/person.js b/Associations/node_modules/mongoose/examples/globalschemas/person.js deleted file mode 100644 index f9c9a27a..00000000 --- a/Associations/node_modules/mongoose/examples/globalschemas/person.js +++ /dev/null @@ -1,15 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date - }); - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/lean/lean.js b/Associations/node_modules/mongoose/examples/lean/lean.js deleted file mode 100644 index 99df1508..00000000 --- a/Associations/node_modules/mongoose/examples/lean/lean.js +++ /dev/null @@ -1,64 +0,0 @@ - -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./person.js')(); - -var Person = mongoose.model('Person'); - -// define some dummy data -var data = [ - { name : 'bill', age : 25, birthday : new Date().setFullYear((new - Date().getFullYear() - 25)), gender : "Male", - likes : ['movies', 'games', 'dogs']}, - { name : 'mary', age : 30, birthday : new Date().setFullYear((new - Date().getFullYear() - 30)), gender : "Female", - likes : ['movies', 'birds', 'cats']}, - { name : 'bob', age : 21, birthday : new Date().setFullYear((new - Date().getFullYear() - 21)), gender : "Male", - likes : ['tv', 'games', 'rabbits']}, - { name : 'lilly', age : 26, birthday : new Date().setFullYear((new - Date().getFullYear() - 26)), gender : "Female", - likes : ['books', 'cats', 'dogs']}, - { name : 'alucard', age : 1000, birthday : new Date().setFullYear((new - Date().getFullYear() - 1000)), gender : "Male", - likes : ['glasses', 'wine', 'the night']} -]; - - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - // create all of the dummy people - async.each(data, function(item, cb) { - Person.create(item, cb); - }, function(err) { - if (err) { - // handle error - } - - // lean queries return just plain javascript objects, not - // MongooseDocuments. This makes them good for high performance read - // situations - - // when using .lean() the default is true, but you can explicitly set the - // value by passing in a boolean value. IE. .lean(false) - var q = Person.find({ age : { $lt : 1000 }}).sort('age').limit(2).lean(); - q.exec(function(err, results) { - if (err) throw err; - console.log("Are the results MongooseDocuments?: %s", results[0] instanceof mongoose.Document); - - console.log(results); - cleanup(); - }); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/lean/package.json b/Associations/node_modules/mongoose/examples/lean/package.json deleted file mode 100644 index 6ee511de..00000000 --- a/Associations/node_modules/mongoose/examples/lean/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "lean-example", - "private": "true", - "version": "0.0.0", - "description": "deps for lean example", - "main": "lean.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "async": "*" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/lean/person.js b/Associations/node_modules/mongoose/examples/lean/person.js deleted file mode 100644 index 5046b1fe..00000000 --- a/Associations/node_modules/mongoose/examples/lean/person.js +++ /dev/null @@ -1,17 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date, - gender: String, - likes: [String] - }); - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/mapreduce/mapreduce.js b/Associations/node_modules/mongoose/examples/mapreduce/mapreduce.js deleted file mode 100644 index bf14cfce..00000000 --- a/Associations/node_modules/mongoose/examples/mapreduce/mapreduce.js +++ /dev/null @@ -1,80 +0,0 @@ -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./person.js')(); - -var Person = mongoose.model('Person'); - -// define some dummy data -var data = [ - { name : 'bill', age : 25, birthday : new Date().setFullYear((new - Date().getFullYear() - 25)), gender : "Male" }, - { name : 'mary', age : 30, birthday : new Date().setFullYear((new - Date().getFullYear() - 30)), gender : "Female" }, - { name : 'bob', age : 21, birthday : new Date().setFullYear((new - Date().getFullYear() - 21)), gender : "Male" }, - { name : 'lilly', age : 26, birthday : new Date().setFullYear((new - Date().getFullYear() - 26)), gender : "Female" }, - { name : 'alucard', age : 1000, birthday : new Date().setFullYear((new - Date().getFullYear() - 1000)), gender : "Male" } -]; - - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - // create all of the dummy people - async.each(data, function(item, cb) { - Person.create(item, cb); - }, function(err) { - if (err) { - // handle error - } - - // alright, simple map reduce example. We will find the total ages of each - // gender - - // create the options object - var o = {}; - - o.map = function() { - // in this function, 'this' refers to the current document being - // processed. Return the (gender, age) tuple using - /* global emit */ - emit(this.gender, this.age); - }; - - // the reduce function receives the array of ages that are grouped by the - // id, which in this case is the gender - o.reduce = function(id, ages) { - return Array.sum(ages); - }; - - // other options that can be specified - - // o.query = { age : { $lt : 1000 }}; // the query object - // o.limit = 3; // max number of documents - // o.keeptemp = true; // default is false, specifies whether to keep temp data - // o.finalize = someFunc; // function called after reduce - // o.scope = {}; // the scope variable exposed to map/reduce/finalize - // o.jsMode = true; // default is false, force execution to stay in JS - o.verbose = true; // default is false, provide stats on the job - // o.out = {}; // objects to specify where output goes, by default is - // returned, but can also be stored in a new collection - // see: http://mongoosejs.com/docs/api.html#model_Model.mapReduce - Person.mapReduce(o, function(err, results, stats) { - console.log("map reduce took %d ms", stats.processtime); - console.log(results); - cleanup(); - }); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/mapreduce/package.json b/Associations/node_modules/mongoose/examples/mapreduce/package.json deleted file mode 100644 index 42400684..00000000 --- a/Associations/node_modules/mongoose/examples/mapreduce/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "map-reduce-example", - "private": "true", - "version": "0.0.0", - "description": "deps for map reduce example", - "main": "mapreduce.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "async": "*" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/mapreduce/person.js b/Associations/node_modules/mongoose/examples/mapreduce/person.js deleted file mode 100644 index 6d476ec1..00000000 --- a/Associations/node_modules/mongoose/examples/mapreduce/person.js +++ /dev/null @@ -1,16 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date, - gender: String - }); - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/population/population-across-three-collections.js b/Associations/node_modules/mongoose/examples/population/population-across-three-collections.js deleted file mode 100644 index 5edd01a6..00000000 --- a/Associations/node_modules/mongoose/examples/population/population-across-three-collections.js +++ /dev/null @@ -1,135 +0,0 @@ - -var assert = require('assert'); -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; -var ObjectId = mongoose.Types.ObjectId; - -/** - * Connect to the db - */ - -var dbname = 'testing_populateAdInfinitum_' + require('../../lib/utils').random(); -mongoose.connect('localhost', dbname); -mongoose.connection.on('error', function() { - console.error('connection error', arguments); -}); - -/** - * Schemas - */ - -var user = new Schema({ - name: String, - friends: [{ - type: Schema.ObjectId, - ref: 'User' - }] -}); -var User = mongoose.model('User', user); - -var blogpost = Schema({ - title: String, - tags: [String], - author: { - type: Schema.ObjectId, - ref: 'User' - } -}); -var BlogPost = mongoose.model('BlogPost', blogpost); - -/** - * example - */ - -mongoose.connection.on('open', function() { - - /** - * Generate data - */ - - var userIds = [new ObjectId, new ObjectId, new ObjectId, new ObjectId]; - var users = []; - - users.push({ - _id: userIds[0], - name: 'mary', - friends: [userIds[1], userIds[2], userIds[3]] - }); - users.push({ - _id: userIds[1], - name: 'bob', - friends: [userIds[0], userIds[2], userIds[3]] - }); - users.push({ - _id: userIds[2], - name: 'joe', - friends: [userIds[0], userIds[1], userIds[3]] - }); - users.push({ - _id: userIds[3], - name: 'sally', - friends: [userIds[0], userIds[1], userIds[2]] - }); - - User.create(users, function(err) { - assert.ifError(err); - - var blogposts = []; - blogposts.push({ - title: 'blog 1', - tags: ['fun', 'cool'], - author: userIds[3] - }); - blogposts.push({ - title: 'blog 2', - tags: ['cool'], - author: userIds[1] - }); - blogposts.push({ - title: 'blog 3', - tags: ['fun', 'odd'], - author: userIds[2] - }); - - BlogPost.create(blogposts, function(err) { - assert.ifError(err); - - /** - * Population - */ - - BlogPost - .find({ tags: 'fun' }) - .lean() - .populate('author') - .exec(function(err, docs) { - assert.ifError(err); - - /** - * Populate the populated documents - */ - - var opts = { - path: 'author.friends', - select: 'name', - options: { limit: 2 } - }; - - BlogPost.populate(docs, opts, function(err, docs) { - assert.ifError(err); - console.log('populated'); - var s = require('util').inspect(docs, { depth: null }); - console.log(s); - done(); - }); - }); - }); - }); -}); - -function done(err) { - if (err) console.error(err.stack); - mongoose.connection.db.dropDatabase(function() { - mongoose.connection.close(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/population/population-basic.js b/Associations/node_modules/mongoose/examples/population/population-basic.js deleted file mode 100644 index b33406bf..00000000 --- a/Associations/node_modules/mongoose/examples/population/population-basic.js +++ /dev/null @@ -1,95 +0,0 @@ - -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -console.log('Running mongoose version %s', mongoose.version); - -/** - * Console schema - */ - -var consoleSchema = Schema({ - name: String - , manufacturer: String - , released: Date -}); -var Console = mongoose.model('Console', consoleSchema); - -/** - * Game schema - */ - -var gameSchema = Schema({ - name: String - , developer: String - , released: Date - , consoles: [{ type: Schema.Types.ObjectId, ref: 'Console' }] -}); -var Game = mongoose.model('Game', gameSchema); - -/** - * Connect to the console database on localhost with - * the default port (27017) - */ - -mongoose.connect('mongodb://localhost/console', function(err) { - // if we failed to connect, abort - if (err) throw err; - - // we connected ok - createData(); -}); - -/** - * Data generation - */ - -function createData() { - Console.create({ - name: 'Nintendo 64' - , manufacturer: 'Nintendo' - , released: 'September 29, 1996' - }, function(err, nintendo64) { - if (err) return done(err); - - Game.create({ - name: 'Legend of Zelda: Ocarina of Time' - , developer: 'Nintendo' - , released: new Date('November 21, 1998') - , consoles: [nintendo64] - }, function(err) { - if (err) return done(err); - example(); - }); - }); -} - -/** - * Population - */ - -function example() { - Game - .findOne({ name: /^Legend of Zelda/ }) - .populate('consoles') - .exec(function(err, ocinara) { - if (err) return done(err); - - console.log( - '"%s" was released for the %s on %s' - , ocinara.name - , ocinara.consoles[0].name - , ocinara.released.toLocaleDateString()); - - done(); - }); -} - -function done(err) { - if (err) console.error(err); - Console.remove(function() { - Game.remove(function() { - mongoose.disconnect(); - }); - }); -} diff --git a/Associations/node_modules/mongoose/examples/population/population-of-existing-doc.js b/Associations/node_modules/mongoose/examples/population/population-of-existing-doc.js deleted file mode 100644 index 45422851..00000000 --- a/Associations/node_modules/mongoose/examples/population/population-of-existing-doc.js +++ /dev/null @@ -1,101 +0,0 @@ - -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -console.log('Running mongoose version %s', mongoose.version); - -/** - * Console schema - */ - -var consoleSchema = Schema({ - name: String - , manufacturer: String - , released: Date -}); -var Console = mongoose.model('Console', consoleSchema); - -/** - * Game schema - */ - -var gameSchema = Schema({ - name: String - , developer: String - , released: Date - , consoles: [{ type: Schema.Types.ObjectId, ref: 'Console' }] -}); -var Game = mongoose.model('Game', gameSchema); - -/** - * Connect to the console database on localhost with - * the default port (27017) - */ - -mongoose.connect('mongodb://localhost/console', function(err) { - // if we failed to connect, abort - if (err) throw err; - - // we connected ok - createData(); -}); - -/** - * Data generation - */ - -function createData() { - Console.create({ - name: 'Nintendo 64' - , manufacturer: 'Nintendo' - , released: 'September 29, 1996' - }, function(err, nintendo64) { - if (err) return done(err); - - Game.create({ - name: 'Legend of Zelda: Ocarina of Time' - , developer: 'Nintendo' - , released: new Date('November 21, 1998') - , consoles: [nintendo64] - }, function(err) { - if (err) return done(err); - example(); - }); - }); -} - -/** - * Population - */ - -function example() { - Game - .findOne({ name: /^Legend of Zelda/ }) - .exec(function(err, ocinara) { - if (err) return done(err); - - console.log('"%s" console _id: %s', ocinara.name, ocinara.consoles[0]); - - // population of existing document - ocinara.populate('consoles', function(err) { - if (err) return done(err); - - console.log( - '"%s" was released for the %s on %s' - , ocinara.name - , ocinara.consoles[0].name - , ocinara.released.toLocaleDateString()); - - done(); - }); - }); -} - -function done(err) { - if (err) console.error(err); - Console.remove(function() { - Game.remove(function() { - mongoose.disconnect(); - }); - }); -} diff --git a/Associations/node_modules/mongoose/examples/population/population-of-multiple-existing-docs.js b/Associations/node_modules/mongoose/examples/population/population-of-multiple-existing-docs.js deleted file mode 100644 index bd1093de..00000000 --- a/Associations/node_modules/mongoose/examples/population/population-of-multiple-existing-docs.js +++ /dev/null @@ -1,112 +0,0 @@ - -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -console.log('Running mongoose version %s', mongoose.version); - -/** - * Console schema - */ - -var consoleSchema = Schema({ - name: String - , manufacturer: String - , released: Date -}); -var Console = mongoose.model('Console', consoleSchema); - -/** - * Game schema - */ - -var gameSchema = Schema({ - name: String - , developer: String - , released: Date - , consoles: [{ type: Schema.Types.ObjectId, ref: 'Console' }] -}); -var Game = mongoose.model('Game', gameSchema); - -/** - * Connect to the console database on localhost with - * the default port (27017) - */ - -mongoose.connect('mongodb://localhost/console', function(err) { - // if we failed to connect, abort - if (err) throw err; - - // we connected ok - createData(); -}); - -/** - * Data generation - */ - -function createData() { - Console.create({ - name: 'Nintendo 64' - , manufacturer: 'Nintendo' - , released: 'September 29, 1996' - }, { - name: 'Super Nintendo' - , manufacturer: 'Nintendo' - , released: 'August 23, 1991' - }, function(err, nintendo64, superNintendo) { - if (err) return done(err); - - Game.create({ - name: 'Legend of Zelda: Ocarina of Time' - , developer: 'Nintendo' - , released: new Date('November 21, 1998') - , consoles: [nintendo64] - }, { - name: 'Mario Kart' - , developer: 'Nintendo' - , released: 'September 1, 1992' - , consoles: [superNintendo] - }, function(err) { - if (err) return done(err); - example(); - }); - }); -} - -/** - * Population - */ - -function example() { - Game - .find({}) - .exec(function(err, games) { - if (err) return done(err); - - console.log('found %d games', games.length); - - var options = { path: 'consoles', select: 'name released -_id' }; - Game.populate(games, options, function(err, games) { - if (err) return done(err); - - games.forEach(function(game) { - console.log( - '"%s" was released for the %s on %s' - , game.name - , game.consoles[0].name - , game.released.toLocaleDateString()); - }); - - done(); - }); - }); -} - -function done(err) { - if (err) console.error(err); - Console.remove(function() { - Game.remove(function() { - mongoose.disconnect(); - }); - }); -} diff --git a/Associations/node_modules/mongoose/examples/population/population-options.js b/Associations/node_modules/mongoose/examples/population/population-options.js deleted file mode 100644 index da8ee084..00000000 --- a/Associations/node_modules/mongoose/examples/population/population-options.js +++ /dev/null @@ -1,124 +0,0 @@ - -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -console.log('Running mongoose version %s', mongoose.version); - -/** - * Console schema - */ - -var consoleSchema = Schema({ - name: String - , manufacturer: String - , released: Date -}); -var Console = mongoose.model('Console', consoleSchema); - -/** - * Game schema - */ - -var gameSchema = Schema({ - name: String - , developer: String - , released: Date - , consoles: [{ type: Schema.Types.ObjectId, ref: 'Console' }] -}); -var Game = mongoose.model('Game', gameSchema); - -/** - * Connect to the console database on localhost with - * the default port (27017) - */ - -mongoose.connect('mongodb://localhost/console', function(err) { - // if we failed to connect, abort - if (err) throw err; - - // we connected ok - createData(); -}); - -/** - * Data generation - */ - -function createData() { - Console.create({ - name: 'Nintendo 64' - , manufacturer: 'Nintendo' - , released: 'September 29, 1996' - }, { - name: 'Super Nintendo' - , manufacturer: 'Nintendo' - , released: 'August 23, 1991' - }, { - name: 'XBOX 360' - , manufacturer: 'Microsoft' - , released: 'November 22, 2005' - }, function(err, nintendo64, superNintendo, xbox360) { - if (err) return done(err); - - Game.create({ - name: 'Legend of Zelda: Ocarina of Time' - , developer: 'Nintendo' - , released: new Date('November 21, 1998') - , consoles: [nintendo64] - }, { - name: 'Mario Kart' - , developer: 'Nintendo' - , released: 'September 1, 1992' - , consoles: [superNintendo] - }, { - name: 'Perfect Dark Zero' - , developer: 'Rare' - , released: 'November 17, 2005' - , consoles: [xbox360] - }, function(err) { - if (err) return done(err); - example(); - }); - }); -} - -/** - * Population - */ - -function example() { - Game - .find({}) - .populate({ - path: 'consoles' - , match: { manufacturer: 'Nintendo' } - , select: 'name' - , options: { comment: 'population' } - }) - .exec(function(err, games) { - if (err) return done(err); - - games.forEach(function(game) { - console.log( - '"%s" was released for the %s on %s' - , game.name - , game.consoles.length ? game.consoles[0].name : '??' - , game.released.toLocaleDateString()); - }); - - return done(); - }); -} - -/** - * Clean up - */ - -function done(err) { - if (err) console.error(err); - Console.remove(function() { - Game.remove(function() { - mongoose.disconnect(); - }); - }); -} diff --git a/Associations/node_modules/mongoose/examples/population/population-plain-objects.js b/Associations/node_modules/mongoose/examples/population/population-plain-objects.js deleted file mode 100644 index 10935428..00000000 --- a/Associations/node_modules/mongoose/examples/population/population-plain-objects.js +++ /dev/null @@ -1,96 +0,0 @@ - -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -console.log('Running mongoose version %s', mongoose.version); - -/** - * Console schema - */ - -var consoleSchema = Schema({ - name: String - , manufacturer: String - , released: Date -}); -var Console = mongoose.model('Console', consoleSchema); - -/** - * Game schema - */ - -var gameSchema = Schema({ - name: String - , developer: String - , released: Date - , consoles: [{ type: Schema.Types.ObjectId, ref: 'Console' }] -}); -var Game = mongoose.model('Game', gameSchema); - -/** - * Connect to the console database on localhost with - * the default port (27017) - */ - -mongoose.connect('mongodb://localhost/console', function(err) { - // if we failed to connect, abort - if (err) throw err; - - // we connected ok - createData(); -}); - -/** - * Data generation - */ - -function createData() { - Console.create({ - name: 'Nintendo 64' - , manufacturer: 'Nintendo' - , released: 'September 29, 1996' - }, function(err, nintendo64) { - if (err) return done(err); - - Game.create({ - name: 'Legend of Zelda: Ocarina of Time' - , developer: 'Nintendo' - , released: new Date('November 21, 1998') - , consoles: [nintendo64] - }, function(err) { - if (err) return done(err); - example(); - }); - }); -} - -/** - * Population - */ - -function example() { - Game - .findOne({ name: /^Legend of Zelda/ }) - .populate('consoles') - .lean() // just return plain objects, not documents wrapped by mongoose - .exec(function(err, ocinara) { - if (err) return done(err); - - console.log( - '"%s" was released for the %s on %s' - , ocinara.name - , ocinara.consoles[0].name - , ocinara.released.toLocaleDateString()); - - done(); - }); -} - -function done(err) { - if (err) console.error(err); - Console.remove(function() { - Game.remove(function() { - mongoose.disconnect(); - }); - }); -} diff --git a/Associations/node_modules/mongoose/examples/promises/package.json b/Associations/node_modules/mongoose/examples/promises/package.json deleted file mode 100644 index 19832508..00000000 --- a/Associations/node_modules/mongoose/examples/promises/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "promise-example", - "private": "true", - "version": "0.0.0", - "description": "deps for promise example", - "main": "promise.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "async": "*" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/promises/person.js b/Associations/node_modules/mongoose/examples/promises/person.js deleted file mode 100644 index f9c9a27a..00000000 --- a/Associations/node_modules/mongoose/examples/promises/person.js +++ /dev/null @@ -1,15 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date - }); - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/promises/promise.js b/Associations/node_modules/mongoose/examples/promises/promise.js deleted file mode 100644 index 27c6607c..00000000 --- a/Associations/node_modules/mongoose/examples/promises/promise.js +++ /dev/null @@ -1,73 +0,0 @@ - -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./person.js')(); - -var Person = mongoose.model('Person'); - -// define some dummy data -var data = [ - { name : 'bill', age : 25, birthday : new Date().setFullYear((new - Date().getFullYear() - 25)) }, - { name : 'mary', age : 30, birthday : new Date().setFullYear((new - Date().getFullYear() - 30)) }, - { name : 'bob', age : 21, birthday : new Date().setFullYear((new - Date().getFullYear() - 21)) }, - { name : 'lilly', age : 26, birthday : new Date().setFullYear((new - Date().getFullYear() - 26)) }, - { name : 'alucard', age : 1000, birthday : new Date().setFullYear((new - Date().getFullYear() - 1000)) } -]; - - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - // create all of the dummy people - async.each(data, function(item, cb) { - Person.create(item, cb); - }, function(err) { - if (err) { - // handle error - } - - // create a promise (get one from the query builder) - var prom = Person.find({age : { $lt : 1000 }}).exec(); - - // add a callback on the promise. This will be called on both error and - // complete - prom.addBack(function() { console.log("completed"); }); - - // add a callback that is only called on complete (success) events - prom.addCallback(function() { console.log("Successful Completion!"); }); - - // add a callback that is only called on err (rejected) events - prom.addErrback(function() { console.log("Fail Boat"); }); - - // you can chain things just like in the promise/A+ spec - // note: each then() is returning a new promise, so the above methods - // that we defined will all fire after the initial promise is fulfilled - prom.then(function(people) { - - // just getting the stuff for the next query - var ids = people.map(function(p) { - return p._id; - }); - - // return the next promise - return Person.find({ _id : { $nin : ids }}).exec(); - }).then(function(oldest) { - console.log("Oldest person is: %s", oldest); - }).then(cleanup); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/querybuilder/package.json b/Associations/node_modules/mongoose/examples/querybuilder/package.json deleted file mode 100644 index 1a3450aa..00000000 --- a/Associations/node_modules/mongoose/examples/querybuilder/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "query-builder-example", - "private": "true", - "version": "0.0.0", - "description": "deps for query builder example", - "main": "querybuilder.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "async": "*" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/querybuilder/person.js b/Associations/node_modules/mongoose/examples/querybuilder/person.js deleted file mode 100644 index f9c9a27a..00000000 --- a/Associations/node_modules/mongoose/examples/querybuilder/person.js +++ /dev/null @@ -1,15 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date - }); - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/querybuilder/querybuilder.js b/Associations/node_modules/mongoose/examples/querybuilder/querybuilder.js deleted file mode 100644 index a5784c25..00000000 --- a/Associations/node_modules/mongoose/examples/querybuilder/querybuilder.js +++ /dev/null @@ -1,65 +0,0 @@ - -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./person.js')(); - -var Person = mongoose.model('Person'); - -// define some dummy data -var data = [ - { name : 'bill', age : 25, birthday : new Date().setFullYear((new - Date().getFullYear() - 25)) }, - { name : 'mary', age : 30, birthday : new Date().setFullYear((new - Date().getFullYear() - 30)) }, - { name : 'bob', age : 21, birthday : new Date().setFullYear((new - Date().getFullYear() - 21)) }, - { name : 'lilly', age : 26, birthday : new Date().setFullYear((new - Date().getFullYear() - 26)) }, - { name : 'alucard', age : 1000, birthday : new Date().setFullYear((new - Date().getFullYear() - 1000)) } -]; - - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - // create all of the dummy people - async.each(data, function(item, cb) { - Person.create(item, cb); - }, function(err) { - if (err) throw err; - - // when querying data, instead of providing a callback, you can instead - // leave that off and get a query object returned - var query = Person.find({ age : { $lt : 1000 }}); - - // this allows you to continue applying modifiers to it - query.sort('birthday'); - query.select('name'); - - // you can chain them together as well - // a full list of methods can be found: - // http://mongoosejs.com/docs/api.html#query-js - query.where('age').gt(21); - - // finally, when ready to execute the query, call the exec() function - query.exec(function(err, results) { - if (err) throw err; - - console.log(results); - - cleanup(); - }); - - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/replicasets/package.json b/Associations/node_modules/mongoose/examples/replicasets/package.json deleted file mode 100644 index 927dfd24..00000000 --- a/Associations/node_modules/mongoose/examples/replicasets/package.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "name": "replica-set-example", - "private": "true", - "version": "0.0.0", - "description": "deps for replica set example", - "main": "querybuilder.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "dependencies": { "async": "*" }, - "repository": "", - "author": "", - "license": "BSD" -} diff --git a/Associations/node_modules/mongoose/examples/replicasets/person.js b/Associations/node_modules/mongoose/examples/replicasets/person.js deleted file mode 100644 index f9c9a27a..00000000 --- a/Associations/node_modules/mongoose/examples/replicasets/person.js +++ /dev/null @@ -1,15 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date - }); - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/replicasets/replica-sets.js b/Associations/node_modules/mongoose/examples/replicasets/replica-sets.js deleted file mode 100644 index 4a9f63fe..00000000 --- a/Associations/node_modules/mongoose/examples/replicasets/replica-sets.js +++ /dev/null @@ -1,56 +0,0 @@ - -// import async to make control flow simplier -var async = require('async'); - -// import the rest of the normal stuff -var mongoose = require('../../lib'); - -require('./person.js')(); - -var Person = mongoose.model('Person'); - -// define some dummy data -var data = [ - { name : 'bill', age : 25, birthday : new Date().setFullYear((new - Date().getFullYear() - 25)) }, - { name : 'mary', age : 30, birthday : new Date().setFullYear((new - Date().getFullYear() - 30)) }, - { name : 'bob', age : 21, birthday : new Date().setFullYear((new - Date().getFullYear() - 21)) }, - { name : 'lilly', age : 26, birthday : new Date().setFullYear((new - Date().getFullYear() - 26)) }, - { name : 'alucard', age : 1000, birthday : new Date().setFullYear((new - Date().getFullYear() - 1000)) } -]; - - -// to connect to a replica set, pass in the comma delimited uri and optionally -// any connection options such as the rs_name. -var opts = { - replSet : { rs_name : "rs0" } -}; -mongoose.connect('mongodb://localhost:27018/persons,localhost:27019,localhost:27020', opts, function(err) { - if (err) throw err; - - // create all of the dummy people - async.each(data, function(item, cb) { - Person.create(item, cb); - }, function(err) { - if (err) { - // handle error - } - - // create and delete some data - var prom = Person.find({age : { $lt : 1000 }}).exec(); - - prom.then(function(people) { - console.log("young people: %s", people); - }).then(cleanup); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/examples/schema/schema.js b/Associations/node_modules/mongoose/examples/schema/schema.js deleted file mode 100644 index 244d0020..00000000 --- a/Associations/node_modules/mongoose/examples/schema/schema.js +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * Module dependencies. - */ - -var mongoose = require('../../lib') - , Schema = mongoose.Schema; - -/** - * Schema definition - */ - -// recursive embedded-document schema - -var Comment = new Schema(); - -Comment.add({ - title : { type: String, index: true } - , date : Date - , body : String - , comments : [Comment] -}); - -var BlogPost = new Schema({ - title : { type: String, index: true } - , slug : { type: String, lowercase: true, trim: true } - , date : Date - , buf : Buffer - , comments : [Comment] - , creator : Schema.ObjectId -}); - -var Person = new Schema({ - name: { - first: String - , last : String - } - , email: { type: String, required: true, index: { unique: true, sparse: true } } - , alive: Boolean -}); - -/** - * Accessing a specific schema type by key - */ - -BlogPost.path('date') -.default(function() { - return new Date(); -}) -.set(function(v) { - return v == 'now' ? new Date() : v; -}); - -/** - * Pre hook. - */ - -BlogPost.pre('save', function(next, done) { - /* global emailAuthor */ - emailAuthor(done); // some async function - next(); -}); - -/** - * Methods - */ - -BlogPost.methods.findCreator = function(callback) { - return this.db.model('Person').findById(this.creator, callback); -}; - -BlogPost.statics.findByTitle = function(title, callback) { - return this.find({ title: title }, callback); -}; - -BlogPost.methods.expressiveQuery = function(creator, date, callback) { - return this.find('creator', creator).where('date').gte(date).run(callback); -}; - -/** - * Plugins - */ - -function slugGenerator(options) { - options = options || {}; - var key = options.key || 'title'; - - return function slugGenerator(schema) { - schema.path(key).set(function(v) { - this.slug = v.toLowerCase().replace(/[^a-z0-9]/g, '').replace(/-+/g, ''); - return v; - }); - }; -} - -BlogPost.plugin(slugGenerator()); - -/** - * Define model. - */ - -mongoose.model('BlogPost', BlogPost); -mongoose.model('Person', Person); diff --git a/Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/index.js b/Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/index.js deleted file mode 100644 index a0372670..00000000 --- a/Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/index.js +++ /dev/null @@ -1,27 +0,0 @@ - -// modules -var mongoose = require('../../../lib'); -var Schema = mongoose.Schema; - -// parse json -var raw = require('./schema.json'); - -// create a schema -var timeSignatureSchema = Schema(raw); - -// compile the model -var TimeSignature = mongoose.model('TimeSignatures', timeSignatureSchema); - -// create a TimeSignature document -var threeFour = new TimeSignature({ - count: 3 - , unit: 4 - , description: "3/4" - , additive: false - , created: new Date - , links: ["http://en.wikipedia.org/wiki/Time_signature"] - , user_id: "518d31a0ef32bbfa853a9814" -}); - -// print its description -console.log(threeFour); diff --git a/Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/schema.json b/Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/schema.json deleted file mode 100644 index 5afc626c..00000000 --- a/Associations/node_modules/mongoose/examples/schema/storing-schemas-as-json/schema.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "count": "number", - "unit": "number", - "description": "string", - "links": ["string"], - "created": "date", - "additive": "boolean", - "user_id": "ObjectId" -} diff --git a/Associations/node_modules/mongoose/examples/statics/person.js b/Associations/node_modules/mongoose/examples/statics/person.js deleted file mode 100644 index 58e3359d..00000000 --- a/Associations/node_modules/mongoose/examples/statics/person.js +++ /dev/null @@ -1,21 +0,0 @@ - -// import the necessary modules -var mongoose = require('../../lib'); -var Schema = mongoose.Schema; - -// create an export function to encapsulate the model creation -module.exports = function() { - // define schema - var PersonSchema = new Schema({ - name : String, - age : Number, - birthday : Date - }); - - // define a static - PersonSchema.statics.findPersonByName = function(name, cb) { - this.find({ name : new RegExp(name, 'i') }, cb); - }; - - mongoose.model('Person', PersonSchema); -}; diff --git a/Associations/node_modules/mongoose/examples/statics/statics.js b/Associations/node_modules/mongoose/examples/statics/statics.js deleted file mode 100644 index 0c0daf53..00000000 --- a/Associations/node_modules/mongoose/examples/statics/statics.js +++ /dev/null @@ -1,38 +0,0 @@ - -var mongoose = require('../../lib'); - - -// import the schema -require('./person.js')(); - -// grab the person model object -var Person = mongoose.model("Person"); - -// connect to a server to do a quick write / read example - -mongoose.connect('mongodb://localhost/persons', function(err) { - if (err) throw err; - - Person.create({ - name : 'bill', - age : 25, - birthday : new Date().setFullYear((new Date().getFullYear() - 25)) - }, function(err, bill) { - if (err) throw err; - console.log("People added to db: %s", bill.toString()); - - // using the static - Person.findPersonByName('bill', function(err, result) { - if (err) throw err; - - console.log(result); - cleanup(); - }); - }); -}); - -function cleanup() { - Person.remove(function() { - mongoose.disconnect(); - }); -} diff --git a/Associations/node_modules/mongoose/index.js b/Associations/node_modules/mongoose/index.js deleted file mode 100644 index e7e62785..00000000 --- a/Associations/node_modules/mongoose/index.js +++ /dev/null @@ -1,7 +0,0 @@ - -/** - * Export lib/mongoose - * - */ - -module.exports = require('./lib/'); diff --git a/Associations/node_modules/mongoose/lib/ES6Promise.js b/Associations/node_modules/mongoose/lib/ES6Promise.js deleted file mode 100644 index 295adb11..00000000 --- a/Associations/node_modules/mongoose/lib/ES6Promise.js +++ /dev/null @@ -1,28 +0,0 @@ -/* eslint no-unused-vars: 1 */ - -/** - * ES6 Promise wrapper constructor. - * - * Promises are returned from executed queries. Example: - * - * var query = Candy.find({ bar: true }); - * var promise = query.exec(); - * - * DEPRECATED. Mongoose 5.0 will use native promises by default (or bluebird, - * if native promises are not present) but still - * support plugging in your own ES6-compatible promises library. Mongoose 5.0 - * will **not** support mpromise. - * - * @param {Function} fn a function which will be called when the promise is resolved that accepts `fn(err, ...){}` as signature - * @api public - */ - -function ES6Promise(fn) { - throw 'Can\'t use ES6 promise with mpromise style constructor'; -} - -ES6Promise.use = function(Promise) { - ES6Promise.ES6 = Promise; -}; - -module.exports = ES6Promise; diff --git a/Associations/node_modules/mongoose/lib/aggregate.js b/Associations/node_modules/mongoose/lib/aggregate.js deleted file mode 100644 index 45e28cbd..00000000 --- a/Associations/node_modules/mongoose/lib/aggregate.js +++ /dev/null @@ -1,555 +0,0 @@ -/* eslint no-unused-vars: 1 */ - -/*! - * Module dependencies - */ - -var util = require('util'); -var utils = require('./utils'); -var PromiseProvider = require('./promise_provider'); -var Query = require('./query'); -var read = Query.prototype.read; - -/** - * Aggregate constructor used for building aggregation pipelines. - * - * ####Example: - * - * new Aggregate(); - * new Aggregate({ $project: { a: 1, b: 1 } }); - * new Aggregate({ $project: { a: 1, b: 1 } }, { $skip: 5 }); - * new Aggregate([{ $project: { a: 1, b: 1 } }, { $skip: 5 }]); - * - * Returned when calling Model.aggregate(). - * - * ####Example: - * - * Model - * .aggregate({ $match: { age: { $gte: 21 }}}) - * .unwind('tags') - * .exec(callback) - * - * ####Note: - * - * - The documents returned are plain javascript objects, not mongoose documents (since any shape of document can be returned). - * - Requires MongoDB >= 2.1 - * - Mongoose does **not** cast pipeline stages. `new Aggregate({ $match: { _id: '00000000000000000000000a' } });` will not work unless `_id` is a string in the database. Use `new Aggregate({ $match: { _id: mongoose.Schema.Types.ObjectId('00000000000000000000000a') } });` instead. - * - * @see MongoDB http://docs.mongodb.org/manual/applications/aggregation/ - * @see driver http://mongodb.github.com/node-mongodb-native/api-generated/collection.html#aggregate - * @param {Object|Array} [ops] aggregation operator(s) or operator array - * @api public - */ - -function Aggregate() { - this._pipeline = []; - this._model = undefined; - this.options = undefined; - - if (1 === arguments.length && util.isArray(arguments[0])) { - this.append.apply(this, arguments[0]); - } else { - this.append.apply(this, arguments); - } -} - -/** - * Binds this aggregate to a model. - * - * @param {Model} model the model to which the aggregate is to be bound - * @return {Aggregate} - * @api public - */ - -Aggregate.prototype.model = function(model) { - this._model = model; - return this; -}; - -/** - * Appends new operators to this aggregate pipeline - * - * ####Examples: - * - * aggregate.append({ $project: { field: 1 }}, { $limit: 2 }); - * - * // or pass an array - * var pipeline = [{ $match: { daw: 'Logic Audio X' }} ]; - * aggregate.append(pipeline); - * - * @param {Object} ops operator(s) to append - * @return {Aggregate} - * @api public - */ - -Aggregate.prototype.append = function() { - var args = utils.args(arguments); - - if (!args.every(isOperator)) { - throw new Error("Arguments must be aggregate pipeline operators"); - } - - this._pipeline = this._pipeline.concat(args); - - return this; -}; - -/** - * Appends a new $project operator to this aggregate pipeline. - * - * Mongoose query [selection syntax](#query_Query-select) is also supported. - * - * ####Examples: - * - * // include a, include b, exclude _id - * aggregate.project("a b -_id"); - * - * // or you may use object notation, useful when - * // you have keys already prefixed with a "-" - * aggregate.project({a: 1, b: 1, _id: 0}); - * - * // reshaping documents - * aggregate.project({ - * newField: '$b.nested' - * , plusTen: { $add: ['$val', 10]} - * , sub: { - * name: '$a' - * } - * }) - * - * // etc - * aggregate.project({ salary_k: { $divide: [ "$salary", 1000 ] } }); - * - * @param {Object|String} arg field specification - * @see projection http://docs.mongodb.org/manual/reference/aggregation/project/ - * @return {Aggregate} - * @api public - */ - -Aggregate.prototype.project = function(arg) { - var fields = {}; - - if ('object' === typeof arg && !util.isArray(arg)) { - Object.keys(arg).forEach(function(field) { - fields[field] = arg[field]; - }); - } else if (1 === arguments.length && 'string' === typeof arg) { - arg.split(/\s+/).forEach(function(field) { - if (!field) return; - var include = '-' == field[0] ? 0 : 1; - if (include === 0) field = field.substring(1); - fields[field] = include; - }); - } else { - throw new Error("Invalid project() argument. Must be string or object"); - } - - return this.append({ $project: fields }); -}; - -/** - * Appends a new custom $group operator to this aggregate pipeline. - * - * ####Examples: - * - * aggregate.group({ _id: "$department" }); - * - * @see $group http://docs.mongodb.org/manual/reference/aggregation/group/ - * @method group - * @memberOf Aggregate - * @param {Object} arg $group operator contents - * @return {Aggregate} - * @api public - */ - -/** - * Appends a new custom $match operator to this aggregate pipeline. - * - * ####Examples: - * - * aggregate.match({ department: { $in: [ "sales", "engineering" } } }); - * - * @see $match http://docs.mongodb.org/manual/reference/aggregation/match/ - * @method match - * @memberOf Aggregate - * @param {Object} arg $match operator contents - * @return {Aggregate} - * @api public - */ - -/** - * Appends a new $skip operator to this aggregate pipeline. - * - * ####Examples: - * - * aggregate.skip(10); - * - * @see $skip http://docs.mongodb.org/manual/reference/aggregation/skip/ - * @method skip - * @memberOf Aggregate - * @param {Number} num number of records to skip before next stage - * @return {Aggregate} - * @api public - */ - -/** - * Appends a new $limit operator to this aggregate pipeline. - * - * ####Examples: - * - * aggregate.limit(10); - * - * @see $limit http://docs.mongodb.org/manual/reference/aggregation/limit/ - * @method limit - * @memberOf Aggregate - * @param {Number} num maximum number of records to pass to the next stage - * @return {Aggregate} - * @api public - */ - -/** - * Appends a new $geoNear operator to this aggregate pipeline. - * - * ####NOTE: - * - * **MUST** be used as the first operator in the pipeline. - * - * ####Examples: - * - * aggregate.near({ - * near: [40.724, -73.997], - * distanceField: "dist.calculated", // required - * maxDistance: 0.008, - * query: { type: "public" }, - * includeLocs: "dist.location", - * uniqueDocs: true, - * num: 5 - * }); - * - * @see $geoNear http://docs.mongodb.org/manual/reference/aggregation/geoNear/ - * @method near - * @memberOf Aggregate - * @param {Object} parameters - * @return {Aggregate} - * @api public - */ - -Aggregate.prototype.near = function(arg) { - var op = {}; - op.$geoNear = arg; - return this.append(op); -}; - -/*! - * define methods - */ - -'group match skip limit out'.split(' ').forEach(function($operator) { - Aggregate.prototype[$operator] = function(arg) { - var op = {}; - op['$' + $operator] = arg; - return this.append(op); - }; -}); - -/** - * Appends new custom $unwind operator(s) to this aggregate pipeline. - * - * Note that the `$unwind` operator requires the path name to start with '$'. - * Mongoose will prepend '$' if the specified field doesn't start '$'. - * - * ####Examples: - * - * aggregate.unwind("tags"); - * aggregate.unwind("a", "b", "c"); - * - * @see $unwind http://docs.mongodb.org/manual/reference/aggregation/unwind/ - * @param {String} fields the field(s) to unwind - * @return {Aggregate} - * @api public - */ - -Aggregate.prototype.unwind = function() { - var args = utils.args(arguments); - - return this.append.apply(this, args.map(function(arg) { - return { $unwind: (arg && arg.charAt(0) === '$') ? arg : '$' + arg }; - })); -}; - -/** - * Appends a new $sort operator to this aggregate pipeline. - * - * If an object is passed, values allowed are `asc`, `desc`, `ascending`, `descending`, `1`, and `-1`. - * - * If a string is passed, it must be a space delimited list of path names. The sort order of each path is ascending unless the path name is prefixed with `-` which will be treated as descending. - * - * ####Examples: - * - * // these are equivalent - * aggregate.sort({ field: 'asc', test: -1 }); - * aggregate.sort('field -test'); - * - * @see $sort http://docs.mongodb.org/manual/reference/aggregation/sort/ - * @param {Object|String} arg - * @return {Aggregate} this - * @api public - */ - -Aggregate.prototype.sort = function(arg) { - // TODO refactor to reuse the query builder logic - - var sort = {}; - - if ('Object' === arg.constructor.name) { - var desc = ['desc', 'descending', -1]; - Object.keys(arg).forEach(function(field) { - sort[field] = desc.indexOf(arg[field]) === -1 ? 1 : -1; - }); - } else if (1 === arguments.length && 'string' == typeof arg) { - arg.split(/\s+/).forEach(function(field) { - if (!field) return; - var ascend = '-' == field[0] ? -1 : 1; - if (ascend === -1) field = field.substring(1); - sort[field] = ascend; - }); - } else { - throw new TypeError('Invalid sort() argument. Must be a string or object.'); - } - - return this.append({ $sort: sort }); -}; - -/** - * Sets the readPreference option for the aggregation query. - * - * ####Example: - * - * Model.aggregate(..).read('primaryPreferred').exec(callback) - * - * @param {String} pref one of the listed preference options or their aliases - * @param {Array} [tags] optional tags for this query - * @see mongodb http://docs.mongodb.org/manual/applications/replication/#read-preference - * @see driver http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences - */ - -Aggregate.prototype.read = function(pref) { - if (!this.options) this.options = {}; - read.apply(this, arguments); - return this; -}; - -/** - * Execute the aggregation with explain - * - * ####Example: - * - * Model.aggregate(..).explain(callback) - * - * @param {Function} callback - * @return {Promise} - */ - -Aggregate.prototype.explain = function(callback) { - var _this = this; - var Promise = PromiseProvider.get(); - return new Promise.ES6(function(resolve, reject) { - if (!_this._pipeline.length) { - var err = new Error('Aggregate has empty pipeline'); - if (callback) { - callback(err); - } - reject(err); - return; - } - - prepareDiscriminatorPipeline(_this); - - _this._model - .collection - .aggregate(_this._pipeline, _this.options || {}) - .explain(function(error, result) { - if (error) { - if (callback) { - callback(error); - } - reject(error); - return; - } - - if (callback) { - callback(null, result); - } - resolve(result); - }); - }); -}; - -/** - * Sets the allowDiskUse option for the aggregation query (ignored for < 2.6.0) - * - * ####Example: - * - * Model.aggregate(..).allowDiskUse(true).exec(callback) - * - * @param {Boolean} value Should tell server it can use hard drive to store data during aggregation. - * @param {Array} [tags] optional tags for this query - * @see mongodb http://docs.mongodb.org/manual/reference/command/aggregate/ - */ - -Aggregate.prototype.allowDiskUse = function(value) { - if (!this.options) this.options = {}; - this.options.allowDiskUse = value; - return this; -}; - -/** - * Sets the cursor option option for the aggregation query (ignored for < 2.6.0). - * Note the different syntax below: .exec() returns a cursor object, and no callback - * is necessary. - * - * ####Example: - * - * var cursor = Model.aggregate(..).cursor({ batchSize: 1000 }).exec(); - * cursor.each(function(error, doc) { - * // use doc - * }); - * - * @param {Object} options set the cursor batch size - * @see mongodb http://mongodb.github.io/node-mongodb-native/2.0/api/AggregationCursor.html - */ - -Aggregate.prototype.cursor = function(options) { - if (!this.options) this.options = {}; - this.options.cursor = options; - return this; -}; - -/** - * Executes the aggregate pipeline on the currently bound Model. - * - * ####Example: - * - * aggregate.exec(callback); - * - * // Because a promise is returned, the `callback` is optional. - * var promise = aggregate.exec(); - * promise.then(..); - * - * @see Promise #promise_Promise - * @param {Function} [callback] - * @return {Promise} - * @api public - */ - -Aggregate.prototype.exec = function(callback) { - if (!this._model) { - throw new Error("Aggregate not bound to any Model"); - } - - if (this.options && this.options.cursor) { - return this._model.collection.aggregate(this._pipeline, this.options || {}); - } - - var _this = this; - var Promise = PromiseProvider.get(); - return new Promise.ES6(function(resolve, reject) { - if (!_this._pipeline.length) { - var err = new Error('Aggregate has empty pipeline'); - if (callback) { - callback(err); - } - reject(err); - return; - } - - prepareDiscriminatorPipeline(_this); - - _this._model - .collection - .aggregate(_this._pipeline, _this.options || {}, function(error, result) { - if (error) { - if (callback) { - callback(error); - } - reject(error); - return; - } - - if (callback) { - callback(null, result); - } - resolve(result); - }); - }); -}; - -/*! - * Helpers - */ - -/** - * Checks whether an object is likely a pipeline operator - * - * @param {Object} obj object to check - * @return {Boolean} - * @api private - */ - -function isOperator(obj) { - var k; - - if ('object' !== typeof obj) { - return false; - } - - k = Object.keys(obj); - - return 1 === k.length && k.some(function(key) { - return '$' === key[0]; - }); -} - -/*! - * Adds the appropriate `$match` pipeline step to the top of an aggregate's - * pipeline, should it's model is a non-root discriminator type. This is - * analogous to the `prepareDiscriminatorCriteria` function in `lib/query.js`. - * - * @param {Aggregate} aggregate Aggregate to prepare - */ - -function prepareDiscriminatorPipeline(aggregate) { - var schema = aggregate._model.schema, - discriminatorMapping = schema && schema.discriminatorMapping; - - if (discriminatorMapping && !discriminatorMapping.isRoot) { - var originalPipeline = aggregate._pipeline, - discriminatorKey = discriminatorMapping.key, - discriminatorValue = discriminatorMapping.value; - - // If the first pipeline stage is a match and it doesn't specify a `__t` - // key, add the discriminator key to it. This allows for potential - // aggregation query optimizations not to be disturbed by this feature. - if (originalPipeline[0] && originalPipeline[0].$match && - !originalPipeline[0].$match[discriminatorKey]) { - originalPipeline[0].$match[discriminatorKey] = discriminatorValue; - // `originalPipeline` is a ref, so there's no need for - // aggregate._pipeline = originalPipeline - } else if (originalPipeline[0] && originalPipeline[0].$geoNear) { - originalPipeline[0].$geoNear.query = - originalPipeline[0].$geoNear.query || {}; - originalPipeline[0].$geoNear.query[discriminatorKey] = discriminatorValue; - } else { - var match = {}; - match[discriminatorKey] = discriminatorValue; - aggregate._pipeline = [{ $match: match }].concat(originalPipeline); - } - } -} - - -/*! - * Exports - */ - -module.exports = Aggregate; diff --git a/Associations/node_modules/mongoose/lib/browser.js b/Associations/node_modules/mongoose/lib/browser.js deleted file mode 100644 index d135f66a..00000000 --- a/Associations/node_modules/mongoose/lib/browser.js +++ /dev/null @@ -1,97 +0,0 @@ -/** - * The [MongooseError](#error_MongooseError) constructor. - * - * @method Error - * @api public - */ - -exports.Error = require('./error'); - -/** - * The Mongoose [Schema](#schema_Schema) constructor - * - * ####Example: - * - * var mongoose = require('mongoose'); - * var Schema = mongoose.Schema; - * var CatSchema = new Schema(..); - * - * @method Schema - * @api public - */ - -exports.Schema = require('./schema'); - -/** - * The various Mongoose Types. - * - * ####Example: - * - * var mongoose = require('mongoose'); - * var array = mongoose.Types.Array; - * - * ####Types: - * - * - [ObjectId](#types-objectid-js) - * - [Buffer](#types-buffer-js) - * - [SubDocument](#types-embedded-js) - * - [Array](#types-array-js) - * - [DocumentArray](#types-documentarray-js) - * - * Using this exposed access to the `ObjectId` type, we can construct ids on demand. - * - * var ObjectId = mongoose.Types.ObjectId; - * var id1 = new ObjectId; - * - * @property Types - * @api public - */ -exports.Types = require('./types'); - -/** - * The Mongoose [VirtualType](#virtualtype_VirtualType) constructor - * - * @method VirtualType - * @api public - */ -exports.VirtualType = require('./virtualtype'); - -/** - * The various Mongoose SchemaTypes. - * - * ####Note: - * - * _Alias of mongoose.Schema.Types for backwards compatibility._ - * - * @property SchemaTypes - * @see Schema.SchemaTypes #schema_Schema.Types - * @api public - */ - -exports.SchemaType = require('./schematype.js'); - -/** - * Internal utils - * - * @property utils - * @api private - */ - -exports.utils = require('./utils.js'); - -/** - * The Mongoose browser [Document](#document-js) constructor. - * - * @method Document - * @api public - */ -exports.Document = require('./document_provider.js')(); - -/*! - * Module exports. - */ - -if (typeof window !== 'undefined') { - window.mongoose = module.exports; - window.Buffer = Buffer; -} diff --git a/Associations/node_modules/mongoose/lib/browserDocument.js b/Associations/node_modules/mongoose/lib/browserDocument.js deleted file mode 100644 index 50b3acc2..00000000 --- a/Associations/node_modules/mongoose/lib/browserDocument.js +++ /dev/null @@ -1,105 +0,0 @@ -/*! - * Module dependencies. - */ - -var NodeJSDocument = require('./document') - , EventEmitter = require('events').EventEmitter - , MongooseError = require('./error') - , Schema = require('./schema') - , ObjectId = require('./types/objectid') - , utils = require('./utils') - , ValidationError = MongooseError.ValidationError - , InternalCache = require('./internal'); - -/** - * Document constructor. - * - * @param {Object} obj the values to set - * @param {Object} [fields] optional object containing the fields which were selected in the query returning this document and any populated paths data - * @param {Boolean} [skipId] bool, should we auto create an ObjectId _id - * @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter - * @event `init`: Emitted on a document after it has was retrieved from the db and fully hydrated by Mongoose. - * @event `save`: Emitted when the document is successfully saved - * @api private - */ - -function Document(obj, schema, fields, skipId, skipInit) { - if ( !(this instanceof Document) ) - return new Document( obj, schema, fields, skipId, skipInit ); - - - if (utils.isObject(schema) && !(schema instanceof Schema)) { - schema = new Schema(schema); - } - - // When creating EmbeddedDocument, it already has the schema and he doesn't need the _id - schema = this.schema || schema; - - // Generate ObjectId if it is missing, but it requires a scheme - if ( !this.schema && schema.options._id ) { - obj = obj || {}; - - if ( obj._id === undefined ) { - obj._id = new ObjectId(); - } - } - - if ( !schema ) { - throw new MongooseError.MissingSchemaError(); - } - - this.$__setSchema(schema); - - this.$__ = new InternalCache; - this.$__.emitter = new EventEmitter(); - this.isNew = true; - this.errors = undefined; - - //var schema = this.schema; - - if ('boolean' === typeof fields) { - this.$__.strictMode = fields; - fields = undefined; - } else { - this.$__.strictMode = this.schema.options && this.schema.options.strict; - this.$__.selected = fields; - } - - var required = this.schema.requiredPaths(); - for (var i = 0; i < required.length; ++i) { - this.$__.activePaths.require(required[i]); - } - - this.$__.emitter.setMaxListeners(0); - this._doc = this.$__buildDoc(obj, fields, skipId); - - if ( !skipInit && obj ) { - this.init( obj ); - } - - this.$__registerHooksFromSchema(); - - // apply methods - for ( var m in schema.methods ) { - this[ m ] = schema.methods[ m ]; - } - // apply statics - for ( var s in schema.statics ) { - this[ s ] = schema.statics[ s ]; - } -} - -/*! - * Inherit from the NodeJS document - */ -Document.prototype = Object.create(NodeJSDocument.prototype); -Document.prototype.constructor = Document; - - - -/*! - * Module exports. - */ - -Document.ValidationError = ValidationError; -module.exports = exports = Document; diff --git a/Associations/node_modules/mongoose/lib/cast.js b/Associations/node_modules/mongoose/lib/cast.js deleted file mode 100644 index d647b320..00000000 --- a/Associations/node_modules/mongoose/lib/cast.js +++ /dev/null @@ -1,211 +0,0 @@ -/*! - * Module dependencies. - */ - -var utils = require('./utils'); -var Types = require('./schema/index'); - -/** - * Handles internal casting for queries - * - * @param {Schema} schema - * @param {Object obj Object to cast - * @api private - */ - -var cast = module.exports = function(schema, obj) { - var paths = Object.keys(obj) - , i = paths.length - , any$conditionals - , schematype - , nested - , path - , type - , val; - - while (i--) { - path = paths[i]; - val = obj[path]; - - if ('$or' === path || '$nor' === path || '$and' === path) { - var k = val.length; - - while (k--) { - val[k] = cast(schema, val[k]); - } - - } else if (path === '$where') { - type = typeof val; - - if ('string' !== type && 'function' !== type) { - throw new Error("Must have a string or function for $where"); - } - - if ('function' === type) { - obj[path] = val.toString(); - } - - continue; - - } else if (path === '$elemMatch') { - - val = cast(schema, val); - - } else { - - if (!schema) { - // no casting for Mixed types - continue; - } - - schematype = schema.path(path); - - if (!schematype) { - // Handle potential embedded array queries - var split = path.split('.') - , j = split.length - , pathFirstHalf - , pathLastHalf - , remainingConds; - - // Find the part of the var path that is a path of the Schema - while (j--) { - pathFirstHalf = split.slice(0, j).join('.'); - schematype = schema.path(pathFirstHalf); - if (schematype) break; - } - - // If a substring of the input path resolves to an actual real path... - if (schematype) { - // Apply the casting; similar code for $elemMatch in schema/array.js - if (schematype.caster && schematype.caster.schema) { - remainingConds = {}; - pathLastHalf = split.slice(j).join('.'); - remainingConds[pathLastHalf] = val; - obj[path] = cast(schematype.caster.schema, remainingConds)[pathLastHalf]; - } else { - obj[path] = val; - } - continue; - } - - if (utils.isObject(val)) { - // handle geo schemas that use object notation - // { loc: { long: Number, lat: Number } - - var geo = val.$near ? '$near' : - val.$nearSphere ? '$nearSphere' : - val.$within ? '$within' : - val.$geoIntersects ? '$geoIntersects' : ''; - - if (!geo) { - continue; - } - - var numbertype = new Types.Number('__QueryCasting__'); - var value = val[geo]; - - if (val.$maxDistance) { - val.$maxDistance = numbertype.castForQuery(val.$maxDistance); - } - - if ('$within' == geo) { - var withinType = value.$center - || value.$centerSphere - || value.$box - || value.$polygon; - - if (!withinType) { - throw new Error('Bad $within paramater: ' + JSON.stringify(val)); - } - - value = withinType; - - } else if ('$near' == geo && - 'string' == typeof value.type && Array.isArray(value.coordinates)) { - // geojson; cast the coordinates - value = value.coordinates; - - } else if (('$near' == geo || '$nearSphere' == geo || '$geoIntersects' == geo) && - value.$geometry && 'string' == typeof value.$geometry.type && - Array.isArray(value.$geometry.coordinates)) { - // geojson; cast the coordinates - value = value.$geometry.coordinates; - } - - (function _cast(val) { - if (Array.isArray(val)) { - val.forEach(function(item, i) { - if (Array.isArray(item) || utils.isObject(item)) { - return _cast(item); - } - val[i] = numbertype.castForQuery(item); - }); - } else { - var nearKeys = Object.keys(val); - var nearLen = nearKeys.length; - while (nearLen--) { - var nkey = nearKeys[nearLen]; - var item = val[nkey]; - if (Array.isArray(item) || utils.isObject(item)) { - _cast(item); - val[nkey] = item; - } else { - val[nkey] = numbertype.castForQuery(item); - } - } - } - })(value); - } - - } else if (val === null || val === undefined) { - obj[path] = null; - continue; - } else if ('Object' === val.constructor.name) { - - any$conditionals = Object.keys(val).some(function(k) { - return k.charAt(0) === '$' && k !== '$id' && k !== '$ref'; - }); - - if (!any$conditionals) { - obj[path] = schematype.castForQuery(val); - } else { - - var ks = Object.keys(val) - , $cond; - - k = ks.length; - - while (k--) { - $cond = ks[k]; - nested = val[$cond]; - - if ('$exists' === $cond) { - if ('boolean' !== typeof nested) { - throw new Error("$exists parameter must be Boolean"); - } - continue; - } - - if ('$type' === $cond) { - if ('number' !== typeof nested) { - throw new Error("$type parameter must be Number"); - } - continue; - } - - if ('$not' === $cond) { - cast(schema, nested); - } else { - val[$cond] = schematype.castForQuery($cond, nested); - } - } - } - } else { - obj[path] = schematype.castForQuery(val); - } - } - } - - return obj; -}; diff --git a/Associations/node_modules/mongoose/lib/collection.js b/Associations/node_modules/mongoose/lib/collection.js deleted file mode 100644 index 44cc41f5..00000000 --- a/Associations/node_modules/mongoose/lib/collection.js +++ /dev/null @@ -1,198 +0,0 @@ - -/*! - * Module dependencies. - */ - -var STATES = require('./connectionstate'); - -/** - * Abstract Collection constructor - * - * This is the base class that drivers inherit from and implement. - * - * @param {String} name name of the collection - * @param {Connection} conn A MongooseConnection instance - * @param {Object} opts optional collection options - * @api public - */ - -function Collection(name, conn, opts) { - if (undefined === opts) opts = {}; - if (undefined === opts.capped) opts.capped = {}; - - opts.bufferCommands = undefined === opts.bufferCommands - ? true - : opts.bufferCommands; - - if ('number' == typeof opts.capped) { - opts.capped = { size: opts.capped }; - } - - this.opts = opts; - this.name = name; - this.collectionName = name; - this.conn = conn; - this.queue = []; - this.buffer = this.opts.bufferCommands; - - if (STATES.connected == this.conn.readyState) { - this.onOpen(); - } -} - -/** - * The collection name - * - * @api public - * @property name - */ - -Collection.prototype.name; - -/** - * The collection name - * - * @api public - * @property collectionName - */ - -Collection.prototype.collectionName; - -/** - * The Connection instance - * - * @api public - * @property conn - */ - -Collection.prototype.conn; - -/** - * Called when the database connects - * - * @api private - */ - -Collection.prototype.onOpen = function() { - var self = this; - this.buffer = false; - self.doQueue(); -}; - -/** - * Called when the database disconnects - * - * @api private - */ - -Collection.prototype.onClose = function() { - if (this.opts.bufferCommands) { - this.buffer = true; - } -}; - -/** - * Queues a method for later execution when its - * database connection opens. - * - * @param {String} name name of the method to queue - * @param {Array} args arguments to pass to the method when executed - * @api private - */ - -Collection.prototype.addQueue = function(name, args) { - this.queue.push([name, args]); - return this; -}; - -/** - * Executes all queued methods and clears the queue. - * - * @api private - */ - -Collection.prototype.doQueue = function() { - for (var i = 0, l = this.queue.length; i < l; i++) { - this[this.queue[i][0]].apply(this, this.queue[i][1]); - } - this.queue = []; - return this; -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.ensureIndex = function() { - throw new Error('Collection#ensureIndex unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.findAndModify = function() { - throw new Error('Collection#findAndModify unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.findOne = function() { - throw new Error('Collection#findOne unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.find = function() { - throw new Error('Collection#find unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.insert = function() { - throw new Error('Collection#insert unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.save = function() { - throw new Error('Collection#save unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.update = function() { - throw new Error('Collection#update unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.getIndexes = function() { - throw new Error('Collection#getIndexes unimplemented by driver'); -}; - -/** - * Abstract method that drivers must implement. - */ - -Collection.prototype.mapReduce = function() { - throw new Error('Collection#mapReduce unimplemented by driver'); -}; - -/*! - * Module exports. - */ - -module.exports = Collection; diff --git a/Associations/node_modules/mongoose/lib/connection.js b/Associations/node_modules/mongoose/lib/connection.js deleted file mode 100644 index 5a7b2f6a..00000000 --- a/Associations/node_modules/mongoose/lib/connection.js +++ /dev/null @@ -1,740 +0,0 @@ -/*! - * Module dependencies. - */ - -var utils = require('./utils') - , EventEmitter = require('events').EventEmitter - , driver = global.MONGOOSE_DRIVER_PATH || './drivers/node-mongodb-native' - , Schema = require('./schema') - , Collection = require(driver + '/collection') - , STATES = require('./connectionstate') - , MongooseError = require('./error') - , muri = require('muri'); - -/*! - * Protocol prefix regexp. - * - * @api private - */ - -var rgxProtocol = /^(?:.)+:\/\//; - -/*! - * A list of authentication mechanisms that don't require a password for authentication. - * This is used by the authMechanismDoesNotRequirePassword method. - * - * @api private - */ -var authMechanismsWhichDontRequirePassword = [ - 'MONGODB-X509' -]; - -/** - * Connection constructor - * - * For practical reasons, a Connection equals a Db. - * - * @param {Mongoose} base a mongoose instance - * @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter - * @event `connecting`: Emitted when `connection.{open,openSet}()` is executed on this connection. - * @event `connected`: Emitted when this connection successfully connects to the db. May be emitted _multiple_ times in `reconnected` scenarios. - * @event `open`: Emitted after we `connected` and `onOpen` is executed on all of this connections models. - * @event `disconnecting`: Emitted when `connection.close()` was executed. - * @event `disconnected`: Emitted after getting disconnected from the db. - * @event `close`: Emitted after we `disconnected` and `onClose` executed on all of this connections models. - * @event `reconnected`: Emitted after we `connected` and subsequently `disconnected`, followed by successfully another successfull connection. - * @event `error`: Emitted when an error occurs on this connection. - * @event `fullsetup`: Emitted in a replica-set scenario, when all nodes specified in the connection string are connected. - * @api public - */ - -function Connection(base) { - this.base = base; - this.collections = {}; - this.models = {}; - this.config = {autoIndex: true}; - this.replica = false; - this.hosts = null; - this.host = null; - this.port = null; - this.user = null; - this.pass = null; - this.name = null; - this.options = null; - this.otherDbs = []; - this._readyState = STATES.disconnected; - this._closeCalled = false; - this._hasOpened = false; -} - -/*! - * Inherit from EventEmitter - */ - -Connection.prototype.__proto__ = EventEmitter.prototype; - -/** - * Connection ready state - * - * - 0 = disconnected - * - 1 = connected - * - 2 = connecting - * - 3 = disconnecting - * - * Each state change emits its associated event name. - * - * ####Example - * - * conn.on('connected', callback); - * conn.on('disconnected', callback); - * - * @property readyState - * @api public - */ - -Object.defineProperty(Connection.prototype, 'readyState', { - get: function() { return this._readyState; } - , set: function(val) { - if (!(val in STATES)) { - throw new Error('Invalid connection state: ' + val); - } - - if (this._readyState !== val) { - this._readyState = val; - // loop over the otherDbs on this connection and change their state - for (var i = 0; i < this.otherDbs.length; i++) { - this.otherDbs[i].readyState = val; - } - - if (STATES.connected === val) - this._hasOpened = true; - - this.emit(STATES[val]); - } - } -}); - -/** - * A hash of the collections associated with this connection - * - * @property collections - */ - -Connection.prototype.collections; - -/** - * The mongodb.Db instance, set when the connection is opened - * - * @property db - */ - -Connection.prototype.db; - -/** - * A hash of the global options that are associated with this connection - * - * @property global - */ - -Connection.prototype.config; - -/** - * Opens the connection to MongoDB. - * - * `options` is a hash with the following possible properties: - * - * config - passed to the connection config instance - * db - passed to the connection db instance - * server - passed to the connection server instance(s) - * replset - passed to the connection ReplSet instance - * user - username for authentication - * pass - password for authentication - * auth - options for authentication (see http://mongodb.github.com/node-mongodb-native/api-generated/db.html#authenticate) - * - * ####Notes: - * - * Mongoose forces the db option `forceServerObjectId` false and cannot be overridden. - * Mongoose defaults the server `auto_reconnect` options to true which can be overridden. - * See the node-mongodb-native driver instance for options that it understands. - * - * _Options passed take precedence over options included in connection strings._ - * - * @param {String} connection_string mongodb://uri or the host to which you are connecting - * @param {String} [database] database name - * @param {Number} [port] database port - * @param {Object} [options] options - * @param {Function} [callback] - * @see node-mongodb-native https://github.com/mongodb/node-mongodb-native - * @see http://mongodb.github.com/node-mongodb-native/api-generated/db.html#authenticate - * @api public - */ - -Connection.prototype.open = function(host, database, port, options, callback) { - var parsed; - - if ('string' === typeof database) { - switch (arguments.length) { - case 2: - port = 27017; - break; - case 3: - switch (typeof port) { - case 'function': - callback = port, port = 27017; - break; - case 'object': - options = port, port = 27017; - break; - } - break; - case 4: - if ('function' === typeof options) - callback = options, options = {}; - } - } else { - switch (typeof database) { - case 'function': - callback = database, database = undefined; - break; - case 'object': - options = database; - database = undefined; - callback = port; - break; - } - - if (!rgxProtocol.test(host)) { - host = 'mongodb://' + host; - } - - try { - parsed = muri(host); - } catch (err) { - this.error(err, callback); - return this; - } - - database = parsed.db; - host = parsed.hosts[0].host || parsed.hosts[0].ipc; - port = parsed.hosts[0].port || 27017; - } - - this.options = this.parseOptions(options, parsed && parsed.options); - - // make sure we can open - if (STATES.disconnected !== this.readyState) { - var err = new Error('Trying to open unclosed connection.'); - err.state = this.readyState; - this.error(err, callback); - return this; - } - - if (!host) { - this.error(new Error('Missing hostname.'), callback); - return this; - } - - if (!database) { - this.error(new Error('Missing database name.'), callback); - return this; - } - - // authentication - if (this.optionsProvideAuthenticationData(options)) { - this.user = options.user; - this.pass = options.pass; - - } else if (parsed && parsed.auth) { - this.user = parsed.auth.user; - this.pass = parsed.auth.pass; - - // Check hostname for user/pass - } else if (/@/.test(host) && /:/.test(host.split('@')[0])) { - host = host.split('@'); - var auth = host.shift().split(':'); - host = host.pop(); - this.user = auth[0]; - this.pass = auth[1]; - - } else { - this.user = this.pass = undefined; - } - - // global configuration options - if (options && options.config) { - if (options.config.autoIndex === false) { - this.config.autoIndex = false; - } - else { - this.config.autoIndex = true; - } - - } - - this.name = database; - this.host = host; - this.port = port; - - this._open(callback); - return this; -}; - -/** - * Opens the connection to a replica set. - * - * ####Example: - * - * var db = mongoose.createConnection(); - * db.openSet("mongodb://user:pwd@localhost:27020/testing,mongodb://example.com:27020,mongodb://localhost:27019"); - * - * The database name and/or auth need only be included in one URI. - * The `options` is a hash which is passed to the internal driver connection object. - * - * Valid `options` - * - * db - passed to the connection db instance - * server - passed to the connection server instance(s) - * replset - passed to the connection ReplSetServer instance - * user - username for authentication - * pass - password for authentication - * auth - options for authentication (see http://mongodb.github.com/node-mongodb-native/api-generated/db.html#authenticate) - * mongos - Boolean - if true, enables High Availability support for mongos - * - * _Options passed take precedence over options included in connection strings._ - * - * ####Notes: - * - * _If connecting to multiple mongos servers, set the `mongos` option to true._ - * - * conn.open('mongodb://mongosA:27501,mongosB:27501', { mongos: true }, cb); - * - * Mongoose forces the db option `forceServerObjectId` false and cannot be overridden. - * Mongoose defaults the server `auto_reconnect` options to true which can be overridden. - * See the node-mongodb-native driver instance for options that it understands. - * - * _Options passed take precedence over options included in connection strings._ - * - * @param {String} uris comma-separated mongodb:// `URI`s - * @param {String} [database] database name if not included in `uris` - * @param {Object} [options] passed to the internal driver - * @param {Function} [callback] - * @see node-mongodb-native https://github.com/mongodb/node-mongodb-native - * @see http://mongodb.github.com/node-mongodb-native/api-generated/db.html#authenticate - * @api public - */ - -Connection.prototype.openSet = function(uris, database, options, callback) { - if (!rgxProtocol.test(uris)) { - uris = 'mongodb://' + uris; - } - - switch (arguments.length) { - case 3: - switch (typeof database) { - case 'string': - this.name = database; - break; - case 'object': - callback = options; - options = database; - database = null; - break; - } - - if ('function' === typeof options) { - callback = options; - options = {}; - } - break; - case 2: - switch (typeof database) { - case 'string': - this.name = database; - break; - case 'function': - callback = database, database = null; - break; - case 'object': - options = database, database = null; - break; - } - } - - var parsed; - try { - parsed = muri(uris); - } catch (err) { - this.error(err, callback); - return this; - } - - if (!this.name) { - this.name = parsed.db; - } - - this.hosts = parsed.hosts; - this.options = this.parseOptions(options, parsed && parsed.options); - this.replica = true; - - if (!this.name) { - this.error(new Error('No database name provided for replica set'), callback); - return this; - } - - // authentication - if (this.optionsProvideAuthenticationData(options)) { - this.user = options.user; - this.pass = options.pass; - - } else if (parsed && parsed.auth) { - this.user = parsed.auth.user; - this.pass = parsed.auth.pass; - - } else { - this.user = this.pass = undefined; - } - - // global configuration options - if (options && options.config) { - if (options.config.autoIndex === false) { - this.config.autoIndex = false; - } - else { - this.config.autoIndex = true; - } - - } - - this._open(callback); - return this; -}; - -/** - * error - * - * Graceful error handling, passes error to callback - * if available, else emits error on the connection. - * - * @param {Error} err - * @param {Function} callback optional - * @api private - */ - -Connection.prototype.error = function(err, callback) { - if (callback) return callback(err); - this.emit('error', err); -}; - -/** - * Handles opening the connection with the appropriate method based on connection type. - * - * @param {Function} callback - * @api private - */ - -Connection.prototype._open = function(callback) { - this.readyState = STATES.connecting; - this._closeCalled = false; - - var self = this; - - var method = this.replica - ? 'doOpenSet' - : 'doOpen'; - - // open connection - this[method](function(err) { - if (err) { - self.readyState = STATES.disconnected; - if (self._hasOpened) { - if (callback) callback(err); - } else { - self.error(err, callback); - } - return; - } - - self.onOpen(callback); - }); -}; - -/** - * Called when the connection is opened - * - * @api private - */ - -Connection.prototype.onOpen = function(callback) { - var self = this; - - function open(err, isAuth) { - if (err) { - self.readyState = isAuth ? STATES.unauthorized : STATES.disconnected; - if (self._hasOpened) { - if (callback) callback(err); - } else { - self.error(err, callback); - } - return; - } - - self.readyState = STATES.connected; - - // avoid having the collection subscribe to our event emitter - // to prevent 0.3 warning - for (var i in self.collections) - self.collections[i].onOpen(); - - callback && callback(); - self.emit('open'); - } - - // re-authenticate - if (this.shouldAuthenticate()) { - self.db.authenticate(self.user, self.pass, self.options.auth, function(err) { - open(err, true); - }); - } else { - open(); - } -}; - -/** - * Closes the connection - * - * @param {Function} [callback] optional - * @return {Connection} self - * @api public - */ - -Connection.prototype.close = function(callback) { - var self = this; - this._closeCalled = true; - - switch (this.readyState) { - case 0: // disconnected - callback && callback(); - break; - - case 1: // connected - case 4: // unauthorized - this.readyState = STATES.disconnecting; - this.doClose(function(err) { - if (err) { - self.error(err, callback); - } else { - self.onClose(); - callback && callback(); - } - }); - break; - - case 2: // connecting - this.once('open', function() { - self.close(callback); - }); - break; - - case 3: // disconnecting - if (!callback) break; - this.once('close', function() { - callback(); - }); - break; - } - - return this; -}; - -/** - * Called when the connection closes - * - * @api private - */ - -Connection.prototype.onClose = function() { - this.readyState = STATES.disconnected; - - // avoid having the collection subscribe to our event emitter - // to prevent 0.3 warning - for (var i in this.collections) - this.collections[i].onClose(); - - this.emit('close'); -}; - -/** - * Retrieves a collection, creating it if not cached. - * - * Not typically needed by applications. Just talk to your collection through your model. - * - * @param {String} name of the collection - * @param {Object} [options] optional collection options - * @return {Collection} collection instance - * @api public - */ - -Connection.prototype.collection = function(name, options) { - if (!(name in this.collections)) - this.collections[name] = new Collection(name, this, options); - return this.collections[name]; -}; - -/** - * Defines or retrieves a model. - * - * var mongoose = require('mongoose'); - * var db = mongoose.createConnection(..); - * db.model('Venue', new Schema(..)); - * var Ticket = db.model('Ticket', new Schema(..)); - * var Venue = db.model('Venue'); - * - * _When no `collection` argument is passed, Mongoose produces a collection name by passing the model `name` to the [utils.toCollectionName](#utils_exports.toCollectionName) method. This method pluralizes the name. If you don't like this behavior, either pass a collection name or set your schemas collection name option._ - * - * ####Example: - * - * var schema = new Schema({ name: String }, { collection: 'actor' }); - * - * // or - * - * schema.set('collection', 'actor'); - * - * // or - * - * var collectionName = 'actor' - * var M = conn.model('Actor', schema, collectionName) - * - * @param {String} name the model name - * @param {Schema} [schema] a schema. necessary when defining a model - * @param {String} [collection] name of mongodb collection (optional) if not given it will be induced from model name - * @see Mongoose#model #index_Mongoose-model - * @return {Model} The compiled model - * @api public - */ - -Connection.prototype.model = function(name, schema, collection) { - // collection name discovery - if ('string' == typeof schema) { - collection = schema; - schema = false; - } - - if (utils.isObject(schema) && !(schema instanceof Schema)) { - schema = new Schema(schema); - } - - if (this.models[name] && !collection) { - // model exists but we are not subclassing with custom collection - if (schema instanceof Schema && schema != this.models[name].schema) { - throw new MongooseError.OverwriteModelError(name); - } - return this.models[name]; - } - - var opts = { cache: false, connection: this }; - var model; - - if (schema instanceof Schema) { - // compile a model - model = this.base.model(name, schema, collection, opts); - - // only the first model with this name is cached to allow - // for one-offs with custom collection names etc. - if (!this.models[name]) { - this.models[name] = model; - } - - model.init(); - return model; - } - - if (this.models[name] && collection) { - // subclassing current model with alternate collection - model = this.models[name]; - schema = model.prototype.schema; - var sub = model.__subclass(this, schema, collection); - // do not cache the sub model - return sub; - } - - // lookup model in mongoose module - model = this.base.models[name]; - - if (!model) { - throw new MongooseError.MissingSchemaError(name); - } - - if (this == model.prototype.db - && (!collection || collection == model.collection.name)) { - // model already uses this connection. - - // only the first model with this name is cached to allow - // for one-offs with custom collection names etc. - if (!this.models[name]) { - this.models[name] = model; - } - - return model; - } - - return this.models[name] = model.__subclass(this, schema, collection); -}; - -/** - * Returns an array of model names created on this connection. - * @api public - * @return {Array} - */ - -Connection.prototype.modelNames = function() { - return Object.keys(this.models); -}; - -/** - * @brief Returns if the connection requires authentication after it is opened. Generally if a - * username and password are both provided than authentication is needed, but in some cases a - * password is not required. - * @api private - * @return {Boolean} true if the connection should be authenticated after it is opened, otherwise false. - */ -Connection.prototype.shouldAuthenticate = function() { - return (this.user != null) && - ((this.pass != null) || this.authMechanismDoesNotRequirePassword()); -}; - -/** - * @brief Returns a boolean value that specifies if the current authentication mechanism needs a - * password to authenticate according to the auth objects passed into the open/openSet methods. - * @api private - * @return {Boolean} true if the authentication mechanism specified in the options object requires - * a password, otherwise false. - */ -Connection.prototype.authMechanismDoesNotRequirePassword = function() { - if (this.options && this.options.auth) { - return authMechanismsWhichDontRequirePassword.indexOf(this.options.auth.authMechanism) >= 0; - } - return true; -}; - -/** - * @brief Returns a boolean value that specifies if the provided objects object provides enough - * data to authenticate with. Generally this is true if the username and password are both specified - * but in some authentication methods, a password is not required for authentication so only a username - * is required. - * @param {Object} [options] the options object passed into the open/openSet methods. - * @api private - * @return {Boolean} true if the provided options object provides enough data to authenticate with, - * otherwise false. - */ -Connection.prototype.optionsProvideAuthenticationData = function(options) { - return (options != null) && - (options.user != null) && - ((options.pass != null) || this.authMechanismDoesNotRequirePassword()); -}; - -/*! - * Module exports. - */ - -Connection.STATES = STATES; -module.exports = Connection; diff --git a/Associations/node_modules/mongoose/lib/connectionstate.js b/Associations/node_modules/mongoose/lib/connectionstate.js deleted file mode 100644 index b9d1bafa..00000000 --- a/Associations/node_modules/mongoose/lib/connectionstate.js +++ /dev/null @@ -1,27 +0,0 @@ - -/*! - * Connection states - */ - -var STATES = module.exports = exports = Object.create(null); - -var disconnected = 'disconnected'; -var connected = 'connected'; -var connecting = 'connecting'; -var disconnecting = 'disconnecting'; -var unauthorized = 'unauthorized'; -var uninitialized = 'uninitialized'; - -STATES[0] = disconnected; -STATES[1] = connected; -STATES[2] = connecting; -STATES[3] = disconnecting; -STATES[4] = unauthorized; -STATES[99] = uninitialized; - -STATES[disconnected] = 0; -STATES[connected] = 1; -STATES[connecting] = 2; -STATES[disconnecting] = 3; -STATES[unauthorized] = 4; -STATES[uninitialized] = 99; diff --git a/Associations/node_modules/mongoose/lib/document.js b/Associations/node_modules/mongoose/lib/document.js deleted file mode 100644 index 48c96006..00000000 --- a/Associations/node_modules/mongoose/lib/document.js +++ /dev/null @@ -1,2250 +0,0 @@ -/* eslint no-unused-vars: 1 */ - -/*! - * Module dependencies. - */ - -var EventEmitter = require('events').EventEmitter - , MongooseError = require('./error') - , MixedSchema = require('./schema/mixed') - , Schema = require('./schema') - , ValidatorError = require('./schematype').ValidatorError - , utils = require('./utils') - , clone = utils.clone - , isMongooseObject = utils.isMongooseObject - , inspect = require('util').inspect - , ValidationError = MongooseError.ValidationError - , InternalCache = require('./internal') - , deepEqual = utils.deepEqual - , hooks = require('hooks-fixed') - , PromiseProvider = require('./promise_provider') - , DocumentArray - , MongooseArray - , Embedded; - -/** - * Document constructor. - * - * @param {Object} obj the values to set - * @param {Object} [fields] optional object containing the fields which were selected in the query returning this document and any populated paths data - * @param {Boolean} [skipId] bool, should we auto create an ObjectId _id - * @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter - * @event `init`: Emitted on a document after it has was retreived from the db and fully hydrated by Mongoose. - * @event `save`: Emitted when the document is successfully saved - * @api private - */ - -function Document(obj, fields, skipId) { - this.$__ = new InternalCache; - this.$__.emitter = new EventEmitter(); - this.isNew = true; - this.errors = undefined; - - var schema = this.schema; - - if ('boolean' === typeof fields) { - this.$__.strictMode = fields; - fields = undefined; - } else { - this.$__.strictMode = schema.options && schema.options.strict; - this.$__.selected = fields; - } - - var required = schema.requiredPaths(true); - for (var i = 0; i < required.length; ++i) { - this.$__.activePaths.require(required[i]); - } - - this.$__.emitter.setMaxListeners(0); - this._doc = this.$__buildDoc(obj, fields, skipId); - - if (obj) { - this.set(obj, undefined, true); - } - - if (!schema.options.strict && obj) { - var self = this - , keys = Object.keys(this._doc); - - keys.forEach(function(key) { - if (!(key in schema.tree)) { - defineKey(key, null, self); - } - }); - } - - this.$__registerHooksFromSchema(); -} - -/*! - * Document exposes the NodeJS event emitter API, so you can use - * `on`, `once`, etc. - */ -utils.each( - ['on', 'once', 'emit', 'listeners', 'removeListener', 'setMaxListeners', - 'removeAllListeners', 'addListener'], - function(emitterFn) { - Document.prototype[emitterFn] = function() { - return this.$__.emitter[emitterFn].apply(this.$__.emitter, arguments); - }; - }); - -Document.prototype.constructor = Document; - -/** - * The documents schema. - * - * @api public - * @property schema - */ - -Document.prototype.schema; - -/** - * Boolean flag specifying if the document is new. - * - * @api public - * @property isNew - */ - -Document.prototype.isNew; - -/** - * The string version of this documents _id. - * - * ####Note: - * - * This getter exists on all documents by default. The getter can be disabled by setting the `id` [option](/docs/guide.html#id) of its `Schema` to false at construction time. - * - * new Schema({ name: String }, { id: false }); - * - * @api public - * @see Schema options /docs/guide.html#options - * @property id - */ - -Document.prototype.id; - -/** - * Hash containing current validation errors. - * - * @api public - * @property errors - */ - -Document.prototype.errors; - -/** - * Builds the default doc structure - * - * @param {Object} obj - * @param {Object} [fields] - * @param {Boolean} [skipId] - * @return {Object} - * @api private - * @method $__buildDoc - * @memberOf Document - */ - -Document.prototype.$__buildDoc = function(obj, fields, skipId) { - var doc = {}; - var exclude = null; - var keys; - var ki; - var self = this; - - // determine if this doc is a result of a query with - // excluded fields - if (fields && 'Object' === utils.getFunctionName(fields.constructor)) { - keys = Object.keys(fields); - ki = keys.length; - - if (ki === 1 && keys[0] === '_id') { - exclude = !!fields[keys[ki]]; - } else { - while (ki--) { - if (keys[ki] !== '_id' && - (!fields[keys[ki]] || typeof fields[keys[ki]] !== 'object')) { - exclude = !fields[keys[ki]]; - break; - } - } - } - } - - var paths = Object.keys(this.schema.paths) - , plen = paths.length - , ii = 0; - - for (; ii < plen; ++ii) { - var p = paths[ii]; - - if ('_id' == p) { - if (skipId) continue; - if (obj && '_id' in obj) continue; - } - - var type = this.schema.paths[p]; - var path = p.split('.'); - var len = path.length; - var last = len - 1; - var curPath = ''; - var doc_ = doc; - var i = 0; - var included = false; - - for (; i < len; ++i) { - var piece = path[i] - , def; - - curPath += piece; - - // support excluding intermediary levels - if (exclude === true) { - if (curPath in fields) break; - } else if (fields && curPath in fields) { - included = true; - } - - if (i === last) { - if (fields && exclude !== null) { - if (exclude === true) { - // apply defaults to all non-excluded fields - if (p in fields) continue; - - def = type.getDefault(self, true); - if ('undefined' !== typeof def) { - doc_[piece] = def; - self.$__.activePaths.default(p); - } - - } else if (included) { - // selected field - def = type.getDefault(self, true); - if ('undefined' !== typeof def) { - doc_[piece] = def; - self.$__.activePaths.default(p); - } - } - } else { - def = type.getDefault(self, true); - if ('undefined' !== typeof def) { - doc_[piece] = def; - self.$__.activePaths.default(p); - } - } - } else { - doc_ = doc_[piece] || (doc_[piece] = {}); - curPath += '.'; - } - } - } - - return doc; -}; - -/** - * Initializes the document without setters or marking anything modified. - * - * Called internally after a document is returned from mongodb. - * - * @param {Object} doc document returned by mongo - * @param {Function} fn callback - * @api private - */ - -Document.prototype.init = function(doc, opts, fn) { - // do not prefix this method with $__ since its - // used by public hooks - - if ('function' == typeof opts) { - fn = opts; - opts = null; - } - - this.isNew = false; - - // handle docs with populated paths - // If doc._id is not null or undefined - if (doc._id != null && opts && opts.populated && opts.populated.length) { - var id = String(doc._id); - for (var i = 0; i < opts.populated.length; ++i) { - var item = opts.populated[i]; - this.populated(item.path, item._docs[id], item); - } - } - - init(this, doc, this._doc); - this.$__storeShard(); - - this.emit('init', this); - if (fn) fn(null); - return this; -}; - -/*! - * Init helper. - * - * @param {Object} self document instance - * @param {Object} obj raw mongodb doc - * @param {Object} doc object we are initializing - * @api private - */ - -function init(self, obj, doc, prefix) { - prefix = prefix || ''; - - var keys = Object.keys(obj) - , len = keys.length - , schema - , path - , i; - - while (len--) { - i = keys[len]; - path = prefix + i; - schema = self.schema.path(path); - - if (!schema && utils.isObject(obj[i]) && - (!obj[i].constructor || 'Object' == utils.getFunctionName(obj[i].constructor))) { - // assume nested object - if (!doc[i]) doc[i] = {}; - init(self, obj[i], doc[i], path + '.'); - } else { - if (obj[i] === null) { - doc[i] = null; - } else if (obj[i] !== undefined) { - if (schema) { - try { - doc[i] = schema.cast(obj[i], self, true); - } catch (e) { - self.invalidate(e.path, new ValidatorError({ - path: e.path, - message: e.message, - type: 'cast', - value: e.value - })); - } - } else { - doc[i] = obj[i]; - } - } - // mark as hydrated - if (!self.isModified(path)) { - self.$__.activePaths.init(path); - } - } - } -} - -/** - * Stores the current values of the shard keys. - * - * ####Note: - * - * _Shard key values do not / are not allowed to change._ - * - * @api private - * @method $__storeShard - * @memberOf Document - */ - -Document.prototype.$__storeShard = function() { - // backwards compat - var key = this.schema.options.shardKey || this.schema.options.shardkey; - if (!(key && 'Object' == utils.getFunctionName(key.constructor))) return; - - var orig = this.$__.shardval = {} - , paths = Object.keys(key) - , len = paths.length - , val; - - for (var i = 0; i < len; ++i) { - val = this.getValue(paths[i]); - if (isMongooseObject(val)) { - orig[paths[i]] = val.toObject({ depopulate: true }); - } else if (null != val && - val.valueOf && - // Explicitly don't take value of dates - (!val.constructor || utils.getFunctionName(val.constructor) !== 'Date')) { - orig[paths[i]] = val.valueOf(); - } else { - orig[paths[i]] = val; - } - } -}; - -/*! - * Set up middleware support - */ - -for (var k in hooks) { - Document.prototype[k] = Document[k] = hooks[k]; -} - -/** - * Sends an update command with this document `_id` as the query selector. - * - * ####Example: - * - * weirdCar.update({$inc: {wheels:1}}, { w: 1 }, callback); - * - * ####Valid options: - * - * - same as in [Model.update](#model_Model.update) - * - * @see Model.update #model_Model.update - * @param {Object} doc - * @param {Object} options - * @param {Function} callback - * @return {Query} - * @api public - */ - -Document.prototype.update = function update() { - var args = utils.args(arguments); - args.unshift({_id: this._id}); - return this.constructor.update.apply(this.constructor, args); -}; - -/** - * Sets the value of a path, or many paths. - * - * ####Example: - * - * // path, value - * doc.set(path, value) - * - * // object - * doc.set({ - * path : value - * , path2 : { - * path : value - * } - * }) - * - * // on-the-fly cast to number - * doc.set(path, value, Number) - * - * // on-the-fly cast to string - * doc.set(path, value, String) - * - * // changing strict mode behavior - * doc.set(path, value, { strict: false }); - * - * @param {String|Object} path path or object of key/vals to set - * @param {Any} val the value to set - * @param {Schema|String|Number|Buffer|etc..} [type] optionally specify a type for "on-the-fly" attributes - * @param {Object} [options] optionally specify options that modify the behavior of the set - * @api public - */ - -Document.prototype.set = function(path, val, type, options) { - if (type && 'Object' == utils.getFunctionName(type.constructor)) { - options = type; - type = undefined; - } - - var merge = options && options.merge - , adhoc = type && true !== type - , constructing = true === type - , adhocs; - - var strict = options && 'strict' in options - ? options.strict - : this.$__.strictMode; - - if (adhoc) { - adhocs = this.$__.adhocPaths || (this.$__.adhocPaths = {}); - adhocs[path] = Schema.interpretAsType(path, type); - } - - if ('string' !== typeof path) { - // new Document({ key: val }) - - if (null === path || undefined === path) { - var _ = path; - path = val; - val = _; - - } else { - var prefix = val - ? val + '.' - : ''; - - if (path instanceof Document) { - if (path.$__isNested) { - path = path.toObject(); - } else { - path = path._doc; - } - } - - var keys = Object.keys(path) - , i = keys.length - , pathtype - , key; - - while (i--) { - key = keys[i]; - var pathName = prefix + key; - pathtype = this.schema.pathType(pathName); - - if (null != path[key] - // need to know if plain object - no Buffer, ObjectId, ref, etc - && utils.isObject(path[key]) - && (!path[key].constructor || 'Object' == utils.getFunctionName(path[key].constructor)) - && 'virtual' !== pathtype - && 'real' !== pathtype - && !(this.$__path(pathName) instanceof MixedSchema) - && !(this.schema.paths[pathName] && - this.schema.paths[pathName].options && - this.schema.paths[pathName].options.ref)) { - this.set(path[key], prefix + key, constructing); - } else if (strict) { - if ('real' === pathtype || 'virtual' === pathtype) { - this.set(prefix + key, path[key], constructing); - } else if (pathtype === 'nested' && path[key] instanceof Document) { - this.set(prefix + key, - path[key].toObject({ virtuals: false }), constructing); - } else if ('throw' == strict) { - throw new Error('Field `' + key + '` is not in schema.'); - } - } else if (undefined !== path[key]) { - this.set(prefix + key, path[key], constructing); - } - } - - return this; - } - } - - // ensure _strict is honored for obj props - // docschema = new Schema({ path: { nest: 'string' }}) - // doc.set('path', obj); - var pathType = this.schema.pathType(path); - if ('nested' == pathType && val) { - if (utils.isObject(val) && - (!val.constructor || 'Object' == utils.getFunctionName(val.constructor))) { - if (!merge) this.setValue(path, null); - this.set(val, path, constructing); - return this; - } - this.invalidate(path, new MongooseError.CastError('Object', val, path)); - return this; - } - - var schema; - var parts = path.split('.'); - - if ('adhocOrUndefined' == pathType && strict) { - - // check for roots that are Mixed types - var mixed; - - for (i = 0; i < parts.length; ++i) { - var subpath = parts.slice(0, i + 1).join('.'); - schema = this.schema.path(subpath); - if (schema instanceof MixedSchema) { - // allow changes to sub paths of mixed types - mixed = true; - break; - } - } - - if (!mixed) { - if ('throw' == strict) { - throw new Error("Field `" + path + "` is not in schema."); - } - return this; - } - - } else if ('virtual' == pathType) { - schema = this.schema.virtualpath(path); - schema.applySetters(val, this); - return this; - } else { - schema = this.$__path(path); - } - - var pathToMark; - - // When using the $set operator the path to the field must already exist. - // Else mongodb throws: "LEFT_SUBFIELD only supports Object" - - if (parts.length <= 1) { - pathToMark = path; - } else { - for (i = 0; i < parts.length; ++i) { - subpath = parts.slice(0, i + 1).join('.'); - if (this.isDirectModified(subpath) // earlier prefixes that are already - // marked as dirty have precedence - || this.get(subpath) === null) { - pathToMark = subpath; - break; - } - } - - if (!pathToMark) pathToMark = path; - } - - // if this doc is being constructed we should not trigger getters - var priorVal = constructing - ? undefined - : this.getValue(path); - - if (!schema) { - this.$__set(pathToMark, path, constructing, parts, schema, val, priorVal); - return this; - } - - var shouldSet = true; - try { - // If the user is trying to set a ref path to a document with - // the correct model name, treat it as populated - var didPopulate = false; - if (schema.options && - schema.options.ref && - val instanceof Document && - schema.options.ref === val.constructor.modelName) { - this.populated(path, val._id); - didPopulate = true; - } - val = schema.applySetters(val, this, false, priorVal); - - if (!didPopulate && this.$__.populated) { - delete this.$__.populated[path]; - } - - this.$markValid(path); - } catch (e) { - var reason; - if (!(e instanceof MongooseError.CastError)) { - reason = e; - } - this.invalidate(path, - new MongooseError.CastError(schema.instance, val, path, reason)); - shouldSet = false; - } - - if (shouldSet) { - this.$__set(pathToMark, path, constructing, parts, schema, val, priorVal); - } - - return this; -}; - -/** - * Determine if we should mark this change as modified. - * - * @return {Boolean} - * @api private - * @method $__shouldModify - * @memberOf Document - */ - -Document.prototype.$__shouldModify = function( - pathToMark, path, constructing, parts, schema, val, priorVal) { - - if (this.isNew) return true; - - if (undefined === val && !this.isSelected(path)) { - // when a path is not selected in a query, its initial - // value will be undefined. - return true; - } - - if (undefined === val && path in this.$__.activePaths.states.default) { - // we're just unsetting the default value which was never saved - return false; - } - - if (!deepEqual(val, priorVal || this.get(path))) { - return true; - } - - if (!constructing && - null != val && - path in this.$__.activePaths.states.default && - deepEqual(val, schema.getDefault(this, constructing))) { - // a path with a default was $unset on the server - // and the user is setting it to the same value again - return true; - } - return false; -}; - -/** - * Handles the actual setting of the value and marking the path modified if appropriate. - * - * @api private - * @method $__set - * @memberOf Document - */ - -Document.prototype.$__set = function( - pathToMark, path, constructing, parts, schema, val, priorVal) { - Embedded = Embedded || require('./types/embedded'); - - var shouldModify = this.$__shouldModify.apply(this, arguments); - var _this = this; - - if (shouldModify) { - this.markModified(pathToMark, val); - - // handle directly setting arrays (gh-1126) - MongooseArray || (MongooseArray = require('./types/array')); - if (val && val.isMongooseArray) { - val._registerAtomic('$set', val); - - // Small hack for gh-1638: if we're overwriting the entire array, ignore - // paths that were modified before the array overwrite - this.$__.activePaths.forEach(function(modifiedPath) { - if (modifiedPath.indexOf(path + '.') === 0) { - _this.$__.activePaths.ignore(modifiedPath); - } - }); - } - } - - var obj = this._doc - , i = 0 - , l = parts.length; - - for (; i < l; i++) { - var next = i + 1 - , last = next === l; - - if (last) { - obj[parts[i]] = val; - } else { - if (obj[parts[i]] && 'Object' === utils.getFunctionName(obj[parts[i]].constructor)) { - obj = obj[parts[i]]; - } else if (obj[parts[i]] && obj[parts[i]] instanceof Embedded) { - obj = obj[parts[i]]; - } else if (obj[parts[i]] && Array.isArray(obj[parts[i]])) { - obj = obj[parts[i]]; - } else { - obj = obj[parts[i]] = {}; - } - } - } -}; - -/** - * Gets a raw value from a path (no getters) - * - * @param {String} path - * @api private - */ - -Document.prototype.getValue = function(path) { - return utils.getValue(path, this._doc); -}; - -/** - * Sets a raw value for a path (no casting, setters, transformations) - * - * @param {String} path - * @param {Object} value - * @api private - */ - -Document.prototype.setValue = function(path, val) { - utils.setValue(path, val, this._doc); - return this; -}; - -/** - * Returns the value of a path. - * - * ####Example - * - * // path - * doc.get('age') // 47 - * - * // dynamic casting to a string - * doc.get('age', String) // "47" - * - * @param {String} path - * @param {Schema|String|Number|Buffer|etc..} [type] optionally specify a type for on-the-fly attributes - * @api public - */ - -Document.prototype.get = function(path, type) { - var adhoc; - if (type) { - adhoc = Schema.interpretAsType(path, type); - } - - var schema = this.$__path(path) || this.schema.virtualpath(path) - , pieces = path.split('.') - , obj = this._doc; - - for (var i = 0, l = pieces.length; i < l; i++) { - obj = undefined === obj || null === obj - ? undefined - : obj[pieces[i]]; - } - - if (adhoc) { - obj = adhoc.cast(obj); - } - - // Check if this path is populated - don't apply getters if it is, - // because otherwise its a nested object. See gh-3357 - if (schema && !this.populated(path)) { - obj = schema.applyGetters(obj, this); - } - - return obj; -}; - -/** - * Returns the schematype for the given `path`. - * - * @param {String} path - * @api private - * @method $__path - * @memberOf Document - */ - -Document.prototype.$__path = function(path) { - var adhocs = this.$__.adhocPaths - , adhocType = adhocs && adhocs[path]; - - if (adhocType) { - return adhocType; - } else { - return this.schema.path(path); - } -}; - -/** - * Marks the path as having pending changes to write to the db. - * - * _Very helpful when using [Mixed](./schematypes.html#mixed) types._ - * - * ####Example: - * - * doc.mixed.type = 'changed'; - * doc.markModified('mixed.type'); - * doc.save() // changes to mixed.type are now persisted - * - * @param {String} path the path to mark modified - * @api public - */ - -Document.prototype.markModified = function(path) { - this.$__.activePaths.modify(path); -}; - -/** - * Returns the list of paths that have been modified. - * - * @return {Array} - * @api public - */ - -Document.prototype.modifiedPaths = function() { - var directModifiedPaths = Object.keys(this.$__.activePaths.states.modify); - - return directModifiedPaths.reduce(function(list, path) { - var parts = path.split('.'); - return list.concat(parts.reduce(function(chains, part, i) { - return chains.concat(parts.slice(0, i).concat(part).join('.')); - }, [])); - }, []); -}; - -/** - * Returns true if this document was modified, else false. - * - * If `path` is given, checks if a path or any full path containing `path` as part of its path chain has been modified. - * - * ####Example - * - * doc.set('documents.0.title', 'changed'); - * doc.isModified() // true - * doc.isModified('documents') // true - * doc.isModified('documents.0.title') // true - * doc.isDirectModified('documents') // false - * - * @param {String} [path] optional - * @return {Boolean} - * @api public - */ - -Document.prototype.isModified = function(path) { - return path - ? !!~this.modifiedPaths().indexOf(path) - : this.$__.activePaths.some('modify'); -}; - -/** - * Checks if a path is set to its default. - * - * ####Example - * - * MyModel = mongoose.model('test', { name: { type: String, default: 'Val '} }); - * var m = new MyModel(); - * m.$isDefault('name'); // true - * - * @param {String} [path] - * @return {Boolean} - * @method $isDefault - * @api public - */ - -Document.prototype.$isDefault = function(path) { - return (path in this.$__.activePaths.states.default); -}; - -/** - * Returns true if `path` was directly set and modified, else false. - * - * ####Example - * - * doc.set('documents.0.title', 'changed'); - * doc.isDirectModified('documents.0.title') // true - * doc.isDirectModified('documents') // false - * - * @param {String} path - * @return {Boolean} - * @api public - */ - -Document.prototype.isDirectModified = function(path) { - return (path in this.$__.activePaths.states.modify); -}; - -/** - * Checks if `path` was initialized. - * - * @param {String} path - * @return {Boolean} - * @api public - */ - -Document.prototype.isInit = function(path) { - return (path in this.$__.activePaths.states.init); -}; - -/** - * Checks if `path` was selected in the source query which initialized this document. - * - * ####Example - * - * Thing.findOne().select('name').exec(function (err, doc) { - * doc.isSelected('name') // true - * doc.isSelected('age') // false - * }) - * - * @param {String} path - * @return {Boolean} - * @api public - */ - -Document.prototype.isSelected = function isSelected(path) { - if (this.$__.selected) { - - if ('_id' === path) { - return 0 !== this.$__.selected._id; - } - - var paths = Object.keys(this.$__.selected) - , i = paths.length - , inclusive = false - , cur; - - if (1 === i && '_id' === paths[0]) { - // only _id was selected. - return 0 === this.$__.selected._id; - } - - while (i--) { - cur = paths[i]; - if ('_id' == cur) continue; - inclusive = !! this.$__.selected[cur]; - break; - } - - if (path in this.$__.selected) { - return inclusive; - } - - i = paths.length; - var pathDot = path + '.'; - - while (i--) { - cur = paths[i]; - if ('_id' == cur) continue; - - if (0 === cur.indexOf(pathDot)) { - return inclusive; - } - - if (0 === pathDot.indexOf(cur + '.')) { - return inclusive; - } - } - - return ! inclusive; - } - - return true; -}; - -/** - * Executes registered validation rules for this document. - * - * ####Note: - * - * This method is called `pre` save and if a validation rule is violated, [save](#model_Model-save) is aborted and the error is returned to your `callback`. - * - * ####Example: - * - * doc.validate(function (err) { - * if (err) handleError(err); - * else // validation passed - * }); - * - * @param {Object} optional options internal options - * @param {Function} optional callback called after validation completes, passing an error if one occurred - * @return {Promise} Promise - * @api public - */ - -Document.prototype.validate = function(options, callback) { - var _this = this; - var Promise = PromiseProvider.get(); - if (typeof options === 'function') { - callback = options; - options = null; - } - - if (options && options.__noPromise) { - this.$__validate(callback); - return; - } - - return new Promise.ES6(function(resolve, reject) { - _this.$__validate(function(error) { - callback && callback(error); - if (error) { - reject(error); - return; - } - resolve(); - }); - }); -}; - -/*! - * ignore - */ - -Document.prototype.$__validate = function(callback) { - var self = this; - var _complete = function() { - var err = self.$__.validationError; - self.$__.validationError = undefined; - self.emit('validate', self); - if (err) { - for (var key in err.errors) { - // Make sure cast errors persist - if (!self.__parent && err.errors[key] instanceof MongooseError.CastError) { - self.invalidate(key, err.errors[key]); - } - } - - return err; - } else { - return; - } - }; - - // only validate required fields when necessary - var paths = Object.keys(this.$__.activePaths.states.require).filter(function(path) { - if (!self.isSelected(path) && !self.isModified(path)) return false; - return true; - }); - - paths = paths.concat(Object.keys(this.$__.activePaths.states.init)); - paths = paths.concat(Object.keys(this.$__.activePaths.states.modify)); - paths = paths.concat(Object.keys(this.$__.activePaths.states.default)); - - if (0 === paths.length) { - process.nextTick(function() { - var err = _complete(); - if (err) { - callback(err); - return; - } - callback(); - }); - } - - var validating = {} - , total = 0; - - // gh-661: if a whole array is modified, make sure to run validation on all - // the children as well - for (var i = 0; i < paths.length; ++i) { - var path = paths[i]; - var val = self.getValue(path); - if (val && val.isMongooseArray && !Buffer.isBuffer(val) && - !val.isMongooseDocumentArray) { - var numElements = val.length; - for (var j = 0; j < numElements; ++j) { - paths.push(path + '.' + j); - } - } - } - - var complete = function() { - var err = _complete(); - if (err) { - callback(err); - return; - } - callback(); - }; - - var validatePath = function(path) { - if (validating[path]) return; - - validating[path] = true; - total++; - - process.nextTick(function() { - var p = self.schema.path(path); - if (!p) { - return --total || complete(); - } - - // If user marked as invalid or there was a cast error, don't validate - if (!self.$isValid(path)) { - --total || complete(); - return; - } - - var val = self.getValue(path); - p.doValidate(val, function(err) { - if (err) { - self.invalidate(path, err, undefined, true); - } - --total || complete(); - }, self); - }); - }; - - paths.forEach(validatePath); -}; - -/** - * Executes registered validation rules (skipping asynchronous validators) for this document. - * - * ####Note: - * - * This method is useful if you need synchronous validation. - * - * ####Example: - * - * var err = doc.validateSync(); - * if ( err ){ - * handleError( err ); - * } else { - * // validation passed - * } - * - * @param {Array|string} pathsToValidate only validate the given paths - * @return {MongooseError|undefined} MongooseError if there are errors during validation, or undefined if there is no error. - * @api public - */ - -Document.prototype.validateSync = function(pathsToValidate) { - var self = this; - - if (typeof pathsToValidate === 'string') { - pathsToValidate = pathsToValidate.split(' '); - } - - // only validate required fields when necessary - var paths = Object.keys(this.$__.activePaths.states.require).filter(function(path) { - if (!self.isSelected(path) && !self.isModified(path)) return false; - return true; - }); - - paths = paths.concat(Object.keys(this.$__.activePaths.states.init)); - paths = paths.concat(Object.keys(this.$__.activePaths.states.modify)); - paths = paths.concat(Object.keys(this.$__.activePaths.states.default)); - - if (pathsToValidate && pathsToValidate.length) { - var tmp = []; - for (var i = 0; i < paths.length; ++i) { - if (pathsToValidate.indexOf(paths[i]) !== -1) { - tmp.push(paths[i]); - } - } - paths = tmp; - } - - var validating = {}; - - paths.forEach(function(path) { - if (validating[path]) return; - - validating[path] = true; - - var p = self.schema.path(path); - if (!p) return; - if (!self.$isValid(path)) { - return; - } - - var val = self.getValue(path); - var err = p.doValidateSync(val, self); - if (err) { - self.invalidate(path, err, undefined, true); - } - }); - - var err = self.$__.validationError; - self.$__.validationError = undefined; - self.emit('validate', self); - - if (err) { - for (var key in err.errors) { - // Make sure cast errors persist - if (err.errors[key] instanceof MongooseError.CastError) { - self.invalidate(key, err.errors[key]); - } - } - } - - return err; -}; - -/** - * Marks a path as invalid, causing validation to fail. - * - * The `errorMsg` argument will become the message of the `ValidationError`. - * - * The `value` argument (if passed) will be available through the `ValidationError.value` property. - * - * doc.invalidate('size', 'must be less than 20', 14); - - * doc.validate(function (err) { - * console.log(err) - * // prints - * { message: 'Validation failed', - * name: 'ValidationError', - * errors: - * { size: - * { message: 'must be less than 20', - * name: 'ValidatorError', - * path: 'size', - * type: 'user defined', - * value: 14 } } } - * }) - * - * @param {String} path the field to invalidate - * @param {String|Error} errorMsg the error which states the reason `path` was invalid - * @param {Object|String|Number|any} value optional invalid value - * @api public - */ - -Document.prototype.invalidate = function(path, err, val) { - if (!this.$__.validationError) { - this.$__.validationError = new ValidationError(this); - } - - if (this.$__.validationError.errors[path]) return; - - if (!err || 'string' === typeof err) { - err = new ValidatorError({ - path: path, - message: err, - type: 'user defined', - value: val - }); - } - - if (this.$__.validationError == err) return; - - this.$__.validationError.errors[path] = err; -}; - -/** - * Marks a path as valid, removing existing validation errors. - * - * @param {String} path the field to mark as valid - * @api private - * @method $markValid - * @receiver Document - */ - -Document.prototype.$markValid = function(path) { - if (!this.$__.validationError || !this.$__.validationError.errors[path]) { - return; - } - - delete this.$__.validationError.errors[path]; - if (Object.keys(this.$__.validationError.errors).length === 0) { - this.$__.validationError = null; - } -}; - -/** - * Checks if a path is invalid - * - * @param {String} path the field to check - * @method $isValid - * @api private - * @receiver Document - */ - -Document.prototype.$isValid = function(path) { - return !this.$__.validationError || !this.$__.validationError.errors[path]; -}; - -/** - * Resets the internal modified state of this document. - * - * @api private - * @return {Document} - * @method $__reset - * @memberOf Document - */ - -Document.prototype.$__reset = function reset() { - var self = this; - DocumentArray || (DocumentArray = require('./types/documentarray')); - - this.$__.activePaths - .map('init', 'modify', function(i) { - return self.getValue(i); - }) - .filter(function(val) { - return val && val instanceof Array && val.isMongooseDocumentArray && val.length; - }) - .forEach(function(array) { - var i = array.length; - while (i--) { - var doc = array[i]; - if (!doc) continue; - doc.$__reset(); - } - }); - - // clear atomics - this.$__dirty().forEach(function(dirt) { - var type = dirt.value; - if (type && type._atomics) { - type._atomics = {}; - } - }); - - // Clear 'dirty' cache - this.$__.activePaths.clear('modify'); - this.$__.activePaths.clear('default'); - this.$__.validationError = undefined; - this.errors = undefined; - self = this; - this.schema.requiredPaths().forEach(function(path) { - self.$__.activePaths.require(path); - }); - - return this; -}; - -/** - * Returns this documents dirty paths / vals. - * - * @api private - * @method $__dirty - * @memberOf Document - */ - -Document.prototype.$__dirty = function() { - var self = this; - - var all = this.$__.activePaths.map('modify', function(path) { - return { - path: path, - value: self.getValue(path), - schema: self.$__path(path) - }; - }); - - // gh-2558: if we had to set a default and the value is not undefined, - // we have to save as well - all = all.concat(this.$__.activePaths.map('default', function(path) { - if (path === '_id' || !self.getValue(path)) { - return; - } - return { - path: path, - value: self.getValue(path), - schema: self.$__path(path) - }; - })); - - // Sort dirty paths in a flat hierarchy. - all.sort(function(a, b) { - return (a.path < b.path ? -1 : (a.path > b.path ? 1 : 0)); - }); - - // Ignore "foo.a" if "foo" is dirty already. - var minimal = [] - , lastPath - , top; - - all.forEach(function(item, i) { - if (!item) { - return; - } - if (item.path.indexOf(lastPath) !== 0) { - lastPath = item.path + '.'; - minimal.push(item); - top = item; - } else { - // special case for top level MongooseArrays - if (top.value && top.value._atomics && top.value.hasAtomics()) { - // the `top` array itself and a sub path of `top` are being modified. - // the only way to honor all of both modifications is through a $set - // of entire array. - top.value._atomics = {}; - top.value._atomics.$set = top.value; - } - } - }); - - top = lastPath = null; - return minimal; -}; - -/*! - * Compiles schemas. - */ - -function compile(tree, proto, prefix) { - var keys = Object.keys(tree) - , i = keys.length - , limb - , key; - - while (i--) { - key = keys[i]; - limb = tree[key]; - - defineKey(key - , (('Object' === utils.getFunctionName(limb.constructor) - && Object.keys(limb).length) - && (!limb.type || limb.type.type) - ? limb - : null) - , proto - , prefix - , keys); - } -} - -// gets descriptors for all properties of `object` -// makes all properties non-enumerable to match previous behavior to #2211 -function getOwnPropertyDescriptors(object) { - var result = {}; - - Object.getOwnPropertyNames(object).forEach(function(key) { - result[key] = Object.getOwnPropertyDescriptor(object, key); - result[key].enumerable = true; - }); - - return result; -} - -/*! - * Defines the accessor named prop on the incoming prototype. - */ - -function defineKey(prop, subprops, prototype, prefix, keys) { - var path = (prefix ? prefix + '.' : '') + prop; - prefix = prefix || ''; - - if (subprops) { - - Object.defineProperty(prototype, prop, { - enumerable: true - , configurable: true - , get: function() { - var _self = this; - if (!this.$__.getters) - this.$__.getters = {}; - - if (!this.$__.getters[path]) { - var nested = Object.create(Object.getPrototypeOf(this), getOwnPropertyDescriptors(this)); - - // save scope for nested getters/setters - if (!prefix) nested.$__.scope = this; - - // shadow inherited getters from sub-objects so - // thing.nested.nested.nested... doesn't occur (gh-366) - var i = 0 - , len = keys.length; - - for (; i < len; ++i) { - // over-write the parents getter without triggering it - Object.defineProperty(nested, keys[i], { - enumerable: false // It doesn't show up. - , writable: true // We can set it later. - , configurable: true // We can Object.defineProperty again. - , value: undefined // It shadows its parent. - }); - } - - nested.toObject = function() { - return _self.get(path); - }; - - nested.toJSON = nested.toObject; - - nested.$__isNested = true; - - compile(subprops, nested, path); - this.$__.getters[path] = nested; - } - - return this.$__.getters[path]; - } - , set: function(v) { - if (v instanceof Document) v = v.toObject(); - return (this.$__.scope || this).set(path, v); - } - }); - - } else { - Object.defineProperty(prototype, prop, { - enumerable: true - , configurable: true - , get: function( ) { return this.get.call(this.$__.scope || this, path); } - , set: function(v) { return this.set.call(this.$__.scope || this, path, v); } - }); - } -} - -/** - * Assigns/compiles `schema` into this documents prototype. - * - * @param {Schema} schema - * @api private - * @method $__setSchema - * @memberOf Document - */ - -Document.prototype.$__setSchema = function(schema) { - compile(schema.tree, this); - this.schema = schema; -}; - - -/** - * Get active path that were changed and are arrays - * - * @api private - * @method $__getArrayPathsToValidate - * @memberOf Document - */ - -Document.prototype.$__getArrayPathsToValidate = function() { - DocumentArray || (DocumentArray = require('./types/documentarray')); - - // validate all document arrays. - return this.$__.activePaths - .map('init', 'modify', function(i) { - return this.getValue(i); - }.bind(this)) - .filter(function(val) { - return val && val instanceof Array && val.isMongooseDocumentArray && val.length; - }).reduce(function(seed, array) { - return seed.concat(array); - }, []) - .filter(function(doc) { return doc;}); -}; - - -/** - * Get all subdocs (by bfs) - * - * @api private - * @method $__getAllSubdocs - * @memberOf Document - */ - -Document.prototype.$__getAllSubdocs = function() { - DocumentArray || (DocumentArray = require('./types/documentarray')); - Embedded = Embedded || require('./types/embedded'); - - function docReducer(seed, path) { - var val = this[path]; - if (val instanceof Embedded) seed.push(val); - if (val && val.isMongooseDocumentArray) { - val.forEach(function _docReduce(doc) { - if (!doc || !doc._doc) return; - if (doc instanceof Embedded) seed.push(doc); - seed = Object.keys(doc._doc).reduce(docReducer.bind(doc._doc), seed); - }); - } else if (val instanceof Document && val.$__isNested) { - val = val.toObject(); - if (val) { - seed = Object.keys(val).reduce(docReducer.bind(val), seed); - } - } - return seed; - } - - var subDocs = Object.keys(this._doc).reduce(docReducer.bind(this), []); - - return subDocs; -}; - -/** - * Executes methods queued from the Schema definition - * - * @api private - * @method $__registerHooksFromSchema - * @memberOf Document - */ - -Document.prototype.$__registerHooksFromSchema = function() { - Embedded = Embedded || require('./types/embedded'); - var Promise = PromiseProvider.get(); - - var self = this; - var q = self.schema && self.schema.callQueue; - if (!q.length) return self; - - // we are only interested in 'pre' hooks, and group by point-cut - var toWrap = q.reduce(function(seed, pair) { - if (pair[0] !== 'pre' && pair[0] !== 'post' && pair[0] !== 'on') { - self[pair[0]].apply(self, pair[1]); - return seed; - } - var args = [].slice.call(pair[1]); - var pointCut = pair[0] === 'on' ? 'post' : args[0]; - if (!(pointCut in seed)) seed[pointCut] = { post: [], pre: [] }; - if (pair[0] === 'post') { - seed[pointCut].post.push(args); - } else if (pair[0] === 'on') { - seed[pointCut].push(args); - } else { - seed[pointCut].pre.push(args); - } - return seed; - }, {post: []}); - - // 'post' hooks are simpler - toWrap.post.forEach(function(args) { - self.on.apply(self, args); - }); - delete toWrap.post; - - // 'init' should be synchronous on subdocuments - if (toWrap.init && self instanceof Embedded) { - if (toWrap.init.pre) { - toWrap.init.pre.forEach(function(args) { - self.pre.apply(self, args); - }); - } - if (toWrap.init.post) { - toWrap.init.post.forEach(function(args) { - self.post.apply(self, args); - }); - } - delete toWrap.init; - } - - Object.keys(toWrap).forEach(function(pointCut) { - // this is so we can wrap everything into a promise; - var newName = ('$__original_' + pointCut); - if (!self[pointCut]) { - return; - } - self[newName] = self[pointCut]; - self[pointCut] = function wrappedPointCut() { - var args = [].slice.call(arguments); - var lastArg = args.pop(); - var fn; - - return new Promise.ES6(function(resolve, reject) { - if (lastArg && typeof lastArg !== 'function') { - args.push(lastArg); - } else { - fn = lastArg; - } - args.push(function(error, result) { - if (error) { - self.$__handleReject(error); - fn && fn(error); - reject(error); - return; - } - - fn && fn.apply(null, [null].concat(Array.prototype.slice.call(arguments, 1))); - resolve(result); - }); - - self[newName].apply(self, args); - }); - }; - - toWrap[pointCut].pre.forEach(function(args) { - args[0] = newName; - self.pre.apply(self, args); - }); - toWrap[pointCut].post.forEach(function(args) { - args[0] = newName; - self.post.apply(self, args); - }); - }); - return self; -}; - -Document.prototype.$__handleReject = function handleReject(err) { - // emit on the Model if listening - if (this.listeners('error').length) { - this.emit('error', err); - } else if (this.constructor.listeners && this.constructor.listeners('error').length) { - this.constructor.emit('error', err); - } else if (this.listeners && this.listeners('error').length) { - this.emit('error', err); - } -}; - -/** - * Internal helper for toObject() and toJSON() that doesn't manipulate options - * - * @api private - * @method $toObject - * @memberOf Document - */ - -Document.prototype.$toObject = function(options, json) { - var defaultOptions = { transform: true, json: json }; - - if (options && options.depopulate && !options._skipDepopulateTopLevel && this.$__.wasPopulated) { - // populated paths that we set to a document - return clone(this._id, options); - } - - // If we're calling toObject on a populated doc, we may want to skip - // depopulated on the top level - if (options && options._skipDepopulateTopLevel) { - options._skipDepopulateTopLevel = false; - } - - // When internally saving this document we always pass options, - // bypassing the custom schema options. - if (!(options && 'Object' == utils.getFunctionName(options.constructor)) || - (options && options._useSchemaOptions)) { - if (json) { - options = this.schema.options.toJSON ? - clone(this.schema.options.toJSON) : - {}; - options.json = true; - options._useSchemaOptions = true; - } else { - options = this.schema.options.toObject ? - clone(this.schema.options.toObject) : - {}; - options.json = false; - options._useSchemaOptions = true; - } - } - - for (var key in defaultOptions) { - if (options[key] === undefined) { - options[key] = defaultOptions[key]; - } - } - - ('minimize' in options) || (options.minimize = this.schema.options.minimize); - - // remember the root transform function - // to save it from being overwritten by sub-transform functions - var originalTransform = options.transform; - - var ret = clone(this._doc, options) || {}; - - if (options.virtuals || options.getters && false !== options.virtuals) { - applyGetters(this, ret, 'virtuals', options); - } - - if (options.getters) { - applyGetters(this, ret, 'paths', options); - // applyGetters for paths will add nested empty objects; - // if minimize is set, we need to remove them. - if (options.minimize) { - ret = minimize(ret) || {}; - } - } - - if (options.versionKey === false && this.schema.options.versionKey) { - delete ret[this.schema.options.versionKey]; - } - - var transform = options.transform; - - // In the case where a subdocument has its own transform function, we need to - // check and see if the parent has a transform (options.transform) and if the - // child schema has a transform (this.schema.options.toObject) In this case, - // we need to adjust options.transform to be the child schema's transform and - // not the parent schema's - if (true === transform || - (this.schema.options.toObject && transform)) { - - var opts = options.json ? this.schema.options.toJSON : this.schema.options.toObject; - - if (opts) { - transform = (typeof options.transform === 'function' ? options.transform : opts.transform); - } - } else { - options.transform = originalTransform; - } - - if ('function' == typeof transform) { - var xformed = transform(this, ret, options); - if ('undefined' != typeof xformed) ret = xformed; - } - - return ret; -}; - -/** - * Converts this document into a plain javascript object, ready for storage in MongoDB. - * - * Buffers are converted to instances of [mongodb.Binary](http://mongodb.github.com/node-mongodb-native/api-bson-generated/binary.html) for proper storage. - * - * ####Options: - * - * - `getters` apply all getters (path and virtual getters) - * - `virtuals` apply virtual getters (can override `getters` option) - * - `minimize` remove empty objects (defaults to true) - * - `transform` a transform function to apply to the resulting document before returning - * - `depopulate` depopulate any populated paths, replacing them with their original refs (defaults to false) - * - `versionKey` whether to include the version key (defaults to true) - * - `retainKeyOrder` keep the order of object keys. If this is set to true, `Object.keys(new Doc({ a: 1, b: 2}).toObject())` will always produce `['a', 'b']` (defaults to false) - * - * ####Getters/Virtuals - * - * Example of only applying path getters - * - * doc.toObject({ getters: true, virtuals: false }) - * - * Example of only applying virtual getters - * - * doc.toObject({ virtuals: true }) - * - * Example of applying both path and virtual getters - * - * doc.toObject({ getters: true }) - * - * To apply these options to every document of your schema by default, set your [schemas](#schema_Schema) `toObject` option to the same argument. - * - * schema.set('toObject', { virtuals: true }) - * - * ####Transform - * - * We may need to perform a transformation of the resulting object based on some criteria, say to remove some sensitive information or return a custom object. In this case we set the optional `transform` function. - * - * Transform functions receive three arguments - * - * function (doc, ret, options) {} - * - * - `doc` The mongoose document which is being converted - * - `ret` The plain object representation which has been converted - * - `options` The options in use (either schema options or the options passed inline) - * - * ####Example - * - * // specify the transform schema option - * if (!schema.options.toObject) schema.options.toObject = {}; - * schema.options.toObject.transform = function (doc, ret, options) { - * // remove the _id of every document before returning the result - * delete ret._id; - * } - * - * // without the transformation in the schema - * doc.toObject(); // { _id: 'anId', name: 'Wreck-it Ralph' } - * - * // with the transformation - * doc.toObject(); // { name: 'Wreck-it Ralph' } - * - * With transformations we can do a lot more than remove properties. We can even return completely new customized objects: - * - * if (!schema.options.toObject) schema.options.toObject = {}; - * schema.options.toObject.transform = function (doc, ret, options) { - * return { movie: ret.name } - * } - * - * // without the transformation in the schema - * doc.toObject(); // { _id: 'anId', name: 'Wreck-it Ralph' } - * - * // with the transformation - * doc.toObject(); // { movie: 'Wreck-it Ralph' } - * - * _Note: if a transform function returns `undefined`, the return value will be ignored._ - * - * Transformations may also be applied inline, overridding any transform set in the options: - * - * function xform (doc, ret, options) { - * return { inline: ret.name, custom: true } - * } - * - * // pass the transform as an inline option - * doc.toObject({ transform: xform }); // { inline: 'Wreck-it Ralph', custom: true } - * - * _Note: if you call `toObject` and pass any options, the transform declared in your schema options will __not__ be applied. To force its application pass `transform: true`_ - * - * if (!schema.options.toObject) schema.options.toObject = {}; - * schema.options.toObject.hide = '_id'; - * schema.options.toObject.transform = function (doc, ret, options) { - * if (options.hide) { - * options.hide.split(' ').forEach(function (prop) { - * delete ret[prop]; - * }); - * } - * } - * - * var doc = new Doc({ _id: 'anId', secret: 47, name: 'Wreck-it Ralph' }); - * doc.toObject(); // { secret: 47, name: 'Wreck-it Ralph' } - * doc.toObject({ hide: 'secret _id' }); // { _id: 'anId', secret: 47, name: 'Wreck-it Ralph' } - * doc.toObject({ hide: 'secret _id', transform: true }); // { name: 'Wreck-it Ralph' } - * - * Transforms are applied _only to the document and are not applied to sub-documents_. - * - * Transforms, like all of these options, are also available for `toJSON`. - * - * See [schema options](/docs/guide.html#toObject) for some more details. - * - * _During save, no custom options are applied to the document before being sent to the database._ - * - * @param {Object} [options] - * @return {Object} js object - * @see mongodb.Binary http://mongodb.github.com/node-mongodb-native/api-bson-generated/binary.html - * @api public - */ - -Document.prototype.toObject = function(options) { - return this.$toObject(options); -}; - -/*! - * Minimizes an object, removing undefined values and empty objects - * - * @param {Object} object to minimize - * @return {Object} - */ - -function minimize(obj) { - var keys = Object.keys(obj) - , i = keys.length - , hasKeys - , key - , val; - - while (i--) { - key = keys[i]; - val = obj[key]; - - if (utils.isObject(val)) { - obj[key] = minimize(val); - } - - if (undefined === obj[key]) { - delete obj[key]; - continue; - } - - hasKeys = true; - } - - return hasKeys - ? obj - : undefined; -} - -/*! - * Applies virtuals properties to `json`. - * - * @param {Document} self - * @param {Object} json - * @param {String} type either `virtuals` or `paths` - * @return {Object} `json` - */ - -function applyGetters(self, json, type, options) { - var schema = self.schema - , paths = Object.keys(schema[type]) - , i = paths.length - , path; - - while (i--) { - path = paths[i]; - - var parts = path.split('.') - , plen = parts.length - , last = plen - 1 - , branch = json - , part; - - for (var ii = 0; ii < plen; ++ii) { - part = parts[ii]; - if (ii === last) { - branch[part] = clone(self.get(path), options); - } else { - branch = branch[part] || (branch[part] = {}); - } - } - } - - return json; -} - -/** - * The return value of this method is used in calls to JSON.stringify(doc). - * - * This method accepts the same options as [Document#toObject](#document_Document-toObject). To apply the options to every document of your schema by default, set your [schemas](#schema_Schema) `toJSON` option to the same argument. - * - * schema.set('toJSON', { virtuals: true }) - * - * See [schema options](/docs/guide.html#toJSON) for details. - * - * @param {Object} options - * @return {Object} - * @see Document#toObject #document_Document-toObject - * @api public - */ - -Document.prototype.toJSON = function(options) { - return this.$toObject(options, true); -}; - -/** - * Helper for console.log - * - * @api public - */ - -Document.prototype.inspect = function(options) { - var opts = options && 'Object' == utils.getFunctionName(options.constructor) ? options : {}; - opts.minimize = false; - opts.retainKeyOrder = true; - return inspect(this.toObject(opts)); -}; - -/** - * Helper for console.log - * - * @api public - * @method toString - */ - -Document.prototype.toString = Document.prototype.inspect; - -/** - * Returns true if the Document stores the same data as doc. - * - * Documents are considered equal when they have matching `_id`s, unless neither - * document has an `_id`, in which case this function falls back to using - * `deepEqual()`. - * - * @param {Document} doc a document to compare - * @return {Boolean} - * @api public - */ - -Document.prototype.equals = function(doc) { - var tid = this.get('_id'); - var docid = doc.get ? doc.get('_id') : doc; - if (!tid && !docid) { - return deepEqual(this, doc); - } - return tid && tid.equals - ? tid.equals(docid) - : tid === docid; -}; - -/** - * Populates document references, executing the `callback` when complete. - * - * ####Example: - * - * doc - * .populate('company') - * .populate({ - * path: 'notes', - * match: /airline/, - * select: 'text', - * model: 'modelName' - * options: opts - * }, function (err, user) { - * assert(doc._id == user._id) // the document itself is passed - * }) - * - * // summary - * doc.populate(path) // not executed - * doc.populate(options); // not executed - * doc.populate(path, callback) // executed - * doc.populate(options, callback); // executed - * doc.populate(callback); // executed - * - * - * ####NOTE: - * - * Population does not occur unless a `callback` is passed *or* you explicitly - * call `execPopulate()`. - * Passing the same path a second time will overwrite the previous path options. - * See [Model.populate()](#model_Model.populate) for explaination of options. - * - * @see Model.populate #model_Model.populate - * @param {String|Object} [path] The path to populate or an options object - * @param {Function} [callback] When passed, population is invoked - * @api public - * @return {Document} this - */ - -Document.prototype.populate = function populate() { - if (0 === arguments.length) return this; - - var pop = this.$__.populate || (this.$__.populate = {}); - var args = utils.args(arguments); - var fn; - - if ('function' == typeof args[args.length - 1]) { - fn = args.pop(); - } - - // allow `doc.populate(callback)` - if (args.length) { - // use hash to remove duplicate paths - var res = utils.populate.apply(null, args); - for (var i = 0; i < res.length; ++i) { - pop[res[i].path] = res[i]; - } - } - - if (fn) { - var paths = utils.object.vals(pop); - this.$__.populate = undefined; - this.constructor.populate(this, paths, fn); - } - - return this; -}; - -/** - * Explicitly executes population and returns a promise. Useful for ES6 - * integration. - * - * ####Example: - * - * var promise = doc. - * populate('company'). - * populate({ - * path: 'notes', - * match: /airline/, - * select: 'text', - * model: 'modelName' - * options: opts - * }). - * execPopulate(); - * - * // summary - * doc.execPopulate() - * - * - * ####NOTE: - * - * Population does not occur unless a `callback` is passed. - * Passing the same path a second time will overwrite the previous path options. - * See [Model.populate()](#model_Model.populate) for explaination of options. - * - * @see Document.populate #Document_model.populate - * @api public - * @return {Promise} promise that resolves to the document when population is done - */ - -Document.prototype.execPopulate = function() { - var Promise = PromiseProvider.get(); - var _this = this; - return new Promise.ES6(function(resolve, reject) { - _this.populate(function(error) { - if (error) { - return reject(error); - } - resolve(_this); - }); - }); -}; - -/** - * Gets _id(s) used during population of the given `path`. - * - * ####Example: - * - * Model.findOne().populate('author').exec(function (err, doc) { - * console.log(doc.author.name) // Dr.Seuss - * console.log(doc.populated('author')) // '5144cf8050f071d979c118a7' - * }) - * - * If the path was not populated, undefined is returned. - * - * @param {String} path - * @return {Array|ObjectId|Number|Buffer|String|undefined} - * @api public - */ - -Document.prototype.populated = function(path, val, options) { - // val and options are internal - - if (val == null) { - if (!this.$__.populated) return undefined; - var v = this.$__.populated[path]; - if (v) return v.value; - return undefined; - } - - // internal - - if (true === val) { - if (!this.$__.populated) return undefined; - return this.$__.populated[path]; - } - - this.$__.populated || (this.$__.populated = {}); - this.$__.populated[path] = { value: val, options: options }; - return val; -}; - -/** - * Returns the full path to this document. - * - * @param {String} [path] - * @return {String} - * @api private - * @method $__fullPath - * @memberOf Document - */ - -Document.prototype.$__fullPath = function(path) { - // overridden in SubDocuments - return path || ''; -}; - -/*! - * Module exports. - */ - -Document.ValidationError = ValidationError; -module.exports = exports = Document; diff --git a/Associations/node_modules/mongoose/lib/document_provider.js b/Associations/node_modules/mongoose/lib/document_provider.js deleted file mode 100644 index f7ad8fac..00000000 --- a/Associations/node_modules/mongoose/lib/document_provider.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -/*! - * Module dependencies. - */ -var Document = require('./document.js'); -var BrowserDocument = require('./browserDocument.js'); - -/** - * Returns the Document constructor for the current context - * - * @api private - */ -module.exports = function() { - if (typeof window !== 'undefined' && typeof document !== 'undefined' && document === window.document) { - return BrowserDocument; - } else { - return Document; - } -}; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/lib/drivers/SPEC.md b/Associations/node_modules/mongoose/lib/drivers/SPEC.md deleted file mode 100644 index 64646931..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/SPEC.md +++ /dev/null @@ -1,4 +0,0 @@ - -# Driver Spec - -TODO diff --git a/Associations/node_modules/mongoose/lib/drivers/browser/ReadPreference.js b/Associations/node_modules/mongoose/lib/drivers/browser/ReadPreference.js deleted file mode 100644 index f20cd6cc..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/browser/ReadPreference.js +++ /dev/null @@ -1,5 +0,0 @@ -/*! - * ignore - */ - -module.exports = function() {}; diff --git a/Associations/node_modules/mongoose/lib/drivers/browser/binary.js b/Associations/node_modules/mongoose/lib/drivers/browser/binary.js deleted file mode 100644 index 4d7a395a..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/browser/binary.js +++ /dev/null @@ -1,12 +0,0 @@ - -/*! - * Module dependencies. - */ - -var Binary = require('bson').Binary; - -/*! - * Module exports. - */ - -module.exports = exports = Binary; diff --git a/Associations/node_modules/mongoose/lib/drivers/browser/index.js b/Associations/node_modules/mongoose/lib/drivers/browser/index.js deleted file mode 100644 index fa5dbb42..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/browser/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Module exports. - */ - -exports.Binary = require('./binary'); -exports.ObjectId = require('./objectid'); -exports.ReadPreference = require('./ReadPreference'); diff --git a/Associations/node_modules/mongoose/lib/drivers/browser/objectid.js b/Associations/node_modules/mongoose/lib/drivers/browser/objectid.js deleted file mode 100644 index e63c04a8..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/browser/objectid.js +++ /dev/null @@ -1,14 +0,0 @@ - -/*! - * [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) ObjectId - * @constructor NodeMongoDbObjectId - * @see ObjectId - */ - -var ObjectId = require('bson').ObjectID; - -/*! - * ignore - */ - -module.exports = exports = ObjectId; diff --git a/Associations/node_modules/mongoose/lib/drivers/index.js b/Associations/node_modules/mongoose/lib/drivers/index.js deleted file mode 100644 index 5a842bae..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/index.js +++ /dev/null @@ -1,17 +0,0 @@ -/*! - * ignore - */ - -var driver; - -if (typeof window === 'undefined') { - driver = require(global.MONGOOSE_DRIVER_PATH || './node-mongodb-native'); -} else { - driver = require('./browser'); -} - -/*! - * ignore - */ - -module.exports = driver; diff --git a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/ReadPreference.js b/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/ReadPreference.js deleted file mode 100644 index e921d60f..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/ReadPreference.js +++ /dev/null @@ -1,45 +0,0 @@ -/*! - * Module dependencies. - */ - -var mongodb = require('mongodb'); -var ReadPref = mongodb.ReadPreference; - -/*! - * Converts arguments to ReadPrefs the driver - * can understand. - * - * @param {String|Array} pref - * @param {Array} [tags] - */ - -module.exports = function readPref(pref, tags) { - if (Array.isArray(pref)) { - tags = pref[1]; - pref = pref[0]; - } - - if (pref instanceof ReadPref) { - return pref; - } - - switch (pref) { - case 'p': - pref = 'primary'; - break; - case 'pp': - pref = 'primaryPreferred'; - break; - case 's': - pref = 'secondary'; - break; - case 'sp': - pref = 'secondaryPreferred'; - break; - case 'n': - pref = 'nearest'; - break; - } - - return new ReadPref(pref, tags); -}; diff --git a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/binary.js b/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/binary.js deleted file mode 100644 index 657efde5..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/binary.js +++ /dev/null @@ -1,8 +0,0 @@ - -/*! - * Module dependencies. - */ - -var Binary = require('mongodb').Binary; - -module.exports = exports = Binary; diff --git a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js b/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js deleted file mode 100644 index b4f85c09..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/collection.js +++ /dev/null @@ -1,225 +0,0 @@ - -/*! - * Module dependencies. - */ - -var MongooseCollection = require('../../collection') - , Collection = require('mongodb').Collection - , utils = require('../../utils'); - -/** - * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) collection implementation. - * - * All methods methods from the [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) driver are copied and wrapped in queue management. - * - * @inherits Collection - * @api private - */ - -function NativeCollection() { - this.collection = null; - MongooseCollection.apply(this, arguments); -} - -/*! - * Inherit from abstract Collection. - */ - -NativeCollection.prototype.__proto__ = MongooseCollection.prototype; - -/** - * Called when the connection opens. - * - * @api private - */ - -NativeCollection.prototype.onOpen = function() { - var self = this; - - // always get a new collection in case the user changed host:port - // of parent db instance when re-opening the connection. - - if (!self.opts.capped.size) { - // non-capped - return self.conn.db.collection(self.name, callback); - } - - // capped - return self.conn.db.collection(self.name, function(err, c) { - if (err) return callback(err); - - // discover if this collection exists and if it is capped - self.conn.db.listCollections({ name: self.name }).toArray(function(err, docs) { - if (err) { - return callback(err); - } - var doc = docs[0]; - var exists = !!doc; - - if (exists) { - if (doc.options && doc.options.capped) { - callback(null, c); - } else { - var msg = 'A non-capped collection exists with the name: ' + self.name + '\n\n' - + ' To use this collection as a capped collection, please ' - + 'first convert it.\n' - + ' http://www.mongodb.org/display/DOCS/Capped+Collections#CappedCollections-Convertingacollectiontocapped'; - err = new Error(msg); - callback(err); - } - } else { - // create - var opts = utils.clone(self.opts.capped); - opts.capped = true; - self.conn.db.createCollection(self.name, opts, callback); - } - }); - }); - - function callback(err, collection) { - if (err) { - // likely a strict mode error - self.conn.emit('error', err); - } else { - self.collection = collection; - MongooseCollection.prototype.onOpen.call(self); - } - } -}; - -/** - * Called when the connection closes - * - * @api private - */ - -NativeCollection.prototype.onClose = function() { - MongooseCollection.prototype.onClose.call(this); -}; - -/*! - * Copy the collection methods and make them subject to queues - */ - -for (var i in Collection.prototype) { - // Janky hack to work around gh-3005 until we can get rid of the mongoose - // collection abstraction - try { - if (typeof Collection.prototype[i] !== 'function') { - continue; - } - } catch (e) { - continue; - } - - (function(i) { - NativeCollection.prototype[i] = function() { - if (this.buffer) { - this.addQueue(i, arguments); - return; - } - - var collection = this.collection - , args = arguments - , self = this - , debug = self.conn.base.options.debug; - - if (debug) { - if ('function' === typeof debug) { - debug.apply(debug - , [self.name, i].concat(utils.args(args, 0, args.length - 1))); - } else { - console.error('\x1B[0;36mMongoose:\x1B[0m %s.%s(%s) %s %s %s' - , self.name - , i - , print(args[0]) - , print(args[1]) - , print(args[2]) - , print(args[3])); - } - } - - return collection[i].apply(collection, args); - }; - })(i); -} - -/*! - * Debug print helper - */ - -function print(arg) { - var type = typeof arg; - if ('function' === type || 'undefined' === type) return ''; - return format(arg); -} - -/*! - * Debug print helper - */ - -function format(obj, sub) { - var x = utils.clone(obj, { retainKeyOrder: 1 }); - var representation; - if (x) { - if ('Binary' === x.constructor.name) { - x = '[object Buffer]'; - } else if ('ObjectID' === x.constructor.name) { - representation = 'ObjectId("' + x.toHexString() + '")'; - x = { inspect: function() { return representation; } }; - } else if ('Date' === x.constructor.name) { - representation = 'new Date("' + x.toUTCString() + '")'; - x = { inspect: function() { return representation; } }; - } else if ('Object' === x.constructor.name) { - var keys = Object.keys(x); - var numKeys = keys.length; - var key; - for (var i = 0; i < numKeys; ++i) { - key = keys[i]; - if (x[key]) { - if ('Binary' === x[key].constructor.name) { - x[key] = '[object Buffer]'; - } else if ('Object' === x[key].constructor.name) { - x[key] = format(x[key], true); - } else if ('ObjectID' === x[key].constructor.name) { - (function(x) { - var representation = 'ObjectId("' + x[key].toHexString() + '")'; - x[key] = { inspect: function() { return representation; } }; - })(x); - } else if ('Date' === x[key].constructor.name) { - (function(x) { - var representation = 'new Date("' + x[key].toUTCString() + '")'; - x[key] = { inspect: function() { return representation; } }; - })(x); - } else if (Array.isArray(x[key])) { - x[key] = x[key].map(function(o) { - return format(o, true); - }); - } - } - } - } - if (sub) return x; - } - - return require('util') - .inspect(x, false, 10, true) - .replace(/\n/g, '') - .replace(/\s{2,}/g, ' '); -} - -/** - * Retreives information about this collections indexes. - * - * @param {Function} callback - * @method getIndexes - * @api public - */ - -NativeCollection.prototype.getIndexes = NativeCollection.prototype.indexInformation; - -/*! - * Module exports. - */ - -module.exports = NativeCollection; diff --git a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js b/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js deleted file mode 100644 index 34adafb3..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/connection.js +++ /dev/null @@ -1,355 +0,0 @@ -/*! - * Module dependencies. - */ - -var MongooseConnection = require('../../connection') - , mongo = require('mongodb') - , Db = mongo.Db - , Server = mongo.Server - , Mongos = mongo.Mongos - , STATES = require('../../connectionstate') - , ReplSetServers = mongo.ReplSet; - -/** - * A [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) connection implementation. - * - * @inherits Connection - * @api private - */ - -function NativeConnection() { - MongooseConnection.apply(this, arguments); - this._listening = false; -} - -/** - * Expose the possible connection states. - * @api public - */ - -NativeConnection.STATES = STATES; - -/*! - * Inherits from Connection. - */ - -NativeConnection.prototype.__proto__ = MongooseConnection.prototype; - -/** - * Opens the connection to MongoDB. - * - * @param {Function} fn - * @return {Connection} this - * @api private - */ - -NativeConnection.prototype.doOpen = function(fn) { - var server = new Server(this.host, this.port, this.options.server); - this.db = new Db(this.name, server, this.options.db); - - var self = this; - this.db.open(function(err) { - if (err) return fn(err); - listen(self); - fn(); - }); - - return this; -}; - -/** - * Switches to a different database using the same connection pool. - * - * Returns a new connection object, with the new db. - * - * @param {String} name The database name - * @return {Connection} New Connection Object - * @api public - */ - -NativeConnection.prototype.useDb = function(name) { - // we have to manually copy all of the attributes... - var newConn = new this.constructor(); - newConn.name = name; - newConn.base = this.base; - newConn.collections = {}; - newConn.models = {}; - newConn.replica = this.replica; - newConn.hosts = this.hosts; - newConn.host = this.host; - newConn.port = this.port; - newConn.user = this.user; - newConn.pass = this.pass; - newConn.options = this.options; - newConn._readyState = this._readyState; - newConn._closeCalled = this._closeCalled; - newConn._hasOpened = this._hasOpened; - newConn._listening = false; - - // First, when we create another db object, we are not guaranteed to have a - // db object to work with. So, in the case where we have a db object and it - // is connected, we can just proceed with setting everything up. However, if - // we do not have a db or the state is not connected, then we need to wait on - // the 'open' event of the connection before doing the rest of the setup - // the 'connected' event is the first time we'll have access to the db object - - var self = this; - - if (this.db && this._readyState === STATES.connected) { - wireup(); - } else { - this.once('connected', wireup); - } - - function wireup() { - newConn.db = self.db.db(name); - newConn.onOpen(); - // setup the events appropriately - listen(newConn); - } - - newConn.name = name; - - // push onto the otherDbs stack, this is used when state changes - this.otherDbs.push(newConn); - newConn.otherDbs.push(this); - - return newConn; -}; - -/*! - * Register listeners for important events and bubble appropriately. - */ - -function listen(conn) { - if (conn._listening) return; - conn._listening = true; - - conn.db.on('close', function() { - if (conn._closeCalled) return; - - // the driver never emits an `open` event. auto_reconnect still - // emits a `close` event but since we never get another - // `open` we can't emit close - if (conn.db.serverConfig.autoReconnect) { - conn.readyState = STATES.disconnected; - conn.emit('close'); - return; - } - conn.onClose(); - }); - conn.db.on('error', function(err) { - conn.emit('error', err); - }); - conn.db.on('reconnect', function() { - conn.readyState = STATES.connected; - conn.emit('reconnected'); - }); - conn.db.on('timeout', function(err) { - var error = new Error(err && err.err || 'connection timeout'); - conn.emit('error', error); - }); - conn.db.on('open', function(err, db) { - if (STATES.disconnected === conn.readyState && db && db.databaseName) { - conn.readyState = STATES.connected; - conn.emit('reconnected'); - } - }); - conn.db.on('parseError', function(err) { - conn.emit('parseError', err); - }); -} - -/** - * Opens a connection to a MongoDB ReplicaSet. - * - * See description of [doOpen](#NativeConnection-doOpen) for server options. In this case `options.replset` is also passed to ReplSetServers. - * - * @param {Function} fn - * @api private - * @return {Connection} this - */ - -NativeConnection.prototype.doOpenSet = function(fn) { - var servers = [] - , self = this; - - this.hosts.forEach(function(server) { - var host = server.host || server.ipc; - var port = server.port || 27017; - servers.push(new Server(host, port, self.options.server)); - }); - - var server = this.options.mongos - ? new Mongos(servers, this.options.mongos) - : new ReplSetServers(servers, this.options.replset); - this.db = new Db(this.name, server, this.options.db); - - this.db.on('fullsetup', function() { - self.emit('fullsetup'); - }); - - this.db.open(function(err) { - if (err) return fn(err); - fn(); - listen(self); - }); - - return this; -}; - -/** - * Closes the connection - * - * @param {Function} fn - * @return {Connection} this - * @api private - */ - -NativeConnection.prototype.doClose = function(fn) { - this.db.close(); - if (fn) fn(); - return this; -}; - -/** - * Prepares default connection options for the node-mongodb-native driver. - * - * _NOTE: `passed` options take precedence over connection string options._ - * - * @param {Object} passed options that were passed directly during connection - * @param {Object} [connStrOptions] options that were passed in the connection string - * @api private - */ - -NativeConnection.prototype.parseOptions = function(passed, connStrOpts) { - var o = passed || {}; - o.db || (o.db = {}); - o.auth || (o.auth = {}); - o.server || (o.server = {}); - o.replset || (o.replset = {}); - o.server.socketOptions || (o.server.socketOptions = {}); - o.replset.socketOptions || (o.replset.socketOptions = {}); - - var opts = connStrOpts || {}; - Object.keys(opts).forEach(function(name) { - switch (name) { - case 'ssl': - case 'poolSize': - if ('undefined' == typeof o.server[name]) { - o.server[name] = o.replset[name] = opts[name]; - } - break; - case 'slaveOk': - if ('undefined' == typeof o.server.slave_ok) { - o.server.slave_ok = opts[name]; - } - break; - case 'autoReconnect': - if ('undefined' == typeof o.server.auto_reconnect) { - o.server.auto_reconnect = opts[name]; - } - break; - case 'socketTimeoutMS': - case 'connectTimeoutMS': - if ('undefined' == typeof o.server.socketOptions[name]) { - o.server.socketOptions[name] = o.replset.socketOptions[name] = opts[name]; - } - break; - case 'authdb': - if ('undefined' == typeof o.auth.authdb) { - o.auth.authdb = opts[name]; - } - break; - case 'authSource': - if ('undefined' == typeof o.auth.authSource) { - o.auth.authSource = opts[name]; - } - break; - case 'retries': - case 'reconnectWait': - case 'rs_name': - if ('undefined' == typeof o.replset[name]) { - o.replset[name] = opts[name]; - } - break; - case 'replicaSet': - if ('undefined' == typeof o.replset.rs_name) { - o.replset.rs_name = opts[name]; - } - break; - case 'readSecondary': - if ('undefined' == typeof o.replset.read_secondary) { - o.replset.read_secondary = opts[name]; - } - break; - case 'nativeParser': - if ('undefined' == typeof o.db.native_parser) { - o.db.native_parser = opts[name]; - } - break; - case 'w': - case 'safe': - case 'fsync': - case 'journal': - case 'wtimeoutMS': - if ('undefined' == typeof o.db[name]) { - o.db[name] = opts[name]; - } - break; - case 'readPreference': - if ('undefined' == typeof o.db.read_preference) { - o.db.read_preference = opts[name]; - } - break; - case 'readPreferenceTags': - if ('undefined' == typeof o.db.read_preference_tags) { - o.db.read_preference_tags = opts[name]; - } - break; - } - }); - - if (!('auto_reconnect' in o.server)) { - o.server.auto_reconnect = true; - } - - if (!o.db.read_preference) { - // read from primaries by default - o.db.read_preference = 'primary'; - } - - // mongoose creates its own ObjectIds - o.db.forceServerObjectId = false; - - // default safe using new nomenclature - if (!('journal' in o.db || 'j' in o.db || - 'fsync' in o.db || 'safe' in o.db || 'w' in o.db)) { - o.db.w = 1; - } - - validate(o); - return o; -}; - -/*! - * Validates the driver db options. - * - * @param {Object} o - */ - -function validate(o) { - if (-1 === o.db.w || 0 === o.db.w) { - if (o.db.journal || o.db.fsync || o.db.safe) { - throw new Error( - 'Invalid writeConcern: ' - + 'w set to -1 or 0 cannot be combined with safe|fsync|journal'); - } - } -} - -/*! - * Module exports. - */ - -module.exports = NativeConnection; diff --git a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/index.js b/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/index.js deleted file mode 100644 index fa5dbb42..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/index.js +++ /dev/null @@ -1,7 +0,0 @@ -/*! - * Module exports. - */ - -exports.Binary = require('./binary'); -exports.ObjectId = require('./objectid'); -exports.ReadPreference = require('./ReadPreference'); diff --git a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js b/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js deleted file mode 100644 index 69fc08f6..00000000 --- a/Associations/node_modules/mongoose/lib/drivers/node-mongodb-native/objectid.js +++ /dev/null @@ -1,14 +0,0 @@ - -/*! - * [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) ObjectId - * @constructor NodeMongoDbObjectId - * @see ObjectId - */ - -var ObjectId = require('mongodb').ObjectId; - -/*! - * ignore - */ - -module.exports = exports = ObjectId; diff --git a/Associations/node_modules/mongoose/lib/error.js b/Associations/node_modules/mongoose/lib/error.js deleted file mode 100644 index d08980ea..00000000 --- a/Associations/node_modules/mongoose/lib/error.js +++ /dev/null @@ -1,51 +0,0 @@ - -/** - * MongooseError constructor - * - * @param {String} msg Error message - * @inherits Error https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Error - */ - -function MongooseError(msg) { - Error.call(this); - this.stack = new Error().stack; - this.message = msg; - this.name = 'MongooseError'; -} - -/*! - * Inherits from Error. - */ - -MongooseError.prototype = Object.create(Error.prototype); -MongooseError.prototype.constructor = Error; - -/*! - * Module exports. - */ - -module.exports = exports = MongooseError; - -/** - * The default built-in validator error messages. - * - * @see Error.messages #error_messages_MongooseError-messages - * @api public - */ - -MongooseError.messages = require('./error/messages'); - -// backward compat -MongooseError.Messages = MongooseError.messages; - -/*! - * Expose subclasses - */ - -MongooseError.CastError = require('./error/cast'); -MongooseError.ValidationError = require('./error/validation'); -MongooseError.ValidatorError = require('./error/validator'); -MongooseError.VersionError = require('./error/version'); -MongooseError.OverwriteModelError = require('./error/overwriteModel'); -MongooseError.MissingSchemaError = require('./error/missingSchema'); -MongooseError.DivergentArrayError = require('./error/divergentArray'); diff --git a/Associations/node_modules/mongoose/lib/error/browserMissingSchema.js b/Associations/node_modules/mongoose/lib/error/browserMissingSchema.js deleted file mode 100644 index 8a67f1ae..00000000 --- a/Associations/node_modules/mongoose/lib/error/browserMissingSchema.js +++ /dev/null @@ -1,33 +0,0 @@ -/* eslint no-unused-vars: 1 */ -/*! - * Module dependencies. - */ - -var MongooseError = require('../error.js'); - -/*! - * MissingSchema Error constructor. - * - * @inherits MongooseError - */ - -function MissingSchemaError(name) { - var msg = 'Schema hasn\'t been registered for document.\n' - + 'Use mongoose.Document(name, schema)'; - MongooseError.call(this, msg); - Error.captureStackTrace && Error.captureStackTrace(this, arguments.callee); - this.name = 'MissingSchemaError'; -} - -/*! - * Inherits from MongooseError. - */ - -MissingSchemaError.prototype = Object.create(MongooseError.prototype); -MissingSchemaError.prototype.constructor = MongooseError; - -/*! - * exports - */ - -module.exports = MissingSchemaError; diff --git a/Associations/node_modules/mongoose/lib/error/cast.js b/Associations/node_modules/mongoose/lib/error/cast.js deleted file mode 100644 index 65da1892..00000000 --- a/Associations/node_modules/mongoose/lib/error/cast.js +++ /dev/null @@ -1,38 +0,0 @@ -/*! - * Module dependencies. - */ - -var MongooseError = require('../error.js'); - -/** - * Casting Error constructor. - * - * @param {String} type - * @param {String} value - * @inherits MongooseError - * @api private - */ - -function CastError(type, value, path, reason) { - MongooseError.call(this, 'Cast to ' + type + ' failed for value "' + value + '" at path "' + path + '"'); - this.stack = new Error().stack; - this.name = 'CastError'; - this.kind = type; - this.value = value; - this.path = path; - this.reason = reason; -} - -/*! - * Inherits from MongooseError. - */ - -CastError.prototype = Object.create(MongooseError.prototype); -CastError.prototype.constructor = MongooseError; - - -/*! - * exports - */ - -module.exports = CastError; diff --git a/Associations/node_modules/mongoose/lib/error/divergentArray.js b/Associations/node_modules/mongoose/lib/error/divergentArray.js deleted file mode 100644 index 1cbaa25f..00000000 --- a/Associations/node_modules/mongoose/lib/error/divergentArray.js +++ /dev/null @@ -1,42 +0,0 @@ - -/*! - * Module dependencies. - */ - -var MongooseError = require('../error.js'); - -/*! - * DivergentArrayError constructor. - * - * @inherits MongooseError - */ - -function DivergentArrayError(paths) { - var msg = 'For your own good, using `document.save()` to update an array ' - + 'which was selected using an $elemMatch projection OR ' - + 'populated using skip, limit, query conditions, or exclusion of ' - + 'the _id field when the operation results in a $pop or $set of ' - + 'the entire array is not supported. The following ' - + 'path(s) would have been modified unsafely:\n' - + ' ' + paths.join('\n ') + '\n' - + 'Use Model.update() to update these arrays instead.'; - // TODO write up a docs page (FAQ) and link to it - - MongooseError.call(this, msg); - Error.captureStackTrace && Error.captureStackTrace(this, arguments.callee); - this.name = 'DivergentArrayError'; -} - -/*! - * Inherits from MongooseError. - */ - -DivergentArrayError.prototype = Object.create(MongooseError.prototype); -DivergentArrayError.prototype.constructor = MongooseError; - - -/*! - * exports - */ - -module.exports = DivergentArrayError; diff --git a/Associations/node_modules/mongoose/lib/error/messages.js b/Associations/node_modules/mongoose/lib/error/messages.js deleted file mode 100644 index 75fc2355..00000000 --- a/Associations/node_modules/mongoose/lib/error/messages.js +++ /dev/null @@ -1,43 +0,0 @@ - -/** - * The default built-in validator error messages. These may be customized. - * - * // customize within each schema or globally like so - * var mongoose = require('mongoose'); - * mongoose.Error.messages.String.enum = "Your custom message for {PATH}."; - * - * As you might have noticed, error messages support basic templating - * - * - `{PATH}` is replaced with the invalid document path - * - `{VALUE}` is replaced with the invalid value - * - `{TYPE}` is replaced with the validator type such as "regexp", "min", or "user defined" - * - `{MIN}` is replaced with the declared min value for the Number.min validator - * - `{MAX}` is replaced with the declared max value for the Number.max validator - * - * Click the "show code" link below to see all defaults. - * - * @property messages - * @receiver MongooseError - * @api public - */ - -var msg = module.exports = exports = {}; - -msg.general = {}; -msg.general.default = "Validator failed for path `{PATH}` with value `{VALUE}`"; -msg.general.required = "Path `{PATH}` is required."; - -msg.Number = {}; -msg.Number.min = "Path `{PATH}` ({VALUE}) is less than minimum allowed value ({MIN})."; -msg.Number.max = "Path `{PATH}` ({VALUE}) is more than maximum allowed value ({MAX})."; - -msg.Date = {}; -msg.Date.min = "Path `{PATH}` ({VALUE}) is before minimum allowed value ({MIN})."; -msg.Date.max = "Path `{PATH}` ({VALUE}) is after maximum allowed value ({MAX})."; - -msg.String = {}; -msg.String.enum = "`{VALUE}` is not a valid enum value for path `{PATH}`."; -msg.String.match = "Path `{PATH}` is invalid ({VALUE})."; -msg.String.minlength = "Path `{PATH}` (`{VALUE}`) is shorter than the minimum allowed length ({MINLENGTH})."; -msg.String.maxlength = "Path `{PATH}` (`{VALUE}`) is longer than the maximum allowed length ({MAXLENGTH})."; - diff --git a/Associations/node_modules/mongoose/lib/error/missingSchema.js b/Associations/node_modules/mongoose/lib/error/missingSchema.js deleted file mode 100644 index 25eabfa5..00000000 --- a/Associations/node_modules/mongoose/lib/error/missingSchema.js +++ /dev/null @@ -1,33 +0,0 @@ - -/*! - * Module dependencies. - */ - -var MongooseError = require('../error.js'); - -/*! - * MissingSchema Error constructor. - * - * @inherits MongooseError - */ - -function MissingSchemaError(name) { - var msg = 'Schema hasn\'t been registered for model "' + name + '".\n' - + 'Use mongoose.model(name, schema)'; - MongooseError.call(this, msg); - Error.captureStackTrace && Error.captureStackTrace(this, arguments.callee); - this.name = 'MissingSchemaError'; -} - -/*! - * Inherits from MongooseError. - */ - -MissingSchemaError.prototype = Object.create(MongooseError.prototype); -MissingSchemaError.prototype.constructor = MongooseError; - -/*! - * exports - */ - -module.exports = MissingSchemaError; diff --git a/Associations/node_modules/mongoose/lib/error/overwriteModel.js b/Associations/node_modules/mongoose/lib/error/overwriteModel.js deleted file mode 100644 index c14ae7ff..00000000 --- a/Associations/node_modules/mongoose/lib/error/overwriteModel.js +++ /dev/null @@ -1,31 +0,0 @@ - -/*! - * Module dependencies. - */ - -var MongooseError = require('../error.js'); - -/*! - * OverwriteModel Error constructor. - * - * @inherits MongooseError - */ - -function OverwriteModelError(name) { - MongooseError.call(this, 'Cannot overwrite `' + name + '` model once compiled.'); - Error.captureStackTrace && Error.captureStackTrace(this, arguments.callee); - this.name = 'OverwriteModelError'; -} - -/*! - * Inherits from MongooseError. - */ - -OverwriteModelError.prototype = Object.create(MongooseError.prototype); -OverwriteModelError.prototype.constructor = MongooseError; - -/*! - * exports - */ - -module.exports = OverwriteModelError; diff --git a/Associations/node_modules/mongoose/lib/error/validation.js b/Associations/node_modules/mongoose/lib/error/validation.js deleted file mode 100644 index b574455a..00000000 --- a/Associations/node_modules/mongoose/lib/error/validation.js +++ /dev/null @@ -1,58 +0,0 @@ - -/*! - * Module requirements - */ - -var MongooseError = require('../error.js'); - -/** - * Document Validation Error - * - * @api private - * @param {Document} instance - * @inherits MongooseError - */ - -function ValidationError(instance) { - if (instance && instance.constructor.name === 'model') { - MongooseError.call(this, instance.constructor.modelName + " validation failed"); - } else { - MongooseError.call(this, "Validation failed"); - } - this.stack = new Error().stack; - this.name = 'ValidationError'; - this.errors = {}; - if (instance) { - instance.errors = this.errors; - } -} - -/*! - * Inherits from MongooseError. - */ - -ValidationError.prototype = Object.create(MongooseError.prototype); -ValidationError.prototype.constructor = MongooseError; - - -/** - * Console.log helper - */ - -ValidationError.prototype.toString = function() { - var ret = this.name + ': '; - var msgs = []; - - Object.keys(this.errors).forEach(function(key) { - if (this == this.errors[key]) return; - msgs.push(String(this.errors[key])); - }, this); - - return ret + msgs.join(', '); -}; - -/*! - * Module exports - */ - -module.exports = exports = ValidationError; diff --git a/Associations/node_modules/mongoose/lib/error/validator.js b/Associations/node_modules/mongoose/lib/error/validator.js deleted file mode 100644 index 3f1c67f9..00000000 --- a/Associations/node_modules/mongoose/lib/error/validator.js +++ /dev/null @@ -1,67 +0,0 @@ -/*! - * Module dependencies. - */ - -var MongooseError = require('../error.js'); -var errorMessages = MongooseError.messages; - -/** - * Schema validator error - * - * @param {Object} properties - * @inherits MongooseError - * @api private - */ - -function ValidatorError(properties) { - var msg = properties.message; - if (!msg) { - msg = errorMessages.general.default; - } - - this.properties = properties; - var message = this.formatMessage(msg, properties); - MongooseError.call(this, message); - this.stack = new Error().stack; - this.name = 'ValidatorError'; - this.kind = properties.type; - this.path = properties.path; - this.value = properties.value; -} - -/*! - * Inherits from MongooseError - */ - -ValidatorError.prototype = Object.create(MongooseError.prototype); -ValidatorError.prototype.constructor = MongooseError; - -/*! - * Formats error messages - */ - -ValidatorError.prototype.formatMessage = function(msg, properties) { - var propertyNames = Object.keys(properties); - for (var i = 0; i < propertyNames.length; ++i) { - var propertyName = propertyNames[i]; - if (propertyName === 'message') { - continue; - } - msg = msg.replace('{' + propertyName.toUpperCase() + '}', properties[propertyName]); - } - return msg; -}; - -/*! - * toString helper - */ - -ValidatorError.prototype.toString = function() { - return this.message; -}; - -/*! - * exports - */ - -module.exports = ValidatorError; diff --git a/Associations/node_modules/mongoose/lib/error/version.js b/Associations/node_modules/mongoose/lib/error/version.js deleted file mode 100644 index 815b1bc3..00000000 --- a/Associations/node_modules/mongoose/lib/error/version.js +++ /dev/null @@ -1,32 +0,0 @@ - -/*! - * Module dependencies. - */ - -var MongooseError = require('../error.js'); - -/** - * Version Error constructor. - * - * @inherits MongooseError - * @api private - */ - -function VersionError() { - MongooseError.call(this, 'No matching document found.'); - Error.captureStackTrace && Error.captureStackTrace(this, arguments.callee); - this.name = 'VersionError'; -} - -/*! - * Inherits from MongooseError. - */ - -VersionError.prototype = Object.create(MongooseError.prototype); -VersionError.prototype.constructor = MongooseError; - -/*! - * exports - */ - -module.exports = VersionError; diff --git a/Associations/node_modules/mongoose/lib/index.js b/Associations/node_modules/mongoose/lib/index.js deleted file mode 100644 index eb728de9..00000000 --- a/Associations/node_modules/mongoose/lib/index.js +++ /dev/null @@ -1,693 +0,0 @@ -'use strict'; - -/*! - * Module dependencies. - */ - -var Schema = require('./schema') - , SchemaType = require('./schematype') - , VirtualType = require('./virtualtype') - , STATES = require('./connectionstate') - , Types = require('./types') - , Query = require('./query') - , Model = require('./model') - , Document = require('./document') - , utils = require('./utils') - , format = utils.toCollectionName - , pkg = require('../package.json'); - -var querystring = require('querystring'); - -var Aggregate = require('./aggregate'); -var PromiseProvider = require('./promise_provider'); - -/** - * Mongoose constructor. - * - * The exports object of the `mongoose` module is an instance of this class. - * Most apps will only use this one instance. - * - * @api public - */ - -function Mongoose() { - this.connections = []; - this.plugins = []; - this.models = {}; - this.modelSchemas = {}; - // default global options - this.options = { - pluralization: true - }; - var conn = this.createConnection(); // default connection - conn.models = this.models; -} - -/** - * Expose connection states for user-land - * - */ -Mongoose.prototype.STATES = STATES; - -/** - * Sets mongoose options - * - * ####Example: - * - * mongoose.set('test', value) // sets the 'test' option to `value` - * - * mongoose.set('debug', true) // enable logging collection methods + arguments to the console - * - * @param {String} key - * @param {String} value - * @api public - */ - -Mongoose.prototype.set = function(key, value) { - if (arguments.length == 1) { - return this.options[key]; - } - - this.options[key] = value; - return this; -}; - -/** - * Gets mongoose options - * - * ####Example: - * - * mongoose.get('test') // returns the 'test' value - * - * @param {String} key - * @method get - * @api public - */ - -Mongoose.prototype.get = Mongoose.prototype.set; - -/*! - * ReplSet connection string check. - */ - -var rgxReplSet = /^.+,.+$/; - -/** - * Checks if ?replicaSet query parameter is specified in URI - * - * ####Example: - * - * checkReplicaSetInUri('localhost:27000?replicaSet=rs0'); // true - * - * @param {String} uri - * @return {boolean} - * @api private - */ - -var checkReplicaSetInUri = function(uri) { - if (!uri) { - return false; - } - - var queryStringStart = uri.indexOf('?'); - var isReplicaSet = false; - if (queryStringStart !== -1) { - try { - var obj = querystring.parse(uri.substr(queryStringStart + 1)); - if (obj && obj.replicaSet) { - isReplicaSet = true; - } - } catch (e) { - return false; - } - } - - return isReplicaSet; -}; - -/** - * Creates a Connection instance. - * - * Each `connection` instance maps to a single database. This method is helpful when mangaging multiple db connections. - * - * If arguments are passed, they are proxied to either [Connection#open](#connection_Connection-open) or [Connection#openSet](#connection_Connection-openSet) appropriately. This means we can pass `db`, `server`, and `replset` options to the driver. _Note that the `safe` option specified in your schema will overwrite the `safe` db option specified here unless you set your schemas `safe` option to `undefined`. See [this](/docs/guide.html#safe) for more information._ - * - * _Options passed take precedence over options included in connection strings._ - * - * ####Example: - * - * // with mongodb:// URI - * db = mongoose.createConnection('mongodb://user:pass@localhost:port/database'); - * - * // and options - * var opts = { db: { native_parser: true }} - * db = mongoose.createConnection('mongodb://user:pass@localhost:port/database', opts); - * - * // replica sets - * db = mongoose.createConnection('mongodb://user:pass@localhost:port,anotherhost:port,yetanother:port/database'); - * - * // and options - * var opts = { replset: { strategy: 'ping', rs_name: 'testSet' }} - * db = mongoose.createConnection('mongodb://user:pass@localhost:port,anotherhost:port,yetanother:port/database', opts); - * - * // with [host, database_name[, port] signature - * db = mongoose.createConnection('localhost', 'database', port) - * - * // and options - * var opts = { server: { auto_reconnect: false }, user: 'username', pass: 'mypassword' } - * db = mongoose.createConnection('localhost', 'database', port, opts) - * - * // initialize now, connect later - * db = mongoose.createConnection(); - * db.open('localhost', 'database', port, [opts]); - * - * @param {String} [uri] a mongodb:// URI - * @param {Object} [options] options to pass to the driver - * @see Connection#open #connection_Connection-open - * @see Connection#openSet #connection_Connection-openSet - * @return {Connection} the created Connection object - * @api public - */ - -Mongoose.prototype.createConnection = function(uri, options) { - var conn = new Connection(this); - this.connections.push(conn); - - if (arguments.length) { - if (rgxReplSet.test(arguments[0]) || checkReplicaSetInUri(arguments[0])) { - conn.openSet.apply(conn, arguments); - } else if (options && options.replset && - (options.replset.replicaSet || options.replset.rs_name)) { - conn.openSet.apply(conn, arguments); - } else { - conn.open.apply(conn, arguments); - } - } - - return conn; -}; - -/** - * Opens the default mongoose connection. - * - * If arguments are passed, they are proxied to either [Connection#open](#connection_Connection-open) or [Connection#openSet](#connection_Connection-openSet) appropriately. - * - * _Options passed take precedence over options included in connection strings._ - * - * ####Example: - * - * mongoose.connect('mongodb://user:pass@localhost:port/database'); - * - * // replica sets - * var uri = 'mongodb://user:pass@localhost:port/database,mongodb://anotherhost:port,mongodb://yetanother:port'; - * mongoose.connect(uri); - * - * // with options - * mongoose.connect(uri, options); - * - * // connecting to multiple mongos - * var uri = 'mongodb://hostA:27501,hostB:27501'; - * var opts = { mongos: true }; - * mongoose.connect(uri, opts); - * - * @param {String} uri(s) - * @param {Object} [options] - * @param {Function} [callback] - * @see Mongoose#createConnection #index_Mongoose-createConnection - * @api public - * @return {Mongoose} this - */ - -Mongoose.prototype.connect = function() { - var conn = this.connection; - - if (rgxReplSet.test(arguments[0]) || checkReplicaSetInUri(arguments[0])) { - conn.openSet.apply(conn, arguments); - } else { - conn.open.apply(conn, arguments); - } - - return this; -}; - -/** - * Disconnects all connections. - * - * @param {Function} [fn] called after all connection close. - * @return {Mongoose} this - * @api public - */ - -Mongoose.prototype.disconnect = function(fn) { - var count = this.connections.length - , error; - - this.connections.forEach(function(conn) { - conn.close(function(err) { - if (error) return; - - if (err) { - error = err; - if (fn) return fn(err); - throw err; - } - - if (fn) - --count || fn(); - }); - }); - return this; -}; - -/** - * Defines a model or retrieves it. - * - * Models defined on the `mongoose` instance are available to all connection created by the same `mongoose` instance. - * - * ####Example: - * - * var mongoose = require('mongoose'); - * - * // define an Actor model with this mongoose instance - * mongoose.model('Actor', new Schema({ name: String })); - * - * // create a new connection - * var conn = mongoose.createConnection(..); - * - * // retrieve the Actor model - * var Actor = conn.model('Actor'); - * - * _When no `collection` argument is passed, Mongoose produces a collection name by passing the model `name` to the [utils.toCollectionName](#utils_exports.toCollectionName) method. This method pluralizes the name. If you don't like this behavior, either pass a collection name or set your schemas collection name option._ - * - * ####Example: - * - * var schema = new Schema({ name: String }, { collection: 'actor' }); - * - * // or - * - * schema.set('collection', 'actor'); - * - * // or - * - * var collectionName = 'actor' - * var M = mongoose.model('Actor', schema, collectionName) - * - * @param {String} name model name - * @param {Schema} [schema] - * @param {String} [collection] name (optional, induced from model name) - * @param {Boolean} [skipInit] whether to skip initialization (defaults to false) - * @api public - */ - -Mongoose.prototype.model = function(name, schema, collection, skipInit) { - if ('string' == typeof schema) { - collection = schema; - schema = false; - } - - if (utils.isObject(schema) && !(schema instanceof Schema)) { - schema = new Schema(schema); - } - - if ('boolean' === typeof collection) { - skipInit = collection; - collection = null; - } - - // handle internal options from connection.model() - var options; - if (skipInit && utils.isObject(skipInit)) { - options = skipInit; - skipInit = true; - } else { - options = {}; - } - - // look up schema for the collection. - if (!this.modelSchemas[name]) { - if (schema) { - // cache it so we only apply plugins once - this.modelSchemas[name] = schema; - this._applyPlugins(schema); - } else { - throw new mongoose.Error.MissingSchemaError(name); - } - } - - var model; - var sub; - - // connection.model() may be passing a different schema for - // an existing model name. in this case don't read from cache. - if (this.models[name] && false !== options.cache) { - if (schema instanceof Schema && schema != this.models[name].schema) { - throw new mongoose.Error.OverwriteModelError(name); - } - - if (collection) { - // subclass current model with alternate collection - model = this.models[name]; - schema = model.prototype.schema; - sub = model.__subclass(this.connection, schema, collection); - // do not cache the sub model - return sub; - } - - return this.models[name]; - } - - // ensure a schema exists - if (!schema) { - schema = this.modelSchemas[name]; - if (!schema) { - throw new mongoose.Error.MissingSchemaError(name); - } - } - - // Apply relevant "global" options to the schema - if (!('pluralization' in schema.options)) schema.options.pluralization = this.options.pluralization; - - - if (!collection) { - collection = schema.get('collection') || format(name, schema.options); - } - - var connection = options.connection || this.connection; - model = Model.compile(name, schema, collection, connection, this); - - if (!skipInit) { - model.init(); - } - - if (false === options.cache) { - return model; - } - - return this.models[name] = model; -}; - -/** - * Returns an array of model names created on this instance of Mongoose. - * - * ####Note: - * - * _Does not include names of models created using `connection.model()`._ - * - * @api public - * @return {Array} - */ - -Mongoose.prototype.modelNames = function() { - var names = Object.keys(this.models); - return names; -}; - -/** - * Applies global plugins to `schema`. - * - * @param {Schema} schema - * @api private - */ - -Mongoose.prototype._applyPlugins = function(schema) { - for (var i = 0, l = this.plugins.length; i < l; i++) { - schema.plugin(this.plugins[i][0], this.plugins[i][1]); - } -}; - -/** - * Declares a global plugin executed on all Schemas. - * - * Equivalent to calling `.plugin(fn)` on each Schema you create. - * - * @param {Function} fn plugin callback - * @param {Object} [opts] optional options - * @return {Mongoose} this - * @see plugins ./plugins.html - * @api public - */ - -Mongoose.prototype.plugin = function(fn, opts) { - this.plugins.push([fn, opts]); - return this; -}; - -/** - * The default connection of the mongoose module. - * - * ####Example: - * - * var mongoose = require('mongoose'); - * mongoose.connect(...); - * mongoose.connection.on('error', cb); - * - * This is the connection used by default for every model created using [mongoose.model](#index_Mongoose-model). - * - * @property connection - * @return {Connection} - * @api public - */ - -Mongoose.prototype.__defineGetter__('connection', function() { - return this.connections[0]; -}); - -/*! - * Driver depentend APIs - */ - -var driver = global.MONGOOSE_DRIVER_PATH || './drivers/node-mongodb-native'; - -/*! - * Connection - */ - -var Connection = require(driver + '/connection'); - -/*! - * Collection - */ - -var Collection = require(driver + '/collection'); - -/** - * The Mongoose Aggregate constructor - * - * @method Aggregate - * @api public - */ - -Mongoose.prototype.Aggregate = Aggregate; - -/** - * The Mongoose Collection constructor - * - * @method Collection - * @api public - */ - -Mongoose.prototype.Collection = Collection; - -/** - * The Mongoose [Connection](#connection_Connection) constructor - * - * @method Connection - * @api public - */ - -Mongoose.prototype.Connection = Connection; - -/** - * The Mongoose version - * - * @property version - * @api public - */ - -Mongoose.prototype.version = pkg.version; - -/** - * The Mongoose constructor - * - * The exports of the mongoose module is an instance of this class. - * - * ####Example: - * - * var mongoose = require('mongoose'); - * var mongoose2 = new mongoose.Mongoose(); - * - * @method Mongoose - * @api public - */ - -Mongoose.prototype.Mongoose = Mongoose; - -/** - * The Mongoose [Schema](#schema_Schema) constructor - * - * ####Example: - * - * var mongoose = require('mongoose'); - * var Schema = mongoose.Schema; - * var CatSchema = new Schema(..); - * - * @method Schema - * @api public - */ - -Mongoose.prototype.Schema = Schema; - -/** - * The Mongoose [SchemaType](#schematype_SchemaType) constructor - * - * @method SchemaType - * @api public - */ - -Mongoose.prototype.SchemaType = SchemaType; - -/** - * The various Mongoose SchemaTypes. - * - * ####Note: - * - * _Alias of mongoose.Schema.Types for backwards compatibility._ - * - * @property SchemaTypes - * @see Schema.SchemaTypes #schema_Schema.Types - * @api public - */ - -Mongoose.prototype.SchemaTypes = Schema.Types; - -/** - * The Mongoose [VirtualType](#virtualtype_VirtualType) constructor - * - * @method VirtualType - * @api public - */ - -Mongoose.prototype.VirtualType = VirtualType; - -/** - * The various Mongoose Types. - * - * ####Example: - * - * var mongoose = require('mongoose'); - * var array = mongoose.Types.Array; - * - * ####Types: - * - * - [ObjectId](#types-objectid-js) - * - [Buffer](#types-buffer-js) - * - [SubDocument](#types-embedded-js) - * - [Array](#types-array-js) - * - [DocumentArray](#types-documentarray-js) - * - * Using this exposed access to the `ObjectId` type, we can construct ids on demand. - * - * var ObjectId = mongoose.Types.ObjectId; - * var id1 = new ObjectId; - * - * @property Types - * @api public - */ - -Mongoose.prototype.Types = Types; - -/** - * The Mongoose [Query](#query_Query) constructor. - * - * @method Query - * @api public - */ - -Mongoose.prototype.Query = Query; - -/** - * The Mongoose [Promise](#promise_Promise) constructor. - * - * @method Promise - * @api public - */ - -Object.defineProperty(Mongoose.prototype, 'Promise', { - get: function() { - return PromiseProvider.get(); - }, - set: function(lib) { - PromiseProvider.set(lib); - } -}); - -/** - * Storage layer for mongoose promises - * - * @method PromiseProvider - * @api public - */ - -Mongoose.prototype.PromiseProvider = PromiseProvider; - -/** - * The Mongoose [Model](#model_Model) constructor. - * - * @method Model - * @api public - */ - -Mongoose.prototype.Model = Model; - -/** - * The Mongoose [Document](#document-js) constructor. - * - * @method Document - * @api public - */ - -Mongoose.prototype.Document = Document; - -/** - * The Mongoose DocumentProvider constructor. - * - * @method DocumentProvider - * @api public - */ - -Mongoose.prototype.DocumentProvider = require('./document_provider'); - -/** - * The [MongooseError](#error_MongooseError) constructor. - * - * @method Error - * @api public - */ - -Mongoose.prototype.Error = require('./error'); - -/** - * The [node-mongodb-native](https://github.com/mongodb/node-mongodb-native) driver Mongoose uses. - * - * @property mongo - * @api public - */ - -Mongoose.prototype.mongo = require('mongodb'); - -/** - * The [mquery](https://github.com/aheckmann/mquery) query builder Mongoose uses. - * - * @property mquery - * @api public - */ - -Mongoose.prototype.mquery = require('mquery'); - -/*! - * The exports object is an instance of Mongoose. - * - * @api public - */ - -var mongoose = module.exports = exports = new Mongoose; diff --git a/Associations/node_modules/mongoose/lib/internal.js b/Associations/node_modules/mongoose/lib/internal.js deleted file mode 100644 index edf3338a..00000000 --- a/Associations/node_modules/mongoose/lib/internal.js +++ /dev/null @@ -1,31 +0,0 @@ -/*! - * Dependencies - */ - -var StateMachine = require('./statemachine'); -var ActiveRoster = StateMachine.ctor('require', 'modify', 'init', 'default', 'ignore'); - -module.exports = exports = InternalCache; - -function InternalCache() { - this.strictMode = undefined; - this.selected = undefined; - this.shardval = undefined; - this.saveError = undefined; - this.validationError = undefined; - this.adhocPaths = undefined; - this.removing = undefined; - this.inserting = undefined; - this.version = undefined; - this.getters = {}; - this._id = undefined; - this.populate = undefined; // what we want to populate in this doc - this.populated = undefined;// the _ids that have been populated - this.wasPopulated = false; // if this doc was the result of a population - this.scope = undefined; - this.activePaths = new ActiveRoster; - - // embedded docs - this.ownerDocument = undefined; - this.fullPath = undefined; -} diff --git a/Associations/node_modules/mongoose/lib/model.js b/Associations/node_modules/mongoose/lib/model.js deleted file mode 100644 index a6b4da9f..00000000 --- a/Associations/node_modules/mongoose/lib/model.js +++ /dev/null @@ -1,2958 +0,0 @@ -/* eslint no-unused-vars: 1 */ - -/*! - * Module dependencies. - */ - -var Document = require('./document'); -var MongooseError = require('./error'); -var VersionError = MongooseError.VersionError; -var DivergentArrayError = MongooseError.DivergentArrayError; -var Query = require('./query'); -var Aggregate = require('./aggregate'); -var Schema = require('./schema'); -var Types = require('./schema/index'); -var utils = require('./utils'); -var hasOwnProperty = utils.object.hasOwnProperty; -var isMongooseObject = utils.isMongooseObject; -var EventEmitter = require('events').EventEmitter; -var Promise = require('./promise'); -var util = require('util'); -var tick = utils.tick; - -var async = require('async'); -var PromiseProvider = require('./promise_provider'); - -var VERSION_WHERE = 1 - , VERSION_INC = 2 - , VERSION_ALL = VERSION_WHERE | VERSION_INC; - -/** - * Model constructor - * - * Provides the interface to MongoDB collections as well as creates document instances. - * - * @param {Object} doc values with which to create the document - * @inherits Document - * @event `error`: If listening to this event, it is emitted when a document was saved without passing a callback and an `error` occurred. If not listening, the event bubbles to the connection used to create this Model. - * @event `index`: Emitted after `Model#ensureIndexes` completes. If an error occurred it is passed with the event. - * @api public - */ - -function Model(doc, fields, skipId) { - Document.call(this, doc, fields, skipId); -} - -/*! - * Inherits from Document. - * - * All Model.prototype features are available on - * top level (non-sub) documents. - */ - -Model.prototype.__proto__ = Document.prototype; - -/** - * Connection the model uses. - * - * @api public - * @property db - */ - -Model.prototype.db; - -/** - * Collection the model uses. - * - * @api public - * @property collection - */ - -Model.prototype.collection; - -/** - * The name of the model - * - * @api public - * @property modelName - */ - -Model.prototype.modelName; - -Model.prototype.$__handleSave = function(options, callback) { - var _this = this; - if (!options.safe && this.schema.options.safe) { - options.safe = this.schema.options.safe; - } - if (typeof options.safe === 'boolean') { - options.safe = null; - } - - if (this.isNew) { - // send entire doc - var toObjectOptions = {}; - if (this.schema.options.toObject && - this.schema.options.toObject.retainKeyOrder) { - toObjectOptions.retainKeyOrder = true; - } - - toObjectOptions.depopulate = 1; - toObjectOptions._skipDepopulateTopLevel = true; - toObjectOptions.transform = false; - - var obj = this.toObject(toObjectOptions); - - if (!utils.object.hasOwnProperty(obj || {}, '_id')) { - // documents must have an _id else mongoose won't know - // what to update later if more changes are made. the user - // wouldn't know what _id was generated by mongodb either - // nor would the ObjectId generated my mongodb necessarily - // match the schema definition. - setTimeout(function() { - callback(new Error('document must have an _id before saving')); - }, 0); - return; - } - - this.$__version(true, obj); - this.collection.insert(obj, options.safe, function(err, ret) { - if (err) { - _this.isNew = true; - _this.emit('isNew', true); - - callback(err); - return; - } - - callback(null, ret); - }); - this.$__reset(); - this.isNew = false; - this.emit('isNew', false); - // Make it possible to retry the insert - this.$__.inserting = true; - } else { - // Make sure we don't treat it as a new object on error, - // since it already exists - this.$__.inserting = false; - - var delta = this.$__delta(); - - if (delta) { - if (delta instanceof Error) { - callback(delta); - return; - } - var where = this.$__where(delta[0]); - - if (where instanceof Error) { - callback(where); - return; - } - - this.collection.update(where, delta[1], options.safe, function(err, ret) { - if (err) { - callback(err); - return; - } - callback(null, ret); - }); - } else { - this.$__reset(); - callback(); - return; - } - - this.emit('isNew', false); - } -}; - -/** - * Saves this document. - * - * ####Example: - * - * product.sold = Date.now(); - * product.save(function (err, product, numAffected) { - * if (err) .. - * }) - * - * The callback will receive three parameters - * - * 1. `err` if an error occurred - * 2. `product` which is the saved `product` - * 3. `numAffected` will be 1 when the document was successfully persisted to MongoDB, otherwise 0. Unless you tweak mongoose's internals, you don't need to worry about checking this parameter for errors - checking `err` is sufficient to make sure your document was properly saved. - * - * As an extra measure of flow control, save will return a Promise. - * ####Example: - * product.save().then(function(product) { - * ... - * }); - * - * For legacy reasons, mongoose stores object keys in reverse order on initial - * save. That is, `{ a: 1, b: 2 }` will be saved as `{ b: 2, a: 1 }` in - * MongoDB. To override this behavior, set - * [the `toObject.retainKeyOrder` option](http://mongoosejs.com/docs/api.html#document_Document-toObject) - * to true on your schema. - * - * @param {Object} [options] options set `options.safe` to override [schema's safe option](http://mongoosejs.com//docs/guide.html#safe) - * @param {Function} [fn] optional callback - * @return {Promise} Promise - * @api public - * @see middleware http://mongoosejs.com/docs/middleware.html - */ - -Model.prototype.save = function(options, fn) { - if ('function' == typeof options) { - fn = options; - options = undefined; - } - - if (!options) { - options = {}; - } - - var _this = this; - - return new Promise.ES6(function(resolve, reject) { - _this.$__handleSave(options, function(error, result) { - if (error) { - fn && fn(error); - reject(error); - return; - } - - _this.$__reset(); - _this.$__storeShard(); - - var numAffected = 0; - if (result) { - if (Array.isArray(result)) { - numAffected = result.length; - } else if (result.result && result.result.n !== undefined) { - numAffected = result.result.n; - } else if (result.result && result.result.nModified !== undefined) { - numAffected = result.result.nModified; - } else { - numAffected = result; - } - } - - // was this an update that required a version bump? - if (_this.$__.version && !_this.$__.inserting) { - var doIncrement = VERSION_INC === (VERSION_INC & _this.$__.version); - _this.$__.version = undefined; - - if (numAffected <= 0) { - // the update failed. pass an error back - var err = new VersionError(); - fn && fn(err); - reject(err); - return; - } - - // increment version if was successful - if (doIncrement) { - var key = _this.schema.options.versionKey; - var version = _this.getValue(key) | 0; - _this.setValue(key, version + 1); - } - } - - _this.emit('save', _this, numAffected); - fn && fn(null, _this, numAffected); - resolve(_this, numAffected); - }); - }); -}; - - -/*! - * Apply the operation to the delta (update) clause as - * well as track versioning for our where clause. - * - * @param {Document} self - * @param {Object} where - * @param {Object} delta - * @param {Object} data - * @param {Mixed} val - * @param {String} [operation] - */ - -function operand(self, where, delta, data, val, op) { - // delta - op || (op = '$set'); - if (!delta[op]) delta[op] = {}; - delta[op][data.path] = val; - - // disabled versioning? - if (false === self.schema.options.versionKey) return; - - // path excluded from versioning? - var skipVersioning = self.schema.options.skipVersioning; - if (skipVersioning && skipVersioning[data.path]) return; - - // already marked for versioning? - if (VERSION_ALL === (VERSION_ALL & self.$__.version)) return; - - switch (op) { - case '$set': - case '$unset': - case '$pop': - case '$pull': - case '$pullAll': - case '$push': - case '$pushAll': - case '$addToSet': - break; - default: - // nothing to do - return; - } - - // ensure updates sent with positional notation are - // editing the correct array element. - // only increment the version if an array position changes. - // modifying elements of an array is ok if position does not change. - - if ('$push' == op || '$pushAll' == op || '$addToSet' == op) { - self.$__.version = VERSION_INC; - } - else if (/^\$p/.test(op)) { - // potentially changing array positions - self.increment(); - } - else if (Array.isArray(val)) { - // $set an array - self.increment(); - } - // now handling $set, $unset - else if (/\.\d+\.|\.\d+$/.test(data.path)) { - // subpath of array - self.$__.version = VERSION_WHERE; - } -} - -/*! - * Compiles an update and where clause for a `val` with _atomics. - * - * @param {Document} self - * @param {Object} where - * @param {Object} delta - * @param {Object} data - * @param {Array} value - */ - -function handleAtomics(self, where, delta, data, value) { - if (delta.$set && delta.$set[data.path]) { - // $set has precedence over other atomics - return; - } - - if ('function' == typeof value.$__getAtomics) { - value.$__getAtomics().forEach(function(atomic) { - var op = atomic[0]; - var val = atomic[1]; - operand(self, where, delta, data, val, op); - }); - return; - } - - // legacy support for plugins - - var atomics = value._atomics - , ops = Object.keys(atomics) - , i = ops.length - , val - , op; - - if (0 === i) { - // $set - - if (isMongooseObject(value)) { - value = value.toObject({ depopulate: 1 }); - } else if (value.valueOf) { - value = value.valueOf(); - } - - return operand(self, where, delta, data, value); - } - - while (i--) { - op = ops[i]; - val = atomics[op]; - - if (isMongooseObject(val)) { - val = val.toObject({ depopulate: 1 }); - } else if (Array.isArray(val)) { - val = val.map(function(mem) { - return isMongooseObject(mem) - ? mem.toObject({ depopulate: 1 }) - : mem; - }); - } else if (val.valueOf) { - val = val.valueOf(); - } - - if ('$addToSet' === op) - val = { $each: val }; - - operand(self, where, delta, data, val, op); - } -} - -/** - * Produces a special query document of the modified properties used in updates. - * - * @api private - * @method $__delta - * @memberOf Model - */ - -Model.prototype.$__delta = function() { - var dirty = this.$__dirty(); - if (!dirty.length && VERSION_ALL != this.$__.version) return; - - var where = {} - , delta = {} - , len = dirty.length - , divergent = [] - , d = 0; - - where._id = this._doc._id; - - for (; d < len; ++d) { - var data = dirty[d]; - var value = data.value; - - var match = checkDivergentArray(this, data.path, value); - if (match) { - divergent.push(match); - continue; - } - - if (divergent.length) continue; - - if (undefined === value) { - operand(this, where, delta, data, 1, '$unset'); - - } else if (null === value) { - operand(this, where, delta, data, null); - - } else if (value._path && value._atomics) { - // arrays and other custom types (support plugins etc) - handleAtomics(this, where, delta, data, value); - - } else if (value._path && Buffer.isBuffer(value)) { - // MongooseBuffer - value = value.toObject(); - operand(this, where, delta, data, value); - - } else { - value = utils.clone(value, { depopulate: 1 }); - operand(this, where, delta, data, value); - } - } - - if (divergent.length) { - return new DivergentArrayError(divergent); - } - - if (this.$__.version) { - this.$__version(where, delta); - } - - return [where, delta]; -}; - -/*! - * Determine if array was populated with some form of filter and is now - * being updated in a manner which could overwrite data unintentionally. - * - * @see https://github.com/Automattic/mongoose/issues/1334 - * @param {Document} doc - * @param {String} path - * @return {String|undefined} - */ - -function checkDivergentArray(doc, path, array) { - // see if we populated this path - var pop = doc.populated(path, true); - - if (!pop && doc.$__.selected) { - // If any array was selected using an $elemMatch projection, we deny the update. - // NOTE: MongoDB only supports projected $elemMatch on top level array. - var top = path.split('.')[0]; - if ((doc.$__.selected[top] && doc.$__.selected[top].$elemMatch) || - doc.$__.selected[top + '.$']) { - return top; - } - } - - if (!(pop && array && array.isMongooseArray)) return; - - // If the array was populated using options that prevented all - // documents from being returned (match, skip, limit) or they - // deselected the _id field, $pop and $set of the array are - // not safe operations. If _id was deselected, we do not know - // how to remove elements. $pop will pop off the _id from the end - // of the array in the db which is not guaranteed to be the - // same as the last element we have here. $set of the entire array - // would be similarily destructive as we never received all - // elements of the array and potentially would overwrite data. - var check = pop.options.match || - pop.options.options && hasOwnProperty(pop.options.options, 'limit') || // 0 is not permitted - pop.options.options && pop.options.options.skip || // 0 is permitted - pop.options.select && // deselected _id? - (0 === pop.options.select._id || - /\s?-_id\s?/.test(pop.options.select)); - - if (check) { - var atomics = array._atomics; - if (0 === Object.keys(atomics).length || atomics.$set || atomics.$pop) { - return path; - } - } -} - -/** - * Appends versioning to the where and update clauses. - * - * @api private - * @method $__version - * @memberOf Model - */ - -Model.prototype.$__version = function(where, delta) { - var key = this.schema.options.versionKey; - - if (true === where) { - // this is an insert - if (key) this.setValue(key, delta[key] = 0); - return; - } - - // updates - - // only apply versioning if our versionKey was selected. else - // there is no way to select the correct version. we could fail - // fast here and force them to include the versionKey but - // thats a bit intrusive. can we do this automatically? - if (!this.isSelected(key)) { - return; - } - - // $push $addToSet don't need the where clause set - if (VERSION_WHERE === (VERSION_WHERE & this.$__.version)) { - where[key] = this.getValue(key); - } - - if (VERSION_INC === (VERSION_INC & this.$__.version)) { - if (!delta.$set || typeof delta.$set[key] === 'undefined') { - delta.$inc || (delta.$inc = {}); - delta.$inc[key] = 1; - } - } -}; - -/** - * Signal that we desire an increment of this documents version. - * - * ####Example: - * - * Model.findById(id, function (err, doc) { - * doc.increment(); - * doc.save(function (err) { .. }) - * }) - * - * @see versionKeys http://mongoosejs.com/docs/guide.html#versionKey - * @api public - */ - -Model.prototype.increment = function increment() { - this.$__.version = VERSION_ALL; - return this; -}; - -/** - * Returns a query object which applies shardkeys if they exist. - * - * @api private - * @method $__where - * @memberOf Model - */ - -Model.prototype.$__where = function _where(where) { - where || (where = {}); - - var paths - , len; - - if (!where._id) { - where._id = this._doc._id; - } - - if (this.$__.shardval) { - paths = Object.keys(this.$__.shardval); - len = paths.length; - - for (var i = 0; i < len; ++i) { - where[paths[i]] = this.$__.shardval[paths[i]]; - } - } - - if (!this._doc._id) { - return new Error('No _id found on document!'); - } - - return where; -}; - -/** - * Removes this document from the db. - * - * ####Example: - * product.remove(function (err, product) { - * if (err) return handleError(err); - * Product.findById(product._id, function (err, product) { - * console.log(product) // null - * }) - * }) - * - * - * As an extra measure of flow control, remove will return a Promise (bound to `fn` if passed) so it could be chained, or hooked to recive errors - * - * ####Example: - * product.remove().then(function (product) { - * ... - * }).onRejected(function (err) { - * assert.ok(err) - * }) - * - * @param {function(err,product)} [fn] optional callback - * @return {Promise} Promise - * @api public - */ - -Model.prototype.remove = function remove(options, fn) { - var Promise = PromiseProvider.get(); - - if ('function' == typeof options) { - fn = options; - options = undefined; - } - - if (!options) { - options = {}; - } - - if (this.$__.removing) { - if (fn) { - this.$__.removing.then( - function(res) { fn(null, res); }, - function(err) { fn(err); }); - } - return this; - } - - var _this = this; - var promise = this.$__.removing = new Promise.ES6(function(resolve, reject) { - var where = _this.$__where(); - if (where instanceof Error) { - reject(where); - fn && fn(where); - return; - } - - if (!options.safe && _this.schema.options.safe) { - options.safe = _this.schema.options.safe; - } - - _this.collection.remove(where, options, function(err) { - if (!err) { - _this.emit('remove', _this); - resolve(_this); - fn && fn(null, _this); - return; - } - - reject(err); - fn && fn(err); - return; - }); - }); - - return promise; -}; - -/** - * Returns another Model instance. - * - * ####Example: - * - * var doc = new Tank; - * doc.model('User').findById(id, callback); - * - * @param {String} name model name - * @api public - */ - -Model.prototype.model = function model(name) { - return this.db.model(name); -}; - -/** - * Adds a discriminator type. - * - * ####Example: - * - * function BaseSchema() { - * Schema.apply(this, arguments); - * - * this.add({ - * name: String, - * createdAt: Date - * }); - * } - * util.inherits(BaseSchema, Schema); - * - * var PersonSchema = new BaseSchema(); - * var BossSchema = new BaseSchema({ department: String }); - * - * var Person = mongoose.model('Person', PersonSchema); - * var Boss = Person.discriminator('Boss', BossSchema); - * - * @param {String} name discriminator model name - * @param {Schema} schema discriminator model schema - * @api public - */ - -Model.discriminator = function discriminator(name, schema) { - if (!(schema instanceof Schema)) { - throw new Error("You must pass a valid discriminator Schema"); - } - - if (this.schema.discriminatorMapping && !this.schema.discriminatorMapping.isRoot) { - throw new Error("Discriminator \"" + name + - "\" can only be a discriminator of the root model"); - } - - var key = this.schema.options.discriminatorKey; - if (schema.path(key)) { - throw new Error("Discriminator \"" + name + - "\" cannot have field with name \"" + key + "\""); - } - - // merges base schema into new discriminator schema and sets new type field. - (function(schema, baseSchema) { - utils.merge(schema, baseSchema); - - var obj = {}; - obj[key] = { type: String, default: name }; - schema.add(obj); - schema.discriminatorMapping = { key: key, value: name, isRoot: false }; - - if (baseSchema.options.collection) { - schema.options.collection = baseSchema.options.collection; - } - - // throws error if options are invalid - (function(a, b) { - a = utils.clone(a); - b = utils.clone(b); - delete a.toJSON; - delete a.toObject; - delete b.toJSON; - delete b.toObject; - - if (!utils.deepEqual(a, b)) { - throw new Error("Discriminator options are not customizable " + - "(except toJSON & toObject)"); - } - })(schema.options, baseSchema.options); - - var toJSON = schema.options.toJSON - , toObject = schema.options.toObject; - - schema.options = utils.clone(baseSchema.options); - if (toJSON) schema.options.toJSON = toJSON; - if (toObject) schema.options.toObject = toObject; - - schema.callQueue = baseSchema.callQueue.concat(schema.callQueue.slice(schema._defaultMiddleware.length)); - schema._requiredpaths = undefined; // reset just in case Schema#requiredPaths() was called on either schema - })(schema, this.schema); - - if (!this.discriminators) { - this.discriminators = {}; - } - - if (!this.schema.discriminatorMapping) { - this.schema.discriminatorMapping = { key: key, value: null, isRoot: true }; - } - - if (this.discriminators[name]) { - throw new Error("Discriminator with name \"" + name + "\" already exists"); - } - - this.discriminators[name] = this.db.model(name, schema, this.collection.name); - this.discriminators[name].prototype.__proto__ = this.prototype; - - // apply methods and statics - applyMethods(this.discriminators[name], schema); - applyStatics(this.discriminators[name], schema); - - return this.discriminators[name]; -}; - -// Model (class) features - -/*! - * Give the constructor the ability to emit events. - */ - -for (var i in EventEmitter.prototype) - Model[i] = EventEmitter.prototype[i]; - -/** - * Called when the model compiles. - * - * @api private - */ - -Model.init = function init() { - if ((this.schema.options.autoIndex) || - (this.schema.options.autoIndex === null && this.db.config.autoIndex)) { - this.ensureIndexes(); - } - - this.schema.emit('init', this); -}; - -/** - * Sends `ensureIndex` commands to mongo for each index declared in the schema. - * - * ####Example: - * - * Event.ensureIndexes(function (err) { - * if (err) return handleError(err); - * }); - * - * After completion, an `index` event is emitted on this `Model` passing an error if one occurred. - * - * ####Example: - * - * var eventSchema = new Schema({ thing: { type: 'string', unique: true }}) - * var Event = mongoose.model('Event', eventSchema); - * - * Event.on('index', function (err) { - * if (err) console.error(err); // error occurred during index creation - * }) - * - * _NOTE: It is not recommended that you run this in production. Index creation may impact database performance depending on your load. Use with caution._ - * - * The `ensureIndex` commands are not sent in parallel. This is to avoid the `MongoError: cannot add index with a background operation in progress` error. See [this ticket](https://github.com/Automattic/mongoose/issues/1365) for more information. - * - * @param {Function} [cb] optional callback - * @return {Promise} - * @api public - */ - -Model.ensureIndexes = function ensureIndexes(cb) { - var promise = new Promise(cb); - - var indexes = this.schema.indexes(); - if (!indexes.length) { - process.nextTick(promise.fulfill.bind(promise)); - return promise; - } - - // Indexes are created one-by-one to support how MongoDB < 2.4 deals - // with background indexes. - - var self = this; - - var done = function(err) { - self.emit('index', err); - promise.resolve(err); - }; - - var create = function() { - var index = indexes.shift(); - if (!index) return done(); - - var options = index[1]; - self.collection.ensureIndex(index[0], options, tick(function(err) { - if (err) return done(err); - create(); - })); - }; - - create(); - return promise; -}; - -/** - * Schema the model uses. - * - * @property schema - * @receiver Model - * @api public - */ - -Model.schema; - -/*! - * Connection instance the model uses. - * - * @property db - * @receiver Model - * @api public - */ - -Model.db; - -/*! - * Collection the model uses. - * - * @property collection - * @receiver Model - * @api public - */ - -Model.collection; - -/** - * Base Mongoose instance the model uses. - * - * @property base - * @receiver Model - * @api public - */ - -Model.base; - -/** - * Registered discriminators for this model. - * - * @property discriminators - * @receiver Model - * @api public - */ - -Model.discriminators; - -/** - * Removes documents from the collection. - * - * ####Example: - * - * Comment.remove({ title: 'baby born from alien father' }, function (err) { - * - * }); - * - * ####Note: - * - * To remove documents without waiting for a response from MongoDB, do not pass a `callback`, then call `exec` on the returned [Query](#query-js): - * - * var query = Comment.remove({ _id: id }); - * query.exec(); - * - * ####Note: - * - * This method sends a remove command directly to MongoDB, no Mongoose documents are involved. Because no Mongoose documents are involved, _no middleware (hooks) are executed_. - * - * @param {Object} conditions - * @param {Function} [callback] - * @return {Promise} Promise - * @api public - */ - -Model.remove = function remove(conditions, callback) { - if ('function' === typeof conditions) { - callback = conditions; - conditions = {}; - } - - // get the mongodb collection object - var mq = new Query(conditions, {}, this, this.collection); - - return mq.remove(callback); -}; - -/** - * Finds documents - * - * The `conditions` are cast to their respective SchemaTypes before the command is sent. - * - * ####Examples: - * - * // named john and at least 18 - * MyModel.find({ name: 'john', age: { $gte: 18 }}); - * - * // executes immediately, passing results to callback - * MyModel.find({ name: 'john', age: { $gte: 18 }}, function (err, docs) {}); - * - * // name LIKE john and only selecting the "name" and "friends" fields, executing immediately - * MyModel.find({ name: /john/i }, 'name friends', function (err, docs) { }) - * - * // passing options - * MyModel.find({ name: /john/i }, null, { skip: 10 }) - * - * // passing options and executing immediately - * MyModel.find({ name: /john/i }, null, { skip: 10 }, function (err, docs) {}); - * - * // executing a query explicitly - * var query = MyModel.find({ name: /john/i }, null, { skip: 10 }) - * query.exec(function (err, docs) {}); - * - * // using the promise returned from executing a query - * var query = MyModel.find({ name: /john/i }, null, { skip: 10 }); - * var promise = query.exec(); - * promise.addBack(function (err, docs) {}); - * - * @param {Object} conditions - * @param {Object} [projection] optional fields to return (http://bit.ly/1HotzBo) - * @param {Object} [options] optional - * @param {Function} [callback] - * @return {Query} - * @see field selection #query_Query-select - * @see promise #promise-js - * @api public - */ - -Model.find = function find(conditions, projection, options, callback) { - if ('function' == typeof conditions) { - callback = conditions; - conditions = {}; - projection = null; - options = null; - } else if ('function' == typeof projection) { - callback = projection; - projection = null; - options = null; - } else if ('function' == typeof options) { - callback = options; - options = null; - } - - // get the raw mongodb collection object - var mq = new Query({}, options, this, this.collection); - mq.select(projection); - if (this.schema.discriminatorMapping && mq.selectedInclusively()) { - mq.select(this.schema.options.discriminatorKey); - } - - return mq.find(conditions, callback); -}; - -/** - * Finds a single document by its _id field. `findById(id)` is almost* - * equivalent to `findOne({ _id: id })`. - * - * The `id` is cast based on the Schema before sending the command. - * - * Note: `findById()` triggers `findOne` hooks. - * - * * Except for how it treats `undefined`. Because the MongoDB driver - * deletes keys that have value `undefined`, `findById(undefined)` gets - * translated to `findById({ _id: null })`. - * - * ####Example: - * - * // find adventure by id and execute immediately - * Adventure.findById(id, function (err, adventure) {}); - * - * // same as above - * Adventure.findById(id).exec(callback); - * - * // select only the adventures name and length - * Adventure.findById(id, 'name length', function (err, adventure) {}); - * - * // same as above - * Adventure.findById(id, 'name length').exec(callback); - * - * // include all properties except for `length` - * Adventure.findById(id, '-length').exec(function (err, adventure) {}); - * - * // passing options (in this case return the raw js objects, not mongoose documents by passing `lean` - * Adventure.findById(id, 'name', { lean: true }, function (err, doc) {}); - * - * // same as above - * Adventure.findById(id, 'name').lean().exec(function (err, doc) {}); - * - * @param {Object|String|Number} id value of `_id` to query by - * @param {Object} [projection] optional fields to return (http://bit.ly/1HotzBo) - * @param {Object} [options] optional - * @param {Function} [callback] - * @return {Query} - * @see field selection #query_Query-select - * @see lean queries #query_Query-lean - * @api public - */ - -Model.findById = function findById(id, projection, options, callback) { - if (typeof id === 'undefined') { - id = null; - } - return this.findOne({ _id: id }, projection, options, callback); -}; - -/** - * Finds one document. - * - * The `conditions` are cast to their respective SchemaTypes before the command is sent. - * - * ####Example: - * - * // find one iphone adventures - iphone adventures?? - * Adventure.findOne({ type: 'iphone' }, function (err, adventure) {}); - * - * // same as above - * Adventure.findOne({ type: 'iphone' }).exec(function (err, adventure) {}); - * - * // select only the adventures name - * Adventure.findOne({ type: 'iphone' }, 'name', function (err, adventure) {}); - * - * // same as above - * Adventure.findOne({ type: 'iphone' }, 'name').exec(function (err, adventure) {}); - * - * // specify options, in this case lean - * Adventure.findOne({ type: 'iphone' }, 'name', { lean: true }, callback); - * - * // same as above - * Adventure.findOne({ type: 'iphone' }, 'name', { lean: true }).exec(callback); - * - * // chaining findOne queries (same as above) - * Adventure.findOne({ type: 'iphone' }).select('name').lean().exec(callback); - * - * @param {Object} [conditions] - * @param {Object} [projection] optional fields to return (http://bit.ly/1HotzBo) - * @param {Object} [options] optional - * @param {Function} [callback] - * @return {Query} - * @see field selection #query_Query-select - * @see lean queries #query_Query-lean - * @api public - */ - -Model.findOne = function findOne(conditions, projection, options, callback) { - if ('function' == typeof options) { - callback = options; - options = null; - } else if ('function' == typeof projection) { - callback = projection; - projection = null; - options = null; - } else if ('function' == typeof conditions) { - callback = conditions; - conditions = {}; - projection = null; - options = null; - } - - // get the mongodb collection object - var mq = new Query({}, options, this, this.collection); - mq.select(projection); - if (this.schema.discriminatorMapping && mq.selectedInclusively()) { - mq.select(this.schema.options.discriminatorKey); - } - - return mq.findOne(conditions, callback); -}; - -/** - * Counts number of matching documents in a database collection. - * - * ####Example: - * - * Adventure.count({ type: 'jungle' }, function (err, count) { - * if (err) .. - * console.log('there are %d jungle adventures', count); - * }); - * - * @param {Object} conditions - * @param {Function} [callback] - * @return {Query} - * @api public - */ - -Model.count = function count(conditions, callback) { - if ('function' === typeof conditions) - callback = conditions, conditions = {}; - - // get the mongodb collection object - var mq = new Query({}, {}, this, this.collection); - - return mq.count(conditions, callback); -}; - -/** - * Creates a Query for a `distinct` operation. - * - * Passing a `callback` immediately executes the query. - * - * ####Example - * - * Link.distinct('url', { clicks: {$gt: 100}}, function (err, result) { - * if (err) return handleError(err); - * - * assert(Array.isArray(result)); - * console.log('unique urls with more than 100 clicks', result); - * }) - * - * var query = Link.distinct('url'); - * query.exec(callback); - * - * @param {String} field - * @param {Object} [conditions] optional - * @param {Function} [callback] - * @return {Query} - * @api public - */ - -Model.distinct = function distinct(field, conditions, callback) { - // get the mongodb collection object - var mq = new Query({}, {}, this, this.collection); - - if ('function' == typeof conditions) { - callback = conditions; - conditions = {}; - } - - return mq.distinct(field, conditions, callback); -}; - -/** - * Creates a Query, applies the passed conditions, and returns the Query. - * - * For example, instead of writing: - * - * User.find({age: {$gte: 21, $lte: 65}}, callback); - * - * we can instead write: - * - * User.where('age').gte(21).lte(65).exec(callback); - * - * Since the Query class also supports `where` you can continue chaining - * - * User - * .where('age').gte(21).lte(65) - * .where('name', /^b/i) - * ... etc - * - * @param {String} path - * @param {Object} [val] optional value - * @return {Query} - * @api public - */ - -Model.where = function where(path, val) { - // get the mongodb collection object - var mq = new Query({}, {}, this, this.collection).find({}); - return mq.where.apply(mq, arguments); -}; - -/** - * Creates a `Query` and specifies a `$where` condition. - * - * Sometimes you need to query for things in mongodb using a JavaScript expression. You can do so via `find({ $where: javascript })`, or you can use the mongoose shortcut method $where via a Query chain or from your mongoose Model. - * - * Blog.$where('this.comments.length > 5').exec(function (err, docs) {}); - * - * @param {String|Function} argument is a javascript string or anonymous function - * @method $where - * @memberOf Model - * @return {Query} - * @see Query.$where #query_Query-%24where - * @api public - */ - -Model.$where = function $where() { - var mq = new Query({}, {}, this, this.collection).find({}); - return mq.$where.apply(mq, arguments); -}; - -/** - * Issues a mongodb findAndModify update command. - * - * Finds a matching document, updates it according to the `update` arg, passing any `options`, and returns the found document (if any) to the callback. The query executes immediately if `callback` is passed else a Query object is returned. - * - * ####Options: - * - * - `new`: bool - if true, return the modified document rather than the original. defaults to false (changed in 4.0) - * - `upsert`: bool - creates the object if it doesn't exist. defaults to false. - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - `select`: sets the document fields to return - * - * ####Examples: - * - * A.findOneAndUpdate(conditions, update, options, callback) // executes - * A.findOneAndUpdate(conditions, update, options) // returns Query - * A.findOneAndUpdate(conditions, update, callback) // executes - * A.findOneAndUpdate(conditions, update) // returns Query - * A.findOneAndUpdate() // returns Query - * - * ####Note: - * - * All top level update keys which are not `atomic` operation names are treated as set operations: - * - * ####Example: - * - * var query = { name: 'borne' }; - * Model.findOneAndUpdate(query, { name: 'jason borne' }, options, callback) - * - * // is sent as - * Model.findOneAndUpdate(query, { $set: { name: 'jason borne' }}, options, callback) - * - * This helps prevent accidentally overwriting your document with `{ name: 'jason borne' }`. - * - * ####Note: - * - * Values are cast to their appropriate types when using the findAndModify helpers. - * However, the below are never executed. - * - * - defaults - * - setters - * - * `findAndModify` helpers support limited defaults and validation. You can - * enable these by setting the `setDefaultsOnInsert` and `runValidators` options, - * respectively. - * - * If you need full-fledged validation, use the traditional approach of first - * retrieving the document. - * - * Model.findById(id, function (err, doc) { - * if (err) .. - * doc.name = 'jason borne'; - * doc.save(callback); - * }); - * - * @param {Object} [conditions] - * @param {Object} [update] - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @api public - */ - -Model.findOneAndUpdate = function(conditions, update, options, callback) { - if ('function' == typeof options) { - callback = options; - options = null; - } - else if (1 === arguments.length) { - if ('function' == typeof conditions) { - var msg = 'Model.findOneAndUpdate(): First argument must not be a function.\n\n' - + ' ' + this.modelName + '.findOneAndUpdate(conditions, update, options, callback)\n' - + ' ' + this.modelName + '.findOneAndUpdate(conditions, update, options)\n' - + ' ' + this.modelName + '.findOneAndUpdate(conditions, update)\n' - + ' ' + this.modelName + '.findOneAndUpdate(update)\n' - + ' ' + this.modelName + '.findOneAndUpdate()\n'; - throw new TypeError(msg); - } - update = conditions; - conditions = undefined; - } - - var fields; - if (options && options.fields) { - fields = options.fields; - options.fields = undefined; - } - - update = utils.clone(update, { depopulate: 1 }); - if (this.schema.options.versionKey && options && options.upsert) { - if (!update.$setOnInsert) { - update.$setOnInsert = {}; - } - update.$setOnInsert[this.schema.options.versionKey] = 0; - } - - var mq = new Query({}, {}, this, this.collection); - mq.select(fields); - - return mq.findOneAndUpdate(conditions, update, options, callback); -}; - -/** - * Issues a mongodb findAndModify update command by a document's _id field. - * `findByIdAndUpdate(id, ...)` is equivalent to `findOneAndUpdate({ _id: id }, ...)`. - * - * Finds a matching document, updates it according to the `update` arg, - * passing any `options`, and returns the found document (if any) to the - * callback. The query executes immediately if `callback` is passed else a - * Query object is returned. - * - * This function triggers `findOneAndUpdate` middleware. - * - * ####Options: - * - * - `new`: bool - true to return the modified document rather than the original. defaults to false - * - `upsert`: bool - creates the object if it doesn't exist. defaults to false. - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - `select`: sets the document fields to return - * - * ####Examples: - * - * A.findByIdAndUpdate(id, update, options, callback) // executes - * A.findByIdAndUpdate(id, update, options) // returns Query - * A.findByIdAndUpdate(id, update, callback) // executes - * A.findByIdAndUpdate(id, update) // returns Query - * A.findByIdAndUpdate() // returns Query - * - * ####Note: - * - * All top level update keys which are not `atomic` operation names are treated as set operations: - * - * ####Example: - * - * Model.findByIdAndUpdate(id, { name: 'jason borne' }, options, callback) - * - * // is sent as - * Model.findByIdAndUpdate(id, { $set: { name: 'jason borne' }}, options, callback) - * - * This helps prevent accidentally overwriting your document with `{ name: 'jason borne' }`. - * - * ####Note: - * - * Values are cast to their appropriate types when using the findAndModify helpers. - * However, the below are never executed. - * - * - defaults - * - setters - * - * `findAndModify` helpers support limited defaults and validation. You can - * enable these by setting the `setDefaultsOnInsert` and `runValidators` options, - * respectively. - * - * If you need full-fledged validation, use the traditional approach of first - * retrieving the document. - * - * Model.findById(id, function (err, doc) { - * if (err) .. - * doc.name = 'jason borne'; - * doc.save(callback); - * }); - * - * @param {Object|Number|String} id value of `_id` to query by - * @param {Object} [update] - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} - * @see Model.findOneAndUpdate #model_Model.findOneAndUpdate - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @api public - */ - -Model.findByIdAndUpdate = function(id, update, options, callback) { - var args; - if (1 === arguments.length) { - if ('function' == typeof id) { - var msg = 'Model.findByIdAndUpdate(): First argument must not be a function.\n\n' - + ' ' + this.modelName + '.findByIdAndUpdate(id, callback)\n' - + ' ' + this.modelName + '.findByIdAndUpdate(id)\n' - + ' ' + this.modelName + '.findByIdAndUpdate()\n'; - throw new TypeError(msg); - } - return this.findOneAndUpdate({_id: id }, undefined); - } - - args = utils.args(arguments, 1); - - // if a model is passed in instead of an id - if (id instanceof Document) { - id = id._id; - } - if (id) { - args.unshift({ _id: id }); - } - return this.findOneAndUpdate.apply(this, args); -}; - -/** - * Issue a mongodb findAndModify remove command. - * - * Finds a matching document, removes it, passing the found document (if any) to the callback. - * - * Executes immediately if `callback` is passed else a Query object is returned. - * - * ####Options: - * - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - `select`: sets the document fields to return - * - * ####Examples: - * - * A.findOneAndRemove(conditions, options, callback) // executes - * A.findOneAndRemove(conditions, options) // return Query - * A.findOneAndRemove(conditions, callback) // executes - * A.findOneAndRemove(conditions) // returns Query - * A.findOneAndRemove() // returns Query - * - * Values are cast to their appropriate types when using the findAndModify helpers. - * However, the below are never executed. - * - * - defaults - * - setters - * - * `findAndModify` helpers support limited defaults and validation. You can - * enable these by setting the `setDefaultsOnInsert` and `runValidators` options, - * respectively. - * - * If you need full-fledged validation, use the traditional approach of first - * retrieving the document. - * - * Model.findById(id, function (err, doc) { - * if (err) .. - * doc.name = 'jason borne'; - * doc.save(callback); - * }); - * - * @param {Object} conditions - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @api public - */ - -Model.findOneAndRemove = function(conditions, options, callback) { - if (1 === arguments.length && 'function' == typeof conditions) { - var msg = 'Model.findOneAndRemove(): First argument must not be a function.\n\n' - + ' ' + this.modelName + '.findOneAndRemove(conditions, callback)\n' - + ' ' + this.modelName + '.findOneAndRemove(conditions)\n' - + ' ' + this.modelName + '.findOneAndRemove()\n'; - throw new TypeError(msg); - } - - if ('function' == typeof options) { - callback = options; - options = undefined; - } - - var fields; - if (options) { - fields = options.select; - options.select = undefined; - } - - var mq = new Query({}, {}, this, this.collection); - mq.select(fields); - - return mq.findOneAndRemove(conditions, options, callback); -}; - -/** - * Issue a mongodb findAndModify remove command by a document's _id field. `findByIdAndRemove(id, ...)` is equivalent to `findOneAndRemove({ _id: id }, ...)`. - * - * Finds a matching document, removes it, passing the found document (if any) to the callback. - * - * Executes immediately if `callback` is passed, else a `Query` object is returned. - * - * ####Options: - * - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - `select`: sets the document fields to return - * - * ####Examples: - * - * A.findByIdAndRemove(id, options, callback) // executes - * A.findByIdAndRemove(id, options) // return Query - * A.findByIdAndRemove(id, callback) // executes - * A.findByIdAndRemove(id) // returns Query - * A.findByIdAndRemove() // returns Query - * - * @param {Object|Number|String} id value of `_id` to query by - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} - * @see Model.findOneAndRemove #model_Model.findOneAndRemove - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - */ - -Model.findByIdAndRemove = function(id, options, callback) { - if (1 === arguments.length && 'function' == typeof id) { - var msg = 'Model.findByIdAndRemove(): First argument must not be a function.\n\n' - + ' ' + this.modelName + '.findByIdAndRemove(id, callback)\n' - + ' ' + this.modelName + '.findByIdAndRemove(id)\n' - + ' ' + this.modelName + '.findByIdAndRemove()\n'; - throw new TypeError(msg); - } - - return this.findOneAndRemove({ _id: id }, options, callback); -}; - -/** - * Shortcut for creating a new Document that is automatically saved to the db if valid. - * - * ####Example: - * - * // pass individual docs - * Candy.create({ type: 'jelly bean' }, { type: 'snickers' }, function (err, jellybean, snickers) { - * if (err) // ... - * }); - * - * // pass an array - * var array = [{ type: 'jelly bean' }, { type: 'snickers' }]; - * Candy.create(array, function (err, candies) { - * if (err) // ... - * - * var jellybean = candies[0]; - * var snickers = candies[1]; - * // ... - * }); - * - * // callback is optional; use the returned promise if you like: - * var promise = Candy.create({ type: 'jawbreaker' }); - * promise.then(function (jawbreaker) { - * // ... - * }) - * - * @param {Array|Object...} doc(s) - * @param {Function} [callback] callback - * @return {Promise} - * @api public - */ - -Model.create = function create(doc, callback) { - var args - , cb; - - if (Array.isArray(doc)) { - args = doc; - cb = callback; - } else { - var last = arguments[arguments.length - 1]; - if ('function' == typeof last) { - cb = last; - args = utils.args(arguments, 0, arguments.length - 1); - } else { - args = utils.args(arguments); - } - } - - var Promise = PromiseProvider.get(); - var ModelConstructor = this; - - var promise = new Promise.ES6(function(resolve, reject) { - if (args.length === 0) { - process.nextTick(function() { - cb && cb(null); - resolve(null); - }); - return; - } - - var toExecute = []; - args.forEach(function(doc) { - toExecute.push(function(callback) { - (new ModelConstructor(doc)).save().then(function(doc) { - callback(null, doc); - }, function(error) { - callback(error); - }); - }); - }); - - async.parallel(toExecute, function(error, savedDocs) { - if (error) { - cb && cb(error); - reject(error); - return; - } - - if (doc instanceof Array) { - resolve(savedDocs); - cb && cb.call(ModelConstructor, null, savedDocs); - } else { - resolve.apply(promise, savedDocs); - if (cb) { - savedDocs.unshift(null); - cb.apply(ModelConstructor, savedDocs); - } - } - }); - }); - - return promise; -}; - -/** - * Shortcut for creating a new Document from existing raw data, pre-saved in the DB. - * The document returned has no paths marked as modified initially. - * - * ####Example: - * - * // hydrate previous data into a Mongoose document - * var mongooseCandy = Candy.hydrate({ _id: '54108337212ffb6d459f854c', type: 'jelly bean' }); - * - * @param {Object} obj - * @return {Document} - * @api public - */ - -Model.hydrate = function(obj) { - var model = require('./queryhelpers').createModel(this, obj); - model.init(obj); - return model; -}; - -/** - * Updates documents in the database without returning them. - * - * ####Examples: - * - * MyModel.update({ age: { $gt: 18 } }, { oldEnough: true }, fn); - * MyModel.update({ name: 'Tobi' }, { ferret: true }, { multi: true }, function (err, raw) { - * if (err) return handleError(err); - * console.log('The raw response from Mongo was ', raw); - * }); - * - * ####Valid options: - * - * - `safe` (boolean) safe mode (defaults to value set in schema (true)) - * - `upsert` (boolean) whether to create the doc if it doesn't match (false) - * - `multi` (boolean) whether multiple documents should be updated (false) - * - `strict` (boolean) overrides the `strict` option for this update - * - `overwrite` (boolean) disables update-only mode, allowing you to overwrite the doc (false) - * - * All `update` values are cast to their appropriate SchemaTypes before being sent. - * - * The `callback` function receives `(err, rawResponse)`. - * - * - `err` is the error if any occurred - * - `rawResponse` is the full response from Mongo - * - * ####Note: - * - * All top level keys which are not `atomic` operation names are treated as set operations: - * - * ####Example: - * - * var query = { name: 'borne' }; - * Model.update(query, { name: 'jason borne' }, options, callback) - * - * // is sent as - * Model.update(query, { $set: { name: 'jason borne' }}, options, callback) - * // if overwrite option is false. If overwrite is true, sent without the $set wrapper. - * - * This helps prevent accidentally overwriting all documents in your collection with `{ name: 'jason borne' }`. - * - * ####Note: - * - * Be careful to not use an existing model instance for the update clause (this won't work and can cause weird behavior like infinite loops). Also, ensure that the update clause does not have an _id property, which causes Mongo to return a "Mod on _id not allowed" error. - * - * ####Note: - * - * To update documents without waiting for a response from MongoDB, do not pass a `callback`, then call `exec` on the returned [Query](#query-js): - * - * Comment.update({ _id: id }, { $set: { text: 'changed' }}).exec(); - * - * ####Note: - * - * Although values are casted to their appropriate types when using update, the following are *not* applied: - * - * - defaults - * - setters - * - validators - * - middleware - * - * If you need those features, use the traditional approach of first retrieving the document. - * - * Model.findOne({ name: 'borne' }, function (err, doc) { - * if (err) .. - * doc.name = 'jason borne'; - * doc.save(callback); - * }) - * - * @see strict http://mongoosejs.com/docs/guide.html#strict - * @see response http://docs.mongodb.org/v2.6/reference/command/update/#output - * @param {Object} conditions - * @param {Object} doc - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} - * @api public - */ - -Model.update = function update(conditions, doc, options, callback) { - var mq = new Query({}, {}, this, this.collection); - // gh-2406 - // make local deep copy of conditions - if (conditions instanceof Document) { - conditions = conditions.toObject(); - } else { - conditions = utils.clone(conditions, { retainKeyOrder: true }); - } - options = typeof options === 'function' ? options : utils.clone(options); - - return mq.update(conditions, doc, options, callback); -}; - -/** - * Executes a mapReduce command. - * - * `o` is an object specifying all mapReduce options as well as the map and reduce functions. All options are delegated to the driver implementation. See [node-mongodb-native mapReduce() documentation](http://mongodb.github.io/node-mongodb-native/api-generated/collection.html#mapreduce) for more detail about options. - * - * ####Example: - * - * var o = {}; - * o.map = function () { emit(this.name, 1) } - * o.reduce = function (k, vals) { return vals.length } - * User.mapReduce(o, function (err, results) { - * console.log(results) - * }) - * - * ####Other options: - * - * - `query` {Object} query filter object. - * - `sort` {Object} sort input objects using this key - * - `limit` {Number} max number of documents - * - `keeptemp` {Boolean, default:false} keep temporary data - * - `finalize` {Function} finalize function - * - `scope` {Object} scope variables exposed to map/reduce/finalize during execution - * - `jsMode` {Boolean, default:false} it is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X - * - `verbose` {Boolean, default:false} provide statistics on job execution time. - * - `readPreference` {String} - * - `out*` {Object, default: {inline:1}} sets the output target for the map reduce job. - * - * ####* out options: - * - * - `{inline:1}` the results are returned in an array - * - `{replace: 'collectionName'}` add the results to collectionName: the results replace the collection - * - `{reduce: 'collectionName'}` add the results to collectionName: if dups are detected, uses the reducer / finalize functions - * - `{merge: 'collectionName'}` add the results to collectionName: if dups exist the new docs overwrite the old - * - * If `options.out` is set to `replace`, `merge`, or `reduce`, a Model instance is returned that can be used for further querying. Queries run against this model are all executed with the `lean` option; meaning only the js object is returned and no Mongoose magic is applied (getters, setters, etc). - * - * ####Example: - * - * var o = {}; - * o.map = function () { emit(this.name, 1) } - * o.reduce = function (k, vals) { return vals.length } - * o.out = { replace: 'createdCollectionNameForResults' } - * o.verbose = true; - * - * User.mapReduce(o, function (err, model, stats) { - * console.log('map reduce took %d ms', stats.processtime) - * model.find().where('value').gt(10).exec(function (err, docs) { - * console.log(docs); - * }); - * }) - * - * // a promise is returned so you may instead write - * var promise = User.mapReduce(o); - * promise.then(function (model, stats) { - * console.log('map reduce took %d ms', stats.processtime) - * return model.find().where('value').gt(10).exec(); - * }).then(function (docs) { - * console.log(docs); - * }).then(null, handleError).end() - * - * @param {Object} o an object specifying map-reduce options - * @param {Function} [callback] optional callback - * @see http://www.mongodb.org/display/DOCS/MapReduce - * @return {Promise} - * @api public - */ - -Model.mapReduce = function mapReduce(o, callback) { - var promise = new Promise(callback); - var self = this; - - if (!Model.mapReduce.schema) { - var opts = { noId: true, noVirtualId: true, strict: false }; - Model.mapReduce.schema = new Schema({}, opts); - } - - if (!o.out) o.out = { inline: 1 }; - if (false !== o.verbose) o.verbose = true; - - o.map = String(o.map); - o.reduce = String(o.reduce); - - if (o.query) { - var q = new Query(o.query); - q.cast(this); - o.query = q._conditions; - q = undefined; - } - - this.collection.mapReduce(null, null, o, function(err, ret, stats) { - if (err) return promise.error(err); - - if (ret.findOne && ret.mapReduce) { - // returned a collection, convert to Model - var model = Model.compile( - '_mapreduce_' + ret.collectionName - , Model.mapReduce.schema - , ret.collectionName - , self.db - , self.base); - - model._mapreduce = true; - - return promise.fulfill(model, stats); - } - - promise.fulfill(ret, stats); - }); - - return promise; -}; - -/** - * geoNear support for Mongoose - * - * ####Options: - * - `lean` {Boolean} return the raw object - * - All options supported by the driver are also supported - * - * ####Example: - * - * // Legacy point - * Model.geoNear([1,3], { maxDistance : 5, spherical : true }, function(err, results, stats) { - * console.log(results); - * }); - * - * // geoJson - * var point = { type : "Point", coordinates : [9,9] }; - * Model.geoNear(point, { maxDistance : 5, spherical : true }, function(err, results, stats) { - * console.log(results); - * }); - * - * @param {Object/Array} GeoJSON point or legacy coordinate pair [x,y] to search near - * @param {Object} options for the qurery - * @param {Function} [callback] optional callback for the query - * @return {Promise} - * @see http://docs.mongodb.org/manual/core/2dsphere/ - * @see http://mongodb.github.io/node-mongodb-native/api-generated/collection.html?highlight=geonear#geoNear - * @api public - */ - -Model.geoNear = function(near, options, callback) { - if ('function' == typeof options) { - callback = options; - options = {}; - } - - var self = this; - var promise = new Promise(callback); - if (!near) { - promise.error(new Error("Must pass a near option to geoNear")); - return promise; - } - - var x,y; - - var handler = function(err, res) { - if (err) return promise.error(err); - if (options.lean) return promise.fulfill(res.results, res.stats); - - var count = res.results.length; - // if there are no results, fulfill the promise now - if (count == 0) { - return promise.fulfill(res.results, res.stats); - } - - var errSeen = false; - for (var i = 0; i < res.results.length; i++) { - var temp = res.results[i].obj; - res.results[i].obj = new self(); - res.results[i].obj.init(temp, function(err) { - if (err && !errSeen) { - errSeen = true; - return promise.error(err); - } - --count || promise.fulfill(res.results, res.stats); - }); - } - }; - - if (Array.isArray(near)) { - if (near.length != 2) { - promise.error(new Error("If using legacy coordinates, must be an array of size 2 for geoNear")); - return promise; - } - x = near[0]; - y = near[1]; - this.collection.geoNear(x, y, options, handler); - } else { - if (near.type != "Point" || !Array.isArray(near.coordinates)) { - promise.error(new Error("Must pass either a legacy coordinate array or GeoJSON Point to geoNear")); - return promise; - } - - this.collection.geoNear(near, options, handler); - } - - return promise; -}; - -/** - * Performs [aggregations](http://docs.mongodb.org/manual/applications/aggregation/) on the models collection. - * - * If a `callback` is passed, the `aggregate` is executed and a `Promise` is returned. If a callback is not passed, the `aggregate` itself is returned. - * - * ####Example: - * - * // Find the max balance of all accounts - * Users.aggregate( - * { $group: { _id: null, maxBalance: { $max: '$balance' }}} - * , { $project: { _id: 0, maxBalance: 1 }} - * , function (err, res) { - * if (err) return handleError(err); - * console.log(res); // [ { maxBalance: 98000 } ] - * }); - * - * // Or use the aggregation pipeline builder. - * Users.aggregate() - * .group({ _id: null, maxBalance: { $max: '$balance' } }) - * .select('-id maxBalance') - * .exec(function (err, res) { - * if (err) return handleError(err); - * console.log(res); // [ { maxBalance: 98 } ] - * }); - * - * ####NOTE: - * - * - Arguments are not cast to the model's schema because `$project` operators allow redefining the "shape" of the documents at any stage of the pipeline, which may leave documents in an incompatible format. - * - The documents returned are plain javascript objects, not mongoose documents (since any shape of document can be returned). - * - Requires MongoDB >= 2.1 - * - * @see Aggregate #aggregate_Aggregate - * @see MongoDB http://docs.mongodb.org/manual/applications/aggregation/ - * @param {Object|Array} [...] aggregation pipeline operator(s) or operator array - * @param {Function} [callback] - * @return {Aggregate|Promise} - * @api public - */ - -Model.aggregate = function aggregate() { - var args = [].slice.call(arguments) - , aggregate - , callback; - - if ('function' === typeof args[args.length - 1]) { - callback = args.pop(); - } - - if (1 === args.length && util.isArray(args[0])) { - aggregate = new Aggregate(args[0]); - } else { - aggregate = new Aggregate(args); - } - - aggregate.model(this); - - if ('undefined' === typeof callback) { - return aggregate; - } - - return aggregate.exec(callback); -}; - -/** - * Implements `$geoSearch` functionality for Mongoose - * - * ####Example: - * - * var options = { near: [10, 10], maxDistance: 5 }; - * Locations.geoSearch({ type : "house" }, options, function(err, res) { - * console.log(res); - * }); - * - * ####Options: - * - `near` {Array} x,y point to search for - * - `maxDistance` {Number} the maximum distance from the point near that a result can be - * - `limit` {Number} The maximum number of results to return - * - `lean` {Boolean} return the raw object instead of the Mongoose Model - * - * @param {Object} condition an object that specifies the match condition (required) - * @param {Object} options for the geoSearch, some (near, maxDistance) are required - * @param {Function} [callback] optional callback - * @return {Promise} - * @see http://docs.mongodb.org/manual/reference/command/geoSearch/ - * @see http://docs.mongodb.org/manual/core/geohaystack/ - * @api public - */ - -Model.geoSearch = function(conditions, options, callback) { - if ('function' == typeof options) { - callback = options; - options = {}; - } - - var promise = new Promise(callback); - - if (conditions == undefined || !utils.isObject(conditions)) { - return promise.error(new Error("Must pass conditions to geoSearch")); - } - - if (!options.near) { - return promise.error(new Error("Must specify the near option in geoSearch")); - } - - if (!Array.isArray(options.near)) { - return promise.error(new Error("near option must be an array [x, y]")); - } - - - // send the conditions in the options object - options.search = conditions; - var self = this; - - this.collection.geoHaystackSearch(options.near[0], options.near[1], options, function(err, res) { - // have to deal with driver problem. Should be fixed in a soon-ish release - // (7/8/2013) - if (err || res.errmsg) { - if (!err) err = new Error(res.errmsg); - if (res && res.code !== undefined) err.code = res.code; - return promise.error(err); - } - - var count = res.results.length; - if (options.lean || (count == 0)) return promise.fulfill(res.results, res.stats); - - var errSeen = false; - for (var i = 0; i < res.results.length; i++) { - var temp = res.results[i]; - res.results[i] = new self(); - res.results[i].init(temp, {}, function(err) { - if (err && !errSeen) { - errSeen = true; - return promise.error(err); - } - - --count || (!errSeen && promise.fulfill(res.results, res.stats)); - }); - } - }); - - return promise; -}; - -/** - * Populates document references. - * - * ####Available options: - * - * - path: space delimited path(s) to populate - * - select: optional fields to select - * - match: optional query conditions to match - * - model: optional name of the model to use for population - * - options: optional query options like sort, limit, etc - * - * ####Examples: - * - * // populates a single object - * User.findById(id, function (err, user) { - * var opts = [ - * { path: 'company', match: { x: 1 }, select: 'name' } - * , { path: 'notes', options: { limit: 10 }, model: 'override' } - * ] - * - * User.populate(user, opts, function (err, user) { - * console.log(user); - * }) - * }) - * - * // populates an array of objects - * User.find(match, function (err, users) { - * var opts = [{ path: 'company', match: { x: 1 }, select: 'name' }] - * - * var promise = User.populate(users, opts); - * promise.then(console.log).end(); - * }) - * - * // imagine a Weapon model exists with two saved documents: - * // { _id: 389, name: 'whip' } - * // { _id: 8921, name: 'boomerang' } - * - * var user = { name: 'Indiana Jones', weapon: 389 } - * Weapon.populate(user, { path: 'weapon', model: 'Weapon' }, function (err, user) { - * console.log(user.weapon.name) // whip - * }) - * - * // populate many plain objects - * var users = [{ name: 'Indiana Jones', weapon: 389 }] - * users.push({ name: 'Batman', weapon: 8921 }) - * Weapon.populate(users, { path: 'weapon' }, function (err, users) { - * users.forEach(function (user) { - * console.log('%s uses a %s', users.name, user.weapon.name) - * // Indiana Jones uses a whip - * // Batman uses a boomerang - * }) - * }) - * // Note that we didn't need to specify the Weapon model because - * // we were already using it's populate() method. - * - * @param {Document|Array} docs Either a single document or array of documents to populate. - * @param {Object} options A hash of key/val (path, options) used for population. - * @param {Function} [cb(err,doc)] Optional callback, executed upon completion. Receives `err` and the `doc(s)`. - * @return {Promise} - * @api public - */ - -Model.populate = function(docs, paths, cb) { - var promise = new Promise(cb); - - // always resolve on nextTick for consistent async behavior - function resolve() { - var args = utils.args(arguments); - - process.nextTick(function() { - promise.resolve.apply(promise, args); - }); - } - - // normalized paths - paths = utils.populate(paths); - var pending = paths.length; - - if (0 === pending) { - resolve(null, docs); - return promise; - } - - // each path has its own query options and must be executed separately - var i = pending; - var path; - var model = this; - while (i--) { - path = paths[i]; - if ('function' === typeof path.model) model = path.model; - populate(model, docs, path, subPopulate.call(model, docs, path, next)); - } - - return promise; - - function next(err) { - if (err) return resolve(err); - if (--pending) return; - resolve(null, docs); - } -}; - -/*! - * Populates deeply if `populate` option is present. - * - * @param {Document|Array} docs - * @param {Object} options - * @param {Function} cb - * @return {Function} - * @api private - */ -function subPopulate(docs, options, cb) { - var model = this; - var prefix = options.path + '.'; - var pop = options.populate; - - if (!pop) { - return cb; - } - - // normalize as array - if (!Array.isArray(pop)) { - pop = [pop]; - } - - return function(err) { - var pending = pop.length; - - function next(err) { - if (err) return cb(err); - if (--pending) return; - cb(); - } - - if (err || !pending) return cb(err); - - pop.forEach(function(subOptions) { - // path needs parent's path prefixed to it - if (!subOptions._originalPath) { - subOptions._originalPath = subOptions.path; - subOptions.path = prefix + subOptions.path; - } - if (typeof subOptions.model === 'string') { - subOptions.model = model.model(subOptions.model); - } - Model.populate.call(subOptions.model || model, docs, subOptions, next); - }); - }; -} - -/*! - * Populates `docs` - */ -var excludeIdReg = /\s?-_id\s?/, - excludeIdRegGlobal = /\s?-_id\s?/g; - -function populate(model, docs, options, cb) { - var modelsMap, rawIds; - - // normalize single / multiple docs passed - if (!Array.isArray(docs)) { - docs = [docs]; - } - - if (0 === docs.length || docs.every(utils.isNullOrUndefined)) { - return cb(); - } - - modelsMap = getModelsMapForPopulate(model, docs, options); - rawIds = getIdsForAndAddIdsInMapPopulate(modelsMap); - - var i, len = modelsMap.length, - mod, match, select, promise, vals = []; - - promise = new Promise(function(err, vals, options, assignmentOpts) { - if (err) return cb(err); - - var lean = options.options && options.options.lean, - len = vals.length, - rawOrder = {}, rawDocs = {}, key, val; - - // optimization: - // record the document positions as returned by - // the query result. - for (var i = 0; i < len; i++) { - val = vals[i]; - key = String(utils.getValue('_id', val)); - rawDocs[key] = val; - rawOrder[key] = i; - - // flag each as result of population - if (!lean) val.$__.wasPopulated = true; - } - - assignVals({ - rawIds: rawIds, - rawDocs: rawDocs, - rawOrder: rawOrder, - docs: docs, - path: options.path, - options: assignmentOpts - }); - cb(); - }); - - var _remaining = len; - for (i = 0; i < len; i++) { - mod = modelsMap[i]; - select = mod.options.select; - - if (mod.options.match) { - match = utils.object.shallowCopy(mod.options.match); - } else { - match = {}; - } - - var ids = utils.array.flatten(mod.ids, function(item) { - // no need to include undefined values in our query - return undefined !== item; - }); - - ids = utils.array.unique(ids); - - if (0 === ids.length || ids.every(utils.isNullOrUndefined)) { - return cb(); - } - - match._id || (match._id = { - $in: ids - }); - - var assignmentOpts = {}; - assignmentOpts.sort = mod.options.options && mod.options.options.sort || undefined; - assignmentOpts.excludeId = excludeIdReg.test(select) || (select && 0 === select._id); - - if (assignmentOpts.excludeId) { - // override the exclusion from the query so we can use the _id - // for document matching during assignment. we'll delete the - // _id back off before returning the result. - if ('string' == typeof select) { - select = select.replace(excludeIdRegGlobal, ' '); - } else { - // preserve original select conditions by copying - select = utils.object.shallowCopy(select); - delete select._id; - } - } - - if (mod.options.options && mod.options.options.limit) { - assignmentOpts.originalLimit = mod.options.options.limit; - mod.options.options.limit = mod.options.options.limit * ids.length; - } - - mod.Model.find(match, select, mod.options.options, next.bind(this, mod.options, assignmentOpts)); - } - - function next(options, assignmentOpts, err, valsFromDb) { - if (err) return promise.resolve(err); - vals = vals.concat(valsFromDb); - if (--_remaining === 0) { - promise.resolve(err, vals, options, assignmentOpts); - } - } -} - -function getModelsMapForPopulate(model, docs, options) { - var i, doc, len = docs.length, - available = {}, - map = [], - modelNameFromQuery = options.model && options.model.modelName || options.model, - schema, refPath, Model, currentOptions, modelNames, modelName, discriminatorKey, modelForFindSchema; - - schema = model._getSchema(options.path); - - if (schema && schema.caster) { - schema = schema.caster; - } - - if (!schema && model.discriminators) { - discriminatorKey = model.schema.discriminatorMapping.key; - } - - refPath = schema && schema.options && schema.options.refPath; - - for (i = 0; i < len; i++) { - doc = docs[i]; - - if (refPath) { - modelNames = utils.getValue(refPath, doc); - } else { - if (!modelNameFromQuery) { - var schemaForCurrentDoc; - - if (!schema && discriminatorKey) { - modelForFindSchema = utils.getValue(discriminatorKey, doc); - - if (modelForFindSchema) { - schemaForCurrentDoc = model.db.model(modelForFindSchema)._getSchema(options.path); - - if (schemaForCurrentDoc && schemaForCurrentDoc.caster) { - schemaForCurrentDoc = schemaForCurrentDoc.caster; - } - } - } else { - schemaForCurrentDoc = schema; - } - - modelNames = [ - schemaForCurrentDoc && schemaForCurrentDoc.options && schemaForCurrentDoc.options.ref // declared in schema - || model.modelName // an ad-hoc structure - ]; - } else { - modelNames = [modelNameFromQuery]; // query options - } - } - - if (!modelNames) - continue; - - if (!Array.isArray(modelNames)) { - modelNames = [modelNames]; - } - - var k = modelNames.length; - while (k--) { - modelName = modelNames[k]; - if (!available[modelName]) { - Model = model.db.model(modelName); - currentOptions = { - model: Model - }; - - if (schema && !discriminatorKey) { - options.model = Model; - } - - utils.merge(currentOptions, options); - - available[modelName] = { - Model: Model, - options: currentOptions, - docs: [doc], - ids: [] - }; - map.push(available[modelName]); - } else { - available[modelName].docs.push(doc); - } - - } - } - - return map; -} - -function getIdsForAndAddIdsInMapPopulate(modelsMap) { - var rawIds = [] // for the correct position - , - i, j, doc, docs, id, len, len2, ret, isDocument, options, path; - - len2 = modelsMap.length; - for (j = 0; j < len2; j++) { - docs = modelsMap[j].docs; - len = docs.length; - options = modelsMap[j].options; - path = options.path; - - for (i = 0; i < len; i++) { - ret = undefined; - doc = docs[i]; - id = String(utils.getValue("_id", doc)); - isDocument = !! doc.$__; - - if (!ret || Array.isArray(ret) && 0 === ret.length) { - ret = utils.getValue(path, doc); - } - - if (ret) { - ret = convertTo_id(ret); - - options._docs[id] = Array.isArray(ret) ? ret.slice() : ret; - } - - rawIds.push(ret); - modelsMap[j].ids.push(ret); - - if (isDocument) { - // cache original populated _ids and model used - doc.populated(path, options._docs[id], options); - } - } - } - - return rawIds; -} - -/*! - * Retrieve the _id of `val` if a Document or Array of Documents. - * - * @param {Array|Document|Any} val - * @return {Array|Document|Any} - */ - -function convertTo_id(val) { - if (val instanceof Model) return val._id; - - if (Array.isArray(val)) { - for (var i = 0; i < val.length; ++i) { - if (val[i] instanceof Model) { - val[i] = val[i]._id; - } - } - return val; - } - - return val; -} - -/*! - * Assigns documents returned from a population query back - * to the original document path. - */ - -function assignVals(o) { - // replace the original ids in our intermediate _ids structure - // with the documents found by query - - assignRawDocsToIdStructure(o.rawIds, o.rawDocs, o.rawOrder, o.options); - - // now update the original documents being populated using the - // result structure that contains real documents. - - var docs = o.docs; - var path = o.path; - var rawIds = o.rawIds; - var options = o.options; - - for (var i = 0; i < docs.length; ++i) { - if (utils.getValue(path, docs[i]) == null) - continue; - utils.setValue(path, rawIds[i], docs[i], function(val) { - return valueFilter(val, options); - }); - } -} - -/*! - * 1) Apply backwards compatible find/findOne behavior to sub documents - * - * find logic: - * a) filter out non-documents - * b) remove _id from sub docs when user specified - * - * findOne - * a) if no doc found, set to null - * b) remove _id from sub docs when user specified - * - * 2) Remove _ids when specified by users query. - * - * background: - * _ids are left in the query even when user excludes them so - * that population mapping can occur. - */ - -function valueFilter(val, assignmentOpts) { - if (Array.isArray(val)) { - // find logic - var ret = []; - var numValues = val.length; - for (var i = 0; i < numValues; ++i) { - var subdoc = val[i]; - if (!isDoc(subdoc)) continue; - maybeRemoveId(subdoc, assignmentOpts); - ret.push(subdoc); - if (assignmentOpts.originalLimit && - ret.length >= assignmentOpts.originalLimit) { - break; - } - } - - // Since we don't want to have to create a new mongoosearray, make sure to - // modify the array in place - while (val.length > ret.length) { - Array.prototype.pop.apply(val, []); - } - for (i = 0; i < ret.length; ++i) { - val[i] = ret[i]; - } - return val; - } - - // findOne - if (isDoc(val)) { - maybeRemoveId(val, assignmentOpts); - return val; - } - - return null; -} - -/*! - * Remove _id from `subdoc` if user specified "lean" query option - */ - -function maybeRemoveId(subdoc, assignmentOpts) { - if (assignmentOpts.excludeId) { - if ('function' == typeof subdoc.setValue) { - delete subdoc._doc._id; - } else { - delete subdoc._id; - } - } -} - -/*! - * Determine if `doc` is a document returned - * by a populate query. - */ - -function isDoc(doc) { - if (null == doc) - return false; - - var type = typeof doc; - if ('string' == type) - return false; - - if ('number' == type) - return false; - - if (Buffer.isBuffer(doc)) - return false; - - if ('ObjectID' == doc.constructor.name) - return false; - - // only docs - return true; -} - -/*! - * Assign `vals` returned by mongo query to the `rawIds` - * structure returned from utils.getVals() honoring - * query sort order if specified by user. - * - * This can be optimized. - * - * Rules: - * - * if the value of the path is not an array, use findOne rules, else find. - * for findOne the results are assigned directly to doc path (including null results). - * for find, if user specified sort order, results are assigned directly - * else documents are put back in original order of array if found in results - * - * @param {Array} rawIds - * @param {Array} vals - * @param {Boolean} sort - * @api private - */ - -function assignRawDocsToIdStructure(rawIds, resultDocs, resultOrder, options, recursed) { - // honor user specified sort order - var newOrder = []; - var sorting = options.sort && rawIds.length > 1; - var doc; - var sid; - var id; - - for (var i = 0; i < rawIds.length; ++i) { - id = rawIds[i]; - - if (Array.isArray(id)) { - // handle [ [id0, id2], [id3] ] - assignRawDocsToIdStructure(id, resultDocs, resultOrder, options, true); - newOrder.push(id); - continue; - } - - if (null === id && !sorting) { - // keep nulls for findOne unless sorting, which always - // removes them (backward compat) - newOrder.push(id); - continue; - } - - sid = String(id); - - if (recursed) { - // apply find behavior - - // assign matching documents in original order unless sorting - doc = resultDocs[sid]; - if (doc) { - if (sorting) { - newOrder[resultOrder[sid]] = doc; - } else { - newOrder.push(doc); - } - } else { - newOrder.push(id); - } - } else { - // apply findOne behavior - if document in results, assign, else assign null - newOrder[i] = doc = resultDocs[sid] || null; - } - } - - rawIds.length = 0; - if (newOrder.length) { - // reassign the documents based on corrected order - - // forEach skips over sparse entries in arrays so we - // can safely use this to our advantage dealing with sorted - // result sets too. - newOrder.forEach(function(doc, i) { - rawIds[i] = doc; - }); - } -} - -/** - * Finds the schema for `path`. This is different than - * calling `schema.path` as it also resolves paths with - * positional selectors (something.$.another.$.path). - * - * @param {String} path - * @return {Schema} - * @api private - */ - -Model._getSchema = function _getSchema(path) { - var schema = this.schema - , pathschema = schema.path(path); - - if (pathschema) - return pathschema; - - // look for arrays - return (function search(parts, schema) { - var p = parts.length + 1 - , foundschema - , trypath; - - while (p--) { - trypath = parts.slice(0, p).join('.'); - foundschema = schema.path(trypath); - if (foundschema) { - if (foundschema.caster) { - - // array of Mixed? - if (foundschema.caster instanceof Types.Mixed) { - return foundschema.caster; - } - - // Now that we found the array, we need to check if there - // are remaining document paths to look up for casting. - // Also we need to handle array.$.path since schema.path - // doesn't work for that. - // If there is no foundschema.schema we are dealing with - // a path like array.$ - if (p !== parts.length && foundschema.schema) { - if ('$' === parts[p]) { - // comments.$.comments.$.title - return search(parts.slice(p + 1), foundschema.schema); - } else { - // this is the last path of the selector - return search(parts.slice(p), foundschema.schema); - } - } - } - return foundschema; - } - } - })(path.split('.'), schema); -}; - -/*! - * Compiler utility. - * - * @param {String} name model name - * @param {Schema} schema - * @param {String} collectionName - * @param {Connection} connection - * @param {Mongoose} base mongoose instance - */ - -Model.compile = function compile(name, schema, collectionName, connection, base) { - var versioningEnabled = false !== schema.options.versionKey; - - if (versioningEnabled && !schema.paths[schema.options.versionKey]) { - // add versioning to top level documents only - var o = {}; - o[schema.options.versionKey] = Number; - schema.add(o); - } - - // generate new class - function model(doc, fields, skipId) { - if (!(this instanceof model)) - return new model(doc, fields, skipId); - Model.call(this, doc, fields, skipId); - } - - model.hooks = schema.s.hooks.clone(); - model.base = base; - model.modelName = name; - model.__proto__ = Model; - model.prototype.__proto__ = Model.prototype; - model.model = Model.prototype.model; - model.db = model.prototype.db = connection; - model.discriminators = model.prototype.discriminators = undefined; - - model.prototype.$__setSchema(schema); - - var collectionOptions = { - bufferCommands: schema.options.bufferCommands - , capped: schema.options.capped - }; - - model.prototype.collection = connection.collection( - collectionName - , collectionOptions - ); - - // apply methods and statics - applyMethods(model, schema); - applyStatics(model, schema); - - model.schema = model.prototype.schema; - model.collection = model.prototype.collection; - - return model; -}; - -/*! - * Register methods for this model - * - * @param {Model} model - * @param {Schema} schema - */ -var applyMethods = function(model, schema) { - for (var i in schema.methods) { - if (typeof schema.methods[i] === 'function') { - model.prototype[i] = schema.methods[i]; - } else { - (function(_i) { - Object.defineProperty(model.prototype, _i, { - get: function() { - var h = {}; - for (var k in schema.methods[_i]) { - h[k] = schema.methods[_i][k].bind(this); - } - return h; - }, - configurable: true - }); - })(i); - } - } -}; - -/*! - * Register statics for this model - * @param {Model} model - * @param {Schema} schema - */ -var applyStatics = function(model, schema) { - for (var i in schema.statics) { - model[i] = schema.statics[i]; - } -}; - -/*! - * Subclass this model with `conn`, `schema`, and `collection` settings. - * - * @param {Connection} conn - * @param {Schema} [schema] - * @param {String} [collection] - * @return {Model} - */ - -Model.__subclass = function subclass(conn, schema, collection) { - // subclass model using this connection and collection name - var model = this; - - var Model = function Model(doc, fields, skipId) { - if (!(this instanceof Model)) { - return new Model(doc, fields, skipId); - } - model.call(this, doc, fields, skipId); - }; - - Model.__proto__ = model; - Model.prototype.__proto__ = model.prototype; - Model.db = Model.prototype.db = conn; - - var s = schema && 'string' != typeof schema - ? schema - : model.prototype.schema; - - var options = s.options || {}; - - if (!collection) { - collection = model.prototype.schema.get('collection') - || utils.toCollectionName(model.modelName, options); - } - - var collectionOptions = { - bufferCommands: s ? options.bufferCommands : true - , capped: s && options.capped - }; - - Model.prototype.collection = conn.collection(collection, collectionOptions); - Model.collection = Model.prototype.collection; - Model.init(); - return Model; -}; - -/*! - * Module exports. - */ - -module.exports = exports = Model; diff --git a/Associations/node_modules/mongoose/lib/promise.js b/Associations/node_modules/mongoose/lib/promise.js deleted file mode 100644 index dba23317..00000000 --- a/Associations/node_modules/mongoose/lib/promise.js +++ /dev/null @@ -1,291 +0,0 @@ -/*! - * Module dependencies - */ - -var MPromise = require('mpromise'); -var util = require('util'); - -/** - * Promise constructor. - * - * Promises are returned from executed queries. Example: - * - * var query = Candy.find({ bar: true }); - * var promise = query.exec(); - * - * DEPRECATED. Mongoose 5.0 will use native promises by default (or bluebird, - * if native promises are not present) but still - * support plugging in your own ES6-compatible promises library. Mongoose 5.0 - * will **not** support mpromise. - * - * @param {Function} fn a function which will be called when the promise is resolved that accepts `fn(err, ...){}` as signature - * @inherits mpromise https://github.com/aheckmann/mpromise - * @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter - * @event `err`: Emits when the promise is rejected - * @event `complete`: Emits when the promise is fulfilled - * @api public - * @deprecated - */ - -function Promise(fn) { - MPromise.call(this, fn); -} - -/** - * ES6-style promise constructor wrapper around mpromise. - * - * @param {Function} resolver - * @return {Promise} new promise - * @api public - */ -Promise.ES6 = function(resolver) { - var promise = new Promise(); - - // No try/catch for backwards compatibility - resolver( - function() { - promise.complete.apply(promise, arguments); - }, - function(e) { - promise.error(e); - }); - - return promise; -}; - -/*! - * Inherit from mpromise - */ - -Promise.prototype = Object.create(MPromise.prototype, { - constructor: { - value: Promise - , enumerable: false - , writable: true - , configurable: true - } -}); - -/*! - * Override event names for backward compatibility. - */ - -Promise.SUCCESS = 'complete'; -Promise.FAILURE = 'err'; - -/** - * Adds `listener` to the `event`. - * - * If `event` is either the success or failure event and the event has already been emitted, the`listener` is called immediately and passed the results of the original emitted event. - * - * @see mpromise#on https://github.com/aheckmann/mpromise#on - * @method on - * @memberOf Promise - * @param {String} event - * @param {Function} listener - * @return {Promise} this - * @api public - */ - -/** - * Rejects this promise with `reason`. - * - * If the promise has already been fulfilled or rejected, not action is taken. - * - * @see mpromise#reject https://github.com/aheckmann/mpromise#reject - * @method reject - * @memberOf Promise - * @param {Object|String|Error} reason - * @return {Promise} this - * @api public - */ - -/** - * Rejects this promise with `err`. - * - * If the promise has already been fulfilled or rejected, not action is taken. - * - * Differs from [#reject](#promise_Promise-reject) by first casting `err` to an `Error` if it is not `instanceof Error`. - * - * @api public - * @param {Error|String} err - * @return {Promise} this - */ - -Promise.prototype.error = function(err) { - if (!(err instanceof Error)) { - if (err instanceof Object) { - err = util.inspect(err); - } - err = new Error(err); - } - return this.reject(err); -}; - -/** - * Resolves this promise to a rejected state if `err` is passed or a fulfilled state if no `err` is passed. - * - * If the promise has already been fulfilled or rejected, not action is taken. - * - * `err` will be cast to an Error if not already instanceof Error. - * - * _NOTE: overrides [mpromise#resolve](https://github.com/aheckmann/mpromise#resolve) to provide error casting._ - * - * @param {Error} [err] error or null - * @param {Object} [val] value to fulfill the promise with - * @api public - * @deprecated - */ - -Promise.prototype.resolve = function(err) { - if (err) return this.error(err); - return this.fulfill.apply(this, Array.prototype.slice.call(arguments, 1)); -}; - -/** - * Adds a single function as a listener to both err and complete. - * - * It will be executed with traditional node.js argument position when the promise is resolved. - * - * promise.addBack(function (err, args...) { - * if (err) return handleError(err); - * console.log('success'); - * }) - * - * Alias of [mpromise#onResolve](https://github.com/aheckmann/mpromise#onresolve). - * - * _Deprecated. Use `onResolve` instead._ - * - * @method addBack - * @param {Function} listener - * @return {Promise} this - * @deprecated - */ - -Promise.prototype.addBack = Promise.prototype.onResolve; - -/** - * Fulfills this promise with passed arguments. - * - * @method fulfill - * @receiver Promise - * @see https://github.com/aheckmann/mpromise#fulfill - * @param {any} args - * @api public - * @deprecated - */ - -/** - * Fulfills this promise with passed arguments. - * - * Alias of [mpromise#fulfill](https://github.com/aheckmann/mpromise#fulfill). - * - * _Deprecated. Use `fulfill` instead._ - * - * @method complete - * @receiver Promise - * @param {any} args - * @api public - * @deprecated - */ - -Promise.prototype.complete = MPromise.prototype.fulfill; - -/** - * Adds a listener to the `complete` (success) event. - * - * Alias of [mpromise#onFulfill](https://github.com/aheckmann/mpromise#onfulfill). - * - * _Deprecated. Use `onFulfill` instead._ - * - * @method addCallback - * @param {Function} listener - * @return {Promise} this - * @api public - * @deprecated - */ - -Promise.prototype.addCallback = Promise.prototype.onFulfill; - -/** - * Adds a listener to the `err` (rejected) event. - * - * Alias of [mpromise#onReject](https://github.com/aheckmann/mpromise#onreject). - * - * _Deprecated. Use `onReject` instead._ - * - * @method addErrback - * @param {Function} listener - * @return {Promise} this - * @api public - * @deprecated - */ - -Promise.prototype.addErrback = Promise.prototype.onReject; - -/** - * Creates a new promise and returns it. If `onFulfill` or `onReject` are passed, they are added as SUCCESS/ERROR callbacks to this promise after the nextTick. - * - * Conforms to [promises/A+](https://github.com/promises-aplus/promises-spec) specification. - * - * ####Example: - * - * var promise = Meetups.find({ tags: 'javascript' }).select('_id').exec(); - * promise.then(function (meetups) { - * var ids = meetups.map(function (m) { - * return m._id; - * }); - * return People.find({ meetups: { $in: ids }).exec(); - * }).then(function (people) { - * if (people.length < 10000) { - * throw new Error('Too few people!!!'); - * } else { - * throw new Error('Still need more people!!!'); - * } - * }).then(null, function (err) { - * assert.ok(err instanceof Error); - * }); - * - * @see promises-A+ https://github.com/promises-aplus/promises-spec - * @see mpromise#then https://github.com/aheckmann/mpromise#then - * @method then - * @memberOf Promise - * @param {Function} onFulFill - * @param {Function} onReject - * @return {Promise} newPromise - * @deprecated - */ - -/** - * Signifies that this promise was the last in a chain of `then()s`: if a handler passed to the call to `then` which produced this promise throws, the exception will go uncaught. - * - * ####Example: - * - * var p = new Promise; - * p.then(function(){ throw new Error('shucks') }); - * setTimeout(function () { - * p.fulfill(); - * // error was caught and swallowed by the promise returned from - * // p.then(). we either have to always register handlers on - * // the returned promises or we can do the following... - * }, 10); - * - * // this time we use .end() which prevents catching thrown errors - * var p = new Promise; - * var p2 = p.then(function(){ throw new Error('shucks') }).end(); // <-- - * setTimeout(function () { - * p.fulfill(); // throws "shucks" - * }, 10); - * - * @api public - * @see mpromise#end https://github.com/aheckmann/mpromise#end - * @method end - * @memberOf Promise - * @deprecated - */ - -/*! - * expose - */ - -module.exports = Promise; diff --git a/Associations/node_modules/mongoose/lib/promise_provider.js b/Associations/node_modules/mongoose/lib/promise_provider.js deleted file mode 100644 index 368cf85f..00000000 --- a/Associations/node_modules/mongoose/lib/promise_provider.js +++ /dev/null @@ -1,51 +0,0 @@ -/*! - * Module dependencies. - */ - -var MPromise = require('./promise'); - -/** - * Helper for multiplexing promise implementations - * - * @api private - */ - -var Promise = { - _promise: MPromise -}; - -/** - * Get the current promise constructor - * - * @api private - */ -Promise.get = function() { - return Promise._promise; -}; - -/** - * Set the current promise constructor - * - * @api private - */ - -Promise.set = function(lib) { - if (lib === MPromise) { - return Promise.reset(); - } - Promise._promise = require('./ES6Promise'); - Promise._promise.use(lib); - require('mquery').Promise = Promise._promise.ES6; -}; - -/** - * Resets to using mpromise - * - * @api private - */ - -Promise.reset = function() { - Promise._promise = MPromise; -}; - -module.exports = Promise; diff --git a/Associations/node_modules/mongoose/lib/query.js b/Associations/node_modules/mongoose/lib/query.js deleted file mode 100644 index a19b109b..00000000 --- a/Associations/node_modules/mongoose/lib/query.js +++ /dev/null @@ -1,3103 +0,0 @@ -/* eslint no-unused-vars: 1 */ - -/*! - * Module dependencies. - */ - -var mquery = require('mquery'); -var util = require('util'); -var readPref = require('./drivers').ReadPreference; -var PromiseProvider = require('./promise_provider'); -var updateValidators = require('./services/updateValidators'); -var utils = require('./utils'); -var helpers = require('./queryhelpers'); -var Document = require('./document'); -var QueryStream = require('./querystream'); -var cast = require('./cast'); - -/** - * Query constructor used for building queries. - * - * ####Example: - * - * var query = new Query(); - * query.setOptions({ lean : true }); - * query.collection(model.collection); - * query.where('age').gte(21).exec(callback); - * - * @param {Object} [options] - * @param {Object} [model] - * @param {Object} [conditions] - * @param {Object} [collection] Mongoose collection - * @api private - */ - -function Query(conditions, options, model, collection) { - // this stuff is for dealing with custom queries created by #toConstructor - if (!this._mongooseOptions) { - this._mongooseOptions = {}; - } - - // this is the case where we have a CustomQuery, we need to check if we got - // options passed in, and if we did, merge them in - if (options) { - var keys = Object.keys(options); - for (var i = 0; i < keys.length; ++i) { - var k = keys[i]; - this._mongooseOptions[k] = options[k]; - } - } - - if (collection) { - this.mongooseCollection = collection; - } - - if (model) { - this.model = model; - this.schema = model.schema; - } - - // this is needed because map reduce returns a model that can be queried, but - // all of the queries on said model should be lean - if (this.model && this.model._mapreduce) { - this.lean(); - } - - // inherit mquery - mquery.call(this, this.mongooseCollection, options); - - if (conditions) { - this.find(conditions); - } - - if (this.schema) { - this._count = this.model.hooks.createWrapper('count', - Query.prototype._count, this); - this._execUpdate = this.model.hooks.createWrapper('update', - Query.prototype._execUpdate, this); - this._find = this.model.hooks.createWrapper('find', - Query.prototype._find, this); - this._findOne = this.model.hooks.createWrapper('findOne', - Query.prototype._findOne, this); - this._findOneAndRemove = this.model.hooks.createWrapper('findOneAndRemove', - Query.prototype._findOneAndRemove, this); - this._findOneAndUpdate = this.model.hooks.createWrapper('findOneAndUpdate', - Query.prototype._findOneAndUpdate, this); - } -} - -/*! - * inherit mquery - */ - -Query.prototype = new mquery; -Query.prototype.constructor = Query; -Query.base = mquery.prototype; - -/** - * Flag to opt out of using `$geoWithin`. - * - * mongoose.Query.use$geoWithin = false; - * - * MongoDB 2.4 deprecated the use of `$within`, replacing it with `$geoWithin`. Mongoose uses `$geoWithin` by default (which is 100% backward compatible with $within). If you are running an older version of MongoDB, set this flag to `false` so your `within()` queries continue to work. - * - * @see http://docs.mongodb.org/manual/reference/operator/geoWithin/ - * @default true - * @property use$geoWithin - * @memberOf Query - * @receiver Query - * @api public - */ - -Query.use$geoWithin = mquery.use$geoWithin; - -/** - * Converts this query to a customized, reusable query constructor with all arguments and options retained. - * - * ####Example - * - * // Create a query for adventure movies and read from the primary - * // node in the replica-set unless it is down, in which case we'll - * // read from a secondary node. - * var query = Movie.find({ tags: 'adventure' }).read('primaryPreferred'); - * - * // create a custom Query constructor based off these settings - * var Adventure = query.toConstructor(); - * - * // Adventure is now a subclass of mongoose.Query and works the same way but with the - * // default query parameters and options set. - * Adventure().exec(callback) - * - * // further narrow down our query results while still using the previous settings - * Adventure().where({ name: /^Life/ }).exec(callback); - * - * // since Adventure is a stand-alone constructor we can also add our own - * // helper methods and getters without impacting global queries - * Adventure.prototype.startsWith = function (prefix) { - * this.where({ name: new RegExp('^' + prefix) }) - * return this; - * } - * Object.defineProperty(Adventure.prototype, 'highlyRated', { - * get: function () { - * this.where({ rating: { $gt: 4.5 }}); - * return this; - * } - * }) - * Adventure().highlyRated.startsWith('Life').exec(callback) - * - * New in 3.7.3 - * - * @return {Query} subclass-of-Query - * @api public - */ - -Query.prototype.toConstructor = function toConstructor() { - var CustomQuery = function(criteria, options) { - if (!(this instanceof CustomQuery)) { - return new CustomQuery(criteria, options); - } - this._mongooseOptions = utils.clone(p._mongooseOptions); - Query.call(this, criteria, options || null); - }; - - util.inherits(CustomQuery, Query); - - // set inherited defaults - var p = CustomQuery.prototype; - - p.options = {}; - - p.setOptions(this.options); - - p.op = this.op; - p._conditions = utils.clone(this._conditions); - p._fields = utils.clone(this._fields); - p._update = utils.clone(this._update); - p._path = this._path; - p._distinct = this._distinct; - p._collection = this._collection; - p.model = this.model; - p.mongooseCollection = this.mongooseCollection; - p._mongooseOptions = this._mongooseOptions; - - return CustomQuery; -}; - -/** - * Specifies a javascript function or expression to pass to MongoDBs query system. - * - * ####Example - * - * query.$where('this.comments.length === 10 || this.name.length === 5') - * - * // or - * - * query.$where(function () { - * return this.comments.length === 10 || this.name.length === 5; - * }) - * - * ####NOTE: - * - * Only use `$where` when you have a condition that cannot be met using other MongoDB operators like `$lt`. - * **Be sure to read about all of [its caveats](http://docs.mongodb.org/manual/reference/operator/where/) before using.** - * - * @see $where http://docs.mongodb.org/manual/reference/operator/where/ - * @method $where - * @param {String|Function} js javascript string or function - * @return {Query} this - * @memberOf Query - * @method $where - * @api public - */ - -/** - * Specifies a `path` for use with chaining. - * - * ####Example - * - * // instead of writing: - * User.find({age: {$gte: 21, $lte: 65}}, callback); - * - * // we can instead write: - * User.where('age').gte(21).lte(65); - * - * // passing query conditions is permitted - * User.find().where({ name: 'vonderful' }) - * - * // chaining - * User - * .where('age').gte(21).lte(65) - * .where('name', /^vonderful/i) - * .where('friends').slice(10) - * .exec(callback) - * - * @method where - * @memberOf Query - * @param {String|Object} [path] - * @param {any} [val] - * @return {Query} this - * @api public - */ - -/** - * Specifies the complementary comparison value for paths specified with `where()` - * - * ####Example - * - * User.where('age').equals(49); - * - * // is the same as - * - * User.where('age', 49); - * - * @method equals - * @memberOf Query - * @param {Object} val - * @return {Query} this - * @api public - */ - -/** - * Specifies arguments for an `$or` condition. - * - * ####Example - * - * query.or([{ color: 'red' }, { status: 'emergency' }]) - * - * @see $or http://docs.mongodb.org/manual/reference/operator/or/ - * @method or - * @memberOf Query - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -/** - * Specifies arguments for a `$nor` condition. - * - * ####Example - * - * query.nor([{ color: 'green' }, { status: 'ok' }]) - * - * @see $nor http://docs.mongodb.org/manual/reference/operator/nor/ - * @method nor - * @memberOf Query - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -/** - * Specifies arguments for a `$and` condition. - * - * ####Example - * - * query.and([{ color: 'green' }, { status: 'ok' }]) - * - * @method and - * @memberOf Query - * @see $and http://docs.mongodb.org/manual/reference/operator/and/ - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -/** - * Specifies a $gt query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * ####Example - * - * Thing.find().where('age').gt(21) - * - * // or - * Thing.find().gt('age', 21) - * - * @method gt - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @see $gt http://docs.mongodb.org/manual/reference/operator/gt/ - * @api public - */ - -/** - * Specifies a $gte query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method gte - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @see $gte http://docs.mongodb.org/manual/reference/operator/gte/ - * @api public - */ - -/** - * Specifies a $lt query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method lt - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @see $lt http://docs.mongodb.org/manual/reference/operator/lt/ - * @api public - */ - -/** - * Specifies a $lte query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method lte - * @see $lte http://docs.mongodb.org/manual/reference/operator/lte/ - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $ne query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @see $ne http://docs.mongodb.org/manual/reference/operator/ne/ - * @method ne - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $in query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @see $in http://docs.mongodb.org/manual/reference/operator/in/ - * @method in - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $nin query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @see $nin http://docs.mongodb.org/manual/reference/operator/nin/ - * @method nin - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $all query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @see $all http://docs.mongodb.org/manual/reference/operator/all/ - * @method all - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $size query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * ####Example - * - * MyModel.where('tags').size(0).exec(function (err, docs) { - * if (err) return handleError(err); - * - * assert(Array.isArray(docs)); - * console.log('documents with 0 tags', docs); - * }) - * - * @see $size http://docs.mongodb.org/manual/reference/operator/size/ - * @method size - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $regex query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @see $regex http://docs.mongodb.org/manual/reference/operator/regex/ - * @method regex - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $maxDistance query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @see $maxDistance http://docs.mongodb.org/manual/reference/operator/maxDistance/ - * @method maxDistance - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a `$mod` condition - * - * @method mod - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @return {Query} this - * @see $mod http://docs.mongodb.org/manual/reference/operator/mod/ - * @api public - */ - -/** - * Specifies an `$exists` condition - * - * ####Example - * - * // { name: { $exists: true }} - * Thing.where('name').exists() - * Thing.where('name').exists(true) - * Thing.find().exists('name') - * - * // { name: { $exists: false }} - * Thing.where('name').exists(false); - * Thing.find().exists('name', false); - * - * @method exists - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @return {Query} this - * @see $exists http://docs.mongodb.org/manual/reference/operator/exists/ - * @api public - */ - -/** - * Specifies an `$elemMatch` condition - * - * ####Example - * - * query.elemMatch('comment', { author: 'autobot', votes: {$gte: 5}}) - * - * query.where('comment').elemMatch({ author: 'autobot', votes: {$gte: 5}}) - * - * query.elemMatch('comment', function (elem) { - * elem.where('author').equals('autobot'); - * elem.where('votes').gte(5); - * }) - * - * query.where('comment').elemMatch(function (elem) { - * elem.where({ author: 'autobot' }); - * elem.where('votes').gte(5); - * }) - * - * @method elemMatch - * @memberOf Query - * @param {String|Object|Function} path - * @param {Object|Function} criteria - * @return {Query} this - * @see $elemMatch http://docs.mongodb.org/manual/reference/operator/elemMatch/ - * @api public - */ - -/** - * Defines a `$within` or `$geoWithin` argument for geo-spatial queries. - * - * ####Example - * - * query.where(path).within().box() - * query.where(path).within().circle() - * query.where(path).within().geometry() - * - * query.where('loc').within({ center: [50,50], radius: 10, unique: true, spherical: true }); - * query.where('loc').within({ box: [[40.73, -73.9], [40.7, -73.988]] }); - * query.where('loc').within({ polygon: [[],[],[],[]] }); - * - * query.where('loc').within([], [], []) // polygon - * query.where('loc').within([], []) // box - * query.where('loc').within({ type: 'LineString', coordinates: [...] }); // geometry - * - * **MUST** be used after `where()`. - * - * ####NOTE: - * - * As of Mongoose 3.7, `$geoWithin` is always used for queries. To change this behavior, see [Query.use$geoWithin](#query_Query-use%2524geoWithin). - * - * ####NOTE: - * - * In Mongoose 3.7, `within` changed from a getter to a function. If you need the old syntax, use [this](https://github.com/ebensing/mongoose-within). - * - * @method within - * @see $polygon http://docs.mongodb.org/manual/reference/operator/polygon/ - * @see $box http://docs.mongodb.org/manual/reference/operator/box/ - * @see $geometry http://docs.mongodb.org/manual/reference/operator/geometry/ - * @see $center http://docs.mongodb.org/manual/reference/operator/center/ - * @see $centerSphere http://docs.mongodb.org/manual/reference/operator/centerSphere/ - * @memberOf Query - * @return {Query} this - * @api public - */ - -/** - * Specifies a $slice projection for an array. - * - * ####Example - * - * query.slice('comments', 5) - * query.slice('comments', -5) - * query.slice('comments', [10, 5]) - * query.where('comments').slice(5) - * query.where('comments').slice([-10, 5]) - * - * @method slice - * @memberOf Query - * @param {String} [path] - * @param {Number} val number/range of elements to slice - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields#RetrievingaSubsetofFields-RetrievingaSubrangeofArrayElements - * @see $slice http://docs.mongodb.org/manual/reference/projection/slice/#prj._S_slice - * @api public - */ - -/** - * Specifies the maximum number of documents the query will return. - * - * ####Example - * - * query.limit(20) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method limit - * @memberOf Query - * @param {Number} val - * @api public - */ - -/** - * Specifies the number of documents to skip. - * - * ####Example - * - * query.skip(100).limit(20) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method skip - * @memberOf Query - * @param {Number} val - * @see cursor.skip http://docs.mongodb.org/manual/reference/method/cursor.skip/ - * @api public - */ - -/** - * Specifies the maxScan option. - * - * ####Example - * - * query.maxScan(100) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method maxScan - * @memberOf Query - * @param {Number} val - * @see maxScan http://docs.mongodb.org/manual/reference/operator/maxScan/ - * @api public - */ - -/** - * Specifies the batchSize option. - * - * ####Example - * - * query.batchSize(100) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method batchSize - * @memberOf Query - * @param {Number} val - * @see batchSize http://docs.mongodb.org/manual/reference/method/cursor.batchSize/ - * @api public - */ - -/** - * Specifies the `comment` option. - * - * ####Example - * - * query.comment('login query') - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method comment - * @memberOf Query - * @param {Number} val - * @see comment http://docs.mongodb.org/manual/reference/operator/comment/ - * @api public - */ - -/** - * Specifies this query as a `snapshot` query. - * - * ####Example - * - * query.snapshot() // true - * query.snapshot(true) - * query.snapshot(false) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method snapshot - * @memberOf Query - * @see snapshot http://docs.mongodb.org/manual/reference/operator/snapshot/ - * @return {Query} this - * @api public - */ - -/** - * Sets query hints. - * - * ####Example - * - * query.hint({ indexA: 1, indexB: -1}) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method hint - * @memberOf Query - * @param {Object} val a hint object - * @return {Query} this - * @see $hint http://docs.mongodb.org/manual/reference/operator/hint/ - * @api public - */ - -/** - * Specifies which document fields to include or exclude (also known as the query "projection") - * - * When using string syntax, prefixing a path with `-` will flag that path as excluded. When a path does not have the `-` prefix, it is included. Lastly, if a path is prefixed with `+`, it forces inclusion of the path, which is useful for paths excluded at the [schema level](/docs/api.html#schematype_SchemaType-select). - * - * ####Example - * - * // include a and b, exclude other fields - * query.select('a b'); - * - * // exclude c and d, include other fields - * query.select('-c -d'); - * - * // or you may use object notation, useful when - * // you have keys already prefixed with a "-" - * query.select({ a: 1, b: 1 }); - * query.select({ c: 0, d: 0 }); - * - * // force inclusion of field excluded at schema level - * query.select('+path') - * - * ####NOTE: - * - * Cannot be used with `distinct()`. - * - * _v2 had slightly different syntax such as allowing arrays of field names. This support was removed in v3._ - * - * @method select - * @memberOf Query - * @param {Object|String} arg - * @return {Query} this - * @see SchemaType - * @api public - */ - -/** - * _DEPRECATED_ Sets the slaveOk option. - * - * **Deprecated** in MongoDB 2.2 in favor of [read preferences](#query_Query-read). - * - * ####Example: - * - * query.slaveOk() // true - * query.slaveOk(true) - * query.slaveOk(false) - * - * @method slaveOk - * @memberOf Query - * @deprecated use read() preferences instead if on mongodb >= 2.2 - * @param {Boolean} v defaults to true - * @see mongodb http://docs.mongodb.org/manual/applications/replication/#read-preference - * @see slaveOk http://docs.mongodb.org/manual/reference/method/rs.slaveOk/ - * @see read() #query_Query-read - * @return {Query} this - * @api public - */ - -/** - * Determines the MongoDB nodes from which to read. - * - * ####Preferences: - * - * primary - (default) Read from primary only. Operations will produce an error if primary is unavailable. Cannot be combined with tags. - * secondary Read from secondary if available, otherwise error. - * primaryPreferred Read from primary if available, otherwise a secondary. - * secondaryPreferred Read from a secondary if available, otherwise read from the primary. - * nearest All operations read from among the nearest candidates, but unlike other modes, this option will include both the primary and all secondaries in the random selection. - * - * Aliases - * - * p primary - * pp primaryPreferred - * s secondary - * sp secondaryPreferred - * n nearest - * - * ####Example: - * - * new Query().read('primary') - * new Query().read('p') // same as primary - * - * new Query().read('primaryPreferred') - * new Query().read('pp') // same as primaryPreferred - * - * new Query().read('secondary') - * new Query().read('s') // same as secondary - * - * new Query().read('secondaryPreferred') - * new Query().read('sp') // same as secondaryPreferred - * - * new Query().read('nearest') - * new Query().read('n') // same as nearest - * - * // read from secondaries with matching tags - * new Query().read('s', [{ dc:'sf', s: 1 },{ dc:'ma', s: 2 }]) - * - * Read more about how to use read preferrences [here](http://docs.mongodb.org/manual/applications/replication/#read-preference) and [here](http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences). - * - * @method read - * @memberOf Query - * @param {String} pref one of the listed preference options or aliases - * @param {Array} [tags] optional tags for this query - * @see mongodb http://docs.mongodb.org/manual/applications/replication/#read-preference - * @see driver http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences - * @return {Query} this - * @api public - */ - -Query.prototype.read = function read(pref, tags) { - // first cast into a ReadPreference object to support tags - var read = readPref.apply(readPref, arguments); - return Query.base.read.call(this, read); -}; - -/** - * Merges another Query or conditions object into this one. - * - * When a Query is passed, conditions, field selection and options are merged. - * - * New in 3.7.0 - * - * @method merge - * @memberOf Query - * @param {Query|Object} source - * @return {Query} this - */ - -/** - * Sets query options. - * - * ####Options: - * - * - [tailable](http://www.mongodb.org/display/DOCS/Tailable+Cursors) * - * - [sort](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsort(\)%7D%7D) * - * - [limit](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Blimit%28%29%7D%7D) * - * - [skip](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bskip%28%29%7D%7D) * - * - [maxscan](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24maxScan) * - * - [batchSize](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7BbatchSize%28%29%7D%7D) * - * - [comment](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24comment) * - * - [snapshot](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsnapshot%28%29%7D%7D) * - * - [hint](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24hint) * - * - [readPreference](http://docs.mongodb.org/manual/applications/replication/#read-preference) ** - * - [lean](./api.html#query_Query-lean) * - * - [safe](http://www.mongodb.org/display/DOCS/getLastError+Command) - * - * _* denotes a query helper method is also available_ - * _** query helper method to set `readPreference` is `read()`_ - * - * @param {Object} options - * @api public - */ - -Query.prototype.setOptions = function(options, overwrite) { - // overwrite is only for internal use - if (overwrite) { - // ensure that _mongooseOptions & options are two different objects - this._mongooseOptions = (options && utils.clone(options)) || {}; - this.options = options || {}; - - if ('populate' in options) { - this.populate(this._mongooseOptions); - } - return this; - } - - if (!(options && 'Object' == options.constructor.name)) { - return this; - } - - return Query.base.setOptions.call(this, options); -}; - -/** - * Returns the current query conditions as a JSON object. - * - * ####Example: - * - * var query = new Query(); - * query.find({ a: 1 }).where('b').gt(2); - * query.getQuery(); // { a: 1, b: { $gt: 2 } } - * - * @return {Object} current query conditions - * @api public - */ - -Query.prototype.getQuery = function() { - return this._conditions; -}; - -/** - * Returns the current update operations as a JSON object. - * - * ####Example: - * - * var query = new Query(); - * query.update({}, { $set: { a: 5 } }); - * query.getUpdate(); // { $set: { a: 5 } } - * - * @return {Object} current update operations - * @api public - */ - -Query.prototype.getUpdate = function() { - return this._update; -}; - -/** - * Returns fields selection for this query. - * - * @method _fieldsForExec - * @return {Object} - * @api private - * @receiver Query - */ - -/** - * Return an update document with corrected $set operations. - * - * @method _updateForExec - * @api private - * @receiver Query - */ - -/** - * Makes sure _path is set. - * - * @method _ensurePath - * @param {String} method - * @api private - * @receiver Query - */ - -/** - * Determines if `conds` can be merged using `mquery().merge()` - * - * @method canMerge - * @memberOf Query - * @param {Object} conds - * @return {Boolean} - * @api private - */ - -/** - * Returns default options for this query. - * - * @param {Model} model - * @api private - */ - -Query.prototype._optionsForExec = function(model) { - var options = Query.base._optionsForExec.call(this); - - delete options.populate; - model = model || this.model; - - if (!model) { - return options; - } else { - if (!('safe' in options) && model.schema.options.safe) { - options.safe = model.schema.options.safe; - } - - if (!('readPreference' in options) && model.schema.options.read) { - options.readPreference = model.schema.options.read; - } - - return options; - } -}; - -/** - * Sets the lean option. - * - * Documents returned from queries with the `lean` option enabled are plain javascript objects, not [MongooseDocuments](#document-js). They have no `save` method, getters/setters or other Mongoose magic applied. - * - * ####Example: - * - * new Query().lean() // true - * new Query().lean(true) - * new Query().lean(false) - * - * Model.find().lean().exec(function (err, docs) { - * docs[0] instanceof mongoose.Document // false - * }); - * - * This is a [great](https://groups.google.com/forum/#!topic/mongoose-orm/u2_DzDydcnA/discussion) option in high-performance read-only scenarios, especially when combined with [stream](#query_Query-stream). - * - * @param {Boolean} bool defaults to true - * @return {Query} this - * @api public - */ - -Query.prototype.lean = function(v) { - this._mongooseOptions.lean = arguments.length ? !!v : true; - return this; -}; - -/** - * Thunk around find() - * - * @param {Function} [callback] - * @return {Query} this - * @api private - */ -Query.prototype._find = function(callback) { - if (this._castError) { - callback(this._castError); - return this; - } - - this._applyPaths(); - this._fields = this._castFields(this._fields); - - var fields = this._fieldsForExec(); - var options = this._mongooseOptions; - var self = this; - - var cb = function(err, docs) { - if (err) { - return callback(err); - } - - if (docs.length === 0) { - return callback(null, docs); - } - - if (!options.populate) { - return true === options.lean - ? callback(null, docs) - : completeMany(self.model, docs, fields, self, null, callback); - } - - var pop = helpers.preparePopulationOptionsMQ(self, options); - self.model.populate(docs, pop, function(err, docs) { - if (err) return callback(err); - return true === options.lean - ? callback(null, docs) - : completeMany(self.model, docs, fields, self, pop, callback); - }); - }; - - return Query.base.find.call(this, {}, cb); -}; - -/** - * Finds documents. - * - * When no `callback` is passed, the query is not executed. When the query is executed, the result will be an array of documents. - * - * ####Example - * - * query.find({ name: 'Los Pollos Hermanos' }).find(callback) - * - * @param {Object} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.find = function(conditions, callback) { - if ('function' == typeof conditions) { - callback = conditions; - conditions = {}; - } - - conditions = utils.toObject(conditions); - - if (mquery.canMerge(conditions)) { - this.merge(conditions); - } - - prepareDiscriminatorCriteria(this); - - try { - this.cast(this.model); - this._castError = null; - } catch (err) { - this._castError = err; - } - - // if we don't have a callback, then just return the query object - if (!callback) { - return Query.base.find.call(this); - } - - this._find(callback); - - return this; -}; - -/*! - * hydrates many documents - * - * @param {Model} model - * @param {Array} docs - * @param {Object} fields - * @param {Query} self - * @param {Array} [pop] array of paths used in population - * @param {Function} callback - */ - -function completeMany(model, docs, fields, self, pop, callback) { - var arr = []; - var count = docs.length; - var len = count; - var opts = pop ? - { populated: pop } - : undefined; - for (var i = 0; i < len; ++i) { - arr[i] = helpers.createModel(model, docs[i], fields); - arr[i].init(docs[i], opts, function(err) { - if (err) return callback(err); - --count || callback(null, arr); - }); - } -} - -/** - * Thunk around findOne() - * - * @param {Function} [callback] - * @see findOne http://docs.mongodb.org/manual/reference/method/db.collection.findOne/ - * @api private - */ - -Query.prototype._findOne = function(callback) { - if (this._castError) { - return callback(this._castError); - } - - this._applyPaths(); - this._fields = this._castFields(this._fields); - - var options = this._mongooseOptions; - var projection = this._fieldsForExec(); - var self = this; - - // don't pass in the conditions because we already merged them in - Query.base.findOne.call(self, {}, function(err, doc) { - if (err) { - return callback(err); - } - if (!doc) { - return callback(null, null); - } - - if (!options.populate) { - return true === options.lean - ? callback(null, doc) - : completeOne(self.model, doc, null, projection, self, null, callback); - } - - var pop = helpers.preparePopulationOptionsMQ(self, options); - self.model.populate(doc, pop, function(err, doc) { - if (err) { - return callback(err); - } - - return true === options.lean - ? callback(null, doc) - : completeOne(self.model, doc, null, projection, self, pop, callback); - }); - }); -}; - -/** - * Declares the query a findOne operation. When executed, the first found document is passed to the callback. - * - * Passing a `callback` executes the query. The result of the query is a single document. - * - * ####Example - * - * var query = Kitten.where({ color: 'white' }); - * query.findOne(function (err, kitten) { - * if (err) return handleError(err); - * if (kitten) { - * // doc may be null if no document matched - * } - * }); - * - * @param {Object|Query} [criteria] mongodb selector - * @param {Object} [projection] optional fields to return (http://bit.ly/1HotzBo) - * @param {Function} [callback] - * @return {Query} this - * @see findOne http://docs.mongodb.org/manual/reference/method/db.collection.findOne/ - * @api public - */ - -Query.prototype.findOne = function(conditions, projection, options, callback) { - if ('function' == typeof conditions) { - callback = conditions; - conditions = null; - projection = null; - options = null; - } else if ('function' == typeof projection) { - callback = projection; - options = null; - projection = null; - } else if ('function' == typeof options) { - callback = options; - options = null; - } - - // make sure we don't send in the whole Document to merge() - conditions = utils.toObject(conditions); - - this.op = 'findOne'; - - if (options) { - this.setOptions(options); - } - - if (projection) { - this.select(projection); - } - - if (mquery.canMerge(conditions)) { - this.merge(conditions); - } - - prepareDiscriminatorCriteria(this); - - try { - this.cast(this.model); - this._castError = null; - } catch (err) { - this._castError = err; - } - - if (!callback) { - // already merged in the conditions, don't need to send them in. - return Query.base.findOne.call(this); - } - - this._findOne(callback); - - return this; -}; - -/** - * Thunk around count() - * - * @param {Function} [callback] - * @see count http://docs.mongodb.org/manual/reference/method/db.collection.count/ - * @api private - */ - -Query.prototype._count = function(callback) { - try { - this.cast(this.model); - } catch (err) { - process.nextTick(function() { - callback(err); - }); - return this; - } - - var conds = this._conditions; - var options = this._optionsForExec(); - - this._collection.count(conds, options, utils.tick(callback)); -}; - -/** - * Specifying this query as a `count` query. - * - * Passing a `callback` executes the query. - * - * ####Example: - * - * var countQuery = model.where({ 'color': 'black' }).count(); - * - * query.count({ color: 'black' }).count(callback) - * - * query.count({ color: 'black' }, callback) - * - * query.where('color', 'black').count(function (err, count) { - * if (err) return handleError(err); - * console.log('there are %d kittens', count); - * }) - * - * @param {Object} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @see count http://docs.mongodb.org/manual/reference/method/db.collection.count/ - * @api public - */ - -Query.prototype.count = function(conditions, callback) { - if ('function' == typeof conditions) { - callback = conditions; - conditions = undefined; - } - - if (mquery.canMerge(conditions)) { - this.merge(conditions); - } - - this.op = 'count'; - if (!callback) { - return this; - } - - this._count(callback); - - return this; -}; - -/** - * Declares or executes a distict() operation. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * distinct(field, conditions, callback) - * distinct(field, conditions) - * distinct(field, callback) - * distinct(field) - * distinct(callback) - * distinct() - * - * @param {String} [field] - * @param {Object|Query} [criteria] - * @param {Function} [callback] - * @return {Query} this - * @see distinct http://docs.mongodb.org/manual/reference/method/db.collection.distinct/ - * @api public - */ - -Query.prototype.distinct = function(field, conditions, callback) { - if (!callback) { - if ('function' === typeof conditions) { - callback = conditions; - conditions = undefined; - } else if ('function' === typeof field) { - callback = field; - field = undefined; - conditions = undefined; - } - } - - conditions = utils.toObject(conditions); - - if (mquery.canMerge(conditions)) { - this.merge(conditions); - } - - try { - this.cast(this.model); - } catch (err) { - if (!callback) { - throw err; - } - callback(err); - return this; - } - - return Query.base.distinct.call(this, {}, field, callback); -}; - -/** - * Sets the sort order - * - * If an object is passed, values allowed are `asc`, `desc`, `ascending`, `descending`, `1`, and `-1`. - * - * If a string is passed, it must be a space delimited list of path names. The - * sort order of each path is ascending unless the path name is prefixed with `-` - * which will be treated as descending. - * - * ####Example - * - * // sort by "field" ascending and "test" descending - * query.sort({ field: 'asc', test: -1 }); - * - * // equivalent - * query.sort('field -test'); - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Object|String} arg - * @return {Query} this - * @see cursor.sort http://docs.mongodb.org/manual/reference/method/cursor.sort/ - * @api public - */ - -Query.prototype.sort = function(arg) { - var nArg = {}; - - if (arguments.length > 1) { - throw new Error("sort() only takes 1 Argument"); - } - - if (Array.isArray(arg)) { - // time to deal with the terrible syntax - for (var i = 0; i < arg.length; i++) { - if (!Array.isArray(arg[i])) throw new Error("Invalid sort() argument."); - nArg[arg[i][0]] = arg[i][1]; - } - - } else { - nArg = arg; - } - - // workaround for gh-2374 when sort is called after count - // if previous operation is count, we ignore - if (this.op == 'count') { - delete this.op; - } - return Query.base.sort.call(this, nArg); -}; - -/** - * Declare and/or execute this query as a remove() operation. - * - * ####Example - * - * Model.remove({ artist: 'Anne Murray' }, callback) - * - * ####Note - * - * The operation is only executed when a callback is passed. To force execution without a callback, you must first call `remove()` and then execute it by using the `exec()` method. - * - * // not executed - * var query = Model.find().remove({ name: 'Anne Murray' }) - * - * // executed - * query.remove({ name: 'Anne Murray' }, callback) - * query.remove({ name: 'Anne Murray' }).remove(callback) - * - * // executed without a callback (unsafe write) - * query.exec() - * - * // summary - * query.remove(conds, fn); // executes - * query.remove(conds) - * query.remove(fn) // executes - * query.remove() - * - * @param {Object|Query} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @see remove http://docs.mongodb.org/manual/reference/method/db.collection.remove/ - * @api public - */ - -Query.prototype.remove = function(cond, callback) { - if ('function' == typeof cond) { - callback = cond; - cond = null; - } - - var cb = 'function' == typeof callback; - - try { - this.cast(this.model); - } catch (err) { - if (cb) return process.nextTick(callback.bind(null, err)); - return this; - } - - return Query.base.remove.call(this, cond, callback); -}; - -/*! - * hydrates a document - * - * @param {Model} model - * @param {Document} doc - * @param {Object} res 3rd parameter to callback - * @param {Object} fields - * @param {Query} self - * @param {Array} [pop] array of paths used in population - * @param {Function} callback - */ - -function completeOne(model, doc, res, fields, self, pop, callback) { - var opts = pop ? - { populated: pop } - : undefined; - - var casted = helpers.createModel(model, doc, fields); - casted.init(doc, opts, function(err) { - if (err) { - return callback(err); - } - if (res) { - return callback(null, casted, res); - } - callback(null, casted); - }); -} - -/*! - * If the model is a discriminator type and not root, then add the key & value to the criteria. - */ - -function prepareDiscriminatorCriteria(query) { - if (!query || !query.model || !query.model.schema) { - return; - } - - var schema = query.model.schema; - - if (schema && schema.discriminatorMapping && !schema.discriminatorMapping.isRoot) { - query._conditions[schema.discriminatorMapping.key] = schema.discriminatorMapping.value; - } -} - -/** - * Issues a mongodb [findAndModify](http://www.mongodb.org/display/DOCS/findAndModify+Command) update command. - * - * Finds a matching document, updates it according to the `update` arg, passing any `options`, and returns the found document (if any) to the callback. The query executes immediately if `callback` is passed. - * - * ####Available options - * - * - `new`: bool - if true, return the modified document rather than the original. defaults to false (changed in 4.0) - * - `upsert`: bool - creates the object if it doesn't exist. defaults to false. - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - `passRawResult`: if true, passes the [raw result from the MongoDB driver as the third callback parameter](http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findAndModify) - * - * ####Callback Signature - * function(error, doc) { - * // error: any errors that occurred - * // doc: the document before updates are applied if `new: false`, or after updates if `new = true` - * } - * - * ####Examples - * - * query.findOneAndUpdate(conditions, update, options, callback) // executes - * query.findOneAndUpdate(conditions, update, options) // returns Query - * query.findOneAndUpdate(conditions, update, callback) // executes - * query.findOneAndUpdate(conditions, update) // returns Query - * query.findOneAndUpdate(update, callback) // returns Query - * query.findOneAndUpdate(update) // returns Query - * query.findOneAndUpdate(callback) // executes - * query.findOneAndUpdate() // returns Query - * - * @method findOneAndUpdate - * @memberOf Query - * @param {Object|Query} [query] - * @param {Object} [doc] - * @param {Object} [options] - * @param {Function} [callback] - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @return {Query} this - * @api public - */ - -Query.prototype.findOneAndUpdate = function(criteria, doc, options, callback) { - this.op = 'findOneAndUpdate'; - this._validate(); - - switch (arguments.length) { - case 3: - if ('function' == typeof options) { - callback = options; - options = {}; - } - break; - case 2: - if ('function' == typeof doc) { - callback = doc; - doc = criteria; - criteria = undefined; - } - options = undefined; - break; - case 1: - if ('function' == typeof criteria) { - callback = criteria; - criteria = options = doc = undefined; - } else { - doc = criteria; - criteria = options = undefined; - } - } - - if (mquery.canMerge(criteria)) { - this.merge(criteria); - } - - // apply doc - if (doc) { - this._mergeUpdate(doc); - } - - options && this.setOptions(options); - - if (!callback) { - return this; - } - - return this._findOneAndUpdate(callback); -}; - -/** - * Thunk around findOneAndUpdate() - * - * @param {Function} [callback] - * @api private - */ - -Query.prototype._findOneAndUpdate = function(callback) { - this._findAndModify('update', callback); - return this; -}; - -/** - * Issues a mongodb [findAndModify](http://www.mongodb.org/display/DOCS/findAndModify+Command) remove command. - * - * Finds a matching document, removes it, passing the found document (if any) to the callback. Executes immediately if `callback` is passed. - * - * ####Available options - * - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - `passRawResult`: if true, passes the [raw result from the MongoDB driver as the third callback parameter](http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findAndModify) - * - * ####Callback Signature - * function(error, doc, result) { - * // error: any errors that occurred - * // doc: the document before updates are applied if `new: false`, or after updates if `new = true` - * // result: [raw result from the MongoDB driver](http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#findAndModify) - * } - * - * ####Examples - * - * A.where().findOneAndRemove(conditions, options, callback) // executes - * A.where().findOneAndRemove(conditions, options) // return Query - * A.where().findOneAndRemove(conditions, callback) // executes - * A.where().findOneAndRemove(conditions) // returns Query - * A.where().findOneAndRemove(callback) // executes - * A.where().findOneAndRemove() // returns Query - * - * @method findOneAndRemove - * @memberOf Query - * @param {Object} [conditions] - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @api public - */ - -Query.prototype.findOneAndRemove = function(conditions, options, callback) { - this.op = 'findOneAndRemove'; - this._validate(); - - switch (arguments.length) { - case 2: - if ('function' == typeof options) { - callback = options; - options = {}; - } - break; - case 1: - if ('function' == typeof conditions) { - callback = conditions; - conditions = undefined; - options = undefined; - } - break; - } - - if (mquery.canMerge(conditions)) { - this.merge(conditions); - } - - options && this.setOptions(options); - - if (!callback) { - return this; - } - - this._findOneAndRemove(callback); - - return this; -}; - -/** - * Thunk around findOneAndRemove() - * - * @param {Function} [callback] - * @return {Query} this - * @api private - */ -Query.prototype._findOneAndRemove = function(callback) { - Query.base.findOneAndRemove.call(this, callback); -}; - -/** - * Override mquery.prototype._findAndModify to provide casting etc. - * - * @param {String} type - either "remove" or "update" - * @param {Function} callback - * @api private - */ - -Query.prototype._findAndModify = function(type, callback) { - if ('function' != typeof callback) { - throw new Error("Expected callback in _findAndModify"); - } - - var model = this.model; - var schema = model.schema; - var self = this; - var castedQuery; - var castedDoc; - var fields; - var opts; - var doValidate; - - castedQuery = castQuery(this); - if (castedQuery instanceof Error) { - return callback(castedQuery); - } - - opts = this._optionsForExec(model); - - if ('strict' in opts) { - this._mongooseOptions.strict = opts.strict; - } - - if ('remove' == type) { - opts.remove = true; - } else { - if (!('new' in opts)) { - opts.new = false; - } - if (!('upsert' in opts)) { - opts.upsert = false; - } - if (opts.upsert || opts['new']) { - opts.remove = false; - } - - castedDoc = castDoc(this, opts.overwrite); - if (!castedDoc) { - if (opts.upsert) { - // still need to do the upsert to empty doc - var doc = utils.clone(castedQuery); - delete doc._id; - castedDoc = { $set: doc }; - } else { - return this.findOne(callback); - } - } else if (castedDoc instanceof Error) { - return callback(castedDoc); - } else { - // In order to make MongoDB 2.6 happy (see - // https://jira.mongodb.org/browse/SERVER-12266 and related issues) - // if we have an actual update document but $set is empty, junk the $set. - if (castedDoc.$set && Object.keys(castedDoc.$set).length === 0) { - delete castedDoc.$set; - } - } - - doValidate = updateValidators(this, schema, castedDoc, opts); - } - - this._applyPaths(); - - self = this; - var options = this._mongooseOptions; - - if (this._fields) { - fields = utils.clone(this._fields); - opts.fields = this._castFields(fields); - if (opts.fields instanceof Error) { - return callback(opts.fields); - } - } - - if (opts.sort) convertSortToArray(opts); - - var cb = function(err, doc, res) { - if (err) { - return callback(err); - } - - if (!doc || (utils.isObject(doc) && Object.keys(doc).length === 0)) { - return callback(null, null); - } - - if (!opts.passRawResult) { - res = null; - } - - if (!options.populate) { - return true === options.lean - ? callback(null, doc) - : completeOne(self.model, doc, res, fields, self, null, callback); - } - - var pop = helpers.preparePopulationOptionsMQ(self, options); - self.model.populate(doc, pop, function(err, doc) { - if (err) { - return callback(err); - } - - return true === options.lean - ? callback(null, doc) - : completeOne(self.model, doc, res, fields, self, pop, callback); - }); - }; - - if ((opts.runValidators || opts.setDefaultsOnInsert) && doValidate) { - doValidate(function(error) { - if (error) { - return callback(error); - } - self._collection.findAndModify(castedQuery, castedDoc, opts, utils.tick(function(error, res) { - return cb(error, res ? res.value : res, res); - })); - }); - } else { - this._collection.findAndModify(castedQuery, castedDoc, opts, utils.tick(function(error, res) { - return cb(error, res ? res.value : res, res); - })); - } - - return this; -}; - -/** - * Override mquery.prototype._mergeUpdate to handle mongoose objects in - * updates. - * - * @param {Object} doc - * @api private - */ - -Query.prototype._mergeUpdate = function(doc) { - if (!this._update) this._update = {}; - if (doc instanceof Query) { - if (doc._update) { - utils.mergeClone(this._update, doc._update); - } - } else { - utils.mergeClone(this._update, doc); - } -}; - -/*! - * The mongodb driver 1.3.23 only supports the nested array sort - * syntax. We must convert it or sorting findAndModify will not work. - */ - -function convertSortToArray(opts) { - if (Array.isArray(opts.sort)) return; - if (!utils.isObject(opts.sort)) return; - - var sort = []; - - for (var key in opts.sort) if (utils.object.hasOwnProperty(opts.sort, key)) { - sort.push([ key, opts.sort[key] ]); - } - - opts.sort = sort; -} - -/** - * Internal helper for update - * - * @param {Object} castedQuery - * @param {Object} castedDoc the update command - * @param {Object} options - * @param {Function} callback - * @return {Query} this - * @see Model.update #model_Model.update - * @api private - */ -Query.prototype._execUpdate = function(castedQuery, castedDoc, options, callback) { - var schema = this.model.schema; - var doValidate; - var _this; - - if (this.options.runValidators || this.options.setDefaultsOnInsert) { - _this = this; - doValidate = updateValidators(this, schema, castedDoc, options); - doValidate(function(err) { - if (err) { - return callback(err); - } - - Query.base.update.call(_this, castedQuery, castedDoc, options, callback); - }); - return this; - } - - Query.base.update.call(this, castedQuery, castedDoc, options, callback); - return this; -}; - -/** - * Declare and/or execute this query as an update() operation. - * - * _All paths passed that are not $atomic operations will become $set ops._ - * - * ####Example - * - * Model.where({ _id: id }).update({ title: 'words' }) - * - * // becomes - * - * Model.where({ _id: id }).update({ $set: { title: 'words' }}) - * - * ####Note - * - * Passing an empty object `{}` as the doc will result in a no-op unless the `overwrite` option is passed. Without the `overwrite` option set, the update operation will be ignored and the callback executed without sending the command to MongoDB so as to prevent accidently overwritting documents in the collection. - * - * ####Note - * - * The operation is only executed when a callback is passed. To force execution without a callback (which would be an unsafe write), we must first call update() and then execute it by using the `exec()` method. - * - * var q = Model.where({ _id: id }); - * q.update({ $set: { name: 'bob' }}).update(); // not executed - * - * q.update({ $set: { name: 'bob' }}).exec(); // executed as unsafe - * - * // keys that are not $atomic ops become $set. - * // this executes the same command as the previous example. - * q.update({ name: 'bob' }).exec(); - * - * // overwriting with empty docs - * var q = Model.where({ _id: id }).setOptions({ overwrite: true }) - * q.update({ }, callback); // executes - * - * // multi update with overwrite to empty doc - * var q = Model.where({ _id: id }); - * q.setOptions({ multi: true, overwrite: true }) - * q.update({ }); - * q.update(callback); // executed - * - * // multi updates - * Model.where() - * .update({ name: /^match/ }, { $set: { arr: [] }}, { multi: true }, callback) - * - * // more multi updates - * Model.where() - * .setOptions({ multi: true }) - * .update({ $set: { arr: [] }}, callback) - * - * // single update by default - * Model.where({ email: 'address@example.com' }) - * .update({ $inc: { counter: 1 }}, callback) - * - * API summary - * - * update(criteria, doc, options, cb) // executes - * update(criteria, doc, options) - * update(criteria, doc, cb) // executes - * update(criteria, doc) - * update(doc, cb) // executes - * update(doc) - * update(cb) // executes - * update(true) // executes (unsafe write) - * update() - * - * @param {Object} [criteria] - * @param {Object} [doc] the update command - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} this - * @see Model.update #model_Model.update - * @see update http://docs.mongodb.org/manual/reference/method/db.collection.update/ - * @api public - */ - -Query.prototype.update = function(conditions, doc, options, callback) { - if ('function' === typeof options) { - // Scenario: update(conditions, doc, callback) - callback = options; - options = null; - } else if ('function' === typeof doc) { - // Scenario: update(doc, callback); - callback = doc; - doc = conditions; - conditions = {}; - options = null; - } else if ('function' === typeof conditions) { - callback = conditions; - conditions = undefined; - doc = undefined; - options = undefined; - } - - // make sure we don't send in the whole Document to merge() - conditions = utils.toObject(conditions); - - var oldCb = callback; - if (oldCb) { - callback = function(error, result) { - oldCb(error, result ? result.result : { ok: 0, n: 0, nModified: 0 }); - }; - } - - // strict is an option used in the update checking, make sure it gets set - if (options) { - if ('strict' in options) { - this._mongooseOptions.strict = options.strict; - } - } - - // if doc is undefined at this point, this means this function is being - // executed by exec(not always see below). Grab the update doc from here in - // order to validate - // This could also be somebody calling update() or update({}). Probably not a - // common use case, check for _update to make sure we don't do anything bad - if (!doc && this._update) { - doc = this._updateForExec(); - } - - if (mquery.canMerge(conditions)) { - this.merge(conditions); - } - - // validate the selector part of the query - var castedQuery = castQuery(this); - if (castedQuery instanceof Error) { - if (callback) { - callback(castedQuery); - return this; - } else { - throw castedQuery; - } - } - - // validate the update part of the query - var castedDoc; - try { - castedDoc = this._castUpdate(utils.clone(doc, { retainKeyOrder: true }), - options && options.overwrite); - } catch (err) { - if (callback) { - callback(err); - return this; - } else { - throw err; - } - } - - if (!castedDoc) { - // Make sure promises know that this is still an update, see gh-2796 - this.op = 'update'; - callback && callback(null); - return this; - } - - if (utils.isObject(options)) { - this.setOptions(options); - } - - if (!this._update) this._update = castedDoc; - - // Hooks - if (callback) { - return this._execUpdate(castedQuery, castedDoc, options, callback); - } - - return Query.base.update.call(this, castedQuery, castedDoc, options, callback); -}; - -/** - * Executes the query - * - * ####Examples: - * - * var promise = query.exec(); - * var promise = query.exec('update'); - * - * query.exec(callback); - * query.exec('find', callback); - * - * @param {String|Function} [operation] - * @param {Function} [callback] - * @return {Promise} - * @api public - */ - -Query.prototype.exec = function exec(op, callback) { - var Promise = PromiseProvider.get(); - var _this = this; - - if ('function' == typeof op) { - callback = op; - op = null; - } else if ('string' == typeof op) { - this.op = op; - } - - return new Promise.ES6(function(resolve, reject) { - if (!_this.op) { - callback && callback(null, undefined); - resolve(); - return; - } - - _this[_this.op].call(_this, function(error, res) { - if (error) { - callback && callback(error); - reject(error); - return; - } - callback && callback.apply(null, arguments); - resolve(res); - }); - }); -}; - -/** - * Finds the schema for `path`. This is different than - * calling `schema.path` as it also resolves paths with - * positional selectors (something.$.another.$.path). - * - * @param {String} path - * @api private - */ - -Query.prototype._getSchema = function _getSchema(path) { - return this.model._getSchema(path); -}; - -/*! - * These operators require casting docs - * to real Documents for Update operations. - */ - -var castOps = { - $push: 1 - , $pushAll: 1 - , $addToSet: 1 - , $set: 1 -}; - -/*! - * These operators should be cast to numbers instead - * of their path schema type. - */ - -var numberOps = { - $pop: 1 - , $unset: 1 - , $inc: 1 -}; - -/** - * Casts obj for an update command. - * - * @param {Object} obj - * @return {Object} obj after casting its values - * @api private - */ - -Query.prototype._castUpdate = function _castUpdate(obj, overwrite) { - if (!obj) return undefined; - - var ops = Object.keys(obj) - , i = ops.length - , ret = {} - , hasKeys - , val; - - while (i--) { - var op = ops[i]; - // if overwrite is set, don't do any of the special $set stuff - if ('$' !== op[0] && !overwrite) { - // fix up $set sugar - if (!ret.$set) { - if (obj.$set) { - ret.$set = obj.$set; - } else { - ret.$set = {}; - } - } - ret.$set[op] = obj[op]; - ops.splice(i, 1); - if (!~ops.indexOf('$set')) ops.push('$set'); - } else if ('$set' === op) { - if (!ret.$set) { - ret[op] = obj[op]; - } - } else { - ret[op] = obj[op]; - } - } - - // cast each value - i = ops.length; - - // if we get passed {} for the update, we still need to respect that when it - // is an overwrite scenario - if (overwrite) { - hasKeys = true; - } - - while (i--) { - op = ops[i]; - val = ret[op]; - if (val && 'Object' === val.constructor.name && !overwrite) { - hasKeys |= this._walkUpdatePath(val, op); - } else if (overwrite && 'Object' === ret.constructor.name) { - // if we are just using overwrite, cast the query and then we will - // *always* return the value, even if it is an empty object. We need to - // set hasKeys above because we need to account for the case where the - // user passes {} and wants to clobber the whole document - // Also, _walkUpdatePath expects an operation, so give it $set since that - // is basically what we're doing - this._walkUpdatePath(ret.$set || ret, '$set'); - } else { - var msg = 'Invalid atomic update value for ' + op + '. ' - + 'Expected an object, received ' + typeof val; - throw new Error(msg); - } - } - - return hasKeys && ret; -}; - -/** - * Walk each path of obj and cast its values - * according to its schema. - * - * @param {Object} obj - part of a query - * @param {String} op - the atomic operator ($pull, $set, etc) - * @param {String} pref - path prefix (internal only) - * @return {Bool} true if this path has keys to update - * @api private - */ - -Query.prototype._walkUpdatePath = function _walkUpdatePath(obj, op, pref) { - var prefix = pref ? pref + '.' : '' - , keys = Object.keys(obj) - , i = keys.length - , hasKeys = false - , schema - , key - , val; - - var strict = 'strict' in this._mongooseOptions - ? this._mongooseOptions.strict - : this.model.schema.options.strict; - - while (i--) { - key = keys[i]; - val = obj[key]; - - if (val && 'Object' === val.constructor.name) { - // watch for embedded doc schemas - schema = this._getSchema(prefix + key); - if (schema && schema.caster && op in castOps) { - // embedded doc schema - hasKeys = true; - - if ('$each' in val) { - obj[key] = { - $each: this._castUpdateVal(schema, val.$each, op) - }; - - if (val.$slice != null) { - obj[key].$slice = val.$slice | 0; - } - - if (val.$sort) { - obj[key].$sort = val.$sort; - } - - if (!!val.$position || val.$position === 0) { - obj[key].$position = val.$position; - } - } else { - obj[key] = this._castUpdateVal(schema, val, op); - } - } else if (op === '$currentDate') { - // $currentDate can take an object - obj[key] = this._castUpdateVal(schema, val, op); - hasKeys = true; - } else if (op === '$set' && schema) { - obj[key] = this._castUpdateVal(schema, val, op); - hasKeys = true; - } else { - var pathToCheck = (prefix + key).replace(/\.\$$/, ''); - pathToCheck = pathToCheck.replace('.$.', '.0.'); - var positionalPath = (prefix + '0.' + key).replace(/\.\$$/, ''); - positionalPath = positionalPath.replace('.$.', '.0.'); - if (this.model.schema.pathType(pathToCheck) === 'adhocOrUndefined' && - !this.model.schema.hasMixedParent(pathToCheck) && - this.model.schema.pathType(positionalPath) === 'adhocOrUndefined' && - !this.model.schema.hasMixedParent(positionalPath)) { - if (strict === 'throw') { - throw new Error('Field `' + pathToCheck + '` is not in schema.'); - } else if (strict) { - delete obj[key]; - continue; - } - } - - // gh-2314 - // we should be able to set a schema-less field - // to an empty object literal - hasKeys |= this._walkUpdatePath(val, op, prefix + key) || - (utils.isObject(val) && Object.keys(val).length === 0); - } - } else { - schema = ('$each' === key || '$or' === key || '$and' === key) - ? this._getSchema(pref) - : this._getSchema(prefix + key); - - var skip = strict && - !schema && - !/real|nested/.test(this.model.schema.pathType(prefix + key)); - - if (skip) { - if ('throw' == strict) { - throw new Error('Field `' + prefix + key + '` is not in schema.'); - } else { - delete obj[key]; - } - } else { - // gh-1845 temporary fix: ignore $rename. See gh-3027 for tracking - // improving this. - if (op === '$rename') { - hasKeys = true; - return; - } - - hasKeys = true; - obj[key] = this._castUpdateVal(schema, val, op, key); - } - } - } - return hasKeys; -}; - -/** - * Casts `val` according to `schema` and atomic `op`. - * - * @param {Schema} schema - * @param {Object} val - * @param {String} op - the atomic operator ($pull, $set, etc) - * @param {String} [$conditional] - * @api private - */ - -Query.prototype._castUpdateVal = function _castUpdateVal(schema, val, op, $conditional) { - if (!schema) { - // non-existing schema path - return op in numberOps - ? Number(val) - : val; - } - - var cond = schema.caster && op in castOps && - (utils.isObject(val) || Array.isArray(val)); - if (cond) { - // Cast values for ops that add data to MongoDB. - // Ensures embedded documents get ObjectIds etc. - var tmp = schema.cast(val); - - if (Array.isArray(val)) { - val = tmp; - } else { - val = tmp[0]; - } - } - - if (op in numberOps) { - return Number(val); - } - if (op === '$currentDate') { - if (typeof val === 'object') { - return { $type: val.$type }; - } - return Boolean(val); - } - if (/^\$/.test($conditional)) { - return schema.castForQuery($conditional, val); - } - - return schema.castForQuery(val); -}; - -/*! - * castQuery - * @api private - */ - -function castQuery(query) { - try { - return query.cast(query.model); - } catch (err) { - return err; - } -} - -/*! - * castDoc - * @api private - */ - -function castDoc(query, overwrite) { - try { - return query._castUpdate(query._update, overwrite); - } catch (err) { - return err; - } -} - -/** - * Specifies paths which should be populated with other documents. - * - * ####Example: - * - * Kitten.findOne().populate('owner').exec(function (err, kitten) { - * console.log(kitten.owner.name) // Max - * }) - * - * Kitten.find().populate({ - * path: 'owner' - * , select: 'name' - * , match: { color: 'black' } - * , options: { sort: { name: -1 }} - * }).exec(function (err, kittens) { - * console.log(kittens[0].owner.name) // Zoopa - * }) - * - * // alternatively - * Kitten.find().populate('owner', 'name', null, {sort: { name: -1 }}).exec(function (err, kittens) { - * console.log(kittens[0].owner.name) // Zoopa - * }) - * - * Paths are populated after the query executes and a response is received. A separate query is then executed for each path specified for population. After a response for each query has also been returned, the results are passed to the callback. - * - * @param {Object|String} path either the path to populate or an object specifying all parameters - * @param {Object|String} [select] Field selection for the population query - * @param {Model} [model] The name of the model you wish to use for population. If not specified, the name is looked up from the Schema ref. - * @param {Object} [match] Conditions for the population query - * @param {Object} [options] Options for the population query (sort, etc) - * @see population ./populate.html - * @see Query#select #query_Query-select - * @see Model.populate #model_Model.populate - * @return {Query} this - * @api public - */ - -Query.prototype.populate = function() { - var res = utils.populate.apply(null, arguments); - var opts = this._mongooseOptions; - - if (!utils.isObject(opts.populate)) { - opts.populate = {}; - } - - for (var i = 0; i < res.length; ++i) { - opts.populate[res[i].path] = res[i]; - } - - return this; -}; - -/** - * Casts this query to the schema of `model` - * - * ####Note - * - * If `obj` is present, it is cast instead of this query. - * - * @param {Model} model - * @param {Object} [obj] - * @return {Object} - * @api public - */ - -Query.prototype.cast = function(model, obj) { - obj || (obj = this._conditions); - - return cast(model.schema, obj); -}; - -/** - * Casts selected field arguments for field selection with mongo 2.2 - * - * query.select({ ids: { $elemMatch: { $in: [hexString] }}) - * - * @param {Object} fields - * @see https://github.com/Automattic/mongoose/issues/1091 - * @see http://docs.mongodb.org/manual/reference/projection/elemMatch/ - * @api private - */ - -Query.prototype._castFields = function _castFields(fields) { - var selected - , elemMatchKeys - , keys - , key - , out - , i; - - if (fields) { - keys = Object.keys(fields); - elemMatchKeys = []; - i = keys.length; - - // collect $elemMatch args - while (i--) { - key = keys[i]; - if (fields[key].$elemMatch) { - selected || (selected = {}); - selected[key] = fields[key]; - elemMatchKeys.push(key); - } - } - } - - if (selected) { - // they passed $elemMatch, cast em - try { - out = this.cast(this.model, selected); - } catch (err) { - return err; - } - - // apply the casted field args - i = elemMatchKeys.length; - while (i--) { - key = elemMatchKeys[i]; - fields[key] = out[key]; - } - } - - return fields; -}; - -/** - * Applies schematype selected options to this query. - * @api private - */ - -Query.prototype._applyPaths = function applyPaths() { - // determine if query is selecting or excluding fields - - var fields = this._fields - , exclude - , keys - , ki; - - if (fields) { - keys = Object.keys(fields); - ki = keys.length; - - while (ki--) { - if ('+' == keys[ki][0]) continue; - exclude = 0 === fields[keys[ki]]; - break; - } - } - - // if selecting, apply default schematype select:true fields - // if excluding, apply schematype select:false fields - - var selected = [] - , excluded = [] - , seen = []; - - var analyzePath = function(path, type) { - if ('boolean' != typeof type.selected) return; - - var plusPath = '+' + path; - if (fields && plusPath in fields) { - // forced inclusion - delete fields[plusPath]; - - // if there are other fields being included, add this one - // if no other included fields, leave this out (implied inclusion) - if (false === exclude && keys.length > 1 && !~keys.indexOf(path)) { - fields[path] = 1; - } - - return; - } - - // check for parent exclusions - var root = path.split('.')[0]; - if (~excluded.indexOf(root)) return; - - (type.selected ? selected : excluded).push(path); - }; - - var analyzeSchema = function(schema, prefix) { - prefix || (prefix = ''); - - // avoid recursion - if (~seen.indexOf(schema)) return; - seen.push(schema); - - schema.eachPath(function(path, type) { - if (prefix) path = prefix + '.' + path; - - analyzePath(path, type); - - // array of subdocs? - if (type.schema) { - analyzeSchema(type.schema, path); - } - - }); - }; - - analyzeSchema(this.model.schema); - - switch (exclude) { - case true: - excluded.length && this.select('-' + excluded.join(' -')); - break; - case false: - if (this.model.schema && this.model.schema.paths['_id'] && - this.model.schema.paths['_id'].options && this.model.schema.paths['_id'].options.select === false) { - selected.push('-_id'); - } - selected.length && this.select(selected.join(' ')); - break; - case undefined: - // user didn't specify fields, implies returning all fields. - // only need to apply excluded fields - excluded.length && this.select('-' + excluded.join(' -')); - break; - } - - return seen = excluded = selected = keys = fields = null; -}; - -/** - * Returns a Node.js 0.8 style [read stream](http://nodejs.org/docs/v0.8.21/api/stream.html#stream_readable_stream) interface. - * - * ####Example - * - * // follows the nodejs 0.8 stream api - * Thing.find({ name: /^hello/ }).stream().pipe(res) - * - * // manual streaming - * var stream = Thing.find({ name: /^hello/ }).stream(); - * - * stream.on('data', function (doc) { - * // do something with the mongoose document - * }).on('error', function (err) { - * // handle the error - * }).on('close', function () { - * // the stream is closed - * }); - * - * ####Valid options - * - * - `transform`: optional function which accepts a mongoose document. The return value of the function will be emitted on `data`. - * - * ####Example - * - * // JSON.stringify all documents before emitting - * var stream = Thing.find().stream({ transform: JSON.stringify }); - * stream.pipe(writeStream); - * - * @return {QueryStream} - * @param {Object} [options] - * @see QueryStream - * @api public - */ - -Query.prototype.stream = function stream(opts) { - this._applyPaths(); - this._fields = this._castFields(this._fields); - return new QueryStream(this, opts); -}; - -// the rest of these are basically to support older Mongoose syntax with mquery - -/** - * _DEPRECATED_ Alias of `maxScan` - * - * @deprecated - * @see maxScan #query_Query-maxScan - * @method maxscan - * @memberOf Query - */ - -Query.prototype.maxscan = Query.base.maxScan; - -/** - * Sets the tailable option (for use with capped collections). - * - * ####Example - * - * query.tailable() // true - * query.tailable(true) - * query.tailable(false) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Boolean} bool defaults to true - * @see tailable http://docs.mongodb.org/manual/tutorial/create-tailable-cursor/ - * @api public - */ - -Query.prototype.tailable = function(val, opts) { - // we need to support the tailable({ awaitdata : true }) as well as the - // tailable(true, {awaitdata :true}) syntax that mquery does not support - if (val && val.constructor.name == 'Object') { - opts = val; - val = true; - } - - if (val === undefined) { - val = true; - } - - if (opts && typeof opts === 'object') { - for (var key in opts) { - if (key === 'awaitdata') { - // For backwards compatibility - this.options[key] = !!opts[key]; - } else { - this.options[key] = opts[key]; - } - } - } - - return Query.base.tailable.call(this, val); -}; - -/** - * Declares an intersects query for `geometry()`. - * - * ####Example - * - * query.where('path').intersects().geometry({ - * type: 'LineString' - * , coordinates: [[180.0, 11.0], [180, 9.0]] - * }) - * - * query.where('path').intersects({ - * type: 'LineString' - * , coordinates: [[180.0, 11.0], [180, 9.0]] - * }) - * - * ####NOTE: - * - * **MUST** be used after `where()`. - * - * ####NOTE: - * - * In Mongoose 3.7, `intersects` changed from a getter to a function. If you need the old syntax, use [this](https://github.com/ebensing/mongoose-within). - * - * @method intersects - * @memberOf Query - * @param {Object} [arg] - * @return {Query} this - * @see $geometry http://docs.mongodb.org/manual/reference/operator/geometry/ - * @see geoIntersects http://docs.mongodb.org/manual/reference/operator/geoIntersects/ - * @api public - */ - -/** - * Specifies a `$geometry` condition - * - * ####Example - * - * var polyA = [[[ 10, 20 ], [ 10, 40 ], [ 30, 40 ], [ 30, 20 ]]] - * query.where('loc').within().geometry({ type: 'Polygon', coordinates: polyA }) - * - * // or - * var polyB = [[ 0, 0 ], [ 1, 1 ]] - * query.where('loc').within().geometry({ type: 'LineString', coordinates: polyB }) - * - * // or - * var polyC = [ 0, 0 ] - * query.where('loc').within().geometry({ type: 'Point', coordinates: polyC }) - * - * // or - * query.where('loc').intersects().geometry({ type: 'Point', coordinates: polyC }) - * - * The argument is assigned to the most recent path passed to `where()`. - * - * ####NOTE: - * - * `geometry()` **must** come after either `intersects()` or `within()`. - * - * The `object` argument must contain `type` and `coordinates` properties. - * - type {String} - * - coordinates {Array} - * - * @method geometry - * @memberOf Query - * @param {Object} object Must contain a `type` property which is a String and a `coordinates` property which is an Array. See the examples. - * @return {Query} this - * @see $geometry http://docs.mongodb.org/manual/reference/operator/geometry/ - * @see http://docs.mongodb.org/manual/release-notes/2.4/#new-geospatial-indexes-with-geojson-and-improved-spherical-geometry - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -/** - * Specifies a `$near` or `$nearSphere` condition - * - * These operators return documents sorted by distance. - * - * ####Example - * - * query.where('loc').near({ center: [10, 10] }); - * query.where('loc').near({ center: [10, 10], maxDistance: 5 }); - * query.where('loc').near({ center: [10, 10], maxDistance: 5, spherical: true }); - * query.near('loc', { center: [10, 10], maxDistance: 5 }); - * - * @method near - * @memberOf Query - * @param {String} [path] - * @param {Object} val - * @return {Query} this - * @see $near http://docs.mongodb.org/manual/reference/operator/near/ - * @see $nearSphere http://docs.mongodb.org/manual/reference/operator/nearSphere/ - * @see $maxDistance http://docs.mongodb.org/manual/reference/operator/maxDistance/ - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -/*! - * Overwriting mquery is needed to support a couple different near() forms found in older - * versions of mongoose - * near([1,1]) - * near(1,1) - * near(field, [1,2]) - * near(field, 1, 2) - * In addition to all of the normal forms supported by mquery - */ - -Query.prototype.near = function() { - var params = []; - var sphere = this._mongooseOptions.nearSphere; - - // TODO refactor - - if (arguments.length === 1) { - if (Array.isArray(arguments[0])) { - params.push({ center: arguments[0], spherical: sphere }); - } else if ('string' == typeof arguments[0]) { - // just passing a path - params.push(arguments[0]); - } else if (utils.isObject(arguments[0])) { - if ('boolean' != typeof arguments[0].spherical) { - arguments[0].spherical = sphere; - } - params.push(arguments[0]); - } else { - throw new TypeError('invalid argument'); - } - } else if (arguments.length === 2) { - if ('number' == typeof arguments[0] && 'number' == typeof arguments[1]) { - params.push({ center: [arguments[0], arguments[1]], spherical: sphere}); - } else if ('string' == typeof arguments[0] && Array.isArray(arguments[1])) { - params.push(arguments[0]); - params.push({ center: arguments[1], spherical: sphere }); - } else if ('string' == typeof arguments[0] && utils.isObject(arguments[1])) { - params.push(arguments[0]); - if ('boolean' != typeof arguments[1].spherical) { - arguments[1].spherical = sphere; - } - params.push(arguments[1]); - } else { - throw new TypeError('invalid argument'); - } - } else if (arguments.length === 3) { - if ('string' == typeof arguments[0] && 'number' == typeof arguments[1] - && 'number' == typeof arguments[2]) { - params.push(arguments[0]); - params.push({ center: [arguments[1], arguments[2]], spherical: sphere }); - } else { - throw new TypeError('invalid argument'); - } - } else { - throw new TypeError('invalid argument'); - } - - return Query.base.near.apply(this, params); -}; - -/** - * _DEPRECATED_ Specifies a `$nearSphere` condition - * - * ####Example - * - * query.where('loc').nearSphere({ center: [10, 10], maxDistance: 5 }); - * - * **Deprecated.** Use `query.near()` instead with the `spherical` option set to `true`. - * - * ####Example - * - * query.where('loc').near({ center: [10, 10], spherical: true }); - * - * @deprecated - * @see near() #query_Query-near - * @see $near http://docs.mongodb.org/manual/reference/operator/near/ - * @see $nearSphere http://docs.mongodb.org/manual/reference/operator/nearSphere/ - * @see $maxDistance http://docs.mongodb.org/manual/reference/operator/maxDistance/ - */ - -Query.prototype.nearSphere = function() { - this._mongooseOptions.nearSphere = true; - this.near.apply(this, arguments); - return this; -}; - -/** - * Specifies a $polygon condition - * - * ####Example - * - * query.where('loc').within().polygon([10,20], [13, 25], [7,15]) - * query.polygon('loc', [10,20], [13, 25], [7,15]) - * - * @method polygon - * @memberOf Query - * @param {String|Array} [path] - * @param {Array|Object} [coordinatePairs...] - * @return {Query} this - * @see $polygon http://docs.mongodb.org/manual/reference/operator/polygon/ - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -/** - * Specifies a $box condition - * - * ####Example - * - * var lowerLeft = [40.73083, -73.99756] - * var upperRight= [40.741404, -73.988135] - * - * query.where('loc').within().box(lowerLeft, upperRight) - * query.box({ ll : lowerLeft, ur : upperRight }) - * - * @method box - * @memberOf Query - * @see $box http://docs.mongodb.org/manual/reference/operator/box/ - * @see within() Query#within #query_Query-within - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @param {Object} val - * @param [Array] Upper Right Coords - * @return {Query} this - * @api public - */ - -/*! - * this is needed to support the mongoose syntax of: - * box(field, { ll : [x,y], ur : [x2,y2] }) - * box({ ll : [x,y], ur : [x2,y2] }) - */ - -Query.prototype.box = function(ll, ur) { - if (!Array.isArray(ll) && utils.isObject(ll)) { - ur = ll.ur; - ll = ll.ll; - } - return Query.base.box.call(this, ll, ur); -}; - -/** - * Specifies a $center or $centerSphere condition. - * - * ####Example - * - * var area = { center: [50, 50], radius: 10, unique: true } - * query.where('loc').within().circle(area) - * // alternatively - * query.circle('loc', area); - * - * // spherical calculations - * var area = { center: [50, 50], radius: 10, unique: true, spherical: true } - * query.where('loc').within().circle(area) - * // alternatively - * query.circle('loc', area); - * - * New in 3.7.0 - * - * @method circle - * @memberOf Query - * @param {String} [path] - * @param {Object} area - * @return {Query} this - * @see $center http://docs.mongodb.org/manual/reference/operator/center/ - * @see $centerSphere http://docs.mongodb.org/manual/reference/operator/centerSphere/ - * @see $geoWithin http://docs.mongodb.org/manual/reference/operator/within/ - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -/** - * _DEPRECATED_ Alias for [circle](#query_Query-circle) - * - * **Deprecated.** Use [circle](#query_Query-circle) instead. - * - * @deprecated - * @method center - * @memberOf Query - * @api public - */ - -Query.prototype.center = Query.base.circle; - -/** - * _DEPRECATED_ Specifies a $centerSphere condition - * - * **Deprecated.** Use [circle](#query_Query-circle) instead. - * - * ####Example - * - * var area = { center: [50, 50], radius: 10 }; - * query.where('loc').within().centerSphere(area); - * - * @deprecated - * @param {String} [path] - * @param {Object} val - * @return {Query} this - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @see $centerSphere http://docs.mongodb.org/manual/reference/operator/centerSphere/ - * @api public - */ - -Query.prototype.centerSphere = function() { - if (arguments[0] && arguments[0].constructor.name == 'Object') { - arguments[0].spherical = true; - } - - if (arguments[1] && arguments[1].constructor.name == 'Object') { - arguments[1].spherical = true; - } - - Query.base.circle.apply(this, arguments); -}; - -/** - * Determines if field selection has been made. - * - * @method selected - * @memberOf Query - * @return {Boolean} - * @api public - */ - -/** - * Executes this query and returns a promise - * - * @method then - * @memberOf Query - * @return {Promise} - * @api public - */ - -/** - * Determines if inclusive field selection has been made. - * - * query.selectedInclusively() // false - * query.select('name') - * query.selectedInclusively() // true - * - * @method selectedInclusively - * @memberOf Query - * @return {Boolean} - * @api public - */ - -/** - * Determines if exclusive field selection has been made. - * - * query.selectedExclusively() // false - * query.select('-name') - * query.selectedExclusively() // true - * query.selectedInclusively() // false - * - * @method selectedExclusively - * @memberOf Query - * @return {Boolean} - * @api public - */ - -/*! - * Export - */ - -module.exports = Query; diff --git a/Associations/node_modules/mongoose/lib/queryhelpers.js b/Associations/node_modules/mongoose/lib/queryhelpers.js deleted file mode 100644 index 3e0b82d7..00000000 --- a/Associations/node_modules/mongoose/lib/queryhelpers.js +++ /dev/null @@ -1,78 +0,0 @@ - -/*! - * Module dependencies - */ - -var utils = require('./utils'); - -/*! - * Prepare a set of path options for query population. - * - * @param {Query} query - * @param {Object} options - * @return {Array} - */ - -exports.preparePopulationOptions = function preparePopulationOptions(query, options) { - var pop = utils.object.vals(query.options.populate); - - // lean options should trickle through all queries - if (options.lean) pop.forEach(makeLean); - - return pop; -}; - -/*! - * Prepare a set of path options for query population. This is the MongooseQuery - * version - * - * @param {Query} query - * @param {Object} options - * @return {Array} - */ - -exports.preparePopulationOptionsMQ = function preparePopulationOptionsMQ(query, options) { - var pop = utils.object.vals(query._mongooseOptions.populate); - - // lean options should trickle through all queries - if (options.lean) pop.forEach(makeLean); - - return pop; -}; - -/*! - * If the document is a mapped discriminator type, it returns a model instance for that type, otherwise, - * it returns an instance of the given model. - * - * @param {Model} model - * @param {Object} doc - * @param {Object} fields - * - * @return {Model} - */ -exports.createModel = function createModel(model, doc, fields) { - var discriminatorMapping = model.schema - ? model.schema.discriminatorMapping - : null; - - var key = discriminatorMapping && discriminatorMapping.isRoot - ? discriminatorMapping.key - : null; - - if (key && doc[key] && model.discriminators && model.discriminators[doc[key]]) { - return new model.discriminators[doc[key]](undefined, fields, true); - } - - return new model(undefined, fields, true); -}; - -/*! - * Set each path query option to lean - * - * @param {Object} option - */ - -function makeLean(option) { - option.options || (option.options = {}); - option.options.lean = true; -} diff --git a/Associations/node_modules/mongoose/lib/querystream.js b/Associations/node_modules/mongoose/lib/querystream.js deleted file mode 100644 index b21410d8..00000000 --- a/Associations/node_modules/mongoose/lib/querystream.js +++ /dev/null @@ -1,346 +0,0 @@ -/* eslint no-empty: 1 */ - -/*! - * Module dependencies. - */ - -var Stream = require('stream').Stream; -var utils = require('./utils'); -var helpers = require('./queryhelpers'); -var K = function(k) { return k; }; - -/** - * Provides a Node.js 0.8 style [ReadStream](http://nodejs.org/docs/v0.8.21/api/stream.html#stream_readable_stream) interface for Queries. - * - * var stream = Model.find().stream(); - * - * stream.on('data', function (doc) { - * // do something with the mongoose document - * }).on('error', function (err) { - * // handle the error - * }).on('close', function () { - * // the stream is closed - * }); - * - * - * The stream interface allows us to simply "plug-in" to other _Node.js 0.8_ style write streams. - * - * Model.where('created').gte(twoWeeksAgo).stream().pipe(writeStream); - * - * ####Valid options - * - * - `transform`: optional function which accepts a mongoose document. The return value of the function will be emitted on `data`. - * - * ####Example - * - * // JSON.stringify all documents before emitting - * var stream = Thing.find().stream({ transform: JSON.stringify }); - * stream.pipe(writeStream); - * - * _NOTE: plugging into an HTTP response will *not* work out of the box. Those streams expect only strings or buffers to be emitted, so first formatting our documents as strings/buffers is necessary._ - * - * _NOTE: these streams are Node.js 0.8 style read streams which differ from Node.js 0.10 style. Node.js 0.10 streams are not well tested yet and are not guaranteed to work._ - * - * @param {Query} query - * @param {Object} [options] - * @inherits NodeJS Stream http://nodejs.org/docs/v0.8.21/api/stream.html#stream_readable_stream - * @event `data`: emits a single Mongoose document - * @event `error`: emits when an error occurs during streaming. This will emit _before_ the `close` event. - * @event `close`: emits when the stream reaches the end of the cursor or an error occurs, or the stream is manually `destroy`ed. After this event, no more events are emitted. - * @api public - */ - -function QueryStream(query, options) { - Stream.call(this); - - this.query = query; - this.readable = true; - this.paused = false; - this._cursor = null; - this._destroyed = null; - this._fields = null; - this._buffer = null; - this._inline = T_INIT; - this._running = false; - this._transform = options && 'function' == typeof options.transform - ? options.transform - : K; - - // give time to hook up events - var self = this; - process.nextTick(function() { - self._init(); - }); -} - -/*! - * Inherit from Stream - */ - -QueryStream.prototype.__proto__ = Stream.prototype; - -/** - * Flag stating whether or not this stream is readable. - * - * @property readable - * @api public - */ - -QueryStream.prototype.readable; - -/** - * Flag stating whether or not this stream is paused. - * - * @property paused - * @api public - */ - -QueryStream.prototype.paused; - -// trampoline flags -var T_INIT = 0; -var T_IDLE = 1; -var T_CONT = 2; - -/** - * Initializes the query. - * - * @api private - */ - -QueryStream.prototype._init = function() { - if (this._destroyed) return; - - var query = this.query - , model = query.model - , options = query._optionsForExec(model) - , self = this; - - try { - query.cast(model); - } catch (err) { - return self.destroy(err); - } - - self._fields = utils.clone(query._fields); - options.fields = query._castFields(self._fields); - - model.collection.find(query._conditions, options, function(err, cursor) { - if (err) return self.destroy(err); - self._cursor = cursor; - self._next(); - }); -}; - -/** - * Trampoline for pulling the next doc from cursor. - * - * @see QueryStream#__next #querystream_QueryStream-__next - * @api private - */ - -QueryStream.prototype._next = function _next() { - if (this.paused || this._destroyed) { - return this._running = false; - } - - this._running = true; - - if (this._buffer && this._buffer.length) { - var arg; - while (!this.paused && !this._destroyed && (arg = this._buffer.shift())) { - this._onNextObject.apply(this, arg); - } - } - - // avoid stack overflows with large result sets. - // trampoline instead of recursion. - while (this.__next()) {} -}; - -/** - * Pulls the next doc from the cursor. - * - * @see QueryStream#_next #querystream_QueryStream-_next - * @api private - */ - -QueryStream.prototype.__next = function() { - if (this.paused || this._destroyed) - return this._running = false; - - var self = this; - self._inline = T_INIT; - - self._cursor.nextObject(function cursorcb(err, doc) { - self._onNextObject(err, doc); - }); - - // if onNextObject() was already called in this tick - // return ourselves to the trampoline. - if (T_CONT === this._inline) { - return true; - } else { - // onNextObject() hasn't fired yet. tell onNextObject - // that its ok to call _next b/c we are not within - // the trampoline anymore. - this._inline = T_IDLE; - } -}; - -/** - * Transforms raw `doc`s returned from the cursor into a model instance. - * - * @param {Error|null} err - * @param {Object} doc - * @api private - */ - -QueryStream.prototype._onNextObject = function _onNextObject(err, doc) { - if (this._destroyed) return; - - if (this.paused) { - this._buffer || (this._buffer = []); - this._buffer.push([err, doc]); - return this._running = false; - } - - if (err) return this.destroy(err); - - // when doc is null we hit the end of the cursor - if (!doc) { - this.emit('end'); - return this.destroy(); - } - - var opts = this.query._mongooseOptions; - - if (!opts.populate) { - return true === opts.lean ? - emit(this, doc) : - createAndEmit(this, null, doc); - } - - var self = this; - var pop = helpers.preparePopulationOptionsMQ(self.query, self.query._mongooseOptions); - - // Hack to work around gh-3108 - pop.forEach(function(option) { - delete option.model; - }); - - self.query.model.populate(doc, pop, function(err, doc) { - if (err) return self.destroy(err); - return true === opts.lean ? - emit(self, doc) : - createAndEmit(self, pop, doc); - }); -}; - -function createAndEmit(self, populatedIds, doc) { - var instance = helpers.createModel(self.query.model, doc, self._fields); - var opts = populatedIds ? - { populated: populatedIds } : - undefined; - - instance.init(doc, opts, function(err) { - if (err) return self.destroy(err); - emit(self, instance); - }); -} - -/*! - * Emit a data event and manage the trampoline state - */ - -function emit(self, doc) { - self.emit('data', self._transform(doc)); - - // trampoline management - if (T_IDLE === self._inline) { - // no longer in trampoline. restart it. - self._next(); - } else { - // in a trampoline. tell __next that its - // ok to continue jumping. - self._inline = T_CONT; - } -} - -/** - * Pauses this stream. - * - * @api public - */ - -QueryStream.prototype.pause = function() { - this.paused = true; -}; - -/** - * Resumes this stream. - * - * @api public - */ - -QueryStream.prototype.resume = function() { - this.paused = false; - - if (!this._cursor) { - // cannot start if not initialized - return; - } - - // are we within the trampoline? - if (T_INIT === this._inline) { - return; - } - - if (!this._running) { - // outside QueryStream control, need manual restart - return this._next(); - } -}; - -/** - * Destroys the stream, closing the underlying cursor. No more events will be emitted. - * - * @param {Error} [err] - * @api public - */ - -QueryStream.prototype.destroy = function(err) { - if (this._destroyed) return; - this._destroyed = true; - this._running = false; - this.readable = false; - - if (this._cursor) { - this._cursor.close(); - } - - if (err) { - this.emit('error', err); - } - - this.emit('close'); -}; - -/** - * Pipes this query stream into another stream. This method is inherited from NodeJS Streams. - * - * ####Example: - * - * query.stream().pipe(writeStream [, options]) - * - * @method pipe - * @memberOf QueryStream - * @see NodeJS http://nodejs.org/api/stream.html - * @api public - */ - -/*! - * Module exports - */ - -module.exports = exports = QueryStream; diff --git a/Associations/node_modules/mongoose/lib/schema.js b/Associations/node_modules/mongoose/lib/schema.js deleted file mode 100644 index bd30605e..00000000 --- a/Associations/node_modules/mongoose/lib/schema.js +++ /dev/null @@ -1,1181 +0,0 @@ -/*! - * Module dependencies. - */ - -var readPref = require('./drivers').ReadPreference - , EventEmitter = require('events').EventEmitter - , VirtualType = require('./virtualtype') - , utils = require('./utils') - , MongooseTypes - , Kareem = require('kareem') - , async = require('async') - , PromiseProvider = require('./promise_provider'); - - -var IS_QUERY_HOOK = { - count: true, - find: true, - findOne: true, - findOneAndUpdate: true, - findOneAndRemove: true, - update: true -}; - -/** - * Schema constructor. - * - * ####Example: - * - * var child = new Schema({ name: String }); - * var schema = new Schema({ name: String, age: Number, children: [child] }); - * var Tree = mongoose.model('Tree', schema); - * - * // setting schema options - * new Schema({ name: String }, { _id: false, autoIndex: false }) - * - * ####Options: - * - * - [autoIndex](/docs/guide.html#autoIndex): bool - defaults to null (which means use the connection's autoIndex option) - * - [bufferCommands](/docs/guide.html#bufferCommands): bool - defaults to true - * - [capped](/docs/guide.html#capped): bool - defaults to false - * - [collection](/docs/guide.html#collection): string - no default - * - [id](/docs/guide.html#id): bool - defaults to true - * - [_id](/docs/guide.html#_id): bool - defaults to true - * - `minimize`: bool - controls [document#toObject](#document_Document-toObject) behavior when called manually - defaults to true - * - [read](/docs/guide.html#read): string - * - [safe](/docs/guide.html#safe): bool - defaults to true. - * - [shardKey](/docs/guide.html#shardKey): bool - defaults to `null` - * - [strict](/docs/guide.html#strict): bool - defaults to true - * - [toJSON](/docs/guide.html#toJSON) - object - no default - * - [toObject](/docs/guide.html#toObject) - object - no default - * - [validateBeforeSave](/docs/guide.html#validateBeforeSave) - bool - defaults to `true` - * - [versionKey](/docs/guide.html#versionKey): bool - defaults to "__v" - * - * ####Note: - * - * _When nesting schemas, (`children` in the example above), always declare the child schema first before passing it into its parent._ - * - * @param {Object} definition - * @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter - * @event `init`: Emitted after the schema is compiled into a `Model`. - * @api public - */ - -function Schema(obj, options) { - if (!(this instanceof Schema)) - return new Schema(obj, options); - - this.paths = {}; - this.subpaths = {}; - this.virtuals = {}; - this.nested = {}; - this.inherits = {}; - this.callQueue = []; - this._indexes = []; - this.methods = {}; - this.statics = {}; - this.tree = {}; - this._requiredpaths = undefined; - this.discriminatorMapping = undefined; - this._indexedpaths = undefined; - - this.s = { - hooks: new Kareem(), - queryHooks: IS_QUERY_HOOK - }; - - this.options = this.defaultOptions(options); - - // build paths - if (obj) { - this.add(obj); - } - - // check if _id's value is a subdocument (gh-2276) - var _idSubDoc = obj && obj._id && utils.isObject(obj._id); - - // ensure the documents get an auto _id unless disabled - var auto_id = !this.paths['_id'] && (!this.options.noId && this.options._id) && !_idSubDoc; - - if (auto_id) { - this.add({ _id: {type: Schema.ObjectId, auto: true} }); - } - - // ensure the documents receive an id getter unless disabled - var autoid = !this.paths['id'] && (!this.options.noVirtualId && this.options.id); - if (autoid) { - this.virtual('id').get(idGetter); - } - - for (var i = 0; i < this._defaultMiddleware.length; ++i) { - var m = this._defaultMiddleware[i]; - this[m.kind](m.hook, !!m.isAsync, m.fn); - } - - // adds updatedAt and createdAt timestamps to documents if enabled - var timestamps = this.options.timestamps; - if (timestamps) { - var createdAt = timestamps.createdAt || 'createdAt' - , updatedAt = timestamps.updatedAt || 'updatedAt' - , schemaAdditions = {}; - - schemaAdditions[updatedAt] = Date; - - if (!this.paths[createdAt]) { - schemaAdditions[createdAt] = Date; - } - - this.add(schemaAdditions); - - this.pre('save', function(next) { - var defaultTimestamp = new Date(); - - if (!this[createdAt]) { - this[createdAt] = auto_id ? this._id.getTimestamp() : defaultTimestamp; - } - - this[updatedAt] = this.isNew ? this[createdAt] : defaultTimestamp; - - next(); - }); - - var genUpdates = function() { - var now = new Date(); - var updates = {$set: {}, $setOnInsert: {}}; - updates.$set[updatedAt] = now; - updates.$setOnInsert[createdAt] = now; - - return updates; - } - - this.pre('findOneAndUpdate', function(next) { - this.findOneAndUpdate({}, genUpdates()); - next(); - }); - - this.pre('update', function(next) { - this.update({}, genUpdates()); - next(); - }); - } - -} - -/*! - * Returns this documents _id cast to a string. - */ - -function idGetter() { - if (this.$__._id) { - return this.$__._id; - } - - return this.$__._id = null == this._id - ? null - : String(this._id); -} - -/*! - * Inherit from EventEmitter. - */ -Schema.prototype = Object.create( EventEmitter.prototype ); -Schema.prototype.constructor = Schema; - -/** - * Default middleware attached to a schema. Cannot be changed. - * - * This field is used to make sure discriminators don't get multiple copies of - * built-in middleware. Declared as a constant because changing this at runtime - * may lead to instability with Model.prototype.discriminator(). - * - * @api private - * @property _defaultMiddleware - */ -Object.defineProperty(Schema.prototype, '_defaultMiddleware', { - configurable: false, - enumerable: false, - writable: false, - value: [{ - kind: 'pre', - hook: 'save', - fn: function(next) { - // Nested docs have their own presave - if (this.ownerDocument) { - return next(); - } - - // Validate - if (this.schema.options.validateBeforeSave) { - // HACK: use $__original_validate to avoid promises so bluebird doesn't - // complain - if (this.$__original_validate) { - this.$__original_validate({ __noPromise: true }, function(error) { - next(error); - }); - } else { - this.validate({ __noPromise: true }, function(error) { - next(error); - }); - } - } else { - next(); - } - } - }, { - kind: 'pre', - hook: 'save', - isAsync: true, - fn: function(next, done) { - var Promise = PromiseProvider.get(), - subdocs = this.$__getAllSubdocs(); - - if (!subdocs.length || this.$__preSavingFromParent) { - done(); - next(); - return; - } - - new Promise.ES6(function(resolve, reject) { - async.each(subdocs, function(subdoc, cb) { - subdoc.$__preSavingFromParent = true; - subdoc.save(function(err) { - cb(err); - }); - }, function(error) { - for (var i = 0; i < subdocs.length; ++i) { - delete subdocs[i].$__preSavingFromParent; - } - if (error) { - reject(error); - return; - } - resolve(); - }); - }).then(function() { - next(); - done(); - }, done); - } - }] -}); - -/** - * Schema as flat paths - * - * ####Example: - * { - * '_id' : SchemaType, - * , 'nested.key' : SchemaType, - * } - * - * @api private - * @property paths - */ - -Schema.prototype.paths; - -/** - * Schema as a tree - * - * ####Example: - * { - * '_id' : ObjectId - * , 'nested' : { - * 'key' : String - * } - * } - * - * @api private - * @property tree - */ - -Schema.prototype.tree; - -/** - * Returns default options for this schema, merged with `options`. - * - * @param {Object} options - * @return {Object} - * @api private - */ - -Schema.prototype.defaultOptions = function(options) { - if (options && false === options.safe) { - options.safe = { w: 0 }; - } - - if (options && options.safe && 0 === options.safe.w) { - // if you turn off safe writes, then versioning goes off as well - options.versionKey = false; - } - - options = utils.options({ - strict: true - , bufferCommands: true - , capped: false // { size, max, autoIndexId } - , versionKey: '__v' - , discriminatorKey: '__t' - , minimize: true - , autoIndex: null - , shardKey: null - , read: null - , validateBeforeSave: true - // the following are only applied at construction time - , noId: false // deprecated, use { _id: false } - , _id: true - , noVirtualId: false // deprecated, use { id: false } - , id: true -// , pluralization: true // only set this to override the global option - }, options); - - if (options.read) { - options.read = readPref(options.read); - } - - return options; -}; - -/** - * Adds key path / schema type pairs to this schema. - * - * ####Example: - * - * var ToySchema = new Schema; - * ToySchema.add({ name: 'string', color: 'string', price: 'number' }); - * - * @param {Object} obj - * @param {String} prefix - * @api public - */ - -Schema.prototype.add = function add(obj, prefix) { - prefix = prefix || ''; - var keys = Object.keys(obj); - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - - if (null == obj[key]) { - throw new TypeError('Invalid value for schema path `' + prefix + key + '`'); - } - - if (Array.isArray(obj[key]) && obj[key].length === 1 && null == obj[key][0]) { - throw new TypeError('Invalid value for schema Array path `' + prefix + key + '`'); - } - - if (utils.isObject(obj[key]) && (!obj[key].constructor || 'Object' == utils.getFunctionName(obj[key].constructor)) && (!obj[key].type || obj[key].type.type)) { - if (Object.keys(obj[key]).length) { - // nested object { last: { name: String }} - this.nested[prefix + key] = true; - this.add(obj[key], prefix + key + '.'); - } else { - this.path(prefix + key, obj[key]); // mixed type - } - } else { - this.path(prefix + key, obj[key]); - } - } -}; - -/** - * Reserved document keys. - * - * Keys in this object are names that are rejected in schema declarations b/c they conflict with mongoose functionality. Using these key name will throw an error. - * - * on, emit, _events, db, get, set, init, isNew, errors, schema, options, modelName, collection, _pres, _posts, toObject - * - * _NOTE:_ Use of these terms as method names is permitted, but play at your own risk, as they may be existing mongoose document methods you are stomping on. - * - * var schema = new Schema(..); - * schema.methods.init = function () {} // potentially breaking - */ - -Schema.reserved = Object.create(null); -var reserved = Schema.reserved; -// EventEmitter -reserved.emit = -reserved.on = -reserved.once = -// document properties and functions -reserved.collection = -reserved.db = -reserved.errors = -reserved.init = -reserved.isModified = -reserved.isNew = -reserved.get = -reserved.modelName = -reserved.save = -reserved.schema = -reserved.set = -reserved.toObject = -reserved.validate = -// hooks.js -reserved._pres = reserved._posts = 1; - -/** - * Document keys to print warnings for - */ - -var warnings = {}; -warnings.increment = '`increment` should not be used as a schema path name ' + - 'unless you have disabled versioning.'; - -/** - * Gets/sets schema paths. - * - * Sets a path (if arity 2) - * Gets a path (if arity 1) - * - * ####Example - * - * schema.path('name') // returns a SchemaType - * schema.path('name', Number) // changes the schemaType of `name` to Number - * - * @param {String} path - * @param {Object} constructor - * @api public - */ - -Schema.prototype.path = function(path, obj) { - if (obj == undefined) { - if (this.paths[path]) return this.paths[path]; - if (this.subpaths[path]) return this.subpaths[path]; - - // subpaths? - return /\.\d+\.?.*$/.test(path) - ? getPositionalPath(this, path) - : undefined; - } - - // some path names conflict with document methods - if (reserved[path]) { - throw new Error("`" + path + "` may not be used as a schema pathname"); - } - - if (warnings[path]) { - console.log('WARN: ' + warnings[path]); - } - - // update the tree - var subpaths = path.split(/\./) - , last = subpaths.pop() - , branch = this.tree; - - subpaths.forEach(function(sub, i) { - if (!branch[sub]) branch[sub] = {}; - if ('object' != typeof branch[sub]) { - var msg = 'Cannot set nested path `' + path + '`. ' - + 'Parent path `' - + subpaths.slice(0, i).concat([sub]).join('.') - + '` already set to type ' + branch[sub].name - + '.'; - throw new Error(msg); - } - branch = branch[sub]; - }); - - branch[last] = utils.clone(obj); - - this.paths[path] = Schema.interpretAsType(path, obj, this.options); - return this; -}; - -/** - * Converts type arguments into Mongoose Types. - * - * @param {String} path - * @param {Object} obj constructor - * @api private - */ - -Schema.interpretAsType = function(path, obj, options) { - if (obj.constructor) { - var constructorName = utils.getFunctionName(obj.constructor); - if (constructorName != 'Object') { - obj = { type: obj }; - } - } - - // Get the type making sure to allow keys named "type" - // and default to mixed if not specified. - // { type: { type: String, default: 'freshcut' } } - var type = obj.type && !obj.type.type - ? obj.type - : {}; - - if ('Object' == utils.getFunctionName(type.constructor) || 'mixed' == type) { - return new MongooseTypes.Mixed(path, obj); - } - - if (Array.isArray(type) || Array == type || 'array' == type) { - // if it was specified through { type } look for `cast` - var cast = (Array == type || 'array' == type) - ? obj.cast - : type[0]; - - if (cast instanceof Schema) { - return new MongooseTypes.DocumentArray(path, cast, obj); - } - - if ('string' == typeof cast) { - cast = MongooseTypes[cast.charAt(0).toUpperCase() + cast.substring(1)]; - } else if (cast && (!cast.type || cast.type.type) - && 'Object' == utils.getFunctionName(cast.constructor) - && Object.keys(cast).length) { - var opts = { minimize: options.minimize }; - return new MongooseTypes.DocumentArray(path, new Schema(cast, opts), obj); - } - - return new MongooseTypes.Array(path, cast || MongooseTypes.Mixed, obj); - } - - var name; - if (Buffer.isBuffer(type)) { - name = 'Buffer'; - } else { - name = 'string' == typeof type - ? type - // If not string, `type` is a function. Outside of IE, function.name - // gives you the function name. In IE, you need to compute it - : type.schemaName || utils.getFunctionName(type); - } - - if (name) { - name = name.charAt(0).toUpperCase() + name.substring(1); - } - - if (undefined == MongooseTypes[name]) { - throw new TypeError('Undefined type `' + name + '` at `' + path + - '`\n Did you try nesting Schemas? ' + - 'You can only nest using refs or arrays.'); - } - - return new MongooseTypes[name](path, obj); -}; - -/** - * Iterates the schemas paths similar to Array#forEach. - * - * The callback is passed the pathname and schemaType as arguments on each iteration. - * - * @param {Function} fn callback function - * @return {Schema} this - * @api public - */ - -Schema.prototype.eachPath = function(fn) { - var keys = Object.keys(this.paths) - , len = keys.length; - - for (var i = 0; i < len; ++i) { - fn(keys[i], this.paths[keys[i]]); - } - - return this; -}; - -/** - * Returns an Array of path strings that are required by this schema. - * - * @api public - * @param {Boolean} invalidate refresh the cache - * @return {Array} - */ - -Schema.prototype.requiredPaths = function requiredPaths(invalidate) { - if (this._requiredpaths && !invalidate) return this._requiredpaths; - - var paths = Object.keys(this.paths) - , i = paths.length - , ret = []; - - while (i--) { - var path = paths[i]; - if (this.paths[path].isRequired) ret.push(path); - } - - return this._requiredpaths = ret; -}; - -/** - * Returns indexes from fields and schema-level indexes (cached). - * - * @api private - * @return {Array} - */ - -Schema.prototype.indexedPaths = function indexedPaths() { - if (this._indexedpaths) return this._indexedpaths; - - return this._indexedpaths = this.indexes(); -}; - -/** - * Returns the pathType of `path` for this schema. - * - * Given a path, returns whether it is a real, virtual, nested, or ad-hoc/undefined path. - * - * @param {String} path - * @return {String} - * @api public - */ - -Schema.prototype.pathType = function(path) { - if (path in this.paths) return 'real'; - if (path in this.virtuals) return 'virtual'; - if (path in this.nested) return 'nested'; - if (path in this.subpaths) return 'real'; - - if (/\.\d+\.|\.\d+$/.test(path)) { - return getPositionalPathType(this, path); - } else { - return 'adhocOrUndefined'; - } -}; - -/** - * Returns true iff this path is a child of a mixed schema. - * - * @param {String} path - * @return {Boolean} - * @api private - */ - -Schema.prototype.hasMixedParent = function(path) { - var subpaths = path.split(/\./g); - path = ''; - for (var i = 0; i < subpaths.length; ++i) { - path = i > 0 ? path + '.' + subpaths[i] : subpaths[i]; - if (path in this.paths && - this.paths[path] instanceof MongooseTypes.Mixed) { - return true; - } - } - - return false; -}; - -/*! - * ignore - */ - -function getPositionalPathType(self, path) { - var subpaths = path.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean); - if (subpaths.length < 2) { - return self.paths[subpaths[0]]; - } - - var val = self.path(subpaths[0]); - var isNested = false; - if (!val) return val; - - var last = subpaths.length - 1 - , subpath - , i = 1; - - for (; i < subpaths.length; ++i) { - isNested = false; - subpath = subpaths[i]; - - if (i === last && val && !val.schema && !/\D/.test(subpath)) { - if (val instanceof MongooseTypes.Array) { - // StringSchema, NumberSchema, etc - val = val.caster; - } else { - val = undefined; - } - break; - } - - // ignore if its just a position segment: path.0.subpath - if (!/\D/.test(subpath)) continue; - - if (!(val && val.schema)) { - val = undefined; - break; - } - - var type = val.schema.pathType(subpath); - isNested = (type === 'nested'); - val = val.schema.path(subpath); - } - - self.subpaths[path] = val; - if (val) { - return 'real'; - } - if (isNested) { - return 'nested'; - } - return 'adhocOrUndefined'; -} - - -/*! - * ignore - */ - -function getPositionalPath(self, path) { - getPositionalPathType(self, path); - return self.subpaths[path]; -} - -/** - * Adds a method call to the queue. - * - * @param {String} name name of the document method to call later - * @param {Array} args arguments to pass to the method - * @api public - */ - -Schema.prototype.queue = function(name, args) { - this.callQueue.push([name, args]); - return this; -}; - -/** - * Defines a pre hook for the document. - * - * ####Example - * - * var toySchema = new Schema(..); - * - * toySchema.pre('save', function (next) { - * if (!this.created) this.created = new Date; - * next(); - * }) - * - * toySchema.pre('validate', function (next) { - * if (this.name != 'Woody') this.name = 'Woody'; - * next(); - * }) - * - * @param {String} method - * @param {Function} callback - * @see hooks.js https://github.com/bnoguchi/hooks-js/tree/31ec571cef0332e21121ee7157e0cf9728572cc3 - * @api public - */ - -Schema.prototype.pre = function() { - var name = arguments[0]; - if (IS_QUERY_HOOK[name]) { - this.s.hooks.pre.apply(this.s.hooks, arguments); - return this; - } - return this.queue('pre', arguments); -}; - -/** - * Defines a post hook for the document - * - * Post hooks fire `on` the event emitted from document instances of Models compiled from this schema. - * - * var schema = new Schema(..); - * schema.post('save', function (doc) { - * console.log('this fired after a document was saved'); - * }); - * - * var Model = mongoose.model('Model', schema); - * - * var m = new Model(..); - * m.save(function (err) { - * console.log('this fires after the `post` hook'); - * }); - * - * @param {String} method name of the method to hook - * @param {Function} fn callback - * @see hooks.js https://github.com/bnoguchi/hooks-js/tree/31ec571cef0332e21121ee7157e0cf9728572cc3 - * @api public - */ - -Schema.prototype.post = function(method, fn) { - if (IS_QUERY_HOOK[method]) { - this.s.hooks.post.apply(this.s.hooks, arguments); - return this; - } - // assuming that all callbacks with arity < 2 are synchronous post hooks - if (fn.length < 2) { - return this.queue('on', [arguments[0], function(doc) { - return fn.call(doc, doc); - }]); - } - - return this.queue('post', [arguments[0], function(next) { - // wrap original function so that the callback goes last, - // for compatibility with old code that is using synchronous post hooks - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - fn.call(this, this, function(err) { - return next.apply(self, [err].concat(args)); - }); - }]); -}; - -/** - * Registers a plugin for this schema. - * - * @param {Function} plugin callback - * @param {Object} [opts] - * @see plugins - * @api public - */ - -Schema.prototype.plugin = function(fn, opts) { - fn(this, opts); - return this; -}; - -/** - * Adds an instance method to documents constructed from Models compiled from this schema. - * - * ####Example - * - * var schema = kittySchema = new Schema(..); - * - * schema.method('meow', function () { - * console.log('meeeeeoooooooooooow'); - * }) - * - * var Kitty = mongoose.model('Kitty', schema); - * - * var fizz = new Kitty; - * fizz.meow(); // meeeeeooooooooooooow - * - * If a hash of name/fn pairs is passed as the only argument, each name/fn pair will be added as methods. - * - * schema.method({ - * purr: function () {} - * , scratch: function () {} - * }); - * - * // later - * fizz.purr(); - * fizz.scratch(); - * - * @param {String|Object} method name - * @param {Function} [fn] - * @api public - */ - -Schema.prototype.method = function(name, fn) { - if ('string' != typeof name) - for (var i in name) - this.methods[i] = name[i]; - else - this.methods[name] = fn; - return this; -}; - -/** - * Adds static "class" methods to Models compiled from this schema. - * - * ####Example - * - * var schema = new Schema(..); - * schema.static('findByName', function (name, callback) { - * return this.find({ name: name }, callback); - * }); - * - * var Drink = mongoose.model('Drink', schema); - * Drink.findByName('sanpellegrino', function (err, drinks) { - * // - * }); - * - * If a hash of name/fn pairs is passed as the only argument, each name/fn pair will be added as statics. - * - * @param {String} name - * @param {Function} fn - * @api public - */ - -Schema.prototype.static = function(name, fn) { - if ('string' != typeof name) - for (var i in name) - this.statics[i] = name[i]; - else - this.statics[name] = fn; - return this; -}; - -/** - * Defines an index (most likely compound) for this schema. - * - * ####Example - * - * schema.index({ first: 1, last: -1 }) - * - * @param {Object} fields - * @param {Object} [options] Options to pass to [MongoDB driver's `createIndex()` function](http://mongodb.github.io/node-mongodb-native/2.0/api/Collection.html#createIndex) - * @param {String} [options.expires=null] Mongoose-specific syntactic sugar, uses [ms](https://www.npmjs.com/package/ms) to convert `expires` option into seconds for the `expireAfterSeconds` in the above link. - * @api public - */ - -Schema.prototype.index = function(fields, options) { - options || (options = {}); - - if (options.expires) - utils.expires(options); - - this._indexes.push([fields, options]); - return this; -}; - -/** - * Sets/gets a schema option. - * - * ####Example - * - * schema.set('strict'); // 'true' by default - * schema.set('strict', false); // Sets 'strict' to false - * schema.set('strict'); // 'false' - * - * @param {String} key option name - * @param {Object} [value] if not passed, the current option value is returned - * @see Schema ./ - * @api public - */ - -Schema.prototype.set = function(key, value, _tags) { - if (1 === arguments.length) { - return this.options[key]; - } - - switch (key) { - case 'read': - this.options[key] = readPref(value, _tags); - break; - case 'safe': - this.options[key] = false === value - ? { w: 0 } - : value; - break; - default: - this.options[key] = value; - } - - return this; -}; - -/** - * Gets a schema option. - * - * @param {String} key option name - * @api public - */ - -Schema.prototype.get = function(key) { - return this.options[key]; -}; - -/** - * The allowed index types - * - * @static indexTypes - * @receiver Schema - * @api public - */ - -var indexTypes = '2d 2dsphere hashed text'.split(' '); - -Object.defineProperty(Schema, 'indexTypes', { - get: function() { return indexTypes; } - , set: function() { throw new Error('Cannot overwrite Schema.indexTypes'); } -}); - -/** - * Compiles indexes from fields and schema-level indexes - * - * @api public - */ - -Schema.prototype.indexes = function() { - 'use strict'; - - var indexes = []; - var seenPrefix = {}; - - var collectIndexes = function(schema, prefix) { - if (seenPrefix[prefix]) { - return; - } - seenPrefix[prefix] = true; - - prefix = prefix || ''; - var key, path, index, field, isObject, options, type; - var keys = Object.keys(schema.paths); - - for (var i = 0; i < keys.length; ++i) { - key = keys[i]; - path = schema.paths[key]; - - if (path instanceof MongooseTypes.DocumentArray) { - collectIndexes(path.schema, key + '.'); - } else { - index = path._index; - - if (false !== index && null != index) { - field = {}; - isObject = utils.isObject(index); - options = isObject ? index : {}; - type = 'string' == typeof index ? index : - isObject ? index.type : - false; - - if (type && ~Schema.indexTypes.indexOf(type)) { - field[prefix + key] = type; - } else { - field[prefix + key] = 1; - } - - delete options.type; - if (!('background' in options)) { - options.background = true; - } - - indexes.push([field, options]); - } - } - } - - if (prefix) { - fixSubIndexPaths(schema, prefix); - } else { - schema._indexes.forEach(function(index) { - if (!('background' in index[1])) index[1].background = true; - }); - indexes = indexes.concat(schema._indexes); - } - - }; - - collectIndexes(this); - return indexes; - - /*! - * Checks for indexes added to subdocs using Schema.index(). - * These indexes need their paths prefixed properly. - * - * schema._indexes = [ [indexObj, options], [indexObj, options] ..] - */ - - function fixSubIndexPaths(schema, prefix) { - var subindexes = schema._indexes - , len = subindexes.length - , indexObj - , newindex - , klen - , keys - , key - , i = 0 - , j; - - for (i = 0; i < len; ++i) { - indexObj = subindexes[i][0]; - keys = Object.keys(indexObj); - klen = keys.length; - newindex = {}; - - // use forward iteration, order matters - for (j = 0; j < klen; ++j) { - key = keys[j]; - newindex[prefix + key] = indexObj[key]; - } - - indexes.push([newindex, subindexes[i][1]]); - } - } -}; - -/** - * Creates a virtual type with the given name. - * - * @param {String} name - * @param {Object} [options] - * @return {VirtualType} - */ - -Schema.prototype.virtual = function(name, options) { - var virtuals = this.virtuals; - var parts = name.split('.'); - return virtuals[name] = parts.reduce(function(mem, part, i) { - mem[part] || (mem[part] = (i === parts.length - 1) - ? new VirtualType(options, name) - : {}); - return mem[part]; - }, this.tree); -}; - -/** - * Returns the virtual type with the given `name`. - * - * @param {String} name - * @return {VirtualType} - */ - -Schema.prototype.virtualpath = function(name) { - return this.virtuals[name]; -}; - -/** - * Removes the given `path` (or [`paths`]). - * - * @param {String|Array} path - * - * @api public - */ -Schema.prototype.remove = function(path) { - if (typeof path === 'string') { - path = [path]; - } - if (Array.isArray(path)) { - path.forEach(function(name) { - if (this.path(name)) { - delete this.paths[name]; - } - }, this); - } -}; - -/*! - * Module exports. - */ - -module.exports = exports = Schema; - -// require down here because of reference issues - -/** - * The various built-in Mongoose Schema Types. - * - * ####Example: - * - * var mongoose = require('mongoose'); - * var ObjectId = mongoose.Schema.Types.ObjectId; - * - * ####Types: - * - * - [String](#schema-string-js) - * - [Number](#schema-number-js) - * - [Boolean](#schema-boolean-js) | Bool - * - [Array](#schema-array-js) - * - [Buffer](#schema-buffer-js) - * - [Date](#schema-date-js) - * - [ObjectId](#schema-objectid-js) | Oid - * - [Mixed](#schema-mixed-js) - * - * Using this exposed access to the `Mixed` SchemaType, we can use them in our schema. - * - * var Mixed = mongoose.Schema.Types.Mixed; - * new mongoose.Schema({ _user: Mixed }) - * - * @api public - */ - -Schema.Types = MongooseTypes = require('./schema/index'); - -/*! - * ignore - */ - -exports.ObjectId = MongooseTypes.ObjectId; diff --git a/Associations/node_modules/mongoose/lib/schema/array.js b/Associations/node_modules/mongoose/lib/schema/array.js deleted file mode 100644 index c7adaad0..00000000 --- a/Associations/node_modules/mongoose/lib/schema/array.js +++ /dev/null @@ -1,394 +0,0 @@ -/*! - * Module dependencies. - */ - -var SchemaType = require('../schematype') - , CastError = SchemaType.CastError - , Types = { - Boolean: require('./boolean') - , Date: require('./date') - , Number: require('./number') - , String: require('./string') - , ObjectId: require('./objectid') - , Buffer: require('./buffer') - } - , MongooseArray = require('../types').Array - , EmbeddedDoc = require('../types').Embedded - , Mixed = require('./mixed') - , cast = require('../cast') - , utils = require('../utils') - , isMongooseObject = utils.isMongooseObject; - -/** - * Array SchemaType constructor - * - * @param {String} key - * @param {SchemaType} cast - * @param {Object} options - * @inherits SchemaType - * @api private - */ - -function SchemaArray(key, cast, options) { - if (cast) { - var castOptions = {}; - - if ('Object' === utils.getFunctionName(cast.constructor)) { - if (cast.type) { - // support { type: Woot } - castOptions = utils.clone(cast); // do not alter user arguments - delete castOptions.type; - cast = cast.type; - } else { - cast = Mixed; - } - } - - // support { type: 'String' } - var name = 'string' == typeof cast - ? cast - : utils.getFunctionName(cast); - - var caster = name in Types - ? Types[name] - : cast; - - this.casterConstructor = caster; - this.caster = new caster(null, castOptions); - if (!(this.caster instanceof EmbeddedDoc)) { - this.caster.path = key; - } - } - - SchemaType.call(this, key, options, 'Array'); - - var self = this - , defaultArr - , fn; - - if (this.defaultValue) { - defaultArr = this.defaultValue; - fn = 'function' == typeof defaultArr; - } - - this.default(function() { - var arr = fn ? defaultArr() : defaultArr || []; - return new MongooseArray(arr, self.path, this); - }); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -SchemaArray.schemaName = 'Array'; - -/*! - * Inherits from SchemaType. - */ -SchemaArray.prototype = Object.create( SchemaType.prototype ); -SchemaArray.prototype.constructor = SchemaArray; - -/** - * Check required - * - * @param {Array} value - * @api private - */ - -SchemaArray.prototype.checkRequired = function(value) { - return !!(value && value.length); -}; - -/** - * Overrides the getters application for the population special-case - * - * @param {Object} value - * @param {Object} scope - * @api private - */ - -SchemaArray.prototype.applyGetters = function(value, scope) { - if (this.caster.options && this.caster.options.ref) { - // means the object id was populated - return value; - } - - return SchemaType.prototype.applyGetters.call(this, value, scope); -}; - -/** - * Casts values for set(). - * - * @param {Object} value - * @param {Document} doc document that triggers the casting - * @param {Boolean} init whether this is an initialization cast - * @api private - */ - -SchemaArray.prototype.cast = function(value, doc, init) { - if (Array.isArray(value)) { - - if (!value.length && doc) { - var indexes = doc.schema.indexedPaths(); - - for (var i = 0, l = indexes.length; i < l; ++i) { - var pathIndex = indexes[i][0][this.path]; - if ('2dsphere' === pathIndex || '2d' === pathIndex) { - return; - } - } - } - - if (!(value && value.isMongooseArray)) { - value = new MongooseArray(value, this.path, doc); - } - - if (this.caster) { - try { - for (i = 0, l = value.length; i < l; i++) { - value[i] = this.caster.cast(value[i], doc, init); - } - } catch (e) { - // rethrow - throw new CastError(e.type, value, this.path); - } - } - - return value; - } else { - // gh-2442: if we're loading this from the db and its not an array, mark - // the whole array as modified. - if (!!doc && !!init) { - doc.markModified(this.path); - } - return this.cast([value], doc, init); - } -}; - -/** - * Casts values for queries. - * - * @param {String} $conditional - * @param {any} [value] - * @api private - */ - -SchemaArray.prototype.castForQuery = function($conditional, value) { - var handler - , val; - - if (arguments.length === 2) { - handler = this.$conditionalHandlers[$conditional]; - - if (!handler) { - throw new Error("Can't use " + $conditional + " with Array."); - } - - val = handler.call(this, value); - - } else { - - val = $conditional; - var proto = this.casterConstructor.prototype; - var method = proto.castForQuery || proto.cast; - var caster = this.caster; - - if (Array.isArray(val)) { - val = val.map(function(v) { - if (utils.isObject(v) && v.$elemMatch) { - return v; - } - if (method) v = method.call(caster, v); - return isMongooseObject(v) ? - v.toObject({ virtuals: false }) : - v; - }); - - } else if (method) { - val = method.call(caster, val); - } - } - - return val && isMongooseObject(val) ? - val.toObject({ virtuals: false }) : - val; -}; - -/*! - * @ignore - * - * $atomic cast helpers - */ - -function castToNumber(val) { - return Types.Number.prototype.cast.call(this, val); -} - -function castArraysOfNumbers(arr, self) { - self || (self = this); - - arr.forEach(function(v, i) { - if (Array.isArray(v)) { - castArraysOfNumbers(v, self); - } else { - arr[i] = castToNumber.call(self, v); - } - }); -} - -function cast$near(val) { - if (Array.isArray(val)) { - castArraysOfNumbers(val, this); - return val; - } - - if (val && val.$geometry) { - return cast$geometry(val, this); - } - - return SchemaArray.prototype.castForQuery.call(this, val); -} - -function cast$geometry(val, self) { - switch (val.$geometry.type) { - case 'Polygon': - case 'LineString': - case 'Point': - castArraysOfNumbers(val.$geometry.coordinates, self); - break; - default: - // ignore unknowns - break; - } - - if (val.$maxDistance) { - val.$maxDistance = castToNumber.call(self, val.$maxDistance); - } - - return val; -} - -function cast$within(val) { - var self = this; - - if (val.$maxDistance) { - val.$maxDistance = castToNumber.call(self, val.$maxDistance); - } - - if (val.$box || val.$polygon) { - var type = val.$box ? '$box' : '$polygon'; - val[type].forEach(function(arr) { - if (!Array.isArray(arr)) { - var msg = 'Invalid $within $box argument. ' - + 'Expected an array, received ' + arr; - throw new TypeError(msg); - } - arr.forEach(function(v, i) { - arr[i] = castToNumber.call(this, v); - }); - }); - } else if (val.$center || val.$centerSphere) { - type = val.$center ? '$center' : '$centerSphere'; - val[type].forEach(function(item, i) { - if (Array.isArray(item)) { - item.forEach(function(v, j) { - item[j] = castToNumber.call(this, v); - }); - } else { - val[type][i] = castToNumber.call(this, item); - } - }); - } else if (val.$geometry) { - cast$geometry(val, this); - } - - return val; -} - -function cast$all(val) { - if (!Array.isArray(val)) { - val = [val]; - } - - val = val.map(function(v) { - if (utils.isObject(v)) { - var o = {}; - o[this.path] = v; - return cast(this.casterConstructor.schema, o)[this.path]; - } - return v; - }, this); - - return this.castForQuery(val); -} - -function cast$elemMatch(val) { - var keys = Object.keys(val); - var numKeys = keys.length; - var key; - var value; - for (var i = 0; i < numKeys; ++i) { - key = keys[i]; - value = val[key]; - if (key.indexOf('$') === 0 && value) { - val[key] = this.castForQuery(key, value); - } - } - - return cast(this.casterConstructor.schema, val); -} - -function cast$geoIntersects(val) { - var geo = val.$geometry; - if (!geo) return; - - cast$geometry(val, this); - return val; -} - -var handle = SchemaArray.prototype.$conditionalHandlers = {}; - -handle.$all = cast$all; -handle.$options = String; -handle.$elemMatch = cast$elemMatch; -handle.$geoIntersects = cast$geoIntersects; -handle.$or = handle.$and = function(val) { - if (!Array.isArray(val)) { - throw new TypeError('conditional $or/$and require array'); - } - - var ret = []; - for (var i = 0; i < val.length; ++i) { - ret.push(cast(this.casterConstructor.schema, val[i])); - } - - return ret; -}; - -handle.$near = -handle.$nearSphere = cast$near; - -handle.$within = -handle.$geoWithin = cast$within; - -handle.$size = -handle.$maxDistance = castToNumber; - -handle.$eq = -handle.$gt = -handle.$gte = -handle.$in = -handle.$lt = -handle.$lte = -handle.$ne = -handle.$nin = -handle.$regex = SchemaArray.prototype.castForQuery; - -/*! - * Module exports. - */ - -module.exports = SchemaArray; diff --git a/Associations/node_modules/mongoose/lib/schema/boolean.js b/Associations/node_modules/mongoose/lib/schema/boolean.js deleted file mode 100644 index 3fe271e4..00000000 --- a/Associations/node_modules/mongoose/lib/schema/boolean.js +++ /dev/null @@ -1,107 +0,0 @@ -/*! - * Module dependencies. - */ - -var utils = require('../utils'); - -var SchemaType = require('../schematype'); - -/** - * Boolean SchemaType constructor. - * - * @param {String} path - * @param {Object} options - * @inherits SchemaType - * @api private - */ - -function SchemaBoolean(path, options) { - SchemaType.call(this, path, options, 'Boolean'); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -SchemaBoolean.schemaName = 'Boolean'; - -/*! - * Inherits from SchemaType. - */ -SchemaBoolean.prototype = Object.create( SchemaType.prototype ); -SchemaBoolean.prototype.constructor = SchemaBoolean; - -/** - * Required validator - * - * @api private - */ - -SchemaBoolean.prototype.checkRequired = function(value) { - return value === true || value === false; -}; - -/** - * Casts to boolean - * - * @param {Object} value - * @api private - */ - -SchemaBoolean.prototype.cast = function(value) { - if (null === value) return value; - if ('0' === value) return false; - if ('true' === value) return true; - if ('false' === value) return false; - return !! value; -}; - -/*! - * ignore - */ - -function handleArray(val) { - var self = this; - if (!Array.isArray(val)) { - return [self.cast(val)]; - } - return val.map(function(m) { - return self.cast(m); - }); -} - -SchemaBoolean.$conditionalHandlers = - utils.options(SchemaType.prototype.$conditionalHandlers, { - '$in': handleArray - }); - -/** - * Casts contents for queries. - * - * @param {String} $conditional - * @param {any} val - * @api private - */ - -SchemaBoolean.prototype.castForQuery = function($conditional, val) { - var handler; - if (2 === arguments.length) { - handler = SchemaBoolean.$conditionalHandlers[$conditional]; - - if (handler) { - return handler.call(this, val); - } - - return this.cast(val); - } - - return this.cast($conditional); -}; - -/*! - * Module exports. - */ - -module.exports = SchemaBoolean; diff --git a/Associations/node_modules/mongoose/lib/schema/buffer.js b/Associations/node_modules/mongoose/lib/schema/buffer.js deleted file mode 100644 index d4bba75b..00000000 --- a/Associations/node_modules/mongoose/lib/schema/buffer.js +++ /dev/null @@ -1,187 +0,0 @@ -/*! - * Module dependencies. - */ - -var utils = require('../utils'); - -var MongooseBuffer = require('../types').Buffer; -var SchemaType = require('../schematype'); - -var Binary = MongooseBuffer.Binary; -var CastError = SchemaType.CastError; -var Document; - -/** - * Buffer SchemaType constructor - * - * @param {String} key - * @param {SchemaType} cast - * @inherits SchemaType - * @api private - */ - -function SchemaBuffer(key, options) { - SchemaType.call(this, key, options, 'Buffer'); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -SchemaBuffer.schemaName = 'Buffer'; - -/*! - * Inherits from SchemaType. - */ -SchemaBuffer.prototype = Object.create( SchemaType.prototype ); -SchemaBuffer.prototype.constructor = SchemaBuffer; - -/** - * Check required - * - * @api private - */ - -SchemaBuffer.prototype.checkRequired = function(value, doc) { - if (SchemaType._isRef(this, value, doc, true)) { - return null != value; - } else { - return !!(value && value.length); - } -}; - -/** - * Casts contents - * - * @param {Object} value - * @param {Document} doc document that triggers the casting - * @param {Boolean} init - * @api private - */ - -SchemaBuffer.prototype.cast = function(value, doc, init) { - var ret; - if (SchemaType._isRef(this, value, doc, init)) { - // wait! we may need to cast this to a document - - if (null == value) { - return value; - } - - // lazy load - Document || (Document = require('./../document')); - - if (value instanceof Document) { - value.$__.wasPopulated = true; - return value; - } - - // setting a populated path - if (Buffer.isBuffer(value)) { - return value; - } else if (!utils.isObject(value)) { - throw new CastError('buffer', value, this.path); - } - - // Handle the case where user directly sets a populated - // path to a plain object; cast to the Model used in - // the population query. - var path = doc.$__fullPath(this.path); - var owner = doc.ownerDocument ? doc.ownerDocument() : doc; - var pop = owner.populated(path, true); - ret = new pop.options.model(value); - ret.$__.wasPopulated = true; - return ret; - } - - // documents - if (value && value._id) { - value = value._id; - } - - if (value && value.isMongooseBuffer) { - return value; - } - - if (Buffer.isBuffer(value)) { - if (!value || !value.isMongooseBuffer) { - value = new MongooseBuffer(value, [this.path, doc]); - } - - return value; - } else if (value instanceof Binary) { - ret = new MongooseBuffer(value.value(true), [this.path, doc]); - if (typeof value.sub_type !== 'number') { - throw new CastError('buffer', value, this.path); - } - ret._subtype = value.sub_type; - return ret; - } - - if (null === value) return value; - - var type = typeof value; - if ('string' == type || 'number' == type || Array.isArray(value)) { - ret = new MongooseBuffer(value, [this.path, doc]); - return ret; - } - - throw new CastError('buffer', value, this.path); -}; - -/*! - * ignore - */ -function handleSingle(val) { - return this.castForQuery(val); -} - -function handleArray(val) { - var self = this; - if (!Array.isArray(val)) { - return [this.castForQuery(val)]; - } - return val.map( function(m) { - return self.castForQuery(m); - }); -} - -SchemaBuffer.prototype.$conditionalHandlers = - utils.options(SchemaType.prototype.$conditionalHandlers, { - '$gt' : handleSingle, - '$gte': handleSingle, - '$in' : handleArray, - '$lt' : handleSingle, - '$lte': handleSingle, - '$ne' : handleSingle, - '$nin': handleArray - }); - -/** - * Casts contents for queries. - * - * @param {String} $conditional - * @param {any} [value] - * @api private - */ - -SchemaBuffer.prototype.castForQuery = function($conditional, val) { - var handler; - if (arguments.length === 2) { - handler = this.$conditionalHandlers[$conditional]; - if (!handler) - throw new Error("Can't use " + $conditional + " with Buffer."); - return handler.call(this, val); - } else { - val = $conditional; - return this.cast(val).toObject(); - } -}; - -/*! - * Module exports. - */ - -module.exports = SchemaBuffer; diff --git a/Associations/node_modules/mongoose/lib/schema/date.js b/Associations/node_modules/mongoose/lib/schema/date.js deleted file mode 100644 index 4e08648c..00000000 --- a/Associations/node_modules/mongoose/lib/schema/date.js +++ /dev/null @@ -1,298 +0,0 @@ -/*! - * Module requirements. - */ - -var errorMessages = require('../error').messages; -var utils = require('../utils'); - -var SchemaType = require('../schematype'); - -var CastError = SchemaType.CastError; - -/** - * Date SchemaType constructor. - * - * @param {String} key - * @param {Object} options - * @inherits SchemaType - * @api private - */ - -function SchemaDate(key, options) { - SchemaType.call(this, key, options, 'Date'); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -SchemaDate.schemaName = 'Date'; - -/*! - * Inherits from SchemaType. - */ -SchemaDate.prototype = Object.create( SchemaType.prototype ); -SchemaDate.prototype.constructor = SchemaDate; - -/** - * Declares a TTL index (rounded to the nearest second) for _Date_ types only. - * - * This sets the `expiresAfterSeconds` index option available in MongoDB >= 2.1.2. - * This index type is only compatible with Date types. - * - * ####Example: - * - * // expire in 24 hours - * new Schema({ createdAt: { type: Date, expires: 60*60*24 }}); - * - * `expires` utilizes the `ms` module from [guille](https://github.com/guille/) allowing us to use a friendlier syntax: - * - * ####Example: - * - * // expire in 24 hours - * new Schema({ createdAt: { type: Date, expires: '24h' }}); - * - * // expire in 1.5 hours - * new Schema({ createdAt: { type: Date, expires: '1.5h' }}); - * - * // expire in 7 days - * var schema = new Schema({ createdAt: Date }); - * schema.path('createdAt').expires('7d'); - * - * @param {Number|String} when - * @added 3.0.0 - * @return {SchemaType} this - * @api public - */ - -SchemaDate.prototype.expires = function(when) { - if (!this._index || 'Object' !== this._index.constructor.name) { - this._index = {}; - } - - this._index.expires = when; - utils.expires(this._index); - return this; -}; - -/** - * Required validator for date - * - * @api private - */ - -SchemaDate.prototype.checkRequired = function(value) { - return value instanceof Date; -}; - -/** - * Sets a minimum date validator. - * - * ####Example: - * - * var s = new Schema({ d: { type: Date, min: Date('1970-01-01') }) - * var M = db.model('M', s) - * var m = new M({ d: Date('1969-12-31') }) - * m.save(function (err) { - * console.error(err) // validator error - * m.d = Date('2014-12-08'); - * m.save() // success - * }) - * - * // custom error messages - * // We can also use the special {MIN} token which will be replaced with the invalid value - * var min = [Date('1970-01-01'), 'The value of path `{PATH}` ({VALUE}) is beneath the limit ({MIN}).']; - * var schema = new Schema({ d: { type: Date, min: min }) - * var M = mongoose.model('M', schema); - * var s= new M({ d: Date('1969-12-31') }); - * s.validate(function (err) { - * console.log(String(err)) // ValidationError: The value of path `d` (1969-12-31) is before the limit (1970-01-01). - * }) - * - * @param {Date} value minimum date - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaDate.prototype.min = function(value, message) { - if (this.minValidator) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.minValidator; - }, this); - } - - if (value) { - var msg = message || errorMessages.Date.min; - msg = msg.replace(/{MIN}/, (value === Date.now ? 'Date.now()' : this.cast(value).toString())); - var self = this; - this.validators.push({ - validator: this.minValidator = function(val) { - var min = (value === Date.now ? value() : self.cast(value)); - return val === null || val.valueOf() >= min.valueOf(); - }, - message: msg, - type: 'min', - min: value - }); - } - - return this; -}; - -/** - * Sets a maximum date validator. - * - * ####Example: - * - * var s = new Schema({ d: { type: Date, max: Date('2014-01-01') }) - * var M = db.model('M', s) - * var m = new M({ d: Date('2014-12-08') }) - * m.save(function (err) { - * console.error(err) // validator error - * m.d = Date('2013-12-31'); - * m.save() // success - * }) - * - * // custom error messages - * // We can also use the special {MAX} token which will be replaced with the invalid value - * var max = [Date('2014-01-01'), 'The value of path `{PATH}` ({VALUE}) exceeds the limit ({MAX}).']; - * var schema = new Schema({ d: { type: Date, max: max }) - * var M = mongoose.model('M', schema); - * var s= new M({ d: Date('2014-12-08') }); - * s.validate(function (err) { - * console.log(String(err)) // ValidationError: The value of path `d` (2014-12-08) exceeds the limit (2014-01-01). - * }) - * - * @param {Date} maximum date - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaDate.prototype.max = function(value, message) { - if (this.maxValidator) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.maxValidator; - }, this); - } - - if (value) { - var msg = message || errorMessages.Date.max; - msg = msg.replace(/{MAX}/, (value === Date.now ? 'Date.now()' : this.cast(value).toString())); - var self = this; - this.validators.push({ - validator: this.maxValidator = function(val) { - var max = (value === Date.now ? value() : self.cast(value)); - return val === null || val.valueOf() <= max.valueOf(); - }, - message: msg, - type: 'max', - max: value - }); - } - - return this; -}; - -/** - * Casts to date - * - * @param {Object} value to cast - * @api private - */ - -SchemaDate.prototype.cast = function(value) { - // If null or undefined - if (value == null || value === '') - return null; - - if (value instanceof Date) - return value; - - var date; - - // support for timestamps - if (typeof value !== 'undefined') { - if (value instanceof Number || 'number' == typeof value - || String(value) == Number(value)) { - date = new Date(Number(value)); - } else if (value.toString) { - // support for date strings - date = new Date(value.toString()); - } - - if (date.toString() != 'Invalid Date') { - return date; - } - } - - throw new CastError('date', value, this.path); -}; - -/*! - * Date Query casting. - * - * @api private - */ - -function handleSingle(val) { - return this.cast(val); -} - -function handleArray(val) { - var self = this; - if (!Array.isArray(val)) { - return [this.cast(val)]; - } - return val.map( function(m) { - return self.cast(m); - }); -} - -SchemaDate.prototype.$conditionalHandlers = - utils.options(SchemaType.prototype.$conditionalHandlers, { - '$all': handleArray, - '$gt': handleSingle, - '$gte': handleSingle, - '$in': handleArray, - '$lt': handleSingle, - '$lte': handleSingle, - '$ne': handleSingle, - '$nin': handleArray - }); - - -/** - * Casts contents for queries. - * - * @param {String} $conditional - * @param {any} [value] - * @api private - */ - -SchemaDate.prototype.castForQuery = function($conditional, val) { - var handler; - - if (2 !== arguments.length) { - return this.cast($conditional); - } - - handler = this.$conditionalHandlers[$conditional]; - - if (!handler) { - throw new Error("Can't use " + $conditional + " with Date."); - } - - return handler.call(this, val); -}; - -/*! - * Module exports. - */ - -module.exports = SchemaDate; diff --git a/Associations/node_modules/mongoose/lib/schema/documentarray.js b/Associations/node_modules/mongoose/lib/schema/documentarray.js deleted file mode 100644 index a8762abe..00000000 --- a/Associations/node_modules/mongoose/lib/schema/documentarray.js +++ /dev/null @@ -1,248 +0,0 @@ -/* eslint no-empty: 1 */ - -/*! - * Module dependencies. - */ - -var ArrayType = require('./array'); -var MongooseDocumentArray = require('../types/documentarray'); -var SchemaType = require('../schematype'); -var Subdocument = require('../types/embedded'); - -/** - * SubdocsArray SchemaType constructor - * - * @param {String} key - * @param {Schema} schema - * @param {Object} options - * @inherits SchemaArray - * @api private - */ - -function DocumentArray(key, schema, options) { - // compile an embedded document for this schema - function EmbeddedDocument() { - Subdocument.apply(this, arguments); - } - - EmbeddedDocument.prototype = Object.create(Subdocument.prototype); - EmbeddedDocument.prototype.$__setSchema(schema); - EmbeddedDocument.schema = schema; - - // apply methods - for (var i in schema.methods) - EmbeddedDocument.prototype[i] = schema.methods[i]; - - // apply statics - for (i in schema.statics) - EmbeddedDocument[i] = schema.statics[i]; - - EmbeddedDocument.options = options; - this.schema = schema; - - ArrayType.call(this, key, EmbeddedDocument, options); - - this.schema = schema; - var path = this.path; - var fn = this.defaultValue; - - this.default(function() { - var arr = fn.call(this); - if (!Array.isArray(arr)) arr = [arr]; - return new MongooseDocumentArray(arr, path, this); - }); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -DocumentArray.schemaName = 'DocumentArray'; - -/*! - * Inherits from ArrayType. - */ -DocumentArray.prototype = Object.create( ArrayType.prototype ); -DocumentArray.prototype.constructor = DocumentArray; - -/** - * Performs local validations first, then validations on each embedded doc - * - * @api private - */ - -DocumentArray.prototype.doValidate = function(array, fn, scope) { - SchemaType.prototype.doValidate.call(this, array, function(err) { - if (err) { - return fn(err); - } - - var count = array && array.length; - var error; - - if (!count) return fn(); - - // handle sparse arrays, do not use array.forEach which does not - // iterate over sparse elements yet reports array.length including - // them :( - - for (var i = 0, len = count; i < len; ++i) { - // sidestep sparse entries - var doc = array[i]; - if (!doc) { - --count || fn(error); - continue; - } - - doc.validate(function(err) { - if (err) { - error = err; - } - --count || fn(error); - }); - } - }, scope); -}; - -/** - * Performs local validations first, then validations on each embedded doc. - * - * ####Note: - * - * This method ignores the asynchronous validators. - * - * @return {MongooseError|undefined} - * @api private - */ - -DocumentArray.prototype.doValidateSync = function(array, scope) { - var schemaTypeError = SchemaType.prototype.doValidateSync.call(this, array, scope); - if (schemaTypeError) return schemaTypeError; - - var count = array && array.length - , resultError = null; - - if (!count) return; - - // handle sparse arrays, do not use array.forEach which does not - // iterate over sparse elements yet reports array.length including - // them :( - - for (var i = 0, len = count; i < len; ++i) { - // only first error - if ( resultError ) break; - // sidestep sparse entries - var doc = array[i]; - if (!doc) continue; - - var subdocValidateError = doc.validateSync(); - - if (subdocValidateError) { - resultError = subdocValidateError; - } - } - - return resultError; -}; - -/** - * Casts contents - * - * @param {Object} value - * @param {Document} document that triggers the casting - * @api private - */ - -DocumentArray.prototype.cast = function(value, doc, init, prev) { - var selected - , subdoc - , i; - - if (!Array.isArray(value)) { - // gh-2442 mark whole array as modified if we're initializing a doc from - // the db and the path isn't an array in the document - if (!!doc && init) { - doc.markModified(this.path); - } - return this.cast([value], doc, init, prev); - } - - if (!(value && value.isMongooseDocumentArray)) { - value = new MongooseDocumentArray(value, this.path, doc); - if (prev && prev._handlers) { - for (var key in prev._handlers) { - doc.removeListener(key, prev._handlers[key]); - } - } - } - - i = value.length; - - while (i--) { - if (!(value[i] instanceof Subdocument) && value[i]) { - if (init) { - selected || (selected = scopePaths(this, doc.$__.selected, init)); - subdoc = new this.casterConstructor(null, value, true, selected, i); - value[i] = subdoc.init(value[i]); - } else { - try { - subdoc = prev.id(value[i]._id); - } catch (e) {} - - if (prev && subdoc) { - // handle resetting doc with existing id but differing data - // doc.array = [{ doc: 'val' }] - subdoc.set(value[i]); - // if set() is hooked it will have no return value - // see gh-746 - value[i] = subdoc; - } else { - subdoc = new this.casterConstructor(value[i], value, undefined, undefined, i); - // if set() is hooked it will have no return value - // see gh-746 - value[i] = subdoc; - } - } - } - } - - return value; -}; - -/*! - * Scopes paths selected in a query to this array. - * Necessary for proper default application of subdocument values. - * - * @param {DocumentArray} array - the array to scope `fields` paths - * @param {Object|undefined} fields - the root fields selected in the query - * @param {Boolean|undefined} init - if we are being created part of a query result - */ - -function scopePaths(array, fields, init) { - if (!(init && fields)) return undefined; - - var path = array.path + '.' - , keys = Object.keys(fields) - , i = keys.length - , selected = {} - , hasKeys - , key; - - while (i--) { - key = keys[i]; - if (0 === key.indexOf(path)) { - hasKeys || (hasKeys = true); - selected[key.substring(path.length)] = fields[key]; - } - } - - return hasKeys && selected || undefined; -} - -/*! - * Module exports. - */ - -module.exports = DocumentArray; diff --git a/Associations/node_modules/mongoose/lib/schema/index.js b/Associations/node_modules/mongoose/lib/schema/index.js deleted file mode 100644 index d1347edc..00000000 --- a/Associations/node_modules/mongoose/lib/schema/index.js +++ /dev/null @@ -1,28 +0,0 @@ - -/*! - * Module exports. - */ - -exports.String = require('./string'); - -exports.Number = require('./number'); - -exports.Boolean = require('./boolean'); - -exports.DocumentArray = require('./documentarray'); - -exports.Array = require('./array'); - -exports.Buffer = require('./buffer'); - -exports.Date = require('./date'); - -exports.ObjectId = require('./objectid'); - -exports.Mixed = require('./mixed'); - -// alias - -exports.Oid = exports.ObjectId; -exports.Object = exports.Mixed; -exports.Bool = exports.Boolean; diff --git a/Associations/node_modules/mongoose/lib/schema/mixed.js b/Associations/node_modules/mongoose/lib/schema/mixed.js deleted file mode 100644 index ff2173a0..00000000 --- a/Associations/node_modules/mongoose/lib/schema/mixed.js +++ /dev/null @@ -1,91 +0,0 @@ - -/*! - * Module dependencies. - */ - -var SchemaType = require('../schematype'); -var utils = require('../utils'); - -/** - * Mixed SchemaType constructor. - * - * @param {String} path - * @param {Object} options - * @inherits SchemaType - * @api private - */ - -function Mixed(path, options) { - if (options && options.default) { - var def = options.default; - if (Array.isArray(def) && 0 === def.length) { - // make sure empty array defaults are handled - options.default = Array; - } else if (!options.shared && - utils.isObject(def) && - 0 === Object.keys(def).length) { - // prevent odd "shared" objects between documents - options.default = function() { - return {}; - }; - } - } - - SchemaType.call(this, path, options, 'Mixed'); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -Mixed.schemaName = 'Mixed'; - -/*! - * Inherits from SchemaType. - */ -Mixed.prototype = Object.create( SchemaType.prototype ); -Mixed.prototype.constructor = Mixed; - -/** - * Required validator - * - * @api private - */ - -Mixed.prototype.checkRequired = function(val) { - return (val !== undefined) && (val !== null); -}; - -/** - * Casts `val` for Mixed. - * - * _this is a no-op_ - * - * @param {Object} value to cast - * @api private - */ - -Mixed.prototype.cast = function(val) { - return val; -}; - -/** - * Casts contents for queries. - * - * @param {String} $cond - * @param {any} [val] - * @api private - */ - -Mixed.prototype.castForQuery = function($cond, val) { - if (arguments.length === 2) return val; - return $cond; -}; - -/*! - * Module exports. - */ - -module.exports = Mixed; diff --git a/Associations/node_modules/mongoose/lib/schema/number.js b/Associations/node_modules/mongoose/lib/schema/number.js deleted file mode 100644 index df260471..00000000 --- a/Associations/node_modules/mongoose/lib/schema/number.js +++ /dev/null @@ -1,278 +0,0 @@ -/*! - * Module requirements. - */ - -var SchemaType = require('../schematype') - , CastError = SchemaType.CastError - , errorMessages = require('../error').messages - , utils = require('../utils') - , Document; - -/** - * Number SchemaType constructor. - * - * @param {String} key - * @param {Object} options - * @inherits SchemaType - * @api private - */ - -function SchemaNumber(key, options) { - SchemaType.call(this, key, options, 'Number'); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -SchemaNumber.schemaName = 'Number'; - -/*! - * Inherits from SchemaType. - */ -SchemaNumber.prototype = Object.create( SchemaType.prototype ); -SchemaNumber.prototype.constructor = SchemaNumber; - -/** - * Required validator for number - * - * @api private - */ - -SchemaNumber.prototype.checkRequired = function checkRequired(value, doc) { - if (SchemaType._isRef(this, value, doc, true)) { - return null != value; - } else { - return typeof value == 'number' || value instanceof Number; - } -}; - -/** - * Sets a minimum number validator. - * - * ####Example: - * - * var s = new Schema({ n: { type: Number, min: 10 }) - * var M = db.model('M', s) - * var m = new M({ n: 9 }) - * m.save(function (err) { - * console.error(err) // validator error - * m.n = 10; - * m.save() // success - * }) - * - * // custom error messages - * // We can also use the special {MIN} token which will be replaced with the invalid value - * var min = [10, 'The value of path `{PATH}` ({VALUE}) is beneath the limit ({MIN}).']; - * var schema = new Schema({ n: { type: Number, min: min }) - * var M = mongoose.model('Measurement', schema); - * var s= new M({ n: 4 }); - * s.validate(function (err) { - * console.log(String(err)) // ValidationError: The value of path `n` (4) is beneath the limit (10). - * }) - * - * @param {Number} value minimum number - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaNumber.prototype.min = function(value, message) { - if (this.minValidator) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.minValidator; - }, this); - } - - if (null != value) { - var msg = message || errorMessages.Number.min; - msg = msg.replace(/{MIN}/, value); - this.validators.push({ - validator: this.minValidator = function(v) { - return v === null || v >= value; - }, - message: msg, - type: 'min', - min: value - }); - } - - return this; -}; - -/** - * Sets a maximum number validator. - * - * ####Example: - * - * var s = new Schema({ n: { type: Number, max: 10 }) - * var M = db.model('M', s) - * var m = new M({ n: 11 }) - * m.save(function (err) { - * console.error(err) // validator error - * m.n = 10; - * m.save() // success - * }) - * - * // custom error messages - * // We can also use the special {MAX} token which will be replaced with the invalid value - * var max = [10, 'The value of path `{PATH}` ({VALUE}) exceeds the limit ({MAX}).']; - * var schema = new Schema({ n: { type: Number, max: max }) - * var M = mongoose.model('Measurement', schema); - * var s= new M({ n: 4 }); - * s.validate(function (err) { - * console.log(String(err)) // ValidationError: The value of path `n` (4) exceeds the limit (10). - * }) - * - * @param {Number} maximum number - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaNumber.prototype.max = function(value, message) { - if (this.maxValidator) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.maxValidator; - }, this); - } - - if (null != value) { - var msg = message || errorMessages.Number.max; - msg = msg.replace(/{MAX}/, value); - this.validators.push({ - validator: this.maxValidator = function(v) { - return v === null || v <= value; - }, - message: msg, - type: 'max', - max: value - }); - } - - return this; -}; - -/** - * Casts to number - * - * @param {Object} value value to cast - * @param {Document} doc document that triggers the casting - * @param {Boolean} init - * @api private - */ - -SchemaNumber.prototype.cast = function(value, doc, init) { - if (SchemaType._isRef(this, value, doc, init)) { - // wait! we may need to cast this to a document - - if (null == value) { - return value; - } - - // lazy load - Document || (Document = require('./../document')); - - if (value instanceof Document) { - value.$__.wasPopulated = true; - return value; - } - - // setting a populated path - if ('number' == typeof value) { - return value; - } else if (Buffer.isBuffer(value) || !utils.isObject(value)) { - throw new CastError('number', value, this.path); - } - - // Handle the case where user directly sets a populated - // path to a plain object; cast to the Model used in - // the population query. - var path = doc.$__fullPath(this.path); - var owner = doc.ownerDocument ? doc.ownerDocument() : doc; - var pop = owner.populated(path, true); - var ret = new pop.options.model(value); - ret.$__.wasPopulated = true; - return ret; - } - - var val = value && value._id - ? value._id // documents - : value; - - if (!isNaN(val)) { - if (null === val) return val; - if ('' === val) return null; - if ('string' == typeof val) val = Number(val); - if (val instanceof Number) return val; - if ('number' == typeof val) return val; - if (val.toString && !Array.isArray(val) && - val.toString() == Number(val)) { - return new Number(val); - } - } - - throw new CastError('number', value, this.path); -}; - -/*! - * ignore - */ - -function handleSingle(val) { - return this.cast(val); -} - -function handleArray(val) { - var self = this; - if (!Array.isArray(val)) { - return [this.cast(val)]; - } - return val.map(function(m) { - return self.cast(m); - }); -} - -SchemaNumber.prototype.$conditionalHandlers = - utils.options(SchemaType.prototype.$conditionalHandlers, { - '$all': handleArray, - '$gt' : handleSingle, - '$gte': handleSingle, - '$in' : handleArray, - '$lt' : handleSingle, - '$lte': handleSingle, - '$ne' : handleSingle, - '$mod': handleArray, - '$nin': handleArray - }); - -/** - * Casts contents for queries. - * - * @param {String} $conditional - * @param {any} [value] - * @api private - */ - -SchemaNumber.prototype.castForQuery = function($conditional, val) { - var handler; - if (arguments.length === 2) { - handler = this.$conditionalHandlers[$conditional]; - if (!handler) - throw new Error("Can't use " + $conditional + " with Number."); - return handler.call(this, val); - } else { - val = this.cast($conditional); - return val == null ? val : val; - } -}; - -/*! - * Module exports. - */ - -module.exports = SchemaNumber; diff --git a/Associations/node_modules/mongoose/lib/schema/objectid.js b/Associations/node_modules/mongoose/lib/schema/objectid.js deleted file mode 100644 index 42403c3e..00000000 --- a/Associations/node_modules/mongoose/lib/schema/objectid.js +++ /dev/null @@ -1,208 +0,0 @@ -/* eslint no-empty: 1 */ - -/*! - * Module dependencies. - */ - -var SchemaType = require('../schematype') - , CastError = SchemaType.CastError - , oid = require('../types/objectid') - , utils = require('../utils') - , Document; - -/** - * ObjectId SchemaType constructor. - * - * @param {String} key - * @param {Object} options - * @inherits SchemaType - * @api private - */ - -function ObjectId(key, options) { - SchemaType.call(this, key, options, 'ObjectID'); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -ObjectId.schemaName = 'ObjectId'; - -/*! - * Inherits from SchemaType. - */ -ObjectId.prototype = Object.create( SchemaType.prototype ); -ObjectId.prototype.constructor = ObjectId; - -/** - * Adds an auto-generated ObjectId default if turnOn is true. - * @param {Boolean} turnOn auto generated ObjectId defaults - * @api public - * @return {SchemaType} this - */ - -ObjectId.prototype.auto = function(turnOn) { - if (turnOn) { - this.default(defaultId); - this.set(resetId); - } - - return this; -}; - -/** - * Check required - * - * @api private - */ - -ObjectId.prototype.checkRequired = function checkRequired(value, doc) { - if (SchemaType._isRef(this, value, doc, true)) { - return null != value; - } else { - return value instanceof oid; - } -}; - -/** - * Casts to ObjectId - * - * @param {Object} value - * @param {Object} doc - * @param {Boolean} init whether this is an initialization cast - * @api private - */ - -ObjectId.prototype.cast = function(value, doc, init) { - if (SchemaType._isRef(this, value, doc, init)) { - // wait! we may need to cast this to a document - - if (null == value) { - return value; - } - - // lazy load - Document || (Document = require('./../document')); - - if (value instanceof Document) { - value.$__.wasPopulated = true; - return value; - } - - // setting a populated path - if (value instanceof oid) { - return value; - } else if (Buffer.isBuffer(value) || !utils.isObject(value)) { - throw new CastError('ObjectId', value, this.path); - } - - // Handle the case where user directly sets a populated - // path to a plain object; cast to the Model used in - // the population query. - var path = doc.$__fullPath(this.path); - var owner = doc.ownerDocument ? doc.ownerDocument() : doc; - var pop = owner.populated(path, true); - var ret = new pop.options.model(value); - ret.$__.wasPopulated = true; - return ret; - } - - // If null or undefined - if (value == null) return value; - - if (value instanceof oid) - return value; - - if (value._id) { - if (value._id instanceof oid) { - return value._id; - } - if (value._id.toString instanceof Function) { - try { - return oid.createFromHexString(value._id.toString()); - } catch (e) {} - } - } - - if (value.toString instanceof Function) { - try { - return oid.createFromHexString(value.toString()); - } catch (err) { - throw new CastError('ObjectId', value, this.path); - } - } - - throw new CastError('ObjectId', value, this.path); -}; - -/*! - * ignore - */ - -function handleSingle(val) { - return this.cast(val); -} - -function handleArray(val) { - var self = this; - if (!Array.isArray(val)) { - return [self.cast(val)]; - } - return val.map(function(m) { - return self.cast(m); - }); -} - -ObjectId.prototype.$conditionalHandlers = - utils.options(SchemaType.prototype.$conditionalHandlers, { - '$all': handleArray, - '$gt': handleSingle, - '$gte': handleSingle, - '$in': handleArray, - '$lt': handleSingle, - '$lte': handleSingle, - '$ne': handleSingle, - '$nin': handleArray - }); - -/** - * Casts contents for queries. - * - * @param {String} $conditional - * @param {any} [val] - * @api private - */ - -ObjectId.prototype.castForQuery = function($conditional, val) { - var handler; - if (arguments.length === 2) { - handler = this.$conditionalHandlers[$conditional]; - if (!handler) - throw new Error("Can't use " + $conditional + " with ObjectId."); - return handler.call(this, val); - } else { - return this.cast($conditional); - } -}; - -/*! - * ignore - */ - -function defaultId() { - return new oid(); -} - -function resetId(v) { - this.$__._id = null; - return v; -} - -/*! - * Module exports. - */ - -module.exports = ObjectId; diff --git a/Associations/node_modules/mongoose/lib/schema/string.js b/Associations/node_modules/mongoose/lib/schema/string.js deleted file mode 100644 index b8c16806..00000000 --- a/Associations/node_modules/mongoose/lib/schema/string.js +++ /dev/null @@ -1,495 +0,0 @@ - -/*! - * Module dependencies. - */ - -var SchemaType = require('../schematype') - , CastError = SchemaType.CastError - , errorMessages = require('../error').messages - , utils = require('../utils') - , Document; - -/** - * String SchemaType constructor. - * - * @param {String} key - * @param {Object} options - * @inherits SchemaType - * @api private - */ - -function SchemaString(key, options) { - this.enumValues = []; - this.regExp = null; - SchemaType.call(this, key, options, 'String'); -} - -/** - * This schema type's name, to defend against minifiers that mangle - * function names. - * - * @api private - */ -SchemaString.schemaName = 'String'; - -/*! - * Inherits from SchemaType. - */ -SchemaString.prototype = Object.create( SchemaType.prototype ); -SchemaString.prototype.constructor = SchemaString; - -/** - * Adds an enum validator - * - * ####Example: - * - * var states = 'opening open closing closed'.split(' ') - * var s = new Schema({ state: { type: String, enum: states }}) - * var M = db.model('M', s) - * var m = new M({ state: 'invalid' }) - * m.save(function (err) { - * console.error(String(err)) // ValidationError: `invalid` is not a valid enum value for path `state`. - * m.state = 'open' - * m.save(callback) // success - * }) - * - * // or with custom error messages - * var enu = { - * values: 'opening open closing closed'.split(' '), - * message: 'enum validator failed for path `{PATH}` with value `{VALUE}`' - * } - * var s = new Schema({ state: { type: String, enum: enu }) - * var M = db.model('M', s) - * var m = new M({ state: 'invalid' }) - * m.save(function (err) { - * console.error(String(err)) // ValidationError: enum validator failed for path `state` with value `invalid` - * m.state = 'open' - * m.save(callback) // success - * }) - * - * @param {String|Object} [args...] enumeration values - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaString.prototype.enum = function() { - if (this.enumValidator) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.enumValidator; - }, this); - this.enumValidator = false; - } - - if (undefined === arguments[0] || false === arguments[0]) { - return this; - } - - var values; - var errorMessage; - - if (utils.isObject(arguments[0])) { - values = arguments[0].values; - errorMessage = arguments[0].message; - } else { - values = arguments; - errorMessage = errorMessages.String.enum; - } - - for (var i = 0; i < values.length; i++) { - if (undefined !== values[i]) { - this.enumValues.push(this.cast(values[i])); - } - } - - var vals = this.enumValues; - this.enumValidator = function(v) { - return undefined === v || ~vals.indexOf(v); - }; - this.validators.push({ - validator: this.enumValidator, - message: errorMessage, - type: 'enum', - enumValues: vals - }); - - return this; -}; - -/** - * Adds a lowercase setter. - * - * ####Example: - * - * var s = new Schema({ email: { type: String, lowercase: true }}) - * var M = db.model('M', s); - * var m = new M({ email: 'SomeEmail@example.COM' }); - * console.log(m.email) // someemail@example.com - * - * @api public - * @return {SchemaType} this - */ - -SchemaString.prototype.lowercase = function() { - return this.set(function(v, self) { - if ('string' != typeof v) v = self.cast(v); - if (v) return v.toLowerCase(); - return v; - }); -}; - -/** - * Adds an uppercase setter. - * - * ####Example: - * - * var s = new Schema({ caps: { type: String, uppercase: true }}) - * var M = db.model('M', s); - * var m = new M({ caps: 'an example' }); - * console.log(m.caps) // AN EXAMPLE - * - * @api public - * @return {SchemaType} this - */ - -SchemaString.prototype.uppercase = function() { - return this.set(function(v, self) { - if ('string' != typeof v) v = self.cast(v); - if (v) return v.toUpperCase(); - return v; - }); -}; - -/** - * Adds a trim setter. - * - * The string value will be trimmed when set. - * - * ####Example: - * - * var s = new Schema({ name: { type: String, trim: true }}) - * var M = db.model('M', s) - * var string = ' some name ' - * console.log(string.length) // 11 - * var m = new M({ name: string }) - * console.log(m.name.length) // 9 - * - * @api public - * @return {SchemaType} this - */ - -SchemaString.prototype.trim = function() { - return this.set(function(v, self) { - if ('string' != typeof v) v = self.cast(v); - if (v) return v.trim(); - return v; - }); -}; - -/** - * Sets a minimum length validator. - * - * ####Example: - * - * var schema = new Schema({ postalCode: { type: String, minlength: 5 }) - * var Address = db.model('Address', schema) - * var address = new Address({ postalCode: '9512' }) - * address.save(function (err) { - * console.error(err) // validator error - * address.postalCode = '95125'; - * address.save() // success - * }) - * - * // custom error messages - * // We can also use the special {MINLENGTH} token which will be replaced with the minimum allowed length - * var minlength = [5, 'The value of path `{PATH}` (`{VALUE}`) is shorter than the minimum allowed length ({MINLENGTH}).']; - * var schema = new Schema({ postalCode: { type: String, minlength: minlength }) - * var Address = mongoose.model('Address', schema); - * var address = new Address({ postalCode: '9512' }); - * address.validate(function (err) { - * console.log(String(err)) // ValidationError: The value of path `postalCode` (`9512`) is shorter than the minimum length (5). - * }) - * - * @param {Number} value minimum string length - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaString.prototype.minlength = function(value, message) { - if (this.minlengthValidator) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.minlengthValidator; - }, this); - } - - if (null != value) { - var msg = message || errorMessages.String.minlength; - msg = msg.replace(/{MINLENGTH}/, value); - this.validators.push({ - validator: this.minlengthValidator = function(v) { - return v === null || v.length >= value; - }, - message: msg, - type: 'minlength', - minlength: value - }); - } - - return this; -}; - -/** - * Sets a maximum length validator. - * - * ####Example: - * - * var schema = new Schema({ postalCode: { type: String, maxlength: 9 }) - * var Address = db.model('Address', schema) - * var address = new Address({ postalCode: '9512512345' }) - * address.save(function (err) { - * console.error(err) // validator error - * address.postalCode = '95125'; - * address.save() // success - * }) - * - * // custom error messages - * // We can also use the special {MAXLENGTH} token which will be replaced with the maximum allowed length - * var maxlength = [9, 'The value of path `{PATH}` (`{VALUE}`) exceeds the maximum allowed length ({MAXLENGTH}).']; - * var schema = new Schema({ postalCode: { type: String, maxlength: maxlength }) - * var Address = mongoose.model('Address', schema); - * var address = new Address({ postalCode: '9512512345' }); - * address.validate(function (err) { - * console.log(String(err)) // ValidationError: The value of path `postalCode` (`9512512345`) exceeds the maximum allowed length (9). - * }) - * - * @param {Number} value maximum string length - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaString.prototype.maxlength = function(value, message) { - if (this.maxlengthValidator) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.maxlengthValidator; - }, this); - } - - if (null != value) { - var msg = message || errorMessages.String.maxlength; - msg = msg.replace(/{MAXLENGTH}/, value); - this.validators.push({ - validator: this.maxlengthValidator = function(v) { - return v === null || v.length <= value; - }, - message: msg, - type: 'maxlength', - maxlength: value - }); - } - - return this; -}; - -/** - * Sets a regexp validator. - * - * Any value that does not pass `regExp`.test(val) will fail validation. - * - * ####Example: - * - * var s = new Schema({ name: { type: String, match: /^a/ }}) - * var M = db.model('M', s) - * var m = new M({ name: 'I am invalid' }) - * m.validate(function (err) { - * console.error(String(err)) // "ValidationError: Path `name` is invalid (I am invalid)." - * m.name = 'apples' - * m.validate(function (err) { - * assert.ok(err) // success - * }) - * }) - * - * // using a custom error message - * var match = [ /\.html$/, "That file doesn't end in .html ({VALUE})" ]; - * var s = new Schema({ file: { type: String, match: match }}) - * var M = db.model('M', s); - * var m = new M({ file: 'invalid' }); - * m.validate(function (err) { - * console.log(String(err)) // "ValidationError: That file doesn't end in .html (invalid)" - * }) - * - * Empty strings, `undefined`, and `null` values always pass the match validator. If you require these values, enable the `required` validator also. - * - * var s = new Schema({ name: { type: String, match: /^a/, required: true }}) - * - * @param {RegExp} regExp regular expression to test against - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaString.prototype.match = function match(regExp, message) { - // yes, we allow multiple match validators - - var msg = message || errorMessages.String.match; - - var matchValidator = function(v) { - if (!regExp) { - return false; - } - - var ret = ((null != v && '' !== v) - ? regExp.test(v) - : true); - return ret; - }; - - this.validators.push({ - validator: matchValidator, - message: msg, - type: 'regexp', - regexp: regExp - }); - return this; -}; - -/** - * Check required - * - * @param {String|null|undefined} value - * @api private - */ - -SchemaString.prototype.checkRequired = function checkRequired(value, doc) { - if (SchemaType._isRef(this, value, doc, true)) { - return null != value; - } else { - return (value instanceof String || typeof value == 'string') && value.length; - } -}; - -/** - * Casts to String - * - * @api private - */ - -SchemaString.prototype.cast = function(value, doc, init) { - if (SchemaType._isRef(this, value, doc, init)) { - // wait! we may need to cast this to a document - - if (null == value) { - return value; - } - - // lazy load - Document || (Document = require('./../document')); - - if (value instanceof Document) { - value.$__.wasPopulated = true; - return value; - } - - // setting a populated path - if ('string' == typeof value) { - return value; - } else if (Buffer.isBuffer(value) || !utils.isObject(value)) { - throw new CastError('string', value, this.path); - } - - // Handle the case where user directly sets a populated - // path to a plain object; cast to the Model used in - // the population query. - var path = doc.$__fullPath(this.path); - var owner = doc.ownerDocument ? doc.ownerDocument() : doc; - var pop = owner.populated(path, true); - var ret = new pop.options.model(value); - ret.$__.wasPopulated = true; - return ret; - } - - // If null or undefined - if (value == null) { - return value; - } - - if ('undefined' !== typeof value) { - // handle documents being passed - if (value._id && 'string' == typeof value._id) { - return value._id; - } - - // Re: gh-647 and gh-3030, we're ok with casting using `toString()` - // **unless** its the default Object.toString, because "[object Object]" - // doesn't really qualify as useful data - if (value.toString && value.toString !== Object.prototype.toString) { - return value.toString(); - } - } - - throw new CastError('string', value, this.path); -}; - -/*! - * ignore - */ - -function handleSingle(val) { - return this.castForQuery(val); -} - -function handleArray(val) { - var self = this; - if (!Array.isArray(val)) { - return [this.castForQuery(val)]; - } - return val.map(function(m) { - return self.castForQuery(m); - }); -} - -SchemaString.prototype.$conditionalHandlers = - utils.options(SchemaType.prototype.$conditionalHandlers, { - '$all': handleArray, - '$gt' : handleSingle, - '$gte': handleSingle, - '$in' : handleArray, - '$lt' : handleSingle, - '$lte': handleSingle, - '$ne' : handleSingle, - '$nin': handleArray, - '$options': handleSingle, - '$regex': handleSingle - }); - -/** - * Casts contents for queries. - * - * @param {String} $conditional - * @param {any} [val] - * @api private - */ - -SchemaString.prototype.castForQuery = function($conditional, val) { - var handler; - if (arguments.length === 2) { - handler = this.$conditionalHandlers[$conditional]; - if (!handler) - throw new Error("Can't use " + $conditional + " with String."); - return handler.call(this, val); - } else { - val = $conditional; - if (val instanceof RegExp) return val; - return this.cast(val); - } -}; - -/*! - * Module exports. - */ - -module.exports = SchemaString; diff --git a/Associations/node_modules/mongoose/lib/schematype.js b/Associations/node_modules/mongoose/lib/schematype.js deleted file mode 100644 index 687b5420..00000000 --- a/Associations/node_modules/mongoose/lib/schematype.js +++ /dev/null @@ -1,800 +0,0 @@ -/*! - * Module dependencies. - */ - -var utils = require('./utils'); -var error = require('./error'); -var errorMessages = error.messages; -var CastError = error.CastError; -var ValidatorError = error.ValidatorError; - -/** - * SchemaType constructor - * - * @param {String} path - * @param {Object} [options] - * @param {String} [instance] - * @api public - */ - -function SchemaType(path, options, instance) { - this.path = path; - this.instance = instance; - this.validators = []; - this.setters = []; - this.getters = []; - this.options = options; - this._index = null; - this.selected; - - for (var i in options) { - if (this[i] && 'function' == typeof this[i]) { - // { unique: true, index: true } - if ('index' == i && this._index) continue; - - var opts = Array.isArray(options[i]) - ? options[i] - : [options[i]]; - - this[i].apply(this, opts); - } - } -} - -/** - * Sets a default value for this SchemaType. - * - * ####Example: - * - * var schema = new Schema({ n: { type: Number, default: 10 }) - * var M = db.model('M', schema) - * var m = new M; - * console.log(m.n) // 10 - * - * Defaults can be either `functions` which return the value to use as the default or the literal value itself. Either way, the value will be cast based on its schema type before being set during document creation. - * - * ####Example: - * - * // values are cast: - * var schema = new Schema({ aNumber: { type: Number, default: 4.815162342 }}) - * var M = db.model('M', schema) - * var m = new M; - * console.log(m.aNumber) // 4.815162342 - * - * // default unique objects for Mixed types: - * var schema = new Schema({ mixed: Schema.Types.Mixed }); - * schema.path('mixed').default(function () { - * return {}; - * }); - * - * // if we don't use a function to return object literals for Mixed defaults, - * // each document will receive a reference to the same object literal creating - * // a "shared" object instance: - * var schema = new Schema({ mixed: Schema.Types.Mixed }); - * schema.path('mixed').default({}); - * var M = db.model('M', schema); - * var m1 = new M; - * m1.mixed.added = 1; - * console.log(m1.mixed); // { added: 1 } - * var m2 = new M; - * console.log(m2.mixed); // { added: 1 } - * - * @param {Function|any} val the default value - * @return {defaultValue} - * @api public - */ - -SchemaType.prototype.default = function(val) { - if (1 === arguments.length) { - this.defaultValue = typeof val === 'function' - ? val - : this.cast(val); - return this; - } else if (arguments.length > 1) { - this.defaultValue = utils.args(arguments); - } - return this.defaultValue; -}; - -/** - * Declares the index options for this schematype. - * - * ####Example: - * - * var s = new Schema({ name: { type: String, index: true }) - * var s = new Schema({ loc: { type: [Number], index: 'hashed' }) - * var s = new Schema({ loc: { type: [Number], index: '2d', sparse: true }) - * var s = new Schema({ loc: { type: [Number], index: { type: '2dsphere', sparse: true }}) - * var s = new Schema({ date: { type: Date, index: { unique: true, expires: '1d' }}) - * Schema.path('my.path').index(true); - * Schema.path('my.date').index({ expires: 60 }); - * Schema.path('my.path').index({ unique: true, sparse: true }); - * - * ####NOTE: - * - * _Indexes are created in the background by default. Specify `background: false` to override._ - * - * [Direction doesn't matter for single key indexes](http://www.mongodb.org/display/DOCS/Indexes#Indexes-CompoundKeysIndexes) - * - * @param {Object|Boolean|String} options - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.index = function(options) { - this._index = options; - utils.expires(this._index); - return this; -}; - -/** - * Declares an unique index. - * - * ####Example: - * - * var s = new Schema({ name: { type: String, unique: true }}); - * Schema.path('name').index({ unique: true }); - * - * _NOTE: violating the constraint returns an `E11000` error from MongoDB when saving, not a Mongoose validation error._ - * - * @param {Boolean} bool - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.unique = function(bool) { - if (null == this._index || 'boolean' == typeof this._index) { - this._index = {}; - } else if ('string' == typeof this._index) { - this._index = { type: this._index }; - } - - this._index.unique = bool; - return this; -}; - -/** - * Declares a full text index. - * - * ###Example: - * - * var s = new Schema({name : {type: String, text : true }) - * Schema.path('name').index({text : true}); - * @param bool - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.text = function(bool) { - if (null == this._index || 'boolean' == typeof this._index) { - this._index = {}; - } else if ('string' == typeof this._index) { - this._index = { type: this._index }; - } - - this._index.text = bool; - return this; -}; - -/** - * Declares a sparse index. - * - * ####Example: - * - * var s = new Schema({ name: { type: String, sparse: true }) - * Schema.path('name').index({ sparse: true }); - * - * @param {Boolean} bool - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.sparse = function(bool) { - if (null == this._index || 'boolean' == typeof this._index) { - this._index = {}; - } else if ('string' == typeof this._index) { - this._index = { type: this._index }; - } - - this._index.sparse = bool; - return this; -}; - -/** - * Adds a setter to this schematype. - * - * ####Example: - * - * function capitalize (val) { - * if ('string' != typeof val) val = ''; - * return val.charAt(0).toUpperCase() + val.substring(1); - * } - * - * // defining within the schema - * var s = new Schema({ name: { type: String, set: capitalize }}) - * - * // or by retreiving its SchemaType - * var s = new Schema({ name: String }) - * s.path('name').set(capitalize) - * - * Setters allow you to transform the data before it gets to the raw mongodb document and is set as a value on an actual key. - * - * Suppose you are implementing user registration for a website. Users provide an email and password, which gets saved to mongodb. The email is a string that you will want to normalize to lower case, in order to avoid one email having more than one account -- e.g., otherwise, avenue@q.com can be registered for 2 accounts via avenue@q.com and AvEnUe@Q.CoM. - * - * You can set up email lower case normalization easily via a Mongoose setter. - * - * function toLower (v) { - * return v.toLowerCase(); - * } - * - * var UserSchema = new Schema({ - * email: { type: String, set: toLower } - * }) - * - * var User = db.model('User', UserSchema) - * - * var user = new User({email: 'AVENUE@Q.COM'}) - * console.log(user.email); // 'avenue@q.com' - * - * // or - * var user = new User - * user.email = 'Avenue@Q.com' - * console.log(user.email) // 'avenue@q.com' - * - * As you can see above, setters allow you to transform the data before it gets to the raw mongodb document and is set as a value on an actual key. - * - * _NOTE: we could have also just used the built-in `lowercase: true` SchemaType option instead of defining our own function._ - * - * new Schema({ email: { type: String, lowercase: true }}) - * - * Setters are also passed a second argument, the schematype on which the setter was defined. This allows for tailored behavior based on options passed in the schema. - * - * function inspector (val, schematype) { - * if (schematype.options.required) { - * return schematype.path + ' is required'; - * } else { - * return val; - * } - * } - * - * var VirusSchema = new Schema({ - * name: { type: String, required: true, set: inspector }, - * taxonomy: { type: String, set: inspector } - * }) - * - * var Virus = db.model('Virus', VirusSchema); - * var v = new Virus({ name: 'Parvoviridae', taxonomy: 'Parvovirinae' }); - * - * console.log(v.name); // name is required - * console.log(v.taxonomy); // Parvovirinae - * - * @param {Function} fn - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.set = function(fn) { - if ('function' != typeof fn) - throw new TypeError('A setter must be a function.'); - this.setters.push(fn); - return this; -}; - -/** - * Adds a getter to this schematype. - * - * ####Example: - * - * function dob (val) { - * if (!val) return val; - * return (val.getMonth() + 1) + "/" + val.getDate() + "/" + val.getFullYear(); - * } - * - * // defining within the schema - * var s = new Schema({ born: { type: Date, get: dob }) - * - * // or by retreiving its SchemaType - * var s = new Schema({ born: Date }) - * s.path('born').get(dob) - * - * Getters allow you to transform the representation of the data as it travels from the raw mongodb document to the value that you see. - * - * Suppose you are storing credit card numbers and you want to hide everything except the last 4 digits to the mongoose user. You can do so by defining a getter in the following way: - * - * function obfuscate (cc) { - * return '****-****-****-' + cc.slice(cc.length-4, cc.length); - * } - * - * var AccountSchema = new Schema({ - * creditCardNumber: { type: String, get: obfuscate } - * }); - * - * var Account = db.model('Account', AccountSchema); - * - * Account.findById(id, function (err, found) { - * console.log(found.creditCardNumber); // '****-****-****-1234' - * }); - * - * Getters are also passed a second argument, the schematype on which the getter was defined. This allows for tailored behavior based on options passed in the schema. - * - * function inspector (val, schematype) { - * if (schematype.options.required) { - * return schematype.path + ' is required'; - * } else { - * return schematype.path + ' is not'; - * } - * } - * - * var VirusSchema = new Schema({ - * name: { type: String, required: true, get: inspector }, - * taxonomy: { type: String, get: inspector } - * }) - * - * var Virus = db.model('Virus', VirusSchema); - * - * Virus.findById(id, function (err, virus) { - * console.log(virus.name); // name is required - * console.log(virus.taxonomy); // taxonomy is not - * }) - * - * @param {Function} fn - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.get = function(fn) { - if ('function' != typeof fn) - throw new TypeError('A getter must be a function.'); - this.getters.push(fn); - return this; -}; - -/** - * Adds validator(s) for this document path. - * - * Validators always receive the value to validate as their first argument and must return `Boolean`. Returning `false` means validation failed. - * - * The error message argument is optional. If not passed, the [default generic error message template](#error_messages_MongooseError-messages) will be used. - * - * ####Examples: - * - * // make sure every value is equal to "something" - * function validator (val) { - * return val == 'something'; - * } - * new Schema({ name: { type: String, validate: validator }}); - * - * // with a custom error message - * - * var custom = [validator, 'Uh oh, {PATH} does not equal "something".'] - * new Schema({ name: { type: String, validate: custom }}); - * - * // adding many validators at a time - * - * var many = [ - * { validator: validator, msg: 'uh oh' } - * , { validator: anotherValidator, msg: 'failed' } - * ] - * new Schema({ name: { type: String, validate: many }}); - * - * // or utilizing SchemaType methods directly: - * - * var schema = new Schema({ name: 'string' }); - * schema.path('name').validate(validator, 'validation of `{PATH}` failed with value `{VALUE}`'); - * - * ####Error message templates: - * - * From the examples above, you may have noticed that error messages support baseic templating. There are a few other template keywords besides `{PATH}` and `{VALUE}` too. To find out more, details are available [here](#error_messages_MongooseError-messages) - * - * ####Asynchronous validation: - * - * Passing a validator function that receives two arguments tells mongoose that the validator is an asynchronous validator. The first argument passed to the validator function is the value being validated. The second argument is a callback function that must called when you finish validating the value and passed either `true` or `false` to communicate either success or failure respectively. - * - * schema.path('name').validate(function (value, respond) { - * doStuff(value, function () { - * ... - * respond(false); // validation failed - * }) -* }, '{PATH} failed validation.'); -* - * You might use asynchronous validators to retreive other documents from the database to validate against or to meet other I/O bound validation needs. - * - * Validation occurs `pre('save')` or whenever you manually execute [document#validate](#document_Document-validate). - * - * If validation fails during `pre('save')` and no callback was passed to receive the error, an `error` event will be emitted on your Models associated db [connection](#connection_Connection), passing the validation error object along. - * - * var conn = mongoose.createConnection(..); - * conn.on('error', handleError); - * - * var Product = conn.model('Product', yourSchema); - * var dvd = new Product(..); - * dvd.save(); // emits error on the `conn` above - * - * If you desire handling these errors at the Model level, attach an `error` listener to your Model and the event will instead be emitted there. - * - * // registering an error listener on the Model lets us handle errors more locally - * Product.on('error', handleError); - * - * @param {RegExp|Function|Object} obj validator - * @param {String} [errorMsg] optional error message - * @param {String} [type] optional validator type - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.validate = function(obj, message, type) { - if ('function' == typeof obj || obj && 'RegExp' === utils.getFunctionName(obj.constructor)) { - var properties; - if (message instanceof Object && !type) { - properties = utils.clone(message); - if (!properties.message) { - properties.message = properties.msg; - } - properties.validator = obj; - properties.type = properties.type || 'user defined'; - } else { - if (!message) message = errorMessages.general.default; - if (!type) type = 'user defined'; - properties = { message: message, type: type, validator: obj }; - } - this.validators.push(properties); - return this; - } - - var i - , length - , arg; - - for (i = 0, length = arguments.length; i < length; i++) { - arg = arguments[i]; - if (!(arg && 'Object' === utils.getFunctionName(arg.constructor))) { - var msg = 'Invalid validator. Received (' + typeof arg + ') ' - + arg - + '. See http://mongoosejs.com/docs/api.html#schematype_SchemaType-validate'; - - throw new Error(msg); - } - this.validate(arg.validator, arg); - } - - return this; -}; - -/** - * Adds a required validator to this schematype. The required validator is added - * to the front of the validators array using `unshift()`. - * - * ####Example: - * - * var s = new Schema({ born: { type: Date, required: true }) - * - * // or with custom error message - * - * var s = new Schema({ born: { type: Date, required: '{PATH} is required!' }) - * - * // or through the path API - * - * Schema.path('name').required(true); - * - * // with custom error messaging - * - * Schema.path('name').required(true, 'grrr :( '); - * - * - * @param {Boolean} required enable/disable the validator - * @param {String} [message] optional custom error message - * @return {SchemaType} this - * @see Customized Error Messages #error_messages_MongooseError-messages - * @api public - */ - -SchemaType.prototype.required = function(required, message) { - if (false === required) { - this.validators = this.validators.filter(function(v) { - return v.validator != this.requiredValidator; - }, this); - - this.isRequired = false; - return this; - } - - var self = this; - this.isRequired = true; - - this.requiredValidator = function(v) { - // in here, `this` refers to the validating document. - // no validation when this path wasn't selected in the query. - if ('isSelected' in this && - !this.isSelected(self.path) && - !this.isModified(self.path)) return true; - - return (('function' === typeof required) && !required.apply(this)) || - self.checkRequired(v, this); - }; - - if ('string' == typeof required) { - message = required; - required = undefined; - } - - var msg = message || errorMessages.general.required; - this.validators.unshift({ - validator: this.requiredValidator, - message: msg, - type: 'required' - }); - - return this; -}; - -/** - * Gets the default value - * - * @param {Object} scope the scope which callback are executed - * @param {Boolean} init - * @api private - */ - -SchemaType.prototype.getDefault = function(scope, init) { - var ret = 'function' === typeof this.defaultValue - ? this.defaultValue.call(scope) - : this.defaultValue; - - if (null !== ret && undefined !== ret) { - return this.cast(ret, scope, init); - } else { - return ret; - } -}; - -/** - * Applies setters - * - * @param {Object} value - * @param {Object} scope - * @param {Boolean} init - * @api private - */ - -SchemaType.prototype.applySetters = function(value, scope, init, priorVal) { - var v = value - , setters = this.setters - , len = setters.length - , caster = this.caster; - - while (len--) { - v = setters[len].call(scope, v, this); - } - - if (Array.isArray(v) && caster && caster.setters) { - var newVal = []; - for (var i = 0; i < v.length; i++) { - newVal.push(caster.applySetters(v[i], scope, init, priorVal)); - } - v = newVal; - } - - if (null === v || undefined === v) return v; - - // do not cast until all setters are applied #665 - v = this.cast(v, scope, init, priorVal); - - return v; -}; - -/** - * Applies getters to a value - * - * @param {Object} value - * @param {Object} scope - * @api private - */ - -SchemaType.prototype.applyGetters = function(value, scope) { - var v = value - , getters = this.getters - , len = getters.length; - - if (!len) { - return v; - } - - while (len--) { - v = getters[len].call(scope, v, this); - } - - return v; -}; - -/** - * Sets default `select()` behavior for this path. - * - * Set to `true` if this path should always be included in the results, `false` if it should be excluded by default. This setting can be overridden at the query level. - * - * ####Example: - * - * T = db.model('T', new Schema({ x: { type: String, select: true }})); - * T.find(..); // field x will always be selected .. - * // .. unless overridden; - * T.find().select('-x').exec(callback); - * - * @param {Boolean} val - * @return {SchemaType} this - * @api public - */ - -SchemaType.prototype.select = function select(val) { - this.selected = !! val; - return this; -}; - -/** - * Performs a validation of `value` using the validators declared for this SchemaType. - * - * @param {any} value - * @param {Function} callback - * @param {Object} scope - * @api private - */ - -SchemaType.prototype.doValidate = function(value, fn, scope) { - var err = false - , path = this.path - , count = this.validators.length; - - if (!count) return fn(null); - - var validate = function(ok, validatorProperties) { - if (err) return; - if (ok === undefined || ok) { - --count || fn(null); - } else { - err = new ValidatorError(validatorProperties); - fn(err); - } - }; - - var self = this; - this.validators.forEach(function(v) { - if (err) { - return; - } - - var validator = v.validator; - - var validatorProperties = utils.clone(v); - validatorProperties.path = path; - validatorProperties.value = value; - - if (validator instanceof RegExp) { - validate(validator.test(value), validatorProperties); - } else if ('function' === typeof validator) { - if (value === undefined && !self.isRequired) { - validate(true, validatorProperties); - return; - } - if (2 === validator.length) { - validator.call(scope, value, function(ok) { - validate(ok, validatorProperties); - }); - } else { - validate(validator.call(scope, value), validatorProperties); - } - } - }); -}; - -/** - * Performs a validation of `value` using the validators declared for this SchemaType. - * - * ####Note: - * - * This method ignores the asynchronous validators. - * - * @param {any} value - * @param {Object} scope - * @return {MongooseError|undefined} - * @api private - */ - -SchemaType.prototype.doValidateSync = function(value, scope) { - var err = null - , path = this.path - , count = this.validators.length; - - if (!count) return null; - - var validate = function(ok, validatorProperties) { - if (err) return; - if (ok !== undefined && !ok) { - err = new ValidatorError(validatorProperties); - } - }; - - var self = this; - if (value === undefined && !self.isRequired) { - return null; - } - - this.validators.forEach(function(v) { - if (err) { - return; - } - - var validator = v.validator; - var validatorProperties = utils.clone(v); - validatorProperties.path = path; - validatorProperties.value = value; - - if (validator instanceof RegExp) { - validate(validator.test(value), validatorProperties); - } else if ('function' === typeof validator) { - // if not async validators - if (2 !== validator.length) { - validate(validator.call(scope, value), validatorProperties); - } - } - }); - - return err; -}; - -/** - * Determines if value is a valid Reference. - * - * @param {SchemaType} self - * @param {Object} value - * @param {Document} doc - * @param {Boolean} init - * @return {Boolean} - * @api private - */ - -SchemaType._isRef = function(self, value, doc, init) { - // fast path - var ref = init && self.options && self.options.ref; - - if (!ref && doc && doc.$__fullPath) { - // checks for - // - this populated with adhoc model and no ref was set in schema OR - // - setting / pushing values after population - var path = doc.$__fullPath(self.path); - var owner = doc.ownerDocument ? doc.ownerDocument() : doc; - ref = owner.populated(path); - } - - if (ref) { - if (null == value) return true; - if (!Buffer.isBuffer(value) && // buffers are objects too - 'Binary' != value._bsontype // raw binary value from the db - && utils.isObject(value) // might have deselected _id in population query - ) { - return true; - } - } - - return false; -}; - -/*! - * ignore - */ - -function handleSingle(val) { - return this.cast(val); -} - -// Default conditional handlers for all schema types -SchemaType.prototype.$conditionalHandlers = { - '$eq': handleSingle -}; - -/*! - * Module exports. - */ - -module.exports = exports = SchemaType; - -exports.CastError = CastError; - -exports.ValidatorError = ValidatorError; diff --git a/Associations/node_modules/mongoose/lib/services/updateValidators.js b/Associations/node_modules/mongoose/lib/services/updateValidators.js deleted file mode 100644 index 698aaabf..00000000 --- a/Associations/node_modules/mongoose/lib/services/updateValidators.js +++ /dev/null @@ -1,178 +0,0 @@ -/*! - * Module dependencies. - */ - -var async = require('async'); -var ValidationError = require('../error/validation.js'); -var ObjectId = require('../types/objectid'); - -/** - * Applies validators and defaults to update and findOneAndUpdate operations, - * specifically passing a null doc as `this` to validators and defaults - * - * @param {Query} query - * @param {Schema} schema - * @param {Object} castedDoc - * @param {Object} options - * @method runValidatorsOnUpdate - * @api private - */ - -module.exports = function(query, schema, castedDoc, options) { - var keys = Object.keys(castedDoc || {}); - var updatedKeys = {}; - var updatedValues = {}; - var numKeys = keys.length; - var hasDollarUpdate = false; - var modified = {}; - - for (var i = 0; i < numKeys; ++i) { - if (keys[i].charAt(0) === '$') { - modifiedPaths(castedDoc[keys[i]], '', modified); - var flat = flatten(castedDoc[keys[i]]); - var paths = Object.keys(flat); - var numPaths = paths.length; - for (var j = 0; j < numPaths; ++j) { - var updatedPath = paths[j].replace('.$.', '.0.'); - updatedPath = updatedPath.replace(/\.\$$/, '.0'); - if (keys[i] === '$set' || keys[i] === '$setOnInsert') { - updatedValues[updatedPath] = flat[paths[j]]; - } else if (keys[i] === '$unset') { - updatedValues[updatedPath] = undefined; - } - updatedKeys[updatedPath] = true; - } - hasDollarUpdate = true; - } - } - - if (!hasDollarUpdate) { - modifiedPaths(castedDoc, '', modified); - updatedValues = flatten(castedDoc); - updatedKeys = Object.keys(updatedValues); - } - - if (options && options.upsert) { - paths = Object.keys(query._conditions); - numPaths = keys.length; - for (i = 0; i < numPaths; ++i) { - var path = paths[i]; - var condition = query._conditions[path]; - if (condition && typeof condition === 'object') { - var conditionKeys = Object.keys(condition); - var numConditionKeys = conditionKeys.length; - var hasDollarKey = false; - for (j = 0; j < numConditionKeys; ++j) { - if (conditionKeys[j].charAt(0) === '$') { - hasDollarKey = true; - break; - } - } - if (hasDollarKey) { - continue; - } - } - updatedKeys[path] = true; - modified[path] = true; - } - - if (options.setDefaultsOnInsert) { - schema.eachPath(function(path, schemaType) { - if (path === '_id') { - // Ignore _id for now because it causes bugs in 2.4 - return; - } - var def = schemaType.getDefault(null, true); - if (!modified[path] && typeof def !== 'undefined') { - castedDoc.$setOnInsert = castedDoc.$setOnInsert || {}; - castedDoc.$setOnInsert[path] = def; - updatedValues[path] = def; - } - }); - } - } - - var updates = Object.keys(updatedValues); - var numUpdates = updates.length; - var validatorsToExecute = []; - var validationErrors = []; - for (i = 0; i < numUpdates; ++i) { - (function(i) { - if (schema.path(updates[i])) { - validatorsToExecute.push(function(callback) { - schema.path(updates[i]).doValidate( - updatedValues[updates[i]], - function(err) { - if (err) { - validationErrors.push(err); - } - callback(null); - }, - null); - }); - } - })(i); - } - - return function(callback) { - async.parallel(validatorsToExecute, function() { - if (validationErrors.length) { - var err = new ValidationError(null); - for (var i = 0; i < validationErrors.length; ++i) { - err.errors[validationErrors[i].path] = validationErrors[i]; - } - return callback(err); - } - callback(null); - }); - }; -}; - -function modifiedPaths(update, path, result) { - var keys = Object.keys(update); - var numKeys = keys.length; - result = result || {}; - path = path ? path + '.' : ''; - - for (var i = 0; i < numKeys; ++i) { - var key = keys[i]; - var val = update[key]; - - result[path + key] = true; - - if (shouldFlatten(val)) { - modifiedPaths(val, path + key, result); - } - } - - return result; -} - -function flatten(update, path) { - var keys = Object.keys(update); - var numKeys = keys.length; - var result = {}; - path = path ? path + '.' : ''; - - for (var i = 0; i < numKeys; ++i) { - var key = keys[i]; - var val = update[key]; - if (shouldFlatten(val)) { - var flat = flatten(val, path + key); - for (var k in flat) { - result[k] = flat[k]; - } - } else { - result[path + key] = val; - } - } - - return result; -} - -function shouldFlatten(val) { - return val && - typeof val === 'object' && - !(val instanceof Date) && - !(val instanceof ObjectId); -} diff --git a/Associations/node_modules/mongoose/lib/statemachine.js b/Associations/node_modules/mongoose/lib/statemachine.js deleted file mode 100644 index a3385402..00000000 --- a/Associations/node_modules/mongoose/lib/statemachine.js +++ /dev/null @@ -1,178 +0,0 @@ - -/*! - * Module dependencies. - */ - -var utils = require('./utils'); - -/*! - * StateMachine represents a minimal `interface` for the - * constructors it builds via StateMachine.ctor(...). - * - * @api private - */ - -var StateMachine = module.exports = exports = function StateMachine() { -}; - -/*! - * StateMachine.ctor('state1', 'state2', ...) - * A factory method for subclassing StateMachine. - * The arguments are a list of states. For each state, - * the constructor's prototype gets state transition - * methods named after each state. These transition methods - * place their path argument into the given state. - * - * @param {String} state - * @param {String} [state] - * @return {Function} subclass constructor - * @private - */ - -StateMachine.ctor = function() { - var states = utils.args(arguments); - - var ctor = function() { - StateMachine.apply(this, arguments); - this.paths = {}; - this.states = {}; - this.stateNames = states; - - var i = states.length - , state; - - while (i--) { - state = states[i]; - this.states[state] = {}; - } - }; - - ctor.prototype = new StateMachine(); - - states.forEach(function(state) { - // Changes the `path`'s state to `state`. - ctor.prototype[state] = function(path) { - this._changeState(path, state); - }; - }); - - return ctor; -}; - -/*! - * This function is wrapped by the state change functions: - * - * - `require(path)` - * - `modify(path)` - * - `init(path)` - * - * @api private - */ - -StateMachine.prototype._changeState = function _changeState(path, nextState) { - var prevBucket = this.states[this.paths[path]]; - if (prevBucket) delete prevBucket[path]; - - this.paths[path] = nextState; - this.states[nextState][path] = true; -}; - -/*! - * ignore - */ - -StateMachine.prototype.clear = function clear(state) { - var keys = Object.keys(this.states[state]) - , i = keys.length - , path; - - while (i--) { - path = keys[i]; - delete this.states[state][path]; - delete this.paths[path]; - } -}; - -/*! - * Checks to see if at least one path is in the states passed in via `arguments` - * e.g., this.some('required', 'inited') - * - * @param {String} state that we want to check for. - * @private - */ - -StateMachine.prototype.some = function some() { - var self = this; - var what = arguments.length ? arguments : this.stateNames; - return Array.prototype.some.call(what, function(state) { - return Object.keys(self.states[state]).length; - }); -}; - -/*! - * This function builds the functions that get assigned to `forEach` and `map`, - * since both of those methods share a lot of the same logic. - * - * @param {String} iterMethod is either 'forEach' or 'map' - * @return {Function} - * @api private - */ - -StateMachine.prototype._iter = function _iter(iterMethod) { - return function() { - var numArgs = arguments.length - , states = utils.args(arguments, 0, numArgs - 1) - , callback = arguments[numArgs - 1]; - - if (!states.length) states = this.stateNames; - - var self = this; - - var paths = states.reduce(function(paths, state) { - return paths.concat(Object.keys(self.states[state])); - }, []); - - return paths[iterMethod](function(path, i, paths) { - return callback(path, i, paths); - }); - }; -}; - -/*! - * Iterates over the paths that belong to one of the parameter states. - * - * The function profile can look like: - * this.forEach(state1, fn); // iterates over all paths in state1 - * this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2 - * this.forEach(fn); // iterates over all paths in all states - * - * @param {String} [state] - * @param {String} [state] - * @param {Function} callback - * @private - */ - -StateMachine.prototype.forEach = function forEach() { - this.forEach = this._iter('forEach'); - return this.forEach.apply(this, arguments); -}; - -/*! - * Maps over the paths that belong to one of the parameter states. - * - * The function profile can look like: - * this.forEach(state1, fn); // iterates over all paths in state1 - * this.forEach(state1, state2, fn); // iterates over all paths in state1 or state2 - * this.forEach(fn); // iterates over all paths in all states - * - * @param {String} [state] - * @param {String} [state] - * @param {Function} callback - * @return {Array} - * @private - */ - -StateMachine.prototype.map = function map() { - this.map = this._iter('map'); - return this.map.apply(this, arguments); -}; diff --git a/Associations/node_modules/mongoose/lib/types/array.js b/Associations/node_modules/mongoose/lib/types/array.js deleted file mode 100644 index bcf73b76..00000000 --- a/Associations/node_modules/mongoose/lib/types/array.js +++ /dev/null @@ -1,762 +0,0 @@ -/*! - * Module dependencies. - */ - -var EmbeddedDocument = require('./embedded'); -var Document = require('../document'); -var ObjectId = require('./objectid'); -var utils = require('../utils'); -var isMongooseObject = utils.isMongooseObject; - -/** - * Mongoose Array constructor. - * - * ####NOTE: - * - * _Values always have to be passed to the constructor to initialize, otherwise `MongooseArray#push` will mark the array as modified._ - * - * @param {Array} values - * @param {String} path - * @param {Document} doc parent document - * @api private - * @inherits Array - * @see http://bit.ly/f6CnZU - */ - -function MongooseArray(values, path, doc) { - var arr = [].concat(values); - - utils.decorate( arr, MongooseArray.mixin ); - arr.isMongooseArray = true; - - var _options = { enumerable: false, configurable: true, writable: true }; - var keys = Object.keys(MongooseArray.mixin). - concat(['isMongooseArray', 'validators', '_path']); - for (var i = 0; i < keys.length; ++i) { - Object.defineProperty(arr, keys[i], _options); - }; - - arr._atomics = {}; - arr.validators = []; - arr._path = path; - - // Because doc comes from the context of another function, doc === global - // can happen if there was a null somewhere up the chain (see #3020) - // RB Jun 17, 2015 updated to check for presence of expected paths instead - // to make more proof against unusual node environments - if (doc && doc instanceof Document) { - arr._parent = doc; - arr._schema = doc.schema.path(path); - } - - return arr; -} - -MongooseArray.mixin = { - - /** - * Stores a queue of atomic operations to perform - * - * @property _atomics - * @api private - */ - - _atomics: undefined, - - /** - * Parent owner document - * - * @property _parent - * @api private - * @receiver MongooseArray - */ - - _parent: undefined, - - /** - * Casts a member based on this arrays schema. - * - * @param {any} value - * @return value the casted value - * @method _cast - * @api private - * @receiver MongooseArray - */ - - _cast: function(value) { - var owner = this._owner; - var populated = false; - var Model; - - if (this._parent) { - // if a populated array, we must cast to the same model - // instance as specified in the original query. - if (!owner) { - owner = this._owner = this._parent.ownerDocument - ? this._parent.ownerDocument() - : this._parent; - } - - populated = owner.populated(this._path, true); - } - - if (populated && null != value) { - // cast to the populated Models schema - Model = populated.options.model; - - // only objects are permitted so we can safely assume that - // non-objects are to be interpreted as _id - if (Buffer.isBuffer(value) || - value instanceof ObjectId || !utils.isObject(value)) { - value = { _id: value }; - } - - // gh-2399 - // we should cast model only when it's not a discriminator - var isDisc = value.schema && value.schema.discriminatorMapping && - value.schema.discriminatorMapping.key !== undefined; - if (!isDisc) { - value = new Model(value); - } - return this._schema.caster.cast(value, this._parent, true); - } - - return this._schema.caster.cast(value, this._parent, false); - }, - - /** - * Marks this array as modified. - * - * If it bubbles up from an embedded document change, then it takes the following arguments (otherwise, takes 0 arguments) - * - * @param {EmbeddedDocument} embeddedDoc the embedded doc that invoked this method on the Array - * @param {String} embeddedPath the path which changed in the embeddedDoc - * @method _markModified - * @api private - * @receiver MongooseArray - */ - - _markModified: function(elem, embeddedPath) { - var parent = this._parent - , dirtyPath; - - if (parent) { - dirtyPath = this._path; - - if (arguments.length) { - if (null != embeddedPath) { - // an embedded doc bubbled up the change - dirtyPath = dirtyPath + '.' + this.indexOf(elem) + '.' + embeddedPath; - } else { - // directly set an index - dirtyPath = dirtyPath + '.' + elem; - } - } - - parent.markModified(dirtyPath); - } - - return this; - }, - - /** - * Register an atomic operation with the parent. - * - * @param {Array} op operation - * @param {any} val - * @method _registerAtomic - * @api private - * @receiver MongooseArray - */ - - _registerAtomic: function(op, val) { - if ('$set' == op) { - // $set takes precedence over all other ops. - // mark entire array modified. - this._atomics = { $set: val }; - return this; - } - - var atomics = this._atomics; - - // reset pop/shift after save - if ('$pop' == op && !('$pop' in atomics)) { - var self = this; - this._parent.once('save', function() { - self._popped = self._shifted = null; - }); - } - - // check for impossible $atomic combos (Mongo denies more than one - // $atomic op on a single path - if (this._atomics.$set || - Object.keys(atomics).length && !(op in atomics)) { - // a different op was previously registered. - // save the entire thing. - this._atomics = { $set: this }; - return this; - } - - var selector; - - if (op === '$pullAll' || op === '$pushAll' || op === '$addToSet') { - atomics[op] || (atomics[op] = []); - atomics[op] = atomics[op].concat(val); - } else if (op === '$pullDocs') { - var pullOp = atomics['$pull'] || (atomics['$pull'] = {}); - if (val[0] instanceof EmbeddedDocument) { - selector = pullOp['$or'] || (pullOp['$or'] = []); - Array.prototype.push.apply(selector, val.map(function(v) { - return v.toObject({ virtuals: false }); - })); - } else { - selector = pullOp['_id'] || (pullOp['_id'] = {'$in' : [] }); - selector['$in'] = selector['$in'].concat(val); - } - } else { - atomics[op] = val; - } - - return this; - }, - - /** - * Depopulates stored atomic operation values as necessary for direct insertion to MongoDB. - * - * If no atomics exist, we return all array values after conversion. - * - * @return {Array} - * @method $__getAtomics - * @memberOf MongooseArray - * @api private - */ - - $__getAtomics: function() { - var ret = []; - var keys = Object.keys(this._atomics); - var i = keys.length; - - if (0 === i) { - ret[0] = ['$set', this.toObject({ depopulate: 1, transform: false })]; - return ret; - } - - while (i--) { - var op = keys[i]; - var val = this._atomics[op]; - - // the atomic values which are arrays are not MongooseArrays. we - // need to convert their elements as if they were MongooseArrays - // to handle populated arrays versus DocumentArrays properly. - if (isMongooseObject(val)) { - val = val.toObject({ depopulate: 1, transform: false }); - } else if (Array.isArray(val)) { - val = this.toObject.call(val, { depopulate: 1, transform: false }); - } else if (val.valueOf) { - val = val.valueOf(); - } - - if ('$addToSet' == op) { - val = { $each: val }; - } - - ret.push([op, val]); - } - - return ret; - }, - - /** - * Returns the number of pending atomic operations to send to the db for this array. - * - * @api private - * @return {Number} - * @method hasAtomics - * @receiver MongooseArray - */ - - hasAtomics: function hasAtomics() { - if (!(this._atomics && 'Object' === this._atomics.constructor.name)) { - return 0; - } - - return Object.keys(this._atomics).length; - }, - - /** - * Internal helper for .map() - * - * @api private - * @return {Number} - * @method _mapCast - * @receiver MongooseArray - */ - _mapCast: function(val, index) { - return this._cast(val, this.length + index); - }, - - /** - * Wraps [`Array#push`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/push) with proper change tracking. - * - * @param {Object} [args...] - * @api public - * @method push - * @receiver MongooseArray - */ - - push: function() { - var values = [].map.call(arguments, this._mapCast, this); - values = this._schema.applySetters(values, this._parent); - var ret = [].push.apply(this, values); - - // $pushAll might be fibbed (could be $push). But it makes it easier to - // handle what could have been $push, $pushAll combos - this._registerAtomic('$pushAll', values); - this._markModified(); - return ret; - }, - - /** - * Pushes items to the array non-atomically. - * - * ####NOTE: - * - * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._ - * - * @param {any} [args...] - * @api public - * @method nonAtomicPush - * @receiver MongooseArray - */ - - nonAtomicPush: function() { - var values = [].map.call(arguments, this._mapCast, this); - var ret = [].push.apply(this, values); - this._registerAtomic('$set', this); - this._markModified(); - return ret; - }, - - /** - * Pops the array atomically at most one time per document `save()`. - * - * #### NOTE: - * - * _Calling this mulitple times on an array before saving sends the same command as calling it once._ - * _This update is implemented using the MongoDB [$pop](http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop) method which enforces this restriction._ - * - * doc.array = [1,2,3]; - * - * var popped = doc.array.$pop(); - * console.log(popped); // 3 - * console.log(doc.array); // [1,2] - * - * // no affect - * popped = doc.array.$pop(); - * console.log(doc.array); // [1,2] - * - * doc.save(function (err) { - * if (err) return handleError(err); - * - * // we saved, now $pop works again - * popped = doc.array.$pop(); - * console.log(popped); // 2 - * console.log(doc.array); // [1] - * }) - * - * @api public - * @method $pop - * @memberOf MongooseArray - * @see mongodb http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop - * @method $pop - * @receiver MongooseArray - */ - - $pop: function() { - this._registerAtomic('$pop', 1); - this._markModified(); - - // only allow popping once - if (this._popped) return; - this._popped = true; - - return [].pop.call(this); - }, - - /** - * Wraps [`Array#pop`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/pop) with proper change tracking. - * - * ####Note: - * - * _marks the entire array as modified which will pass the entire thing to $set potentially overwritting any changes that happen between when you retrieved the object and when you save it._ - * - * @see MongooseArray#$pop #types_array_MongooseArray-%24pop - * @api public - * @method pop - * @receiver MongooseArray - */ - - pop: function() { - var ret = [].pop.call(this); - this._registerAtomic('$set', this); - this._markModified(); - return ret; - }, - - /** - * Atomically shifts the array at most one time per document `save()`. - * - * ####NOTE: - * - * _Calling this mulitple times on an array before saving sends the same command as calling it once._ - * _This update is implemented using the MongoDB [$pop](http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop) method which enforces this restriction._ - * - * doc.array = [1,2,3]; - * - * var shifted = doc.array.$shift(); - * console.log(shifted); // 1 - * console.log(doc.array); // [2,3] - * - * // no affect - * shifted = doc.array.$shift(); - * console.log(doc.array); // [2,3] - * - * doc.save(function (err) { - * if (err) return handleError(err); - * - * // we saved, now $shift works again - * shifted = doc.array.$shift(); - * console.log(shifted ); // 2 - * console.log(doc.array); // [3] - * }) - * - * @api public - * @memberOf MongooseArray - * @method $shift - * @see mongodb http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pop - */ - - $shift: function $shift() { - this._registerAtomic('$pop', -1); - this._markModified(); - - // only allow shifting once - if (this._shifted) return; - this._shifted = true; - - return [].shift.call(this); - }, - - /** - * Wraps [`Array#shift`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/unshift) with proper change tracking. - * - * ####Example: - * - * doc.array = [2,3]; - * var res = doc.array.shift(); - * console.log(res) // 2 - * console.log(doc.array) // [3] - * - * ####Note: - * - * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._ - * - * @api public - * @method shift - * @receiver MongooseArray - */ - - shift: function() { - var ret = [].shift.call(this); - this._registerAtomic('$set', this); - this._markModified(); - return ret; - }, - - /** - * Pulls items from the array atomically. Equality is determined by casting - * the provided value to an embedded document and comparing using - * [the `Document.equals()` function.](./api.html#document_Document-equals) - * - * ####Examples: - * - * doc.array.pull(ObjectId) - * doc.array.pull({ _id: 'someId' }) - * doc.array.pull(36) - * doc.array.pull('tag 1', 'tag 2') - * - * To remove a document from a subdocument array we may pass an object with a matching `_id`. - * - * doc.subdocs.push({ _id: 4815162342 }) - * doc.subdocs.pull({ _id: 4815162342 }) // removed - * - * Or we may passing the _id directly and let mongoose take care of it. - * - * doc.subdocs.push({ _id: 4815162342 }) - * doc.subdocs.pull(4815162342); // works - * - * @param {any} [args...] - * @see mongodb http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pull - * @api public - * @method pull - * @receiver MongooseArray - */ - - pull: function() { - var values = [].map.call(arguments, this._cast, this) - , cur = this._parent.get(this._path) - , i = cur.length - , mem; - - while (i--) { - mem = cur[i]; - if (mem instanceof EmbeddedDocument) { - if (values.some(function(v) { return v.equals(mem); } )) { - [].splice.call(cur, i, 1); - } - } else if (~cur.indexOf.call(values, mem)) { - [].splice.call(cur, i, 1); - } - } - - if (values[0] instanceof EmbeddedDocument) { - this._registerAtomic('$pullDocs', values.map(function(v) { - return v._id || v; - })); - } else { - this._registerAtomic('$pullAll', values); - } - - this._markModified(); - return this; - }, - - /** - * Wraps [`Array#splice`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/splice) with proper change tracking and casting. - * - * ####Note: - * - * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._ - * - * @api public - * @method splice - * @receiver MongooseArray - */ - - splice: function splice() { - var ret, vals, i; - - if (arguments.length) { - vals = []; - for (i = 0; i < arguments.length; ++i) { - vals[i] = i < 2 - ? arguments[i] - : this._cast(arguments[i], arguments[0] + (i - 2)); - } - ret = [].splice.apply(this, vals); - this._registerAtomic('$set', this); - this._markModified(); - } - - return ret; - }, - - /** - * Wraps [`Array#unshift`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/unshift) with proper change tracking. - * - * ####Note: - * - * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._ - * - * @api public - * @method unshift - * @receiver MongooseArray - */ - - unshift: function() { - var values = [].map.call(arguments, this._cast, this); - values = this._schema.applySetters(values, this._parent); - [].unshift.apply(this, values); - this._registerAtomic('$set', this); - this._markModified(); - return this.length; - }, - - /** - * Wraps [`Array#sort`](https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/sort) with proper change tracking. - * - * ####NOTE: - * - * _marks the entire array as modified, which if saved, will store it as a `$set` operation, potentially overwritting any changes that happen between when you retrieved the object and when you save it._ - * - * @api public - * @method sort - * @receiver MongooseArray - */ - - sort: function() { - var ret = [].sort.apply(this, arguments); - this._registerAtomic('$set', this); - this._markModified(); - return ret; - }, - - /** - * Adds values to the array if not already present. - * - * ####Example: - * - * console.log(doc.array) // [2,3,4] - * var added = doc.array.addToSet(4,5); - * console.log(doc.array) // [2,3,4,5] - * console.log(added) // [5] - * - * @param {any} [args...] - * @return {Array} the values that were added - * @receiver MongooseArray - * @api public - * @method addToSet - */ - - addToSet: function addToSet() { - var values = [].map.call(arguments, this._mapCast, this); - values = this._schema.applySetters(values, this._parent); - var added = []; - var type = values[0] instanceof EmbeddedDocument ? 'doc' : - values[0] instanceof Date ? 'date' : - ''; - - values.forEach(function(v) { - var found; - switch (type) { - case 'doc': - found = this.some(function(doc) { return doc.equals(v); }); - break; - case 'date': - var val = +v; - found = this.some(function(d) { return +d === val; }); - break; - default: - found = ~this.indexOf(v); - } - - if (!found) { - [].push.call(this, v); - this._registerAtomic('$addToSet', v); - this._markModified(); - [].push.call(added, v); - } - }, this); - - return added; - }, - - /** - * Sets the casted `val` at index `i` and marks the array modified. - * - * ####Example: - * - * // given documents based on the following - * var Doc = mongoose.model('Doc', new Schema({ array: [Number] })); - * - * var doc = new Doc({ array: [2,3,4] }) - * - * console.log(doc.array) // [2,3,4] - * - * doc.array.set(1,"5"); - * console.log(doc.array); // [2,5,4] // properly cast to number - * doc.save() // the change is saved - * - * // VS not using array#set - * doc.array[1] = "5"; - * console.log(doc.array); // [2,"5",4] // no casting - * doc.save() // change is not saved - * - * @return {Array} this - * @api public - * @method set - * @receiver MongooseArray - */ - - set: function set(i, val) { - var value = this._cast(val, i); - value = this._schema.caster instanceof EmbeddedDocument ? - value : - this._schema.caster.applySetters(val, this._parent) - ; - this[i] = value; - this._markModified(i); - return this; - }, - - /** - * Returns a native js Array. - * - * @param {Object} options - * @return {Array} - * @api public - * @method toObject - * @receiver MongooseArray - */ - - toObject: function(options) { - if (options && options.depopulate) { - return this.map(function(doc) { - return doc instanceof Document - ? doc.toObject(options) - : doc; - }); - } - - return this.slice(); - }, - - /** - * Helper for console.log - * - * @api public - * @method inspect - * @receiver MongooseArray - */ - - inspect: function() { - return JSON.stringify(this); - }, - - /** - * Return the index of `obj` or `-1` if not found. - * - * @param {Object} obj the item to look for - * @return {Number} - * @api public - * @method indexOf - * @receiver MongooseArray - */ - - indexOf: function indexOf(obj) { - if (obj instanceof ObjectId) obj = obj.toString(); - for (var i = 0, len = this.length; i < len; ++i) { - if (obj == this[i]) - return i; - } - return -1; - } -}; - -/** - * Alias of [pull](#types_array_MongooseArray-pull) - * - * @see MongooseArray#pull #types_array_MongooseArray-pull - * @see mongodb http://www.mongodb.org/display/DOCS/Updating/#Updating-%24pull - * @api public - * @memberOf MongooseArray - * @method remove - */ - -MongooseArray.mixin.remove = MongooseArray.mixin.pull; - -/*! - * Module exports. - */ - -module.exports = exports = MongooseArray; diff --git a/Associations/node_modules/mongoose/lib/types/buffer.js b/Associations/node_modules/mongoose/lib/types/buffer.js deleted file mode 100644 index 0357c821..00000000 --- a/Associations/node_modules/mongoose/lib/types/buffer.js +++ /dev/null @@ -1,269 +0,0 @@ -/*! - * Module dependencies. - */ - -var Binary = require('../drivers').Binary - , utils = require('../utils'); - -/** - * Mongoose Buffer constructor. - * - * Values always have to be passed to the constructor to initialize. - * - * @param {Buffer} value - * @param {String} encode - * @param {Number} offset - * @api private - * @inherits Buffer - * @see http://bit.ly/f6CnZU - */ - -function MongooseBuffer(value, encode, offset) { - var length = arguments.length; - var val; - - if (0 === length || null === arguments[0] || undefined === arguments[0]) { - val = 0; - } else { - val = value; - } - - var encoding; - var path; - var doc; - - if (Array.isArray(encode)) { - // internal casting - path = encode[0]; - doc = encode[1]; - } else { - encoding = encode; - } - - var buf = new Buffer(val, encoding, offset); - utils.decorate( buf, MongooseBuffer.mixin ); - buf.isMongooseBuffer = true; - - // make sure these internal props don't show up in Object.keys() - Object.defineProperties(buf, { - validators: { value: [] } - , _path: { value: path } - , _parent: { value: doc } - }); - - if (doc && "string" === typeof path) { - Object.defineProperty(buf, '_schema', { - value: doc.schema.path(path) - }); - } - - buf._subtype = 0; - return buf; -} - -/*! - * Inherit from Buffer. - */ - -//MongooseBuffer.prototype = new Buffer(0); - -MongooseBuffer.mixin = { - - /** - * Parent owner document - * - * @api private - * @property _parent - * @receiver MongooseBuffer - */ - - _parent: undefined, - - /** - * Default subtype for the Binary representing this Buffer - * - * @api private - * @property _subtype - * @receiver MongooseBuffer - */ - - _subtype: undefined, - - /** - * Marks this buffer as modified. - * - * @api private - * @method _markModified - * @receiver MongooseBuffer - */ - - _markModified: function() { - var parent = this._parent; - - if (parent) { - parent.markModified(this._path); - } - return this; - }, - - /** - * Writes the buffer. - * - * @api public - * @method write - * @receiver MongooseBuffer - */ - - write: function() { - var written = Buffer.prototype.write.apply(this, arguments); - - if (written > 0) { - this._markModified(); - } - - return written; - }, - - /** - * Copies the buffer. - * - * ####Note: - * - * `Buffer#copy` does not mark `target` as modified so you must copy from a `MongooseBuffer` for it to work as expected. This is a work around since `copy` modifies the target, not this. - * - * @return {MongooseBuffer} - * @param {Buffer} target - * @method copy - * @receiver MongooseBuffer - */ - - copy: function(target) { - var ret = Buffer.prototype.copy.apply(this, arguments); - - if (target && target.isMongooseBuffer) { - target._markModified(); - } - - return ret; - } -}; - -/*! - * Compile other Buffer methods marking this buffer as modified. - */ - -( -// node < 0.5 -'writeUInt8 writeUInt16 writeUInt32 writeInt8 writeInt16 writeInt32 ' + -'writeFloat writeDouble fill ' + -'utf8Write binaryWrite asciiWrite set ' + - -// node >= 0.5 -'writeUInt16LE writeUInt16BE writeUInt32LE writeUInt32BE ' + -'writeInt16LE writeInt16BE writeInt32LE writeInt32BE ' + -'writeFloatLE writeFloatBE writeDoubleLE writeDoubleBE' -).split(' ').forEach(function(method) { - if (!Buffer.prototype[method]) return; - MongooseBuffer.mixin[method] = new Function( - 'var ret = Buffer.prototype.' + method + '.apply(this, arguments);' + - 'this._markModified();' + - 'return ret;' - ); -}); - -/** - * Converts this buffer to its Binary type representation. - * - * ####SubTypes: - * - * var bson = require('bson') - * bson.BSON_BINARY_SUBTYPE_DEFAULT - * bson.BSON_BINARY_SUBTYPE_FUNCTION - * bson.BSON_BINARY_SUBTYPE_BYTE_ARRAY - * bson.BSON_BINARY_SUBTYPE_UUID - * bson.BSON_BINARY_SUBTYPE_MD5 - * bson.BSON_BINARY_SUBTYPE_USER_DEFINED - * - * doc.buffer.toObject(bson.BSON_BINARY_SUBTYPE_USER_DEFINED); - * - * @see http://bsonspec.org/#/specification - * @param {Hex} [subtype] - * @return {Binary} - * @api public - * @method toObject - * @receiver MongooseBuffer - */ - -MongooseBuffer.mixin.toObject = function(options) { - var subtype = 'number' == typeof options - ? options - : (this._subtype || 0); - return new Binary(this, subtype); -}; - -/** - * Determines if this buffer is equals to `other` buffer - * - * @param {Buffer} other - * @return {Boolean} - * @method equals - * @receiver MongooseBuffer - */ - -MongooseBuffer.mixin.equals = function(other) { - if (!Buffer.isBuffer(other)) { - return false; - } - - if (this.length !== other.length) { - return false; - } - - for (var i = 0; i < this.length; ++i) { - if (this[i] !== other[i]) return false; - } - - return true; -}; - -/** - * Sets the subtype option and marks the buffer modified. - * - * ####SubTypes: - * - * var bson = require('bson') - * bson.BSON_BINARY_SUBTYPE_DEFAULT - * bson.BSON_BINARY_SUBTYPE_FUNCTION - * bson.BSON_BINARY_SUBTYPE_BYTE_ARRAY - * bson.BSON_BINARY_SUBTYPE_UUID - * bson.BSON_BINARY_SUBTYPE_MD5 - * bson.BSON_BINARY_SUBTYPE_USER_DEFINED - * - * doc.buffer.subtype(bson.BSON_BINARY_SUBTYPE_UUID); - * - * @see http://bsonspec.org/#/specification - * @param {Hex} subtype - * @api public - * @method subtype - * @receiver MongooseBuffer - */ - -MongooseBuffer.mixin.subtype = function(subtype) { - if ('number' != typeof subtype) { - throw new TypeError('Invalid subtype. Expected a number'); - } - - if (this._subtype != subtype) { - this._markModified(); - } - - this._subtype = subtype; -}; - -/*! - * Module exports. - */ - -MongooseBuffer.Binary = Binary; - -module.exports = MongooseBuffer; diff --git a/Associations/node_modules/mongoose/lib/types/documentarray.js b/Associations/node_modules/mongoose/lib/types/documentarray.js deleted file mode 100644 index 5be9304e..00000000 --- a/Associations/node_modules/mongoose/lib/types/documentarray.js +++ /dev/null @@ -1,223 +0,0 @@ -/*! - * Module dependencies. - */ - -var MongooseArray = require('./array') - , ObjectId = require('./objectid') - , ObjectIdSchema = require('../schema/objectid') - , utils = require('../utils') - , util = require('util') - , Document = require('../document'); - -/** - * DocumentArray constructor - * - * @param {Array} values - * @param {String} path the path to this array - * @param {Document} doc parent document - * @api private - * @return {MongooseDocumentArray} - * @inherits MongooseArray - * @see http://bit.ly/f6CnZU - */ - -function MongooseDocumentArray(values, path, doc) { - var arr = [].concat(values); - - // Values always have to be passed to the constructor to initialize, since - // otherwise MongooseArray#push will mark the array as modified to the parent. - utils.decorate( arr, MongooseDocumentArray.mixin ); - arr.isMongooseArray = true; - arr.isMongooseDocumentArray = true; - - arr._atomics = {}; - arr.validators = []; - arr._path = path; - - // Because doc comes from the context of another function, doc === global - // can happen if there was a null somewhere up the chain (see #3020 && #3034) - // RB Jun 17, 2015 updated to check for presence of expected paths instead - // to make more proof against unusual node environments - if (doc && doc instanceof Document) { - arr._parent = doc; - arr._schema = doc.schema.path(path); - arr._handlers = { - isNew: arr.notify('isNew'), - save: arr.notify('save') - }; - - doc.on('save', arr._handlers.save); - doc.on('isNew', arr._handlers.isNew); - } - - return arr; -} - -/*! - * Inherits from MongooseArray - */ -MongooseDocumentArray.mixin = Object.create( MongooseArray.mixin ); - -/** - * Overrides MongooseArray#cast - * - * @method _cast - * @api private - * @receiver MongooseDocumentArray - */ - -MongooseDocumentArray.mixin._cast = function(value, index) { - if (value instanceof this._schema.casterConstructor) { - if (!(value.__parent && value.__parentArray)) { - // value may have been created using array.create() - value.__parent = this._parent; - value.__parentArray = this; - } - value.__index = index; - return value; - } - - // handle cast('string') or cast(ObjectId) etc. - // only objects are permitted so we can safely assume that - // non-objects are to be interpreted as _id - if (Buffer.isBuffer(value) || - value instanceof ObjectId || !utils.isObject(value)) { - value = { _id: value }; - } - return new this._schema.casterConstructor(value, this, undefined, undefined, index); -}; - -/** - * Searches array items for the first document with a matching _id. - * - * ####Example: - * - * var embeddedDoc = m.array.id(some_id); - * - * @return {EmbeddedDocument|null} the subdocument or null if not found. - * @param {ObjectId|String|Number|Buffer} id - * @TODO cast to the _id based on schema for proper comparison - * @method id - * @api public - * @receiver MongooseDocumentArray - */ - -MongooseDocumentArray.mixin.id = function(id) { - var casted - , sid - , _id; - - try { - var casted_ = ObjectIdSchema.prototype.cast.call({}, id); - if (casted_) casted = String(casted_); - } catch (e) { - casted = null; - } - - for (var i = 0, l = this.length; i < l; i++) { - _id = this[i].get('_id'); - - if (_id === null || typeof _id === 'undefined') { - continue; - } else if (_id instanceof Document) { - sid || (sid = String(id)); - if (sid == _id._id) return this[i]; - } else if (!(_id instanceof ObjectId)) { - if (utils.deepEqual(id, _id)) return this[i]; - } else if (casted == _id) { - return this[i]; - } - } - - return null; -}; - -/** - * Returns a native js Array of plain js objects - * - * ####NOTE: - * - * _Each sub-document is converted to a plain object by calling its `#toObject` method._ - * - * @param {Object} [options] optional options to pass to each documents `toObject` method call during conversion - * @return {Array} - * @method toObject - * @api public - * @receiver MongooseDocumentArray - */ - -MongooseDocumentArray.mixin.toObject = function(options) { - return this.map(function(doc) { - return doc && doc.toObject(options) || null; - }); -}; - -/** - * Helper for console.log - * - * @method inspect - * @api public - * @receiver MongooseDocumentArray - */ - -MongooseDocumentArray.mixin.inspect = function() { - return '[' + Array.prototype.map.call(this, function(doc) { - if (doc) { - return doc.inspect - ? doc.inspect() - : util.inspect(doc); - } - return 'null'; - }).join('\n') + ']'; -}; - -/** - * Creates a subdocument casted to this schema. - * - * This is the same subdocument constructor used for casting. - * - * @param {Object} obj the value to cast to this arrays SubDocument schema - * @method create - * @api public - * @receiver MongooseDocumentArray - */ - -MongooseDocumentArray.mixin.create = function(obj) { - return new this._schema.casterConstructor(obj); -}; - -/** - * Creates a fn that notifies all child docs of `event`. - * - * @param {String} event - * @return {Function} - * @method notify - * @api private - * @receiver MongooseDocumentArray - */ - -MongooseDocumentArray.mixin.notify = function notify(event) { - var self = this; - return function notify(val) { - var i = self.length; - while (i--) { - if (!self[i]) continue; - switch (event) { - // only swap for save event for now, we may change this to all event types later - case 'save': - val = self[i]; - break; - default: - // NO-OP - break; - } - self[i].emit(event, val); - } - }; -}; - -/*! - * Module exports. - */ - -module.exports = MongooseDocumentArray; diff --git a/Associations/node_modules/mongoose/lib/types/embedded.js b/Associations/node_modules/mongoose/lib/types/embedded.js deleted file mode 100644 index 2cac9992..00000000 --- a/Associations/node_modules/mongoose/lib/types/embedded.js +++ /dev/null @@ -1,311 +0,0 @@ -/* eslint no-func-assign: 1 */ - -/*! - * Module dependencies. - */ - -var Document = require('../document_provider')(); -var inspect = require('util').inspect; -var Promise = require('../promise'); - -/** - * EmbeddedDocument constructor. - * - * @param {Object} obj js object returned from the db - * @param {MongooseDocumentArray} parentArr the parent array of this document - * @param {Boolean} skipId - * @inherits Document - * @api private - */ - -function EmbeddedDocument(obj, parentArr, skipId, fields, index) { - if (parentArr) { - this.__parentArray = parentArr; - this.__parent = parentArr._parent; - } else { - this.__parentArray = undefined; - this.__parent = undefined; - } - this.__index = index; - - Document.call(this, obj, fields, skipId); - - var self = this; - this.on('isNew', function(val) { - self.isNew = val; - }); -} - -/*! - * Inherit from Document - */ -EmbeddedDocument.prototype = Object.create( Document.prototype ); -EmbeddedDocument.prototype.constructor = EmbeddedDocument; - -/** - * Marks the embedded doc modified. - * - * ####Example: - * - * var doc = blogpost.comments.id(hexstring); - * doc.mixed.type = 'changed'; - * doc.markModified('mixed.type'); - * - * @param {String} path the path which changed - * @api public - * @receiver EmbeddedDocument - */ - -EmbeddedDocument.prototype.markModified = function(path) { - if (!this.__parentArray) return; - - this.$__.activePaths.modify(path); - if (this.isNew) { - // Mark the WHOLE parent array as modified - // if this is a new document (i.e., we are initializing - // a document), - this.__parentArray._markModified(); - } else { - this.__parentArray._markModified(this, path); - } -}; - -/** - * Used as a stub for [hooks.js](https://github.com/bnoguchi/hooks-js/tree/31ec571cef0332e21121ee7157e0cf9728572cc3) - * - * ####NOTE: - * - * _This is a no-op. Does not actually save the doc to the db._ - * - * @param {Function} [fn] - * @return {Promise} resolved Promise - * @api private - */ - -EmbeddedDocument.prototype.save = function(fn) { - return new Promise.ES6(function(resolve) { - fn && fn(); - resolve(); - }); -}; - -/** - * Removes the subdocument from its parent array. - * - * @param {Function} [fn] - * @api public - */ - -EmbeddedDocument.prototype.remove = function(fn) { - if (!this.__parentArray) return this; - - var _id; - if (!this.willRemove) { - _id = this._doc._id; - if (!_id) { - throw new Error('For your own good, Mongoose does not know ' + - 'how to remove an EmbeddedDocument that has no _id'); - } - this.__parentArray.pull({ _id: _id }); - this.willRemove = true; - registerRemoveListener(this); - } - - if (fn) - fn(null); - - return this; -}; - -/*! - * Registers remove event listeners for triggering - * on subdocuments. - * - * @param {EmbeddedDocument} sub - * @api private - */ - -function registerRemoveListener(sub) { - var owner = sub.ownerDocument(); - - owner.on('save', emitRemove); - owner.on('remove', emitRemove); - - function emitRemove() { - owner.removeListener('save', emitRemove); - owner.removeListener('remove', emitRemove); - sub.emit('remove', sub); - owner = sub = emitRemove = null; - } -} - -/** - * Override #update method of parent documents. - * @api private - */ - -EmbeddedDocument.prototype.update = function() { - throw new Error('The #update method is not available on EmbeddedDocuments'); -}; - -/** - * Helper for console.log - * - * @api public - */ - -EmbeddedDocument.prototype.inspect = function() { - return inspect(this.toObject()); -}; - -/** - * Marks a path as invalid, causing validation to fail. - * - * @param {String} path the field to invalidate - * @param {String|Error} err error which states the reason `path` was invalid - * @return {Boolean} - * @api public - */ - -EmbeddedDocument.prototype.invalidate = function(path, err, val, first) { - if (!this.__parent) { - var msg = 'Unable to invalidate a subdocument that has not been added to an array.'; - throw new Error(msg); - } - - var index = this.__index; - if (typeof index !== 'undefined') { - var parentPath = this.__parentArray._path; - var fullPath = [parentPath, index, path].join('.'); - this.__parent.invalidate(fullPath, err, val); - } - - if (first) { - this.$__.validationError = this.ownerDocument().$__.validationError; - } - - return true; -}; - -/** - * Marks a path as valid, removing existing validation errors. - * - * @param {String} path the field to mark as valid - * @api private - * @method $markValid - * @receiver EmbeddedDocument - */ - -EmbeddedDocument.prototype.$markValid = function(path) { - if (!this.__parent) { - return; - } - - var index = this.__index; - if (typeof index !== 'undefined') { - var parentPath = this.__parentArray._path; - var fullPath = [parentPath, index, path].join('.'); - this.__parent.$markValid(fullPath); - } -}; - -/** - * Checks if a path is invalid - * - * @param {String} path the field to check - * @api private - * @method $isValid - * @receiver EmbeddedDocument - */ - -EmbeddedDocument.prototype.$isValid = function(path) { - var index = this.__index; - if (typeof index !== 'undefined') { - - return !this.__parent.$__.validationError || - !this.__parent.$__.validationError.errors[path]; - } - - return true; -}; - -/** - * Returns the top level document of this sub-document. - * - * @return {Document} - */ - -EmbeddedDocument.prototype.ownerDocument = function() { - if (this.$__.ownerDocument) { - return this.$__.ownerDocument; - } - - var parent = this.__parent; - if (!parent) return this; - - while (parent.__parent) { - parent = parent.__parent; - } - - return this.$__.ownerDocument = parent; -}; - -/** - * Returns the full path to this document. If optional `path` is passed, it is appended to the full path. - * - * @param {String} [path] - * @return {String} - * @api private - * @method $__fullPath - * @memberOf EmbeddedDocument - */ - -EmbeddedDocument.prototype.$__fullPath = function(path) { - if (!this.$__.fullPath) { - var parent = this; - if (!parent.__parent) return path; - - var paths = []; - while (parent.__parent) { - paths.unshift(parent.__parentArray._path); - parent = parent.__parent; - } - - this.$__.fullPath = paths.join('.'); - - if (!this.$__.ownerDocument) { - // optimization - this.$__.ownerDocument = parent; - } - } - - return path - ? this.$__.fullPath + '.' + path - : this.$__.fullPath; -}; - -/** - * Returns this sub-documents parent document. - * - * @api public - */ - -EmbeddedDocument.prototype.parent = function() { - return this.__parent; -}; - -/** - * Returns this sub-documents parent array. - * - * @api public - */ - -EmbeddedDocument.prototype.parentArray = function() { - return this.__parentArray; -}; - -/*! - * Module exports. - */ - -module.exports = EmbeddedDocument; diff --git a/Associations/node_modules/mongoose/lib/types/index.js b/Associations/node_modules/mongoose/lib/types/index.js deleted file mode 100644 index e6a9901e..00000000 --- a/Associations/node_modules/mongoose/lib/types/index.js +++ /dev/null @@ -1,13 +0,0 @@ - -/*! - * Module exports. - */ - -exports.Array = require('./array'); -exports.Buffer = require('./buffer'); - -exports.Document = // @deprecate -exports.Embedded = require('./embedded'); - -exports.DocumentArray = require('./documentarray'); -exports.ObjectId = require('./objectid'); diff --git a/Associations/node_modules/mongoose/lib/types/objectid.js b/Associations/node_modules/mongoose/lib/types/objectid.js deleted file mode 100644 index 9fe0b97a..00000000 --- a/Associations/node_modules/mongoose/lib/types/objectid.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * ObjectId type constructor - * - * ####Example - * - * var id = new mongoose.Types.ObjectId; - * - * @constructor ObjectId - */ - -var ObjectId = require('../drivers').ObjectId; - -module.exports = ObjectId; diff --git a/Associations/node_modules/mongoose/lib/utils.js b/Associations/node_modules/mongoose/lib/utils.js deleted file mode 100644 index e9915948..00000000 --- a/Associations/node_modules/mongoose/lib/utils.js +++ /dev/null @@ -1,794 +0,0 @@ -/*! - * Module dependencies. - */ - -var ObjectId = require('./types/objectid'); -var cloneRegExp = require('regexp-clone'); -var sliced = require('sliced'); -var mpath = require('mpath'); -var ms = require('ms'); -var MongooseBuffer; -var MongooseArray; -var Document; - -/*! - * Produces a collection name from model `name`. - * - * @param {String} name a model name - * @return {String} a collection name - * @api private - */ - -exports.toCollectionName = function(name, options) { - options = options || {}; - if ('system.profile' === name) return name; - if ('system.indexes' === name) return name; - if (options.pluralization === false) return name; - return pluralize(name.toLowerCase()); -}; - -/** - * Pluralization rules. - * - * These rules are applied while processing the argument to `toCollectionName`. - * - * @deprecated remove in 4.x gh-1350 - */ - -exports.pluralization = [ - [/(m)an$/gi, '$1en'], - [/(pe)rson$/gi, '$1ople'], - [/(child)$/gi, '$1ren'], - [/^(ox)$/gi, '$1en'], - [/(ax|test)is$/gi, '$1es'], - [/(octop|vir)us$/gi, '$1i'], - [/(alias|status)$/gi, '$1es'], - [/(bu)s$/gi, '$1ses'], - [/(buffal|tomat|potat)o$/gi, '$1oes'], - [/([ti])um$/gi, '$1a'], - [/sis$/gi, 'ses'], - [/(?:([^f])fe|([lr])f)$/gi, '$1$2ves'], - [/(hive)$/gi, '$1s'], - [/([^aeiouy]|qu)y$/gi, '$1ies'], - [/(x|ch|ss|sh)$/gi, '$1es'], - [/(matr|vert|ind)ix|ex$/gi, '$1ices'], - [/([m|l])ouse$/gi, '$1ice'], - [/(kn|w|l)ife$/gi, '$1ives'], - [/(quiz)$/gi, '$1zes'], - [/s$/gi, 's'], - [/([^a-z])$/, '$1'], - [/$/gi, 's'] -]; -var rules = exports.pluralization; - -/** - * Uncountable words. - * - * These words are applied while processing the argument to `toCollectionName`. - * @api public - */ - -exports.uncountables = [ - 'advice', - 'energy', - 'excretion', - 'digestion', - 'cooperation', - 'health', - 'justice', - 'labour', - 'machinery', - 'equipment', - 'information', - 'pollution', - 'sewage', - 'paper', - 'money', - 'species', - 'series', - 'rain', - 'rice', - 'fish', - 'sheep', - 'moose', - 'deer', - 'news', - 'expertise', - 'status', - 'media' -]; -var uncountables = exports.uncountables; - -/*! - * Pluralize function. - * - * @author TJ Holowaychuk (extracted from _ext.js_) - * @param {String} string to pluralize - * @api private - */ - -function pluralize(str) { - var found; - if (!~uncountables.indexOf(str.toLowerCase())) { - found = rules.filter(function(rule) { - return str.match(rule[0]); - }); - if (found[0]) return str.replace(found[0][0], found[0][1]); - } - return str; -} - -/*! - * Determines if `a` and `b` are deep equal. - * - * Modified from node/lib/assert.js - * - * @param {any} a a value to compare to `b` - * @param {any} b a value to compare to `a` - * @return {Boolean} - * @api private - */ - -exports.deepEqual = function deepEqual(a, b) { - if (a === b) return true; - - if (a instanceof Date && b instanceof Date) - return a.getTime() === b.getTime(); - - if (a instanceof ObjectId && b instanceof ObjectId) { - return a.toString() === b.toString(); - } - - if (a instanceof RegExp && b instanceof RegExp) { - return a.source == b.source && - a.ignoreCase == b.ignoreCase && - a.multiline == b.multiline && - a.global == b.global; - } - - if (typeof a !== 'object' && typeof b !== 'object') - return a == b; - - if (a === null || b === null || a === undefined || b === undefined) - return false; - - if (a.prototype !== b.prototype) return false; - - // Handle MongooseNumbers - if (a instanceof Number && b instanceof Number) { - return a.valueOf() === b.valueOf(); - } - - if (Buffer.isBuffer(a)) { - return exports.buffer.areEqual(a, b); - } - - if (isMongooseObject(a)) a = a.toObject(); - if (isMongooseObject(b)) b = b.toObject(); - - try { - var ka = Object.keys(a), - kb = Object.keys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!deepEqual(a[key], b[key])) return false; - } - - return true; -}; - -/*! - * Object clone with Mongoose natives support. - * - * If options.minimize is true, creates a minimal data object. Empty objects and undefined values will not be cloned. This makes the data payload sent to MongoDB as small as possible. - * - * Functions are never cloned. - * - * @param {Object} obj the object to clone - * @param {Object} options - * @return {Object} the cloned object - * @api private - */ - -exports.clone = function clone(obj, options) { - if (obj === undefined || obj === null) - return obj; - - if (Array.isArray(obj)) - return cloneArray(obj, options); - - if (isMongooseObject(obj)) { - if (options && options.json && 'function' === typeof obj.toJSON) { - return obj.toJSON(options); - } else { - return obj.toObject(options); - } - } - - if (obj.constructor) { - switch (exports.getFunctionName(obj.constructor)) { - case 'Object': - return cloneObject(obj, options); - case 'Date': - return new obj.constructor(+obj); - case 'RegExp': - return cloneRegExp(obj); - default: - // ignore - break; - } - } - - if (obj instanceof ObjectId) - return new ObjectId(obj.id); - - if (!obj.constructor && exports.isObject(obj)) { - // object created with Object.create(null) - return cloneObject(obj, options); - } - - if (obj.valueOf) - return obj.valueOf(); -}; -var clone = exports.clone; - -/*! - * ignore - */ - -function cloneObject(obj, options) { - var retainKeyOrder = options && options.retainKeyOrder - , minimize = options && options.minimize - , ret = {} - , hasKeys - , keys - , val - , k - , i; - - if (retainKeyOrder) { - for (k in obj) { - val = clone(obj[k], options); - - if (!minimize || ('undefined' !== typeof val)) { - hasKeys || (hasKeys = true); - ret[k] = val; - } - } - } else { - // faster - - keys = Object.keys(obj); - i = keys.length; - - while (i--) { - k = keys[i]; - val = clone(obj[k], options); - - if (!minimize || ('undefined' !== typeof val)) { - if (!hasKeys) hasKeys = true; - ret[k] = val; - } - } - } - - return minimize - ? hasKeys && ret - : ret; -} - -function cloneArray(arr, options) { - var ret = []; - for (var i = 0, l = arr.length; i < l; i++) - ret.push(clone(arr[i], options)); - return ret; -} - -/*! - * Shallow copies defaults into options. - * - * @param {Object} defaults - * @param {Object} options - * @return {Object} the merged object - * @api private - */ - -exports.options = function(defaults, options) { - var keys = Object.keys(defaults) - , i = keys.length - , k ; - - options = options || {}; - - while (i--) { - k = keys[i]; - if (!(k in options)) { - options[k] = defaults[k]; - } - } - - return options; -}; - -/*! - * Generates a random string - * - * @api private - */ - -exports.random = function() { - return Math.random().toString().substr(3); -}; - -/*! - * Merges `from` into `to` without overwriting existing properties. - * - * @param {Object} to - * @param {Object} from - * @api private - */ - -exports.merge = function merge(to, from) { - var keys = Object.keys(from) - , i = keys.length - , key; - - while (i--) { - key = keys[i]; - if ('undefined' === typeof to[key]) { - to[key] = from[key]; - } else if (exports.isObject(from[key])) { - merge(to[key], from[key]); - } - } -}; - -/*! - * toString helper - */ - -var toString = Object.prototype.toString; - -/*! - * Applies toObject recursively. - * - * @param {Document|Array|Object} obj - * @return {Object} - * @api private - */ - -exports.toObject = function toObject(obj) { - var ret; - - if (exports.isNullOrUndefined(obj)) { - return obj; - } - - if (obj instanceof Document) { - return obj.toObject(); - } - - if (Array.isArray(obj)) { - ret = []; - - for (var i = 0, len = obj.length; i < len; ++i) { - ret.push(toObject(obj[i])); - } - - return ret; - } - - if ((obj.constructor && exports.getFunctionName(obj.constructor) === 'Object') || - (!obj.constructor && exports.isObject(obj))) { - ret = {}; - - for (var k in obj) { - ret[k] = toObject(obj[k]); - } - - return ret; - } - - return obj; -}; - -/*! - * Determines if `arg` is an object. - * - * @param {Object|Array|String|Function|RegExp|any} arg - * @api private - * @return {Boolean} - */ - -exports.isObject = function(arg) { - return '[object Object]' == toString.call(arg); -}; - -/*! - * A faster Array.prototype.slice.call(arguments) alternative - * @api private - */ - -exports.args = sliced; - -/*! - * process.nextTick helper. - * - * Wraps `callback` in a try/catch + nextTick. - * - * node-mongodb-native has a habit of state corruption when an error is immediately thrown from within a collection callback. - * - * @param {Function} callback - * @api private - */ - -exports.tick = function tick(callback) { - if ('function' !== typeof callback) return; - return function() { - try { - callback.apply(this, arguments); - } catch (err) { - // only nextTick on err to get out of - // the event loop and avoid state corruption. - process.nextTick(function() { - throw err; - }); - } - }; -}; - -/*! - * Returns if `v` is a mongoose object that has a `toObject()` method we can use. - * - * This is for compatibility with libs like Date.js which do foolish things to Natives. - * - * @param {any} v - * @api private - */ - -exports.isMongooseObject = function(v) { - Document || (Document = require('./document')); - MongooseArray || (MongooseArray = require('./types').Array); - MongooseBuffer || (MongooseBuffer = require('./types').Buffer); - - return v instanceof Document || - (v && v.isMongooseArray) || - (v && v.isMongooseBuffer); -}; -var isMongooseObject = exports.isMongooseObject; - -/*! - * Converts `expires` options of index objects to `expiresAfterSeconds` options for MongoDB. - * - * @param {Object} object - * @api private - */ - -exports.expires = function expires(object) { - if (!(object && 'Object' == object.constructor.name)) return; - if (!('expires' in object)) return; - - var when; - if ('string' != typeof object.expires) { - when = object.expires; - } else { - when = Math.round(ms(object.expires) / 1000); - } - object.expireAfterSeconds = when; - delete object.expires; -}; - -/*! - * Populate options constructor - */ - -function PopulateOptions(path, select, match, options, model, subPopulate) { - this.path = path; - this.match = match; - this.select = select; - this.options = options; - this.model = model; - if (typeof subPopulate === 'object') { - this.populate = subPopulate; - } - this._docs = {}; -} - -// make it compatible with utils.clone -PopulateOptions.prototype.constructor = Object; - -// expose -exports.PopulateOptions = PopulateOptions; - -/*! - * populate helper - */ - -exports.populate = function populate(path, select, model, match, options, subPopulate) { - // The order of select/conditions args is opposite Model.find but - // necessary to keep backward compatibility (select could be - // an array, string, or object literal). - - // might have passed an object specifying all arguments - if (1 === arguments.length) { - if (path instanceof PopulateOptions) { - return [path]; - } - - if (Array.isArray(path)) { - return path.map(function(o) { - return exports.populate(o)[0]; - }); - } - - if (exports.isObject(path)) { - match = path.match; - options = path.options; - select = path.select; - model = path.model; - subPopulate = path.populate; - path = path.path; - } - } else if ('string' !== typeof model && 'function' !== typeof model) { - options = match; - match = model; - model = undefined; - } - - if ('string' != typeof path) { - throw new TypeError('utils.populate: invalid path. Expected string. Got typeof `' + typeof path + '`'); - } - - if (typeof subPopulate === 'object') { - subPopulate = exports.populate(subPopulate); - } - - var ret = []; - var paths = path.split(' '); - for (var i = 0; i < paths.length; ++i) { - ret.push(new PopulateOptions(paths[i], select, match, options, model, subPopulate)); - } - - return ret; -}; - -/*! - * Return the value of `obj` at the given `path`. - * - * @param {String} path - * @param {Object} obj - */ - -exports.getValue = function(path, obj, map) { - return mpath.get(path, obj, '_doc', map); -}; - -/*! - * Sets the value of `obj` at the given `path`. - * - * @param {String} path - * @param {Anything} val - * @param {Object} obj - */ - -exports.setValue = function(path, val, obj, map) { - mpath.set(path, val, obj, '_doc', map); -}; - -/*! - * Returns an array of values from object `o`. - * - * @param {Object} o - * @return {Array} - * @private - */ - -exports.object = {}; -exports.object.vals = function vals(o) { - var keys = Object.keys(o) - , i = keys.length - , ret = []; - - while (i--) { - ret.push(o[keys[i]]); - } - - return ret; -}; - -/*! - * @see exports.options - */ - -exports.object.shallowCopy = exports.options; - -/*! - * Safer helper for hasOwnProperty checks - * - * @param {Object} obj - * @param {String} prop - */ - -var hop = Object.prototype.hasOwnProperty; -exports.object.hasOwnProperty = function(obj, prop) { - return hop.call(obj, prop); -}; - -/*! - * Determine if `val` is null or undefined - * - * @return {Boolean} - */ - -exports.isNullOrUndefined = function(val) { - return null == val; -}; - -/*! - * ignore - */ - -exports.array = {}; - -/*! - * Flattens an array. - * - * [ 1, [ 2, 3, [4] ]] -> [1,2,3,4] - * - * @param {Array} arr - * @param {Function} [filter] If passed, will be invoked with each item in the array. If `filter` returns a falsey value, the item will not be included in the results. - * @return {Array} - * @private - */ - -exports.array.flatten = function flatten(arr, filter, ret) { - ret || (ret = []); - - arr.forEach(function(item) { - if (Array.isArray(item)) { - flatten(item, filter, ret); - } else { - if (!filter || filter(item)) { - ret.push(item); - } - } - }); - - return ret; -}; - -/*! - * Removes duplicate values from an array - * - * [1, 2, 3, 3, 5] => [1, 2, 3, 5] - * [ ObjectId("550988ba0c19d57f697dc45e"), ObjectId("550988ba0c19d57f697dc45e") ] - * => [ObjectId("550988ba0c19d57f697dc45e")] - * - * @param {Array} arr - * @return {Array} - * @private - */ - -exports.array.unique = function(arr) { - var primitives = {}; - var ids = {}; - var ret = []; - var length = arr.length; - for (var i = 0; i < length; ++i) { - if (typeof arr[i] === 'number' || typeof arr[i] === 'string') { - if (primitives[arr[i]]) { - continue; - } - ret.push(arr[i]); - primitives[arr[i]] = true; - } else if (arr[i] instanceof ObjectId) { - if (ids[arr[i].toString()]) { - continue; - } - ret.push(arr[i]); - ids[arr[i].toString()] = true; - } else { - ret.push(arr[i]); - } - } - - return ret; -}; - -/*! - * Determines if two buffers are equal. - * - * @param {Buffer} a - * @param {Object} b - */ - -exports.buffer = {}; -exports.buffer.areEqual = function(a, b) { - if (!Buffer.isBuffer(a)) return false; - if (!Buffer.isBuffer(b)) return false; - if (a.length !== b.length) return false; - for (var i = 0, len = a.length; i < len; ++i) { - if (a[i] !== b[i]) return false; - } - return true; -}; - -exports.getFunctionName = function(fn) { - if (fn.name) { - return fn.name; - } - return (fn.toString().trim().match(/^function\s*([^\s(]+)/) || [])[1]; -}; - -exports.decorate = function(destination, source) { - for (var key in source) { - destination[key] = source[key]; - } -}; - -/** - * merges to with a copy of from - * - * @param {Object} to - * @param {Object} from - * @api private - */ - -exports.mergeClone = function(to, from) { - var keys = Object.keys(from) - , i = keys.length - , key; - - while (i--) { - key = keys[i]; - if ('undefined' === typeof to[key]) { - // make sure to retain key order here because of a bug handling the $each - // operator in mongodb 2.4.4 - to[key] = exports.clone(from[key], { retainKeyOrder : 1}); - } else { - if (exports.isObject(from[key])) { - exports.mergeClone(to[key], from[key]); - } else { - // make sure to retain key order here because of a bug handling the - // $each operator in mongodb 2.4.4 - to[key] = exports.clone(from[key], { retainKeyOrder : 1}); - } - } - } -}; - -/** - * Executes a function on each element of an array (like _.each) - * - * @param {Array} arr - * @param {Function} fn - * @api private - */ - -exports.each = function(arr, fn) { - for (var i = 0; i < arr.length; ++i) { - fn(arr[i]); - } -}; diff --git a/Associations/node_modules/mongoose/lib/virtualtype.js b/Associations/node_modules/mongoose/lib/virtualtype.js deleted file mode 100644 index f43cbe2b..00000000 --- a/Associations/node_modules/mongoose/lib/virtualtype.js +++ /dev/null @@ -1,103 +0,0 @@ - -/** - * VirtualType constructor - * - * This is what mongoose uses to define virtual attributes via `Schema.prototype.virtual`. - * - * ####Example: - * - * var fullname = schema.virtual('fullname'); - * fullname instanceof mongoose.VirtualType // true - * - * @parma {Object} options - * @api public - */ - -function VirtualType(options, name) { - this.path = name; - this.getters = []; - this.setters = []; - this.options = options || {}; -} - -/** - * Defines a getter. - * - * ####Example: - * - * var virtual = schema.virtual('fullname'); - * virtual.get(function () { - * return this.name.first + ' ' + this.name.last; - * }); - * - * @param {Function} fn - * @return {VirtualType} this - * @api public - */ - -VirtualType.prototype.get = function(fn) { - this.getters.push(fn); - return this; -}; - -/** - * Defines a setter. - * - * ####Example: - * - * var virtual = schema.virtual('fullname'); - * virtual.set(function (v) { - * var parts = v.split(' '); - * this.name.first = parts[0]; - * this.name.last = parts[1]; - * }); - * - * @param {Function} fn - * @return {VirtualType} this - * @api public - */ - -VirtualType.prototype.set = function(fn) { - this.setters.push(fn); - return this; -}; - -/** - * Applies getters to `value` using optional `scope`. - * - * @param {Object} value - * @param {Object} scope - * @return {any} the value after applying all getters - * @api public - */ - -VirtualType.prototype.applyGetters = function(value, scope) { - var v = value; - for (var l = this.getters.length - 1; l >= 0; l--) { - v = this.getters[l].call(scope, v, this); - } - return v; -}; - -/** - * Applies setters to `value` using optional `scope`. - * - * @param {Object} value - * @param {Object} scope - * @return {any} the value after applying all setters - * @api public - */ - -VirtualType.prototype.applySetters = function(value, scope) { - var v = value; - for (var l = this.setters.length - 1; l >= 0; l--) { - v = this.setters[l].call(scope, v, this); - } - return v; -}; - -/*! - * exports - */ - -module.exports = VirtualType; diff --git a/Associations/node_modules/mongoose/node_modules/async/.travis.yml b/Associations/node_modules/mongoose/node_modules/async/.travis.yml deleted file mode 100644 index 6e5919de..00000000 --- a/Associations/node_modules/mongoose/node_modules/async/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -language: node_js -node_js: - - "0.10" diff --git a/Associations/node_modules/mongoose/node_modules/async/LICENSE b/Associations/node_modules/mongoose/node_modules/async/LICENSE deleted file mode 100644 index 8f296985..00000000 --- a/Associations/node_modules/mongoose/node_modules/async/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2010-2014 Caolan McMahon - -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/Associations/node_modules/mongoose/node_modules/async/README.md b/Associations/node_modules/mongoose/node_modules/async/README.md deleted file mode 100644 index 0bea5311..00000000 --- a/Associations/node_modules/mongoose/node_modules/async/README.md +++ /dev/null @@ -1,1646 +0,0 @@ -# Async.js - -[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) - - -Async is a utility module which provides straight-forward, powerful functions -for working with asynchronous JavaScript. Although originally designed for -use with [Node.js](http://nodejs.org), it can also be used directly in the -browser. Also supports [component](https://github.com/component/component). - -Async provides around 20 functions that include the usual 'functional' -suspects (`map`, `reduce`, `filter`, `each`…) as well as some common patterns -for asynchronous control flow (`parallel`, `series`, `waterfall`…). All these -functions assume you follow the Node.js convention of providing a single -callback as the last argument of your `async` function. - - -## Quick Examples - -```javascript -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); - -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); - -async.parallel([ - function(){ ... }, - function(){ ... } -], callback); - -async.series([ - function(){ ... }, - function(){ ... } -]); -``` - -There are many more functions available so take a look at the docs below for a -full list. This module aims to be comprehensive, so if you feel anything is -missing please create a GitHub issue for it. - -## Common Pitfalls - -### Binding a context to an iterator - -This section is really about `bind`, not about `async`. If you are wondering how to -make `async` execute your iterators in a given context, or are confused as to why -a method of another library isn't working as an iterator, study this example: - -```js -// Here is a simple object with an (unnecessarily roundabout) squaring method -var AsyncSquaringLibrary = { - squareExponent: 2, - square: function(number, callback){ - var result = Math.pow(number, this.squareExponent); - setTimeout(function(){ - callback(null, result); - }, 200); - } -}; - -async.map([1, 2, 3], AsyncSquaringLibrary.square, function(err, result){ - // result is [NaN, NaN, NaN] - // This fails because the `this.squareExponent` expression in the square - // function is not evaluated in the context of AsyncSquaringLibrary, and is - // therefore undefined. -}); - -async.map([1, 2, 3], AsyncSquaringLibrary.square.bind(AsyncSquaringLibrary), function(err, result){ - // result is [1, 4, 9] - // With the help of bind we can attach a context to the iterator before - // passing it to async. Now the square function will be executed in its - // 'home' AsyncSquaringLibrary context and the value of `this.squareExponent` - // will be as expected. -}); -``` - -## Download - -The source is available for download from -[GitHub](http://github.com/caolan/async). -Alternatively, you can install using Node Package Manager (`npm`): - - npm install async - -__Development:__ [async.js](https://github.com/caolan/async/raw/master/lib/async.js) - 29.6kb Uncompressed - -## In the Browser - -So far it's been tested in IE6, IE7, IE8, FF3.6 and Chrome 5. - -Usage: - -```html - - -``` - -## Documentation - -### Collections - -* [`each`](#each) -* [`eachSeries`](#eachSeries) -* [`eachLimit`](#eachLimit) -* [`map`](#map) -* [`mapSeries`](#mapSeries) -* [`mapLimit`](#mapLimit) -* [`filter`](#filter) -* [`filterSeries`](#filterSeries) -* [`reject`](#reject) -* [`rejectSeries`](#rejectSeries) -* [`reduce`](#reduce) -* [`reduceRight`](#reduceRight) -* [`detect`](#detect) -* [`detectSeries`](#detectSeries) -* [`sortBy`](#sortBy) -* [`some`](#some) -* [`every`](#every) -* [`concat`](#concat) -* [`concatSeries`](#concatSeries) - -### Control Flow - -* [`series`](#seriestasks-callback) -* [`parallel`](#parallel) -* [`parallelLimit`](#parallellimittasks-limit-callback) -* [`whilst`](#whilst) -* [`doWhilst`](#doWhilst) -* [`until`](#until) -* [`doUntil`](#doUntil) -* [`forever`](#forever) -* [`waterfall`](#waterfall) -* [`compose`](#compose) -* [`seq`](#seq) -* [`applyEach`](#applyEach) -* [`applyEachSeries`](#applyEachSeries) -* [`queue`](#queue) -* [`priorityQueue`](#priorityQueue) -* [`cargo`](#cargo) -* [`auto`](#auto) -* [`retry`](#retry) -* [`iterator`](#iterator) -* [`apply`](#apply) -* [`nextTick`](#nextTick) -* [`times`](#times) -* [`timesSeries`](#timesSeries) - -### Utils - -* [`memoize`](#memoize) -* [`unmemoize`](#unmemoize) -* [`log`](#log) -* [`dir`](#dir) -* [`noConflict`](#noConflict) - - -## Collections - - - -### each(arr, iterator, callback) - -Applies the function `iterator` to each item in `arr`, in parallel. -The `iterator` is called with an item from the list, and a callback for when it -has finished. If the `iterator` passes an error to its `callback`, the main -`callback` (for the `each` function) is immediately called with the error. - -Note, that since this function applies `iterator` to each item in parallel, -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the `callback` should be run without - arguments or with an explicit `null` argument. -* `callback(err)` - A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Examples__ - - -```js -// assuming openFiles is an array of file names and saveFile is a function -// to save the modified contents of that file: - -async.each(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - -```js -// assuming openFiles is an array of file names - -async.each(openFiles, function( file, callback) { - - // Perform operation on file here. - console.log('Processing file ' + file); - - if( file.length > 32 ) { - console.log('This file name is too long'); - callback('File name too long'); - } else { - // Do work to process file here - console.log('File processed'); - callback(); - } -}, function(err){ - // if any of the file processing produced an error, err would equal that error - if( err ) { - // One of the iterations produced an error. - // All processing will now stop. - console.log('A file failed to process'); - } else { - console.log('All files have been processed successfully'); - } -}); -``` - ---------------------------------------- - - - -### eachSeries(arr, iterator, callback) - -The same as [`each`](#each), only `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -This means the `iterator` functions will complete in order. - - ---------------------------------------- - - - -### eachLimit(arr, limit, iterator, callback) - -The same as [`each`](#each), only no more than `limit` `iterator`s will be simultaneously -running at any time. - -Note that the items in `arr` are not processed in batches, so there is no guarantee that -the first `limit` `iterator` functions will complete before any others are started. - -__Arguments__ - -* `arr` - An array to iterate over. -* `limit` - The maximum number of `iterator`s to run at any time. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the callback should be run without - arguments or with an explicit `null` argument. -* `callback(err)` - A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Example__ - -```js -// Assume documents is an array of JSON objects and requestApi is a -// function that interacts with a rate-limited REST api. - -async.eachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in `arr` through -the `iterator` function. The `iterator` is called with an item from `arr` and a -callback for when it has finished processing. Each of these callback takes 2 arguments: -an `error`, and the transformed item from `arr`. If `iterator` passes an error to this -callback, the main `callback` (for the `map` function) is immediately called with the error. - -Note, that since this function applies the `iterator` to each item in parallel, -there is no guarantee that the `iterator` functions will complete in order. -However, the results array will be in the same order as the original `arr`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - A callback which is called when all `iterator` - functions have finished, or an error occurs. Results is an array of the - transformed items from the `arr`. - -__Example__ - -```js -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as [`map`](#map), only the `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - - ---------------------------------------- - - -### mapLimit(arr, limit, iterator, callback) - -The same as [`map`](#map), only no more than `limit` `iterator`s will be simultaneously -running at any time. - -Note that the items are not processed in batches, so there is no guarantee that -the first `limit` `iterator` functions will complete before any others are started. - -__Arguments__ - -* `arr` - An array to iterate over. -* `limit` - The maximum number of `iterator`s to run at any time. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - A callback which is called when all `iterator` - calls have finished, or an error occurs. The result is an array of the - transformed items from the original `arr`. - -__Example__ - -```js -async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - - -### filter(arr, iterator, callback) - -__Alias:__ `select` - -Returns a new array of all the values in `arr` which pass an async truth test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The `iterator` is passed a `callback(truthValue)`, which must be called with a - boolean argument once it has completed. -* `callback(results)` - A callback which is called after all the `iterator` - functions have finished. - -__Example__ - -```js -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); -``` - ---------------------------------------- - - - -### filterSeries(arr, iterator, callback) - -__Alias:__ `selectSeries` - -The same as [`filter`](#filter) only the `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of [`filter`](#filter). Removes values that pass an `async` truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as [`reject`](#reject), only the `iterator` is applied to each item in `arr` -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__Aliases:__ `inject`, `foldl` - -Reduces `arr` into a single value using an async `iterator` to return -each successive step. `memo` is the initial state of the reduction. -This function only operates in series. - -For performance reasons, it may make sense to split a call to this function into -a parallel map, and then use the normal `Array.prototype.reduce` on the results. -This function is for situations where each step in the reduction needs to be async; -if you can get the data before reducing it, then it's probably a good idea to do so. - -__Arguments__ - -* `arr` - An array to iterate over. -* `memo` - The initial state of the reduction. -* `iterator(memo, item, callback)` - A function applied to each item in the - array to produce the next step in the reduction. The `iterator` is passed a - `callback(err, reduction)` which accepts an optional error as its first - argument, and the state of the reduction as the second. If an error is - passed to the callback, the reduction is stopped and the main `callback` is - immediately called with the error. -* `callback(err, result)` - A callback which is called after all the `iterator` - functions have finished. Result is the reduced value. - -__Example__ - -```js -async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); -}, function(err, result){ - // result is now equal to the last value of memo, which is 6 -}); -``` - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ `foldr` - -Same as [`reduce`](#reduce), only operates on `arr` in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in `arr` that passes an async truth test. The -`iterator` is applied in parallel, meaning the first iterator to return `true` will -fire the detect `callback` with that result. That means the result might not be -the first item in the original `arr` (in terms of order) that passes the test. - -If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries). - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The iterator is passed a `callback(truthValue)` which must be called with a - boolean argument once it has completed. -* `callback(result)` - A callback which is called as soon as any iterator returns - `true`, or after all the `iterator` functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value `undefined` if none passed. - -__Example__ - -```js -async.detect(['file1','file2','file3'], fs.exists, function(result){ - // result now equals the first file in the list that exists -}); -``` - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as [`detect`](#detect), only the `iterator` is applied to each item in `arr` -in series. This means the result is always the first in the original `arr` (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each `arr` value through an async `iterator`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, sortValue)` which must be called once it - has completed with an error (which can be `null`) and a value to use as the sort - criteria. -* `callback(err, results)` - A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is the items from - the original `arr` sorted by the values returned by the `iterator` calls. - -__Example__ - -```js -async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); -}, function(err, results){ - // results is now the original array of files sorted by - // modified date -}); -``` - -__Sort Order__ - -By modifying the callback parameter the sorting order can be influenced: - -```js -//ascending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x); -}, function(err,result){ - //result callback -} ); - -//descending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x*-1); //<- x*-1 instead of x, turns the order around -}, function(err,result){ - //result callback -} ); -``` - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ `any` - -Returns `true` if at least one element in the `arr` satisfies an async test. -_The callback for each iterator call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. Once any iterator -call returns `true`, the main `callback` is immediately called. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a callback(truthValue) which must be - called with a boolean argument once it has completed. -* `callback(result)` - A callback which is called as soon as any iterator returns - `true`, or after all the iterator functions have finished. Result will be - either `true` or `false` depending on the values of the async tests. - -__Example__ - -```js -async.some(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then at least one of the files exists -}); -``` - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ `all` - -Returns `true` if every element in `arr` satisfies an async test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a callback(truthValue) which must be - called with a boolean argument once it has completed. -* `callback(result)` - A callback which is called after all the `iterator` - functions have finished. Result will be either `true` or `false` depending on - the values of the async tests. - -__Example__ - -```js -async.every(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then every file exists -}); -``` - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies `iterator` to each item in `arr`, concatenating the results. Returns the -concatenated list. The `iterator`s are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of `arr` passed to the `iterator` function. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, results)` which must be called once it - has completed with an error (which can be `null`) and an array of results. -* `callback(err, results)` - A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is an array containing - the concatenated results of the `iterator` function. - -__Example__ - -```js -async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories -}); -``` - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as [`concat`](#concat), but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run the functions in the `tasks` array in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run, and `callback` is immediately called with the value of the error. -Otherwise, `callback` receives an array of results when `tasks` have completed. - -It is also possible to use an object instead of an array. Each property will be -run as a function, and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`series`](#series). - -**Note** that while many implementations preserve the order of object properties, the -[ECMAScript Language Specifcation](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) -explicitly states that - -> The mechanics and order of enumerating the properties is not specified. - -So if you rely on the order in which your series of functions are executed, and want -this to work on all platforms, consider using an array. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - -__Example__ - -```js -async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - } -], -// optional callback -function(err, results){ - // results is now equal to ['one', 'two'] -}); - - -// an example using an object instead of an array -async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equal to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run the `tasks` array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main `callback` is immediately called with the value of the error. -Once the `tasks` have completed, the results are passed to the final `callback` as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`parallel`](#parallel). - - -__Arguments__ - -* `tasks` - An array or object containing functions to run. Each function is passed - a `callback(err, result)` which it must call on completion with an error `err` - (which can be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - } -], -// optional callback -function(err, results){ - // the results array will equal ['one','two'] even though - // the second function had a shorter timeout. -}); - - -// an example using an object instead of an array -async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equals to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallelLimit(tasks, limit, [callback]) - -The same as [`parallel`](#parallel), only `tasks` are executed in parallel -with a maximum of `limit` tasks executing at any time. - -Note that the `tasks` are not executed in batches, so there is no guarantee that -the first `limit` tasks will complete before any others are started. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `limit` - The maximum number of `tasks` to run at any time. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -__Arguments__ - -* `test()` - synchronous truth test to perform before each execution of `fn`. -* `fn(callback)` - A function which is called each time `test` passes. The function is - passed a `callback(err)`, which must be called once it has completed with an - optional `err` argument. -* `callback(err)` - A callback which is called after the test fails and repeated - execution of `fn` has stopped. - -__Example__ - -```js -var count = 0; - -async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } -); -``` - ---------------------------------------- - - -### doWhilst(fn, test, callback) - -The post-check version of [`whilst`](#whilst). To reflect the difference in -the order of operations, the arguments `test` and `fn` are switched. - -`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -The inverse of [`whilst`](#whilst). - ---------------------------------------- - - -### doUntil(fn, test, callback) - -Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`. - ---------------------------------------- - - -### forever(fn, errback) - -Calls the asynchronous function `fn` with a callback parameter that allows it to -call itself again, in series, indefinitely. - -If an error is passed to the callback then `errback` is called with the -error, and execution stops, otherwise it will never be called. - -```js -async.forever( - function(next) { - // next is suitable for passing to things that need a callback(err [, whatever]); - // it will result in this function being called again. - }, - function(err) { - // if next is called with a value in its first parameter, it will appear - // in here as 'err', and execution will stop. - } -); -``` - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs the `tasks` array of functions in series, each passing their results to the next in -the array. However, if any of the `tasks` pass an error to their own callback, the -next function is not executed, and the main `callback` is immediately called with -the error. - -__Arguments__ - -* `tasks` - An array of functions to run, each function is passed a - `callback(err, result1, result2, ...)` it must call on completion. The first - argument is an error (which can be `null`) and any further arguments will be - passed as arguments in order to the next task. -* `callback(err, [results])` - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - -```js -async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } -], function (err, result) { - // result now equals 'done' -}); -``` - ---------------------------------------- - -### compose(fn1, fn2...) - -Creates a function which is a composition of the passed asynchronous -functions. Each function consumes the return value of the function that -follows. Composing functions `f()`, `g()`, and `h()` would produce the result of -`f(g(h()))`, only this version uses callbacks to obtain the return values. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* `functions...` - the asynchronous functions to compose - - -__Example__ - -```js -function add1(n, callback) { - setTimeout(function () { - callback(null, n + 1); - }, 10); -} - -function mul3(n, callback) { - setTimeout(function () { - callback(null, n * 3); - }, 10); -} - -var add1mul3 = async.compose(mul3, add1); - -add1mul3(4, function (err, result) { - // result now equals 15 -}); -``` - ---------------------------------------- - -### seq(fn1, fn2...) - -Version of the compose function that is more natural to read. -Each following function consumes the return value of the latter function. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* functions... - the asynchronous functions to compose - - -__Example__ - -```js -// Requires lodash (or underscore), express3 and dresende's orm2. -// Part of an app, that fetches cats of the logged user. -// This example uses `seq` function to avoid overnesting and error -// handling clutter. -app.get('/cats', function(request, response) { - function handleError(err, data, callback) { - if (err) { - console.error(err); - response.json({ status: 'error', message: err.message }); - } - else { - callback(data); - } - } - var User = request.models.User; - async.seq( - _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - handleError, - function(user, fn) { - user.getCats(fn); // 'getCats' has signature (callback(err, data)) - }, - handleError, - function(cats) { - response.json({ status: 'ok', message: 'Cats found', data: cats }); - } - )(req.session.user_id); - } -}); -``` - ---------------------------------------- - -### applyEach(fns, args..., callback) - -Applies the provided arguments to each function in the array, calling -`callback` after all functions have completed. If you only provide the first -argument, then it will return a function which lets you pass in the -arguments as if it were a single function call. - -__Arguments__ - -* `fns` - the asynchronous functions to all call with the same arguments -* `args...` - any number of separate arguments to pass to the function -* `callback` - the final argument should be the callback, called when all - functions have completed processing - - -__Example__ - -```js -async.applyEach([enableSearch, updateSchema], 'bucket', callback); - -// partial application example: -async.each( - buckets, - async.applyEach([enableSearch, updateSchema]), - callback -); -``` - ---------------------------------------- - - -### applyEachSeries(arr, iterator, callback) - -The same as [`applyEach`](#applyEach) only the functions are applied in series. - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a `queue` object with the specified `concurrency`. Tasks added to the -`queue` are processed in parallel (up to the `concurrency` limit). If all -`worker`s are in progress, the task is queued until one becomes available. -Once a `worker` completes a `task`, that `task`'s callback is called. - -__Arguments__ - -* `worker(task, callback)` - An asynchronous function for processing a queued - task, which must call its `callback(err)` argument when finished, with an - optional `error` as an argument. -* `concurrency` - An `integer` for determining how many `worker` functions should be - run in parallel. - -__Queue objects__ - -The `queue` object returned by this function has the following properties and -methods: - -* `length()` - a function returning the number of items waiting to be processed. -* `started` - a function returning whether or not any items have been pushed and processed by the queue -* `running()` - a function returning the number of items currently being processed. -* `idle()` - a function returning false if there are items waiting or being processed, or true if not. -* `concurrency` - an integer for determining how many `worker` functions should be - run in parallel. This property can be changed after a `queue` is created to - alter the concurrency on-the-fly. -* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once - the `worker` has finished processing the task. Instead of a single task, a `tasks` array - can be submitted. The respective callback is used for every task in the list. -* `unshift(task, [callback])` - add a new task to the front of the `queue`. -* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, - and further tasks will be queued. -* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`. -* `paused` - a boolean for determining whether the queue is in a paused state -* `pause()` - a function that pauses the processing of tasks until `resume()` is called. -* `resume()` - a function that resumes the processing of queued tasks when the queue is paused. -* `kill()` - a function that empties remaining tasks from the queue forcing it to go idle. - -__Example__ - -```js -// create a queue object with concurrency 2 - -var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -// assign a callback -q.drain = function() { - console.log('all items have been processed'); -} - -// add some items to the queue - -q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); - -// add some items to the queue (batch-wise) - -q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); -}); - -// add some items to the front of the queue - -q.unshift({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -``` - - ---------------------------------------- - - -### priorityQueue(worker, concurrency) - -The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects: - -* `push(task, priority, [callback])` - `priority` should be a number. If an array of - `tasks` is given, all tasks will be assigned the same priority. -* The `unshift` method was removed. - ---------------------------------------- - - -### cargo(worker, [payload]) - -Creates a `cargo` object with the specified payload. Tasks added to the -cargo will be processed altogether (up to the `payload` limit). If the -`worker` is in progress, the task is queued until it becomes available. Once -the `worker` has completed some tasks, each callback of those tasks is called. -Check out [this animation](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) for how `cargo` and `queue` work. - -While [queue](#queue) passes only one task to one of a group of workers -at a time, cargo passes an array of tasks to a single worker, repeating -when the worker is finished. - -__Arguments__ - -* `worker(tasks, callback)` - An asynchronous function for processing an array of - queued tasks, which must call its `callback(err)` argument when finished, with - an optional `err` argument. -* `payload` - An optional `integer` for determining how many tasks should be - processed per round; if omitted, the default is unlimited. - -__Cargo objects__ - -The `cargo` object returned by this function has the following properties and -methods: - -* `length()` - A function returning the number of items waiting to be processed. -* `payload` - An `integer` for determining how many tasks should be - process per round. This property can be changed after a `cargo` is created to - alter the payload on-the-fly. -* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called - once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` - can be submitted. The respective callback is used for every task in the list. -* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued. -* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`. - -__Example__ - -```js -// create a cargo object with payload 2 - -var cargo = async.cargo(function (tasks, callback) { - for(var i=0; i -### auto(tasks, [callback]) - -Determines the best order for running the functions in `tasks`, based on their -requirements. Each function can optionally depend on other functions being completed -first, and each function is run as soon as its requirements are satisfied. - -If any of the functions pass an error to their callback, it will not -complete (so any other functions depending on it will not run), and the main -`callback` is immediately called with the error. Functions also receive an -object containing the results of functions which have completed so far. - -Note, all functions are called with a `results` object as a second argument, -so it is unsafe to pass functions in the `tasks` object which cannot handle the -extra argument. - -For example, this snippet of code: - -```js -async.auto({ - readData: async.apply(fs.readFile, 'data.txt', 'utf-8') -}, callback); -``` - -will have the effect of calling `readFile` with the results object as the last -argument, which will fail: - -```js -fs.readFile('data.txt', 'utf-8', cb, {}); -``` - -Instead, wrap the call to `readFile` in a function which does not forward the -`results` object: - -```js -async.auto({ - readData: function(cb, results){ - fs.readFile('data.txt', 'utf-8', cb); - } -}, callback); -``` - -__Arguments__ - -* `tasks` - An object. Each of its properties is either a function or an array of - requirements, with the function itself the last item in the array. The object's key - of a property serves as the name of the task defined by that property, - i.e. can be used when specifying requirements for other tasks. - The function receives two arguments: (1) a `callback(err, result)` which must be - called when finished, passing an `error` (which can be `null`) and the result of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions. -* `callback(err, results)` - An optional callback which is called when all the - tasks have been completed. It receives the `err` argument if any `tasks` - pass an error to their callback. Results are always returned; however, if - an error occurs, no further `tasks` will be performed, and the results - object will only contain partial results. - - -__Example__ - -```js -async.auto({ - get_data: function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - make_folder: function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - }, - write_file: ['get_data', 'make_folder', function(callback, results){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, 'filename'); - }], - email_link: ['write_file', function(callback, results){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - callback(null, {'file':results.write_file, 'email':'user@example.com'}); - }] -}, function(err, results) { - console.log('err = ', err); - console.log('results = ', results); -}); -``` - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - -```js -async.parallel([ - function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - } -], -function(err, results){ - async.series([ - function(callback){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - results.push('filename'); - callback(null); - }, - function(callback){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - callback(null, {'file':results.pop(), 'email':'user@example.com'}); - } - ]); -}); -``` - -For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding -new tasks much easier (and the code more readable). - - ---------------------------------------- - - -### retry([times = 5], task, [callback]) - -Attempts to get a successful response from `task` no more than `times` times before -returning an error. If the task is successful, the `callback` will be passed the result -of the successfull task. If all attemps fail, the callback will be passed the error and -result (if any) of the final attempt. - -__Arguments__ - -* `times` - An integer indicating how many times to attempt the `task` before giving up. Defaults to 5. -* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)` - which must be called when finished, passing `err` (which can be `null`) and the `result` of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions (if nested inside another control flow). -* `callback(err, results)` - An optional callback which is called when the - task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`. - -The [`retry`](#retry) function can be used as a stand-alone control flow by passing a -callback, as shown below: - -```js -async.retry(3, apiMethod, function(err, result) { - // do something with the result -}); -``` - -It can also be embeded within other control flow functions to retry individual methods -that are not as reliable, like this: - -```js -async.auto({ - users: api.getUsers.bind(api), - payments: async.retry(3, api.getPayments.bind(api)) -}, function(err, results) { - // do something with the results -}); -``` - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the `tasks` array, -returning a continuation to call the next one after that. It's also possible to -“peek” at the next iterator with `iterator.next()`. - -This function is used internally by the `async` module, but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* `tasks` - An array of functions to run. - -__Example__ - -```js -var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } -]); - -node> var iterator2 = iterator(); -'one' -node> var iterator3 = iterator2(); -'two' -node> iterator3(); -'three' -node> var nextfn = iterator2.next(); -node> nextfn(); -'three' -``` - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied. - -Useful as a shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - -```js -// using apply - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -// the same process without using apply - -async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - } -]); -``` - -It's possible to pass any number of additional arguments when calling the -continuation: - -```js -node> var fn = async.apply(sys.puts, 'one'); -node> fn('two', 'three'); -one -two -three -``` - ---------------------------------------- - - -### nextTick(callback) - -Calls `callback` on a later loop around the event loop. In Node.js this just -calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` -if available, otherwise `setTimeout(callback, 0)`, which means other higher priority -events may precede the execution of `callback`. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* `callback` - The function to call on a later loop around the event loop. - -__Example__ - -```js -var call_order = []; -async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two'] -}); -call_order.push('one') -``` - - -### times(n, callback) - -Calls the `callback` function `n` times, and accumulates results in the same manner -you would use with [`map`](#map). - -__Arguments__ - -* `n` - The number of times to run the function. -* `callback` - The function to call `n` times. - -__Example__ - -```js -// Pretend this is some complicated async factory -var createUser = function(id, callback) { - callback(null, { - id: 'user' + id - }) -} -// generate 5 users -async.times(5, function(n, next){ - createUser(n, function(err, user) { - next(err, user) - }) -}, function(err, users) { - // we should now have 5 users -}); -``` - - -### timesSeries(n, callback) - -The same as [`times`](#times), only the iterator is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an `async` function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -The cache of results is exposed as the `memo` property of the function returned -by `memoize`. - -__Arguments__ - -* `fn` - The function to proxy and cache results from. -* `hasher` - Tn optional function for generating a custom hash for storing - results. It has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - -```js -var slow_fn = function (name, callback) { - // do something - callback(null, result); -}; -var fn = async.memoize(slow_fn); - -// fn can now be used as if it were slow_fn -fn('some name', function () { - // callback -}); -``` - - -### unmemoize(fn) - -Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized -form. Handy for testing. - -__Arguments__ - -* `fn` - the memoized function - - -### log(function, arguments) - -Logs the result of an `async` function to the `console`. Only works in Node.js or -in browsers that support `console.log` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.log` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); -}; -``` -```js -node> async.log(hello, 'world'); -'hello world' -``` - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an `async` function to the `console` using `console.dir` to -display the properties of the resulting object. Only works in Node.js or -in browsers that support `console.dir` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.dir` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); -}; -``` -```js -node> async.dir(hello, 'world'); -{hello: 'world'} -``` - ---------------------------------------- - - -### noConflict() - -Changes the value of `async` back to its original value, returning a reference to the -`async` object. diff --git a/Associations/node_modules/mongoose/node_modules/async/component.json b/Associations/node_modules/mongoose/node_modules/async/component.json deleted file mode 100644 index bbb01154..00000000 --- a/Associations/node_modules/mongoose/node_modules/async/component.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "async", - "repo": "caolan/async", - "description": "Higher-order functions and common patterns for asynchronous code", - "version": "0.1.23", - "keywords": [], - "dependencies": {}, - "development": {}, - "main": "lib/async.js", - "scripts": [ "lib/async.js" ] -} diff --git a/Associations/node_modules/mongoose/node_modules/async/lib/async.js b/Associations/node_modules/mongoose/node_modules/async/lib/async.js deleted file mode 100755 index 01e8afcc..00000000 --- a/Associations/node_modules/mongoose/node_modules/async/lib/async.js +++ /dev/null @@ -1,1123 +0,0 @@ -/*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2014 Caolan McMahon - * Released under the MIT license - */ -/*jshint onevar: false, indent:4 */ -/*global setImmediate: false, setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root, previous_async; - - root = this; - if (root != null) { - previous_async = root.async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - var called = false; - return function() { - if (called) throw new Error("Callback was already called."); - called = true; - fn.apply(root, arguments); - } - } - - //// cross-browser compatiblity functions //// - - var _toString = Object.prototype.toString; - - var _isArray = Array.isArray || function (obj) { - return _toString.call(obj) === '[object Array]'; - }; - - var _each = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _each(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _each(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - if (typeof setImmediate === 'function') { - async.nextTick = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - async.setImmediate = async.nextTick; - } - else { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - async.setImmediate = async.nextTick; - } - } - else { - async.nextTick = process.nextTick; - if (typeof setImmediate !== 'undefined') { - async.setImmediate = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - } - else { - async.setImmediate = async.nextTick; - } - } - - async.each = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _each(arr, function (x) { - iterator(x, only_once(done) ); - }); - function done(err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(); - } - } - } - }; - async.forEach = async.each; - - async.eachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - async.forEachSeries = async.eachSeries; - - async.eachLimit = function (arr, limit, iterator, callback) { - var fn = _eachLimit(limit); - fn.apply(null, [arr, iterator, callback]); - }; - async.forEachLimit = async.eachLimit; - - var _eachLimit = function (limit) { - - return function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed >= arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - started += 1; - running += 1; - iterator(arr[started - 1], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed >= arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - } - })(); - }; - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.each].concat(args)); - }; - }; - var doParallelLimit = function(limit, fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [_eachLimit(limit)].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.eachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - if (!callback) { - eachfn(arr, function (x, callback) { - iterator(x.value, function (err) { - callback(err); - }); - }); - } else { - var results = []; - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = function (arr, limit, iterator, callback) { - return _mapLimit(limit)(arr, iterator, callback); - }; - - var _mapLimit = function(limit) { - return doParallelLimit(limit, _asyncMap); - }; - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.eachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - var remainingTasks = keys.length - if (!remainingTasks) { - return callback(); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - remainingTasks-- - _each(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (!remainingTasks) { - var theCallback = callback; - // prevent final callback from calling itself if it errors - callback = function () {}; - - theCallback(null, results); - } - }); - - _each(keys, function (k) { - var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; - var taskCallback = function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _each(_keys(results), function(rkey) { - safeResults[rkey] = results[rkey]; - }); - safeResults[k] = args; - callback(err, safeResults); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - results[k] = args; - async.setImmediate(taskComplete); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.retry = function(times, task, callback) { - var DEFAULT_TIMES = 5; - var attempts = []; - // Use defaults if times not passed - if (typeof times === 'function') { - callback = task; - task = times; - times = DEFAULT_TIMES; - } - // Make sure times is a number - times = parseInt(times, 10) || DEFAULT_TIMES; - var wrappedTask = function(wrappedCallback, wrappedResults) { - var retryAttempt = function(task, finalAttempt) { - return function(seriesCallback) { - task(function(err, result){ - seriesCallback(!err || finalAttempt, {err: err, result: result}); - }, wrappedResults); - }; - }; - while (times) { - attempts.push(retryAttempt(task, !(times-=1))); - } - async.series(attempts, function(done, data){ - data = data[data.length - 1]; - (wrappedCallback || callback)(data.err, data.result); - }); - } - // If a callback is passed, run this as a controll flow - return callback ? wrappedTask() : wrappedTask - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (!_isArray(tasks)) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback.apply(null, arguments); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.setImmediate(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - var _parallel = function(eachfn, tasks, callback) { - callback = callback || function () {}; - if (_isArray(tasks)) { - eachfn.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - eachfn.each(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.parallel = function (tasks, callback) { - _parallel({ map: async.map, each: async.each }, tasks, callback); - }; - - async.parallelLimit = function(tasks, limit, callback) { - _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback); - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (_isArray(tasks)) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.eachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doWhilst = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - var args = Array.prototype.slice.call(arguments, 1); - if (test.apply(null, args)) { - async.doWhilst(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doUntil = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - var args = Array.prototype.slice.call(arguments, 1); - if (!test.apply(null, args)) { - async.doUntil(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.queue = function (worker, concurrency) { - if (concurrency === undefined) { - concurrency = 1; - } - function _insert(q, data, pos, callback) { - if (!q.started){ - q.started = true; - } - if (!_isArray(data)) { - data = [data]; - } - if(data.length == 0) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - if (q.drain) { - q.drain(); - } - }); - } - _each(data, function(task) { - var item = { - data: task, - callback: typeof callback === 'function' ? callback : null - }; - - if (pos) { - q.tasks.unshift(item); - } else { - q.tasks.push(item); - } - - if (q.saturated && q.tasks.length === q.concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - started: false, - paused: false, - push: function (data, callback) { - _insert(q, data, false, callback); - }, - kill: function () { - q.drain = null; - q.tasks = []; - }, - unshift: function (data, callback) { - _insert(q, data, true, callback); - }, - process: function () { - if (!q.paused && workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if (q.empty && q.tasks.length === 0) { - q.empty(); - } - workers += 1; - var next = function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if (q.drain && q.tasks.length + workers === 0) { - q.drain(); - } - q.process(); - }; - var cb = only_once(next); - worker(task.data, cb); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - }, - idle: function() { - return q.tasks.length + workers === 0; - }, - pause: function () { - if (q.paused === true) { return; } - q.paused = true; - q.process(); - }, - resume: function () { - if (q.paused === false) { return; } - q.paused = false; - q.process(); - } - }; - return q; - }; - - async.priorityQueue = function (worker, concurrency) { - - function _compareTasks(a, b){ - return a.priority - b.priority; - }; - - function _binarySearch(sequence, item, compare) { - var beg = -1, - end = sequence.length - 1; - while (beg < end) { - var mid = beg + ((end - beg + 1) >>> 1); - if (compare(item, sequence[mid]) >= 0) { - beg = mid; - } else { - end = mid - 1; - } - } - return beg; - } - - function _insert(q, data, priority, callback) { - if (!q.started){ - q.started = true; - } - if (!_isArray(data)) { - data = [data]; - } - if(data.length == 0) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - if (q.drain) { - q.drain(); - } - }); - } - _each(data, function(task) { - var item = { - data: task, - priority: priority, - callback: typeof callback === 'function' ? callback : null - }; - - q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); - - if (q.saturated && q.tasks.length === q.concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - // Start with a normal queue - var q = async.queue(worker, concurrency); - - // Override push to accept second parameter representing priority - q.push = function (data, priority, callback) { - _insert(q, data, priority, callback); - }; - - // Remove unshift function - delete q.unshift; - - return q; - }; - - async.cargo = function (worker, payload) { - var working = false, - tasks = []; - - var cargo = { - tasks: tasks, - payload: payload, - saturated: null, - empty: null, - drain: null, - drained: true, - push: function (data, callback) { - if (!_isArray(data)) { - data = [data]; - } - _each(data, function(task) { - tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - cargo.drained = false; - if (cargo.saturated && tasks.length === payload) { - cargo.saturated(); - } - }); - async.setImmediate(cargo.process); - }, - process: function process() { - if (working) return; - if (tasks.length === 0) { - if(cargo.drain && !cargo.drained) cargo.drain(); - cargo.drained = true; - return; - } - - var ts = typeof payload === 'number' - ? tasks.splice(0, payload) - : tasks.splice(0, tasks.length); - - var ds = _map(ts, function (task) { - return task.data; - }); - - if(cargo.empty) cargo.empty(); - working = true; - worker(ds, function () { - working = false; - - var args = arguments; - _each(ts, function (data) { - if (data.callback) { - data.callback.apply(null, args); - } - }); - - process(); - }); - }, - length: function () { - return tasks.length; - }, - running: function () { - return working; - } - }; - return cargo; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _each(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - async.nextTick(function () { - callback.apply(null, memo[key]); - }); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; - - async.times = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.map(counter, iterator, callback); - }; - - async.timesSeries = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.mapSeries(counter, iterator, callback); - }; - - async.seq = function (/* functions... */) { - var fns = arguments; - return function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([function () { - var err = arguments[0]; - var nextargs = Array.prototype.slice.call(arguments, 1); - cb(err, nextargs); - }])) - }, - function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }; - }; - - async.compose = function (/* functions... */) { - return async.seq.apply(null, Array.prototype.reverse.call(arguments)); - }; - - var _applyEach = function (eachfn, fns /*args...*/) { - var go = function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - return eachfn(fns, function (fn, cb) { - fn.apply(that, args.concat([cb])); - }, - callback); - }; - if (arguments.length > 2) { - var args = Array.prototype.slice.call(arguments, 2); - return go.apply(this, args); - } - else { - return go; - } - }; - async.applyEach = doParallel(_applyEach); - async.applyEachSeries = doSeries(_applyEach); - - async.forever = function (fn, callback) { - function next(err) { - if (err) { - if (callback) { - return callback(err); - } - throw err; - } - fn(next); - } - next(); - }; - - // Node.js - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - // AMD / RequireJS - else if (typeof define !== 'undefined' && define.amd) { - define([], function () { - return async; - }); - } - // included directly via - - - - - -``` - -A simple example of how to use BSON in `node.js`: - -```javascript -var bson = require("bson"); -var BSON = new bson.BSONPure.BSON(); -var Long = bson.BSONPure.Long; - -var doc = {long: Long.fromNumber(100)} - -// Serialize a document -var data = BSON.serialize(doc, false, true, false); -console.log("data:", data); - -// Deserialize the resulting Buffer -var doc_2 = BSON.deserialize(data); -console.log("doc_2:", doc_2); -``` - -The API consists of two simple methods to serialize/deserialize objects to/from BSON format: - - * BSON.serialize(object, checkKeys, asBuffer, serializeFunctions) - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)** - * @return {TypedArray/Array} returns a TypedArray or Array depending on what your browser supports - - * BSON.deserialize(buffer, options, isArray) - * Options - * **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * **promoteBuffers** {Boolean, default:false}, deserialize Binary data directly into node.js Buffer object. - * @param {TypedArray/Array} a TypedArray/Array containing the BSON data - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. diff --git a/Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js b/Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js deleted file mode 100644 index 555aa797..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js +++ /dev/null @@ -1,1574 +0,0 @@ -var Long = require('../lib/bson/long').Long - , Double = require('../lib/bson/double').Double - , Timestamp = require('../lib/bson/timestamp').Timestamp - , ObjectID = require('../lib/bson/objectid').ObjectID - , Symbol = require('../lib/bson/symbol').Symbol - , Code = require('../lib/bson/code').Code - , MinKey = require('../lib/bson/min_key').MinKey - , MaxKey = require('../lib/bson/max_key').MaxKey - , DBRef = require('../lib/bson/db_ref').DBRef - , Binary = require('../lib/bson/binary').Binary - , BinaryParser = require('../lib/bson/binary_parser').BinaryParser - , writeIEEE754 = require('../lib/bson/float_parser').writeIEEE754 - , readIEEE754 = require('../lib/bson/float_parser').readIEEE754 - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -/** - * Create a new BSON instance - * - * @class - * @return {BSON} instance of BSON Parser. - */ -function BSON () {}; - -/** - * @ignore - * @api private - */ -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_UNDEFINED - **/ -BSON.BSON_DATA_UNDEFINED = 6; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.calculateObjectSize = function calculateObjectSize(object, serializeFunctions) { - var totalLength = (4 + 1); - - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - totalLength += calculateElement(i.toString(), object[i], serializeFunctions) - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Calculate size - for(var key in object) { - totalLength += calculateElement(key, object[key], serializeFunctions) - } - } - - return totalLength; -} - -/** - * @ignore - * @api private - */ -function calculateElement(name, value, serializeFunctions) { - var isBuffer = typeof Buffer !== 'undefined'; - - // If we have toBSON defined, override the current object - if(value && value.toBSON){ - value = value.toBSON(); - } - - switch(typeof value) { - case 'string': - return 1 + (!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1 + 4 + (!isBuffer ? numberOfBytes(value) : Buffer.byteLength(value, 'utf8')) + 1; - case 'number': - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (4 + 1); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - } else { // 64 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - case 'undefined': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - case 'boolean': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 1); - case 'object': - if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (12 + 1); - } else if(value instanceof Date || isDate(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 4 + 1) + value.length; - } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp - || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - // Calculate size depending on the availability of a scope - if(value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Check what kind of subtype we have - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1 + 4); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1); - } - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + ((!isBuffer ? numberOfBytes(value.value) : Buffer.byteLength(value.value, 'utf8')) + 4 + 1 + 1); - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + BSON.calculateObjectSize(ordered_values, serializeFunctions); - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + BSON.calculateObjectSize(value, serializeFunctions) + 1; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else if(serializeFunctions) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1; - } - } - } - - return 0; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.serializeWithBufferAndIndex = function serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) { - // Default setting false - serializeFunctions = serializeFunctions == null ? false : serializeFunctions; - // Write end information (length of the object) - var size = buffer.length; - // Write the size of the object - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return serializeObject(object, checkKeys, buffer, index, serializeFunctions) - 1; -} - -/** - * @ignore - * @api private - */ -var serializeObject = function(object, checkKeys, buffer, index, serializeFunctions) { - if(object.toBSON) { - if(typeof object.toBSON != 'function') throw new Error("toBSON is not a function"); - object = object.toBSON(); - if(object != null && typeof object != 'object') throw new Error("toBSON function did not return an object"); - } - - // Process the object - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - index = packElement(i.toString(), object[i], checkKeys, buffer, index, serializeFunctions); - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Serialize the object - for(var key in object) { - // Check the key and throw error if it's illegal - if (key != '$db' && key != '$ref' && key != '$id') { - // dollars and dots ok - BSON.checkKey(key, !checkKeys); - } - - // Pack the element - index = packElement(key, object[key], checkKeys, buffer, index, serializeFunctions); - } - } - - // Write zero - buffer[index++] = 0; - return index; -} - -var stringToBytes = function(str) { - var ch, st, re = []; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re.concat( st.reverse() ); - } - // return an array of bytes - return re; -} - -var numberOfBytes = function(str) { - var ch, st, re = 0; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re + st.length; - } - // return an array of bytes - return re; -} - -/** - * @ignore - * @api private - */ -var writeToTypedArray = function(buffer, string, index) { - var bytes = stringToBytes(string); - for(var i = 0; i < bytes.length; i++) { - buffer[index + i] = bytes[i]; - } - return bytes.length; -} - -/** - * @ignore - * @api private - */ -var supportsBuffer = typeof Buffer != 'undefined'; - -/** - * @ignore - * @api private - */ -var packElement = function(name, value, checkKeys, buffer, index, serializeFunctions) { - - // If we have toBSON defined, override the current object - if(value && value.toBSON){ - value = value.toBSON(); - } - - var startIndex = index; - - switch(typeof value) { - case 'string': - // console.log("+++++++++++ index string:: " + index) - // Encode String type - buffer[index++] = BSON.BSON_DATA_STRING; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value) + 1 : numberOfBytes(value) + 1; - // console.log("====== key :: " + name + " size ::" + size) - // Write the size of the string to buffer - buffer[index + 3] = (size >> 24) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index] = size & 0xff; - // Ajust the index - index = index + 4; - // Write the string - supportsBuffer ? buffer.write(value, index, 'utf8') : writeToTypedArray(buffer, value, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - // Return index - return index; - case 'number': - // We have an integer value - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // If the value fits in 32 bits encode as int, if it fits in a double - // encode it as a double, otherwise long - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { - // Set int type 32 bits or less - buffer[index++] = BSON.BSON_DATA_INT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the int value - buffer[index++] = value & 0xff; - buffer[index++] = (value >> 8) & 0xff; - buffer[index++] = (value >> 16) & 0xff; - buffer[index++] = (value >> 24) & 0xff; - } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } else { - // Set long type - buffer[index++] = BSON.BSON_DATA_LONG; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var longVal = Long.fromNumber(value); - var lowBits = longVal.getLowBits(); - var highBits = longVal.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - } - } else { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } - - return index; - case 'undefined': - // Set long type - buffer[index++] = BSON.BSON_DATA_NULL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - case 'boolean': - // Write the type - buffer[index++] = BSON.BSON_DATA_BOOLEAN; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; - case 'object': - if(value === null || value instanceof MinKey || value instanceof MaxKey - || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - // Write the type of either min or max key - if(value === null) { - buffer[index++] = BSON.BSON_DATA_NULL; - } else if(value instanceof MinKey) { - buffer[index++] = BSON.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = BSON.BSON_DATA_MAX_KEY; - } - - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - // console.log("+++++++++++ index OBJECTID:: " + index) - // Write the type - buffer[index++] = BSON.BSON_DATA_OID; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write objectid - supportsBuffer ? buffer.write(value.id, index, 'binary') : writeToTypedArray(buffer, value.id, index); - // Ajust index - index = index + 12; - return index; - } else if(value instanceof Date || isDate(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_DATE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the date - var dateInMilis = Long.fromNumber(value.getTime()); - var lowBits = dateInMilis.getLowBits(); - var highBits = dateInMilis.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Get size of the buffer (current write point) - var size = value.length; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the default subtype - buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - value.copy(buffer, index, 0, size); - // Adjust the index - index = index + size; - return index; - } else if(value instanceof Long || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - // Write the type - buffer[index++] = value instanceof Long || value['_bsontype'] == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the date - var lowBits = value.getLowBits(); - var highBits = value.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(value instanceof Double || value['_bsontype'] == 'Double') { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - return index; - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - if(value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.code.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize + 4; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = supportsBuffer ? new Buffer(scopeSize) : new Uint8Array(new ArrayBuffer(scopeSize)); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - supportsBuffer ? scopeObjectBuffer.copy(buffer, index, 0, scopeSize) : buffer.set(scopeObjectBuffer, index); - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.code.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Extract the buffer - var data = value.value(true); - // Calculate size - var size = value.position; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - - // If we have binary type 2 the 4 first bytes are the size - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - } - - // Write the data to the object - supportsBuffer ? data.copy(buffer, index, 0, value.position) : buffer.set(data, index); - // Ajust index - index = index + value.position; - return index; - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - // Write the type - buffer[index++] = BSON.BSON_DATA_SYMBOL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value.value) + 1 : numberOfBytes(value.value) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - buffer.write(value.value, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0x00; - return index; - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - // Message size - var size = BSON.calculateObjectSize(ordered_values, serializeFunctions); - // Serialize the object - var endIndex = BSON.serializeWithBufferAndIndex(ordered_values, checkKeys, buffer, index, serializeFunctions); - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write zero for object - buffer[endIndex++] = 0x00; - // Return the end index - return endIndex; - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - supportsBuffer ? buffer.write(value.source, index, 'utf8') : writeToTypedArray(buffer, value.source, index); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - // Write the type - buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Adjust the index - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var endIndex = serializeObject(value, checkKeys, buffer, index + 4, serializeFunctions); - // Write size - var size = endIndex - index; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return endIndex; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - buffer.write(value.source, index, 'utf8'); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = new Buffer(scopeSize); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize - 4; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - scopeObjectBuffer.copy(buffer, index, 0, scopeSize); - - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else if(serializeFunctions) { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } - } - - // If no value to serialize - return index; -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - // Throw error if we are trying serialize an illegal type - if(object == null || typeof object != 'object' || Array.isArray(object)) - throw new Error("Only javascript objects supported"); - - // Emoty target buffer - var buffer = null; - // Calculate the size of the object - var size = BSON.calculateObjectSize(object, serializeFunctions); - // Fetch the best available type for storing the binary data - if(buffer = typeof Buffer != 'undefined') { - buffer = new Buffer(size); - asBuffer = true; - } else if(typeof Uint8Array != 'undefined') { - buffer = new Uint8Array(new ArrayBuffer(size)); - } else { - buffer = new Array(size); - } - - // If asBuffer is false use typed arrays - BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, 0, serializeFunctions); - // console.log("++++++++++++++++++++++++++++++++++++ OLDJS :: " + buffer.length) - // console.log(buffer.toString('hex')) - // console.log(buffer.toString('ascii')) - return buffer; -} - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Crc state variables shared by function - * - * @ignore - * @api private - */ -var 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]; - -/** - * CRC32 hash method, Fast and enough versitility for our usage - * - * @ignore - * @api private - */ -var crc32 = function(string, start, end) { - var crc = 0 - var x = 0; - var y = 0; - crc = crc ^ (-1); - - for(var i = start, iTop = end; i < iTop;i++) { - y = (crc ^ string[i]) & 0xFF; - x = table[y]; - crc = (crc >>> 8) ^ x; - } - - return crc ^ (-1); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); - options = options != null ? options : {}; - var index = startIndex; - // Loop over all documents - for(var i = 0; i < numberOfDocuments; i++) { - // Find size of the document - var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; - // Update options with index - options['index'] = index; - // Parse the document at this point - documents[docStartIndex + i] = BSON.deserialize(data, options); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEvalWithHash = function(functionCache, hash, functionString, object) { - // Contains the value we are going to set - var value = null; - - // Check for cache hit, eval if missing and return cached function - if(functionCache[hash] == null) { - eval("value = " + functionString); - functionCache[hash] = value; - } - // Set the object - return functionCache[hash].bind(object); -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEval = function(functionString) { - // Contains the value we are going to set - var value = null; - // Eval the function - eval("value = " + functionString); - return value; -} - -/** - * Convert Uint8Array to String - * - * @ignore - * @api private - */ -var convertUint8ArrayToUtf8String = function(byteArray, startIndex, endIndex) { - return BinaryParser.decode_utf8(convertArraytoUtf8BinaryString(byteArray, startIndex, endIndex)); -} - -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - - return result; -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.deserialize = function(buffer, options, isArray) { - // Options - options = options == null ? {} : options; - var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; - var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; - var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; - var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs']; - - // Validate that we have at least 4 bytes of buffer - if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); - - // Set up index - var index = typeof options['index'] == 'number' ? options['index'] : 0; - // Reads in a C style string - var readCStyleString = function() { - // Get the start search index - var i = index; - // Locate the end of the c string - while(buffer[i] !== 0x00 && i < buffer.length) { - i++ - } - // If are at the end of the buffer there is a problem with the document - if(i >= buffer.length) throw new Error("Bad BSON Document: illegal CString") - // Grab utf8 encoded string - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, i) : convertUint8ArrayToUtf8String(buffer, index, i); - // Update index position - index = i + 1; - // Return string - return string; - } - - // Create holding object - var object = isArray ? [] : {}; - - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || size > buffer.length) throw new Error("corrupt bson message"); - - // While we have more left data left keep parsing - while(true) { - // Read the type - var elementType = buffer[index++]; - // If we get a zero it's the last byte, exit - if(elementType == 0) break; - // Read the name of the field - var name = readCStyleString(); - // Switch on the type - switch(elementType) { - case BSON.BSON_DATA_OID: - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('binary', index, index + 12) : convertArraytoUtf8BinaryString(buffer, index, index + 12); - // Decode the oid - object[name] = new ObjectID(string); - // Update index - index = index + 12; - break; - case BSON.BSON_DATA_STRING: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_INT: - // Decode the 32bit value - object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - break; - case BSON.BSON_DATA_NUMBER: - // Decode the double value - object[name] = readIEEE754(buffer, index, 'little', 52, 8); - // Update the index - index = index + 8; - break; - case BSON.BSON_DATA_DATE: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set date object - object[name] = new Date(new Long(lowBits, highBits).toNumber()); - break; - case BSON.BSON_DATA_BOOLEAN: - // Parse the boolean value - object[name] = buffer[index++] == 1; - break; - case BSON.BSON_DATA_UNDEFINED: - case BSON.BSON_DATA_NULL: - // Parse the boolean value - object[name] = null; - break; - case BSON.BSON_DATA_BINARY: - // Decode the size of the binary blob - var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Decode the subtype - var subType = buffer[index++]; - // Decode as raw Buffer object if options specifies it - if(buffer['slice'] != null) { - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Slice the data - object[name] = new Binary(buffer.slice(index, index + binarySize), subType); - } else { - var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize); - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Copy the data - for(var i = 0; i < binarySize; i++) { - _buffer[i] = buffer[index + i]; - } - // Create the binary object - object[name] = new Binary(_buffer, subType); - } - // Update the index - index = index + binarySize; - break; - case BSON.BSON_DATA_ARRAY: - options['index'] = index; - // Decode the size of the array document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, true); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_OBJECT: - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_REGEXP: - // Create the regexp - var source = readCStyleString(); - var regExpOptions = readCStyleString(); - // For each option add the corresponding one for javascript - var optionsArray = new Array(regExpOptions.length); - - // Parse options - for(var i = 0; i < regExpOptions.length; i++) { - switch(regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - object[name] = new RegExp(source, optionsArray.join('')); - break; - case BSON.BSON_DATA_LONG: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Create long object - var long = new Long(lowBits, highBits); - // Promote the long if possible - if(promoteLongs) { - object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; - } else { - object[name] = long; - } - break; - case BSON.BSON_DATA_SYMBOL: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_TIMESTAMP: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set the object - object[name] = new Timestamp(lowBits, highBits); - break; - case BSON.BSON_DATA_MIN_KEY: - // Parse the object - object[name] = new MinKey(); - break; - case BSON.BSON_DATA_MAX_KEY: - // Parse the object - object[name] = new MaxKey(); - break; - case BSON.BSON_DATA_CODE: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Function string - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - } else { - object[name] = new Code(functionString, {}); - } - - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_CODE_W_SCOPE: - // Read the content of the field - var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Javascript function - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - // Parse the element - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Decode the scope object - var scopeObject = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - - // Set the scope on the object - object[name].scope = scopeObject; - } else { - object[name] = new Code(functionString, scopeObject); - } - - // Add string to object - break; - } - } - - // Check if we have a db ref object - if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); - - // Return the final objects - return object; -} - -/** - * Check if key name is valid. - * - * @ignore - * @api private - */ -BSON.checkKey = function checkKey (key, dollarsAndDotsOk) { - if (!key.length) return; - // Check if we have a legal key for the object - if (!!~key.indexOf("\x00")) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - if (!dollarsAndDotsOk) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.prototype.deserialize = function(data, options) { - return BSON.deserialize(data, options); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - return BSON.deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options); -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.prototype.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - return BSON.serialize(object, checkKeys, asBuffer, serializeFunctions); -} - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.prototype.calculateObjectSize = function(object, serializeFunctions) { - return BSON.calculateObjectSize(object, serializeFunctions); -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, buffer, startIndex, serializeFunctions) { - return BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, startIndex, serializeFunctions); -} - -/** - * @ignore - * @api private - */ -module.exports = BSON; -module.exports.Code = Code; -module.exports.Symbol = Symbol; -module.exports.BSON = BSON; -module.exports.DBRef = DBRef; -module.exports.Binary = Binary; -module.exports.ObjectID = ObjectID; -module.exports.Long = Long; -module.exports.Timestamp = Timestamp; -module.exports.Double = Double; -module.exports.MinKey = MinKey; -module.exports.MaxKey = MaxKey; diff --git a/Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js b/Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js deleted file mode 100644 index f19e44fb..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js +++ /dev/null @@ -1,429 +0,0 @@ -/// reduced to ~ 410 LOCs (parser only 300 vs. 1400+) with (some, needed) BSON classes "inlined". -/// Compare ~ 4,300 (22KB vs. 157KB) in browser build at: https://github.com/mongodb/js-bson/blob/master/browser_build/bson.js - -module.exports.calculateObjectSize = calculateObjectSize; - -function calculateObjectSize(object) { - var totalLength = (4 + 1); /// handles the obj.length prefix + terminating '0' ?! - for(var key in object) { /// looks like it handles arrays under the same for...in loop!? - totalLength += calculateElement(key, object[key]) - } - return totalLength; -} - -function calculateElement(name, value) { - var len = 1; /// always starting with 1 for the data type byte! - if (name) len += Buffer.byteLength(name, 'utf8') + 1; /// cstring: name + '0' termination - - if (value === undefined || value === null) return len; /// just the type byte plus name cstring - switch( value.constructor ) { /// removed all checks 'isBuffer' if Node.js Buffer class is present!? - - case ObjectID: /// we want these sorted from most common case to least common/deprecated; - return len + 12; - case String: - return len + 4 + Buffer.byteLength(value, 'utf8') +1; /// - case Number: - if (Math.floor(value) === value) { /// case: integer; pos.# more common, '&&' stops if 1st fails! - if ( value <= 2147483647 && value >= -2147483647 ) // 32 bit - return len + 4; - else return len + 8; /// covers Long-ish JS integers as Longs! - } else return len + 8; /// 8+1 --- covers Double & std. float - case Boolean: - return len + 1; - - case Array: - case Object: - return len + calculateObjectSize(value); - - case Buffer: /// replaces the entire Binary class! - return len + 4 + value.length + 1; - - case Regex: /// these are handled as strings by serializeFast() later, hence 'gim' opts = 3 + 1 chars - return len + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) +1; - case Date: - case Long: - case Timestamp: - case Double: - return len + 8; - - case MinKey: - case MaxKey: - return len; /// these two return the type byte and name cstring only! - } - return 0; -} - -module.exports.serializeFast = serializeFast; -module.exports.serialize = function(object, checkKeys, asBuffer, serializeFunctions, index) { - var buffer = new Buffer(calculateObjectSize(object)); - return serializeFast(object, checkKeys, buffer, 0); -} - -function serializeFast(object, checkKeys, buffer, i) { /// set checkKeys = false in query(..., options object to save performance IFF you're certain your keys are safe/system-set! - var size = buffer.length; - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; /// these get overwritten later! - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - - if (object.constructor === Array) { /// any need to checkKeys here?!? since we're doing for rather than for...in, should be safe from extra (non-numeric) keys added to the array?! - for(var j = 0; j < object.length; j++) { - i = packElement(j.toString(), object[j], checkKeys, buffer, i); - } - } else { /// checkKeys is needed if any suspicion of end-user key tampering/"injection" (a la SQL) - for(var key in object) { /// mostly there should never be direct access to them!? - if (checkKeys && (key.indexOf('\x00') >= 0 || key === '$where') ) { /// = "no script"?!; could add back key.indexOf('$') or maybe check for 'eval'?! -/// took out: || key.indexOf('.') >= 0... Don't we allow dot notation queries?! - console.log('checkKeys error: '); - return new Error('Illegal object key!'); - } - i = packElement(key, object[key], checkKeys, buffer, i); /// checkKeys pass needed for recursion! - } - } - buffer[i++] = 0; /// write terminating zero; !we do NOT -1 the index increase here as original does! - return i; -} - -function packElement(name, value, checkKeys, buffer, i) { /// serializeFunctions removed! checkKeys needed for Array & Object cases pass through (calling serializeFast recursively!) - if (value === undefined || value === null){ - buffer[i++] = 10; /// = BSON.BSON_DATA_NULL; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; /// buffer.write(...) returns bytesWritten! - return i; - } - switch(value.constructor) { - - case ObjectID: - buffer[i++] = 7; /// = BSON.BSON_DATA_OID; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; -/// i += buffer.write(value.id, i, 'binary'); /// OLD: writes a String to a Buffer; 'binary' deprecated!! - value.id.copy(buffer, i); /// NEW ObjectID version has this.id = Buffer at the ready! - return i += 12; - - case String: - buffer[i++] = 2; /// = BSON.BSON_DATA_STRING; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - - var size = Buffer.byteLength(value) + 1; /// includes the terminating '0'!? - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - - i += buffer.write(value, i, 'utf8'); buffer[i++] = 0; - return i; - - case Number: - if ( ~~(value) === value) { /// double-Tilde is equiv. to Math.floor(value) - if ( value <= 2147483647 && value >= -2147483647){ /// = BSON.BSON_INT32_MAX / MIN asf. - buffer[i++] = 16; /// = BSON.BSON_DATA_INT; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - buffer[i++] = value & 0xff; buffer[i++] = (value >> 8) & 0xff; - buffer[i++] = (value >> 16) & 0xff; buffer[i++] = (value >> 24) & 0xff; - -// Else large-ish JS int!? to Long!? - } else { /// if (value <= BSON.JS_INT_MAX && value >= BSON.JS_INT_MIN){ /// 9007199254740992 asf. - buffer[i++] = 18; /// = BSON.BSON_DATA_LONG; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var lowBits = ( value % 4294967296 ) | 0, highBits = ( value / 4294967296 ) | 0; - - buffer[i++] = lowBits & 0xff; buffer[i++] = (lowBits >> 8) & 0xff; - buffer[i++] = (lowBits >> 16) & 0xff; buffer[i++] = (lowBits >> 24) & 0xff; - buffer[i++] = highBits & 0xff; buffer[i++] = (highBits >> 8) & 0xff; - buffer[i++] = (highBits >> 16) & 0xff; buffer[i++] = (highBits >> 24) & 0xff; - } - } else { /// we have a float / Double - buffer[i++] = 1; /// = BSON.BSON_DATA_NUMBER; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; -/// OLD: writeIEEE754(buffer, value, i, 'little', 52, 8); - buffer.writeDoubleLE(value, i); i += 8; - } - return i; - - case Boolean: - buffer[i++] = 8; /// = BSON.BSON_DATA_BOOLEAN; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - buffer[i++] = value ? 1 : 0; - return i; - - case Array: - case Object: - buffer[i++] = value.constructor === Array ? 4 : 3; /// = BSON.BSON_DATA_ARRAY / _OBJECT; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - - var endIndex = serializeFast(value, checkKeys, buffer, i); /// + 4); no longer needed b/c serializeFast writes a temp 4 bytes for length - var size = endIndex - i; - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - return endIndex; - - /// case Binary: /// is basically identical unless special/deprecated options! - case Buffer: /// solves ALL of our Binary needs without the BSON.Binary class!? - buffer[i++] = 5; /// = BSON.BSON_DATA_BINARY; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var size = value.length; - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - - buffer[i++] = 0; /// write BSON.BSON_BINARY_SUBTYPE_DEFAULT; - value.copy(buffer, i); ///, 0, size); << defaults to sourceStart=0, sourceEnd=sourceBuffer.length); - i += size; - return i; - - case RegExp: - buffer[i++] = 11; /// = BSON.BSON_DATA_REGEXP; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - i += buffer.write(value.source, i, 'utf8'); buffer[i++] = 0x00; - - if (value.global) buffer[i++] = 0x73; // s = 'g' for JS Regex! - if (value.ignoreCase) buffer[i++] = 0x69; // i - if (value.multiline) buffer[i++] = 0x6d; // m - buffer[i++] = 0x00; - return i; - - case Date: - buffer[i++] = 9; /// = BSON.BSON_DATA_DATE; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var millis = value.getTime(); - var lowBits = ( millis % 4294967296 ) | 0, highBits = ( millis / 4294967296 ) | 0; - - buffer[i++] = lowBits & 0xff; buffer[i++] = (lowBits >> 8) & 0xff; - buffer[i++] = (lowBits >> 16) & 0xff; buffer[i++] = (lowBits >> 24) & 0xff; - buffer[i++] = highBits & 0xff; buffer[i++] = (highBits >> 8) & 0xff; - buffer[i++] = (highBits >> 16) & 0xff; buffer[i++] = (highBits >> 24) & 0xff; - return i; - - case Long: - case Timestamp: - buffer[i++] = value.constructor === Long ? 18 : 17; /// = BSON.BSON_DATA_LONG / _TIMESTAMP - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var lowBits = value.getLowBits(), highBits = value.getHighBits(); - - buffer[i++] = lowBits & 0xff; buffer[i++] = (lowBits >> 8) & 0xff; - buffer[i++] = (lowBits >> 16) & 0xff; buffer[i++] = (lowBits >> 24) & 0xff; - buffer[i++] = highBits & 0xff; buffer[i++] = (highBits >> 8) & 0xff; - buffer[i++] = (highBits >> 16) & 0xff; buffer[i++] = (highBits >> 24) & 0xff; - return i; - - case Double: - buffer[i++] = 1; /// = BSON.BSON_DATA_NUMBER; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; -/// OLD: writeIEEE754(buffer, value, i, 'little', 52, 8); i += 8; - buffer.writeDoubleLE(value, i); i += 8; - return i - - case MinKey: /// = BSON.BSON_DATA_MINKEY; - buffer[i++] = 127; i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - return i; - case MaxKey: /// = BSON.BSON_DATA_MAXKEY; - buffer[i++] = 255; i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - return i; - - } /// end of switch - return i; /// ?! If no value to serialize -} - - -module.exports.deserializeFast = deserializeFast; - -function deserializeFast(buffer, i, isArray){ //// , options, isArray) { //// no more options! - if (buffer.length < 5) return new Error('Corrupt bson message < 5 bytes long'); /// from 'throw' - var elementType, tempindex = 0, name; - var string, low, high; /// = lowBits / highBits - /// using 'i' as the index to keep the lines shorter: - i || ( i = 0 ); /// for parseResponse it's 0; set to running index in deserialize(object/array) recursion - var object = isArray ? [] : {}; /// needed for type ARRAY recursion later! - var size = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - if(size < 5 || size > buffer.length) return new Error('Corrupt BSON message'); -/// 'size' var was not used by anything after this, so we can reuse it - - while(true) { // While we have more left data left keep parsing - elementType = buffer[i++]; // Read the type - if (elementType === 0) break; // If we get a zero it's the last byte, exit - - tempindex = i; /// inlined readCStyleString & removed extra i= buffer.length) return new Error('Corrupt BSON document: illegal CString') - name = buffer.toString('utf8', i, tempindex); - i = tempindex + 1; /// Update index position to after the string + '0' termination - - switch(elementType) { - - case 7: /// = BSON.BSON_DATA_OID: - var buf = new Buffer(12); - buffer.copy(buf, 0, i, i += 12 ); /// copy 12 bytes from the current 'i' offset into fresh Buffer - object[name] = new ObjectID(buf); ///... & attach to the new ObjectID instance - break; - - case 2: /// = BSON.BSON_DATA_STRING: - size = buffer[i++] | buffer[i++] <<8 | buffer[i++] <<16 | buffer[i++] <<24; - object[name] = buffer.toString('utf8', i, i += size -1 ); - i++; break; /// need to get the '0' index "tick-forward" back! - - case 16: /// = BSON.BSON_DATA_INT: // Decode the 32bit value - object[name] = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; break; - - case 1: /// = BSON.BSON_DATA_NUMBER: // Decode the double value - object[name] = buffer.readDoubleLE(i); /// slightly faster depending on dec.points; a LOT cleaner - /// OLD: object[name] = readIEEE754(buffer, i, 'little', 52, 8); - i += 8; break; - - case 8: /// = BSON.BSON_DATA_BOOLEAN: - object[name] = buffer[i++] == 1; break; - - case 6: /// = BSON.BSON_DATA_UNDEFINED: /// deprecated - case 10: /// = BSON.BSON_DATA_NULL: - object[name] = null; break; - - case 4: /// = BSON.BSON_DATA_ARRAY - size = buffer[i] | buffer[i+1] <<8 | buffer[i+2] <<16 | buffer[i+3] <<24; /// NO 'i' increment since the size bytes are reread during the recursion! - object[name] = deserializeFast(buffer, i, true ); /// pass current index & set isArray = true - i += size; break; - case 3: /// = BSON.BSON_DATA_OBJECT: - size = buffer[i] | buffer[i+1] <<8 | buffer[i+2] <<16 | buffer[i+3] <<24; - object[name] = deserializeFast(buffer, i, false ); /// isArray = false => Object - i += size; break; - - case 5: /// = BSON.BSON_DATA_BINARY: // Decode the size of the binary blob - size = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - buffer[i++]; /// Skip, as we assume always default subtype, i.e. 0! - object[name] = buffer.slice(i, i += size); /// creates a new Buffer "slice" view of the same memory! - break; - - case 9: /// = BSON.BSON_DATA_DATE: /// SEE notes below on the Date type vs. other options... - low = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - high = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - object[name] = new Date( high * 4294967296 + (low < 0 ? low + 4294967296 : low) ); break; - - case 18: /// = BSON.BSON_DATA_LONG: /// usage should be somewhat rare beyond parseResponse() -> cursorId, where it is handled inline, NOT as part of deserializeFast(returnedObjects); get lowBits, highBits: - low = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - high = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - - size = high * 4294967296 + (low < 0 ? low + 4294967296 : low); /// from long.toNumber() - if (size < JS_INT_MAX && size > JS_INT_MIN) object[name] = size; /// positive # more likely! - else object[name] = new Long(low, high); break; - - case 127: /// = BSON.BSON_DATA_MIN_KEY: /// do we EVER actually get these BACK from MongoDB server?! - object[name] = new MinKey(); break; - case 255: /// = BSON.BSON_DATA_MAX_KEY: - object[name] = new MaxKey(); break; - - case 17: /// = BSON.BSON_DATA_TIMESTAMP: /// somewhat obscure internal BSON type; MongoDB uses it for (pseudo) high-res time timestamp (past millisecs precision is just a counter!) in the Oplog ts: field, etc. - low = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - high = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - object[name] = new Timestamp(low, high); break; - -/// case 11: /// = RegExp is skipped; we should NEVER be getting any from the MongoDB server!? - } /// end of switch(elementType) - } /// end of while(1) - return object; // Return the finalized object -} - - -function MinKey() { this._bsontype = 'MinKey'; } /// these are merely placeholders/stubs to signify the type!? - -function MaxKey() { this._bsontype = 'MaxKey'; } - -function Long(low, high) { - this._bsontype = 'Long'; - this.low_ = low | 0; this.high_ = high | 0; /// force into 32 signed bits. -} -Long.prototype.getLowBits = function(){ return this.low_; } -Long.prototype.getHighBits = function(){ return this.high_; } - -Long.prototype.toNumber = function(){ - return this.high_ * 4294967296 + (this.low_ < 0 ? this.low_ + 4294967296 : this.low_); -} -Long.fromNumber = function(num){ - return new Long(num % 4294967296, num / 4294967296); /// |0 is forced in the constructor! -} -function Double(value) { - this._bsontype = 'Double'; - this.value = value; -} -function Timestamp(low, high) { - this._bsontype = 'Timestamp'; - this.low_ = low | 0; this.high_ = high | 0; /// force into 32 signed bits. -} -Timestamp.prototype.getLowBits = function(){ return this.low_; } -Timestamp.prototype.getHighBits = function(){ return this.high_; } - -/////////////////////////////// ObjectID ///////////////////////////////// -/// machine & proc IDs stored as 1 string, b/c Buffer shouldn't be held for long periods (could use SlowBuffer?!) - -var MACHINE = parseInt(Math.random() * 0xFFFFFF, 10); -var PROCESS = process.pid % 0xFFFF; -var MACHINE_AND_PROC = encodeIntBE(MACHINE, 3) + encodeIntBE(PROCESS, 2); /// keep as ONE string, ready to go. - -function encodeIntBE(data, bytes){ /// encode the bytes to a string - var result = ''; - if (bytes >= 4){ result += String.fromCharCode(Math.floor(data / 0x1000000)); data %= 0x1000000; } - if (bytes >= 3){ result += String.fromCharCode(Math.floor(data / 0x10000)); data %= 0x10000; } - if (bytes >= 2){ result += String.fromCharCode(Math.floor(data / 0x100)); data %= 0x100; } - result += String.fromCharCode(Math.floor(data)); - return result; -} -var _counter = ~~(Math.random() * 0xFFFFFF); /// double-tilde is equivalent to Math.floor() -var checkForHex = new RegExp('^[0-9a-fA-F]{24}$'); - -function ObjectID(id) { - this._bsontype = 'ObjectID'; - if (!id){ this.id = createFromScratch(); /// base case, DONE. - } else { - if (id.constructor === Buffer){ - this.id = id; /// case of - } else if (id.constructor === String) { - if ( id.length === 24 && checkForHex.test(id) ) { - this.id = new Buffer(id, 'hex'); - } else { - this.id = new Error('Illegal/faulty Hexadecimal string supplied!'); /// changed from 'throw' - } - } else if (id.constructor === Number) { - this.id = createFromTime(id); /// this is what should be the only interface for this!? - } - } -} -function createFromScratch() { - var buf = new Buffer(12), i = 0; - var ts = ~~(Date.now()/1000); /// 4 bytes timestamp in seconds, BigEndian notation! - buf[i++] = (ts >> 24) & 0xFF; buf[i++] = (ts >> 16) & 0xFF; - buf[i++] = (ts >> 8) & 0xFF; buf[i++] = (ts) & 0xFF; - - buf.write(MACHINE_AND_PROC, i, 5, 'utf8'); i += 5; /// write 3 bytes + 2 bytes MACHINE_ID and PROCESS_ID - _counter = ++_counter % 0xFFFFFF; /// 3 bytes internal _counter for subsecond resolution; BigEndian - buf[i++] = (_counter >> 16) & 0xFF; - buf[i++] = (_counter >> 8) & 0xFF; - buf[i++] = (_counter) & 0xFF; - return buf; -} -function createFromTime(ts) { - ts || ( ts = ~~(Date.now()/1000) ); /// 4 bytes timestamp in seconds only - var buf = new Buffer(12), i = 0; - buf[i++] = (ts >> 24) & 0xFF; buf[i++] = (ts >> 16) & 0xFF; - buf[i++] = (ts >> 8) & 0xFF; buf[i++] = (ts) & 0xFF; - - for (;i < 12; ++i) buf[i] = 0x00; /// indeces 4 through 11 (8 bytes) get filled up with nulls - return buf; -} -ObjectID.prototype.toHexString = function toHexString() { - return this.id.toString('hex'); -} -ObjectID.prototype.getTimestamp = function getTimestamp() { - return this.id.readUIntBE(0, 4); -} -ObjectID.prototype.getTimestampDate = function getTimestampDate() { - var ts = new Date(); - ts.setTime(this.id.readUIntBE(0, 4) * 1000); - return ts; -} -ObjectID.createPk = function createPk () { ///?override if a PrivateKey factory w/ unique factors is warranted?! - return new ObjectID(); -} -ObjectID.prototype.toJSON = function toJSON() { - return "ObjectID('" +this.id.toString('hex')+ "')"; -} - -/// module.exports.BSON = BSON; /// not needed anymore!? exports.Binary = Binary; -module.exports.ObjectID = ObjectID; -module.exports.MinKey = MinKey; -module.exports.MaxKey = MaxKey; -module.exports.Long = Long; /// ?! we really don't want to do the complicated Long math anywhere for now!? - -//module.exports.Double = Double; -//module.exports.Timestamp = Timestamp; diff --git a/Associations/node_modules/mongoose/node_modules/bson/browser_build/bson.js b/Associations/node_modules/mongoose/node_modules/bson/browser_build/bson.js deleted file mode 100644 index 8e942dd4..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/browser_build/bson.js +++ /dev/null @@ -1,4843 +0,0 @@ -var bson = (function(){ - - var pkgmap = {}, - global = {}, - nativeRequire = typeof require != 'undefined' && require, - lib, ties, main, async; - - function exports(){ return main(); }; - - exports.main = exports; - exports.module = module; - exports.packages = pkgmap; - exports.pkg = pkg; - exports.require = function require(uri){ - return pkgmap.main.index.require(uri); - }; - - - ties = {}; - - aliases = {}; - - - return exports; - -function join() { - return normalize(Array.prototype.join.call(arguments, "/")); -}; - -function normalize(path) { - var ret = [], parts = path.split('/'), cur, prev; - - var i = 0, l = parts.length-1; - for (; i <= l; i++) { - cur = parts[i]; - - if (cur === "." && prev !== undefined) continue; - - if (cur === ".." && ret.length && prev !== ".." && prev !== "." && prev !== undefined) { - ret.pop(); - prev = ret.slice(-1)[0]; - } else { - if (prev === ".") ret.pop(); - ret.push(cur); - prev = cur; - } - } - - return ret.join("/"); -}; - -function dirname(path) { - return path && path.substr(0, path.lastIndexOf("/")) || "."; -}; - -function findModule(workingModule, uri){ - var moduleId = join(dirname(workingModule.id), /\.\/$/.test(uri) ? (uri + 'index') : uri ).replace(/\.js$/, ''), - moduleIndexId = join(moduleId, 'index'), - pkg = workingModule.pkg, - module; - - var i = pkg.modules.length, - id; - - while(i-->0){ - id = pkg.modules[i].id; - - if(id==moduleId || id == moduleIndexId){ - module = pkg.modules[i]; - break; - } - } - - return module; -} - -function newRequire(callingModule){ - function require(uri){ - var module, pkg; - - if(/^\./.test(uri)){ - module = findModule(callingModule, uri); - } else if ( ties && ties.hasOwnProperty( uri ) ) { - return ties[uri]; - } else if ( aliases && aliases.hasOwnProperty( uri ) ) { - return require(aliases[uri]); - } else { - pkg = pkgmap[uri]; - - if(!pkg && nativeRequire){ - try { - pkg = nativeRequire(uri); - } catch (nativeRequireError) {} - - if(pkg) return pkg; - } - - if(!pkg){ - throw new Error('Cannot find module "'+uri+'" @[module: '+callingModule.id+' package: '+callingModule.pkg.name+']'); - } - - module = pkg.index; - } - - if(!module){ - throw new Error('Cannot find module "'+uri+'" @[module: '+callingModule.id+' package: '+callingModule.pkg.name+']'); - } - - module.parent = callingModule; - return module.call(); - }; - - - return require; -} - - -function module(parent, id, wrapper){ - var mod = { pkg: parent, id: id, wrapper: wrapper }, - cached = false; - - mod.exports = {}; - mod.require = newRequire(mod); - - mod.call = function(){ - if(cached) { - return mod.exports; - } - - cached = true; - - global.require = mod.require; - - mod.wrapper(mod, mod.exports, global, global.require); - return mod.exports; - }; - - if(parent.mainModuleId == mod.id){ - parent.index = mod; - parent.parents.length === 0 && ( main = mod.call ); - } - - parent.modules.push(mod); -} - -function pkg(/* [ parentId ...], wrapper */){ - var wrapper = arguments[ arguments.length - 1 ], - parents = Array.prototype.slice.call(arguments, 0, arguments.length - 1), - ctx = wrapper(parents); - - - pkgmap[ctx.name] = ctx; - - arguments.length == 1 && ( pkgmap.main = ctx ); - - return function(modules){ - var id; - for(id in modules){ - module(ctx, id, modules[id]); - } - }; -} - - -}(this)); - -bson.pkg(function(parents){ - - return { - 'name' : 'bson', - 'mainModuleId' : 'bson', - 'modules' : [], - 'parents' : parents - }; - -})({ 'binary': function(module, exports, global, require, undefined){ - /** - * Module dependencies. - */ -if(typeof window === 'undefined') { - var Buffer = require('buffer').Buffer; // TODO just use global Buffer -} - -// Binary default subtype -var BSON_BINARY_SUBTYPE_DEFAULT = 0; - -/** - * @ignore - * @api private - */ -var writeStringToArray = function(data) { - // Create a buffer - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length); - // Write the content to the buffer - for(var i = 0; i < data.length; i++) { - buffer[i] = data.charCodeAt(i); - } - // Write the string to the buffer - return buffer; -} - -/** - * Convert Array ot Uint8Array to Binary String - * - * @ignore - * @api private - */ -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - return result; -}; - -/** - * A class representation of the BSON Binary type. - * - * Sub types - * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. - * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. - * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. - * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. - * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. - * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. - * - * @class Represents the Binary BSON type. - * @param {Buffer} buffer a buffer object containing the binary data. - * @param {Number} [subType] the option binary type. - * @return {Grid} - */ -function Binary(buffer, subType) { - if(!(this instanceof Binary)) return new Binary(buffer, subType); - - this._bsontype = 'Binary'; - - if(buffer instanceof Number) { - this.sub_type = buffer; - this.position = 0; - } else { - this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; - this.position = 0; - } - - if(buffer != null && !(buffer instanceof Number)) { - // Only accept Buffer, Uint8Array or Arrays - if(typeof buffer == 'string') { - // Different ways of writing the length of the string for the different types - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(buffer); - } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) { - this.buffer = writeStringToArray(buffer); - } else { - throw new Error("only String, Buffer, Uint8Array or Array accepted"); - } - } else { - this.buffer = buffer; - } - this.position = buffer.length; - } else { - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(Binary.BUFFER_SIZE); - } else if(typeof Uint8Array != 'undefined'){ - this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); - } else { - this.buffer = new Array(Binary.BUFFER_SIZE); - } - // Set position to start of buffer - this.position = 0; - } -}; - -/** - * Updates this binary with byte_value. - * - * @param {Character} byte_value a single byte we wish to write. - * @api public - */ -Binary.prototype.put = function put(byte_value) { - // If it's a string and a has more than one character throw an error - if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error("only accepts single character String, Uint8Array or Array"); - if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error("only accepts number in a valid unsigned byte range 0-255"); - - // Decode the byte value once - var decoded_byte = null; - if(typeof byte_value == 'string') { - decoded_byte = byte_value.charCodeAt(0); - } else if(byte_value['length'] != null) { - decoded_byte = byte_value[0]; - } else { - decoded_byte = byte_value; - } - - if(this.buffer.length > this.position) { - this.buffer[this.position++] = decoded_byte; - } else { - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - // Create additional overflow buffer - var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); - // Combine the two buffers together - this.buffer.copy(buffer, 0, 0, this.buffer.length); - this.buffer = buffer; - this.buffer[this.position++] = decoded_byte; - } else { - var buffer = null; - // Create a new buffer (typed or normal array) - if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length)); - } else { - buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); - } - - // We need to copy all the content to the new array - for(var i = 0; i < this.buffer.length; i++) { - buffer[i] = this.buffer[i]; - } - - // Reassign the buffer - this.buffer = buffer; - // Write the byte - this.buffer[this.position++] = decoded_byte; - } - } -}; - -/** - * Writes a buffer or string to the binary. - * - * @param {Buffer|String} string a string or buffer to be written to the Binary BSON object. - * @param {Number} offset specify the binary of where to write the content. - * @api public - */ -Binary.prototype.write = function write(string, offset) { - offset = typeof offset == 'number' ? offset : this.position; - - // If the buffer is to small let's extend the buffer - if(this.buffer.length < offset + string.length) { - var buffer = null; - // If we are in node.js - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - buffer = new Buffer(this.buffer.length + string.length); - this.buffer.copy(buffer, 0, 0, this.buffer.length); - } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - // Create a new buffer - buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length)) - // Copy the content - for(var i = 0; i < this.position; i++) { - buffer[i] = this.buffer[i]; - } - } - - // Assign the new buffer - this.buffer = buffer; - } - - if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) { - string.copy(this.buffer, offset, 0, string.length); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length - } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) { - this.buffer.write(string, 'binary', offset); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length; - } else if(Object.prototype.toString.call(string) == '[object Uint8Array]' - || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string[i]; - } - - this.position = offset > this.position ? offset : this.position; - } else if(typeof string == 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string.charCodeAt(i); - } - - this.position = offset > this.position ? offset : this.position; - } -}; - -/** - * Reads **length** bytes starting at **position**. - * - * @param {Number} position read from the given position in the Binary. - * @param {Number} length the number of bytes to read. - * @return {Buffer} - * @api public - */ -Binary.prototype.read = function read(position, length) { - length = length && length > 0 - ? length - : this.position; - - // Let's return the data based on the type we have - if(this.buffer['slice']) { - return this.buffer.slice(position, position + length); - } else { - // Create a buffer to keep the result - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length); - for(var i = 0; i < length; i++) { - buffer[i] = this.buffer[position++]; - } - } - // Return the buffer - return buffer; -}; - -/** - * Returns the value of this binary as a string. - * - * @return {String} - * @api public - */ -Binary.prototype.value = function value(asRaw) { - asRaw = asRaw == null ? false : asRaw; - - // If it's a node.js buffer object - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position); - } else { - if(asRaw) { - // we support the slice command use it - if(this.buffer['slice'] != null) { - return this.buffer.slice(0, this.position); - } else { - // Create a new buffer to copy content to - var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position); - // Copy content - for(var i = 0; i < this.position; i++) { - newBuffer[i] = this.buffer[i]; - } - // Return the buffer - return newBuffer; - } - } else { - return convertArraytoUtf8BinaryString(this.buffer, 0, this.position); - } - } -}; - -/** - * Length. - * - * @return {Number} the length of the binary. - * @api public - */ -Binary.prototype.length = function length() { - return this.position; -}; - -/** - * @ignore - * @api private - */ -Binary.prototype.toJSON = function() { - return this.buffer != null ? this.buffer.toString('base64') : ''; -} - -/** - * @ignore - * @api private - */ -Binary.prototype.toString = function(format) { - return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; -} - -Binary.BUFFER_SIZE = 256; - -/** - * Default BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_DEFAULT = 0; -/** - * Function BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_FUNCTION = 1; -/** - * Byte Array BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_BYTE_ARRAY = 2; -/** - * OLD UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID_OLD = 3; -/** - * UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID = 4; -/** - * MD5 BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_MD5 = 5; -/** - * User BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_USER_DEFINED = 128; - -/** - * Expose. - */ -exports.Binary = Binary; - - -}, - - - -'binary_parser': function(module, exports, global, require, undefined){ - /** - * Binary Parser. - * Jonas Raoni Soares Silva - * http://jsfromhell.com/classes/binary-parser [v1.0] - */ -var chr = String.fromCharCode; - -var maxBits = []; -for (var i = 0; i < 64; i++) { - maxBits[i] = Math.pow(2, i); -} - -function BinaryParser (bigEndian, allowExceptions) { - if(!(this instanceof BinaryParser)) return new BinaryParser(bigEndian, allowExceptions); - - this.bigEndian = bigEndian; - this.allowExceptions = allowExceptions; -}; - -BinaryParser.warn = function warn (msg) { - if (this.allowExceptions) { - throw new Error(msg); - } - - return 1; -}; - -BinaryParser.decodeFloat = function decodeFloat (data, precisionBits, exponentBits) { - var b = new this.Buffer(this.bigEndian, data); - - b.checkBuffer(precisionBits + exponentBits + 1); - - var bias = maxBits[exponentBits - 1] - 1 - , signal = b.readBits(precisionBits + exponentBits, 1) - , exponent = b.readBits(precisionBits, exponentBits) - , significand = 0 - , divisor = 2 - , curByte = b.buffer.length + (-precisionBits >> 3) - 1; - - do { - for (var byteValue = b.buffer[ ++curByte ], startBit = precisionBits % 8 || 8, mask = 1 << startBit; mask >>= 1; ( byteValue & mask ) && ( significand += 1 / divisor ), divisor *= 2 ); - } while (precisionBits -= startBit); - - return exponent == ( bias << 1 ) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity : ( 1 + signal * -2 ) * ( exponent || significand ? !exponent ? Math.pow( 2, -bias + 1 ) * significand : Math.pow( 2, exponent - bias ) * ( 1 + significand ) : 0 ); -}; - -BinaryParser.decodeInt = function decodeInt (data, bits, signed, forceBigEndian) { - var b = new this.Buffer(this.bigEndian || forceBigEndian, data) - , x = b.readBits(0, bits) - , max = maxBits[bits]; //max = Math.pow( 2, bits ); - - return signed && x >= max / 2 - ? x - max - : x; -}; - -BinaryParser.encodeFloat = function encodeFloat (data, precisionBits, exponentBits) { - var bias = maxBits[exponentBits - 1] - 1 - , minExp = -bias + 1 - , maxExp = bias - , minUnnormExp = minExp - precisionBits - , n = parseFloat(data) - , status = isNaN(n) || n == -Infinity || n == +Infinity ? n : 0 - , exp = 0 - , len = 2 * bias + 1 + precisionBits + 3 - , bin = new Array(len) - , signal = (n = status !== 0 ? 0 : n) < 0 - , intPart = Math.floor(n = Math.abs(n)) - , floatPart = n - intPart - , lastBit - , rounded - , result - , i - , j; - - for (i = len; i; bin[--i] = 0); - - for (i = bias + 2; intPart && i; bin[--i] = intPart % 2, intPart = Math.floor(intPart / 2)); - - for (i = bias + 1; floatPart > 0 && i; (bin[++i] = ((floatPart *= 2) >= 1) - 0 ) && --floatPart); - - for (i = -1; ++i < len && !bin[i];); - - if (bin[(lastBit = precisionBits - 1 + (i = (exp = bias + 1 - i) >= minExp && exp <= maxExp ? i + 1 : bias + 1 - (exp = minExp - 1))) + 1]) { - if (!(rounded = bin[lastBit])) { - for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]); - } - - for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0)); - } - - for (i = i - 2 < 0 ? -1 : i - 3; ++i < len && !bin[i];); - - if ((exp = bias + 1 - i) >= minExp && exp <= maxExp) { - ++i; - } else if (exp < minExp) { - exp != bias + 1 - len && exp < minUnnormExp && this.warn("encodeFloat::float underflow"); - i = bias + 1 - (exp = minExp - 1); - } - - if (intPart || status !== 0) { - this.warn(intPart ? "encodeFloat::float overflow" : "encodeFloat::" + status); - exp = maxExp + 1; - i = bias + 2; - - if (status == -Infinity) { - signal = 1; - } else if (isNaN(status)) { - bin[i] = 1; - } - } - - for (n = Math.abs(exp + bias), j = exponentBits + 1, result = ""; --j; result = (n % 2) + result, n = n >>= 1); - - for (n = 0, j = 0, i = (result = (signal ? "1" : "0") + result + bin.slice(i, i + precisionBits).join("")).length, r = []; i; j = (j + 1) % 8) { - n += (1 << j) * result.charAt(--i); - if (j == 7) { - r[r.length] = String.fromCharCode(n); - n = 0; - } - } - - r[r.length] = n - ? String.fromCharCode(n) - : ""; - - return (this.bigEndian ? r.reverse() : r).join(""); -}; - -BinaryParser.encodeInt = function encodeInt (data, bits, signed, forceBigEndian) { - var max = maxBits[bits]; - - if (data >= max || data < -(max / 2)) { - this.warn("encodeInt::overflow"); - data = 0; - } - - if (data < 0) { - data += max; - } - - for (var r = []; data; r[r.length] = String.fromCharCode(data % 256), data = Math.floor(data / 256)); - - for (bits = -(-bits >> 3) - r.length; bits--; r[r.length] = "\0"); - - return ((this.bigEndian || forceBigEndian) ? r.reverse() : r).join(""); -}; - -BinaryParser.toSmall = function( data ){ return this.decodeInt( data, 8, true ); }; -BinaryParser.fromSmall = function( data ){ return this.encodeInt( data, 8, true ); }; -BinaryParser.toByte = function( data ){ return this.decodeInt( data, 8, false ); }; -BinaryParser.fromByte = function( data ){ return this.encodeInt( data, 8, false ); }; -BinaryParser.toShort = function( data ){ return this.decodeInt( data, 16, true ); }; -BinaryParser.fromShort = function( data ){ return this.encodeInt( data, 16, true ); }; -BinaryParser.toWord = function( data ){ return this.decodeInt( data, 16, false ); }; -BinaryParser.fromWord = function( data ){ return this.encodeInt( data, 16, false ); }; -BinaryParser.toInt = function( data ){ return this.decodeInt( data, 32, true ); }; -BinaryParser.fromInt = function( data ){ return this.encodeInt( data, 32, true ); }; -BinaryParser.toLong = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromLong = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toDWord = function( data ){ return this.decodeInt( data, 32, false ); }; -BinaryParser.fromDWord = function( data ){ return this.encodeInt( data, 32, false ); }; -BinaryParser.toQWord = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromQWord = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toFloat = function( data ){ return this.decodeFloat( data, 23, 8 ); }; -BinaryParser.fromFloat = function( data ){ return this.encodeFloat( data, 23, 8 ); }; -BinaryParser.toDouble = function( data ){ return this.decodeFloat( data, 52, 11 ); }; -BinaryParser.fromDouble = function( data ){ return this.encodeFloat( data, 52, 11 ); }; - -// Factor out the encode so it can be shared by add_header and push_int32 -BinaryParser.encode_int32 = function encode_int32 (number, asArray) { - var a, b, c, d, unsigned; - unsigned = (number < 0) ? (number + 0x100000000) : number; - a = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - b = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - c = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - d = Math.floor(unsigned); - return asArray ? [chr(a), chr(b), chr(c), chr(d)] : chr(a) + chr(b) + chr(c) + chr(d); -}; - -BinaryParser.encode_int64 = function encode_int64 (number) { - var a, b, c, d, e, f, g, h, unsigned; - unsigned = (number < 0) ? (number + 0x10000000000000000) : number; - a = Math.floor(unsigned / 0xffffffffffffff); - unsigned &= 0xffffffffffffff; - b = Math.floor(unsigned / 0xffffffffffff); - unsigned &= 0xffffffffffff; - c = Math.floor(unsigned / 0xffffffffff); - unsigned &= 0xffffffffff; - d = Math.floor(unsigned / 0xffffffff); - unsigned &= 0xffffffff; - e = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - f = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - g = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - h = Math.floor(unsigned); - return chr(a) + chr(b) + chr(c) + chr(d) + chr(e) + chr(f) + chr(g) + chr(h); -}; - -/** - * UTF8 methods - */ - -// Take a raw binary string and return a utf8 string -BinaryParser.decode_utf8 = function decode_utf8 (binaryStr) { - var len = binaryStr.length - , decoded = '' - , i = 0 - , c = 0 - , c1 = 0 - , c2 = 0 - , c3; - - while (i < len) { - c = binaryStr.charCodeAt(i); - if (c < 128) { - decoded += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = binaryStr.charCodeAt(i+1); - decoded += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = binaryStr.charCodeAt(i+1); - c3 = binaryStr.charCodeAt(i+2); - decoded += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - - return decoded; -}; - -// Encode a cstring -BinaryParser.encode_cstring = function encode_cstring (s) { - return unescape(encodeURIComponent(s)) + BinaryParser.fromByte(0); -}; - -// Take a utf8 string and return a binary string -BinaryParser.encode_utf8 = function encode_utf8 (s) { - var a = "" - , c; - - for (var n = 0, len = s.length; n < len; n++) { - c = s.charCodeAt(n); - - if (c < 128) { - a += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - a += String.fromCharCode((c>>6) | 192) ; - a += String.fromCharCode((c&63) | 128); - } else { - a += String.fromCharCode((c>>12) | 224); - a += String.fromCharCode(((c>>6) & 63) | 128); - a += String.fromCharCode((c&63) | 128); - } - } - - return a; -}; - -BinaryParser.hprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } - } - - process.stdout.write("\n\n"); -}; - -BinaryParser.ilprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -BinaryParser.hlprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -/** - * BinaryParser buffer constructor. - */ -function BinaryParserBuffer (bigEndian, buffer) { - this.bigEndian = bigEndian || 0; - this.buffer = []; - this.setBuffer(buffer); -}; - -BinaryParserBuffer.prototype.setBuffer = function setBuffer (data) { - var l, i, b; - - if (data) { - i = l = data.length; - b = this.buffer = new Array(l); - for (; i; b[l - i] = data.charCodeAt(--i)); - this.bigEndian && b.reverse(); - } -}; - -BinaryParserBuffer.prototype.hasNeededBits = function hasNeededBits (neededBits) { - return this.buffer.length >= -(-neededBits >> 3); -}; - -BinaryParserBuffer.prototype.checkBuffer = function checkBuffer (neededBits) { - if (!this.hasNeededBits(neededBits)) { - throw new Error("checkBuffer::missing bytes"); - } -}; - -BinaryParserBuffer.prototype.readBits = function readBits (start, length) { - //shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni) - - function shl (a, b) { - for (; b--; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1); - return a; - } - - if (start < 0 || length <= 0) { - return 0; - } - - this.checkBuffer(start + length); - - var offsetLeft - , offsetRight = start % 8 - , curByte = this.buffer.length - ( start >> 3 ) - 1 - , lastByte = this.buffer.length + ( -( start + length ) >> 3 ) - , diff = curByte - lastByte - , sum = ((this.buffer[ curByte ] >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1)) + (diff && (offsetLeft = (start + length) % 8) ? (this.buffer[lastByte++] & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight : 0); - - for(; diff; sum += shl(this.buffer[lastByte++], (diff-- << 3) - offsetRight)); - - return sum; -}; - -/** - * Expose. - */ -BinaryParser.Buffer = BinaryParserBuffer; - -exports.BinaryParser = BinaryParser; - -}, - - - -'bson': function(module, exports, global, require, undefined){ - var Long = require('./long').Long - , Double = require('./double').Double - , Timestamp = require('./timestamp').Timestamp - , ObjectID = require('./objectid').ObjectID - , Symbol = require('./symbol').Symbol - , Code = require('./code').Code - , MinKey = require('./min_key').MinKey - , MaxKey = require('./max_key').MaxKey - , DBRef = require('./db_ref').DBRef - , Binary = require('./binary').Binary - , BinaryParser = require('./binary_parser').BinaryParser - , writeIEEE754 = require('./float_parser').writeIEEE754 - , readIEEE754 = require('./float_parser').readIEEE754 - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -/** - * Create a new BSON instance - * - * @class Represents the BSON Parser - * @return {BSON} instance of BSON Parser. - */ -function BSON () {}; - -/** - * @ignore - * @api private - */ -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.calculateObjectSize = function calculateObjectSize(object, serializeFunctions) { - var totalLength = (4 + 1); - - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - totalLength += calculateElement(i.toString(), object[i], serializeFunctions) - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Calculate size - for(var key in object) { - totalLength += calculateElement(key, object[key], serializeFunctions) - } - } - - return totalLength; -} - -/** - * @ignore - * @api private - */ -function calculateElement(name, value, serializeFunctions) { - var isBuffer = typeof Buffer !== 'undefined'; - - switch(typeof value) { - case 'string': - return 1 + (!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1 + 4 + (!isBuffer ? numberOfBytes(value) : Buffer.byteLength(value, 'utf8')) + 1; - case 'number': - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (4 + 1); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - } else { // 64 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - case 'undefined': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - case 'boolean': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 1); - case 'object': - if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (12 + 1); - } else if(value instanceof Date || isDate(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 4 + 1) + value.length; - } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp - || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - // Calculate size depending on the availability of a scope - if(value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Check what kind of subtype we have - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1 + 4); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1); - } - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + ((!isBuffer ? numberOfBytes(value.value) : Buffer.byteLength(value.value, 'utf8')) + 4 + 1 + 1); - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + BSON.calculateObjectSize(ordered_values, serializeFunctions); - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + BSON.calculateObjectSize(value, serializeFunctions) + 1; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else if(serializeFunctions) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1; - } - } - } - - return 0; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.serializeWithBufferAndIndex = function serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) { - // Default setting false - serializeFunctions = serializeFunctions == null ? false : serializeFunctions; - // Write end information (length of the object) - var size = buffer.length; - // Write the size of the object - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return serializeObject(object, checkKeys, buffer, index, serializeFunctions) - 1; -} - -/** - * @ignore - * @api private - */ -var serializeObject = function(object, checkKeys, buffer, index, serializeFunctions) { - // Process the object - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - index = packElement(i.toString(), object[i], checkKeys, buffer, index, serializeFunctions); - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Serialize the object - for(var key in object) { - // Check the key and throw error if it's illegal - if (key != '$db' && key != '$ref' && key != '$id') { - // dollars and dots ok - BSON.checkKey(key, !checkKeys); - } - - // Pack the element - index = packElement(key, object[key], checkKeys, buffer, index, serializeFunctions); - } - } - - // Write zero - buffer[index++] = 0; - return index; -} - -var stringToBytes = function(str) { - var ch, st, re = []; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re.concat( st.reverse() ); - } - // return an array of bytes - return re; -} - -var numberOfBytes = function(str) { - var ch, st, re = 0; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re + st.length; - } - // return an array of bytes - return re; -} - -/** - * @ignore - * @api private - */ -var writeToTypedArray = function(buffer, string, index) { - var bytes = stringToBytes(string); - for(var i = 0; i < bytes.length; i++) { - buffer[index + i] = bytes[i]; - } - return bytes.length; -} - -/** - * @ignore - * @api private - */ -var supportsBuffer = typeof Buffer != 'undefined'; - -/** - * @ignore - * @api private - */ -var packElement = function(name, value, checkKeys, buffer, index, serializeFunctions) { - var startIndex = index; - - switch(typeof value) { - case 'string': - // Encode String type - buffer[index++] = BSON.BSON_DATA_STRING; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value) + 1 : numberOfBytes(value) + 1; - // Write the size of the string to buffer - buffer[index + 3] = (size >> 24) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index] = size & 0xff; - // Ajust the index - index = index + 4; - // Write the string - supportsBuffer ? buffer.write(value, index, 'utf8') : writeToTypedArray(buffer, value, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - // Return index - return index; - case 'number': - // We have an integer value - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // If the value fits in 32 bits encode as int, if it fits in a double - // encode it as a double, otherwise long - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { - // Set int type 32 bits or less - buffer[index++] = BSON.BSON_DATA_INT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the int value - buffer[index++] = value & 0xff; - buffer[index++] = (value >> 8) & 0xff; - buffer[index++] = (value >> 16) & 0xff; - buffer[index++] = (value >> 24) & 0xff; - } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } else { - // Set long type - buffer[index++] = BSON.BSON_DATA_LONG; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var longVal = Long.fromNumber(value); - var lowBits = longVal.getLowBits(); - var highBits = longVal.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - } - } else { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } - - return index; - case 'undefined': - // Set long type - buffer[index++] = BSON.BSON_DATA_NULL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - case 'boolean': - // Write the type - buffer[index++] = BSON.BSON_DATA_BOOLEAN; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; - case 'object': - if(value === null || value instanceof MinKey || value instanceof MaxKey - || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - // Write the type of either min or max key - if(value === null) { - buffer[index++] = BSON.BSON_DATA_NULL; - } else if(value instanceof MinKey) { - buffer[index++] = BSON.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = BSON.BSON_DATA_MAX_KEY; - } - - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OID; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write objectid - supportsBuffer ? buffer.write(value.id, index, 'binary') : writeToTypedArray(buffer, value.id, index); - // Ajust index - index = index + 12; - return index; - } else if(value instanceof Date || isDate(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_DATE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the date - var dateInMilis = Long.fromNumber(value.getTime()); - var lowBits = dateInMilis.getLowBits(); - var highBits = dateInMilis.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Get size of the buffer (current write point) - var size = value.length; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the default subtype - buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - value.copy(buffer, index, 0, size); - // Adjust the index - index = index + size; - return index; - } else if(value instanceof Long || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - // Write the type - buffer[index++] = value instanceof Long ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the date - var lowBits = value.getLowBits(); - var highBits = value.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(value instanceof Double || value['_bsontype'] == 'Double') { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - return index; - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - if(value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.code.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize + 4; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = supportsBuffer ? new Buffer(scopeSize) : new Uint8Array(new ArrayBuffer(scopeSize)); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - supportsBuffer ? scopeObjectBuffer.copy(buffer, index, 0, scopeSize) : buffer.set(scopeObjectBuffer, index); - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.code.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Extract the buffer - var data = value.value(true); - // Calculate size - var size = value.position; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - - // If we have binary type 2 the 4 first bytes are the size - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - } - - // Write the data to the object - supportsBuffer ? data.copy(buffer, index, 0, value.position) : buffer.set(data, index); - // Ajust index - index = index + value.position; - return index; - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - // Write the type - buffer[index++] = BSON.BSON_DATA_SYMBOL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value.value) + 1 : numberOfBytes(value.value) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - buffer.write(value.value, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0x00; - return index; - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - // Message size - var size = BSON.calculateObjectSize(ordered_values, serializeFunctions); - // Serialize the object - var endIndex = BSON.serializeWithBufferAndIndex(ordered_values, checkKeys, buffer, index, serializeFunctions); - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write zero for object - buffer[endIndex++] = 0x00; - // Return the end index - return endIndex; - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - supportsBuffer ? buffer.write(value.source, index, 'utf8') : writeToTypedArray(buffer, value.source, index); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - // Write the type - buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Adjust the index - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var endIndex = serializeObject(value, checkKeys, buffer, index + 4, serializeFunctions); - // Write size - var size = endIndex - index; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return endIndex; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - buffer.write(value.source, index, 'utf8'); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = new Buffer(scopeSize); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize - 4; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - scopeObjectBuffer.copy(buffer, index, 0, scopeSize); - - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else if(serializeFunctions) { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } - } - - // If no value to serialize - return index; -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - // Throw error if we are trying serialize an illegal type - if(object == null || typeof object != 'object' || Array.isArray(object)) - throw new Error("Only javascript objects supported"); - - // Emoty target buffer - var buffer = null; - // Calculate the size of the object - var size = BSON.calculateObjectSize(object, serializeFunctions); - // Fetch the best available type for storing the binary data - if(buffer = typeof Buffer != 'undefined') { - buffer = new Buffer(size); - asBuffer = true; - } else if(typeof Uint8Array != 'undefined') { - buffer = new Uint8Array(new ArrayBuffer(size)); - } else { - buffer = new Array(size); - } - - // If asBuffer is false use typed arrays - BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, 0, serializeFunctions); - return buffer; -} - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Crc state variables shared by function - * - * @ignore - * @api private - */ -var 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]; - -/** - * CRC32 hash method, Fast and enough versitility for our usage - * - * @ignore - * @api private - */ -var crc32 = function(string, start, end) { - var crc = 0 - var x = 0; - var y = 0; - crc = crc ^ (-1); - - for(var i = start, iTop = end; i < iTop;i++) { - y = (crc ^ string[i]) & 0xFF; - x = table[y]; - crc = (crc >>> 8) ^ x; - } - - return crc ^ (-1); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); - options = options != null ? options : {}; - var index = startIndex; - // Loop over all documents - for(var i = 0; i < numberOfDocuments; i++) { - // Find size of the document - var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; - // Update options with index - options['index'] = index; - // Parse the document at this point - documents[docStartIndex + i] = BSON.deserialize(data, options); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEvalWithHash = function(functionCache, hash, functionString, object) { - // Contains the value we are going to set - var value = null; - - // Check for cache hit, eval if missing and return cached function - if(functionCache[hash] == null) { - eval("value = " + functionString); - functionCache[hash] = value; - } - // Set the object - return functionCache[hash].bind(object); -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEval = function(functionString) { - // Contains the value we are going to set - var value = null; - // Eval the function - eval("value = " + functionString); - return value; -} - -/** - * Convert Uint8Array to String - * - * @ignore - * @api private - */ -var convertUint8ArrayToUtf8String = function(byteArray, startIndex, endIndex) { - return BinaryParser.decode_utf8(convertArraytoUtf8BinaryString(byteArray, startIndex, endIndex)); -} - -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - - return result; -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.deserialize = function(buffer, options, isArray) { - // Options - options = options == null ? {} : options; - var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; - var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; - var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; - var promoteLongs = options['promoteLongs'] || true; - - // Validate that we have at least 4 bytes of buffer - if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); - - // Set up index - var index = typeof options['index'] == 'number' ? options['index'] : 0; - // Reads in a C style string - var readCStyleString = function() { - // Get the start search index - var i = index; - // Locate the end of the c string - while(buffer[i] !== 0x00) { i++ } - // Grab utf8 encoded string - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, i) : convertUint8ArrayToUtf8String(buffer, index, i); - // Update index position - index = i + 1; - // Return string - return string; - } - - // Create holding object - var object = isArray ? [] : {}; - - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || size > buffer.length) throw new Error("corrupt bson message"); - - // While we have more left data left keep parsing - while(true) { - // Read the type - var elementType = buffer[index++]; - // If we get a zero it's the last byte, exit - if(elementType == 0) break; - // Read the name of the field - var name = readCStyleString(); - // Switch on the type - switch(elementType) { - case BSON.BSON_DATA_OID: - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('binary', index, index + 12) : convertArraytoUtf8BinaryString(buffer, index, index + 12); - // Decode the oid - object[name] = new ObjectID(string); - // Update index - index = index + 12; - break; - case BSON.BSON_DATA_STRING: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_INT: - // Decode the 32bit value - object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - break; - case BSON.BSON_DATA_NUMBER: - // Decode the double value - object[name] = readIEEE754(buffer, index, 'little', 52, 8); - // Update the index - index = index + 8; - break; - case BSON.BSON_DATA_DATE: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set date object - object[name] = new Date(new Long(lowBits, highBits).toNumber()); - break; - case BSON.BSON_DATA_BOOLEAN: - // Parse the boolean value - object[name] = buffer[index++] == 1; - break; - case BSON.BSON_DATA_NULL: - // Parse the boolean value - object[name] = null; - break; - case BSON.BSON_DATA_BINARY: - // Decode the size of the binary blob - var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Decode the subtype - var subType = buffer[index++]; - // Decode as raw Buffer object if options specifies it - if(buffer['slice'] != null) { - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Slice the data - object[name] = new Binary(buffer.slice(index, index + binarySize), subType); - } else { - var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize); - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Copy the data - for(var i = 0; i < binarySize; i++) { - _buffer[i] = buffer[index + i]; - } - // Create the binary object - object[name] = new Binary(_buffer, subType); - } - // Update the index - index = index + binarySize; - break; - case BSON.BSON_DATA_ARRAY: - options['index'] = index; - // Decode the size of the array document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, true); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_OBJECT: - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_REGEXP: - // Create the regexp - var source = readCStyleString(); - var regExpOptions = readCStyleString(); - // For each option add the corresponding one for javascript - var optionsArray = new Array(regExpOptions.length); - - // Parse options - for(var i = 0; i < regExpOptions.length; i++) { - switch(regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - object[name] = new RegExp(source, optionsArray.join('')); - break; - case BSON.BSON_DATA_LONG: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Create long object - var long = new Long(lowBits, highBits); - // Promote the long if possible - if(promoteLongs) { - object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; - } else { - object[name] = long; - } - break; - case BSON.BSON_DATA_SYMBOL: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_TIMESTAMP: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set the object - object[name] = new Timestamp(lowBits, highBits); - break; - case BSON.BSON_DATA_MIN_KEY: - // Parse the object - object[name] = new MinKey(); - break; - case BSON.BSON_DATA_MAX_KEY: - // Parse the object - object[name] = new MaxKey(); - break; - case BSON.BSON_DATA_CODE: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Function string - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - } else { - object[name] = new Code(functionString, {}); - } - - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_CODE_W_SCOPE: - // Read the content of the field - var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Javascript function - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - // Parse the element - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Decode the scope object - var scopeObject = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - - // Set the scope on the object - object[name].scope = scopeObject; - } else { - object[name] = new Code(functionString, scopeObject); - } - - // Add string to object - break; - } - } - - // Check if we have a db ref object - if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); - - // Return the final objects - return object; -} - -/** - * Check if key name is valid. - * - * @ignore - * @api private - */ -BSON.checkKey = function checkKey (key, dollarsAndDotsOk) { - if (!key.length) return; - // Check if we have a legal key for the object - if (!!~key.indexOf("\x00")) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - if (!dollarsAndDotsOk) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.prototype.deserialize = function(data, options) { - return BSON.deserialize(data, options); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - return BSON.deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options); -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.prototype.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - return BSON.serialize(object, checkKeys, asBuffer, serializeFunctions); -} - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.prototype.calculateObjectSize = function(object, serializeFunctions) { - return BSON.calculateObjectSize(object, serializeFunctions); -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, buffer, startIndex, serializeFunctions) { - return BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, startIndex, serializeFunctions); -} - -/** - * @ignore - * @api private - */ -exports.Code = Code; -exports.Symbol = Symbol; -exports.BSON = BSON; -exports.DBRef = DBRef; -exports.Binary = Binary; -exports.ObjectID = ObjectID; -exports.Long = Long; -exports.Timestamp = Timestamp; -exports.Double = Double; -exports.MinKey = MinKey; -exports.MaxKey = MaxKey; - -}, - - - -'code': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON Code type. - * - * @class Represents the BSON Code type. - * @param {String|Function} code a string or function. - * @param {Object} [scope] an optional scope for the function. - * @return {Code} - */ -function Code(code, scope) { - if(!(this instanceof Code)) return new Code(code, scope); - - this._bsontype = 'Code'; - this.code = code; - this.scope = scope == null ? {} : scope; -}; - -/** - * @ignore - * @api private - */ -Code.prototype.toJSON = function() { - return {scope:this.scope, code:this.code}; -} - -exports.Code = Code; -}, - - - -'db_ref': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON DBRef type. - * - * @class Represents the BSON DBRef type. - * @param {String} namespace the collection name. - * @param {ObjectID} oid the reference ObjectID. - * @param {String} [db] optional db name, if omitted the reference is local to the current db. - * @return {DBRef} - */ -function DBRef(namespace, oid, db) { - if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db); - - this._bsontype = 'DBRef'; - this.namespace = namespace; - this.oid = oid; - this.db = db; -}; - -/** - * @ignore - * @api private - */ -DBRef.prototype.toJSON = function() { - return { - '$ref':this.namespace, - '$id':this.oid, - '$db':this.db == null ? '' : this.db - }; -} - -exports.DBRef = DBRef; -}, - - - -'double': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON Double type. - * - * @class Represents the BSON Double type. - * @param {Number} value the number we want to represent as a double. - * @return {Double} - */ -function Double(value) { - if(!(this instanceof Double)) return new Double(value); - - this._bsontype = 'Double'; - this.value = value; -} - -/** - * Access the number value. - * - * @return {Number} returns the wrapped double number. - * @api public - */ -Double.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - * @api private - */ -Double.prototype.toJSON = function() { - return this.value; -} - -exports.Double = Double; -}, - - - -'float_parser': function(module, exports, global, require, undefined){ - // Copyright (c) 2008, Fair Oaks Labs, Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// -// Modifications to writeIEEE754 to support negative zeroes made by Brian White - -var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { - var e, m, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - nBits = -7, - i = bBE ? 0 : (nBytes - 1), - d = bBE ? 1 : -1, - s = buffer[offset + i]; - - i += d; - - e = s & ((1 << (-nBits)) - 1); - s >>= (-nBits); - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - - m = e & ((1 << (-nBits)) - 1); - e >>= (-nBits); - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity); - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; - -var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { - var e, m, c, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), - i = bBE ? (nBytes-1) : 0, - d = bBE ? -1 : 1, - s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; - - value = Math.abs(value); - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e+eBias >= 1) { - value += rt / c; - } else { - value += rt * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - - e = (e << mLen) | m; - eLen += mLen; - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - - buffer[offset + i - d] |= s * 128; -}; - -exports.readIEEE754 = readIEEE754; -exports.writeIEEE754 = writeIEEE754; -}, - - - -'index': function(module, exports, global, require, undefined){ - try { - exports.BSONPure = require('./bson'); - exports.BSONNative = require('../../ext'); -} catch(err) { - // do nothing -} - -[ './binary_parser' - , './binary' - , './code' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './symbol' - , './timestamp' - , './long'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - exports[i] = module[i]; - } -}); - -// Exports all the classes for the NATIVE JS BSON Parser -exports.native = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './symbol' - , './timestamp' - , './long' - , '../../ext' -].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} - -// Exports all the classes for the PURE JS BSON Parser -exports.pure = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './symbol' - , './timestamp' - , './long' - , '././bson'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} - -}, - - - -'long': function(module, exports, global, require, undefined){ - // Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Long class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Long". This - * implementation is derived from LongLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Longs. - * - * The internal representation of a Long is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class Represents the BSON Long type. - * @param {Number} low the low (signed) 32 bits of the Long. - * @param {Number} high the high (signed) 32 bits of the Long. - */ -function Long(low, high) { - if(!(this instanceof Long)) return new Long(low, high); - - this._bsontype = 'Long'; - /** - * @type {number} - * @api private - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @api private - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {Number} the value, assuming it is a 32-bit integer. - * @api public - */ -Long.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @return {Number} the closest floating-point representation to this value. - * @api public - */ -Long.prototype.toNumber = function() { - return this.high_ * Long.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @return {String} the JSON representation. - * @api public - */ -Long.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @param {Number} [opt_radix] the radix in which the text should be written. - * @return {String} the textual representation of this value. - * @api public - */ -Long.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - // We need to change the Long value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixLong = Long.fromNumber(radix); - var div = this.div(radixLong); - var rem = div.multiply(radixLong).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @return {Number} the high 32-bits as a signed value. - * @api public - */ -Long.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @return {Number} the low 32-bits as a signed value. - * @api public - */ -Long.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @return {Number} the low 32-bits as an unsigned value. - * @api public - */ -Long.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Long. - * - * @return {Number} Returns the number of bits needed to represent the absolute value of this Long. - * @api public - */ -Long.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @return {Boolean} whether this value is zero. - * @api public - */ -Long.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @return {Boolean} whether this value is negative. - * @api public - */ -Long.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @return {Boolean} whether this value is odd. - * @api public - */ -Long.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Long equals the other - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long equals the other - * @api public - */ -Long.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Long does not equal the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long does not equal the other. - * @api public - */ -Long.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Long is less than the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is less than the other. - * @api public - */ -Long.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Long is less than or equal to the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is less than or equal to the other. - * @api public - */ -Long.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Long is greater than the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is greater than the other. - * @api public - */ -Long.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Long is greater than or equal to the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is greater than or equal to the other. - * @api public - */ -Long.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Long with the given one. - * - * @param {Long} other Long to compare against. - * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - * @api public - */ -Long.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @return {Long} the negation of this value. - * @api public - */ -Long.prototype.negate = function() { - if (this.equals(Long.MIN_VALUE)) { - return Long.MIN_VALUE; - } else { - return this.not().add(Long.ONE); - } -}; - -/** - * Returns the sum of this and the given Long. - * - * @param {Long} other Long to add to this one. - * @return {Long} the sum of this and the given Long. - * @api public - */ -Long.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Long. - * - * @param {Long} other Long to subtract from this. - * @return {Long} the difference of this and the given Long. - * @api public - */ -Long.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Long. - * - * @param {Long} other Long to multiply with this. - * @return {Long} the product of this and the other. - * @api public - */ -Long.prototype.multiply = function(other) { - if (this.isZero()) { - return Long.ZERO; - } else if (other.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } else if (other.equals(Long.MIN_VALUE)) { - return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Longs are small, use float multiplication - if (this.lessThan(Long.TWO_PWR_24_) && - other.lessThan(Long.TWO_PWR_24_)) { - return Long.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Long divided by the given one. - * - * @param {Long} other Long by which to divide. - * @return {Long} this Long divided by the given one. - * @api public - */ -Long.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - if (other.equals(Long.ONE) || - other.equals(Long.NEG_ONE)) { - return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Long.ZERO)) { - return other.isNegative() ? Long.ONE : Long.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Long.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Long.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Long.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Long.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Long modulo the given one. - * - * @param {Long} other Long by which to mod. - * @return {Long} this Long modulo the given one. - * @api public - */ -Long.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @return {Long} the bitwise-NOT of this value. - * @api public - */ -Long.prototype.not = function() { - return Long.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Long and the given one. - * - * @param {Long} other the Long with which to AND. - * @return {Long} the bitwise-AND of this and the other. - * @api public - */ -Long.prototype.and = function(other) { - return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Long and the given one. - * - * @param {Long} other the Long with which to OR. - * @return {Long} the bitwise-OR of this and the other. - * @api public - */ -Long.prototype.or = function(other) { - return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Long and the given one. - * - * @param {Long} other the Long with which to XOR. - * @return {Long} the bitwise-XOR of this and the other. - * @api public - */ -Long.prototype.xor = function(other) { - return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Long with bits shifted to the left by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the left by the given amount. - * @api public - */ -Long.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Long.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Long.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount. - * @api public - */ -Long.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Long.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. - * @api public - */ -Long.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Long.fromBits(high, 0); - } else { - return Long.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Long representing the given (32-bit) integer value. - * - * @param {Number} value the 32-bit integer in question. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Long.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Long(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Long.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @param {Number} value the number in question. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Long.ZERO; - } else if (value <= -Long.TWO_PWR_63_DBL_) { - return Long.MIN_VALUE; - } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { - return Long.MAX_VALUE; - } else if (value < 0) { - return Long.fromNumber(-value).negate(); - } else { - return new Long( - (value % Long.TWO_PWR_32_DBL_) | 0, - (value / Long.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @param {Number} lowBits the low 32-bits. - * @param {Number} highBits the high 32-bits. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromBits = function(lowBits, highBits) { - return new Long(lowBits, highBits); -}; - -/** - * Returns a Long representation of the given string, written using the given radix. - * - * @param {String} str the textual representation of the Long. - * @param {Number} opt_radix the radix in which the text is written. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Long.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 8)); - - var result = Long.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Long.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Long.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Long.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Long representations of small integer values. - * @type {Object} - * @api private - */ -Long.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @api private - */ -Long.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; - -/** @type {Long} */ -Long.ZERO = Long.fromInt(0); - -/** @type {Long} */ -Long.ONE = Long.fromInt(1); - -/** @type {Long} */ -Long.NEG_ONE = Long.fromInt(-1); - -/** @type {Long} */ -Long.MAX_VALUE = - Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Long} */ -Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); - -/** - * @type {Long} - * @api private - */ -Long.TWO_PWR_24_ = Long.fromInt(1 << 24); - -/** - * Expose. - */ -exports.Long = Long; -}, - - - -'max_key': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON MaxKey type. - * - * @class Represents the BSON MaxKey type. - * @return {MaxKey} - */ -function MaxKey() { - if(!(this instanceof MaxKey)) return new MaxKey(); - - this._bsontype = 'MaxKey'; -} - -exports.MaxKey = MaxKey; -}, - - - -'min_key': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON MinKey type. - * - * @class Represents the BSON MinKey type. - * @return {MinKey} - */ -function MinKey() { - if(!(this instanceof MinKey)) return new MinKey(); - - this._bsontype = 'MinKey'; -} - -exports.MinKey = MinKey; -}, - - - -'objectid': function(module, exports, global, require, undefined){ - /** - * Module dependencies. - */ -var BinaryParser = require('./binary_parser').BinaryParser; - -/** - * Machine id. - * - * Create a random 3-byte value (i.e. unique for this - * process). Other drivers use a md5 of the machine id here, but - * that would mean an asyc call to gethostname, so we don't bother. - */ -var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10); - -// Regular expression that checks for hex value -var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$"); - -/** -* Create a new ObjectID instance -* -* @class Represents the BSON ObjectID type -* @param {String|Number} id Can be a 24 byte hex string, 12 byte binary string or a Number. -* @return {Object} instance of ObjectID. -*/ -var ObjectID = function ObjectID(id, _hex) { - if(!(this instanceof ObjectID)) return new ObjectID(id, _hex); - - this._bsontype = 'ObjectID'; - var __id = null; - - // Throw an error if it's not a valid setup - if(id != null && 'number' != typeof id && (id.length != 12 && id.length != 24)) - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - - // Generate id based on the input - if(id == null || typeof id == 'number') { - // convert to 12 byte binary string - this.id = this.generate(id); - } else if(id != null && id.length === 12) { - // assume 12 byte string - this.id = id; - } else if(checkForHexRegExp.test(id)) { - return ObjectID.createFromHexString(id); - } else { - throw new Error("Value passed in is not a valid 24 character hex string"); - } - - if(ObjectID.cacheHexString) this.__id = this.toHexString(); -}; - -// Allow usage of ObjectId as well as ObjectID -var ObjectId = ObjectID; - -// Precomputed hex table enables speedy hex string conversion -var hexTable = []; -for (var i = 0; i < 256; i++) { - hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); -} - -/** -* Return the ObjectID id as a 24 byte hex string representation -* -* @return {String} return the 24 byte hex string representation. -* @api public -*/ -ObjectID.prototype.toHexString = function() { - if(ObjectID.cacheHexString && this.__id) return this.__id; - - var hexString = ''; - - for (var i = 0; i < this.id.length; i++) { - hexString += hexTable[this.id.charCodeAt(i)]; - } - - if(ObjectID.cacheHexString) this.__id = hexString; - return hexString; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @return {Number} returns next index value. -* @api private -*/ -ObjectID.prototype.get_inc = function() { - return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @return {Number} returns next index value. -* @api private -*/ -ObjectID.prototype.getInc = function() { - return this.get_inc(); -}; - -/** -* Generate a 12 byte id string used in ObjectID's -* -* @param {Number} [time] optional parameter allowing to pass in a second based timestamp. -* @return {String} return the 12 byte id binary string. -* @api private -*/ -ObjectID.prototype.generate = function(time) { - if ('number' == typeof time) { - var time4Bytes = BinaryParser.encodeInt(time, 32, true, true); - /* for time-based ObjectID the bytes following the time will be zeroed */ - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - } else { - var unixTime = parseInt(Date.now()/1000,10); - var time4Bytes = BinaryParser.encodeInt(unixTime, 32, true, true); - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - } - - return time4Bytes + machine3Bytes + pid2Bytes + index3Bytes; -}; - -/** -* Converts the id into a 24 byte hex string for printing -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.toString = function() { - return this.toHexString(); -}; - -/** -* Converts to a string representation of this Id. -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.inspect = ObjectID.prototype.toString; - -/** -* Converts to its JSON representation. -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.toJSON = function() { - return this.toHexString(); -}; - -/** -* Compares the equality of this ObjectID with `otherID`. -* -* @param {Object} otherID ObjectID instance to compare against. -* @return {Bool} the result of comparing two ObjectID's -* @api public -*/ -ObjectID.prototype.equals = function equals (otherID) { - var id = (otherID instanceof ObjectID || otherID.toHexString) - ? otherID.id - : ObjectID.createFromHexString(otherID).id; - - return this.id === id; -} - -/** -* Returns the generation date (accurate up to the second) that this ID was generated. -* -* @return {Date} the generation date -* @api public -*/ -ObjectID.prototype.getTimestamp = function() { - var timestamp = new Date(); - timestamp.setTime(Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)) * 1000); - return timestamp; -} - -/** -* @ignore -* @api private -*/ -ObjectID.index = parseInt(Math.random() * 0xFFFFFF, 10); - -ObjectID.createPk = function createPk () { - return new ObjectID(); -}; - -/** -* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. -* -* @param {Number} time an integer number representing a number of seconds. -* @return {ObjectID} return the created ObjectID -* @api public -*/ -ObjectID.createFromTime = function createFromTime (time) { - var id = BinaryParser.encodeInt(time, 32, true, true) + - BinaryParser.encodeInt(0, 64, true, true); - return new ObjectID(id); -}; - -/** -* Creates an ObjectID from a hex string representation of an ObjectID. -* -* @param {String} hexString create a ObjectID from a passed in 24 byte hexstring. -* @return {ObjectID} return the created ObjectID -* @api public -*/ -ObjectID.createFromHexString = function createFromHexString (hexString) { - // Throw an error if it's not a valid setup - if(typeof hexString === 'undefined' || hexString != null && hexString.length != 24) - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - - var len = hexString.length; - - if(len > 12*2) { - throw new Error('Id cannot be longer than 12 bytes'); - } - - var result = '' - , string - , number; - - for (var index = 0; index < len; index += 2) { - string = hexString.substr(index, 2); - number = parseInt(string, 16); - result += BinaryParser.fromByte(number); - } - - return new ObjectID(result, hexString); -}; - -/** -* @ignore -*/ -Object.defineProperty(ObjectID.prototype, "generationTime", { - enumerable: true - , get: function () { - return Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)); - } - , set: function (value) { - var value = BinaryParser.encodeInt(value, 32, true, true); - this.id = value + this.id.substr(4); - // delete this.__id; - this.toHexString(); - } -}); - -/** - * Expose. - */ -exports.ObjectID = ObjectID; -exports.ObjectId = ObjectID; - -}, - - - -'symbol': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON Symbol type. - * - * @class Represents the BSON Symbol type. - * @param {String} value the string representing the symbol. - * @return {Symbol} - */ -function Symbol(value) { - if(!(this instanceof Symbol)) return new Symbol(value); - this._bsontype = 'Symbol'; - this.value = value; -} - -/** - * Access the wrapped string value. - * - * @return {String} returns the wrapped string. - * @api public - */ -Symbol.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - * @api private - */ -Symbol.prototype.toString = function() { - return this.value; -} - -/** - * @ignore - * @api private - */ -Symbol.prototype.inspect = function() { - return this.value; -} - -/** - * @ignore - * @api private - */ -Symbol.prototype.toJSON = function() { - return this.value; -} - -exports.Symbol = Symbol; -}, - - - -'timestamp': function(module, exports, global, require, undefined){ - // Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Timestamp class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Timestamp". This - * implementation is derived from TimestampLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Timestamps. - * - * The internal representation of a Timestamp is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class Represents the BSON Timestamp type. - * @param {Number} low the low (signed) 32 bits of the Timestamp. - * @param {Number} high the high (signed) 32 bits of the Timestamp. - */ -function Timestamp(low, high) { - if(!(this instanceof Timestamp)) return new Timestamp(low, high); - this._bsontype = 'Timestamp'; - /** - * @type {number} - * @api private - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @api private - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {Number} the value, assuming it is a 32-bit integer. - * @api public - */ -Timestamp.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @return {Number} the closest floating-point representation to this value. - * @api public - */ -Timestamp.prototype.toNumber = function() { - return this.high_ * Timestamp.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @return {String} the JSON representation. - * @api public - */ -Timestamp.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @param {Number} [opt_radix] the radix in which the text should be written. - * @return {String} the textual representation of this value. - * @api public - */ -Timestamp.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - // We need to change the Timestamp value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixTimestamp = Timestamp.fromNumber(radix); - var div = this.div(radixTimestamp); - var rem = div.multiply(radixTimestamp).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @return {Number} the high 32-bits as a signed value. - * @api public - */ -Timestamp.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @return {Number} the low 32-bits as a signed value. - * @api public - */ -Timestamp.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @return {Number} the low 32-bits as an unsigned value. - * @api public - */ -Timestamp.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Timestamp. - * - * @return {Number} Returns the number of bits needed to represent the absolute value of this Timestamp. - * @api public - */ -Timestamp.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @return {Boolean} whether this value is zero. - * @api public - */ -Timestamp.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @return {Boolean} whether this value is negative. - * @api public - */ -Timestamp.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @return {Boolean} whether this value is odd. - * @api public - */ -Timestamp.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Timestamp equals the other - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp equals the other - * @api public - */ -Timestamp.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Timestamp does not equal the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp does not equal the other. - * @api public - */ -Timestamp.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Timestamp is less than the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is less than the other. - * @api public - */ -Timestamp.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Timestamp is less than or equal to the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is less than or equal to the other. - * @api public - */ -Timestamp.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Timestamp is greater than the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is greater than the other. - * @api public - */ -Timestamp.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Timestamp is greater than or equal to the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is greater than or equal to the other. - * @api public - */ -Timestamp.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Timestamp with the given one. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - * @api public - */ -Timestamp.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @return {Timestamp} the negation of this value. - * @api public - */ -Timestamp.prototype.negate = function() { - if (this.equals(Timestamp.MIN_VALUE)) { - return Timestamp.MIN_VALUE; - } else { - return this.not().add(Timestamp.ONE); - } -}; - -/** - * Returns the sum of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to add to this one. - * @return {Timestamp} the sum of this and the given Timestamp. - * @api public - */ -Timestamp.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to subtract from this. - * @return {Timestamp} the difference of this and the given Timestamp. - * @api public - */ -Timestamp.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to multiply with this. - * @return {Timestamp} the product of this and the other. - * @api public - */ -Timestamp.prototype.multiply = function(other) { - if (this.isZero()) { - return Timestamp.ZERO; - } else if (other.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } else if (other.equals(Timestamp.MIN_VALUE)) { - return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Timestamps are small, use float multiplication - if (this.lessThan(Timestamp.TWO_PWR_24_) && - other.lessThan(Timestamp.TWO_PWR_24_)) { - return Timestamp.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Timestamp divided by the given one. - * - * @param {Timestamp} other Timestamp by which to divide. - * @return {Timestamp} this Timestamp divided by the given one. - * @api public - */ -Timestamp.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - if (other.equals(Timestamp.ONE) || - other.equals(Timestamp.NEG_ONE)) { - return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Timestamp.ZERO)) { - return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Timestamp.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Timestamp.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Timestamp.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Timestamp.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Timestamp modulo the given one. - * - * @param {Timestamp} other Timestamp by which to mod. - * @return {Timestamp} this Timestamp modulo the given one. - * @api public - */ -Timestamp.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @return {Timestamp} the bitwise-NOT of this value. - * @api public - */ -Timestamp.prototype.not = function() { - return Timestamp.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to AND. - * @return {Timestamp} the bitwise-AND of this and the other. - * @api public - */ -Timestamp.prototype.and = function(other) { - return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to OR. - * @return {Timestamp} the bitwise-OR of this and the other. - * @api public - */ -Timestamp.prototype.or = function(other) { - return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to XOR. - * @return {Timestamp} the bitwise-XOR of this and the other. - * @api public - */ -Timestamp.prototype.xor = function(other) { - return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Timestamp with bits shifted to the left by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the left by the given amount. - * @api public - */ -Timestamp.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Timestamp.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Timestamp.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount. - * @api public - */ -Timestamp.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Timestamp.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. - * @api public - */ -Timestamp.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Timestamp.fromBits(high, 0); - } else { - return Timestamp.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Timestamp representing the given (32-bit) integer value. - * - * @param {Number} value the 32-bit integer in question. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Timestamp.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Timestamp.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @param {Number} value the number in question. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Timestamp.ZERO; - } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MIN_VALUE; - } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MAX_VALUE; - } else if (value < 0) { - return Timestamp.fromNumber(-value).negate(); - } else { - return new Timestamp( - (value % Timestamp.TWO_PWR_32_DBL_) | 0, - (value / Timestamp.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @param {Number} lowBits the low 32-bits. - * @param {Number} highBits the high 32-bits. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromBits = function(lowBits, highBits) { - return new Timestamp(lowBits, highBits); -}; - -/** - * Returns a Timestamp representation of the given string, written using the given radix. - * - * @param {String} str the textual representation of the Timestamp. - * @param {Number} opt_radix the radix in which the text is written. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Timestamp.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); - - var result = Timestamp.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Timestamp.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Timestamp.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Timestamp.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Timestamp representations of small integer values. - * @type {Object} - * @api private - */ -Timestamp.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; - -/** @type {Timestamp} */ -Timestamp.ZERO = Timestamp.fromInt(0); - -/** @type {Timestamp} */ -Timestamp.ONE = Timestamp.fromInt(1); - -/** @type {Timestamp} */ -Timestamp.NEG_ONE = Timestamp.fromInt(-1); - -/** @type {Timestamp} */ -Timestamp.MAX_VALUE = - Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Timestamp} */ -Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); - -/** - * @type {Timestamp} - * @api private - */ -Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); - -/** - * Expose. - */ -exports.Timestamp = Timestamp; -}, - - }); - - -if(typeof module != 'undefined' && module.exports ){ - module.exports = bson; - - if( !module.parent ){ - bson(); - } -} - -if(typeof window != 'undefined' && typeof require == 'undefined'){ - window.require = bson.require; -} diff --git a/Associations/node_modules/mongoose/node_modules/bson/browser_build/package.json b/Associations/node_modules/mongoose/node_modules/bson/browser_build/package.json deleted file mode 100644 index 3ebb5876..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/browser_build/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ "name" : "bson" -, "description" : "A bson parser for node.js and the browser" -, "main": "../lib/bson/bson" -, "directories" : { "lib" : "../lib/bson" } -, "engines" : { "node" : ">=0.6.0" } -, "licenses" : [ { "type" : "Apache License, Version 2.0" - , "url" : "http://www.apache.org/licenses/LICENSE-2.0" } ] -} diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary.js deleted file mode 100644 index ef74b16e..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary.js +++ /dev/null @@ -1,344 +0,0 @@ -/** - * Module dependencies. - * @ignore - */ -if(typeof window === 'undefined') { - var Buffer = require('buffer').Buffer; // TODO just use global Buffer -} - -/** - * A class representation of the BSON Binary type. - * - * Sub types - * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. - * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. - * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. - * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. - * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. - * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. - * - * @class - * @param {Buffer} buffer a buffer object containing the binary data. - * @param {Number} [subType] the option binary type. - * @return {Binary} - */ -function Binary(buffer, subType) { - if(!(this instanceof Binary)) return new Binary(buffer, subType); - - this._bsontype = 'Binary'; - - if(buffer instanceof Number) { - this.sub_type = buffer; - this.position = 0; - } else { - this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; - this.position = 0; - } - - if(buffer != null && !(buffer instanceof Number)) { - // Only accept Buffer, Uint8Array or Arrays - if(typeof buffer == 'string') { - // Different ways of writing the length of the string for the different types - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(buffer); - } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) { - this.buffer = writeStringToArray(buffer); - } else { - throw new Error("only String, Buffer, Uint8Array or Array accepted"); - } - } else { - this.buffer = buffer; - } - this.position = buffer.length; - } else { - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(Binary.BUFFER_SIZE); - } else if(typeof Uint8Array != 'undefined'){ - this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); - } else { - this.buffer = new Array(Binary.BUFFER_SIZE); - } - // Set position to start of buffer - this.position = 0; - } -}; - -/** - * Updates this binary with byte_value. - * - * @method - * @param {string} byte_value a single byte we wish to write. - */ -Binary.prototype.put = function put(byte_value) { - // If it's a string and a has more than one character throw an error - if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error("only accepts single character String, Uint8Array or Array"); - if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error("only accepts number in a valid unsigned byte range 0-255"); - - // Decode the byte value once - var decoded_byte = null; - if(typeof byte_value == 'string') { - decoded_byte = byte_value.charCodeAt(0); - } else if(byte_value['length'] != null) { - decoded_byte = byte_value[0]; - } else { - decoded_byte = byte_value; - } - - if(this.buffer.length > this.position) { - this.buffer[this.position++] = decoded_byte; - } else { - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - // Create additional overflow buffer - var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); - // Combine the two buffers together - this.buffer.copy(buffer, 0, 0, this.buffer.length); - this.buffer = buffer; - this.buffer[this.position++] = decoded_byte; - } else { - var buffer = null; - // Create a new buffer (typed or normal array) - if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length)); - } else { - buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); - } - - // We need to copy all the content to the new array - for(var i = 0; i < this.buffer.length; i++) { - buffer[i] = this.buffer[i]; - } - - // Reassign the buffer - this.buffer = buffer; - // Write the byte - this.buffer[this.position++] = decoded_byte; - } - } -}; - -/** - * Writes a buffer or string to the binary. - * - * @method - * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object. - * @param {number} offset specify the binary of where to write the content. - * @return {null} - */ -Binary.prototype.write = function write(string, offset) { - offset = typeof offset == 'number' ? offset : this.position; - - // If the buffer is to small let's extend the buffer - if(this.buffer.length < offset + string.length) { - var buffer = null; - // If we are in node.js - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - buffer = new Buffer(this.buffer.length + string.length); - this.buffer.copy(buffer, 0, 0, this.buffer.length); - } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - // Create a new buffer - buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length)) - // Copy the content - for(var i = 0; i < this.position; i++) { - buffer[i] = this.buffer[i]; - } - } - - // Assign the new buffer - this.buffer = buffer; - } - - if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) { - string.copy(this.buffer, offset, 0, string.length); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length - } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) { - this.buffer.write(string, offset, 'binary'); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length; - } else if(Object.prototype.toString.call(string) == '[object Uint8Array]' - || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string[i]; - } - - this.position = offset > this.position ? offset : this.position; - } else if(typeof string == 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string.charCodeAt(i); - } - - this.position = offset > this.position ? offset : this.position; - } -}; - -/** - * Reads **length** bytes starting at **position**. - * - * @method - * @param {number} position read from the given position in the Binary. - * @param {number} length the number of bytes to read. - * @return {Buffer} - */ -Binary.prototype.read = function read(position, length) { - length = length && length > 0 - ? length - : this.position; - - // Let's return the data based on the type we have - if(this.buffer['slice']) { - return this.buffer.slice(position, position + length); - } else { - // Create a buffer to keep the result - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length); - for(var i = 0; i < length; i++) { - buffer[i] = this.buffer[position++]; - } - } - // Return the buffer - return buffer; -}; - -/** - * Returns the value of this binary as a string. - * - * @method - * @return {string} - */ -Binary.prototype.value = function value(asRaw) { - asRaw = asRaw == null ? false : asRaw; - - // Optimize to serialize for the situation where the data == size of buffer - if(asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position) - return this.buffer; - - // If it's a node.js buffer object - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position); - } else { - if(asRaw) { - // we support the slice command use it - if(this.buffer['slice'] != null) { - return this.buffer.slice(0, this.position); - } else { - // Create a new buffer to copy content to - var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position); - // Copy content - for(var i = 0; i < this.position; i++) { - newBuffer[i] = this.buffer[i]; - } - // Return the buffer - return newBuffer; - } - } else { - return convertArraytoUtf8BinaryString(this.buffer, 0, this.position); - } - } -}; - -/** - * Length. - * - * @method - * @return {number} the length of the binary. - */ -Binary.prototype.length = function length() { - return this.position; -}; - -/** - * @ignore - */ -Binary.prototype.toJSON = function() { - return this.buffer != null ? this.buffer.toString('base64') : ''; -} - -/** - * @ignore - */ -Binary.prototype.toString = function(format) { - return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; -} - -/** - * Binary default subtype - * @ignore - */ -var BSON_BINARY_SUBTYPE_DEFAULT = 0; - -/** - * @ignore - */ -var writeStringToArray = function(data) { - // Create a buffer - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length); - // Write the content to the buffer - for(var i = 0; i < data.length; i++) { - buffer[i] = data.charCodeAt(i); - } - // Write the string to the buffer - return buffer; -} - -/** - * Convert Array ot Uint8Array to Binary String - * - * @ignore - */ -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - return result; -}; - -Binary.BUFFER_SIZE = 256; - -/** - * Default BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_DEFAULT = 0; -/** - * Function BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_FUNCTION = 1; -/** - * Byte Array BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_BYTE_ARRAY = 2; -/** - * OLD UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID_OLD = 3; -/** - * UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID = 4; -/** - * MD5 BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_MD5 = 5; -/** - * User BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_USER_DEFINED = 128; - -/** - * Expose. - */ -module.exports = Binary; -module.exports.Binary = Binary; diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js deleted file mode 100644 index d2fc811f..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js +++ /dev/null @@ -1,385 +0,0 @@ -/** - * Binary Parser. - * Jonas Raoni Soares Silva - * http://jsfromhell.com/classes/binary-parser [v1.0] - */ -var chr = String.fromCharCode; - -var maxBits = []; -for (var i = 0; i < 64; i++) { - maxBits[i] = Math.pow(2, i); -} - -function BinaryParser (bigEndian, allowExceptions) { - if(!(this instanceof BinaryParser)) return new BinaryParser(bigEndian, allowExceptions); - - this.bigEndian = bigEndian; - this.allowExceptions = allowExceptions; -}; - -BinaryParser.warn = function warn (msg) { - if (this.allowExceptions) { - throw new Error(msg); - } - - return 1; -}; - -BinaryParser.decodeFloat = function decodeFloat (data, precisionBits, exponentBits) { - var b = new this.Buffer(this.bigEndian, data); - - b.checkBuffer(precisionBits + exponentBits + 1); - - var bias = maxBits[exponentBits - 1] - 1 - , signal = b.readBits(precisionBits + exponentBits, 1) - , exponent = b.readBits(precisionBits, exponentBits) - , significand = 0 - , divisor = 2 - , curByte = b.buffer.length + (-precisionBits >> 3) - 1; - - do { - for (var byteValue = b.buffer[ ++curByte ], startBit = precisionBits % 8 || 8, mask = 1 << startBit; mask >>= 1; ( byteValue & mask ) && ( significand += 1 / divisor ), divisor *= 2 ); - } while (precisionBits -= startBit); - - return exponent == ( bias << 1 ) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity : ( 1 + signal * -2 ) * ( exponent || significand ? !exponent ? Math.pow( 2, -bias + 1 ) * significand : Math.pow( 2, exponent - bias ) * ( 1 + significand ) : 0 ); -}; - -BinaryParser.decodeInt = function decodeInt (data, bits, signed, forceBigEndian) { - var b = new this.Buffer(this.bigEndian || forceBigEndian, data) - , x = b.readBits(0, bits) - , max = maxBits[bits]; //max = Math.pow( 2, bits ); - - return signed && x >= max / 2 - ? x - max - : x; -}; - -BinaryParser.encodeFloat = function encodeFloat (data, precisionBits, exponentBits) { - var bias = maxBits[exponentBits - 1] - 1 - , minExp = -bias + 1 - , maxExp = bias - , minUnnormExp = minExp - precisionBits - , n = parseFloat(data) - , status = isNaN(n) || n == -Infinity || n == +Infinity ? n : 0 - , exp = 0 - , len = 2 * bias + 1 + precisionBits + 3 - , bin = new Array(len) - , signal = (n = status !== 0 ? 0 : n) < 0 - , intPart = Math.floor(n = Math.abs(n)) - , floatPart = n - intPart - , lastBit - , rounded - , result - , i - , j; - - for (i = len; i; bin[--i] = 0); - - for (i = bias + 2; intPart && i; bin[--i] = intPart % 2, intPart = Math.floor(intPart / 2)); - - for (i = bias + 1; floatPart > 0 && i; (bin[++i] = ((floatPart *= 2) >= 1) - 0 ) && --floatPart); - - for (i = -1; ++i < len && !bin[i];); - - if (bin[(lastBit = precisionBits - 1 + (i = (exp = bias + 1 - i) >= minExp && exp <= maxExp ? i + 1 : bias + 1 - (exp = minExp - 1))) + 1]) { - if (!(rounded = bin[lastBit])) { - for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]); - } - - for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0)); - } - - for (i = i - 2 < 0 ? -1 : i - 3; ++i < len && !bin[i];); - - if ((exp = bias + 1 - i) >= minExp && exp <= maxExp) { - ++i; - } else if (exp < minExp) { - exp != bias + 1 - len && exp < minUnnormExp && this.warn("encodeFloat::float underflow"); - i = bias + 1 - (exp = minExp - 1); - } - - if (intPart || status !== 0) { - this.warn(intPart ? "encodeFloat::float overflow" : "encodeFloat::" + status); - exp = maxExp + 1; - i = bias + 2; - - if (status == -Infinity) { - signal = 1; - } else if (isNaN(status)) { - bin[i] = 1; - } - } - - for (n = Math.abs(exp + bias), j = exponentBits + 1, result = ""; --j; result = (n % 2) + result, n = n >>= 1); - - for (n = 0, j = 0, i = (result = (signal ? "1" : "0") + result + bin.slice(i, i + precisionBits).join("")).length, r = []; i; j = (j + 1) % 8) { - n += (1 << j) * result.charAt(--i); - if (j == 7) { - r[r.length] = String.fromCharCode(n); - n = 0; - } - } - - r[r.length] = n - ? String.fromCharCode(n) - : ""; - - return (this.bigEndian ? r.reverse() : r).join(""); -}; - -BinaryParser.encodeInt = function encodeInt (data, bits, signed, forceBigEndian) { - var max = maxBits[bits]; - - if (data >= max || data < -(max / 2)) { - this.warn("encodeInt::overflow"); - data = 0; - } - - if (data < 0) { - data += max; - } - - for (var r = []; data; r[r.length] = String.fromCharCode(data % 256), data = Math.floor(data / 256)); - - for (bits = -(-bits >> 3) - r.length; bits--; r[r.length] = "\0"); - - return ((this.bigEndian || forceBigEndian) ? r.reverse() : r).join(""); -}; - -BinaryParser.toSmall = function( data ){ return this.decodeInt( data, 8, true ); }; -BinaryParser.fromSmall = function( data ){ return this.encodeInt( data, 8, true ); }; -BinaryParser.toByte = function( data ){ return this.decodeInt( data, 8, false ); }; -BinaryParser.fromByte = function( data ){ return this.encodeInt( data, 8, false ); }; -BinaryParser.toShort = function( data ){ return this.decodeInt( data, 16, true ); }; -BinaryParser.fromShort = function( data ){ return this.encodeInt( data, 16, true ); }; -BinaryParser.toWord = function( data ){ return this.decodeInt( data, 16, false ); }; -BinaryParser.fromWord = function( data ){ return this.encodeInt( data, 16, false ); }; -BinaryParser.toInt = function( data ){ return this.decodeInt( data, 32, true ); }; -BinaryParser.fromInt = function( data ){ return this.encodeInt( data, 32, true ); }; -BinaryParser.toLong = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromLong = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toDWord = function( data ){ return this.decodeInt( data, 32, false ); }; -BinaryParser.fromDWord = function( data ){ return this.encodeInt( data, 32, false ); }; -BinaryParser.toQWord = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromQWord = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toFloat = function( data ){ return this.decodeFloat( data, 23, 8 ); }; -BinaryParser.fromFloat = function( data ){ return this.encodeFloat( data, 23, 8 ); }; -BinaryParser.toDouble = function( data ){ return this.decodeFloat( data, 52, 11 ); }; -BinaryParser.fromDouble = function( data ){ return this.encodeFloat( data, 52, 11 ); }; - -// Factor out the encode so it can be shared by add_header and push_int32 -BinaryParser.encode_int32 = function encode_int32 (number, asArray) { - var a, b, c, d, unsigned; - unsigned = (number < 0) ? (number + 0x100000000) : number; - a = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - b = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - c = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - d = Math.floor(unsigned); - return asArray ? [chr(a), chr(b), chr(c), chr(d)] : chr(a) + chr(b) + chr(c) + chr(d); -}; - -BinaryParser.encode_int64 = function encode_int64 (number) { - var a, b, c, d, e, f, g, h, unsigned; - unsigned = (number < 0) ? (number + 0x10000000000000000) : number; - a = Math.floor(unsigned / 0xffffffffffffff); - unsigned &= 0xffffffffffffff; - b = Math.floor(unsigned / 0xffffffffffff); - unsigned &= 0xffffffffffff; - c = Math.floor(unsigned / 0xffffffffff); - unsigned &= 0xffffffffff; - d = Math.floor(unsigned / 0xffffffff); - unsigned &= 0xffffffff; - e = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - f = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - g = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - h = Math.floor(unsigned); - return chr(a) + chr(b) + chr(c) + chr(d) + chr(e) + chr(f) + chr(g) + chr(h); -}; - -/** - * UTF8 methods - */ - -// Take a raw binary string and return a utf8 string -BinaryParser.decode_utf8 = function decode_utf8 (binaryStr) { - var len = binaryStr.length - , decoded = '' - , i = 0 - , c = 0 - , c1 = 0 - , c2 = 0 - , c3; - - while (i < len) { - c = binaryStr.charCodeAt(i); - if (c < 128) { - decoded += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = binaryStr.charCodeAt(i+1); - decoded += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = binaryStr.charCodeAt(i+1); - c3 = binaryStr.charCodeAt(i+2); - decoded += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - - return decoded; -}; - -// Encode a cstring -BinaryParser.encode_cstring = function encode_cstring (s) { - return unescape(encodeURIComponent(s)) + BinaryParser.fromByte(0); -}; - -// Take a utf8 string and return a binary string -BinaryParser.encode_utf8 = function encode_utf8 (s) { - var a = "" - , c; - - for (var n = 0, len = s.length; n < len; n++) { - c = s.charCodeAt(n); - - if (c < 128) { - a += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - a += String.fromCharCode((c>>6) | 192) ; - a += String.fromCharCode((c&63) | 128); - } else { - a += String.fromCharCode((c>>12) | 224); - a += String.fromCharCode(((c>>6) & 63) | 128); - a += String.fromCharCode((c&63) | 128); - } - } - - return a; -}; - -BinaryParser.hprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } - } - - process.stdout.write("\n\n"); -}; - -BinaryParser.ilprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -BinaryParser.hlprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -/** - * BinaryParser buffer constructor. - */ -function BinaryParserBuffer (bigEndian, buffer) { - this.bigEndian = bigEndian || 0; - this.buffer = []; - this.setBuffer(buffer); -}; - -BinaryParserBuffer.prototype.setBuffer = function setBuffer (data) { - var l, i, b; - - if (data) { - i = l = data.length; - b = this.buffer = new Array(l); - for (; i; b[l - i] = data.charCodeAt(--i)); - this.bigEndian && b.reverse(); - } -}; - -BinaryParserBuffer.prototype.hasNeededBits = function hasNeededBits (neededBits) { - return this.buffer.length >= -(-neededBits >> 3); -}; - -BinaryParserBuffer.prototype.checkBuffer = function checkBuffer (neededBits) { - if (!this.hasNeededBits(neededBits)) { - throw new Error("checkBuffer::missing bytes"); - } -}; - -BinaryParserBuffer.prototype.readBits = function readBits (start, length) { - //shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni) - - function shl (a, b) { - for (; b--; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1); - return a; - } - - if (start < 0 || length <= 0) { - return 0; - } - - this.checkBuffer(start + length); - - var offsetLeft - , offsetRight = start % 8 - , curByte = this.buffer.length - ( start >> 3 ) - 1 - , lastByte = this.buffer.length + ( -( start + length ) >> 3 ) - , diff = curByte - lastByte - , sum = ((this.buffer[ curByte ] >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1)) + (diff && (offsetLeft = (start + length) % 8) ? (this.buffer[lastByte++] & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight : 0); - - for(; diff; sum += shl(this.buffer[lastByte++], (diff-- << 3) - offsetRight)); - - return sum; -}; - -/** - * Expose. - */ -BinaryParser.Buffer = BinaryParserBuffer; - -exports.BinaryParser = BinaryParser; diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/bson.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/bson.js deleted file mode 100644 index 36f00573..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/bson.js +++ /dev/null @@ -1,323 +0,0 @@ -// "use strict" - -var writeIEEE754 = require('./float_parser').writeIEEE754, - readIEEE754 = require('./float_parser').readIEEE754, - Map = require('./map'), - Long = require('./long').Long, - Double = require('./double').Double, - Timestamp = require('./timestamp').Timestamp, - ObjectID = require('./objectid').ObjectID, - BSONRegExp = require('./regexp').BSONRegExp, - Symbol = require('./symbol').Symbol, - Code = require('./code').Code, - MinKey = require('./min_key').MinKey, - MaxKey = require('./max_key').MaxKey, - DBRef = require('./db_ref').DBRef, - Binary = require('./binary').Binary; - -// Parts of the parser -var deserialize = require('./parser/deserializer'), - serializer = require('./parser/serializer'), - calculateObjectSize = require('./parser/calculate_size'); - -/** - * @ignore - * @api private - */ -// Max Size -var MAXSIZE = (1024*1024*17); -// Max Document Buffer size -var buffer = new Buffer(MAXSIZE); - -var BSON = function() { -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.prototype.serialize = function serialize(object, checkKeys, asBuffer, serializeFunctions, index, ignoreUndefined) { - // Attempt to serialize - var serializationIndex = serializer(buffer, object, checkKeys, index || 0, 0, serializeFunctions, ignoreUndefined); - // Create the final buffer - var finishedBuffer = new Buffer(serializationIndex); - // Copy into the finished buffer - buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length); - // Return the buffer - return finishedBuffer; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, finalBuffer, startIndex, serializeFunctions, ignoreUndefined) { - // Attempt to serialize - var serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined); - buffer.copy(finalBuffer, startIndex, 0, serializationIndex); - // Return the index - return startIndex + serializationIndex - 1; -} - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.prototype.deserialize = function(data, options) { - return deserialize(data, options); -} - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.prototype.calculateObjectSize = function(object, serializeFunctions, ignoreUndefined) { - return calculateObjectSize(object, serializeFunctions, ignoreUndefined); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); - options = options != null ? options : {}; - var index = startIndex; - // Loop over all documents - for(var i = 0; i < numberOfDocuments; i++) { - // Find size of the document - var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; - // Update options with index - options['index'] = index; - // Parse the document at this point - documents[docStartIndex + i] = this.deserialize(data, options); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} - -/** - * @ignore - * @api private - */ -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// Return BSON -module.exports = BSON; -module.exports.Code = Code; -module.exports.Map = Map; -module.exports.Symbol = Symbol; -module.exports.BSON = BSON; -module.exports.DBRef = DBRef; -module.exports.Binary = Binary; -module.exports.ObjectID = ObjectID; -module.exports.Long = Long; -module.exports.Timestamp = Timestamp; -module.exports.Double = Double; -module.exports.MinKey = MinKey; -module.exports.MaxKey = MaxKey; -module.exports.BSONRegExp = BSONRegExp; diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/code.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/code.js deleted file mode 100644 index 83a42c96..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/code.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * A class representation of the BSON Code type. - * - * @class - * @param {(string|function)} code a string or function. - * @param {Object} [scope] an optional scope for the function. - * @return {Code} - */ -var Code = function Code(code, scope) { - if(!(this instanceof Code)) return new Code(code, scope); - this._bsontype = 'Code'; - this.code = code; - this.scope = scope == null ? {} : scope; -}; - -/** - * @ignore - */ -Code.prototype.toJSON = function() { - return {scope:this.scope, code:this.code}; -} - -module.exports = Code; -module.exports.Code = Code; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js deleted file mode 100644 index 06789a6c..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * A class representation of the BSON DBRef type. - * - * @class - * @param {string} namespace the collection name. - * @param {ObjectID} oid the reference ObjectID. - * @param {string} [db] optional db name, if omitted the reference is local to the current db. - * @return {DBRef} - */ -function DBRef(namespace, oid, db) { - if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db); - - this._bsontype = 'DBRef'; - this.namespace = namespace; - this.oid = oid; - this.db = db; -}; - -/** - * @ignore - * @api private - */ -DBRef.prototype.toJSON = function() { - return { - '$ref':this.namespace, - '$id':this.oid, - '$db':this.db == null ? '' : this.db - }; -} - -module.exports = DBRef; -module.exports.DBRef = DBRef; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/double.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/double.js deleted file mode 100644 index 09ed2229..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/double.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * A class representation of the BSON Double type. - * - * @class - * @param {number} value the number we want to represent as a double. - * @return {Double} - */ -function Double(value) { - if(!(this instanceof Double)) return new Double(value); - - this._bsontype = 'Double'; - this.value = value; -} - -/** - * Access the number value. - * - * @method - * @return {number} returns the wrapped double number. - */ -Double.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - */ -Double.prototype.toJSON = function() { - return this.value; -} - -module.exports = Double; -module.exports.Double = Double; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js deleted file mode 100644 index 6fca3924..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2008, Fair Oaks Labs, Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// -// Modifications to writeIEEE754 to support negative zeroes made by Brian White - -var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { - var e, m, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - nBits = -7, - i = bBE ? 0 : (nBytes - 1), - d = bBE ? 1 : -1, - s = buffer[offset + i]; - - i += d; - - e = s & ((1 << (-nBits)) - 1); - s >>= (-nBits); - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - - m = e & ((1 << (-nBits)) - 1); - e >>= (-nBits); - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity); - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; - -var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { - var e, m, c, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), - i = bBE ? (nBytes-1) : 0, - d = bBE ? -1 : 1, - s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; - - value = Math.abs(value); - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e+eBias >= 1) { - value += rt / c; - } else { - value += rt * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - - e = (e << mLen) | m; - eLen += mLen; - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - - buffer[offset + i - d] |= s * 128; -}; - -exports.readIEEE754 = readIEEE754; -exports.writeIEEE754 = writeIEEE754; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/index.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/index.js deleted file mode 100644 index 4fc02186..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/index.js +++ /dev/null @@ -1,86 +0,0 @@ -try { - exports.BSONPure = require('./bson'); - exports.BSONNative = require('./bson'); -} catch(err) { -} - -[ './binary_parser' - , './binary' - , './code' - , './map' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './regexp' - , './symbol' - , './timestamp' - , './long'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - exports[i] = module[i]; - } -}); - -// Exports all the classes for the PURE JS BSON Parser -exports.pure = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './map' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './regexp' - , './symbol' - , './timestamp' - , './long' - , '././bson'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} - -// Exports all the classes for the NATIVE JS BSON Parser -exports.native = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './map' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './regexp' - , './symbol' - , './timestamp' - , './long' - ].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - - // Catch error and return no classes found - try { - classes['BSON'] = require('./bson'); - } catch(err) { - return exports.pure(); - } - - // Return classes list - return classes; -} diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/long.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/long.js deleted file mode 100644 index 6f188850..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/long.js +++ /dev/null @@ -1,856 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Long class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Long". This - * implementation is derived from LongLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Longs. - * - * The internal representation of a Long is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class - * @param {number} low the low (signed) 32 bits of the Long. - * @param {number} high the high (signed) 32 bits of the Long. - * @return {Long} - */ -function Long(low, high) { - if(!(this instanceof Long)) return new Long(low, high); - - this._bsontype = 'Long'; - /** - * @type {number} - * @ignore - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @ignore - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @method - * @return {number} the value, assuming it is a 32-bit integer. - */ -Long.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @method - * @return {number} the closest floating-point representation to this value. - */ -Long.prototype.toNumber = function() { - return this.high_ * Long.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @method - * @return {string} the JSON representation. - */ -Long.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @method - * @param {number} [opt_radix] the radix in which the text should be written. - * @return {string} the textual representation of this value. - */ -Long.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - // We need to change the Long value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixLong = Long.fromNumber(radix); - var div = this.div(radixLong); - var rem = div.multiply(radixLong).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @method - * @return {number} the high 32-bits as a signed value. - */ -Long.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @method - * @return {number} the low 32-bits as a signed value. - */ -Long.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @method - * @return {number} the low 32-bits as an unsigned value. - */ -Long.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Long. - * - * @method - * @return {number} Returns the number of bits needed to represent the absolute value of this Long. - */ -Long.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @method - * @return {boolean} whether this value is zero. - */ -Long.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @method - * @return {boolean} whether this value is negative. - */ -Long.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @method - * @return {boolean} whether this value is odd. - */ -Long.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Long equals the other - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long equals the other - */ -Long.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Long does not equal the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long does not equal the other. - */ -Long.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Long is less than the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is less than the other. - */ -Long.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Long is less than or equal to the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is less than or equal to the other. - */ -Long.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Long is greater than the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is greater than the other. - */ -Long.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Long is greater than or equal to the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is greater than or equal to the other. - */ -Long.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Long with the given one. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - */ -Long.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @method - * @return {Long} the negation of this value. - */ -Long.prototype.negate = function() { - if (this.equals(Long.MIN_VALUE)) { - return Long.MIN_VALUE; - } else { - return this.not().add(Long.ONE); - } -}; - -/** - * Returns the sum of this and the given Long. - * - * @method - * @param {Long} other Long to add to this one. - * @return {Long} the sum of this and the given Long. - */ -Long.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Long. - * - * @method - * @param {Long} other Long to subtract from this. - * @return {Long} the difference of this and the given Long. - */ -Long.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Long. - * - * @method - * @param {Long} other Long to multiply with this. - * @return {Long} the product of this and the other. - */ -Long.prototype.multiply = function(other) { - if (this.isZero()) { - return Long.ZERO; - } else if (other.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } else if (other.equals(Long.MIN_VALUE)) { - return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Longs are small, use float multiplication - if (this.lessThan(Long.TWO_PWR_24_) && - other.lessThan(Long.TWO_PWR_24_)) { - return Long.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Long divided by the given one. - * - * @method - * @param {Long} other Long by which to divide. - * @return {Long} this Long divided by the given one. - */ -Long.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - if (other.equals(Long.ONE) || - other.equals(Long.NEG_ONE)) { - return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Long.ZERO)) { - return other.isNegative() ? Long.ONE : Long.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Long.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Long.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Long.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Long.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Long modulo the given one. - * - * @method - * @param {Long} other Long by which to mod. - * @return {Long} this Long modulo the given one. - */ -Long.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @method - * @return {Long} the bitwise-NOT of this value. - */ -Long.prototype.not = function() { - return Long.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Long and the given one. - * - * @method - * @param {Long} other the Long with which to AND. - * @return {Long} the bitwise-AND of this and the other. - */ -Long.prototype.and = function(other) { - return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Long and the given one. - * - * @method - * @param {Long} other the Long with which to OR. - * @return {Long} the bitwise-OR of this and the other. - */ -Long.prototype.or = function(other) { - return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Long and the given one. - * - * @method - * @param {Long} other the Long with which to XOR. - * @return {Long} the bitwise-XOR of this and the other. - */ -Long.prototype.xor = function(other) { - return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Long with bits shifted to the left by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the left by the given amount. - */ -Long.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Long.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Long.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount. - */ -Long.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Long.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. - */ -Long.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Long.fromBits(high, 0); - } else { - return Long.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Long representing the given (32-bit) integer value. - * - * @method - * @param {number} value the 32-bit integer in question. - * @return {Long} the corresponding Long value. - */ -Long.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Long.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Long(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Long.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @method - * @param {number} value the number in question. - * @return {Long} the corresponding Long value. - */ -Long.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Long.ZERO; - } else if (value <= -Long.TWO_PWR_63_DBL_) { - return Long.MIN_VALUE; - } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { - return Long.MAX_VALUE; - } else if (value < 0) { - return Long.fromNumber(-value).negate(); - } else { - return new Long( - (value % Long.TWO_PWR_32_DBL_) | 0, - (value / Long.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @method - * @param {number} lowBits the low 32-bits. - * @param {number} highBits the high 32-bits. - * @return {Long} the corresponding Long value. - */ -Long.fromBits = function(lowBits, highBits) { - return new Long(lowBits, highBits); -}; - -/** - * Returns a Long representation of the given string, written using the given radix. - * - * @method - * @param {string} str the textual representation of the Long. - * @param {number} opt_radix the radix in which the text is written. - * @return {Long} the corresponding Long value. - */ -Long.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Long.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 8)); - - var result = Long.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Long.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Long.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Long.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Long representations of small integer values. - * @type {Object} - * @ignore - */ -Long.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @ignore - */ -Long.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; - -/** @type {Long} */ -Long.ZERO = Long.fromInt(0); - -/** @type {Long} */ -Long.ONE = Long.fromInt(1); - -/** @type {Long} */ -Long.NEG_ONE = Long.fromInt(-1); - -/** @type {Long} */ -Long.MAX_VALUE = - Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Long} */ -Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); - -/** - * @type {Long} - * @ignore - */ -Long.TWO_PWR_24_ = Long.fromInt(1 << 24); - -/** - * Expose. - */ -module.exports = Long; -module.exports.Long = Long; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/map.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/map.js deleted file mode 100644 index f53c8c16..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/map.js +++ /dev/null @@ -1,126 +0,0 @@ -"use strict" - -// We have an ES6 Map available, return the native instance -if(typeof global.Map !== 'undefined') { - module.exports = global.Map; - module.exports.Map = global.Map; -} else { - // We will return a polyfill - var Map = function(array) { - this._keys = []; - this._values = {}; - - for(var i = 0; i < array.length; i++) { - if(array[i] == null) continue; // skip null and undefined - var entry = array[i]; - var key = entry[0]; - var value = entry[1]; - // Add the key to the list of keys in order - this._keys.push(key); - // Add the key and value to the values dictionary with a point - // to the location in the ordered keys list - this._values[key] = {v: value, i: this._keys.length - 1}; - } - } - - Map.prototype.clear = function() { - this._keys = []; - this._values = {}; - } - - Map.prototype.delete = function(key) { - var value = this._values[key]; - if(value == null) return false; - // Delete entry - delete this._values[key]; - // Remove the key from the ordered keys list - this._keys.splice(value.i, 1); - return true; - } - - Map.prototype.entries = function() { - var self = this; - var index = 0; - - return { - next: function() { - var key = self._keys[index++]; - return { - value: key !== undefined ? [key, self._values[key].v] : undefined, - done: key !== undefined ? false : true - } - } - }; - } - - Map.prototype.forEach = function(callback, self) { - self = self || this; - - for(var i = 0; i < this._keys.length; i++) { - var key = this._keys[i]; - // Call the forEach callback - callback.call(self, this._values[key].v, key, self); - } - } - - Map.prototype.get = function(key) { - return this._values[key] ? this._values[key].v : undefined; - } - - Map.prototype.has = function(key) { - return this._values[key] != null; - } - - Map.prototype.keys = function(key) { - var self = this; - var index = 0; - - return { - next: function() { - var key = self._keys[index++]; - return { - value: key !== undefined ? key : undefined, - done: key !== undefined ? false : true - } - } - }; - } - - Map.prototype.set = function(key, value) { - if(this._values[key]) { - this._values[key].v = value; - return this; - } - - // Add the key to the list of keys in order - this._keys.push(key); - // Add the key and value to the values dictionary with a point - // to the location in the ordered keys list - this._values[key] = {v: value, i: this._keys.length - 1}; - return this; - } - - Map.prototype.values = function(key, value) { - var self = this; - var index = 0; - - return { - next: function() { - var key = self._keys[index++]; - return { - value: key !== undefined ? self._values[key].v : undefined, - done: key !== undefined ? false : true - } - } - }; - } - - // Last ismaster - Object.defineProperty(Map.prototype, 'size', { - enumerable:true, - get: function() { return this._keys.length; } - }); - - module.exports = Map; - module.exports.Map = Map; -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js deleted file mode 100644 index 03ee9cdd..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * A class representation of the BSON MaxKey type. - * - * @class - * @return {MaxKey} A MaxKey instance - */ -function MaxKey() { - if(!(this instanceof MaxKey)) return new MaxKey(); - - this._bsontype = 'MaxKey'; -} - -module.exports = MaxKey; -module.exports.MaxKey = MaxKey; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js deleted file mode 100644 index 5e120fbe..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * A class representation of the BSON MinKey type. - * - * @class - * @return {MinKey} A MinKey instance - */ -function MinKey() { - if(!(this instanceof MinKey)) return new MinKey(); - - this._bsontype = 'MinKey'; -} - -module.exports = MinKey; -module.exports.MinKey = MinKey; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js deleted file mode 100644 index f8ec3839..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js +++ /dev/null @@ -1,278 +0,0 @@ -/** - * Module dependencies. - * @ignore - */ -var BinaryParser = require('./binary_parser').BinaryParser; - -/** - * Machine id. - * - * Create a random 3-byte value (i.e. unique for this - * process). Other drivers use a md5 of the machine id here, but - * that would mean an asyc call to gethostname, so we don't bother. - * @ignore - */ -var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10); - -// Regular expression that checks for hex value -var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$"); - -/** -* Create a new ObjectID instance -* -* @class -* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number. -* @property {number} generationTime The generation time of this ObjectId instance -* @return {ObjectID} instance of ObjectID. -*/ -var ObjectID = function ObjectID(id) { - if(!(this instanceof ObjectID)) return new ObjectID(id); - if((id instanceof ObjectID)) return id; - - this._bsontype = 'ObjectID'; - var __id = null; - var valid = ObjectID.isValid(id); - - // Throw an error if it's not a valid setup - if(!valid && id != null){ - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - } else if(valid && typeof id == 'string' && id.length == 24) { - return ObjectID.createFromHexString(id); - } else if(id == null || typeof id == 'number') { - // convert to 12 byte binary string - this.id = this.generate(id); - } else if(id != null && id.length === 12) { - // assume 12 byte string - this.id = id; - } - - if(ObjectID.cacheHexString) this.__id = this.toHexString(); -}; - -// Allow usage of ObjectId as well as ObjectID -var ObjectId = ObjectID; - -// Precomputed hex table enables speedy hex string conversion -var hexTable = []; -for (var i = 0; i < 256; i++) { - hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); -} - -/** -* Return the ObjectID id as a 24 byte hex string representation -* -* @method -* @return {string} return the 24 byte hex string representation. -*/ -ObjectID.prototype.toHexString = function() { - if(ObjectID.cacheHexString && this.__id) return this.__id; - - var hexString = ''; - - for (var i = 0; i < this.id.length; i++) { - hexString += hexTable[this.id.charCodeAt(i)]; - } - - if(ObjectID.cacheHexString) this.__id = hexString; - return hexString; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @method -* @return {number} returns next index value. -* @ignore -*/ -ObjectID.prototype.get_inc = function() { - return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @method -* @return {number} returns next index value. -* @ignore -*/ -ObjectID.prototype.getInc = function() { - return this.get_inc(); -}; - -/** -* Generate a 12 byte id string used in ObjectID's -* -* @method -* @param {number} [time] optional parameter allowing to pass in a second based timestamp. -* @return {string} return the 12 byte id binary string. -*/ -ObjectID.prototype.generate = function(time) { - if ('number' != typeof time) { - time = parseInt(Date.now()/1000,10); - } - - var time4Bytes = BinaryParser.encodeInt(time, 32, true, true); - /* for time-based ObjectID the bytes following the time will be zeroed */ - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid % 0xFFFF); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - - return time4Bytes + machine3Bytes + pid2Bytes + index3Bytes; -}; - -/** -* Converts the id into a 24 byte hex string for printing -* -* @return {String} return the 24 byte hex string representation. -* @ignore -*/ -ObjectID.prototype.toString = function() { - return this.toHexString(); -}; - -/** -* Converts to a string representation of this Id. -* -* @return {String} return the 24 byte hex string representation. -* @ignore -*/ -ObjectID.prototype.inspect = ObjectID.prototype.toString; - -/** -* Converts to its JSON representation. -* -* @return {String} return the 24 byte hex string representation. -* @ignore -*/ -ObjectID.prototype.toJSON = function() { - return this.toHexString(); -}; - -/** -* Compares the equality of this ObjectID with `otherID`. -* -* @method -* @param {object} otherID ObjectID instance to compare against. -* @return {boolean} the result of comparing two ObjectID's -*/ -ObjectID.prototype.equals = function equals (otherID) { - var id; - - if(otherID != null && (otherID instanceof ObjectID || otherID.toHexString)) { - id = otherID.id; - } else if(typeof otherID == 'string' && ObjectID.isValid(otherID)) { - id = ObjectID.createFromHexString(otherID).id; - } else { - return false; - } - - return this.id === id; -} - -/** -* Returns the generation date (accurate up to the second) that this ID was generated. -* -* @method -* @return {date} the generation date -*/ -ObjectID.prototype.getTimestamp = function() { - var timestamp = new Date(); - timestamp.setTime(Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)) * 1000); - return timestamp; -} - -/** -* @ignore -*/ -ObjectID.index = parseInt(Math.random() * 0xFFFFFF, 10); - -/** -* @ignore -*/ -ObjectID.createPk = function createPk () { - return new ObjectID(); -}; - -/** -* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. -* -* @method -* @param {number} time an integer number representing a number of seconds. -* @return {ObjectID} return the created ObjectID -*/ -ObjectID.createFromTime = function createFromTime (time) { - var id = BinaryParser.encodeInt(time, 32, true, true) + - BinaryParser.encodeInt(0, 64, true, true); - return new ObjectID(id); -}; - -/** -* Creates an ObjectID from a hex string representation of an ObjectID. -* -* @method -* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring. -* @return {ObjectID} return the created ObjectID -*/ -ObjectID.createFromHexString = function createFromHexString (hexString) { - // Throw an error if it's not a valid setup - if(typeof hexString === 'undefined' || hexString != null && hexString.length != 24) - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - - var len = hexString.length; - - if(len > 12*2) { - throw new Error('Id cannot be longer than 12 bytes'); - } - - var result = '' - , string - , number; - - for (var index = 0; index < len; index += 2) { - string = hexString.substr(index, 2); - number = parseInt(string, 16); - result += BinaryParser.fromByte(number); - } - - return new ObjectID(result, hexString); -}; - -/** -* Checks if a value is a valid bson ObjectId -* -* @method -* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise. -*/ -ObjectID.isValid = function isValid(id) { - if(id == null) return false; - - if(typeof id == 'number') - return true; - if(typeof id == 'string') { - return id.length == 12 || (id.length == 24 && checkForHexRegExp.test(id)); - } - return false; -}; - -/** -* @ignore -*/ -Object.defineProperty(ObjectID.prototype, "generationTime", { - enumerable: true - , get: function () { - return Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)); - } - , set: function (value) { - var value = BinaryParser.encodeInt(value, 32, true, true); - this.id = value + this.id.substr(4); - // delete this.__id; - this.toHexString(); - } -}); - -/** - * Expose. - */ -module.exports = ObjectID; -module.exports.ObjectID = ObjectID; -module.exports.ObjectId = ObjectID; diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js deleted file mode 100644 index 03513f32..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js +++ /dev/null @@ -1,310 +0,0 @@ -"use strict" - -var writeIEEE754 = require('../float_parser').writeIEEE754 - , readIEEE754 = require('../float_parser').readIEEE754 - , Long = require('../long').Long - , Double = require('../double').Double - , Timestamp = require('../timestamp').Timestamp - , ObjectID = require('../objectid').ObjectID - , Symbol = require('../symbol').Symbol - , BSONRegExp = require('../regexp').BSONRegExp - , Code = require('../code').Code - , MinKey = require('../min_key').MinKey - , MaxKey = require('../max_key').MaxKey - , DBRef = require('../db_ref').DBRef - , Binary = require('../binary').Binary; - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -var calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) { - var totalLength = (4 + 1); - - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined) - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Calculate size - for(var key in object) { - totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined) - } - } - - return totalLength; -} - -/** - * @ignore - * @api private - */ -function calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) { - // If we have toBSON defined, override the current object - if(value && value.toBSON){ - value = value.toBSON(); - } - - switch(typeof value) { - case 'string': - return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1; - case 'number': - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (4 + 1); - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } - } else { // 64 bit - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } - case 'undefined': - if(isArray || !ignoreUndefined) return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1); - return 0; - case 'boolean': - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 1); - case 'object': - if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1); - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (12 + 1); - } else if(value instanceof Date || isDate(value)) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 4 + 1) + value.length; - } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp - || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - // Calculate size depending on the availability of a scope - if(value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined); - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Check what kind of subtype we have - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1 + 4); - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1); - } - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1; - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined); - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else if(value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1 - + Buffer.byteLength(value.options, 'utf8') + 1 - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined); - } else if(serializeFunctions) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1; - } - } - } - - return 0; -} - -var BSON = {}; - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -module.exports = calculateObjectSize; diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js deleted file mode 100644 index dc1281be..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js +++ /dev/null @@ -1,555 +0,0 @@ -"use strict" - -var writeIEEE754 = require('../float_parser').writeIEEE754, - readIEEE754 = require('../float_parser').readIEEE754, - f = require('util').format, - Long = require('../long').Long, - Double = require('../double').Double, - Timestamp = require('../timestamp').Timestamp, - ObjectID = require('../objectid').ObjectID, - Symbol = require('../symbol').Symbol, - Code = require('../code').Code, - MinKey = require('../min_key').MinKey, - MaxKey = require('../max_key').MaxKey, - DBRef = require('../db_ref').DBRef, - BSONRegExp = require('../regexp').BSONRegExp, - Binary = require('../binary').Binary; - -var deserialize = function(buffer, options, isArray) { - var index = 0; - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || buffer.length < size) { - throw new Error("corrupt bson message"); - } - - // Illegal end value - if(buffer[size - 1] != 0) { - throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00"); - } - - // Start deserializtion - return deserializeObject(buffer, options, isArray); -} - -// Reads in a C style string -var readCStyleStringSpecial = function(buffer, index) { - // Get the start search index - var i = index; - // Locate the end of the c string - while(buffer[i] !== 0x00 && i < buffer.length) { - i++ - } - // If are at the end of the buffer there is a problem with the document - if(i >= buffer.length) throw new Error("Bad BSON Document: illegal CString") - // Grab utf8 encoded string - var string = buffer.toString('utf8', index, i); - // Update index position - index = i + 1; - // Return string - return {s: string, i: index}; -} - -var deserializeObject = function(buffer, options, isArray) { - // Options - options = options == null ? {} : options; - var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; - var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; - var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; - var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs']; - var fieldsAsRaw = options['fieldsAsRaw'] == null ? {} : options['fieldsAsRaw']; - // Return BSONRegExp objects instead of native regular expressions - var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false; - var promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers']; - - // Validate that we have at least 4 bytes of buffer - if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); - - // Set up index - var index = typeof options['index'] == 'number' ? options['index'] : 0; - - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || size > buffer.length) throw new Error("corrupt bson message"); - - // Create holding object - var object = isArray ? [] : {}; - - // While we have more left data left keep parsing - while(true) { - // Read the type - var elementType = buffer[index++]; - // If we get a zero it's the last byte, exit - if(elementType == 0) break; - // Read the name of the field - var r = readCStyleStringSpecial(buffer, index); - var name = r.s; - index = r.i; - - // Switch on the type - if(elementType == BSON.BSON_DATA_OID) { - var string = buffer.toString('binary', index, index + 12); - // Decode the oid - object[name] = new ObjectID(string); - // Update index - index = index + 12; - } else if(elementType == BSON.BSON_DATA_STRING) { - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Add string to object - object[name] = buffer.toString('utf8', index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - } else if(elementType == BSON.BSON_DATA_INT) { - // Decode the 32bit value - object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } else if(elementType == BSON.BSON_DATA_NUMBER) { - // Decode the double value - object[name] = readIEEE754(buffer, index, 'little', 52, 8); - // Update the index - index = index + 8; - } else if(elementType == BSON.BSON_DATA_DATE) { - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set date object - object[name] = new Date(new Long(lowBits, highBits).toNumber()); - } else if(elementType == BSON.BSON_DATA_BOOLEAN) { - // Parse the boolean value - object[name] = buffer[index++] == 1; - } else if(elementType == BSON.BSON_DATA_UNDEFINED || elementType == BSON.BSON_DATA_NULL) { - // Parse the boolean value - object[name] = null; - } else if(elementType == BSON.BSON_DATA_BINARY) { - // Decode the size of the binary blob - var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Decode the subtype - var subType = buffer[index++]; - // Decode as raw Buffer object if options specifies it - if(buffer['slice'] != null) { - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - if(promoteBuffers) { - // assign reference to sliced Buffer object - object[name] = buffer.slice(index, index + binarySize); - } else { - // Slice the data - object[name] = new Binary(buffer.slice(index, index + binarySize), subType); - } - } else { - var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize); - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Copy the data - for(var i = 0; i < binarySize; i++) { - _buffer[i] = buffer[index + i]; - } - if(promoteBuffers) { - // assign reference to Buffer object - object[name] = _buffer; - } else { - // Create the binary object - object[name] = new Binary(_buffer, subType); - } - } - // Update the index - index = index + binarySize; - } else if(elementType == BSON.BSON_DATA_ARRAY) { - options['index'] = index; - // Decode the size of the array document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - var arrayOptions = options; - - // All elements of array to be returned as raw bson - if(fieldsAsRaw[name]) { - arrayOptions = {}; - for(var n in options) arrayOptions[n] = options[n]; - arrayOptions['raw'] = true; - } - - // Set the array to the object - object[name] = deserializeObject(buffer, arrayOptions, true); - // Adjust the index - index = index + objectSize; - } else if(elementType == BSON.BSON_DATA_OBJECT) { - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Validate if string Size is larger than the actual provided buffer - if(objectSize <= 0 || objectSize > (buffer.length - index)) throw new Error("bad embedded document length in bson"); - - // We have a raw value - if(options['raw']) { - // Set the array to the object - object[name] = buffer.slice(index, index + objectSize); - } else { - // Set the array to the object - object[name] = deserializeObject(buffer, options, false); - } - - // Adjust the index - index = index + objectSize; - } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) { - // Create the regexp - var r = readCStyleStringSpecial(buffer, index); - var source = r.s; - index = r.i; - - var r = readCStyleStringSpecial(buffer, index); - var regExpOptions = r.s; - index = r.i; - - // For each option add the corresponding one for javascript - var optionsArray = new Array(regExpOptions.length); - - // Parse options - for(var i = 0; i < regExpOptions.length; i++) { - switch(regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - object[name] = new RegExp(source, optionsArray.join('')); - } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) { - // Create the regexp - var r = readCStyleStringSpecial(buffer, index); - var source = r.s; - index = r.i; - - var r = readCStyleStringSpecial(buffer, index); - var regExpOptions = r.s; - index = r.i; - - // Set the object - object[name] = new BSONRegExp(source, regExpOptions); - } else if(elementType == BSON.BSON_DATA_LONG) { - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Create long object - var long = new Long(lowBits, highBits); - // Promote the long if possible - if(promoteLongs) { - object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; - } else { - object[name] = long; - } - } else if(elementType == BSON.BSON_DATA_SYMBOL) { - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Add string to object - object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); - // Update parse index position - index = index + stringSize; - } else if(elementType == BSON.BSON_DATA_TIMESTAMP) { - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set the object - object[name] = new Timestamp(lowBits, highBits); - } else if(elementType == BSON.BSON_DATA_MIN_KEY) { - // Parse the object - object[name] = new MinKey(); - } else if(elementType == BSON.BSON_DATA_MAX_KEY) { - // Parse the object - object[name] = new MaxKey(); - } else if(elementType == BSON.BSON_DATA_CODE) { - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Function string - var functionString = buffer.toString('utf8', index, index + stringSize - 1); - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - } else { - object[name] = new Code(functionString, {}); - } - - // Update parse index position - index = index + stringSize; - } else if(elementType == BSON.BSON_DATA_CODE_W_SCOPE) { - // Read the content of the field - var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Javascript function - var functionString = buffer.toString('utf8', index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - // Parse the element - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Decode the scope object - var scopeObject = deserializeObject(buffer, options, false); - // Adjust the index - index = index + objectSize; - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - - // Set the scope on the object - object[name].scope = scopeObject; - } else { - object[name] = new Code(functionString, scopeObject); - } - } - } - - // Check if we have a db ref object - if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); - - // Return the final objects - return object; -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEvalWithHash = function(functionCache, hash, functionString, object) { - // Contains the value we are going to set - var value = null; - - // Check for cache hit, eval if missing and return cached function - if(functionCache[hash] == null) { - eval("value = " + functionString); - functionCache[hash] = value; - } - // Set the object - return functionCache[hash].bind(object); -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEval = function(functionString) { - // Contains the value we are going to set - var value = null; - // Eval the function - eval("value = " + functionString); - return value; -} - -var BSON = {}; - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -module.exports = deserialize diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js deleted file mode 100644 index de6b13ac..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js +++ /dev/null @@ -1,912 +0,0 @@ -"use strict" - -var writeIEEE754 = require('../float_parser').writeIEEE754, - readIEEE754 = require('../float_parser').readIEEE754, - Long = require('../long').Long, - Map = require('../map'), - Double = require('../double').Double, - Timestamp = require('../timestamp').Timestamp, - ObjectID = require('../objectid').ObjectID, - Symbol = require('../symbol').Symbol, - Code = require('../code').Code, - BSONRegExp = require('../regexp').BSONRegExp, - MinKey = require('../min_key').MinKey, - MaxKey = require('../max_key').MaxKey, - DBRef = require('../db_ref').DBRef, - Binary = require('../binary').Binary; - -var regexp = /\x00/ - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -var isRegExp = function isRegExp(d) { - return Object.prototype.toString.call(d) === '[object RegExp]'; -} - -var serializeString = function(buffer, key, value, index) { - // Encode String type - buffer[index++] = BSON.BSON_DATA_STRING; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the string - var size = buffer.write(value, index + 4, 'utf8'); - // Write the size of the string to buffer - buffer[index + 3] = (size + 1 >> 24) & 0xff; - buffer[index + 2] = (size + 1 >> 16) & 0xff; - buffer[index + 1] = (size + 1 >> 8) & 0xff; - buffer[index] = size + 1 & 0xff; - // Update index - index = index + 4 + size; - // Write zero - buffer[index++] = 0; - return index; -} - -var serializeNumber = function(buffer, key, value, index) { - // We have an integer value - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // If the value fits in 32 bits encode as int, if it fits in a double - // encode it as a double, otherwise long - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { - // Set int type 32 bits or less - buffer[index++] = BSON.BSON_DATA_INT; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the int value - buffer[index++] = value & 0xff; - buffer[index++] = (value >> 8) & 0xff; - buffer[index++] = (value >> 16) & 0xff; - buffer[index++] = (value >> 24) & 0xff; - } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } else { - // Set long type - buffer[index++] = BSON.BSON_DATA_LONG; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - var longVal = Long.fromNumber(value); - var lowBits = longVal.getLowBits(); - var highBits = longVal.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - } - } else { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } - - return index; -} - -var serializeUndefined = function(buffer, key, value, index) { - // Set long type - buffer[index++] = BSON.BSON_DATA_NULL; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - return index; -} - -var serializeBoolean = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BOOLEAN; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; -} - -var serializeDate = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_DATE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Write the date - var dateInMilis = Long.fromNumber(value.getTime()); - var lowBits = dateInMilis.getLowBits(); - var highBits = dateInMilis.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; -} - -var serializeRegExp = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - if (value.source && value.source.match(regexp) != null) { - throw Error("value " + value.source + " must not contain null bytes"); - } - // Adjust the index - index = index + buffer.write(value.source, index, 'utf8'); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; -} - -var serializeBSONRegExp = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Adjust the index - index = index + buffer.write(value.pattern, index, 'utf8'); - // Write zero - buffer[index++] = 0x00; - // Write the options - index = index + buffer.write(value.options, index, 'utf8'); - // Add ending zero - buffer[index++] = 0x00; - return index; -} - -var serializeMinMax = function(buffer, key, value, index) { - // Write the type of either min or max key - if(value === null) { - buffer[index++] = BSON.BSON_DATA_NULL; - } else if(value instanceof MinKey) { - buffer[index++] = BSON.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = BSON.BSON_DATA_MAX_KEY; - } - - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - return index; -} - -var serializeObjectId = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_OID; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Write the objectId into the shared buffer - buffer.write(value.id, index, 'binary') - - // Ajust index - return index + 12; -} - -var serializeBuffer = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Get size of the buffer (current write point) - var size = value.length; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the default subtype - buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - value.copy(buffer, index, 0, size); - // Adjust the index - index = index + size; - return index; -} - -var serializeObject = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined) { - // Write the type - buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined); - // Write size - var size = endIndex - index; - return endIndex; -} - -var serializeLong = function(buffer, key, value, index) { - // Write the type - buffer[index++] = value instanceof Long ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the date - var lowBits = value.getLowBits(); - var highBits = value.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; -} - -var serializeDouble = function(buffer, key, value, index) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - return index; -} - -var serializeFunction = function(buffer, key, value, index, checkKeys, depth) { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Function string - var functionString = value.toString(); - // Write the string - var size = buffer.write(functionString, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = size & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 3] = (size >> 24) & 0xff; - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0; - return index; -} - -var serializeCode = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined) { - if(value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Starting index - var startIndex = index; - - // Serialize the function - // Get the function string - var functionString = typeof value.code == 'string' ? value.code : value.code.toString(); - // Index adjustment - index = index + 4; - // Write string into buffer - var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = codeSize & 0xff; - buffer[index + 1] = (codeSize >> 8) & 0xff; - buffer[index + 2] = (codeSize >> 16) & 0xff; - buffer[index + 3] = (codeSize >> 24) & 0xff; - // Write end 0 - buffer[index + 4 + codeSize - 1] = 0; - // Write the - index = index + codeSize + 4; - - // - // Serialize the scope value - var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined) - index = endIndex - 1; - - // Writ the total - var totalSize = endIndex - startIndex; - - // Write the total size of the object - buffer[startIndex++] = totalSize & 0xff; - buffer[startIndex++] = (totalSize >> 8) & 0xff; - buffer[startIndex++] = (totalSize >> 16) & 0xff; - buffer[startIndex++] = (totalSize >> 24) & 0xff; - // Write trailing zero - buffer[index++] = 0; - } else { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Function string - var functionString = value.code.toString(); - // Write the string - var size = buffer.write(functionString, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = size & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 3] = (size >> 24) & 0xff; - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0; - } - - return index; -} - -var serializeBinary = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Extract the buffer - var data = value.value(true); - // Calculate size - var size = value.position; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - - // If we have binary type 2 the 4 first bytes are the size - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - } - - // Write the data to the object - data.copy(buffer, index, 0, value.position); - // Adjust the index - index = index + value.position; - return index; -} - -var serializeSymbol = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_SYMBOL; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the string - var size = buffer.write(value.value, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = size & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 3] = (size >> 24) & 0xff; - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0x00; - return index; -} - -var serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions) { - // Write the type - buffer[index++] = BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - var startIndex = index; - var endIndex; - - // Serialize object - if(null != value.db) { - endIndex = serializeInto(buffer, { - '$ref': value.namespace - , '$id' : value.oid - , '$db' : value.db - }, false, index, depth + 1, serializeFunctions); - } else { - endIndex = serializeInto(buffer, { - '$ref': value.namespace - , '$id' : value.oid - }, false, index, depth + 1, serializeFunctions); - } - - // Calculate object size - var size = endIndex - startIndex; - // Write the size - buffer[startIndex++] = size & 0xff; - buffer[startIndex++] = (size >> 8) & 0xff; - buffer[startIndex++] = (size >> 16) & 0xff; - buffer[startIndex++] = (size >> 24) & 0xff; - // Set index - return endIndex; -} - -var serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined) { - startingIndex = startingIndex || 0; - - // Start place to serialize into - var index = startingIndex + 4; - var self = this; - - // Special case isArray - if(Array.isArray(object)) { - // Get object keys - for(var i = 0; i < object.length; i++) { - var key = "" + i; - var value = object[i]; - - // Is there an override value - if(value && value.toBSON) { - if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function"); - value = value.toBSON(); - } - - var type = typeof value; - if(type == 'string') { - index = serializeString(buffer, key, value, index); - } else if(type == 'number') { - index = serializeNumber(buffer, key, value, index); - } else if(type == 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if(value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if(type == 'undefined' || value == null) { - index = serializeUndefined(buffer, key, value, index); - } else if(value['_bsontype'] == 'ObjectID') { - index = serializeObjectId(buffer, key, value, index); - } else if(Buffer.isBuffer(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if(value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else if(type == 'object' && value['_bsontype'] == null) { - index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if(value['_bsontype'] == 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if(typeof value == 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); - } else if(value['_bsontype'] == 'Code') { - index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if(value['_bsontype'] == 'Symbol') { - index = serializeSymbol(buffer, key, value, index); - } else if(value['_bsontype'] == 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); - } else if(value['_bsontype'] == 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } - } - } else if(object instanceof Map) { - var iterator = object.entries(); - var done = false; - - while(!done) { - // Unpack the next entry - var entry = iterator.next(); - done = entry.done; - // Are we done, then skip and terminate - if(done) continue; - - // Get the entry values - var key = entry.value[0]; - var value = entry.value[1]; - - // Check the type of the value - var type = typeof value; - - // Check the key and throw error if it's illegal - if(key != '$db' && key != '$ref' && key != '$id') { - if (key.match(regexp) != null) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - - if (checkKeys) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } - } - - // console.log("---------------------------------------------------") - // console.dir("key = " + key) - // console.dir("value = " + value) - - if(type == 'string') { - index = serializeString(buffer, key, value, index); - } else if(type == 'number') { - index = serializeNumber(buffer, key, value, index); - } else if(type == 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if(value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if(value === undefined && ignoreUndefined == true) { - } else if(value === null || value === undefined) { - index = serializeUndefined(buffer, key, value, index); - } else if(value['_bsontype'] == 'ObjectID') { - index = serializeObjectId(buffer, key, value, index); - } else if(Buffer.isBuffer(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if(value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else if(type == 'object' && value['_bsontype'] == null) { - index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if(value['_bsontype'] == 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if(value['_bsontype'] == 'Code') { - index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(typeof value == 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); - } else if(value['_bsontype'] == 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if(value['_bsontype'] == 'Symbol') { - index = serializeSymbol(buffer, key, value, index); - } else if(value['_bsontype'] == 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); - } else if(value['_bsontype'] == 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } - } - } else { - // Did we provide a custom serialization method - if(object.toBSON) { - if(typeof object.toBSON != 'function') throw new Error("toBSON is not a function"); - object = object.toBSON(); - if(object != null && typeof object != 'object') throw new Error("toBSON function did not return an object"); - } - - // Iterate over all the keys - for(var key in object) { - var value = object[key]; - // Is there an override value - if(value && value.toBSON) { - if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function"); - value = value.toBSON(); - } - - // Check the type of the value - var type = typeof value; - - // Check the key and throw error if it's illegal - if(key != '$db' && key != '$ref' && key != '$id') { - if (key.match(regexp) != null) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - - if (checkKeys) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } - } - - if(type == 'string') { - index = serializeString(buffer, key, value, index); - } else if(type == 'number') { - index = serializeNumber(buffer, key, value, index); - } else if(type == 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if(value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if(value === undefined && ignoreUndefined == true) { - } else if(value === null || value === undefined) { - index = serializeUndefined(buffer, key, value, index); - } else if(value['_bsontype'] == 'ObjectID') { - index = serializeObjectId(buffer, key, value, index); - } else if(Buffer.isBuffer(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if(value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else if(type == 'object' && value['_bsontype'] == null) { - index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if(value['_bsontype'] == 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if(value['_bsontype'] == 'Code') { - index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(typeof value == 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); - } else if(value['_bsontype'] == 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if(value['_bsontype'] == 'Symbol') { - index = serializeSymbol(buffer, key, value, index); - } else if(value['_bsontype'] == 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); - } else if(value['_bsontype'] == 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } - } - } - - // Final padding byte for object - buffer[index++] = 0x00; - - // Final size - var size = index - startingIndex; - // Write the size of the object - buffer[startingIndex++] = size & 0xff; - buffer[startingIndex++] = (size >> 8) & 0xff; - buffer[startingIndex++] = (size >> 16) & 0xff; - buffer[startingIndex++] = (size >> 24) & 0xff; - return index; -} - -var BSON = {}; - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -module.exports = serializeInto; diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js deleted file mode 100644 index 6b148b26..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A class representation of the BSON RegExp type. - * - * @class - * @return {BSONRegExp} A MinKey instance - */ -function BSONRegExp(pattern, options) { - if(!(this instanceof BSONRegExp)) return new BSONRegExp(); - - // Execute - this._bsontype = 'BSONRegExp'; - this.pattern = pattern; - this.options = options; - - // Validate options - for(var i = 0; i < options.length; i++) { - if(!(this.options[i] == 'i' - || this.options[i] == 'm' - || this.options[i] == 'x' - || this.options[i] == 'l' - || this.options[i] == 's' - || this.options[i] == 'u' - )) { - throw new Error('the regular expression options [' + this.options[i] + "] is not supported"); - } - } -} - -module.exports = BSONRegExp; -module.exports.BSONRegExp = BSONRegExp; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js deleted file mode 100644 index 7681a4de..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * A class representation of the BSON Symbol type. - * - * @class - * @deprecated - * @param {string} value the string representing the symbol. - * @return {Symbol} - */ -function Symbol(value) { - if(!(this instanceof Symbol)) return new Symbol(value); - this._bsontype = 'Symbol'; - this.value = value; -} - -/** - * Access the wrapped string value. - * - * @method - * @return {String} returns the wrapped string. - */ -Symbol.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - */ -Symbol.prototype.toString = function() { - return this.value; -} - -/** - * @ignore - */ -Symbol.prototype.inspect = function() { - return this.value; -} - -/** - * @ignore - */ -Symbol.prototype.toJSON = function() { - return this.value; -} - -module.exports = Symbol; -module.exports.Symbol = Symbol; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js b/Associations/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js deleted file mode 100644 index 7718cafc..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js +++ /dev/null @@ -1,856 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * This type is for INTERNAL use in MongoDB only and should not be used in applications. - * The appropriate corresponding type is the JavaScript Date type. - * - * Defines a Timestamp class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Timestamp". This - * implementation is derived from TimestampLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Timestamps. - * - * The internal representation of a Timestamp is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class - * @param {number} low the low (signed) 32 bits of the Timestamp. - * @param {number} high the high (signed) 32 bits of the Timestamp. - */ -function Timestamp(low, high) { - if(!(this instanceof Timestamp)) return new Timestamp(low, high); - this._bsontype = 'Timestamp'; - /** - * @type {number} - * @ignore - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @ignore - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {number} the value, assuming it is a 32-bit integer. - */ -Timestamp.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @method - * @return {number} the closest floating-point representation to this value. - */ -Timestamp.prototype.toNumber = function() { - return this.high_ * Timestamp.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @method - * @return {string} the JSON representation. - */ -Timestamp.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @method - * @param {number} [opt_radix] the radix in which the text should be written. - * @return {string} the textual representation of this value. - */ -Timestamp.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - // We need to change the Timestamp value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixTimestamp = Timestamp.fromNumber(radix); - var div = this.div(radixTimestamp); - var rem = div.multiply(radixTimestamp).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @method - * @return {number} the high 32-bits as a signed value. - */ -Timestamp.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @method - * @return {number} the low 32-bits as a signed value. - */ -Timestamp.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @method - * @return {number} the low 32-bits as an unsigned value. - */ -Timestamp.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Timestamp. - * - * @method - * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp. - */ -Timestamp.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @method - * @return {boolean} whether this value is zero. - */ -Timestamp.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @method - * @return {boolean} whether this value is negative. - */ -Timestamp.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @method - * @return {boolean} whether this value is odd. - */ -Timestamp.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Timestamp equals the other - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp equals the other - */ -Timestamp.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Timestamp does not equal the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp does not equal the other. - */ -Timestamp.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Timestamp is less than the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is less than the other. - */ -Timestamp.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Timestamp is less than or equal to the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is less than or equal to the other. - */ -Timestamp.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Timestamp is greater than the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is greater than the other. - */ -Timestamp.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Timestamp is greater than or equal to the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is greater than or equal to the other. - */ -Timestamp.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Timestamp with the given one. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - */ -Timestamp.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @method - * @return {Timestamp} the negation of this value. - */ -Timestamp.prototype.negate = function() { - if (this.equals(Timestamp.MIN_VALUE)) { - return Timestamp.MIN_VALUE; - } else { - return this.not().add(Timestamp.ONE); - } -}; - -/** - * Returns the sum of this and the given Timestamp. - * - * @method - * @param {Timestamp} other Timestamp to add to this one. - * @return {Timestamp} the sum of this and the given Timestamp. - */ -Timestamp.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Timestamp. - * - * @method - * @param {Timestamp} other Timestamp to subtract from this. - * @return {Timestamp} the difference of this and the given Timestamp. - */ -Timestamp.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Timestamp. - * - * @method - * @param {Timestamp} other Timestamp to multiply with this. - * @return {Timestamp} the product of this and the other. - */ -Timestamp.prototype.multiply = function(other) { - if (this.isZero()) { - return Timestamp.ZERO; - } else if (other.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } else if (other.equals(Timestamp.MIN_VALUE)) { - return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Timestamps are small, use float multiplication - if (this.lessThan(Timestamp.TWO_PWR_24_) && - other.lessThan(Timestamp.TWO_PWR_24_)) { - return Timestamp.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Timestamp divided by the given one. - * - * @method - * @param {Timestamp} other Timestamp by which to divide. - * @return {Timestamp} this Timestamp divided by the given one. - */ -Timestamp.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - if (other.equals(Timestamp.ONE) || - other.equals(Timestamp.NEG_ONE)) { - return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Timestamp.ZERO)) { - return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Timestamp.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Timestamp.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Timestamp.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Timestamp.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Timestamp modulo the given one. - * - * @method - * @param {Timestamp} other Timestamp by which to mod. - * @return {Timestamp} this Timestamp modulo the given one. - */ -Timestamp.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @method - * @return {Timestamp} the bitwise-NOT of this value. - */ -Timestamp.prototype.not = function() { - return Timestamp.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Timestamp and the given one. - * - * @method - * @param {Timestamp} other the Timestamp with which to AND. - * @return {Timestamp} the bitwise-AND of this and the other. - */ -Timestamp.prototype.and = function(other) { - return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Timestamp and the given one. - * - * @method - * @param {Timestamp} other the Timestamp with which to OR. - * @return {Timestamp} the bitwise-OR of this and the other. - */ -Timestamp.prototype.or = function(other) { - return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Timestamp and the given one. - * - * @method - * @param {Timestamp} other the Timestamp with which to XOR. - * @return {Timestamp} the bitwise-XOR of this and the other. - */ -Timestamp.prototype.xor = function(other) { - return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Timestamp with bits shifted to the left by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the left by the given amount. - */ -Timestamp.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Timestamp.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Timestamp.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount. - */ -Timestamp.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Timestamp.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. - */ -Timestamp.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Timestamp.fromBits(high, 0); - } else { - return Timestamp.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Timestamp representing the given (32-bit) integer value. - * - * @method - * @param {number} value the 32-bit integer in question. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Timestamp.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Timestamp.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @method - * @param {number} value the number in question. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Timestamp.ZERO; - } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MIN_VALUE; - } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MAX_VALUE; - } else if (value < 0) { - return Timestamp.fromNumber(-value).negate(); - } else { - return new Timestamp( - (value % Timestamp.TWO_PWR_32_DBL_) | 0, - (value / Timestamp.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @method - * @param {number} lowBits the low 32-bits. - * @param {number} highBits the high 32-bits. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromBits = function(lowBits, highBits) { - return new Timestamp(lowBits, highBits); -}; - -/** - * Returns a Timestamp representation of the given string, written using the given radix. - * - * @method - * @param {string} str the textual representation of the Timestamp. - * @param {number} opt_radix the radix in which the text is written. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Timestamp.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); - - var result = Timestamp.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Timestamp.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Timestamp.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Timestamp.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Timestamp representations of small integer values. - * @type {Object} - * @ignore - */ -Timestamp.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; - -/** @type {Timestamp} */ -Timestamp.ZERO = Timestamp.fromInt(0); - -/** @type {Timestamp} */ -Timestamp.ONE = Timestamp.fromInt(1); - -/** @type {Timestamp} */ -Timestamp.NEG_ONE = Timestamp.fromInt(-1); - -/** @type {Timestamp} */ -Timestamp.MAX_VALUE = - Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Timestamp} */ -Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); - -/** - * @type {Timestamp} - * @ignore - */ -Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); - -/** - * Expose. - */ -module.exports = Timestamp; -module.exports.Timestamp = Timestamp; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/bson/package.json b/Associations/node_modules/mongoose/node_modules/bson/package.json deleted file mode 100644 index 30270480..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "bson", - "description": "A bson parser for node.js and the browser", - "keywords": [ - "mongodb", - "bson", - "parser" - ], - "version": "0.4.19", - "author": { - "name": "Christian Amor Kvalheim", - "email": "christkv@gmail.com" - }, - "contributors": [], - "repository": { - "type": "git", - "url": "git://github.com/mongodb/js-bson.git" - }, - "bugs": { - "url": "https://github.com/mongodb/js-bson/issues" - }, - "devDependencies": { - "nodeunit": "0.9.0", - "gleak": "0.2.3", - "one": "2.X.X", - "benchmark": "1.0.0", - "colors": "1.1.0" - }, - "config": { - "native": false - }, - "main": "./lib/bson/index", - "directories": { - "lib": "./lib/bson" - }, - "engines": { - "node": ">=0.6.19" - }, - "scripts": { - "test": "nodeunit ./test/node" - }, - "browser": "lib/bson/bson.js", - "license": "Apache-2.0", - "gitHead": "70852794697af3ff6c08f922b6961e80af94e9f0", - "homepage": "https://github.com/mongodb/js-bson", - "_id": "bson@0.4.19", - "_shasum": "1a340f39a83d163c18af9c5ca92d2b697a35be41", - "_from": "bson@~0.4.18", - "_npmVersion": "2.14.7", - "_nodeVersion": "4.2.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "octave", - "email": "chinsay@gmail.com" - }, - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "1a340f39a83d163c18af9c5ca92d2b697a35be41", - "tarball": "http://registry.npmjs.org/bson/-/bson-0.4.19.tgz" - }, - "_resolved": "https://registry.npmjs.org/bson/-/bson-0.4.19.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/bson/tools/gleak.js b/Associations/node_modules/mongoose/node_modules/bson/tools/gleak.js deleted file mode 100644 index c707cfcb..00000000 --- a/Associations/node_modules/mongoose/node_modules/bson/tools/gleak.js +++ /dev/null @@ -1,21 +0,0 @@ - -var gleak = require('gleak')(); -gleak.ignore('AssertionError'); -gleak.ignore('testFullSpec_param_found'); -gleak.ignore('events'); -gleak.ignore('Uint8Array'); -gleak.ignore('Uint8ClampedArray'); -gleak.ignore('TAP_Global_Harness'); -gleak.ignore('setImmediate'); -gleak.ignore('clearImmediate'); - -gleak.ignore('DTRACE_NET_SERVER_CONNECTION'); -gleak.ignore('DTRACE_NET_STREAM_END'); -gleak.ignore('DTRACE_NET_SOCKET_READ'); -gleak.ignore('DTRACE_NET_SOCKET_WRITE'); -gleak.ignore('DTRACE_HTTP_SERVER_REQUEST'); -gleak.ignore('DTRACE_HTTP_SERVER_RESPONSE'); -gleak.ignore('DTRACE_HTTP_CLIENT_REQUEST'); -gleak.ignore('DTRACE_HTTP_CLIENT_RESPONSE'); - -module.exports = gleak; diff --git a/Associations/node_modules/mongoose/node_modules/hooks-fixed/.npmignore b/Associations/node_modules/mongoose/node_modules/hooks-fixed/.npmignore deleted file mode 100644 index 96e29a84..00000000 --- a/Associations/node_modules/mongoose/node_modules/hooks-fixed/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -**.swp -node_modules diff --git a/Associations/node_modules/mongoose/node_modules/hooks-fixed/Makefile b/Associations/node_modules/mongoose/node_modules/hooks-fixed/Makefile deleted file mode 100644 index 1db5d653..00000000 --- a/Associations/node_modules/mongoose/node_modules/hooks-fixed/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -test: - @NODE_ENV=test ./node_modules/expresso/bin/expresso \ - $(TESTFLAGS) \ - ./test.js - -test-cov: - @TESTFLAGS=--cov $(MAKE) test - -.PHONY: test test-cov diff --git a/Associations/node_modules/mongoose/node_modules/hooks-fixed/README.md b/Associations/node_modules/mongoose/node_modules/hooks-fixed/README.md deleted file mode 100644 index 98fe85bd..00000000 --- a/Associations/node_modules/mongoose/node_modules/hooks-fixed/README.md +++ /dev/null @@ -1,369 +0,0 @@ -hooks -============ - -Add pre and post middleware hooks to your JavaScript methods. - -## Installation - npm install hooks - -## Motivation -Suppose you have a JavaScript object with a `save` method. - -It would be nice to be able to declare code that runs before `save` and after `save`. -For example, you might want to run validation code before every `save`, -and you might want to dispatch a job to a background job queue after `save`. - -One might have an urge to hard code this all into `save`, but that turns out to -couple all these pieces of functionality (validation, save, and job creation) more -tightly than is necessary. For example, what if someone does not want to do background -job creation after the logical save? - -It is nicer to tack on functionality using what we call `pre` and `post` hooks. These -are functions that you define and that you direct to execute before or after particular -methods. - -## Example -We can use `hooks` to add validation and background jobs in the following way: - -```javascript -var hooks = require('hooks') - , Document = require('./path/to/some/document/constructor'); - -// Add hooks' methods: `hook`, `pre`, and `post` -for (var k in hooks) { - Document[k] = hooks[k]; -} - -// Define a new method that is able to invoke pre and post middleware -Document.hook('save', Document.prototype.save); - -// Define a middleware function to be invoked before 'save' -Document.pre('save', function validate (next) { - // The `this` context inside of `pre` and `post` functions - // is the Document instance - if (this.isValid()) next(); // next() passes control to the next middleware - // or to the target method itself - else next(new Error("Invalid")); // next(error) invokes an error callback -}); - -// Define a middleware function to be invoked after 'save' -Document.post('save', function createJob (next) { - this.sendToBackgroundQueue(); - next(); -}); -``` - -If you already have defined `Document.prototype` methods for which you want pres and posts, -then you do not need to explicitly invoke `Document.hook(...)`. Invoking `Document.pre(methodName, fn)` -or `Document.post(methodName, fn)` will automatically and lazily change `Document.prototype[methodName]` -so that it plays well with `hooks`. An equivalent way to implement the previous example is: - -```javascript -var hooks = require('hooks') - , Document = require('./path/to/some/document/constructor'); - -// Add hooks' methods: `hook`, `pre`, and `post` -for (var k in hooks) { - Document[k] = hooks[k]; -} - -Document.prototype.save = function () { - // ... -}; - -// Define a middleware function to be invoked before 'save' -Document.pre('save', function validate (next) { - // The `this` context inside of `pre` and `post` functions - // is the Document instance - if (this.isValid()) next(); // next() passes control to the next middleware - // or to the target method itself - else next(new Error("Invalid")); // next(error) invokes an error callback -}); - -// Define a middleware function to be invoked after 'save' -Document.post('save', function createJob (next) { - this.sendToBackgroundQueue(); - next(); -}); -``` - -## Pres and Posts as Middleware -We structure pres and posts as middleware to give you maximum flexibility: - -1. You can define **multiple** pres (or posts) for a single method. -2. These pres (or posts) are then executed as a chain of methods. -3. Any functions in this middleware chain can choose to halt the chain's execution by `next`ing an Error from that middleware function. If this occurs, then none of the other middleware in the chain will execute, and the main method (e.g., `save`) will not execute. This is nice, for example, when we don't want a document to save if it is invalid. - -## Defining multiple pres (or posts) -`pre` and `post` are chainable, so you can define multiple via: -```javascript -Document.pre('save', function (next) { - console.log("hello"); - next(); -}).pre('save', function (next) { - console.log("world"); - next(); -}); - -Document.post('save', function (next) { - console.log("hello"); - next(); -}).post('save', function (next) { - console.log("world"); - next(); -}); -``` - -As soon as one pre finishes executing, the next one will be invoked, and so on. - -## Error Handling -You can define a default error handler by passing a 2nd function as the 3rd argument to `hook`: -```javascript -Document.hook('set', function (path, val) { - this[path] = val; -}, function (err) { - // Handler the error here - console.error(err); -}); -``` - -Then, we can pass errors to this handler from a pre or post middleware function: -```javascript -Document.pre('set', function (next, path, val) { - next(new Error()); -}); -``` - -If you do not set up a default handler, then `hooks` makes the default handler that just throws the `Error`. - -The default error handler can be over-rided on a per method invocation basis. - -If the main method that you are surrounding with pre and post middleware expects its last argument to be a function -with callback signature `function (error, ...)`, then that callback becomes the error handler, over-riding the default -error handler you may have set up. - -```javascript -Document.hook('save', function (callback) { - // Save logic goes here - ... -}); - -var doc = new Document(); -doc.save( function (err, saved) { - // We can pass err via `next` in any of our pre or post middleware functions - if (err) console.error(err); - - // Rest of callback logic follows ... -}); -``` - -## Mutating Arguments via Middleware -`pre` and `post` middleware can also accept the intended arguments for the method -they augment. This is useful if you want to mutate the arguments before passing -them along to the next middleware and eventually pass a mutated arguments list to -the main method itself. - -As a simple example, let's define a method `set` that just sets a key, value pair. -If we want to namespace the key, we can do so by adding a `pre` middleware hook -that runs before `set`, alters the arguments by namespacing the `key` argument, and passes them onto `set`: - -```javascript -Document.hook('set', function (key, val) { - this[key] = val; -}); -Document.pre('set', function (next, key, val) { - next('namespace-' + key, val); -}); -var doc = new Document(); -doc.set('hello', 'world'); -console.log(doc.hello); // undefined -console.log(doc['namespace-hello']); // 'world' -``` - -As you can see above, we pass arguments via `next`. - -If you are not mutating the arguments, then you can pass zero arguments -to `next`, and the next middleware function will still have access -to the arguments. - -```javascript -Document.hook('set', function (key, val) { - this[key] = val; -}); -Document.pre('set', function (next, key, val) { - // I have access to key and val here - next(); // We don't need to pass anything to next -}); -Document.pre('set', function (next, key, val) { - // And I still have access to the original key and val here - next(); -}); -``` - -Finally, you can add arguments that downstream middleware can also see: - -```javascript -// Note that in the definition of `set`, there is no 3rd argument, options -Document.hook('set', function (key, val) { - // But... - var options = arguments[2]; // ...I have access to an options argument - // because of pre function pre2 (defined below) - console.log(options); // '{debug: true}' - this[key] = val; -}); -Document.pre('set', function pre1 (next, key, val) { - // I only have access to key and val arguments - console.log(arguments.length); // 3 - next(key, val, {debug: true}); -}); -Document.pre('set', function pre2 (next, key, val, options) { - console.log(arguments.length); // 4 - console.log(options); // '{ debug: true}' - next(); -}); -Document.pre('set', function pre3 (next, key, val, options) { - // I still have access to key, val, AND the options argument introduced via the preceding middleware - console.log(arguments.length); // 4 - console.log(options); // '{ debug: true}' - next(); -}); - -var doc = new Document() -doc.set('hey', 'there'); -``` - -## Post middleware - -Post middleware intercepts the callback originally sent to the asynchronous function you have hooked to. - -This means that the following chain of execution will occur in a typical `save` operation: - -(1) doc.save -> (2) pre --(next)--> (3) save calls back -> (4) post --(next)--> (5) targetFn - -Illustrated below: - -``` -Document.pre('save', function (next) { - this.key = "value"; - next(); -}); -// Post handler occurs before `set` calls back. This is useful if we need to grab something -// async before `set` finishes. -Document.post('set', function (next) { - var me = this; - getSomethingAsync(function(value){ // let's assume it returns "Hello Async" - me.key2 = value; - next(); - }); -}); - -var doc = new Document(); -doc.save(function(err){ - console.log(this.key); // "value" - this value was saved - console.log(this.key2); // "Hello Async" - this value was *not* saved -} - -``` - -Post middleware must call `next()` or execution will stop. - -## Parallel `pre` middleware - -All middleware up to this point has been "serial" middleware -- i.e., middleware whose logic -is executed as a serial chain. - -Some scenarios call for parallel middleware -- i.e., middleware that can wait for several -asynchronous services at once to respond. - -For instance, you may only want to save a Document only after you have checked -that the Document is valid according to two different remote services. - -We accomplish asynchronous middleware by adding a second kind of flow control callback -(the only flow control callback so far has been `next`), called `done`. - -- `next` passes control to the next middleware in the chain -- `done` keeps track of how many parallel middleware have invoked `done` and passes - control to the target method when ALL parallel middleware have invoked `done`. If - you pass an `Error` to `done`, then the error is handled, and the main method that is - wrapped by pres and posts will not get invoked. - -We declare pre middleware that is parallel by passing a 3rd boolean argument to our `pre` -definition method. - -We illustrate via the parallel validation example mentioned above: - -```javascript -Document.hook('save', function targetFn (callback) { - // Save logic goes here - // ... - // This only gets run once the two `done`s are both invoked via preOne and preTwo. -}); - - // true marks this as parallel middleware -Document.pre('save', true, function preOne (next, doneOne, callback) { - remoteServiceOne.validate(this.serialize(), function (err, isValid) { - // The code in here will probably be run after the `next` below this block - // and could possibly be run after the console.log("Hola") in `preTwo - if (err) return doneOne(err); - if (isValid) doneOne(); - }); - next(); // Pass control to the next middleware -}); - -// We will suppose that we need 2 different remote services to validate our document -Document.pre('save', true, function preTwo (next, doneTwo, callback) { - remoteServiceTwo.validate(this.serialize(), function (err, isValid) { - if (err) return doneTwo(err); - if (isValid) doneTwo(); - }); - next(); -}); - -// While preOne and preTwo are parallel, preThree is a serial pre middleware -Document.pre('save', function preThree (next, callback) { - next(); -}); - -var doc = new Document(); -doc.save( function (err, doc) { - // Do stuff with the saved doc here... -}); -``` - -In the above example, flow control may happen in the following way: - -(1) doc.save -> (2) preOne --(next)--> (3) preTwo --(next)--> (4) preThree --(next)--> (wait for dones to invoke) -> (5) doneTwo -> (6) doneOne -> (7) targetFn - -So what's happening is that: - -1. You call `doc.save(...)` -2. First, your preOne middleware gets executed. It makes a remote call to the validation service and `next()`s to the preTwo middleware. -3. Now, your preTwo middleware gets executed. It makes a remote call to another validation service and `next()`s to the preThree middleware. -4. Your preThree middleware gets executed. It immediately `next()`s. But nothing else gets executing until both `doneOne` and `doneTwo` are invoked inside the callbacks handling the response from the two valiation services. -5. We will suppose that validation remoteServiceTwo returns a response to us first. In this case, we call `doneTwo` inside the callback to remoteServiceTwo. -6. Some fractions of a second later, remoteServiceOne returns a response to us. In this case, we call `doneOne` inside the callback to remoteServiceOne. -7. `hooks` implementation keeps track of how many parallel middleware has been defined per target function. It detects that both asynchronous pre middlewares (`preOne` and `preTwo`) have finally called their `done` functions (`doneOne` and `doneTwo`), so the implementation finally invokes our `targetFn` (i.e., our core `save` business logic). - -## Removing Pres - -You can remove a particular pre associated with a hook: - - Document.pre('set', someFn); - Document.removePre('set', someFn); - -And you can also remove all pres associated with a hook: - Document.removePre('set'); // Removes all declared `pre`s on the hook 'set' - -## Tests -To run the tests: - make test - -### Contributors -- [Brian Noguchi](https://github.com/bnoguchi) - -### License -MIT License - ---- -### Author -Brian Noguchi diff --git a/Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js b/Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js deleted file mode 100644 index 6ced3575..00000000 --- a/Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Hooks are useful if we want to add a method that automatically has `pre` and `post` hooks. - * For example, it would be convenient to have `pre` and `post` hooks for `save`. - * _.extend(Model, mixins.hooks); - * Model.hook('save', function () { - * console.log('saving'); - * }); - * Model.pre('save', function (next, done) { - * console.log('about to save'); - * next(); - * }); - * Model.post('save', function (next, done) { - * console.log('saved'); - * next(); - * }); - * - * var m = new Model(); - * m.save(); - * // about to save - * // saving - * // saved - */ - -// TODO Add in pre and post skipping options -module.exports = { - /** - * Declares a new hook to which you can add pres and posts - * @param {String} name of the function - * @param {Function} the method - * @param {Function} the error handler callback - */ - hook: function (name, fn, err) { - if (arguments.length === 1 && typeof name === 'object') { - for (var k in name) { // `name` is a hash of hookName->hookFn - this.hook(k, name[k]); - } - return; - } - - if (!err) err = fn; - - var proto = this.prototype || this - , pres = proto._pres = proto._pres || {} - , posts = proto._posts = proto._posts || {}; - pres[name] = pres[name] || []; - posts[name] = posts[name] || []; - - function noop () {} - - proto[name] = function () { - var self = this - , pres = this._pres[name] - , posts = this._posts[name] - , numAsyncPres = 0 - , hookArgs = [].slice.call(arguments) - , preChain = pres.map( function (pre, i) { - var wrapper = function () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - if (numAsyncPres) { - // arguments[1] === asyncComplete - if (arguments.length) - hookArgs = [].slice.call(arguments, 2); - pre.apply(self, - [ preChain[i+1] || allPresInvoked, - asyncComplete - ].concat(hookArgs) - ); - } else { - if (arguments.length) - hookArgs = [].slice.call(arguments); - pre.apply(self, - [ preChain[i+1] || allPresDone ].concat(hookArgs)); - } - }; // end wrapper = function () {... - if (wrapper.isAsync = pre.isAsync) - numAsyncPres++; - return wrapper; - }); // end posts.map(...) - function allPresInvoked () { - if (arguments[0] instanceof Error) - err(arguments[0]); - } - - function allPresDone () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - if (arguments.length) - hookArgs = [].slice.call(arguments); - fn.apply(self, hookArgs); - var postChain = posts.map( function (post, i) { - var wrapper = function () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - if (arguments.length) - hookArgs = [].slice.call(arguments); - post.apply(self, - [ postChain[i+1] || noop].concat(hookArgs)); - }; // end wrapper = function () {... - return wrapper; - }); // end posts.map(...) - if (postChain.length) postChain[0](); - } - - if (numAsyncPres) { - complete = numAsyncPres; - function asyncComplete () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - --complete || allPresDone.call(this); - } - } - (preChain[0] || allPresDone)(); - }; - - return this; - }, - - pre: function (name, fn, isAsync) { - var proto = this.prototype - , pres = proto._pres = proto._pres || {}; - if (fn.isAsync = isAsync) { - this.prototype[name].numAsyncPres++; - } - (pres[name] = pres[name] || []).push(fn); - return this; - }, - post: function (name, fn, isAsync) { - var proto = this.prototype - , posts = proto._posts = proto._posts || {}; - (posts[name] = posts[name] || []).push(fn); - return this; - } -}; diff --git a/Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.js b/Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.js deleted file mode 100644 index 756c8337..00000000 --- a/Associations/node_modules/mongoose/node_modules/hooks-fixed/hooks.js +++ /dev/null @@ -1,191 +0,0 @@ -// TODO Add in pre and post skipping options -module.exports = { - /** - * Declares a new hook to which you can add pres and posts - * @param {String} name of the function - * @param {Function} the method - * @param {Function} the error handler callback - */ - hook: function (name, fn, errorCb) { - if (arguments.length === 1 && typeof name === 'object') { - for (var k in name) { // `name` is a hash of hookName->hookFn - this.hook(k, name[k]); - } - return; - } - - var proto = this.prototype || this - , pres = proto._pres = proto._pres || {} - , posts = proto._posts = proto._posts || {}; - pres[name] = pres[name] || []; - posts[name] = posts[name] || []; - - proto[name] = function () { - var self = this - , hookArgs // arguments eventually passed to the hook - are mutable - , lastArg = arguments[arguments.length-1] - , pres = this._pres[name] - , posts = this._posts[name] - , _total = pres.length - , _current = -1 - , _asyncsLeft = proto[name].numAsyncPres - , _asyncsDone = function(err) { - if (err) { - return handleError(err); - } - --_asyncsLeft || _done.apply(self, hookArgs); - } - , handleError = function(err) { - if ('function' == typeof lastArg) - return lastArg(err); - if (errorCb) return errorCb.call(self, err); - throw err; - } - , _next = function () { - if (arguments[0] instanceof Error) { - return handleError(arguments[0]); - } - var _args = Array.prototype.slice.call(arguments) - , currPre - , preArgs; - if (_args.length && !(arguments[0] == null && typeof lastArg === 'function')) - hookArgs = _args; - if (++_current < _total) { - currPre = pres[_current] - if (currPre.isAsync && currPre.length < 2) - throw new Error("Your pre must have next and done arguments -- e.g., function (next, done, ...)"); - if (currPre.length < 1) - throw new Error("Your pre must have a next argument -- e.g., function (next, ...)"); - preArgs = (currPre.isAsync - ? [once(_next), once(_asyncsDone)] - : [once(_next)]).concat(hookArgs); - return currPre.apply(self, preArgs); - } else if (!_asyncsLeft) { - return _done.apply(self, hookArgs); - } - } - , _done = function () { - var args_ = Array.prototype.slice.call(arguments) - , ret, total_, current_, next_, done_, postArgs; - - if (_current === _total) { - - next_ = function () { - if (arguments[0] instanceof Error) { - return handleError(arguments[0]); - } - var args_ = Array.prototype.slice.call(arguments, 1) - , currPost - , postArgs; - if (args_.length) hookArgs = args_; - if (++current_ < total_) { - currPost = posts[current_] - if (currPost.length < 1) - throw new Error("Your post must have a next argument -- e.g., function (next, ...)"); - postArgs = [once(next_)].concat(hookArgs); - return currPost.apply(self, postArgs); - } else if (typeof lastArg === 'function'){ - // All post handlers are done, call original callback function - return lastArg.apply(self, arguments); - } - }; - - // We are assuming that if the last argument provided to the wrapped function is a function, it was expecting - // a callback. We trap that callback and wait to call it until all post handlers have finished. - if(typeof lastArg === 'function'){ - args_[args_.length - 1] = once(next_); - } - - total_ = posts.length; - current_ = -1; - ret = fn.apply(self, args_); // Execute wrapped function, post handlers come afterward - - if (total_ && typeof lastArg !== 'function') return next_(); // no callback provided, execute next_() manually - return ret; - } - }; - - return _next.apply(this, arguments); - }; - - proto[name].numAsyncPres = 0; - - return this; - }, - - pre: function (name, isAsync, fn, errorCb) { - if ('boolean' !== typeof arguments[1]) { - errorCb = fn; - fn = isAsync; - isAsync = false; - } - var proto = this.prototype || this - , pres = proto._pres = proto._pres || {}; - - this._lazySetupHooks(proto, name, errorCb); - - if (fn.isAsync = isAsync) { - proto[name].numAsyncPres++; - } - - (pres[name] = pres[name] || []).push(fn); - return this; - }, - post: function (name, isAsync, fn) { - if (arguments.length === 2) { - fn = isAsync; - isAsync = false; - } - var proto = this.prototype || this - , posts = proto._posts = proto._posts || {}; - - this._lazySetupHooks(proto, name); - (posts[name] = posts[name] || []).push(fn); - return this; - }, - removePre: function (name, fnToRemove) { - var proto = this.prototype || this - , pres = proto._pres || (proto._pres || {}); - if (!pres[name]) return this; - if (arguments.length === 1) { - // Remove all pre callbacks for hook `name` - pres[name].length = 0; - } else { - pres[name] = pres[name].filter( function (currFn) { - return currFn !== fnToRemove; - }); - } - return this; - }, - removePost: function (name, fnToRemove) { - var proto = this.prototype || this - , posts = proto._posts || (proto._posts || {}); - if (!posts[name]) return this; - if (arguments.length === 1) { - // Remove all post callbacks for hook `name` - posts[name].length = 0; - } else { - posts[name] = posts[name].filter( function (currFn) { - return currFn !== fnToRemove; - }); - } - return this; - }, - - _lazySetupHooks: function (proto, methodName, errorCb) { - if ('undefined' === typeof proto[methodName].numAsyncPres) { - this.hook(methodName, proto[methodName], errorCb); - } - } -}; - -function once (fn, scope) { - return function fnWrapper () { - if (fnWrapper.hookCalled) return; - fnWrapper.hookCalled = true; - var ret = fn.apply(scope, arguments); - if (ret && ret.then) { - ret.then(function() {}, function() {}); - } - }; -} diff --git a/Associations/node_modules/mongoose/node_modules/hooks-fixed/package.json b/Associations/node_modules/mongoose/node_modules/hooks-fixed/package.json deleted file mode 100644 index 952e6ec5..00000000 --- a/Associations/node_modules/mongoose/node_modules/hooks-fixed/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "hooks-fixed", - "description": "Adds pre and post hook functionality to your JavaScript methods.", - "version": "1.1.0", - "keywords": [ - "node", - "hooks", - "middleware", - "pre", - "post" - ], - "homepage": "https://github.com/vkarpov15/hooks-fixed/", - "repository": { - "type": "git", - "url": "git://github.com/vkarpov15/hooks-fixed.git" - }, - "author": { - "name": "Brian Noguchi", - "email": "brian.noguchi@gmail.com", - "url": "https://github.com/bnoguchi/" - }, - "main": "./hooks.js", - "directories": { - "lib": "." - }, - "scripts": { - "test": "make test" - }, - "dependencies": {}, - "devDependencies": { - "expresso": ">=0.7.6", - "should": ">=0.2.1", - "underscore": ">=1.1.4" - }, - "engines": { - "node": ">=0.4.0" - }, - "licenses": [ - "MIT" - ], - "optionalDependencies": {}, - "gitHead": "17ef258ae58d7aa6de7cec5b57f76233a4ba1c96", - "bugs": { - "url": "https://github.com/vkarpov15/hooks-fixed/issues" - }, - "_id": "hooks-fixed@1.1.0", - "_shasum": "0e8c15336708e6611185fe390b44687dd5230dbb", - "_from": "hooks-fixed@1.1.0", - "_npmVersion": "2.9.1", - "_nodeVersion": "0.12.3", - "_npmUser": { - "name": "vkarpov15", - "email": "val@karpov.io" - }, - "dist": { - "shasum": "0e8c15336708e6611185fe390b44687dd5230dbb", - "tarball": "http://registry.npmjs.org/hooks-fixed/-/hooks-fixed-1.1.0.tgz" - }, - "maintainers": [ - { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - } - ], - "_resolved": "https://registry.npmjs.org/hooks-fixed/-/hooks-fixed-1.1.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/hooks-fixed/test.js b/Associations/node_modules/mongoose/node_modules/hooks-fixed/test.js deleted file mode 100644 index 81ad79ee..00000000 --- a/Associations/node_modules/mongoose/node_modules/hooks-fixed/test.js +++ /dev/null @@ -1,786 +0,0 @@ -var hooks = require('./hooks') - , should = require('should') - , assert = require('assert') - , _ = require('underscore'); - -// TODO Add in test for making sure all pres get called if pre is defined directly on an instance. -// TODO Test for calling `done` twice or `next` twice in the same function counts only once -module.exports = { - 'should be able to assign multiple hooks at once': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook({ - hook1: function (a) {}, - hook2: function (b) {} - }); - var a = new A(); - assert.equal(typeof a.hook1, 'function'); - assert.equal(typeof a.hook2, 'function'); - }, - 'should run without pres and posts when not present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - }, - 'should run with pres when present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValue = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.preValue.should.equal(2); - }, - 'should run with posts when present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.value = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(2); - }, - 'should run pres and posts when present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValue = 2; - next(); - }); - A.post('save', function (next) { - this.value = 3; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(3); - a.preValue.should.equal(2); - }, - 'should run posts after pres': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.override = 100; - next(); - }); - A.post('save', function (next) { - this.override = 200; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.override.should.equal(200); - }, - 'should not run a hook if a pre fails': function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function () { - this.value = 1; - }, function (err) { - counter++; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save(); - counter.should.equal(1); - assert.equal(typeof a.value, 'undefined'); - }, - 'should be able to run multiple pres': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.v1 = 1; - next(); - }).pre('save', function (next) { - this.v2 = 2; - next(); - }); - var a = new A(); - a.save(); - a.v1.should.equal(1); - a.v2.should.equal(2); - }, - 'should run multiple pres until a pre fails and not call the hook': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }, function (err) {}); - A.pre('save', function (next) { - this.v1 = 1; - next(); - }).pre('save', function (next) { - next(new Error()); - }).pre('save', function (next) { - this.v3 = 3; - next(); - }); - var a = new A(); - a.save(); - a.v1.should.equal(1); - assert.equal(typeof a.v3, 'undefined'); - assert.equal(typeof a.value, 'undefined'); - }, - 'should be able to run multiple posts': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.value = 2; - next(); - }).post('save', function (next) { - this.value = 3.14; - next(); - }).post('save', function (next) { - this.v3 = 3; - next(); - }); - var a = new A(); - a.save(); - assert.equal(a.value, 3.14); - assert.equal(a.v3, 3); - }, - 'should run only posts up until an error': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }, function (err) {}); - A.post('save', function (next) { - this.value = 2; - next(); - }).post('save', function (next) { - this.value = 3; - next(new Error()); - }).post('save', function (next) { - this.value = 4; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(3); - }, - "should fall back first to the hook method's last argument as the error handler if it is a function of arity 1 or 2": function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (callback) { - this.value = 1; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save( function (err) { - if (err instanceof Error) counter++; - }); - counter.should.equal(1); - should.deepEqual(undefined, a.value); - }, - 'should fall back second to the default error handler if specified': function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (callback) { - this.value = 1; - }, function (err) { - if (err instanceof Error) counter++; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save(); - counter.should.equal(1); - should.deepEqual(undefined, a.value); - }, - 'fallback default error handler should scope to the object': function () { - var A = function () { - this.counter = 0; - }; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (callback) { - this.value = 1; - }, function (err) { - if (err instanceof Error) this.counter++; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save(); - a.counter.should.equal(1); - should.deepEqual(undefined, a.value); - }, - 'should fall back last to throwing the error': function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (err) { - if (err instanceof Error) return counter++; - this.value = 1; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - var didCatch = false; - try { - a.save(); - } catch (e) { - didCatch = true; - e.should.be.an.instanceof(Error); - counter.should.equal(0); - assert.equal(typeof a.value, 'undefined'); - } - didCatch.should.be.true; - }, - "should proceed without mutating arguments if `next(null|undefined)` is called in a serial pre, and the last argument of the target method is a callback with node-like signature function (err, obj) {...} or function (err) {...}": function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.prototype.save = function (callback) { - this.value = 1; - callback(); - }; - A.pre('save', function (next) { - next(null); - }); - A.pre('save', function (next) { - next(undefined); - }); - var a = new A(); - a.save( function (err) { - if (err instanceof Error) counter++; - else counter--; - }); - counter.should.equal(-1); - a.value.should.eql(1); - }, - "should proceed with mutating arguments if `next(null|undefined)` is callback in a serial pre, and the last argument of the target method is not a function": function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.set = function (v) { - this.value = v; - }; - A.pre('set', function (next) { - next(undefined); - }); - A.pre('set', function (next) { - next(null); - }); - var a = new A(); - a.set(1); - should.strictEqual(null, a.value); - }, - 'should not run any posts if a pre fails': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 2; - }, function (err) {}); - A.pre('save', function (next) { - this.value = 1; - next(new Error()); - }).post('save', function (next) { - this.value = 3; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - }, - - "can pass the hook's arguments verbatim to pres": function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - }); - A.pre('set', function (next, path, val) { - path.should.equal('hello'); - val.should.equal('world'); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - a.hello.should.equal('world'); - }, -// "can pass the hook's arguments as an array to pres": function () { -// // Great for dynamic arity - e.g., slice(...) -// var A = function () {}; -// _.extend(A, hooks); -// A.hook('set', function (path, val) { -// this[path] = val; -// }); -// A.pre('set', function (next, hello, world) { -// hello.should.equal('hello'); -// world.should.equal('world'); -// next(); -// }); -// var a = new A(); -// a.set('hello', 'world'); -// assert.equal(a.hello, 'world'); -// }, - "can pass the hook's arguments verbatim to posts": function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - }); - A.post('set', function (next, path, val) { - path.should.equal('hello'); - val.should.equal('world'); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - assert.equal(a.hello, 'world'); - }, -// "can pass the hook's arguments as an array to posts": function () { -// var A = function () {}; -// _.extend(A, hooks); -// A.hook('set', function (path, val) { -// this[path] = val; -// }); -// A.post('set', function (next, halt, args) { -// assert.equal(args[0], 'hello'); -// assert.equal(args[1], 'world'); -// next(); -// }); -// var a = new A(); -// a.set('hello', 'world'); -// assert.equal(a.hello, 'world'); -// }, - "pres should be able to modify and pass on a modified version of the hook's arguments": function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - assert.equal(arguments[2], 'optional'); - }); - A.pre('set', function (next, path, val) { - next('foo', 'bar'); - }); - A.pre('set', function (next, path, val) { - assert.equal(path, 'foo'); - assert.equal(val, 'bar'); - next('rock', 'says', 'optional'); - }); - A.pre('set', function (next, path, val, opt) { - assert.equal(path, 'rock'); - assert.equal(val, 'says'); - assert.equal(opt, 'optional'); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - assert.equal(typeof a.hello, 'undefined'); - a.rock.should.equal('says'); - }, - 'posts should see the modified version of arguments if the pres modified them': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - }); - A.pre('set', function (next, path, val) { - next('foo', 'bar'); - }); - A.post('set', function (next, path, val) { - path.should.equal('foo'); - val.should.equal('bar'); - }); - var a = new A(); - a.set('hello', 'world'); - assert.equal(typeof a.hello, 'undefined'); - a.foo.should.equal('bar'); - }, - 'should pad missing arguments (relative to expected arguments of the hook) with null': function () { - // Otherwise, with hookFn = function (a, b, next, ), - // if we use hookFn(a), then because the pre functions are of the form - // preFn = function (a, b, next, ), then it actually gets executed with - // preFn(a, next, ), so when we call next() from within preFn, we are actually - // calling () - - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val, opts) { - this[path] = val; - }); - A.pre('set', function (next, path, val, opts) { - next('foo', 'bar'); - assert.equal(typeof opts, 'undefined'); - }); - var a = new A(); - a.set('hello', 'world'); - }, - - 'should not invoke the target method until all asynchronous middleware have invoked dones': function () { - var counter = 0; - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - counter++; - this[path] = val; - counter.should.equal(7); - }); - A.pre('set', function (next, path, val) { - counter++; - next(); - }); - A.pre('set', true, function (next, done, path, val) { - counter++; - setTimeout(function () { - counter++; - done(); - }, 1000); - next(); - }); - A.pre('set', function (next, path, val) { - counter++; - next(); - }); - A.pre('set', true, function (next, done, path, val) { - counter++; - setTimeout(function () { - counter++; - done(); - }, 500); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - }, - - 'invoking a method twice should run its async middleware twice': function () { - var counter = 0; - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - if (path === 'hello') counter.should.equal(1); - if (path === 'foo') counter.should.equal(2); - }); - A.pre('set', true, function (next, done, path, val) { - setTimeout(function () { - counter++; - done(); - }, 1000); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - a.set('foo', 'bar'); - }, - - 'calling the same done multiple times should have the effect of only calling it once': function () { - var A = function () { - this.acked = false; - }; - _.extend(A, hooks); - A.hook('ack', function () { - console.log("UH OH, YOU SHOULD NOT BE SEEING THIS"); - this.acked = true; - }); - A.pre('ack', true, function (next, done) { - next(); - done(); - done(); - }); - A.pre('ack', true, function (next, done) { - next(); - // Notice that done() is not invoked here - }); - var a = new A(); - a.ack(); - setTimeout( function () { - a.acked.should.be.false; - }, 1000); - }, - - 'calling the same next multiple times should have the effect of only calling it once': function (beforeExit) { - var A = function () { - this.acked = false; - }; - _.extend(A, hooks); - A.hook('ack', function () { - console.log("UH OH, YOU SHOULD NOT BE SEEING THIS"); - this.acked = true; - }); - A.pre('ack', function (next) { - // force a throw to re-exec next() - try { - next(new Error('bam')); - } catch (err) { - next(); - } - }); - A.pre('ack', function (next) { - next(); - }); - var a = new A(); - a.ack(); - beforeExit( function () { - a.acked.should.be.false; - }); - }, - - 'asynchronous middleware should be able to pass an error via `done`, stopping the middleware chain': function () { - var counter = 0; - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val, fn) { - counter++; - this[path] = val; - fn(null); - }); - A.pre('set', true, function (next, done, path, val, fn) { - setTimeout(function () { - counter++; - done(new Error); - }, 1000); - next(); - }); - var a = new A(); - a.set('hello', 'world', function (err) { - err.should.be.an.instanceof(Error); - should.strictEqual(undefined, a['hello']); - counter.should.eql(1); - }); - }, - - 'should be able to remove a particular pre': function () { - var A = function () {} - , preTwo; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValueOne = 2; - next(); - }); - A.pre('save', preTwo = function (next) { - this.preValueTwo = 4; - next(); - }); - A.removePre('save', preTwo); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.preValueOne.should.equal(2); - should.strictEqual(undefined, a.preValueTwo); - }, - - 'should be able to remove all pres associated with a hook': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValueOne = 2; - next(); - }); - A.pre('save', function (next) { - this.preValueTwo = 4; - next(); - }); - A.removePre('save'); - var a = new A(); - a.save(); - a.value.should.equal(1); - should.strictEqual(undefined, a.preValueOne); - should.strictEqual(undefined, a.preValueTwo); - }, - - 'should be able to remove a particular post': function () { - var A = function () {} - , postTwo; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.postValueOne = 2; - next(); - }); - A.post('save', postTwo = function (next) { - this.postValueTwo = 4; - next(); - }); - A.removePost('save', postTwo); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.postValueOne.should.equal(2); - should.strictEqual(undefined, a.postValueTwo); - }, - - 'should be able to remove all posts associated with a hook': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.postValueOne = 2; - next(); - }); - A.post('save', function (next) { - this.postValueTwo = 4; - next(); - }); - A.removePost('save'); - var a = new A(); - a.save(); - a.value.should.equal(1); - should.strictEqual(undefined, a.postValueOne); - should.strictEqual(undefined, a.postValueTwo); - }, - - '#pre should lazily make a method hookable': function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.save = function () { - this.value = 1; - }; - A.pre('save', function (next) { - this.preValue = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.preValue.should.equal(2); - }, - - '#pre lazily making a method hookable should be able to provide a default errorHandler as the last argument': function () { - var A = function () {}; - var preValue = ""; - _.extend(A, hooks); - A.prototype.save = function () { - this.value = 1; - }; - A.pre('save', function (next) { - next(new Error); - }, function (err) { - preValue = 'ERROR'; - }); - var a = new A(); - a.save(); - should.strictEqual(undefined, a.value); - preValue.should.equal('ERROR'); - }, - - '#post should lazily make a method hookable': function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.save = function () { - this.value = 1; - }; - A.post('save', function (next) { - this.value = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(2); - }, - - "a lazy hooks setup should handle errors via a method's last argument, if it's a callback": function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.save = function (fn) {}; - A.pre('save', function (next) { - next(new Error("hi there")); - }); - var a = new A(); - a.save( function (err) { - err.should.be.an.instanceof(Error); - }); - }, - - 'should intercept method callbacks for post handlers': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function (val, callback) { - this.value = val; - callback(); - }); - A.post('save', function (next) { - assert.equal(a.value, 2); - this.value += 2; - setTimeout(next, 10); - }).post('save', function (next) { - assert.equal(a.value, 4); - this.value += 3; - setTimeout(next, 10); - }).post('save', function (next) { - assert.equal(a.value, 7); - this.value2 = 3; - setTimeout(next, 10); - }); - var a = new A(); - a.save(2, function(){ - assert.equal(a.value, 7); - assert.equal(a.value2, 3); - }); - }, - - 'should handle parallel followed by serial': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function (val, callback) { - this.value = val; - callback(); - }); - A.pre('save', true, function(next, done) { - process.nextTick(function() { - done(); - }); - next(); - }).pre('save', function(done) { - process.nextTick(function() { - done(); - }); - }); - var a = new A(); - a.save(2, function(){ - assert.ok(true); - }); - } -}; diff --git a/Associations/node_modules/mongoose/node_modules/kareem/.npmignore b/Associations/node_modules/mongoose/node_modules/kareem/.npmignore deleted file mode 100644 index 59d842ba..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# Commenting this out is preferred by some people, see -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- -node_modules - -# Users Environment Variables -.lock-wscript diff --git a/Associations/node_modules/mongoose/node_modules/kareem/.travis.yml b/Associations/node_modules/mongoose/node_modules/kareem/.travis.yml deleted file mode 100644 index 9aa82225..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "0.12" - - "0.10" - - "iojs" -script: "npm run-script test-travis" -after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls" diff --git a/Associations/node_modules/mongoose/node_modules/kareem/LICENSE b/Associations/node_modules/mongoose/node_modules/kareem/LICENSE deleted file mode 100644 index e06d2081..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/Associations/node_modules/mongoose/node_modules/kareem/Makefile b/Associations/node_modules/mongoose/node_modules/kareem/Makefile deleted file mode 100644 index f71ba900..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -docs: - node ./docs.js - -coverage: - ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec ./test/* diff --git a/Associations/node_modules/mongoose/node_modules/kareem/README.md b/Associations/node_modules/mongoose/node_modules/kareem/README.md deleted file mode 100644 index 7d2dc84b..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/README.md +++ /dev/null @@ -1,379 +0,0 @@ -# kareem - - [![Build Status](https://travis-ci.org/vkarpov15/kareem.svg?branch=master)](https://travis-ci.org/vkarpov15/kareem) - [![Coverage Status](https://img.shields.io/coveralls/vkarpov15/kareem.svg)](https://coveralls.io/r/vkarpov15/kareem) - -Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, meant to offer additional flexibility in allowing you to execute hooks whenever necessary, as opposed to simply wrapping a single function. - -Named for the NBA's all-time leading scorer Kareem Abdul-Jabbar, known for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook) - - - -# API - -## pre hooks - -Much like [hooks](https://npmjs.org/package/hooks), kareem lets you define -pre and post hooks: pre hooks are called before a given function executes. -Unlike hooks, kareem stores hooks and other internal state in a separate -object, rather than relying on inheritance. Furthermore, kareem exposes -an `execPre()` function that allows you to execute your pre hooks when -appropriate, giving you more fine-grained control over your function hooks. - - -#### It runs without any hooks specified - -```javascript - - hooks.execPre('cook', null, function() { - done(); - }); - -``` - -#### It runs basic serial pre hooks - -pre hook functions take one parameter, a "done" function that you execute -when your pre hook is finished. - - -```javascript - - var count = 0; - - hooks.pre('cook', function(done) { - ++count; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count); - done(); - }); - -``` - -#### It can run multipe pre hooks - -```javascript - - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function(done) { - ++count1; - done(); - }); - - hooks.pre('cook', function(done) { - ++count2; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - -``` - -#### It can run fully synchronous pre hooks - -If your pre hook function takes no parameters, its assumed to be -fully synchronous. - - -```javascript - - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function() { - ++count1; - }); - - hooks.pre('cook', function() { - ++count2; - }); - - hooks.execPre('cook', null, function(error) { - assert.equal(null, error); - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - -``` - -#### It properly attaches context to pre hooks - -Pre save hook functions are bound to the second parameter to `execPre()` - - -```javascript - - hooks.pre('cook', function(done) { - this.bacon = 3; - done(); - }); - - hooks.pre('cook', function(done) { - this.eggs = 4; - done(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - // In the pre hooks, `this` will refer to `obj` - hooks.execPre('cook', obj, function(error) { - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - done(); - }); - -``` - -#### It can execute parallel (async) pre hooks - -Like the hooks module, you can declare "async" pre hooks - these take two -parameters, the functions `next()` and `done()`. `next()` passes control to -the next pre hook, but the underlying function won't be called until all -async pre hooks have called `done()`. - - -```javascript - - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - hooks.execPre('cook', obj, function() { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - done(); - }); - -``` - -## post hooks - -#### It runs without any hooks specified - -```javascript - - hooks.execPost('cook', null, [1], function(error, eggs) { - assert.ifError(error); - assert.equal(1, eggs); - done(); - }); - -``` - -#### It executes with parameters passed in - -```javascript - - hooks.post('cook', function(eggs, bacon, callback) { - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - -``` - -#### It can use synchronous post hooks - -```javascript - - var execed = {}; - - hooks.post('cook', function(eggs, bacon) { - execed.first = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - }); - - hooks.post('cook', function(eggs, bacon, callback) { - execed.second = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - -``` - -## wrap() - -#### It wraps pre and post calls into one call - -```javascript - - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.ifError(error); - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj, - args); - -``` - -## createWrapper() - -#### It wraps wrap() into a callable function - -```javascript - - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var cook = hooks.createWrapper( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj); - - cook(obj, function(error, result) { - assert.ifError(error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - -``` - -## clone() - -#### It clones a Kareem object - -```javascript - - var k1 = new Kareem(); - k1.pre('cook', function() {}); - k1.post('cook', function() {}); - - var k2 = k1.clone(); - assert.deepEqual(['cook'], Object.keys(k2._pres)); - assert.deepEqual(['cook'], Object.keys(k2._posts)); - -``` - diff --git a/Associations/node_modules/mongoose/node_modules/kareem/docs.js b/Associations/node_modules/mongoose/node_modules/kareem/docs.js deleted file mode 100644 index 4a8d4c89..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/docs.js +++ /dev/null @@ -1,37 +0,0 @@ -var acquit = require('acquit'); - -var content = require('fs').readFileSync('./test/examples.test.js').toString(); -var blocks = acquit.parse(content); - -var mdOutput = - '# kareem\n\n' + - ' [![Build Status](https://travis-ci.org/vkarpov15/kareem.svg?branch=master)](https://travis-ci.org/vkarpov15/kareem)\n' + - ' [![Coverage Status](https://img.shields.io/coveralls/vkarpov15/kareem.svg)](https://coveralls.io/r/vkarpov15/kareem)\n\n' + - 'Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, ' + - 'meant to offer additional flexibility in allowing you to execute hooks ' + - 'whenever necessary, as opposed to simply wrapping a single function.\n\n' + - 'Named for the NBA\'s all-time leading scorer Kareem Abdul-Jabbar, known ' + - 'for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook)\n\n' + - '\n\n' + - '# API\n\n'; - -for (var i = 0; i < blocks.length; ++i) { - var describe = blocks[i]; - mdOutput += '## ' + describe.contents + '\n\n'; - mdOutput += describe.comments[0] ? - acquit.trimEachLine(describe.comments[0]) + '\n\n' : - ''; - - for (var j = 0; j < describe.blocks.length; ++j) { - var it = describe.blocks[j]; - mdOutput += '#### It ' + it.contents + '\n\n'; - mdOutput += it.comments[0] ? - acquit.trimEachLine(it.comments[0]) + '\n\n' : - ''; - mdOutput += '```javascript\n'; - mdOutput += ' ' + it.code + '\n'; - mdOutput += '```\n\n'; - } -} - -require('fs').writeFileSync('README.md', mdOutput); diff --git a/Associations/node_modules/mongoose/node_modules/kareem/gulpfile.js b/Associations/node_modules/mongoose/node_modules/kareem/gulpfile.js deleted file mode 100644 index 635bfc75..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/gulpfile.js +++ /dev/null @@ -1,18 +0,0 @@ -var gulp = require('gulp'); -var mocha = require('gulp-mocha'); -var config = require('./package.json'); -var jscs = require('gulp-jscs'); - -gulp.task('mocha', function() { - return gulp.src('./test/*'). - pipe(mocha({ reporter: 'dot' })); -}); - -gulp.task('jscs', function() { - return gulp.src('./index.js'). - pipe(jscs(config.jscsConfig)); -}); - -gulp.task('watch', function() { - gulp.watch('./index.js', ['jscs', 'mocha']); -}); diff --git a/Associations/node_modules/mongoose/node_modules/kareem/index.js b/Associations/node_modules/mongoose/node_modules/kareem/index.js deleted file mode 100644 index b4b071be..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/index.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -function Kareem() { - this._pres = {}; - this._posts = {}; -} - -Kareem.prototype.execPre = function(name, context, callback) { - var pres = this._pres[name] || []; - var numPres = pres.length; - var numAsyncPres = pres.numAsync || 0; - var currentPre = 0; - var asyncPresLeft = numAsyncPres; - var done = false; - - if (!numPres) { - return process.nextTick(function() { - callback(null); - }); - } - - var next = function() { - if (currentPre >= numPres) { - return; - } - var pre = pres[currentPre]; - - if (pre.isAsync) { - pre.fn.call( - context, - function(error) { - if (error) { - if (done) { - return; - } - done = true; - return callback(error); - } - - ++currentPre; - next.apply(context, arguments); - }, - function(error) { - if (error) { - if (done) { - return; - } - done = true; - return callback(error); - } - - if (--numAsyncPres === 0) { - return callback(null); - } - }); - } else if (pre.fn.length > 0) { - var args = [function(error) { - if (error) { - if (done) { - return; - } - done = true; - return callback(error); - } - - if (++currentPre >= numPres) { - if (asyncPresLeft > 0) { - // Leave parallel hooks to run - return; - } else { - return callback(null); - } - } - - next.apply(context, arguments); - }]; - if (arguments.length >= 2) { - for (var i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - } - pre.fn.apply(context, args); - } else { - pre.fn.call(context); - if (++currentPre >= numPres) { - if (asyncPresLeft > 0) { - // Leave parallel hooks to run - return; - } else { - return process.nextTick(function() { - callback(null); - }); - } - } - next(); - } - }; - - next(); -}; - -Kareem.prototype.execPost = function(name, context, args, callback) { - var posts = this._posts[name] || []; - var numPosts = posts.length; - var currentPost = 0; - - if (!numPosts) { - return process.nextTick(function() { - callback.apply(null, [null].concat(args)); - }); - } - - var next = function() { - var post = posts[currentPost]; - - if (post.length > args.length) { - post.apply(context, args.concat(function(error) { - if (error) { - return callback(error); - } - - if (++currentPost >= numPosts) { - return callback.apply(null, [null].concat(args)); - } - - next(); - })); - } else { - post.apply(context, args); - - if (++currentPost >= numPosts) { - return callback.apply(null, [null].concat(args)); - } - - next(); - } - }; - - next(); -}; - -Kareem.prototype.wrap = function(name, fn, context, args, useLegacyPost) { - var lastArg = (args.length > 0 ? args[args.length - 1] : null); - var _this = this; - - this.execPre(name, context, function(error) { - if (error) { - if (typeof lastArg === 'function') { - return lastArg(error); - } - return; - } - - var end = (typeof lastArg === 'function' ? args.length - 1 : args.length); - - fn.apply(context, args.slice(0, end).concat(function() { - if (arguments[0]) { - // Assume error - return typeof lastArg === 'function' ? - lastArg(arguments[0]) : - undefined; - } - - if (useLegacyPost && typeof lastArg === 'function') { - lastArg.apply(context, arguments); - } - - var argsWithoutError = Array.prototype.slice.call(arguments, 1); - _this.execPost(name, context, argsWithoutError, function() { - if (arguments[0]) { - return typeof lastArg === 'function' ? - lastArg(arguments[0]) : - undefined; - } - - return typeof lastArg === 'function' && !useLegacyPost ? - lastArg.apply(context, arguments) : - undefined; - }); - })); - }); -}; - -Kareem.prototype.createWrapper = function(name, fn, context) { - var _this = this; - return function() { - var args = Array.prototype.slice.call(arguments); - _this.wrap(name, fn, context, args); - }; -}; - -Kareem.prototype.pre = function(name, isAsync, fn, error) { - if (typeof arguments[1] !== 'boolean') { - error = fn; - fn = isAsync; - isAsync = false; - } - - this._pres[name] = this._pres[name] || []; - var pres = this._pres[name]; - - if (isAsync) { - pres.numAsync = pres.numAsync || 0; - ++pres.numAsync; - } - - pres.push({ fn: fn, isAsync: isAsync }); - - return this; -}; - -Kareem.prototype.post = function(name, fn) { - (this._posts[name] = this._posts[name] || []).push(fn); - return this; -}; - -Kareem.prototype.clone = function() { - var n = new Kareem(); - for (var key in this._pres) { - n._pres[key] = this._pres[key].slice(); - } - for (var key in this._posts) { - n._posts[key] = this._posts[key].slice(); - } - - return n; -}; - -module.exports = Kareem; diff --git a/Associations/node_modules/mongoose/node_modules/kareem/package.json b/Associations/node_modules/mongoose/node_modules/kareem/package.json deleted file mode 100644 index 302be1be..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "kareem", - "version": "1.0.1", - "description": "Next-generation take on pre/post function hooks", - "main": "index.js", - "scripts": { - "test": "./node_modules/mocha/bin/mocha ./test/*", - "test-travis": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec ./test/*" - }, - "repository": { - "type": "git", - "url": "git://github.com/vkarpov15/kareem.git" - }, - "devDependencies": { - "acquit": "0.0.3", - "gulp": "3.8.10", - "gulp-mocha": "2.0.0", - "gulp-jscs": "1.4.0", - "istanbul": "0.3.5", - "jscs": "1.9.0", - "mocha": "2.0.0" - }, - "jscsConfig": { - "preset": "airbnb", - "requireMultipleVarDecl": null, - "disallowMultipleVarDecl": true - }, - "author": { - "name": "Valeri Karpov", - "email": "val@karpov.io" - }, - "license": "Apache 2.0", - "gitHead": "69710887f85dee09afac690df770dd2febde7268", - "bugs": { - "url": "https://github.com/vkarpov15/kareem/issues" - }, - "homepage": "https://github.com/vkarpov15/kareem", - "_id": "kareem@1.0.1", - "_shasum": "7805d215bb53214ec3af969a1d0b1f17e3e7b95c", - "_from": "kareem@1.0.1", - "_npmVersion": "2.7.4", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - }, - "maintainers": [ - { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - } - ], - "dist": { - "shasum": "7805d215bb53214ec3af969a1d0b1f17e3e7b95c", - "tarball": "http://registry.npmjs.org/kareem/-/kareem-1.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/kareem/-/kareem-1.0.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/kareem/test/examples.test.js b/Associations/node_modules/mongoose/node_modules/kareem/test/examples.test.js deleted file mode 100644 index 96d2fb8f..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/test/examples.test.js +++ /dev/null @@ -1,339 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -/* Much like [hooks](https://npmjs.org/package/hooks), kareem lets you define - * pre and post hooks: pre hooks are called before a given function executes. - * Unlike hooks, kareem stores hooks and other internal state in a separate - * object, rather than relying on inheritance. Furthermore, kareem exposes - * an `execPre()` function that allows you to execute your pre hooks when - * appropriate, giving you more fine-grained control over your function hooks. - */ -describe('pre hooks', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('runs without any hooks specified', function(done) { - hooks.execPre('cook', null, function() { - done(); - }); - }); - - /* pre hook functions take one parameter, a "done" function that you execute - * when your pre hook is finished. - */ - it('runs basic serial pre hooks', function(done) { - var count = 0; - - hooks.pre('cook', function(done) { - ++count; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count); - done(); - }); - }); - - it('can run multipe pre hooks', function(done) { - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function(done) { - ++count1; - done(); - }); - - hooks.pre('cook', function(done) { - ++count2; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - }); - - /* If your pre hook function takes no parameters, its assumed to be - * fully synchronous. - */ - it('can run fully synchronous pre hooks', function(done) { - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function() { - ++count1; - }); - - hooks.pre('cook', function() { - ++count2; - }); - - hooks.execPre('cook', null, function(error) { - assert.equal(null, error); - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - }); - - /* Pre save hook functions are bound to the second parameter to `execPre()` - */ - it('properly attaches context to pre hooks', function(done) { - hooks.pre('cook', function(done) { - this.bacon = 3; - done(); - }); - - hooks.pre('cook', function(done) { - this.eggs = 4; - done(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - // In the pre hooks, `this` will refer to `obj` - hooks.execPre('cook', obj, function(error) { - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - done(); - }); - }); - - /* Like the hooks module, you can declare "async" pre hooks - these take two - * parameters, the functions `next()` and `done()`. `next()` passes control to - * the next pre hook, but the underlying function won't be called until all - * async pre hooks have called `done()`. - */ - it('can execute parallel (async) pre hooks', function(done) { - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - hooks.execPre('cook', obj, function() { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - done(); - }); - }); -}); - -describe('post hooks', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('runs without any hooks specified', function(done) { - hooks.execPost('cook', null, [1], function(error, eggs) { - assert.ifError(error); - assert.equal(1, eggs); - done(); - }); - }); - - it('executes with parameters passed in', function(done) { - hooks.post('cook', function(eggs, bacon, callback) { - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - }); - - it('can use synchronous post hooks', function(done) { - var execed = {}; - - hooks.post('cook', function(eggs, bacon) { - execed.first = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - }); - - hooks.post('cook', function(eggs, bacon, callback) { - execed.second = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - }); -}); - -describe('wrap()', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('wraps pre and post calls into one call', function(done) { - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.ifError(error); - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj, - args); - }); -}); - -describe('createWrapper()', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('wraps wrap() into a callable function', function(done) { - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var cook = hooks.createWrapper( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj); - - cook(obj, function(error, result) { - assert.ifError(error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - }); -}); - -describe('clone()', function() { - it('clones a Kareem object', function() { - var k1 = new Kareem(); - k1.pre('cook', function() {}); - k1.post('cook', function() {}); - - var k2 = k1.clone(); - assert.deepEqual(['cook'], Object.keys(k2._pres)); - assert.deepEqual(['cook'], Object.keys(k2._posts)); - }); -}); diff --git a/Associations/node_modules/mongoose/node_modules/kareem/test/post.test.js b/Associations/node_modules/mongoose/node_modules/kareem/test/post.test.js deleted file mode 100644 index 3df0ec59..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/test/post.test.js +++ /dev/null @@ -1,46 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -describe('execPost', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('handles errors', function(done) { - hooks.post('cook', function(eggs, callback) { - callback('error!'); - }); - - hooks.execPost('cook', null, [4], function(error, eggs) { - assert.equal('error!', error); - assert.ok(!eggs); - done(); - }); - }); - - it('multiple posts', function(done) { - hooks.post('cook', function(eggs, callback) { - setTimeout( - function() { - callback(); - }, - 5); - }); - - hooks.post('cook', function(eggs, callback) { - setTimeout( - function() { - callback(); - }, - 5); - }); - - hooks.execPost('cook', null, [4], function(error, eggs) { - assert.ifError(error); - assert.equal(4, eggs); - done(); - }); - }); -}); \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/kareem/test/pre.test.js b/Associations/node_modules/mongoose/node_modules/kareem/test/pre.test.js deleted file mode 100644 index 4c1a212a..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/test/pre.test.js +++ /dev/null @@ -1,226 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -describe('execPre', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('handles errors with multiple pres', function(done) { - var execed = {}; - - hooks.pre('cook', function(done) { - execed.first = true; - done(); - }); - - hooks.pre('cook', function(done) { - execed.second = true; - done('error!'); - }); - - hooks.pre('cook', function(done) { - execed.third = true; - done(); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('handles async errors', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('error!'); - }, - 5); - - next(); - }); - - hooks.pre('cook', true, function(next, done) { - execed.second = true; - setTimeout( - function() { - done('other error!'); - }, - 10); - - next(); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('handles async errors in next()', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('other error!'); - }, - 15); - - next(); - }); - - hooks.pre('cook', true, function(next, done) { - execed.second = true; - setTimeout( - function() { - next('error!'); - done('another error!'); - }, - 5); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('handles async errors in next() when already done', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('other error!'); - }, - 5); - - next(); - }); - - hooks.pre('cook', true, function(next, done) { - execed.second = true; - setTimeout( - function() { - next('error!'); - done('another error!'); - }, - 25); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('other error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('returns correct error when async pre errors', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('other error!'); - }, - 5); - - next(); - }); - - hooks.pre('cook', function(next) { - execed.second = true; - setTimeout( - function() { - next('error!'); - }, - 15); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('other error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('lets async pres run when fully sync pres are done', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done(); - }, - 5); - - next(); - }); - - hooks.pre('cook', function() { - execed.second = true; - }); - - hooks.execPre('cook', null, function(err) { - assert.ifError(err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('allows passing arguments to the next pre', function(done) { - var execed = {}; - - hooks.pre('cook', function(next) { - execed.first = true; - next(null, 'test'); - }); - - hooks.pre('cook', function(next, p) { - execed.second = true; - assert.equal(p, 'test'); - next(); - }); - - hooks.pre('cook', function(next, p) { - execed.third = true; - assert.ok(!p); - next(); - }); - - hooks.execPre('cook', null, function(err) { - assert.ifError(err); - assert.equal(3, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - assert.ok(execed.third); - done(); - }); - }); -}); diff --git a/Associations/node_modules/mongoose/node_modules/kareem/test/wrap.test.js b/Associations/node_modules/mongoose/node_modules/kareem/test/wrap.test.js deleted file mode 100644 index 3303961a..00000000 --- a/Associations/node_modules/mongoose/node_modules/kareem/test/wrap.test.js +++ /dev/null @@ -1,277 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -describe('wrap()', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('handles pre errors', function(done) { - hooks.pre('cook', function(done) { - done('error!'); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.equal('error!', error); - assert.ok(!result); - assert.equal(undefined, obj.tofu); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - // Should never get called - assert.ok(false); - callback(null, o); - }, - obj, - args); - }); - - it('handles pre errors when no callback defined', function(done) { - hooks.pre('cook', function(done) { - done('error!'); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - - hooks.wrap( - 'cook', - function(o, callback) { - // Should never get called - assert.ok(false); - callback(null, o); - }, - obj, - args); - - setTimeout( - function() { - done(); - }, - 25); - }); - - it('handles errors in wrapped function', function(done) { - hooks.pre('cook', function(done) { - done(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.equal('error!', error); - assert.ok(!result); - assert.equal(undefined, obj.tofu); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - callback('error!'); - }, - obj, - args); - }); - - it('handles errors in post', function(done) { - hooks.pre('cook', function(done) { - done(); - }); - - hooks.post('cook', function(obj, callback) { - obj.tofu = 'no'; - callback('error!'); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.equal('error!', error); - assert.ok(!result); - assert.equal('no', obj.tofu); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - callback(null, o); - }, - obj, - args); - }); - - it('works with no args', function(done) { - hooks.pre('cook', function(done) { - done(); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback(null); - }, - obj, - args); - - setTimeout( - function() { - assert.equal('no', obj.tofu); - done(); - }, - 25); - }); - - it('handles pre errors with no args', function(done) { - hooks.pre('cook', function(done) { - done('error!'); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback(null); - }, - obj, - args); - - setTimeout( - function() { - assert.equal(undefined, obj.tofu); - done(); - }, - 25); - }); - - it('handles wrapped function errors with no args', function(done) { - hooks.pre('cook', function(done) { - obj.waffles = false; - done(); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback('error!'); - }, - obj, - args); - - setTimeout( - function() { - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - done(); - }, - 25); - }); - - it('handles post errors with no args', function(done) { - hooks.pre('cook', function(done) { - obj.waffles = false; - done(); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback('error!'); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback(); - }, - obj, - args); - - setTimeout( - function() { - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - done(); - }, - 25); - }); - - it('can use legacy post behavior', function(done) { - var called = 0; - hooks.post('cook', function(callback) { - ++called; - callback(); - }); - - var args = [function(error) { - assert.equal(called, 0); - - setTimeout(function() { - assert.equal(called, 1); - done(); - }, 0); - }]; - - hooks.wrap( - 'cook', - function(callback) { - callback(); - }, - null, - args, - true); - }); -}); \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/HISTORY.md b/Associations/node_modules/mongoose/node_modules/mongodb/HISTORY.md deleted file mode 100644 index 9a6163b1..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/HISTORY.md +++ /dev/null @@ -1,1225 +0,0 @@ -2.0.46 10-15-2015 ------------------ -* Updated mongodb-core to 1.2.19. -* NODE-578 Order of sort fields is lost for numeric field names. -* Expose BSON Map (ES6 Map or polyfill). -* Minor fixes for APM support to pass extended APM test suite. - -2.0.45 09-30-2015 ------------------ -* NODE-566 Fix issue with rewind on capped collections causing cursor state to be reset on connection loss. - -2.0.44 09-28-2015 ------------------ -* Bug fixes for APM upconverting of legacy INSERT/UPDATE/REMOVE wire protocol messages. -* NODE-562, fixed issue where a Replicaset MongoDB URI with a single seed and replSet name set would cause a single direct connection instead of topology discovery. -* Updated mongodb-core to 1.2.14. -* NODE-563 Introduced options.ignoreUndefined for db class and MongoClient db options, made serialize undefined to null default again but allowing for overrides on insert/update/delete operations. -* Use handleCallback if result is an error for count queries. (Issue #1298, https://github.com/agclever) -* Rewind cursor to correctly force reconnect on capped collections when first query comes back empty. -* NODE-571 added code 59 to legacy server errors when SCRAM-SHA-1 mechanism fails. -* NODE-572 Remove examples that use the second parameter to `find()`. - -2.0.43 09-14-2015 ------------------ -* Propagate timeout event correctly to db instances. -* Application Monitoring API (APM) implemented. -* NOT providing replSet name in MongoClient connection URI will force single server connection. Fixes issue where it was impossible to directly connect to a replicaset member server. -* Updated mongodb-core to 1.2.12. -* NODE-541 Initial Support "read committed" isolation level where "committed" means confimed by the voting majority of a replica set. -* GridStore doesn't share readPreference setting from connection string. (Issue #1295, https://github.com/zhangyaoxing) -* fixed forceServerObjectId calls (Issue #1292, https://github.com/d-mon-) -* Pass promise library through to DB function (Issue #1294, https://github.com/RovingCodeMonkey) - -2.0.42 08-18-2015 ------------------ -* Added test case to exercise all non-crud methods on mongos topologies, fixed numberOfConnectedServers on mongos topology instance. - -2.0.41 08-14-2015 ------------------ -* Added missing Mongos.prototype.parserType function. -* Updated mongodb-core to 1.2.10. - -2.0.40 07-14-2015 ------------------ -* Updated mongodb-core to 1.2.9 for 2.4 wire protocol error handler fix. -* NODE-525 Reset connectionTimeout after it's overwritten by tls.connect. -* NODE-518 connectTimeoutMS is doubled in 2.0.39. -* NODE-506 Ensures that errors from bulk unordered and ordered are instanceof Error (Issue #1282, https://github.com/owenallenaz). -* NODE-526 Unique index not throwing duplicate key error. -* NODE-528 Ignore undefined fields in Collection.find(). -* NODE-527 The API example for collection.createIndex shows Db.createIndex functionality. - -2.0.39 07-14-2015 ------------------ -* Updated mongodb-core to 1.2.6 for NODE-505. - -2.0.38 07-14-2015 ------------------ -* NODE-505 Query fails to find records that have a 'result' property with an array value. - -2.0.37 07-14-2015 ------------------ -* NODE-504 Collection * Default options when using promiseLibrary. -* NODE-500 Accidental repeat of hostname in seed list multiplies total connections persistently. -* Updated mongodb-core to 1.2.5 to fix NODE-492. - -2.0.36 07-07-2015 ------------------ -* Fully promisified allowing the use of ES6 generators and libraries like co. Also allows for BYOP (Bring your own promises). -* NODE-493 updated mongodb-core to 1.2.4 to ensure we cannot DDOS the mongod or mongos process on large connection pool sizes. - -2.0.35 06-17-2015 ------------------ -* Upgraded to mongodb-core 1.2.2 including removing warnings when C++ bson parser is not available and a fix for SCRAM authentication. - -2.0.34 06-17-2015 ------------------ -* Upgraded to mongodb-core 1.2.1 speeding up serialization and removing the need for the c++ bson extension. -* NODE-486 fixed issue related to limit and skip when calling toArray in 2.0 driver. -* NODE-483 throw error if capabilities of topology is queries before topology has performed connection setup. -* NODE-482 fixed issue where MongoClient.connect would incorrectly identify a replset seed list server as a non replicaset member. -* NODE-487 fixed issue where killcursor command was not being sent correctly on limit and skip queries. - -2.0.33 05-20-2015 ------------------ -* Bumped mongodb-core to 1.1.32. - -2.0.32 05-19-2015 ------------------ -* NODE-463 db.close immediately executes its callback. -* Don't only emit server close event once (Issue #1276, https://github.com/vkarpov15). -* NODE-464 Updated mongodb-core to 1.1.31 that uses a single socket connection to arbiters and hidden servers as well as emitting all event correctly. - -2.0.31 05-08-2015 ------------------ -* NODE-461 Tripping on error "no chunks found for file, possibly corrupt" when there is no error. - -2.0.30 05-07-2015 ------------------ -* NODE-460 fix; don't set authMechanism for user in db.authenticate() to avoid mongoose authentication issue. - -2.0.29 05-07-2015 ------------------ -* NODE-444 Possible memory leak, too many listeners added. -* NODE-459 Auth failure using Node 0.8.28, MongoDB 3.0.2 & mongodb-node-native 1.4.35. -* Bumped mongodb-core to 1.1.26. - -2.0.28 04-24-2015 ------------------ -* Bumped mongodb-core to 1.1.25 -* Added Cursor.prototype.setCursorOption to allow for setting node specific cursor options for tailable cursors. -* NODE-430 Cursor.count() opts argument masked by var opts = {} -* NODE-406 Implemented Cursor.prototype.map function tapping into MongoClient cursor transforms. -* NODE-438 replaceOne is not returning the result.ops property as described in the docs. -* NODE-433 _read, pipe and write all open gridstore automatically if not open. -* NODE-426 ensure drain event is emitted after write function returns, fixes intermittent issues in writing files to gridstore. -* NODE-440 GridStoreStream._read() doesn't check GridStore.read() error. -* Always use readPreference = primary for findAndModify command (ignore passed in read preferences) (Issue #1274, https://github.com/vkarpov15). -* Minor fix in GridStore.exists for dealing with regular expressions searches. - -2.0.27 04-07-2015 ------------------ -* NODE-410 Correctly handle issue with pause/resume in Node 0.10.x that causes exceptions when using the Node 0.12.0 style streams. - -2.0.26 04-07-2015 ------------------ -* Implements the Common Index specification Standard API at https://github.com/mongodb/specifications/blob/master/source/index-management.rst. -* NODE-408 Expose GridStore.currentChunk.chunkNumber. - -2.0.25 03-26-2015 ------------------ -* Upgraded mongodb-core to 1.1.21, making the C++ bson code an optional dependency to the bson module. - -2.0.24 03-24-2015 ------------------ -* NODE-395 Socket Not Closing, db.close called before full set finished initalizing leading to server connections in progress not being closed properly. -* Upgraded mongodb-core to 1.1.20. - -2.0.23 2015-03-21 ------------------ -* NODE-380 Correctly return MongoError from toError method. -* Fixed issue where addCursorFlag was not correctly setting the flag on the command for mongodb-core. -* NODE-388 Changed length from method to property on order.js/unordered.js bulk operations. -* Upgraded mongodb-core to 1.1.19. - -2.0.22 2015-03-16 ------------------ -* NODE-377, fixed issue where tags would correctly be checked on secondary and nearest to filter out eligible server candidates. -* Upgraded mongodb-core to 1.1.17. - -2.0.21 2015-03-06 ------------------ -* Upgraded mongodb-core to 1.1.16 making sslValidate default to true to force validation on connection unless overriden by the user. - -2.0.20 2015-03-04 ------------------ -* Updated mongodb-core 1.1.15 to relax pickserver method. - -2.0.19 2015-03-03 ------------------ -* NODE-376 Fixes issue * Unordered batch incorrectly tracks batch size when switching batch types (Issue #1261, https://github.com/meirgottlieb) -* NODE-379 Fixes bug in cursor.count() that causes the result to always be zero for dotted collection names (Issue #1262, https://github.com/vsivsi) -* Expose MongoError from mongodb-core (Issue #1260, https://github.com/tjconcept) - -2.0.18 2015-02-27 ------------------ -* Bumped mongodb-core 1.1.14 to ensure passives are correctly added as secondaries. - -2.0.17 2015-02-27 ------------------ -* NODE-336 Added length function to ordered and unordered bulk operations to be able know the amount of current operations in bulk. -* Bumped mongodb-core 1.1.13 to ensure passives are correctly added as secondaries. - -2.0.16 2015-02-16 ------------------ -* listCollection now returns filtered result correctly removing db name for 2.6 or earlier servers. -* Bumped mongodb-core 1.1.12 to correctly work for node 0.12.0 and io.js. -* Add ability to get collection name from cursor (Issue #1253, https://github.com/vkarpov15) - -2.0.15 2015-02-02 ------------------ -* Unified behavior of listCollections results so 3.0 and pre 3.0 return same type of results. -* Bumped mongodb-core to 1.1.11 to support per document tranforms in cursors as well as relaxing the setName requirement. -* NODE-360 Aggregation cursor and command correctly passing down the maxTimeMS property. -* Added ~1.0 mongodb-tools module for test running. -* Remove the required setName for replicaset connections, if not set it will pick the first setName returned. - -2.0.14 2015-01-21 ------------------ -* Fixed some MongoClient.connect options pass through issues and added test coverage. -* Bumped mongodb-core to 1.1.9 including fixes for io.js - -2.0.13 2015-01-09 ------------------ -* Bumped mongodb-core to 1.1.8. -* Optimized query path for performance, moving Object.defineProperty outside of constructors. - -2.0.12 2014-12-22 ------------------ -* Minor fixes to listCollections to ensure correct querying of a collection when using a string. - -2.0.11 2014-12-19 ------------------ -* listCollections filters out index namespaces on < 2.8 correctly -* Bumped mongo-client to 1.1.7 - -2.0.10 2014-12-18 ------------------ -* NODE-328 fixed db.open return when no callback available issue and added test. -* NODE-327 Refactored listCollections to return cursor to support 2.8. -* NODE-327 Added listIndexes method and refactored internal methods to use the new command helper. -* NODE-335 Cannot create index for nested objects fixed by relaxing key checking for createIndex helper. -* Enable setting of connectTimeoutMS (Issue #1235, https://github.com/vkarpov15) -* Bumped mongo-client to 1.1.6 - -2.0.9 2014-12-01 ----------------- -* Bumped mongodb-core to 1.1.3 fixing global leaked variables and introducing strict across all classes. -* All classes are now strict (Issue #1233) -* NODE-324 Refactored insert/update/remove and all other crud opts to rely on internal methods to avoid any recursion. -* Fixed recursion issues in debug logging due to JSON.stringify() -* Documentation fixes (Issue #1232, https://github.com/wsmoak) -* Fix writeConcern in Db.prototype.ensureIndex (Issue #1231, https://github.com/Qard) - -2.0.8 2014-11-28 ----------------- -* NODE-322 Finished up prototype refactoring of Db class. -* NODE-322 Exposed Cursor in index.js for New Relic. - -2.0.7 2014-11-20 ----------------- -* Bumped mongodb-core to 1.1.2 fixing a UTF8 encoding issue for collection names. -* NODE-318 collection.update error while setting a function with serializeFunctions option. -* Documentation fixes. - -2.0.6 2014-11-14 ----------------- -* Refactored code to be prototype based instead of privileged methods. -* Bumped mongodb-core to 1.1.1 to take advantage of the prototype based refactorings. -* Implemented missing aspects of the CRUD specification. -* Fixed documentation issues. -* Fixed global leak REFERENCE_BY_ID in gridfs grid_store (Issue #1225, https://github.com/j) -* Fix LearnBoost/mongoose#2313: don't let user accidentally clobber geoNear params (Issue #1223, https://github.com/vkarpov15) - -2.0.5 2014-10-29 ----------------- -* Minor fixes to documentation and generation of documentation. -* NODE-306 (No results in aggregation cursor when collection name contains a dot), Merged code for cursor and aggregation cursor. - -2.0.4 2014-10-23 ----------------- -* Allow for single replicaset seed list with no setName specified (Issue #1220, https://github.com/imaman) -* Made each rewind on each call allowing for re-using the cursor. -* Fixed issue where incorrect iterations would happen on each for extensive batchSizes. -* NODE-301 specifying maxTimeMS on find causes all fields to be omitted from result. - -2.0.3 2014-10-14 ----------------- -* NODE-297 Aggregate Broken for case of pipeline with no options. - -2.0.2 2014-10-08 ----------------- -* Bumped mongodb-core to 1.0.2. -* Fixed bson module dependency issue by relying on the mongodb-core one. -* Use findOne instead of find followed by nextObject (Issue #1216, https://github.com/sergeyksv) - -2.0.1 2014-10-07 ----------------- -* Dependency fix - -2.0.0 2014-10-07 ----------------- -* First release of 2.0 driver - -2.0.0-alpha2 2014-10-02 ------------------------ -* CRUD API (insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, bulkWrite, findOneAndDelete, findOneAndUpdate, findOneAndReplace) -* Cluster Management Spec compatible. - -2.0.0-alpha1 2014-09-08 ------------------------ -* Insert method allows only up 1000 pr batch for legacy as well as 2.6 mode -* Streaming behavior is 0.10.x or higher with backwards compatibility using readable-stream npm package -* Gridfs stream only available through .stream() method due to overlapping names on Gridstore object and streams in 0.10.x and higher of node -* remove third result on update and remove and return the whole result document instead (getting rid of the weird 3 result parameters) - * Might break some application -* Returns the actual mongodb-core result instead of just the number of records changed for insert/update/remove -* MongoClient only has the connect method (no ability instantiate with Server, ReplSet or similar) -* Removed Grid class -* GridStore only supports w+ for metadata updates, no appending to file as it's not thread safe and can cause corruption of the data - + seek will fail if attempt to use with w or w+ - + write will fail if attempted with w+ or r - + w+ only works for updating metadata on a file -* Cursor toArray and each resets and re-runs the cursor -* FindAndModify returns whole result document instead of just value -* Extend cursor to allow for setting all the options via methods instead of dealing with the current messed up find -* Removed db.dereference method -* Removed db.cursorInfo method -* Removed db.stats method -* Removed db.collectionNames not needed anymore as it's just a specialized case of listCollections -* Removed db.collectionInfo removed due to not being compatible with new storage engines in 2.8 as they need to use the listCollections command due to system collections not working for namespaces. -* Added db.listCollections to replace several methods above - -1.4.10 2014-09-04 ------------------ -* Fixed BSON and Kerberos compilation issues -* Bumped BSON to ~0.2 always installing latest BSON 0.2.x series -* Fixed Kerberos and bumped to 0.0.4 - -1.4.9 2014-08-26 ----------------- -* Check _bsonType for Binary (Issue #1202, https://github.com/mchapman) -* Remove duplicate Cursor constructor (Issue #1201, https://github.com/KenPowers) -* Added missing parameter in the documentation (Issue #1199, https://github.com/wpjunior) -* Documented third parameter on the update callback(Issue #1196, https://github.com/gabmontes) -* NODE-240 Operations on SSL connection hang on node 0.11.x -* NODE-235 writeResult is not being passed on when error occurs in insert -* NODE-229 Allow count to work with query hints -* NODE-233 collection.save() does not support fullResult -* NODE-244 Should parseError also emit a `disconnected` event? -* NODE-246 Cursors are inefficiently constructed and consequently cannot be promisified. -* NODE-248 Crash with X509 auth -* NODE-252 Uncaught Exception in Base.__executeAllServerSpecificErrorCallbacks -* Bumped BSON parser to 0.2.12 - - -1.4.8 2014-08-01 ----------------- -* NODE-205 correctly emit authenticate event -* NODE-210 ensure no undefined connection error when checking server state -* NODE-212 correctly inherit socketTimeoutMS from replicaset when HA process adds new servers or reconnects to existing ones -* NODE-220 don't throw error if ensureIndex errors out in Gridstore -* Updated bson to 0.2.11 to ensure correct toBSON behavior when returning non object in nested classes -* Fixed test running filters -* Wrap debug log in a call to format (Issue #1187, https://github.com/andyroyle) -* False option values should not trigger w:1 (Issue #1186, https://github.com/jsdevel) -* Fix aggregatestream.close(Issue #1194, https://github.com/jonathanong) -* Fixed parsing issue for w:0 in url parser when in connection string -* Modified collection.geoNear to support a geoJSON point or legacy coordinate pair (Issue #1198, https://github.com/mmacmillan) - -1.4.7 2014-06-18 ----------------- -* Make callbacks to be executed in right domain when server comes back up (Issue #1184, https://github.com/anton-kotenko) -* Fix issue where currentOp query against mongos would fail due to mongos passing through $readPreference field to mongod (CS-X) - -1.4.6 2014-06-12 ----------------- -* Added better support for MongoClient IP6 parsing (Issue #1181, https://github.com/micovery) -* Remove options check on index creation (Issue #1179, Issue #1183, https://github.com/jdesboeufs, https://github.com/rubenvereecken) -* Added missing type check before calling optional callback function (Issue #1180) - -1.4.5 2014-05-21 ----------------- -* Added fullResult flag to insert/update/remove which will pass raw result document back. Document contents will vary depending on the server version the driver is talking to. No attempt is made to coerce a joint response. -* Fix to avoid MongoClient.connect hanging during auth when secondaries building indexes pre 2.6. -* return the destination stream in GridStore.pipe (Issue #1176, https://github.com/iamdoron) - -1.4.4 2014-05-13 ----------------- -* Bumped BSON version to use the NaN 1.0 package, fixed strict comparison issue for ObjectID -* Removed leaking global variable (Issue #1174, https://github.com/dainis) -* MongoClient respects connectTimeoutMS for initial discovery process (NODE-185) -* Fix bug with return messages larger than 16MB but smaller than max BSON Message Size (NODE-184) - -1.4.3 2014-05-01 ----------------- -* Clone options for commands to avoid polluting original options passed from Mongoose (Issue #1171, https://github.com/vkarpov15) -* Made geoNear and geoHaystackSearch only clean out allowed options from command generation (Issue #1167) -* Fixed typo for allowDiskUse (Issue #1168, https://github.com/joaofranca) -* A 'mapReduce' function changed 'function' to instance '\' of 'Code' class (Issue #1165, https://github.com/exabugs) -* Made findAndModify set sort only when explicitly set (Issue #1163, https://github.com/sars) -* Rewriting a gridStore file by id should use a new filename if provided (Issue #1169, https://github.com/vsivsi) - -1.4.2 2014-04-15 ----------------- -* Fix for inheritance of readPreferences from MongoClient NODE-168/NODE-169 -* Merged in fix for ping strategy to avoid hitting non-pinged servers (Issue #1161, https://github.com/vaseker) -* Merged in fix for correct debug output for connection messages (Issue #1158, https://github.com/vaseker) -* Fixed global variable leak (Issue #1160, https://github.com/vaseker) - -1.4.1 2014-04-09 ----------------- -* Correctly emit joined event when primary change -* Add _id to documents correctly when using bulk operations - -1.4.0 2014-04-03 ----------------- -* All node exceptions will no longer be caught if on('error') is defined -* Added X509 auth support -* Fix for MongoClient connection timeout issue (NODE-97) -* Pass through error messages from parseError instead of just text (Issue #1125) -* Close db connection on error (Issue #1128, https://github.com/benighted) -* Fixed documentation generation -* Added aggregation cursor for 2.6 and emulated cursor for pre 2.6 (uses stream2) -* New Bulk API implementation using write commands for 2.6 and down converts for pre 2.6 -* Insert/Update/Remove using new write commands when available -* Added support for new roles based API's in 2.6 for addUser/removeUser -* Added bufferMaxEntries to start failing if the buffer hits the specified number of entries -* Upgraded BSON parser to version 0.2.7 to work with < 0.11.10 C++ API changes -* Support for OP_LOG_REPLAY flag (NODE-94) -* Fixes for SSL HA ping and discovery. -* Uses createIndexes if available for ensureIndex/createIndex -* Added parallelCollectionScan method to collection returning CommandCursor instances for cursors -* Made CommandCursor behave as Readable stream. -* Only Db honors readPreference settings, removed Server.js legacy readPreference settings due to user confusion. -* Reconnect event emitted by ReplSet/Mongos/Server after reconnect and before replaying of buffered operations. -* GridFS buildMongoObject returns error on illegal md5 (NODE-157, https://github.com/iantocristian) -* Default GridFS chunk size changed to (255 * 1024) bytes to optimize for collections defaulting to power of 2 sizes on 2.6. -* Refactored commands to all go through command function ensuring consistent command execution. -* Fixed issues where readPreferences where not correctly passed to mongos. -* Catch error == null and make err detection more prominent (NODE-130) -* Allow reads from arbiter for single server connection (NODE-117) -* Handle error coming back with no documents (NODE-130) -* Correctly use close parameter in Gridstore.write() (NODE-125) -* Throw an error on a bulk find with no selector (NODE-129, https://github.com/vkarpov15) -* Use a shallow copy of options in find() (NODE-124, https://github.com/vkarpov15) -* Fix statistical strategy (NODE-158, https://github.com/vkarpov15) -* GridFS off-by-one bug in lastChunkNumber() causes uncaught throw and data loss (Issue #1154, https://github.com/vsivsi) -* GridStore drops passed `aliases` option, always results in `null` value in GridFS files (Issue #1152, https://github.com/vsivsi) -* Remove superfluous connect object copying in index.js (Issue #1145, https://github.com/thomseddon) -* Do not return false when the connection buffer is still empty (Issue #1143, https://github.com/eknkc) -* Check ReadPreference object on ReplSet.canRead (Issue #1142, https://github.com/eknkc) -* Fix unpack error on _executeQueryCommand (Issue #1141, https://github.com/eknkc) -* Close db on failed connect so node can exit (Issue #1128, https://github.com/benighted) -* Fix global leak with _write_concern (Issue #1126, https://github.com/shanejonas) - -1.3.19 2013-08-21 ------------------ -* Correctly rethrowing errors after change from event emission to callbacks, compatibility with 0.10.X domains without breaking 0.8.X support. -* Small fix to return the entire findAndModify result as the third parameter (Issue #1068) -* No removal of "close" event handlers on server reconnect, emits "reconnect" event when reconnection happens. Reconnect Only applies for single server connections as of now as semantics for ReplSet and Mongos is not clear (Issue #1056) - -1.3.18 2013-08-10 ------------------ -* Fixed issue when throwing exceptions in MongoClient.connect/Db.open (Issue #1057) -* Fixed an issue where _events is not cleaned up correctly causing a slow steady memory leak. - -1.3.17 2013-08-07 ------------------ -* Ignore return commands that have no registered callback -* Made collection.count not use the db.command function -* Fix throw exception on ping command (Issue #1055) - -1.3.16 2013-08-02 ------------------ -* Fixes connection issue where lots of connections would happen if a server is in recovery mode during connection (Issue #1050, NODE-50, NODE-51) -* Bug in unlink mulit filename (Issue #1054) - -1.3.15 2013-08-01 ------------------ -* Memory leak issue due to node Issue #4390 where _events[id] is set to undefined instead of deleted leading to leaks in the Event Emitter over time - -1.3.14 2013-08-01 ------------------ -* Fixed issue with checkKeys where it would error on X.X - -1.3.13 2013-07-31 ------------------ -* Added override for checkKeys on insert/update (Warning will expose you to injection attacks) (Issue #1046) -* BSON size checking now done pre serialization (Issue #1037) -* Added isConnected returns false when no connection Pool exists (Issue #1043) -* Unified command handling to ensure same handling (Issue #1041, #1042) -* Correctly emit "open" and "fullsetup" across all Db's associated with Mongos, ReplSet or Server (Issue #1040) -* Correctly handles bug in authentication when attempting to connect to a recovering node in a replicaset. -* Correctly remove recovering servers from available servers in replicaset. Piggybacks on the ping command. -* Removed findAndModify chaining to be compliant with behavior in other official drivers and to fix a known mongos issue. -* Fixed issue with Kerberos authentication on Windows for re-authentication. -* Fixed Mongos failover behavior to correctly throw out old servers. -* Ensure stored queries/write ops are executed correctly after connection timeout -* Added promoteLongs option for to allow for overriding the promotion of Longs to Numbers and return the actual Long. - -1.3.12 2013-07-19 ------------------ -* Fixed issue where timeouts sometimes would behave wrongly (Issue #1032) -* Fixed bug with callback third parameter on some commands (Issue #1033) -* Fixed possible issue where killcursor command might leave hanging functions -* Fixed issue where Mongos was not correctly removing dead servers from the pool of eligable servers -* Throw error if dbName or collection name contains null character (at command level and at collection level) -* Updated bson parser to 0.2.1 with security fix and non-promotion of Long values to javascript Numbers (once a long always a long) - -1.3.11 2013-07-04 ------------------ -* Fixed errors on geoNear and geoSearch (Issue #1024, https://github.com/ebensing) -* Add driver version to export (Issue #1021, https://github.com/aheckmann) -* Add text to readpreference obedient commands (Issue #1019) -* Drivers should check the query failure bit even on getmore response (Issue #1018) -* Map reduce has incorrect expectations of 'inline' value for 'out' option (Issue #1016, https://github.com/rcotter) -* Support SASL PLAIN authentication (Issue #1009) -* Ability to use different Service Name on the driver for Kerberos Authentication (Issue #1008) -* Remove unnecessary octal literal to allow the code to run in strict mode (Issue #1005, https://github.com/jamesallardice) -* Proper handling of recovering nodes (when they go into recovery and when they return from recovery, Issue #1027) - -1.3.10 2013-06-17 ------------------ -* Guard against possible undefined in server::canCheckoutWriter (Issue #992, https://github.com/willyaranda) -* Fixed some duplicate test names (Issue #993, https://github.com/kawanet) -* Introduced write and read concerns for GridFS (Issue #996) -* Fixed commands not correctly respecting Collection level read preference (Issue #995, #999) -* Fixed issue with pool size on replicaset connections (Issue #1000) -* Execute all query commands on master switch (Issue #1002, https://github.com/fogaztuc) - -1.3.9 2013-06-05 ----------------- -* Fixed memory leak when findAndModify errors out on w>1 and chained callbacks not properly cleaned up. - -1.3.8 2013-05-31 ----------------- -* Fixed issue with socket death on windows where it emits error event instead of close event (Issue #987) -* Emit authenticate event on db after authenticate method has finished on db instance (Issue #984) -* Allows creation of MongoClient and do new MongoClient().connect(..). Emits open event when connection correct allowing for apps to react on event. - -1.3.7 2013-05-29 ----------------- -* After reconnect, tailable getMores go on inconsistent connections (Issue #981, #982, https://github.com/glasser) -* Updated Bson to 0.1.9 to fix ARM support (Issue #985) - -1.3.6 2013-05-21 ----------------- -* Fixed issue where single server reconnect attempt would throw due to missing options variable (Issue #979) -* Fixed issue where difference in ismaster server name and seed list caused connections issues, (Issue #976) - -1.3.5 2013-05-14 ----------------- -* Fixed issue where HA for replicaset would pick the same broken connection when attempting to ping the replicaset causing the replicaset to never recover. - -1.3.4 2013-05-14 ----------------- -* Fixed bug where options not correctly passed in for uri parser (Issue #973, https://github.com/supershabam) -* Fixed bug when passing a named index hint (Issue #974) - -1.3.3 2013-05-09 ----------------- -* Fixed auto-reconnect issue with single server instance. - -1.3.2 2013-05-08 ----------------- -* Fixes for an issue where replicaset would be pronounced dead when high priority primary caused double elections. - -1.3.1 2013-05-06 ----------------- -* Fix for replicaset consisting of primary/secondary/arbiter with priority applied failing to reconnect properly -* Applied auth before server instance is set as connected when single server connection -* Throw error if array of documents passed to save method - -1.3.0 2013-04-25 ----------------- -* Whole High availability handling for Replicaset, Server and Mongos connections refactored to ensure better handling of failover cases. -* Fixed issue where findAndModify would not correctly skip issuing of chained getLastError (Issue #941) -* Fixed throw error issue on errors with findAndModify during write out operation (Issue #939, https://github.com/autopulated) -* Gridstore.prototype.writeFile now returns gridstore object correctly (Issue #938) -* Kerberos support is now an optional module that allows for use of GSSAPI authentication using MongoDB Subscriber edition -* Fixed issue where cursor.toArray could blow the stack on node 0.10.X (#950) - -1.2.14 2013-03-14 ------------------ -* Refactored test suite to speed up running of replicaset tests -* Fix of async error handling when error happens in callback (Issue #909, https://github.com/medikoo) -* Corrected a slaveOk setting issue (Issue #906, #905) -* Fixed HA issue where ping's would not go to correct server on HA server connection failure. -* Uses setImmediate if on 0.10 otherwise nextTick for cursor stream -* Fixed race condition in Cursor stream (NODE-31) -* Fixed issues related to node 0.10 and process.nextTick now correctly using setImmediate where needed on node 0.10 -* Added support for maxMessageSizeBytes if available (DRIVERS-1) -* Added support for authSource (2.4) to MongoClient URL and db.authenticate method (DRIVER-69/NODE-34) -* Fixed issue in GridStore seek and GridStore read to correctly work on multiple seeks (Issue #895) - -1.2.13 2013-02-22 ------------------ -* Allow strategy 'none' for repliaset if no strategy wanted (will default to round robin selection of servers on a set readPreference) -* Fixed missing MongoErrors on some cursor methods (Issue #882) -* Correctly returning a null for the db instance on MongoClient.connect when auth fails (Issue #890) -* Added dropTarget option support for renameCollection/rename (Issue #891, help from https://github.com/jbottigliero) -* Fixed issue where connection using MongoClient.connect would fail if first server did not exist (Issue #885) - -1.2.12 2013-02-13 ------------------ -* Added limit/skip options to Collection.count (Issue #870) -* Added applySkipLimit option to Cursor.count (Issue #870) -* Enabled ping strategy as default for Replicaset if none specified (Issue #876) -* Should correctly pick nearest server for SECONDARY/SECONDARY_PREFERRED/NEAREST (Issue #878) - -1.2.11 2013-01-29 ------------------ -* Added fixes for handling type 2 binary due to PHP driver (Issue #864) -* Moved callBackStore to Base class to have single unified store (Issue #866) -* Ping strategy now reuses sockets unless they are closed by the server to avoid overhead - -1.2.10 2013-01-25 ------------------ -* Merged in SSL support for 2.4 supporting certificate validation and presenting certificates to the server. -* Only open a new HA socket when previous one dead (Issue #859, #857) -* Minor fixes - -1.2.9 2013-01-15 ----------------- -* Fixed bug in SSL support for MongoClient/Db.connect when discovering servers (Issue #849) -* Connection string with no db specified should default to admin db (Issue #848) -* Support port passed as string to Server class (Issue #844) -* Removed noOpen support for MongoClient/Db.connect as auto discovery of servers for Mongod/Mongos makes it not possible (Issue #842) -* Included toError wrapper code moved to utils.js file (Issue #839, #840) -* Rewrote cursor handling to avoid process.nextTick using trampoline instead to avoid stack overflow, speedup about 40% - -1.2.8 2013-01-07 ----------------- -* Accept function in a Map Reduce scope object not only a function string (Issue #826, https://github.com/aheckmann) -* Typo in db.authenticate caused a check (for provided connection) to return false, causing a connection AND onAll=true to be passed into __executeQueryCommand downstream (Issue #831, https://github.com/m4tty) -* Allow gridfs objects to use non ObjectID ids (Issue #825, https://github.com/nailgun) -* Removed the double wrap, by not passing an Error object to the wrap function (Issue #832, https://github.com/m4tty) -* Fix connection leak (gh-827) for HA replicaset health checks (Issue #833, https://github.com/aheckmann) -* Modified findOne to use nextObject instead of toArray avoiding a nextTick operation (Issue #836) -* Fixes for cursor stream to avoid multiple getmore issues when one in progress (Issue #818) -* Fixes .open replaying all backed up commands correctly if called after operations performed, (Issue #829 and #823) - -1.2.7 2012-12-23 ----------------- -* Rolled back batches as they hang in certain situations -* Fixes for NODE-25, keep reading from secondaries when primary goes down - -1.2.6 2012-12-21 ----------------- -* domain sockets shouldn't require a port arg (Issue #815, https://github.com/aheckmann) -* Cannot read property 'info' of null (Issue #809, https://github.com/thesmart) -* Cursor.each should work in batches (Issue #804, https://github.com/Swatinem) -* Cursor readPreference bug for non-supported read preferences (Issue #817) - -1.2.5 2012-12-12 ----------------- -* Fixed ssl regression, added more test coverage (Issue #800) -* Added better error reporting to the Db.connect if no valid serverConfig setup found (Issue #798) - -1.2.4 2012-12-11 ----------------- -* Fix to ensure authentication is correctly applied across all secondaries when using MongoClient. - -1.2.3 2012-12-10 ----------------- -* Fix for new replicaset members correctly authenticating when being added (Issue #791, https://github.com/m4tty) -* Fixed seek issue in gridstore when using stream (Issue #790) - -1.2.2 2012-12-03 ----------------- -* Fix for journal write concern not correctly being passed under some circumstances. -* Fixed correct behavior and re-auth for servers that get stepped down (Issue #779). - -1.2.1 2012-11-30 ----------------- -* Fix for double callback on insert with w:0 specified (Issue #783) -* Small cleanup of urlparser. - -1.2.0 2012-11-27 ----------------- -* Honor connectTimeoutMS option for replicasets (Issue #750, https://github.com/aheckmann) -* Fix ping strategy regression (Issue #738, https://github.com/aheckmann) -* Small cleanup of code (Issue #753, https://github.com/sokra/node-mongodb-native) -* Fixed index declaration using objects/arrays from other contexts (Issue #755, https://github.com/sokra/node-mongodb-native) -* Intermittent (and rare) null callback exception when using ReplicaSets (Issue #752) -* Force correct setting of read_secondary based on the read preference (Issue #741) -* If using read preferences with secondaries queries will not fail if primary is down (Issue #744) -* noOpen connection for Db.connect removed as not compatible with autodetection of Mongo type -* Mongos connection with auth not working (Issue #737) -* Use the connect method directly from the require. require('mongodb')("mongodb://localhost:27017/db") -* new MongoClient introduced as the point of connecting to MongoDB's instead of the Db - * open/close/db/connect methods implemented -* Implemented common URL connection format using MongoClient.connect allowing for simialar interface across all drivers. -* Fixed a bug with aggregation helper not properly accepting readPreference - -1.1.11 2012-10-10 ------------------ -* Removed strict mode and introduced normal handling of safe at DB level. - -1.1.10 2012-10-08 ------------------ -* fix Admin.serverStatus (Issue #723, https://github.com/Contra) -* logging on connection open/close(Issue #721, https://github.com/asiletto) -* more fixes for windows bson install (Issue #724) - -1.1.9 2012-10-05 ----------------- -* Updated bson to 0.1.5 to fix build problem on sunos/windows. - -1.1.8 2012-10-01 ----------------- -* Fixed db.eval to correctly handle system.js global javascript functions (Issue #709) -* Cleanup of non-closing connections (Issue #706) -* More cleanup of connections under replicaset (Issue #707, https://github.com/elbert3) -* Set keepalive on as default, override if not needed -* Cleanup of jsbon install to correctly build without install.js script (https://github.com/shtylman) -* Added domain socket support new Server("/tmp/mongodb.sock") style - -1.1.7 2012-09-10 ----------------- -* Protect against starting PingStrategy being called more than once (Issue #694, https://github.com/aheckmann) -* Make PingStrategy interval configurable (was 1 second, relaxed to 5) (Issue #693, https://github.com/aheckmann) -* Made PingStrategy api more consistant, callback to start/stop methods are optional (Issue #693, https://github.com/aheckmann) -* Proper stopping of strategy on replicaset stop -* Throw error when gridstore file is not found in read mode (Issue #702, https://github.com/jbrumwell) -* Cursor stream resume now using nextTick to avoid duplicated records (Issue #696) - -1.1.6 2012-09-01 ----------------- -* Fix for readPreference NEAREST for replicasets (Issue #693, https://github.com/aheckmann) -* Emit end correctly on stream cursor (Issue #692, https://github.com/Raynos) - -1.1.5 2012-08-29 ----------------- -* Fix for eval on replicaset Issue #684 -* Use helpful error msg when native parser not compiled (Issue #685, https://github.com/aheckmann) -* Arbiter connect hotfix (Issue #681, https://github.com/fengmk2) -* Upgraded bson parser to 0.1.2 using gyp, deprecated support for node 0.4.X -* Added name parameter to createIndex/ensureIndex to be able to override index names larger than 128 bytes -* Added exhaust option for find for feature completion (not recommended for normal use) -* Added tailableRetryInterval to find for tailable cursors to allow to control getMore retry time interval -* Fixes for read preferences when using MongoS to correctly handle no read preference set when iterating over a cursor (Issue #686) - -1.1.4 2012-08-12 ----------------- -* Added Mongos connection type with a fallback list for mongos proxies, supports ha (on by default) and will attempt to reconnect to failed proxies. -* Documents can now have a toBSON method that lets the user control the serialization behavior for documents being saved. -* Gridstore instance object now works as a readstream or writestream (thanks to code from Aaron heckmann (https://github.com/aheckmann/gridfs-stream)). -* Fix gridfs readstream (Issue #607, https://github.com/tedeh). -* Added disableDriverBSONSizeCheck property to Server.js for people who wish to push the inserts to the limit (Issue #609). -* Fixed bug where collection.group keyf given as Code is processed as a regular object (Issue #608, https://github.com/rrusso2007). -* Case mismatch between driver's ObjectID and mongo's ObjectId, allow both (Issue #618). -* Cleanup map reduce (Issue #614, https://github.com/aheckmann). -* Add proper error handling to gridfs (Issue #615, https://github.com/aheckmann). -* Ensure cursor is using same connection for all operations to avoid potential jump of servers when using replicasets. -* Date identification handled correctly in bson js parser when running in vm context. -* Documentation updates -* GridStore filename not set on read (Issue #621) -* Optimizations on the C++ bson parser to fix a potential memory leak and avoid non-needed calls -* Added support for awaitdata for tailable cursors (Issue #624) -* Implementing read preference setting at collection and cursor level - * collection.find().setReadPreference(Server.SECONDARY_PREFERRED) - * db.collection("some", {readPreference:Server.SECONDARY}) -* Replicaset now returns when the master is discovered on db.open and lets the rest of the connections happen asynchronous. - * ReplSet/ReplSetServers emits "fullsetup" when all servers have been connected to -* Prevent callback from executing more than once in getMore function (Issue #631, https://github.com/shankar0306) -* Corrupt bson messages now errors out to all callbacks and closes up connections correctly, Issue #634 -* Replica set member status update when primary changes bug (Issue #635, https://github.com/alinsilvian) -* Fixed auth to work better when multiple connections are involved. -* Default connection pool size increased to 5 connections. -* Fixes for the ReadStream class to work properly with 0.8 of Node.js -* Added explain function support to aggregation helper -* Added socketTimeoutMS and connectTimeoutMS to socket options for repl_set.js and server.js -* Fixed addUser to correctly handle changes in 2.2 for getLastError authentication required -* Added index to gridstore chunks on file_id (Issue #649, https://github.com/jacobbubu) -* Fixed Always emit db events (Issue #657) -* Close event not correctly resets DB openCalled variable to allow reconnect -* Added open event on connection established for replicaset, mongos and server -* Much faster BSON C++ parser thanks to Lucasfilm Singapore. -* Refactoring of replicaset connection logic to simplify the code. -* Add `options.connectArbiter` to decide connect arbiters or not (Issue #675) -* Minor optimization for findAndModify when not using j,w or fsync for safe - -1.0.2 2012-05-15 ----------------- -* Reconnect functionality for replicaset fix for mongodb 2.0.5 - -1.0.1 2012-05-12 ----------------- -* Passing back getLastError object as 3rd parameter on findAndModify command. -* Fixed a bunch of performance regressions in objectId and cursor. -* Fixed issue #600 allowing for single document delete to be passed in remove command. - -1.0.0 2012-04-25 ----------------- -* Fixes to handling of failover on server error -* Only emits error messages if there are error listeners to avoid uncaught events -* Server.isConnected using the server state variable not the connection pool state - -0.9.9.8 2012-04-12 ------------------- -* _id=0 is being turned into an ObjectID (Issue #551) -* fix for error in GridStore write method (Issue #559) -* Fix for reading a GridStore from arbitrary, non-chunk aligned offsets, added test (Issue #563, https://github.com/subroutine) -* Modified limitRequest to allow negative limits to pass through to Mongo, added test (Issue #561) -* Corrupt GridFS files when chunkSize < fileSize, fixed concurrency issue (Issue #555) -* Handle dead tailable cursors (Issue #568, https://github.com/aheckmann) -* Connection pools handles closing themselves down and clearing the state -* Check bson size of documents against maxBsonSize and throw client error instead of server error, (Issue #553) -* Returning update status document at the end of the callback for updates, (Issue #569) -* Refactor use of Arguments object to gain performance (Issue #574, https://github.com/AaronAsAChimp) - -0.9.9.7 2012-03-16 ------------------- -* Stats not returned from map reduce with inline results (Issue #542) -* Re-enable testing of whether or not the callback is called in the multi-chunk seek, fix small GridStore bug (Issue #543, https://github.com/pgebheim) -* Streaming large files from GridFS causes truncation (Issue #540) -* Make callback type checks agnostic to V8 context boundaries (Issue #545) -* Correctly throw error if an attempt is made to execute an insert/update/remove/createIndex/ensureIndex with safe enabled and no callback -* Db.open throws if the application attemps to call open again without calling close first - -0.9.9.6 2012-03-12 ------------------- -* BSON parser is externalized in it's own repository, currently using git master -* Fixes for Replicaset connectivity issue (Issue #537) -* Fixed issues with node 0.4.X vs 0.6.X (Issue #534) -* Removed SimpleEmitter and replaced with standard EventEmitter -* GridStore.seek fails to change chunks and call callback when in read mode (Issue #532) - -0.9.9.5 2012-03-07 ------------------- -* Merged in replSetGetStatus helper to admin class (Issue #515, https://github.com/mojodna) -* Merged in serverStatus helper to admin class (Issue #516, https://github.com/mojodna) -* Fixed memory leak in C++ bson parser (Issue #526) -* Fix empty MongoError "message" property (Issue #530, https://github.com/aheckmann) -* Cannot save files with the same file name to GridFS (Issue #531) - -0.9.9.4 2012-02-26 ------------------- -* bugfix for findAndModify: Error: corrupt bson message < 5 bytes long (Issue #519) - -0.9.9.3 2012-02-23 ------------------- -* document: save callback arguments are both undefined, (Issue #518) -* Native BSON parser install error with npm, (Issue #517) - -0.9.9.2 2012-02-17 ------------------- -* Improved detection of Buffers using Buffer.isBuffer instead of instanceof. -* Added wrap error around db.dropDatabase to catch all errors (Issue #512) -* Added aggregate helper to collection, only for MongoDB >= 2.1 - -0.9.9.1 2012-02-15 ------------------- -* Better handling of safe when using some commands such as createIndex, ensureIndex, addUser, removeUser, createCollection. -* Mapreduce now throws error if out parameter is not specified. - -0.9.9 2012-02-13 ----------------- -* Added createFromTime method on ObjectID to allow for queries against _id more easily using the timestamp. -* Db.close(true) now makes connection unusable as it's been force closed by app. -* Fixed mapReduce and group functions to correctly send slaveOk on queries. -* Fixes for find method to correctly work with find(query, fields, callback) (Issue #506). -* A fix for connection error handling when using the SSL on MongoDB. - -0.9.8-7 2012-02-06 ------------------- -* Simplified findOne to use the find command instead of the custom code (Issue #498). -* BSON JS parser not also checks for _bsonType variable in case BSON object is in weird scope (Issue #495). - -0.9.8-6 2012-02-04 ------------------- -* Removed the check for replicaset change code as it will never work with node.js. - -0.9.8-5 2012-02-02 ------------------- -* Added geoNear command to Collection. -* Added geoHaystackSearch command to Collection. -* Added indexes command to collection to retrieve the indexes on a Collection. -* Added stats command to collection to retrieve the statistics on a Collection. -* Added listDatabases command to admin object to allow retrieval of all available dbs. -* Changed createCreateIndexCommand to work better with options. -* Fixed dereference method on Db class to correctly dereference Db reference objects. -* Moved connect object onto Db class(Db.connect) as well as keeping backward compatibility. -* Removed writeBuffer method from gridstore, write handles switching automatically now. -* Changed readBuffer to read on Gridstore, Gridstore now only supports Binary Buffers no Strings anymore. -* Moved Long class to bson directory. - -0.9.8-4 2012-01-28 ------------------- -* Added reIndex command to collection and db level. -* Added support for $returnKey, $maxScan, $min, $max, $showDiskLoc, $comment to cursor and find/findOne methods. -* Added dropDups and v option to createIndex and ensureIndex. -* Added isCapped method to Collection. -* Added indexExists method to Collection. -* Added findAndRemove method to Collection. -* Fixed bug for replicaset connection when no active servers in the set. -* Fixed bug for replicaset connections when errors occur during connection. -* Merged in patch for BSON Number handling from Lee Salzman, did some small fixes and added test coverage. - -0.9.8-3 2012-01-21 ------------------- -* Workaround for issue with Object.defineProperty (Issue #484) -* ObjectID generation with date does not set rest of fields to zero (Issue #482) - -0.9.8-2 2012-01-20 ------------------- -* Fixed a missing this in the ReplSetServers constructor. - -0.9.8-1 2012-01-17 ------------------- -* FindAndModify bug fix for duplicate errors (Issue #481) - -0.9.8 2012-01-17 ----------------- -* Replicasets now correctly adjusts to live changes in the replicaset configuration on the servers, reconnecting correctly. - * Set the interval for checking for changes setting the replicaSetCheckInterval property when creating the ReplSetServers instance or on db.serverConfig.replicaSetCheckInterval. (default 1000 miliseconds) -* Fixes formattedOrderClause in collection.js to accept a plain hash as a parameter (Issue #469) https://github.com/tedeh -* Removed duplicate code for formattedOrderClause and moved to utils module -* Pass in poolSize for ReplSetServers to set default poolSize for new replicaset members -* Bug fix for BSON JS deserializer. Isolating the eval functions in separate functions to avoid V8 deoptimizations -* Correct handling of illegal BSON messages during deserialization -* Fixed Infinite loop when reading GridFs file with no chunks (Issue #471) -* Correctly update existing user password when using addUser (Issue #470) - -0.9.7.3-5 2012-01-04 --------------------- -* Fix for RegExp serialization for 0.4.X where typeof /regexp/ == 'function' vs in 0.6.X typeof /regexp/ == 'object' -* Don't allow keepAlive and setNoDelay for 0.4.X as it throws errors - -0.9.7.3-4 2012-01-04 --------------------- -* Chased down potential memory leak on findAndModify, Issue #467 (node.js removeAllListeners leaves the key in the _events object, node.js bug on eventlistener?, leads to extremely slow memory leak on listener object) -* Sanity checks for GridFS performance with benchmark added - -0.9.7.3-3 2012-01-04 --------------------- -* Bug fixes for performance issues going form 0.9.6.X to 0.9.7.X on linux -* BSON bug fixes for performance - -0.9.7.3-2 2012-01-02 --------------------- -* Fixed up documentation to reflect the preferred way of instantiating bson types -* GC bug fix for JS bson parser to avoid stop-and-go GC collection - -0.9.7.3-1 2012-01-02 --------------------- -* Fix to make db.bson_serializer and db.bson_deserializer work as it did previously - -0.9.7.3 2011-12-30 --------------------- -* Moved BSON_BINARY_SUBTYPE_DEFAULT from BSON object to Binary object and removed the BSON_BINARY_ prefixes -* Removed Native BSON types, C++ parser uses JS types (faster due to cost of crossing the JS-C++ barrier for each call) -* Added build fix for 0.4.X branch of Node.js where GetOwnPropertyNames is not defined in v8 -* Fix for wire protocol parser for corner situation where the message is larger than the maximum socket buffer in node.js (Issue #464, #461, #447) -* Connection pool status set to connected on poolReady, isConnected returns false on anything but connected status (Issue #455) - -0.9.7.2-5 2011-12-22 --------------------- -* Brand spanking new Streaming Cursor support Issue #458 (https://github.com/christkv/node-mongodb-native/pull/458) thanks to Mr Aaron Heckmann - -0.9.7.2-4 2011-12-21 --------------------- -* Refactoring of callback code to work around performance regression on linux -* Fixed group function to correctly use the command mode as default - -0.9.7.2-3 2011-12-18 --------------------- -* Fixed error handling for findAndModify while still working for mongodb 1.8.6 (Issue #450). -* Allow for force send query to primary, pass option (read:'primary') on find command. - * ``find({a:1}, {read:'primary'}).toArray(function(err, items) {});`` - -0.9.7.2-2 2011-12-16 --------------------- -* Fixes infinite streamRecords QueryFailure fix when using Mongos (Issue #442) - -0.9.7.2-1 2011-12-16 --------------------- -* ~10% perf improvement for ObjectId#toHexString (Issue #448, https://github.com/aheckmann) -* Only using process.nextTick on errors emitted on callbacks not on all parsing, reduces number of ticks in the driver -* Changed parsing off bson messages to use process.nextTick to do bson parsing in batches if the message is over 10K as to yield more time to the event look increasing concurrency on big mongoreply messages with multiple documents - -0.9.7.2 2011-12-15 ------------------- -* Added SSL support for future version of mongodb (VERY VERY EXPERIMENTAL) - * pass in the ssl:true option to the server or replicaset server config to enable - * a bug either in mongodb or node.js does not allow for more than 1 connection pr db instance (poolSize:1). -* Added getTimestamp() method to objectID that returns a date object -* Added finalize function to collection.group - * function group (keys, condition, initial, reduce, finalize, command, callback) -* Reaper no longer using setTimeout to handle reaping. Triggering is done in the general flow leading to predictable behavior. - * reaperInterval, set interval for reaper (default 10000 miliseconds) - * reaperTimeout, set timeout for calls (default 30000 miliseconds) - * reaper, enable/disable reaper (default false) -* Work around for issues with findAndModify during high concurrency load, insure that the behavior is the same across the 1.8.X branch and 2.X branch of MongoDb -* Reworked multiple db's sharing same connection pool to behave correctly on error, timeout and close -* EnsureIndex command can be executed without a callback (Issue #438) -* Eval function no accepts options including nolock (Issue #432) - * eval(code, parameters, options, callback) (where options = {nolock:true}) - -0.9.7.1-4 2011-11-27 --------------------- -* Replaced install.sh with install.js to install correctly on all supported os's - -0.9.7.1-3 2011-11-27 --------------------- -* Fixes incorrect scope for ensureIndex error wrapping (Issue #419) https://github.com/ritch - -0.9.7.1-2 2011-11-27 --------------------- -* Set statistical selection strategy as default for secondary choice. - -0.9.7.1-1 2011-11-27 --------------------- -* Better handling of single server reconnect (fixes some bugs) -* Better test coverage of single server failure -* Correct handling of callbacks on replicaset servers when firewall dropping packets, correct reconnect - -0.9.7.1 2011-11-24 ------------------- -* Better handling of dead server for single server instances -* FindOne and find treats selector == null as {}, Issue #403 -* Possible to pass in a strategy for the replicaset to pick secondary reader node - * parameter strategy - * ping (default), pings the servers and picks the one with the lowest ping time - * statistical, measures each request and pick the one with the lowest mean and std deviation -* Set replicaset read preference replicaset.setReadPreference() - * Server.READ_PRIMARY (use primary server for reads) - * Server.READ_SECONDARY (from a secondary server (uses the strategy set)) - * tags, {object of tags} -* Added replay of commands issued to a closed connection when the connection is re-established -* Fix isConnected and close on unopened connections. Issue #409, fix by (https://github.com/sethml) -* Moved reaper to db.open instead of constructor (Issue #406) -* Allows passing through of socket connection settings to Server or ReplSetServer under the option socketOptions - * timeout = set seconds before connection times out (default 0) - * noDelay = Disables the Nagle algorithm (default true) - * keepAlive = Set if keepAlive is used (default 0, which means no keepAlive, set higher than 0 for keepAlive) - * encoding = ['ascii', 'utf8', or 'base64'] (default null) -* Fixes for handling of errors during shutdown off a socket connection -* Correctly applies socket options including timeout -* Cleanup of test management code to close connections correctly -* Handle parser errors better, closing down the connection and emitting an error -* Correctly emit errors from server.js only wrapping errors that are strings - -0.9.7 2011-11-10 ----------------- -* Added priority setting to replicaset manager -* Added correct handling of passive servers in replicaset -* Reworked socket code for simpler clearer handling -* Correct handling of connections in test helpers -* Added control of retries on failure - * control with parameters retryMiliSeconds and numberOfRetries when creating a db instance -* Added reaper that will timeout and cleanup queries that never return - * control with parameters reaperInterval and reaperTimeout when creating a db instance -* Refactored test helper classes for replicaset tests -* Allows raw (no bson parser mode for insert, update, remove, find and findOne) - * control raw mode passing in option raw:true on the commands - * will return buffers with the binary bson objects -* Fixed memory leak in cursor.toArray -* Fixed bug in command creation for mongodb server with wrong scope of call -* Added db(dbName) method to db.js to allow for reuse of connections against other databases -* Serialization of functions in an object is off by default, override with parameter - * serializeFunctions [true/false] on db level, collection level or individual insert/update/findAndModify -* Added Long.fromString to c++ class and fixed minor bug in the code (Test case for $gt operator on 64-bit integers, Issue #394) -* FindOne and find now share same code execution and will work in the same manner, Issue #399 -* Fix for tailable cursors, Issue #384 -* Fix for Cursor rewind broken, Issue #389 -* Allow Gridstore.exist to query using regexp, Issue #387, fix by (https://github.com/kaij) -* Updated documentation on https://github.com/christkv/node-mongodb-native -* Fixed toJSON methods across all objects for BSON, Binary return Base64 Encoded data - -0.9.6-22 2011-10-15 -------------------- -* Fixed bug in js bson parser that could cause wrong object size on serialization, Issue #370 -* Fixed bug in findAndModify that did not throw error on replicaset timeout, Issue #373 - -0.9.6-21 2011-10-05 -------------------- -* Reworked reconnect code to work correctly -* Handling errors in different parts of the code to ensure that it does not lock the connection -* Consistent error handling for Object.createFromHexString for JS and C++ - -0.9.6-20 2011-10-04 -------------------- -* Reworked bson.js parser to get rid off Array.shift() due to it allocating new memory for each call. Speedup varies between 5-15% depending on doc -* Reworked bson.cc to throw error when trying to serialize js bson types -* Added MinKey, MaxKey and Double support for JS and C++ parser -* Reworked socket handling code to emit errors on unparsable messages -* Added logger option for Db class, lets you pass in a function in the shape - { - log : function(message, object) {}, - error : function(errorMessage, errorObject) {}, - debug : function(debugMessage, object) {}, - } - - Usage is new Db(new Server(..), {logger: loggerInstance}) - -0.9.6-19 2011-09-29 -------------------- -* Fixing compatibility issues between C++ bson parser and js parser -* Added Symbol support to C++ parser -* Fixed socket handling bug for seldom misaligned message from mongodb -* Correctly handles serialization of functions using the C++ bson parser - -0.9.6-18 2011-09-22 -------------------- -* Fixed bug in waitForConnection that would lead to 100% cpu usage, Issue #352 - -0.9.6-17 2011-09-21 -------------------- -* Fixed broken exception test causing bamboo to hang -* Handling correctly command+lastError when both return results as in findAndModify, Issue #351 - -0.9.6-16 2011-09-14 -------------------- -* Fixing a bunch of issues with compatibility with MongoDB 2.0.X branch. Some fairly big changes in behavior from 1.8.X to 2.0.X on the server. -* Error Connection MongoDB V2.0.0 with Auth=true, Issue #348 - -0.9.6-15 2011-09-09 -------------------- -* Fixed issue where pools would not be correctly cleaned up after an error, Issue #345 -* Fixed authentication issue with secondary servers in Replicaset, Issue #334 -* Duplicate replica-set servers when omitting port, Issue #341 -* Fixing findAndModify to correctly work with Replicasets ensuring proper error handling, Issue #336 -* Merged in code from (https://github.com/aheckmann) that checks for global variable leaks - -0.9.6-14 2011-09-05 -------------------- -* Minor fixes for error handling in cursor streaming (https://github.com/sethml), Issue #332 -* Minor doc fixes -* Some more cursor sort tests added, Issue #333 -* Fixes to work with 0.5.X branch -* Fix Db not removing reconnect listener from serverConfig, (https://github.com/sbrekken), Issue #337 -* Removed node_events.h includes (https://github.com/jannehietamaki), Issue #339 -* Implement correct safe/strict mode for findAndModify. - -0.9.6-13 2011-08-24 -------------------- -* Db names correctly error checked for illegal characters - -0.9.6-12 2011-08-24 -------------------- -* Nasty bug in GridFS if you changed the default chunk size -* Fixed error handling bug in findOne - -0.9.6-11 2011-08-23 -------------------- -* Timeout option not correctly making it to the cursor, Issue #320, Fix from (https://github.com/year2013) -* Fixes for memory leaks when using buffers and C++ parser -* Fixes to make tests pass on 0.5.X -* Cleanup of bson.js to remove duplicated code paths -* Fix for errors occurring in ensureIndex, Issue #326 -* Removing require.paths to make tests work with the 0.5.X branch - -0.9.6-10 2011-08-11 -------------------- -* Specific type Double for capped collections (https://github.com/mbostock), Issue #312 -* Decorating Errors with all all object info from Mongo (https://github.com/laurie71), Issue #308 -* Implementing fixes for mongodb 1.9.1 and higher to make tests pass -* Admin validateCollection now takes an options argument for you to pass in full option -* Implemented keepGoing parameter for mongodb 1.9.1 or higher, Issue #310 -* Added test for read_secondary count issue, merged in fix from (https://github.com/year2013), Issue #317 - -0.9.6-9 -------- -* Bug fix for bson parsing the key '':'' correctly without crashing - -0.9.6-8 -------- -* Changed to using node.js crypto library MD5 digest -* Connect method support documented mongodb: syntax by (https://github.com/sethml) -* Support Symbol type for BSON, serializes to it's own type Symbol, Issue #302, #288 -* Code object without scope serializing to correct BSON type -* Lot's of fixes to avoid double callbacks (https://github.com/aheckmann) Issue #304 -* Long deserializes as Number for values in the range -2^53 to 2^53, Issue #305 (https://github.com/sethml) -* Fixed C++ parser to reflect JS parser handling of long deserialization -* Bson small optimizations - -0.9.6-7 2011-07-13 ------------------- -* JS Bson deserialization bug #287 - -0.9.6-6 2011-07-12 ------------------- -* FindAndModify not returning error message as other methods Issue #277 -* Added test coverage for $push, $pushAll and $inc atomic operations -* Correct Error handling for non 12/24 bit ids on Pure JS ObjectID class Issue #276 -* Fixed terrible deserialization bug in js bson code #285 -* Fix by andrewjstone to avoid throwing errors when this.primary not defined - -0.9.6-5 2011-07-06 ------------------- -* Rewritten BSON js parser now faster than the C parser on my core2duo laptop -* Added option full to indexInformation to get all index info Issue #265 -* Passing in ObjectID for new Gridstore works correctly Issue #272 - -0.9.6-4 2011-07-01 ------------------- -* Added test and bug fix for insert/update/remove without callback supplied - -0.9.6-3 2011-07-01 ------------------- -* Added simple grid class called Grid with put, get, delete methods -* Fixed writeBuffer/readBuffer methods on GridStore so they work correctly -* Automatic handling of buffers when using write method on GridStore -* GridStore now accepts a ObjectID instead of file name for write and read methods -* GridStore.list accepts id option to return of file ids instead of filenames -* GridStore close method returns document for the file allowing user to reference _id field - -0.9.6-2 2011-06-30 ------------------- -* Fixes for reconnect logic for server object (replays auth correctly) -* More testcases for auth -* Fixes in error handling for replicaset -* Fixed bug with safe parameter that would fail to execute safe when passing w or wtimeout -* Fixed slaveOk bug for findOne method -* Implemented auth support for replicaset and test cases -* Fixed error when not passing in rs_name - -0.9.6-1 2011-06-25 ------------------- -* Fixes for test to run properly using c++ bson parser -* Fixes for dbref in native parser (correctly handles ref without db component) -* Connection fixes for replicasets to avoid runtime conditions in cygwin (https://github.com/vincentcr) -* Fixes for timestamp in js bson parser (distinct timestamp type now) - -0.9.6 2011-06-21 ----------------- -* Worked around npm version handling bug -* Race condition fix for cygwin (https://github.com/vincentcr) - -0.9.5-1 2011-06-21 ------------------- -* Extracted Timestamp as separate class for bson js parser to avoid instanceof problems -* Fixed driver strict mode issue - -0.9.5 2011-06-20 ----------------- -* Replicaset support (failover and reading from secondary servers) -* Removed ServerPair and ServerCluster -* Added connection pool functionality -* Fixed serious bug in C++ bson parser where bytes > 127 would generate 2 byte sequences -* Allows for forcing the server to assign ObjectID's using the option {forceServerObjectId: true} - -0.6.8 ------ -* Removed multiple message concept from bson -* Changed db.open(db) to be db.open(err, db) - -0.1 2010-01-30 --------------- -* Initial release support of driver using native node.js interface -* Supports gridfs specification -* Supports admin functionality diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/LICENSE b/Associations/node_modules/mongoose/node_modules/mongodb/LICENSE deleted file mode 100644 index ad410e11..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/Makefile b/Associations/node_modules/mongoose/node_modules/mongodb/Makefile deleted file mode 100644 index 36e12024..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -NODE = node -NPM = npm -JSDOC = jsdoc -name = all - -generate_docs: - # cp -R ./HISTORY.md ./docs/content/meta/release-notes.md - hugo -s docs/reference -d ../../public - $(JSDOC) -c conf.json -t docs/jsdoc-template/ -d ./public/api - cp -R ./public/api/scripts ./public/. - cp -R ./public/api/styles ./public/. diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/README.md deleted file mode 100644 index fda82c0f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/README.md +++ /dev/null @@ -1,324 +0,0 @@ -[![NPM](https://nodei.co/npm/mongodb.png?downloads=true&downloadRank=true)](https://nodei.co/npm/mongodb/) [![NPM](https://nodei.co/npm-dl/mongodb.png?months=6&height=3)](https://nodei.co/npm/mongodb/) - -[![Build Status](https://secure.travis-ci.org/mongodb/node-mongodb-native.png)](http://travis-ci.org/mongodb/node-mongodb-native) - -[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/mongodb/node-mongodb-native?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - -# Description - -The MongoDB driver is the high level part of the 2.0 or higher MongoDB driver and is meant for end users. - -## MongoDB Node.JS Driver - -| what | where | -|---------------|------------------------------------------------| -| documentation | http://mongodb.github.io/node-mongodb-native/ | -| api-doc | http://mongodb.github.io/node-mongodb-native/2.0/api/ | -| source | https://github.com/mongodb/node-mongodb-native | -| mongodb | http://www.mongodb.org/ | - -### Blogs of Engineers involved in the driver -- Christian Kvalheim [@christkv](https://twitter.com/christkv) - -### Bugs / Feature Requests - -Think you’ve found a bug? Want to see a new feature in node-mongodb-native? Please open a -case in our issue management tool, JIRA: - -- Create an account and login . -- Navigate to the NODE project . -- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it. - -Bug reports in JIRA for all driver projects (i.e. NODE, PYTHON, CSHARP, JAVA) and the -Core Server (i.e. SERVER) project are **public**. - -### Questions and Bug Reports - - * mailing list: https://groups.google.com/forum/#!forum/node-mongodb-native - * jira: http://jira.mongodb.org/ - -### Change Log - -http://jira.mongodb.org/browse/NODE - -QuickStart -========== -The quick start guide will show you how to setup a simple application using node.js and MongoDB. Its scope is only how to set up the driver and perform the simple crud operations. For more in depth coverage we encourage reading the tutorials. - -Create the package.json file ----------------------------- -Let's create a directory where our application will live. In our case we will put this under our projects directory. - -``` -mkdir myproject -cd myproject -``` - -Enter the following command and answer the questions to create the initial structure for your new project - -``` -npm init -``` - -Next we need to edit the generated package.json file to add the dependency for the MongoDB driver. The package.json file below is just an example and your will look different depending on how you answered the questions after entering `npm init` - -``` -{ - "name": "myproject", - "version": "1.0.0", - "description": "My first project", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/christkv/myfirstproject.git" - }, - "dependencies": { - "mongodb": "~2.0" - }, - "author": "Christian Kvalheim", - "license": "Apache 2.0", - "bugs": { - "url": "https://github.com/christkv/myfirstproject/issues" - }, - "homepage": "https://github.com/christkv/myfirstproject" -} -``` - -Save the file and return to the shell or command prompt and use **NPM** to install all the dependencies. - -``` -npm install -``` - -You should see **NPM** download a lot of files. Once it's done you'll find all the downloaded packages under the **node_modules** directory. - -Booting up a MongoDB Server ---------------------------- -Let's boot up a MongoDB server instance. Download the right MongoDB version from [MongoDB](http://www.mongodb.org), open a new shell or command line and ensure the **mongod** command is in the shell or command line path. Now let's create a database directory (in our case under **/data**). - -``` -mongod --dbpath=/data --port 27017 -``` - -You should see the **mongod** process start up and print some status information. - -Connecting to MongoDB ---------------------- -Let's create a new **app.js** file that we will use to show the basic CRUD operations using the MongoDB driver. - -First let's add code to connect to the server and the database **myproject**. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - db.close(); -}); -``` - -Given that you booted up the **mongod** process earlier the application should connect successfully and print **Connected correctly to server** to the console. - -Let's Add some code to show the different CRUD operations available. - -Inserting a Document --------------------- -Let's create a function that will insert some documents for us. - -```js -var insertDocuments = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Insert some documents - collection.insertMany([ - {a : 1}, {a : 2}, {a : 3} - ], function(err, result) { - assert.equal(err, null); - assert.equal(3, result.result.n); - assert.equal(3, result.ops.length); - console.log("Inserted 3 documents into the document collection"); - callback(result); - }); -} -``` - -The insert command will return a results object that contains several fields that might be useful. - -* **result** Contains the result document from MongoDB -* **ops** Contains the documents inserted with added **_id** fields -* **connection** Contains the connection used to perform the insert - -Let's add call the **insertDocuments** command to the **MongoClient.connect** method callback. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - db.close(); - }); -}); -``` - -We can now run the update **app.js** file. - -``` -node app.js -``` - -You should see the following output after running the **app.js** file. - -``` -Connected correctly to server -Inserted 3 documents into the document collection -``` - -Updating a document -------------------- -Let's look at how to do a simple document update by adding a new field **b** to the document that has the field **a** set to **2**. - -```js -var updateDocument = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Update document where a is 2, set b equal to 1 - collection.updateOne({ a : 2 } - , { $set: { b : 1 } }, function(err, result) { - assert.equal(err, null); - assert.equal(1, result.result.n); - console.log("Updated the document with the field a equal to 2"); - callback(result); - }); -} -``` - -The method will update the first document where the field **a** is equal to **2** by adding a new field **b** to the document set to **1**. Let's update the callback function from **MongoClient.connect** to include the update method. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - updateDocument(db, function() { - db.close(); - }); - }); -}); -``` - -Delete a document ------------------ -Next lets delete the document where the field **a** equals to **3**. - -```js -var deleteDocument = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Insert some documents - collection.deleteOne({ a : 3 }, function(err, result) { - assert.equal(err, null); - assert.equal(1, result.result.n); - console.log("Removed the document with the field a equal to 3"); - callback(result); - }); -} -``` - -This will delete the first document where the field **a** equals to **3**. Let's add the method to the **MongoClient -.connect** callback function. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - updateDocument(db, function() { - deleteDocument(db, function() { - db.close(); - }); - }); - }); -}); -``` - -Finally let's retrieve all the documents using a simple find. - -Find All Documents ------------------- -We will finish up the Quickstart CRUD methods by performing a simple query that returns all the documents matching the query. - -```js -var findDocuments = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Find some documents - collection.find({}).toArray(function(err, docs) { - assert.equal(err, null); - assert.equal(2, docs.length); - console.log("Found the following records"); - console.dir(docs); - callback(docs); - }); -} -``` - -This query will return all the documents in the **documents** collection. Since we deleted a document the total -documents returned is **2**. Finally let's add the findDocument method to the **MongoClient.connect** callback. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - updateDocument(db, function() { - deleteDocument(db, function() { - findDocuments(db, function() { - db.close(); - }); - }); - }); - }); -}); -``` - -This concludes the QuickStart of connecting and performing some Basic operations using the MongoDB Node.js driver. For more detailed information you can look at the tutorials covering more specific topics of interest. - -## Next Steps - - * [MongoDB Documentation](http://mongodb.org/) - * [Read about Schemas](http://learnmongodbthehardway.com/) - * [Star us on GitHub](https://github.com/mongodb/node-mongodb-native) diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/conf.json b/Associations/node_modules/mongoose/node_modules/mongodb/conf.json deleted file mode 100644 index 15f3021d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/conf.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "plugins": ["plugins/markdown", "docs/lib/jsdoc/examples_plugin.js"], - "source": { - "include": [ - "test/functional/operation_example_tests.js", - "test/functional/operation_promises_example_tests.js", - "test/functional/operation_generators_example_tests.js", - "test/functional/authentication_tests.js", - "lib/admin.js", - "lib/collection.js", - "lib/cursor.js", - "lib/aggregation_cursor.js", - "lib/command_cursor.js", - "lib/db.js", - "lib/mongo_client.js", - "lib/mongos.js", - "lib/read_preference.js", - "lib/replset.js", - "lib/server.js", - "lib/bulk/common.js", - "lib/bulk/ordered.js", - "lib/bulk/unordered.js", - "lib/gridfs/grid_store.js", - "node_modules/mongodb-core/lib/error.js", - "node_modules/mongodb-core/lib/connection/logger.js", - "node_modules/bson/lib/bson/binary.js", - "node_modules/bson/lib/bson/code.js", - "node_modules/bson/lib/bson/db_ref.js", - "node_modules/bson/lib/bson/double.js", - "node_modules/bson/lib/bson/long.js", - "node_modules/bson/lib/bson/objectid.js", - "node_modules/bson/lib/bson/symbol.js", - "node_modules/bson/lib/bson/timestamp.js", - "node_modules/bson/lib/bson/max_key.js", - "node_modules/bson/lib/bson/min_key.js" - ] - }, - "templates": { - "cleverLinks": true, - "monospaceLinks": true, - "default": { - "outputSourceFiles" : true - }, - "applicationName": "Node.js MongoDB Driver API", - "disqus": true, - "googleAnalytics": "UA-29229787-1", - "openGraph": { - "title": "", - "type": "website", - "image": "", - "site_name": "", - "url": "" - }, - "meta": { - "title": "", - "description": "", - "keyword": "" - }, - "linenums": true - }, - "markdown": { - "parser": "gfm", - "hardwrap": true, - "tags": ["examples"] - }, - "examples": { - "indent": 4 - } -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/index.js b/Associations/node_modules/mongoose/node_modules/mongodb/index.js deleted file mode 100644 index 9fa98edb..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/index.js +++ /dev/null @@ -1,48 +0,0 @@ -// Core module -var core = require('mongodb-core'), - Instrumentation = require('./lib/apm'); - -// Set up the connect function -var connect = require('./lib/mongo_client').connect; - -// Expose error class -connect.MongoError = core.MongoError; - -// Actual driver classes exported -connect.MongoClient = require('./lib/mongo_client'); -connect.Db = require('./lib/db'); -connect.Collection = require('./lib/collection'); -connect.Server = require('./lib/server'); -connect.ReplSet = require('./lib/replset'); -connect.Mongos = require('./lib/mongos'); -connect.ReadPreference = require('./lib/read_preference'); -connect.GridStore = require('./lib/gridfs/grid_store'); -connect.Chunk = require('./lib/gridfs/chunk'); -connect.Logger = core.Logger; -connect.Cursor = require('./lib/cursor'); - -// BSON types exported -connect.Binary = core.BSON.Binary; -connect.Code = core.BSON.Code; -connect.Map = core.BSON.Map; -connect.DBRef = core.BSON.DBRef; -connect.Double = core.BSON.Double; -connect.Long = core.BSON.Long; -connect.MinKey = core.BSON.MinKey; -connect.MaxKey = core.BSON.MaxKey; -connect.ObjectID = core.BSON.ObjectID; -connect.ObjectId = core.BSON.ObjectID; -connect.Symbol = core.BSON.Symbol; -connect.Timestamp = core.BSON.Timestamp; - -// Add connect method -connect.connect = connect; - -// Set up the instrumentation method -connect.instrument = function(options, callback) { - if(typeof options == 'function') callback = options, options = {}; - return new Instrumentation(core, options, callback); -} - -// Set our exports to be the connect function -module.exports = connect; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/admin.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/admin.js deleted file mode 100644 index 1f89512b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/admin.js +++ /dev/null @@ -1,581 +0,0 @@ -"use strict"; - -var toError = require('./utils').toError, - Define = require('./metadata'), - shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **Admin** class is an internal class that allows convenient access to - * the admin functionality and commands for MongoDB. - * - * **ADMIN Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Use the admin database for the operation - * var adminDb = db.admin(); - * - * // List all the available databases - * adminDb.listDatabases(function(err, dbs) { - * test.equal(null, err); - * test.ok(dbs.databases.length > 0); - * db.close(); - * }); - * }); - */ - -/** - * Create a new Admin instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @return {Admin} a collection instance. - */ -var Admin = function(db, topology, promiseLibrary) { - if(!(this instanceof Admin)) return new Admin(db, topology); - var self = this; - - // Internal state - this.s = { - db: db - , topology: topology - , promiseLibrary: promiseLibrary - } -} - -var define = Admin.define = new Define('Admin', Admin, false); - -/** - * The callback format for results - * @callback Admin~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result object if the command was executed successfully. - */ - -/** - * Execute a command - * @method - * @param {object} command The command hash - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxTimeMS=null] Number of milliseconds to wait before aborting the query. - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.command = function(command, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - - // Execute using callback - if(typeof callback == 'function') return this.s.db.executeDbAdminCommand(command, options, function(err, doc) { - return callback != null ? callback(err, doc) : null; - }); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand(command, options, function(err, doc) { - if(err) return reject(err); - resolve(doc); - }); - }); -} - -define.classMethod('command', {callback: true, promise:true}); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.buildInfo = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return this.serverInfo(callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.serverInfo(function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('buildInfo', {callback: true, promise:true}); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.serverInfo = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return this.s.db.executeDbAdminCommand({buildinfo:1}, function(err, doc) { - if(err != null) return callback(err, null); - callback(null, doc); - }); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand({buildinfo:1}, function(err, doc) { - if(err) return reject(err); - resolve(doc); - }); - }); -} - -define.classMethod('serverInfo', {callback: true, promise:true}); - -/** - * Retrieve this db's server status. - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.serverStatus = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return serverStatus(self, callback) - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - serverStatus(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var serverStatus = function(self, callback) { - self.s.db.executeDbAdminCommand({serverStatus: 1}, function(err, doc) { - if(err == null && doc.ok === 1) { - callback(null, doc); - } else { - if(err) return callback(err, false); - return callback(toError(doc), false); - } - }); -} - -define.classMethod('serverStatus', {callback: true, promise:true}); - -/** - * Retrieve the current profiling Level for MongoDB - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.profilingLevel = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return profilingLevel(self, callback) - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - profilingLevel(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var profilingLevel = function(self, callback) { - self.s.db.executeDbAdminCommand({profile:-1}, function(err, doc) { - doc = doc; - - if(err == null && doc.ok === 1) { - var was = doc.was; - if(was == 0) return callback(null, "off"); - if(was == 1) return callback(null, "slow_only"); - if(was == 2) return callback(null, "all"); - return callback(new Error("Error: illegal profiling level value " + was), null); - } else { - err != null ? callback(err, null) : callback(new Error("Error with profile command"), null); - } - }); -} - -define.classMethod('profilingLevel', {callback: true, promise:true}); - -/** - * Ping the MongoDB server and retrieve results - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.ping = function(options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - - // Execute using callback - if(typeof callback == 'function') return this.s.db.executeDbAdminCommand({ping: 1}, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand({ping: 1}, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('ping', {callback: true, promise:true}); - -/** - * Authenticate a user against the server. - * @method - * @param {string} username The username. - * @param {string} [password] The password. - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.authenticate = function(username, password, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options); - options.authdb = 'admin'; - - // Execute using callback - if(typeof callback == 'function') return this.s.db.authenticate(username, password, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.authenticate(username, password, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('authenticate', {callback: true, promise:true}); - -/** - * Logout user from server, fire off on all connections and remove all auth info - * @method - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.logout = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return this.s.db.logout({authdb: 'admin'}, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.logout({authdb: 'admin'}, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('logout', {callback: true, promise:true}); - -// Get write concern -var writeConcern = function(options, db) { - options = shallowClone(options); - - // If options already contain write concerns return it - if(options.w || options.wtimeout || options.j || options.fsync) { - return options; - } - - // Set db write concern if available - if(db.writeConcern) { - if(options.w) options.w = db.writeConcern.w; - if(options.wtimeout) options.wtimeout = db.writeConcern.wtimeout; - if(options.j) options.j = db.writeConcern.j; - if(options.fsync) options.fsync = db.writeConcern.fsync; - } - - // Return modified options - return options; -} - -/** - * Add a user to the database. - * @method - * @param {string} username The username. - * @param {string} password The password. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {object} [options.customData=null] Custom data associated with the user (only Mongodb 2.6 or higher) - * @param {object[]} [options.roles=null] Roles associated with the created user (only Mongodb 2.6 or higher) - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.addUser = function(username, password, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - // Get the options - options = writeConcern(options, self.s.db) - // Set the db name to admin - options.dbName = 'admin'; - - // Execute using callback - if(typeof callback == 'function') - return self.s.db.addUser(username, password, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.addUser(username, password, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('addUser', {callback: true, promise:true}); - -/** - * Remove a user from a database - * @method - * @param {string} username The username. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.removeUser = function(username, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - // Get the options - options = writeConcern(options, self.s.db) - // Set the db name - options.dbName = 'admin'; - - // Execute using callback - if(typeof callback == 'function') - return self.s.db.removeUser(username, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.removeUser(username, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('removeUser', {callback: true, promise:true}); - -/** - * Set the current profiling level of MongoDB - * - * @param {string} level The new profiling level (off, slow_only, all). - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.setProfilingLevel = function(level, callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return setProfilingLevel(self, level, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - setProfilingLevel(self, level, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var setProfilingLevel = function(self, level, callback) { - var command = {}; - var profile = 0; - - if(level == "off") { - profile = 0; - } else if(level == "slow_only") { - profile = 1; - } else if(level == "all") { - profile = 2; - } else { - return callback(new Error("Error: illegal profiling level value " + level)); - } - - // Set up the profile number - command['profile'] = profile; - - self.s.db.executeDbAdminCommand(command, function(err, doc) { - doc = doc; - - if(err == null && doc.ok === 1) - return callback(null, level); - return err != null ? callback(err, null) : callback(new Error("Error with profile command"), null); - }); -} - -define.classMethod('setProfilingLevel', {callback: true, promise:true}); - -/** - * Retrive the current profiling information for MongoDB - * - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.profilingInfo = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return profilingInfo(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - profilingInfo(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var profilingInfo = function(self, callback) { - try { - self.s.topology.cursor("admin.system.profile", { find: 'system.profile', query: {}}, {}).toArray(callback); - } catch (err) { - return callback(err, null); - } -} - -define.classMethod('profilingLevel', {callback: true, promise:true}); - -/** - * Validate an existing collection - * - * @param {string} collectionName The name of the collection to validate. - * @param {object} [options=null] Optional settings. - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.validateCollection = function(collectionName, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') - return validateCollection(self, collectionName, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - validateCollection(self, collectionName, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var validateCollection = function(self, collectionName, options, callback) { - var command = {validate: collectionName}; - var keys = Object.keys(options); - - // Decorate command with extra options - for(var i = 0; i < keys.length; i++) { - if(options.hasOwnProperty(keys[i])) { - command[keys[i]] = options[keys[i]]; - } - } - - self.s.db.command(command, function(err, doc) { - if(err != null) return callback(err, null); - - if(doc.ok === 0) - return callback(new Error("Error with validate command"), null); - if(doc.result != null && doc.result.constructor != String) - return callback(new Error("Error with validation data"), null); - if(doc.result != null && doc.result.match(/exception|corrupt/) != null) - return callback(new Error("Error: invalid collection " + collectionName), null); - if(doc.valid != null && !doc.valid) - return callback(new Error("Error: invalid collection " + collectionName), null); - - return callback(null, doc); - }); -} - -define.classMethod('validateCollection', {callback: true, promise:true}); - -/** - * List the available databases - * - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.listDatabases = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return self.s.db.executeDbAdminCommand({listDatabases:1}, {}, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand({listDatabases:1}, {}, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('listDatabases', {callback: true, promise:true}); - -/** - * Get ReplicaSet status - * - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.replSetGetStatus = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return replSetGetStatus(self, callback); - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - replSetGetStatus(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var replSetGetStatus = function(self, callback) { - self.s.db.executeDbAdminCommand({replSetGetStatus:1}, function(err, doc) { - if(err == null && doc.ok === 1) - return callback(null, doc); - if(err) return callback(err, false); - callback(toError(doc), false); - }); -} - -define.classMethod('replSetGetStatus', {callback: true, promise:true}); - -module.exports = Admin; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js deleted file mode 100644 index 3663229d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js +++ /dev/null @@ -1,432 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , toError = require('./utils').toError - , getSingleProperty = require('./utils').getSingleProperty - , formattedOrderClause = require('./utils').formattedOrderClause - , handleCallback = require('./utils').handleCallback - , Logger = require('mongodb-core').Logger - , EventEmitter = require('events').EventEmitter - , ReadPreference = require('./read_preference') - , MongoError = require('mongodb-core').MongoError - , Readable = require('stream').Readable || require('readable-stream').Readable - , Define = require('./metadata') - , CoreCursor = require('./cursor') - , Query = require('mongodb-core').Query - , CoreReadPreference = require('mongodb-core').ReadPreference; - -/** - * @fileOverview The **AggregationCursor** class is an internal class that embodies an aggregation cursor on MongoDB - * allowing for iteration over the results returned from the underlying query. It supports - * one by one document iteration, conversion to an array or can be iterated as a Node 0.10.X - * or higher stream - * - * **AGGREGATIONCURSOR Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('createIndexExample1'); - * // Insert a bunch of documents - * col.insert([{a:1, b:1} - * , {a:2, b:2}, {a:3, b:3} - * , {a:4, b:4}], {w:1}, function(err, result) { - * test.equal(null, err); - * // Show that duplicate records got dropped - * col.aggregation({}, {cursor: {}}).toArray(function(err, items) { - * test.equal(null, err); - * test.equal(4, items.length); - * db.close(); - * }); - * }); - * }); - */ - -/** - * Namespace provided by the browser. - * @external Readable - */ - -/** - * Creates a new Aggregation Cursor instance (INTERNAL TYPE, do not instantiate directly) - * @class AggregationCursor - * @extends external:Readable - * @fires AggregationCursor#data - * @fires AggregationCursor#end - * @fires AggregationCursor#close - * @fires AggregationCursor#readable - * @return {AggregationCursor} an AggregationCursor instance. - */ -var AggregationCursor = function(bson, ns, cmd, options, topology, topologyOptions) { - CoreCursor.apply(this, Array.prototype.slice.call(arguments, 0)); - var self = this; - var state = AggregationCursor.INIT; - var streamOptions = {}; - - // MaxTimeMS - var maxTimeMS = null; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set up - Readable.call(this, {objectMode: true}); - - // Internal state - this.s = { - // MaxTimeMS - maxTimeMS: maxTimeMS - // State - , state: state - // Stream options - , streamOptions: streamOptions - // BSON - , bson: bson - // Namespae - , ns: ns - // Command - , cmd: cmd - // Options - , options: options - // Topology - , topology: topology - // Topology Options - , topologyOptions: topologyOptions - // Promise library - , promiseLibrary: promiseLibrary - } -} - -/** - * AggregationCursor stream data event, fired for each document in the cursor. - * - * @event AggregationCursor#data - * @type {object} - */ - -/** - * AggregationCursor stream end event - * - * @event AggregationCursor#end - * @type {null} - */ - -/** - * AggregationCursor stream close event - * - * @event AggregationCursor#close - * @type {null} - */ - -/** - * AggregationCursor stream readable event - * - * @event AggregationCursor#readable - * @type {null} - */ - -// Inherit from Readable -inherits(AggregationCursor, Readable); - -// Set the methods to inherit from prototype -var methodsToInherit = ['_next', 'next', 'each', 'forEach', 'toArray' - , 'rewind', 'bufferedCount', 'readBufferedDocuments', 'close', 'isClosed', 'kill' - , '_find', '_getmore', '_killcursor', 'isDead', 'explain', 'isNotified']; - -// Extend the Cursor -for(var name in CoreCursor.prototype) { - AggregationCursor.prototype[name] = CoreCursor.prototype[name]; -} - -var define = AggregationCursor.define = new Define('AggregationCursor', AggregationCursor, true); - -/** - * Set the batch size for the cursor. - * @method - * @param {number} value The batchSize for the cursor. - * @throws {MongoError} - * @return {AggregationCursor} - */ -AggregationCursor.prototype.batchSize = function(value) { - if(this.s.state == AggregationCursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true }); - if(typeof value != 'number') throw MongoError.create({message: "batchSize requires an integer", drvier:true }); - if(this.s.cmd.cursor) this.s.cmd.cursor.batchSize = value; - this.setCursorBatchSize(value); - return this; -} - -define.classMethod('batchSize', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a geoNear stage to the aggregation pipeline - * @method - * @param {object} document The geoNear stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.geoNear = function(document) { - this.s.cmd.pipeline.push({$geoNear: document}); - return this; -} - -define.classMethod('geoNear', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a group stage to the aggregation pipeline - * @method - * @param {object} document The group stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.group = function(document) { - this.s.cmd.pipeline.push({$group: document}); - return this; -} - -define.classMethod('group', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a limit stage to the aggregation pipeline - * @method - * @param {number} value The state limit value. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.limit = function(value) { - this.s.cmd.pipeline.push({$limit: value}); - return this; -} - -define.classMethod('limit', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a match stage to the aggregation pipeline - * @method - * @param {object} document The match stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.match = function(document) { - this.s.cmd.pipeline.push({$match: document}); - return this; -} - -define.classMethod('match', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a maxTimeMS stage to the aggregation pipeline - * @method - * @param {number} value The state maxTimeMS value. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.maxTimeMS = function(value) { - if(this.s.topology.lastIsMaster().minWireVersion > 2) { - this.s.cmd.maxTimeMS = value; - } - return this; -} - -define.classMethod('maxTimeMS', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a out stage to the aggregation pipeline - * @method - * @param {number} destination The destination name. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.out = function(destination) { - this.s.cmd.pipeline.push({$out: destination}); - return this; -} - -define.classMethod('out', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a project stage to the aggregation pipeline - * @method - * @param {object} document The project stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.project = function(document) { - this.s.cmd.pipeline.push({$project: document}); - return this; -} - -define.classMethod('project', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a redact stage to the aggregation pipeline - * @method - * @param {object} document The redact stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.redact = function(document) { - this.s.cmd.pipeline.push({$redact: document}); - return this; -} - -define.classMethod('redact', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a skip stage to the aggregation pipeline - * @method - * @param {number} value The state skip value. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.skip = function(value) { - this.s.cmd.pipeline.push({$skip: value}); - return this; -} - -define.classMethod('skip', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a sort stage to the aggregation pipeline - * @method - * @param {object} document The sort stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.sort = function(document) { - this.s.cmd.pipeline.push({$sort: document}); - return this; -} - -define.classMethod('sort', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a unwind stage to the aggregation pipeline - * @method - * @param {number} field The unwind field name. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.unwind = function(field) { - this.s.cmd.pipeline.push({$unwind: field}); - return this; -} - -define.classMethod('unwind', {callback: false, promise:false, returns: [AggregationCursor]}); - -AggregationCursor.prototype.get = AggregationCursor.prototype.toArray; - -// Inherited methods -define.classMethod('toArray', {callback: true, promise:true}); -define.classMethod('each', {callback: true, promise:false}); -define.classMethod('forEach', {callback: true, promise:false}); -define.classMethod('next', {callback: true, promise:true}); -define.classMethod('close', {callback: true, promise:true}); -define.classMethod('isClosed', {callback: false, promise:false, returns: [Boolean]}); -define.classMethod('rewind', {callback: false, promise:false}); -define.classMethod('bufferedCount', {callback: false, promise:false, returns: [Number]}); -define.classMethod('readBufferedDocuments', {callback: false, promise:false, returns: [Array]}); - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @function AggregationCursor.prototype.next - * @param {AggregationCursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback AggregationCursor~toArrayResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object[]} documents All the documents the satisfy the cursor. - */ - -/** - * Returns an array of documents. The caller is responsible for making sure that there - * is enough memory to store the results. Note that the array only contain partial - * results when this cursor had been previouly accessed. In that case, - * cursor.rewind() can be used to reset the cursor. - * @method AggregationCursor.prototype.toArray - * @param {AggregationCursor~toArrayResultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback AggregationCursor~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {(object|null)} result The result object if the command was executed successfully. - */ - -/** - * Iterates over all the documents for this cursor. As with **{cursor.toArray}**, - * not all of the elements will be iterated if this cursor had been previouly accessed. - * In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike - * **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements - * at any given time if batch size is specified. Otherwise, the caller is responsible - * for making sure that the entire result can fit the memory. - * @method AggregationCursor.prototype.each - * @param {AggregationCursor~resultCallback} callback The result callback. - * @throws {MongoError} - * @return {null} - */ - -/** - * Close the cursor, sending a AggregationCursor command and emitting close. - * @method AggregationCursor.prototype.close - * @param {AggregationCursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ - -/** - * Is the cursor closed - * @method AggregationCursor.prototype.isClosed - * @return {boolean} - */ - -/** - * Execute the explain for the cursor - * @method AggregationCursor.prototype.explain - * @param {AggregationCursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ - -/** - * Clone the cursor - * @function AggregationCursor.prototype.clone - * @return {AggregationCursor} - */ - -/** - * Resets the cursor - * @function AggregationCursor.prototype.rewind - * @return {AggregationCursor} - */ - -/** - * The callback format for the forEach iterator method - * @callback AggregationCursor~iteratorCallback - * @param {Object} doc An emitted document for the iterator - */ - -/** - * The callback error format for the forEach iterator method - * @callback AggregationCursor~endCallback - * @param {MongoError} error An error instance representing the error during the execution. - */ - -/* - * Iterates over all the documents for this cursor using the iterator, callback pattern. - * @method AggregationCursor.prototype.forEach - * @param {AggregationCursor~iteratorCallback} iterator The iteration callback. - * @param {AggregationCursor~endCallback} callback The end callback. - * @throws {MongoError} - * @return {null} - */ - -AggregationCursor.INIT = 0; -AggregationCursor.OPEN = 1; -AggregationCursor.CLOSED = 2; - -module.exports = AggregationCursor; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/apm.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/apm.js deleted file mode 100644 index 7b080126..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/apm.js +++ /dev/null @@ -1,608 +0,0 @@ -var EventEmitter = require('events').EventEmitter, - inherits = require('util').inherits; - -// Get prototypes -var AggregationCursor = require('./aggregation_cursor'), - CommandCursor = require('./command_cursor'), - OrderedBulkOperation = require('./bulk/ordered').OrderedBulkOperation, - UnorderedBulkOperation = require('./bulk/unordered').UnorderedBulkOperation, - GridStore = require('./gridfs/grid_store'), - Server = require('./server'), - ReplSet = require('./replset'), - Mongos = require('./mongos'), - Cursor = require('./cursor'), - Collection = require('./collection'), - Db = require('./db'), - Admin = require('./admin'); - -var basicOperationIdGenerator = { - operationId: 1, - - next: function() { - return this.operationId++; - } -} - -var basicTimestampGenerator = { - current: function() { - return new Date().getTime(); - }, - - duration: function(start, end) { - return end - start; - } -} - -var senstiveCommands = ['authenticate', 'saslStart', 'saslContinue', 'getnonce', - 'createUser', 'updateUser', 'copydbgetnonce', 'copydbsaslstart', 'copydb']; - -var Instrumentation = function(core, options, callback) { - options = options || {}; - - // Optional id generators - var operationIdGenerator = options.operationIdGenerator || basicOperationIdGenerator; - // Optional timestamp generator - var timestampGenerator = options.timestampGenerator || basicTimestampGenerator; - // Extend with event emitter functionality - EventEmitter.call(this); - - // Contains all the instrumentation overloads - this.overloads = []; - - // --------------------------------------------------------- - // - // Instrument prototype - // - // --------------------------------------------------------- - - var instrumentPrototype = function(callback) { - var instrumentations = [] - - // Classes to support - var classes = [GridStore, OrderedBulkOperation, UnorderedBulkOperation, - CommandCursor, AggregationCursor, Cursor, Collection, Db]; - - // Add instrumentations to the available list - for(var i = 0; i < classes.length; i++) { - if(classes[i].define) { - instrumentations.push(classes[i].define.generate()); - } - } - - // Return the list of instrumentation points - callback(null, instrumentations); - } - - // Did the user want to instrument the prototype - if(typeof callback == 'function') { - instrumentPrototype(callback); - } - - // --------------------------------------------------------- - // - // Server - // - // --------------------------------------------------------- - - // Reference - var self = this; - // Names of methods we need to wrap - var methods = ['command', 'insert', 'update', 'remove']; - // Prototype - var proto = core.Server.prototype; - // Core server method we are going to wrap - methods.forEach(function(x) { - var func = proto[x]; - - // Add to overloaded methods - self.overloads.push({proto: proto, name:x, func:func}); - - // The actual prototype - proto[x] = function() { - var requestId = core.Query.nextRequestId(); - // Get the aruments - var args = Array.prototype.slice.call(arguments, 0); - var ns = args[0]; - var commandObj = args[1]; - var options = args[2] || {}; - var keys = Object.keys(commandObj); - var commandName = keys[0]; - var db = ns.split('.')[0]; - - // Do we have a legacy insert/update/remove command - if(x == 'insert' && !this.lastIsMaster().maxWireVersion) { - commandName = 'insert'; - // Get the collection - var col = ns.split('.'); - col.shift(); - col = col.join('.'); - - // Re-write the command - commandObj = { - insert: col, documents: commandObj - } - - if(options.writeConcern && Object.keys(options.writeConcern).length > 0) { - commandObj.writeConcern = options.writeConcern; - } - - commandObj.ordered = options.ordered != undefined ? options.ordered : true; - } else if(x == 'update' && !this.lastIsMaster().maxWireVersion) { - commandName = 'update'; - - // Get the collection - var col = ns.split('.'); - col.shift(); - col = col.join('.'); - - // Re-write the command - commandObj = { - update: col, updates: commandObj - } - - if(options.writeConcern && Object.keys(options.writeConcern).length > 0) { - commandObj.writeConcern = options.writeConcern; - } - - commandObj.ordered = options.ordered != undefined ? options.ordered : true; - } else if(x == 'remove' && !this.lastIsMaster().maxWireVersion) { - commandName = 'delete'; - - // Get the collection - var col = ns.split('.'); - col.shift(); - col = col.join('.'); - - // Re-write the command - commandObj = { - delete: col, deletes: commandObj - } - - if(options.writeConcern && Object.keys(options.writeConcern).length > 0) { - commandObj.writeConcern = options.writeConcern; - } - - commandObj.ordered = options.ordered != undefined ? options.ordered : true; - } else if(x == 'insert' || x == 'update' || x == 'remove' && this.lastIsMaster().maxWireVersion >= 2) { - // Skip the insert/update/remove commands as they are executed as actual write commands in 2.6 or higher - return func.apply(this, args); - } - - // Get the callback - var callback = args.pop(); - // Set current callback operation id from the current context or create - // a new one - var ourOpId = callback.operationId || operationIdGenerator.next(); - - // Get a connection reference for this server instance - var connection = this.s.pool.get() - - // Emit the start event for the command - var command = { - // Returns the command. - command: commandObj, - // Returns the database name. - databaseName: db, - // Returns the command name. - commandName: commandName, - // Returns the driver generated request id. - requestId: requestId, - // Returns the driver generated operation id. - // This is used to link events together such as bulk write operations. OPTIONAL. - operationId: ourOpId, - // Returns the connection id for the command. For languages that do not have this, - // this MUST return the driver equivalent which MUST include the server address and port. - // The name of this field is flexible to match the object that is returned from the driver. - connectionId: connection - }; - - // Filter out any sensitive commands - if(senstiveCommands.indexOf(commandName.toLowerCase())) { - command.commandObj = {}; - command.commandObj[commandName] = true; - } - - // Emit the started event - self.emit('started', command) - - // Start time - var startTime = timestampGenerator.current(); - - // Push our handler callback - args.push(function(err, r) { - var endTime = timestampGenerator.current(); - var command = { - duration: timestampGenerator.duration(startTime, endTime), - commandName: commandName, - requestId: requestId, - operationId: ourOpId, - connectionId: connection - }; - - // If we have an error - if(err || (r && r.result && r.result.ok == 0)) { - command.failure = err || r.result.writeErrors || r.result; - - // Filter out any sensitive commands - if(senstiveCommands.indexOf(commandName.toLowerCase())) { - command.failure = {}; - } - - self.emit('failed', command); - } else if(commandObj && commandObj.writeConcern - && commandObj.writeConcern.w == 0) { - // If we have write concern 0 - command.reply = {ok:1}; - self.emit('succeeded', command); - } else { - command.reply = r && r.result ? r.result : r; - - // Filter out any sensitive commands - if(senstiveCommands.indexOf(commandName.toLowerCase()) != -1) { - command.reply = {}; - } - - self.emit('succeeded', command); - } - - // Return to caller - callback(err, r); - }); - - // Apply the call - func.apply(this, args); - } - }); - - // --------------------------------------------------------- - // - // Bulk Operations - // - // --------------------------------------------------------- - - // Inject ourselves into the Bulk methods - var methods = ['execute']; - var prototypes = [ - require('./bulk/ordered').Bulk.prototype, - require('./bulk/unordered').Bulk.prototype - ] - - prototypes.forEach(function(proto) { - // Core server method we are going to wrap - methods.forEach(function(x) { - var func = proto[x]; - - // Add to overloaded methods - self.overloads.push({proto: proto, name:x, func:func}); - - // The actual prototype - proto[x] = function() { - var bulk = this; - // Get the aruments - var args = Array.prototype.slice.call(arguments, 0); - // Set an operation Id on the bulk object - this.operationId = operationIdGenerator.next(); - - // Get the callback - var callback = args.pop(); - // If we have a callback use this - if(typeof callback == 'function') { - args.push(function(err, r) { - // Return to caller - callback(err, r); - }); - - // Apply the call - func.apply(this, args); - } else { - return func.apply(this, args); - } - } - }); - }); - - // --------------------------------------------------------- - // - // Cursor - // - // --------------------------------------------------------- - - // Inject ourselves into the Cursor methods - var methods = ['_find', '_getmore', '_killcursor']; - var prototypes = [ - require('./cursor').prototype, - require('./command_cursor').prototype, - require('./aggregation_cursor').prototype - ] - - // Command name translation - var commandTranslation = { - '_find': 'find', '_getmore': 'getMore', '_killcursor': 'killCursors', '_explain': 'explain' - } - - prototypes.forEach(function(proto) { - - // Core server method we are going to wrap - methods.forEach(function(x) { - var func = proto[x]; - - // Add to overloaded methods - self.overloads.push({proto: proto, name:x, func:func}); - - // The actual prototype - proto[x] = function() { - var cursor = this; - var requestId = core.Query.nextRequestId(); - var ourOpId = operationIdGenerator.next(); - var parts = this.ns.split('.'); - var db = parts[0]; - - // Get the collection - parts.shift(); - var collection = parts.join('.'); - - // Set the command - var command = this.query; - var cmd = this.s.cmd; - - // If we have a find method, set the operationId on the cursor - if(x == '_find') { - cursor.operationId = ourOpId; - } - - // Do we have a find command rewrite it - if(x == '_getmore') { - command = { - getMore: this.cursorState.cursorId, - collection: collection, - batchSize: cmd.batchSize - } - - if(cmd.maxTimeMS) command.maxTimeMS = cmd.maxTimeMS; - } else if(x == '_killcursors') { - command = { - killCursors: collection, - cursors: [this.cursorState.cursorId] - } - } else if(cmd.find) { - command = { - find: collection, filter: cmd.query - } - - if(cmd.sort) command.sort = cmd.sort; - if(cmd.fields) command.projection = cmd.fields; - if(cmd.limit && cmd.limit < 0) { - command.limit = Math.abs(cmd.limit); - command.singleBatch = true; - } else if(cmd.limit) { - command.limit = Math.abs(cmd.limit); - } - - // Options - if(cmd.skip) command.skip = cmd.skip; - if(cmd.hint) command.hint = cmd.hint; - if(cmd.batchSize) command.batchSize = cmd.batchSize; - if(typeof cmd.returnKey == 'boolean') command.returnKey = cmd.returnKey; - if(cmd.comment) command.comment = cmd.comment; - if(cmd.min) command.min = cmd.min; - if(cmd.max) command.max = cmd.max; - if(cmd.maxScan) command.maxScan = cmd.maxScan; - if(cmd.maxTimeMS) command.maxTimeMS = cmd.maxTimeMS; - - // Flags - if(typeof cmd.awaitData == 'boolean') command.awaitData = cmd.awaitData; - if(typeof cmd.snapshot == 'boolean') command.snapshot = cmd.snapshot; - if(typeof cmd.tailable == 'boolean') command.tailable = cmd.tailable; - if(typeof cmd.oplogReplay == 'boolean') command.oplogReplay = cmd.oplogReplay; - if(typeof cmd.noCursorTimeout == 'boolean') command.noCursorTimeout = cmd.noCursorTimeout; - if(typeof cmd.partial == 'boolean') command.partial = cmd.partial; - if(typeof cmd.showDiskLoc == 'boolean') command.showRecordId = cmd.showDiskLoc; - - // Read Concern - if(cmd.readConcern) command.readConcern = cmd.readConcern; - - // Override method - if(cmd.explain) command.explain = cmd.explain; - if(cmd.exhaust) command.exhaust = cmd.exhaust; - - // If we have a explain flag - if(cmd.explain) { - // Create fake explain command - command = { - explain: command, - verbosity: 'allPlansExecution' - } - - // Set readConcern on the command if available - if(cmd.readConcern) command.readConcern = cmd.readConcern - - // Set up the _explain name for the command - x = '_explain'; - } - } else { - command = cmd; - } - - // Set up the connection - var connectionId = null; - - // Set local connection - if(this.connection) connectionId = this.connection; - if(!connectionId && this.server && this.server.getConnection) connectionId = this.server.getConnection(); - - // Get the command Name - var commandName = x == '_find' ? Object.keys(command)[0] : commandTranslation[x]; - - // Emit the start event for the command - var command = { - // Returns the command. - command: command, - // Returns the database name. - databaseName: db, - // Returns the command name. - commandName: commandName, - // Returns the driver generated request id. - requestId: requestId, - // Returns the driver generated operation id. - // This is used to link events together such as bulk write operations. OPTIONAL. - operationId: this.operationId, - // Returns the connection id for the command. For languages that do not have this, - // this MUST return the driver equivalent which MUST include the server address and port. - // The name of this field is flexible to match the object that is returned from the driver. - connectionId: connectionId - }; - - // Get the aruments - var args = Array.prototype.slice.call(arguments, 0); - - // Get the callback - var callback = args.pop(); - - // We do not have a callback but a Promise - if(typeof callback == 'function' || command.commandName == 'killCursors') { - var startTime = timestampGenerator.current(); - // Emit the started event - self.emit('started', command) - - // Emit succeeded event with killcursor if we have a legacy protocol - if(command.commandName == 'killCursors' - && this.server.lastIsMaster() - && this.server.lastIsMaster().maxWireVersion < 4) { - // Emit the succeeded command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: cursor.operationId, - connectionId: cursor.server.getConnection(), - reply: [{ok:1}] - }; - - // Emit the command - return self.emit('succeeded', command) - } - - // Add our callback handler - args.push(function(err, r) { - if(err) { - // Command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: ourOpId, - connectionId: cursor.server.getConnection(), - failure: err }; - - // Emit the command - self.emit('failed', command) - } else { - - // Do we have a getMore - if(commandName.toLowerCase() == 'getmore' && r == null) { - r = { - cursor: { - id: cursor.cursorState.cursorId, - ns: cursor.ns, - nextBatch: cursor.cursorState.documents - }, ok:1 - } - } else if(commandName.toLowerCase() == 'find' && r == null) { - r = { - cursor: { - id: cursor.cursorState.cursorId, - ns: cursor.ns, - firstBatch: cursor.cursorState.documents - }, ok:1 - } - } else if(commandName.toLowerCase() == 'killcursors' && r == null) { - r = { - cursorsUnknown:[cursor.cursorState.lastCursorId], - ok:1 - } - } - - // cursor id is zero, we can issue success command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: cursor.operationId, - connectionId: cursor.server.getConnection(), - reply: r && r.result ? r.result : r - }; - - // Emit the command - self.emit('succeeded', command) - } - - // Return - if(!callback) return; - - // Return to caller - callback(err, r); - }); - - // Apply the call - func.apply(this, args); - } else { - // Assume promise, push back the missing value - args.push(callback); - // Get the promise - var promise = func.apply(this, args); - // Return a new promise - return new cursor.s.promiseLibrary(function(resolve, reject) { - var startTime = timestampGenerator.current(); - // Emit the started event - self.emit('started', command) - // Execute the function - promise.then(function(r) { - // cursor id is zero, we can issue success command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: cursor.operationId, - connectionId: cursor.server.getConnection(), - reply: cursor.cursorState.documents - }; - - // Emit the command - self.emit('succeeded', command) - }).catch(function(err) { - // Command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: ourOpId, - connectionId: cursor.server.getConnection(), - failure: err }; - - // Emit the command - self.emit('failed', command) - // reject the promise - reject(err); - }); - }); - } - } - }); - }); -} - -inherits(Instrumentation, EventEmitter); - -Instrumentation.prototype.uninstrument = function() { - for(var i = 0; i < this.overloads.length; i++) { - var obj = this.overloads[i]; - obj.proto[obj.name] = obj.func; - } - - // Remove all listeners - this.removeAllListeners('started'); - this.removeAllListeners('succeeded'); - this.removeAllListeners('failed'); -} - -module.exports = Instrumentation; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js deleted file mode 100644 index 7ec023e3..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js +++ /dev/null @@ -1,393 +0,0 @@ -"use strict"; - -var utils = require('../utils'); - -// Error codes -var UNKNOWN_ERROR = 8; -var INVALID_BSON_ERROR = 22; -var WRITE_CONCERN_ERROR = 64; -var MULTIPLE_ERROR = 65; - -// Insert types -var INSERT = 1; -var UPDATE = 2; -var REMOVE = 3 - - -// Get write concern -var writeConcern = function(target, col, options) { - if(options.w != null || options.j != null || options.fsync != null) { - target.writeConcern = options; - } else if(col.writeConcern.w != null || col.writeConcern.j != null || col.writeConcern.fsync != null) { - target.writeConcern = col.writeConcern; - } - - return target -} - -/** - * Helper function to define properties - * @ignore - */ -var defineReadOnlyProperty = function(self, name, value) { - Object.defineProperty(self, name, { - enumerable: true - , get: function() { - return value; - } - }); -} - -/** - * Keeps the state of a unordered batch so we can rewrite the results - * correctly after command execution - * @ignore - */ -var Batch = function(batchType, originalZeroIndex) { - this.originalZeroIndex = originalZeroIndex; - this.currentIndex = 0; - this.originalIndexes = []; - this.batchType = batchType; - this.operations = []; - this.size = 0; - this.sizeBytes = 0; -} - -/** - * Wraps a legacy operation so we can correctly rewrite it's error - * @ignore - */ -var LegacyOp = function(batchType, operation, index) { - this.batchType = batchType; - this.index = index; - this.operation = operation; -} - -/** - * Create a new BulkWriteResult instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @property {boolean} ok Did bulk operation correctly execute - * @property {number} nInserted number of inserted documents - * @property {number} nUpdated number of documents updated logically - * @property {number} nUpserted Number of upserted documents - * @property {number} nModified Number of documents updated physically on disk - * @property {number} nRemoved Number of removed documents - * @return {BulkWriteResult} a BulkWriteResult instance - */ -var BulkWriteResult = function(bulkResult) { - defineReadOnlyProperty(this, "ok", bulkResult.ok); - defineReadOnlyProperty(this, "nInserted", bulkResult.nInserted); - defineReadOnlyProperty(this, "nUpserted", bulkResult.nUpserted); - defineReadOnlyProperty(this, "nMatched", bulkResult.nMatched); - defineReadOnlyProperty(this, "nModified", bulkResult.nModified); - defineReadOnlyProperty(this, "nRemoved", bulkResult.nRemoved); - - /** - * Return an array of inserted ids - * - * @return {object[]} - */ - this.getInsertedIds = function() { - return bulkResult.insertedIds; - } - - /** - * Return an array of upserted ids - * - * @return {object[]} - */ - this.getUpsertedIds = function() { - return bulkResult.upserted; - } - - /** - * Return the upserted id at position x - * - * @param {number} index the number of the upserted id to return, returns undefined if no result for passed in index - * @return {object} - */ - this.getUpsertedIdAt = function(index) { - return bulkResult.upserted[index]; - } - - /** - * Return raw internal result - * - * @return {object} - */ - this.getRawResponse = function() { - return bulkResult; - } - - /** - * Returns true if the bulk operation contains a write error - * - * @return {boolean} - */ - this.hasWriteErrors = function() { - return bulkResult.writeErrors.length > 0; - } - - /** - * Returns the number of write errors off the bulk operation - * - * @return {number} - */ - this.getWriteErrorCount = function() { - return bulkResult.writeErrors.length; - } - - /** - * Returns a specific write error object - * - * @return {WriteError} - */ - this.getWriteErrorAt = function(index) { - if(index < bulkResult.writeErrors.length) { - return bulkResult.writeErrors[index]; - } - return null; - } - - /** - * Retrieve all write errors - * - * @return {object[]} - */ - this.getWriteErrors = function() { - return bulkResult.writeErrors; - } - - /** - * Retrieve lastOp if available - * - * @return {object} - */ - this.getLastOp = function() { - return bulkResult.lastOp; - } - - /** - * Retrieve the write concern error if any - * - * @return {WriteConcernError} - */ - this.getWriteConcernError = function() { - if(bulkResult.writeConcernErrors.length == 0) { - return null; - } else if(bulkResult.writeConcernErrors.length == 1) { - // Return the error - return bulkResult.writeConcernErrors[0]; - } else { - - // Combine the errors - var errmsg = ""; - for(var i = 0; i < bulkResult.writeConcernErrors.length; i++) { - var err = bulkResult.writeConcernErrors[i]; - errmsg = errmsg + err.errmsg; - - // TODO: Something better - if(i == 0) errmsg = errmsg + " and "; - } - - return new WriteConcernError({ errmsg : errmsg, code : WRITE_CONCERN_ERROR }); - } - } - - this.toJSON = function() { - return bulkResult; - } - - this.toString = function() { - return "BulkWriteResult(" + this.toJSON(bulkResult) + ")"; - } - - this.isOk = function() { - return bulkResult.ok == 1; - } -} - -/** - * Create a new WriteConcernError instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @property {number} code Write concern error code. - * @property {string} errmsg Write concern error message. - * @return {WriteConcernError} a WriteConcernError instance - */ -var WriteConcernError = function(err) { - if(!(this instanceof WriteConcernError)) return new WriteConcernError(err); - - // Define properties - defineReadOnlyProperty(this, "code", err.code); - defineReadOnlyProperty(this, "errmsg", err.errmsg); - - this.toJSON = function() { - return {code: err.code, errmsg: err.errmsg}; - } - - this.toString = function() { - return "WriteConcernError(" + err.errmsg + ")"; - } -} - -/** - * Create a new WriteError instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @property {number} code Write concern error code. - * @property {number} index Write concern error original bulk operation index. - * @property {string} errmsg Write concern error message. - * @return {WriteConcernError} a WriteConcernError instance - */ -var WriteError = function(err) { - if(!(this instanceof WriteError)) return new WriteError(err); - - // Define properties - defineReadOnlyProperty(this, "code", err.code); - defineReadOnlyProperty(this, "index", err.index); - defineReadOnlyProperty(this, "errmsg", err.errmsg); - - // - // Define access methods - this.getOperation = function() { - return err.op; - } - - this.toJSON = function() { - return {code: err.code, index: err.index, errmsg: err.errmsg, op: err.op}; - } - - this.toString = function() { - return "WriteError(" + JSON.stringify(this.toJSON()) + ")"; - } -} - -/** - * Merges results into shared data structure - * @ignore - */ -var mergeBatchResults = function(ordered, batch, bulkResult, err, result) { - // If we have an error set the result to be the err object - if(err) { - result = err; - } else if(result && result.result) { - result = result.result; - } else if(result == null) { - return; - } - - // Do we have a top level error stop processing and return - if(result.ok == 0 && bulkResult.ok == 1) { - bulkResult.ok = 0; - // bulkResult.error = utils.toError(result); - var writeError = { - index: 0 - , code: result.code || 0 - , errmsg: result.message - , op: batch.operations[0] - }; - - bulkResult.writeErrors.push(new WriteError(writeError)); - return; - } else if(result.ok == 0 && bulkResult.ok == 0) { - return; - } - - // Add lastop if available - if(result.lastOp) { - bulkResult.lastOp = result.lastOp; - } - - // If we have an insert Batch type - if(batch.batchType == INSERT && result.n) { - bulkResult.nInserted = bulkResult.nInserted + result.n; - } - - // If we have an insert Batch type - if(batch.batchType == REMOVE && result.n) { - bulkResult.nRemoved = bulkResult.nRemoved + result.n; - } - - var nUpserted = 0; - - // We have an array of upserted values, we need to rewrite the indexes - if(Array.isArray(result.upserted)) { - nUpserted = result.upserted.length; - - for(var i = 0; i < result.upserted.length; i++) { - bulkResult.upserted.push({ - index: result.upserted[i].index + batch.originalZeroIndex - , _id: result.upserted[i]._id - }); - } - } else if(result.upserted) { - - nUpserted = 1; - - bulkResult.upserted.push({ - index: batch.originalZeroIndex - , _id: result.upserted - }); - } - - // If we have an update Batch type - if(batch.batchType == UPDATE && result.n) { - var nModified = result.nModified; - bulkResult.nUpserted = bulkResult.nUpserted + nUpserted; - bulkResult.nMatched = bulkResult.nMatched + (result.n - nUpserted); - - if(typeof nModified == 'number') { - bulkResult.nModified = bulkResult.nModified + nModified; - } else { - bulkResult.nModified = null; - } - } - - if(Array.isArray(result.writeErrors)) { - for(var i = 0; i < result.writeErrors.length; i++) { - - var writeError = { - index: batch.originalZeroIndex + result.writeErrors[i].index - , code: result.writeErrors[i].code - , errmsg: result.writeErrors[i].errmsg - , op: batch.operations[result.writeErrors[i].index] - }; - - bulkResult.writeErrors.push(new WriteError(writeError)); - } - } - - if(result.writeConcernError) { - bulkResult.writeConcernErrors.push(new WriteConcernError(result.writeConcernError)); - } -} - -// -// Clone the options -var cloneOptions = function(options) { - var clone = {}; - var keys = Object.keys(options); - for(var i = 0; i < keys.length; i++) { - clone[keys[i]] = options[keys[i]]; - } - - return clone; -} - -// Exports symbols -exports.BulkWriteResult = BulkWriteResult; -exports.WriteError = WriteError; -exports.Batch = Batch; -exports.LegacyOp = LegacyOp; -exports.mergeBatchResults = mergeBatchResults; -exports.cloneOptions = cloneOptions; -exports.writeConcern = writeConcern; -exports.INVALID_BSON_ERROR = INVALID_BSON_ERROR; -exports.WRITE_CONCERN_ERROR = WRITE_CONCERN_ERROR; -exports.MULTIPLE_ERROR = MULTIPLE_ERROR; -exports.UNKNOWN_ERROR = UNKNOWN_ERROR; -exports.INSERT = INSERT; -exports.UPDATE = UPDATE; -exports.REMOVE = REMOVE; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js deleted file mode 100644 index b0bd554e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js +++ /dev/null @@ -1,529 +0,0 @@ -"use strict"; - -var common = require('./common') - , utils = require('../utils') - , toError = require('../utils').toError - , f = require('util').format - , shallowClone = utils.shallowClone - , WriteError = common.WriteError - , BulkWriteResult = common.BulkWriteResult - , LegacyOp = common.LegacyOp - , ObjectID = require('mongodb-core').BSON.ObjectID - , Define = require('../metadata') - , Batch = common.Batch - , mergeBatchResults = common.mergeBatchResults; - -/** - * Create a FindOperatorsOrdered instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @return {FindOperatorsOrdered} a FindOperatorsOrdered instance. - */ -var FindOperatorsOrdered = function(self) { - this.s = self.s; -} - -/** - * Add a single update document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.update = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: true - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a single update one document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.updateOne = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: false - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a replace one operation to the bulk operation - * - * @method - * @param {object} doc the new document to replace the existing one with - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.replaceOne = function(updateDocument) { - this.updateOne(updateDocument); -} - -/** - * Upsert modifier for update bulk operation - * - * @method - * @throws {MongoError} - * @return {FindOperatorsOrdered} - */ -FindOperatorsOrdered.prototype.upsert = function() { - this.s.currentOp.upsert = true; - return this; -} - -/** - * Add a remove one operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.deleteOne = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 1 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -// Backward compatibility -FindOperatorsOrdered.prototype.removeOne = FindOperatorsOrdered.prototype.deleteOne; - -/** - * Add a remove operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.delete = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 0 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -// Backward compatibility -FindOperatorsOrdered.prototype.remove = FindOperatorsOrdered.prototype.delete; - -// Add to internal list of documents -var addToOperationsList = function(_self, docType, document) { - // Get the bsonSize - var bsonSize = _self.s.bson.calculateObjectSize(document, false); - - // Throw error if the doc is bigger than the max BSON size - if(bsonSize >= _self.s.maxBatchSizeBytes) throw toError("document is larger than the maximum size " + _self.s.maxBatchSizeBytes); - // Create a new batch object if we don't have a current one - if(_self.s.currentBatch == null) _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - - // Check if we need to create a new batch - if(((_self.s.currentBatchSize + 1) >= _self.s.maxWriteBatchSize) - || ((_self.s.currentBatchSizeBytes + _self.s.currentBatchSizeBytes) >= _self.s.maxBatchSizeBytes) - || (_self.s.currentBatch.batchType != docType)) { - // Save the batch to the execution stack - _self.s.batches.push(_self.s.currentBatch); - - // Create a new batch - _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - - // Reset the current size trackers - _self.s.currentBatchSize = 0; - _self.s.currentBatchSizeBytes = 0; - } else { - // Update current batch size - _self.s.currentBatchSize = _self.s.currentBatchSize + 1; - _self.s.currentBatchSizeBytes = _self.s.currentBatchSizeBytes + bsonSize; - } - - if(docType == common.INSERT) { - _self.s.bulkResult.insertedIds.push({index: _self.s.currentIndex, _id: document._id}); - } - - // We have an array of documents - if(Array.isArray(document)) { - throw toError("operation passed in cannot be an Array"); - } else { - _self.s.currentBatch.originalIndexes.push(_self.s.currentIndex); - _self.s.currentBatch.operations.push(document) - _self.s.currentIndex = _self.s.currentIndex + 1; - } - - // Return self - return _self; -} - -/** - * Create a new OrderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @property {number} length Get the number of operations in the bulk. - * @return {OrderedBulkOperation} a OrderedBulkOperation instance. - */ -function OrderedBulkOperation(topology, collection, options) { - options = options == null ? {} : options; - // TODO Bring from driver information in isMaster - var self = this; - var executed = false; - - // Current item - var currentOp = null; - - // Handle to the bson serializer, used to calculate running sizes - var bson = topology.bson; - - // Namespace for the operation - var namespace = collection.collectionName; - - // Set max byte size - var maxBatchSizeBytes = topology.isMasterDoc && topology.isMasterDoc.maxBsonObjectSize - ? topology.isMasterDoc.maxBsonObjectSize : (1024*1025*16); - var maxWriteBatchSize = topology.isMasterDoc && topology.isMasterDoc.maxWriteBatchSize - ? topology.isMasterDoc.maxWriteBatchSize : 1000; - - // Get the write concern - var writeConcern = common.writeConcern(shallowClone(options), collection, options); - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Current batch - var currentBatch = null; - var currentIndex = 0; - var currentBatchSize = 0; - var currentBatchSizeBytes = 0; - var batches = []; - - // Final results - var bulkResult = { - ok: 1 - , writeErrors: [] - , writeConcernErrors: [] - , insertedIds: [] - , nInserted: 0 - , nUpserted: 0 - , nMatched: 0 - , nModified: 0 - , nRemoved: 0 - , upserted: [] - }; - - // Internal state - this.s = { - // Final result - bulkResult: bulkResult - // Current batch state - , currentBatch: null - , currentIndex: 0 - , currentBatchSize: 0 - , currentBatchSizeBytes: 0 - , batches: [] - // Write concern - , writeConcern: writeConcern - // Max batch size options - , maxBatchSizeBytes: maxBatchSizeBytes - , maxWriteBatchSize: maxWriteBatchSize - // Namespace - , namespace: namespace - // BSON - , bson: bson - // Topology - , topology: topology - // Options - , options: options - // Current operation - , currentOp: currentOp - // Executed - , executed: executed - // Collection - , collection: collection - // Promise Library - , promiseLibrary: promiseLibrary - // Fundamental error - , err: null - // Bypass validation - , bypassDocumentValidation: typeof options.bypassDocumentValidation == 'boolean' ? options.bypassDocumentValidation : false - } -} - -var define = OrderedBulkOperation.define = new Define('OrderedBulkOperation', OrderedBulkOperation, false); - -OrderedBulkOperation.prototype.raw = function(op) { - var key = Object.keys(op)[0]; - - // Set up the force server object id - var forceServerObjectId = typeof this.s.options.forceServerObjectId == 'boolean' - ? this.s.options.forceServerObjectId : this.s.collection.s.db.options.forceServerObjectId; - - // Update operations - if((op.updateOne && op.updateOne.q) - || (op.updateMany && op.updateMany.q) - || (op.replaceOne && op.replaceOne.q)) { - op[key].multi = op.updateOne || op.replaceOne ? false : true; - return addToOperationsList(this, common.UPDATE, op[key]); - } - - // Crud spec update format - if(op.updateOne || op.updateMany || op.replaceOne) { - var multi = op.updateOne || op.replaceOne ? false : true; - var operation = {q: op[key].filter, u: op[key].update || op[key].replacement, multi: multi} - operation.upsert = op[key].upsert ? true: false; - return addToOperationsList(this, common.UPDATE, operation); - } - - // Remove operations - if(op.removeOne || op.removeMany || (op.deleteOne && op.deleteOne.q) || op.deleteMany && op.deleteMany.q) { - op[key].limit = op.removeOne ? 1 : 0; - return addToOperationsList(this, common.REMOVE, op[key]); - } - - // Crud spec delete operations, less efficient - if(op.deleteOne || op.deleteMany) { - var limit = op.deleteOne ? 1 : 0; - var operation = {q: op[key].filter, limit: limit} - return addToOperationsList(this, common.REMOVE, operation); - } - - // Insert operations - if(op.insertOne && op.insertOne.document == null) { - if(forceServerObjectId !== true && op.insertOne._id == null) op.insertOne._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne); - } else if(op.insertOne && op.insertOne.document) { - if(forceServerObjectId !== true && op.insertOne.document._id == null) op.insertOne.document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne.document); - } - - if(op.insertMany) { - for(var i = 0; i < op.insertMany.length; i++) { - if(forceServerObjectId !== true && op.insertMany[i]._id == null) op.insertMany[i]._id = new ObjectID(); - addToOperationsList(this, common.INSERT, op.insertMany[i]); - } - - return; - } - - // No valid type of operation - throw toError("bulkWrite only supports insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, deleteOne, deleteMany"); -} - -/** - * Add a single insert document to the bulk operation - * - * @param {object} doc the document to insert - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -OrderedBulkOperation.prototype.insert = function(document) { - if(this.s.collection.s.db.options.forceServerObjectId !== true && document._id == null) document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, document); -} - -/** - * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne - * - * @method - * @param {object} selector The selector for the bulk operation. - * @throws {MongoError} - * @return {FindOperatorsOrdered} - */ -OrderedBulkOperation.prototype.find = function(selector) { - if (!selector) { - throw toError("Bulk find operation must specify a selector"); - } - - // Save a current selector - this.s.currentOp = { - selector: selector - } - - return new FindOperatorsOrdered(this); -} - -Object.defineProperty(OrderedBulkOperation.prototype, 'length', { - enumerable: true, - get: function() { - return this.s.currentIndex; - } -}); - -// -// Execute next write command in a chain -var executeCommands = function(self, callback) { - if(self.s.batches.length == 0) { - return callback(null, new BulkWriteResult(self.s.bulkResult)); - } - - // Ordered execution of the command - var batch = self.s.batches.shift(); - - var resultHandler = function(err, result) { - // Error is a driver related error not a bulk op error, terminate - if(err && err.driver || err && err.message) { - return callback(err); - } - - // If we have and error - if(err) err.ok = 0; - // Merge the results together - var mergeResult = mergeBatchResults(true, batch, self.s.bulkResult, err, result); - if(mergeResult != null) { - return callback(null, new BulkWriteResult(self.s.bulkResult)); - } - - // If we are ordered and have errors and they are - // not all replication errors terminate the operation - if(self.s.bulkResult.writeErrors.length > 0) { - return callback(toError(self.s.bulkResult.writeErrors[0]), new BulkWriteResult(self.s.bulkResult)); - } - - // Execute the next command in line - executeCommands(self, callback); - } - - var finalOptions = {ordered: true} - if(self.s.writeConcern != null) { - finalOptions.writeConcern = self.s.writeConcern; - } - - // Set an operationIf if provided - if(self.operationId) { - resultHandler.operationId = self.operationId; - } - - // Serialize functions - if(self.s.options.serializeFunctions) { - finalOptions.serializeFunctions = true - } - - // Serialize functions - if(self.s.options.ignoreUndefined) { - finalOptions.ignoreUndefined = true - } - - // Is the bypassDocumentValidation options specific - if(self.s.bypassDocumentValidation == true) { - finalOptions.bypassDocumentValidation = true; - } - - try { - if(batch.batchType == common.INSERT) { - self.s.topology.insert(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.UPDATE) { - self.s.topology.update(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.REMOVE) { - self.s.topology.remove(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } - } catch(err) { - // Force top level error - err.ok = 0; - // Merge top level error and return - callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, null)); - } -} - -/** - * The callback format for results - * @callback OrderedBulkOperation~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {BulkWriteResult} result The bulk write result. - */ - -/** - * Execute the ordered bulk operation - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {OrderedBulkOperation~resultCallback} [callback] The result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -OrderedBulkOperation.prototype.execute = function(_writeConcern, callback) { - var self = this; - if(this.s.executed) throw new toError("batch cannot be re-executed"); - if(typeof _writeConcern == 'function') { - callback = _writeConcern; - } else { - this.s.writeConcern = _writeConcern; - } - - // If we have current batch - if(this.s.currentBatch) this.s.batches.push(this.s.currentBatch); - - // If we have no operations in the bulk raise an error - if(this.s.batches.length == 0) { - throw toError("Invalid Operation, No operations in bulk"); - } - - // Execute using callback - if(typeof callback == 'function') { - return executeCommands(this, callback); - } - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - executeCommands(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('execute', {callback: true, promise:false}); - -/** - * Returns an unordered batch object - * @ignore - */ -var initializeOrderedBulkOp = function(topology, collection, options) { - return new OrderedBulkOperation(topology, collection, options); -} - -initializeOrderedBulkOp.OrderedBulkOperation = OrderedBulkOperation; -module.exports = initializeOrderedBulkOp; -module.exports.Bulk = OrderedBulkOperation; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js deleted file mode 100644 index 905769ae..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js +++ /dev/null @@ -1,538 +0,0 @@ -"use strict"; - -var common = require('./common') - , utils = require('../utils') - , toError = require('../utils').toError - , f = require('util').format - , shallowClone = utils.shallowClone - , WriteError = common.WriteError - , BulkWriteResult = common.BulkWriteResult - , LegacyOp = common.LegacyOp - , ObjectID = require('mongodb-core').BSON.ObjectID - , Define = require('../metadata') - , Batch = common.Batch - , mergeBatchResults = common.mergeBatchResults; - -/** - * Create a FindOperatorsUnordered instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @property {number} length Get the number of operations in the bulk. - * @return {FindOperatorsUnordered} a FindOperatorsUnordered instance. - */ -var FindOperatorsUnordered = function(self) { - this.s = self.s; -} - -/** - * Add a single update document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.update = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: true - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a single update one document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.updateOne = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: false - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a replace one operation to the bulk operation - * - * @method - * @param {object} doc the new document to replace the existing one with - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.replaceOne = function(updateDocument) { - this.updateOne(updateDocument); -} - -/** - * Upsert modifier for update bulk operation - * - * @method - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.upsert = function() { - this.s.currentOp.upsert = true; - return this; -} - -/** - * Add a remove one operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.removeOne = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 1 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -/** - * Add a remove operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.remove = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 0 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -// -// Add to the operations list -// -var addToOperationsList = function(_self, docType, document) { - // Get the bsonSize - var bsonSize = _self.s.bson.calculateObjectSize(document, false); - // Throw error if the doc is bigger than the max BSON size - if(bsonSize >= _self.s.maxBatchSizeBytes) throw toError("document is larger than the maximum size " + _self.s.maxBatchSizeBytes); - // Holds the current batch - _self.s.currentBatch = null; - // Get the right type of batch - if(docType == common.INSERT) { - _self.s.currentBatch = _self.s.currentInsertBatch; - } else if(docType == common.UPDATE) { - _self.s.currentBatch = _self.s.currentUpdateBatch; - } else if(docType == common.REMOVE) { - _self.s.currentBatch = _self.s.currentRemoveBatch; - } - - // Create a new batch object if we don't have a current one - if(_self.s.currentBatch == null) _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - - // Check if we need to create a new batch - if(((_self.s.currentBatch.size + 1) >= _self.s.maxWriteBatchSize) - || ((_self.s.currentBatch.sizeBytes + bsonSize) >= _self.s.maxBatchSizeBytes) - || (_self.s.currentBatch.batchType != docType)) { - // Save the batch to the execution stack - _self.s.batches.push(_self.s.currentBatch); - - // Create a new batch - _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - } - - // We have an array of documents - if(Array.isArray(document)) { - throw toError("operation passed in cannot be an Array"); - } else { - _self.s.currentBatch.operations.push(document); - _self.s.currentBatch.originalIndexes.push(_self.s.currentIndex); - _self.s.currentIndex = _self.s.currentIndex + 1; - } - - // Save back the current Batch to the right type - if(docType == common.INSERT) { - _self.s.currentInsertBatch = _self.s.currentBatch; - _self.s.bulkResult.insertedIds.push({index: _self.s.currentIndex, _id: document._id}); - } else if(docType == common.UPDATE) { - _self.s.currentUpdateBatch = _self.s.currentBatch; - } else if(docType == common.REMOVE) { - _self.s.currentRemoveBatch = _self.s.currentBatch; - } - - // Update current batch size - _self.s.currentBatch.size = _self.s.currentBatch.size + 1; - _self.s.currentBatch.sizeBytes = _self.s.currentBatch.sizeBytes + bsonSize; - - // Return self - return _self; -} - -/** - * Create a new UnorderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @return {UnorderedBulkOperation} a UnorderedBulkOperation instance. - */ -var UnorderedBulkOperation = function(topology, collection, options) { - options = options == null ? {} : options; - - // Contains reference to self - var self = this; - // Get the namesspace for the write operations - var namespace = collection.collectionName; - // Used to mark operation as executed - var executed = false; - - // Current item - // var currentBatch = null; - var currentOp = null; - var currentIndex = 0; - var batches = []; - - // The current Batches for the different operations - var currentInsertBatch = null; - var currentUpdateBatch = null; - var currentRemoveBatch = null; - - // Handle to the bson serializer, used to calculate running sizes - var bson = topology.bson; - - // Set max byte size - var maxBatchSizeBytes = topology.isMasterDoc && topology.isMasterDoc.maxBsonObjectSize - ? topology.isMasterDoc.maxBsonObjectSize : (1024*1025*16); - var maxWriteBatchSize = topology.isMasterDoc && topology.isMasterDoc.maxWriteBatchSize - ? topology.isMasterDoc.maxWriteBatchSize : 1000; - - // Get the write concern - var writeConcern = common.writeConcern(shallowClone(options), collection, options); - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Final results - var bulkResult = { - ok: 1 - , writeErrors: [] - , writeConcernErrors: [] - , insertedIds: [] - , nInserted: 0 - , nUpserted: 0 - , nMatched: 0 - , nModified: 0 - , nRemoved: 0 - , upserted: [] - }; - - // Internal state - this.s = { - // Final result - bulkResult: bulkResult - // Current batch state - , currentInsertBatch: null - , currentUpdateBatch: null - , currentRemoveBatch: null - , currentBatch: null - , currentIndex: 0 - , batches: [] - // Write concern - , writeConcern: writeConcern - // Max batch size options - , maxBatchSizeBytes: maxBatchSizeBytes - , maxWriteBatchSize: maxWriteBatchSize - // Namespace - , namespace: namespace - // BSON - , bson: bson - // Topology - , topology: topology - // Options - , options: options - // Current operation - , currentOp: currentOp - // Executed - , executed: executed - // Collection - , collection: collection - // Promise Library - , promiseLibrary: promiseLibrary - // Bypass validation - , bypassDocumentValidation: typeof options.bypassDocumentValidation == 'boolean' ? options.bypassDocumentValidation : false - } -} - -var define = UnorderedBulkOperation.define = new Define('UnorderedBulkOperation', UnorderedBulkOperation, false); - -/** - * Add a single insert document to the bulk operation - * - * @param {object} doc the document to insert - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -UnorderedBulkOperation.prototype.insert = function(document) { - if(this.s.collection.s.db.options.forceServerObjectId !== true && document._id == null) document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, document); -} - -/** - * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne - * - * @method - * @param {object} selector The selector for the bulk operation. - * @throws {MongoError} - * @return {FindOperatorsUnordered} - */ -UnorderedBulkOperation.prototype.find = function(selector) { - if (!selector) { - throw toError("Bulk find operation must specify a selector"); - } - - // Save a current selector - this.s.currentOp = { - selector: selector - } - - return new FindOperatorsUnordered(this); -} - -Object.defineProperty(UnorderedBulkOperation.prototype, 'length', { - enumerable: true, - get: function() { - return this.s.currentIndex; - } -}); - -UnorderedBulkOperation.prototype.raw = function(op) { - var key = Object.keys(op)[0]; - - // Set up the force server object id - var forceServerObjectId = typeof this.s.options.forceServerObjectId == 'boolean' - ? this.s.options.forceServerObjectId : this.s.collection.s.db.options.forceServerObjectId; - - // Update operations - if((op.updateOne && op.updateOne.q) - || (op.updateMany && op.updateMany.q) - || (op.replaceOne && op.replaceOne.q)) { - op[key].multi = op.updateOne || op.replaceOne ? false : true; - return addToOperationsList(this, common.UPDATE, op[key]); - } - - // Crud spec update format - if(op.updateOne || op.updateMany || op.replaceOne) { - var multi = op.updateOne || op.replaceOne ? false : true; - var operation = {q: op[key].filter, u: op[key].update || op[key].replacement, multi: multi} - if(op[key].upsert) operation.upsert = true; - return addToOperationsList(this, common.UPDATE, operation); - } - - // Remove operations - if(op.removeOne || op.removeMany || (op.deleteOne && op.deleteOne.q) || op.deleteMany && op.deleteMany.q) { - op[key].limit = op.removeOne ? 1 : 0; - return addToOperationsList(this, common.REMOVE, op[key]); - } - - // Crud spec delete operations, less efficient - if(op.deleteOne || op.deleteMany) { - var limit = op.deleteOne ? 1 : 0; - var operation = {q: op[key].filter, limit: limit} - return addToOperationsList(this, common.REMOVE, operation); - } - - // Insert operations - if(op.insertOne && op.insertOne.document == null) { - if(forceServerObjectId !== true && op.insertOne._id == null) op.insertOne._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne); - } else if(op.insertOne && op.insertOne.document) { - if(forceServerObjectId !== true && op.insertOne.document._id == null) op.insertOne.document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne.document); - } - - if(op.insertMany) { - for(var i = 0; i < op.insertMany.length; i++) { - if(forceServerObjectId !== true && op.insertMany[i]._id == null) op.insertMany[i]._id = new ObjectID(); - addToOperationsList(this, common.INSERT, op.insertMany[i]); - } - - return; - } - - // No valid type of operation - throw toError("bulkWrite only supports insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, deleteOne, deleteMany"); -} - -// -// Execute the command -var executeBatch = function(self, batch, callback) { - var finalOptions = {ordered: false} - if(self.s.writeConcern != null) { - finalOptions.writeConcern = self.s.writeConcern; - } - - var resultHandler = function(err, result) { - // Error is a driver related error not a bulk op error, terminate - if(err && err.driver || err && err.message) { - return callback(err); - } - - // If we have and error - if(err) err.ok = 0; - callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, result)); - } - - // Set an operationIf if provided - if(self.operationId) { - resultHandler.operationId = self.operationId; - } - - // Serialize functions - if(self.s.options.serializeFunctions) { - finalOptions.serializeFunctions = true - } - - // Is the bypassDocumentValidation options specific - if(self.s.bypassDocumentValidation == true) { - finalOptions.bypassDocumentValidation = true; - } - - try { - if(batch.batchType == common.INSERT) { - self.s.topology.insert(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.UPDATE) { - self.s.topology.update(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.REMOVE) { - self.s.topology.remove(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } - } catch(err) { - // Force top level error - err.ok = 0; - // Merge top level error and return - callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, null)); - } -} - -// -// Execute all the commands -var executeBatches = function(self, callback) { - var numberOfCommandsToExecute = self.s.batches.length; - var error = null; - // Execute over all the batches - for(var i = 0; i < self.s.batches.length; i++) { - executeBatch(self, self.s.batches[i], function(err, result) { - // Driver layer error capture it - if(err) error = err; - // Count down the number of commands left to execute - numberOfCommandsToExecute = numberOfCommandsToExecute - 1; - - // Execute - if(numberOfCommandsToExecute == 0) { - // Driver level error - if(error) return callback(error); - // Treat write errors - var error = self.s.bulkResult.writeErrors.length > 0 ? toError(self.s.bulkResult.writeErrors[0]) : null; - callback(error, new BulkWriteResult(self.s.bulkResult)); - } - }); - } -} - -/** - * The callback format for results - * @callback UnorderedBulkOperation~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {BulkWriteResult} result The bulk write result. - */ - -/** - * Execute the ordered bulk operation - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {UnorderedBulkOperation~resultCallback} [callback] The result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -UnorderedBulkOperation.prototype.execute = function(_writeConcern, callback) { - var self = this; - if(this.s.executed) throw toError("batch cannot be re-executed"); - if(typeof _writeConcern == 'function') { - callback = _writeConcern; - } else { - this.s.writeConcern = _writeConcern; - } - - // If we have current batch - if(this.s.currentInsertBatch) this.s.batches.push(this.s.currentInsertBatch); - if(this.s.currentUpdateBatch) this.s.batches.push(this.s.currentUpdateBatch); - if(this.s.currentRemoveBatch) this.s.batches.push(this.s.currentRemoveBatch); - - // If we have no operations in the bulk raise an error - if(this.s.batches.length == 0) { - throw toError("Invalid Operation, No operations in bulk"); - } - - // Execute using callback - if(typeof callback == 'function') return executeBatches(this, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - executeBatches(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('execute', {callback: true, promise:false}); - -/** - * Returns an unordered batch object - * @ignore - */ -var initializeUnorderedBulkOp = function(topology, collection, options) { - return new UnorderedBulkOperation(topology, collection, options); -} - -initializeUnorderedBulkOp.UnorderedBulkOperation = UnorderedBulkOperation; -module.exports = initializeUnorderedBulkOp; -module.exports.Bulk = UnorderedBulkOperation; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/collection.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/collection.js deleted file mode 100644 index c34e23e9..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/collection.js +++ /dev/null @@ -1,3138 +0,0 @@ -"use strict"; - -var checkCollectionName = require('./utils').checkCollectionName - , ObjectID = require('mongodb-core').BSON.ObjectID - , Long = require('mongodb-core').BSON.Long - , Code = require('mongodb-core').BSON.Code - , f = require('util').format - , AggregationCursor = require('./aggregation_cursor') - , MongoError = require('mongodb-core').MongoError - , shallowClone = require('./utils').shallowClone - , isObject = require('./utils').isObject - , toError = require('./utils').toError - , normalizeHintField = require('./utils').normalizeHintField - , handleCallback = require('./utils').handleCallback - , decorateCommand = require('./utils').decorateCommand - , formattedOrderClause = require('./utils').formattedOrderClause - , ReadPreference = require('./read_preference') - , CoreReadPreference = require('mongodb-core').ReadPreference - , CommandCursor = require('./command_cursor') - , Define = require('./metadata') - , Cursor = require('./cursor') - , unordered = require('./bulk/unordered') - , ordered = require('./bulk/ordered'); - -/** - * @fileOverview The **Collection** class is an internal class that embodies a MongoDB collection - * allowing for insert/update/remove/find and other command operation on that MongoDB collection. - * - * **COLLECTION Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('createIndexExample1'); - * // Show that duplicate records got dropped - * col.find({}).toArray(function(err, items) { - * test.equal(null, err); - * test.equal(4, items.length); - * db.close(); - * }); - * }); - */ - -/** - * Create a new Collection instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @property {string} collectionName Get the collection name. - * @property {string} namespace Get the full collection namespace. - * @property {object} writeConcern The current write concern values. - * @property {object} readConcern The current read concern values. - * @property {object} hint Get current index hint for collection. - * @return {Collection} a Collection instance. - */ -var Collection = function(db, topology, dbName, name, pkFactory, options) { - checkCollectionName(name); - var self = this; - // Unpack variables - var internalHint = null; - var opts = options != null && ('object' === typeof options) ? options : {}; - var slaveOk = options == null || options.slaveOk == null ? db.slaveOk : options.slaveOk; - var serializeFunctions = options == null || options.serializeFunctions == null ? db.serializeFunctions : options.serializeFunctions; - var raw = options == null || options.raw == null ? db.raw : options.raw; - var readPreference = null; - var collectionHint = null; - var namespace = f("%s.%s", dbName, name); - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Assign the right collection level readPreference - if(options && options.readPreference) { - readPreference = options.readPreference; - } else if(db.options.readPreference) { - readPreference = db.options.readPreference; - } - - // Set custom primary key factory if provided - pkFactory = pkFactory == null - ? ObjectID - : pkFactory; - - // Internal state - this.s = { - // Set custom primary key factory if provided - pkFactory: pkFactory - // Db - , db: db - // Topology - , topology: topology - // dbName - , dbName: dbName - // Options - , options: options - // Namespace - , namespace: namespace - // Read preference - , readPreference: readPreference - // Raw - , raw: raw - // SlaveOK - , slaveOk: slaveOk - // Serialize functions - , serializeFunctions: serializeFunctions - // internalHint - , internalHint: internalHint - // collectionHint - , collectionHint: collectionHint - // Name - , name: name - // Promise library - , promiseLibrary: promiseLibrary - // Read Concern - , readConcern: options.readConcern - } -} - -var define = Collection.define = new Define('Collection', Collection, false); - -Object.defineProperty(Collection.prototype, 'collectionName', { - enumerable: true, get: function() { return this.s.name; } -}); - -Object.defineProperty(Collection.prototype, 'namespace', { - enumerable: true, get: function() { return this.s.namespace; } -}); - -Object.defineProperty(Collection.prototype, 'readConcern', { - enumerable: true, get: function() { return this.s.readConcern || {level: 'local'}; } -}); - -Object.defineProperty(Collection.prototype, 'writeConcern', { - enumerable:true, - get: function() { - var ops = {}; - if(this.s.options.w != null) ops.w = this.s.options.w; - if(this.s.options.j != null) ops.j = this.s.options.j; - if(this.s.options.fsync != null) ops.fsync = this.s.options.fsync; - if(this.s.options.wtimeout != null) ops.wtimeout = this.s.options.wtimeout; - return ops; - } -}); - -/** - * @ignore - */ -Object.defineProperty(Collection.prototype, "hint", { - enumerable: true - , get: function () { return this.s.collectionHint; } - , set: function (v) { this.s.collectionHint = normalizeHintField(v); } -}); - -/** - * Creates a cursor for a query that can be used to iterate over results from MongoDB - * @method - * @param {object} query The cursor query object. - * @throws {MongoError} - * @return {Cursor} - */ -Collection.prototype.find = function() { - var options - , args = Array.prototype.slice.call(arguments, 0) - , has_callback = typeof args[args.length - 1] === 'function' - , has_weird_callback = typeof args[0] === 'function' - , callback = has_callback ? args.pop() : (has_weird_callback ? args.shift() : null) - , len = args.length - , selector = len >= 1 ? args[0] : {} - , fields = len >= 2 ? args[1] : undefined; - - if(len === 1 && has_weird_callback) { - // backwards compat for callback?, options case - selector = {}; - options = args[0]; - } - - if(len === 2 && fields !== undefined && !Array.isArray(fields)) { - var fieldKeys = Object.keys(fields); - var is_option = false; - - for(var i = 0; i < fieldKeys.length; i++) { - if(testForFields[fieldKeys[i]] != null) { - is_option = true; - break; - } - } - - if(is_option) { - options = fields; - fields = undefined; - } else { - options = {}; - } - } else if(len === 2 && Array.isArray(fields) && !Array.isArray(fields[0])) { - var newFields = {}; - // Rewrite the array - for(var i = 0; i < fields.length; i++) { - newFields[fields[i]] = 1; - } - // Set the fields - fields = newFields; - } - - if(3 === len) { - options = args[2]; - } - - // Ensure selector is not null - selector = selector == null ? {} : selector; - // Validate correctness off the selector - var object = selector; - if(Buffer.isBuffer(object)) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query selector raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - // Validate correctness of the field selector - var object = fields; - if(Buffer.isBuffer(object)) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query fields raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - // Check special case where we are using an objectId - if(selector instanceof ObjectID || (selector != null && selector._bsontype == 'ObjectID')) { - selector = {_id:selector}; - } - - // If it's a serialized fields field we need to just let it through - // user be warned it better be good - if(options && options.fields && !(Buffer.isBuffer(options.fields))) { - fields = {}; - - if(Array.isArray(options.fields)) { - if(!options.fields.length) { - fields['_id'] = 1; - } else { - for (var i = 0, l = options.fields.length; i < l; i++) { - fields[options.fields[i]] = 1; - } - } - } else { - fields = options.fields; - } - } - - if (!options) options = {}; - - var newOptions = {}; - // Make a shallow copy of options - for (var key in options) { - newOptions[key] = options[key]; - } - - // Unpack options - newOptions.skip = len > 3 ? args[2] : options.skip ? options.skip : 0; - newOptions.limit = len > 3 ? args[3] : options.limit ? options.limit : 0; - newOptions.raw = options.raw != null && typeof options.raw === 'boolean' ? options.raw : this.s.raw; - newOptions.hint = options.hint != null ? normalizeHintField(options.hint) : this.s.collectionHint; - newOptions.timeout = len == 5 ? args[4] : typeof options.timeout === 'undefined' ? undefined : options.timeout; - // // If we have overridden slaveOk otherwise use the default db setting - newOptions.slaveOk = options.slaveOk != null ? options.slaveOk : this.s.db.slaveOk; - - // Add read preference if needed - newOptions = getReadPreference(this, newOptions, this.s.db, this); - // Set slave ok to true if read preference different from primary - if(newOptions.readPreference != null - && (newOptions.readPreference != 'primary' || newOptions.readPreference.mode != 'primary')) { - newOptions.slaveOk = true; - } - - // Ensure the query is an object - if(selector != null && typeof selector != 'object') { - throw MongoError.create({message: "query selector must be an object", driver:true }); - } - - // Build the find command - var findCommand = { - find: this.s.namespace - , limit: newOptions.limit - , skip: newOptions.skip - , query: selector - } - - // Ensure we use the right await data option - if(typeof newOptions.awaitdata == 'boolean') { - newOptions.awaitData = newOptions.awaitdata - }; - - // Translate to new command option noCursorTimeout - if(typeof newOptions.timeout == 'boolean') newOptions.noCursorTimeout = newOptions.timeout; - - // Merge in options to command - for(var name in newOptions) { - if(newOptions[name] != null) findCommand[name] = newOptions[name]; - } - - // Format the fields - var formatFields = function(fields) { - var object = {}; - if(Array.isArray(fields)) { - for(var i = 0; i < fields.length; i++) { - if(Array.isArray(fields[i])) { - object[fields[i][0]] = fields[i][1]; - } else { - object[fields[i][0]] = 1; - } - } - } else { - object = fields; - } - - return object; - } - - // Special treatment for the fields selector - if(fields) findCommand.fields = formatFields(fields); - - // Add db object to the new options - newOptions.db = this.s.db; - - // Add the promise library - newOptions.promiseLibrary = this.s.promiseLibrary; - - // Set raw if available at collection level - if(newOptions.raw == null && this.s.raw) newOptions.raw = this.s.raw; - - // Sort options - if(findCommand.sort) - findCommand.sort = formattedOrderClause(findCommand.sort); - - // Set the readConcern - if(this.s.readConcern) { - findCommand.readConcern = this.s.readConcern; - } - - // Create the cursor - if(typeof callback == 'function') return handleCallback(callback, null, this.s.topology.cursor(this.s.namespace, findCommand, newOptions)); - return this.s.topology.cursor(this.s.namespace, findCommand, newOptions); -} - -define.classMethod('find', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Inserts a single document into MongoDB. - * @method - * @param {object} doc Document to insert. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~insertOneWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.insertOne = function(doc, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - if(Array.isArray(doc)) return callback(MongoError.create({message: 'doc parameter must be an object', driver:true })); - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return insertOne(self, doc, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - insertOne(self, doc, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var insertOne = function(self, doc, options, callback) { - insertDocuments(self, [doc], options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - // Workaround for pre 2.6 servers - if(r == null) return callback(null, {result: {ok:1}}); - // Add values to top level to ensure crud spec compatibility - r.insertedCount = r.result.n; - r.insertedId = doc._id; - if(callback) callback(null, r); - }); -} - -var mapInserManyResults = function(docs, r) { - var ids = r.getInsertedIds(); - var keys = Object.keys(ids); - var finalIds = new Array(keys); - - for(var i = 0; i < keys.length; i++) { - if(ids[keys[i]]._id) { - finalIds[ids[keys[i]].index] = ids[keys[i]]._id; - } - } - - return { - result: {ok: 1, n: r.insertedCount}, - ops: docs, - insertedCount: r.insertedCount, - insertedIds: finalIds - } -} - -define.classMethod('insertOne', {callback: true, promise:true}); - -/** - * Inserts an array of documents into MongoDB. - * @method - * @param {object[]} docs Documents to insert. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {Collection~insertWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.insertMany = function(docs, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {ordered:true}; - if(!Array.isArray(docs)) return callback(MongoError.create({message: 'docs parameter must be an array of documents', driver:true })); - - // Get the write concern options - if(typeof options.checkKeys != 'boolean') { - options.checkKeys = true; - } - - // If keep going set unordered - options['serializeFunctions'] = options['serializeFunctions'] || self.s.serializeFunctions; - - // Set up the force server object id - var forceServerObjectId = typeof options.forceServerObjectId == 'boolean' - ? options.forceServerObjectId : self.s.db.options.forceServerObjectId; - - // Do we want to force the server to assign the _id key - if(forceServerObjectId !== true) { - // Add _id if not specified - for(var i = 0; i < docs.length; i++) { - if(docs[i]._id == null) docs[i]._id = self.s.pkFactory.createPk(); - } - } - - // Generate the bulk write operations - var operations = [{ - insertMany: docs - }]; - - // Execute using callback - if(typeof callback == 'function') return bulkWrite(self, operations, options, function(err, r) { - if(err) return callback(err, r); - callback(null, mapInserManyResults(docs, r)); - }); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - bulkWrite(self, operations, options, function(err, r) { - if(err) return reject(err); - resolve(mapInserManyResults(docs, r)); - }); - }); -} - -define.classMethod('insertMany', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~BulkWriteOpResult - * @property {number} insertedCount Number of documents inserted. - * @property {number} matchedCount Number of documents matched for update. - * @property {number} modifiedCount Number of documents modified. - * @property {number} deletedCount Number of documents deleted. - * @property {number} upsertedCount Number of documents upserted. - * @property {object} insertedIds Inserted document generated Id's, hash key is the index of the originating operation - * @property {object} upsertedIds Upserted document generated Id's, hash key is the index of the originating operation - * @property {object} result The command result object. - */ - -/** - * The callback format for inserts - * @callback Collection~bulkWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~BulkWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Perform a bulkWrite operation without a fluent API - * - * Legal operation types are - * - * { insertOne: { document: { a: 1 } } } - * - * { updateOne: { filter: {a:2}, update: {$set: {a:2}}, upsert:true } } - * - * { updateMany: { filter: {a:2}, update: {$set: {a:2}}, upsert:true } } - * - * { deleteOne: { filter: {c:1} } } - * - * { deleteMany: { filter: {c:1} } } - * - * { replaceOne: { filter: {c:3}, replacement: {c:4}, upsert:true}} - * - * @method - * @param {object[]} operations Bulk operations to perform. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.ordered=true] Execute write operation in ordered or unordered fashion. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~bulkWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.bulkWrite = function(operations, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {ordered:true}; - - if(!Array.isArray(operations)) { - throw MongoError.create({message: "operations must be an array of documents", driver:true }); - } - - // Execute using callback - if(typeof callback == 'function') return bulkWrite(self, operations, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - bulkWrite(self, operations, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var bulkWrite = function(self, operations, options, callback) { - // Add ignoreUndfined - if(self.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = self.s.options.ignoreUndefined; - } - - // Create the bulk operation - var bulk = options.ordered == true || options.ordered == null ? self.initializeOrderedBulkOp(options) : self.initializeUnorderedBulkOp(options); - - // for each op go through and add to the bulk - for(var i = 0; i < operations.length; i++) { - bulk.raw(operations[i]); - } - - // Final options for write concern - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - var writeCon = finalOptions.writeConcern ? finalOptions.writeConcern : {}; - - // Execute the bulk - bulk.execute(writeCon, function(err, r) { - // We have connection level error - if(!r && err) return callback(err, null); - // We have single error - if(r && r.hasWriteErrors() && r.getWriteErrorCount() == 1) { - return callback(toError(r.getWriteErrorAt(0)), r); - } - - // if(err) return callback(err); - r.insertedCount = r.nInserted; - r.matchedCount = r.nMatched; - r.modifiedCount = r.nModified || 0; - r.deletedCount = r.nRemoved; - r.upsertedCount = r.getUpsertedIds().length; - r.upsertedIds = {}; - r.insertedIds = {}; - - // Update the n - r.n = r.insertedCount; - - // Inserted documents - var inserted = r.getInsertedIds(); - // Map inserted ids - for(var i = 0; i < inserted.length; i++) { - r.insertedIds[inserted[i].index] = inserted[i]._id; - } - - // Upserted documents - var upserted = r.getUpsertedIds(); - // Map upserted ids - for(var i = 0; i < upserted.length; i++) { - r.upsertedIds[upserted[i].index] = upserted[i]._id; - } - - // Check if we have write errors - if(r.hasWriteErrors()) { - // Get all the errors - var errors = r.getWriteErrors(); - // Return the MongoError object - return callback(toError({ - message: 'write operation failed', code: errors[0].code, writeErrors: errors - }), r); - } - - // Check if we have a writeConcern error - if(r.getWriteConcernError()) { - // Return the MongoError object - return callback(toError(r.getWriteConcernError()), r); - } - - // Return the results - callback(null, r); - }); -} - -var insertDocuments = function(self, docs, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - // Ensure we are operating on an array op docs - docs = Array.isArray(docs) ? docs : [docs]; - - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - if(typeof finalOptions.checkKeys != 'boolean') finalOptions.checkKeys = true; - - // If keep going set unordered - if(finalOptions.keepGoing == true) finalOptions.ordered = false; - finalOptions['serializeFunctions'] = options['serializeFunctions'] || self.s.serializeFunctions; - - // Set up the force server object id - var forceServerObjectId = typeof options.forceServerObjectId == 'boolean' - ? options.forceServerObjectId : self.s.db.options.forceServerObjectId; - - // Add _id if not specified - if(forceServerObjectId !== true){ - for(var i = 0; i < docs.length; i++) { - if(docs[i]._id == null) docs[i]._id = self.s.pkFactory.createPk(); - } - } - - // File inserts - self.s.topology.insert(self.s.namespace, docs, finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err); - if(result == null) return handleCallback(callback, null, null); - if(result.result.code) return handleCallback(callback, toError(result.result)); - if(result.result.writeErrors) return handleCallback(callback, toError(result.result.writeErrors[0])); - // Add docs to the list - result.ops = docs; - // Return the results - handleCallback(callback, null, result); - }); -} - -define.classMethod('bulkWrite', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~WriteOpResult - * @property {object[]} ops All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany - * @property {object} connection The connection object used for the operation. - * @property {object} result The command result object. - */ - -/** - * The callback format for inserts - * @callback Collection~writeOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~WriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * @typedef {Object} Collection~insertWriteOpResult - * @property {Number} insertedCount The total amount of documents inserted. - * @property {object[]} ops All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany - * @property {ObjectId[]} insertedIds All the generated _id's for the inserted documents. - * @property {object} connection The connection object used for the operation. - * @property {object} result The raw command result object returned from MongoDB (content might vary by server version). - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents inserted. - */ - -/** - * @typedef {Object} Collection~insertOneWriteOpResult - * @property {Number} insertedCount The total amount of documents inserted. - * @property {object[]} ops All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany - * @property {ObjectId} insertedId The driver generated ObjectId for the insert operation. - * @property {object} connection The connection object used for the operation. - * @property {object} result The raw command result object returned from MongoDB (content might vary by server version). - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents inserted. - */ - -/** - * The callback format for inserts - * @callback Collection~insertWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~insertWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * The callback format for inserts - * @callback Collection~insertOneWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~insertOneWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Inserts a single document or a an array of documents into MongoDB. - * @method - * @param {(object|object[])} docs Documents to insert. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~insertWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated Use insertOne, insertMany or bulkWrite - */ -Collection.prototype.insert = function(docs, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {ordered:false}; - docs = !Array.isArray(docs) ? [docs] : docs; - - if(options.keepGoing == true) { - options.ordered = false; - } - - return this.insertMany(docs, options, callback); -} - -define.classMethod('insert', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~updateWriteOpResult - * @property {Object} result The raw result returned from MongoDB, field will vary depending on server version. - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents scanned. - * @property {Number} result.nModified The total count of documents modified. - * @property {Object} connection The connection object used for the operation. - * @property {Number} matchedCount The number of documents that matched the filter. - * @property {Number} modifiedCount The number of documents that were modified. - * @property {Number} upsertedCount The number of documents upserted. - * @property {Object} upsertedId The upserted id. - * @property {ObjectId} upsertedId._id The upserted _id returned from the server. - */ - -/** - * The callback format for inserts - * @callback Collection~updateWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~updateWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Update a single document on MongoDB - * @method - * @param {object} filter The Filter used to select the document to update - * @param {object} update The update operations to be applied to the document - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~updateWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.updateOne = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options) - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return updateOne(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - updateOne(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var updateOne = function(self, filter, update, options, callback) { - // Set single document update - options.multi = false; - // Execute update - updateDocuments(self, filter, update, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.matchedCount = r.result.n; - r.modifiedCount = r.result.nModified != null ? r.result.nModified : r.result.n; - r.upsertedId = Array.isArray(r.result.upserted) && r.result.upserted.length > 0 ? r.result.upserted[0] : null; - r.upsertedCount = Array.isArray(r.result.upserted) && r.result.upserted.length ? r.result.upserted.length : 0; - if(callback) callback(null, r); - }); -} - -define.classMethod('updateOne', {callback: true, promise:true}); - -/** - * Replace a document on MongoDB - * @method - * @param {object} filter The Filter used to select the document to update - * @param {object} doc The Document that replaces the matching document - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~updateWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.replaceOne = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options) - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return replaceOne(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - replaceOne(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var replaceOne = function(self, filter, update, options, callback) { - // Set single document update - options.multi = false; - // Execute update - updateDocuments(self, filter, update, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.matchedCount = r.result.n; - r.modifiedCount = r.result.nModified != null ? r.result.nModified : r.result.n; - r.upsertedId = Array.isArray(r.result.upserted) && r.result.upserted.length > 0 ? r.result.upserted[0] : null; - r.upsertedCount = Array.isArray(r.result.upserted) && r.result.upserted.length ? r.result.upserted.length : 0; - r.ops = [update]; - if(callback) callback(null, r); - }); -} - -define.classMethod('replaceOne', {callback: true, promise:true}); - -/** - * Update multiple documents on MongoDB - * @method - * @param {object} filter The Filter used to select the document to update - * @param {object} update The update operations to be applied to the document - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~updateWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.updateMany = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options) - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return updateMany(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - updateMany(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var updateMany = function(self, filter, update, options, callback) { - // Set single document update - options.multi = true; - // Execute update - updateDocuments(self, filter, update, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.matchedCount = r.result.n; - r.modifiedCount = r.result.nModified != null ? r.result.nModified : r.result.n; - r.upsertedId = Array.isArray(r.result.upserted) && r.result.upserted.length > 0 ? r.result.upserted[0] : null; - r.upsertedCount = Array.isArray(r.result.upserted) && r.result.upserted.length ? r.result.upserted.length : 0; - if(callback) callback(null, r); - }); -} - -define.classMethod('updateMany', {callback: true, promise:true}); - -var updateDocuments = function(self, selector, document, options, callback) { - if('function' === typeof options) callback = options, options = null; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - - // If we are not providing a selector or document throw - if(selector == null || typeof selector != 'object') return callback(toError("selector must be a valid JavaScript object")); - if(document == null || typeof document != 'object') return callback(toError("document must be a valid JavaScript object")); - - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - - // Do we return the actual result document - // Either use override on the function, or go back to default on either the collection - // level or db - finalOptions['serializeFunctions'] = options['serializeFunctions'] || self.s.serializeFunctions; - - // Execute the operation - var op = {q: selector, u: document}; - op.upsert = typeof options.upsert == 'boolean' ? options.upsert : false; - op.multi = typeof options.multi == 'boolean' ? options.multi : false; - - // Update options - self.s.topology.update(self.s.namespace, [op], finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - if(result == null) return handleCallback(callback, null, null); - if(result.result.code) return handleCallback(callback, toError(result.result)); - if(result.result.writeErrors) return handleCallback(callback, toError(result.result.writeErrors[0])); - // Return the results - handleCallback(callback, null, result); - }); -} - -/** - * Updates documents. - * @method - * @param {object} selector The selector for the update operation. - * @param {object} document The update document. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {boolean} [options.multi=false] Update one/all documents with operation. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~writeOpCallback} [callback] The command result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - * @deprecated use updateOne, updateMany or bulkWrite - */ -Collection.prototype.update = function(selector, document, options, callback) { - var self = this; - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return updateDocuments(self, selector, document, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - updateDocuments(self, selector, document, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('update', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~deleteWriteOpResult - * @property {Object} result The raw result returned from MongoDB, field will vary depending on server version. - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents deleted. - * @property {Object} connection The connection object used for the operation. - * @property {Number} deletedCount The number of documents deleted. - */ - -/** - * The callback format for inserts - * @callback Collection~deleteWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~deleteWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Delete a document on MongoDB - * @method - * @param {object} filter The Filter used to select the document to remove - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~deleteWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.deleteOne = function(filter, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - var options = shallowClone(options); - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return deleteOne(self, filter, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - deleteOne(self, filter, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var deleteOne = function(self, filter, options, callback) { - options.single = true; - removeDocuments(self, filter, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.deletedCount = r.result.n; - if(callback) callback(null, r); - }); -} - -define.classMethod('deleteOne', {callback: true, promise:true}); - -Collection.prototype.removeOne = Collection.prototype.deleteOne; - -define.classMethod('removeOne', {callback: true, promise:true}); - -/** - * Delete multiple documents on MongoDB - * @method - * @param {object} filter The Filter used to select the documents to remove - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~deleteWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.deleteMany = function(filter, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - var options = shallowClone(options); - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return deleteMany(self, filter, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - deleteMany(self, filter, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var deleteMany = function(self, filter, options, callback) { - options.single = false; - removeDocuments(self, filter, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.deletedCount = r.result.n; - if(callback) callback(null, r); - }); -} - -var removeDocuments = function(self, selector, options, callback) { - if(typeof options == 'function') { - callback = options, options = {}; - } else if (typeof selector === 'function') { - callback = selector; - options = {}; - selector = {}; - } - - // Create an empty options object if the provided one is null - options = options || {}; - - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - - // If selector is null set empty - if(selector == null) selector = {}; - - // Build the op - var op = {q: selector, limit: 0}; - if(options.single) op.limit = 1; - - // Execute the remove - self.s.topology.remove(self.s.namespace, [op], finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - if(result == null) return handleCallback(callback, null, null); - if(result.result.code) return handleCallback(callback, toError(result.result)); - if(result.result.writeErrors) return handleCallback(callback, toError(result.result.writeErrors[0])); - // Return the results - handleCallback(callback, null, result); - }); -} - -define.classMethod('deleteMany', {callback: true, promise:true}); - -Collection.prototype.removeMany = Collection.prototype.deleteMany; - -define.classMethod('removeMany', {callback: true, promise:true}); - -/** - * Remove documents. - * @method - * @param {object} selector The selector for the update operation. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.single=false] Removes the first document found. - * @param {Collection~writeOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use deleteOne, deleteMany or bulkWrite - */ -Collection.prototype.remove = function(selector, options, callback) { - var self = this; - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return removeDocuments(self, selector, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - removeDocuments(self, selector, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('remove', {callback: true, promise:true}); - -/** - * Save a document. Simple full document replacement function. Not recommended for efficiency, use atomic - * operators and update instead for more efficient operations. - * @method - * @param {object} doc Document to save - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~writeOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use insertOne, insertMany, updateOne or updateMany - */ -Collection.prototype.save = function(doc, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return save(self, doc, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - save(self, doc, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var save = function(self, doc, options, callback) { - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - // Establish if we need to perform an insert or update - if(doc._id != null) { - finalOptions.upsert = true; - return updateDocuments(self, {_id: doc._id}, doc, finalOptions, callback); - } - - // Insert the document - insertDocuments(self, [doc], options, function(err, r) { - if(callback == null) return; - if(doc == null) return handleCallback(callback, null, null); - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, r); - }); -} - -define.classMethod('save', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Collection~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result object if the command was executed successfully. - */ - -/** - * Fetches the first document that matches the query - * @method - * @param {object} query Query for find Operation - * @param {object} [options=null] Optional settings. - * @param {number} [options.limit=0] Sets the limit of documents returned in the query. - * @param {(array|object)} [options.sort=null] Set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. - * @param {object} [options.fields=null] The fields to return in the query. Object of fields to include or exclude (not both), {'a':1} - * @param {number} [options.skip=0] Set to skip N documents ahead in your query (useful for pagination). - * @param {Object} [options.hint=null] Tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} - * @param {boolean} [options.explain=false] Explain the query instead of returning the data. - * @param {boolean} [options.snapshot=false] Snapshot query. - * @param {boolean} [options.timeout=false] Specify if the cursor can timeout. - * @param {boolean} [options.tailable=false] Specify if the cursor is tailable. - * @param {number} [options.batchSize=0] Set the batchSize for the getMoreCommand when iterating over the query results. - * @param {boolean} [options.returnKey=false] Only return the index key. - * @param {number} [options.maxScan=null] Limit the number of items to scan. - * @param {number} [options.min=null] Set index bounds. - * @param {number} [options.max=null] Set index bounds. - * @param {boolean} [options.showDiskLoc=false] Show disk location of results. - * @param {string} [options.comment=null] You can put a $comment field on a query to make looking in the profiler logs simpler. - * @param {boolean} [options.raw=false] Return all BSON documents as Raw Buffer documents. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {boolean} [options.partial=false] Specify if the cursor should return partial results when querying against a sharded system - * @param {number} [options.maxTimeMS=null] Number of miliseconds to wait before aborting the query. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use find().limit(1).next(function(err, doc){}) - */ -Collection.prototype.findOne = function() { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - var callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - - // Execute using callback - if(typeof callback == 'function') return findOne(self, args, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - findOne(self, args, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOne = function(self, args, callback) { - var cursor = self.find.apply(self, args).limit(-1).batchSize(1); - // Return the item - cursor.next(function(err, item) { - if(err != null) return handleCallback(callback, toError(err), null); - handleCallback(callback, null, item); - }); -} - -define.classMethod('findOne', {callback: true, promise:true}); - -/** - * The callback format for the collection method, must be used if strict is specified - * @callback Collection~collectionResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection} collection The collection instance. - */ - -/** - * Rename the collection. - * - * @method - * @param {string} newName New name of of the collection. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.dropTarget=false] Drop the target name collection if it previously exists. - * @param {Collection~collectionResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.rename = function(newName, opt, callback) { - var self = this; - if(typeof opt == 'function') callback = opt, opt = {}; - opt = opt || {}; - - // Execute using callback - if(typeof callback == 'function') return rename(self, newName, opt, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - rename(self, newName, opt, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var rename = function(self, newName, opt, callback) { - // Check the collection name - checkCollectionName(newName); - // Build the command - var renameCollection = f("%s.%s", self.s.dbName, self.s.name); - var toCollection = f("%s.%s", self.s.dbName, newName); - var dropTarget = typeof opt.dropTarget == 'boolean' ? opt.dropTarget : false; - var cmd = {'renameCollection':renameCollection, 'to':toCollection, 'dropTarget':dropTarget}; - - // Execute against admin - self.s.db.admin().command(cmd, opt, function(err, doc) { - if(err) return handleCallback(callback, err, null); - // We have an error - if(doc.errmsg) return handleCallback(callback, toError(doc), null); - try { - return handleCallback(callback, null, new Collection(self.s.db, self.s.topology, self.s.dbName, newName, self.s.pkFactory, self.s.options)); - } catch(err) { - return handleCallback(callback, toError(err), null); - } - }); -} - -define.classMethod('rename', {callback: true, promise:true}); - -/** - * Drop the collection from the database, removing it permanently. New accesses will create a new collection. - * - * @method - * @param {Collection~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.drop = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return self.s.db.dropCollection(self.s.name, callback); - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.dropCollection(self.s.name, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('drop', {callback: true, promise:true}); - -/** - * Returns the options of the collection. - * - * @method - * @param {Collection~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.options = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return options(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var options = function(self, callback) { - self.s.db.listCollections({name: self.s.name}).toArray(function(err, collections) { - if(err) return handleCallback(callback, err); - if(collections.length == 0) { - return handleCallback(callback, MongoError.create({message: f("collection %s not found", self.s.namespace), driver:true })); - } - - handleCallback(callback, err, collections[0].options || null); - }); -} - -define.classMethod('options', {callback: true, promise:true}); - -/** - * Returns if the collection is a capped collection - * - * @method - * @param {Collection~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.isCapped = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return isCapped(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - isCapped(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var isCapped = function(self, callback) { - self.options(function(err, document) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, document && document.capped); - }); -} - -define.classMethod('isCapped', {callback: true, promise:true}); - -/** - * Creates an index on the db and collection collection. - * @method - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.createIndex = function(fieldOrSpec, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - options = typeof callback === 'function' ? options : callback; - options = options == null ? {} : options; - - // Execute using callback - if(typeof callback == 'function') return createIndex(self, fieldOrSpec, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - createIndex(self, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var createIndex = function(self, fieldOrSpec, options, callback) { - self.s.db.createIndex(self.s.name, fieldOrSpec, options, callback); -} - -define.classMethod('createIndex', {callback: true, promise:true}); - -/** - * Creates multiple indexes in the collection, this method is only supported for - * MongoDB 2.6 or higher. Earlier version of MongoDB will throw a command not supported - * error. Index specifications are defined at http://docs.mongodb.org/manual/reference/command/createIndexes/. - * @method - * @param {array} indexSpecs An array of index specifications to be created - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.createIndexes = function(indexSpecs, callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return createIndexes(self, indexSpecs, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - createIndexes(self, indexSpecs, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var createIndexes = function(self, indexSpecs, callback) { - // Ensure we generate the correct name if the parameter is not set - for(var i = 0; i < indexSpecs.length; i++) { - if(indexSpecs[i].name == null) { - var keys = []; - - for(var name in indexSpecs[i].key) { - keys.push(f('%s_%s', name, indexSpecs[i].key[name])); - } - - // Set the name - indexSpecs[i].name = keys.join('_'); - } - } - - // Execute the index - self.s.db.command({ - createIndexes: self.s.name, indexes: indexSpecs - }, callback); -} - -define.classMethod('createIndexes', {callback: true, promise:true}); - -/** - * Drops an index from this collection. - * @method - * @param {string} indexName Name of the index to drop. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.dropIndex = function(indexName, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - // Run only against primary - options.readPreference = ReadPreference.PRIMARY; - - // Execute using callback - if(typeof callback == 'function') return dropIndex(self, indexName, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - dropIndex(self, indexName, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var dropIndex = function(self, indexName, options, callback) { - // Delete index command - var cmd = {'deleteIndexes':self.s.name, 'index':indexName}; - - // Execute command - self.s.db.command(cmd, options, function(err, result) { - if(typeof callback != 'function') return; - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result); - }); -} - -define.classMethod('dropIndex', {callback: true, promise:true}); - -/** - * Drops all indexes from this collection. - * @method - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.dropIndexes = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return dropIndexes(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - dropIndexes(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var dropIndexes = function(self, callback) { - self.dropIndex('*', function (err, result) { - if(err) return handleCallback(callback, err, false); - handleCallback(callback, null, true); - }); -} - -define.classMethod('dropIndexes', {callback: true, promise:true}); - -/** - * Drops all indexes from this collection. - * @method - * @deprecated use dropIndexes - * @param {Collection~resultCallback} callback The command result callback - * @return {Promise} returns Promise if no [callback] passed - */ -Collection.prototype.dropAllIndexes = Collection.prototype.dropIndexes; - -define.classMethod('dropAllIndexes', {callback: true, promise:true}); - -/** - * Reindex all indexes on the collection - * Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. - * @method - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.reIndex = function(options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return reIndex(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - reIndex(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var reIndex = function(self, options, callback) { - // Reindex - var cmd = {'reIndex':self.s.name}; - - // Execute the command - self.s.db.command(cmd, options, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.ok ? true : false); - }); -} - -define.classMethod('reIndex', {callback: true, promise:true}); - -/** - * Get the list of all indexes information for the collection. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {number} [options.batchSize=null] The batchSize for the returned command cursor or if pre 2.8 the systems batch collection - * @return {CommandCursor} - */ -Collection.prototype.listIndexes = function(options) { - options = options || {}; - // Clone the options - options = shallowClone(options); - // Set the CommandCursor constructor - options.cursorFactory = CommandCursor; - // Set the promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - if(!this.s.topology.capabilities()) { - throw new MongoError('cannot connect to server'); - } - - // We have a list collections command - if(this.s.topology.capabilities().hasListIndexesCommand) { - // Cursor options - var cursor = options.batchSize ? {batchSize: options.batchSize} : {} - // Build the command - var command = { listIndexes: this.s.name, cursor: cursor }; - // Execute the cursor - return this.s.topology.cursor(f('%s.$cmd', this.s.dbName), command, options); - } - - // Get the namespace - var ns = f('%s.system.indexes', this.s.dbName); - // Get the query - return this.s.topology.cursor(ns, {find: ns, query: {ns: this.s.namespace}}, options); -}; - -define.classMethod('listIndexes', {callback: false, promise:false, returns: [CommandCursor]}); - -/** - * Ensures that an index exists, if it does not it creates it - * @method - * @deprecated use createIndexes instead - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.ensureIndex = function(fieldOrSpec, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return ensureIndex(self, fieldOrSpec, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - ensureIndex(self, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var ensureIndex = function(self, fieldOrSpec, options, callback) { - self.s.db.ensureIndex(self.s.name, fieldOrSpec, options, callback); -} - -define.classMethod('ensureIndex', {callback: true, promise:true}); - -/** - * Checks if one or more indexes exist on the collection, fails on first non-existing index - * @method - * @param {(string|array)} indexes One or more index names to check. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.indexExists = function(indexes, callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return indexExists(self, indexes, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexExists(self, indexes, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var indexExists = function(self, indexes, callback) { - self.indexInformation(function(err, indexInformation) { - // If we have an error return - if(err != null) return handleCallback(callback, err, null); - // Let's check for the index names - if(!Array.isArray(indexes)) return handleCallback(callback, null, indexInformation[indexes] != null); - // Check in list of indexes - for(var i = 0; i < indexes.length; i++) { - if(indexInformation[indexes[i]] == null) { - return handleCallback(callback, null, false); - } - } - - // All keys found return true - return handleCallback(callback, null, true); - }); -} - -define.classMethod('indexExists', {callback: true, promise:true}); - -/** - * Retrieves this collections index info. - * @method - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.full=false] Returns the full raw index information. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.indexInformation = function(options, callback) { - var self = this; - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return indexInformation(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexInformation(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var indexInformation = function(self, options, callback) { - self.s.db.indexInformation(self.s.name, options, callback); -} - -define.classMethod('indexInformation', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Collection~countCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {number} result The count of documents that matched the query. - */ - -/** - * Count number of matching documents in the db to a query. - * @method - * @param {object} query The query for the count. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.limit=null] The limit of documents to count. - * @param {boolean} [options.skip=null] The number of documents to skip for the count. - * @param {string} [options.hint=null] An index name hint for the query. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Collection~countCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.count = function(query, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - var queryOption = args.length ? args.shift() || {} : {}; - var optionsOption = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return count(self, queryOption, optionsOption, callback); - - // Check if query is empty - query = query || {}; - options = options || {}; - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - count(self, query, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var count = function(self, query, options, callback) { - var skip = options.skip; - var limit = options.limit; - var hint = options.hint; - var maxTimeMS = options.maxTimeMS; - - // Final query - var cmd = { - 'count': self.s.name, 'query': query - }; - - // Add limit and skip if defined - if(typeof skip == 'number') cmd.skip = skip; - if(typeof limit == 'number') cmd.limit = limit; - if(hint) options.hint = hint; - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - cmd.readConcern = self.s.readConcern; - } - - // Execute command - self.s.db.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.n); - }); -} - -define.classMethod('count', {callback: true, promise:true}); - -/** - * The distinct command returns returns a list of distinct values for the given key across a collection. - * @method - * @param {string} key Field of the document to find distinct values for. - * @param {object} query The query for filtering the set of documents to which we apply the distinct filter. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.distinct = function(key, query, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - var queryOption = args.length ? args.shift() || {} : {}; - var optionsOption = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return distinct(self, key, queryOption, optionsOption, callback); - - // Ensure the query and options are set - query = query || {}; - options = options || {}; - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - distinct(self, key, query, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var distinct = function(self, key, query, options, callback) { - // maxTimeMS option - var maxTimeMS = options.maxTimeMS; - - // Distinct command - var cmd = { - 'distinct': self.s.name, 'key': key, 'query': query - }; - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - cmd.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.values); - }); -} - -define.classMethod('distinct', {callback: true, promise:true}); - -/** - * Retrieve all the indexes on the collection. - * @method - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.indexes = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return indexes(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexes(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var indexes = function(self, callback) { - self.s.db.indexInformation(self.s.name, {full:true}, callback); -} - -define.classMethod('indexes', {callback: true, promise:true}); - -/** - * Get all the collection statistics. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {number} [options.scale=null] Divide the returned sizes by scale value. - * @param {Collection~resultCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.stats = function(options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return stats(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - stats(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var stats = function(self, options, callback) { - // Build command object - var commandObject = { - collStats:self.s.name - } - - // Check if we have the scale value - if(options['scale'] != null) commandObject['scale'] = options['scale']; - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Execute the command - self.s.db.command(commandObject, options, callback); -} - -define.classMethod('stats', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~findAndModifyWriteOpResult - * @property {object} value Document returned from findAndModify command. - * @property {object} lastErrorObject The raw lastErrorObject returned from the command. - * @property {Number} ok Is 1 if the command executed correctly. - */ - -/** - * The callback format for inserts - * @callback Collection~findAndModifyCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~findAndModifyWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation. - * - * @method - * @param {object} filter Document selection filter. - * @param {object} [options=null] Optional settings. - * @param {object} [options.projection=null] Limits the fields to return for all matching documents. - * @param {object} [options.sort=null] Determines which document the operation modifies if the query selects multiple documents. - * @param {number} [options.maxTimeMS=null] The maximum amount of time to allow the query to run. - * @param {Collection~findAndModifyCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.findOneAndDelete = function(filter, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return findOneAndDelete(self, filter, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findOneAndDelete(self, filter, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOneAndDelete = function(self, filter, options, callback) { - // Final options - var finalOptions = shallowClone(options); - finalOptions['fields'] = options.projection; - finalOptions['remove'] = true; - // Execute find and Modify - self.findAndModify( - filter - , options.sort - , null - , finalOptions - , callback - ); -} - -define.classMethod('findOneAndDelete', {callback: true, promise:true}); - -/** - * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation. - * - * @method - * @param {object} filter Document selection filter. - * @param {object} replacement Document replacing the matching document. - * @param {object} [options=null] Optional settings. - * @param {object} [options.projection=null] Limits the fields to return for all matching documents. - * @param {object} [options.sort=null] Determines which document the operation modifies if the query selects multiple documents. - * @param {number} [options.maxTimeMS=null] The maximum amount of time to allow the query to run. - * @param {boolean} [options.upsert=false] Upsert the document if it does not exist. - * @param {boolean} [options.returnOriginal=true] When false, returns the updated document rather than the original. The default is true. - * @param {Collection~findAndModifyCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.findOneAndReplace = function(filter, replacement, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return findOneAndReplace(self, filter, replacement, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findOneAndReplace(self, filter, replacement, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOneAndReplace = function(self, filter, replacement, options, callback) { - // Final options - var finalOptions = shallowClone(options); - finalOptions['fields'] = options.projection; - finalOptions['update'] = true; - finalOptions['new'] = typeof options.returnOriginal == 'boolean' ? !options.returnOriginal : false; - finalOptions['upsert'] = typeof options.upsert == 'boolean' ? options.upsert : false; - - // Execute findAndModify - self.findAndModify( - filter - , options.sort - , replacement - , finalOptions - , callback - ); -} - -define.classMethod('findOneAndReplace', {callback: true, promise:true}); - -/** - * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation. - * - * @method - * @param {object} filter Document selection filter. - * @param {object} update Update operations to be performed on the document - * @param {object} [options=null] Optional settings. - * @param {object} [options.projection=null] Limits the fields to return for all matching documents. - * @param {object} [options.sort=null] Determines which document the operation modifies if the query selects multiple documents. - * @param {number} [options.maxTimeMS=null] The maximum amount of time to allow the query to run. - * @param {boolean} [options.upsert=false] Upsert the document if it does not exist. - * @param {boolean} [options.returnOriginal=true] When false, returns the updated document rather than the original. The default is true. - * @param {Collection~findAndModifyCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.findOneAndUpdate = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return findOneAndUpdate(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findOneAndUpdate(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOneAndUpdate = function(self, filter, update, options, callback) { - // Final options - var finalOptions = shallowClone(options); - finalOptions['fields'] = options.projection; - finalOptions['update'] = true; - finalOptions['new'] = typeof options.returnOriginal == 'boolean' ? !options.returnOriginal : false; - finalOptions['upsert'] = typeof options.upsert == 'boolean' ? options.upsert : false; - - // Execute findAndModify - self.findAndModify( - filter - , options.sort - , update - , finalOptions - , callback - ); -} - -define.classMethod('findOneAndUpdate', {callback: true, promise:true}); - -/** - * Find and update a document. - * @method - * @param {object} query Query object to locate the object to modify. - * @param {array} sort If multiple docs match, choose the first one in the specified sort order as the object to manipulate. - * @param {object} doc The fields/vals to be updated. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.remove=false] Set to true to remove the object before returning. - * @param {boolean} [options.upsert=false] Perform an upsert operation. - * @param {boolean} [options.new=false] Set to true if you want to return the modified object rather than the original. Ignored for remove. - * @param {object} [options.fields=null] Object containing the field projection for the result returned from the operation. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use findOneAndUpdate, findOneAndReplace or findOneAndDelete instead - */ -Collection.prototype.findAndModify = function(query, sort, doc, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - sort = args.length ? args.shift() || [] : []; - doc = args.length ? args.shift() : null; - options = args.length ? args.shift() || {} : {}; - - // Clone options - var options = shallowClone(options); - // Force read preference primary - options.readPreference = ReadPreference.PRIMARY; - - // Execute using callback - if(typeof callback == 'function') return findAndModify(self, query, sort, doc, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findAndModify(self, query, sort, doc, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findAndModify = function(self, query, sort, doc, options, callback) { - // Create findAndModify command object - var queryObject = { - 'findandmodify': self.s.name - , 'query': query - }; - - sort = formattedOrderClause(sort); - if(sort) { - queryObject.sort = sort; - } - - queryObject.new = options.new ? true : false; - queryObject.remove = options.remove ? true : false; - queryObject.upsert = options.upsert ? true : false; - - if(options.fields) { - queryObject.fields = options.fields; - } - - if(doc && !options.remove) { - queryObject.update = doc; - } - - // Either use override on the function, or go back to default on either the collection - // level or db - if(options['serializeFunctions'] != null) { - options['serializeFunctions'] = options['serializeFunctions']; - } else { - options['serializeFunctions'] = self.s.serializeFunctions; - } - - // No check on the documents - options.checkKeys = false; - - // Get the write concern settings - var finalOptions = writeConcern(options, self.s.db, self, options); - - // Decorate the findAndModify command with the write Concern - if(finalOptions.writeConcern) { - queryObject.writeConcern = finalOptions.writeConcern; - } - - // Have we specified bypassDocumentValidation - if(typeof finalOptions.bypassDocumentValidation == 'boolean') { - queryObject.bypassDocumentValidation = finalOptions.bypassDocumentValidation; - } - - // Execute the command - self.s.db.command(queryObject - , options, function(err, result) { - if(err) return handleCallback(callback, err, null); - return handleCallback(callback, null, result); - }); -} - -define.classMethod('findAndModify', {callback: true, promise:true}); - -/** - * Find and remove a document. - * @method - * @param {object} query Query object to locate the object to modify. - * @param {array} sort If multiple docs match, choose the first one in the specified sort order as the object to manipulate. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use findOneAndDelete instead - */ -Collection.prototype.findAndRemove = function(query, sort, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - sort = args.length ? args.shift() || [] : []; - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return findAndRemove(self, query, sort, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - findAndRemove(self, query, sort, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findAndRemove = function(self, query, sort, options, callback) { - // Add the remove option - options['remove'] = true; - // Execute the callback - self.findAndModify(query, sort, null, options, callback); -} - -define.classMethod('findAndRemove', {callback: true, promise:true}); - -/** - * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2 - * @method - * @param {object} pipeline Array containing all the aggregation framework commands for the execution. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.cursor=null] Return the query as cursor, on 2.6 > it returns as a real cursor on pre 2.6 it returns as an emulated cursor. - * @param {number} [options.cursor.batchSize=null] The batchSize for the cursor - * @param {boolean} [options.explain=false] Explain returns the aggregation execution plan (requires mongodb 2.6 >). - * @param {boolean} [options.allowDiskUse=false] allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 >). - * @param {number} [options.maxTimeMS=null] maxTimeMS specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~resultCallback} callback The command result callback - * @return {(null|AggregationCursor)} - */ -Collection.prototype.aggregate = function(pipeline, options, callback) { - var self = this; - if(Array.isArray(pipeline)) { - // Set up callback if one is provided - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // If we have no options or callback we are doing - // a cursor based aggregation - if(options == null && callback == null) { - options = {}; - } - } else { - // Aggregation pipeline passed as arguments on the method - var args = Array.prototype.slice.call(arguments, 0); - // Get the callback - callback = args.pop(); - // Get the possible options object - var opts = args[args.length - 1]; - // If it contains any of the admissible options pop it of the args - options = opts && (opts.readPreference - || opts.explain || opts.cursor || opts.out - || opts.maxTimeMS || opts.allowDiskUse) ? args.pop() : {}; - // Left over arguments is the pipeline - pipeline = args; - } - - // Ignore readConcern option - var ignoreReadConcern = false; - - // If out was specified - if(typeof options.out == 'string') { - pipeline.push({$out: options.out}); - ignoreReadConcern = true; - } else if(pipeline.length > 0 && pipeline[pipeline.length - 1]['$out']) { - ignoreReadConcern = true; - } - - // Build the command - var command = { aggregate : this.s.name, pipeline : pipeline}; - - // If we have bypassDocumentValidation set - if(typeof options.bypassDocumentValidation == 'boolean') { - command.bypassDocumentValidation = options.bypassDocumentValidation; - } - - // Do we have a readConcern specified - if(!ignoreReadConcern && this.s.readConcern) { - command.readConcern = this.s.readConcern; - } - - // If we have allowDiskUse defined - if(options.allowDiskUse) command.allowDiskUse = options.allowDiskUse; - if(typeof options.maxTimeMS == 'number') command.maxTimeMS = options.maxTimeMS; - - // Ensure we have the right read preference inheritance - options = getReadPreference(this, options, this.s.db, this); - - // If explain has been specified add it - if(options.explain) command.explain = options.explain; - - // Validate that cursor options is valid - if(options.cursor != null && typeof options.cursor != 'object') { - throw toError('cursor options must be an object'); - } - - // promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - // Set the AggregationCursor constructor - options.cursorFactory = AggregationCursor; - if(typeof callback != 'function') { - if(!this.s.topology.capabilities()) { - throw new MongoError('cannot connect to server'); - } - - if(this.s.topology.capabilities().hasAggregationCursor) { - options.cursor = options.cursor || { batchSize : 1000 }; - command.cursor = options.cursor; - } - - // Allow disk usage command - if(typeof options.allowDiskUse == 'boolean') command.allowDiskUse = options.allowDiskUse; - if(typeof options.maxTimeMS == 'number') command.maxTimeMS = options.maxTimeMS; - - // Execute the cursor - return this.s.topology.cursor(this.s.namespace, command, options); - } - - var cursor = null; - // We do not allow cursor - if(options.cursor) { - return this.s.topology.cursor(this.s.namespace, command, options); - } - - // Execute the command - this.s.db.command(command, options, function(err, result) { - if(err) { - handleCallback(callback, err); - } else if(result['err'] || result['errmsg']) { - handleCallback(callback, toError(result)); - } else if(typeof result == 'object' && result['serverPipeline']) { - handleCallback(callback, null, result['serverPipeline']); - } else if(typeof result == 'object' && result['stages']) { - handleCallback(callback, null, result['stages']); - } else { - handleCallback(callback, null, result.result); - } - }); -} - -define.classMethod('aggregate', {callback: true, promise:false}); - -/** - * The callback format for results - * @callback Collection~parallelCollectionScanCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Cursor[]} cursors A list of cursors returned allowing for parallel reading of collection. - */ - -/** - * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are - * no ordering guarantees for returned results. - * @method - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.batchSize=null] Set the batchSize for the getMoreCommand when iterating over the query results. - * @param {number} [options.numCursors=1] The maximum number of parallel command cursors to return (the number of returned cursors will be in the range 1:numCursors) - * @param {boolean} [options.raw=false] Return all BSON documents as Raw Buffer documents. - * @param {Collection~parallelCollectionScanCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.parallelCollectionScan = function(options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {numCursors: 1}; - // Set number of cursors to 1 - options.numCursors = options.numCursors || 1; - options.batchSize = options.batchSize || 1000; - - // Ensure we have the right read preference inheritance - options = getReadPreference(this, options, this.s.db, this); - - // Add a promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - // Execute using callback - if(typeof callback == 'function') return parallelCollectionScan(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - parallelCollectionScan(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var parallelCollectionScan = function(self, options, callback) { - // Create command object - var commandObject = { - parallelCollectionScan: self.s.name - , numCursors: options.numCursors - } - - // Do we have a readConcern specified - if(self.s.readConcern) { - commandObject.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(commandObject, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - if(result == null) return handleCallback(callback, new Error("no result returned for parallelCollectionScan"), null); - - var cursors = []; - // Create command cursors for each item - for(var i = 0; i < result.cursors.length; i++) { - var rawId = result.cursors[i].cursor.id - // Convert cursorId to Long if needed - var cursorId = typeof rawId == 'number' ? Long.fromNumber(rawId) : rawId; - - // Command cursor options - var cmd = { - batchSize: options.batchSize - , cursorId: cursorId - , items: result.cursors[i].cursor.firstBatch - } - - // Add a command cursor - cursors.push(self.s.topology.cursor(self.s.namespace, cursorId, options)); - } - - handleCallback(callback, null, cursors); - }); -} - -define.classMethod('parallelCollectionScan', {callback: true, promise:true}); - -/** - * Execute the geoNear command to search for items in the collection - * - * @method - * @param {number} x Point to search on the x axis, ensure the indexes are ordered in the same order. - * @param {number} y Point to search on the y axis, ensure the indexes are ordered in the same order. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.num=null] Max number of results to return. - * @param {number} [options.minDistance=null] Include results starting at minDistance from a point (2.6 or higher) - * @param {number} [options.maxDistance=null] Include results up to maxDistance from the point. - * @param {number} [options.distanceMultiplier=null] Include a value to multiply the distances with allowing for range conversions. - * @param {object} [options.query=null] Filter the results by a query. - * @param {boolean} [options.spherical=false] Perform query using a spherical model. - * @param {boolean} [options.uniqueDocs=false] The closest location in a document to the center of the search region will always be returned MongoDB > 2.X. - * @param {boolean} [options.includeLocs=false] Include the location data fields in the top level of the results MongoDB > 2.X. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.geoNear = function(x, y, options, callback) { - var self = this; - var point = typeof(x) == 'object' && x - , args = Array.prototype.slice.call(arguments, point?1:2); - - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return geoNear(self, x, y, point, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - geoNear(self, x, y, point, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var geoNear = function(self, x, y, point, options, callback) { - // Build command object - var commandObject = { - geoNear:self.s.name, - near: point || [x, y] - } - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Exclude readPreference and existing options to prevent user from - // shooting themselves in the foot - var exclude = { - readPreference: true, - geoNear: true, - near: true - }; - - // Filter out any excluded objects - commandObject = decorateCommand(commandObject, options, exclude); - - // Do we have a readConcern specified - if(self.s.readConcern) { - commandObject.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(commandObject, options, function (err, res) { - if(err) return handleCallback(callback, err); - if(res.err || res.errmsg) return handleCallback(callback, toError(res)); - // should we only be returning res.results here? Not sure if the user - // should see the other return information - handleCallback(callback, null, res); - }); -} - -define.classMethod('geoNear', {callback: true, promise:true}); - -/** - * Execute a geo search using a geo haystack index on a collection. - * - * @method - * @param {number} x Point to search on the x axis, ensure the indexes are ordered in the same order. - * @param {number} y Point to search on the y axis, ensure the indexes are ordered in the same order. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxDistance=null] Include results up to maxDistance from the point. - * @param {object} [options.search=null] Filter the results by a query. - * @param {number} [options.limit=false] Max number of results to return. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.geoHaystackSearch = function(x, y, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return geoHaystackSearch(self, x, y, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - geoHaystackSearch(self, x, y, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var geoHaystackSearch = function(self, x, y, options, callback) { - // Build command object - var commandObject = { - geoSearch: self.s.name, - near: [x, y] - } - - // Remove read preference from hash if it exists - commandObject = decorateCommand(commandObject, options, {readPreference: true}); - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - commandObject.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(commandObject, options, function (err, res) { - if(err) return handleCallback(callback, err); - if(res.err || res.errmsg) handleCallback(callback, utils.toError(res)); - // should we only be returning res.results here? Not sure if the user - // should see the other return information - handleCallback(callback, null, res); - }); -} - -define.classMethod('geoHaystackSearch', {callback: true, promise:true}); - -/** - * Group function helper - * @ignore - */ -var groupFunction = function () { - var c = db[ns].find(condition); - var map = new Map(); - var reduce_function = reduce; - - while (c.hasNext()) { - var obj = c.next(); - var key = {}; - - for (var i = 0, len = keys.length; i < len; ++i) { - var k = keys[i]; - key[k] = obj[k]; - } - - var aggObj = map.get(key); - - if (aggObj == null) { - var newObj = Object.extend({}, key); - aggObj = Object.extend(newObj, initial); - map.put(key, aggObj); - } - - reduce_function(obj, aggObj); - } - - return { "result": map.values() }; -}.toString(); - -/** - * Run a group command across a collection - * - * @method - * @param {(object|array|function|code)} keys An object, array or function expressing the keys to group by. - * @param {object} condition An optional condition that must be true for a row to be considered. - * @param {object} initial Initial value of the aggregation counter object. - * @param {(function|Code)} reduce The reduce function aggregates (reduces) the objects iterated - * @param {(function|Code)} finalize An optional function to be run on each item in the result set just before the item is returned. - * @param {boolean} command Specify if you wish to run using the internal group command or using eval, default is true. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.group = function(keys, condition, initial, reduce, finalize, command, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 3); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - reduce = args.length ? args.shift() : null; - finalize = args.length ? args.shift() : null; - command = args.length ? args.shift() : null; - options = args.length ? args.shift() || {} : {}; - - // Make sure we are backward compatible - if(!(typeof finalize == 'function')) { - command = finalize; - finalize = null; - } - - if (!Array.isArray(keys) && keys instanceof Object && typeof(keys) !== 'function' && !(keys instanceof Code)) { - keys = Object.keys(keys); - } - - if(typeof reduce === 'function') { - reduce = reduce.toString(); - } - - if(typeof finalize === 'function') { - finalize = finalize.toString(); - } - - // Set up the command as default - command = command == null ? true : command; - - // Execute using callback - if(typeof callback == 'function') return group(self, keys, condition, initial, reduce, finalize, command, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - group(self, keys, condition, initial, reduce, finalize, command, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var group = function(self, keys, condition, initial, reduce, finalize, command, options, callback) { - // Execute using the command - if(command) { - var reduceFunction = reduce instanceof Code - ? reduce - : new Code(reduce); - - var selector = { - group: { - 'ns': self.s.name - , '$reduce': reduceFunction - , 'cond': condition - , 'initial': initial - , 'out': "inline" - } - }; - - // if finalize is defined - if(finalize != null) selector.group['finalize'] = finalize; - // Set up group selector - if ('function' === typeof keys || keys instanceof Code) { - selector.group.$keyf = keys instanceof Code - ? keys - : new Code(keys); - } else { - var hash = {}; - keys.forEach(function (key) { - hash[key] = 1; - }); - selector.group.key = hash; - } - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - selector.readConcern = self.s.readConcern; - } - - // Execute command - self.s.db.command(selector, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.retval); - }); - } else { - // Create execution scope - var scope = reduce != null && reduce instanceof Code - ? reduce.scope - : {}; - - scope.ns = self.s.name; - scope.keys = keys; - scope.condition = condition; - scope.initial = initial; - - // Pass in the function text to execute within mongodb. - var groupfn = groupFunction.replace(/ reduce;/, reduce.toString() + ';'); - - self.s.db.eval(new Code(groupfn, scope), function (err, results) { - if (err) return handleCallback(callback, err, null); - handleCallback(callback, null, results.result || results); - }); - } -} - -define.classMethod('group', {callback: true, promise:true}); - -/** - * Functions that are passed as scope args must - * be converted to Code instances. - * @ignore - */ -function processScope (scope) { - if(!isObject(scope)) { - return scope; - } - - var keys = Object.keys(scope); - var i = keys.length; - var key; - var new_scope = {}; - - while (i--) { - key = keys[i]; - if ('function' == typeof scope[key]) { - new_scope[key] = new Code(String(scope[key])); - } else { - new_scope[key] = processScope(scope[key]); - } - } - - return new_scope; -} - -/** - * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection. - * - * @method - * @param {(function|string)} map The mapping function. - * @param {(function|string)} reduce The reduce function. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.out=null] Sets the output target for the map reduce job. *{inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | {reduce:'collectionName'}* - * @param {object} [options.query=null] Query filter object. - * @param {object} [options.sort=null] Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. - * @param {number} [options.limit=null] Number of objects to return from collection. - * @param {boolean} [options.keeptemp=false] Keep temporary data. - * @param {(function|string)} [options.finalize=null] Finalize function. - * @param {object} [options.scope=null] Can pass in variables that can be access from map/reduce/finalize. - * @param {boolean} [options.jsMode=false] It is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X. - * @param {boolean} [options.verbose=false] Provide statistics on job execution time. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~resultCallback} [callback] The command result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.mapReduce = function(map, reduce, options, callback) { - var self = this; - if('function' === typeof options) callback = options, options = {}; - // Out must allways be defined (make sure we don't break weirdly on pre 1.8+ servers) - if(null == options.out) { - throw new Error("the out option parameter must be defined, see mongodb docs for possible values"); - } - - if('function' === typeof map) { - map = map.toString(); - } - - if('function' === typeof reduce) { - reduce = reduce.toString(); - } - - if('function' === typeof options.finalize) { - options.finalize = options.finalize.toString(); - } - - // Execute using callback - if(typeof callback == 'function') return mapReduce(self, map, reduce, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - mapReduce(self, map, reduce, options, function(err, r, r1) { - if(err) return reject(err); - if(r instanceof Collection) return resolve(r); - resolve({results: r, stats: r1}); - }); - }); -} - -var mapReduce = function(self, map, reduce, options, callback) { - var mapCommandHash = { - mapreduce: self.s.name - , map: map - , reduce: reduce - }; - - // Add any other options passed in - for(var n in options) { - if('scope' == n) { - mapCommandHash[n] = processScope(options[n]); - } else { - mapCommandHash[n] = options[n]; - } - } - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // If we have a read preference and inline is not set as output fail hard - if((options.readPreference != false && options.readPreference != 'primary') - && options['out'] && (options['out'].inline != 1 && options['out'] != 'inline')) { - options.readPreference = 'primary'; - } else if(self.s.readConcern) { - mapCommandHash.readConcern = self.s.readConcern; - } - - // Is bypassDocumentValidation specified - if(typeof options.bypassDocumentValidation == 'boolean') { - mapCommandHash.bypassDocumentValidation = options.bypassDocumentValidation; - } - - // Execute command - self.s.db.command(mapCommandHash, {readPreference:options.readPreference}, function (err, result) { - if(err) return handleCallback(callback, err); - // Check if we have an error - if(1 != result.ok || result.err || result.errmsg) { - return handleCallback(callback, toError(result)); - } - - // Create statistics value - var stats = {}; - if(result.timeMillis) stats['processtime'] = result.timeMillis; - if(result.counts) stats['counts'] = result.counts; - if(result.timing) stats['timing'] = result.timing; - - // invoked with inline? - if(result.results) { - // If we wish for no verbosity - if(options['verbose'] == null || !options['verbose']) { - return handleCallback(callback, null, result.results); - } - - return handleCallback(callback, null, result.results, stats); - } - - // The returned collection - var collection = null; - - // If we have an object it's a different db - if(result.result != null && typeof result.result == 'object') { - var doc = result.result; - collection = self.s.db.db(doc.db).collection(doc.collection); - } else { - // Create a collection object that wraps the result collection - collection = self.s.db.collection(result.result) - } - - // If we wish for no verbosity - if(options['verbose'] == null || !options['verbose']) { - return handleCallback(callback, err, collection); - } - - // Return stats as third set of values - handleCallback(callback, err, collection, stats); - }); -} - -define.classMethod('mapReduce', {callback: true, promise:true}); - -/** - * Initiate a Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @return {UnorderedBulkOperation} - */ -Collection.prototype.initializeUnorderedBulkOp = function(options) { - options = options || {}; - options.promiseLibrary = this.s.promiseLibrary; - return unordered(this.s.topology, this, options); -} - -define.classMethod('initializeUnorderedBulkOp', {callback: false, promise:false, returns: [ordered.UnorderedBulkOperation]}); - -/** - * Initiate an In order bulk write operation, operations will be serially executed in the order they are added, creating a new operation for each switch in types. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {OrderedBulkOperation} callback The command result callback - * @return {null} - */ -Collection.prototype.initializeOrderedBulkOp = function(options) { - options = options || {}; - options.promiseLibrary = this.s.promiseLibrary; - return ordered(this.s.topology, this, options); -} - -define.classMethod('initializeOrderedBulkOp', {callback: false, promise:false, returns: [ordered.OrderedBulkOperation]}); - -// Get write concern -var writeConcern = function(target, db, col, options) { - if(options.w != null || options.j != null || options.fsync != null) { - var opts = {}; - if(options.w != null) opts.w = options.w; - if(options.wtimeout != null) opts.wtimeout = options.wtimeout; - if(options.j != null) opts.j = options.j; - if(options.fsync != null) opts.fsync = options.fsync; - target.writeConcern = opts; - } else if(col.writeConcern.w != null || col.writeConcern.j != null || col.writeConcern.fsync != null) { - target.writeConcern = col.writeConcern; - } else if(db.writeConcern.w != null || db.writeConcern.j != null || db.writeConcern.fsync != null) { - target.writeConcern = db.writeConcern; - } - - return target -} - -// Figure out the read preference -var getReadPreference = function(self, options, db, coll) { - var r = null - if(options.readPreference) { - r = options.readPreference - } else if(self.s.readPreference) { - r = self.s.readPreference - } else if(db.readPreference) { - r = db.readPreference; - } - - if(r instanceof ReadPreference) { - options.readPreference = new CoreReadPreference(r.mode, r.tags); - } else if(typeof r == 'string') { - options.readPreference = new CoreReadPreference(r); - } - - return options; -} - -var testForFields = { - limit: 1, sort: 1, fields:1, skip: 1, hint: 1, explain: 1, snapshot: 1, timeout: 1, tailable: 1, tailableRetryInterval: 1 - , numberOfRetries: 1, awaitdata: 1, awaitData: 1, exhaust: 1, batchSize: 1, returnKey: 1, maxScan: 1, min: 1, max: 1, showDiskLoc: 1 - , comment: 1, raw: 1, readPreference: 1, partial: 1, read: 1, dbName: 1, oplogReplay: 1, connection: 1, maxTimeMS: 1, transforms: 1 -} - -module.exports = Collection; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js deleted file mode 100644 index 37df593b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js +++ /dev/null @@ -1,296 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , toError = require('./utils').toError - , getSingleProperty = require('./utils').getSingleProperty - , formattedOrderClause = require('./utils').formattedOrderClause - , handleCallback = require('./utils').handleCallback - , Logger = require('mongodb-core').Logger - , EventEmitter = require('events').EventEmitter - , ReadPreference = require('./read_preference') - , MongoError = require('mongodb-core').MongoError - , Readable = require('stream').Readable || require('readable-stream').Readable - , Define = require('./metadata') - , CoreCursor = require('./cursor') - , Query = require('mongodb-core').Query - , CoreReadPreference = require('mongodb-core').ReadPreference; - -/** - * @fileOverview The **CommandCursor** class is an internal class that embodies a - * generalized cursor based on a MongoDB command allowing for iteration over the - * results returned. It supports one by one document iteration, conversion to an - * array or can be iterated as a Node 0.10.X or higher stream - * - * **CommandCursor Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('listCollectionsExample1'); - * // Insert a bunch of documents - * col.insert([{a:1, b:1} - * , {a:2, b:2}, {a:3, b:3} - * , {a:4, b:4}], {w:1}, function(err, result) { - * test.equal(null, err); - * - * // List the database collections available - * db.listCollections().toArray(function(err, items) { - * test.equal(null, err); - * db.close(); - * }); - * }); - * }); - */ - -/** - * Namespace provided by the browser. - * @external Readable - */ - -/** - * Creates a new Command Cursor instance (INTERNAL TYPE, do not instantiate directly) - * @class CommandCursor - * @extends external:Readable - * @fires CommandCursor#data - * @fires CommandCursor#end - * @fires CommandCursor#close - * @fires CommandCursor#readable - * @return {CommandCursor} an CommandCursor instance. - */ -var CommandCursor = function(bson, ns, cmd, options, topology, topologyOptions) { - CoreCursor.apply(this, Array.prototype.slice.call(arguments, 0)); - var self = this; - var state = CommandCursor.INIT; - var streamOptions = {}; - - // MaxTimeMS - var maxTimeMS = null; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set up - Readable.call(this, {objectMode: true}); - - // Internal state - this.s = { - // MaxTimeMS - maxTimeMS: maxTimeMS - // State - , state: state - // Stream options - , streamOptions: streamOptions - // BSON - , bson: bson - // Namespae - , ns: ns - // Command - , cmd: cmd - // Options - , options: options - // Topology - , topology: topology - // Topology Options - , topologyOptions: topologyOptions - // Promise library - , promiseLibrary: promiseLibrary - } -} - -/** - * CommandCursor stream data event, fired for each document in the cursor. - * - * @event CommandCursor#data - * @type {object} - */ - -/** - * CommandCursor stream end event - * - * @event CommandCursor#end - * @type {null} - */ - -/** - * CommandCursor stream close event - * - * @event CommandCursor#close - * @type {null} - */ - -/** - * CommandCursor stream readable event - * - * @event CommandCursor#readable - * @type {null} - */ - -// Inherit from Readable -inherits(CommandCursor, Readable); - -// Set the methods to inherit from prototype -var methodsToInherit = ['_next', 'next', 'each', 'forEach', 'toArray' - , 'rewind', 'bufferedCount', 'readBufferedDocuments', 'close', 'isClosed', 'kill' - , '_find', '_getmore', '_killcursor', 'isDead', 'explain', 'isNotified', 'isKilled']; - -// Only inherit the types we need -for(var i = 0; i < methodsToInherit.length; i++) { - CommandCursor.prototype[methodsToInherit[i]] = CoreCursor.prototype[methodsToInherit[i]]; -} - -var define = CommandCursor.define = new Define('CommandCursor', CommandCursor, true); - -/** - * Set the batch size for the cursor. - * @method - * @param {number} value The batchSize for the cursor. - * @throws {MongoError} - * @return {CommandCursor} - */ -CommandCursor.prototype.batchSize = function(value) { - if(this.s.state == CommandCursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "batchSize requires an integer", driver:true}); - if(this.s.cmd.cursor) this.s.cmd.cursor.batchSize = value; - this.setCursorBatchSize(value); - return this; -} - -define.classMethod('batchSize', {callback: false, promise:false, returns: [CommandCursor]}); - -/** - * Add a maxTimeMS stage to the aggregation pipeline - * @method - * @param {number} value The state maxTimeMS value. - * @return {CommandCursor} - */ -CommandCursor.prototype.maxTimeMS = function(value) { - if(this.s.topology.lastIsMaster().minWireVersion > 2) { - this.s.cmd.maxTimeMS = value; - } - return this; -} - -define.classMethod('maxTimeMS', {callback: false, promise:false, returns: [CommandCursor]}); - -CommandCursor.prototype.get = CommandCursor.prototype.toArray; - -define.classMethod('get', {callback: true, promise:false}); - -// Inherited methods -define.classMethod('toArray', {callback: true, promise:true}); -define.classMethod('each', {callback: true, promise:false}); -define.classMethod('forEach', {callback: true, promise:false}); -define.classMethod('next', {callback: true, promise:true}); -define.classMethod('close', {callback: true, promise:true}); -define.classMethod('isClosed', {callback: false, promise:false, returns: [Boolean]}); -define.classMethod('rewind', {callback: false, promise:false}); -define.classMethod('bufferedCount', {callback: false, promise:false, returns: [Number]}); -define.classMethod('readBufferedDocuments', {callback: false, promise:false, returns: [Array]}); - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @function CommandCursor.prototype.next - * @param {CommandCursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback CommandCursor~toArrayResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object[]} documents All the documents the satisfy the cursor. - */ - -/** - * Returns an array of documents. The caller is responsible for making sure that there - * is enough memory to store the results. Note that the array only contain partial - * results when this cursor had been previouly accessed. - * @method CommandCursor.prototype.toArray - * @param {CommandCursor~toArrayResultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback CommandCursor~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {(object|null)} result The result object if the command was executed successfully. - */ - -/** - * Iterates over all the documents for this cursor. As with **{cursor.toArray}**, - * not all of the elements will be iterated if this cursor had been previouly accessed. - * In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike - * **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements - * at any given time if batch size is specified. Otherwise, the caller is responsible - * for making sure that the entire result can fit the memory. - * @method CommandCursor.prototype.each - * @param {CommandCursor~resultCallback} callback The result callback. - * @throws {MongoError} - * @return {null} - */ - -/** - * Close the cursor, sending a KillCursor command and emitting close. - * @method CommandCursor.prototype.close - * @param {CommandCursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ - -/** - * Is the cursor closed - * @method CommandCursor.prototype.isClosed - * @return {boolean} - */ - -/** - * Clone the cursor - * @function CommandCursor.prototype.clone - * @return {CommandCursor} - */ - -/** - * Resets the cursor - * @function CommandCursor.prototype.rewind - * @return {CommandCursor} - */ - -/** - * The callback format for the forEach iterator method - * @callback CommandCursor~iteratorCallback - * @param {Object} doc An emitted document for the iterator - */ - -/** - * The callback error format for the forEach iterator method - * @callback CommandCursor~endCallback - * @param {MongoError} error An error instance representing the error during the execution. - */ - -/* - * Iterates over all the documents for this cursor using the iterator, callback pattern. - * @method CommandCursor.prototype.forEach - * @param {CommandCursor~iteratorCallback} iterator The iteration callback. - * @param {CommandCursor~endCallback} callback The end callback. - * @throws {MongoError} - * @return {null} - */ - -CommandCursor.INIT = 0; -CommandCursor.OPEN = 1; -CommandCursor.CLOSED = 2; - -module.exports = CommandCursor; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/cursor.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/cursor.js deleted file mode 100644 index 7a35b8df..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/cursor.js +++ /dev/null @@ -1,1177 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , toError = require('./utils').toError - , getSingleProperty = require('./utils').getSingleProperty - , formattedOrderClause = require('./utils').formattedOrderClause - , handleCallback = require('./utils').handleCallback - , Logger = require('mongodb-core').Logger - , EventEmitter = require('events').EventEmitter - , ReadPreference = require('./read_preference') - , MongoError = require('mongodb-core').MongoError - , Readable = require('stream').Readable || require('readable-stream').Readable - , Define = require('./metadata') - , CoreCursor = require('mongodb-core').Cursor - , Map = require('mongodb-core').BSON.Map - , Query = require('mongodb-core').Query - , CoreReadPreference = require('mongodb-core').ReadPreference; - -/** - * @fileOverview The **Cursor** class is an internal class that embodies a cursor on MongoDB - * allowing for iteration over the results returned from the underlying query. It supports - * one by one document iteration, conversion to an array or can be iterated as a Node 0.10.X - * or higher stream - * - * **CURSORS Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('createIndexExample1'); - * // Insert a bunch of documents - * col.insert([{a:1, b:1} - * , {a:2, b:2}, {a:3, b:3} - * , {a:4, b:4}], {w:1}, function(err, result) { - * test.equal(null, err); - * - * // Show that duplicate records got dropped - * col.find({}).toArray(function(err, items) { - * test.equal(null, err); - * test.equal(4, items.length); - * db.close(); - * }); - * }); - * }); - */ - -/** - * Namespace provided by the mongodb-core and node.js - * @external CoreCursor - * @external Readable - */ - -// Flags allowed for cursor -var flags = ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'exhaust', 'partial']; -var fields = ['numberOfRetries', 'tailableRetryInterval']; - -/** - * Creates a new Cursor instance (INTERNAL TYPE, do not instantiate directly) - * @class Cursor - * @extends external:CoreCursor - * @extends external:Readable - * @property {string} sortValue Cursor query sort setting. - * @property {boolean} timeout Is Cursor able to time out. - * @property {ReadPreference} readPreference Get cursor ReadPreference. - * @fires Cursor#data - * @fires Cursor#end - * @fires Cursor#close - * @fires Cursor#readable - * @return {Cursor} a Cursor instance. - * @example - * Cursor cursor options. - * - * collection.find({}).project({a:1}) // Create a projection of field a - * collection.find({}).skip(1).limit(10) // Skip 1 and limit 10 - * collection.find({}).batchSize(5) // Set batchSize on cursor to 5 - * collection.find({}).filter({a:1}) // Set query on the cursor - * collection.find({}).comment('add a comment') // Add a comment to the query, allowing to correlate queries - * collection.find({}).addCursorFlag('tailable', true) // Set cursor as tailable - * collection.find({}).addCursorFlag('oplogReplay', true) // Set cursor as oplogReplay - * collection.find({}).addCursorFlag('noCursorTimeout', true) // Set cursor as noCursorTimeout - * collection.find({}).addCursorFlag('awaitData', true) // Set cursor as awaitData - * collection.find({}).addCursorFlag('exhaust', true) // Set cursor as exhaust - * collection.find({}).addCursorFlag('partial', true) // Set cursor as partial - * collection.find({}).addQueryModifier('$orderby', {a:1}) // Set $orderby {a:1} - * collection.find({}).max(10) // Set the cursor maxScan - * collection.find({}).maxScan(10) // Set the cursor maxScan - * collection.find({}).maxTimeMS(1000) // Set the cursor maxTimeMS - * collection.find({}).min(100) // Set the cursor min - * collection.find({}).returnKey(10) // Set the cursor returnKey - * collection.find({}).setReadPreference(ReadPreference.PRIMARY) // Set the cursor readPreference - * collection.find({}).showRecordId(true) // Set the cursor showRecordId - * collection.find({}).snapshot(true) // Set the cursor snapshot - * collection.find({}).sort([['a', 1]]) // Sets the sort order of the cursor query - * collection.find({}).hint('a_1') // Set the cursor hint - * - * All options are chainable, so one can do the following. - * - * collection.find({}).maxTimeMS(1000).maxScan(100).skip(1).toArray(..) - */ -var Cursor = function(bson, ns, cmd, options, topology, topologyOptions) { - CoreCursor.apply(this, Array.prototype.slice.call(arguments, 0)); - var self = this; - var state = Cursor.INIT; - var streamOptions = {}; - - // Tailable cursor options - var numberOfRetries = options.numberOfRetries || 5; - var tailableRetryInterval = options.tailableRetryInterval || 500; - var currentNumberOfRetries = numberOfRetries; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set up - Readable.call(this, {objectMode: true}); - - // Internal cursor state - this.s = { - // Tailable cursor options - numberOfRetries: numberOfRetries - , tailableRetryInterval: tailableRetryInterval - , currentNumberOfRetries: currentNumberOfRetries - // State - , state: state - // Stream options - , streamOptions: streamOptions - // BSON - , bson: bson - // Namespace - , ns: ns - // Command - , cmd: cmd - // Options - , options: options - // Topology - , topology: topology - // Topology options - , topologyOptions: topologyOptions - // Promise library - , promiseLibrary: promiseLibrary - // Current doc - , currentDoc: null - } - - // Legacy fields - this.timeout = self.s.options.noCursorTimeout == true; - this.sortValue = self.s.cmd.sort; - this.readPreference = self.s.options.readPreference; -} - -/** - * Cursor stream data event, fired for each document in the cursor. - * - * @event Cursor#data - * @type {object} - */ - -/** - * Cursor stream end event - * - * @event Cursor#end - * @type {null} - */ - -/** - * Cursor stream close event - * - * @event Cursor#close - * @type {null} - */ - -/** - * Cursor stream readable event - * - * @event Cursor#readable - * @type {null} - */ - -// Inherit from Readable -inherits(Cursor, Readable); - -// Map core cursor _next method so we can apply mapping -CoreCursor.prototype._next = CoreCursor.prototype.next; - -for(var name in CoreCursor.prototype) { - Cursor.prototype[name] = CoreCursor.prototype[name]; -} - -var define = Cursor.define = new Define('Cursor', Cursor, true); - -/** - * Check if there is any document still available in the cursor - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.hasNext = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') { - if(self.s.currentDoc){ - return callback(null, true); - } else { - return nextObject(self, function(err, doc) { - if(!doc) return callback(null, false); - self.s.currentDoc = doc; - callback(null, true); - }); - } - } - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - if(self.s.currentDoc){ - resolve(true); - } else { - nextObject(self, function(err, doc) { - if(self.s.state == Cursor.CLOSED || self.isDead()) return resolve(false); - if(err) return reject(err); - if(!doc) return resolve(false); - self.s.currentDoc = doc; - resolve(true); - }); - } - }); -} - -define.classMethod('hasNext', {callback: true, promise:true}); - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.next = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') { - // Return the currentDoc if someone called hasNext first - if(self.s.currentDoc) { - var doc = self.s.currentDoc; - self.s.currentDoc = null; - return callback(null, doc); - } - - // Return the next object - return nextObject(self, callback) - }; - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - // Return the currentDoc if someone called hasNext first - if(self.s.currentDoc) { - var doc = self.s.currentDoc; - self.s.currentDoc = null; - return resolve(doc); - } - - nextObject(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('next', {callback: true, promise:true}); - -/** - * Set the cursor query - * @method - * @param {object} filter The filter object used for the cursor. - * @return {Cursor} - */ -Cursor.prototype.filter = function(filter) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.query = filter; - return this; -} - -define.classMethod('filter', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor maxScan - * @method - * @param {object} maxScan Constrains the query to only scan the specified number of documents when fulfilling the query - * @return {Cursor} - */ -Cursor.prototype.maxScan = function(maxScan) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.maxScan = maxScan; - return this; -} - -define.classMethod('maxScan', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor hint - * @method - * @param {object} hint If specified, then the query system will only consider plans using the hinted index. - * @return {Cursor} - */ -Cursor.prototype.hint = function(hint) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.hint = hint; - return this; -} - -define.classMethod('hint', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor min - * @method - * @param {object} min Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order. - * @return {Cursor} - */ -Cursor.prototype.min = function(min) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.min = min; - return this; -} - -define.classMethod('min', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor max - * @method - * @param {object} max Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order. - * @return {Cursor} - */ -Cursor.prototype.max = function(max) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.max = max; - return this; -} - -define.classMethod('max', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor returnKey - * @method - * @param {object} returnKey Only return the index field or fields for the results of the query. If $returnKey is set to true and the query does not use an index to perform the read operation, the returned documents will not contain any fields. Use one of the following forms: - * @return {Cursor} - */ -Cursor.prototype.returnKey = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.returnKey = value; - return this; -} - -define.classMethod('returnKey', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor showRecordId - * @method - * @param {object} showRecordId The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find. - * @return {Cursor} - */ -Cursor.prototype.showRecordId = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.showDiskLoc = value; - return this; -} - -define.classMethod('showRecordId', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor snapshot - * @method - * @param {object} snapshot The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document. - * @return {Cursor} - */ -Cursor.prototype.snapshot = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.snapshot = value; - return this; -} - -define.classMethod('snapshot', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set a node.js specific cursor option - * @method - * @param {string} field The cursor option to set ['numberOfRetries', 'tailableRetryInterval']. - * @param {object} value The field value. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.setCursorOption = function(field, value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(fields.indexOf(field) == -1) throw MongoError.create({message: f("option %s not a supported option %s", field, fields), driver:true }); - this.s[field] = value; - if(field == 'numberOfRetries') - this.s.currentNumberOfRetries = value; - return this; -} - -define.classMethod('setCursorOption', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Add a cursor flag to the cursor - * @method - * @param {string} flag The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'exhaust', 'partial']. - * @param {boolean} value The flag boolean value. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.addCursorFlag = function(flag, value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(flags.indexOf(flag) == -1) throw MongoError.create({message: f("flag %s not a supported flag %s", flag, flags), driver:true }); - if(typeof value != 'boolean') throw MongoError.create({message: f("flag %s must be a boolean value", flag), driver:true}); - this.s.cmd[flag] = value; - return this; -} - -define.classMethod('addCursorFlag', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Add a query modifier to the cursor query - * @method - * @param {string} name The query modifier (must start with $, such as $orderby etc) - * @param {boolean} value The flag boolean value. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.addQueryModifier = function(name, value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(name[0] != '$') throw MongoError.create({message: f("%s is not a valid query modifier"), driver:true}); - // Strip of the $ - var field = name.substr(1); - // Set on the command - this.s.cmd[field] = value; - // Deal with the special case for sort - if(field == 'orderby') this.s.cmd.sort = this.s.cmd[field]; - return this; -} - -define.classMethod('addQueryModifier', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Add a comment to the cursor query allowing for tracking the comment in the log. - * @method - * @param {string} value The comment attached to this query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.comment = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.comment = value; - return this; -} - -define.classMethod('comment', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher) - * @method - * @param {number} value Number of milliseconds to wait before aborting the query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.maxTimeMS = function(value) { - if(typeof value != 'number') throw MongoError.create({message: "maxTimeMS must be a number", driver:true}); - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.maxTimeMS = value; - return this; -} - -define.classMethod('maxTimeMS', {callback: false, promise:false, returns: [Cursor]}); - -Cursor.prototype.maxTimeMs = Cursor.prototype.maxTimeMS; - -define.classMethod('maxTimeMs', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Sets a field projection for the query. - * @method - * @param {object} value The field projection object. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.project = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.fields = value; - return this; -} - -define.classMethod('project', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Sets the sort order of the cursor query. - * @method - * @param {(string|array|object)} keyOrList The key or keys set for the sort. - * @param {number} [direction] The direction of the sorting (1 or -1). - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.sort = function(keyOrList, direction) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support sorting", driver:true}); - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - var order = keyOrList; - - // We have an array of arrays, we need to preserve the order of the sort - // so we will us a Map - if(Array.isArray(order) && Array.isArray(order[0])) { - // console.log("------------------------------------------------") - // console.dir(order) - // console.dir(order) - order = new Map(order.map(function(x) { - // console.dir("--------------------------------------- x") - // console.dir(x) - var value = [x[0], null]; - if(x[1] == 'asc') { - value[1] = 1; - } else if(x[1] == 'desc') { - value[1] = -1; - } else if(x[1] == 1 || x[1] == -1) { - value[1] = x[1]; - } else { - throw new MongoError("Illegal sort clause, must be of the form [['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]"); - } - - return value; - })); - - // console.log("=============================== MAP") - // console.dir(order) - } - - if(direction != null) { - order = [[keyOrList, direction]]; - } - - this.s.cmd.sort = order; - this.sortValue = order; - return this; -} - -define.classMethod('sort', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the batch size for the cursor. - * @method - * @param {number} value The batchSize for the cursor. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.batchSize = function(value) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support batchSize", driver:true}); - if(this.s.state == Cursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "batchSize requires an integer", driver:true}); - this.s.cmd.batchSize = value; - this.setCursorBatchSize(value); - return this; -} - -define.classMethod('batchSize', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the limit for the cursor. - * @method - * @param {number} value The limit for the cursor query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.limit = function(value) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support limit", driver:true}); - if(this.s.state == Cursor.OPEN || this.s.state == Cursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "limit requires an integer", driver:true}); - this.s.cmd.limit = value; - // this.cursorLimit = value; - this.setCursorLimit(value); - return this; -} - -define.classMethod('limit', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the skip for the cursor. - * @method - * @param {number} value The skip for the cursor query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.skip = function(value) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support skip", driver:true}); - if(this.s.state == Cursor.OPEN || this.s.state == Cursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "skip requires an integer", driver:true}); - this.s.cmd.skip = value; - this.setCursorSkip(value); - return this; -} - -define.classMethod('skip', {callback: false, promise:false, returns: [Cursor]}); - -/** - * The callback format for results - * @callback Cursor~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {(object|null|boolean)} result The result object if the command was executed successfully. - */ - -/** - * Clone the cursor - * @function external:CoreCursor#clone - * @return {Cursor} - */ - -/** - * Resets the cursor - * @function external:CoreCursor#rewind - * @return {null} - */ - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @deprecated - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.nextObject = Cursor.prototype.next; - -var nextObject = function(self, callback) { - if(self.s.state == Cursor.CLOSED || self.isDead()) return handleCallback(callback, MongoError.create({message: "Cursor is closed", driver:true})); - if(self.s.state == Cursor.INIT && self.s.cmd.sort) { - try { - self.s.cmd.sort = formattedOrderClause(self.s.cmd.sort); - } catch(err) { - return handleCallback(callback, err); - } - } - - // Get the next object - self._next(function(err, doc) { - if(err && err.tailable && self.s.currentNumberOfRetries == 0) return callback(err); - if(err && err.tailable && self.s.currentNumberOfRetries > 0) { - self.s.currentNumberOfRetries = self.s.currentNumberOfRetries - 1; - - return setTimeout(function() { - // Rewind the cursor only when it has not actually read any documents yet - if(self.cursorState.currentLimit == 0) self.rewind(); - // Read the next document, forcing a re-issue of query if no cursorId exists - self.nextObject(callback); - }, self.s.tailableRetryInterval); - } - - self.s.state = Cursor.OPEN; - if(err) return handleCallback(callback, err); - handleCallback(callback, null, doc); - }); -} - -define.classMethod('nextObject', {callback: true, promise:true}); - -// Trampoline emptying the number of retrieved items -// without incurring a nextTick operation -var loop = function(self, callback) { - // No more items we are done - if(self.bufferedCount() == 0) return; - // Get the next document - self._next(callback); - // Loop - return loop; -} - -Cursor.prototype.next = Cursor.prototype.nextObject; - -define.classMethod('next', {callback: true, promise:true}); - -/** - * Iterates over all the documents for this cursor. As with **{cursor.toArray}**, - * not all of the elements will be iterated if this cursor had been previouly accessed. - * In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike - * **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements - * at any given time if batch size is specified. Otherwise, the caller is responsible - * for making sure that the entire result can fit the memory. - * @method - * @deprecated - * @param {Cursor~resultCallback} callback The result callback. - * @throws {MongoError} - * @return {null} - */ -Cursor.prototype.each = function(callback) { - // Rewind cursor state - this.rewind(); - // Set current cursor to INIT - this.s.state = Cursor.INIT; - // Run the query - _each(this, callback); -}; - -define.classMethod('each', {callback: true, promise:false}); - -// Run the each loop -var _each = function(self, callback) { - if(!callback) throw MongoError.create({message: 'callback is mandatory', driver:true}); - if(self.isNotified()) return; - if(self.s.state == Cursor.CLOSED || self.isDead()) { - return handleCallback(callback, MongoError.create({message: "Cursor is closed", driver:true})); - } - - if(self.s.state == Cursor.INIT) self.s.state = Cursor.OPEN; - - // Define function to avoid global scope escape - var fn = null; - // Trampoline all the entries - if(self.bufferedCount() > 0) { - while(fn = loop(self, callback)) fn(self, callback); - _each(self, callback); - } else { - self.next(function(err, item) { - if(err) return handleCallback(callback, err); - if(item == null) { - self.s.state = Cursor.CLOSED; - return handleCallback(callback, null, null); - } - - if(handleCallback(callback, null, item) == false) return; - _each(self, callback); - }) - } -} - -/** - * The callback format for the forEach iterator method - * @callback Cursor~iteratorCallback - * @param {Object} doc An emitted document for the iterator - */ - -/** - * The callback error format for the forEach iterator method - * @callback Cursor~endCallback - * @param {MongoError} error An error instance representing the error during the execution. - */ - -/** - * Iterates over all the documents for this cursor using the iterator, callback pattern. - * @method - * @param {Cursor~iteratorCallback} iterator The iteration callback. - * @param {Cursor~endCallback} callback The end callback. - * @throws {MongoError} - * @return {null} - */ -Cursor.prototype.forEach = function(iterator, callback) { - this.each(function(err, doc){ - if(err) { callback(err); return false; } - if(doc != null) { iterator(doc); return true; } - if(doc == null && callback) { - var internalCallback = callback; - callback = null; - internalCallback(null); - return false; - } - }); -} - -define.classMethod('forEach', {callback: true, promise:false}); - -/** - * Set the ReadPreference for the cursor. - * @method - * @param {(string|ReadPreference)} readPreference The new read preference for the cursor. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.setReadPreference = function(r) { - if(this.s.state != Cursor.INIT) throw MongoError.create({message: 'cannot change cursor readPreference after cursor has been accessed', driver:true}); - if(r instanceof ReadPreference) { - this.s.options.readPreference = new CoreReadPreference(r.mode, r.tags); - } else { - this.s.options.readPreference = new CoreReadPreference(r); - } - - return this; -} - -define.classMethod('setReadPreference', {callback: false, promise:false, returns: [Cursor]}); - -/** - * The callback format for results - * @callback Cursor~toArrayResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object[]} documents All the documents the satisfy the cursor. - */ - -/** - * Returns an array of documents. The caller is responsible for making sure that there - * is enough memory to store the results. Note that the array only contain partial - * results when this cursor had been previouly accessed. In that case, - * cursor.rewind() can be used to reset the cursor. - * @method - * @param {Cursor~toArrayResultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.toArray = function(callback) { - var self = this; - if(self.s.options.tailable) throw MongoError.create({message: 'Tailable cursor cannot be converted to array', driver:true}); - - // Execute using callback - if(typeof callback == 'function') return toArray(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - toArray(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var toArray = function(self, callback) { - var items = []; - - // Reset cursor - self.rewind(); - self.s.state = Cursor.INIT; - - // Fetch all the documents - var fetchDocs = function() { - self._next(function(err, doc) { - if(err) return handleCallback(callback, err); - if(doc == null) { - self.s.state = Cursor.CLOSED; - return handleCallback(callback, null, items); - } - - // Add doc to items - items.push(doc) - - // Get all buffered objects - if(self.bufferedCount() > 0) { - var docs = self.readBufferedDocuments(self.bufferedCount()) - - // Transform the doc if transform method added - if(self.s.transforms && typeof self.s.transforms.doc == 'function') { - docs = docs.map(self.s.transforms.doc); - } - - items = items.concat(docs); - } - - // Attempt a fetch - fetchDocs(); - }) - } - - fetchDocs(); -} - -define.classMethod('toArray', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Cursor~countResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {number} count The count of documents. - */ - -/** - * Get the count of documents for this cursor - * @method - * @param {boolean} applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options. - * @param {object} [options=null] Optional settings. - * @param {number} [options.skip=null] The number of documents to skip. - * @param {number} [options.limit=null] The maximum amounts to count before aborting. - * @param {number} [options.maxTimeMS=null] Number of miliseconds to wait before aborting the query. - * @param {string} [options.hint=null] An index name hint for the query. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Cursor~countResultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.count = function(applySkipLimit, opts, callback) { - var self = this; - if(self.s.cmd.query == null) throw MongoError.create({message: "count can only be used with find command", driver:true}); - if(typeof opts == 'function') callback = opts, opts = {}; - opts = opts || {}; - - // Execute using callback - if(typeof callback == 'function') return count(self, applySkipLimit, opts, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - count(self, applySkipLimit, opts, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var count = function(self, applySkipLimit, opts, callback) { - if(typeof applySkipLimit == 'function') { - callback = applySkipLimit; - applySkipLimit = true; - } - - if(applySkipLimit) { - if(typeof self.cursorSkip() == 'number') opts.skip = self.cursorSkip(); - if(typeof self.cursorLimit() == 'number') opts.limit = self.cursorLimit(); - } - - // Command - var delimiter = self.s.ns.indexOf('.'); - - var command = { - 'count': self.s.ns.substr(delimiter+1), 'query': self.s.cmd.query - } - - if(typeof opts.maxTimeMS == 'number') { - command.maxTimeMS = opts.maxTimeMS; - } else if(typeof self.s.maxTimeMS == 'number') { - command.maxTimeMS = self.s.maxTimeMS; - } - - // Get a server - var server = self.s.topology.getServer(opts); - // Get a connection - var connection = self.s.topology.getConnection(opts); - // Get the callbacks - var callbacks = server.getCallbacks(); - - // Merge in any options - if(opts.skip) command.skip = opts.skip; - if(opts.limit) command.limit = opts.limit; - if(self.s.options.hint) command.hint = self.s.options.hint; - - // Build Query object - var query = new Query(self.s.bson, f("%s.$cmd", self.s.ns.substr(0, delimiter)), command, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false - }); - - // Set up callback - callbacks.register(query.requestId, function(err, result) { - if(err) return handleCallback(callback, err); - if(result.documents.length == 1 - && (result.documents[0].errmsg - || result.documents[0].err - || result.documents[0]['$err'])) { - return handleCallback(callback, MongoError.create(result.documents[0])); - } - handleCallback(callback, null, result.documents[0].n); - }); - - // Write the initial command out - connection.write(query.toBin()); -} - -define.classMethod('count', {callback: true, promise:true}); - -/** - * Close the cursor, sending a KillCursor command and emitting close. - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.close = function(callback) { - this.s.state = Cursor.CLOSED; - // Kill the cursor - this.kill(); - // Emit the close event for the cursor - this.emit('close'); - // Callback if provided - if(typeof callback == 'function') return handleCallback(callback, null, this); - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - resolve(); - }); -} - -define.classMethod('close', {callback: true, promise:true}); - -/** - * Map all documents using the provided function - * @method - * @param {function} [transform] The mapping transformation method. - * @return {null} - */ -Cursor.prototype.map = function(transform) { - this.cursorState.transforms = { doc: transform }; - return this; -} - -define.classMethod('map', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Is the cursor closed - * @method - * @return {boolean} - */ -Cursor.prototype.isClosed = function() { - return this.isDead(); -} - -define.classMethod('isClosed', {callback: false, promise:false, returns: [Boolean]}); - -Cursor.prototype.destroy = function(err) { - this.pause(); - this.close(); - if(err) this.emit('error', err); -} - -define.classMethod('destroy', {callback: false, promise:false}); - -/** - * Return a modified Readable stream including a possible transform method. - * @method - * @param {object} [options=null] Optional settings. - * @param {function} [options.transform=null] A transformation method applied to each document emitted by the stream. - * @return {Cursor} - */ -Cursor.prototype.stream = function(options) { - this.s.streamOptions = options || {}; - return this; -} - -define.classMethod('stream', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Execute the explain for the cursor - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.explain = function(callback) { - var self = this; - this.s.cmd.explain = true; - - // Execute using callback - if(typeof callback == 'function') return this._next(callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self._next(function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('explain', {callback: true, promise:true}); - -Cursor.prototype._read = function(n) { - var self = this; - if(self.s.state == Cursor.CLOSED || self.isDead()) { - return self.push(null); - } - - // Get the next item - self.nextObject(function(err, result) { - if(err) { - if(!self.isDead()) self.close(); - if(self.listeners('error') && self.listeners('error').length > 0) { - self.emit('error', err); - } - - // Emit end event - self.emit('end'); - return self.emit('finish'); - } - - // If we provided a transformation method - if(typeof self.s.streamOptions.transform == 'function' && result != null) { - return self.push(self.s.streamOptions.transform(result)); - } - - // If we provided a map function - if(self.cursorState.transforms && typeof self.cursorState.transforms.doc == 'function' && result != null) { - return self.push(self.cursorState.transforms.doc(result)); - } - - // Return the result - self.push(result); - }); -} - -Object.defineProperty(Cursor.prototype, 'namespace', { - enumerable: true, - get: function() { - if (!this || !this.s) { - return null; - } - - // TODO: refactor this logic into core - var ns = this.s.ns || ''; - var firstDot = ns.indexOf('.'); - if (firstDot < 0) { - return { - database: this.s.ns, - collection: '' - }; - } - return { - database: ns.substr(0, firstDot), - collection: ns.substr(firstDot + 1) - }; - } -}); - -/** - * The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null. - * @function external:Readable#read - * @param {number} size Optional argument to specify how much data to read. - * @return {(String | Buffer | null)} - */ - -/** - * Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects. - * @function external:Readable#setEncoding - * @param {string} encoding The encoding to use. - * @return {null} - */ - -/** - * This method will cause the readable stream to resume emitting data events. - * @function external:Readable#resume - * @return {null} - */ - -/** - * This method will cause a stream in flowing-mode to stop emitting data events. Any data that becomes available will remain in the internal buffer. - * @function external:Readable#pause - * @return {null} - */ - -/** - * This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream. - * @function external:Readable#pipe - * @param {Writable} destination The destination for writing data - * @param {object} [options] Pipe options - * @return {null} - */ - -/** - * This method will remove the hooks set up for a previous pipe() call. - * @function external:Readable#unpipe - * @param {Writable} [destination] The destination for writing data - * @return {null} - */ - -/** - * This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party. - * @function external:Readable#unshift - * @param {(Buffer|string)} chunk Chunk of data to unshift onto the read queue. - * @return {null} - */ - -/** - * Versions of Node prior to v0.10 had streams that did not implement the entire Streams API as it is today. (See "Compatibility" below for more information.) - * @function external:Readable#wrap - * @param {Stream} stream An "old style" readable stream. - * @return {null} - */ - -Cursor.INIT = 0; -Cursor.OPEN = 1; -Cursor.CLOSED = 2; -Cursor.GET_MORE = 3; - -module.exports = Cursor; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/db.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/db.js deleted file mode 100644 index 6667297c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/db.js +++ /dev/null @@ -1,1731 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , getSingleProperty = require('./utils').getSingleProperty - , shallowClone = require('./utils').shallowClone - , parseIndexOptions = require('./utils').parseIndexOptions - , debugOptions = require('./utils').debugOptions - , CommandCursor = require('./command_cursor') - , handleCallback = require('./utils').handleCallback - , toError = require('./utils').toError - , ReadPreference = require('./read_preference') - , f = require('util').format - , Admin = require('./admin') - , Code = require('mongodb-core').BSON.Code - , CoreReadPreference = require('mongodb-core').ReadPreference - , MongoError = require('mongodb-core').MongoError - , ObjectID = require('mongodb-core').ObjectID - , Define = require('./metadata') - , Logger = require('mongodb-core').Logger - , Collection = require('./collection') - , crypto = require('crypto'); - -var debugFields = ['authSource', 'w', 'wtimeout', 'j', 'native_parser', 'forceServerObjectId' - , 'serializeFunctions', 'raw', 'promoteLongs', 'bufferMaxEntries', 'numberOfRetries', 'retryMiliSeconds' - , 'readPreference', 'pkFactory']; - -/** - * @fileOverview The **Db** class is a class that represents a MongoDB Database. - * - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Get an additional db - * var testDb = db.db('test'); - * db.close(); - * }); - */ - -/** - * Creates a new Db instance - * @class - * @param {string} databaseName The name of the database this instance represents. - * @param {(Server|ReplSet|Mongos)} topology The server topology for the database. - * @param {object} [options=null] Optional settings. - * @param {string} [options.authSource=null] If the database authentication is dependent on another databaseName. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.native_parser=true] Select C++ bson parser instead of JavaScript parser. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {boolean} [options.raw=false] Return document results as raw BSON buffers. - * @param {boolean} [options.promoteLongs=true] Promotes Long values to number if they fit inside the 53 bits resolution. - * @param {number} [options.bufferMaxEntries=-1] Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection, default is -1 which is unlimited. - * @param {number} [options.numberOfRetries=5] Number of times a tailable cursor will re-poll when it gets nothing back. - * @param {number} [options.retryMiliSeconds=500] Number of milliseconds between retries. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.pkFactory=null] A primary key factory object for generation of custom _id keys. - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {object} [options.readConcern=null] Specify a read concern for the collection. (only MongoDB 3.2 or higher supported) - * @param {object} [options.readConcern.level='local'] Specify a read concern level for the collection operations, one of [local|majority]. (only MongoDB 3.2 or higher supported) - * @property {(Server|ReplSet|Mongos)} serverConfig Get the current db topology. - * @property {number} bufferMaxEntries Current bufferMaxEntries value for the database - * @property {string} databaseName The name of the database this instance represents. - * @property {object} options The options associated with the db instance. - * @property {boolean} native_parser The current value of the parameter native_parser. - * @property {boolean} slaveOk The current slaveOk value for the db instance. - * @property {object} writeConcern The current write concern values. - * @fires Db#close - * @fires Db#authenticated - * @fires Db#reconnect - * @fires Db#error - * @fires Db#timeout - * @fires Db#parseError - * @fires Db#fullsetup - * @return {Db} a Db instance. - */ -var Db = function(databaseName, topology, options) { - options = options || {}; - if(!(this instanceof Db)) return new Db(databaseName, topology, options); - EventEmitter.call(this); - var self = this; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Ensure we put the promiseLib in the options - options.promiseLibrary = promiseLibrary; - - // var self = this; // Internal state of the db object - this.s = { - // Database name - databaseName: databaseName - // DbCache - , dbCache: {} - // Children db's - , children: [] - // Topology - , topology: topology - // Options - , options: options - // Logger instance - , logger: Logger('Db', options) - // Get the bson parser - , bson: topology ? topology.bson : null - // Authsource if any - , authSource: options.authSource - // Unpack read preference - , readPreference: options.readPreference - // Set buffermaxEntries - , bufferMaxEntries: typeof options.bufferMaxEntries == 'number' ? options.bufferMaxEntries : -1 - // Parent db (if chained) - , parentDb: options.parentDb || null - // Set up the primary key factory or fallback to ObjectID - , pkFactory: options.pkFactory || ObjectID - // Get native parser - , nativeParser: options.nativeParser || options.native_parser - // Promise library - , promiseLibrary: promiseLibrary - // No listener - , noListener: typeof options.noListener == 'boolean' ? options.noListener : false - // ReadConcern - , readConcern: options.readConcern - } - - // Ensure we have a valid db name - validateDatabaseName(self.s.databaseName); - - // If we have specified the type of parser - if(typeof self.s.nativeParser == 'boolean') { - if(self.s.nativeParser) { - topology.setBSONParserType("c++"); - } else { - topology.setBSONParserType("js"); - } - } - - // Add a read Only property - getSingleProperty(this, 'serverConfig', self.s.topology); - getSingleProperty(this, 'bufferMaxEntries', self.s.bufferMaxEntries); - getSingleProperty(this, 'databaseName', self.s.databaseName); - - // Last ismaster - Object.defineProperty(this, 'options', { - enumerable:true, - get: function() { return self.s.options; } - }); - - // Last ismaster - Object.defineProperty(this, 'native_parser', { - enumerable:true, - get: function() { return self.s.topology.parserType() == 'c++'; } - }); - - // Last ismaster - Object.defineProperty(this, 'slaveOk', { - enumerable:true, - get: function() { - if(self.s.options.readPreference != null - && (self.s.options.readPreference != 'primary' || self.s.options.readPreference.mode != 'primary')) { - return true; - } - return false; - } - }); - - Object.defineProperty(this, 'writeConcern', { - enumerable:true, - get: function() { - var ops = {}; - if(self.s.options.w != null) ops.w = self.s.options.w; - if(self.s.options.j != null) ops.j = self.s.options.j; - if(self.s.options.fsync != null) ops.fsync = self.s.options.fsync; - if(self.s.options.wtimeout != null) ops.wtimeout = self.s.options.wtimeout; - return ops; - } - }); - - // This is a child db, do not register any listeners - if(options.parentDb) return; - if(this.s.noListener) return; - - // Add listeners - topology.on('error', createListener(self, 'error', self)); - topology.on('timeout', createListener(self, 'timeout', self)); - topology.on('close', createListener(self, 'close', self)); - topology.on('parseError', createListener(self, 'parseError', self)); - topology.once('open', createListener(self, 'open', self)); - topology.once('fullsetup', createListener(self, 'fullsetup', self)); - topology.once('all', createListener(self, 'all', self)); - topology.on('reconnect', createListener(self, 'reconnect', self)); -} - -inherits(Db, EventEmitter); - -var define = Db.define = new Define('Db', Db, false); - -/** - * The callback format for the Db.open method - * @callback Db~openCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Db} db The Db instance if the open method was successful. - */ - -// Internal method -var open = function(self, callback) { - self.s.topology.connect(self, self.s.options, function(err, topology) { - if(callback == null) return; - var internalCallback = callback; - callback == null; - - if(err) { - self.close(); - return internalCallback(err); - } - - internalCallback(null, self); - }); -} - -/** - * Open the database - * @method - * @param {Db~openCallback} [callback] Callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.open = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return open(self, callback); - // Return promise - return new self.s.promiseLibrary(function(resolve, reject) { - open(self, function(err, db) { - if(err) return reject(err); - resolve(db); - }) - }); -} - -define.classMethod('open', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Db~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result object if the command was executed successfully. - */ - -var executeCommand = function(self, command, options, callback) { - var dbName = options.dbName || options.authdb || self.s.databaseName; - // If we have a readPreference set - if(options.readPreference == null && self.s.readPreference) { - options.readPreference = self.s.readPreference; - } - - // Convert the readPreference - if(options.readPreference && typeof options.readPreference == 'string') { - options.readPreference = new CoreReadPreference(options.readPreference); - } else if(options.readPreference instanceof ReadPreference) { - options.readPreference = new CoreReadPreference(options.readPreference.mode - , options.readPreference.tags); - } - - // Debug information - if(self.s.logger.isDebug()) self.s.logger.debug(f('executing command %s against %s with options [%s]' - , JSON.stringify(command), f('%s.$cmd', dbName), JSON.stringify(debugOptions(debugFields, options)))); - - // Execute command - self.s.topology.command(f('%s.$cmd', dbName), command, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.result); - }); -} - -/** - * Execute a command - * @method - * @param {object} command The command hash - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxTimeMS=null] Number of milliseconds to wait before aborting the query. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.command = function(command, options, callback) { - var self = this; - // Change the callback - if(typeof options == 'function') callback = options, options = {}; - // Clone the options - options = shallowClone(options); - - // Do we have a callback - if(typeof callback == 'function') return executeCommand(self, command, options, callback); - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - executeCommand(self, command, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('command', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Db~noResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {null} result Is not set to a value - */ - -/** - * Close the db and it's underlying connections - * @method - * @param {boolean} force Force close, emitting no events - * @param {Db~noResultCallback} [callback] The result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.close = function(force, callback) { - if(typeof force == 'function') callback = force, force = false; - this.s.topology.close(force); - var self = this; - - // Fire close event if any listeners - if(this.listeners('close').length > 0) { - this.emit('close'); - - // If it's the top level db emit close on all children - if(this.parentDb == null) { - // Fire close on all children - for(var i = 0; i < this.s.children.length; i++) { - this.s.children[i].emit('close'); - } - } - - // Remove listeners after emit - self.removeAllListeners('close'); - } - - // Close parent db if set - if(this.s.parentDb) this.s.parentDb.close(); - // Callback after next event loop tick - if(typeof callback == 'function') return process.nextTick(function() { - handleCallback(callback, null); - }) - - // Return dummy promise - return new this.s.promiseLibrary(function(resolve, reject) { - resolve(); - }); -} - -define.classMethod('close', {callback: true, promise:true}); - -/** - * Return the Admin db instance - * @method - * @return {Admin} return the new Admin db instance - */ -Db.prototype.admin = function() { - return new Admin(this, this.s.topology, this.s.promiseLibrary); -}; - -define.classMethod('admin', {callback: false, promise:false, returns: [Admin]}); - -/** - * The callback format for the collection method, must be used if strict is specified - * @callback Db~collectionResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection} collection The collection instance. - */ - -/** - * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can - * can use it without a callback in the following way. var collection = db.collection('mycollection'); - * - * @method - * @param {string} name the collection name we wish to access. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.raw=false] Return document results as raw BSON buffers. - * @param {object} [options.pkFactory=null] A primary key factory object for generation of custom _id keys. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.strict=false] Returns an error if the collection does not exist - * @param {object} [options.readConcern=null] Specify a read concern for the collection. (only MongoDB 3.2 or higher supported) - * @param {object} [options.readConcern.level='local'] Specify a read concern level for the collection operations, one of [local|majority]. (only MongoDB 3.2 or higher supported) - * @param {Db~collectionResultCallback} callback The collection result callback - * @return {Collection} return the new Collection instance if not in strict mode - */ -Db.prototype.collection = function(name, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - options = shallowClone(options); - // Set the promise library - options.promiseLibrary = this.s.promiseLibrary; - - // If we have not set a collection level readConcern set the db level one - options.readConcern = options.readConcern || this.s.readConcern; - - // Do we have ignoreUndefined set - if(this.s.options.ignoreUndefined) { - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute - if(options == null || !options.strict) { - try { - var collection = new Collection(this, this.s.topology, this.s.databaseName, name, this.s.pkFactory, options); - if(callback) callback(null, collection); - return collection; - } catch(err) { - if(callback) return callback(err); - throw err; - } - } - - // Strict mode - if(typeof callback != 'function') { - throw toError(f("A callback is required in strict mode. While getting collection %s.", name)); - } - - // Strict mode - this.listCollections({name:name}).toArray(function(err, collections) { - if(err != null) return handleCallback(callback, err, null); - if(collections.length == 0) return handleCallback(callback, toError(f("Collection %s does not exist. Currently in strict mode.", name)), null); - - try { - return handleCallback(callback, null, new Collection(self, self.s.topology, self.s.databaseName, name, self.s.pkFactory, options)); - } catch(err) { - return handleCallback(callback, err, null); - } - }); -} - -define.classMethod('collection', {callback: true, promise:false, returns: [Collection]}); - -var createCollection = function(self, name, options, callback) { - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self, options); - - // Check if we have the name - self.listCollections({name: name}).toArray(function(err, collections) { - if(err != null) return handleCallback(callback, err, null); - if(collections.length > 0 && finalOptions.strict) { - return handleCallback(callback, MongoError.create({message: f("Collection %s already exists. Currently in strict mode.", name), driver:true}), null); - } else if (collections.length > 0) { - try { return handleCallback(callback, null, new Collection(self, self.s.topology, self.s.databaseName, name, self.s.pkFactory, options)); } - catch(err) { return handleCallback(callback, err); } - } - - // Create collection command - var cmd = {'create':name}; - - // Add all optional parameters - for(var n in options) { - if(options[n] != null && typeof options[n] != 'function') - cmd[n] = options[n]; - } - - // Execute command - self.command(cmd, finalOptions, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, new Collection(self, self.s.topology, self.s.databaseName, name, self.s.pkFactory, options)); - }); - }); -} - -/** - * Creates a collection on a server pre-allocating space, need to create f.ex capped collections. - * - * @method - * @param {string} name the collection name we wish to access. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.raw=false] Return document results as raw BSON buffers. - * @param {object} [options.pkFactory=null] A primary key factory object for generation of custom _id keys. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.strict=false] Returns an error if the collection does not exist - * @param {boolean} [options.capped=false] Create a capped collection. - * @param {number} [options.size=null] The size of the capped collection in bytes. - * @param {number} [options.max=null] The maximum number of documents in the capped collection. - * @param {boolean} [options.autoIndexId=true] Create an index on the _id field of the document, True by default on MongoDB 2.2 or higher off for version < 2.2. - * @param {Db~collectionResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.createCollection = function(name, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - name = args.length ? args.shift() : null; - options = args.length ? args.shift() || {} : {}; - - // Do we have a promisesLibrary - options.promiseLibrary = options.promiseLibrary || this.s.promiseLibrary; - - // Check if the callback is in fact a string - if(typeof callback == 'string') name = callback; - - // Execute the fallback callback - if(typeof callback == 'function') return createCollection(self, name, options, callback); - return new this.s.promiseLibrary(function(resolve, reject) { - createCollection(self, name, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('createCollection', {callback: true, promise:true}); - -/** - * Get all the db statistics. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {number} [options.scale=null] Divide the returned sizes by scale value. - * @param {Db~resultCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.stats = function(options, callback) { - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - // Build command object - var commandObject = { dbStats:true }; - // Check if we have the scale value - if(options['scale'] != null) commandObject['scale'] = options['scale']; - // Execute the command - return this.command(commandObject, options, callback); -} - -define.classMethod('stats', {callback: true, promise:true}); - -// Transformation methods for cursor results -var listCollectionsTranforms = function(databaseName) { - var matching = f('%s.', databaseName); - - return { - doc: function(doc) { - var index = doc.name.indexOf(matching); - // Remove database name if available - if(doc.name && index == 0) { - doc.name = doc.name.substr(index + matching.length); - } - - return doc; - } - } -} - -/** - * Get the list of all collection information for the specified db. - * - * @method - * @param {object} filter Query to filter collections by - * @param {object} [options=null] Optional settings. - * @param {number} [options.batchSize=null] The batchSize for the returned command cursor or if pre 2.8 the systems batch collection - * @return {CommandCursor} - */ -Db.prototype.listCollections = function(filter, options) { - filter = filter || {}; - options = options || {}; - - // Shallow clone the object - options = shallowClone(options); - // Set the promise library - options.promiseLibrary = this.s.promiseLibrary; - - // We have a list collections command - if(this.serverConfig.capabilities().hasListCollectionsCommand) { - // Cursor options - var cursor = options.batchSize ? {batchSize: options.batchSize} : {} - // Build the command - var command = { listCollections : true, filter: filter, cursor: cursor }; - // Set the AggregationCursor constructor - options.cursorFactory = CommandCursor; - // Filter out the correct field values - options.transforms = listCollectionsTranforms(this.s.databaseName); - // Execute the cursor - return this.s.topology.cursor(f('%s.$cmd', this.s.databaseName), command, options); - } - - // We cannot use the listCollectionsCommand - if(!this.serverConfig.capabilities().hasListCollectionsCommand) { - // If we have legacy mode and have not provided a full db name filter it - if(typeof filter.name == 'string' && !(new RegExp('^' + this.databaseName + '\\.').test(filter.name))) { - filter = shallowClone(filter); - filter.name = f('%s.%s', this.s.databaseName, filter.name); - } - } - - // No filter, filter by current database - if(filter == null) { - filter.name = f('/%s/', this.s.databaseName); - } - - // Rewrite the filter to use $and to filter out indexes - if(filter.name) { - filter = {$and: [{name: filter.name}, {name:/^((?!\$).)*$/}]}; - } else { - filter = {name:/^((?!\$).)*$/}; - } - - // Return options - var options = {transforms: listCollectionsTranforms(this.s.databaseName)} - // Get the cursor - var cursor = this.collection(Db.SYSTEM_NAMESPACE_COLLECTION).find(filter, options); - // Set the passed in batch size if one was provided - if(options.batchSize) cursor = cursor.batchSize(options.batchSize); - // We have a fallback mode using legacy systems collections - return cursor; -}; - -define.classMethod('listCollections', {callback: false, promise:false, returns: [CommandCursor]}); - -var evaluate = function(self, code, parameters, options, callback) { - var finalCode = code; - var finalParameters = []; - - // If not a code object translate to one - if(!(finalCode instanceof Code)) finalCode = new Code(finalCode); - // Ensure the parameters are correct - if(parameters != null && !Array.isArray(parameters) && typeof parameters !== 'function') { - finalParameters = [parameters]; - } else if(parameters != null && Array.isArray(parameters) && typeof parameters !== 'function') { - finalParameters = parameters; - } - - // Create execution selector - var cmd = {'$eval':finalCode, 'args':finalParameters}; - // Check if the nolock parameter is passed in - if(options['nolock']) { - cmd['nolock'] = options['nolock']; - } - - // Set primary read preference - options.readPreference = new CoreReadPreference(ReadPreference.PRIMARY); - - // Execute the command - self.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - if(result && result.ok == 1) return handleCallback(callback, null, result.retval); - if(result) return handleCallback(callback, MongoError.create({message: f("eval failed: %s", result.errmsg), driver:true}), null); - handleCallback(callback, err, result); - }); -} - -/** - * Evaluate JavaScript on the server - * - * @method - * @param {Code} code JavaScript to execute on server. - * @param {(object|array)} parameters The parameters for the call. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.nolock=false] Tell MongoDB not to block on the evaulation of the javascript. - * @param {Db~resultCallback} [callback] The results callback - * @deprecated Eval is deprecated on MongoDB 3.2 and forward - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.eval = function(code, parameters, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - parameters = args.length ? args.shift() : parameters; - options = args.length ? args.shift() || {} : {}; - - // Check if the callback is in fact a string - if(typeof callback == 'function') return evaluate(self, code, parameters, options, callback); - // Execute the command - return new this.s.promiseLibrary(function(resolve, reject) { - evaluate(self, code, parameters, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('eval', {callback: true, promise:true}); - -/** - * Rename a collection. - * - * @method - * @param {string} fromCollection Name of current collection to rename. - * @param {string} toCollection New name of of the collection. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.dropTarget=false] Drop the target name collection if it previously exists. - * @param {Db~collectionResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.renameCollection = function(fromCollection, toCollection, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - // Add return new collection - options.new_collection = true; - - // Check if the callback is in fact a string - if(typeof callback == 'function') { - return this.collection(fromCollection).rename(toCollection, options, callback); - } - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.collection(fromCollection).rename(toCollection, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('renameCollection', {callback: true, promise:true}); - -/** - * Drop a collection from the database, removing it permanently. New accesses will create a new collection. - * - * @method - * @param {string} name Name of collection to drop - * @param {Db~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.dropCollection = function(name, callback) { - var self = this; - - // Command to execute - var cmd = {'drop':name} - - // Check if the callback is in fact a string - if(typeof callback == 'function') return this.command(cmd, this.s.options, function(err, result) { - if(err) return handleCallback(callback, err); - if(result.ok) return handleCallback(callback, null, true); - handleCallback(callback, null, false); - }); - - // Execute the command - return new this.s.promiseLibrary(function(resolve, reject) { - // Execute command - self.command(cmd, self.s.options, function(err, result) { - if(err) return reject(err); - if(result.ok) return resolve(true); - resolve(false); - }); - }); -}; - -define.classMethod('dropCollection', {callback: true, promise:true}); - -/** - * Drop a database. - * - * @method - * @param {Db~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.dropDatabase = function(callback) { - var self = this; - // Drop database command - var cmd = {'dropDatabase':1}; - - // Check if the callback is in fact a string - if(typeof callback == 'function') return this.command(cmd, this.s.options, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.ok ? true : false); - }); - - // Execute the command - return new this.s.promiseLibrary(function(resolve, reject) { - // Execute command - self.command(cmd, self.s.options, function(err, result) { - if(err) return reject(err); - if(result.ok) return resolve(true); - resolve(false); - }); - }); -} - -define.classMethod('dropDatabase', {callback: true, promise:true}); - -/** - * The callback format for the collections method. - * @callback Db~collectionsResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection[]} collections An array of all the collections objects for the db instance. - */ -var collections = function(self, callback) { - // Let's get the collection names - self.listCollections().toArray(function(err, documents) { - if(err != null) return handleCallback(callback, err, null); - // Filter collections removing any illegal ones - documents = documents.filter(function(doc) { - return doc.name.indexOf('$') == -1; - }); - - // Return the collection objects - handleCallback(callback, null, documents.map(function(d) { - return new Collection(self, self.s.topology, self.s.databaseName, d.name.replace(self.s.databaseName + ".", ''), self.s.pkFactory, self.s.options); - })); - }); -} - -/** - * Fetch all collections for the current db. - * - * @method - * @param {Db~collectionsResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.collections = function(callback) { - var self = this; - - // Return the callback - if(typeof callback == 'function') return collections(self, callback); - // Return the promise - return new self.s.promiseLibrary(function(resolve, reject) { - collections(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('collections', {callback: true, promise:true}); - -/** - * Runs a command on the database as admin. - * @method - * @param {object} command The command hash - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxTimeMS=null] Number of milliseconds to wait before aborting the query. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.executeDbAdminCommand = function(selector, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - if(options.readPreference) { - options.readPreference = options.readPreference; - } - - // Return the callback - if(typeof callback == 'function') return self.s.topology.command('admin.$cmd', selector, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.result); - }); - - // Return promise - return new self.s.promiseLibrary(function(resolve, reject) { - self.s.topology.command('admin.$cmd', selector, options, function(err, result) { - if(err) return reject(err); - resolve(result.result); - }); - }); -}; - -define.classMethod('executeDbAdminCommand', {callback: true, promise:true}); - -/** - * Creates an index on the db and collection collection. - * @method - * @param {string} name Name of the collection to create the index on. - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.createIndex = function(name, fieldOrSpec, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - options = typeof callback === 'function' ? options : callback; - options = options == null ? {} : options; - // Shallow clone the options - options = shallowClone(options); - // Run only against primary - options.readPreference = ReadPreference.PRIMARY; - - // If we have a callback fallback - if(typeof callback == 'function') return createIndex(self, name, fieldOrSpec, options, callback); - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - createIndex(self, name, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var createIndex = function(self, name, fieldOrSpec, options, callback) { - // Get the write concern options - var finalOptions = writeConcern({}, self, options); - // Ensure we have a callback - if(finalOptions.writeConcern && typeof callback != 'function') { - throw MongoError.create({message: "Cannot use a writeConcern without a provided callback", driver:true}); - } - - // Attempt to run using createIndexes command - createIndexUsingCreateIndexes(self, name, fieldOrSpec, options, function(err, result) { - if(err == null) return handleCallback(callback, err, result); - // Create command - var doc = createCreateIndexCommand(self, name, fieldOrSpec, options); - // Set no key checking - finalOptions.checkKeys = false; - // Insert document - self.s.topology.insert(f("%s.%s", self.s.databaseName, Db.SYSTEM_INDEX_COLLECTION), doc, finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err); - if(result == null) return handleCallback(callback, null, null); - if(result.result.writeErrors) return handleCallback(callback, MongoError.create(result.result.writeErrors[0]), null); - handleCallback(callback, null, doc.name); - }); - }); -} - -define.classMethod('createIndex', {callback: true, promise:true}); - -/** - * Ensures that an index exists, if it does not it creates it - * @method - * @deprecated since version 2.0 - * @param {string} name The index name - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.ensureIndex = function(name, fieldOrSpec, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // If we have a callback fallback - if(typeof callback == 'function') return ensureIndex(self, name, fieldOrSpec, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - ensureIndex(self, name, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var ensureIndex = function(self, name, fieldOrSpec, options, callback) { - // Get the write concern options - var finalOptions = writeConcern({}, self, options); - // Create command - var selector = createCreateIndexCommand(self, name, fieldOrSpec, options); - var index_name = selector.name; - - // Default command options - var commandOptions = {}; - // Check if the index allready exists - self.indexInformation(name, finalOptions, function(err, indexInformation) { - if(err != null && err.code != 26) return handleCallback(callback, err, null); - // If the index does not exist, create it - if(indexInformation == null || !indexInformation[index_name]) { - self.createIndex(name, fieldOrSpec, options, callback); - } else { - if(typeof callback === 'function') return handleCallback(callback, null, index_name); - } - }); -} - -define.classMethod('ensureIndex', {callback: true, promise:true}); - -Db.prototype.addChild = function(db) { - if(this.s.parentDb) return this.s.parentDb.addChild(db); - this.s.children.push(db); -} - -/** - * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are - * related in a parent-child relationship to the original instance so that events are correctly emitted on child - * db instances. Child db instances are cached so performing db('db1') twice will return the same instance. - * You can control these behaviors with the options noListener and returnNonCachedInstance. - * - * @method - * @param {string} name The name of the database we want to use. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.noListener=false] Do not make the db an event listener to the original connection. - * @param {boolean} [options.returnNonCachedInstance=false] Control if you want to return a cached instance or have a new one created - * @return {Db} - */ -Db.prototype.db = function(dbName, options) { - options = options || {}; - // Copy the options and add out internal override of the not shared flag - for(var key in this.options) { - options[key] = this.options[key]; - } - - // Do we have the db in the cache already - if(this.s.dbCache[dbName] && options.returnNonCachedInstance !== true) { - return this.s.dbCache[dbName]; - } - - // Add current db as parentDb - if(options.noListener == null || options.noListener == false) { - options.parentDb = this; - } - - // Add promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - // Return the db object - var db = new Db(dbName, this.s.topology, options) - - // Add as child - if(options.noListener == null || options.noListener == false) { - this.addChild(db); - } - - // Add the db to the cache - this.s.dbCache[dbName] = db; - // Return the database - return db; -}; - -define.classMethod('db', {callback: false, promise:false, returns: [Db]}); - -var _executeAuthCreateUserCommand = function(self, username, password, options, callback) { - // Special case where there is no password ($external users) - if(typeof username == 'string' - && password != null && typeof password == 'object') { - options = password; - password = null; - } - - // Unpack all options - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // Error out if we digestPassword set - if(options.digestPassword != null) { - throw toError("The digestPassword option is not supported via add_user. Please use db.command('createUser', ...) instead for this option."); - } - - // Get additional values - var customData = options.customData != null ? options.customData : {}; - var roles = Array.isArray(options.roles) ? options.roles : []; - var maxTimeMS = typeof options.maxTimeMS == 'number' ? options.maxTimeMS : null; - - // If not roles defined print deprecated message - if(roles.length == 0) { - console.log("Creating a user without roles is deprecated in MongoDB >= 2.6"); - } - - // Get the error options - var commandOptions = {writeCommand:true}; - if(options['dbName']) commandOptions.dbName = options['dbName']; - - // Add maxTimeMS to options if set - if(maxTimeMS != null) commandOptions.maxTimeMS = maxTimeMS; - - // Check the db name and add roles if needed - if((self.databaseName.toLowerCase() == 'admin' || options.dbName == 'admin') && !Array.isArray(options.roles)) { - roles = ['root'] - } else if(!Array.isArray(options.roles)) { - roles = ['dbOwner'] - } - - // Build the command to execute - var command = { - createUser: username - , customData: customData - , roles: roles - , digestPassword:false - } - - // Apply write concern to command - command = writeConcern(command, self, options); - - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var userPassword = md5.digest('hex'); - - // No password - if(typeof password == 'string') { - command.pwd = userPassword; - } - - // Force write using primary - commandOptions.readPreference = CoreReadPreference.primary; - - // Execute the command - self.command(command, commandOptions, function(err, result) { - if(err && err.ok == 0 && err.code == undefined) return handleCallback(callback, {code: -5000}, null); - if(err) return handleCallback(callback, err, null); - handleCallback(callback, !result.ok ? toError(result) : null - , result.ok ? [{user: username, pwd: ''}] : null); - }) -} - -var addUser = function(self, username, password, options, callback) { - // Attempt to execute auth command - _executeAuthCreateUserCommand(self, username, password, options, function(err, r) { - // We need to perform the backward compatible insert operation - if(err && err.code == -5000) { - var finalOptions = writeConcern(shallowClone(options), self, options); - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var userPassword = md5.digest('hex'); - - // If we have another db set - var db = options.dbName ? self.db(options.dbName) : self; - - // Fetch a user collection - var collection = db.collection(Db.SYSTEM_USER_COLLECTION); - - // Check if we are inserting the first user - collection.count({}, function(err, count) { - // We got an error (f.ex not authorized) - if(err != null) return handleCallback(callback, err, null); - // Check if the user exists and update i - collection.find({user: username}, {dbName: options['dbName']}).toArray(function(err, documents) { - // We got an error (f.ex not authorized) - if(err != null) return handleCallback(callback, err, null); - // Add command keys - finalOptions.upsert = true; - - // We have a user, let's update the password or upsert if not - collection.update({user: username},{$set: {user: username, pwd: userPassword}}, finalOptions, function(err, results, full) { - if(count == 0 && err) return handleCallback(callback, null, [{user:username, pwd:userPassword}]); - if(err) return handleCallback(callback, err, null) - handleCallback(callback, null, [{user:username, pwd:userPassword}]); - }); - }); - }); - - return; - } - - if(err) return handleCallback(callback, err); - handleCallback(callback, err, r); - }); -} - -/** - * Add a user to the database. - * @method - * @param {string} username The username. - * @param {string} password The password. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {object} [options.customData=null] Custom data associated with the user (only Mongodb 2.6 or higher) - * @param {object[]} [options.roles=null] Roles associated with the created user (only Mongodb 2.6 or higher) - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.addUser = function(username, password, options, callback) { - // Unpack the parameters - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // If we have a callback fallback - if(typeof callback == 'function') return addUser(self, username, password, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - addUser(self, username, password, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('addUser', {callback: true, promise:true}); - -var _executeAuthRemoveUserCommand = function(self, username, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - // Get the error options - var commandOptions = {writeCommand:true}; - if(options['dbName']) commandOptions.dbName = options['dbName']; - - // Get additional values - var maxTimeMS = typeof options.maxTimeMS == 'number' ? options.maxTimeMS : null; - - // Add maxTimeMS to options if set - if(maxTimeMS != null) commandOptions.maxTimeMS = maxTimeMS; - - // Build the command to execute - var command = { - dropUser: username - } - - // Apply write concern to command - command = writeConcern(command, self, options); - - // Force write using primary - commandOptions.readPreference = CoreReadPreference.primary; - - // Execute the command - self.command(command, commandOptions, function(err, result) { - if(err && !err.ok && err.code == undefined) return handleCallback(callback, {code: -5000}); - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.ok ? true : false); - }) -} - -var removeUser = function(self, username, options, callback) { - // Attempt to execute command - _executeAuthRemoveUserCommand(self, username, options, function(err, result) { - if(err && err.code == -5000) { - var finalOptions = writeConcern(shallowClone(options), self, options); - // If we have another db set - var db = options.dbName ? self.db(options.dbName) : self; - - // Fetch a user collection - var collection = db.collection(Db.SYSTEM_USER_COLLECTION); - - // Locate the user - collection.findOne({user: username}, {}, function(err, user) { - if(user == null) return handleCallback(callback, err, false); - collection.remove({user: username}, finalOptions, function(err, result) { - handleCallback(callback, err, true); - }); - }); - - return; - } - - if(err) return handleCallback(callback, err); - handleCallback(callback, err, result); - }); -} - -define.classMethod('removeUser', {callback: true, promise:true}); - -/** - * Remove a user from a database - * @method - * @param {string} username The username. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.removeUser = function(username, options, callback) { - // Unpack the parameters - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // If we have a callback fallback - if(typeof callback == 'function') return removeUser(self, username, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - removeUser(self, username, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var authenticate = function(self, username, password, options, callback) { - // the default db to authenticate against is 'self' - // if authententicate is called from a retry context, it may be another one, like admin - var authdb = options.authdb ? options.authdb : options.dbName; - authdb = options.authSource ? options.authSource : authdb; - authdb = authdb ? authdb : self.databaseName; - - // Callback - var _callback = function(err, result) { - if(self.listeners('authenticated').length > 0) { - self.emit('authenticated', err, result); - } - - // Return to caller - handleCallback(callback, err, result); - } - - // authMechanism - var authMechanism = options.authMechanism || ''; - authMechanism = authMechanism.toUpperCase(); - - // If classic auth delegate to auth command - if(authMechanism == 'MONGODB-CR') { - self.s.topology.auth('mongocr', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'PLAIN') { - self.s.topology.auth('plain', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'MONGODB-X509') { - self.s.topology.auth('x509', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'SCRAM-SHA-1') { - self.s.topology.auth('scram-sha-1', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'GSSAPI') { - if(process.platform == 'win32') { - self.s.topology.auth('sspi', authdb, username, password, options, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else { - self.s.topology.auth('gssapi', authdb, username, password, options, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } - } else if(authMechanism == 'DEFAULT') { - self.s.topology.auth('default', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else { - handleCallback(callback, MongoError.create({message: f("authentication mechanism %s not supported", options.authMechanism), driver:true})); - } -} - -/** - * Authenticate a user against the server. - * @method - * @param {string} username The username. - * @param {string} [password] The password. - * @param {object} [options=null] Optional settings. - * @param {string} [options.authMechanism=MONGODB-CR] The authentication mechanism to use, GSSAPI, MONGODB-CR, MONGODB-X509, PLAIN - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.authenticate = function(username, password, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - // Shallow copy the options - options = shallowClone(options); - - // Set default mechanism - if(!options.authMechanism) { - options.authMechanism = 'DEFAULT'; - } else if(options.authMechanism != 'GSSAPI' - && options.authMechanism != 'MONGODB-CR' - && options.authMechanism != 'MONGODB-X509' - && options.authMechanism != 'SCRAM-SHA-1' - && options.authMechanism != 'PLAIN') { - return handleCallback(callback, MongoError.create({message: "only GSSAPI, PLAIN, MONGODB-X509, SCRAM-SHA-1 or MONGODB-CR is supported by authMechanism", driver:true})); - } - - // If we have a callback fallback - if(typeof callback == 'function') return authenticate(self, username, password, options, function(err, r) { - // Support failed auth method - if(err && err.message && err.message.indexOf('saslStart') != -1) err.code = 59; - // Reject error - if(err) return callback(err, r); - callback(null, r); - }); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - authenticate(self, username, password, options, function(err, r) { - // Support failed auth method - if(err && err.message && err.message.indexOf('saslStart') != -1) err.code = 59; - // Reject error - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('authenticate', {callback: true, promise:true}); - -/** - * Logout user from server, fire off on all connections and remove all auth info - * @method - * @param {object} [options=null] Optional settings. - * @param {string} [options.dbName=null] Logout against different database than current. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.logout = function(options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // logout command - var cmd = {'logout':1}; - - // Add onAll to login to ensure all connection are logged out - options.onAll = true; - - // We authenticated against a different db use that - if(this.s.authSource) options.dbName = this.s.authSource; - - // Execute the command - if(typeof callback == 'function') return this.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err, false); - handleCallback(callback, null, true) - }); - - // Return promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.command(cmd, options, function(err, result) { - if(err) return reject(err); - resolve(true); - }); - }); -} - -define.classMethod('logout', {callback: true, promise:true}); - -// Figure out the read preference -var getReadPreference = function(options, db) { - if(options.readPreference) return options; - if(db.readPreference) options.readPreference = db.readPreference; - return options; -} - -/** - * Retrieves this collections index info. - * @method - * @param {string} name The name of the collection. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.full=false] Returns the full raw index information. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.indexInformation = function(name, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // If we have a callback fallback - if(typeof callback == 'function') return indexInformation(self, name, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexInformation(self, name, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var indexInformation = function(self, name, options, callback) { - // If we specified full information - var full = options['full'] == null ? false : options['full']; - - // Process all the results from the index command and collection - var processResults = function(indexes) { - // Contains all the information - var info = {}; - // Process all the indexes - for(var i = 0; i < indexes.length; i++) { - var index = indexes[i]; - // Let's unpack the object - info[index.name] = []; - for(var name in index.key) { - info[index.name].push([name, index.key[name]]); - } - } - - return info; - } - - // Get the list of indexes of the specified collection - self.collection(name).listIndexes().toArray(function(err, indexes) { - if(err) return callback(toError(err)); - if(!Array.isArray(indexes)) return handleCallback(callback, null, []); - if(full) return handleCallback(callback, null, indexes); - handleCallback(callback, null, processResults(indexes)); - }); -} - -define.classMethod('indexInformation', {callback: true, promise:true}); - -var createCreateIndexCommand = function(db, name, fieldOrSpec, options) { - var indexParameters = parseIndexOptions(fieldOrSpec); - var fieldHash = indexParameters.fieldHash; - var keys = indexParameters.keys; - - // Generate the index name - var indexName = typeof options.name == 'string' ? options.name : indexParameters.name; - var selector = { - 'ns': db.databaseName + "." + name, 'key': fieldHash, 'name': indexName - } - - // Ensure we have a correct finalUnique - var finalUnique = options == null || 'object' === typeof options ? false : options; - // Set up options - options = options == null || typeof options == 'boolean' ? {} : options; - - // Add all the options - var keysToOmit = Object.keys(selector); - for(var optionName in options) { - if(keysToOmit.indexOf(optionName) == -1) { - selector[optionName] = options[optionName]; - } - } - - if(selector['unique'] == null) selector['unique'] = finalUnique; - - // Remove any write concern operations - var removeKeys = ['w', 'wtimeout', 'j', 'fsync', 'readPreference']; - for(var i = 0; i < removeKeys.length; i++) { - delete selector[removeKeys[i]]; - } - - // Return the command creation selector - return selector; -} - -var createIndexUsingCreateIndexes = function(self, name, fieldOrSpec, options, callback) { - // Build the index - var indexParameters = parseIndexOptions(fieldOrSpec); - // Generate the index name - var indexName = typeof options.name == 'string' ? options.name : indexParameters.name; - // Set up the index - var indexes = [{ name: indexName, key: indexParameters.fieldHash }]; - // merge all the options - var keysToOmit = Object.keys(indexes[0]); - for(var optionName in options) { - if(keysToOmit.indexOf(optionName) == -1) { - indexes[0][optionName] = options[optionName]; - } - - // Remove any write concern operations - var removeKeys = ['w', 'wtimeout', 'j', 'fsync', 'readPreference']; - for(var i = 0; i < removeKeys.length; i++) { - delete indexes[0][removeKeys[i]]; - } - } - - // Create command - var cmd = {createIndexes: name, indexes: indexes}; - - // Apply write concern to command - cmd = writeConcern(cmd, self, options); - - // Build the command - self.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - if(result.ok == 0) return handleCallback(callback, toError(result), null); - // Return the indexName for backward compatibility - handleCallback(callback, null, indexName); - }); -} - -// Validate the database name -var validateDatabaseName = function(databaseName) { - if(typeof databaseName !== 'string') throw MongoError.create({message: "database name must be a string", driver:true}); - if(databaseName.length === 0) throw MongoError.create({message: "database name cannot be the empty string", driver:true}); - if(databaseName == '$external') return; - - var invalidChars = [" ", ".", "$", "/", "\\"]; - for(var i = 0; i < invalidChars.length; i++) { - if(databaseName.indexOf(invalidChars[i]) != -1) throw MongoError.create({message: "database names cannot contain the character '" + invalidChars[i] + "'", driver:true}); - } -} - -// Get write concern -var writeConcern = function(target, db, options) { - if(options.w != null || options.j != null || options.fsync != null) { - var opts = {}; - if(options.w) opts.w = options.w; - if(options.wtimeout) opts.wtimeout = options.wtimeout; - if(options.j) opts.j = options.j; - if(options.fsync) opts.fsync = options.fsync; - target.writeConcern = opts; - } else if(db.writeConcern.w != null || db.writeConcern.j != null || db.writeConcern.fsync != null) { - target.writeConcern = db.writeConcern; - } - - return target -} - -// Add listeners to topology -var createListener = function(self, e, object) { - var listener = function(err) { - if(e != 'error') { - object.emit(e, err, self); - - // Emit on all associated db's if available - for(var i = 0; i < self.s.children.length; i++) { - self.s.children[i].emit(e, err, self.s.children[i]); - } - } - } - return listener; -} - -/** - * Db close event - * - * Emitted after a socket closed against a single server or mongos proxy. - * - * @event Db#close - * @type {MongoError} - */ - -/** - * Db authenticated event - * - * Emitted after all server members in the topology (single server, replicaset or mongos) have successfully authenticated. - * - * @event Db#authenticated - * @type {object} - */ - -/** - * Db reconnect event - * - * * Server: Emitted when the driver has reconnected and re-authenticated. - * * ReplicaSet: N/A - * * Mongos: Emitted when the driver reconnects and re-authenticates successfully against a Mongos. - * - * @event Db#reconnect - * @type {object} - */ - -/** - * Db error event - * - * Emitted after an error occurred against a single server or mongos proxy. - * - * @event Db#error - * @type {MongoError} - */ - -/** - * Db timeout event - * - * Emitted after a socket timeout occurred against a single server or mongos proxy. - * - * @event Db#timeout - * @type {MongoError} - */ - -/** - * Db parseError event - * - * The parseError event is emitted if the driver detects illegal or corrupt BSON being received from the server. - * - * @event Db#parseError - * @type {MongoError} - */ - -/** - * Db fullsetup event, emitted when all servers in the topology have been connected to at start up time. - * - * * Server: Emitted when the driver has connected to the single server and has authenticated. - * * ReplSet: Emitted after the driver has attempted to connect to all replicaset members. - * * Mongos: Emitted after the driver has attempted to connect to all mongos proxies. - * - * @event Db#fullsetup - * @type {Db} - */ - -// Constants -Db.SYSTEM_NAMESPACE_COLLECTION = "system.namespaces"; -Db.SYSTEM_INDEX_COLLECTION = "system.indexes"; -Db.SYSTEM_PROFILE_COLLECTION = "system.profile"; -Db.SYSTEM_USER_COLLECTION = "system.users"; -Db.SYSTEM_COMMAND_COLLECTION = "$cmd"; -Db.SYSTEM_JS_COLLECTION = "system.js"; - -module.exports = Db; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js deleted file mode 100644 index d96095fb..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js +++ /dev/null @@ -1,237 +0,0 @@ -"use strict"; - -var Binary = require('mongodb-core').BSON.Binary, - ObjectID = require('mongodb-core').BSON.ObjectID; - -/** - * Class for representing a single chunk in GridFS. - * - * @class - * - * @param file {GridStore} The {@link GridStore} object holding this chunk. - * @param mongoObject {object} The mongo object representation of this chunk. - * - * @throws Error when the type of data field for {@link mongoObject} is not - * supported. Currently supported types for data field are instances of - * {@link String}, {@link Array}, {@link Binary} and {@link Binary} - * from the bson module - * - * @see Chunk#buildMongoObject - */ -var Chunk = function(file, mongoObject, writeConcern) { - if(!(this instanceof Chunk)) return new Chunk(file, mongoObject); - - this.file = file; - var self = this; - var mongoObjectFinal = mongoObject == null ? {} : mongoObject; - this.writeConcern = writeConcern || {w:1}; - this.objectId = mongoObjectFinal._id == null ? new ObjectID() : mongoObjectFinal._id; - this.chunkNumber = mongoObjectFinal.n == null ? 0 : mongoObjectFinal.n; - this.data = new Binary(); - - if(mongoObjectFinal.data == null) { - } else if(typeof mongoObjectFinal.data == "string") { - var buffer = new Buffer(mongoObjectFinal.data.length); - buffer.write(mongoObjectFinal.data, 0, mongoObjectFinal.data.length, 'binary'); - this.data = new Binary(buffer); - } else if(Array.isArray(mongoObjectFinal.data)) { - var buffer = new Buffer(mongoObjectFinal.data.length); - var data = mongoObjectFinal.data.join(''); - buffer.write(data, 0, data.length, 'binary'); - this.data = new Binary(buffer); - } else if(mongoObjectFinal.data._bsontype === 'Binary') { - this.data = mongoObjectFinal.data; - } else if(Buffer.isBuffer(mongoObjectFinal.data)) { - } else { - throw Error("Illegal chunk format"); - } - - // Update position - this.internalPosition = 0; -}; - -/** - * Writes a data to this object and advance the read/write head. - * - * @param data {string} the data to write - * @param callback {function(*, GridStore)} This will be called after executing - * this method. The first parameter will contain null and the second one - * will contain a reference to this object. - */ -Chunk.prototype.write = function(data, callback) { - this.data.write(data, this.internalPosition, data.length, 'binary'); - this.internalPosition = this.data.length(); - if(callback != null) return callback(null, this); - return this; -}; - -/** - * Reads data and advances the read/write head. - * - * @param length {number} The length of data to read. - * - * @return {string} The data read if the given length will not exceed the end of - * the chunk. Returns an empty String otherwise. - */ -Chunk.prototype.read = function(length) { - // Default to full read if no index defined - length = length == null || length == 0 ? this.length() : length; - - if(this.length() - this.internalPosition + 1 >= length) { - var data = this.data.read(this.internalPosition, length); - this.internalPosition = this.internalPosition + length; - return data; - } else { - return ''; - } -}; - -Chunk.prototype.readSlice = function(length) { - if ((this.length() - this.internalPosition) >= length) { - var data = null; - if (this.data.buffer != null) { //Pure BSON - data = this.data.buffer.slice(this.internalPosition, this.internalPosition + length); - } else { //Native BSON - data = new Buffer(length); - length = this.data.readInto(data, this.internalPosition); - } - this.internalPosition = this.internalPosition + length; - return data; - } else { - return null; - } -}; - -/** - * Checks if the read/write head is at the end. - * - * @return {boolean} Whether the read/write head has reached the end of this - * chunk. - */ -Chunk.prototype.eof = function() { - return this.internalPosition == this.length() ? true : false; -}; - -/** - * Reads one character from the data of this chunk and advances the read/write - * head. - * - * @return {string} a single character data read if the the read/write head is - * not at the end of the chunk. Returns an empty String otherwise. - */ -Chunk.prototype.getc = function() { - return this.read(1); -}; - -/** - * Clears the contents of the data in this chunk and resets the read/write head - * to the initial position. - */ -Chunk.prototype.rewind = function() { - this.internalPosition = 0; - this.data = new Binary(); -}; - -/** - * Saves this chunk to the database. Also overwrites existing entries having the - * same id as this chunk. - * - * @param callback {function(*, GridStore)} This will be called after executing - * this method. The first parameter will contain null and the second one - * will contain a reference to this object. - */ -Chunk.prototype.save = function(options, callback) { - var self = this; - if(typeof options == 'function') { - callback = options; - options = {}; - } - - self.file.chunkCollection(function(err, collection) { - if(err) return callback(err); - - // Merge the options - var writeOptions = {}; - for(var name in options) writeOptions[name] = options[name]; - for(var name in self.writeConcern) writeOptions[name] = self.writeConcern[name]; - - // collection.remove({'_id':self.objectId}, self.writeConcern, function(err, result) { - collection.remove({'_id':self.objectId}, writeOptions, function(err, result) { - if(err) return callback(err); - - if(self.data.length() > 0) { - self.buildMongoObject(function(mongoObject) { - var options = {forceServerObjectId:true}; - for(var name in self.writeConcern) { - options[name] = self.writeConcern[name]; - } - - collection.insert(mongoObject, writeOptions, function(err, collection) { - callback(err, self); - }); - }); - } else { - callback(null, self); - } - }); - }); -}; - -/** - * Creates a mongoDB object representation of this chunk. - * - * @param callback {function(Object)} This will be called after executing this - * method. The object will be passed to the first parameter and will have - * the structure: - * - *
    
    - *        {
    - *          '_id' : , // {number} id for this chunk
    - *          'files_id' : , // {number} foreign key to the file collection
    - *          'n' : , // {number} chunk number
    - *          'data' : , // {bson#Binary} the chunk data itself
    - *        }
    - *        
    - * - * @see
    MongoDB GridFS Chunk Object Structure - */ -Chunk.prototype.buildMongoObject = function(callback) { - var mongoObject = { - 'files_id': this.file.fileId, - 'n': this.chunkNumber, - 'data': this.data}; - // If we are saving using a specific ObjectId - if(this.objectId != null) mongoObject._id = this.objectId; - - callback(mongoObject); -}; - -/** - * @return {number} the length of the data - */ -Chunk.prototype.length = function() { - return this.data.length(); -}; - -/** - * The position of the read/write head - * @name position - * @lends Chunk# - * @field - */ -Object.defineProperty(Chunk.prototype, "position", { enumerable: true - , get: function () { - return this.internalPosition; - } - , set: function(value) { - this.internalPosition = value; - } -}); - -/** - * The default chunk size - * @constant - */ -Chunk.DEFAULT_CHUNK_SIZE = 1024 * 255; - -module.exports = Chunk; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js deleted file mode 100644 index c120a49a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js +++ /dev/null @@ -1,1923 +0,0 @@ -"use strict"; - -/** - * @fileOverview GridFS is a tool for MongoDB to store files to the database. - * Because of the restrictions of the object size the database can hold, a - * facility to split a file into several chunks is needed. The {@link GridStore} - * class offers a simplified api to interact with files while managing the - * chunks of split files behind the scenes. More information about GridFS can be - * found here. - * - * @example - * var MongoClient = require('mongodb').MongoClient, - * GridStore = require('mongodb').GridStore, - * ObjectID = require('mongodb').ObjectID, - * test = require('assert'); - * - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * var gridStore = new GridStore(db, null, "w"); - * gridStore.open(function(err, gridStore) { - * gridStore.write("hello world!", function(err, gridStore) { - * gridStore.close(function(err, result) { - * - * // Let's read the file using object Id - * GridStore.read(db, result._id, function(err, data) { - * test.equal('hello world!', data); - * db.close(); - * test.done(); - * }); - * }); - * }); - * }); - * }); - */ -var Chunk = require('./chunk'), - ObjectID = require('mongodb-core').BSON.ObjectID, - ReadPreference = require('../read_preference'), - Buffer = require('buffer').Buffer, - Collection = require('../collection'), - fs = require('fs'), - timers = require('timers'), - f = require('util').format, - util = require('util'), - Define = require('../metadata'), - MongoError = require('mongodb-core').MongoError, - inherits = util.inherits, - Duplex = require('stream').Duplex || require('readable-stream').Duplex; - -var REFERENCE_BY_FILENAME = 0, - REFERENCE_BY_ID = 1; - -/** - * Namespace provided by the mongodb-core and node.js - * @external Duplex - */ - -/** - * Create a new GridStore instance - * - * Modes - * - **"r"** - read only. This is the default mode. - * - **"w"** - write in truncate mode. Existing data will be overwriten. - * - * @class - * @param {Db} db A database instance to interact with. - * @param {object} [id] optional unique id for this file - * @param {string} [filename] optional filename for this file, no unique constrain on the field - * @param {string} mode set the mode for this file. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {string} [options.root=null] Root collection to use. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {string} [options.content_type=null] MIME type of the file. Defaults to **{GridStore.DEFAULT_CONTENT_TYPE}**. - * @param {number} [options.chunk_size=261120] Size for the chunk. Defaults to **{Chunk.DEFAULT_CHUNK_SIZE}**. - * @param {object} [options.metadata=null] Arbitrary data the user wants to store. - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @property {number} chunkSize Get the gridstore chunk size. - * @property {number} md5 The md5 checksum for this file. - * @property {number} chunkNumber The current chunk number the gridstore has materialized into memory - * @return {GridStore} a GridStore instance. - */ -var GridStore = function GridStore(db, id, filename, mode, options) { - if(!(this instanceof GridStore)) return new GridStore(db, id, filename, mode, options); - var self = this; - this.db = db; - - // Handle options - if(typeof options === 'undefined') options = {}; - // Handle mode - if(typeof mode === 'undefined') { - mode = filename; - filename = undefined; - } else if(typeof mode == 'object') { - options = mode; - mode = filename; - filename = undefined; - } - - if(id instanceof ObjectID) { - this.referenceBy = REFERENCE_BY_ID; - this.fileId = id; - this.filename = filename; - } else if(typeof filename == 'undefined') { - this.referenceBy = REFERENCE_BY_FILENAME; - this.filename = id; - if (mode.indexOf('w') != null) { - this.fileId = new ObjectID(); - } - } else { - this.referenceBy = REFERENCE_BY_ID; - this.fileId = id; - this.filename = filename; - } - - // Set up the rest - this.mode = mode == null ? "r" : mode; - this.options = options || {}; - - // Opened - this.isOpen = false; - - // Set the root if overridden - this.root = this.options['root'] == null ? GridStore.DEFAULT_ROOT_COLLECTION : this.options['root']; - this.position = 0; - this.readPreference = this.options.readPreference || db.options.readPreference || ReadPreference.PRIMARY; - this.writeConcern = _getWriteConcern(db, this.options); - // Set default chunk size - this.internalChunkSize = this.options['chunkSize'] == null ? Chunk.DEFAULT_CHUNK_SIZE : this.options['chunkSize']; - - // Get the promiseLibrary - var promiseLibrary = this.options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set the promiseLibrary - this.promiseLibrary = promiseLibrary; - - Object.defineProperty(this, "chunkSize", { enumerable: true - , get: function () { - return this.internalChunkSize; - } - , set: function(value) { - if(!(this.mode[0] == "w" && this.position == 0 && this.uploadDate == null)) { - this.internalChunkSize = this.internalChunkSize; - } else { - this.internalChunkSize = value; - } - } - }); - - Object.defineProperty(this, "md5", { enumerable: true - , get: function () { - return this.internalMd5; - } - }); - - Object.defineProperty(this, "chunkNumber", { enumerable: true - , get: function () { - return this.currentChunk && this.currentChunk.chunkNumber ? this.currentChunk.chunkNumber : null; - } - }); -} - -var define = GridStore.define = new Define('Gridstore', GridStore, true); - -/** - * The callback format for the Gridstore.open method - * @callback GridStore~openCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {GridStore} gridStore The GridStore instance if the open method was successful. - */ - -/** - * Opens the file from the database and initialize this object. Also creates a - * new one if file does not exist. - * - * @method - * @param {GridStore~openCallback} [callback] this will be called after executing this method - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.open = function(callback) { - var self = this; - if( this.mode != "w" && this.mode != "w+" && this.mode != "r"){ - throw MongoError.create({message: "Illegal mode " + this.mode, driver:true}); - } - - // We provided a callback leg - if(typeof callback == 'function') return open(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - open(self, function(err, store) { - if(err) return reject(err); - resolve(store); - }) - }); -}; - -var open = function(self, callback) { - // Get the write concern - var writeConcern = _getWriteConcern(self.db, self.options); - - // If we are writing we need to ensure we have the right indexes for md5's - if((self.mode == "w" || self.mode == "w+")) { - // Get files collection - var collection = self.collection(); - // Put index on filename - collection.ensureIndex([['filename', 1]], writeConcern, function(err, index) { - // Get chunk collection - var chunkCollection = self.chunkCollection(); - // Ensure index on chunk collection - chunkCollection.ensureIndex([['files_id', 1], ['n', 1]], writeConcern, function(err, index) { - // Open the connection - _open(self, writeConcern, function(err, r) { - if(err) return callback(err); - self.isOpen = true; - callback(err, r); - }); - }); - }); - } else { - // Open the gridstore - _open(self, writeConcern, function(err, r) { - if(err) return callback(err); - self.isOpen = true; - callback(err, r); - }); - } -} - -// Push the definition for open -define.classMethod('open', {callback: true, promise:true}); - -/** - * Verify if the file is at EOF. - * - * @method - * @return {boolean} true if the read/write head is at the end of this file. - */ -GridStore.prototype.eof = function() { - return this.position == this.length ? true : false; -} - -define.classMethod('eof', {callback: false, promise:false, returns: [Boolean]}); - -/** - * The callback result format. - * @callback GridStore~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result from the callback. - */ - -/** - * Retrieves a single character from this file. - * - * @method - * @param {GridStore~resultCallback} [callback] this gets called after this method is executed. Passes null to the first parameter and the character read to the second or null to the second if the read/write head is at the end of the file. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.getc = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return eof(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - eof(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -var eof = function(self, callback) { - if(self.eof()) { - callback(null, null); - } else if(self.currentChunk.eof()) { - nthChunk(self, self.currentChunk.chunkNumber + 1, function(err, chunk) { - self.currentChunk = chunk; - self.position = self.position + 1; - callback(err, self.currentChunk.getc()); - }); - } else { - self.position = self.position + 1; - callback(null, self.currentChunk.getc()); - } -} - -define.classMethod('getc', {callback: true, promise:true}); - -/** - * Writes a string to the file with a newline character appended at the end if - * the given string does not have one. - * - * @method - * @param {string} string the string to write. - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.puts = function(string, callback) { - var self = this; - var finalString = string.match(/\n$/) == null ? string + "\n" : string; - // We provided a callback leg - if(typeof callback == 'function') return this.write(finalString, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - self.write(finalString, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -define.classMethod('puts', {callback: true, promise:true}); - -/** - * Return a modified Readable stream including a possible transform method. - * - * @method - * @return {GridStoreStream} - */ -GridStore.prototype.stream = function() { - return new GridStoreStream(this); -} - -define.classMethod('stream', {callback: false, promise:false, returns: [GridStoreStream]}); - -/** - * Writes some data. This method will work properly only if initialized with mode "w" or "w+". - * - * @method - * @param {(string|Buffer)} data the data to write. - * @param {boolean} [close] closes this file after writing if set to true. - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.write = function write(data, close, callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return _writeNormal(this, data, close, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - _writeNormal(self, data, close, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -define.classMethod('write', {callback: true, promise:true}); - -/** - * Handles the destroy part of a stream - * - * @method - * @result {null} - */ -GridStore.prototype.destroy = function destroy() { - // close and do not emit any more events. queued data is not sent. - if(!this.writable) return; - this.readable = false; - if(this.writable) { - this.writable = false; - this._q.length = 0; - this.emit('close'); - } -} - -define.classMethod('destroy', {callback: false, promise:false}); - -/** - * Stores a file from the file system to the GridFS database. - * - * @method - * @param {(string|Buffer|FileHandle)} file the file to store. - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.writeFile = function (file, callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return writeFile(self, file, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - writeFile(self, file, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var writeFile = function(self, file, callback) { - if (typeof file === 'string') { - fs.open(file, 'r', function (err, fd) { - if(err) return callback(err); - self.writeFile(fd, callback); - }); - return; - } - - self.open(function (err, self) { - if(err) return callback(err, self); - - fs.fstat(file, function (err, stats) { - if(err) return callback(err, self); - - var offset = 0; - var index = 0; - var numberOfChunksLeft = Math.min(stats.size / self.chunkSize); - - // Write a chunk - var writeChunk = function() { - fs.read(file, self.chunkSize, offset, 'binary', function(err, data, bytesRead) { - if(err) return callback(err, self); - - offset = offset + bytesRead; - - // Create a new chunk for the data - var chunk = new Chunk(self, {n:index++}, self.writeConcern); - chunk.write(data, function(err, chunk) { - if(err) return callback(err, self); - - chunk.save({}, function(err, result) { - if(err) return callback(err, self); - - self.position = self.position + data.length; - - // Point to current chunk - self.currentChunk = chunk; - - if(offset >= stats.size) { - fs.close(file); - self.close(function(err, result) { - if(err) return callback(err, self); - return callback(null, self); - }); - } else { - return process.nextTick(writeChunk); - } - }); - }); - }); - } - - // Process the first write - process.nextTick(writeChunk); - }); - }); -} - -define.classMethod('writeFile', {callback: true, promise:true}); - -/** - * Saves this file to the database. This will overwrite the old entry if it - * already exists. This will work properly only if mode was initialized to - * "w" or "w+". - * - * @method - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.close = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return close(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - close(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var close = function(self, callback) { - if(self.mode[0] == "w") { - // Set up options - var options = self.writeConcern; - - if(self.currentChunk != null && self.currentChunk.position > 0) { - self.currentChunk.save({}, function(err, chunk) { - if(err && typeof callback == 'function') return callback(err); - - self.collection(function(err, files) { - if(err && typeof callback == 'function') return callback(err); - - // Build the mongo object - if(self.uploadDate != null) { - files.remove({'_id':self.fileId}, self.writeConcern, function(err, collection) { - if(err && typeof callback == 'function') return callback(err); - - buildMongoObject(self, function(err, mongoObject) { - if(err) { - if(typeof callback == 'function') return callback(err); else throw err; - } - - files.save(mongoObject, options, function(err) { - if(typeof callback == 'function') - callback(err, mongoObject); - }); - }); - }); - } else { - self.uploadDate = new Date(); - buildMongoObject(self, function(err, mongoObject) { - if(err) { - if(typeof callback == 'function') return callback(err); else throw err; - } - - files.save(mongoObject, options, function(err) { - if(typeof callback == 'function') - callback(err, mongoObject); - }); - }); - } - }); - }); - } else { - self.collection(function(err, files) { - if(err && typeof callback == 'function') return callback(err); - - self.uploadDate = new Date(); - buildMongoObject(self, function(err, mongoObject) { - if(err) { - if(typeof callback == 'function') return callback(err); else throw err; - } - - files.save(mongoObject, options, function(err) { - if(typeof callback == 'function') - callback(err, mongoObject); - }); - }); - }); - } - } else if(self.mode[0] == "r") { - if(typeof callback == 'function') - callback(null, null); - } else { - if(typeof callback == 'function') - callback(MongoError.create({message: f("Illegal mode %s", self.mode), driver:true})); - } -} - -define.classMethod('close', {callback: true, promise:true}); - -/** - * The collection callback format. - * @callback GridStore~collectionCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection} collection The collection from the command execution. - */ - -/** - * Retrieve this file's chunks collection. - * - * @method - * @param {GridStore~collectionCallback} callback the command callback. - * @return {Collection} - */ -GridStore.prototype.chunkCollection = function(callback) { - if(typeof callback == 'function') - return this.db.collection((this.root + ".chunks"), callback); - return this.db.collection((this.root + ".chunks")); -}; - -define.classMethod('chunkCollection', {callback: true, promise:false, returns: [Collection]}); - -/** - * Deletes all the chunks of this file in the database. - * - * @method - * @param {GridStore~resultCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.unlink = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return unlink(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - unlink(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var unlink = function(self, callback) { - deleteChunks(self, function(err) { - if(err!==null) { - err.message = "at deleteChunks: " + err.message; - return callback(err); - } - - self.collection(function(err, collection) { - if(err!==null) { - err.message = "at collection: " + err.message; - return callback(err); - } - - collection.remove({'_id':self.fileId}, self.writeConcern, function(err) { - callback(err, self); - }); - }); - }); -} - -define.classMethod('unlink', {callback: true, promise:true}); - -/** - * Retrieves the file collection associated with this object. - * - * @method - * @param {GridStore~collectionCallback} callback the command callback. - * @return {Collection} - */ -GridStore.prototype.collection = function(callback) { - if(typeof callback == 'function') - this.db.collection(this.root + ".files", callback); - return this.db.collection(this.root + ".files"); -}; - -define.classMethod('collection', {callback: true, promise:false, returns: [Collection]}); - -/** - * The readlines callback format. - * @callback GridStore~readlinesCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {string[]} strings The array of strings returned. - */ - -/** - * Read the entire file as a list of strings splitting by the provided separator. - * - * @method - * @param {string} [separator] The character to be recognized as the newline separator. - * @param {GridStore~readlinesCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.readlines = function(separator, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - separator = args.length ? args.shift() : "\n"; - separator = separator || "\n"; - - // We provided a callback leg - if(typeof callback == 'function') return readlines(self, separator, callback); - - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - readlines(self, separator, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var readlines = function(self, separator, callback) { - self.read(function(err, data) { - if(err) return callback(err); - - var items = data.toString().split(separator); - items = items.length > 0 ? items.splice(0, items.length - 1) : []; - for(var i = 0; i < items.length; i++) { - items[i] = items[i] + separator; - } - - callback(null, items); - }); -} - -define.classMethod('readlines', {callback: true, promise:true}); - -/** - * Deletes all the chunks of this file in the database if mode was set to "w" or - * "w+" and resets the read/write head to the initial position. - * - * @method - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.rewind = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return rewind(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - rewind(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var rewind = function(self, callback) { - if(self.currentChunk.chunkNumber != 0) { - if(self.mode[0] == "w") { - deleteChunks(self, function(err, gridStore) { - if(err) return callback(err); - self.currentChunk = new Chunk(self, {'n': 0}, self.writeConcern); - self.position = 0; - callback(null, self); - }); - } else { - self.currentChunk(0, function(err, chunk) { - if(err) return callback(err); - self.currentChunk = chunk; - self.currentChunk.rewind(); - self.position = 0; - callback(null, self); - }); - } - } else { - self.currentChunk.rewind(); - self.position = 0; - callback(null, self); - } -} - -define.classMethod('rewind', {callback: true, promise:true}); - -/** - * The read callback format. - * @callback GridStore~readCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Buffer} data The data read from the GridStore object - */ - -/** - * Retrieves the contents of this file and advances the read/write head. Works with Buffers only. - * - * There are 3 signatures for this method: - * - * (callback) - * (length, callback) - * (length, buffer, callback) - * - * @method - * @param {number} [length] the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified. - * @param {(string|Buffer)} [buffer] a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method. - * @param {GridStore~readCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.read = function(length, buffer, callback) { - var self = this; - - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - length = args.length ? args.shift() : null; - buffer = args.length ? args.shift() : null; - // We provided a callback leg - if(typeof callback == 'function') return read(self, length, buffer, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - read(self, length, buffer, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -var read = function(self, length, buffer, callback) { - // The data is a c-terminated string and thus the length - 1 - var finalLength = length == null ? self.length - self.position : length; - var finalBuffer = buffer == null ? new Buffer(finalLength) : buffer; - // Add a index to buffer to keep track of writing position or apply current index - finalBuffer._index = buffer != null && buffer._index != null ? buffer._index : 0; - - if((self.currentChunk.length() - self.currentChunk.position + finalBuffer._index) >= finalLength) { - var slice = self.currentChunk.readSlice(finalLength - finalBuffer._index); - // Copy content to final buffer - slice.copy(finalBuffer, finalBuffer._index); - // Update internal position - self.position = self.position + finalBuffer.length; - // Check if we don't have a file at all - if(finalLength == 0 && finalBuffer.length == 0) return callback(MongoError.create({message: "File does not exist", driver:true}), null); - // Else return data - return callback(null, finalBuffer); - } - - // Read the next chunk - var slice = self.currentChunk.readSlice(self.currentChunk.length() - self.currentChunk.position); - // Copy content to final buffer - slice.copy(finalBuffer, finalBuffer._index); - // Update index position - finalBuffer._index += slice.length; - - // Load next chunk and read more - nthChunk(self, self.currentChunk.chunkNumber + 1, function(err, chunk) { - if(err) return callback(err); - - if(chunk.length() > 0) { - self.currentChunk = chunk; - self.read(length, finalBuffer, callback); - } else { - if(finalBuffer._index > 0) { - callback(null, finalBuffer) - } else { - callback(MongoError.create({message: "no chunks found for file, possibly corrupt", driver:true}), null); - } - } - }); -} - -define.classMethod('read', {callback: true, promise:true}); - -/** - * The tell callback format. - * @callback GridStore~tellCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {number} position The current read position in the GridStore. - */ - -/** - * Retrieves the position of the read/write head of this file. - * - * @method - * @param {number} [length] the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified. - * @param {(string|Buffer)} [buffer] a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method. - * @param {GridStore~tellCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.tell = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return callback(null, this.position); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - resolve(self.position); - }); -}; - -define.classMethod('tell', {callback: true, promise:true}); - -/** - * The tell callback format. - * @callback GridStore~gridStoreCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {GridStore} gridStore The gridStore. - */ - -/** - * Moves the read/write head to a new location. - * - * There are 3 signatures for this method - * - * Seek Location Modes - * - **GridStore.IO_SEEK_SET**, **(default)** set the position from the start of the file. - * - **GridStore.IO_SEEK_CUR**, set the position from the current position in the file. - * - **GridStore.IO_SEEK_END**, set the position from the end of the file. - * - * @method - * @param {number} [position] the position to seek to - * @param {number} [seekLocation] seek mode. Use one of the Seek Location modes. - * @param {GridStore~gridStoreCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.seek = function(position, seekLocation, callback) { - var self = this; - - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - seekLocation = args.length ? args.shift() : null; - - // We provided a callback leg - if(typeof callback == 'function') return seek(self, position, seekLocation, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - seek(self, position, seekLocation, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -var seek = function(self, position, seekLocation, callback) { - // Seek only supports read mode - if(self.mode != 'r') { - return callback(MongoError.create({message: "seek is only supported for mode r", driver:true})) - } - - var seekLocationFinal = seekLocation == null ? GridStore.IO_SEEK_SET : seekLocation; - var finalPosition = position; - var targetPosition = 0; - - // Calculate the position - if(seekLocationFinal == GridStore.IO_SEEK_CUR) { - targetPosition = self.position + finalPosition; - } else if(seekLocationFinal == GridStore.IO_SEEK_END) { - targetPosition = self.length + finalPosition; - } else { - targetPosition = finalPosition; - } - - // Get the chunk - var newChunkNumber = Math.floor(targetPosition/self.chunkSize); - var seekChunk = function() { - nthChunk(self, newChunkNumber, function(err, chunk) { - if(err) return callback(err, null); - if(chunk == null) return callback(new Error('no chunk found')); - - // Set the current chunk - self.currentChunk = chunk; - self.position = targetPosition; - self.currentChunk.position = (self.position % self.chunkSize); - callback(err, self); - }); - }; - - seekChunk(); -} - -define.classMethod('seek', {callback: true, promise:true}); - -/** - * @ignore - */ -var _open = function(self, options, callback) { - var collection = self.collection(); - // Create the query - var query = self.referenceBy == REFERENCE_BY_ID ? {_id:self.fileId} : {filename:self.filename}; - query = null == self.fileId && self.filename == null ? null : query; - options.readPreference = self.readPreference; - - // Fetch the chunks - if(query != null) { - collection.findOne(query, options, function(err, doc) { - if(err) return error(err); - - // Check if the collection for the files exists otherwise prepare the new one - if(doc != null) { - self.fileId = doc._id; - // Prefer a new filename over the existing one if this is a write - self.filename = ((self.mode == 'r') || (self.filename == undefined)) ? doc.filename : self.filename; - self.contentType = doc.contentType; - self.internalChunkSize = doc.chunkSize; - self.uploadDate = doc.uploadDate; - self.aliases = doc.aliases; - self.length = doc.length; - self.metadata = doc.metadata; - self.internalMd5 = doc.md5; - } else if (self.mode != 'r') { - self.fileId = self.fileId == null ? new ObjectID() : self.fileId; - self.contentType = GridStore.DEFAULT_CONTENT_TYPE; - self.internalChunkSize = self.internalChunkSize == null ? Chunk.DEFAULT_CHUNK_SIZE : self.internalChunkSize; - self.length = 0; - } else { - self.length = 0; - var txtId = self.fileId instanceof ObjectID ? self.fileId.toHexString() : self.fileId; - return error(MongoError.create({message: f("file with id %s not opened for writing", (self.referenceBy == REFERENCE_BY_ID ? txtId : self.filename)), driver:true}), self); - } - - // Process the mode of the object - if(self.mode == "r") { - nthChunk(self, 0, options, function(err, chunk) { - if(err) return error(err); - self.currentChunk = chunk; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w") { - // Delete any existing chunks - deleteChunks(self, options, function(err, result) { - if(err) return error(err); - self.currentChunk = new Chunk(self, {'n':0}, self.writeConcern); - self.contentType = self.options['content_type'] == null ? self.contentType : self.options['content_type']; - self.internalChunkSize = self.options['chunk_size'] == null ? self.internalChunkSize : self.options['chunk_size']; - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w+") { - nthChunk(self, lastChunkNumber(self), options, function(err, chunk) { - if(err) return error(err); - // Set the current chunk - self.currentChunk = chunk == null ? new Chunk(self, {'n':0}, self.writeConcern) : chunk; - self.currentChunk.position = self.currentChunk.data.length(); - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = self.length; - callback(null, self); - }); - } - }); - } else { - // Write only mode - self.fileId = null == self.fileId ? new ObjectID() : self.fileId; - self.contentType = GridStore.DEFAULT_CONTENT_TYPE; - self.internalChunkSize = self.internalChunkSize == null ? Chunk.DEFAULT_CHUNK_SIZE : self.internalChunkSize; - self.length = 0; - - var collection2 = self.chunkCollection(); - // No file exists set up write mode - if(self.mode == "w") { - // Delete any existing chunks - deleteChunks(self, options, function(err, result) { - if(err) return error(err); - self.currentChunk = new Chunk(self, {'n':0}, self.writeConcern); - self.contentType = self.options['content_type'] == null ? self.contentType : self.options['content_type']; - self.internalChunkSize = self.options['chunk_size'] == null ? self.internalChunkSize : self.options['chunk_size']; - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w+") { - nthChunk(self, lastChunkNumber(self), options, function(err, chunk) { - if(err) return error(err); - // Set the current chunk - self.currentChunk = chunk == null ? new Chunk(self, {'n':0}, self.writeConcern) : chunk; - self.currentChunk.position = self.currentChunk.data.length(); - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = self.length; - callback(null, self); - }); - } - } - - // only pass error to callback once - function error (err) { - if(error.err) return; - callback(error.err = err); - } -}; - -/** - * @ignore - */ -var writeBuffer = function(self, buffer, close, callback) { - if(typeof close === "function") { callback = close; close = null; } - var finalClose = typeof close == 'boolean' ? close : false; - - if(self.mode != "w") { - callback(MongoError.create({message: f("file with id %s not opened for writing", (self.referenceBy == REFERENCE_BY_ID ? self.referenceBy : self.filename)), driver:true}), null); - } else { - if(self.currentChunk.position + buffer.length >= self.chunkSize) { - // Write out the current Chunk and then keep writing until we have less data left than a chunkSize left - // to a new chunk (recursively) - var previousChunkNumber = self.currentChunk.chunkNumber; - var leftOverDataSize = self.chunkSize - self.currentChunk.position; - var firstChunkData = buffer.slice(0, leftOverDataSize); - var leftOverData = buffer.slice(leftOverDataSize); - // A list of chunks to write out - var chunksToWrite = [self.currentChunk.write(firstChunkData)]; - // If we have more data left than the chunk size let's keep writing new chunks - while(leftOverData.length >= self.chunkSize) { - // Create a new chunk and write to it - var newChunk = new Chunk(self, {'n': (previousChunkNumber + 1)}, self.writeConcern); - var firstChunkData = leftOverData.slice(0, self.chunkSize); - leftOverData = leftOverData.slice(self.chunkSize); - // Update chunk number - previousChunkNumber = previousChunkNumber + 1; - // Write data - newChunk.write(firstChunkData); - // Push chunk to save list - chunksToWrite.push(newChunk); - } - - // Set current chunk with remaining data - self.currentChunk = new Chunk(self, {'n': (previousChunkNumber + 1)}, self.writeConcern); - // If we have left over data write it - if(leftOverData.length > 0) self.currentChunk.write(leftOverData); - - // Update the position for the gridstore - self.position = self.position + buffer.length; - // Total number of chunks to write - var numberOfChunksToWrite = chunksToWrite.length; - - for(var i = 0; i < chunksToWrite.length; i++) { - chunksToWrite[i].save({}, function(err, result) { - if(err) return callback(err); - - numberOfChunksToWrite = numberOfChunksToWrite - 1; - - if(numberOfChunksToWrite <= 0) { - // We care closing the file before returning - if(finalClose) { - return self.close(function(err, result) { - callback(err, self); - }); - } - - // Return normally - return callback(null, self); - } - }); - } - } else { - // Update the position for the gridstore - self.position = self.position + buffer.length; - // We have less data than the chunk size just write it and callback - self.currentChunk.write(buffer); - // We care closing the file before returning - if(finalClose) { - return self.close(function(err, result) { - callback(err, self); - }); - } - // Return normally - return callback(null, self); - } - } -}; - -/** - * Creates a mongoDB object representation of this object. - * - *
    
    - *        {
    - *          '_id' : , // {number} id for this file
    - *          'filename' : , // {string} name for this file
    - *          'contentType' : , // {string} mime type for this file
    - *          'length' : , // {number} size of this file?
    - *          'chunksize' : , // {number} chunk size used by this file
    - *          'uploadDate' : , // {Date}
    - *          'aliases' : , // {array of string}
    - *          'metadata' : , // {string}
    - *        }
    - *        
    - * - * @ignore - */ -var buildMongoObject = function(self, callback) { - // Calcuate the length - var mongoObject = { - '_id': self.fileId, - 'filename': self.filename, - 'contentType': self.contentType, - 'length': self.position ? self.position : 0, - 'chunkSize': self.chunkSize, - 'uploadDate': self.uploadDate, - 'aliases': self.aliases, - 'metadata': self.metadata - }; - - var md5Command = {filemd5:self.fileId, root:self.root}; - self.db.command(md5Command, function(err, results) { - if(err) return callback(err); - - mongoObject.md5 = results.md5; - callback(null, mongoObject); - }); -}; - -/** - * Gets the nth chunk of this file. - * @ignore - */ -var nthChunk = function(self, chunkNumber, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - options = options || self.writeConcern; - options.readPreference = self.readPreference; - // Get the nth chunk - self.chunkCollection().findOne({'files_id':self.fileId, 'n':chunkNumber}, options, function(err, chunk) { - if(err) return callback(err); - - var finalChunk = chunk == null ? {} : chunk; - callback(null, new Chunk(self, finalChunk, self.writeConcern)); - }); -}; - -/** - * @ignore - */ -var lastChunkNumber = function(self) { - return Math.floor((self.length ? self.length - 1 : 0)/self.chunkSize); -}; - -/** - * Deletes all the chunks of this file in the database. - * - * @ignore - */ -var deleteChunks = function(self, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - options = options || self.writeConcern; - - if(self.fileId != null) { - self.chunkCollection().remove({'files_id':self.fileId}, options, function(err, result) { - if(err) return callback(err, false); - callback(null, true); - }); - } else { - callback(null, true); - } -}; - -/** -* The collection to be used for holding the files and chunks collection. -* -* @classconstant DEFAULT_ROOT_COLLECTION -**/ -GridStore.DEFAULT_ROOT_COLLECTION = 'fs'; - -/** -* Default file mime type -* -* @classconstant DEFAULT_CONTENT_TYPE -**/ -GridStore.DEFAULT_CONTENT_TYPE = 'binary/octet-stream'; - -/** -* Seek mode where the given length is absolute. -* -* @classconstant IO_SEEK_SET -**/ -GridStore.IO_SEEK_SET = 0; - -/** -* Seek mode where the given length is an offset to the current read/write head. -* -* @classconstant IO_SEEK_CUR -**/ -GridStore.IO_SEEK_CUR = 1; - -/** -* Seek mode where the given length is an offset to the end of the file. -* -* @classconstant IO_SEEK_END -**/ -GridStore.IO_SEEK_END = 2; - -/** - * Checks if a file exists in the database. - * - * @method - * @static - * @param {Db} db the database to query. - * @param {string} name The name of the file to look for. - * @param {string} [rootCollection] The root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~resultCallback} [callback] result from exists. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.exist = function(db, fileIdObject, rootCollection, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - rootCollection = args.length ? args.shift() : null; - options = args.length ? args.shift() : {}; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return exists(db, fileIdObject, rootCollection, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - exists(db, fileIdObject, rootCollection, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var exists = function(db, fileIdObject, rootCollection, options, callback) { - // Establish read preference - var readPreference = options.readPreference || ReadPreference.PRIMARY; - // Fetch collection - var rootCollectionFinal = rootCollection != null ? rootCollection : GridStore.DEFAULT_ROOT_COLLECTION; - db.collection(rootCollectionFinal + ".files", function(err, collection) { - if(err) return callback(err); - - // Build query - var query = (typeof fileIdObject == 'string' || Object.prototype.toString.call(fileIdObject) == '[object RegExp]' ) - ? {'filename':fileIdObject} - : {'_id':fileIdObject}; // Attempt to locate file - - // We have a specific query - if(fileIdObject != null - && typeof fileIdObject == 'object' - && Object.prototype.toString.call(fileIdObject) != '[object RegExp]') { - query = fileIdObject; - } - - // Check if the entry exists - collection.findOne(query, {readPreference:readPreference}, function(err, item) { - if(err) return callback(err); - callback(null, item == null ? false : true); - }); - }); -} - -define.staticMethod('exist', {callback: true, promise:true}); - -/** - * Gets the list of files stored in the GridFS. - * - * @method - * @static - * @param {Db} db the database to query. - * @param {string} [rootCollection] The root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~resultCallback} [callback] result from exists. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.list = function(db, rootCollection, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - rootCollection = args.length ? args.shift() : null; - options = args.length ? args.shift() : {}; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return list(db, rootCollection, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - list(db, rootCollection, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var list = function(db, rootCollection, options, callback) { - // Ensure we have correct values - if(rootCollection != null && typeof rootCollection == 'object') { - options = rootCollection; - rootCollection = null; - } - - // Establish read preference - var readPreference = options.readPreference || ReadPreference.PRIMARY; - // Check if we are returning by id not filename - var byId = options['id'] != null ? options['id'] : false; - // Fetch item - var rootCollectionFinal = rootCollection != null ? rootCollection : GridStore.DEFAULT_ROOT_COLLECTION; - var items = []; - db.collection((rootCollectionFinal + ".files"), function(err, collection) { - if(err) return callback(err); - - collection.find({}, {readPreference:readPreference}, function(err, cursor) { - if(err) return callback(err); - - cursor.each(function(err, item) { - if(item != null) { - items.push(byId ? item._id : item.filename); - } else { - callback(err, items); - } - }); - }); - }); -} - -define.staticMethod('list', {callback: true, promise:true}); - -/** - * Reads the contents of a file. - * - * This method has the following signatures - * - * (db, name, callback) - * (db, name, length, callback) - * (db, name, length, offset, callback) - * (db, name, length, offset, options, callback) - * - * @method - * @static - * @param {Db} db the database to query. - * @param {string} name The name of the file. - * @param {number} [length] The size of data to read. - * @param {number} [offset] The offset from the head of the file of which to start reading from. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~readCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ - -GridStore.read = function(db, name, length, offset, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - length = args.length ? args.shift() : null; - offset = args.length ? args.shift() : null; - options = args.length ? args.shift() : null; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options ? options.promiseLibrary : null; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return readStatic(db, name, length, offset, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - readStatic(db, name, length, offset, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var readStatic = function(db, name, length, offset, options, callback) { - new GridStore(db, name, "r", options).open(function(err, gridStore) { - if(err) return callback(err); - // Make sure we are not reading out of bounds - if(offset && offset >= gridStore.length) return callback("offset larger than size of file", null); - if(length && length > gridStore.length) return callback("length is larger than the size of the file", null); - if(offset && length && (offset + length) > gridStore.length) return callback("offset and length is larger than the size of the file", null); - - if(offset != null) { - gridStore.seek(offset, function(err, gridStore) { - if(err) return callback(err); - gridStore.read(length, callback); - }); - } else { - gridStore.read(length, callback); - } - }); -} - -define.staticMethod('read', {callback: true, promise:true}); - -/** - * Read the entire file as a list of strings splitting by the provided separator. - * - * @method - * @static - * @param {Db} db the database to query. - * @param {(String|object)} name the name of the file. - * @param {string} [separator] The character to be recognized as the newline separator. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~readlinesCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.readlines = function(db, name, separator, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - separator = args.length ? args.shift() : null; - options = args.length ? args.shift() : null; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options ? options.promiseLibrary : null; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return readlinesStatic(db, name, separator, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - readlinesStatic(db, name, separator, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var readlinesStatic = function(db, name, separator, options, callback) { - var finalSeperator = separator == null ? "\n" : separator; - new GridStore(db, name, "r", options).open(function(err, gridStore) { - if(err) return callback(err); - gridStore.readlines(finalSeperator, callback); - }); -} - -define.staticMethod('readlines', {callback: true, promise:true}); - -/** - * Deletes the chunks and metadata information of a file from GridFS. - * - * @method - * @static - * @param {Db} db The database to query. - * @param {(string|array)} names The name/names of the files to delete. - * @param {object} [options=null] Optional settings. - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~resultCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.unlink = function(db, names, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return unlinkStatic(self, db, names, options, callback); - - // Return promise - return new promiseLibrary(function(resolve, reject) { - unlinkStatic(self, db, names, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var unlinkStatic = function(self, db, names, options, callback) { - // Get the write concern - var writeConcern = _getWriteConcern(db, options); - - // List of names - if(names.constructor == Array) { - var tc = 0; - for(var i = 0; i < names.length; i++) { - ++tc; - GridStore.unlink(db, names[i], options, function(result) { - if(--tc == 0) { - callback(null, self); - } - }); - } - } else { - new GridStore(db, names, "w", options).open(function(err, gridStore) { - if(err) return callback(err); - deleteChunks(gridStore, function(err, result) { - if(err) return callback(err); - gridStore.collection(function(err, collection) { - if(err) return callback(err); - collection.remove({'_id':gridStore.fileId}, writeConcern, function(err, result) { - callback(err, self); - }); - }); - }); - }); - } -} - -define.staticMethod('unlink', {callback: true, promise:true}); - -/** - * @ignore - */ -var _writeNormal = function(self, data, close, callback) { - // If we have a buffer write it using the writeBuffer method - if(Buffer.isBuffer(data)) { - return writeBuffer(self, data, close, callback); - } else { - return writeBuffer(self, new Buffer(data, 'binary'), close, callback); - } -} - -/** - * @ignore - */ -var _setWriteConcernHash = function(options) { - var finalOptions = {}; - if(options.w != null) finalOptions.w = options.w; - if(options.journal == true) finalOptions.j = options.journal; - if(options.j == true) finalOptions.j = options.j; - if(options.fsync == true) finalOptions.fsync = options.fsync; - if(options.wtimeout != null) finalOptions.wtimeout = options.wtimeout; - return finalOptions; -} - -/** - * @ignore - */ -var _getWriteConcern = function(self, options) { - // Final options - var finalOptions = {w:1}; - options = options || {}; - - // Local options verification - if(options.w != null || typeof options.j == 'boolean' || typeof options.journal == 'boolean' || typeof options.fsync == 'boolean') { - finalOptions = _setWriteConcernHash(options); - } else if(options.safe != null && typeof options.safe == 'object') { - finalOptions = _setWriteConcernHash(options.safe); - } else if(typeof options.safe == "boolean") { - finalOptions = {w: (options.safe ? 1 : 0)}; - } else if(self.options.w != null || typeof self.options.j == 'boolean' || typeof self.options.journal == 'boolean' || typeof self.options.fsync == 'boolean') { - finalOptions = _setWriteConcernHash(self.options); - } else if(self.safe && (self.safe.w != null || typeof self.safe.j == 'boolean' || typeof self.safe.journal == 'boolean' || typeof self.safe.fsync == 'boolean')) { - finalOptions = _setWriteConcernHash(self.safe); - } else if(typeof self.safe == "boolean") { - finalOptions = {w: (self.safe ? 1 : 0)}; - } - - // Ensure we don't have an invalid combination of write concerns - if(finalOptions.w < 1 - && (finalOptions.journal == true || finalOptions.j == true || finalOptions.fsync == true)) throw MongoError.create({message: "No acknowledgement using w < 1 cannot be combined with journal:true or fsync:true", driver:true}); - - // Return the options - return finalOptions; -} - -/** - * Create a new GridStoreStream instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @extends external:Duplex - * @return {GridStoreStream} a GridStoreStream instance. - */ -var GridStoreStream = function(gs) { - var self = this; - // Initialize the duplex stream - Duplex.call(this); - - // Get the gridstore - this.gs = gs; - - // End called - this.endCalled = false; - - // If we have a seek - this.totalBytesToRead = this.gs.length - this.gs.position; - this.seekPosition = this.gs.position; -} - -// -// Inherit duplex -inherits(GridStoreStream, Duplex); - -GridStoreStream.prototype._pipe = GridStoreStream.prototype.pipe; - -// Set up override -GridStoreStream.prototype.pipe = function(destination) { - var self = this; - - // Only open gridstore if not already open - if(!self.gs.isOpen) { - self.gs.open(function(err) { - if(err) return self.emit('error', err); - self.totalBytesToRead = self.gs.length - self.gs.position; - self._pipe.apply(self, [destination]); - }); - } else { - self.totalBytesToRead = self.gs.length - self.gs.position; - self._pipe.apply(self, [destination]); - } -} - -// Called by stream -GridStoreStream.prototype._read = function(n) { - var self = this; - - var read = function() { - // Read data - self.gs.read(length, function(err, buffer) { - if(err && !self.endCalled) return self.emit('error', err); - - // Stream is closed - if(self.endCalled || buffer == null) return self.push(null); - // Remove bytes read - if(buffer.length <= self.totalBytesToRead) { - self.totalBytesToRead = self.totalBytesToRead - buffer.length; - self.push(buffer); - } else if(buffer.length > self.totalBytesToRead) { - self.totalBytesToRead = self.totalBytesToRead - buffer._index; - self.push(buffer.slice(0, buffer._index)); - } - - // Finished reading - if(self.totalBytesToRead <= 0) { - self.endCalled = true; - } - }); - } - - // Set read length - var length = self.gs.length < self.gs.chunkSize ? self.gs.length - self.seekPosition : self.gs.chunkSize; - if(!self.gs.isOpen) { - self.gs.open(function(err, gs) { - self.totalBytesToRead = self.gs.length - self.gs.position; - if(err) return self.emit('error', err); - read(); - }); - } else { - read(); - } -} - -GridStoreStream.prototype.destroy = function() { - this.pause(); - this.endCalled = true; - this.gs.close(); - this.emit('end'); -} - -GridStoreStream.prototype.write = function(chunk, encoding, callback) { - var self = this; - if(self.endCalled) return self.emit('error', MongoError.create({message: 'attempting to write to stream after end called', driver:true})) - // Do we have to open the gridstore - if(!self.gs.isOpen) { - self.gs.open(function() { - self.gs.isOpen = true; - self.gs.write(chunk, function() { - process.nextTick(function() { - self.emit('drain'); - }); - }); - }); - return false; - } else { - self.gs.write(chunk, function() { - self.emit('drain'); - }); - return true; - } -} - -GridStoreStream.prototype.end = function(chunk, encoding, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - chunk = args.length ? args.shift() : null; - encoding = args.length ? args.shift() : null; - self.endCalled = true; - - if(chunk) { - self.gs.write(chunk, function() { - self.gs.close(function() { - if(typeof callback == 'function') callback(); - self.emit('end') - }); - }); - } - - self.gs.close(function() { - if(typeof callback == 'function') callback(); - self.emit('end') - }); -} - -/** - * The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null. - * @function external:Duplex#read - * @param {number} size Optional argument to specify how much data to read. - * @return {(String | Buffer | null)} - */ - -/** - * Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects. - * @function external:Duplex#setEncoding - * @param {string} encoding The encoding to use. - * @return {null} - */ - -/** - * This method will cause the readable stream to resume emitting data events. - * @function external:Duplex#resume - * @return {null} - */ - -/** - * This method will cause a stream in flowing-mode to stop emitting data events. Any data that becomes available will remain in the internal buffer. - * @function external:Duplex#pause - * @return {null} - */ - -/** - * This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream. - * @function external:Duplex#pipe - * @param {Writable} destination The destination for writing data - * @param {object} [options] Pipe options - * @return {null} - */ - -/** - * This method will remove the hooks set up for a previous pipe() call. - * @function external:Duplex#unpipe - * @param {Writable} [destination] The destination for writing data - * @return {null} - */ - -/** - * This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party. - * @function external:Duplex#unshift - * @param {(Buffer|string)} chunk Chunk of data to unshift onto the read queue. - * @return {null} - */ - -/** - * Versions of Node prior to v0.10 had streams that did not implement the entire Streams API as it is today. (See "Compatibility" below for more information.) - * @function external:Duplex#wrap - * @param {Stream} stream An "old style" readable stream. - * @return {null} - */ - -/** - * This method writes some data to the underlying system, and calls the supplied callback once the data has been fully handled. - * @function external:Duplex#write - * @param {(string|Buffer)} chunk The data to write - * @param {string} encoding The encoding, if chunk is a String - * @param {function} callback Callback for when this chunk of data is flushed - * @return {boolean} - */ - -/** - * Call this method when no more data will be written to the stream. If supplied, the callback is attached as a listener on the finish event. - * @function external:Duplex#end - * @param {(string|Buffer)} chunk The data to write - * @param {string} encoding The encoding, if chunk is a String - * @param {function} callback Callback for when this chunk of data is flushed - * @return {null} - */ - -/** - * GridStoreStream stream data event, fired for each document in the cursor. - * - * @event GridStoreStream#data - * @type {object} - */ - -/** - * GridStoreStream stream end event - * - * @event GridStoreStream#end - * @type {null} - */ - -/** - * GridStoreStream stream close event - * - * @event GridStoreStream#close - * @type {null} - */ - -/** - * GridStoreStream stream readable event - * - * @event GridStoreStream#readable - * @type {null} - */ - -/** - * GridStoreStream stream drain event - * - * @event GridStoreStream#drain - * @type {null} - */ - -/** - * GridStoreStream stream finish event - * - * @event GridStoreStream#finish - * @type {null} - */ - -/** - * GridStoreStream stream pipe event - * - * @event GridStoreStream#pipe - * @type {null} - */ - -/** - * GridStoreStream stream unpipe event - * - * @event GridStoreStream#unpipe - * @type {null} - */ - -/** - * GridStoreStream stream error event - * - * @event GridStoreStream#error - * @type {null} - */ - -/** - * @ignore - */ -module.exports = GridStore; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/metadata.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/metadata.js deleted file mode 100644 index 7dae5624..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/metadata.js +++ /dev/null @@ -1,64 +0,0 @@ -var f = require('util').format; - -var Define = function(name, object, stream) { - this.name = name; - this.object = object; - this.stream = typeof stream == 'boolean' ? stream : false; - this.instrumentations = {}; -} - -Define.prototype.classMethod = function(name, options) { - var keys = Object.keys(options).sort(); - var key = generateKey(keys, options); - - // Add a list of instrumentations - if(this.instrumentations[key] == null) { - this.instrumentations[key] = { - methods: [], options: options - } - } - - // Push to list of method for this instrumentation - this.instrumentations[key].methods.push(name); -} - -var generateKey = function(keys, options) { - var parts = []; - for(var i = 0; i < keys.length; i++) { - parts.push(f('%s=%s', keys[i], options[keys[i]])); - } - - return parts.join(); -} - -Define.prototype.staticMethod = function(name, options) { - options.static = true; - var keys = Object.keys(options).sort(); - var key = generateKey(keys, options); - - // Add a list of instrumentations - if(this.instrumentations[key] == null) { - this.instrumentations[key] = { - methods: [], options: options - } - } - - // Push to list of method for this instrumentation - this.instrumentations[key].methods.push(name); -} - -Define.prototype.generate = function(keys, options) { - // Generate the return object - var object = { - name: this.name, obj: this.object, stream: this.stream, - instrumentations: [] - } - - for(var name in this.instrumentations) { - object.instrumentations.push(this.instrumentations[name]); - } - - return object; -} - -module.exports = Define; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js deleted file mode 100644 index 6b4a01fc..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js +++ /dev/null @@ -1,465 +0,0 @@ -"use strict"; - -var parse = require('./url_parser') - , Server = require('./server') - , Mongos = require('./mongos') - , ReplSet = require('./replset') - , Define = require('./metadata') - , ReadPreference = require('./read_preference') - , Db = require('./db'); - -/** - * @fileOverview The **MongoClient** class is a class that allows for making Connections to MongoDB. - * - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new MongoClient instance - * @class - * @return {MongoClient} a MongoClient instance. - */ -function MongoClient() { - /** - * The callback format for results - * @callback MongoClient~connectCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Db} db The connected database. - */ - - /** - * Connect to MongoDB using a url as documented at - * - * docs.mongodb.org/manual/reference/connection-string/ - * - * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver - * - * @method - * @param {string} url The connection URI string - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.uri_decode_auth=false] Uri decode the user name and password for authentication - * @param {object} [options.db=null] A hash of options to set on the db object, see **Db constructor** - * @param {object} [options.server=null] A hash of options to set on the server objects, see **Server** constructor** - * @param {object} [options.replSet=null] A hash of options to set on the replSet object, see **ReplSet** constructor** - * @param {object} [options.mongos=null] A hash of options to set on the mongos object, see **Mongos** constructor** - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {MongoClient~connectCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ - this.connect = MongoClient.connect; -} - -var define = MongoClient.define = new Define('MongoClient', MongoClient, false); - -/** - * Connect to MongoDB using a url as documented at - * - * docs.mongodb.org/manual/reference/connection-string/ - * - * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver - * - * @method - * @static - * @param {string} url The connection URI string - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.uri_decode_auth=false] Uri decode the user name and password for authentication - * @param {object} [options.db=null] A hash of options to set on the db object, see **Db constructor** - * @param {object} [options.server=null] A hash of options to set on the server objects, see **Server** constructor** - * @param {object} [options.replSet=null] A hash of options to set on the replSet object, see **ReplSet** constructor** - * @param {object} [options.mongos=null] A hash of options to set on the mongos object, see **Mongos** constructor** - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {MongoClient~connectCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -MongoClient.connect = function(url, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = typeof args[args.length - 1] == 'function' ? args.pop() : null; - options = args.length ? args.shift() : null; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Return a promise - if(typeof callback != 'function') { - return new promiseLibrary(function(resolve, reject) { - connect(url, options, function(err, db) { - if(err) return reject(err); - resolve(db); - }); - }); - } - - // Fallback to callback based connect - connect(url, options, callback); -} - -define.staticMethod('connect', {callback: true, promise:true}); - -var connect = function(url, options, callback) { - var serverOptions = options.server || {}; - var mongosOptions = options.mongos || {}; - var replSetServersOptions = options.replSet || options.replSetServers || {}; - var dbOptions = options.db || {}; - - // If callback is null throw an exception - if(callback == null) - throw new Error("no callback function provided"); - - // Parse the string - var object = parse(url, options); - - // Merge in any options for db in options object - if(dbOptions) { - for(var name in dbOptions) object.db_options[name] = dbOptions[name]; - } - - // Added the url to the options - object.db_options.url = url; - - // Merge in any options for server in options object - if(serverOptions) { - for(var name in serverOptions) object.server_options[name] = serverOptions[name]; - } - - // Merge in any replicaset server options - if(replSetServersOptions) { - for(var name in replSetServersOptions) object.rs_options[name] = replSetServersOptions[name]; - } - - if(replSetServersOptions.ssl - || replSetServersOptions.sslValidate - || replSetServersOptions.sslCA - || replSetServersOptions.sslCert - || replSetServersOptions.sslKey - || replSetServersOptions.sslPass) { - object.server_options.ssl = replSetServersOptions.ssl; - object.server_options.sslValidate = replSetServersOptions.sslValidate; - object.server_options.sslCA = replSetServersOptions.sslCA; - object.server_options.sslCert = replSetServersOptions.sslCert; - object.server_options.sslKey = replSetServersOptions.sslKey; - object.server_options.sslPass = replSetServersOptions.sslPass; - } - - // Merge in any replicaset server options - if(mongosOptions) { - for(var name in mongosOptions) object.mongos_options[name] = mongosOptions[name]; - } - - if(typeof object.server_options.poolSize == 'number') { - if(!object.mongos_options.poolSize) object.mongos_options.poolSize = object.server_options.poolSize; - if(!object.rs_options.poolSize) object.rs_options.poolSize = object.server_options.poolSize; - } - - if(mongosOptions.ssl - || mongosOptions.sslValidate - || mongosOptions.sslCA - || mongosOptions.sslCert - || mongosOptions.sslKey - || mongosOptions.sslPass) { - object.server_options.ssl = mongosOptions.ssl; - object.server_options.sslValidate = mongosOptions.sslValidate; - object.server_options.sslCA = mongosOptions.sslCA; - object.server_options.sslCert = mongosOptions.sslCert; - object.server_options.sslKey = mongosOptions.sslKey; - object.server_options.sslPass = mongosOptions.sslPass; - } - - // Set the promise library - object.db_options.promiseLibrary = options.promiseLibrary; - - // We need to ensure that the list of servers are only either direct members or mongos - // they cannot be a mix of monogs and mongod's - var totalNumberOfServers = object.servers.length; - var totalNumberOfMongosServers = 0; - var totalNumberOfMongodServers = 0; - var serverConfig = null; - var errorServers = {}; - - // Failure modes - if(object.servers.length == 0) throw new Error("connection string must contain at least one seed host"); - - // If we have no db setting for the native parser try to set the c++ one first - object.db_options.native_parser = _setNativeParser(object.db_options); - // If no auto_reconnect is set, set it to true as default for single servers - if(typeof object.server_options.auto_reconnect != 'boolean') { - object.server_options.auto_reconnect = true; - } - - // If we have more than a server, it could be replicaset or mongos list - // need to verify that it's one or the other and fail if it's a mix - // Connect to all servers and run ismaster - for(var i = 0; i < object.servers.length; i++) { - // Set up socket options - var providedSocketOptions = object.server_options.socketOptions || {}; - - var _server_options = { - poolSize:1 - , socketOptions: { - connectTimeoutMS: providedSocketOptions.connectTimeoutMS || 30000 - , socketTimeoutMS: providedSocketOptions.socketTimeoutMS || 30000 - } - , auto_reconnect:false}; - - // Ensure we have ssl setup for the servers - if(object.server_options.ssl) { - _server_options.ssl = object.server_options.ssl; - _server_options.sslValidate = object.server_options.sslValidate; - _server_options.sslCA = object.server_options.sslCA; - _server_options.sslCert = object.server_options.sslCert; - _server_options.sslKey = object.server_options.sslKey; - _server_options.sslPass = object.server_options.sslPass; - } else if(object.rs_options.ssl) { - _server_options.ssl = object.rs_options.ssl; - _server_options.sslValidate = object.rs_options.sslValidate; - _server_options.sslCA = object.rs_options.sslCA; - _server_options.sslCert = object.rs_options.sslCert; - _server_options.sslKey = object.rs_options.sslKey; - _server_options.sslPass = object.rs_options.sslPass; - } - - // Error - var error = null; - // Set up the Server object - var _server = object.servers[i].domain_socket - ? new Server(object.servers[i].domain_socket, _server_options) - : new Server(object.servers[i].host, object.servers[i].port, _server_options); - - var connectFunction = function(__server) { - // Attempt connect - new Db(object.dbName, __server, {w:1, native_parser:false, promiseLibrary:options.promiseLibrary}).open(function(err, db) { - // Update number of servers - totalNumberOfServers = totalNumberOfServers - 1; - - // If no error do the correct checks - if(!err) { - // Close the connection - db.close(); - var isMasterDoc = db.serverConfig.isMasterDoc; - - // Check what type of server we have - if(isMasterDoc.setName) { - totalNumberOfMongodServers++; - } - - if(isMasterDoc.msg && isMasterDoc.msg == "isdbgrid") totalNumberOfMongosServers++; - } else { - error = err; - errorServers[__server.host + ":" + __server.port] = __server; - } - - if(totalNumberOfServers == 0) { - // Error out - if(totalNumberOfMongodServers == 0 && totalNumberOfMongosServers == 0 && error) { - return callback(error, null); - } - - // If we have a mix of mongod and mongos, throw an error - if(totalNumberOfMongosServers > 0 && totalNumberOfMongodServers > 0) { - if(db) db.close(); - return process.nextTick(function() { - try { - callback(new Error("cannot combine a list of replicaset seeds and mongos seeds")); - } catch (err) { - throw err - } - }) - } - - if(totalNumberOfMongodServers == 0 - && totalNumberOfMongosServers == 0 - && object.servers.length == 1 - && (!object.rs_options.replicaSet || !object.rs_options.rs_name)) { - - var obj = object.servers[0]; - serverConfig = obj.domain_socket ? - new Server(obj.domain_socket, object.server_options) - : new Server(obj.host, obj.port, object.server_options); - - } else if(totalNumberOfMongodServers > 0 - || totalNumberOfMongosServers > 0 - || object.rs_options.replicaSet || object.rs_options.rs_name) { - - var finalServers = object.servers - .filter(function(serverObj) { - return errorServers[serverObj.host + ":" + serverObj.port] == null; - }) - .map(function(serverObj) { - return serverObj.domain_socket ? - new Server(serverObj.domain_socket, 27017, object.server_options) - : new Server(serverObj.host, serverObj.port, object.server_options); - }); - - // Clean out any error servers - errorServers = {}; - - // Set up the final configuration - if(totalNumberOfMongodServers > 0) { - try { - - // If no replicaset name was provided, we wish to perform a - // direct connection - if(totalNumberOfMongodServers == 1 - && (!object.rs_options.replicaSet && !object.rs_options.rs_name)) { - serverConfig = finalServers[0]; - } else if(totalNumberOfMongodServers == 1) { - object.rs_options.replicaSet = object.rs_options.replicaSet || object.rs_options.rs_name; - serverConfig = new ReplSet(finalServers, object.rs_options); - } else { - serverConfig = new ReplSet(finalServers, object.rs_options); - } - - } catch(err) { - return callback(err, null); - } - } else { - serverConfig = new Mongos(finalServers, object.mongos_options); - } - } - - if(serverConfig == null) { - return process.nextTick(function() { - try { - callback(new Error("Could not locate any valid servers in initial seed list")); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } - - // Ensure no firing of open event before we are ready - serverConfig.emitOpen = false; - // Set up all options etc and connect to the database - _finishConnecting(serverConfig, object, options, callback) - } - }); - } - - // Wrap the context of the call - connectFunction(_server); - } -} - -var _setNativeParser = function(db_options) { - if(typeof db_options.native_parser == 'boolean') return db_options.native_parser; - - try { - require('mongodb-core').BSON.BSONNative.BSON; - return true; - } catch(err) { - return false; - } -} - -var _finishConnecting = function(serverConfig, object, options, callback) { - // If we have a readPreference passed in by the db options - if(typeof object.db_options.readPreference == 'string') { - object.db_options.readPreference = new ReadPreference(object.db_options.readPreference); - } else if(typeof object.db_options.read_preference == 'string') { - object.db_options.readPreference = new ReadPreference(object.db_options.read_preference); - } - - // Do we have readPreference tags - if(object.db_options.readPreference && object.db_options.readPreferenceTags) { - object.db_options.readPreference.tags = object.db_options.readPreferenceTags; - } else if(object.db_options.readPreference && object.db_options.read_preference_tags) { - object.db_options.readPreference.tags = object.db_options.read_preference_tags; - } - - // Get the socketTimeoutMS - var socketTimeoutMS = object.server_options.socketOptions.socketTimeoutMS || 0; - - // If we have a replset, override with replicaset socket timeout option if available - if(serverConfig instanceof ReplSet) { - socketTimeoutMS = object.rs_options.socketOptions.socketTimeoutMS || socketTimeoutMS; - } - - // Set socketTimeout to the same as the connectTimeoutMS or 30 sec - serverConfig.connectTimeoutMS = serverConfig.connectTimeoutMS || 30000; - serverConfig.socketTimeoutMS = serverConfig.connectTimeoutMS; - - // Set up the db options - var db = new Db(object.dbName, serverConfig, object.db_options); - // Open the db - db.open(function(err, db){ - - if(err) { - return process.nextTick(function() { - try { - callback(err, null); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } - - // Reset the socket timeout - serverConfig.socketTimeoutMS = socketTimeoutMS || 0; - - // Return object - if(err == null && object.auth){ - // What db to authenticate against - var authentication_db = db; - if(object.db_options && object.db_options.authSource) { - authentication_db = db.db(object.db_options.authSource); - } - - // Build options object - var options = {}; - if(object.db_options.authMechanism) options.authMechanism = object.db_options.authMechanism; - if(object.db_options.gssapiServiceName) options.gssapiServiceName = object.db_options.gssapiServiceName; - - // Authenticate - authentication_db.authenticate(object.auth.user, object.auth.password, options, function(err, success){ - if(success){ - process.nextTick(function() { - try { - callback(null, db); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } else { - if(db) db.close(); - process.nextTick(function() { - try { - callback(err ? err : new Error('Could not authenticate user ' + object.auth[0]), null); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } - }); - } else { - process.nextTick(function() { - try { - callback(err, db); - } catch (err) { - if(db) db.close(); - throw err - } - }) - } - }); -} - -module.exports = MongoClient diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/mongos.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/mongos.js deleted file mode 100644 index c1d40ec6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/mongos.js +++ /dev/null @@ -1,492 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , f = require('util').format - , ServerCapabilities = require('./topology_base').ServerCapabilities - , MongoCR = require('mongodb-core').MongoCR - , MongoError = require('mongodb-core').MongoError - , CMongos = require('mongodb-core').Mongos - , Cursor = require('./cursor') - , AggregationCursor = require('./aggregation_cursor') - , CommandCursor = require('./command_cursor') - , Define = require('./metadata') - , Server = require('./server') - , Store = require('./topology_base').Store - , shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **Mongos** class is a class that represents a Mongos Proxy topology and is - * used to construct connections. - * - * **Mongos Should not be used, use MongoClient.connect** - * @example - * var Db = require('mongodb').Db, - * Mongos = require('mongodb').Mongos, - * Server = require('mongodb').Server, - * test = require('assert'); - * // Connect using Mongos - * var server = new Server('localhost', 27017); - * var db = new Db('test', new Mongos([server])); - * db.open(function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new Mongos instance - * @class - * @deprecated - * @param {Server[]} servers A seedlist of servers participating in the replicaset. - * @param {object} [options=null] Optional settings. - * @param {booelan} [options.ha=true] Turn on high availability monitoring. - * @param {number} [options.haInterval=5000] Time between each replicaset status check. - * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. - * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support) - * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {object} [options.socketOptions=null] Socket options - * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option. - * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start. - * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting - * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting - * @fires Mongos#connect - * @fires Mongos#ha - * @fires Mongos#joined - * @fires Mongos#left - * @fires Mongos#fullsetup - * @fires Mongos#open - * @fires Mongos#close - * @fires Mongos#error - * @fires Mongos#timeout - * @fires Mongos#parseError - * @return {Mongos} a Mongos instance. - */ -var Mongos = function(servers, options) { - if(!(this instanceof Mongos)) return new Mongos(servers, options); - options = options || {}; - var self = this; - - // Ensure all the instances are Server - for(var i = 0; i < servers.length; i++) { - if(!(servers[i] instanceof Server)) { - throw MongoError.create({message: "all seed list instances must be of the Server type", driver:true}); - } - } - - // Store option defaults - var storeOptions = { - force: false - , bufferMaxEntries: -1 - } - - // Shared global store - var store = options.store || new Store(self, storeOptions); - - // Set up event emitter - EventEmitter.call(this); - - // Debug tag - var tag = options.tag; - - // Build seed list - var seedlist = servers.map(function(x) { - return {host: x.host, port: x.port} - }); - - // Final options - var finalOptions = shallowClone(options); - - // Default values - finalOptions.size = typeof options.poolSize == 'number' ? options.poolSize : 5; - finalOptions.reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true; - finalOptions.emitError = typeof options.emitError == 'boolean' ? options.emitError : true; - finalOptions.cursorFactory = Cursor; - - // Add the store - finalOptions.disconnectHandler = store; - - // Ensure we change the sslCA option to ca if available - if(options.sslCA) finalOptions.ca = options.sslCA; - if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate; - if(options.sslKey) finalOptions.key = options.sslKey; - if(options.sslCert) finalOptions.cert = options.sslCert; - if(options.sslPass) finalOptions.passphrase = options.sslPass; - - // Socket options passed down - if(options.socketOptions) { - if(options.socketOptions.connectTimeoutMS) { - this.connectTimeoutMS = options.socketOptions.connectTimeoutMS; - finalOptions.connectionTimeout = options.socketOptions.connectTimeoutMS; - } - if(options.socketOptions.socketTimeoutMS) - finalOptions.socketTimeout = options.socketOptions.socketTimeoutMS; - } - - // Are we running in debug mode - var debug = typeof options.debug == 'boolean' ? options.debug : false; - if(debug) { - finalOptions.debug = debug; - } - - // Map keep alive setting - if(options.socketOptions && typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAlive = true; - if(typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAliveInitialDelay = options.socketOptions.keepAlive; - } - } - - // Connection timeout - if(options.socketOptions && typeof options.socketOptions.connectionTimeout == 'number') { - finalOptions.connectionTimeout = options.socketOptions.connectionTimeout; - } - - // Socket timeout - if(options.socketOptions && typeof options.socketOptions.socketTimeout == 'number') { - finalOptions.socketTimeout = options.socketOptions.socketTimeout; - } - - // noDelay - if(options.socketOptions && typeof options.socketOptions.noDelay == 'boolean') { - finalOptions.noDelay = options.socketOptions.noDelay; - } - - if(typeof options.secondaryAcceptableLatencyMS == 'number') { - finalOptions.acceptableLatency = options.secondaryAcceptableLatencyMS; - } - - // Add the non connection store - finalOptions.disconnectHandler = store; - - // Create the Mongos - var mongos = new CMongos(seedlist, finalOptions) - // Server capabilities - var sCapabilities = null; - // Add auth prbufferMaxEntriesoviders - mongos.addAuthProvider('mongocr', new MongoCR()); - - // Internal state - this.s = { - // Create the Mongos - mongos: mongos - // Server capabilities - , sCapabilities: sCapabilities - // Debug turned on - , debug: debug - // Store option defaults - , storeOptions: storeOptions - // Cloned options - , clonedOptions: finalOptions - // Actual store of callbacks - , store: store - // Options - , options: options - } - - - // Last ismaster - Object.defineProperty(this, 'isMasterDoc', { - enumerable:true, get: function() { return self.s.mongos.lastIsMaster(); } - }); - - // Last ismaster - Object.defineProperty(this, 'numberOfConnectedServers', { - enumerable:true, get: function() { - return self.s.mongos.s.mongosState.connectedServers().length; - } - }); - - // BSON property - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - return self.s.mongos.bson; - } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return self.s.mongos.haInterval; } - }); -} - -/** - * @ignore - */ -inherits(Mongos, EventEmitter); - -var define = Mongos.define = new Define('Mongos', Mongos, false); - -// Connect -Mongos.prototype.connect = function(db, _options, callback) { - var self = this; - if('function' === typeof _options) callback = _options, _options = {}; - if(_options == null) _options = {}; - if(!('function' === typeof callback)) callback = null; - self.s.options = _options; - - // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; - - // Error handler - var connectErrorHandler = function(event) { - return function(err) { - // Remove all event handlers - var events = ['timeout', 'error', 'close']; - events.forEach(function(e) { - self.removeListener(e, connectErrorHandler); - }); - - self.s.mongos.removeListener('connect', connectErrorHandler); - - // Try to callback - try { - callback(err); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - } - - // Actual handler - var errorHandler = function(event) { - return function(err) { - if(event != 'error') { - self.emit(event, err); - } - } - } - - // Error handler - var reconnectHandler = function(err) { - self.emit('reconnect'); - self.s.store.execute(); - } - - // Connect handler - var connectHandler = function() { - // Clear out all the current handlers left over - ["timeout", "error", "close"].forEach(function(e) { - self.s.mongos.removeAllListeners(e); - }); - - // Set up listeners - self.s.mongos.once('timeout', errorHandler('timeout')); - self.s.mongos.once('error', errorHandler('error')); - self.s.mongos.once('close', errorHandler('close')); - - // relay the event - var relay = function(event) { - return function(t, server) { - self.emit(event, t, server); - } - } - - // Set up serverConfig listeners - self.s.mongos.on('joined', relay('joined')); - self.s.mongos.on('left', relay('left')); - self.s.mongos.on('fullsetup', relay('fullsetup')); - - // Emit open event - self.emit('open', null, self); - - // Return correctly - try { - callback(null, self); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - - // Set up listeners - self.s.mongos.once('timeout', connectErrorHandler('timeout')); - self.s.mongos.once('error', connectErrorHandler('error')); - self.s.mongos.once('close', connectErrorHandler('close')); - self.s.mongos.once('connect', connectHandler); - // Reconnect server - self.s.mongos.on('reconnect', reconnectHandler); - - // Start connection - self.s.mongos.connect(_options); -} - -Mongos.prototype.parserType = function() { - return this.s.mongos.parserType(); -} - -define.classMethod('parserType', {callback: false, promise:false, returns: [String]}); - -// Server capabilities -Mongos.prototype.capabilities = function() { - if(this.s.sCapabilities) return this.s.sCapabilities; - if(this.s.mongos.lastIsMaster() == null) return null; - this.s.sCapabilities = new ServerCapabilities(this.s.mongos.lastIsMaster()); - return this.s.sCapabilities; -} - -define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]}); - -// Command -Mongos.prototype.command = function(ns, cmd, options, callback) { - this.s.mongos.command(ns, cmd, options, callback); -} - -define.classMethod('command', {callback: true, promise:false}); - -// Insert -Mongos.prototype.insert = function(ns, ops, options, callback) { - this.s.mongos.insert(ns, ops, options, function(e, m) { - callback(e, m) - }); -} - -define.classMethod('insert', {callback: true, promise:false}); - -// Update -Mongos.prototype.update = function(ns, ops, options, callback) { - this.s.mongos.update(ns, ops, options, callback); -} - -define.classMethod('update', {callback: true, promise:false}); - -// Remove -Mongos.prototype.remove = function(ns, ops, options, callback) { - this.s.mongos.remove(ns, ops, options, callback); -} - -define.classMethod('remove', {callback: true, promise:false}); - -// IsConnected -Mongos.prototype.isConnected = function() { - return this.s.mongos.isConnected(); -} - -define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]}); - -// Insert -Mongos.prototype.cursor = function(ns, cmd, options) { - options.disconnectHandler = this.s.store; - return this.s.mongos.cursor(ns, cmd, options); -} - -define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]}); - -Mongos.prototype.setBSONParserType = function(type) { - return this.s.mongos.setBSONParserType(type); -} - -Mongos.prototype.lastIsMaster = function() { - return this.s.mongos.lastIsMaster(); -} - -Mongos.prototype.close = function(forceClosed) { - this.s.mongos.destroy(); - // We need to wash out all stored processes - if(forceClosed == true) { - this.s.storeOptions.force = forceClosed; - this.s.store.flush(); - } -} - -define.classMethod('close', {callback: false, promise:false}); - -Mongos.prototype.auth = function() { - var args = Array.prototype.slice.call(arguments, 0); - this.s.mongos.auth.apply(this.s.mongos, args); -} - -define.classMethod('auth', {callback: true, promise:false}); - -/** - * All raw connections - * @method - * @return {array} - */ -Mongos.prototype.connections = function() { - return this.s.mongos.connections(); -} - -define.classMethod('connections', {callback: false, promise:false, returns:[Array]}); - -/** - * A mongos connect event, used to verify that the connection is up and running - * - * @event Mongos#connect - * @type {Mongos} - */ - -/** - * The mongos high availability event - * - * @event Mongos#ha - * @type {function} - * @param {string} type The stage in the high availability event (start|end) - * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only - * @param {number} data.id The id for this high availability request - * @param {object} data.state An object containing the information about the current replicaset - */ - -/** - * A server member left the mongos set - * - * @event Mongos#left - * @type {function} - * @param {string} type The type of member that left (primary|secondary|arbiter) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the mongos set - * - * @event Mongos#joined - * @type {function} - * @param {string} type The type of member that joined (primary|secondary|arbiter) - * @param {Server} server The server object that joined - */ - -/** - * Mongos fullsetup event, emitted when all proxies in the topology have been connected to. - * - * @event Mongos#fullsetup - * @type {Mongos} - */ - -/** - * Mongos open event, emitted when mongos can start processing commands. - * - * @event Mongos#open - * @type {Mongos} - */ - -/** - * Mongos close event - * - * @event Mongos#close - * @type {object} - */ - -/** - * Mongos error event, emitted if there is an error listener. - * - * @event Mongos#error - * @type {MongoError} - */ - -/** - * Mongos timeout event - * - * @event Mongos#timeout - * @type {object} - */ - -/** - * Mongos parseError event - * - * @event Mongos#parseError - * @type {object} - */ - -module.exports = Mongos; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js deleted file mode 100644 index 73b253ae..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; - -/** - * @fileOverview The **ReadPreference** class is a class that represents a MongoDB ReadPreference and is - * used to construct connections. - * - * @example - * var Db = require('mongodb').Db, - * ReplSet = require('mongodb').ReplSet, - * Server = require('mongodb').Server, - * ReadPreference = require('mongodb').ReadPreference, - * test = require('assert'); - * // Connect using ReplSet - * var server = new Server('localhost', 27017); - * var db = new Db('test', new ReplSet([server])); - * db.open(function(err, db) { - * test.equal(null, err); - * // Perform a read - * var cursor = db.collection('t').find({}); - * cursor.setReadPreference(ReadPreference.PRIMARY); - * cursor.toArray(function(err, docs) { - * test.equal(null, err); - * db.close(); - * }); - * }); - */ - -/** - * Creates a new ReadPreference instance - * - * Read Preferences - * - **ReadPreference.PRIMARY**, Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags (This is the default.). - * - **ReadPreference.PRIMARY_PREFERRED**, Read from primary if available, otherwise a secondary. - * - **ReadPreference.SECONDARY**, Read from secondary if available, otherwise error. - * - **ReadPreference.SECONDARY_PREFERRED**, Read from a secondary if available, otherwise read from the primary. - * - **ReadPreference.NEAREST**, All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection. - * - * @class - * @param {string} mode The ReadPreference mode as listed above. - * @param {object} tags An object representing read preference tags. - * @property {string} mode The ReadPreference mode. - * @property {object} tags The ReadPreference tags. - * @return {ReadPreference} a ReadPreference instance. - */ -var ReadPreference = function(mode, tags) { - if(!(this instanceof ReadPreference)) - return new ReadPreference(mode, tags); - this._type = 'ReadPreference'; - this.mode = mode; - this.tags = tags; -} - -/** - * Validate if a mode is legal - * - * @method - * @param {string} mode The string representing the read preference mode. - * @return {boolean} - */ -ReadPreference.isValid = function(_mode) { - return (_mode == ReadPreference.PRIMARY || _mode == ReadPreference.PRIMARY_PREFERRED - || _mode == ReadPreference.SECONDARY || _mode == ReadPreference.SECONDARY_PREFERRED - || _mode == ReadPreference.NEAREST - || _mode == true || _mode == false || _mode == null); -} - -/** - * Validate if a mode is legal - * - * @method - * @param {string} mode The string representing the read preference mode. - * @return {boolean} - */ -ReadPreference.prototype.isValid = function(mode) { - var _mode = typeof mode == 'string' ? mode : this.mode; - return ReadPreference.isValid(_mode); -} - -/** - * @ignore - */ -ReadPreference.prototype.toObject = function() { - var object = {mode:this.mode}; - - if(this.tags != null) { - object['tags'] = this.tags; - } - - return object; -} - -/** - * @ignore - */ -ReadPreference.PRIMARY = 'primary'; -ReadPreference.PRIMARY_PREFERRED = 'primaryPreferred'; -ReadPreference.SECONDARY = 'secondary'; -ReadPreference.SECONDARY_PREFERRED = 'secondaryPreferred'; -ReadPreference.NEAREST = 'nearest' - -/** - * @ignore - */ -module.exports = ReadPreference; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/replset.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/replset.js deleted file mode 100644 index 9837de83..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/replset.js +++ /dev/null @@ -1,555 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , f = require('util').format - , Server = require('./server') - , Mongos = require('./mongos') - , Cursor = require('./cursor') - , AggregationCursor = require('./aggregation_cursor') - , CommandCursor = require('./command_cursor') - , ReadPreference = require('./read_preference') - , MongoCR = require('mongodb-core').MongoCR - , MongoError = require('mongodb-core').MongoError - , ServerCapabilities = require('./topology_base').ServerCapabilities - , Store = require('./topology_base').Store - , Define = require('./metadata') - , CServer = require('mongodb-core').Server - , CReplSet = require('mongodb-core').ReplSet - , CoreReadPreference = require('mongodb-core').ReadPreference - , shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **ReplSet** class is a class that represents a Replicaset topology and is - * used to construct connections. - * - * **ReplSet Should not be used, use MongoClient.connect** - * @example - * var Db = require('mongodb').Db, - * ReplSet = require('mongodb').ReplSet, - * Server = require('mongodb').Server, - * test = require('assert'); - * // Connect using ReplSet - * var server = new Server('localhost', 27017); - * var db = new Db('test', new ReplSet([server])); - * db.open(function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new ReplSet instance - * @class - * @deprecated - * @param {Server[]} servers A seedlist of servers participating in the replicaset. - * @param {object} [options=null] Optional settings. - * @param {booelan} [options.ha=true] Turn on high availability monitoring. - * @param {number} [options.haInterval=5000] Time between each replicaset status check. - * @param {string} options.replicaSet The name of the replicaset to connect to. - * @param {number} [options.secondaryAcceptableLatencyMS=15] Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms) - * @param {boolean} [options.connectWithNoPrimary=false] Sets if the driver should connect even if no primary is available - * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. - * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support) - * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {object} [options.socketOptions=null] Socket options - * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option. - * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start. - * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting - * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting - * @fires ReplSet#connect - * @fires ReplSet#ha - * @fires ReplSet#joined - * @fires ReplSet#left - * @fires ReplSet#fullsetup - * @fires ReplSet#open - * @fires ReplSet#close - * @fires ReplSet#error - * @fires ReplSet#timeout - * @fires ReplSet#parseError - * @return {ReplSet} a ReplSet instance. - */ -var ReplSet = function(servers, options) { - if(!(this instanceof ReplSet)) return new ReplSet(servers, options); - options = options || {}; - var self = this; - - // Ensure all the instances are Server - for(var i = 0; i < servers.length; i++) { - if(!(servers[i] instanceof Server)) { - throw MongoError.create({message: "all seed list instances must be of the Server type", driver:true}); - } - } - - // Store option defaults - var storeOptions = { - force: false - , bufferMaxEntries: -1 - } - - // Shared global store - var store = options.store || new Store(self, storeOptions); - - // Set up event emitter - EventEmitter.call(this); - - // Debug tag - var tag = options.tag; - - // Build seed list - var seedlist = servers.map(function(x) { - return {host: x.host, port: x.port} - }); - - // Final options - var finalOptions = shallowClone(options); - - // Default values - finalOptions.size = typeof options.poolSize == 'number' ? options.poolSize : 5; - finalOptions.reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true; - finalOptions.emitError = typeof options.emitError == 'boolean' ? options.emitError : true; - finalOptions.cursorFactory = Cursor; - - // Add the store - finalOptions.disconnectHandler = store; - - // Socket options passed down - if(options.socketOptions) { - if(options.socketOptions.connectTimeoutMS) { - this.connectTimeoutMS = options.socketOptions.connectTimeoutMS; - finalOptions.connectionTimeout = options.socketOptions.connectTimeoutMS; - } - - if(options.socketOptions.socketTimeoutMS) { - finalOptions.socketTimeout = options.socketOptions.socketTimeoutMS; - } - } - - // Get the name - var replicaSet = options.replicaSet || options.rs_name; - - // Set up options - finalOptions.setName = replicaSet; - - // Are we running in debug mode - var debug = typeof options.debug == 'boolean' ? options.debug : false; - if(debug) { - finalOptions.debug = debug; - } - - // Map keep alive setting - if(options.socketOptions && typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAlive = true; - if(typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAliveInitialDelay = options.socketOptions.keepAlive; - } - } - - // Connection timeout - if(options.socketOptions && typeof options.socketOptions.connectionTimeout == 'number') { - finalOptions.connectionTimeout = options.socketOptions.connectionTimeout; - } - - // Socket timeout - if(options.socketOptions && typeof options.socketOptions.socketTimeout == 'number') { - finalOptions.socketTimeout = options.socketOptions.socketTimeout; - } - - // noDelay - if(options.socketOptions && typeof options.socketOptions.noDelay == 'boolean') { - finalOptions.noDelay = options.socketOptions.noDelay; - } - - if(typeof options.secondaryAcceptableLatencyMS == 'number') { - finalOptions.acceptableLatency = options.secondaryAcceptableLatencyMS; - } - - if(options.connectWithNoPrimary == true) { - finalOptions.secondaryOnlyConnectionAllowed = true; - } - - // Add the non connection store - finalOptions.disconnectHandler = store; - - // Translate the options - if(options.sslCA) finalOptions.ca = options.sslCA; - if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate; - if(options.sslKey) finalOptions.key = options.sslKey; - if(options.sslCert) finalOptions.cert = options.sslCert; - if(options.sslPass) finalOptions.passphrase = options.sslPass; - - // Create the ReplSet - var replset = new CReplSet(seedlist, finalOptions) - // Server capabilities - var sCapabilities = null; - // Add auth prbufferMaxEntriesoviders - replset.addAuthProvider('mongocr', new MongoCR()); - - // Listen to reconnect event - replset.on('reconnect', function() { - self.emit('reconnect'); - store.execute(); - }); - - // Internal state - this.s = { - // Replicaset - replset: replset - // Server capabilities - , sCapabilities: null - // Debug tag - , tag: options.tag - // Store options - , storeOptions: storeOptions - // Cloned options - , clonedOptions: finalOptions - // Store - , store: store - // Options - , options: options - } - - // Debug - if(debug) { - // Last ismaster - Object.defineProperty(this, 'replset', { - enumerable:true, get: function() { return replset; } - }); - } - - // Last ismaster - Object.defineProperty(this, 'isMasterDoc', { - enumerable:true, get: function() { return replset.lastIsMaster(); } - }); - - // BSON property - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - return replset.bson; - } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return replset.haInterval; } - }); -} - -/** - * @ignore - */ -inherits(ReplSet, EventEmitter); - -var define = ReplSet.define = new Define('ReplSet', ReplSet, false); - -// Ensure the right read Preference object -var translateReadPreference = function(options) { - if(typeof options.readPreference == 'string') { - options.readPreference = new CoreReadPreference(options.readPreference); - } else if(options.readPreference instanceof ReadPreference) { - options.readPreference = new CoreReadPreference(options.readPreference.mode - , options.readPreference.tags); - } - - return options; -} - -ReplSet.prototype.parserType = function() { - return this.s.replset.parserType(); -} - -define.classMethod('parserType', {callback: false, promise:false, returns: [String]}); - -// Connect method -ReplSet.prototype.connect = function(db, _options, callback) { - var self = this; - if('function' === typeof _options) callback = _options, _options = {}; - if(_options == null) _options = {}; - if(!('function' === typeof callback)) callback = null; - self.s.options = _options; - - // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; - - // Actual handler - var errorHandler = function(event) { - return function(err) { - if(event != 'error') { - self.emit(event, err); - } - } - } - - // Connect handler - var connectHandler = function() { - // Clear out all the current handlers left over - ["timeout", "error", "close"].forEach(function(e) { - self.s.replset.removeAllListeners(e); - }); - - // Set up listeners - self.s.replset.once('timeout', errorHandler('timeout')); - self.s.replset.once('error', errorHandler('error')); - self.s.replset.once('close', errorHandler('close')); - - // relay the event - var relay = function(event) { - return function(t, server) { - self.emit(event, t, server); - } - } - - // Replset events relay - var replsetRelay = function(event) { - return function(t, server) { - self.emit(event, t, server.lastIsMaster(), server); - } - } - - // Relay ha - var relayHa = function(t, state) { - self.emit('ha', t, state); - - if(t == 'start') { - self.emit('ha_connect', t, state); - } else if(t == 'end') { - self.emit('ha_ismaster', t, state); - } - } - - // Set up serverConfig listeners - self.s.replset.on('joined', replsetRelay('joined')); - self.s.replset.on('left', relay('left')); - self.s.replset.on('ping', relay('ping')); - self.s.replset.on('ha', relayHa); - - self.s.replset.on('fullsetup', function(topology) { - self.emit('fullsetup', null, self); - }); - - self.s.replset.on('all', function(topology) { - self.emit('all', null, self); - }); - - // Emit open event - self.emit('open', null, self); - - // Return correctly - try { - callback(null, self); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - - // Error handler - var connectErrorHandler = function(event) { - return function(err) { - ['timeout', 'error', 'close'].forEach(function(e) { - self.s.replset.removeListener(e, connectErrorHandler); - }); - - self.s.replset.removeListener('connect', connectErrorHandler); - // Destroy the replset - self.s.replset.destroy(); - - // Try to callback - try { - callback(err); - } catch(err) { - if(!self.s.replset.isConnected()) - process.nextTick(function() { throw err; }) - } - } - } - - // Set up listeners - self.s.replset.once('timeout', connectErrorHandler('timeout')); - self.s.replset.once('error', connectErrorHandler('error')); - self.s.replset.once('close', connectErrorHandler('close')); - self.s.replset.once('connect', connectHandler); - - // Start connection - self.s.replset.connect(_options); -} - -// Server capabilities -ReplSet.prototype.capabilities = function() { - if(this.s.sCapabilities) return this.s.sCapabilities; - if(this.s.replset.lastIsMaster() == null) return null; - this.s.sCapabilities = new ServerCapabilities(this.s.replset.lastIsMaster()); - return this.s.sCapabilities; -} - -define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]}); - -// Command -ReplSet.prototype.command = function(ns, cmd, options, callback) { - options = translateReadPreference(options); - this.s.replset.command(ns, cmd, options, callback); -} - -define.classMethod('command', {callback: true, promise:false}); - -// Insert -ReplSet.prototype.insert = function(ns, ops, options, callback) { - this.s.replset.insert(ns, ops, options, callback); -} - -define.classMethod('insert', {callback: true, promise:false}); - -// Update -ReplSet.prototype.update = function(ns, ops, options, callback) { - this.s.replset.update(ns, ops, options, callback); -} - -define.classMethod('update', {callback: true, promise:false}); - -// Remove -ReplSet.prototype.remove = function(ns, ops, options, callback) { - this.s.replset.remove(ns, ops, options, callback); -} - -define.classMethod('remove', {callback: true, promise:false}); - -// IsConnected -ReplSet.prototype.isConnected = function() { - return this.s.replset.isConnected(); -} - -define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]}); - -ReplSet.prototype.setBSONParserType = function(type) { - return this.s.replset.setBSONParserType(type); -} - -// Insert -ReplSet.prototype.cursor = function(ns, cmd, options) { - options = translateReadPreference(options); - options.disconnectHandler = this.s.store; - return this.s.replset.cursor(ns, cmd, options); -} - -define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]}); - -ReplSet.prototype.lastIsMaster = function() { - return this.s.replset.lastIsMaster(); -} - -ReplSet.prototype.close = function(forceClosed) { - var self = this; - this.s.replset.destroy(); - // We need to wash out all stored processes - if(forceClosed == true) { - this.s.storeOptions.force = forceClosed; - this.s.store.flush(); - } - - var events = ['timeout', 'error', 'close', 'joined', 'left']; - events.forEach(function(e) { - self.removeAllListeners(e); - }); -} - -define.classMethod('close', {callback: false, promise:false}); - -ReplSet.prototype.auth = function() { - var args = Array.prototype.slice.call(arguments, 0); - this.s.replset.auth.apply(this.s.replset, args); -} - -define.classMethod('auth', {callback: true, promise:false}); - -/** - * All raw connections - * @method - * @return {array} - */ -ReplSet.prototype.connections = function() { - return this.s.replset.connections(); -} - -define.classMethod('connections', {callback: false, promise:false, returns:[Array]}); - -/** - * A replset connect event, used to verify that the connection is up and running - * - * @event ReplSet#connect - * @type {ReplSet} - */ - -/** - * The replset high availability event - * - * @event ReplSet#ha - * @type {function} - * @param {string} type The stage in the high availability event (start|end) - * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only - * @param {number} data.id The id for this high availability request - * @param {object} data.state An object containing the information about the current replicaset - */ - -/** - * A server member left the replicaset - * - * @event ReplSet#left - * @type {function} - * @param {string} type The type of member that left (primary|secondary|arbiter) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the replicaset - * - * @event ReplSet#joined - * @type {function} - * @param {string} type The type of member that joined (primary|secondary|arbiter) - * @param {Server} server The server object that joined - */ - -/** - * ReplSet open event, emitted when replicaset can start processing commands. - * - * @event ReplSet#open - * @type {Replset} - */ - -/** - * ReplSet fullsetup event, emitted when all servers in the topology have been connected to. - * - * @event ReplSet#fullsetup - * @type {Replset} - */ - -/** - * ReplSet close event - * - * @event ReplSet#close - * @type {object} - */ - -/** - * ReplSet error event, emitted if there is an error listener. - * - * @event ReplSet#error - * @type {MongoError} - */ - -/** - * ReplSet timeout event - * - * @event ReplSet#timeout - * @type {object} - */ - -/** - * ReplSet parseError event - * - * @event ReplSet#parseError - * @type {object} - */ - -module.exports = ReplSet; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/server.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/server.js deleted file mode 100644 index 2c4b4f5d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/server.js +++ /dev/null @@ -1,437 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , CServer = require('mongodb-core').Server - , Cursor = require('./cursor') - , AggregationCursor = require('./aggregation_cursor') - , CommandCursor = require('./command_cursor') - , f = require('util').format - , ServerCapabilities = require('./topology_base').ServerCapabilities - , Store = require('./topology_base').Store - , Define = require('./metadata') - , MongoError = require('mongodb-core').MongoError - , shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **Server** class is a class that represents a single server topology and is - * used to construct connections. - * - * **Server Should not be used, use MongoClient.connect** - * @example - * var Db = require('mongodb').Db, - * Server = require('mongodb').Server, - * test = require('assert'); - * // Connect using single Server - * var db = new Db('test', new Server('localhost', 27017);); - * db.open(function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new Server instance - * @class - * @deprecated - * @param {string} host The host for the server, can be either an IP4, IP6 or domain socket style host. - * @param {number} [port] The server port if IP4. - * @param {object} [options=null] Optional settings. - * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. - * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support) - * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {object} [options.socketOptions=null] Socket options - * @param {boolean} [options.socketOptions.autoReconnect=false] Reconnect on error. - * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option. - * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start. - * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting - * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting - * @param {number} [options.reconnectTries=30] Server attempt to reconnect #times - * @param {number} [options.reconnectInterval=1000] Server will wait # milliseconds between retries - * @fires Server#connect - * @fires Server#close - * @fires Server#error - * @fires Server#timeout - * @fires Server#parseError - * @fires Server#reconnect - * @return {Server} a Server instance. - */ -var Server = function(host, port, options) { - options = options || {}; - if(!(this instanceof Server)) return new Server(host, port, options); - EventEmitter.call(this); - var self = this; - - // Store option defaults - var storeOptions = { - force: false - , bufferMaxEntries: -1 - } - - // Shared global store - var store = options.store || new Store(self, storeOptions); - - // Detect if we have a socket connection - if(host.indexOf('\/') != -1) { - if(port != null && typeof port == 'object') { - options = port; - port = null; - } - } else if(port == null) { - throw MongoError.create({message: 'port must be specified', driver:true}); - } - - // Clone options - var clonedOptions = shallowClone(options); - clonedOptions.host = host; - clonedOptions.port = port; - - // Reconnect - var reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true; - reconnect = typeof options.autoReconnect == 'boolean' ? options.autoReconnect : reconnect; - var emitError = typeof options.emitError == 'boolean' ? options.emitError : true; - var poolSize = typeof options.poolSize == 'number' ? options.poolSize : 5; - - // Socket options passed down - if(options.socketOptions) { - if(options.socketOptions.connectTimeoutMS) { - this.connectTimeoutMS = options.socketOptions.connectTimeoutMS; - clonedOptions.connectionTimeout = options.socketOptions.connectTimeoutMS; - } - - if(options.socketOptions.socketTimeoutMS) { - clonedOptions.socketTimeout = options.socketOptions.socketTimeoutMS; - } - - if(typeof options.socketOptions.keepAlive == 'number') { - clonedOptions.keepAliveInitialDelay = options.socketOptions.keepAlive; - clonedOptions.keepAlive = true; - } - - if(typeof options.socketOptions.noDelay == 'boolean') { - clonedOptions.noDelay = options.socketOptions.noDelay; - } - } - - // Add the cursor factory function - clonedOptions.cursorFactory = Cursor; - clonedOptions.reconnect = reconnect; - clonedOptions.emitError = emitError; - clonedOptions.size = poolSize; - - // Translate the options - if(clonedOptions.sslCA) clonedOptions.ca = clonedOptions.sslCA; - if(typeof clonedOptions.sslValidate == 'boolean') clonedOptions.rejectUnauthorized = clonedOptions.sslValidate; - if(clonedOptions.sslKey) clonedOptions.key = clonedOptions.sslKey; - if(clonedOptions.sslCert) clonedOptions.cert = clonedOptions.sslCert; - if(clonedOptions.sslPass) clonedOptions.passphrase = clonedOptions.sslPass; - - // Add the non connection store - clonedOptions.disconnectHandler = store; - - // Create an instance of a server instance from mongodb-core - var server = new CServer(clonedOptions); - // Server capabilities - var sCapabilities = null; - - // Define the internal properties - this.s = { - // Create an instance of a server instance from mongodb-core - server: server - // Server capabilities - , sCapabilities: null - // Cloned options - , clonedOptions: clonedOptions - // Reconnect - , reconnect: reconnect - // Emit error - , emitError: emitError - // Pool size - , poolSize: poolSize - // Store Options - , storeOptions: storeOptions - // Store - , store: store - // Host - , host: host - // Port - , port: port - // Options - , options: options - } - - // BSON property - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - return self.s.server.bson; - } - }); - - // Last ismaster - Object.defineProperty(this, 'isMasterDoc', { - enumerable:true, get: function() { - return self.s.server.lastIsMaster(); - } - }); - - // Last ismaster - Object.defineProperty(this, 'poolSize', { - enumerable:true, get: function() { return self.s.server.connections().length; } - }); - - Object.defineProperty(this, 'autoReconnect', { - enumerable:true, get: function() { return self.s.reconnect; } - }); - - Object.defineProperty(this, 'host', { - enumerable:true, get: function() { return self.s.host; } - }); - - Object.defineProperty(this, 'port', { - enumerable:true, get: function() { return self.s.port; } - }); -} - -inherits(Server, EventEmitter); - -var define = Server.define = new Define('Server', Server, false); - -Server.prototype.parserType = function() { - return this.s.server.parserType(); -} - -define.classMethod('parserType', {callback: false, promise:false, returns: [String]}); - -// Connect -Server.prototype.connect = function(db, _options, callback) { - var self = this; - if('function' === typeof _options) callback = _options, _options = {}; - if(_options == null) _options = {}; - if(!('function' === typeof callback)) callback = null; - self.s.options = _options; - - // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; - - // Error handler - var connectErrorHandler = function(event) { - return function(err) { - // Remove all event handlers - var events = ['timeout', 'error', 'close']; - events.forEach(function(e) { - self.s.server.removeListener(e, connectHandlers[e]); - }); - - self.s.server.removeListener('connect', connectErrorHandler); - - // Try to callback - try { - callback(err); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - } - - // Actual handler - var errorHandler = function(event) { - return function(err) { - if(event != 'error') { - self.emit(event, err); - } - } - } - - // Error handler - var reconnectHandler = function(err) { - self.emit('reconnect', self); - self.s.store.execute(); - } - - // Destroy called on topology, perform cleanup - var destroyHandler = function() { - self.s.store.flush(); - } - - // Connect handler - var connectHandler = function() { - // Clear out all the current handlers left over - ["timeout", "error", "close"].forEach(function(e) { - self.s.server.removeAllListeners(e); - }); - - // Set up listeners - self.s.server.once('timeout', errorHandler('timeout')); - self.s.server.once('error', errorHandler('error')); - self.s.server.on('close', errorHandler('close')); - // Only called on destroy - self.s.server.once('destroy', destroyHandler); - - // Emit open event - self.emit('open', null, self); - - // Return correctly - try { - callback(null, self); - } catch(err) { - console.log(err.stack) - process.nextTick(function() { throw err; }) - } - } - - // Set up listeners - var connectHandlers = { - timeout: connectErrorHandler('timeout'), - error: connectErrorHandler('error'), - close: connectErrorHandler('close') - }; - - // Add the event handlers - self.s.server.once('timeout', connectHandlers.timeout); - self.s.server.once('error', connectHandlers.error); - self.s.server.once('close', connectHandlers.close); - self.s.server.once('connect', connectHandler); - // Reconnect server - self.s.server.on('reconnect', reconnectHandler); - - // Start connection - self.s.server.connect(_options); -} - -// Server capabilities -Server.prototype.capabilities = function() { - if(this.s.sCapabilities) return this.s.sCapabilities; - if(this.s.server.lastIsMaster() == null) return null; - this.s.sCapabilities = new ServerCapabilities(this.s.server.lastIsMaster()); - return this.s.sCapabilities; -} - -define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]}); - -// Command -Server.prototype.command = function(ns, cmd, options, callback) { - this.s.server.command(ns, cmd, options, callback); -} - -define.classMethod('command', {callback: true, promise:false}); - -// Insert -Server.prototype.insert = function(ns, ops, options, callback) { - this.s.server.insert(ns, ops, options, callback); -} - -define.classMethod('insert', {callback: true, promise:false}); - -// Update -Server.prototype.update = function(ns, ops, options, callback) { - this.s.server.update(ns, ops, options, callback); -} - -define.classMethod('update', {callback: true, promise:false}); - -// Remove -Server.prototype.remove = function(ns, ops, options, callback) { - this.s.server.remove(ns, ops, options, callback); -} - -define.classMethod('remove', {callback: true, promise:false}); - -// IsConnected -Server.prototype.isConnected = function() { - return this.s.server.isConnected(); -} - -define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]}); - -// Insert -Server.prototype.cursor = function(ns, cmd, options) { - options.disconnectHandler = this.s.store; - return this.s.server.cursor(ns, cmd, options); -} - -define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]}); - -Server.prototype.setBSONParserType = function(type) { - return this.s.server.setBSONParserType(type); -} - -Server.prototype.lastIsMaster = function() { - return this.s.server.lastIsMaster(); -} - -Server.prototype.close = function(forceClosed) { - this.s.server.destroy(); - // We need to wash out all stored processes - if(forceClosed == true) { - this.s.storeOptions.force = forceClosed; - this.s.store.flush(); - } -} - -define.classMethod('close', {callback: false, promise:false}); - -Server.prototype.auth = function() { - var args = Array.prototype.slice.call(arguments, 0); - this.s.server.auth.apply(this.s.server, args); -} - -define.classMethod('auth', {callback: true, promise:false}); - -/** - * All raw connections - * @method - * @return {array} - */ -Server.prototype.connections = function() { - return this.s.server.connections(); -} - -define.classMethod('connections', {callback: false, promise:false, returns:[Array]}); - -/** - * Server connect event - * - * @event Server#connect - * @type {object} - */ - -/** - * Server close event - * - * @event Server#close - * @type {object} - */ - -/** - * Server reconnect event - * - * @event Server#reconnect - * @type {object} - */ - -/** - * Server error event - * - * @event Server#error - * @type {MongoError} - */ - -/** - * Server timeout event - * - * @event Server#timeout - * @type {object} - */ - -/** - * Server parseError event - * - * @event Server#parseError - * @type {object} - */ - -module.exports = Server; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js deleted file mode 100644 index 000f7ece..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js +++ /dev/null @@ -1,152 +0,0 @@ -"use strict"; - -var MongoError = require('mongodb-core').MongoError - , f = require('util').format; - -// The store of ops -var Store = function(topology, storeOptions) { - var self = this; - var storedOps = []; - storeOptions = storeOptions || {force:false, bufferMaxEntries: -1} - - // Internal state - this.s = { - storedOps: storedOps - , storeOptions: storeOptions - , topology: topology - } - - Object.defineProperty(this, 'length', { - enumerable:true, get: function() { return self.s.storedOps.length; } - }); -} - -Store.prototype.add = function(opType, ns, ops, options, callback) { - if(this.s.storeOptions.force) { - return callback(MongoError.create({message: "db closed by application", driver:true})); - } - - if(this.s.storeOptions.bufferMaxEntries == 0) { - return callback(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - if(this.s.storeOptions.bufferMaxEntries > 0 && this.s.storedOps.length > this.s.storeOptions.bufferMaxEntries) { - while(this.s.storedOps.length > 0) { - var op = this.s.storedOps.shift(); - op.c(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - return; - } - - this.s.storedOps.push({t: opType, n: ns, o: ops, op: options, c: callback}) -} - -Store.prototype.addObjectAndMethod = function(opType, object, method, params, callback) { - if(this.s.storeOptions.force) { - return callback(MongoError.create({message: "db closed by application", driver:true })); - } - - if(this.s.storeOptions.bufferMaxEntries == 0) { - return callback(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - if(this.s.storeOptions.bufferMaxEntries > 0 && this.s.storedOps.length > this.s.storeOptions.bufferMaxEntries) { - while(this.s.storedOps.length > 0) { - var op = this.s.storedOps.shift(); - op.c(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - return; - } - - this.s.storedOps.push({t: opType, m: method, o: object, p: params, c: callback}) -} - -Store.prototype.flush = function() { - while(this.s.storedOps.length > 0) { - this.s.storedOps.shift().c(MongoError.create({message: f("no connection available for operation"), driver:true })); - } -} - -Store.prototype.execute = function() { - // Get current ops - var ops = this.s.storedOps; - // Reset the ops - this.s.storedOps = []; - - // Execute all the stored ops - while(ops.length > 0) { - var op = ops.shift(); - - if(op.t == 'cursor') { - op.o[op.m].apply(op.o, op.p); - } else { - this.s.topology[op.t](op.n, op.o, op.op, op.c); - } - } -} - -Store.prototype.all = function() { - return this.s.storedOps; -} - -// Server capabilities -var ServerCapabilities = function(ismaster) { - var setup_get_property = function(object, name, value) { - Object.defineProperty(object, name, { - enumerable: true - , get: function () { return value; } - }); - } - - // Capabilities - var aggregationCursor = false; - var writeCommands = false; - var textSearch = false; - var authCommands = false; - var listCollections = false; - var listIndexes = false; - var maxNumberOfDocsInBatch = ismaster.maxWriteBatchSize || 1000; - - if(ismaster.minWireVersion >= 0) { - textSearch = true; - } - - if(ismaster.maxWireVersion >= 1) { - aggregationCursor = true; - authCommands = true; - } - - if(ismaster.maxWireVersion >= 2) { - writeCommands = true; - } - - if(ismaster.maxWireVersion >= 3) { - listCollections = true; - listIndexes = true; - } - - // If no min or max wire version set to 0 - if(ismaster.minWireVersion == null) { - ismaster.minWireVersion = 0; - } - - if(ismaster.maxWireVersion == null) { - ismaster.maxWireVersion = 0; - } - - // Map up read only parameters - setup_get_property(this, "hasAggregationCursor", aggregationCursor); - setup_get_property(this, "hasWriteCommands", writeCommands); - setup_get_property(this, "hasTextSearch", textSearch); - setup_get_property(this, "hasAuthCommands", authCommands); - setup_get_property(this, "hasListCollectionsCommand", listCollections); - setup_get_property(this, "hasListIndexesCommand", listIndexes); - setup_get_property(this, "minWireVersion", ismaster.minWireVersion); - setup_get_property(this, "maxWireVersion", ismaster.maxWireVersion); - setup_get_property(this, "maxNumberOfDocsInBatch", maxNumberOfDocsInBatch); -} - -exports.Store = Store; -exports.ServerCapabilities = ServerCapabilities; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js deleted file mode 100644 index eccc1e00..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js +++ /dev/null @@ -1,295 +0,0 @@ -"use strict"; - -var ReadPreference = require('./read_preference'); - -module.exports = function(url, options) { - // Ensure we have a default options object if none set - options = options || {}; - // Variables - var connection_part = ''; - var auth_part = ''; - var query_string_part = ''; - var dbName = 'admin'; - - // Must start with mongodb - if(url.indexOf("mongodb://") != 0) - throw Error("URL must be in the format mongodb://user:pass@host:port/dbname"); - // If we have a ? mark cut the query elements off - if(url.indexOf("?") != -1) { - query_string_part = url.substr(url.indexOf("?") + 1); - connection_part = url.substring("mongodb://".length, url.indexOf("?")) - } else { - connection_part = url.substring("mongodb://".length); - } - - // Check if we have auth params - if(connection_part.indexOf("@") != -1) { - auth_part = connection_part.split("@")[0]; - connection_part = connection_part.split("@")[1]; - } - - // Check if the connection string has a db - if(connection_part.indexOf(".sock") != -1) { - if(connection_part.indexOf(".sock/") != -1) { - dbName = connection_part.split(".sock/")[1]; - connection_part = connection_part.split("/", connection_part.indexOf(".sock") + ".sock".length); - } - } else if(connection_part.indexOf("/") != -1) { - dbName = connection_part.split("/")[1]; - connection_part = connection_part.split("/")[0]; - } - - // Result object - var object = {}; - - // Pick apart the authentication part of the string - var authPart = auth_part || ''; - var auth = authPart.split(':', 2); - - // Decode the URI components - auth[0] = decodeURIComponent(auth[0]); - if(auth[1]){ - auth[1] = decodeURIComponent(auth[1]); - } - - // Add auth to final object if we have 2 elements - if(auth.length == 2) object.auth = {user: auth[0], password: auth[1]}; - - // Variables used for temporary storage - var hostPart; - var urlOptions; - var servers; - var serverOptions = {socketOptions: {}}; - var dbOptions = {read_preference_tags: []}; - var replSetServersOptions = {socketOptions: {}}; - // Add server options to final object - object.server_options = serverOptions; - object.db_options = dbOptions; - object.rs_options = replSetServersOptions; - object.mongos_options = {}; - - // Let's check if we are using a domain socket - if(url.match(/\.sock/)) { - // Split out the socket part - var domainSocket = url.substring( - url.indexOf("mongodb://") + "mongodb://".length - , url.lastIndexOf(".sock") + ".sock".length); - // Clean out any auth stuff if any - if(domainSocket.indexOf("@") != -1) domainSocket = domainSocket.split("@")[1]; - servers = [{domain_socket: domainSocket}]; - } else { - // Split up the db - hostPart = connection_part; - // Deduplicate servers - var deduplicatedServers = {}; - - // Parse all server results - servers = hostPart.split(',').map(function(h) { - var _host, _port, ipv6match; - //check if it matches [IPv6]:port, where the port number is optional - if ((ipv6match = /\[([^\]]+)\](?:\:(.+))?/.exec(h))) { - _host = ipv6match[1]; - _port = parseInt(ipv6match[2], 10) || 27017; - } else { - //otherwise assume it's IPv4, or plain hostname - var hostPort = h.split(':', 2); - _host = hostPort[0] || 'localhost'; - _port = hostPort[1] != null ? parseInt(hostPort[1], 10) : 27017; - // Check for localhost?safe=true style case - if(_host.indexOf("?") != -1) _host = _host.split(/\?/)[0]; - } - - // No entry returned for duplicate servr - if(deduplicatedServers[_host + "_" + _port]) return null; - deduplicatedServers[_host + "_" + _port] = 1; - - // Return the mapped object - return {host: _host, port: _port}; - }).filter(function(x) { - return x != null; - }); - } - - // Get the db name - object.dbName = dbName || 'admin'; - // Split up all the options - urlOptions = (query_string_part || '').split(/[&;]/); - // Ugh, we have to figure out which options go to which constructor manually. - urlOptions.forEach(function(opt) { - if(!opt) return; - var splitOpt = opt.split('='), name = splitOpt[0], value = splitOpt[1]; - // Options implementations - switch(name) { - case 'slaveOk': - case 'slave_ok': - serverOptions.slave_ok = (value == 'true'); - dbOptions.slaveOk = (value == 'true'); - break; - case 'maxPoolSize': - case 'poolSize': - serverOptions.poolSize = parseInt(value, 10); - replSetServersOptions.poolSize = parseInt(value, 10); - break; - case 'autoReconnect': - case 'auto_reconnect': - serverOptions.auto_reconnect = (value == 'true'); - break; - case 'minPoolSize': - throw new Error("minPoolSize not supported"); - case 'maxIdleTimeMS': - throw new Error("maxIdleTimeMS not supported"); - case 'waitQueueMultiple': - throw new Error("waitQueueMultiple not supported"); - case 'waitQueueTimeoutMS': - throw new Error("waitQueueTimeoutMS not supported"); - case 'uuidRepresentation': - throw new Error("uuidRepresentation not supported"); - case 'ssl': - if(value == 'prefer') { - serverOptions.ssl = value; - replSetServersOptions.ssl = value; - break; - } - serverOptions.ssl = (value == 'true'); - replSetServersOptions.ssl = (value == 'true'); - break; - case 'replicaSet': - case 'rs_name': - replSetServersOptions.rs_name = value; - break; - case 'reconnectWait': - replSetServersOptions.reconnectWait = parseInt(value, 10); - break; - case 'retries': - replSetServersOptions.retries = parseInt(value, 10); - break; - case 'readSecondary': - case 'read_secondary': - replSetServersOptions.read_secondary = (value == 'true'); - break; - case 'fsync': - dbOptions.fsync = (value == 'true'); - break; - case 'journal': - dbOptions.j = (value == 'true'); - break; - case 'safe': - dbOptions.safe = (value == 'true'); - break; - case 'nativeParser': - case 'native_parser': - dbOptions.native_parser = (value == 'true'); - break; - case 'readConcernLevel': - dbOptions.readConcern = {level: value}; - break; - case 'connectTimeoutMS': - serverOptions.socketOptions.connectTimeoutMS = parseInt(value, 10); - replSetServersOptions.socketOptions.connectTimeoutMS = parseInt(value, 10); - break; - case 'socketTimeoutMS': - serverOptions.socketOptions.socketTimeoutMS = parseInt(value, 10); - replSetServersOptions.socketOptions.socketTimeoutMS = parseInt(value, 10); - break; - case 'w': - dbOptions.w = parseInt(value, 10); - if(isNaN(dbOptions.w)) dbOptions.w = value; - break; - case 'authSource': - dbOptions.authSource = value; - break; - case 'gssapiServiceName': - dbOptions.gssapiServiceName = value; - break; - case 'authMechanism': - if(value == 'GSSAPI') { - // If no password provided decode only the principal - if(object.auth == null) { - var urlDecodeAuthPart = decodeURIComponent(authPart); - if(urlDecodeAuthPart.indexOf("@") == -1) throw new Error("GSSAPI requires a provided principal"); - object.auth = {user: urlDecodeAuthPart, password: null}; - } else { - object.auth.user = decodeURIComponent(object.auth.user); - } - } else if(value == 'MONGODB-X509') { - object.auth = {user: decodeURIComponent(authPart)}; - } - - // Only support GSSAPI or MONGODB-CR for now - if(value != 'GSSAPI' - && value != 'MONGODB-X509' - && value != 'MONGODB-CR' - && value != 'DEFAULT' - && value != 'SCRAM-SHA-1' - && value != 'PLAIN') - throw new Error("only DEFAULT, GSSAPI, PLAIN, MONGODB-X509, SCRAM-SHA-1 or MONGODB-CR is supported by authMechanism"); - - // Authentication mechanism - dbOptions.authMechanism = value; - break; - case 'authMechanismProperties': - // Split up into key, value pairs - var values = value.split(','); - var o = {}; - // For each value split into key, value - values.forEach(function(x) { - var v = x.split(':'); - o[v[0]] = v[1]; - }); - - // Set all authMechanismProperties - dbOptions.authMechanismProperties = o; - // Set the service name value - if(typeof o.SERVICE_NAME == 'string') dbOptions.gssapiServiceName = o.SERVICE_NAME; - break; - case 'wtimeoutMS': - dbOptions.wtimeout = parseInt(value, 10); - break; - case 'readPreference': - if(!ReadPreference.isValid(value)) throw new Error("readPreference must be either primary/primaryPreferred/secondary/secondaryPreferred/nearest"); - dbOptions.read_preference = value; - break; - case 'readPreferenceTags': - // Decode the value - value = decodeURIComponent(value); - // Contains the tag object - var tagObject = {}; - if(value == null || value == '') { - dbOptions.read_preference_tags.push(tagObject); - break; - } - - // Split up the tags - var tags = value.split(/\,/); - for(var i = 0; i < tags.length; i++) { - var parts = tags[i].trim().split(/\:/); - tagObject[parts[0]] = parts[1]; - } - - // Set the preferences tags - dbOptions.read_preference_tags.push(tagObject); - break; - default: - break; - } - }); - - // No tags: should be null (not []) - if(dbOptions.read_preference_tags.length === 0) { - dbOptions.read_preference_tags = null; - } - - // Validate if there are an invalid write concern combinations - if((dbOptions.w == -1 || dbOptions.w == 0) && ( - dbOptions.journal == true - || dbOptions.fsync == true - || dbOptions.safe == true)) throw new Error("w set to -1 or 0 cannot be combined with safe/w/journal/fsync") - - // If no read preference set it to primary - if(!dbOptions.read_preference) dbOptions.read_preference = 'primary'; - - // Add servers to result - object.servers = servers; - // Returned parsed object - return object; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/lib/utils.js b/Associations/node_modules/mongoose/node_modules/mongodb/lib/utils.js deleted file mode 100644 index cb20e67a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/lib/utils.js +++ /dev/null @@ -1,234 +0,0 @@ -"use strict"; - -var MongoError = require('mongodb-core').MongoError, - f = require('util').format; - -var shallowClone = function(obj) { - var copy = {}; - for(var name in obj) copy[name] = obj[name]; - return copy; -} - -// Set simple property -var getSingleProperty = function(obj, name, value) { - Object.defineProperty(obj, name, { - enumerable:true, - get: function() { - return value - } - }); -} - -var formatSortValue = exports.formatSortValue = function(sortDirection) { - var value = ("" + sortDirection).toLowerCase(); - - switch (value) { - case 'ascending': - case 'asc': - case '1': - return 1; - case 'descending': - case 'desc': - case '-1': - return -1; - default: - throw new Error("Illegal sort clause, must be of the form " - + "[['field1', '(ascending|descending)'], " - + "['field2', '(ascending|descending)']]"); - } -}; - -var formattedOrderClause = exports.formattedOrderClause = function(sortValue) { - var orderBy = {}; - if(sortValue == null) return null; - if (Array.isArray(sortValue)) { - if(sortValue.length === 0) { - return null; - } - - for(var i = 0; i < sortValue.length; i++) { - if(sortValue[i].constructor == String) { - orderBy[sortValue[i]] = 1; - } else { - orderBy[sortValue[i][0]] = formatSortValue(sortValue[i][1]); - } - } - } else if(sortValue != null && typeof sortValue == 'object') { - orderBy = sortValue; - } else if (typeof sortValue == 'string') { - orderBy[sortValue] = 1; - } else { - throw new Error("Illegal sort clause, must be of the form " + - "[['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]"); - } - - return orderBy; -}; - -var checkCollectionName = function checkCollectionName (collectionName) { - if('string' !== typeof collectionName) { - throw Error("collection name must be a String"); - } - - if(!collectionName || collectionName.indexOf('..') != -1) { - throw Error("collection names cannot be empty"); - } - - if(collectionName.indexOf('$') != -1 && - collectionName.match(/((^\$cmd)|(oplog\.\$main))/) == null) { - throw Error("collection names must not contain '$'"); - } - - if(collectionName.match(/^\.|\.$/) != null) { - throw Error("collection names must not start or end with '.'"); - } - - // Validate that we are not passing 0x00 in the colletion name - if(!!~collectionName.indexOf("\x00")) { - throw new Error("collection names cannot contain a null character"); - } -}; - -var handleCallback = function(callback, err, value1, value2) { - try { - if(callback == null) return; - if(value2) return callback(err, value1, value2); - return callback(err, value1); - } catch(err) { - process.nextTick(function() { throw err; }); - return false; - } - - return true; -} - -/** - * Wrap a Mongo error document in an Error instance - * @ignore - * @api private - */ -var toError = function(error) { - if (error instanceof Error) return error; - - var msg = error.err || error.errmsg || error.errMessage || error; - var e = MongoError.create({message: msg, driver:true}); - - // Get all object keys - var keys = typeof error == 'object' - ? Object.keys(error) - : []; - - for(var i = 0; i < keys.length; i++) { - e[keys[i]] = error[keys[i]]; - } - - return e; -} - -/** - * @ignore - */ -var normalizeHintField = function normalizeHintField(hint) { - var finalHint = null; - - if(typeof hint == 'string') { - finalHint = hint; - } else if(Array.isArray(hint)) { - finalHint = {}; - - hint.forEach(function(param) { - finalHint[param] = 1; - }); - } else if(hint != null && typeof hint == 'object') { - finalHint = {}; - for (var name in hint) { - finalHint[name] = hint[name]; - } - } - - return finalHint; -}; - -/** - * Create index name based on field spec - * - * @ignore - * @api private - */ -var parseIndexOptions = function(fieldOrSpec) { - var fieldHash = {}; - var indexes = []; - var keys; - - // Get all the fields accordingly - if('string' == typeof fieldOrSpec) { - // 'type' - indexes.push(fieldOrSpec + '_' + 1); - fieldHash[fieldOrSpec] = 1; - } else if(Array.isArray(fieldOrSpec)) { - fieldOrSpec.forEach(function(f) { - if('string' == typeof f) { - // [{location:'2d'}, 'type'] - indexes.push(f + '_' + 1); - fieldHash[f] = 1; - } else if(Array.isArray(f)) { - // [['location', '2d'],['type', 1]] - indexes.push(f[0] + '_' + (f[1] || 1)); - fieldHash[f[0]] = f[1] || 1; - } else if(isObject(f)) { - // [{location:'2d'}, {type:1}] - keys = Object.keys(f); - keys.forEach(function(k) { - indexes.push(k + '_' + f[k]); - fieldHash[k] = f[k]; - }); - } else { - // undefined (ignore) - } - }); - } else if(isObject(fieldOrSpec)) { - // {location:'2d', type:1} - keys = Object.keys(fieldOrSpec); - keys.forEach(function(key) { - indexes.push(key + '_' + fieldOrSpec[key]); - fieldHash[key] = fieldOrSpec[key]; - }); - } - - return { - name: indexes.join("_"), keys: keys, fieldHash: fieldHash - } -} - -var isObject = exports.isObject = function (arg) { - return '[object Object]' == toString.call(arg) -} - -var debugOptions = function(debugFields, options) { - var finaloptions = {}; - debugFields.forEach(function(n) { - finaloptions[n] = options[n]; - }); - - return finaloptions; -} - -var decorateCommand = function(command, options, exclude) { - for(var name in options) { - if(exclude[name] == null) command[name] = options[name]; - } - - return command; -} - -exports.shallowClone = shallowClone; -exports.getSingleProperty = getSingleProperty; -exports.checkCollectionName = checkCollectionName; -exports.toError = toError; -exports.formattedOrderClause = formattedOrderClause; -exports.parseIndexOptions = parseIndexOptions; -exports.normalizeHintField = normalizeHintField; -exports.handleCallback = handleCallback; -exports.decorateCommand = decorateCommand; -exports.isObject = isObject; -exports.debugOptions = debugOptions; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/load.js b/Associations/node_modules/mongoose/node_modules/mongodb/load.js deleted file mode 100644 index 01b570e9..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/load.js +++ /dev/null @@ -1,32 +0,0 @@ -var MongoClient = require('./').MongoClient; - -MongoClient.connect('mongodb://localhost:27017/test', function(err, db) { - var col = db.collection('test'); - col.ensureIndex({dt:-1}, function() { - var docs = []; - for(var i = 0; i < 100; i++) { - docs.push({a:i, dt:i, ot:i}); - } - console.log("------------------------------- 0") - - col.insertMany(docs, function() { - // Start firing finds - - for(var i = 0; i < 100; i++) { - setInterval(function() { - col.find({}, {_id: 0, ot:0}).limit(2).sort({dt:-1}).toArray(function(err) { - console.log("-------------------------------- 1") - }); - }, 10) - } - - // while(true) { - // - // // console.log("------------------------------- 1") - // col.find({}, {_id: 0, ot:0}).limit(2).sort({dt:-1}).toArray(function(err) { - // console.log("-------------------------------- 1") - // }); - // } - }); - }); -}); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md deleted file mode 100644 index e06b4967..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md +++ /dev/null @@ -1,9 +0,0 @@ -# Master - -# 2.0.0 - -* re-sync with RSVP. Many large performance improvements and bugfixes. - -# 1.0.0 - -* first subset of RSVP diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE deleted file mode 100644 index 954ec599..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors - -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/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md deleted file mode 100644 index ca8678e2..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js)) - -This is a polyfill of the [ES6 Promise](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-constructor). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js), if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js). - -For API details and how to use promises, see the JavaScript Promises HTML5Rocks article. - -## Downloads - -* [es6-promise](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise.js) -* [es6-promise-min](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise-min.js) - -## Node.js - -To install: - -```sh -npm install es6-promise -``` - -To use: - -```js -var Promise = require('es6-promise').Promise; -``` - -## Usage in IE<9 - -`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, you can use a string to access the property as shown in the following example. - -However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production: - -```js -promise['catch'](function(err) { - // ... -}); -``` - -Or use `.then` instead: - -```js -promise.then(undefined, function(err) { - // ... -}); -``` - -## Auto-polyfill - -To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet: - -```js -require('es6-promise').polyfill(); -``` - -Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called. - -## Building & Testing - -* `npm run build` to build -* `npm test` to run tests -* `npm start` to run a build watcher, and webserver to test -* `npm run test:server` for a testem test runner and watching builder diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js deleted file mode 100644 index 308f3acb..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js +++ /dev/null @@ -1,957 +0,0 @@ -/*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE - * @version 2.1.1 - */ - -(function() { - "use strict"; - function lib$es6$promise$utils$$objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); - } - - function lib$es6$promise$utils$$isFunction(x) { - return typeof x === 'function'; - } - - function lib$es6$promise$utils$$isMaybeThenable(x) { - return typeof x === 'object' && x !== null; - } - - var lib$es6$promise$utils$$_isArray; - if (!Array.isArray) { - lib$es6$promise$utils$$_isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; - } else { - lib$es6$promise$utils$$_isArray = Array.isArray; - } - - var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; - var lib$es6$promise$asap$$len = 0; - var lib$es6$promise$asap$$toString = {}.toString; - var lib$es6$promise$asap$$vertxNext; - function lib$es6$promise$asap$$asap(callback, arg) { - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; - lib$es6$promise$asap$$len += 2; - if (lib$es6$promise$asap$$len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - lib$es6$promise$asap$$scheduleFlush(); - } - } - - var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; - - var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; - var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; - var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; - var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - - // test for web worker but not in IE10 - var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - - // node - function lib$es6$promise$asap$$useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(lib$es6$promise$asap$$flush); - }; - } - - // vertx - function lib$es6$promise$asap$$useVertxTimer() { - return function() { - lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); - }; - } - - function lib$es6$promise$asap$$useMutationObserver() { - var iterations = 0; - var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; - } - - // web worker - function lib$es6$promise$asap$$useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = lib$es6$promise$asap$$flush; - return function () { - channel.port2.postMessage(0); - }; - } - - function lib$es6$promise$asap$$useSetTimeout() { - return function() { - setTimeout(lib$es6$promise$asap$$flush, 1); - }; - } - - var lib$es6$promise$asap$$queue = new Array(1000); - function lib$es6$promise$asap$$flush() { - for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { - var callback = lib$es6$promise$asap$$queue[i]; - var arg = lib$es6$promise$asap$$queue[i+1]; - - callback(arg); - - lib$es6$promise$asap$$queue[i] = undefined; - lib$es6$promise$asap$$queue[i+1] = undefined; - } - - lib$es6$promise$asap$$len = 0; - } - - function lib$es6$promise$asap$$attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; - return lib$es6$promise$asap$$useVertxTimer(); - } catch(e) { - return lib$es6$promise$asap$$useSetTimeout(); - } - } - - var lib$es6$promise$asap$$scheduleFlush; - // Decide what async method to use to triggering processing of queued callbacks: - if (lib$es6$promise$asap$$isNode) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); - } else if (lib$es6$promise$asap$$BrowserMutationObserver) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); - } else if (lib$es6$promise$asap$$isWorker) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); - } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); - } else { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); - } - - function lib$es6$promise$$internal$$noop() {} - - var lib$es6$promise$$internal$$PENDING = void 0; - var lib$es6$promise$$internal$$FULFILLED = 1; - var lib$es6$promise$$internal$$REJECTED = 2; - - var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); - } - - function lib$es6$promise$$internal$$cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); - } - - function lib$es6$promise$$internal$$getThen(promise) { - try { - return promise.then; - } catch(error) { - lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; - return lib$es6$promise$$internal$$GET_THEN_ERROR; - } - } - - function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } - } - - function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { - lib$es6$promise$asap$$default(function(promise) { - var sealed = false; - var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - lib$es6$promise$$internal$$resolve(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - lib$es6$promise$$internal$$reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - lib$es6$promise$$internal$$reject(promise, error); - } - }, promise); - } - - function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { - if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, thenable._result); - } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, thenable._result); - } else { - lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { - lib$es6$promise$$internal$$resolve(promise, value); - }, function(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } - } - - function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); - } else { - var then = lib$es6$promise$$internal$$getThen(maybeThenable); - - if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); - } else if (then === undefined) { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } else if (lib$es6$promise$utils$$isFunction(then)) { - lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); - } else { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } - } - } - - function lib$es6$promise$$internal$$resolve(promise, value) { - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); - } else if (lib$es6$promise$utils$$objectOrFunction(value)) { - lib$es6$promise$$internal$$handleMaybeThenable(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - } - - function lib$es6$promise$$internal$$publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - lib$es6$promise$$internal$$publish(promise); - } - - function lib$es6$promise$$internal$$fulfill(promise, value) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - - promise._result = value; - promise._state = lib$es6$promise$$internal$$FULFILLED; - - if (promise._subscribers.length !== 0) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); - } - } - - function lib$es6$promise$$internal$$reject(promise, reason) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - promise._state = lib$es6$promise$$internal$$REJECTED; - promise._result = reason; - - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); - } - - function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; - subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; - - if (length === 0 && parent._state) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); - } - } - - function lib$es6$promise$$internal$$publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; - } - - function lib$es6$promise$$internal$$ErrorObject() { - this.error = null; - } - - var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; - return lib$es6$promise$$internal$$TRY_CATCH_ERROR; - } - } - - function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { - var hasCallback = lib$es6$promise$utils$$isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = lib$es6$promise$$internal$$tryCatch(callback, detail); - - if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== lib$es6$promise$$internal$$PENDING) { - // noop - } else if (hasCallback && succeeded) { - lib$es6$promise$$internal$$resolve(promise, value); - } else if (failed) { - lib$es6$promise$$internal$$reject(promise, error); - } else if (settled === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, value); - } else if (settled === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } - } - - function lib$es6$promise$$internal$$initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - lib$es6$promise$$internal$$resolve(promise, value); - }, function rejectPromise(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } catch(e) { - lib$es6$promise$$internal$$reject(promise, e); - } - } - - function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } - } - } else { - lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); - } - } - - lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { - return lib$es6$promise$utils$$isArray(input); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { - this._result = new Array(this.length); - }; - - var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; - - lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (lib$es6$promise$utils$$isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === lib$es6$promise$$internal$$PENDING) { - enumerator._remaining--; - - if (state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(promise, enumerator._result); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { - enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); - }); - }; - function lib$es6$promise$promise$all$$all(entries) { - return new lib$es6$promise$enumerator$$default(this, entries).promise; - } - var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; - function lib$es6$promise$promise$race$$race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (!lib$es6$promise$utils$$isArray(entries)) { - lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - lib$es6$promise$$internal$$resolve(promise, value); - } - - function onRejection(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - } - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; - } - var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; - function lib$es6$promise$promise$resolve$$resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$resolve(promise, object); - return promise; - } - var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; - function lib$es6$promise$promise$reject$$reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$reject(promise, reason); - return promise; - } - var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; - - var lib$es6$promise$promise$$counter = 0; - - function lib$es6$promise$promise$$needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - function lib$es6$promise$promise$$needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; - /** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor - */ - function lib$es6$promise$promise$$Promise(resolver) { - this._id = lib$es6$promise$promise$$counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (lib$es6$promise$$internal$$noop !== resolver) { - if (!lib$es6$promise$utils$$isFunction(resolver)) { - lib$es6$promise$promise$$needsResolver(); - } - - if (!(this instanceof lib$es6$promise$promise$$Promise)) { - lib$es6$promise$promise$$needsNew(); - } - - lib$es6$promise$$internal$$initializePromise(this, resolver); - } - } - - lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; - lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; - lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; - lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; - - lib$es6$promise$promise$$Promise.prototype = { - constructor: lib$es6$promise$promise$$Promise, - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(lib$es6$promise$$internal$$noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - lib$es6$promise$asap$$default(function(){ - lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); - }); - } else { - lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - function lib$es6$promise$polyfill$$polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = lib$es6$promise$promise$$default; - } - var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; - - var lib$es6$promise$umd$$ES6Promise = { - 'Promise': lib$es6$promise$promise$$default, - 'polyfill': lib$es6$promise$polyfill$$default - }; - - /* global define:true module:true window: true */ - if (typeof define === 'function' && define['amd']) { - define(function() { return lib$es6$promise$umd$$ES6Promise; }); - } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = lib$es6$promise$umd$$ES6Promise; - } else if (typeof this !== 'undefined') { - this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; - } - - lib$es6$promise$polyfill$$default(); -}).call(this); - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js deleted file mode 100644 index 0552e12e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE - * @version 2.1.1 - */ - -(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;i -// -// 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 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. - -// when used in node, this will actually load the util module we depend on -// versus loading the builtin util module as happens otherwise -// this is a bug in node module loading as far as I am concerned -var util = require('util/'); - -var pSlice = Array.prototype.slice; -var hasOwn = Object.prototype.hasOwnProperty; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } - else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = stackStartFunction.name; - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try { - var ka = objectKeys(a), - kb = objectKeys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -},{"util/":6}],3:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],4:[function(require,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; - -process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canMutationObserver = typeof window !== 'undefined' - && window.MutationObserver; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; - } - - var queue = []; - - if (canMutationObserver) { - var hiddenDiv = document.createElement("div"); - var observer = new MutationObserver(function () { - var queueList = queue.slice(); - queue.length = 0; - queueList.forEach(function (fn) { - fn(); - }); - }); - - observer.observe(hiddenDiv, { attributes: true }); - - return function nextTick(fn) { - if (!queue.length) { - hiddenDiv.setAttribute('yes', 'no'); - } - queue.push(fn); - }; - } - - if (canPost) { - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } - } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; - } - - return function nextTick(fn) { - setTimeout(fn, 0); - }; -})(); - -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -// TODO(shtylman) -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; - -},{}],5:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],6:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":5,"_process":4,"inherits":3}],7:[function(require,module,exports){ -require("./tests/2.1.2"); -require("./tests/2.1.3"); -require("./tests/2.2.1"); -require("./tests/2.2.2"); -require("./tests/2.2.3"); -require("./tests/2.2.4"); -require("./tests/2.2.5"); -require("./tests/2.2.6"); -require("./tests/2.2.7"); -require("./tests/2.3.1"); -require("./tests/2.3.2"); -require("./tests/2.3.3"); -require("./tests/2.3.4"); - -},{"./tests/2.1.2":8,"./tests/2.1.3":9,"./tests/2.2.1":10,"./tests/2.2.2":11,"./tests/2.2.3":12,"./tests/2.2.4":13,"./tests/2.2.5":14,"./tests/2.2.6":15,"./tests/2.2.7":16,"./tests/2.3.1":17,"./tests/2.3.2":18,"./tests/2.3.3":19,"./tests/2.3.4":20}],8:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; - -var adapter = global.adapter; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.1.2.1: When fulfilled, a promise: must not transition to any other state.", function () { - testFulfilled(dummy, function (promise, done) { - var onFulfilledCalled = false; - - promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - setTimeout(done, 100); - }); - - specify("trying to fulfill then immediately reject", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - d.resolve(dummy); - d.reject(dummy); - setTimeout(done, 100); - }); - - specify("trying to fulfill then reject, delayed", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - setTimeout(function () { - d.resolve(dummy); - d.reject(dummy); - }, 50); - setTimeout(done, 100); - }); - - specify("trying to fulfill immediately then reject delayed", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - d.resolve(dummy); - setTimeout(function () { - d.reject(dummy); - }, 50); - setTimeout(done, 100); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],9:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testRejected = require("./helpers/testThreeCases").testRejected; - -var adapter = global.adapter; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.1.3.1: When rejected, a promise: must not transition to any other state.", function () { - testRejected(dummy, function (promise, done) { - var onRejectedCalled = false; - - promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - setTimeout(done, 100); - }); - - specify("trying to reject then immediately fulfill", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - d.reject(dummy); - d.resolve(dummy); - setTimeout(done, 100); - }); - - specify("trying to reject then fulfill, delayed", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - setTimeout(function () { - d.reject(dummy); - d.resolve(dummy); - }, 50); - setTimeout(done, 100); - }); - - specify("trying to reject immediately then fulfill delayed", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - d.reject(dummy); - setTimeout(function () { - d.resolve(dummy); - }, 50); - setTimeout(done, 100); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],10:[function(require,module,exports){ -(function (global){ -"use strict"; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.2.1: Both `onFulfilled` and `onRejected` are optional arguments.", function () { - describe("2.2.1.1: If `onFulfilled` is not a function, it must be ignored.", function () { - describe("applied to a directly-rejected promise", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onFulfilled` is " + stringRepresentation, function (done) { - rejected(dummy).then(nonFunction, function () { - done(); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - - describe("applied to a promise rejected and then chained off of", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onFulfilled` is " + stringRepresentation, function (done) { - rejected(dummy).then(function () { }, undefined).then(nonFunction, function () { - done(); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - }); - - describe("2.2.1.2: If `onRejected` is not a function, it must be ignored.", function () { - describe("applied to a directly-fulfilled promise", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onRejected` is " + stringRepresentation, function (done) { - resolved(dummy).then(function () { - done(); - }, nonFunction); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - - describe("applied to a promise fulfilled and then chained off of", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onFulfilled` is " + stringRepresentation, function (done) { - resolved(dummy).then(undefined, function () { }).then(function () { - done(); - }, nonFunction); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],11:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality - -describe("2.2.2: If `onFulfilled` is a function,", function () { - describe("2.2.2.1: it must be called after `promise` is fulfilled, with `promise`’s fulfillment value as its " + - "first argument.", function () { - testFulfilled(sentinel, function (promise, done) { - promise.then(function onFulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("2.2.2.2: it must not be called before `promise` is fulfilled", function () { - specify("fulfilled after a delay", function (done) { - var d = deferred(); - var isFulfilled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(isFulfilled, true); - done(); - }); - - setTimeout(function () { - d.resolve(dummy); - isFulfilled = true; - }, 50); - }); - - specify("never fulfilled", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - done(); - }); - - setTimeout(function () { - assert.strictEqual(onFulfilledCalled, false); - done(); - }, 150); - }); - }); - - describe("2.2.2.3: it must not be called more than once.", function () { - specify("already-fulfilled", function (done) { - var timesCalled = 0; - - resolved(dummy).then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - }); - - specify("trying to fulfill a pending promise more than once, immediately", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.resolve(dummy); - d.resolve(dummy); - }); - - specify("trying to fulfill a pending promise more than once, delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - setTimeout(function () { - d.resolve(dummy); - d.resolve(dummy); - }, 50); - }); - - specify("trying to fulfill a pending promise more than once, immediately then delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.resolve(dummy); - setTimeout(function () { - d.resolve(dummy); - }, 50); - }); - - specify("when multiple `then` calls are made, spaced apart in time", function (done) { - var d = deferred(); - var timesCalled = [0, 0, 0]; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[0], 1); - }); - - setTimeout(function () { - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[1], 1); - }); - }, 50); - - setTimeout(function () { - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[2], 1); - done(); - }); - }, 100); - - setTimeout(function () { - d.resolve(dummy); - }, 150); - }); - - specify("when `then` is interleaved with fulfillment", function (done) { - var d = deferred(); - var timesCalled = [0, 0]; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[0], 1); - }); - - d.resolve(dummy); - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[1], 1); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],12:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testRejected = require("./helpers/testThreeCases").testRejected; - -var adapter = global.adapter; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality - -describe("2.2.3: If `onRejected` is a function,", function () { - describe("2.2.3.1: it must be called after `promise` is rejected, with `promise`’s rejection reason as its " + - "first argument.", function () { - testRejected(sentinel, function (promise, done) { - promise.then(null, function onRejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("2.2.3.2: it must not be called before `promise` is rejected", function () { - specify("rejected after a delay", function (done) { - var d = deferred(); - var isRejected = false; - - d.promise.then(null, function onRejected() { - assert.strictEqual(isRejected, true); - done(); - }); - - setTimeout(function () { - d.reject(dummy); - isRejected = true; - }, 50); - }); - - specify("never rejected", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(null, function onRejected() { - onRejectedCalled = true; - done(); - }); - - setTimeout(function () { - assert.strictEqual(onRejectedCalled, false); - done(); - }, 150); - }); - }); - - describe("2.2.3.3: it must not be called more than once.", function () { - specify("already-rejected", function (done) { - var timesCalled = 0; - - rejected(dummy).then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - }); - - specify("trying to reject a pending promise more than once, immediately", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.reject(dummy); - d.reject(dummy); - }); - - specify("trying to reject a pending promise more than once, delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - setTimeout(function () { - d.reject(dummy); - d.reject(dummy); - }, 50); - }); - - specify("trying to reject a pending promise more than once, immediately then delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.reject(dummy); - setTimeout(function () { - d.reject(dummy); - }, 50); - }); - - specify("when multiple `then` calls are made, spaced apart in time", function (done) { - var d = deferred(); - var timesCalled = [0, 0, 0]; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[0], 1); - }); - - setTimeout(function () { - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[1], 1); - }); - }, 50); - - setTimeout(function () { - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[2], 1); - done(); - }); - }, 100); - - setTimeout(function () { - d.reject(dummy); - }, 150); - }); - - specify("when `then` is interleaved with rejection", function (done) { - var d = deferred(); - var timesCalled = [0, 0]; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[0], 1); - }); - - d.reject(dummy); - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[1], 1); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],13:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.2.4: `onFulfilled` or `onRejected` must not be called until the execution context stack contains only " + - "platform code.", function () { - describe("`then` returns before the promise becomes fulfilled or rejected", function () { - testFulfilled(dummy, function (promise, done) { - var thenHasReturned = false; - - promise.then(function onFulfilled() { - assert.strictEqual(thenHasReturned, true); - done(); - }); - - thenHasReturned = true; - }); - testRejected(dummy, function (promise, done) { - var thenHasReturned = false; - - promise.then(null, function onRejected() { - assert.strictEqual(thenHasReturned, true); - done(); - }); - - thenHasReturned = true; - }); - }); - - describe("Clean-stack execution ordering tests (fulfillment case)", function () { - specify("when `onFulfilled` is added immediately before the promise is fulfilled", - function () { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }); - - d.resolve(dummy); - - assert.strictEqual(onFulfilledCalled, false); - }); - - specify("when `onFulfilled` is added immediately after the promise is fulfilled", - function () { - var d = deferred(); - var onFulfilledCalled = false; - - d.resolve(dummy); - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }); - - assert.strictEqual(onFulfilledCalled, false); - }); - - specify("when one `onFulfilled` is added inside another `onFulfilled`", function (done) { - var promise = resolved(); - var firstOnFulfilledFinished = false; - - promise.then(function () { - promise.then(function () { - assert.strictEqual(firstOnFulfilledFinished, true); - done(); - }); - firstOnFulfilledFinished = true; - }); - }); - - specify("when `onFulfilled` is added inside an `onRejected`", function (done) { - var promise = rejected(); - var promise2 = resolved(); - var firstOnRejectedFinished = false; - - promise.then(null, function () { - promise2.then(function () { - assert.strictEqual(firstOnRejectedFinished, true); - done(); - }); - firstOnRejectedFinished = true; - }); - }); - - specify("when the promise is fulfilled asynchronously", function (done) { - var d = deferred(); - var firstStackFinished = false; - - setTimeout(function () { - d.resolve(dummy); - firstStackFinished = true; - }, 0); - - d.promise.then(function () { - assert.strictEqual(firstStackFinished, true); - done(); - }); - }); - }); - - describe("Clean-stack execution ordering tests (rejection case)", function () { - specify("when `onRejected` is added immediately before the promise is rejected", - function () { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(null, function onRejected() { - onRejectedCalled = true; - }); - - d.reject(dummy); - - assert.strictEqual(onRejectedCalled, false); - }); - - specify("when `onRejected` is added immediately after the promise is rejected", - function () { - var d = deferred(); - var onRejectedCalled = false; - - d.reject(dummy); - - d.promise.then(null, function onRejected() { - onRejectedCalled = true; - }); - - assert.strictEqual(onRejectedCalled, false); - }); - - specify("when `onRejected` is added inside an `onFulfilled`", function (done) { - var promise = resolved(); - var promise2 = rejected(); - var firstOnFulfilledFinished = false; - - promise.then(function () { - promise2.then(null, function () { - assert.strictEqual(firstOnFulfilledFinished, true); - done(); - }); - firstOnFulfilledFinished = true; - }); - }); - - specify("when one `onRejected` is added inside another `onRejected`", function (done) { - var promise = rejected(); - var firstOnRejectedFinished = false; - - promise.then(null, function () { - promise.then(null, function () { - assert.strictEqual(firstOnRejectedFinished, true); - done(); - }); - firstOnRejectedFinished = true; - }); - }); - - specify("when the promise is rejected asynchronously", function (done) { - var d = deferred(); - var firstStackFinished = false; - - setTimeout(function () { - d.reject(dummy); - firstStackFinished = true; - }, 0); - - d.promise.then(null, function () { - assert.strictEqual(firstStackFinished, true); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],14:[function(require,module,exports){ -(function (global){ -/*jshint strict: false */ - -var assert = require("assert"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -function impimentsUseStrictCorrectly() { - "use strict"; - function test() { - /*jshint validthis:true */ - return !this; - } - return test(); -} -describe("2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value).", function () { - if (impimentsUseStrictCorrectly()) { - describe("strict mode", function () { - specify("fulfilled", function (done) { - resolved(dummy).then(function onFulfilled() { - "use strict"; - - assert.strictEqual(this, undefined); - done(); - }); - }); - - specify("rejected", function (done) { - rejected(dummy).then(null, function onRejected() { - "use strict"; - - assert.strictEqual(this, undefined); - done(); - }); - }); - }); - } - describe("sloppy mode", function () { - specify("fulfilled", function (done) { - resolved(dummy).then(function onFulfilled() { - assert.strictEqual(this, global); - done(); - }); - }); - - specify("rejected", function (done) { - rejected(dummy).then(null, function onRejected() { - assert.strictEqual(this, global); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],15:[function(require,module,exports){ -"use strict"; - -var assert = require("assert"); -var sinon = require("sinon"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var other = { other: "other" }; // a value we don't want to be strict equal to -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality -var sentinel2 = { sentinel2: "sentinel2" }; -var sentinel3 = { sentinel3: "sentinel3" }; - -function callbackAggregator(times, ultimateCallback) { - var soFar = 0; - return function () { - if (++soFar === times) { - ultimateCallback(); - } - }; -} - -describe("2.2.6: `then` may be called multiple times on the same promise.", function () { - describe("2.2.6.1: If/when `promise` is fulfilled, all respective `onFulfilled` callbacks must execute in the " + - "order of their originating calls to `then`.", function () { - describe("multiple boring fulfillment handlers", function () { - testFulfilled(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().returns(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(handler1, spy); - promise.then(handler2, spy); - promise.then(handler3, spy); - - promise.then(function (value) { - assert.strictEqual(value, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("multiple fulfillment handlers, one of which throws", function () { - testFulfilled(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().throws(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(handler1, spy); - promise.then(handler2, spy); - promise.then(handler3, spy); - - promise.then(function (value) { - assert.strictEqual(value, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("results in multiple branching chains with their own fulfillment values", function () { - testFulfilled(dummy, function (promise, done) { - var semiDone = callbackAggregator(3, done); - - promise.then(function () { - return sentinel; - }).then(function (value) { - assert.strictEqual(value, sentinel); - semiDone(); - }); - - promise.then(function () { - throw sentinel2; - }).then(null, function (reason) { - assert.strictEqual(reason, sentinel2); - semiDone(); - }); - - promise.then(function () { - return sentinel3; - }).then(function (value) { - assert.strictEqual(value, sentinel3); - semiDone(); - }); - }); - }); - - describe("`onFulfilled` handlers are called in the original order", function () { - testFulfilled(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(handler1); - promise.then(handler2); - promise.then(handler3); - - promise.then(function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }); - }); - - describe("even when one handler is added inside another handler", function () { - testFulfilled(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(function () { - handler1(); - promise.then(handler3); - }); - promise.then(handler2); - - promise.then(function () { - // Give implementations a bit of extra time to flush their internal queue, if necessary. - setTimeout(function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }, 15); - }); - }); - }); - }); - }); - - describe("2.2.6.2: If/when `promise` is rejected, all respective `onRejected` callbacks must execute in the " + - "order of their originating calls to `then`.", function () { - describe("multiple boring rejection handlers", function () { - testRejected(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().returns(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(spy, handler1); - promise.then(spy, handler2); - promise.then(spy, handler3); - - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("multiple rejection handlers, one of which throws", function () { - testRejected(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().throws(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(spy, handler1); - promise.then(spy, handler2); - promise.then(spy, handler3); - - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("results in multiple branching chains with their own fulfillment values", function () { - testRejected(sentinel, function (promise, done) { - var semiDone = callbackAggregator(3, done); - - promise.then(null, function () { - return sentinel; - }).then(function (value) { - assert.strictEqual(value, sentinel); - semiDone(); - }); - - promise.then(null, function () { - throw sentinel2; - }).then(null, function (reason) { - assert.strictEqual(reason, sentinel2); - semiDone(); - }); - - promise.then(null, function () { - return sentinel3; - }).then(function (value) { - assert.strictEqual(value, sentinel3); - semiDone(); - }); - }); - }); - - describe("`onRejected` handlers are called in the original order", function () { - testRejected(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(null, handler1); - promise.then(null, handler2); - promise.then(null, handler3); - - promise.then(null, function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }); - }); - - describe("even when one handler is added inside another handler", function () { - testRejected(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(null, function () { - handler1(); - promise.then(null, handler3); - }); - promise.then(null, handler2); - - promise.then(null, function () { - // Give implementations a bit of extra time to flush their internal queue, if necessary. - setTimeout(function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }, 15); - }); - }); - }); - }); - }); -}); - -},{"./helpers/testThreeCases":22,"assert":2,"sinon":24}],16:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; -var reasons = require("./helpers/reasons"); - -var adapter = global.adapter; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality -var other = { other: "other" }; // a value we don't want to be strict equal to - -describe("2.2.7: `then` must return a promise: `promise2 = promise1.then(onFulfilled, onRejected)`", function () { - specify("is a promise", function () { - var promise1 = deferred().promise; - var promise2 = promise1.then(); - - assert(typeof promise2 === "object" || typeof promise2 === "function"); - assert.notStrictEqual(promise2, null); - assert.strictEqual(typeof promise2.then, "function"); - }); - - describe("2.2.7.1: If either `onFulfilled` or `onRejected` returns a value `x`, run the Promise Resolution " + - "Procedure `[[Resolve]](promise2, x)`", function () { - specify("see separate 3.3 tests", function () { }); - }); - - describe("2.2.7.2: If either `onFulfilled` or `onRejected` throws an exception `e`, `promise2` must be rejected " + - "with `e` as the reason.", function () { - function testReason(expectedReason, stringRepresentation) { - describe("The reason is " + stringRepresentation, function () { - testFulfilled(dummy, function (promise1, done) { - var promise2 = promise1.then(function onFulfilled() { - throw expectedReason; - }); - - promise2.then(null, function onPromise2Rejected(actualReason) { - assert.strictEqual(actualReason, expectedReason); - done(); - }); - }); - testRejected(dummy, function (promise1, done) { - var promise2 = promise1.then(null, function onRejected() { - throw expectedReason; - }); - - promise2.then(null, function onPromise2Rejected(actualReason) { - assert.strictEqual(actualReason, expectedReason); - done(); - }); - }); - }); - } - - Object.keys(reasons).forEach(function (stringRepresentation) { - testReason(reasons[stringRepresentation], stringRepresentation); - }); - }); - - describe("2.2.7.3: If `onFulfilled` is not a function and `promise1` is fulfilled, `promise2` must be fulfilled " + - "with the same value.", function () { - - function testNonFunction(nonFunction, stringRepresentation) { - describe("`onFulfilled` is " + stringRepresentation, function () { - testFulfilled(sentinel, function (promise1, done) { - var promise2 = promise1.then(nonFunction); - - promise2.then(function onPromise2Fulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - testNonFunction([function () { return other; }], "an array containing a function"); - }); - - describe("2.2.7.4: If `onRejected` is not a function and `promise1` is rejected, `promise2` must be rejected " + - "with the same reason.", function () { - - function testNonFunction(nonFunction, stringRepresentation) { - describe("`onRejected` is " + stringRepresentation, function () { - testRejected(sentinel, function (promise1, done) { - var promise2 = promise1.then(null, nonFunction); - - promise2.then(null, function onPromise2Rejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - testNonFunction([function () { return other; }], "an array containing a function"); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/reasons":21,"./helpers/testThreeCases":22,"assert":2}],17:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.3.1: If `promise` and `x` refer to the same object, reject `promise` with a `TypeError' as the reason.", - function () { - specify("via return from a fulfilled promise", function (done) { - var promise = resolved(dummy).then(function () { - return promise; - }); - - promise.then(null, function (reason) { - assert(reason instanceof TypeError); - done(); - }); - }); - - specify("via return from a rejected promise", function (done) { - var promise = rejected(dummy).then(null, function () { - return promise; - }); - - promise.then(null, function (reason) { - assert(reason instanceof TypeError); - done(); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],18:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality - -function testPromiseResolution(xFactory, test) { - specify("via return from a fulfilled promise", function (done) { - var promise = resolved(dummy).then(function onBasePromiseFulfilled() { - return xFactory(); - }); - - test(promise, done); - }); - - specify("via return from a rejected promise", function (done) { - var promise = rejected(dummy).then(null, function onBasePromiseRejected() { - return xFactory(); - }); - - test(promise, done); - }); -} - -describe("2.3.2: If `x` is a promise, adopt its state", function () { - describe("2.3.2.1: If `x` is pending, `promise` must remain pending until `x` is fulfilled or rejected.", - function () { - function xFactory() { - return deferred().promise; - } - - testPromiseResolution(xFactory, function (promise, done) { - var wasFulfilled = false; - var wasRejected = false; - - promise.then( - function onPromiseFulfilled() { - wasFulfilled = true; - }, - function onPromiseRejected() { - wasRejected = true; - } - ); - - setTimeout(function () { - assert.strictEqual(wasFulfilled, false); - assert.strictEqual(wasRejected, false); - done(); - }, 100); - }); - }); - - describe("2.3.2.2: If/when `x` is fulfilled, fulfill `promise` with the same value.", function () { - describe("`x` is already-fulfilled", function () { - function xFactory() { - return resolved(sentinel); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function onPromiseFulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`x` is eventually-fulfilled", function () { - var d = null; - - function xFactory() { - d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - return d.promise; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function onPromiseFulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - }); - - describe("2.3.2.3: If/when `x` is rejected, reject `promise` with the same reason.", function () { - describe("`x` is already-rejected", function () { - function xFactory() { - return rejected(sentinel); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function onPromiseRejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`x` is eventually-rejected", function () { - var d = null; - - function xFactory() { - d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - return d.promise; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function onPromiseRejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],19:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var thenables = require("./helpers/thenables"); -var reasons = require("./helpers/reasons"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality -var other = { other: "other" }; // a value we don't want to be strict equal to -var sentinelArray = [sentinel]; // a sentinel fulfillment value to test when we need an array - -function testPromiseResolution(xFactory, test) { - specify("via return from a fulfilled promise", function (done) { - var promise = resolved(dummy).then(function onBasePromiseFulfilled() { - return xFactory(); - }); - - test(promise, done); - }); - - specify("via return from a rejected promise", function (done) { - var promise = rejected(dummy).then(null, function onBasePromiseRejected() { - return xFactory(); - }); - - test(promise, done); - }); -} - -function testCallingResolvePromise(yFactory, stringRepresentation, test) { - describe("`y` is " + stringRepresentation, function () { - describe("`then` calls `resolvePromise` synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(yFactory()); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - - describe("`then` calls `resolvePromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - setTimeout(function () { - resolvePromise(yFactory()); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - }); -} - -function testCallingRejectPromise(r, stringRepresentation, test) { - describe("`r` is " + stringRepresentation, function () { - describe("`then` calls `rejectPromise` synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(r); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - - describe("`then` calls `rejectPromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(r); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - }); -} - -function testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, fulfillmentValue) { - testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) { - promise.then(function onPromiseFulfilled(value) { - assert.strictEqual(value, fulfillmentValue); - done(); - }); - }); -} - -function testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, rejectionReason) { - testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) { - promise.then(null, function onPromiseRejected(reason) { - assert.strictEqual(reason, rejectionReason); - done(); - }); - }); -} - -function testCallingRejectPromiseRejectsWith(reason, stringRepresentation) { - testCallingRejectPromise(reason, stringRepresentation, function (promise, done) { - promise.then(null, function onPromiseRejected(rejectionReason) { - assert.strictEqual(rejectionReason, reason); - done(); - }); - }); -} - -describe("2.3.3: Otherwise, if `x` is an object or function,", function () { - describe("2.3.3.1: Let `then` be `x.then`", function () { - describe("`x` is an object with null prototype", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - return Object.create(null, { - then: { - get: function () { - ++numberOfTimesThenWasRetrieved; - return function thenMethodForX(onFulfilled) { - onFulfilled(); - }; - } - } - }); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - assert.strictEqual(numberOfTimesThenWasRetrieved, 1); - done(); - }); - }); - }); - - describe("`x` is an object with normal Object.prototype", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - return Object.create(Object.prototype, { - then: { - get: function () { - ++numberOfTimesThenWasRetrieved; - return function thenMethodForX(onFulfilled) { - onFulfilled(); - }; - } - } - }); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - assert.strictEqual(numberOfTimesThenWasRetrieved, 1); - done(); - }); - }); - }); - - describe("`x` is a function", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - function x() { } - - Object.defineProperty(x, "then", { - get: function () { - ++numberOfTimesThenWasRetrieved; - return function thenMethodForX(onFulfilled) { - onFulfilled(); - }; - } - }); - - return x; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - assert.strictEqual(numberOfTimesThenWasRetrieved, 1); - done(); - }); - }); - }); - }); - - describe("2.3.3.2: If retrieving the property `x.then` results in a thrown exception `e`, reject `promise` with " + - "`e` as the reason.", function () { - function testRejectionViaThrowingGetter(e, stringRepresentation) { - function xFactory() { - return Object.create(Object.prototype, { - then: { - get: function () { - throw e; - } - } - }); - } - - describe("`e` is " + stringRepresentation, function () { - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, e); - done(); - }); - }); - }); - } - - Object.keys(reasons).forEach(function (stringRepresentation) { - testRejectionViaThrowingGetter(reasons[stringRepresentation], stringRepresentation); - }); - }); - - describe("2.3.3.3: If `then` is a function, call it with `x` as `this`, first argument `resolvePromise`, and " + - "second argument `rejectPromise`", function () { - describe("Calls with `x` as `this` and two function arguments", function () { - function xFactory() { - var x = { - then: function (onFulfilled, onRejected) { - assert.strictEqual(this, x); - assert.strictEqual(typeof onFulfilled, "function"); - assert.strictEqual(typeof onRejected, "function"); - onFulfilled(); - } - }; - return x; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - done(); - }); - }); - }); - - describe("Uses the original value of `then`", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - return Object.create(Object.prototype, { - then: { - get: function () { - if (numberOfTimesThenWasRetrieved === 0) { - return function (onFulfilled) { - onFulfilled(); - }; - } - return null; - } - } - }); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - done(); - }); - }); - }); - - describe("2.3.3.3.1: If/when `resolvePromise` is called with value `y`, run `[[Resolve]](promise, y)`", - function () { - describe("`y` is not a thenable", function () { - testCallingResolvePromiseFulfillsWith(function () { return undefined; }, "`undefined`", undefined); - testCallingResolvePromiseFulfillsWith(function () { return null; }, "`null`", null); - testCallingResolvePromiseFulfillsWith(function () { return false; }, "`false`", false); - testCallingResolvePromiseFulfillsWith(function () { return 5; }, "`5`", 5); - testCallingResolvePromiseFulfillsWith(function () { return sentinel; }, "an object", sentinel); - testCallingResolvePromiseFulfillsWith(function () { return sentinelArray; }, "an array", sentinelArray); - }); - - describe("`y` is a thenable", function () { - Object.keys(thenables.fulfilled).forEach(function (stringRepresentation) { - function yFactory() { - return thenables.fulfilled[stringRepresentation](sentinel); - } - - testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel); - }); - - Object.keys(thenables.rejected).forEach(function (stringRepresentation) { - function yFactory() { - return thenables.rejected[stringRepresentation](sentinel); - } - - testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel); - }); - }); - - describe("`y` is a thenable for a thenable", function () { - Object.keys(thenables.fulfilled).forEach(function (outerStringRepresentation) { - var outerThenableFactory = thenables.fulfilled[outerStringRepresentation]; - - Object.keys(thenables.fulfilled).forEach(function (innerStringRepresentation) { - var innerThenableFactory = thenables.fulfilled[innerStringRepresentation]; - - var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation; - - function yFactory() { - return outerThenableFactory(innerThenableFactory(sentinel)); - } - - testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel); - }); - - Object.keys(thenables.rejected).forEach(function (innerStringRepresentation) { - var innerThenableFactory = thenables.rejected[innerStringRepresentation]; - - var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation; - - function yFactory() { - return outerThenableFactory(innerThenableFactory(sentinel)); - } - - testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel); - }); - }); - }); - }); - - describe("2.3.3.3.2: If/when `rejectPromise` is called with reason `r`, reject `promise` with `r`", - function () { - Object.keys(reasons).forEach(function (stringRepresentation) { - testCallingRejectPromiseRejectsWith(reasons[stringRepresentation], stringRepresentation); - }); - }); - - describe("2.3.3.3.3: If both `resolvePromise` and `rejectPromise` are called, or multiple calls to the same " + - "argument are made, the first call takes precedence, and any further calls are ignored.", - function () { - describe("calling `resolvePromise` then `rejectPromise`, both synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(sentinel); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` synchronously then `rejectPromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(sentinel); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` then `rejectPromise`, both asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - resolvePromise(sentinel); - }, 0); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling " + - "`rejectPromise`, both synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(d.promise); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling " + - "`rejectPromise`, both synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(d.promise); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` then `resolvePromise`, both synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` synchronously then `resolvePromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` then `resolvePromise`, both asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(sentinel); - }, 0); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` twice synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(sentinel); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` twice, first synchronously then asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(sentinel); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` twice, both times asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - setTimeout(function () { - resolvePromise(sentinel); - }, 0); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling it again, both " + - "times synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling it again, both " + - "times synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` twice synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` twice, first synchronously then asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` twice, both times asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(sentinel); - }, 0); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("saving and abusing `resolvePromise` and `rejectPromise`", function () { - var savedResolvePromise, savedRejectPromise; - - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - savedResolvePromise = resolvePromise; - savedRejectPromise = rejectPromise; - } - }; - } - - beforeEach(function () { - savedResolvePromise = null; - savedRejectPromise = null; - }); - - testPromiseResolution(xFactory, function (promise, done) { - var timesFulfilled = 0; - var timesRejected = 0; - - promise.then( - function () { - ++timesFulfilled; - }, - function () { - ++timesRejected; - } - ); - - if (savedResolvePromise && savedRejectPromise) { - savedResolvePromise(dummy); - savedResolvePromise(dummy); - savedRejectPromise(dummy); - savedRejectPromise(dummy); - } - - setTimeout(function () { - savedResolvePromise(dummy); - savedResolvePromise(dummy); - savedRejectPromise(dummy); - savedRejectPromise(dummy); - }, 50); - - setTimeout(function () { - assert.strictEqual(timesFulfilled, 1); - assert.strictEqual(timesRejected, 0); - done(); - }, 100); - }); - }); - }); - - describe("2.3.3.3.4: If calling `then` throws an exception `e`,", function () { - describe("2.3.3.3.4.1: If `resolvePromise` or `rejectPromise` have been called, ignore it.", function () { - describe("`resolvePromise` was called with a non-thenable", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(sentinel); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` was called with an asynchronously-fulfilled promise", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` was called with an asynchronously-rejected promise", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`rejectPromise` was called", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` then `rejectPromise` were called", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(sentinel); - rejectPromise(other); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`rejectPromise` then `resolvePromise` were called", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - resolvePromise(other); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - }); - - describe("2.3.3.3.4.2: Otherwise, reject `promise` with `e` as the reason.", function () { - describe("straightforward case", function () { - function xFactory() { - return { - then: function () { - throw sentinel; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` is called asynchronously before the `throw`", function () { - function xFactory() { - return { - then: function (resolvePromise) { - setTimeout(function () { - resolvePromise(other); - }, 0); - throw sentinel; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`rejectPromise` is called asynchronously before the `throw`", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(other); - }, 0); - throw sentinel; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - }); - }); - }); - - describe("2.3.3.4: If `then` is not a function, fulfill promise with `x`", function () { - function testFulfillViaNonFunction(then, stringRepresentation) { - var x = null; - - beforeEach(function () { - x = { then: then }; - }); - - function xFactory() { - return x; - } - - describe("`then` is " + stringRepresentation, function () { - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, x); - done(); - }); - }); - }); - } - - testFulfillViaNonFunction(5, "`5`"); - testFulfillViaNonFunction({}, "an object"); - testFulfillViaNonFunction([function () { }], "an array containing a function"); - testFulfillViaNonFunction(/a-b/i, "a regular expression"); - testFulfillViaNonFunction(Object.create(Function.prototype), "an object inheriting from `Function.prototype`"); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/reasons":21,"./helpers/thenables":23,"assert":2}],20:[function(require,module,exports){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.3.4: If `x` is not an object or function, fulfill `promise` with `x`", function () { - function testValue(expectedValue, stringRepresentation, beforeEachHook, afterEachHook) { - describe("The value is " + stringRepresentation, function () { - if (typeof beforeEachHook === "function") { - beforeEach(beforeEachHook); - } - if (typeof afterEachHook === "function") { - afterEach(afterEachHook); - } - - testFulfilled(dummy, function (promise1, done) { - var promise2 = promise1.then(function onFulfilled() { - return expectedValue; - }); - - promise2.then(function onPromise2Fulfilled(actualValue) { - assert.strictEqual(actualValue, expectedValue); - done(); - }); - }); - testRejected(dummy, function (promise1, done) { - var promise2 = promise1.then(null, function onRejected() { - return expectedValue; - }); - - promise2.then(function onPromise2Fulfilled(actualValue) { - assert.strictEqual(actualValue, expectedValue); - done(); - }); - }); - }); - } - - testValue(undefined, "`undefined`"); - testValue(null, "`null`"); - testValue(false, "`false`"); - testValue(true, "`true`"); - testValue(0, "`0`"); - - testValue( - true, - "`true` with `Boolean.prototype` modified to have a `then` method", - function () { - Boolean.prototype.then = function () {}; - }, - function () { - delete Boolean.prototype.then; - } - ); - - testValue( - 1, - "`1` with `Number.prototype` modified to have a `then` method", - function () { - Number.prototype.then = function () {}; - }, - function () { - delete Number.prototype.then; - } - ); -}); - -},{"./helpers/testThreeCases":22,"assert":2}],21:[function(require,module,exports){ -(function (global){ -"use strict"; - -// This module exports some valid rejection reason factories, keyed by human-readable versions of their names. - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; - -exports["`undefined`"] = function () { - return undefined; -}; - -exports["`null`"] = function () { - return null; -}; - -exports["`false`"] = function () { - return false; -}; - -exports["`0`"] = function () { - return 0; -}; - -exports["an error"] = function () { - return new Error(); -}; - -exports["an error without a stack"] = function () { - var error = new Error(); - delete error.stack; - - return error; -}; - -exports["a date"] = function () { - return new Date(); -}; - -exports["an object"] = function () { - return {}; -}; - -exports["an always-pending thenable"] = function () { - return { then: function () { } }; -}; - -exports["a fulfilled promise"] = function () { - return resolved(dummy); -}; - -exports["a rejected promise"] = function () { - return rejected(dummy); -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],22:[function(require,module,exports){ -(function (global){ -"use strict"; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -exports.testFulfilled = function (value, test) { - specify("already-fulfilled", function (done) { - test(resolved(value), done); - }); - - specify("immediately-fulfilled", function (done) { - var d = deferred(); - test(d.promise, done); - d.resolve(value); - }); - - specify("eventually-fulfilled", function (done) { - var d = deferred(); - test(d.promise, done); - setTimeout(function () { - d.resolve(value); - }, 50); - }); -}; - -exports.testRejected = function (reason, test) { - specify("already-rejected", function (done) { - test(rejected(reason), done); - }); - - specify("immediately-rejected", function (done) { - var d = deferred(); - test(d.promise, done); - d.reject(reason); - }); - - specify("eventually-rejected", function (done) { - var d = deferred(); - test(d.promise, done); - setTimeout(function () { - d.reject(reason); - }, 50); - }); -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],23:[function(require,module,exports){ -(function (global){ -"use strict"; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var other = { other: "other" }; // a value we don't want to be strict equal to - -exports.fulfilled = { - "a synchronously-fulfilled custom thenable": function (value) { - return { - then: function (onFulfilled) { - onFulfilled(value); - } - }; - }, - - "an asynchronously-fulfilled custom thenable": function (value) { - return { - then: function (onFulfilled) { - setTimeout(function () { - onFulfilled(value); - }, 0); - } - }; - }, - - "a synchronously-fulfilled one-time thenable": function (value) { - var numberOfTimesThenRetrieved = 0; - return Object.create(null, { - then: { - get: function () { - if (numberOfTimesThenRetrieved === 0) { - ++numberOfTimesThenRetrieved; - return function (onFulfilled) { - onFulfilled(value); - }; - } - return null; - } - } - }); - }, - - "a thenable that tries to fulfill twice": function (value) { - return { - then: function (onFulfilled) { - onFulfilled(value); - onFulfilled(other); - } - }; - }, - - "a thenable that fulfills but then throws": function (value) { - return { - then: function (onFulfilled) { - onFulfilled(value); - throw other; - } - }; - }, - - "an already-fulfilled promise": function (value) { - return resolved(value); - }, - - "an eventually-fulfilled promise": function (value) { - var d = deferred(); - setTimeout(function () { - d.resolve(value); - }, 50); - return d.promise; - } -}; - -exports.rejected = { - "a synchronously-rejected custom thenable": function (reason) { - return { - then: function (onFulfilled, onRejected) { - onRejected(reason); - } - }; - }, - - "an asynchronously-rejected custom thenable": function (reason) { - return { - then: function (onFulfilled, onRejected) { - setTimeout(function () { - onRejected(reason); - }, 0); - } - }; - }, - - "a synchronously-rejected one-time thenable": function (reason) { - var numberOfTimesThenRetrieved = 0; - return Object.create(null, { - then: { - get: function () { - if (numberOfTimesThenRetrieved === 0) { - ++numberOfTimesThenRetrieved; - return function (onFulfilled, onRejected) { - onRejected(reason); - }; - } - return null; - } - } - }); - }, - - "a thenable that immediately throws in `then`": function (reason) { - return { - then: function () { - throw reason; - } - }; - }, - - "an object with a throwing `then` accessor": function (reason) { - return Object.create(null, { - then: { - get: function () { - throw reason; - } - } - }); - }, - - "an already-rejected promise": function (reason) { - return rejected(reason); - }, - - "an eventually-rejected promise": function (reason) { - var d = deferred(); - setTimeout(function () { - d.reject(reason); - }, 50); - return d.promise; - } -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],24:[function(require,module,exports){ -/** - * Sinon core utilities. For internal use only. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -var sinon = (function () { - var sinon; - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - sinon = module.exports = require("./sinon/util/core"); - require("./sinon/extend"); - require("./sinon/typeOf"); - require("./sinon/times_in_words"); - require("./sinon/spy"); - require("./sinon/call"); - require("./sinon/behavior"); - require("./sinon/stub"); - require("./sinon/mock"); - require("./sinon/collection"); - require("./sinon/assert"); - require("./sinon/sandbox"); - require("./sinon/test"); - require("./sinon/test_case"); - require("./sinon/match"); - require("./sinon/format"); - require("./sinon/log_error"); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - sinon = module.exports; - } else { - sinon = {}; - } - - return sinon; -}()); - -},{"./sinon/assert":25,"./sinon/behavior":26,"./sinon/call":27,"./sinon/collection":28,"./sinon/extend":29,"./sinon/format":30,"./sinon/log_error":31,"./sinon/match":32,"./sinon/mock":33,"./sinon/sandbox":34,"./sinon/spy":35,"./sinon/stub":36,"./sinon/test":37,"./sinon/test_case":38,"./sinon/times_in_words":39,"./sinon/typeOf":40,"./sinon/util/core":41}],25:[function(require,module,exports){ -(function (global){ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Assertions matching the test spy retrieval interface. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon, global) { - var slice = Array.prototype.slice; - - function makeApi(sinon) { - var assert; - - function verifyIsStub() { - var method; - - for (var i = 0, l = arguments.length; i < l; ++i) { - method = arguments[i]; - - if (!method) { - assert.fail("fake is not a spy"); - } - - if (method.proxy) { - verifyIsStub(method.proxy); - } else { - if (typeof method != "function") { - assert.fail(method + " is not a function"); - } - - if (typeof method.getCall != "function") { - assert.fail(method + " is not stubbed"); - } - } - - } - } - - function failAssertion(object, msg) { - object = object || global; - var failMethod = object.fail || assert.fail; - failMethod.call(object, msg); - } - - function mirrorPropAsAssertion(name, method, message) { - if (arguments.length == 2) { - message = method; - method = name; - } - - assert[name] = function (fake) { - verifyIsStub(fake); - - var args = slice.call(arguments, 1); - var failed = false; - - if (typeof method == "function") { - failed = !method(fake); - } else { - failed = typeof fake[method] == "function" ? - !fake[method].apply(fake, args) : !fake[method]; - } - - if (failed) { - failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args))); - } else { - assert.pass(name); - } - }; - } - - function exposedName(prefix, prop) { - return !prefix || /^fail/.test(prop) ? prop : - prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1); - } - - assert = { - failException: "AssertError", - - fail: function fail(message) { - var error = new Error(message); - error.name = this.failException || assert.failException; - - throw error; - }, - - pass: function pass(assertion) {}, - - callOrder: function assertCallOrder() { - verifyIsStub.apply(null, arguments); - var expected = "", actual = ""; - - if (!sinon.calledInOrder(arguments)) { - try { - expected = [].join.call(arguments, ", "); - var calls = slice.call(arguments); - var i = calls.length; - while (i) { - if (!calls[--i].called) { - calls.splice(i, 1); - } - } - actual = sinon.orderByFirstCall(calls).join(", "); - } catch (e) { - // If this fails, we'll just fall back to the blank string - } - - failAssertion(this, "expected " + expected + " to be " + - "called in order but were called as " + actual); - } else { - assert.pass("callOrder"); - } - }, - - callCount: function assertCallCount(method, count) { - verifyIsStub(method); - - if (method.callCount != count) { - var msg = "expected %n to be called " + sinon.timesInWords(count) + - " but was called %c%C"; - failAssertion(this, method.printf(msg)); - } else { - assert.pass("callCount"); - } - }, - - expose: function expose(target, options) { - if (!target) { - throw new TypeError("target is null or undefined"); - } - - var o = options || {}; - var prefix = typeof o.prefix == "undefined" && "assert" || o.prefix; - var includeFail = typeof o.includeFail == "undefined" || !!o.includeFail; - - for (var method in this) { - if (method != "expose" && (includeFail || !/^(fail)/.test(method))) { - target[exposedName(prefix, method)] = this[method]; - } - } - - return target; - }, - - match: function match(actual, expectation) { - var matcher = sinon.match(expectation); - if (matcher.test(actual)) { - assert.pass("match"); - } else { - var formatted = [ - "expected value to match", - " expected = " + sinon.format(expectation), - " actual = " + sinon.format(actual) - ] - failAssertion(this, formatted.join("\n")); - } - } - }; - - mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called"); - mirrorPropAsAssertion("notCalled", function (spy) { return !spy.called; }, - "expected %n to not have been called but was called %c%C"); - mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C"); - mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C"); - mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C"); - mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t"); - mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t"); - mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new"); - mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new"); - mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C"); - mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C"); - mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C"); - mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C"); - mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C"); - mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C"); - mirrorPropAsAssertion("threw", "%n did not throw exception%C"); - mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C"); - - sinon.assert = assert; - return assert; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } - -}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./format":30,"./match":32,"./util/core":41}],26:[function(require,module,exports){ -(function (process){ -/** - * @depend util/core.js - * @depend extend.js - */ -/** - * Stub behavior - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Tim Fischbach (mail@timfischbach.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - var slice = Array.prototype.slice; - var join = Array.prototype.join; - var useLeftMostCallback = -1; - var useRightMostCallback = -2; - - var nextTick = (function () { - if (typeof process === "object" && typeof process.nextTick === "function") { - return process.nextTick; - } else if (typeof setImmediate === "function") { - return setImmediate; - } else { - return function (callback) { - setTimeout(callback, 0); - }; - } - })(); - - function throwsException(error, message) { - if (typeof error == "string") { - this.exception = new Error(message || ""); - this.exception.name = error; - } else if (!error) { - this.exception = new Error("Error"); - } else { - this.exception = error; - } - - return this; - } - - function getCallback(behavior, args) { - var callArgAt = behavior.callArgAt; - - if (callArgAt >= 0) { - return args[callArgAt]; - } - - var argumentList; - - if (callArgAt === useLeftMostCallback) { - argumentList = args; - } - - if (callArgAt === useRightMostCallback) { - argumentList = slice.call(args).reverse(); - } - - var callArgProp = behavior.callArgProp; - - for (var i = 0, l = argumentList.length; i < l; ++i) { - if (!callArgProp && typeof argumentList[i] == "function") { - return argumentList[i]; - } - - if (callArgProp && argumentList[i] && - typeof argumentList[i][callArgProp] == "function") { - return argumentList[i][callArgProp]; - } - } - - return null; - } - - function makeApi(sinon) { - function getCallbackError(behavior, func, args) { - if (behavior.callArgAt < 0) { - var msg; - - if (behavior.callArgProp) { - msg = sinon.functionName(behavior.stub) + - " expected to yield to '" + behavior.callArgProp + - "', but no object with such a property was passed."; - } else { - msg = sinon.functionName(behavior.stub) + - " expected to yield, but no callback was passed."; - } - - if (args.length > 0) { - msg += " Received [" + join.call(args, ", ") + "]"; - } - - return msg; - } - - return "argument at index " + behavior.callArgAt + " is not a function: " + func; - } - - function callCallback(behavior, args) { - if (typeof behavior.callArgAt == "number") { - var func = getCallback(behavior, args); - - if (typeof func != "function") { - throw new TypeError(getCallbackError(behavior, func, args)); - } - - if (behavior.callbackAsync) { - nextTick(function () { - func.apply(behavior.callbackContext, behavior.callbackArguments); - }); - } else { - func.apply(behavior.callbackContext, behavior.callbackArguments); - } - } - } - - var proto = { - create: function create(stub) { - var behavior = sinon.extend({}, sinon.behavior); - delete behavior.create; - behavior.stub = stub; - - return behavior; - }, - - isPresent: function isPresent() { - return (typeof this.callArgAt == "number" || - this.exception || - typeof this.returnArgAt == "number" || - this.returnThis || - this.returnValueDefined); - }, - - invoke: function invoke(context, args) { - callCallback(this, args); - - if (this.exception) { - throw this.exception; - } else if (typeof this.returnArgAt == "number") { - return args[this.returnArgAt]; - } else if (this.returnThis) { - return context; - } - - return this.returnValue; - }, - - onCall: function onCall(index) { - return this.stub.onCall(index); - }, - - onFirstCall: function onFirstCall() { - return this.stub.onFirstCall(); - }, - - onSecondCall: function onSecondCall() { - return this.stub.onSecondCall(); - }, - - onThirdCall: function onThirdCall() { - return this.stub.onThirdCall(); - }, - - withArgs: function withArgs(/* arguments */) { - throw new Error("Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" is not supported. " + - "Use \"stub.withArgs(...).onCall(...)\" to define sequential behavior for calls with certain arguments."); - }, - - callsArg: function callsArg(pos) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOn: function callsArgOn(pos, context) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgWith: function callsArgWith(pos) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOnWith: function callsArgWith(pos, context) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yields: function () { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsRight: function () { - this.callArgAt = useRightMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsOn: function (context) { - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsTo: function (prop) { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - yieldsToOn: function (prop, context) { - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - throws: throwsException, - throwsException: throwsException, - - returns: function returns(value) { - this.returnValue = value; - this.returnValueDefined = true; - - return this; - }, - - returnsArg: function returnsArg(pos) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - - this.returnArgAt = pos; - - return this; - }, - - returnsThis: function returnsThis() { - this.returnThis = true; - - return this; - } - }; - - // create asynchronous versions of callsArg* and yields* methods - for (var method in proto) { - // need to avoid creating anotherasync versions of the newly added async methods - if (proto.hasOwnProperty(method) && - method.match(/^(callsArg|yields)/) && - !method.match(/Async/)) { - proto[method + "Async"] = (function (syncFnName) { - return function () { - var result = this[syncFnName].apply(this, arguments); - this.callbackAsync = true; - return result; - }; - })(method); - } - } - - sinon.behavior = proto; - return proto; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -}).call(this,require('_process')) -},{"./extend":29,"./util/core":41,"_process":4}],27:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Spy calls - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - * Copyright (c) 2013 Maximilian Antoni - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - function throwYieldError(proxy, text, args) { - var msg = sinon.functionName(proxy) + text; - if (args.length) { - msg += " Received [" + slice.call(args).join(", ") + "]"; - } - throw new Error(msg); - } - - var slice = Array.prototype.slice; - - var callProto = { - calledOn: function calledOn(thisValue) { - if (sinon.match && sinon.match.isMatcher(thisValue)) { - return thisValue.test(this.thisValue); - } - return this.thisValue === thisValue; - }, - - calledWith: function calledWith() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - if (!sinon.deepEqual(arguments[i], this.args[i])) { - return false; - } - } - - return true; - }, - - calledWithMatch: function calledWithMatch() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - var actual = this.args[i]; - var expectation = arguments[i]; - if (!sinon.match || !sinon.match(expectation).test(actual)) { - return false; - } - } - return true; - }, - - calledWithExactly: function calledWithExactly() { - return arguments.length == this.args.length && - this.calledWith.apply(this, arguments); - }, - - notCalledWith: function notCalledWith() { - return !this.calledWith.apply(this, arguments); - }, - - notCalledWithMatch: function notCalledWithMatch() { - return !this.calledWithMatch.apply(this, arguments); - }, - - returned: function returned(value) { - return sinon.deepEqual(value, this.returnValue); - }, - - threw: function threw(error) { - if (typeof error === "undefined" || !this.exception) { - return !!this.exception; - } - - return this.exception === error || this.exception.name === error; - }, - - calledWithNew: function calledWithNew() { - return this.proxy.prototype && this.thisValue instanceof this.proxy; - }, - - calledBefore: function (other) { - return this.callId < other.callId; - }, - - calledAfter: function (other) { - return this.callId > other.callId; - }, - - callArg: function (pos) { - this.args[pos](); - }, - - callArgOn: function (pos, thisValue) { - this.args[pos].apply(thisValue); - }, - - callArgWith: function (pos) { - this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1))); - }, - - callArgOnWith: function (pos, thisValue) { - var args = slice.call(arguments, 2); - this.args[pos].apply(thisValue, args); - }, - - yield: function () { - this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0))); - }, - - yieldOn: function (thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (typeof args[i] === "function") { - args[i].apply(thisValue, slice.call(arguments, 1)); - return; - } - } - throwYieldError(this.proxy, " cannot yield since no callback was passed.", args); - }, - - yieldTo: function (prop) { - this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1))); - }, - - yieldToOn: function (prop, thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (args[i] && typeof args[i][prop] === "function") { - args[i][prop].apply(thisValue, slice.call(arguments, 2)); - return; - } - } - throwYieldError(this.proxy, " cannot yield to '" + prop + - "' since no callback was passed.", args); - }, - - toString: function () { - var callStr = this.proxy.toString() + "("; - var args = []; - - for (var i = 0, l = this.args.length; i < l; ++i) { - args.push(sinon.format(this.args[i])); - } - - callStr = callStr + args.join(", ") + ")"; - - if (typeof this.returnValue != "undefined") { - callStr += " => " + sinon.format(this.returnValue); - } - - if (this.exception) { - callStr += " !" + this.exception.name; - - if (this.exception.message) { - callStr += "(" + this.exception.message + ")"; - } - } - - return callStr; - } - }; - - callProto.invokeCallback = callProto.yield; - - function createSpyCall(spy, thisValue, args, returnValue, exception, id) { - if (typeof id !== "number") { - throw new TypeError("Call id is not a number"); - } - var proxyCall = sinon.create(callProto); - proxyCall.proxy = spy; - proxyCall.thisValue = thisValue; - proxyCall.args = args; - proxyCall.returnValue = returnValue; - proxyCall.exception = exception; - proxyCall.callId = id; - - return proxyCall; - } - createSpyCall.toString = callProto.toString; // used by mocks - - sinon.spyCall = createSpyCall; - return createSpyCall; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./format":30,"./match":32,"./util/core":41}],28:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend spy.js - * @depend stub.js - * @depend mock.js - */ -/** - * Collections of stubs, spies and mocks. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - var push = [].push; - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function getFakes(fakeCollection) { - if (!fakeCollection.fakes) { - fakeCollection.fakes = []; - } - - return fakeCollection.fakes; - } - - function each(fakeCollection, method) { - var fakes = getFakes(fakeCollection); - - for (var i = 0, l = fakes.length; i < l; i += 1) { - if (typeof fakes[i][method] == "function") { - fakes[i][method](); - } - } - } - - function compact(fakeCollection) { - var fakes = getFakes(fakeCollection); - var i = 0; - while (i < fakes.length) { - fakes.splice(i, 1); - } - } - - function makeApi(sinon) { - var collection = { - verify: function resolve() { - each(this, "verify"); - }, - - restore: function restore() { - each(this, "restore"); - compact(this); - }, - - reset: function restore() { - each(this, "reset"); - }, - - verifyAndRestore: function verifyAndRestore() { - var exception; - - try { - this.verify(); - } catch (e) { - exception = e; - } - - this.restore(); - - if (exception) { - throw exception; - } - }, - - add: function add(fake) { - push.call(getFakes(this), fake); - return fake; - }, - - spy: function spy() { - return this.add(sinon.spy.apply(sinon, arguments)); - }, - - stub: function stub(object, property, value) { - if (property) { - var original = object[property]; - - if (typeof original != "function") { - if (!hasOwnProperty.call(object, property)) { - throw new TypeError("Cannot stub non-existent own property " + property); - } - - object[property] = value; - - return this.add({ - restore: function () { - object[property] = original; - } - }); - } - } - if (!property && !!object && typeof object == "object") { - var stubbedObj = sinon.stub.apply(sinon, arguments); - - for (var prop in stubbedObj) { - if (typeof stubbedObj[prop] === "function") { - this.add(stubbedObj[prop]); - } - } - - return stubbedObj; - } - - return this.add(sinon.stub.apply(sinon, arguments)); - }, - - mock: function mock() { - return this.add(sinon.mock.apply(sinon, arguments)); - }, - - inject: function inject(obj) { - var col = this; - - obj.spy = function () { - return col.spy.apply(col, arguments); - }; - - obj.stub = function () { - return col.stub.apply(col, arguments); - }; - - obj.mock = function () { - return col.mock.apply(col, arguments); - }; - - return obj; - } - }; - - sinon.collection = collection; - return collection; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./mock"); - require("./spy"); - require("./stub"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./mock":33,"./spy":35,"./stub":36,"./util/core":41}],29:[function(require,module,exports){ -/** - * @depend util/core.js - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - - // Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug - var hasDontEnumBug = (function () { - var obj = { - constructor: function () { - return "0"; - }, - toString: function () { - return "1"; - }, - valueOf: function () { - return "2"; - }, - toLocaleString: function () { - return "3"; - }, - prototype: function () { - return "4"; - }, - isPrototypeOf: function () { - return "5"; - }, - propertyIsEnumerable: function () { - return "6"; - }, - hasOwnProperty: function () { - return "7"; - }, - length: function () { - return "8"; - }, - unique: function () { - return "9" - } - }; - - var result = []; - for (var prop in obj) { - result.push(obj[prop]()); - } - return result.join("") !== "0123456789"; - })(); - - /* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will - * override properties in previous sources. - * - * target - The Object to extend - * sources - Objects to copy properties from. - * - * Returns the extended target - */ - function extend(target /*, sources */) { - var sources = Array.prototype.slice.call(arguments, 1), - source, i, prop; - - for (i = 0; i < sources.length; i++) { - source = sources[i]; - - for (prop in source) { - if (source.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - - // Make sure we copy (own) toString method even when in JScript with DontEnum bug - // See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug - if (hasDontEnumBug && source.hasOwnProperty("toString") && source.toString !== target.toString) { - target.toString = source.toString; - } - } - - return target; - }; - - sinon.extend = extend; - return sinon.extend; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./util/core":41}],30:[function(require,module,exports){ -/** - * @depend util/core.js - */ -/** - * Format functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -(function (sinon, formatio) { - function makeApi(sinon) { - function valueFormatter(value) { - return "" + value; - } - - function getFormatioFormatter() { - var formatter = formatio.configure({ - quoteStrings: false, - limitChildrenCount: 250 - }); - - function format() { - return formatter.ascii.apply(formatter, arguments); - }; - - return format; - } - - function getNodeFormatter(value) { - function format(value) { - return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value; - }; - - try { - var util = require("util"); - } catch (e) { - /* Node, but no util module - would be very old, but better safe than sorry */ - } - - return util ? format : valueFormatter; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function", - formatter; - - if (isNode) { - try { - formatio = require("formatio"); - } catch (e) {} - } - - if (formatio) { - formatter = getFormatioFormatter() - } else if (isNode) { - formatter = getNodeFormatter(); - } else { - formatter = valueFormatter; - } - - sinon.format = formatter; - return sinon.format; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}( - (typeof sinon == "object" && sinon || null), - (typeof formatio == "object" && formatio) -)); - -},{"./util/core":41,"formatio":48,"util":6}],31:[function(require,module,exports){ -/** - * @depend util/core.js - */ -/** - * Logs errors - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -(function (sinon) { - // cache a reference to setTimeout, so that our reference won't be stubbed out - // when using fake timers and errors will still get logged - // https://github.com/cjohansen/Sinon.JS/issues/381 - var realSetTimeout = setTimeout; - - function makeApi(sinon) { - - function log() {} - - function logError(label, err) { - var msg = label + " threw exception: "; - - sinon.log(msg + "[" + err.name + "] " + err.message); - - if (err.stack) { - sinon.log(err.stack); - } - - logError.setTimeout(function () { - err.message = msg + err.message; - throw err; - }, 0); - }; - - // wrap realSetTimeout with something we can stub in tests - logError.setTimeout = function (func, timeout) { - realSetTimeout(func, timeout); - } - - var exports = {}; - exports.log = sinon.log = log; - exports.logError = sinon.logError = logError; - - return exports; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./util/core":41}],32:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend typeOf.js - */ -/*jslint eqeqeq: false, onevar: false, plusplus: false*/ -/*global module, require, sinon*/ -/** - * Match functions - * - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2012 Maximilian Antoni - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - function assertType(value, type, name) { - var actual = sinon.typeOf(value); - if (actual !== type) { - throw new TypeError("Expected type of " + name + " to be " + - type + ", but was " + actual); - } - } - - var matcher = { - toString: function () { - return this.message; - } - }; - - function isMatcher(object) { - return matcher.isPrototypeOf(object); - } - - function matchObject(expectation, actual) { - if (actual === null || actual === undefined) { - return false; - } - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - var exp = expectation[key]; - var act = actual[key]; - if (match.isMatcher(exp)) { - if (!exp.test(act)) { - return false; - } - } else if (sinon.typeOf(exp) === "object") { - if (!matchObject(exp, act)) { - return false; - } - } else if (!sinon.deepEqual(exp, act)) { - return false; - } - } - } - return true; - } - - matcher.or = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var or = sinon.create(matcher); - or.test = function (actual) { - return m1.test(actual) || m2.test(actual); - }; - or.message = m1.message + ".or(" + m2.message + ")"; - return or; - }; - - matcher.and = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var and = sinon.create(matcher); - and.test = function (actual) { - return m1.test(actual) && m2.test(actual); - }; - and.message = m1.message + ".and(" + m2.message + ")"; - return and; - }; - - var match = function (expectation, message) { - var m = sinon.create(matcher); - var type = sinon.typeOf(expectation); - switch (type) { - case "object": - if (typeof expectation.test === "function") { - m.test = function (actual) { - return expectation.test(actual) === true; - }; - m.message = "match(" + sinon.functionName(expectation.test) + ")"; - return m; - } - var str = []; - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - str.push(key + ": " + expectation[key]); - } - } - m.test = function (actual) { - return matchObject(expectation, actual); - }; - m.message = "match(" + str.join(", ") + ")"; - break; - case "number": - m.test = function (actual) { - return expectation == actual; - }; - break; - case "string": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return actual.indexOf(expectation) !== -1; - }; - m.message = "match(\"" + expectation + "\")"; - break; - case "regexp": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return expectation.test(actual); - }; - break; - case "function": - m.test = expectation; - if (message) { - m.message = message; - } else { - m.message = "match(" + sinon.functionName(expectation) + ")"; - } - break; - default: - m.test = function (actual) { - return sinon.deepEqual(expectation, actual); - }; - } - if (!m.message) { - m.message = "match(" + expectation + ")"; - } - return m; - }; - - match.isMatcher = isMatcher; - - match.any = match(function () { - return true; - }, "any"); - - match.defined = match(function (actual) { - return actual !== null && actual !== undefined; - }, "defined"); - - match.truthy = match(function (actual) { - return !!actual; - }, "truthy"); - - match.falsy = match(function (actual) { - return !actual; - }, "falsy"); - - match.same = function (expectation) { - return match(function (actual) { - return expectation === actual; - }, "same(" + expectation + ")"); - }; - - match.typeOf = function (type) { - assertType(type, "string", "type"); - return match(function (actual) { - return sinon.typeOf(actual) === type; - }, "typeOf(\"" + type + "\")"); - }; - - match.instanceOf = function (type) { - assertType(type, "function", "type"); - return match(function (actual) { - return actual instanceof type; - }, "instanceOf(" + sinon.functionName(type) + ")"); - }; - - function createPropertyMatcher(propertyTest, messagePrefix) { - return function (property, value) { - assertType(property, "string", "property"); - var onlyProperty = arguments.length === 1; - var message = messagePrefix + "(\"" + property + "\""; - if (!onlyProperty) { - message += ", " + value; - } - message += ")"; - return match(function (actual) { - if (actual === undefined || actual === null || - !propertyTest(actual, property)) { - return false; - } - return onlyProperty || sinon.deepEqual(value, actual[property]); - }, message); - }; - } - - match.has = createPropertyMatcher(function (actual, property) { - if (typeof actual === "object") { - return property in actual; - } - return actual[property] !== undefined; - }, "has"); - - match.hasOwn = createPropertyMatcher(function (actual, property) { - return actual.hasOwnProperty(property); - }, "hasOwn"); - - match.bool = match.typeOf("boolean"); - match.number = match.typeOf("number"); - match.string = match.typeOf("string"); - match.object = match.typeOf("object"); - match.func = match.typeOf("function"); - match.array = match.typeOf("array"); - match.regexp = match.typeOf("regexp"); - match.date = match.typeOf("date"); - - sinon.match = match; - return match; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./typeOf"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./typeOf":40,"./util/core":41}],33:[function(require,module,exports){ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend call.js - * @depend extend.js - * @depend match.js - * @depend spy.js - * @depend stub.js - * @depend format.js - */ -/** - * Mock functions. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - var push = [].push; - var match = sinon.match; - - function mock(object) { - if (!object) { - return sinon.expectation.create("Anonymous mock"); - } - - return mock.create(object); - } - - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - - sinon.extend(mock, { - create: function create(object) { - if (!object) { - throw new TypeError("object is null"); - } - - var mockObject = sinon.extend({}, mock); - mockObject.object = object; - delete mockObject.create; - - return mockObject; - }, - - expects: function expects(method) { - if (!method) { - throw new TypeError("method is falsy"); - } - - if (!this.expectations) { - this.expectations = {}; - this.proxies = []; - } - - if (!this.expectations[method]) { - this.expectations[method] = []; - var mockObject = this; - - sinon.wrapMethod(this.object, method, function () { - return mockObject.invokeMethod(method, this, arguments); - }); - - push.call(this.proxies, method); - } - - var expectation = sinon.expectation.create(method); - push.call(this.expectations[method], expectation); - - return expectation; - }, - - restore: function restore() { - var object = this.object; - - each(this.proxies, function (proxy) { - if (typeof object[proxy].restore == "function") { - object[proxy].restore(); - } - }); - }, - - verify: function verify() { - var expectations = this.expectations || {}; - var messages = [], met = []; - - each(this.proxies, function (proxy) { - each(expectations[proxy], function (expectation) { - if (!expectation.met()) { - push.call(messages, expectation.toString()); - } else { - push.call(met, expectation.toString()); - } - }); - }); - - this.restore(); - - if (messages.length > 0) { - sinon.expectation.fail(messages.concat(met).join("\n")); - } else if (met.length > 0) { - sinon.expectation.pass(messages.concat(met).join("\n")); - } - - return true; - }, - - invokeMethod: function invokeMethod(method, thisValue, args) { - var expectations = this.expectations && this.expectations[method]; - var length = expectations && expectations.length || 0, i; - - for (i = 0; i < length; i += 1) { - if (!expectations[i].met() && - expectations[i].allowsCall(thisValue, args)) { - return expectations[i].apply(thisValue, args); - } - } - - var messages = [], available, exhausted = 0; - - for (i = 0; i < length; i += 1) { - if (expectations[i].allowsCall(thisValue, args)) { - available = available || expectations[i]; - } else { - exhausted += 1; - } - push.call(messages, " " + expectations[i].toString()); - } - - if (exhausted === 0) { - return available.apply(thisValue, args); - } - - messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({ - proxy: method, - args: args - })); - - sinon.expectation.fail(messages.join("\n")); - } - }); - - var times = sinon.timesInWords; - var slice = Array.prototype.slice; - - function callCountInWords(callCount) { - if (callCount == 0) { - return "never called"; - } else { - return "called " + times(callCount); - } - } - - function expectedCallCountInWords(expectation) { - var min = expectation.minCalls; - var max = expectation.maxCalls; - - if (typeof min == "number" && typeof max == "number") { - var str = times(min); - - if (min != max) { - str = "at least " + str + " and at most " + times(max); - } - - return str; - } - - if (typeof min == "number") { - return "at least " + times(min); - } - - return "at most " + times(max); - } - - function receivedMinCalls(expectation) { - var hasMinLimit = typeof expectation.minCalls == "number"; - return !hasMinLimit || expectation.callCount >= expectation.minCalls; - } - - function receivedMaxCalls(expectation) { - if (typeof expectation.maxCalls != "number") { - return false; - } - - return expectation.callCount == expectation.maxCalls; - } - - function verifyMatcher(possibleMatcher, arg) { - if (match && match.isMatcher(possibleMatcher)) { - return possibleMatcher.test(arg); - } else { - return true; - } - } - - sinon.expectation = { - minCalls: 1, - maxCalls: 1, - - create: function create(methodName) { - var expectation = sinon.extend(sinon.stub.create(), sinon.expectation); - delete expectation.create; - expectation.method = methodName; - - return expectation; - }, - - invoke: function invoke(func, thisValue, args) { - this.verifyCallAllowed(thisValue, args); - - return sinon.spy.invoke.apply(this, arguments); - }, - - atLeast: function atLeast(num) { - if (typeof num != "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.maxCalls = null; - this.limitsSet = true; - } - - this.minCalls = num; - - return this; - }, - - atMost: function atMost(num) { - if (typeof num != "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.minCalls = null; - this.limitsSet = true; - } - - this.maxCalls = num; - - return this; - }, - - never: function never() { - return this.exactly(0); - }, - - once: function once() { - return this.exactly(1); - }, - - twice: function twice() { - return this.exactly(2); - }, - - thrice: function thrice() { - return this.exactly(3); - }, - - exactly: function exactly(num) { - if (typeof num != "number") { - throw new TypeError("'" + num + "' is not a number"); - } - - this.atLeast(num); - return this.atMost(num); - }, - - met: function met() { - return !this.failed && receivedMinCalls(this); - }, - - verifyCallAllowed: function verifyCallAllowed(thisValue, args) { - if (receivedMaxCalls(this)) { - this.failed = true; - sinon.expectation.fail(this.method + " already called " + times(this.maxCalls)); - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " + - this.expectedThis); - } - - if (!("expectedArguments" in this)) { - return; - } - - if (!args) { - sinon.expectation.fail(this.method + " received no arguments, expected " + - sinon.format(this.expectedArguments)); - } - - if (args.length < this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - if (this.expectsExactArgCount && - args.length != this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", didn't match " + this.expectedArguments.toString()); - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", expected " + sinon.format(this.expectedArguments)); - } - } - }, - - allowsCall: function allowsCall(thisValue, args) { - if (this.met() && receivedMaxCalls(this)) { - return false; - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - return false; - } - - if (!("expectedArguments" in this)) { - return true; - } - - args = args || []; - - if (args.length < this.expectedArguments.length) { - return false; - } - - if (this.expectsExactArgCount && - args.length != this.expectedArguments.length) { - return false; - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - return false; - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - return false; - } - } - - return true; - }, - - withArgs: function withArgs() { - this.expectedArguments = slice.call(arguments); - return this; - }, - - withExactArgs: function withExactArgs() { - this.withArgs.apply(this, arguments); - this.expectsExactArgCount = true; - return this; - }, - - on: function on(thisValue) { - this.expectedThis = thisValue; - return this; - }, - - toString: function () { - var args = (this.expectedArguments || []).slice(); - - if (!this.expectsExactArgCount) { - push.call(args, "[...]"); - } - - var callStr = sinon.spyCall.toString.call({ - proxy: this.method || "anonymous mock expectation", - args: args - }); - - var message = callStr.replace(", [...", "[, ...") + " " + - expectedCallCountInWords(this); - - if (this.met()) { - return "Expectation met: " + message; - } - - return "Expected " + message + " (" + - callCountInWords(this.callCount) + ")"; - }, - - verify: function verify() { - if (!this.met()) { - sinon.expectation.fail(this.toString()); - } else { - sinon.expectation.pass(this.toString()); - } - - return true; - }, - - pass: function pass(message) { - sinon.assert.pass(message); - }, - - fail: function fail(message) { - var exception = new Error(message); - exception.name = "ExpectationError"; - - throw exception; - } - }; - - sinon.mock = mock; - return mock; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./times_in_words"); - require("./call"); - require("./extend"); - require("./match"); - require("./spy"); - require("./stub"); - require("./format"); - - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./call":27,"./extend":29,"./format":30,"./match":32,"./spy":35,"./stub":36,"./times_in_words":39,"./util/core":41}],34:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend extend.js - * @depend collection.js - * @depend util/fake_timers.js - * @depend util/fake_server_with_clock.js - */ -/** - * Manages fake collections as well as fake utilities such as Sinon's - * timers and fake XHR implementation in one convenient object. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function () { - function makeApi(sinon) { - var push = [].push; - - function exposeValue(sandbox, config, key, value) { - if (!value) { - return; - } - - if (config.injectInto && !(key in config.injectInto)) { - config.injectInto[key] = value; - sandbox.injectedKeys.push(key); - } else { - push.call(sandbox.args, value); - } - } - - function prepareSandboxFromConfig(config) { - var sandbox = sinon.create(sinon.sandbox); - - if (config.useFakeServer) { - if (typeof config.useFakeServer == "object") { - sandbox.serverPrototype = config.useFakeServer; - } - - sandbox.useFakeServer(); - } - - if (config.useFakeTimers) { - if (typeof config.useFakeTimers == "object") { - sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers); - } else { - sandbox.useFakeTimers(); - } - } - - return sandbox; - } - - sinon.sandbox = sinon.extend(sinon.create(sinon.collection), { - useFakeTimers: function useFakeTimers() { - this.clock = sinon.useFakeTimers.apply(sinon, arguments); - - return this.add(this.clock); - }, - - serverPrototype: sinon.fakeServer, - - useFakeServer: function useFakeServer() { - var proto = this.serverPrototype || sinon.fakeServer; - - if (!proto || !proto.create) { - return null; - } - - this.server = proto.create(); - return this.add(this.server); - }, - - inject: function (obj) { - sinon.collection.inject.call(this, obj); - - if (this.clock) { - obj.clock = this.clock; - } - - if (this.server) { - obj.server = this.server; - obj.requests = this.server.requests; - } - - obj.match = sinon.match; - - return obj; - }, - - restore: function () { - sinon.collection.restore.apply(this, arguments); - this.restoreContext(); - }, - - restoreContext: function () { - if (this.injectedKeys) { - for (var i = 0, j = this.injectedKeys.length; i < j; i++) { - delete this.injectInto[this.injectedKeys[i]]; - } - this.injectedKeys = []; - } - }, - - create: function (config) { - if (!config) { - return sinon.create(sinon.sandbox); - } - - var sandbox = prepareSandboxFromConfig(config); - sandbox.args = sandbox.args || []; - sandbox.injectedKeys = []; - sandbox.injectInto = config.injectInto; - var prop, value, exposed = sandbox.inject({}); - - if (config.properties) { - for (var i = 0, l = config.properties.length; i < l; i++) { - prop = config.properties[i]; - value = exposed[prop] || prop == "sandbox" && sandbox; - exposeValue(sandbox, config, prop, value); - } - } else { - exposeValue(sandbox, config, "sandbox", value); - } - - return sandbox; - }, - - match: sinon.match - }); - - sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer; - - return sinon.sandbox; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - require("./util/fake_server_with_clock"); - require("./util/fake_timers"); - require("./collection"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}()); - -},{"./collection":28,"./extend":29,"./util/core":41,"./util/fake_server_with_clock":44,"./util/fake_timers":45}],35:[function(require,module,exports){ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend extend.js - * @depend call.js - * @depend format.js - */ -/** - * Spy functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - - function makeApi(sinon) { - var push = Array.prototype.push; - var slice = Array.prototype.slice; - var callId = 0; - - function spy(object, property, types) { - if (!property && typeof object == "function") { - return spy.create(object); - } - - if (!object && !property) { - return spy.create(function () { }); - } - - if (types) { - var methodDesc = sinon.getPropertyDescriptor(object, property); - for (var i = 0; i < types.length; i++) { - methodDesc[types[i]] = spy.create(methodDesc[types[i]]); - } - return sinon.wrapMethod(object, property, methodDesc); - } else { - var method = object[property]; - return sinon.wrapMethod(object, property, spy.create(method)); - } - } - - function matchingFake(fakes, args, strict) { - if (!fakes) { - return; - } - - for (var i = 0, l = fakes.length; i < l; i++) { - if (fakes[i].matches(args, strict)) { - return fakes[i]; - } - } - } - - function incrementCallCount() { - this.called = true; - this.callCount += 1; - this.notCalled = false; - this.calledOnce = this.callCount == 1; - this.calledTwice = this.callCount == 2; - this.calledThrice = this.callCount == 3; - } - - function createCallProperties() { - this.firstCall = this.getCall(0); - this.secondCall = this.getCall(1); - this.thirdCall = this.getCall(2); - this.lastCall = this.getCall(this.callCount - 1); - } - - var vars = "a,b,c,d,e,f,g,h,i,j,k,l"; - function createProxy(func, proxyLength) { - // Retain the function length: - var p; - if (proxyLength) { - eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) + - ") { return p.invoke(func, this, slice.call(arguments)); });"); - } else { - p = function proxy() { - return p.invoke(func, this, slice.call(arguments)); - }; - } - return p; - } - - var uuid = 0; - - // Public API - var spyApi = { - reset: function () { - if (this.invoking) { - var err = new Error("Cannot reset Sinon function while invoking it. " + - "Move the call to .reset outside of the callback."); - err.name = "InvalidResetException"; - throw err; - } - - this.called = false; - this.notCalled = true; - this.calledOnce = false; - this.calledTwice = false; - this.calledThrice = false; - this.callCount = 0; - this.firstCall = null; - this.secondCall = null; - this.thirdCall = null; - this.lastCall = null; - this.args = []; - this.returnValues = []; - this.thisValues = []; - this.exceptions = []; - this.callIds = []; - if (this.fakes) { - for (var i = 0; i < this.fakes.length; i++) { - this.fakes[i].reset(); - } - } - - return this; - }, - - create: function create(func, spyLength) { - var name; - - if (typeof func != "function") { - func = function () { }; - } else { - name = sinon.functionName(func); - } - - if (!spyLength) { - spyLength = func.length; - } - - var proxy = createProxy(func, spyLength); - - sinon.extend(proxy, spy); - delete proxy.create; - sinon.extend(proxy, func); - - proxy.reset(); - proxy.prototype = func.prototype; - proxy.displayName = name || "spy"; - proxy.toString = sinon.functionToString; - proxy.instantiateFake = sinon.spy.create; - proxy.id = "spy#" + uuid++; - - return proxy; - }, - - invoke: function invoke(func, thisValue, args) { - var matching = matchingFake(this.fakes, args); - var exception, returnValue; - - incrementCallCount.call(this); - push.call(this.thisValues, thisValue); - push.call(this.args, args); - push.call(this.callIds, callId++); - - // Make call properties available from within the spied function: - createCallProperties.call(this); - - try { - this.invoking = true; - - if (matching) { - returnValue = matching.invoke(func, thisValue, args); - } else { - returnValue = (this.func || func).apply(thisValue, args); - } - - var thisCall = this.getCall(this.callCount - 1); - if (thisCall.calledWithNew() && typeof returnValue !== "object") { - returnValue = thisValue; - } - } catch (e) { - exception = e; - } finally { - delete this.invoking; - } - - push.call(this.exceptions, exception); - push.call(this.returnValues, returnValue); - - // Make return value and exception available in the calls: - createCallProperties.call(this); - - if (exception !== undefined) { - throw exception; - } - - return returnValue; - }, - - named: function named(name) { - this.displayName = name; - return this; - }, - - getCall: function getCall(i) { - if (i < 0 || i >= this.callCount) { - return null; - } - - return sinon.spyCall(this, this.thisValues[i], this.args[i], - this.returnValues[i], this.exceptions[i], - this.callIds[i]); - }, - - getCalls: function () { - var calls = []; - var i; - - for (i = 0; i < this.callCount; i++) { - calls.push(this.getCall(i)); - } - - return calls; - }, - - calledBefore: function calledBefore(spyFn) { - if (!this.called) { - return false; - } - - if (!spyFn.called) { - return true; - } - - return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1]; - }, - - calledAfter: function calledAfter(spyFn) { - if (!this.called || !spyFn.called) { - return false; - } - - return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1]; - }, - - withArgs: function () { - var args = slice.call(arguments); - - if (this.fakes) { - var match = matchingFake(this.fakes, args, true); - - if (match) { - return match; - } - } else { - this.fakes = []; - } - - var original = this; - var fake = this.instantiateFake(); - fake.matchingAguments = args; - fake.parent = this; - push.call(this.fakes, fake); - - fake.withArgs = function () { - return original.withArgs.apply(original, arguments); - }; - - for (var i = 0; i < this.args.length; i++) { - if (fake.matches(this.args[i])) { - incrementCallCount.call(fake); - push.call(fake.thisValues, this.thisValues[i]); - push.call(fake.args, this.args[i]); - push.call(fake.returnValues, this.returnValues[i]); - push.call(fake.exceptions, this.exceptions[i]); - push.call(fake.callIds, this.callIds[i]); - } - } - createCallProperties.call(fake); - - return fake; - }, - - matches: function (args, strict) { - var margs = this.matchingAguments; - - if (margs.length <= args.length && - sinon.deepEqual(margs, args.slice(0, margs.length))) { - return !strict || margs.length == args.length; - } - }, - - printf: function (format) { - var spy = this; - var args = slice.call(arguments, 1); - var formatter; - - return (format || "").replace(/%(.)/g, function (match, specifyer) { - formatter = spyApi.formatters[specifyer]; - - if (typeof formatter == "function") { - return formatter.call(null, spy, args); - } else if (!isNaN(parseInt(specifyer, 10))) { - return sinon.format(args[specifyer - 1]); - } - - return "%" + specifyer; - }); - } - }; - - function delegateToCalls(method, matchAny, actual, notCalled) { - spyApi[method] = function () { - if (!this.called) { - if (notCalled) { - return notCalled.apply(this, arguments); - } - return false; - } - - var currentCall; - var matches = 0; - - for (var i = 0, l = this.callCount; i < l; i += 1) { - currentCall = this.getCall(i); - - if (currentCall[actual || method].apply(currentCall, arguments)) { - matches += 1; - - if (matchAny) { - return true; - } - } - } - - return matches === this.callCount; - }; - } - - delegateToCalls("calledOn", true); - delegateToCalls("alwaysCalledOn", false, "calledOn"); - delegateToCalls("calledWith", true); - delegateToCalls("calledWithMatch", true); - delegateToCalls("alwaysCalledWith", false, "calledWith"); - delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch"); - delegateToCalls("calledWithExactly", true); - delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly"); - delegateToCalls("neverCalledWith", false, "notCalledWith", - function () { return true; }); - delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", - function () { return true; }); - delegateToCalls("threw", true); - delegateToCalls("alwaysThrew", false, "threw"); - delegateToCalls("returned", true); - delegateToCalls("alwaysReturned", false, "returned"); - delegateToCalls("calledWithNew", true); - delegateToCalls("alwaysCalledWithNew", false, "calledWithNew"); - delegateToCalls("callArg", false, "callArgWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgWith = spyApi.callArg; - delegateToCalls("callArgOn", false, "callArgOnWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgOnWith = spyApi.callArgOn; - delegateToCalls("yield", false, "yield", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode. - spyApi.invokeCallback = spyApi.yield; - delegateToCalls("yieldOn", false, "yieldOn", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - delegateToCalls("yieldTo", false, "yieldTo", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - delegateToCalls("yieldToOn", false, "yieldToOn", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - - spyApi.formatters = { - c: function (spy) { - return sinon.timesInWords(spy.callCount); - }, - - n: function (spy) { - return spy.toString(); - }, - - C: function (spy) { - var calls = []; - - for (var i = 0, l = spy.callCount; i < l; ++i) { - var stringifiedCall = " " + spy.getCall(i).toString(); - if (/\n/.test(calls[i - 1])) { - stringifiedCall = "\n" + stringifiedCall; - } - push.call(calls, stringifiedCall); - } - - return calls.length > 0 ? "\n" + calls.join("\n") : ""; - }, - - t: function (spy) { - var objects = []; - - for (var i = 0, l = spy.callCount; i < l; ++i) { - push.call(objects, sinon.format(spy.thisValues[i])); - } - - return objects.join(", "); - }, - - "*": function (spy, args) { - var formatted = []; - - for (var i = 0, l = args.length; i < l; ++i) { - push.call(formatted, sinon.format(args[i])); - } - - return formatted.join(", "); - } - }; - - sinon.extend(spy, spyApi); - - spy.spyCall = sinon.spyCall; - sinon.spy = spy; - - return spy; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./call"); - require("./extend"); - require("./times_in_words"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./call":27,"./extend":29,"./format":30,"./times_in_words":39,"./util/core":41}],36:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend extend.js - * @depend spy.js - * @depend behavior.js - */ -/** - * Stub functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - function stub(object, property, func) { - if (!!func && typeof func != "function" && typeof func != "object") { - throw new TypeError("Custom stub should be a function or a property descriptor"); - } - - var wrapper; - - if (func) { - if (typeof func == "function") { - wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func; - } else { - wrapper = func; - if (sinon.spy && sinon.spy.create) { - var types = sinon.objectKeys(wrapper); - for (var i = 0; i < types.length; i++) { - wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]); - } - } - } - } else { - var stubLength = 0; - if (typeof object == "object" && typeof object[property] == "function") { - stubLength = object[property].length; - } - wrapper = stub.create(stubLength); - } - - if (!object && typeof property === "undefined") { - return sinon.stub.create(); - } - - if (typeof property === "undefined" && typeof object == "object") { - for (var prop in object) { - if (typeof object[prop] === "function") { - stub(object, prop); - } - } - - return object; - } - - return sinon.wrapMethod(object, property, wrapper); - } - - function getDefaultBehavior(stub) { - return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub); - } - - function getParentBehaviour(stub) { - return (stub.parent && getCurrentBehavior(stub.parent)); - } - - function getCurrentBehavior(stub) { - var behavior = stub.behaviors[stub.callCount - 1]; - return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub); - } - - var uuid = 0; - - var proto = { - create: function create(stubLength) { - var functionStub = function () { - return getCurrentBehavior(functionStub).invoke(this, arguments); - }; - - functionStub.id = "stub#" + uuid++; - var orig = functionStub; - functionStub = sinon.spy.create(functionStub, stubLength); - functionStub.func = orig; - - sinon.extend(functionStub, stub); - functionStub.instantiateFake = sinon.stub.create; - functionStub.displayName = "stub"; - functionStub.toString = sinon.functionToString; - - functionStub.defaultBehavior = null; - functionStub.behaviors = []; - - return functionStub; - }, - - resetBehavior: function () { - var i; - - this.defaultBehavior = null; - this.behaviors = []; - - delete this.returnValue; - delete this.returnArgAt; - this.returnThis = false; - - if (this.fakes) { - for (i = 0; i < this.fakes.length; i++) { - this.fakes[i].resetBehavior(); - } - } - }, - - onCall: function onCall(index) { - if (!this.behaviors[index]) { - this.behaviors[index] = sinon.behavior.create(this); - } - - return this.behaviors[index]; - }, - - onFirstCall: function onFirstCall() { - return this.onCall(0); - }, - - onSecondCall: function onSecondCall() { - return this.onCall(1); - }, - - onThirdCall: function onThirdCall() { - return this.onCall(2); - } - }; - - for (var method in sinon.behavior) { - if (sinon.behavior.hasOwnProperty(method) && - !proto.hasOwnProperty(method) && - method != "create" && - method != "withArgs" && - method != "invoke") { - proto[method] = (function (behaviorMethod) { - return function () { - this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this); - this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments); - return this; - }; - }(method)); - } - } - - sinon.extend(stub, proto); - sinon.stub = stub; - - return stub; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./behavior"); - require("./spy"); - require("./extend"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./behavior":26,"./extend":29,"./spy":35,"./util/core":41}],37:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend sandbox.js - */ -/** - * Test function, sandboxes fakes - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - var slice = Array.prototype.slice; - - function test(callback) { - var type = typeof callback; - - if (type != "function") { - throw new TypeError("sinon.test needs to wrap a test function, got " + type); - } - - function sinonSandboxedTest() { - var config = sinon.getConfig(sinon.config); - config.injectInto = config.injectIntoThis && this || config.injectInto; - var sandbox = sinon.sandbox.create(config); - var args = slice.call(arguments); - var oldDone = args.length && args[args.length - 1]; - var exception, result; - - if (typeof oldDone == "function") { - args[args.length - 1] = function sinonDone(result) { - if (result) { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - oldDone(result); - }; - } - - try { - result = callback.apply(this, args.concat(sandbox.args)); - } catch (e) { - exception = e; - } - - if (typeof oldDone != "function") { - if (typeof exception !== "undefined") { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - } - - return result; - } - - if (callback.length) { - return function sinonAsyncSandboxedTest(callback) { - return sinonSandboxedTest.apply(this, arguments); - }; - } - - return sinonSandboxedTest; - } - - test.config = { - injectIntoThis: true, - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeTimers: true, - useFakeServer: true - }; - - sinon.test = test; - return test; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./sandbox"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (sinon) { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./sandbox":34,"./util/core":41}],38:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend test.js - */ -/** - * Test case, sandboxes all test functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function createTest(property, setUp, tearDown) { - return function () { - if (setUp) { - setUp.apply(this, arguments); - } - - var exception, result; - - try { - result = property.apply(this, arguments); - } catch (e) { - exception = e; - } - - if (tearDown) { - tearDown.apply(this, arguments); - } - - if (exception) { - throw exception; - } - - return result; - }; - } - - function makeApi(sinon) { - function testCase(tests, prefix) { - /*jsl:ignore*/ - if (!tests || typeof tests != "object") { - throw new TypeError("sinon.testCase needs an object with test functions"); - } - /*jsl:end*/ - - prefix = prefix || "test"; - var rPrefix = new RegExp("^" + prefix); - var methods = {}, testName, property, method; - var setUp = tests.setUp; - var tearDown = tests.tearDown; - - for (testName in tests) { - if (tests.hasOwnProperty(testName)) { - property = tests[testName]; - - if (/^(setUp|tearDown)$/.test(testName)) { - continue; - } - - if (typeof property == "function" && rPrefix.test(testName)) { - method = property; - - if (setUp || tearDown) { - method = createTest(property, setUp, tearDown); - } - - methods[testName] = sinon.test(method); - } else { - methods[testName] = tests[testName]; - } - } - } - - return methods; - } - - sinon.testCase = testCase; - return testCase; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./test"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./test":37,"./util/core":41}],39:[function(require,module,exports){ -/** - * @depend util/core.js - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - - function timesInWords(count) { - switch (count) { - case 1: - return "once"; - case 2: - return "twice"; - case 3: - return "thrice"; - default: - return (count || 0) + " times"; - } - } - - sinon.timesInWords = timesInWords; - return sinon.timesInWords; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./util/core":41}],40:[function(require,module,exports){ -/** - * @depend util/core.js - */ -/** - * Format functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -(function (sinon, formatio) { - function makeApi(sinon) { - function typeOf(value) { - if (value === null) { - return "null"; - } else if (value === undefined) { - return "undefined"; - } - var string = Object.prototype.toString.call(value); - return string.substring(8, string.length - 1).toLowerCase(); - }; - - sinon.typeOf = typeOf; - return sinon.typeOf; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}( - (typeof sinon == "object" && sinon || null), - (typeof formatio == "object" && formatio) -)); - -},{"./util/core":41}],41:[function(require,module,exports){ -/** - * @depend ../../sinon.js - */ -/** - * Sinon core utilities. For internal use only. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - var div = typeof document != "undefined" && document.createElement("div"); - var hasOwn = Object.prototype.hasOwnProperty; - - function isDOMNode(obj) { - var success = false; - - try { - obj.appendChild(div); - success = div.parentNode == obj; - } catch (e) { - return false; - } finally { - try { - obj.removeChild(div); - } catch (e) { - // Remove failed, not much we can do about that - } - } - - return success; - } - - function isElement(obj) { - return div && obj && obj.nodeType === 1 && isDOMNode(obj); - } - - function isFunction(obj) { - return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply); - } - - function isReallyNaN(val) { - return typeof val === "number" && isNaN(val); - } - - function mirrorProperties(target, source) { - for (var prop in source) { - if (!hasOwn.call(target, prop)) { - target[prop] = source[prop]; - } - } - } - - function isRestorable(obj) { - return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon; - } - - // Cheap way to detect if we have ES5 support. - var hasES5Support = "keys" in Object; - - function makeApi(sinon) { - sinon.wrapMethod = function wrapMethod(object, property, method) { - if (!object) { - throw new TypeError("Should wrap property of object"); - } - - if (typeof method != "function" && typeof method != "object") { - throw new TypeError("Method wrapper should be a function or a property descriptor"); - } - - function checkWrappedMethod(wrappedMethod) { - if (!isFunction(wrappedMethod)) { - error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + - property + " as function"); - } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) { - error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } else if (wrappedMethod.calledBefore) { - var verb = !!wrappedMethod.returns ? "stubbed" : "spied on"; - error = new TypeError("Attempted to wrap " + property + " which is already " + verb); - } - - if (error) { - if (wrappedMethod && wrappedMethod.stackTrace) { - error.stack += "\n--------------\n" + wrappedMethod.stackTrace; - } - throw error; - } - } - - var error, wrappedMethod; - - // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem - // when using hasOwn.call on objects from other frames. - var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property); - - if (hasES5Support) { - var methodDesc = (typeof method == "function") ? {value: method} : method, - wrappedMethodDesc = sinon.getPropertyDescriptor(object, property), - i; - - if (!wrappedMethodDesc) { - error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + - property + " as function"); - } else if (wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon) { - error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } - if (error) { - if (wrappedMethodDesc && wrappedMethodDesc.stackTrace) { - error.stack += "\n--------------\n" + wrappedMethodDesc.stackTrace; - } - throw error; - } - - var types = sinon.objectKeys(methodDesc); - for (i = 0; i < types.length; i++) { - wrappedMethod = wrappedMethodDesc[types[i]]; - checkWrappedMethod(wrappedMethod); - } - - mirrorProperties(methodDesc, wrappedMethodDesc); - for (i = 0; i < types.length; i++) { - mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]); - } - Object.defineProperty(object, property, methodDesc); - } else { - wrappedMethod = object[property]; - checkWrappedMethod(wrappedMethod); - object[property] = method; - method.displayName = property; - } - - method.displayName = property; - - // Set up a stack trace which can be used later to find what line of - // code the original method was created on. - method.stackTrace = (new Error("Stack Trace for original")).stack; - - method.restore = function () { - // For prototype properties try to reset by delete first. - // If this fails (ex: localStorage on mobile safari) then force a reset - // via direct assignment. - if (!owned) { - try { - delete object[property]; - } catch (e) {} - // For native code functions `delete` fails without throwing an error - // on Chrome < 43, PhantomJS, etc. - // Use strict equality comparison to check failures then force a reset - // via direct assignment. - if (object[property] === method) { - object[property] = wrappedMethod; - } - } else if (hasES5Support) { - Object.defineProperty(object, property, wrappedMethodDesc); - } - - if (!hasES5Support && object[property] === method) { - object[property] = wrappedMethod; - } - }; - - method.restore.sinon = true; - - if (!hasES5Support) { - mirrorProperties(method, wrappedMethod); - } - - return method; - }; - - sinon.create = function create(proto) { - var F = function () {}; - F.prototype = proto; - return new F(); - }; - - sinon.deepEqual = function deepEqual(a, b) { - if (sinon.match && sinon.match.isMatcher(a)) { - return a.test(b); - } - - if (typeof a != "object" || typeof b != "object") { - if (isReallyNaN(a) && isReallyNaN(b)) { - return true; - } else { - return a === b; - } - } - - if (isElement(a) || isElement(b)) { - return a === b; - } - - if (a === b) { - return true; - } - - if ((a === null && b !== null) || (a !== null && b === null)) { - return false; - } - - if (a instanceof RegExp && b instanceof RegExp) { - return (a.source === b.source) && (a.global === b.global) && - (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline); - } - - var aString = Object.prototype.toString.call(a); - if (aString != Object.prototype.toString.call(b)) { - return false; - } - - if (aString == "[object Date]") { - return a.valueOf() === b.valueOf(); - } - - var prop, aLength = 0, bLength = 0; - - if (aString == "[object Array]" && a.length !== b.length) { - return false; - } - - for (prop in a) { - aLength += 1; - - if (!(prop in b)) { - return false; - } - - if (!deepEqual(a[prop], b[prop])) { - return false; - } - } - - for (prop in b) { - bLength += 1; - } - - return aLength == bLength; - }; - - sinon.functionName = function functionName(func) { - var name = func.displayName || func.name; - - // Use function decomposition as a last resort to get function - // name. Does not rely on function decomposition to work - if it - // doesn't debugging will be slightly less informative - // (i.e. toString will say 'spy' rather than 'myFunc'). - if (!name) { - var matches = func.toString().match(/function ([^\s\(]+)/); - name = matches && matches[1]; - } - - return name; - }; - - sinon.functionToString = function toString() { - if (this.getCall && this.callCount) { - var thisValue, prop, i = this.callCount; - - while (i--) { - thisValue = this.getCall(i).thisValue; - - for (prop in thisValue) { - if (thisValue[prop] === this) { - return prop; - } - } - } - } - - return this.displayName || "sinon fake"; - }; - - sinon.objectKeys = function objectKeys(obj) { - if (obj !== Object(obj)) { - throw new TypeError("sinon.objectKeys called on a non-object"); - } - - var keys = []; - var key; - for (key in obj) { - if (hasOwn.call(obj, key)) { - keys.push(key); - } - } - - return keys; - }; - - sinon.getPropertyDescriptor = function getPropertyDescriptor(object, property) { - var proto = object, descriptor; - while (proto && !(descriptor = Object.getOwnPropertyDescriptor(proto, property))) { - proto = Object.getPrototypeOf(proto); - } - return descriptor; - } - - sinon.getConfig = function (custom) { - var config = {}; - custom = custom || {}; - var defaults = sinon.defaultConfig; - - for (var prop in defaults) { - if (defaults.hasOwnProperty(prop)) { - config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop]; - } - } - - return config; - }; - - sinon.defaultConfig = { - injectIntoThis: true, - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeTimers: true, - useFakeServer: true - }; - - sinon.timesInWords = function timesInWords(count) { - return count == 1 && "once" || - count == 2 && "twice" || - count == 3 && "thrice" || - (count || 0) + " times"; - }; - - sinon.calledInOrder = function (spies) { - for (var i = 1, l = spies.length; i < l; i++) { - if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) { - return false; - } - } - - return true; - }; - - sinon.orderByFirstCall = function (spies) { - return spies.sort(function (a, b) { - // uuid, won't ever be equal - var aCall = a.getCall(0); - var bCall = b.getCall(0); - var aId = aCall && aCall.callId || -1; - var bId = bCall && bCall.callId || -1; - - return aId < bId ? -1 : 1; - }); - }; - - sinon.createStubInstance = function (constructor) { - if (typeof constructor !== "function") { - throw new TypeError("The constructor should be a function."); - } - return sinon.stub(sinon.create(constructor.prototype)); - }; - - sinon.restore = function (object) { - if (object !== null && typeof object === "object") { - for (var prop in object) { - if (isRestorable(object[prop])) { - object[prop].restore(); - } - } - } else if (isRestorable(object)) { - object.restore(); - } - }; - - return sinon; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports) { - makeApi(exports); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{}],42:[function(require,module,exports){ -/** - * Minimal Event interface implementation - * - * Original implementation by Sven Fuchs: https://gist.github.com/995028 - * Modifications and tests by Christian Johansen. - * - * @author Sven Fuchs (svenfuchs@artweb-design.de) - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2011 Sven Fuchs, Christian Johansen - */ -"use strict"; - -if (typeof sinon == "undefined") { - this.sinon = {}; -} - -(function () { - var push = [].push; - - function makeApi(sinon) { - sinon.Event = function Event(type, bubbles, cancelable, target) { - this.initEvent(type, bubbles, cancelable, target); - }; - - sinon.Event.prototype = { - initEvent: function (type, bubbles, cancelable, target) { - this.type = type; - this.bubbles = bubbles; - this.cancelable = cancelable; - this.target = target; - }, - - stopPropagation: function () {}, - - preventDefault: function () { - this.defaultPrevented = true; - } - }; - - sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) { - this.initEvent(type, false, false, target); - this.loaded = progressEventRaw.loaded || null; - this.total = progressEventRaw.total || null; - this.lengthComputable = !!progressEventRaw.total; - }; - - sinon.ProgressEvent.prototype = new sinon.Event(); - - sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent; - - sinon.CustomEvent = function CustomEvent(type, customData, target) { - this.initEvent(type, false, false, target); - this.detail = customData.detail || null; - }; - - sinon.CustomEvent.prototype = new sinon.Event(); - - sinon.CustomEvent.prototype.constructor = sinon.CustomEvent; - - sinon.EventTarget = { - addEventListener: function addEventListener(event, listener) { - this.eventListeners = this.eventListeners || {}; - this.eventListeners[event] = this.eventListeners[event] || []; - push.call(this.eventListeners[event], listener); - }, - - removeEventListener: function removeEventListener(event, listener) { - var listeners = this.eventListeners && this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] == listener) { - return listeners.splice(i, 1); - } - } - }, - - dispatchEvent: function dispatchEvent(event) { - var type = event.type; - var listeners = this.eventListeners && this.eventListeners[type] || []; - - for (var i = 0; i < listeners.length; i++) { - if (typeof listeners[i] == "function") { - listeners[i].call(this, event); - } else { - listeners[i].handleEvent(event); - } - } - - return !!event.defaultPrevented; - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); - } -}()); - -},{"./core":41}],43:[function(require,module,exports){ -/** - * @depend fake_xdomain_request.js - * @depend fake_xml_http_request.js - * @depend ../format.js - * @depend ../log_error.js - */ -/** - * The Sinon "server" mimics a web server that receives requests from - * sinon.FakeXMLHttpRequest and provides an API to respond to those requests, - * both synchronously and asynchronously. To respond synchronuously, canned - * answers have to be provided upfront. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -if (typeof sinon == "undefined") { - var sinon = {}; -} - -(function () { - var push = [].push; - function F() {} - - function create(proto) { - F.prototype = proto; - return new F(); - } - - function responseArray(handler) { - var response = handler; - - if (Object.prototype.toString.call(handler) != "[object Array]") { - response = [200, {}, handler]; - } - - if (typeof response[2] != "string") { - throw new TypeError("Fake server response body should be string, but was " + - typeof response[2]); - } - - return response; - } - - var wloc = typeof window !== "undefined" ? window.location : {}; - var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host); - - function matchOne(response, reqMethod, reqUrl) { - var rmeth = response.method; - var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase(); - var url = response.url; - var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl)); - - return matchMethod && matchUrl; - } - - function match(response, request) { - var requestUrl = request.url; - - if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) { - requestUrl = requestUrl.replace(rCurrLoc, ""); - } - - if (matchOne(response, this.getHTTPMethod(request), requestUrl)) { - if (typeof response.response == "function") { - var ru = response.url; - var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []); - return response.response.apply(response, args); - } - - return true; - } - - return false; - } - - function makeApi(sinon) { - sinon.fakeServer = { - create: function () { - var server = create(this); - if (!sinon.xhr.supportsCORS) { - this.xhr = sinon.useFakeXDomainRequest(); - } else { - this.xhr = sinon.useFakeXMLHttpRequest(); - } - server.requests = []; - - this.xhr.onCreate = function (xhrObj) { - server.addRequest(xhrObj); - }; - - return server; - }, - - addRequest: function addRequest(xhrObj) { - var server = this; - push.call(this.requests, xhrObj); - - xhrObj.onSend = function () { - server.handleRequest(this); - - if (server.respondImmediately) { - server.respond(); - } else if (server.autoRespond && !server.responding) { - setTimeout(function () { - server.responding = false; - server.respond(); - }, server.autoRespondAfter || 10); - - server.responding = true; - } - }; - }, - - getHTTPMethod: function getHTTPMethod(request) { - if (this.fakeHTTPMethods && /post/i.test(request.method)) { - var matches = (request.requestBody || "").match(/_method=([^\b;]+)/); - return !!matches ? matches[1] : request.method; - } - - return request.method; - }, - - handleRequest: function handleRequest(xhr) { - if (xhr.async) { - if (!this.queue) { - this.queue = []; - } - - push.call(this.queue, xhr); - } else { - this.processRequest(xhr); - } - }, - - log: function log(response, request) { - var str; - - str = "Request:\n" + sinon.format(request) + "\n\n"; - str += "Response:\n" + sinon.format(response) + "\n\n"; - - sinon.log(str); - }, - - respondWith: function respondWith(method, url, body) { - if (arguments.length == 1 && typeof method != "function") { - this.response = responseArray(method); - return; - } - - if (!this.responses) { this.responses = []; } - - if (arguments.length == 1) { - body = method; - url = method = null; - } - - if (arguments.length == 2) { - body = url; - url = method; - method = null; - } - - push.call(this.responses, { - method: method, - url: url, - response: typeof body == "function" ? body : responseArray(body) - }); - }, - - respond: function respond() { - if (arguments.length > 0) { - this.respondWith.apply(this, arguments); - } - - var queue = this.queue || []; - var requests = queue.splice(0, queue.length); - var request; - - while (request = requests.shift()) { - this.processRequest(request); - } - }, - - processRequest: function processRequest(request) { - try { - if (request.aborted) { - return; - } - - var response = this.response || [404, {}, ""]; - - if (this.responses) { - for (var l = this.responses.length, i = l - 1; i >= 0; i--) { - if (match.call(this, this.responses[i], request)) { - response = this.responses[i].response; - break; - } - } - } - - if (request.readyState != 4) { - this.log(response, request); - - request.respond(response[0], response[1], response[2]); - } - } catch (e) { - sinon.logError("Fake server request processing", e); - } - }, - - restore: function restore() { - return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments); - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("./fake_xdomain_request"); - require("./fake_xml_http_request"); - require("../format"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else { - makeApi(sinon); - } -}()); - -},{"../format":30,"./core":41,"./fake_xdomain_request":46,"./fake_xml_http_request":47}],44:[function(require,module,exports){ -/** - * @depend fake_server.js - * @depend fake_timers.js - */ -/** - * Add-on for sinon.fakeServer that automatically handles a fake timer along with - * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery - * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead, - * it polls the object for completion with setInterval. Dispite the direct - * motivation, there is nothing jQuery-specific in this file, so it can be used - * in any environment where the ajax implementation depends on setInterval or - * setTimeout. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function () { - function makeApi(sinon) { - function Server() {} - Server.prototype = sinon.fakeServer; - - sinon.fakeServerWithClock = new Server(); - - sinon.fakeServerWithClock.addRequest = function addRequest(xhr) { - if (xhr.async) { - if (typeof setTimeout.clock == "object") { - this.clock = setTimeout.clock; - } else { - this.clock = sinon.useFakeTimers(); - this.resetClock = true; - } - - if (!this.longestTimeout) { - var clockSetTimeout = this.clock.setTimeout; - var clockSetInterval = this.clock.setInterval; - var server = this; - - this.clock.setTimeout = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetTimeout.apply(this, arguments); - }; - - this.clock.setInterval = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetInterval.apply(this, arguments); - }; - } - } - - return sinon.fakeServer.addRequest.call(this, xhr); - }; - - sinon.fakeServerWithClock.respond = function respond() { - var returnVal = sinon.fakeServer.respond.apply(this, arguments); - - if (this.clock) { - this.clock.tick(this.longestTimeout || 0); - this.longestTimeout = 0; - - if (this.resetClock) { - this.clock.restore(); - this.resetClock = false; - } - } - - return returnVal; - }; - - sinon.fakeServerWithClock.restore = function restore() { - if (this.clock) { - this.clock.restore(); - } - - return sinon.fakeServer.restore.apply(this, arguments); - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - require("./fake_server"); - require("./fake_timers"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); - } -}()); - -},{"./core":41,"./fake_server":43,"./fake_timers":45}],45:[function(require,module,exports){ -(function (global){ -/*global lolex */ - -/** - * Fake timer API - * setTimeout - * setInterval - * clearTimeout - * clearInterval - * tick - * reset - * Date - * - * Inspired by jsUnitMockTimeOut from JsUnit - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -if (typeof sinon == "undefined") { - var sinon = {}; -} - -(function (global) { - function makeApi(sinon, lol) { - var llx = typeof lolex !== "undefined" ? lolex : lol; - - sinon.useFakeTimers = function () { - var now, methods = Array.prototype.slice.call(arguments); - - if (typeof methods[0] === "string") { - now = 0; - } else { - now = methods.shift(); - } - - var clock = llx.install(now || 0, methods); - clock.restore = clock.uninstall; - return clock; - }; - - sinon.clock = { - create: function (now) { - return llx.createClock(now); - } - }; - - sinon.timers = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), - clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined), - setInterval: setInterval, - clearInterval: clearInterval, - Date: Date - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, epxorts, module, lolex) { - var sinon = require("./core"); - makeApi(sinon, lolex); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module, require("lolex")); - } else { - makeApi(sinon); - } -}(typeof global != "undefined" && typeof global !== "function" ? global : this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./core":41,"lolex":50}],46:[function(require,module,exports){ -/** - * @depend core.js - * @depend ../extend.js - * @depend event.js - * @depend ../log_error.js - */ -/** - * Fake XDomainRequest object - */ -"use strict"; - -if (typeof sinon == "undefined") { - this.sinon = {}; -} - -// wrapper for global -(function (global) { - var xdr = { XDomainRequest: global.XDomainRequest }; - xdr.GlobalXDomainRequest = global.XDomainRequest; - xdr.supportsXDR = typeof xdr.GlobalXDomainRequest != "undefined"; - xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false; - - function makeApi(sinon) { - sinon.xdr = xdr; - - function FakeXDomainRequest() { - this.readyState = FakeXDomainRequest.UNSENT; - this.requestBody = null; - this.requestHeaders = {}; - this.status = 0; - this.timeout = null; - - if (typeof FakeXDomainRequest.onCreate == "function") { - FakeXDomainRequest.onCreate(this); - } - } - - function verifyState(xdr) { - if (xdr.readyState !== FakeXDomainRequest.OPENED) { - throw new Error("INVALID_STATE_ERR"); - } - - if (xdr.sendFlag) { - throw new Error("INVALID_STATE_ERR"); - } - } - - function verifyRequestSent(xdr) { - if (xdr.readyState == FakeXDomainRequest.UNSENT) { - throw new Error("Request not sent"); - } - if (xdr.readyState == FakeXDomainRequest.DONE) { - throw new Error("Request done"); - } - } - - function verifyResponseBodyType(body) { - if (typeof body != "string") { - var error = new Error("Attempted to respond to fake XDomainRequest with " + - body + ", which is not a string."); - error.name = "InvalidBodyException"; - throw error; - } - } - - sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, { - open: function open(method, url) { - this.method = method; - this.url = url; - - this.responseText = null; - this.sendFlag = false; - - this.readyStateChange(FakeXDomainRequest.OPENED); - }, - - readyStateChange: function readyStateChange(state) { - this.readyState = state; - var eventName = ""; - switch (this.readyState) { - case FakeXDomainRequest.UNSENT: - break; - case FakeXDomainRequest.OPENED: - break; - case FakeXDomainRequest.LOADING: - if (this.sendFlag) { - //raise the progress event - eventName = "onprogress"; - } - break; - case FakeXDomainRequest.DONE: - if (this.isTimeout) { - eventName = "ontimeout" - } else if (this.errorFlag || (this.status < 200 || this.status > 299)) { - eventName = "onerror"; - } else { - eventName = "onload" - } - break; - } - - // raising event (if defined) - if (eventName) { - if (typeof this[eventName] == "function") { - try { - this[eventName](); - } catch (e) { - sinon.logError("Fake XHR " + eventName + " handler", e); - } - } - } - }, - - send: function send(data) { - verifyState(this); - - if (!/^(get|head)$/i.test(this.method)) { - this.requestBody = data; - } - this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; - - this.errorFlag = false; - this.sendFlag = true; - this.readyStateChange(FakeXDomainRequest.OPENED); - - if (typeof this.onSend == "function") { - this.onSend(this); - } - }, - - abort: function abort() { - this.aborted = true; - this.responseText = null; - this.errorFlag = true; - - if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) { - this.readyStateChange(sinon.FakeXDomainRequest.DONE); - this.sendFlag = false; - } - }, - - setResponseBody: function setResponseBody(body) { - verifyRequestSent(this); - verifyResponseBodyType(body); - - var chunkSize = this.chunkSize || 10; - var index = 0; - this.responseText = ""; - - do { - this.readyStateChange(FakeXDomainRequest.LOADING); - this.responseText += body.substring(index, index + chunkSize); - index += chunkSize; - } while (index < body.length); - - this.readyStateChange(FakeXDomainRequest.DONE); - }, - - respond: function respond(status, contentType, body) { - // content-type ignored, since XDomainRequest does not carry this - // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease - // test integration across browsers - this.status = typeof status == "number" ? status : 200; - this.setResponseBody(body || ""); - }, - - simulatetimeout: function simulatetimeout() { - this.status = 0; - this.isTimeout = true; - // Access to this should actually throw an error - this.responseText = undefined; - this.readyStateChange(FakeXDomainRequest.DONE); - } - }); - - sinon.extend(FakeXDomainRequest, { - UNSENT: 0, - OPENED: 1, - LOADING: 3, - DONE: 4 - }); - - sinon.useFakeXDomainRequest = function useFakeXDomainRequest() { - sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) { - if (xdr.supportsXDR) { - global.XDomainRequest = xdr.GlobalXDomainRequest; - } - - delete sinon.FakeXDomainRequest.restore; - - if (keepOnCreate !== true) { - delete sinon.FakeXDomainRequest.onCreate; - } - }; - if (xdr.supportsXDR) { - global.XDomainRequest = sinon.FakeXDomainRequest; - } - return sinon.FakeXDomainRequest; - }; - - sinon.FakeXDomainRequest = FakeXDomainRequest; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("../extend"); - require("./event"); - require("../log_error"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else { - makeApi(sinon); - } -})(this); - -},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],47:[function(require,module,exports){ -(function (global){ -/** - * @depend core.js - * @depend ../extend.js - * @depend event.js - * @depend ../log_error.js - */ -/** - * Fake XMLHttpRequest object - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (global) { - - var supportsProgress = typeof ProgressEvent !== "undefined"; - var supportsCustomEvent = typeof CustomEvent !== "undefined"; - var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest }; - sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest; - sinonXhr.GlobalActiveXObject = global.ActiveXObject; - sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject != "undefined"; - sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest != "undefined"; - sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX - ? function () { return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") } : false; - sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest()); - - /*jsl:ignore*/ - var unsafeHeaders = { - "Accept-Charset": true, - "Accept-Encoding": true, - Connection: true, - "Content-Length": true, - Cookie: true, - Cookie2: true, - "Content-Transfer-Encoding": true, - Date: true, - Expect: true, - Host: true, - "Keep-Alive": true, - Referer: true, - TE: true, - Trailer: true, - "Transfer-Encoding": true, - Upgrade: true, - "User-Agent": true, - Via: true - }; - /*jsl:end*/ - - function FakeXMLHttpRequest() { - this.readyState = FakeXMLHttpRequest.UNSENT; - this.requestHeaders = {}; - this.requestBody = null; - this.status = 0; - this.statusText = ""; - this.upload = new UploadProgress(); - if (sinonXhr.supportsCORS) { - this.withCredentials = false; - } - - var xhr = this; - var events = ["loadstart", "load", "abort", "loadend"]; - - function addEventListener(eventName) { - xhr.addEventListener(eventName, function (event) { - var listener = xhr["on" + eventName]; - - if (listener && typeof listener == "function") { - listener.call(this, event); - } - }); - } - - for (var i = events.length - 1; i >= 0; i--) { - addEventListener(events[i]); - } - - if (typeof FakeXMLHttpRequest.onCreate == "function") { - FakeXMLHttpRequest.onCreate(this); - } - } - - // An upload object is created for each - // FakeXMLHttpRequest and allows upload - // events to be simulated using uploadProgress - // and uploadError. - function UploadProgress() { - this.eventListeners = { - progress: [], - load: [], - abort: [], - error: [] - } - } - - UploadProgress.prototype.addEventListener = function addEventListener(event, listener) { - this.eventListeners[event].push(listener); - }; - - UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) { - var listeners = this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] == listener) { - return listeners.splice(i, 1); - } - } - }; - - UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) { - var listeners = this.eventListeners[event.type] || []; - - for (var i = 0, listener; (listener = listeners[i]) != null; i++) { - listener(event); - } - }; - - function verifyState(xhr) { - if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR"); - } - - if (xhr.sendFlag) { - throw new Error("INVALID_STATE_ERR"); - } - } - - function getHeader(headers, header) { - header = header.toLowerCase(); - - for (var h in headers) { - if (h.toLowerCase() == header) { - return h; - } - } - - return null; - } - - // filtering to enable a white-list version of Sinon FakeXhr, - // where whitelisted requests are passed through to real XHR - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - function some(collection, callback) { - for (var index = 0; index < collection.length; index++) { - if (callback(collection[index]) === true) { - return true; - } - } - return false; - } - // largest arity in XHR is 5 - XHR#open - var apply = function (obj, method, args) { - switch (args.length) { - case 0: return obj[method](); - case 1: return obj[method](args[0]); - case 2: return obj[method](args[0], args[1]); - case 3: return obj[method](args[0], args[1], args[2]); - case 4: return obj[method](args[0], args[1], args[2], args[3]); - case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]); - } - }; - - FakeXMLHttpRequest.filters = []; - FakeXMLHttpRequest.addFilter = function addFilter(fn) { - this.filters.push(fn) - }; - var IE6Re = /MSIE 6/; - FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) { - var xhr = new sinonXhr.workingXHR(); - each([ - "open", - "setRequestHeader", - "send", - "abort", - "getResponseHeader", - "getAllResponseHeaders", - "addEventListener", - "overrideMimeType", - "removeEventListener" - ], function (method) { - fakeXhr[method] = function () { - return apply(xhr, method, arguments); - }; - }); - - var copyAttrs = function (args) { - each(args, function (attr) { - try { - fakeXhr[attr] = xhr[attr] - } catch (e) { - if (!IE6Re.test(navigator.userAgent)) { - throw e; - } - } - }); - }; - - var stateChange = function stateChange() { - fakeXhr.readyState = xhr.readyState; - if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) { - copyAttrs(["status", "statusText"]); - } - if (xhr.readyState >= FakeXMLHttpRequest.LOADING) { - copyAttrs(["responseText", "response"]); - } - if (xhr.readyState === FakeXMLHttpRequest.DONE) { - copyAttrs(["responseXML"]); - } - if (fakeXhr.onreadystatechange) { - fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr }); - } - }; - - if (xhr.addEventListener) { - for (var event in fakeXhr.eventListeners) { - if (fakeXhr.eventListeners.hasOwnProperty(event)) { - each(fakeXhr.eventListeners[event], function (handler) { - xhr.addEventListener(event, handler); - }); - } - } - xhr.addEventListener("readystatechange", stateChange); - } else { - xhr.onreadystatechange = stateChange; - } - apply(xhr, "open", xhrArgs); - }; - FakeXMLHttpRequest.useFilters = false; - - function verifyRequestOpened(xhr) { - if (xhr.readyState != FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR - " + xhr.readyState); - } - } - - function verifyRequestSent(xhr) { - if (xhr.readyState == FakeXMLHttpRequest.DONE) { - throw new Error("Request done"); - } - } - - function verifyHeadersReceived(xhr) { - if (xhr.async && xhr.readyState != FakeXMLHttpRequest.HEADERS_RECEIVED) { - throw new Error("No headers received"); - } - } - - function verifyResponseBodyType(body) { - if (typeof body != "string") { - var error = new Error("Attempted to respond to fake XMLHttpRequest with " + - body + ", which is not a string."); - error.name = "InvalidBodyException"; - throw error; - } - } - - FakeXMLHttpRequest.parseXML = function parseXML(text) { - var xmlDoc; - - if (typeof DOMParser != "undefined") { - var parser = new DOMParser(); - xmlDoc = parser.parseFromString(text, "text/xml"); - } else { - xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); - xmlDoc.async = "false"; - xmlDoc.loadXML(text); - } - - return xmlDoc; - }; - - FakeXMLHttpRequest.statusCodes = { - 100: "Continue", - 101: "Switching Protocols", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-Authoritative Information", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 207: "Multi-Status", - 300: "Multiple Choice", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 307: "Temporary Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Request Entity Too Large", - 414: "Request-URI Too Long", - 415: "Unsupported Media Type", - 416: "Requested Range Not Satisfiable", - 417: "Expectation Failed", - 422: "Unprocessable Entity", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported" - }; - - function makeApi(sinon) { - sinon.xhr = sinonXhr; - - sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, { - async: true, - - open: function open(method, url, async, username, password) { - this.method = method; - this.url = url; - this.async = typeof async == "boolean" ? async : true; - this.username = username; - this.password = password; - this.responseText = null; - this.responseXML = null; - this.requestHeaders = {}; - this.sendFlag = false; - - if (FakeXMLHttpRequest.useFilters === true) { - var xhrArgs = arguments; - var defake = some(FakeXMLHttpRequest.filters, function (filter) { - return filter.apply(this, xhrArgs) - }); - if (defake) { - return FakeXMLHttpRequest.defake(this, arguments); - } - } - this.readyStateChange(FakeXMLHttpRequest.OPENED); - }, - - readyStateChange: function readyStateChange(state) { - this.readyState = state; - - if (typeof this.onreadystatechange == "function") { - try { - this.onreadystatechange(); - } catch (e) { - sinon.logError("Fake XHR onreadystatechange handler", e); - } - } - - this.dispatchEvent(new sinon.Event("readystatechange")); - - switch (this.readyState) { - case FakeXMLHttpRequest.DONE: - this.dispatchEvent(new sinon.Event("load", false, false, this)); - this.dispatchEvent(new sinon.Event("loadend", false, false, this)); - this.upload.dispatchEvent(new sinon.Event("load", false, false, this)); - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - } - break; - } - }, - - setRequestHeader: function setRequestHeader(header, value) { - verifyState(this); - - if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) { - throw new Error("Refused to set unsafe header \"" + header + "\""); - } - - if (this.requestHeaders[header]) { - this.requestHeaders[header] += "," + value; - } else { - this.requestHeaders[header] = value; - } - }, - - // Helps testing - setResponseHeaders: function setResponseHeaders(headers) { - verifyRequestOpened(this); - this.responseHeaders = {}; - - for (var header in headers) { - if (headers.hasOwnProperty(header)) { - this.responseHeaders[header] = headers[header]; - } - } - - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED); - } else { - this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED; - } - }, - - // Currently treats ALL data as a DOMString (i.e. no Document) - send: function send(data) { - verifyState(this); - - if (!/^(get|head)$/i.test(this.method)) { - var contentType = getHeader(this.requestHeaders, "Content-Type"); - if (this.requestHeaders[contentType]) { - var value = this.requestHeaders[contentType].split(";"); - this.requestHeaders[contentType] = value[0] + ";charset=utf-8"; - } else if (!(data instanceof FormData)) { - this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; - } - - this.requestBody = data; - } - - this.errorFlag = false; - this.sendFlag = this.async; - this.readyStateChange(FakeXMLHttpRequest.OPENED); - - if (typeof this.onSend == "function") { - this.onSend(this); - } - - this.dispatchEvent(new sinon.Event("loadstart", false, false, this)); - }, - - abort: function abort() { - this.aborted = true; - this.responseText = null; - this.errorFlag = true; - this.requestHeaders = {}; - - if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) { - this.readyStateChange(FakeXMLHttpRequest.DONE); - this.sendFlag = false; - } - - this.readyState = FakeXMLHttpRequest.UNSENT; - - this.dispatchEvent(new sinon.Event("abort", false, false, this)); - - this.upload.dispatchEvent(new sinon.Event("abort", false, false, this)); - - if (typeof this.onerror === "function") { - this.onerror(); - } - }, - - getResponseHeader: function getResponseHeader(header) { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return null; - } - - if (/^Set-Cookie2?$/i.test(header)) { - return null; - } - - header = getHeader(this.responseHeaders, header); - - return this.responseHeaders[header] || null; - }, - - getAllResponseHeaders: function getAllResponseHeaders() { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return ""; - } - - var headers = ""; - - for (var header in this.responseHeaders) { - if (this.responseHeaders.hasOwnProperty(header) && - !/^Set-Cookie2?$/i.test(header)) { - headers += header + ": " + this.responseHeaders[header] + "\r\n"; - } - } - - return headers; - }, - - setResponseBody: function setResponseBody(body) { - verifyRequestSent(this); - verifyHeadersReceived(this); - verifyResponseBodyType(body); - - var chunkSize = this.chunkSize || 10; - var index = 0; - this.responseText = ""; - - do { - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.LOADING); - } - - this.responseText += body.substring(index, index + chunkSize); - index += chunkSize; - } while (index < body.length); - - var type = this.getResponseHeader("Content-Type"); - - if (this.responseText && - (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) { - try { - this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText); - } catch (e) { - // Unable to parse XML - no biggie - } - } - - this.readyStateChange(FakeXMLHttpRequest.DONE); - }, - - respond: function respond(status, headers, body) { - this.status = typeof status == "number" ? status : 200; - this.statusText = FakeXMLHttpRequest.statusCodes[this.status]; - this.setResponseHeaders(headers || {}); - this.setResponseBody(body || ""); - }, - - uploadProgress: function uploadProgress(progressEventRaw) { - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - downloadProgress: function downloadProgress(progressEventRaw) { - if (supportsProgress) { - this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - uploadError: function uploadError(error) { - if (supportsCustomEvent) { - this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error})); - } - } - }); - - sinon.extend(FakeXMLHttpRequest, { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 - }); - - sinon.useFakeXMLHttpRequest = function () { - FakeXMLHttpRequest.restore = function restore(keepOnCreate) { - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = sinonXhr.GlobalActiveXObject; - } - - delete FakeXMLHttpRequest.restore; - - if (keepOnCreate !== true) { - delete FakeXMLHttpRequest.onCreate; - } - }; - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = FakeXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = function ActiveXObject(objId) { - if (objId == "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) { - - return new FakeXMLHttpRequest(); - } - - return new sinonXhr.GlobalActiveXObject(objId); - }; - } - - return FakeXMLHttpRequest; - }; - - sinon.FakeXMLHttpRequest = FakeXMLHttpRequest; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("../extend"); - require("./event"); - require("../log_error"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (typeof sinon === "undefined") { - return; - } else { - makeApi(sinon); - } - -})(typeof global !== "undefined" ? global : this); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],48:[function(require,module,exports){ -(function (global){ -((typeof define === "function" && define.amd && function (m) { - define("formatio", ["samsam"], m); -}) || (typeof module === "object" && function (m) { - module.exports = m(require("samsam")); -}) || function (m) { this.formatio = m(this.samsam); } -)(function (samsam) { - "use strict"; - - var formatio = { - excludeConstructors: ["Object", /^.$/], - quoteStrings: true, - limitChildrenCount: 0 - }; - - var hasOwn = Object.prototype.hasOwnProperty; - - var specialObjects = []; - if (typeof global !== "undefined") { - specialObjects.push({ object: global, value: "[object global]" }); - } - if (typeof document !== "undefined") { - specialObjects.push({ - object: document, - value: "[object HTMLDocument]" - }); - } - if (typeof window !== "undefined") { - specialObjects.push({ object: window, value: "[object Window]" }); - } - - function functionName(func) { - if (!func) { return ""; } - if (func.displayName) { return func.displayName; } - if (func.name) { return func.name; } - var matches = func.toString().match(/function\s+([^\(]+)/m); - return (matches && matches[1]) || ""; - } - - function constructorName(f, object) { - var name = functionName(object && object.constructor); - var excludes = f.excludeConstructors || - formatio.excludeConstructors || []; - - var i, l; - for (i = 0, l = excludes.length; i < l; ++i) { - if (typeof excludes[i] === "string" && excludes[i] === name) { - return ""; - } else if (excludes[i].test && excludes[i].test(name)) { - return ""; - } - } - - return name; - } - - function isCircular(object, objects) { - if (typeof object !== "object") { return false; } - var i, l; - for (i = 0, l = objects.length; i < l; ++i) { - if (objects[i] === object) { return true; } - } - return false; - } - - function ascii(f, object, processed, indent) { - if (typeof object === "string") { - var qs = f.quoteStrings; - var quote = typeof qs !== "boolean" || qs; - return processed || quote ? '"' + object + '"' : object; - } - - if (typeof object === "function" && !(object instanceof RegExp)) { - return ascii.func(object); - } - - processed = processed || []; - - if (isCircular(object, processed)) { return "[Circular]"; } - - if (Object.prototype.toString.call(object) === "[object Array]") { - return ascii.array.call(f, object, processed); - } - - if (!object) { return String((1/object) === -Infinity ? "-0" : object); } - if (samsam.isElement(object)) { return ascii.element(object); } - - if (typeof object.toString === "function" && - object.toString !== Object.prototype.toString) { - return object.toString(); - } - - var i, l; - for (i = 0, l = specialObjects.length; i < l; i++) { - if (object === specialObjects[i].object) { - return specialObjects[i].value; - } - } - - return ascii.object.call(f, object, processed, indent); - } - - ascii.func = function (func) { - return "function " + functionName(func) + "() {}"; - }; - - ascii.array = function (array, processed) { - processed = processed || []; - processed.push(array); - var pieces = []; - var i, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, array.length) : array.length; - - for (i = 0; i < l; ++i) { - pieces.push(ascii(this, array[i], processed)); - } - - if(l < array.length) - pieces.push("[... " + (array.length - l) + " more elements]"); - - return "[" + pieces.join(", ") + "]"; - }; - - ascii.object = function (object, processed, indent) { - processed = processed || []; - processed.push(object); - indent = indent || 0; - var pieces = [], properties = samsam.keys(object).sort(); - var length = 3; - var prop, str, obj, i, k, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, properties.length) : properties.length; - - for (i = 0; i < l; ++i) { - prop = properties[i]; - obj = object[prop]; - - if (isCircular(obj, processed)) { - str = "[Circular]"; - } else { - str = ascii(this, obj, processed, indent + 2); - } - - str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str; - length += str.length; - pieces.push(str); - } - - var cons = constructorName(this, object); - var prefix = cons ? "[" + cons + "] " : ""; - var is = ""; - for (i = 0, k = indent; i < k; ++i) { is += " "; } - - if(l < properties.length) - pieces.push("[... " + (properties.length - l) + " more elements]"); - - if (length + indent > 80) { - return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" + - is + "}"; - } - return prefix + "{ " + pieces.join(", ") + " }"; - }; - - ascii.element = function (element) { - var tagName = element.tagName.toLowerCase(); - var attrs = element.attributes, attr, pairs = [], attrName, i, l, val; - - for (i = 0, l = attrs.length; i < l; ++i) { - attr = attrs.item(i); - attrName = attr.nodeName.toLowerCase().replace("html:", ""); - val = attr.nodeValue; - if (attrName !== "contenteditable" || val !== "inherit") { - if (!!val) { pairs.push(attrName + "=\"" + val + "\""); } - } - } - - var formatted = "<" + tagName + (pairs.length > 0 ? " " : ""); - var content = element.innerHTML; - - if (content.length > 20) { - content = content.substr(0, 20) + "[...]"; - } - - var res = formatted + pairs.join(" ") + ">" + content + - ""; - - return res.replace(/ contentEditable="inherit"/, ""); - }; - - function Formatio(options) { - for (var opt in options) { - this[opt] = options[opt]; - } - } - - Formatio.prototype = { - functionName: functionName, - - configure: function (options) { - return new Formatio(options); - }, - - constructorName: function (object) { - return constructorName(this, object); - }, - - ascii: function (object, processed, indent) { - return ascii(this, object, processed, indent); - } - }; - - return Formatio.prototype; -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"samsam":49}],49:[function(require,module,exports){ -((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) || - (typeof module === "object" && - function (m) { module.exports = m(); }) || // Node - function (m) { this.samsam = m(); } // Browser globals -)(function () { - var o = Object.prototype; - var div = typeof document !== "undefined" && document.createElement("div"); - - function isNaN(value) { - // Unlike global isNaN, this avoids type coercion - // typeof check avoids IE host object issues, hat tip to - // lodash - var val = value; // JsLint thinks value !== value is "weird" - return typeof value === "number" && value !== val; - } - - function getClass(value) { - // Returns the internal [[Class]] by calling Object.prototype.toString - // with the provided value as this. Return value is a string, naming the - // internal class, e.g. "Array" - return o.toString.call(value).split(/[ \]]/)[1]; - } - - /** - * @name samsam.isArguments - * @param Object object - * - * Returns ``true`` if ``object`` is an ``arguments`` object, - * ``false`` otherwise. - */ - function isArguments(object) { - if (getClass(object) === 'Arguments') { return true; } - if (typeof object !== "object" || typeof object.length !== "number" || - getClass(object) === "Array") { - return false; - } - if (typeof object.callee == "function") { return true; } - try { - object[object.length] = 6; - delete object[object.length]; - } catch (e) { - return true; - } - return false; - } - - /** - * @name samsam.isElement - * @param Object object - * - * Returns ``true`` if ``object`` is a DOM element node. Unlike - * Underscore.js/lodash, this function will return ``false`` if ``object`` - * is an *element-like* object, i.e. a regular object with a ``nodeType`` - * property that holds the value ``1``. - */ - function isElement(object) { - if (!object || object.nodeType !== 1 || !div) { return false; } - try { - object.appendChild(div); - object.removeChild(div); - } catch (e) { - return false; - } - return true; - } - - /** - * @name samsam.keys - * @param Object object - * - * Return an array of own property names. - */ - function keys(object) { - var ks = [], prop; - for (prop in object) { - if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); } - } - return ks; - } - - /** - * @name samsam.isDate - * @param Object value - * - * Returns true if the object is a ``Date``, or *date-like*. Duck typing - * of date objects work by checking that the object has a ``getTime`` - * function whose return value equals the return value from the object's - * ``valueOf``. - */ - function isDate(value) { - return typeof value.getTime == "function" && - value.getTime() == value.valueOf(); - } - - /** - * @name samsam.isNegZero - * @param Object value - * - * Returns ``true`` if ``value`` is ``-0``. - */ - function isNegZero(value) { - return value === 0 && 1 / value === -Infinity; - } - - /** - * @name samsam.equal - * @param Object obj1 - * @param Object obj2 - * - * Returns ``true`` if two objects are strictly equal. Compared to - * ``===`` there are two exceptions: - * - * - NaN is considered equal to NaN - * - -0 and +0 are not considered equal - */ - function identical(obj1, obj2) { - if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) { - return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2); - } - } - - - /** - * @name samsam.deepEqual - * @param Object obj1 - * @param Object obj2 - * - * Deep equal comparison. Two values are "deep equal" if: - * - * - They are equal, according to samsam.identical - * - They are both date objects representing the same time - * - They are both arrays containing elements that are all deepEqual - * - They are objects with the same set of properties, and each property - * in ``obj1`` is deepEqual to the corresponding property in ``obj2`` - * - * Supports cyclic objects. - */ - function deepEqualCyclic(obj1, obj2) { - - // used for cyclic comparison - // contain already visited objects - var objects1 = [], - objects2 = [], - // contain pathes (position in the object structure) - // of the already visited objects - // indexes same as in objects arrays - paths1 = [], - paths2 = [], - // contains combinations of already compared objects - // in the manner: { "$1['ref']$2['ref']": true } - compared = {}; - - /** - * used to check, if the value of a property is an object - * (cyclic logic is only needed for objects) - * only needed for cyclic logic - */ - function isObject(value) { - - if (typeof value === 'object' && value !== null && - !(value instanceof Boolean) && - !(value instanceof Date) && - !(value instanceof Number) && - !(value instanceof RegExp) && - !(value instanceof String)) { - - return true; - } - - return false; - } - - /** - * returns the index of the given object in the - * given objects array, -1 if not contained - * only needed for cyclic logic - */ - function getIndex(objects, obj) { - - var i; - for (i = 0; i < objects.length; i++) { - if (objects[i] === obj) { - return i; - } - } - - return -1; - } - - // does the recursion for the deep equal check - return (function deepEqual(obj1, obj2, path1, path2) { - var type1 = typeof obj1; - var type2 = typeof obj2; - - // == null also matches undefined - if (obj1 === obj2 || - isNaN(obj1) || isNaN(obj2) || - obj1 == null || obj2 == null || - type1 !== "object" || type2 !== "object") { - - return identical(obj1, obj2); - } - - // Elements are only equal if identical(expected, actual) - if (isElement(obj1) || isElement(obj2)) { return false; } - - var isDate1 = isDate(obj1), isDate2 = isDate(obj2); - if (isDate1 || isDate2) { - if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) { - return false; - } - } - - if (obj1 instanceof RegExp && obj2 instanceof RegExp) { - if (obj1.toString() !== obj2.toString()) { return false; } - } - - var class1 = getClass(obj1); - var class2 = getClass(obj2); - var keys1 = keys(obj1); - var keys2 = keys(obj2); - - if (isArguments(obj1) || isArguments(obj2)) { - if (obj1.length !== obj2.length) { return false; } - } else { - if (type1 !== type2 || class1 !== class2 || - keys1.length !== keys2.length) { - return false; - } - } - - var key, i, l, - // following vars are used for the cyclic logic - value1, value2, - isObject1, isObject2, - index1, index2, - newPath1, newPath2; - - for (i = 0, l = keys1.length; i < l; i++) { - key = keys1[i]; - if (!o.hasOwnProperty.call(obj2, key)) { - return false; - } - - // Start of the cyclic logic - - value1 = obj1[key]; - value2 = obj2[key]; - - isObject1 = isObject(value1); - isObject2 = isObject(value2); - - // determine, if the objects were already visited - // (it's faster to check for isObject first, than to - // get -1 from getIndex for non objects) - index1 = isObject1 ? getIndex(objects1, value1) : -1; - index2 = isObject2 ? getIndex(objects2, value2) : -1; - - // determine the new pathes of the objects - // - for non cyclic objects the current path will be extended - // by current property name - // - for cyclic objects the stored path is taken - newPath1 = index1 !== -1 - ? paths1[index1] - : path1 + '[' + JSON.stringify(key) + ']'; - newPath2 = index2 !== -1 - ? paths2[index2] - : path2 + '[' + JSON.stringify(key) + ']'; - - // stop recursion if current objects are already compared - if (compared[newPath1 + newPath2]) { - return true; - } - - // remember the current objects and their pathes - if (index1 === -1 && isObject1) { - objects1.push(value1); - paths1.push(newPath1); - } - if (index2 === -1 && isObject2) { - objects2.push(value2); - paths2.push(newPath2); - } - - // remember that the current objects are already compared - if (isObject1 && isObject2) { - compared[newPath1 + newPath2] = true; - } - - // End of cyclic logic - - // neither value1 nor value2 is a cycle - // continue with next level - if (!deepEqual(value1, value2, newPath1, newPath2)) { - return false; - } - } - - return true; - - }(obj1, obj2, '$1', '$2')); - } - - var match; - - function arrayContains(array, subset) { - if (subset.length === 0) { return true; } - var i, l, j, k; - for (i = 0, l = array.length; i < l; ++i) { - if (match(array[i], subset[0])) { - for (j = 0, k = subset.length; j < k; ++j) { - if (!match(array[i + j], subset[j])) { return false; } - } - return true; - } - } - return false; - } - - /** - * @name samsam.match - * @param Object object - * @param Object matcher - * - * Compare arbitrary value ``object`` with matcher. - */ - match = function match(object, matcher) { - if (matcher && typeof matcher.test === "function") { - return matcher.test(object); - } - - if (typeof matcher === "function") { - return matcher(object) === true; - } - - if (typeof matcher === "string") { - matcher = matcher.toLowerCase(); - var notNull = typeof object === "string" || !!object; - return notNull && - (String(object)).toLowerCase().indexOf(matcher) >= 0; - } - - if (typeof matcher === "number") { - return matcher === object; - } - - if (typeof matcher === "boolean") { - return matcher === object; - } - - if (typeof(matcher) === "undefined") { - return typeof(object) === "undefined"; - } - - if (matcher === null) { - return object === null; - } - - if (getClass(object) === "Array" && getClass(matcher) === "Array") { - return arrayContains(object, matcher); - } - - if (matcher && typeof matcher === "object") { - if (matcher === object) { - return true; - } - var prop; - for (prop in matcher) { - var value = object[prop]; - if (typeof value === "undefined" && - typeof object.getAttribute === "function") { - value = object.getAttribute(prop); - } - if (matcher[prop] === null || typeof matcher[prop] === 'undefined') { - if (value !== matcher[prop]) { - return false; - } - } else if (typeof value === "undefined" || !match(value, matcher[prop])) { - return false; - } - } - return true; - } - - throw new Error("Matcher was not a string, a number, a " + - "function, a boolean or an object"); - }; - - return { - isArguments: isArguments, - isElement: isElement, - isDate: isDate, - isNegZero: isNegZero, - identical: identical, - deepEqual: deepEqualCyclic, - match: match, - keys: keys - }; -}); - -},{}],50:[function(require,module,exports){ -(function (global){ -/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/ -/*global global*/ -/** - * @author Christian Johansen (christian@cjohansen.no) and contributors - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -// node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref() -// browsers, a number. -// see https://github.com/cjohansen/Sinon.JS/pull/436 -var timeoutResult = setTimeout(function() {}, 0); -var addTimerReturnsObject = typeof timeoutResult === "object"; -clearTimeout(timeoutResult); - -var NativeDate = Date; -var id = 1; - -/** - * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into - * number of milliseconds. This is used to support human-readable strings passed - * to clock.tick() - */ -function parseTime(str) { - if (!str) { - return 0; - } - - var strings = str.split(":"); - var l = strings.length, i = l; - var ms = 0, parsed; - - if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) { - throw new Error("tick only understands numbers and 'h:m:s'"); - } - - while (i--) { - parsed = parseInt(strings[i], 10); - - if (parsed >= 60) { - throw new Error("Invalid time " + str); - } - - ms += parsed * Math.pow(60, (l - i - 1)); - } - - return ms * 1000; -} - -/** - * Used to grok the `now` parameter to createClock. - */ -function getEpoch(epoch) { - if (!epoch) { return 0; } - if (typeof epoch.getTime === "function") { return epoch.getTime(); } - if (typeof epoch === "number") { return epoch; } - throw new TypeError("now should be milliseconds since UNIX epoch"); -} - -function inRange(from, to, timer) { - return timer && timer.callAt >= from && timer.callAt <= to; -} - -function mirrorDateProperties(target, source) { - if (source.now) { - target.now = function now() { - return target.clock.now; - }; - } else { - delete target.now; - } - - if (source.toSource) { - target.toSource = function toSource() { - return source.toSource(); - }; - } else { - delete target.toSource; - } - - target.toString = function toString() { - return source.toString(); - }; - - target.prototype = source.prototype; - target.parse = source.parse; - target.UTC = source.UTC; - target.prototype.toUTCString = source.prototype.toUTCString; - - for (var prop in source) { - if (source.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - - return target; -} - -function createDate() { - function ClockDate(year, month, date, hour, minute, second, ms) { - // Defensive and verbose to avoid potential harm in passing - // explicit undefined when user does not pass argument - switch (arguments.length) { - case 0: - return new NativeDate(ClockDate.clock.now); - case 1: - return new NativeDate(year); - case 2: - return new NativeDate(year, month); - case 3: - return new NativeDate(year, month, date); - case 4: - return new NativeDate(year, month, date, hour); - case 5: - return new NativeDate(year, month, date, hour, minute); - case 6: - return new NativeDate(year, month, date, hour, minute, second); - default: - return new NativeDate(year, month, date, hour, minute, second, ms); - } - } - - return mirrorDateProperties(ClockDate, NativeDate); -} - -function addTimer(clock, timer) { - if (typeof timer.func === "undefined") { - throw new Error("Callback must be provided to timer calls"); - } - - if (!clock.timers) { - clock.timers = {}; - } - - timer.id = id++; - timer.createdAt = clock.now; - timer.callAt = clock.now + (timer.delay || 0); - - clock.timers[timer.id] = timer; - - if (addTimerReturnsObject) { - return { - id: timer.id, - ref: function() {}, - unref: function() {} - }; - } - else { - return timer.id; - } -} - -function firstTimerInRange(clock, from, to) { - var timers = clock.timers, timer = null; - - for (var id in timers) { - if (!inRange(from, to, timers[id])) { - continue; - } - - if (!timer || ~compareTimers(timer, timers[id])) { - timer = timers[id]; - } - } - - return timer; -} - -function compareTimers(a, b) { - // Sort first by absolute timing - if (a.callAt < b.callAt) { - return -1; - } - if (a.callAt > b.callAt) { - return 1; - } - - // Sort next by immediate, immediate timers take precedence - if (a.immediate && !b.immediate) { - return -1; - } - if (!a.immediate && b.immediate) { - return 1; - } - - // Sort next by creation time, earlier-created timers take precedence - if (a.createdAt < b.createdAt) { - return -1; - } - if (a.createdAt > b.createdAt) { - return 1; - } - - // Sort next by id, lower-id timers take precedence - if (a.id < b.id) { - return -1; - } - if (a.id > b.id) { - return 1; - } - - // As timer ids are unique, no fallback `0` is necessary -} - -function callTimer(clock, timer) { - if (typeof timer.interval == "number") { - clock.timers[timer.id].callAt += timer.interval; - } else { - delete clock.timers[timer.id]; - } - - try { - if (typeof timer.func == "function") { - timer.func.apply(null, timer.args); - } else { - eval(timer.func); - } - } catch (e) { - var exception = e; - } - - if (!clock.timers[timer.id]) { - if (exception) { - throw exception; - } - return; - } - - if (exception) { - throw exception; - } -} - -function uninstall(clock, target) { - var method; - - for (var i = 0, l = clock.methods.length; i < l; i++) { - method = clock.methods[i]; - - if (target[method].hadOwnProperty) { - target[method] = clock["_" + method]; - } else { - try { - delete target[method]; - } catch (e) {} - } - } - - // Prevent multiple executions which will completely remove these props - clock.methods = []; -} - -function hijackMethod(target, method, clock) { - clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method); - clock["_" + method] = target[method]; - - if (method == "Date") { - var date = mirrorDateProperties(clock[method], target[method]); - target[method] = date; - } else { - target[method] = function () { - return clock[method].apply(clock, arguments); - }; - - for (var prop in clock[method]) { - if (clock[method].hasOwnProperty(prop)) { - target[method][prop] = clock[method][prop]; - } - } - } - - target[method].clock = clock; -} - -var timers = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), - clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined), - setInterval: setInterval, - clearInterval: clearInterval, - Date: Date -}; - -var keys = Object.keys || function (obj) { - var ks = []; - for (var key in obj) { - ks.push(key); - } - return ks; -}; - -exports.timers = timers; - -var createClock = exports.createClock = function (now) { - var clock = { - now: getEpoch(now), - timeouts: {}, - Date: createDate() - }; - - clock.Date.clock = clock; - - clock.setTimeout = function setTimeout(func, timeout) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout - }); - }; - - clock.clearTimeout = function clearTimeout(timerId) { - if (!timerId) { - // null appears to be allowed in most browsers, and appears to be - // relied upon by some libraries, like Bootstrap carousel - return; - } - if (!clock.timers) { - clock.timers = []; - } - // in Node, timerId is an object with .ref()/.unref(), and - // its .id field is the actual timer id. - if (typeof timerId === "object") { - timerId = timerId.id - } - if (timerId in clock.timers) { - delete clock.timers[timerId]; - } - }; - - clock.setInterval = function setInterval(func, timeout) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout, - interval: timeout - }); - }; - - clock.clearInterval = function clearInterval(timerId) { - clock.clearTimeout(timerId); - }; - - clock.setImmediate = function setImmediate(func) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 1), - immediate: true - }); - }; - - clock.clearImmediate = function clearImmediate(timerId) { - clock.clearTimeout(timerId); - }; - - clock.tick = function tick(ms) { - ms = typeof ms == "number" ? ms : parseTime(ms); - var tickFrom = clock.now, tickTo = clock.now + ms, previous = clock.now; - var timer = firstTimerInRange(clock, tickFrom, tickTo); - - var firstException; - while (timer && tickFrom <= tickTo) { - if (clock.timers[timer.id]) { - tickFrom = clock.now = timer.callAt; - try { - callTimer(clock, timer); - } catch (e) { - firstException = firstException || e; - } - } - - timer = firstTimerInRange(clock, previous, tickTo); - previous = tickFrom; - } - - clock.now = tickTo; - - if (firstException) { - throw firstException; - } - - return clock.now; - }; - - clock.reset = function reset() { - clock.timers = {}; - }; - - return clock; -}; - -exports.install = function install(target, now, toFake) { - if (typeof target === "number") { - toFake = now; - now = target; - target = null; - } - - if (!target) { - target = global; - } - - var clock = createClock(now); - - clock.uninstall = function () { - uninstall(clock, target); - }; - - clock.methods = toFake || []; - - if (clock.methods.length === 0) { - clock.methods = keys(timers); - } - - for (var i = 0, l = clock.methods.length; i < l; i++) { - hijackMethod(target, clock.methods[i], clock); - } - - return clock; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],51:[function(require,module,exports){ -(function (process,global){ -(function() { - "use strict"; - function lib$es6$promise$utils$$objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); - } - - function lib$es6$promise$utils$$isFunction(x) { - return typeof x === 'function'; - } - - function lib$es6$promise$utils$$isMaybeThenable(x) { - return typeof x === 'object' && x !== null; - } - - var lib$es6$promise$utils$$_isArray; - if (!Array.isArray) { - lib$es6$promise$utils$$_isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; - } else { - lib$es6$promise$utils$$_isArray = Array.isArray; - } - - var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; - var lib$es6$promise$asap$$len = 0; - var lib$es6$promise$asap$$toString = {}.toString; - var lib$es6$promise$asap$$vertxNext; - function lib$es6$promise$asap$$asap(callback, arg) { - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; - lib$es6$promise$asap$$len += 2; - if (lib$es6$promise$asap$$len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - lib$es6$promise$asap$$scheduleFlush(); - } - } - - var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; - - var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; - var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; - var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; - var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - - // test for web worker but not in IE10 - var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - - // node - function lib$es6$promise$asap$$useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(lib$es6$promise$asap$$flush); - }; - } - - // vertx - function lib$es6$promise$asap$$useVertxTimer() { - return function() { - lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); - }; - } - - function lib$es6$promise$asap$$useMutationObserver() { - var iterations = 0; - var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; - } - - // web worker - function lib$es6$promise$asap$$useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = lib$es6$promise$asap$$flush; - return function () { - channel.port2.postMessage(0); - }; - } - - function lib$es6$promise$asap$$useSetTimeout() { - return function() { - setTimeout(lib$es6$promise$asap$$flush, 1); - }; - } - - var lib$es6$promise$asap$$queue = new Array(1000); - function lib$es6$promise$asap$$flush() { - for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { - var callback = lib$es6$promise$asap$$queue[i]; - var arg = lib$es6$promise$asap$$queue[i+1]; - - callback(arg); - - lib$es6$promise$asap$$queue[i] = undefined; - lib$es6$promise$asap$$queue[i+1] = undefined; - } - - lib$es6$promise$asap$$len = 0; - } - - function lib$es6$promise$asap$$attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; - return lib$es6$promise$asap$$useVertxTimer(); - } catch(e) { - return lib$es6$promise$asap$$useSetTimeout(); - } - } - - var lib$es6$promise$asap$$scheduleFlush; - // Decide what async method to use to triggering processing of queued callbacks: - if (lib$es6$promise$asap$$isNode) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); - } else if (lib$es6$promise$asap$$BrowserMutationObserver) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); - } else if (lib$es6$promise$asap$$isWorker) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); - } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); - } else { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); - } - - function lib$es6$promise$$internal$$noop() {} - - var lib$es6$promise$$internal$$PENDING = void 0; - var lib$es6$promise$$internal$$FULFILLED = 1; - var lib$es6$promise$$internal$$REJECTED = 2; - - var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); - } - - function lib$es6$promise$$internal$$cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); - } - - function lib$es6$promise$$internal$$getThen(promise) { - try { - return promise.then; - } catch(error) { - lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; - return lib$es6$promise$$internal$$GET_THEN_ERROR; - } - } - - function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } - } - - function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { - lib$es6$promise$asap$$default(function(promise) { - var sealed = false; - var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - lib$es6$promise$$internal$$resolve(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - lib$es6$promise$$internal$$reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - lib$es6$promise$$internal$$reject(promise, error); - } - }, promise); - } - - function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { - if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, thenable._result); - } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, thenable._result); - } else { - lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { - lib$es6$promise$$internal$$resolve(promise, value); - }, function(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } - } - - function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); - } else { - var then = lib$es6$promise$$internal$$getThen(maybeThenable); - - if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); - } else if (then === undefined) { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } else if (lib$es6$promise$utils$$isFunction(then)) { - lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); - } else { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } - } - } - - function lib$es6$promise$$internal$$resolve(promise, value) { - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); - } else if (lib$es6$promise$utils$$objectOrFunction(value)) { - lib$es6$promise$$internal$$handleMaybeThenable(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - } - - function lib$es6$promise$$internal$$publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - lib$es6$promise$$internal$$publish(promise); - } - - function lib$es6$promise$$internal$$fulfill(promise, value) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - - promise._result = value; - promise._state = lib$es6$promise$$internal$$FULFILLED; - - if (promise._subscribers.length !== 0) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); - } - } - - function lib$es6$promise$$internal$$reject(promise, reason) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - promise._state = lib$es6$promise$$internal$$REJECTED; - promise._result = reason; - - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); - } - - function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; - subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; - - if (length === 0 && parent._state) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); - } - } - - function lib$es6$promise$$internal$$publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; - } - - function lib$es6$promise$$internal$$ErrorObject() { - this.error = null; - } - - var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; - return lib$es6$promise$$internal$$TRY_CATCH_ERROR; - } - } - - function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { - var hasCallback = lib$es6$promise$utils$$isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = lib$es6$promise$$internal$$tryCatch(callback, detail); - - if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== lib$es6$promise$$internal$$PENDING) { - // noop - } else if (hasCallback && succeeded) { - lib$es6$promise$$internal$$resolve(promise, value); - } else if (failed) { - lib$es6$promise$$internal$$reject(promise, error); - } else if (settled === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, value); - } else if (settled === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } - } - - function lib$es6$promise$$internal$$initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - lib$es6$promise$$internal$$resolve(promise, value); - }, function rejectPromise(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } catch(e) { - lib$es6$promise$$internal$$reject(promise, e); - } - } - - function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } - } - } else { - lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); - } - } - - lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { - return lib$es6$promise$utils$$isArray(input); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { - this._result = new Array(this.length); - }; - - var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; - - lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (lib$es6$promise$utils$$isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === lib$es6$promise$$internal$$PENDING) { - enumerator._remaining--; - - if (state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(promise, enumerator._result); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { - enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); - }); - }; - function lib$es6$promise$promise$all$$all(entries) { - return new lib$es6$promise$enumerator$$default(this, entries).promise; - } - var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; - function lib$es6$promise$promise$race$$race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (!lib$es6$promise$utils$$isArray(entries)) { - lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - lib$es6$promise$$internal$$resolve(promise, value); - } - - function onRejection(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - } - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; - } - var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; - function lib$es6$promise$promise$resolve$$resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$resolve(promise, object); - return promise; - } - var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; - function lib$es6$promise$promise$reject$$reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$reject(promise, reason); - return promise; - } - var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; - - var lib$es6$promise$promise$$counter = 0; - - function lib$es6$promise$promise$$needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - function lib$es6$promise$promise$$needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; - /** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor - */ - function lib$es6$promise$promise$$Promise(resolver) { - this._id = lib$es6$promise$promise$$counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (lib$es6$promise$$internal$$noop !== resolver) { - if (!lib$es6$promise$utils$$isFunction(resolver)) { - lib$es6$promise$promise$$needsResolver(); - } - - if (!(this instanceof lib$es6$promise$promise$$Promise)) { - lib$es6$promise$promise$$needsNew(); - } - - lib$es6$promise$$internal$$initializePromise(this, resolver); - } - } - - lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; - lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; - lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; - lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; - - lib$es6$promise$promise$$Promise.prototype = { - constructor: lib$es6$promise$promise$$Promise, - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(lib$es6$promise$$internal$$noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - lib$es6$promise$asap$$default(function(){ - lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); - }); - } else { - lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - function lib$es6$promise$polyfill$$polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = lib$es6$promise$promise$$default; - } - var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; - - var lib$es6$promise$umd$$ES6Promise = { - 'Promise': lib$es6$promise$promise$$default, - 'polyfill': lib$es6$promise$polyfill$$default - }; - - /* global define:true module:true window: true */ - if (typeof define === 'function' && define['amd']) { - define(function() { return lib$es6$promise$umd$$ES6Promise; }); - } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = lib$es6$promise$umd$$ES6Promise; - } else if (typeof this !== 'undefined') { - this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; - } - - lib$es6$promise$polyfill$$default(); -}).call(this); - -//# sourceMappingURL=es6-promise.js.map -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":4}],52:[function(require,module,exports){ -(function (global){ -/*global describe, specify, it, assert */ - -if (typeof Object.getPrototypeOf !== "function") { - Object.getPrototypeOf = "".__proto__ === String.prototype - ? function (object) { - return object.__proto__; - } - : function (object) { - // May break if the constructor has been tampered with - return object.constructor.prototype; - }; -} - -function keysOf(object) { - var results = []; - - for (var key in object) { - if (object.hasOwnProperty(key)) { - results.push(key); - } - } - - return results; -} - -var g = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this; -var Promise = g.adapter.Promise; -var assert = require('assert'); - -function objectEquals(obj1, obj2) { - for (var i in obj1) { - if (obj1.hasOwnProperty(i)) { - if (!obj2.hasOwnProperty(i)) return false; - if (obj1[i] != obj2[i]) return false; - } - } - for (var i in obj2) { - if (obj2.hasOwnProperty(i)) { - if (!obj1.hasOwnProperty(i)) return false; - if (obj1[i] != obj2[i]) return false; - } - } - return true; -} - -describe("extensions", function() { - describe("Promise constructor", function() { - it('should exist and have length 1', function() { - assert(Promise); - assert.equal(Promise.length, 1); - }); - - it('should fulfill if `resolve` is called with a value', function(done) { - var promise = new Promise(function(resolve) { resolve('value'); }); - - promise.then(function(value) { - assert.equal(value, 'value'); - done(); - }); - }); - - it('should reject if `reject` is called with a reason', function(done) { - var promise = new Promise(function(resolve, reject) { reject('reason'); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'reason'); - done(); - }); - }); - - it('should be a constructor', function() { - var promise = new Promise(function() {}); - - assert.equal(Object.getPrototypeOf(promise), Promise.prototype, '[[Prototype]] equals Promise.prototype'); - assert.equal(promise.constructor, Promise, 'constructor property of instances is set correctly'); - assert.equal(Promise.prototype.constructor, Promise, 'constructor property of prototype is set correctly'); - }); - - it('should NOT work without `new`', function() { - assert.throws(function(){ - Promise(function(resolve) { resolve('value'); }); - }, TypeError) - }); - - it('should throw a `TypeError` if not given a function', function() { - assert.throws(function () { - new Promise(); - }, TypeError); - - assert.throws(function () { - new Promise({}); - }, TypeError); - - assert.throws(function () { - new Promise('boo!'); - }, TypeError); - }); - - it('should reject on resolver exception', function(done) { - new Promise(function() { - throw 'error'; - }).then(null, function(e) { - assert.equal(e, 'error'); - done(); - }); - }); - - it('should not resolve multiple times', function(done) { - var resolver, rejector, fulfilled = 0, rejected = 0; - var thenable = { - then: function(resolve, reject) { - resolver = resolve; - rejector = reject; - } - }; - - var promise = new Promise(function(resolve) { - resolve(1); - }); - - promise.then(function(value){ - return thenable; - }).then(function(value){ - fulfilled++; - }, function(reason) { - rejected++; - }); - - setTimeout(function() { - resolver(1); - resolver(1); - rejector(1); - rejector(1); - - setTimeout(function() { - assert.equal(fulfilled, 1); - assert.equal(rejected, 0); - done(); - }, 20); - }, 20); - - }); - - describe('assimilation', function() { - it('should assimilate if `resolve` is called with a fulfilled promise', function(done) { - var originalPromise = new Promise(function(resolve) { resolve('original value'); }); - var promise = new Promise(function(resolve) { resolve(originalPromise); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate if `resolve` is called with a rejected promise', function(done) { - var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); - var promise = new Promise(function(resolve) { resolve(originalPromise); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - - it('should assimilate if `resolve` is called with a fulfilled thenable', function(done) { - var originalThenable = { - then: function (onFulfilled) { - setTimeout(function() { onFulfilled('original value'); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(originalThenable); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate if `resolve` is called with a rejected thenable', function(done) { - var originalThenable = { - then: function (onFulfilled, onRejected) { - setTimeout(function() { onRejected('original reason'); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(originalThenable); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - - - it('should assimilate two levels deep, for fulfillment of self fulfilling promises', function(done) { - var originalPromise, promise; - originalPromise = new Promise(function(resolve) { - setTimeout(function() { - resolve(originalPromise); - }, 0) - }); - - promise = new Promise(function(resolve) { - setTimeout(function() { - resolve(originalPromise); - }, 0); - }); - - promise.then(function(value) { - assert(false); - done(); - })['catch'](function(reason) { - assert.equal(reason.message, "You cannot resolve a promise with itself"); - assert(reason instanceof TypeError); - done(); - }); - }); - - it('should assimilate two levels deep, for fulfillment', function(done) { - var originalPromise = new Promise(function(resolve) { resolve('original value'); }); - var nextPromise = new Promise(function(resolve) { resolve(originalPromise); }); - var promise = new Promise(function(resolve) { resolve(nextPromise); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate two levels deep, for rejection', function(done) { - var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); - var nextPromise = new Promise(function(resolve) { resolve(originalPromise); }); - var promise = new Promise(function(resolve) { resolve(nextPromise); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - - it('should assimilate three levels deep, mixing thenables and promises (fulfilled case)', function(done) { - var originalPromise = new Promise(function(resolve) { resolve('original value'); }); - var intermediateThenable = { - then: function (onFulfilled) { - setTimeout(function() { onFulfilled(originalPromise); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(intermediateThenable); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate three levels deep, mixing thenables and promises (rejected case)', function(done) { - var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); - var intermediateThenable = { - then: function (onFulfilled) { - setTimeout(function() { onFulfilled(originalPromise); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(intermediateThenable); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - }); - }); - - describe("Promise.all", function() { - testAll(function(){ - return Promise.all.apply(Promise, arguments); - }); - }); - - function testAll(all) { - it('should exist', function() { - assert(all); - }); - - it('throws when not passed an array', function(done) { - var nothing = assertRejection(all()); - var string = assertRejection(all('')); - var object = assertRejection(all({})); - - Promise.all([ - nothing, - string, - object - ]).then(function(){ done(); }); - }); - - specify('fulfilled only after all of the other promises are fulfilled', function(done) { - var firstResolved, secondResolved, firstResolver, secondResolver; - - var first = new Promise(function(resolve) { - firstResolver = resolve; - }); - first.then(function() { - firstResolved = true; - }); - - var second = new Promise(function(resolve) { - secondResolver = resolve; - }); - second.then(function() { - secondResolved = true; - }); - - setTimeout(function() { - firstResolver(true); - }, 0); - - setTimeout(function() { - secondResolver(true); - }, 0); - - all([first, second]).then(function() { - assert(firstResolved); - assert(secondResolved); - done(); - }); - }); - - specify('rejected as soon as a promise is rejected', function(done) { - var firstResolver, secondResolver; - - var first = new Promise(function(resolve, reject) { - firstResolver = { resolve: resolve, reject: reject }; - }); - - var second = new Promise(function(resolve, reject) { - secondResolver = { resolve: resolve, reject: reject }; - }); - - setTimeout(function() { - firstResolver.reject({}); - }, 0); - - var firstWasRejected, secondCompleted; - - first['catch'](function(){ - firstWasRejected = true; - }); - - second.then(function(){ - secondCompleted = true; - }, function() { - secondCompleted = true; - }); - - all([first, second]).then(function() { - assert(false); - }, function() { - assert(firstWasRejected); - assert(!secondCompleted); - done(); - }); - }); - - specify('passes the resolved values of each promise to the callback in the correct order', function(done) { - var firstResolver, secondResolver, thirdResolver; - - var first = new Promise(function(resolve, reject) { - firstResolver = { resolve: resolve, reject: reject }; - }); - - var second = new Promise(function(resolve, reject) { - secondResolver = { resolve: resolve, reject: reject }; - }); - - var third = new Promise(function(resolve, reject) { - thirdResolver = { resolve: resolve, reject: reject }; - }); - - thirdResolver.resolve(3); - firstResolver.resolve(1); - secondResolver.resolve(2); - - all([first, second, third]).then(function(results) { - assert(results.length === 3); - assert(results[0] === 1); - assert(results[1] === 2); - assert(results[2] === 3); - done(); - }); - }); - - specify('resolves an empty array passed to all()', function(done) { - all([]).then(function(results) { - assert(results.length === 0); - done(); - }); - }); - - specify('works with null', function(done) { - all([null]).then(function(results) { - assert.equal(results[0], null); - done(); - }); - }); - - specify('works with a mix of promises and thenables and non-promises', function(done) { - var promise = new Promise(function(resolve) { resolve(1); }); - var syncThenable = { then: function (onFulfilled) { onFulfilled(2); } }; - var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } }; - var nonPromise = 4; - - all([promise, syncThenable, asyncThenable, nonPromise]).then(function(results) { - assert(objectEquals(results, [1, 2, 3, 4])); - done(); - })['catch'](done); - }); - } - - describe("reject", function(){ - specify("it should exist", function(){ - assert(Promise.reject); - }); - - describe('it rejects', function(){ - var reason = 'the reason', - promise = Promise.reject(reason); - - promise.then(function(){ - assert(false, 'should not fulfill'); - }, function(actualReason){ - assert.equal(reason, actualReason); - }); - }); - }); - - function assertRejection(promise) { - return promise.then(function(){ - assert(false, 'expected rejection, but got fulfillment'); - }, function(reason){ - assert(reason instanceof Error); - }); - } - - describe('race', function() { - it("should exist", function() { - assert(Promise.race); - }); - - it("throws when not passed an array", function(done) { - var nothing = assertRejection(Promise.race()); - var string = assertRejection(Promise.race('')); - var object = assertRejection(Promise.race({})); - - Promise.all([ - nothing, - string, - object - ]).then(function(){ done(); }); - }); - - specify('fulfilled after one of the other promises are fulfilled', function(done) { - var firstResolved, secondResolved, firstResolver, secondResolver; - - var first = new Promise(function(resolve) { - firstResolver = resolve; - }); - first.then(function() { - firstResolved = true; - }); - - var second = new Promise(function(resolve) { - secondResolver = resolve; - }); - second.then(function() { - secondResolved = true; - }); - - setTimeout(function() { - firstResolver(true); - }, 100); - - setTimeout(function() { - secondResolver(true); - }, 0); - - Promise.race([first, second]).then(function() { - assert(secondResolved); - assert.equal(firstResolved, undefined); - done(); - }); - }); - - specify('the race begins on nextTurn and prioritized by array entry', function(done) { - var firstResolver, secondResolver, nonPromise = 5; - - var first = new Promise(function(resolve, reject) { - resolve(true); - }); - - var second = new Promise(function(resolve, reject) { - resolve(false); - }); - - Promise.race([first, second, nonPromise]).then(function(value) { - assert.equal(value, true); - done(); - }); - }); - - specify('rejected as soon as a promise is rejected', function(done) { - var firstResolver, secondResolver; - - var first = new Promise(function(resolve, reject) { - firstResolver = { resolve: resolve, reject: reject }; - }); - - var second = new Promise(function(resolve, reject) { - secondResolver = { resolve: resolve, reject: reject }; - }); - - setTimeout(function() { - firstResolver.reject({}); - }, 0); - - var firstWasRejected, secondCompleted; - - first['catch'](function(){ - firstWasRejected = true; - }); - - second.then(function(){ - secondCompleted = true; - }, function() { - secondCompleted = true; - }); - - Promise.race([first, second]).then(function() { - assert(false); - }, function() { - assert(firstWasRejected); - assert(!secondCompleted); - done(); - }); - }); - - specify('resolves an empty array to forever pending Promise', function(done) { - var foreverPendingPromise = Promise.race([]), - wasSettled = false; - - foreverPendingPromise.then(function() { - wasSettled = true; - }, function() { - wasSettled = true; - }); - - setTimeout(function() { - assert(!wasSettled); - done(); - }, 100); - }); - - specify('works with a mix of promises and thenables', function(done) { - var promise = new Promise(function(resolve) { setTimeout(function() { resolve(1); }, 10); }), - syncThenable = { then: function (onFulfilled) { onFulfilled(2); } }; - - Promise.race([promise, syncThenable]).then(function(result) { - assert(result, 2); - done(); - }); - }); - - specify('works with a mix of thenables and non-promises', function (done) { - var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } }, - nonPromise = 4; - - Promise.race([asyncThenable, nonPromise]).then(function(result) { - assert(result, 4); - done(); - }); - }); - }); - - describe("resolve", function(){ - specify("it should exist", function(){ - assert(Promise.resolve); - }); - - describe("1. If x is a promise, adopt its state ", function(){ - specify("1.1 If x is pending, promise must remain pending until x is fulfilled or rejected.", function(done){ - var expectedValue, resolver, thenable, wrapped; - - expectedValue = 'the value'; - thenable = { - then: function(resolve, reject){ - resolver = resolve; - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(value){ - assert(value === expectedValue); - done(); - }); - - setTimeout(function(){ - resolver(expectedValue); - }, 10); - }); - - specify("1.2 If/when x is fulfilled, fulfill promise with the same value.", function(done){ - var expectedValue, thenable, wrapped; - - expectedValue = 'the value'; - thenable = { - then: function(resolve, reject){ - resolve(expectedValue); - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(value){ - assert(value === expectedValue); - done(); - }) - }); - - specify("1.3 If/when x is rejected, reject promise with the same reason.", function(done){ - var expectedError, thenable, wrapped; - - expectedError = new Error(); - thenable = { - then: function(resolve, reject){ - reject(expectedError); - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - assert(error === expectedError); - done(); - }); - }); - }); - - describe("2. Otherwise, if x is an object or function,", function(){ - specify("2.1 Let then x.then", function(done){ - var accessCount, resolver, wrapped, thenable; - - accessCount = 0; - thenable = { }; - - // we likely don't need to test this, if the browser doesn't support it - if (typeof Object.defineProperty !== "function") { done(); return; } - - Object.defineProperty(thenable, 'then', { - get: function(){ - accessCount++; - - if (accessCount > 1) { - throw new Error(); - } - - return function(){ }; - } - }); - - assert(accessCount === 0); - - wrapped = Promise.resolve(thenable); - - assert(accessCount === 1); - - done(); - }); - - specify("2.2 If retrieving the property x.then results in a thrown exception e, reject promise with e as the reason.", function(done){ - var wrapped, thenable, expectedError; - - expectedError = new Error(); - thenable = { }; - - // we likely don't need to test this, if the browser doesn't support it - if (typeof Object.defineProperty !== "function") { done(); return; } - - Object.defineProperty(thenable, 'then', { - get: function(){ - throw expectedError; - } - }); - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - assert(error === expectedError, 'incorrect exception was thrown'); - done(); - }); - }); - - describe('2.3. If then is a function, call it with x as this, first argument resolvePromise, and second argument rejectPromise, where', function(){ - specify('2.3.1 If/when resolvePromise is called with a value y, run Resolve(promise, y)', function(done){ - var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis; - - thenable = { - then: function(resolve, reject){ - calledThis = this; - resolver = resolve; - rejector = reject; - } - }; - - expectedSuccess = 'success'; - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - assert(calledThis === thenable, 'this must be the thenable'); - assert(success === expectedSuccess, 'rejected promise with x'); - done(); - }); - - setTimeout(function() { - resolver(expectedSuccess); - }, 20); - }); - - specify('2.3.2 If/when rejectPromise is called with a reason r, reject promise with r.', function(done){ - var expectedError, resolver, rejector, thenable, wrapped, calledThis; - - thenable = { - then: function(resolve, reject){ - calledThis = this; - resolver = resolve; - rejector = reject; - } - }; - - expectedError = new Error(); - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - assert(error === expectedError, 'rejected promise with x'); - done(); - }); - - setTimeout(function() { - rejector(expectedError); - }, 20); - }); - - specify("2.3.3 If both resolvePromise and rejectPromise are called, or multiple calls to the same argument are made, the first call takes precedence, and any further calls are ignored", function(done){ - var expectedError, expectedSuccess, resolver, rejector, thenable, wrapped, calledThis, - calledRejected, calledResolved; - - calledRejected = 0; - calledResolved = 0; - - thenable = { - then: function(resolve, reject){ - calledThis = this; - resolver = resolve; - rejector = reject; - } - }; - - expectedError = new Error(); - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(){ - calledResolved++; - }, function(error){ - calledRejected++; - assert(calledResolved === 0, 'never resolved'); - assert(calledRejected === 1, 'rejected only once'); - assert(error === expectedError, 'rejected promise with x'); - }); - - setTimeout(function() { - rejector(expectedError); - rejector(expectedError); - - rejector('foo'); - - resolver('bar'); - resolver('baz'); - }, 20); - - setTimeout(function(){ - assert(calledRejected === 1, 'only rejected once'); - assert(calledResolved === 0, 'never resolved'); - done(); - }, 50); - }); - - describe("2.3.4 If calling then throws an exception e", function(){ - specify("2.3.4.1 If resolvePromise or rejectPromise have been called, ignore it.", function(done){ - var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis, - calledRejected, calledResolved; - - expectedSuccess = 'success'; - - thenable = { - then: function(resolve, reject){ - resolve(expectedSuccess); - throw expectedError; - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - assert(success === expectedSuccess, 'resolved not errored'); - done(); - }); - }); - - specify("2.3.4.2 Otherwise, reject promise with e as the reason.", function(done) { - var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount; - - expectedError = new Error(); - callCount = 0; - - thenable = { then: function() { throw expectedError; } }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - callCount++; - assert(expectedError === error, 'expected the correct error to be rejected'); - done(); - }); - - assert(callCount === 0, 'expected async, was sync'); - }); - }); - }); - - specify("2.4 If then is not a function, fulfill promise with x", function(done){ - var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount; - - thenable = { then: 3 }; - callCount = 0; - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - callCount++; - assert(thenable === success, 'fulfilled promise with x'); - done(); - }); - - assert(callCount === 0, 'expected async, was sync'); - }); - }); - - describe("3. If x is not an object or function, ", function(){ - specify("fulfill promise with x.", function(done){ - var thenable, callCount, wrapped; - - thenable = null; - callCount = 0; - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - callCount++; - assert(success === thenable, 'fulfilled promise with x'); - done(); - }, function(a){ - assert(false, 'should not also reject'); - }); - - assert(callCount === 0, 'expected async, was sync'); - }); - }); - }); - - if (typeof Worker !== 'undefined') { - describe('web worker', function () { - it('should work', function (done) { - this.timeout(2000); - var worker = new Worker('worker.js'); - worker.addEventListener('error', function(reason) { - done(new Error("Test failed:" + reason)); - }); - worker.addEventListener('message', function (e) { - worker.terminate(); - assert.equal(e.data, 'pong'); - done(); - }); - worker.postMessage('ping'); - }); - }); - } -}); - -// thanks to @wizardwerdna for the test case -> https://github.com/tildeio/rsvp.js/issues/66 -// Only run these tests in node (phantomjs cannot handle them) -if (typeof module !== 'undefined' && module.exports) { - - describe("using reduce to sum integers using promises", function(){ - it("should build the promise pipeline without error", function(){ - var array, iters, pZero, i; - - array = []; - iters = 1000; - - for (i=1; i<=iters; i++) { - array.push(i); - } - - pZero = Promise.resolve(0); - - array.reduce(function(promise, nextVal) { - return promise.then(function(currentVal) { - return Promise.resolve(currentVal + nextVal); - }); - }, pZero); - }); - - it("should get correct answer without blowing the nextTick stack", function(done){ - var pZero, array, iters, result, i; - - pZero = Promise.resolve(0); - - array = []; - iters = 1000; - - for (i=1; i<=iters; i++) { - array.push(i); - } - - result = array.reduce(function(promise, nextVal) { - return promise.then(function(currentVal) { - return Promise.resolve(currentVal + nextVal); - }); - }, pZero); - - result.then(function(value){ - assert.equal(value, (iters*(iters+1)/2)); - done(); - }); - }); - }); -} - -// Kudos to @Octane at https://github.com/getify/native-promise-only/issues/5 for this, and @getify for pinging me. -describe("Thenables should not be able to run code during assimilation", function () { - specify("resolving to a thenable", function () { - var thenCalled = false; - var thenable = { - then: function () { - thenCalled = true; - } - }; - - Promise.resolve(thenable); - assert.strictEqual(thenCalled, false); - }); - - specify("resolving to an evil promise", function () { - var thenCalled = false; - var evilPromise = Promise.resolve(); - evilPromise.then = function () { - thenCalled = true; - }; - - Promise.resolve(evilPromise); - assert.strictEqual(thenCalled, false); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],53:[function(require,module,exports){ -(function (global){ -var assert = require('assert'); -var g = typeof window !== 'undefined' ? - window : typeof global !== 'undefined' ? global : this; - -var Promise = g.ES6Promise || require('./es6-promise').Promise; - -function defer() { - var deferred = {}; - - deferred.promise = new Promise(function(resolve, reject) { - deferred.resolve = resolve; - deferred.reject = reject; - }); - - return deferred; -} -var resolve = Promise.resolve; -var reject = Promise.reject; - - -module.exports = g.adapter = { - resolved: function(a) { return Promise.resolve(a); }, - rejected: function(a) { return Promise.reject(a); }, - deferred: defer, - Promise: Promise -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./es6-promise":51,"assert":2}]},{},[1]); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js deleted file mode 100644 index 5b096d6e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js +++ /dev/null @@ -1,950 +0,0 @@ -(function() { - "use strict"; - function lib$es6$promise$utils$$objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); - } - - function lib$es6$promise$utils$$isFunction(x) { - return typeof x === 'function'; - } - - function lib$es6$promise$utils$$isMaybeThenable(x) { - return typeof x === 'object' && x !== null; - } - - var lib$es6$promise$utils$$_isArray; - if (!Array.isArray) { - lib$es6$promise$utils$$_isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; - } else { - lib$es6$promise$utils$$_isArray = Array.isArray; - } - - var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; - var lib$es6$promise$asap$$len = 0; - var lib$es6$promise$asap$$toString = {}.toString; - var lib$es6$promise$asap$$vertxNext; - function lib$es6$promise$asap$$asap(callback, arg) { - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; - lib$es6$promise$asap$$len += 2; - if (lib$es6$promise$asap$$len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - lib$es6$promise$asap$$scheduleFlush(); - } - } - - var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; - - var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; - var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; - var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; - var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - - // test for web worker but not in IE10 - var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - - // node - function lib$es6$promise$asap$$useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(lib$es6$promise$asap$$flush); - }; - } - - // vertx - function lib$es6$promise$asap$$useVertxTimer() { - return function() { - lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); - }; - } - - function lib$es6$promise$asap$$useMutationObserver() { - var iterations = 0; - var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; - } - - // web worker - function lib$es6$promise$asap$$useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = lib$es6$promise$asap$$flush; - return function () { - channel.port2.postMessage(0); - }; - } - - function lib$es6$promise$asap$$useSetTimeout() { - return function() { - setTimeout(lib$es6$promise$asap$$flush, 1); - }; - } - - var lib$es6$promise$asap$$queue = new Array(1000); - function lib$es6$promise$asap$$flush() { - for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { - var callback = lib$es6$promise$asap$$queue[i]; - var arg = lib$es6$promise$asap$$queue[i+1]; - - callback(arg); - - lib$es6$promise$asap$$queue[i] = undefined; - lib$es6$promise$asap$$queue[i+1] = undefined; - } - - lib$es6$promise$asap$$len = 0; - } - - function lib$es6$promise$asap$$attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; - return lib$es6$promise$asap$$useVertxTimer(); - } catch(e) { - return lib$es6$promise$asap$$useSetTimeout(); - } - } - - var lib$es6$promise$asap$$scheduleFlush; - // Decide what async method to use to triggering processing of queued callbacks: - if (lib$es6$promise$asap$$isNode) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); - } else if (lib$es6$promise$asap$$BrowserMutationObserver) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); - } else if (lib$es6$promise$asap$$isWorker) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); - } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); - } else { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); - } - - function lib$es6$promise$$internal$$noop() {} - - var lib$es6$promise$$internal$$PENDING = void 0; - var lib$es6$promise$$internal$$FULFILLED = 1; - var lib$es6$promise$$internal$$REJECTED = 2; - - var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); - } - - function lib$es6$promise$$internal$$cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); - } - - function lib$es6$promise$$internal$$getThen(promise) { - try { - return promise.then; - } catch(error) { - lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; - return lib$es6$promise$$internal$$GET_THEN_ERROR; - } - } - - function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } - } - - function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { - lib$es6$promise$asap$$default(function(promise) { - var sealed = false; - var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - lib$es6$promise$$internal$$resolve(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - lib$es6$promise$$internal$$reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - lib$es6$promise$$internal$$reject(promise, error); - } - }, promise); - } - - function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { - if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, thenable._result); - } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, thenable._result); - } else { - lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { - lib$es6$promise$$internal$$resolve(promise, value); - }, function(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } - } - - function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); - } else { - var then = lib$es6$promise$$internal$$getThen(maybeThenable); - - if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); - } else if (then === undefined) { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } else if (lib$es6$promise$utils$$isFunction(then)) { - lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); - } else { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } - } - } - - function lib$es6$promise$$internal$$resolve(promise, value) { - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); - } else if (lib$es6$promise$utils$$objectOrFunction(value)) { - lib$es6$promise$$internal$$handleMaybeThenable(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - } - - function lib$es6$promise$$internal$$publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - lib$es6$promise$$internal$$publish(promise); - } - - function lib$es6$promise$$internal$$fulfill(promise, value) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - - promise._result = value; - promise._state = lib$es6$promise$$internal$$FULFILLED; - - if (promise._subscribers.length !== 0) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); - } - } - - function lib$es6$promise$$internal$$reject(promise, reason) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - promise._state = lib$es6$promise$$internal$$REJECTED; - promise._result = reason; - - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); - } - - function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; - subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; - - if (length === 0 && parent._state) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); - } - } - - function lib$es6$promise$$internal$$publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; - } - - function lib$es6$promise$$internal$$ErrorObject() { - this.error = null; - } - - var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; - return lib$es6$promise$$internal$$TRY_CATCH_ERROR; - } - } - - function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { - var hasCallback = lib$es6$promise$utils$$isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = lib$es6$promise$$internal$$tryCatch(callback, detail); - - if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== lib$es6$promise$$internal$$PENDING) { - // noop - } else if (hasCallback && succeeded) { - lib$es6$promise$$internal$$resolve(promise, value); - } else if (failed) { - lib$es6$promise$$internal$$reject(promise, error); - } else if (settled === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, value); - } else if (settled === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } - } - - function lib$es6$promise$$internal$$initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - lib$es6$promise$$internal$$resolve(promise, value); - }, function rejectPromise(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } catch(e) { - lib$es6$promise$$internal$$reject(promise, e); - } - } - - function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } - } - } else { - lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); - } - } - - lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { - return lib$es6$promise$utils$$isArray(input); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { - this._result = new Array(this.length); - }; - - var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; - - lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (lib$es6$promise$utils$$isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === lib$es6$promise$$internal$$PENDING) { - enumerator._remaining--; - - if (state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(promise, enumerator._result); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { - enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); - }); - }; - function lib$es6$promise$promise$all$$all(entries) { - return new lib$es6$promise$enumerator$$default(this, entries).promise; - } - var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; - function lib$es6$promise$promise$race$$race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (!lib$es6$promise$utils$$isArray(entries)) { - lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - lib$es6$promise$$internal$$resolve(promise, value); - } - - function onRejection(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - } - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; - } - var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; - function lib$es6$promise$promise$resolve$$resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$resolve(promise, object); - return promise; - } - var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; - function lib$es6$promise$promise$reject$$reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$reject(promise, reason); - return promise; - } - var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; - - var lib$es6$promise$promise$$counter = 0; - - function lib$es6$promise$promise$$needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - function lib$es6$promise$promise$$needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; - /** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor - */ - function lib$es6$promise$promise$$Promise(resolver) { - this._id = lib$es6$promise$promise$$counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (lib$es6$promise$$internal$$noop !== resolver) { - if (!lib$es6$promise$utils$$isFunction(resolver)) { - lib$es6$promise$promise$$needsResolver(); - } - - if (!(this instanceof lib$es6$promise$promise$$Promise)) { - lib$es6$promise$promise$$needsNew(); - } - - lib$es6$promise$$internal$$initializePromise(this, resolver); - } - } - - lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; - lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; - lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; - lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; - - lib$es6$promise$promise$$Promise.prototype = { - constructor: lib$es6$promise$promise$$Promise, - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(lib$es6$promise$$internal$$noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - lib$es6$promise$asap$$default(function(){ - lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); - }); - } else { - lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - function lib$es6$promise$polyfill$$polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = lib$es6$promise$promise$$default; - } - var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; - - var lib$es6$promise$umd$$ES6Promise = { - 'Promise': lib$es6$promise$promise$$default, - 'polyfill': lib$es6$promise$polyfill$$default - }; - - /* global define:true module:true window: true */ - if (typeof define === 'function' && define['amd']) { - define(function() { return lib$es6$promise$umd$$ES6Promise; }); - } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = lib$es6$promise$umd$$ES6Promise; - } else if (typeof this !== 'undefined') { - this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; - } - - lib$es6$promise$polyfill$$default(); -}).call(this); - -//# sourceMappingURL=es6-promise.js.map \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js deleted file mode 100644 index 34a1f52b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;i - - - rsvp.js Tests - - - -
    - - - - - - - - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js deleted file mode 100644 index 4817c9e7..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js +++ /dev/null @@ -1,902 +0,0 @@ -/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ -;(function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof define === "function" && define.amd; - - // A set of types used to distinguish objects from primitives. - var objectTypes = { - "function": true, - "object": true - }; - - // Detect the `exports` object exposed by CommonJS implementations. - var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; - - // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - var root = objectTypes[typeof window] && window || this, - freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global; - - if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) { - root = freeGlobal; - } - - // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - function runInContext(context, exports) { - context || (context = root["Object"]()); - exports || (exports = root["Object"]()); - - // Native constructor aliases. - var Number = context["Number"] || root["Number"], - String = context["String"] || root["String"], - Object = context["Object"] || root["Object"], - Date = context["Date"] || root["Date"], - SyntaxError = context["SyntaxError"] || root["SyntaxError"], - TypeError = context["TypeError"] || root["TypeError"], - Math = context["Math"] || root["Math"], - nativeJSON = context["JSON"] || root["JSON"]; - - // Delegate to the native `stringify` and `parse` implementations. - if (typeof nativeJSON == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } - - // Convenience aliases. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty, forEach, undef; - - // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - var isExtended = new Date(-3509827334573292); - try { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && - // Safari < 2.0.2 stores the internal millisecond time value correctly, - // but clips the values returned by the date methods to the range of - // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). - isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - } catch (exception) {} - - // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. - function has(name) { - if (has[name] !== undef) { - // Return cached feature test result. - return has[name]; - } - var isSupported; - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("json-parse"); - } else { - var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; - // Test `JSON.stringify`. - if (name == "json-stringify") { - var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended; - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function () { - return 1; - }).toJSON = value; - try { - stringifySupported = - // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && - // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && - stringify(new String()) == '""' && - // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undef && - // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undef) === undef && - // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undef && - // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && - stringify([value]) == "[1]" && - // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undef]) == "[null]" && - // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && - // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undef, getClass, null]) == "[null,null,null]" && - // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && - // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && - stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && - // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && - // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && - // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && - // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - } catch (exception) { - stringifySupported = false; - } - } - isSupported = stringifySupported; - } - // Test `JSON.parse`. - if (name == "json-parse") { - var parse = exports.parse; - if (typeof parse == "function") { - try { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - var parseSupported = value["a"].length == 5 && value["a"][0] === 1; - if (parseSupported) { - try { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - } catch (exception) {} - if (parseSupported) { - try { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - } catch (exception) {} - } - if (parseSupported) { - try { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - } catch (exception) {} - } - } - } - } catch (exception) { - parseSupported = false; - } - } - isSupported = parseSupported; - } - } - return has[name] = !!isSupported; - } - - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; - - // Detect incomplete support for accessing string characters by index. - var charIndexBuggy = has("bug-string-char-index"); - - // Define additional utility methods if the `Date` methods are buggy. - if (!isExtended) { - var floor = Math.floor; - // A mapping between the months of the year and the number of days between - // January 1st and the first of the respective month. - var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; - // Internal: Calculates the number of days between the Unix epoch and the - // first day of the given month. - var getDay = function (year, month) { - return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); - }; - } - - // Internal: Determines if a property is a direct property of the given - // object. Delegates to the native `Object#hasOwnProperty` method. - if (!(isProperty = objectProto.hasOwnProperty)) { - isProperty = function (property) { - var members = {}, constructor; - if ((members.__proto__ = null, members.__proto__ = { - // The *proto* property cannot be set multiple times in recent - // versions of Firefox and SeaMonkey. - "toString": 1 - }, members).toString != getClass) { - // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but - // supports the mutable *proto* property. - isProperty = function (property) { - // Capture and break the object's prototype chain (see section 8.6.2 - // of the ES 5.1 spec). The parenthesized expression prevents an - // unsafe transformation by the Closure Compiler. - var original = this.__proto__, result = property in (this.__proto__ = null, this); - // Restore the original prototype chain. - this.__proto__ = original; - return result; - }; - } else { - // Capture a reference to the top-level `Object` constructor. - constructor = members.constructor; - // Use the `constructor` property to simulate `Object#hasOwnProperty` in - // other environments. - isProperty = function (property) { - var parent = (this.constructor || constructor).prototype; - return property in this && !(property in parent && this[property] === parent[property]); - }; - } - members = null; - return isProperty.call(this, property); - }; - } - - // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. - forEach = function (object, callback) { - var size = 0, Properties, members, property; - - // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - (Properties = function () { - this.valueOf = 0; - }).prototype.valueOf = 0; - - // Iterate over a new instance of the `Properties` class. - members = new Properties(); - for (property in members) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(members, property)) { - size++; - } - } - Properties = members = null; - - // Normalize the iteration algorithm. - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; - // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. - forEach = function (object, callback) { - var isFunction = getClass.call(object) == functionClass, property, length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty; - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } - // Manually invoke the callback for each non-enumerable property. - for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property)); - }; - } else if (size == 2) { - // Safari <= 2.0.4 enumerates shadowed properties twice. - forEach = function (object, callback) { - // Create a set of iterated properties. - var members = {}, isFunction = getClass.call(object) == functionClass, property; - for (property in object) { - // Store each property name to prevent double enumeration. The - // `prototype` property of functions is not enumerated due to cross- - // environment inconsistencies. - if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - forEach = function (object, callback) { - var isFunction = getClass.call(object) == functionClass, property, isConstructor; - for (property in object) { - if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { - callback(property); - } - } - // Manually invoke the callback for the `constructor` property due to - // cross-environment inconsistencies. - if (isConstructor || isProperty.call(object, (property = "constructor"))) { - callback(property); - } - }; - } - return forEach(object, callback); - }; - - // Public: Serializes a JavaScript `value` as a JSON string. The optional - // `filter` argument may specify either a function that alters how object and - // array members are serialized, or an array of strings and numbers that - // indicates which properties should be serialized. The optional `width` - // argument may be either a string or number that specifies the indentation - // level of the output. - if (!has("json-stringify")) { - // Internal: A map of control characters and their escaped equivalents. - var Escapes = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t" - }; - - // Internal: Converts `value` into a zero-padded string such that its - // length is at least equal to `width`. The `width` must be <= 6. - var leadingZeroes = "000000"; - var toPaddedString = function (width, value) { - // The `|| 0` expression is necessary to work around a bug in - // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return (leadingZeroes + (value || 0)).slice(-width); - }; - - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; - var quote = function (value) { - var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10; - var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value); - for (; index < length; index++) { - var charCode = value.charCodeAt(index); - // If the character is a control character, append its Unicode or - // shorthand escape sequence; otherwise, append the character as-is. - switch (charCode) { - case 8: case 9: case 10: case 12: case 13: case 34: case 92: - result += Escapes[charCode]; - break; - default: - if (charCode < 32) { - result += unicodePrefix + toPaddedString(2, charCode.toString(16)); - break; - } - result += useCharIndex ? symbols[index] : value.charAt(index); - } - } - return result + '"'; - }; - - // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { - var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result; - try { - // Necessary for host object support. - value = object[property]; - } catch (exception) {} - if (typeof value == "object" && value) { - className = getClass.call(value); - if (className == dateClass && !isProperty.call(value, "toJSON")) { - if (value > -1 / 0 && value < 1 / 0) { - // Dates are serialized according to the `Date#toJSON` method - // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 - // for the ISO 8601 date time string format. - if (getDay) { - // Manually compute the year, month, date, hours, minutes, - // seconds, and milliseconds if the `getUTC*` methods are - // buggy. Adapted from @Yaffle's `date-shim` project. - date = floor(value / 864e5); - for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++); - for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++); - date = 1 + date - getDay(year, month); - // The `time` value specifies the time within the day (see ES - // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used - // to compute `A modulo B`, as the `%` operator does not - // correspond to the `modulo` operation for negative numbers. - time = (value % 864e5 + 864e5) % 864e5; - // The hours, minutes, seconds, and milliseconds are obtained by - // decomposing the time within the day. See section 15.9.1.10. - hours = floor(time / 36e5) % 24; - minutes = floor(time / 6e4) % 60; - seconds = floor(time / 1e3) % 60; - milliseconds = time % 1e3; - } else { - year = value.getUTCFullYear(); - month = value.getUTCMonth(); - date = value.getUTCDate(); - hours = value.getUTCHours(); - minutes = value.getUTCMinutes(); - seconds = value.getUTCSeconds(); - milliseconds = value.getUTCMilliseconds(); - } - // Serialize extended years correctly. - value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + - "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + - // Months, dates, hours, minutes, and seconds should have two - // digits; milliseconds should have three. - "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + - // Milliseconds are optional in ES 5.0, but required in 5.1. - "." + toPaddedString(3, milliseconds) + "Z"; - } else { - value = null; - } - } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { - // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the - // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 - // ignores all `toJSON` methods on these objects unless they are - // defined directly on an instance. - value = value.toJSON(property); - } - } - if (callback) { - // If a replacement function was provided, call it to obtain the value - // for serialization. - value = callback.call(object, property, value); - } - if (value === null) { - return "null"; - } - className = getClass.call(value); - if (className == booleanClass) { - // Booleans are represented literally. - return "" + value; - } else if (className == numberClass) { - // JSON numbers must be finite. `Infinity` and `NaN` are serialized as - // `"null"`. - return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - } else if (className == stringClass) { - // Strings are double-quoted and escaped. - return quote("" + value); - } - // Recursively serialize objects and arrays. - if (typeof value == "object") { - // Check for cyclic structures. This is a linear search; performance - // is inversely proportional to the number of unique nested objects. - for (length = stack.length; length--;) { - if (stack[length] === value) { - // Cyclic structures cannot be serialized by `JSON.stringify`. - throw TypeError(); - } - } - // Add the object to the stack of traversed objects. - stack.push(value); - results = []; - // Save the current indentation level and indent one additional level. - prefix = indentation; - indentation += whitespace; - if (className == arrayClass) { - // Recursively serialize array elements. - for (index = 0, length = value.length; index < length; index++) { - element = serialize(index, value, callback, properties, whitespace, indentation, stack); - results.push(element === undef ? "null" : element); - } - result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; - } else { - // Recursively serialize object members. Members are selected from - // either a user-specified list of property names, or the object - // itself. - forEach(properties || value, function (property) { - var element = serialize(property, value, callback, properties, whitespace, indentation, stack); - if (element !== undef) { - // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} - // is not the empty string, let `member` {quote(property) + ":"} - // be the concatenation of `member` and the `space` character." - // The "`space` character" refers to the literal space - // character, not the `space` {width} argument provided to - // `JSON.stringify`. - results.push(quote(property) + ":" + (whitespace ? " " : "") + element); - } - }); - result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; - } - // Remove the object from the traversed object stack. - stack.pop(); - return result; - } - }; - - // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - exports.stringify = function (source, filter, width) { - var whitespace, callback, properties, className; - if (objectTypes[typeof filter] && filter) { - if ((className = getClass.call(filter)) == functionClass) { - callback = filter; - } else if (className == arrayClass) { - // Convert the property names array into a makeshift set. - properties = {}; - for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1)); - } - } - if (width) { - if ((className = getClass.call(width)) == numberClass) { - // Convert the `width` to an integer and create a string containing - // `width` number of space characters. - if ((width -= width % 1) > 0) { - for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); - } - } else if (className == stringClass) { - whitespace = width.length <= 10 ? width : width.slice(0, 10); - } - } - // Opera <= 7.54u2 discards the values associated with empty string keys - // (`""`) only if they are used directly within an object member list - // (e.g., `!("" in { "": 1})`). - return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); - }; - } - - // Public: Parses a JSON source string. - if (!has("json-parse")) { - var fromCharCode = String.fromCharCode; - - // Internal: A map of escaped control characters and their unescaped - // equivalents. - var Unescapes = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r" - }; - - // Internal: Stores the parser state. - var Index, Source; - - // Internal: Resets the parser state and throws a `SyntaxError`. - var abort = function () { - Index = Source = null; - throw SyntaxError(); - }; - - // Internal: Returns the next token, or `"$"` if the parser has reached - // the end of the source string. A token may be a string, number, `null` - // literal, or Boolean literal. - var lex = function () { - var source = Source, length = source.length, value, begin, position, isSigned, charCode; - while (Index < length) { - charCode = source.charCodeAt(Index); - switch (charCode) { - case 9: case 10: case 13: case 32: - // Skip whitespace tokens, including tabs, carriage returns, line - // feeds, and space characters. - Index++; - break; - case 123: case 125: case 91: case 93: case 58: case 44: - // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at - // the current position. - value = charIndexBuggy ? source.charAt(Index) : source[Index]; - Index++; - return value; - case 34: - // `"` delimits a JSON string; advance to the next character and - // begin parsing the string. String tokens are prefixed with the - // sentinel `@` character to distinguish them from punctuators and - // end-of-string tokens. - for (value = "@", Index++; Index < length;) { - charCode = source.charCodeAt(Index); - if (charCode < 32) { - // Unescaped ASCII control characters (those with a code unit - // less than the space character) are not permitted. - abort(); - } else if (charCode == 92) { - // A reverse solidus (`\`) marks the beginning of an escaped - // control character (including `"`, `\`, and `/`) or Unicode - // escape sequence. - charCode = source.charCodeAt(++Index); - switch (charCode) { - case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: - // Revive escaped control characters. - value += Unescapes[charCode]; - Index++; - break; - case 117: - // `\u` marks the beginning of a Unicode escape sequence. - // Advance to the first character and validate the - // four-digit code point. - begin = ++Index; - for (position = Index + 4; Index < position; Index++) { - charCode = source.charCodeAt(Index); - // A valid sequence comprises four hexdigits (case- - // insensitive) that form a single hexadecimal value. - if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { - // Invalid Unicode escape sequence. - abort(); - } - } - // Revive the escaped character. - value += fromCharCode("0x" + source.slice(begin, Index)); - break; - default: - // Invalid escape sequence. - abort(); - } - } else { - if (charCode == 34) { - // An unescaped double-quote character marks the end of the - // string. - break; - } - charCode = source.charCodeAt(Index); - begin = Index; - // Optimize for the common case where a string is valid. - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } - // Append the string as-is. - value += source.slice(begin, Index); - } - } - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } - // Unterminated string. - abort(); - default: - // Parse numbers and literals. - begin = Index; - // Advance past the negative sign, if one is specified. - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } - // Parse an integer or floating-point value. - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); - } - isSigned = false; - // Parse the integer component. - for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); - // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. - if (source.charCodeAt(Index) == 46) { - position = ++Index; - // Parse the decimal component. - for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); - if (position == Index) { - // Illegal trailing decimal. - abort(); - } - Index = position; - } - // Parse exponents. The `e` denoting the exponent is - // case-insensitive. - charCode = source.charCodeAt(Index); - if (charCode == 101 || charCode == 69) { - charCode = source.charCodeAt(++Index); - // Skip past the sign following the exponent, if one is - // specified. - if (charCode == 43 || charCode == 45) { - Index++; - } - // Parse the exponential component. - for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); - if (position == Index) { - // Illegal empty exponent. - abort(); - } - Index = position; - } - // Coerce the parsed value to a JavaScript number. - return +source.slice(begin, Index); - } - // A negative sign may only precede numbers. - if (isSigned) { - abort(); - } - // `true`, `false`, and `null` literals. - if (source.slice(Index, Index + 4) == "true") { - Index += 4; - return true; - } else if (source.slice(Index, Index + 5) == "false") { - Index += 5; - return false; - } else if (source.slice(Index, Index + 4) == "null") { - Index += 4; - return null; - } - // Unrecognized token. - abort(); - } - } - // Return the sentinel `$` character if the parser has reached the end - // of the source string. - return "$"; - }; - - // Internal: Parses a JSON `value` token. - var get = function (value) { - var results, hasMembers; - if (value == "$") { - // Unexpected end of input. - abort(); - } - if (typeof value == "string") { - if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { - // Remove the sentinel `@` character. - return value.slice(1); - } - // Parse object and array literals. - if (value == "[") { - // Parses a JSON array, returning a new JavaScript array. - results = []; - for (;; hasMembers || (hasMembers = true)) { - value = lex(); - // A closing square bracket marks the end of the array literal. - if (value == "]") { - break; - } - // If the array literal contains elements, the current token - // should be a comma separating the previous element from the - // next. - if (hasMembers) { - if (value == ",") { - value = lex(); - if (value == "]") { - // Unexpected trailing `,` in array literal. - abort(); - } - } else { - // A `,` must separate each array element. - abort(); - } - } - // Elisions and leading commas are not permitted. - if (value == ",") { - abort(); - } - results.push(get(value)); - } - return results; - } else if (value == "{") { - // Parses a JSON object, returning a new JavaScript object. - results = {}; - for (;; hasMembers || (hasMembers = true)) { - value = lex(); - // A closing curly brace marks the end of the object literal. - if (value == "}") { - break; - } - // If the object literal contains members, the current token - // should be a comma separator. - if (hasMembers) { - if (value == ",") { - value = lex(); - if (value == "}") { - // Unexpected trailing `,` in object literal. - abort(); - } - } else { - // A `,` must separate each object member. - abort(); - } - } - // Leading commas are not permitted, object property names must be - // double-quoted strings, and a `:` must separate each property - // name and value. - if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { - abort(); - } - results[value.slice(1)] = get(lex()); - } - return results; - } - // Unexpected token encountered. - abort(); - } - return value; - }; - - // Internal: Updates a traversed object member. - var update = function (source, property, callback) { - var element = walk(source, property, callback); - if (element === undef) { - delete source[property]; - } else { - source[property] = element; - } - }; - - // Internal: Recursively traverses a parsed JSON object, invoking the - // `callback` function for each value. This is an implementation of the - // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. - var walk = function (source, property, callback) { - var value = source[property], length; - if (typeof value == "object" && value) { - // `forEach` can't be used to traverse an array in Opera <= 8.54 - // because its `Object#hasOwnProperty` implementation returns `false` - // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). - if (getClass.call(value) == arrayClass) { - for (length = value.length; length--;) { - update(value, length, callback); - } - } else { - forEach(value, function (property) { - update(value, property, callback); - }); - } - } - return callback.call(source, property, value); - }; - - // Public: `JSON.parse`. See ES 5.1 section 15.12.2. - exports.parse = function (source, callback) { - var result, value; - Index = 0; - Source = "" + source; - result = get(lex()); - // If a JSON string contains multiple tokens, it is invalid. - if (lex() != "$") { - abort(); - } - // Reset the parser state. - Index = Source = null; - return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; - }; - } - } - - exports["runInContext"] = runInContext; - return exports; - } - - if (freeExports && !isLoader) { - // Export for CommonJS environments. - runInContext(root, freeExports); - } else { - // Export for web browsers and JavaScript engines. - var nativeJSON = root.JSON, - previousJSON = root["JSON3"], - isRestored = false; - - var JSON3 = runInContext(root, (root["JSON3"] = { - // Public: Restores the original value of the global `JSON` object and - // returns a reference to the `JSON3` object. - "noConflict": function () { - if (!isRestored) { - isRestored = true; - root.JSON = nativeJSON; - root["JSON3"] = previousJSON; - nativeJSON = previousJSON = null; - } - return JSON3; - } - })); - - root.JSON = { - "parse": JSON3.parse, - "stringify": JSON3.stringify - }; - } - - // Export for asynchronous module loaders. - if (isLoader) { - define(function () { - return JSON3; - }); - } -}).call(this); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css deleted file mode 100644 index 42b9798f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css +++ /dev/null @@ -1,270 +0,0 @@ -@charset "utf-8"; - -body { - margin:0; -} - -#mocha { - font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; - margin: 60px 50px; -} - -#mocha ul, -#mocha li { - margin: 0; - padding: 0; -} - -#mocha ul { - list-style: none; -} - -#mocha h1, -#mocha h2 { - margin: 0; -} - -#mocha h1 { - margin-top: 15px; - font-size: 1em; - font-weight: 200; -} - -#mocha h1 a { - text-decoration: none; - color: inherit; -} - -#mocha h1 a:hover { - text-decoration: underline; -} - -#mocha .suite .suite h1 { - margin-top: 0; - font-size: .8em; -} - -#mocha .hidden { - display: none; -} - -#mocha h2 { - font-size: 12px; - font-weight: normal; - cursor: pointer; -} - -#mocha .suite { - margin-left: 15px; -} - -#mocha .test { - margin-left: 15px; - overflow: hidden; -} - -#mocha .test.pending:hover h2::after { - content: '(pending)'; - font-family: arial, sans-serif; -} - -#mocha .test.pass.medium .duration { - background: #c09853; -} - -#mocha .test.pass.slow .duration { - background: #b94a48; -} - -#mocha .test.pass::before { - content: '✓'; - font-size: 12px; - display: block; - float: left; - margin-right: 5px; - color: #00d6b2; -} - -#mocha .test.pass .duration { - font-size: 9px; - margin-left: 5px; - padding: 2px 5px; - color: #fff; - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; -} - -#mocha .test.pass.fast .duration { - display: none; -} - -#mocha .test.pending { - color: #0b97c4; -} - -#mocha .test.pending::before { - content: '◦'; - color: #0b97c4; -} - -#mocha .test.fail { - color: #c00; -} - -#mocha .test.fail pre { - color: black; -} - -#mocha .test.fail::before { - content: '✖'; - font-size: 12px; - display: block; - float: left; - margin-right: 5px; - color: #c00; -} - -#mocha .test pre.error { - color: #c00; - max-height: 300px; - overflow: auto; -} - -/** - * (1): approximate for browsers not supporting calc - * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border) - * ^^ seriously - */ -#mocha .test pre { - display: block; - float: left; - clear: left; - font: 12px/1.5 monaco, monospace; - margin: 5px; - padding: 15px; - border: 1px solid #eee; - max-width: 85%; /*(1)*/ - max-width: calc(100% - 42px); /*(2)*/ - word-wrap: break-word; - border-bottom-color: #ddd; - -webkit-border-radius: 3px; - -webkit-box-shadow: 0 1px 3px #eee; - -moz-border-radius: 3px; - -moz-box-shadow: 0 1px 3px #eee; - border-radius: 3px; -} - -#mocha .test h2 { - position: relative; -} - -#mocha .test a.replay { - position: absolute; - top: 3px; - right: 0; - text-decoration: none; - vertical-align: middle; - display: block; - width: 15px; - height: 15px; - line-height: 15px; - text-align: center; - background: #eee; - font-size: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - -webkit-transition: opacity 200ms; - -moz-transition: opacity 200ms; - transition: opacity 200ms; - opacity: 0.3; - color: #888; -} - -#mocha .test:hover a.replay { - opacity: 1; -} - -#mocha-report.pass .test.fail { - display: none; -} - -#mocha-report.fail .test.pass { - display: none; -} - -#mocha-report.pending .test.pass, -#mocha-report.pending .test.fail { - display: none; -} -#mocha-report.pending .test.pass.pending { - display: block; -} - -#mocha-error { - color: #c00; - font-size: 1.5em; - font-weight: 100; - letter-spacing: 1px; -} - -#mocha-stats { - position: fixed; - top: 15px; - right: 10px; - font-size: 12px; - margin: 0; - color: #888; - z-index: 1; -} - -#mocha-stats .progress { - float: right; - padding-top: 0; -} - -#mocha-stats em { - color: black; -} - -#mocha-stats a { - text-decoration: none; - color: inherit; -} - -#mocha-stats a:hover { - border-bottom: 1px solid #eee; -} - -#mocha-stats li { - display: inline-block; - margin: 0 5px; - list-style: none; - padding-top: 11px; -} - -#mocha-stats canvas { - width: 40px; - height: 40px; -} - -#mocha code .comment { color: #ddd; } -#mocha code .init { color: #2f6fad; } -#mocha code .string { color: #5890ad; } -#mocha code .keyword { color: #8a6343; } -#mocha code .number { color: #2f6fad; } - -@media screen and (max-device-width: 480px) { - #mocha { - margin: 60px 0px; - } - - #mocha #stats { - position: absolute; - } -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js deleted file mode 100644 index e8bee79b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js +++ /dev/null @@ -1,6095 +0,0 @@ -;(function(){ - -// CommonJS require() - -function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; - if (!mod) throw new Error('failed to require "' + p + '"'); - if (!mod.exports) { - mod.exports = {}; - mod.call(mod.exports, mod, mod.exports, require.relative(path)); - } - return mod.exports; - } - -require.modules = {}; - -require.resolve = function (path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; - }; - -require.register = function (path, fn){ - require.modules[path] = fn; - }; - -require.relative = function (parent) { - return function(p){ - if ('.' != p.charAt(0)) return require(p); - - var path = parent.split('/') - , segs = p.split('/'); - path.pop(); - - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; - if ('..' == seg) path.pop(); - else if ('.' != seg) path.push(seg); - } - - return require(path.join('/')); - }; - }; - - -require.register("browser/debug.js", function(module, exports, require){ - -module.exports = function(type){ - return function(){ - } -}; - -}); // module: browser/debug.js - -require.register("browser/diff.js", function(module, exports, require){ -/* See LICENSE file for terms of use */ - -/* - * Text diff implementation. - * - * This library supports the following APIS: - * JsDiff.diffChars: Character by character diff - * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace - * JsDiff.diffLines: Line based diff - * - * JsDiff.diffCss: Diff targeted at CSS content - * - * These methods are based on the implementation proposed in - * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). - * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 - */ -var JsDiff = (function() { - /*jshint maxparams: 5*/ - function clonePath(path) { - return { newPos: path.newPos, components: path.components.slice(0) }; - } - function removeEmpty(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - return ret; - } - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - - return n; - } - - var Diff = function(ignoreWhitespace) { - this.ignoreWhitespace = ignoreWhitespace; - }; - Diff.prototype = { - diff: function(oldString, newString) { - // Handle the identity case (this is due to unrolling editLength == 0 - if (newString === oldString) { - return [{ value: newString }]; - } - if (!newString) { - return [{ value: oldString, removed: true }]; - } - if (!oldString) { - return [{ value: newString, added: true }]; - } - - newString = this.tokenize(newString); - oldString = this.tokenize(oldString); - - var newLen = newString.length, oldLen = oldString.length; - var maxEditLength = newLen + oldLen; - var bestPath = [{ newPos: -1, components: [] }]; - - // Seed editLength = 0 - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { - return bestPath[0].components; - } - - for (var editLength = 1; editLength <= maxEditLength; editLength++) { - for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) { - var basePath; - var addPath = bestPath[diagonalPath-1], - removePath = bestPath[diagonalPath+1]; - oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath-1] = undefined; - } - - var canAdd = addPath && addPath.newPos+1 < newLen; - var canRemove = removePath && 0 <= oldPos && oldPos < oldLen; - if (!canAdd && !canRemove) { - bestPath[diagonalPath] = undefined; - continue; - } - - // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) { - basePath = clonePath(removePath); - this.pushComponent(basePath.components, oldString[oldPos], undefined, true); - } else { - basePath = clonePath(addPath); - basePath.newPos++; - this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); - } - - var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); - - if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { - return basePath.components; - } else { - bestPath[diagonalPath] = basePath; - } - } - } - }, - - pushComponent: function(components, value, added, removed) { - var last = components[components.length-1]; - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length-1] = - {value: this.join(last.value, value), added: added, removed: removed }; - } else { - components.push({value: value, added: added, removed: removed }); - } - }, - extractCommon: function(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath; - while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { - newPos++; - oldPos++; - - this.pushComponent(basePath.components, newString[newPos], undefined, undefined); - } - basePath.newPos = newPos; - return oldPos; - }, - - equals: function(left, right) { - var reWhitespace = /\S/; - if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { - return true; - } else { - return left === right; - } - }, - join: function(left, right) { - return left + right; - }, - tokenize: function(value) { - return value; - } - }; - - var CharDiff = new Diff(); - - var WordDiff = new Diff(true); - var WordWithSpaceDiff = new Diff(); - WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) { - return removeEmpty(value.split(/(\s+|\b)/)); - }; - - var CssDiff = new Diff(true); - CssDiff.tokenize = function(value) { - return removeEmpty(value.split(/([{}:;,]|\s+)/)); - }; - - var LineDiff = new Diff(); - LineDiff.tokenize = function(value) { - var retLines = [], - lines = value.split(/^/m); - - for(var i = 0; i < lines.length; i++) { - var line = lines[i], - lastLine = lines[i - 1]; - - // Merge lines that may contain windows new lines - if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') { - retLines[retLines.length - 1] += '\n'; - } else if (line) { - retLines.push(line); - } - } - - return retLines; - }; - - return { - Diff: Diff, - - diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); }, - diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); }, - diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); }, - diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); }, - - diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); }, - - createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { - var ret = []; - - ret.push('Index: ' + fileName); - ret.push('==================================================================='); - ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); - ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); - - var diff = LineDiff.diff(oldStr, newStr); - if (!diff[diff.length-1].value) { - diff.pop(); // Remove trailing newline add - } - diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function(entry) { return ' ' + entry; }); - } - function eofNL(curRange, i, current) { - var last = diff[diff.length-2], - isLast = i === diff.length-2, - isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed); - - // Figure out if this is the last line for the given file and missing NL - if (!/\n$/.test(current.value) && (isLast || isLastOfType)) { - curRange.push('\\ No newline at end of file'); - } - } - - var oldRangeStart = 0, newRangeStart = 0, curRange = [], - oldLine = 1, newLine = 1; - for (var i = 0; i < diff.length; i++) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - if (!oldRangeStart) { - var prev = diff[i-1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = contextLines(prev.lines.slice(-4)); - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } - curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; })); - eofNL(curRange, i, current); - - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= 8 && i < diff.length-2) { - // Overlapping - curRange.push.apply(curRange, contextLines(lines)); - } else { - // end the range and output - var contextSize = Math.min(lines.length, 4); - ret.push( - '@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize) - + ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize) - + ' @@'); - ret.push.apply(ret, curRange); - ret.push.apply(ret, contextLines(lines.slice(0, contextSize))); - if (lines.length <= 4) { - eofNL(ret, i, current); - } - - oldRangeStart = 0; newRangeStart = 0; curRange = []; - } - } - oldLine += lines.length; - newLine += lines.length; - } - } - - return ret.join('\n') + '\n'; - }, - - applyPatch: function(oldStr, uniDiff) { - var diffstr = uniDiff.split('\n'); - var diff = []; - var remEOFNL = false, - addEOFNL = false; - - for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { - if(diffstr[i][0] === '@') { - var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); - diff.unshift({ - start:meh[3], - oldlength:meh[2], - oldlines:[], - newlength:meh[4], - newlines:[] - }); - } else if(diffstr[i][0] === '+') { - diff[0].newlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === '-') { - diff[0].oldlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === ' ') { - diff[0].newlines.push(diffstr[i].substr(1)); - diff[0].oldlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === '\\') { - if (diffstr[i-1][0] === '+') { - remEOFNL = true; - } else if(diffstr[i-1][0] === '-') { - addEOFNL = true; - } - } - } - - var str = oldStr.split('\n'); - for (var i = diff.length - 1; i >= 0; i--) { - var d = diff[i]; - for (var j = 0; j < d.oldlength; j++) { - if(str[d.start-1+j] !== d.oldlines[j]) { - return false; - } - } - Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines)); - } - - if (remEOFNL) { - while (!str[str.length-1]) { - str.pop(); - } - } else if (addEOFNL) { - str.push(''); - } - return str.join('\n'); - }, - - convertChangesToXML: function(changes){ - var ret = []; - for ( var i = 0; i < changes.length; i++) { - var change = changes[i]; - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - - ret.push(escapeHTML(change.value)); - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - return ret.join(''); - }, - - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - convertChangesToDMP: function(changes){ - var ret = [], change; - for ( var i = 0; i < changes.length; i++) { - change = changes[i]; - ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); - } - return ret; - } - }; -})(); - -if (typeof module !== 'undefined') { - module.exports = JsDiff; -} - -}); // module: browser/diff.js - -require.register("browser/escape-string-regexp.js", function(module, exports, require){ -'use strict'; - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - return str.replace(matchOperatorsRe, '\\$&'); -}; - -}); // module: browser/escape-string-regexp.js - -require.register("browser/events.js", function(module, exports, require){ - -/** - * Module exports. - */ - -exports.EventEmitter = EventEmitter; - -/** - * Check if `obj` is an array. - */ - -function isArray(obj) { - return '[object Array]' == {}.toString.call(obj); -} - -/** - * Event emitter constructor. - * - * @api public - */ - -function EventEmitter(){}; - -/** - * Adds a listener. - * - * @api public - */ - -EventEmitter.prototype.on = function (name, fn) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = fn; - } else if (isArray(this.$events[name])) { - this.$events[name].push(fn); - } else { - this.$events[name] = [this.$events[name], fn]; - } - - return this; -}; - -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -/** - * Adds a volatile listener. - * - * @api public - */ - -EventEmitter.prototype.once = function (name, fn) { - var self = this; - - function on () { - self.removeListener(name, on); - fn.apply(this, arguments); - }; - - on.listener = fn; - this.on(name, on); - - return this; -}; - -/** - * Removes a listener. - * - * @api public - */ - -EventEmitter.prototype.removeListener = function (name, fn) { - if (this.$events && this.$events[name]) { - var list = this.$events[name]; - - if (isArray(list)) { - var pos = -1; - - for (var i = 0, l = list.length; i < l; i++) { - if (list[i] === fn || (list[i].listener && list[i].listener === fn)) { - pos = i; - break; - } - } - - if (pos < 0) { - return this; - } - - list.splice(pos, 1); - - if (!list.length) { - delete this.$events[name]; - } - } else if (list === fn || (list.listener && list.listener === fn)) { - delete this.$events[name]; - } - } - - return this; -}; - -/** - * Removes all listeners for an event. - * - * @api public - */ - -EventEmitter.prototype.removeAllListeners = function (name) { - if (name === undefined) { - this.$events = {}; - return this; - } - - if (this.$events && this.$events[name]) { - this.$events[name] = null; - } - - return this; -}; - -/** - * Gets all listeners for a certain event. - * - * @api public - */ - -EventEmitter.prototype.listeners = function (name) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = []; - } - - if (!isArray(this.$events[name])) { - this.$events[name] = [this.$events[name]]; - } - - return this.$events[name]; -}; - -/** - * Emits an event. - * - * @api public - */ - -EventEmitter.prototype.emit = function (name) { - if (!this.$events) { - return false; - } - - var handler = this.$events[name]; - - if (!handler) { - return false; - } - - var args = [].slice.call(arguments, 1); - - if ('function' == typeof handler) { - handler.apply(this, args); - } else if (isArray(handler)) { - var listeners = handler.slice(); - - for (var i = 0, l = listeners.length; i < l; i++) { - listeners[i].apply(this, args); - } - } else { - return false; - } - - return true; -}; -}); // module: browser/events.js - -require.register("browser/fs.js", function(module, exports, require){ - -}); // module: browser/fs.js - -require.register("browser/glob.js", function(module, exports, require){ - -}); // module: browser/glob.js - -require.register("browser/path.js", function(module, exports, require){ - -}); // module: browser/path.js - -require.register("browser/progress.js", function(module, exports, require){ -/** - * Expose `Progress`. - */ - -module.exports = Progress; - -/** - * Initialize a new `Progress` indicator. - */ - -function Progress() { - this.percent = 0; - this.size(0); - this.fontSize(11); - this.font('helvetica, arial, sans-serif'); -} - -/** - * Set progress size to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.size = function(n){ - this._size = n; - return this; -}; - -/** - * Set text to `str`. - * - * @param {String} str - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.text = function(str){ - this._text = str; - return this; -}; - -/** - * Set font size to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.fontSize = function(n){ - this._fontSize = n; - return this; -}; - -/** - * Set font `family`. - * - * @param {String} family - * @return {Progress} for chaining - */ - -Progress.prototype.font = function(family){ - this._font = family; - return this; -}; - -/** - * Update percentage to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - */ - -Progress.prototype.update = function(n){ - this.percent = n; - return this; -}; - -/** - * Draw on `ctx`. - * - * @param {CanvasRenderingContext2d} ctx - * @return {Progress} for chaining - */ - -Progress.prototype.draw = function(ctx){ - try { - var percent = Math.min(this.percent, 100) - , size = this._size - , half = size / 2 - , x = half - , y = half - , rad = half - 1 - , fontSize = this._fontSize; - - ctx.font = fontSize + 'px ' + this._font; - - var angle = Math.PI * 2 * (percent / 100); - ctx.clearRect(0, 0, size, size); - - // outer circle - ctx.strokeStyle = '#9f9f9f'; - ctx.beginPath(); - ctx.arc(x, y, rad, 0, angle, false); - ctx.stroke(); - - // inner circle - ctx.strokeStyle = '#eee'; - ctx.beginPath(); - ctx.arc(x, y, rad - 1, 0, angle, true); - ctx.stroke(); - - // text - var text = this._text || (percent | 0) + '%' - , w = ctx.measureText(text).width; - - ctx.fillText( - text - , x - w / 2 + 1 - , y + fontSize / 2 - 1); - } catch (ex) {} //don't fail if we can't render progress - return this; -}; - -}); // module: browser/progress.js - -require.register("browser/tty.js", function(module, exports, require){ - -exports.isatty = function(){ - return true; -}; - -exports.getWindowSize = function(){ - if ('innerHeight' in global) { - return [global.innerHeight, global.innerWidth]; - } else { - // In a Web Worker, the DOM Window is not available. - return [640, 480]; - } -}; - -}); // module: browser/tty.js - -require.register("context.js", function(module, exports, require){ - -/** - * Expose `Context`. - */ - -module.exports = Context; - -/** - * Initialize a new `Context`. - * - * @api private - */ - -function Context(){} - -/** - * Set or get the context `Runnable` to `runnable`. - * - * @param {Runnable} runnable - * @return {Context} - * @api private - */ - -Context.prototype.runnable = function(runnable){ - if (0 == arguments.length) return this._runnable; - this.test = this._runnable = runnable; - return this; -}; - -/** - * Set test timeout `ms`. - * - * @param {Number} ms - * @return {Context} self - * @api private - */ - -Context.prototype.timeout = function(ms){ - if (arguments.length === 0) return this.runnable().timeout(); - this.runnable().timeout(ms); - return this; -}; - -/** - * Set test timeout `enabled`. - * - * @param {Boolean} enabled - * @return {Context} self - * @api private - */ - -Context.prototype.enableTimeouts = function (enabled) { - this.runnable().enableTimeouts(enabled); - return this; -}; - - -/** - * Set test slowness threshold `ms`. - * - * @param {Number} ms - * @return {Context} self - * @api private - */ - -Context.prototype.slow = function(ms){ - this.runnable().slow(ms); - return this; -}; - -/** - * Inspect the context void of `._runnable`. - * - * @return {String} - * @api private - */ - -Context.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_runnable' == key) return; - if ('test' == key) return; - return val; - }, 2); -}; - -}); // module: context.js - -require.register("hook.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); - -/** - * Expose `Hook`. - */ - -module.exports = Hook; - -/** - * Initialize a new `Hook` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Hook(title, fn) { - Runnable.call(this, title, fn); - this.type = 'hook'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -function F(){}; -F.prototype = Runnable.prototype; -Hook.prototype = new F; -Hook.prototype.constructor = Hook; - - -/** - * Get or set the test `err`. - * - * @param {Error} err - * @return {Error} - * @api public - */ - -Hook.prototype.error = function(err){ - if (0 == arguments.length) { - var err = this._error; - this._error = null; - return err; - } - - this._error = err; -}; - -}); // module: hook.js - -require.register("interfaces/bdd.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils') - , escapeRe = require('browser/escape-string-regexp'); - -/** - * BDD-style interface: - * - * describe('Array', function(){ - * describe('#indexOf()', function(){ - * it('should return -1 when not present', function(){ - * - * }); - * - * it('should return the index when present', function(){ - * - * }); - * }); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Describe a "suite" with the given `title` - * and callback `fn` containing nested suites - * and/or tests. - */ - - context.describe = context.context = function(title, fn){ - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; - - /** - * Pending describe. - */ - - context.xdescribe = - context.xcontext = - context.describe.skip = function(title, fn){ - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** - * Exclusive suite. - */ - - context.describe.only = function(title, fn){ - var suite = context.describe(title, fn); - mocha.grep(suite.fullTitle()); - return suite; - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.it = context.specify = function(title, fn){ - var suite = suites[0]; - if (suite.pending) fn = null; - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.it.only = function(title, fn){ - var test = context.it(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - return test; - }; - - /** - * Pending test case. - */ - - context.xit = - context.xspecify = - context.it.skip = function(title){ - context.it(title); - }; - }); -}; - -}); // module: interfaces/bdd.js - -require.register("interfaces/exports.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test'); - -/** - * TDD-style interface: - * - * exports.Array = { - * '#indexOf()': { - * 'should return -1 when the value is not present': function(){ - * - * }, - * - * 'should return the correct index when the value is present': function(){ - * - * } - * } - * }; - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('require', visit); - - function visit(obj, file) { - var suite; - for (var key in obj) { - if ('function' == typeof obj[key]) { - var fn = obj[key]; - switch (key) { - case 'before': - suites[0].beforeAll(fn); - break; - case 'after': - suites[0].afterAll(fn); - break; - case 'beforeEach': - suites[0].beforeEach(fn); - break; - case 'afterEach': - suites[0].afterEach(fn); - break; - default: - var test = new Test(key, fn); - test.file = file; - suites[0].addTest(test); - } - } else { - suite = Suite.create(suites[0], key); - suites.unshift(suite); - visit(obj[key]); - suites.shift(); - } - } - } -}; - -}); // module: interfaces/exports.js - -require.register("interfaces/index.js", function(module, exports, require){ - -exports.bdd = require('./bdd'); -exports.tdd = require('./tdd'); -exports.qunit = require('./qunit'); -exports.exports = require('./exports'); - -}); // module: interfaces/index.js - -require.register("interfaces/qunit.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test') - , escapeRe = require('browser/escape-string-regexp') - , utils = require('../utils'); - -/** - * QUnit-style interface: - * - * suite('Array'); - * - * test('#length', function(){ - * var arr = [1,2,3]; - * ok(arr.length == 3); - * }); - * - * test('#indexOf()', function(){ - * var arr = [1,2,3]; - * ok(arr.indexOf(1) == 0); - * ok(arr.indexOf(2) == 1); - * ok(arr.indexOf(3) == 2); - * }); - * - * suite('String'); - * - * test('#length', function(){ - * ok('foo'.length == 3); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Describe a "suite" with the given `title`. - */ - - context.suite = function(title){ - if (suites.length > 1) suites.shift(); - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - return suite; - }; - - /** - * Exclusive test-case. - */ - - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn){ - var test = new Test(title, fn); - test.file = file; - suites[0].addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - /** - * Pending test case. - */ - - context.test.skip = function(title){ - context.test(title); - }; - }); -}; - -}); // module: interfaces/qunit.js - -require.register("interfaces/tdd.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test') - , escapeRe = require('browser/escape-string-regexp') - , utils = require('../utils'); - -/** - * TDD-style interface: - * - * suite('Array', function(){ - * suite('#indexOf()', function(){ - * suiteSetup(function(){ - * - * }); - * - * test('should return -1 when not present', function(){ - * - * }); - * - * test('should return the index when present', function(){ - * - * }); - * - * suiteTeardown(function(){ - * - * }); - * }); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before each test case. - */ - - context.setup = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.teardown = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Execute before the suite. - */ - - context.suiteSetup = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after the suite. - */ - - context.suiteTeardown = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Describe a "suite" with the given `title` - * and callback `fn` containing nested suites - * and/or tests. - */ - - context.suite = function(title, fn){ - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; - - /** - * Pending suite. - */ - context.suite.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** - * Exclusive test-case. - */ - - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn){ - var suite = suites[0]; - if (suite.pending) fn = null; - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - /** - * Pending test case. - */ - - context.test.skip = function(title){ - context.test(title); - }; - }); -}; - -}); // module: interfaces/tdd.js - -require.register("mocha.js", function(module, exports, require){ -/*! - * mocha - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var path = require('browser/path') - , escapeRe = require('browser/escape-string-regexp') - , utils = require('./utils'); - -/** - * Expose `Mocha`. - */ - -exports = module.exports = Mocha; - -/** - * To require local UIs and reporters when running in node. - */ - -if (typeof process !== 'undefined' && typeof process.cwd === 'function') { - var join = path.join - , cwd = process.cwd(); - module.paths.push(cwd, join(cwd, 'node_modules')); -} - -/** - * Expose internals. - */ - -exports.utils = utils; -exports.interfaces = require('./interfaces'); -exports.reporters = require('./reporters'); -exports.Runnable = require('./runnable'); -exports.Context = require('./context'); -exports.Runner = require('./runner'); -exports.Suite = require('./suite'); -exports.Hook = require('./hook'); -exports.Test = require('./test'); - -/** - * Return image `name` path. - * - * @param {String} name - * @return {String} - * @api private - */ - -function image(name) { - return __dirname + '/../images/' + name + '.png'; -} - -/** - * Setup mocha with `options`. - * - * Options: - * - * - `ui` name "bdd", "tdd", "exports" etc - * - `reporter` reporter instance, defaults to `mocha.reporters.spec` - * - `globals` array of accepted globals - * - `timeout` timeout in milliseconds - * - `bail` bail on the first test failure - * - `slow` milliseconds to wait before considering a test slow - * - `ignoreLeaks` ignore global leaks - * - `grep` string or regexp to filter tests with - * - * @param {Object} options - * @api public - */ - -function Mocha(options) { - options = options || {}; - this.files = []; - this.options = options; - this.grep(options.grep); - this.suite = new exports.Suite('', new exports.Context); - this.ui(options.ui); - this.bail(options.bail); - this.reporter(options.reporter); - if (null != options.timeout) this.timeout(options.timeout); - this.useColors(options.useColors) - if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts); - if (options.slow) this.slow(options.slow); - - this.suite.on('pre-require', function (context) { - exports.afterEach = context.afterEach || context.teardown; - exports.after = context.after || context.suiteTeardown; - exports.beforeEach = context.beforeEach || context.setup; - exports.before = context.before || context.suiteSetup; - exports.describe = context.describe || context.suite; - exports.it = context.it || context.test; - exports.setup = context.setup || context.beforeEach; - exports.suiteSetup = context.suiteSetup || context.before; - exports.suiteTeardown = context.suiteTeardown || context.after; - exports.suite = context.suite || context.describe; - exports.teardown = context.teardown || context.afterEach; - exports.test = context.test || context.it; - }); -} - -/** - * Enable or disable bailing on the first failure. - * - * @param {Boolean} [bail] - * @api public - */ - -Mocha.prototype.bail = function(bail){ - if (0 == arguments.length) bail = true; - this.suite.bail(bail); - return this; -}; - -/** - * Add test `file`. - * - * @param {String} file - * @api public - */ - -Mocha.prototype.addFile = function(file){ - this.files.push(file); - return this; -}; - -/** - * Set reporter to `reporter`, defaults to "spec". - * - * @param {String|Function} reporter name or constructor - * @api public - */ - -Mocha.prototype.reporter = function(reporter){ - if ('function' == typeof reporter) { - this._reporter = reporter; - } else { - reporter = reporter || 'spec'; - var _reporter; - try { _reporter = require('./reporters/' + reporter); } catch (err) {}; - if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; - if (!_reporter && reporter === 'teamcity') - console.warn('The Teamcity reporter was moved to a package named ' + - 'mocha-teamcity-reporter ' + - '(https://npmjs.org/package/mocha-teamcity-reporter).'); - if (!_reporter) throw new Error('invalid reporter "' + reporter + '"'); - this._reporter = _reporter; - } - return this; -}; - -/** - * Set test UI `name`, defaults to "bdd". - * - * @param {String} bdd - * @api public - */ - -Mocha.prototype.ui = function(name){ - name = name || 'bdd'; - this._ui = exports.interfaces[name]; - if (!this._ui) try { this._ui = require(name); } catch (err) {}; - if (!this._ui) throw new Error('invalid interface "' + name + '"'); - this._ui = this._ui(this.suite); - return this; -}; - -/** - * Load registered files. - * - * @api private - */ - -Mocha.prototype.loadFiles = function(fn){ - var self = this; - var suite = this.suite; - var pending = this.files.length; - this.files.forEach(function(file){ - file = path.resolve(file); - suite.emit('pre-require', global, file, self); - suite.emit('require', require(file), file, self); - suite.emit('post-require', global, file, self); - --pending || (fn && fn()); - }); -}; - -/** - * Enable growl support. - * - * @api private - */ - -Mocha.prototype._growl = function(runner, reporter) { - var notify = require('growl'); - - runner.on('end', function(){ - var stats = reporter.stats; - if (stats.failures) { - var msg = stats.failures + ' of ' + runner.total + ' tests failed'; - notify(msg, { name: 'mocha', title: 'Failed', image: image('error') }); - } else { - notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { - name: 'mocha' - , title: 'Passed' - , image: image('ok') - }); - } - }); -}; - -/** - * Add regexp to grep, if `re` is a string it is escaped. - * - * @param {RegExp|String} re - * @return {Mocha} - * @api public - */ - -Mocha.prototype.grep = function(re){ - this.options.grep = 'string' == typeof re - ? new RegExp(escapeRe(re)) - : re; - return this; -}; - -/** - * Invert `.grep()` matches. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.invert = function(){ - this.options.invert = true; - return this; -}; - -/** - * Ignore global leaks. - * - * @param {Boolean} ignore - * @return {Mocha} - * @api public - */ - -Mocha.prototype.ignoreLeaks = function(ignore){ - this.options.ignoreLeaks = !!ignore; - return this; -}; - -/** - * Enable global leak checking. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.checkLeaks = function(){ - this.options.ignoreLeaks = false; - return this; -}; - -/** - * Enable growl support. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.growl = function(){ - this.options.growl = true; - return this; -}; - -/** - * Ignore `globals` array or string. - * - * @param {Array|String} globals - * @return {Mocha} - * @api public - */ - -Mocha.prototype.globals = function(globals){ - this.options.globals = (this.options.globals || []).concat(globals); - return this; -}; - -/** - * Emit color output. - * - * @param {Boolean} colors - * @return {Mocha} - * @api public - */ - -Mocha.prototype.useColors = function(colors){ - this.options.useColors = arguments.length && colors != undefined - ? colors - : true; - return this; -}; - -/** - * Use inline diffs rather than +/-. - * - * @param {Boolean} inlineDiffs - * @return {Mocha} - * @api public - */ - -Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined - ? inlineDiffs - : false; - return this; -}; - -/** - * Set the timeout in milliseconds. - * - * @param {Number} timeout - * @return {Mocha} - * @api public - */ - -Mocha.prototype.timeout = function(timeout){ - this.suite.timeout(timeout); - return this; -}; - -/** - * Set slowness threshold in milliseconds. - * - * @param {Number} slow - * @return {Mocha} - * @api public - */ - -Mocha.prototype.slow = function(slow){ - this.suite.slow(slow); - return this; -}; - -/** - * Enable timeouts. - * - * @param {Boolean} enabled - * @return {Mocha} - * @api public - */ - -Mocha.prototype.enableTimeouts = function(enabled) { - this.suite.enableTimeouts(arguments.length && enabled !== undefined - ? enabled - : true); - return this -}; - -/** - * Makes all tests async (accepting a callback) - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.asyncOnly = function(){ - this.options.asyncOnly = true; - return this; -}; - -/** - * Disable syntax highlighting (in browser). - * @returns {Mocha} - * @api public - */ -Mocha.prototype.noHighlighting = function() { - this.options.noHighlighting = true; - return this; -}; - -/** - * Run tests and invoke `fn()` when complete. - * - * @param {Function} fn - * @return {Runner} - * @api public - */ - -Mocha.prototype.run = function(fn){ - if (this.files.length) this.loadFiles(); - var suite = this.suite; - var options = this.options; - options.files = this.files; - var runner = new exports.Runner(suite); - var reporter = new this._reporter(runner, options); - runner.ignoreLeaks = false !== options.ignoreLeaks; - runner.asyncOnly = options.asyncOnly; - if (options.grep) runner.grep(options.grep, options.invert); - if (options.globals) runner.globals(options.globals); - if (options.growl) this._growl(runner, reporter); - exports.reporters.Base.useColors = options.useColors; - exports.reporters.Base.inlineDiffs = options.useInlineDiffs; - return runner.run(fn); -}; - -}); // module: mocha.js - -require.register("ms.js", function(module, exports, require){ -/** - * 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'] ? longFormat(val) : shortFormat(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 shortFormat(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 longFormat(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'; -} - -}); // module: ms.js - -require.register("reporters/base.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var tty = require('browser/tty') - , diff = require('browser/diff') - , ms = require('../ms') - , utils = require('../utils'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Check if both stdio streams are associated with a tty. - */ - -var isatty = tty.isatty(1) && tty.isatty(2); - -/** - * Expose `Base`. - */ - -exports = module.exports = Base; - -/** - * Enable coloring by default. - */ - -exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); - -/** - * Inline diffs instead of +/- - */ - -exports.inlineDiffs = false; - -/** - * Default color map. - */ - -exports.colors = { - 'pass': 90 - , 'fail': 31 - , 'bright pass': 92 - , 'bright fail': 91 - , 'bright yellow': 93 - , 'pending': 36 - , 'suite': 0 - , 'error title': 0 - , 'error message': 31 - , 'error stack': 90 - , 'checkmark': 32 - , 'fast': 90 - , 'medium': 33 - , 'slow': 31 - , 'green': 32 - , 'light': 90 - , 'diff gutter': 90 - , 'diff added': 42 - , 'diff removed': 41 -}; - -/** - * Default symbol map. - */ - -exports.symbols = { - ok: '✓', - err: '✖', - dot: '․' -}; - -// With node.js on Windows: use symbols available in terminal default fonts -if ('win32' == process.platform) { - exports.symbols.ok = '\u221A'; - exports.symbols.err = '\u00D7'; - exports.symbols.dot = '.'; -} - -/** - * Color `str` with the given `type`, - * allowing colors to be disabled, - * as well as user-defined color - * schemes. - * - * @param {String} type - * @param {String} str - * @return {String} - * @api private - */ - -var color = exports.color = function(type, str) { - if (!exports.useColors) return str; - return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; -}; - -/** - * Expose term window size, with some - * defaults for when stderr is not a tty. - */ - -exports.window = { - width: isatty - ? process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1] - : 75 -}; - -/** - * Expose some basic cursor interactions - * that are common among reporters. - */ - -exports.cursor = { - hide: function(){ - isatty && process.stdout.write('\u001b[?25l'); - }, - - show: function(){ - isatty && process.stdout.write('\u001b[?25h'); - }, - - deleteLine: function(){ - isatty && process.stdout.write('\u001b[2K'); - }, - - beginningOfLine: function(){ - isatty && process.stdout.write('\u001b[0G'); - }, - - CR: function(){ - if (isatty) { - exports.cursor.deleteLine(); - exports.cursor.beginningOfLine(); - } else { - process.stdout.write('\r'); - } - } -}; - -/** - * Outut the given `failures` as a list. - * - * @param {Array} failures - * @api public - */ - -exports.list = function(failures){ - console.error(); - failures.forEach(function(test, i){ - // format - var fmt = color('error title', ' %s) %s:\n') - + color('error message', ' %s') - + color('error stack', '\n%s\n'); - - // msg - var err = test.err - , message = err.message || '' - , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) - , actual = err.actual - , expected = err.expected - , escape = true; - - // uncaught - if (err.uncaught) { - msg = 'Uncaught ' + msg; - } - - // explicitly show diff - if (err.showDiff && sameType(actual, expected)) { - escape = false; - err.actual = actual = utils.stringify(actual); - err.expected = expected = utils.stringify(expected); - } - - // actual / expected diff - if (err.showDiff && 'string' == typeof actual && 'string' == typeof expected) { - fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); - var match = message.match(/^([^:]+): expected/); - msg = '\n ' + color('error message', match ? match[1] : msg); - - if (exports.inlineDiffs) { - msg += inlineDiff(err, escape); - } else { - msg += unifiedDiff(err, escape); - } - } - - // indent stack trace without msg - stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); - - console.error(fmt, (i + 1), test.fullTitle(), msg, stack); - }); -}; - -/** - * Initialize a new `Base` reporter. - * - * All other reporters generally - * inherit from this reporter, providing - * stats such as test duration, number - * of tests passed / failed etc. - * - * @param {Runner} runner - * @api public - */ - -function Base(runner) { - var self = this - , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } - , failures = this.failures = []; - - if (!runner) return; - this.runner = runner; - - runner.stats = stats; - - runner.on('start', function(){ - stats.start = new Date; - }); - - runner.on('suite', function(suite){ - stats.suites = stats.suites || 0; - suite.root || stats.suites++; - }); - - runner.on('test end', function(test){ - stats.tests = stats.tests || 0; - stats.tests++; - }); - - runner.on('pass', function(test){ - stats.passes = stats.passes || 0; - - var medium = test.slow() / 2; - test.speed = test.duration > test.slow() - ? 'slow' - : test.duration > medium - ? 'medium' - : 'fast'; - - stats.passes++; - }); - - runner.on('fail', function(test, err){ - stats.failures = stats.failures || 0; - stats.failures++; - test.err = err; - failures.push(test); - }); - - runner.on('end', function(){ - stats.end = new Date; - stats.duration = new Date - stats.start; - }); - - runner.on('pending', function(){ - stats.pending++; - }); -} - -/** - * Output common epilogue used by many of - * the bundled reporters. - * - * @api public - */ - -Base.prototype.epilogue = function(){ - var stats = this.stats; - var tests; - var fmt; - - console.log(); - - // passes - fmt = color('bright pass', ' ') - + color('green', ' %d passing') - + color('light', ' (%s)'); - - console.log(fmt, - stats.passes || 0, - ms(stats.duration)); - - // pending - if (stats.pending) { - fmt = color('pending', ' ') - + color('pending', ' %d pending'); - - console.log(fmt, stats.pending); - } - - // failures - if (stats.failures) { - fmt = color('fail', ' %d failing'); - - console.error(fmt, - stats.failures); - - Base.list(this.failures); - console.error(); - } - - console.log(); -}; - -/** - * Pad the given `str` to `len`. - * - * @param {String} str - * @param {String} len - * @return {String} - * @api private - */ - -function pad(str, len) { - str = String(str); - return Array(len - str.length + 1).join(' ') + str; -} - - -/** - * Returns an inline diff between 2 strings with coloured ANSI output - * - * @param {Error} Error with actual/expected - * @return {String} Diff - * @api private - */ - -function inlineDiff(err, escape) { - var msg = errorDiff(err, 'WordsWithSpace', escape); - - // linenos - var lines = msg.split('\n'); - if (lines.length > 4) { - var width = String(lines.length).length; - msg = lines.map(function(str, i){ - return pad(++i, width) + ' |' + ' ' + str; - }).join('\n'); - } - - // legend - msg = '\n' - + color('diff removed', 'actual') - + ' ' - + color('diff added', 'expected') - + '\n\n' - + msg - + '\n'; - - // indent - msg = msg.replace(/^/gm, ' '); - return msg; -} - -/** - * Returns a unified diff between 2 strings - * - * @param {Error} Error with actual/expected - * @return {String} Diff - * @api private - */ - -function unifiedDiff(err, escape) { - var indent = ' '; - function cleanUp(line) { - if (escape) { - line = escapeInvisibles(line); - } - if (line[0] === '+') return indent + colorLines('diff added', line); - if (line[0] === '-') return indent + colorLines('diff removed', line); - if (line.match(/\@\@/)) return null; - if (line.match(/\\ No newline/)) return null; - else return indent + line; - } - function notBlank(line) { - return line != null; - } - msg = diff.createPatch('string', err.actual, err.expected); - var lines = msg.split('\n').splice(4); - return '\n ' - + colorLines('diff added', '+ expected') + ' ' - + colorLines('diff removed', '- actual') - + '\n\n' - + lines.map(cleanUp).filter(notBlank).join('\n'); -} - -/** - * Return a character diff for `err`. - * - * @param {Error} err - * @return {String} - * @api private - */ - -function errorDiff(err, type, escape) { - var actual = escape ? escapeInvisibles(err.actual) : err.actual; - var expected = escape ? escapeInvisibles(err.expected) : err.expected; - return diff['diff' + type](actual, expected).map(function(str){ - if (str.added) return colorLines('diff added', str.value); - if (str.removed) return colorLines('diff removed', str.value); - return str.value; - }).join(''); -} - -/** - * Returns a string with all invisible characters in plain text - * - * @param {String} line - * @return {String} - * @api private - */ -function escapeInvisibles(line) { - return line.replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); -} - -/** - * Color lines for `str`, using the color `name`. - * - * @param {String} name - * @param {String} str - * @return {String} - * @api private - */ - -function colorLines(name, str) { - return str.split('\n').map(function(str){ - return color(name, str); - }).join('\n'); -} - -/** - * Check that a / b have the same type. - * - * @param {Object} a - * @param {Object} b - * @return {Boolean} - * @api private - */ - -function sameType(a, b) { - a = Object.prototype.toString.call(a); - b = Object.prototype.toString.call(b); - return a == b; -} - -}); // module: reporters/base.js - -require.register("reporters/doc.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils'); - -/** - * Expose `Doc`. - */ - -exports = module.exports = Doc; - -/** - * Initialize a new `Doc` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Doc(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , indents = 2; - - function indent() { - return Array(indents).join(' '); - } - - runner.on('suite', function(suite){ - if (suite.root) return; - ++indents; - console.log('%s
    ', indent()); - ++indents; - console.log('%s

    %s

    ', indent(), utils.escape(suite.title)); - console.log('%s
    ', indent()); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - console.log('%s
    ', indent()); - --indents; - console.log('%s
    ', indent()); - --indents; - }); - - runner.on('pass', function(test){ - console.log('%s
    %s
    ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
    %s
    ', indent(), code); - }); - - runner.on('fail', function(test, err){ - console.log('%s
    %s
    ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
    %s
    ', indent(), code); - console.log('%s
    %s
    ', indent(), utils.escape(err)); - }); -} - -}); // module: reporters/doc.js - -require.register("reporters/dot.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = Dot; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function Dot(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , n = -1; - - runner.on('start', function(){ - process.stdout.write('\n '); - }); - - runner.on('pending', function(test){ - if (++n % width == 0) process.stdout.write('\n '); - process.stdout.write(color('pending', Base.symbols.dot)); - }); - - runner.on('pass', function(test){ - if (++n % width == 0) process.stdout.write('\n '); - if ('slow' == test.speed) { - process.stdout.write(color('bright yellow', Base.symbols.dot)); - } else { - process.stdout.write(color(test.speed, Base.symbols.dot)); - } - }); - - runner.on('fail', function(test, err){ - if (++n % width == 0) process.stdout.write('\n '); - process.stdout.write(color('fail', Base.symbols.dot)); - }); - - runner.on('end', function(){ - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Dot.prototype = new F; -Dot.prototype.constructor = Dot; - - -}); // module: reporters/dot.js - -require.register("reporters/html-cov.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var JSONCov = require('./json-cov') - , fs = require('browser/fs'); - -/** - * Expose `HTMLCov`. - */ - -exports = module.exports = HTMLCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @param {Runner} runner - * @api public - */ - -function HTMLCov(runner) { - var jade = require('jade') - , file = __dirname + '/templates/coverage.jade' - , str = fs.readFileSync(file, 'utf8') - , fn = jade.compile(str, { filename: file }) - , self = this; - - JSONCov.call(this, runner, false); - - runner.on('end', function(){ - process.stdout.write(fn({ - cov: self.cov - , coverageClass: coverageClass - })); - }); -} - -/** - * Return coverage class for `n`. - * - * @return {String} - * @api private - */ - -function coverageClass(n) { - if (n >= 75) return 'high'; - if (n >= 50) return 'medium'; - if (n >= 25) return 'low'; - return 'terrible'; -} -}); // module: reporters/html-cov.js - -require.register("reporters/html.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils') - , Progress = require('../browser/progress') - , escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Expose `HTML`. - */ - -exports = module.exports = HTML; - -/** - * Stats template. - */ - -var statsTemplate = ''; - -/** - * Initialize a new `HTML` reporter. - * - * @param {Runner} runner - * @api public - */ - -function HTML(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , stat = fragment(statsTemplate) - , items = stat.getElementsByTagName('li') - , passes = items[1].getElementsByTagName('em')[0] - , passesLink = items[1].getElementsByTagName('a')[0] - , failures = items[2].getElementsByTagName('em')[0] - , failuresLink = items[2].getElementsByTagName('a')[0] - , duration = items[3].getElementsByTagName('em')[0] - , canvas = stat.getElementsByTagName('canvas')[0] - , report = fragment('
      ') - , stack = [report] - , progress - , ctx - , root = document.getElementById('mocha'); - - if (canvas.getContext) { - var ratio = window.devicePixelRatio || 1; - canvas.style.width = canvas.width; - canvas.style.height = canvas.height; - canvas.width *= ratio; - canvas.height *= ratio; - ctx = canvas.getContext('2d'); - ctx.scale(ratio, ratio); - progress = new Progress; - } - - if (!root) return error('#mocha div missing, add it to your document'); - - // pass toggle - on(passesLink, 'click', function(){ - unhide(); - var name = /pass/.test(report.className) ? '' : ' pass'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) hideSuitesWithout('test pass'); - }); - - // failure toggle - on(failuresLink, 'click', function(){ - unhide(); - var name = /fail/.test(report.className) ? '' : ' fail'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) hideSuitesWithout('test fail'); - }); - - root.appendChild(stat); - root.appendChild(report); - - if (progress) progress.size(40); - - runner.on('suite', function(suite){ - if (suite.root) return; - - // suite - var url = self.suiteURL(suite); - var el = fragment('
    • %s

    • ', url, escape(suite.title)); - - // container - stack[0].appendChild(el); - stack.unshift(document.createElement('ul')); - el.appendChild(stack[0]); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - stack.shift(); - }); - - runner.on('fail', function(test, err){ - if ('hook' == test.type) runner.emit('test end', test); - }); - - runner.on('test end', function(test){ - // TODO: add to stats - var percent = stats.tests / this.total * 100 | 0; - if (progress) progress.update(percent).draw(ctx); - - // update stats - var ms = new Date - stats.start; - text(passes, stats.passes); - text(failures, stats.failures); - text(duration, (ms / 1000).toFixed(2)); - - // test - if ('passed' == test.state) { - var url = self.testURL(test); - var el = fragment('
    • %e%ems

    • ', test.speed, test.title, test.duration, url); - } else if (test.pending) { - var el = fragment('
    • %e

    • ', test.title); - } else { - var el = fragment('
    • %e

    • ', test.title, encodeURIComponent(test.fullTitle())); - var str = test.err.stack || test.err.toString(); - - // FF / Opera do not add the message - if (!~str.indexOf(test.err.message)) { - str = test.err.message + '\n' + str; - } - - // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we - // check for the result of the stringifying. - if ('[object Error]' == str) str = test.err.message; - - // Safari doesn't give you a stack. Let's at least provide a source line. - if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { - str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; - } - - el.appendChild(fragment('
      %e
      ', str)); - } - - // toggle code - // TODO: defer - if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; - - on(h2, 'click', function(){ - pre.style.display = 'none' == pre.style.display - ? 'block' - : 'none'; - }); - - var pre = fragment('
      %e
      ', utils.clean(test.fn.toString())); - el.appendChild(pre); - pre.style.display = 'none'; - } - - // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. - if (stack[0]) stack[0].appendChild(el); - }); -} - -/** - * Provide suite URL - * - * @param {Object} [suite] - */ - -HTML.prototype.suiteURL = function(suite){ - return '?grep=' + encodeURIComponent(suite.fullTitle()); -}; - -/** - * Provide test URL - * - * @param {Object} [test] - */ - -HTML.prototype.testURL = function(test){ - return '?grep=' + encodeURIComponent(test.fullTitle()); -}; - -/** - * Display error `msg`. - */ - -function error(msg) { - document.body.appendChild(fragment('
      %s
      ', msg)); -} - -/** - * Return a DOM fragment from `html`. - */ - -function fragment(html) { - var args = arguments - , div = document.createElement('div') - , i = 1; - - div.innerHTML = html.replace(/%([se])/g, function(_, type){ - switch (type) { - case 's': return String(args[i++]); - case 'e': return escape(args[i++]); - } - }); - - return div.firstChild; -} - -/** - * Check for suites that do not have elements - * with `classname`, and hide them. - */ - -function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); - if (0 == els.length) suites[i].className += ' hidden'; - } -} - -/** - * Unhide .hidden suites. - */ - -function unhide() { - var els = document.getElementsByClassName('suite hidden'); - for (var i = 0; i < els.length; ++i) { - els[i].className = els[i].className.replace('suite hidden', 'suite'); - } -} - -/** - * Set `el` text to `str`. - */ - -function text(el, str) { - if (el.textContent) { - el.textContent = str; - } else { - el.innerText = str; - } -} - -/** - * Listen on `event` with callback `fn`. - */ - -function on(el, event, fn) { - if (el.addEventListener) { - el.addEventListener(event, fn, false); - } else { - el.attachEvent('on' + event, fn); - } -} - -}); // module: reporters/html.js - -require.register("reporters/index.js", function(module, exports, require){ - -exports.Base = require('./base'); -exports.Dot = require('./dot'); -exports.Doc = require('./doc'); -exports.TAP = require('./tap'); -exports.JSON = require('./json'); -exports.HTML = require('./html'); -exports.List = require('./list'); -exports.Min = require('./min'); -exports.Spec = require('./spec'); -exports.Nyan = require('./nyan'); -exports.XUnit = require('./xunit'); -exports.Markdown = require('./markdown'); -exports.Progress = require('./progress'); -exports.Landing = require('./landing'); -exports.JSONCov = require('./json-cov'); -exports.HTMLCov = require('./html-cov'); -exports.JSONStream = require('./json-stream'); - -}); // module: reporters/index.js - -require.register("reporters/json-cov.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `JSONCov`. - */ - -exports = module.exports = JSONCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @param {Runner} runner - * @param {Boolean} output - * @api public - */ - -function JSONCov(runner, output) { - var self = this - , output = 1 == arguments.length ? true : output; - - Base.call(this, runner); - - var tests = [] - , failures = [] - , passes = []; - - runner.on('test end', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - passes.push(test); - }); - - runner.on('fail', function(test){ - failures.push(test); - }); - - runner.on('end', function(){ - var cov = global._$jscoverage || {}; - var result = self.cov = map(cov); - result.stats = self.stats; - result.tests = tests.map(clean); - result.failures = failures.map(clean); - result.passes = passes.map(clean); - if (!output) return; - process.stdout.write(JSON.stringify(result, null, 2 )); - }); -} - -/** - * Map jscoverage data to a JSON structure - * suitable for reporting. - * - * @param {Object} cov - * @return {Object} - * @api private - */ - -function map(cov) { - var ret = { - instrumentation: 'node-jscoverage' - , sloc: 0 - , hits: 0 - , misses: 0 - , coverage: 0 - , files: [] - }; - - for (var filename in cov) { - var data = coverage(filename, cov[filename]); - ret.files.push(data); - ret.hits += data.hits; - ret.misses += data.misses; - ret.sloc += data.sloc; - } - - ret.files.sort(function(a, b) { - return a.filename.localeCompare(b.filename); - }); - - if (ret.sloc > 0) { - ret.coverage = (ret.hits / ret.sloc) * 100; - } - - return ret; -} - -/** - * Map jscoverage data for a single source file - * to a JSON structure suitable for reporting. - * - * @param {String} filename name of the source file - * @param {Object} data jscoverage coverage data - * @return {Object} - * @api private - */ - -function coverage(filename, data) { - var ret = { - filename: filename, - coverage: 0, - hits: 0, - misses: 0, - sloc: 0, - source: {} - }; - - data.source.forEach(function(line, num){ - num++; - - if (data[num] === 0) { - ret.misses++; - ret.sloc++; - } else if (data[num] !== undefined) { - ret.hits++; - ret.sloc++; - } - - ret.source[num] = { - source: line - , coverage: data[num] === undefined - ? '' - : data[num] - }; - }); - - ret.coverage = ret.hits / ret.sloc * 100; - - return ret; -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} - -}); // module: reporters/json-cov.js - -require.register("reporters/json-stream.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function List(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total; - - runner.on('start', function(){ - console.log(JSON.stringify(['start', { total: total }])); - }); - - runner.on('pass', function(test){ - console.log(JSON.stringify(['pass', clean(test)])); - }); - - runner.on('fail', function(test, err){ - console.log(JSON.stringify(['fail', clean(test)])); - }); - - runner.on('end', function(){ - process.stdout.write(JSON.stringify(['end', self.stats])); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json-stream.js - -require.register("reporters/json.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `JSON`. - */ - -exports = module.exports = JSONReporter; - -/** - * Initialize a new `JSON` reporter. - * - * @param {Runner} runner - * @api public - */ - -function JSONReporter(runner) { - var self = this; - Base.call(this, runner); - - var tests = [] - , pending = [] - , failures = [] - , passes = []; - - runner.on('test end', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - passes.push(test); - }); - - runner.on('fail', function(test){ - failures.push(test); - }); - - runner.on('pending', function(test){ - pending.push(test); - }); - - runner.on('end', function(){ - var obj = { - stats: self.stats, - tests: tests.map(clean), - pending: pending.map(clean), - failures: failures.map(clean), - passes: passes.map(clean) - }; - - runner.testResults = obj; - - process.stdout.write(JSON.stringify(obj, null, 2)); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title, - fullTitle: test.fullTitle(), - duration: test.duration, - err: errorJSON(test.err || {}) - } -} - -/** - * Transform `error` into a JSON object. - * @param {Error} err - * @return {Object} - */ - -function errorJSON(err) { - var res = {}; - Object.getOwnPropertyNames(err).forEach(function(key) { - res[key] = err[key]; - }, err); - return res; -} - -}); // module: reporters/json.js - -require.register("reporters/landing.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Landing`. - */ - -exports = module.exports = Landing; - -/** - * Airplane color. - */ - -Base.colors.plane = 0; - -/** - * Airplane crash color. - */ - -Base.colors['plane crash'] = 31; - -/** - * Runway color. - */ - -Base.colors.runway = 90; - -/** - * Initialize a new `Landing` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Landing(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , total = runner.total - , stream = process.stdout - , plane = color('plane', '✈') - , crashed = -1 - , n = 0; - - function runway() { - var buf = Array(width).join('-'); - return ' ' + color('runway', buf); - } - - runner.on('start', function(){ - stream.write('\n '); - cursor.hide(); - }); - - runner.on('test end', function(test){ - // check if the plane crashed - var col = -1 == crashed - ? width * ++n / total | 0 - : crashed; - - // show the crash - if ('failed' == test.state) { - plane = color('plane crash', '✈'); - crashed = col; - } - - // render landing strip - stream.write('\u001b[4F\n\n'); - stream.write(runway()); - stream.write('\n '); - stream.write(color('runway', Array(col).join('⋅'))); - stream.write(plane) - stream.write(color('runway', Array(width - col).join('⋅') + '\n')); - stream.write(runway()); - stream.write('\u001b[0m'); - }); - - runner.on('end', function(){ - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Landing.prototype = new F; -Landing.prototype.constructor = Landing; - -}); // module: reporters/landing.js - -require.register("reporters/list.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function List(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , n = 0; - - runner.on('start', function(){ - console.log(); - }); - - runner.on('test', function(test){ - process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); - }); - - runner.on('pending', function(test){ - var fmt = color('checkmark', ' -') - + color('pending', ' %s'); - console.log(fmt, test.fullTitle()); - }); - - runner.on('pass', function(test){ - var fmt = color('checkmark', ' '+Base.symbols.dot) - + color('pass', ' %s: ') - + color(test.speed, '%dms'); - cursor.CR(); - console.log(fmt, test.fullTitle(), test.duration); - }); - - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -List.prototype = new F; -List.prototype.constructor = List; - - -}); // module: reporters/list.js - -require.register("reporters/markdown.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils'); - -/** - * Expose `Markdown`. - */ - -exports = module.exports = Markdown; - -/** - * Initialize a new `Markdown` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Markdown(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , level = 0 - , buf = ''; - - function title(str) { - return Array(level).join('#') + ' ' + str; - } - - function indent() { - return Array(level).join(' '); - } - - function mapTOC(suite, obj) { - var ret = obj; - obj = obj[suite.title] = obj[suite.title] || { suite: suite }; - suite.suites.forEach(function(suite){ - mapTOC(suite, obj); - }); - return ret; - } - - function stringifyTOC(obj, level) { - ++level; - var buf = ''; - var link; - for (var key in obj) { - if ('suite' == key) continue; - if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; - if (key) buf += Array(level).join(' ') + link; - buf += stringifyTOC(obj[key], level); - } - --level; - return buf; - } - - function generateTOC(suite) { - var obj = mapTOC(suite, {}); - return stringifyTOC(obj, 0); - } - - generateTOC(runner.suite); - - runner.on('suite', function(suite){ - ++level; - var slug = utils.slug(suite.fullTitle()); - buf += '' + '\n'; - buf += title(suite.title) + '\n'; - }); - - runner.on('suite end', function(suite){ - --level; - }); - - runner.on('pass', function(test){ - var code = utils.clean(test.fn.toString()); - buf += test.title + '.\n'; - buf += '\n```js\n'; - buf += code + '\n'; - buf += '```\n\n'; - }); - - runner.on('end', function(){ - process.stdout.write('# TOC\n'); - process.stdout.write(generateTOC(runner.suite)); - process.stdout.write(buf); - }); -} -}); // module: reporters/markdown.js - -require.register("reporters/min.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `Min`. - */ - -exports = module.exports = Min; - -/** - * Initialize a new `Min` minimal test reporter (best used with --watch). - * - * @param {Runner} runner - * @api public - */ - -function Min(runner) { - Base.call(this, runner); - - runner.on('start', function(){ - // clear screen - process.stdout.write('\u001b[2J'); - // set cursor position - process.stdout.write('\u001b[1;3H'); - }); - - runner.on('end', this.epilogue.bind(this)); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Min.prototype = new F; -Min.prototype.constructor = Min; - - -}); // module: reporters/min.js - -require.register("reporters/nyan.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = NyanCat; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function NyanCat(runner) { - Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , rainbowColors = this.rainbowColors = self.generateColors() - , colorIndex = this.colorIndex = 0 - , numerOfLines = this.numberOfLines = 4 - , trajectories = this.trajectories = [[], [], [], []] - , nyanCatWidth = this.nyanCatWidth = 11 - , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) - , scoreboardWidth = this.scoreboardWidth = 5 - , tick = this.tick = 0 - , n = 0; - - runner.on('start', function(){ - Base.cursor.hide(); - self.draw(); - }); - - runner.on('pending', function(test){ - self.draw(); - }); - - runner.on('pass', function(test){ - self.draw(); - }); - - runner.on('fail', function(test, err){ - self.draw(); - }); - - runner.on('end', function(){ - Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) write('\n'); - self.epilogue(); - }); -} - -/** - * Draw the nyan cat - * - * @api private - */ - -NyanCat.prototype.draw = function(){ - this.appendRainbow(); - this.drawScoreboard(); - this.drawRainbow(); - this.drawNyanCat(); - this.tick = !this.tick; -}; - -/** - * Draw the "scoreboard" showing the number - * of passes, failures and pending tests. - * - * @api private - */ - -NyanCat.prototype.drawScoreboard = function(){ - var stats = this.stats; - var colors = Base.colors; - - function draw(color, n) { - write(' '); - write('\u001b[' + color + 'm' + n + '\u001b[0m'); - write('\n'); - } - - draw(colors.green, stats.passes); - draw(colors.fail, stats.failures); - draw(colors.pending, stats.pending); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Append the rainbow. - * - * @api private - */ - -NyanCat.prototype.appendRainbow = function(){ - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); - - for (var index = 0; index < this.numberOfLines; index++) { - var trajectory = this.trajectories[index]; - if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift(); - trajectory.push(rainbowified); - } -}; - -/** - * Draw the rainbow. - * - * @api private - */ - -NyanCat.prototype.drawRainbow = function(){ - var self = this; - - this.trajectories.forEach(function(line, index) { - write('\u001b[' + self.scoreboardWidth + 'C'); - write(line.join('')); - write('\n'); - }); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw the nyan cat - * - * @api private - */ - -NyanCat.prototype.drawNyanCat = function() { - var self = this; - var startWidth = this.scoreboardWidth + this.trajectories[0].length; - var color = '\u001b[' + startWidth + 'C'; - var padding = ''; - - write(color); - write('_,------,'); - write('\n'); - - write(color); - padding = self.tick ? ' ' : ' '; - write('_|' + padding + '/\\_/\\ '); - write('\n'); - - write(color); - padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - var face; - write(tail + '|' + padding + this.face() + ' '); - write('\n'); - - write(color); - padding = self.tick ? ' ' : ' '; - write(padding + '"" "" '); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw nyan cat face. - * - * @return {String} - * @api private - */ - -NyanCat.prototype.face = function() { - var stats = this.stats; - if (stats.failures) { - return '( x .x)'; - } else if (stats.pending) { - return '( o .o)'; - } else if(stats.passes) { - return '( ^ .^)'; - } else { - return '( - .-)'; - } -}; - -/** - * Move cursor up `n`. - * - * @param {Number} n - * @api private - */ - -NyanCat.prototype.cursorUp = function(n) { - write('\u001b[' + n + 'A'); -}; - -/** - * Move cursor down `n`. - * - * @param {Number} n - * @api private - */ - -NyanCat.prototype.cursorDown = function(n) { - write('\u001b[' + n + 'B'); -}; - -/** - * Generate rainbow colors. - * - * @return {Array} - * @api private - */ - -NyanCat.prototype.generateColors = function(){ - var colors = []; - - for (var i = 0; i < (6 * 7); i++) { - var pi3 = Math.floor(Math.PI / 3); - var n = (i * (1.0 / 6)); - var r = Math.floor(3 * Math.sin(n) + 3); - var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); - var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); - colors.push(36 * r + 6 * g + b + 16); - } - - return colors; -}; - -/** - * Apply rainbow to the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -NyanCat.prototype.rainbowify = function(str){ - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; - this.colorIndex += 1; - return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; -}; - -/** - * Stdout helper. - */ - -function write(string) { - process.stdout.write(string); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -NyanCat.prototype = new F; -NyanCat.prototype.constructor = NyanCat; - - -}); // module: reporters/nyan.js - -require.register("reporters/progress.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Progress`. - */ - -exports = module.exports = Progress; - -/** - * General progress bar color. - */ - -Base.colors.progress = 90; - -/** - * Initialize a new `Progress` bar test reporter. - * - * @param {Runner} runner - * @param {Object} options - * @api public - */ - -function Progress(runner, options) { - Base.call(this, runner); - - var self = this - , options = options || {} - , stats = this.stats - , width = Base.window.width * .50 | 0 - , total = runner.total - , complete = 0 - , max = Math.max - , lastN = -1; - - // default chars - options.open = options.open || '['; - options.complete = options.complete || '▬'; - options.incomplete = options.incomplete || Base.symbols.dot; - options.close = options.close || ']'; - options.verbose = false; - - // tests started - runner.on('start', function(){ - console.log(); - cursor.hide(); - }); - - // tests complete - runner.on('test end', function(){ - complete++; - var incomplete = total - complete - , percent = complete / total - , n = width * percent | 0 - , i = width - n; - - if (lastN === n && !options.verbose) { - // Don't re-render the line if it hasn't changed - return; - } - lastN = n; - - cursor.CR(); - process.stdout.write('\u001b[J'); - process.stdout.write(color('progress', ' ' + options.open)); - process.stdout.write(Array(n).join(options.complete)); - process.stdout.write(Array(i).join(options.incomplete)); - process.stdout.write(color('progress', options.close)); - if (options.verbose) { - process.stdout.write(color('progress', ' ' + complete + ' of ' + total)); - } - }); - - // tests are complete, output some stats - // and the failures if any - runner.on('end', function(){ - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Progress.prototype = new F; -Progress.prototype.constructor = Progress; - - -}); // module: reporters/progress.js - -require.register("reporters/spec.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Spec`. - */ - -exports = module.exports = Spec; - -/** - * Initialize a new `Spec` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function Spec(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , indents = 0 - , n = 0; - - function indent() { - return Array(indents).join(' ') - } - - runner.on('start', function(){ - console.log(); - }); - - runner.on('suite', function(suite){ - ++indents; - console.log(color('suite', '%s%s'), indent(), suite.title); - }); - - runner.on('suite end', function(suite){ - --indents; - if (1 == indents) console.log(); - }); - - runner.on('pending', function(test){ - var fmt = indent() + color('pending', ' - %s'); - console.log(fmt, test.title); - }); - - runner.on('pass', function(test){ - if ('fast' == test.speed) { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s '); - cursor.CR(); - console.log(fmt, test.title); - } else { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); - cursor.CR(); - console.log(fmt, test.title, test.duration); - } - }); - - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Spec.prototype = new F; -Spec.prototype.constructor = Spec; - - -}); // module: reporters/spec.js - -require.register("reporters/tap.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `TAP`. - */ - -exports = module.exports = TAP; - -/** - * Initialize a new `TAP` reporter. - * - * @param {Runner} runner - * @api public - */ - -function TAP(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , n = 1 - , passes = 0 - , failures = 0; - - runner.on('start', function(){ - var total = runner.grepTotal(runner.suite); - console.log('%d..%d', 1, total); - }); - - runner.on('test end', function(){ - ++n; - }); - - runner.on('pending', function(test){ - console.log('ok %d %s # SKIP -', n, title(test)); - }); - - runner.on('pass', function(test){ - passes++; - console.log('ok %d %s', n, title(test)); - }); - - runner.on('fail', function(test, err){ - failures++; - console.log('not ok %d %s', n, title(test)); - if (err.stack) console.log(err.stack.replace(/^/gm, ' ')); - }); - - runner.on('end', function(){ - console.log('# tests ' + (passes + failures)); - console.log('# pass ' + passes); - console.log('# fail ' + failures); - }); -} - -/** - * Return a TAP-safe title of `test` - * - * @param {Object} test - * @return {String} - * @api private - */ - -function title(test) { - return test.fullTitle().replace(/#/g, ''); -} - -}); // module: reporters/tap.js - -require.register("reporters/xunit.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils') - , escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Expose `XUnit`. - */ - -exports = module.exports = XUnit; - -/** - * Initialize a new `XUnit` reporter. - * - * @param {Runner} runner - * @api public - */ - -function XUnit(runner) { - Base.call(this, runner); - var stats = this.stats - , tests = [] - , self = this; - - runner.on('pending', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - tests.push(test); - }); - - runner.on('fail', function(test){ - tests.push(test); - }); - - runner.on('end', function(){ - console.log(tag('testsuite', { - name: 'Mocha Tests' - , tests: stats.tests - , failures: stats.failures - , errors: stats.failures - , skipped: stats.tests - stats.failures - stats.passes - , timestamp: (new Date).toUTCString() - , time: (stats.duration / 1000) || 0 - }, false)); - - tests.forEach(test); - console.log(''); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -XUnit.prototype = new F; -XUnit.prototype.constructor = XUnit; - - -/** - * Output tag for the given `test.` - */ - -function test(test) { - var attrs = { - classname: test.parent.fullTitle() - , name: test.title - , time: (test.duration / 1000) || 0 - }; - - if ('failed' == test.state) { - var err = test.err; - console.log(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + "\n" + err.stack)))); - } else if (test.pending) { - console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); - } else { - console.log(tag('testcase', attrs, true) ); - } -} - -/** - * HTML tag helper. - */ - -function tag(name, attrs, close, content) { - var end = close ? '/>' : '>' - , pairs = [] - , tag; - - for (var key in attrs) { - pairs.push(key + '="' + escape(attrs[key]) + '"'); - } - - tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; - if (content) tag += content + ''; -} - -}); // module: reporters/xunit.js - -require.register("runnable.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runnable') - , milliseconds = require('./ms'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Object#toString(). - */ - -var toString = Object.prototype.toString; - -/** - * Expose `Runnable`. - */ - -module.exports = Runnable; - -/** - * Initialize a new `Runnable` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Runnable(title, fn) { - this.title = title; - this.fn = fn; - this.async = fn && fn.length; - this.sync = ! this.async; - this._timeout = 2000; - this._slow = 75; - this._enableTimeouts = true; - this.timedOut = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -function F(){}; -F.prototype = EventEmitter.prototype; -Runnable.prototype = new F; -Runnable.prototype.constructor = Runnable; - - -/** - * Set & get timeout `ms`. - * - * @param {Number|String} ms - * @return {Runnable|Number} ms or self - * @api private - */ - -Runnable.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if (ms === 0) this._enableTimeouts = false; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = ms; - if (this.timer) this.resetTimeout(); - return this; -}; - -/** - * Set & get slow `ms`. - * - * @param {Number|String} ms - * @return {Runnable|Number} ms or self - * @api private - */ - -Runnable.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._slow = ms; - return this; -}; - -/** - * Set and & get timeout `enabled`. - * - * @param {Boolean} enabled - * @return {Runnable|Boolean} enabled or self - * @api private - */ - -Runnable.prototype.enableTimeouts = function(enabled){ - if (arguments.length === 0) return this._enableTimeouts; - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Return the full title generated by recursively - * concatenating the parent's full title. - * - * @return {String} - * @api public - */ - -Runnable.prototype.fullTitle = function(){ - return this.parent.fullTitle() + ' ' + this.title; -}; - -/** - * Clear the timeout. - * - * @api private - */ - -Runnable.prototype.clearTimeout = function(){ - clearTimeout(this.timer); -}; - -/** - * Inspect the runnable void of private properties. - * - * @return {String} - * @api private - */ - -Runnable.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_' == key[0]) return; - if ('parent' == key) return '#'; - if ('ctx' == key) return '#'; - return val; - }, 2); -}; - -/** - * Reset the timeout. - * - * @api private - */ - -Runnable.prototype.resetTimeout = function(){ - var self = this; - var ms = this.timeout() || 1e9; - - if (!this._enableTimeouts) return; - this.clearTimeout(); - this.timer = setTimeout(function(){ - if (!self._enableTimeouts) return; - self.callback(new Error('timeout of ' + ms + 'ms exceeded')); - self.timedOut = true; - }, ms); -}; - -/** - * Whitelist these globals for this test run - * - * @api private - */ -Runnable.prototype.globals = function(arr){ - var self = this; - this._allowedGlobals = arr; -}; - -/** - * Run the test and invoke `fn(err)`. - * - * @param {Function} fn - * @api private - */ - -Runnable.prototype.run = function(fn){ - var self = this - , start = new Date - , ctx = this.ctx - , finished - , emitted; - - // Some times the ctx exists but it is not runnable - if (ctx && ctx.runnable) ctx.runnable(this); - - // called multiple times - function multiple(err) { - if (emitted) return; - emitted = true; - self.emit('error', err || new Error('done() called multiple times')); - } - - // finished - function done(err) { - var ms = self.timeout(); - if (self.timedOut) return; - if (finished) return multiple(err); - self.clearTimeout(); - self.duration = new Date - start; - finished = true; - if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded'); - fn(err); - } - - // for .resetTimeout() - this.callback = done; - - // explicit async with `done` argument - if (this.async) { - this.resetTimeout(); - - try { - this.fn.call(ctx, function(err){ - if (err instanceof Error || toString.call(err) === "[object Error]") return done(err); - if (null != err) { - if (Object.prototype.toString.call(err) === '[object Object]') { - return done(new Error('done() invoked with non-Error: ' + JSON.stringify(err))); - } else { - return done(new Error('done() invoked with non-Error: ' + err)); - } - } - done(); - }); - } catch (err) { - done(err); - } - return; - } - - if (this.asyncOnly) { - return done(new Error('--async-only option in use without declaring `done()`')); - } - - // sync or promise-returning - try { - if (this.pending) { - done(); - } else { - callFn(this.fn); - } - } catch (err) { - done(err); - } - - function callFn(fn) { - var result = fn.call(ctx); - if (result && typeof result.then === 'function') { - self.resetTimeout(); - result - .then(function() { - done() - }, - function(reason) { - done(reason || new Error('Promise rejected with no or falsy reason')) - }); - } else { - done(); - } - } -}; - -}); // module: runnable.js - -require.register("runner.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runner') - , Test = require('./test') - , utils = require('./utils') - , filter = utils.filter - , keys = utils.keys; - -/** - * Non-enumerable globals. - */ - -var globals = [ - 'setTimeout', - 'clearTimeout', - 'setInterval', - 'clearInterval', - 'XMLHttpRequest', - 'Date' -]; - -/** - * Expose `Runner`. - */ - -module.exports = Runner; - -/** - * Initialize a `Runner` for the given `suite`. - * - * Events: - * - * - `start` execution started - * - `end` execution complete - * - `suite` (suite) test suite execution started - * - `suite end` (suite) all tests (and sub-suites) have finished - * - `test` (test) test execution started - * - `test end` (test) test completed - * - `hook` (hook) hook execution started - * - `hook end` (hook) hook complete - * - `pass` (test) test passed - * - `fail` (test, err) test failed - * - `pending` (test) test pending - * - * @api public - */ - -function Runner(suite) { - var self = this; - this._globals = []; - this._abort = false; - this.suite = suite; - this.total = suite.total(); - this.failures = 0; - this.on('test end', function(test){ self.checkGlobals(test); }); - this.on('hook end', function(hook){ self.checkGlobals(hook); }); - this.grep(/.*/); - this.globals(this.globalProps().concat(extraGlobals())); -} - -/** - * Wrapper for setImmediate, process.nextTick, or browser polyfill. - * - * @param {Function} fn - * @api private - */ - -Runner.immediately = global.setImmediate || process.nextTick; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -function F(){}; -F.prototype = EventEmitter.prototype; -Runner.prototype = new F; -Runner.prototype.constructor = Runner; - - -/** - * Run tests with full titles matching `re`. Updates runner.total - * with number of tests matched. - * - * @param {RegExp} re - * @param {Boolean} invert - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.grep = function(re, invert){ - debug('grep %s', re); - this._grep = re; - this._invert = invert; - this.total = this.grepTotal(this.suite); - return this; -}; - -/** - * Returns the number of tests matching the grep search for the - * given suite. - * - * @param {Suite} suite - * @return {Number} - * @api public - */ - -Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; - - suite.eachTest(function(test){ - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (match) total++; - }); - - return total; -}; - -/** - * Return a list of global properties. - * - * @return {Array} - * @api private - */ - -Runner.prototype.globalProps = function() { - var props = utils.keys(global); - - // non-enumerables - for (var i = 0; i < globals.length; ++i) { - if (~utils.indexOf(props, globals[i])) continue; - props.push(globals[i]); - } - - return props; -}; - -/** - * Allow the given `arr` of globals. - * - * @param {Array} arr - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.globals = function(arr){ - if (0 == arguments.length) return this._globals; - debug('globals %j', arr); - this._globals = this._globals.concat(arr); - return this; -}; - -/** - * Check for global variable leaks. - * - * @api private - */ - -Runner.prototype.checkGlobals = function(test){ - if (this.ignoreLeaks) return; - var ok = this._globals; - - var globals = this.globalProps(); - var leaks; - - if (test) { - ok = ok.concat(test._allowedGlobals || []); - } - - if(this.prevGlobalsLength == globals.length) return; - this.prevGlobalsLength = globals.length; - - leaks = filterLeaks(ok, globals); - this._globals = this._globals.concat(leaks); - - if (leaks.length > 1) { - this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + '')); - } else if (leaks.length) { - this.fail(test, new Error('global leak detected: ' + leaks[0])); - } -}; - -/** - * Fail the given `test`. - * - * @param {Test} test - * @param {Error} err - * @api private - */ - -Runner.prototype.fail = function(test, err){ - ++this.failures; - test.state = 'failed'; - - if ('string' == typeof err) { - err = new Error('the string "' + err + '" was thrown, throw an Error :)'); - } - - this.emit('fail', test, err); -}; - -/** - * Fail the given `hook` with `err`. - * - * Hook failures work in the following pattern: - * - If bail, then exit - * - Failed `before` hook skips all tests in a suite and subsuites, - * but jumps to corresponding `after` hook - * - Failed `before each` hook skips remaining tests in a - * suite and jumps to corresponding `after each` hook, - * which is run only once - * - Failed `after` hook does not alter - * execution order - * - Failed `after each` hook skips remaining tests in a - * suite and subsuites, but executes other `after each` - * hooks - * - * @param {Hook} hook - * @param {Error} err - * @api private - */ - -Runner.prototype.failHook = function(hook, err){ - this.fail(hook, err); - if (this.suite.bail()) { - this.emit('end'); - } -}; - -/** - * Run hook `name` callbacks and then invoke `fn()`. - * - * @param {String} name - * @param {Function} function - * @api private - */ - -Runner.prototype.hook = function(name, fn){ - var suite = this.suite - , hooks = suite['_' + name] - , self = this - , timer; - - function next(i) { - var hook = hooks[i]; - if (!hook) return fn(); - if (self.failures && suite.bail()) return fn(); - self.currentRunnable = hook; - - hook.ctx.currentTest = self.test; - - self.emit('hook', hook); - - hook.on('error', function(err){ - self.failHook(hook, err); - }); - - hook.run(function(err){ - hook.removeAllListeners('error'); - var testError = hook.error(); - if (testError) self.fail(self.test, testError); - if (err) { - self.failHook(hook, err); - - // stop executing hooks, notify callee of hook err - return fn(err); - } - self.emit('hook end', hook); - delete hook.ctx.currentTest; - next(++i); - }); - } - - Runner.immediately(function(){ - next(0); - }); -}; - -/** - * Run hook `name` for the given array of `suites` - * in order, and callback `fn(err, errSuite)`. - * - * @param {String} name - * @param {Array} suites - * @param {Function} fn - * @api private - */ - -Runner.prototype.hooks = function(name, suites, fn){ - var self = this - , orig = this.suite; - - function next(suite) { - self.suite = suite; - - if (!suite) { - self.suite = orig; - return fn(); - } - - self.hook(name, function(err){ - if (err) { - var errSuite = self.suite; - self.suite = orig; - return fn(err, errSuite); - } - - next(suites.pop()); - }); - } - - next(suites.pop()); -}; - -/** - * Run hooks from the top level down. - * - * @param {String} name - * @param {Function} fn - * @api private - */ - -Runner.prototype.hookUp = function(name, fn){ - var suites = [this.suite].concat(this.parents()).reverse(); - this.hooks(name, suites, fn); -}; - -/** - * Run hooks from the bottom up. - * - * @param {String} name - * @param {Function} fn - * @api private - */ - -Runner.prototype.hookDown = function(name, fn){ - var suites = [this.suite].concat(this.parents()); - this.hooks(name, suites, fn); -}; - -/** - * Return an array of parent Suites from - * closest to furthest. - * - * @return {Array} - * @api private - */ - -Runner.prototype.parents = function(){ - var suite = this.suite - , suites = []; - while (suite = suite.parent) suites.push(suite); - return suites; -}; - -/** - * Run the current test and callback `fn(err)`. - * - * @param {Function} fn - * @api private - */ - -Runner.prototype.runTest = function(fn){ - var test = this.test - , self = this; - - if (this.asyncOnly) test.asyncOnly = true; - - try { - test.on('error', function(err){ - self.fail(test, err); - }); - test.run(fn); - } catch (err) { - fn(err); - } -}; - -/** - * Run tests in the given `suite` and invoke - * the callback `fn()` when complete. - * - * @param {Suite} suite - * @param {Function} fn - * @api private - */ - -Runner.prototype.runTests = function(suite, fn){ - var self = this - , tests = suite.tests.slice() - , test; - - - function hookErr(err, errSuite, after) { - // before/after Each hook for errSuite failed: - var orig = self.suite; - - // for failed 'after each' hook start from errSuite parent, - // otherwise start from errSuite itself - self.suite = after ? errSuite.parent : errSuite; - - if (self.suite) { - // call hookUp afterEach - self.hookUp('afterEach', function(err2, errSuite2) { - self.suite = orig; - // some hooks may fail even now - if (err2) return hookErr(err2, errSuite2, true); - // report error suite - fn(errSuite); - }); - } else { - // there is no need calling other 'after each' hooks - self.suite = orig; - fn(errSuite); - } - } - - function next(err, errSuite) { - // if we bail after first err - if (self.failures && suite._bail) return fn(); - - if (self._abort) return fn(); - - if (err) return hookErr(err, errSuite, true); - - // next test - test = tests.shift(); - - // all done - if (!test) return fn(); - - // grep - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (!match) return next(); - - // pending - if (test.pending) { - self.emit('pending', test); - self.emit('test end', test); - return next(); - } - - // execute test and hook(s) - self.emit('test', self.test = test); - self.hookDown('beforeEach', function(err, errSuite){ - - if (err) return hookErr(err, errSuite, false); - - self.currentRunnable = self.test; - self.runTest(function(err){ - test = self.test; - - if (err) { - self.fail(test, err); - self.emit('test end', test); - return self.hookUp('afterEach', next); - } - - test.state = 'passed'; - self.emit('pass', test); - self.emit('test end', test); - self.hookUp('afterEach', next); - }); - }); - } - - this.next = next; - next(); -}; - -/** - * Run the given `suite` and invoke the - * callback `fn()` when complete. - * - * @param {Suite} suite - * @param {Function} fn - * @api private - */ - -Runner.prototype.runSuite = function(suite, fn){ - var total = this.grepTotal(suite) - , self = this - , i = 0; - - debug('run suite %s', suite.fullTitle()); - - if (!total) return fn(); - - this.emit('suite', this.suite = suite); - - function next(errSuite) { - if (errSuite) { - // current suite failed on a hook from errSuite - if (errSuite == suite) { - // if errSuite is current suite - // continue to the next sibling suite - return done(); - } else { - // errSuite is among the parents of current suite - // stop execution of errSuite and all sub-suites - return done(errSuite); - } - } - - if (self._abort) return done(); - - var curr = suite.suites[i++]; - if (!curr) return done(); - self.runSuite(curr, next); - } - - function done(errSuite) { - self.suite = suite; - self.hook('afterAll', function(){ - self.emit('suite end', suite); - fn(errSuite); - }); - } - - this.hook('beforeAll', function(err){ - if (err) return done(); - self.runTests(suite, next); - }); -}; - -/** - * Handle uncaught exceptions. - * - * @param {Error} err - * @api private - */ - -Runner.prototype.uncaught = function(err){ - if (err) { - debug('uncaught exception %s', err !== function () { - return this; - }.call(err) ? err : ( err.message || err )); - } else { - debug('uncaught undefined exception'); - err = new Error('Caught undefined error, did you throw without specifying what?'); - } - err.uncaught = true; - - var runnable = this.currentRunnable; - if (!runnable) return; - - var wasAlreadyDone = runnable.state; - this.fail(runnable, err); - - runnable.clearTimeout(); - - if (wasAlreadyDone) return; - - // recover from test - if ('test' == runnable.type) { - this.emit('test end', runnable); - this.hookUp('afterEach', this.next); - return; - } - - // bail on hooks - this.emit('end'); -}; - -/** - * Run the root suite and invoke `fn(failures)` - * on completion. - * - * @param {Function} fn - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; - - function uncaught(err){ - self.uncaught(err); - } - - debug('start'); - - // callback - this.on('end', function(){ - debug('end'); - process.removeListener('uncaughtException', uncaught); - fn(self.failures); - }); - - // run suites - this.emit('start'); - this.runSuite(this.suite, function(){ - debug('finished running'); - self.emit('end'); - }); - - // uncaught exception - process.on('uncaughtException', uncaught); - - return this; -}; - -/** - * Cleanly abort execution - * - * @return {Runner} for chaining - * @api public - */ -Runner.prototype.abort = function(){ - debug('aborting'); - this._abort = true; -}; - -/** - * Filter leaks with the given globals flagged as `ok`. - * - * @param {Array} ok - * @param {Array} globals - * @return {Array} - * @api private - */ - -function filterLeaks(ok, globals) { - return filter(globals, function(key){ - // Firefox and Chrome exposes iframes as index inside the window object - if (/^d+/.test(key)) return false; - - // in firefox - // if runner runs in an iframe, this iframe's window.getInterface method not init at first - // it is assigned in some seconds - if (global.navigator && /^getInterface/.test(key)) return false; - - // an iframe could be approached by window[iframeIndex] - // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak - if (global.navigator && /^\d+/.test(key)) return false; - - // Opera and IE expose global variables for HTML element IDs (issue #243) - if (/^mocha-/.test(key)) return false; - - var matched = filter(ok, function(ok){ - if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); - return key == ok; - }); - return matched.length == 0 && (!global.navigator || 'onerror' !== key); - }); -} - -/** - * Array of globals dependent on the environment. - * - * @return {Array} - * @api private - */ - - function extraGlobals() { - if (typeof(process) === 'object' && - typeof(process.version) === 'string') { - - var nodeVersion = process.version.split('.').reduce(function(a, v) { - return a << 8 | v; - }); - - // 'errno' was renamed to process._errno in v0.9.11. - - if (nodeVersion < 0x00090B) { - return ['errno']; - } - } - - return []; - } - -}); // module: runner.js - -require.register("suite.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:suite') - , milliseconds = require('./ms') - , utils = require('./utils') - , Hook = require('./hook'); - -/** - * Expose `Suite`. - */ - -exports = module.exports = Suite; - -/** - * Create a new `Suite` with the given `title` - * and parent `Suite`. When a suite with the - * same title is already present, that suite - * is returned to provide nicer reporter - * and more flexible meta-testing. - * - * @param {Suite} parent - * @param {String} title - * @return {Suite} - * @api public - */ - -exports.create = function(parent, title){ - var suite = new Suite(title, parent.ctx); - suite.parent = parent; - if (parent.pending) suite.pending = true; - title = suite.fullTitle(); - parent.addSuite(suite); - return suite; -}; - -/** - * Initialize a new `Suite` with the given - * `title` and `ctx`. - * - * @param {String} title - * @param {Context} ctx - * @api private - */ - -function Suite(title, parentContext) { - this.title = title; - var context = function() {}; - context.prototype = parentContext; - this.ctx = new context(); - this.suites = []; - this.tests = []; - this.pending = false; - this._beforeEach = []; - this._beforeAll = []; - this._afterEach = []; - this._afterAll = []; - this.root = !title; - this._timeout = 2000; - this._enableTimeouts = true; - this._slow = 75; - this._bail = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -function F(){}; -F.prototype = EventEmitter.prototype; -Suite.prototype = new F; -Suite.prototype.constructor = Suite; - - -/** - * Return a clone of this `Suite`. - * - * @return {Suite} - * @api private - */ - -Suite.prototype.clone = function(){ - var suite = new Suite(this.title); - debug('clone'); - suite.ctx = this.ctx; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - return suite; -}; - -/** - * Set timeout `ms` or short-hand such as "2s". - * - * @param {Number|String} ms - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if (ms === 0) this._enableTimeouts = false; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = parseInt(ms, 10); - return this; -}; - -/** - * Set timeout `enabled`. - * - * @param {Boolean} enabled - * @return {Suite|Boolean} self or enabled - * @api private - */ - -Suite.prototype.enableTimeouts = function(enabled){ - if (arguments.length === 0) return this._enableTimeouts; - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Set slow `ms` or short-hand such as "2s". - * - * @param {Number|String} ms - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('slow %d', ms); - this._slow = ms; - return this; -}; - -/** - * Sets whether to bail after first error. - * - * @parma {Boolean} bail - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.bail = function(bail){ - if (0 == arguments.length) return this._bail; - debug('bail %s', bail); - this._bail = bail; - return this; -}; - -/** - * Run `fn(test[, done])` before running tests. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.beforeAll = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"before all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeAll.push(hook); - this.emit('beforeAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after running tests. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.afterAll = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"after all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterAll.push(hook); - this.emit('afterAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` before each test case. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.beforeEach = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"before each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeEach.push(hook); - this.emit('beforeEach', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after each test case. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.afterEach = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"after each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterEach.push(hook); - this.emit('afterEach', hook); - return this; -}; - -/** - * Add a test `suite`. - * - * @param {Suite} suite - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.addSuite = function(suite){ - suite.parent = this; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - this.suites.push(suite); - this.emit('suite', suite); - return this; -}; - -/** - * Add a `test` to this suite. - * - * @param {Test} test - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.addTest = function(test){ - test.parent = this; - test.timeout(this.timeout()); - test.enableTimeouts(this.enableTimeouts()); - test.slow(this.slow()); - test.ctx = this.ctx; - this.tests.push(test); - this.emit('test', test); - return this; -}; - -/** - * Return the full title generated by recursively - * concatenating the parent's full title. - * - * @return {String} - * @api public - */ - -Suite.prototype.fullTitle = function(){ - if (this.parent) { - var full = this.parent.fullTitle(); - if (full) return full + ' ' + this.title; - } - return this.title; -}; - -/** - * Return the total number of tests. - * - * @return {Number} - * @api public - */ - -Suite.prototype.total = function(){ - return utils.reduce(this.suites, function(sum, suite){ - return sum + suite.total(); - }, 0) + this.tests.length; -}; - -/** - * Iterates through each suite recursively to find - * all tests. Applies a function in the format - * `fn(test)`. - * - * @param {Function} fn - * @return {Suite} - * @api private - */ - -Suite.prototype.eachTest = function(fn){ - utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite){ - suite.eachTest(fn); - }); - return this; -}; - -}); // module: suite.js - -require.register("test.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); - -/** - * Expose `Test`. - */ - -module.exports = Test; - -/** - * Initialize a new `Test` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Test(title, fn) { - Runnable.call(this, title, fn); - this.pending = !fn; - this.type = 'test'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -function F(){}; -F.prototype = Runnable.prototype; -Test.prototype = new F; -Test.prototype.constructor = Test; - - -}); // module: test.js - -require.register("utils.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var fs = require('browser/fs') - , path = require('browser/path') - , basename = path.basename - , exists = fs.existsSync || path.existsSync - , glob = require('browser/glob') - , join = path.join - , debug = require('browser/debug')('mocha:watch'); - -/** - * Ignored directories. - */ - -var ignore = ['node_modules', '.git']; - -/** - * Escape special characters in the given string of html. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * Array#forEach (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} scope - * @api private - */ - -exports.forEach = function(arr, fn, scope){ - for (var i = 0, l = arr.length; i < l; i++) - fn.call(scope, arr[i], i); -}; - -/** - * Array#map (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} scope - * @api private - */ - -exports.map = function(arr, fn, scope){ - var result = []; - for (var i = 0, l = arr.length; i < l; i++) - result.push(fn.call(scope, arr[i], i)); - return result; -}; - -/** - * Array#indexOf (<=IE8) - * - * @parma {Array} arr - * @param {Object} obj to find index of - * @param {Number} start - * @api private - */ - -exports.indexOf = function(arr, obj, start){ - for (var i = start || 0, l = arr.length; i < l; i++) { - if (arr[i] === obj) - return i; - } - return -1; -}; - -/** - * Array#reduce (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} initial value - * @api private - */ - -exports.reduce = function(arr, fn, val){ - var rval = val; - - for (var i = 0, l = arr.length; i < l; i++) { - rval = fn(rval, arr[i], i, arr); - } - - return rval; -}; - -/** - * Array#filter (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @api private - */ - -exports.filter = function(arr, fn){ - var ret = []; - - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; - if (fn(val, i, arr)) ret.push(val); - } - - return ret; -}; - -/** - * Object.keys (<=IE8) - * - * @param {Object} obj - * @return {Array} keys - * @api private - */ - -exports.keys = Object.keys || function(obj) { - var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 - - for (var key in obj) { - if (has.call(obj, key)) { - keys.push(key); - } - } - - return keys; -}; - -/** - * Watch the given `files` for changes - * and invoke `fn(file)` on modification. - * - * @param {Array} files - * @param {Function} fn - * @api private - */ - -exports.watch = function(files, fn){ - var options = { interval: 100 }; - files.forEach(function(file){ - debug('file %s', file); - fs.watchFile(file, options, function(curr, prev){ - if (prev.mtime < curr.mtime) fn(file); - }); - }); -}; - -/** - * Ignored files. - */ - -function ignored(path){ - return !~ignore.indexOf(path); -} - -/** - * Lookup files in the given `dir`. - * - * @return {Array} - * @api private - */ - -exports.files = function(dir, ext, ret){ - ret = ret || []; - ext = ext || ['js']; - - var re = new RegExp('\\.(' + ext.join('|') + ')$'); - - fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ext, ret); - } else if (path.match(re)) { - ret.push(path); - } - }); - - return ret; -}; - -/** - * Compute a slug from the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.slug = function(str){ - return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); -}; - -/** - * Strip the function definition from `str`, - * and re-indent for pre whitespace. - */ - -exports.clean = function(str) { - str = str - .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') - .replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '') - .replace(/\s+\}$/, ''); - - var spaces = str.match(/^\n?( *)/)[1].length - , tabs = str.match(/^\n?(\t*)/)[1].length - , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); - - str = str.replace(re, ''); - - return exports.trim(str); -}; - -/** - * Trim the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.trim = function(str){ - return str.replace(/^\s+|\s+$/g, ''); -}; - -/** - * Parse the given `qs`. - * - * @param {String} qs - * @return {Object} - * @api private - */ - -exports.parseQuery = function(qs){ - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ - var i = pair.indexOf('=') - , key = pair.slice(0, i) - , val = pair.slice(++i); - - obj[key] = decodeURIComponent(val); - return obj; - }, {}); -}; - -/** - * Highlight the given string of `js`. - * - * @param {String} js - * @return {String} - * @api private - */ - -function highlight(js) { - return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew[ \t]+(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1') -} - -/** - * Highlight the contents of tag `name`. - * - * @param {String} name - * @api private - */ - -exports.highlightTags = function(name) { - var code = document.getElementById('mocha').getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { - code[i].innerHTML = highlight(code[i].innerHTML); - } -}; - - -/** - * Stringify `obj`. - * - * @param {Object} obj - * @return {String} - * @api private - */ - -exports.stringify = function(obj) { - if (obj instanceof RegExp) return obj.toString(); - return JSON.stringify(exports.canonicalize(obj), null, 2).replace(/,(\n|$)/g, '$1'); -}; - -/** - * Return a new object that has the keys in sorted order. - * @param {Object} obj - * @param {Array} [stack] - * @return {Object} - * @api private - */ - -exports.canonicalize = function(obj, stack) { - stack = stack || []; - - if (exports.indexOf(stack, obj) !== -1) return '[Circular]'; - - var canonicalizedObj; - - if ({}.toString.call(obj) === '[object Array]') { - stack.push(obj); - canonicalizedObj = exports.map(obj, function (item) { - return exports.canonicalize(item, stack); - }); - stack.pop(); - } else if (typeof obj === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - exports.forEach(exports.keys(obj).sort(), function (key) { - canonicalizedObj[key] = exports.canonicalize(obj[key], stack); - }); - stack.pop(); - } else { - canonicalizedObj = obj; - } - - return canonicalizedObj; - }; - -/** - * Lookup file names at the given `path`. - */ -exports.lookupFiles = function lookupFiles(path, extensions, recursive) { - var files = []; - var re = new RegExp('\\.(' + extensions.join('|') + ')$'); - - if (!exists(path)) { - if (exists(path + '.js')) { - path += '.js'; - } else { - files = glob.sync(path); - if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'"); - return files; - } - } - - try { - var stat = fs.statSync(path); - if (stat.isFile()) return path; - } - catch (ignored) { - return; - } - - fs.readdirSync(path).forEach(function(file){ - file = join(path, file); - try { - var stat = fs.statSync(file); - if (stat.isDirectory()) { - if (recursive) { - files = files.concat(lookupFiles(file, extensions, recursive)); - } - return; - } - } - catch (ignored) { - return; - } - if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') return; - files.push(file); - }); - - return files; -}; - -}); // module: utils.js -// The global object is "self" in Web Workers. -var global = (function() { return this; })(); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; - -/** - * Node shims. - * - * These are meant only to allow - * mocha.js to run untouched, not - * to allow running node code in - * the browser. - */ - -var process = {}; -process.exit = function(status){}; -process.stdout = {}; - -var uncaughtExceptionHandlers = []; - -var originalOnerrorHandler = global.onerror; - -/** - * Remove uncaughtException listener. - * Revert to original onerror handler if previously defined. - */ - -process.removeListener = function(e, fn){ - if ('uncaughtException' == e) { - if (originalOnerrorHandler) { - global.onerror = originalOnerrorHandler; - } else { - global.onerror = function() {}; - } - var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); - if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } - } -}; - -/** - * Implements uncaughtException listener. - */ - -process.on = function(e, fn){ - if ('uncaughtException' == e) { - global.onerror = function(err, url, line){ - fn(new Error(err + ' (' + url + ':' + line + ')')); - return true; - }; - uncaughtExceptionHandlers.push(fn); - } -}; - -/** - * Expose mocha. - */ - -var Mocha = global.Mocha = require('mocha'), - mocha = global.mocha = new Mocha({ reporter: 'html' }); - -// The BDD UI is registered by default, but no UI will be functional in the -// browser without an explicit call to the overridden `mocha.ui` (see below). -// Ensure that this default UI does not expose its methods to the global scope. -mocha.suite.removeAllListeners('pre-require'); - -var immediateQueue = [] - , immediateTimeout; - -function timeslice() { - var immediateStart = new Date().getTime(); - while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) { - immediateQueue.shift()(); - } - if (immediateQueue.length) { - immediateTimeout = setTimeout(timeslice, 0); - } else { - immediateTimeout = null; - } -} - -/** - * High-performance override of Runner.immediately. - */ - -Mocha.Runner.immediately = function(callback) { - immediateQueue.push(callback); - if (!immediateTimeout) { - immediateTimeout = setTimeout(timeslice, 0); - } -}; - -/** - * Function to allow assertion libraries to throw errors directly into mocha. - * This is useful when running tests in a browser because window.onerror will - * only receive the 'message' attribute of the Error. - */ -mocha.throwError = function(err) { - Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) { - fn(err); - }); - throw err; -}; - -/** - * Override ui to ensure that the ui functions are initialized. - * Normally this would happen in Mocha.prototype.loadFiles. - */ - -mocha.ui = function(ui){ - Mocha.prototype.ui.call(this, ui); - this.suite.emit('pre-require', global, null, this); - return this; -}; - -/** - * Setup mocha with the given setting options. - */ - -mocha.setup = function(opts){ - if ('string' == typeof opts) opts = { ui: opts }; - for (var opt in opts) this[opt](opts[opt]); - return this; -}; - -/** - * Run mocha, returning the Runner. - */ - -mocha.run = function(fn){ - var options = mocha.options; - mocha.globals('location'); - - var query = Mocha.utils.parseQuery(global.location.search || ''); - if (query.grep) mocha.grep(query.grep); - if (query.invert) mocha.invert(); - - return Mocha.prototype.run.call(mocha, function(err){ - // The DOM Document is not available in Web Workers. - var document = global.document; - if (document && document.getElementById('mocha') && options.noHighlighting !== true) { - Mocha.utils.highlightTags('code'); - } - if (fn) fn(err); - }); -}; - -/** - * Expose the process shim. - */ - -Mocha.process = process; -})(); \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js deleted file mode 100644 index 7ad9f8a2..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js +++ /dev/null @@ -1,16 +0,0 @@ -importScripts('es6-promise.js'); -new ES6Promise.Promise(function(resolve, reject) { - self.onmessage = function (e) { - if (e.data === 'ping') { - resolve('pong'); - } else { - reject(new Error('wrong message')); - } - }; -}).then(function (result) { - self.postMessage(result); -}, function (err){ - setTimeout(function () { - throw err; - }); -}); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js deleted file mode 100644 index 5984f705..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js +++ /dev/null @@ -1,18 +0,0 @@ -import Promise from './es6-promise/promise'; -import polyfill from './es6-promise/polyfill'; - -var ES6Promise = { - 'Promise': Promise, - 'polyfill': polyfill -}; - -/* global define:true module:true window: true */ -if (typeof define === 'function' && define['amd']) { - define(function() { return ES6Promise; }); -} else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = ES6Promise; -} else if (typeof this !== 'undefined') { - this['ES6Promise'] = ES6Promise; -} - -polyfill(); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js deleted file mode 100644 index daee2c38..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js +++ /dev/null @@ -1,250 +0,0 @@ -import { - objectOrFunction, - isFunction -} from './utils'; - -import asap from './asap'; - -function noop() {} - -var PENDING = void 0; -var FULFILLED = 1; -var REJECTED = 2; - -var GET_THEN_ERROR = new ErrorObject(); - -function selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); -} - -function cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); -} - -function getThen(promise) { - try { - return promise.then; - } catch(error) { - GET_THEN_ERROR.error = error; - return GET_THEN_ERROR; - } -} - -function tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } -} - -function handleForeignThenable(promise, thenable, then) { - asap(function(promise) { - var sealed = false; - var error = tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - resolve(promise, value); - } else { - fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - reject(promise, error); - } - }, promise); -} - -function handleOwnThenable(promise, thenable) { - if (thenable._state === FULFILLED) { - fulfill(promise, thenable._result); - } else if (thenable._state === REJECTED) { - reject(promise, thenable._result); - } else { - subscribe(thenable, undefined, function(value) { - resolve(promise, value); - }, function(reason) { - reject(promise, reason); - }); - } -} - -function handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - handleOwnThenable(promise, maybeThenable); - } else { - var then = getThen(maybeThenable); - - if (then === GET_THEN_ERROR) { - reject(promise, GET_THEN_ERROR.error); - } else if (then === undefined) { - fulfill(promise, maybeThenable); - } else if (isFunction(then)) { - handleForeignThenable(promise, maybeThenable, then); - } else { - fulfill(promise, maybeThenable); - } - } -} - -function resolve(promise, value) { - if (promise === value) { - reject(promise, selfFullfillment()); - } else if (objectOrFunction(value)) { - handleMaybeThenable(promise, value); - } else { - fulfill(promise, value); - } -} - -function publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - publish(promise); -} - -function fulfill(promise, value) { - if (promise._state !== PENDING) { return; } - - promise._result = value; - promise._state = FULFILLED; - - if (promise._subscribers.length !== 0) { - asap(publish, promise); - } -} - -function reject(promise, reason) { - if (promise._state !== PENDING) { return; } - promise._state = REJECTED; - promise._result = reason; - - asap(publishRejection, promise); -} - -function subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + FULFILLED] = onFulfillment; - subscribers[length + REJECTED] = onRejection; - - if (length === 0 && parent._state) { - asap(publish, parent); - } -} - -function publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; -} - -function ErrorObject() { - this.error = null; -} - -var TRY_CATCH_ERROR = new ErrorObject(); - -function tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - TRY_CATCH_ERROR.error = e; - return TRY_CATCH_ERROR; - } -} - -function invokeCallback(settled, promise, callback, detail) { - var hasCallback = isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = tryCatch(callback, detail); - - if (value === TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - reject(promise, cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== PENDING) { - // noop - } else if (hasCallback && succeeded) { - resolve(promise, value); - } else if (failed) { - reject(promise, error); - } else if (settled === FULFILLED) { - fulfill(promise, value); - } else if (settled === REJECTED) { - reject(promise, value); - } -} - -function initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - resolve(promise, value); - }, function rejectPromise(reason) { - reject(promise, reason); - }); - } catch(e) { - reject(promise, e); - } -} - -export { - noop, - resolve, - reject, - fulfill, - subscribe, - publish, - publishRejection, - initializePromise, - invokeCallback, - FULFILLED, - REJECTED, - PENDING -}; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js deleted file mode 100644 index 4f7dcee2..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js +++ /dev/null @@ -1,111 +0,0 @@ -var len = 0; -var toString = {}.toString; -var vertxNext; -export default function asap(callback, arg) { - queue[len] = callback; - queue[len + 1] = arg; - len += 2; - if (len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - scheduleFlush(); - } -} - -var browserWindow = (typeof window !== 'undefined') ? window : undefined; -var browserGlobal = browserWindow || {}; -var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; -var isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - -// test for web worker but not in IE10 -var isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - -// node -function useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(flush); - }; -} - -// vertx -function useVertxTimer() { - return function() { - vertxNext(flush); - }; -} - -function useMutationObserver() { - var iterations = 0; - var observer = new BrowserMutationObserver(flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; -} - -// web worker -function useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = flush; - return function () { - channel.port2.postMessage(0); - }; -} - -function useSetTimeout() { - return function() { - setTimeout(flush, 1); - }; -} - -var queue = new Array(1000); -function flush() { - for (var i = 0; i < len; i+=2) { - var callback = queue[i]; - var arg = queue[i+1]; - - callback(arg); - - queue[i] = undefined; - queue[i+1] = undefined; - } - - len = 0; -} - -function attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - vertxNext = vertx.runOnLoop || vertx.runOnContext; - return useVertxTimer(); - } catch(e) { - return useSetTimeout(); - } -} - -var scheduleFlush; -// Decide what async method to use to triggering processing of queued callbacks: -if (isNode) { - scheduleFlush = useNextTick(); -} else if (BrowserMutationObserver) { - scheduleFlush = useMutationObserver(); -} else if (isWorker) { - scheduleFlush = useMessageChannel(); -} else if (browserWindow === undefined && typeof require === 'function') { - scheduleFlush = attemptVertex(); -} else { - scheduleFlush = useSetTimeout(); -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js deleted file mode 100644 index 03fdf8c1..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js +++ /dev/null @@ -1,113 +0,0 @@ -import { - isArray, - isMaybeThenable -} from './utils'; - -import { - noop, - reject, - fulfill, - subscribe, - FULFILLED, - REJECTED, - PENDING -} from './-internal'; - -function Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - fulfill(enumerator.promise, enumerator._result); - } - } - } else { - reject(enumerator.promise, enumerator._validationError()); - } -} - -Enumerator.prototype._validateInput = function(input) { - return isArray(input); -}; - -Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); -}; - -Enumerator.prototype._init = function() { - this._result = new Array(this.length); -}; - -export default Enumerator; - -Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } -}; - -Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } -}; - -Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === PENDING) { - enumerator._remaining--; - - if (state === REJECTED) { - reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - fulfill(promise, enumerator._result); - } -}; - -Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - subscribe(promise, undefined, function(value) { - enumerator._settledAt(FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(REJECTED, i, reason); - }); -}; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js deleted file mode 100644 index 6696dfc6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js +++ /dev/null @@ -1,26 +0,0 @@ -/*global self*/ -import Promise from './promise'; - -export default function polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = Promise; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js deleted file mode 100644 index 78fe2ca0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js +++ /dev/null @@ -1,408 +0,0 @@ -import { - isFunction -} from './utils'; - -import { - noop, - subscribe, - initializePromise, - invokeCallback, - FULFILLED, - REJECTED -} from './-internal'; - -import asap from './asap'; - -import all from './promise/all'; -import race from './promise/race'; -import Resolve from './promise/resolve'; -import Reject from './promise/reject'; - -var counter = 0; - -function needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); -} - -function needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); -} - -export default Promise; -/** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor -*/ -function Promise(resolver) { - this._id = counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (noop !== resolver) { - if (!isFunction(resolver)) { - needsResolver(); - } - - if (!(this instanceof Promise)) { - needsNew(); - } - - initializePromise(this, resolver); - } -} - -Promise.all = all; -Promise.race = race; -Promise.resolve = Resolve; -Promise.reject = Reject; - -Promise.prototype = { - constructor: Promise, - -/** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} -*/ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === FULFILLED && !onFulfillment || state === REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - asap(function(){ - invokeCallback(state, child, callback, result); - }); - } else { - subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - -/** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} -*/ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } -}; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js deleted file mode 100644 index 03033f0d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js +++ /dev/null @@ -1,52 +0,0 @@ -import Enumerator from '../enumerator'; - -/** - `Promise.all` accepts an array of promises, and returns a new promise which - is fulfilled with an array of fulfillment values for the passed promises, or - rejected with the reason of the first passed promise to be rejected. It casts all - elements of the passed iterable to promises as it runs this algorithm. - - Example: - - ```javascript - var promise1 = resolve(1); - var promise2 = resolve(2); - var promise3 = resolve(3); - var promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - var promise1 = resolve(1); - var promise2 = reject(new Error("2")); - var promise3 = reject(new Error("3")); - var promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @static - @param {Array} entries array of promises - @param {String} label optional string for labeling the promise. - Useful for tooling. - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. - @static -*/ -export default function all(entries) { - return new Enumerator(this, entries).promise; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js deleted file mode 100644 index 0d7ff133..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js +++ /dev/null @@ -1,104 +0,0 @@ -import { - isArray -} from "../utils"; - -import { - noop, - resolve, - reject, - subscribe, - PENDING -} from '../-internal'; - -/** - `Promise.race` returns a new promise which is settled in the same way as the - first passed promise to settle. - - Example: - - ```javascript - var promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - var promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 2'); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // result === 'promise 2' because it was resolved before promise1 - // was resolved. - }); - ``` - - `Promise.race` is deterministic in that only the state of the first - settled promise matters. For example, even if other promises given to the - `promises` array argument are resolved, but the first settled promise has - become rejected before the other promises became fulfilled, the returned - promise will become rejected: - - ```javascript - var promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - var promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error('promise 2')); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // Code here never runs - }, function(reason){ - // reason.message === 'promise 2' because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - An example real-world use case is implementing timeouts: - - ```javascript - Promise.race([ajax('foo.json'), timeout(5000)]) - ``` - - @method race - @static - @param {Array} promises array of promises to observe - Useful for tooling. - @return {Promise} a promise which settles in the same way as the first passed - promise to settle. -*/ -export default function race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(noop); - - if (!isArray(entries)) { - reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - resolve(promise, value); - } - - function onRejection(reason) { - reject(promise, reason); - } - - for (var i = 0; promise._state === PENDING && i < length; i++) { - subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js deleted file mode 100644 index 63b86cba..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js +++ /dev/null @@ -1,46 +0,0 @@ -import { - noop, - reject as _reject -} from '../-internal'; - -/** - `Promise.reject` returns a promise rejected with the passed `reason`. - It is shorthand for the following: - - ```javascript - var promise = new Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = Promise.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @static - @param {Any} reason value that the returned promise will be rejected with. - Useful for tooling. - @return {Promise} a promise rejected with the given `reason`. -*/ -export default function reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(noop); - _reject(promise, reason); - return promise; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js deleted file mode 100644 index 201a545d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js +++ /dev/null @@ -1,48 +0,0 @@ -import { - noop, - resolve as _resolve -} from '../-internal'; - -/** - `Promise.resolve` returns a promise that will become resolved with the - passed `value`. It is shorthand for the following: - - ```javascript - var promise = new Promise(function(resolve, reject){ - resolve(1); - }); - - promise.then(function(value){ - // value === 1 - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = Promise.resolve(1); - - promise.then(function(value){ - // value === 1 - }); - ``` - - @method resolve - @static - @param {Any} value value that the returned promise will be resolved with - Useful for tooling. - @return {Promise} a promise that will become fulfilled with the given - `value` -*/ -export default function resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(noop); - _resolve(promise, object); - return promise; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js deleted file mode 100644 index 31ec6f9c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js +++ /dev/null @@ -1,22 +0,0 @@ -export function objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); -} - -export function isFunction(x) { - return typeof x === 'function'; -} - -export function isMaybeThenable(x) { - return typeof x === 'object' && x !== null; -} - -var _isArray; -if (!Array.isArray) { - _isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; -} else { - _isArray = Array.isArray; -} - -export var isArray = _isArray; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json deleted file mode 100644 index 339d6738..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json +++ /dev/null @@ -1,89 +0,0 @@ -{ - "name": "es6-promise", - "namespace": "es6-promise", - "version": "2.1.1", - "description": "A lightweight library that provides tools for organizing asynchronous code", - "main": "dist/es6-promise.js", - "directories": { - "lib": "lib" - }, - "files": [ - "dist", - "lib" - ], - "devDependencies": { - "bower": "^1.3.9", - "brfs": "0.0.8", - "broccoli-es3-safe-recast": "0.0.8", - "broccoli-es6-module-transpiler": "^0.5.0", - "broccoli-jshint": "^0.5.1", - "broccoli-merge-trees": "^0.1.4", - "broccoli-replace": "^0.2.0", - "broccoli-stew": "0.0.6", - "broccoli-uglify-js": "^0.1.3", - "broccoli-watchify": "^0.2.0", - "ember-cli": "^0.2.2", - "ember-publisher": "0.0.7", - "git-repo-version": "0.0.2", - "json3": "^3.3.2", - "minimatch": "^2.0.1", - "mocha": "^1.20.1", - "promises-aplus-tests-phantom": "^2.1.0-revise", - "release-it": "0.0.10" - }, - "scripts": { - "build": "ember build", - "start": "ember s", - "test": "ember test", - "test:server": "ember test --server", - "test:node": "ember build && mocha ./dist/test/browserify", - "lint": "jshint lib", - "prepublish": "ember build --environment production", - "dry-run-release": "ember build --environment production && release-it --dry-run --non-interactive" - }, - "repository": { - "type": "git", - "url": "git://github.com/jakearchibald/ES6-Promises.git" - }, - "bugs": { - "url": "https://github.com/jakearchibald/ES6-Promises/issues" - }, - "browser": { - "vertx": false - }, - "keywords": [ - "promises", - "futures" - ], - "author": { - "name": "Yehuda Katz, Tom Dale, Stefan Penner and contributors", - "url": "Conversion to ES6 API by Jake Archibald" - }, - "license": "MIT", - "spm": { - "main": "dist/es6-promise.js" - }, - "gitHead": "02cf697c50856f0cd3785f425a2cf819af0e521c", - "homepage": "https://github.com/jakearchibald/ES6-Promises", - "_id": "es6-promise@2.1.1", - "_shasum": "03e8f3c7297928e5478d6ab1d0643251507bdedd", - "_from": "es6-promise@2.1.1", - "_npmVersion": "2.5.1", - "_nodeVersion": "0.12.1", - "_npmUser": { - "name": "jaffathecake", - "email": "jaffathecake@gmail.com" - }, - "maintainers": [ - { - "name": "jaffathecake", - "email": "jaffathecake@gmail.com" - } - ], - "dist": { - "shasum": "03e8f3c7297928e5478d6ab1d0643251507bdedd", - "tarball": "http://registry.npmjs.org/es6-promise/-/es6-promise-2.1.1.tgz" - }, - "_resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.1.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md deleted file mode 100644 index 07336250..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md +++ /dev/null @@ -1,266 +0,0 @@ -1.2.19 10-15-2015 ------------------ -- Make batchSize always be > 0 for 3.2 wire protocol to make it work consistently with pre 3.2 servers. -- Locked to bson 0.4.19. - -1.2.18 10-15-2015 ------------------ -- Minor 3.2 fix for handling readPreferences on sharded commands. -- Minor fixes to correctly pass APM specification test suite. - -1.2.17 10-08-2015 ------------------ -- Connections to arbiters only maintain a single connection. - -1.2.15 10-06-2015 ------------------ -- Set slaveOk to true for getMore and killCursors commands. -- Don't swallow callback errors for 2.4 single server (Issue #49, https://github.com/vkarpov15). -- Apply toString('hex') to each buffer in an array when logging (Issue #48, https://github.com/nbrachet). - -1.2.14 09-28-2015 ------------------ -- NODE-547 only emit error if there are any listeners. -- Fixed APM issue with issuing readConcern. - -1.2.13 09-18-2015 ------------------ -- Added BSON serializer ignoreUndefined option for insert/update/remove/command/cursor. - -1.2.12 09-08-2015 ------------------ -- NODE-541 Added initial support for readConcern. - -1.2.11 08-31-2015 ------------------ -- NODE-535 If connectWithNoPrimary is true then primary-only connection is not allowed. -- NODE-534 Passive secondaries are not allowed for secondaryOnlyConnectionAllowed. -- Fixed filtering bug for logging (Issue 30, https://github.com/christkv/mongodb-core/issues/30). - -1.2.10 08-14-2015 ------------------ -- Added missing Mongos.prototype.parserType function. - -1.2.9 08-05-2015 ----------------- -- NODE-525 Reset connectionTimeout after it's overwritten by tls.connect. -- NODE-518 connectTimeoutMS is doubled in 2.0.39. - -1.2.8 07-24-2015 ------------------ -- Minor fix to handle 2.4.x errors better by correctly return driver layer issues. - -1.2.7 07-16-2015 ------------------ -- Refactoring to allow to tap into find/getmore/killcursor in cursors for APM monitoring in driver. - -1.2.6 07-14-2015 ------------------ -- NODE-505 Query fails to find records that have a 'result' property with an array value. - -1.2.5 07-14-2015 ------------------ -- NODE-492 correctly handle hanging replicaset monitoring connections when server is unavailable due to network partitions or firewalls dropping packets, configureable using the connectionTimeoutMS setting. - -1.2.4 07-07-2015 ------------------ -- NODE-493 staggering the socket connections to avoid overwhelming the mongod process. - -1.2.3 06-26-2015 ------------------ -- Minor bug fixes. - -1.2.2 06-22-2015 ------------------ -- Fix issue with SCRAM authentication causing authentication to return true on failed authentication (Issue 26, https://github.com/cglass17). - -1.2.1 06-17-2015 ------------------ -- Ensure serializeFunctions passed down correctly to wire protocol. - -1.2.0 06-17-2015 ------------------ -- Switching to using the 0.4.x pure JS serializer, removing dependency on C++ parser. -- Refactoring wire protocol messages to avoid expensive size calculations of documents in favor of writing out an array of buffers to the sockets. -- NODE-486 fixed issue related to limit and skip when calling toArray in 2.0 driver. -- NODE-483 throw error if capabilities of topology is queries before topology has performed connection setup. -- NODE-487 fixed issue where killcursor command was not being sent correctly on limit and skip queries. - -1.1.33 05-31-2015 ------------------ -- NODE-478 Work around authentication race condition in mongos authentication due to multi step authentication methods like SCRAM. - -1.1.32 05-20-2015 ------------------ -- After reconnect, it updates the allowable reconnect retries to the option settings (Issue #23, https://github.com/owenallenaz) - -1.1.31 05-19-2015 ------------------ -- Minor fixes for issues with re-authentication of mongos. - -1.1.30 05-18-2015 ------------------ -- Correctly emit 'all' event when primary + all secondaries have connected. - -1.1.29 05-17-2015 ------------------ -- NODE-464 Only use a single socket against arbiters and hidden servers. -- Ensure we filter out hidden servers from any server queries. - -1.1.28 05-12-2015 ------------------ -- Fixed buffer compare for electionId for < node 12.0.2 - -1.1.27 05-12-2015 ------------------ -- NODE-455 Update SDAM specification support to cover electionId and Mongos load balancing. - -1.1.26 05-06-2015 ------------------ -- NODE-456 Allow mongodb-core to pipeline commands (ex findAndModify+GLE) along the same connection and handle the returned results. -- Fixes to make mongodb-core work for node 0.8.x when using scram and setImmediate. - -1.1.25 04-24-2015 ------------------ -- Handle lack of callback in crud operations when returning error on application closed. - -1.1.24 04-22-2015 ------------------ -- Error out when topology has been destroyed either by connection retries being exhausted or destroy called on topology. - -1.1.23 04-15-2015 ------------------ -- Standardizing mongoErrors and its API (Issue #14) -- Creating a new connection is slow because of 100ms setTimeout() (Issue #17, https://github.com/vkarpov15) -- remove mkdirp and rimraf dependencies (Issue #12) -- Updated default value of param options.rejectUnauthorized to match documentation (Issue #16) -- ISSUE: NODE-417 Resolution. Improving behavior of thrown errors (Issue #14, https://github.com/owenallenaz) -- Fix cursor hanging when next() called on exhausted cursor (Issue #18, https://github.com/vkarpov15) - -1.1.22 04-10-2015 ------------------ -- Minor refactorings in cursor code to make extending the cursor simpler. -- NODE-417 Resolution. Improving behavior of thrown errors using Error.captureStackTrace. - -1.1.21 03-26-2015 ------------------ -- Updated bson module to 0.3.0 that extracted the c++ parser into bson-ext and made it an optional dependency. - -1.1.20 03-24-2015 ------------------ -- NODE-395 Socket Not Closing, db.close called before full set finished initalizing leading to server connections in progress not being closed properly. - -1.1.19 03-21-2015 ------------------ -- Made kerberos module ~0.0 to allow for quicker releases due to io.js of kerberos module. - -1.1.18 03-17-2015 ------------------ -- Added support for minHeartbeatFrequencyMS on server reconnect according to the SDAM specification. - -1.1.17 03-16-2015 ------------------ -- NODE-377, fixed issue where tags would correctly be checked on secondary and nearest to filter out eligible server candidates. - -1.1.16 03-06-2015 ------------------ -- rejectUnauthorized parameter is set to true for ssl certificates by default instead of false. - -1.1.15 03-04-2015 ------------------ -- Removed check for type in replset pickserver function. - -1.1.14 02-26-2015 ------------------ -- NODE-374 correctly adding passive secondaries to the list of eligable servers for reads - -1.1.13 02-24-2015 ------------------ -- NODE-365 mongoDB native node.js driver infinite reconnect attempts (fixed issue around handling of retry attempts) - -1.1.12 02-16-2015 ------------------ -- Fixed cursor transforms for buffered document reads from cursor. - -1.1.11 02-02-2015 ------------------ -- Remove the required setName for replicaset connections, if not set it will pick the first setName returned. - -1.1.10 31-01-2015 ------------------ -- Added tranforms.doc option to cursor to allow for pr. document transformations. - -1.1.9 21-01-2015 ----------------- -- Updated BSON dependency to 0.2.18 to fix issues with io.js and node. -- Updated Kerberos dependency to 0.0.8 to fix issues with io.js and node. -- Don't treat findOne() as a command cursor. -- Refactored out state changes into methods to simplify read the next method. - -1.1.8 09-12-2015 ----------------- -- Stripped out Object.defineProperty for performance reasons -- Applied more performance optimizations. -- properties cursorBatchSize, cursorSkip, cursorLimit are not methods setCursorBatchSize/cursorBatchSize, setCursorSkip/cursorSkip, setCursorLimit/cursorLimit - -1.1.7 18-12-2014 ----------------- -- Use ns variable for getMore commands for command cursors to work properly with cursor version of listCollections and listIndexes. - -1.1.6 18-12-2014 ----------------- -- Server manager fixed to support 2.2.X servers for travis test matrix. - -1.1.5 17-12-2014 ----------------- -- Fall back to errmsg when creating MongoError for command errors - -1.1.4 17-12-2014 ----------------- -- Added transform method support for cursor (initially just for initial query results) to support listCollections/listIndexes in 2.8. -- Fixed variable leak in scram. -- Fixed server manager to deal better with killing processes. -- Bumped bson to 0.2.16. - -1.1.3 01-12-2014 ----------------- -- Fixed error handling issue with nonce generation in mongocr. -- Fixed issues with restarting servers when using ssl. -- Using strict for all classes. -- Cleaned up any escaping global variables. - -1.1.2 20-11-2014 ----------------- -- Correctly encoding UTF8 collection names on wire protocol messages. -- Added emitClose parameter to topology destroy methods to allow users to specify that they wish the topology to emit the close event to any listeners. - -1.1.1 14-11-2014 ----------------- -- Refactored code to use prototype instead of privileged methods. -- Fixed issue with auth where a runtime condition could leave replicaset members without proper authentication. -- Several deopt optimizations for v8 to improve performance and reduce GC pauses. - -1.0.5 29-10-2014 ----------------- -- Fixed issue with wrong namespace being created for command cursors. - -1.0.4 24-10-2014 ----------------- -- switched from using shift for the cursor due to bad slowdown on big batchSizes as shift causes entire array to be copied on each call. - -1.0.3 21-10-2014 ----------------- -- fixed error issuing problem on cursor.next when iterating over a huge dataset with a very small batchSize. - -1.0.2 07-10-2014 ----------------- -- fullsetup is now defined as a primary and secondary being available allowing for all read preferences to be satisfied. -- fixed issue with replset_state logging. - -1.0.1 07-10-2014 ----------------- -- Dependency issue solved - -1.0.0 07-10-2014 ----------------- -- Initial release of mongodb-core diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE deleted file mode 100644 index ad410e11..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile deleted file mode 100644 index 36e12024..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -NODE = node -NPM = npm -JSDOC = jsdoc -name = all - -generate_docs: - # cp -R ./HISTORY.md ./docs/content/meta/release-notes.md - hugo -s docs/reference -d ../../public - $(JSDOC) -c conf.json -t docs/jsdoc-template/ -d ./public/api - cp -R ./public/api/scripts ./public/. - cp -R ./public/api/styles ./public/. diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md deleted file mode 100644 index 1c9e4c84..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# Description - -The MongoDB Core driver is the low level part of the 2.0 or higher MongoDB driver and is meant for library developers not end users. It does not contain any abstractions or helpers outside of the basic management of MongoDB topology connections, CRUD operations and authentication. - -## MongoDB Node.JS Core Driver - -| what | where | -|---------------|------------------------------------------------| -| documentation | http://mongodb.github.io/node-mongodb-native/ | -| apidoc | http://mongodb.github.io/node-mongodb-native/ | -| source | https://github.com/christkv/mongodb-core | -| mongodb | http://www.mongodb.org/ | - -### Blogs of Engineers involved in the driver -- Christian Kvalheim [@christkv](https://twitter.com/christkv) - -### Bugs / Feature Requests - -Think you’ve found a bug? Want to see a new feature in node-mongodb-native? Please open a -case in our issue management tool, JIRA: - -- Create an account and login . -- Navigate to the NODE project . -- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it. - -Bug reports in JIRA for all driver projects (i.e. NODE, PYTHON, CSHARP, JAVA) and the -Core Server (i.e. SERVER) project are **public**. - -### Questions and Bug Reports - - * mailing list: https://groups.google.com/forum/#!forum/node-mongodb-native - * jira: http://jira.mongodb.org/ - -### Change Log - -http://jira.mongodb.org/browse/NODE - -# QuickStart - -The quick start guide will show you how to set up a simple application using Core driver and MongoDB. It scope is only how to set up the driver and perform the simple crud operations. For more inn depth coverage we encourage reading the tutorials. - -## Create the package.json file - -Let's create a directory where our application will live. In our case we will put this under our projects directory. - -``` -mkdir myproject -cd myproject -``` - -Create a **package.json** using your favorite text editor and fill it in. - -```json -{ - "name": "myproject", - "version": "1.0.0", - "description": "My first project", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/christkv/myfirstproject.git" - }, - "dependencies": { - "mongodb-core": "~1.0" - }, - "author": "Christian Kvalheim", - "license": "Apache 2.0", - "bugs": { - "url": "https://github.com/christkv/myfirstproject/issues" - }, - "homepage": "https://github.com/christkv/myfirstproject" -} -``` - -Save the file and return to the shell or command prompt and use **NPM** to install all the dependencies. - -``` -npm install -``` - -You should see **NPM** download a lot of files. Once it's done you'll find all the downloaded packages under the **node_modules** directory. - -Booting up a MongoDB Server ---------------------------- -Let's boot up a MongoDB server instance. Download the right MongoDB version from [MongoDB](http://www.mongodb.org), open a new shell or command line and ensure the **mongod** command is in the shell or command line path. Now let's create a database directory (in our case under **/data**). - -``` -mongod --dbpath=/data --port 27017 -``` - -You should see the **mongod** process start up and print some status information. - -## Connecting to MongoDB - -Let's create a new **app.js** file that we will use to show the basic CRUD operations using the MongoDB driver. - -First let's add code to connect to the server. Notice that there is no concept of a database here and we use the topology directly to perform the connection. - -```js -var Server = require('mongodb-core').Server - , assert = require('assert'); - -// Set up server connection -var server = new Server({ - host: 'localhost' - , port: 27017 - , reconnect: true - , reconnectInterval: 50 -}); - -// Add event listeners -server.on('connect', function(_server) { - console.log('connected'); - test.done(); -}); - -server.on('close', function() { - console.log('closed'); -}); - -server.on('reconnect', function() { - console.log('reconnect'); -}); - -// Start connection -server.connect(); -``` - -To connect to a replicaset we would use the `ReplSet` class and for a set of Mongos proxies we use the `Mongos` class. Each topology class offer the same CRUD operations and you operate on the topology directly. Let's look at an example exercising all the different available CRUD operations. - -```js -var Server = require('mongodb-core').Server - , assert = require('assert'); - -// Set up server connection -var server = new Server({ - host: 'localhost' - , port: 27017 - , reconnect: true - , reconnectInterval: 50 -}); - -// Add event listeners -server.on('connect', function(_server) { - console.log('connected'); - - // Execute the ismaster command - _server.command('system.$cmd', {ismaster: true}, function(err, result) { - - // Perform a document insert - _server.insert('myproject.inserts1', [{a:1}, {a:2}], { - writeConcern: {w:1}, ordered:true - }, function(err, results) { - assert.equal(null, err); - assert.equal(2, results.result.n); - - // Perform a document update - _server.update('myproject.inserts1', [{ - q: {a: 1}, u: {'$set': {b:1}} - }], { - writeConcern: {w:1}, ordered:true - }, function(err, results) { - assert.equal(null, err); - assert.equal(1, results.result.n); - - // Remove a document - _server.remove('myproject.inserts1', [{ - q: {a: 1}, limit: 1 - }], { - writeConcern: {w:1}, ordered:true - }, function(err, results) { - assert.equal(null, err); - assert.equal(1, results.result.n); - - // Get a document - var cursor = _server.cursor('integration_tests.inserts_example4', { - find: 'integration_tests.example4' - , query: {a:1} - }); - - // Get the first document - cursor.next(function(err, doc) { - assert.equal(null, err); - assert.equal(2, doc.a); - - // Execute the ismaster command - _server.command("system.$cmd" - , {ismaster: true}, function(err, result) { - assert.equal(null, err) - _server.destroy(); - }); - }); - }); - }); - - test.done(); - }); -}); - -server.on('close', function() { - console.log('closed'); -}); - -server.on('reconnect', function() { - console.log('reconnect'); -}); - -// Start connection -server.connect(); -``` - -The core driver does not contain any helpers or abstractions only the core crud operations. These consist of the following commands. - -* `insert`, Insert takes an array of 1 or more documents to be inserted against the topology and allows you to specify a write concern and if you wish to execute the inserts in order or out of order. -* `update`, Update takes an array of 1 or more update commands to be executed against the server topology and also allows you to specify a write concern and if you wish to execute the updates in order or out of order. -* `remove`, Remove takes an array of 1 or more remove commands to be executed against the server topology and also allows you to specify a write concern and if you wish to execute the removes in order or out of order. -* `cursor`, Returns you a cursor for either the 'virtual' `find` command, a command that returns a cursor id or a plain cursor id. Read the cursor tutorial for more inn depth coverage. -* `command`, Executes a command against MongoDB and returns the result. -* `auth`, Authenticates the current topology using a supported authentication scheme. - -The Core Driver is a building block for library builders and is not meant for usage by end users as it lacks a lot of features the end user might need such as automatic buffering of operations when a primary is changing in a replicaset or the db and collections abstraction. - -## Next steps - -The next step is to get more in depth information about how the different aspects of the core driver works and how to leverage them to extend the functionality of the cursors. Please view the tutorials for more detailed information. diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md deleted file mode 100644 index fe03ea0f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md +++ /dev/null @@ -1,18 +0,0 @@ -Testing setup -============= - -Single Server -------------- -mongod --dbpath=./db - -Replicaset ----------- -mongo --nodb -var x = new ReplSetTest({"useHostName":"false", "nodes" : {node0 : {}, node1 : {}, node2 : {}}}) -x.startSet(); -var config = x.getReplSetConfig() -x.initiate(config); - -Mongos ------- -var s = new ShardingTest( "auth1", 1 , 0 , 2 , {rs: true, noChunkSize : true}); \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json deleted file mode 100644 index c5eca926..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "plugins": ["plugins/markdown", "docs/lib/jsdoc/examples_plugin.js"], - "source": { - "include": [ - "test/tests/functional/operation_example_tests.js", - "lib/topologies/mongos.js", - "lib/topologies/command_result.js", - "lib/topologies/read_preference.js", - "lib/topologies/replset.js", - "lib/topologies/server.js", - "lib/topologies/session.js", - "lib/topologies/replset_state.js", - "lib/connection/logger.js", - "lib/connection/connection.js", - "lib/cursor.js", - "lib/error.js", - "node_modules/bson/lib/bson/binary.js", - "node_modules/bson/lib/bson/code.js", - "node_modules/bson/lib/bson/db_ref.js", - "node_modules/bson/lib/bson/double.js", - "node_modules/bson/lib/bson/long.js", - "node_modules/bson/lib/bson/objectid.js", - "node_modules/bson/lib/bson/symbol.js", - "node_modules/bson/lib/bson/timestamp.js", - "node_modules/bson/lib/bson/max_key.js", - "node_modules/bson/lib/bson/min_key.js" - ] - }, - "templates": { - "cleverLinks": true, - "monospaceLinks": true, - "default": { - "outputSourceFiles" : true - }, - "applicationName": "Node.js MongoDB Driver API", - "disqus": true, - "googleAnalytics": "UA-29229787-1", - "openGraph": { - "title": "", - "type": "website", - "image": "", - "site_name": "", - "url": "" - }, - "meta": { - "title": "", - "description": "", - "keyword": "" - }, - "linenums": true - }, - "markdown": { - "parser": "gfm", - "hardwrap": true, - "tags": ["examples"] - }, - "examples": { - "indent": 4 - } -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js deleted file mode 100644 index 8f108604..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - MongoError: require('./lib/error') - , Server: require('./lib/topologies/server') - , ReplSet: require('./lib/topologies/replset') - , Mongos: require('./lib/topologies/mongos') - , Logger: require('./lib/connection/logger') - , Cursor: require('./lib/cursor') - , ReadPreference: require('./lib/topologies/read_preference') - , BSON: require('bson') - // Raw operations - , Query: require('./lib/connection/commands').Query - // Auth mechanisms - , MongoCR: require('./lib/auth/mongocr') - , X509: require('./lib/auth/x509') - , Plain: require('./lib/auth/plain') - , GSSAPI: require('./lib/auth/gssapi') - , ScramSHA1: require('./lib/auth/scram') -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js deleted file mode 100644 index c442b9b0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js +++ /dev/null @@ -1,244 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password, options) { - this.db = db; - this.username = username; - this.password = password; - this.options = options; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -// Kerberos class -var Kerberos = null; -var MongoAuthProcess = null; - -// Try to grab the Kerberos class -try { - Kerberos = require('kerberos').Kerberos - // Authentication process for Mongo - MongoAuthProcess = require('kerberos').processes.MongoAuthProcess -} catch(err) {} - -/** - * Creates a new GSSAPI authentication mechanism - * @class - * @return {GSSAPI} A cursor instance - */ -var GSSAPI = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -GSSAPI.prototype.auth = function(server, pool, db, username, password, options, callback) { - var self = this; - // We don't have the Kerberos library - if(Kerberos == null) return callback(new Error("Kerberos library is not installed")); - var gssapiServiceName = options['gssapiServiceName'] || 'mongodb'; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Start Auth process for a connection - GSSAPIInitialize(db, username, password, db, gssapiServiceName, server, connection, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password, options)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -// -// Initialize step -var GSSAPIInitialize = function(db, username, password, authdb, gssapiServiceName, server, connection, callback) { - // Create authenticator - var mongo_auth_process = new MongoAuthProcess(connection.host, connection.port, gssapiServiceName); - - // Perform initialization - mongo_auth_process.init(username, password, function(err, context) { - if(err) return callback(err, false); - - // Perform the first step - mongo_auth_process.transition('', function(err, payload) { - if(err) return callback(err, false); - - // Call the next db step - MongoDBGSSAPIFirstStep(mongo_auth_process, payload, db, username, password, authdb, server, connection, callback); - }); - }); -} - -// -// Perform first step against mongodb -var MongoDBGSSAPIFirstStep = function(mongo_auth_process, payload, db, username, password, authdb, server, connection, callback) { - // Build the sasl start command - var command = { - saslStart: 1 - , mechanism: 'GSSAPI' - , payload: payload - , autoAuthorize: 1 - }; - - // Execute first sasl step - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - // Execute mongodb transition - mongo_auth_process.transition(r.result.payload, function(err, payload) { - if(err) return callback(err, false); - - // MongoDB API Second Step - MongoDBGSSAPISecondStep(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback); - }); - }); -} - -// -// Perform first step against mongodb -var MongoDBGSSAPISecondStep = function(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback) { - // Build Authentication command to send to MongoDB - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - // Call next transition for kerberos - mongo_auth_process.transition(doc.payload, function(err, payload) { - if(err) return callback(err, false); - - // Call the last and third step - MongoDBGSSAPIThirdStep(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback); - }); - }); -} - -var MongoDBGSSAPIThirdStep = function(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback) { - // Build final command - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - mongo_auth_process.transition(null, function(err, payload) { - if(err) return callback(err, null); - callback(null, r); - }); - }); -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -GSSAPI.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, this.authStore[i].options, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = GSSAPI; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js deleted file mode 100644 index d0e9f59b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new MongoCR authentication mechanism - * @class - * @return {MongoCR} A cursor instance - */ -var MongoCR = function() { - this.authStore = []; -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -MongoCR.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var executeMongoCR = function(connection) { - // Let's start the process - server.command(f("%s.$cmd", db) - , { getnonce: 1 } - , { connection: connection }, function(err, r) { - var nonce = null; - var key = null; - - // Adjust the number of connections left - // Get nonce - if(err == null) { - nonce = r.result.nonce; - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var hash_password = md5.digest('hex'); - // Final key - md5 = crypto.createHash('md5'); - md5.update(nonce + username + hash_password); - key = md5.digest('hex'); - } - - // Execute command - server.command(f("%s.$cmd", db) - , { authenticate: 1, user: username, nonce: nonce, key:key} - , { connection: connection }, function(err, r) { - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - }); - } - - // Get the connection - executeMongoCR(connections.shift()); - } -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -MongoCR.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = MongoCR; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js deleted file mode 100644 index 31ce8722..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js +++ /dev/null @@ -1,150 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , Binary = require('bson').Binary - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new Plain authentication mechanism - * @class - * @return {Plain} A cursor instance - */ -var Plain = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -Plain.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Create payload - var payload = new Binary(f("\x00%s\x00%s", username, password)); - - // Let's start the sasl process - var command = { - saslStart: 1 - , mechanism: 'PLAIN' - , payload: payload - , autoAuthorize: 1 - }; - - // Let's start the process - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -Plain.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = Plain; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js deleted file mode 100644 index fe96637b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js +++ /dev/null @@ -1,317 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , Binary = require('bson').Binary - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new ScramSHA1 authentication mechanism - * @class - * @return {ScramSHA1} A cursor instance - */ -var ScramSHA1 = function() { - this.authStore = []; -} - -var parsePayload = function(payload) { - var dict = {}; - var parts = payload.split(','); - - for(var i = 0; i < parts.length; i++) { - var valueParts = parts[i].split('='); - dict[valueParts[0]] = valueParts[1]; - } - - return dict; -} - -var passwordDigest = function(username, password) { - if(typeof username != 'string') throw new MongoError("username must be a string"); - if(typeof password != 'string') throw new MongoError("password must be a string"); - if(password.length == 0) throw new MongoError("password cannot be empty"); - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - return md5.digest('hex'); -} - -// XOR two buffers -var xor = function(a, b) { - if (!Buffer.isBuffer(a)) a = new Buffer(a) - if (!Buffer.isBuffer(b)) b = new Buffer(b) - var res = [] - if (a.length > b.length) { - for (var i = 0; i < b.length; i++) { - res.push(a[i] ^ b[i]) - } - } else { - for (var i = 0; i < a.length; i++) { - res.push(a[i] ^ b[i]) - } - } - return new Buffer(res); -} - -// Create a final digest -var hi = function(data, salt, iterations) { - // Create digest - var digest = function(msg) { - var hmac = crypto.createHmac('sha1', data); - hmac.update(msg); - return new Buffer(hmac.digest('base64'), 'base64'); - } - - // Create variables - salt = Buffer.concat([salt, new Buffer('\x00\x00\x00\x01')]) - var ui = digest(salt); - var u1 = ui; - - for(var i = 0; i < iterations - 1; i++) { - u1 = digest(u1); - ui = xor(ui, u1); - } - - return ui; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -ScramSHA1.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var executeScram = function(connection) { - // Clean up the user - username = username.replace('=', "=3D").replace(',', '=2C'); - - // Create a random nonce - var nonce = crypto.randomBytes(24).toString('base64'); - // var nonce = 'MsQUY9iw0T9fx2MUEz6LZPwGuhVvWAhc' - var firstBare = f("n=%s,r=%s", username, nonce); - - // Build command structure - var cmd = { - saslStart: 1 - , mechanism: 'SCRAM-SHA-1' - , payload: new Binary(f("n,,%s", firstBare)) - , autoAuthorize: 1 - } - - // Handle the error - var handleError = function(err, r) { - if(err) { - numberOfValidConnections = numberOfValidConnections - 1; - errorObject = err; return false; - } else if(r.result['$err']) { - errorObject = r.result; return false; - } else if(r.result['errmsg']) { - errorObject = r.result; return false; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - return true - } - - // Finish up - var finish = function(_count, _numberOfValidConnections) { - if(_count == 0 && _numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - return callback(null, true); - } else if(_count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using scram")); - return callback(errorObject, false); - } - } - - var handleEnd = function(_err, _r) { - // Handle any error - handleError(_err, _r) - // Adjust the number of connections - count = count - 1; - // Execute the finish - finish(count, numberOfValidConnections); - } - - // Execute start sasl command - server.command(f("%s.$cmd", db) - , cmd, { connection: connection }, function(err, r) { - - // Do we have an error, handle it - if(handleError(err, r) == false) { - count = count - 1; - - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - return callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using scram")); - return callback(errorObject, false); - } - - return; - } - - // Get the dictionary - var dict = parsePayload(r.result.payload.value()) - - // Unpack dictionary - var iterations = parseInt(dict.i, 10); - var salt = dict.s; - var rnonce = dict.r; - - // Set up start of proof - var withoutProof = f("c=biws,r=%s", rnonce); - var passwordDig = passwordDigest(username, password); - var saltedPassword = hi(passwordDig - , new Buffer(salt, 'base64') - , iterations); - - // Create the client key - var hmac = crypto.createHmac('sha1', saltedPassword); - hmac.update(new Buffer("Client Key")); - var clientKey = new Buffer(hmac.digest('base64'), 'base64'); - - // Create the stored key - var hash = crypto.createHash('sha1'); - hash.update(clientKey); - var storedKey = new Buffer(hash.digest('base64'), 'base64'); - - // Create the authentication message - var authMsg = [firstBare, r.result.payload.value().toString('base64'), withoutProof].join(','); - - // Create client signature - var hmac = crypto.createHmac('sha1', storedKey); - hmac.update(new Buffer(authMsg)); - var clientSig = new Buffer(hmac.digest('base64'), 'base64'); - - // Create client proof - var clientProof = f("p=%s", new Buffer(xor(clientKey, clientSig)).toString('base64')); - - // Create client final - var clientFinal = [withoutProof, clientProof].join(','); - - // Generate server key - var hmac = crypto.createHmac('sha1', saltedPassword); - hmac.update(new Buffer('Server Key')) - var serverKey = new Buffer(hmac.digest('base64'), 'base64'); - - // Generate server signature - var hmac = crypto.createHmac('sha1', serverKey); - hmac.update(new Buffer(authMsg)) - var serverSig = new Buffer(hmac.digest('base64'), 'base64'); - - // - // Create continue message - var cmd = { - saslContinue: 1 - , conversationId: r.result.conversationId - , payload: new Binary(new Buffer(clientFinal)) - } - - // - // Execute sasl continue - server.command(f("%s.$cmd", db) - , cmd, { connection: connection }, function(err, r) { - if(r && r.result.done == false) { - var cmd = { - saslContinue: 1 - , conversationId: r.result.conversationId - , payload: new Buffer(0) - } - - server.command(f("%s.$cmd", db) - , cmd, { connection: connection }, function(err, r) { - handleEnd(err, r); - }); - } else { - handleEnd(err, r); - } - }); - }); - } - - // Get the connection - executeScram(connections.shift()); - } -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -ScramSHA1.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - - -module.exports = ScramSHA1; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js deleted file mode 100644 index 177ede57..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js +++ /dev/null @@ -1,234 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password, options) { - this.db = db; - this.username = username; - this.password = password; - this.options = options; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -// Kerberos class -var Kerberos = null; -var MongoAuthProcess = null; - -// Try to grab the Kerberos class -try { - Kerberos = require('kerberos').Kerberos - // Authentication process for Mongo - MongoAuthProcess = require('kerberos').processes.MongoAuthProcess -} catch(err) {} - -/** - * Creates a new SSPI authentication mechanism - * @class - * @return {SSPI} A cursor instance - */ -var SSPI = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -SSPI.prototype.auth = function(server, pool, db, username, password, options, callback) { - var self = this; - // We don't have the Kerberos library - if(Kerberos == null) return callback(new Error("Kerberos library is not installed")); - var gssapiServiceName = options['gssapiServiceName'] || 'mongodb'; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Start Auth process for a connection - SSIPAuthenticate(username, password, gssapiServiceName, server, connection, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r && typeof r == 'object' && r.result['$err']) { - errorObject = r.result; - } else if(r && typeof r == 'object' && r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password, options)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -var SSIPAuthenticate = function(username, password, gssapiServiceName, server, connection, callback) { - // Build Authentication command to send to MongoDB - var command = { - saslStart: 1 - , mechanism: 'GSSAPI' - , payload: '' - , autoAuthorize: 1 - }; - - // Create authenticator - var mongo_auth_process = new MongoAuthProcess(connection.host, connection.port, gssapiServiceName); - - // Execute first sasl step - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - mongo_auth_process.init(username, password, function(err) { - if(err) return callback(err); - - mongo_auth_process.transition(doc.payload, function(err, payload) { - if(err) return callback(err); - - // Perform the next step against mongod - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - mongo_auth_process.transition(doc.payload, function(err, payload) { - if(err) return callback(err); - - // Perform the next step against mongod - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - mongo_auth_process.transition(doc.payload, function(err, payload) { - // Perform the next step against mongod - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - if(doc.done) return callback(null, true); - callback(new Error("Authentication failed"), false); - }); - }); - }); - }); - }); - }); - }); - }); -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -SSPI.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, this.authStore[i].options, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = SSPI; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js deleted file mode 100644 index 641990e4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new X509 authentication mechanism - * @class - * @return {X509} A cursor instance - */ -var X509 = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -X509.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Let's start the sasl process - var command = { - authenticate: 1 - , mechanism: 'MONGODB-X509' - , user: username - }; - - // Let's start the process - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -X509.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = X509; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js deleted file mode 100644 index 05023b4a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js +++ /dev/null @@ -1,519 +0,0 @@ -"use strict"; - -var f = require('util').format - , Long = require('bson').Long - , setProperty = require('./utils').setProperty - , getProperty = require('./utils').getProperty - , getSingleProperty = require('./utils').getSingleProperty; - -// Incrementing request id -var _requestId = 0; - -// Wire command operation ids -var OP_QUERY = 2004; -var OP_GETMORE = 2005; -var OP_KILL_CURSORS = 2007; - -// Query flags -var OPTS_NONE = 0; -var OPTS_TAILABLE_CURSOR = 2; -var OPTS_SLAVE = 4; -var OPTS_OPLOG_REPLAY = 8; -var OPTS_NO_CURSOR_TIMEOUT = 16; -var OPTS_AWAIT_DATA = 32; -var OPTS_EXHAUST = 64; -var OPTS_PARTIAL = 128; - -// Response flags -var CURSOR_NOT_FOUND = 0; -var QUERY_FAILURE = 2; -var SHARD_CONFIG_STALE = 4; -var AWAIT_CAPABLE = 8; - -/************************************************************** - * QUERY - **************************************************************/ -var Query = function(bson, ns, query, options) { - var self = this; - // Basic options needed to be passed in - if(ns == null) throw new Error("ns must be specified for query"); - if(query == null) throw new Error("query must be specified for query"); - - // Validate that we are not passing 0x00 in the colletion name - if(!!~ns.indexOf("\x00")) { - throw new Error("namespace cannot contain a null character"); - } - - // Basic options - this.bson = bson; - this.ns = ns; - this.query = query; - - // Ensure empty options - this.options = options || {}; - - // Additional options - this.numberToSkip = options.numberToSkip || 0; - this.numberToReturn = options.numberToReturn || 0; - this.returnFieldSelector = options.returnFieldSelector || null; - this.requestId = _requestId++; - - // Serialization option - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.maxBsonSize = options.maxBsonSize || 1024 * 1024 * 16; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : true; - this.batchSize = self.numberToReturn; - - // Flags - this.tailable = false; - this.slaveOk = false; - this.oplogReply = false; - this.noCursorTimeout = false; - this.awaitData = false; - this.exhaust = false; - this.partial = false; -} - -// -// Assign a new request Id -Query.prototype.incRequestId = function() { - this.requestId = _requestId++; -} - -// -// Assign a new request Id -Query.nextRequestId = function() { - return _requestId + 1; -} - -// -// Uses a single allocated buffer for the process, avoiding multiple memory allocations -Query.prototype.toBin = function() { - var self = this; - var buffers = []; - var projection = null; - - // Set up the flags - var flags = 0; - if(this.tailable) flags |= OPTS_TAILABLE_CURSOR; - if(this.slaveOk) flags |= OPTS_SLAVE; - if(this.oplogReply) flags |= OPTS_OPLOG_REPLAY; - if(this.noCursorTimeout) flags |= OPTS_NO_CURSOR_TIMEOUT; - if(this.awaitData) flags |= OPTS_AWAIT_DATA; - if(this.exhaust) flags |= OPTS_EXHAUST; - if(this.partial) flags |= OPTS_PARTIAL; - - // If batchSize is different to self.numberToReturn - if(self.batchSize != self.numberToReturn) self.numberToReturn = self.batchSize; - - // Allocate write protocol header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // Flags - + Buffer.byteLength(self.ns) + 1 // namespace - + 4 // numberToSkip - + 4 // numberToReturn - ); - - // Add header to buffers - buffers.push(header); - - // Serialize the query - var query = self.bson.serialize(this.query - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - - // Add query document - buffers.push(query); - - if(self.returnFieldSelector && Object.keys(self.returnFieldSelector).length > 0) { - // Serialize the projection document - projection = self.bson.serialize(this.returnFieldSelector, this.checkKeys, true, this.serializeFunctions, this.ignoreUndefined); - // Add projection document - buffers.push(projection); - } - - // Total message size - var totalLength = header.length + query.length + (projection ? projection.length : 0); - - // Set up the index - var index = 4; - - // Write total document length - header[3] = (totalLength >> 24) & 0xff; - header[2] = (totalLength >> 16) & 0xff; - header[1] = (totalLength >> 8) & 0xff; - header[0] = (totalLength) & 0xff; - - // Write header information requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // Write header information responseTo - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Write header information OP_QUERY - header[index + 3] = (OP_QUERY >> 24) & 0xff; - header[index + 2] = (OP_QUERY >> 16) & 0xff; - header[index + 1] = (OP_QUERY >> 8) & 0xff; - header[index] = (OP_QUERY) & 0xff; - index = index + 4; - - // Write header information flags - header[index + 3] = (flags >> 24) & 0xff; - header[index + 2] = (flags >> 16) & 0xff; - header[index + 1] = (flags >> 8) & 0xff; - header[index] = (flags) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Write header information flags numberToSkip - header[index + 3] = (this.numberToSkip >> 24) & 0xff; - header[index + 2] = (this.numberToSkip >> 16) & 0xff; - header[index + 1] = (this.numberToSkip >> 8) & 0xff; - header[index] = (this.numberToSkip) & 0xff; - index = index + 4; - - // Write header information flags numberToReturn - header[index + 3] = (this.numberToReturn >> 24) & 0xff; - header[index + 2] = (this.numberToReturn >> 16) & 0xff; - header[index + 1] = (this.numberToReturn >> 8) & 0xff; - header[index] = (this.numberToReturn) & 0xff; - index = index + 4; - - // Return the buffers - return buffers; -} - -Query.getRequestId = function() { - return ++_requestId; -} - -/************************************************************** - * GETMORE - **************************************************************/ -var GetMore = function(bson, ns, cursorId, opts) { - opts = opts || {}; - this.numberToReturn = opts.numberToReturn || 0; - this.requestId = _requestId++; - this.bson = bson; - this.ns = ns; - this.cursorId = cursorId; -} - -// -// Uses a single allocated buffer for the process, avoiding multiple memory allocations -GetMore.prototype.toBin = function() { - var length = 4 + Buffer.byteLength(this.ns) + 1 + 4 + 8 + (4 * 4); - // Create command buffer - var index = 0; - // Allocate buffer - var _buffer = new Buffer(length); - - // Write header information - // index = write32bit(index, _buffer, length); - _buffer[index + 3] = (length >> 24) & 0xff; - _buffer[index + 2] = (length >> 16) & 0xff; - _buffer[index + 1] = (length >> 8) & 0xff; - _buffer[index] = (length) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, requestId); - _buffer[index + 3] = (this.requestId >> 24) & 0xff; - _buffer[index + 2] = (this.requestId >> 16) & 0xff; - _buffer[index + 1] = (this.requestId >> 8) & 0xff; - _buffer[index] = (this.requestId) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, OP_GETMORE); - _buffer[index + 3] = (OP_GETMORE >> 24) & 0xff; - _buffer[index + 2] = (OP_GETMORE >> 16) & 0xff; - _buffer[index + 1] = (OP_GETMORE >> 8) & 0xff; - _buffer[index] = (OP_GETMORE) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // Write collection name - index = index + _buffer.write(this.ns, index, 'utf8') + 1; - _buffer[index - 1] = 0; - - // Write batch size - // index = write32bit(index, _buffer, numberToReturn); - _buffer[index + 3] = (this.numberToReturn >> 24) & 0xff; - _buffer[index + 2] = (this.numberToReturn >> 16) & 0xff; - _buffer[index + 1] = (this.numberToReturn >> 8) & 0xff; - _buffer[index] = (this.numberToReturn) & 0xff; - index = index + 4; - - // Write cursor id - // index = write32bit(index, _buffer, cursorId.getLowBits()); - _buffer[index + 3] = (this.cursorId.getLowBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorId.getLowBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorId.getLowBits() >> 8) & 0xff; - _buffer[index] = (this.cursorId.getLowBits()) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, cursorId.getHighBits()); - _buffer[index + 3] = (this.cursorId.getHighBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorId.getHighBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorId.getHighBits() >> 8) & 0xff; - _buffer[index] = (this.cursorId.getHighBits()) & 0xff; - index = index + 4; - - // Return buffer - return _buffer; -} - -/************************************************************** - * KILLCURSOR - **************************************************************/ -var KillCursor = function(bson, cursorIds) { - this.requestId = _requestId++; - this.cursorIds = cursorIds; -} - -// -// Uses a single allocated buffer for the process, avoiding multiple memory allocations -KillCursor.prototype.toBin = function() { - var length = 4 + 4 + (4 * 4) + (this.cursorIds.length * 8); - - // Create command buffer - var index = 0; - var _buffer = new Buffer(length); - - // Write header information - // index = write32bit(index, _buffer, length); - _buffer[index + 3] = (length >> 24) & 0xff; - _buffer[index + 2] = (length >> 16) & 0xff; - _buffer[index + 1] = (length >> 8) & 0xff; - _buffer[index] = (length) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, requestId); - _buffer[index + 3] = (this.requestId >> 24) & 0xff; - _buffer[index + 2] = (this.requestId >> 16) & 0xff; - _buffer[index + 1] = (this.requestId >> 8) & 0xff; - _buffer[index] = (this.requestId) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, OP_KILL_CURSORS); - _buffer[index + 3] = (OP_KILL_CURSORS >> 24) & 0xff; - _buffer[index + 2] = (OP_KILL_CURSORS >> 16) & 0xff; - _buffer[index + 1] = (OP_KILL_CURSORS >> 8) & 0xff; - _buffer[index] = (OP_KILL_CURSORS) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // Write batch size - // index = write32bit(index, _buffer, this.cursorIds.length); - _buffer[index + 3] = (this.cursorIds.length >> 24) & 0xff; - _buffer[index + 2] = (this.cursorIds.length >> 16) & 0xff; - _buffer[index + 1] = (this.cursorIds.length >> 8) & 0xff; - _buffer[index] = (this.cursorIds.length) & 0xff; - index = index + 4; - - // Write all the cursor ids into the array - for(var i = 0; i < this.cursorIds.length; i++) { - // Write cursor id - // index = write32bit(index, _buffer, cursorIds[i].getLowBits()); - _buffer[index + 3] = (this.cursorIds[i].getLowBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorIds[i].getLowBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorIds[i].getLowBits() >> 8) & 0xff; - _buffer[index] = (this.cursorIds[i].getLowBits()) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, cursorIds[i].getHighBits()); - _buffer[index + 3] = (this.cursorIds[i].getHighBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorIds[i].getHighBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorIds[i].getHighBits() >> 8) & 0xff; - _buffer[index] = (this.cursorIds[i].getHighBits()) & 0xff; - index = index + 4; - } - - // Return buffer - return _buffer; -} - -var Response = function(bson, data, opts) { - opts = opts || {promoteLongs: true}; - this.parsed = false; - - // - // Parse Header - // - this.index = 0; - this.raw = data; - this.data = data; - this.bson = bson; - this.opts = opts; - - // Read the message length - this.length = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Fetch the request id for this reply - this.requestId = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Fetch the id of the request that triggered the response - this.responseTo = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Skip op-code field - this.index = this.index + 4; - - // Unpack flags - this.responseFlags = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Unpack the cursor - var lowBits = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - var highBits = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - // Create long object - this.cursorId = new Long(lowBits, highBits); - - // Unpack the starting from - this.startingFrom = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Unpack the number of objects returned - this.numberReturned = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Preallocate document array - this.documents = new Array(this.numberReturned); - - // Flag values - this.cursorNotFound = (this.responseFlags & CURSOR_NOT_FOUND) != 0; - this.queryFailure = (this.responseFlags & QUERY_FAILURE) != 0; - this.shardConfigStale = (this.responseFlags & SHARD_CONFIG_STALE) != 0; - this.awaitCapable = (this.responseFlags & AWAIT_CAPABLE) != 0; - this.promoteLongs = typeof opts.promoteLongs == 'boolean' ? opts.promoteLongs : true; -} - -Response.prototype.isParsed = function() { - return this.parsed; -} - -// Validation buffers -var firstBatch = new Buffer('firstBatch', 'utf8'); -var nextBatch = new Buffer('nextBatch', 'utf8'); -var cursorId = new Buffer('id', 'utf8').toString('hex'); - -var documentBuffers = { - firstBatch: firstBatch.toString('hex'), - nextBatch: nextBatch.toString('hex') -}; - -Response.prototype.parse = function(options) { - // Don't parse again if not needed - if(this.parsed) return; - options = options || {}; - - // Allow the return of raw documents instead of parsing - var raw = options.raw || false; - var documentsReturnedIn = options.documentsReturnedIn || null; - - // - // Single document and documentsReturnedIn set - // - if(this.numberReturned == 1 && documentsReturnedIn != null && raw) { - // Calculate the bson size - var bsonSize = this.data[this.index] | this.data[this.index + 1] << 8 | this.data[this.index + 2] << 16 | this.data[this.index + 3] << 24; - // Slice out the buffer containing the command result document - var document = this.data.slice(this.index, this.index + bsonSize); - // Set up field we wish to keep as raw - var fieldsAsRaw = {} - fieldsAsRaw[documentsReturnedIn] = true; - // Set up the options - var _options = {promoteLongs: this.opts.promoteLongs, fieldsAsRaw: fieldsAsRaw}; - - // Deserialize but keep the array of documents in non-parsed form - var doc = this.bson.deserialize(document, _options); - - // Get the documents - this.documents = doc.cursor[documentsReturnedIn]; - this.numberReturned = this.documents.length; - // Ensure we have a Long valie cursor id - this.cursorId = typeof doc.cursor.id == 'number' - ? Long.fromNumber(doc.cursor.id) - : doc.cursor.id; - - // Adjust the index - this.index = this.index + bsonSize; - - // Set as parsed - this.parsed = true - return; - } - - // - // Parse Body - // - for(var i = 0; i < this.numberReturned; i++) { - var bsonSize = this.data[this.index] | this.data[this.index + 1] << 8 | this.data[this.index + 2] << 16 | this.data[this.index + 3] << 24; - // Parse options - var _options = {promoteLongs: this.opts.promoteLongs}; - - // If we have raw results specified slice the return document - if(raw) { - this.documents[i] = this.data.slice(this.index, this.index + bsonSize); - } else { - this.documents[i] = this.bson.deserialize(this.data.slice(this.index, this.index + bsonSize), _options); - } - - // Adjust the index - this.index = this.index + bsonSize; - } - - // Set parsed - this.parsed = true; -} - -module.exports = { - Query: Query - , GetMore: GetMore - , Response: Response - , KillCursor: KillCursor -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js deleted file mode 100644 index 6d5779c0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js +++ /dev/null @@ -1,469 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , EventEmitter = require('events').EventEmitter - , net = require('net') - , tls = require('tls') - , f = require('util').format - , getSingleProperty = require('./utils').getSingleProperty - , debugOptions = require('./utils').debugOptions - , Response = require('./commands').Response - , MongoError = require('../error') - , Logger = require('./logger'); - -var _id = 0; -var debugFields = ['host', 'port', 'size', 'keepAlive', 'keepAliveInitialDelay', 'noDelay' - , 'connectionTimeout', 'socketTimeout', 'singleBufferSerializtion', 'ssl', 'ca', 'cert' - , 'rejectUnauthorized', 'promoteLongs']; - -/** - * Creates a new Connection instance - * @class - * @param {string} options.host The server host - * @param {number} options.port The server port - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @fires Connection#connect - * @fires Connection#close - * @fires Connection#error - * @fires Connection#timeout - * @fires Connection#parseError - * @return {Connection} A cursor instance - */ -var Connection = function(options) { - // Add event listener - EventEmitter.call(this); - // Set empty if no options passed - this.options = options || {}; - // Identification information - this.id = _id++; - // Logger instance - this.logger = Logger('Connection', options); - // No bson parser passed in - if(!options.bson) throw new Error("must pass in valid bson parser"); - // Get bson parser - this.bson = options.bson; - // Grouping tag used for debugging purposes - this.tag = options.tag; - // Message handler - this.messageHandler = options.messageHandler; - - // Max BSON message size - this.maxBsonMessageSize = options.maxBsonMessageSize || (1024 * 1024 * 16 * 4); - // Debug information - if(this.logger.isDebug()) this.logger.debug(f('creating connection %s with options [%s]', this.id, JSON.stringify(debugOptions(debugFields, options)))); - - // Default options - this.port = options.port || 27017; - this.host = options.host || 'localhost'; - this.keepAlive = typeof options.keepAlive == 'boolean' ? options.keepAlive : true; - this.keepAliveInitialDelay = options.keepAliveInitialDelay || 0; - this.noDelay = typeof options.noDelay == 'boolean' ? options.noDelay : true; - this.connectionTimeout = options.connectionTimeout || 0; - this.socketTimeout = options.socketTimeout || 0; - - // If connection was destroyed - this.destroyed = false; - - // Check if we have a domain socket - this.domainSocket = this.host.indexOf('\/') != -1; - - // Serialize commands using function - this.singleBufferSerializtion = typeof options.singleBufferSerializtion == 'boolean' ? options.singleBufferSerializtion : true; - this.serializationFunction = this.singleBufferSerializtion ? 'toBinUnified' : 'toBin'; - - // SSL options - this.ca = options.ca || null; - this.cert = options.cert || null; - this.key = options.key || null; - this.passphrase = options.passphrase || null; - this.ssl = typeof options.ssl == 'boolean' ? options.ssl : false; - this.rejectUnauthorized = typeof options.rejectUnauthorized == 'boolean' ? options.rejectUnauthorized : true - - // If ssl not enabled - if(!this.ssl) this.rejectUnauthorized = false; - - // Response options - this.responseOptions = { - promoteLongs: typeof options.promoteLongs == 'boolean' ? options.promoteLongs : true - } - - // Flushing - this.flushing = false; - this.queue = []; - - // Internal state - this.connection = null; - this.writeStream = null; -} - -inherits(Connection, EventEmitter); - -// -// Connection handlers -var errorHandler = function(self) { - return function(err) { - // Debug information - if(self.logger.isDebug()) self.logger.debug(f('connection %s for [%s:%s] errored out with [%s]', self.id, self.host, self.port, JSON.stringify(err))); - // Emit the error - if(self.listeners('error').length > 0) self.emit("error", MongoError.create(err), self); - } -} - -var timeoutHandler = function(self) { - return function() { - // Debug information - if(self.logger.isDebug()) self.logger.debug(f('connection %s for [%s:%s] timed out', self.id, self.host, self.port)); - // Emit timeout error - self.emit("timeout" - , MongoError.create(f("connection %s to %s:%s timed out", self.id, self.host, self.port)) - , self); - } -} - -var closeHandler = function(self) { - return function(hadError) { - // Debug information - if(self.logger.isDebug()) self.logger.debug(f('connection %s with for [%s:%s] closed', self.id, self.host, self.port)); - // Emit close event - if(!hadError) { - self.emit("close" - , MongoError.create(f("connection %s to %s:%s closed", self.id, self.host, self.port)) - , self); - } - } -} - -var dataHandler = function(self) { - return function(data) { - // Parse until we are done with the data - while(data.length > 0) { - // If we still have bytes to read on the current message - if(self.bytesRead > 0 && self.sizeOfMessage > 0) { - // Calculate the amount of remaining bytes - var remainingBytesToRead = self.sizeOfMessage - self.bytesRead; - // Check if the current chunk contains the rest of the message - if(remainingBytesToRead > data.length) { - // Copy the new data into the exiting buffer (should have been allocated when we know the message size) - data.copy(self.buffer, self.bytesRead); - // Adjust the number of bytes read so it point to the correct index in the buffer - self.bytesRead = self.bytesRead + data.length; - - // Reset state of buffer - data = new Buffer(0); - } else { - // Copy the missing part of the data into our current buffer - data.copy(self.buffer, self.bytesRead, 0, remainingBytesToRead); - // Slice the overflow into a new buffer that we will then re-parse - data = data.slice(remainingBytesToRead); - - // Emit current complete message - try { - var emitBuffer = self.buffer; - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Emit the buffer - self.messageHandler(new Response(self.bson, emitBuffer, self.responseOptions), self); - } catch(err) { - var errorObject = {err:"socketHandler", trace:err, bin:self.buffer, parseState:{ - sizeOfMessage:self.sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - } - } - } else { - // Stub buffer is kept in case we don't get enough bytes to determine the - // size of the message (< 4 bytes) - if(self.stubBuffer != null && self.stubBuffer.length > 0) { - // If we have enough bytes to determine the message size let's do it - if(self.stubBuffer.length + data.length > 4) { - // Prepad the data - var newData = new Buffer(self.stubBuffer.length + data.length); - self.stubBuffer.copy(newData, 0); - data.copy(newData, self.stubBuffer.length); - // Reassign for parsing - data = newData; - - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - - } else { - - // Add the the bytes to the stub buffer - var newStubBuffer = new Buffer(self.stubBuffer.length + data.length); - // Copy existing stub buffer - self.stubBuffer.copy(newStubBuffer, 0); - // Copy missing part of the data - data.copy(newStubBuffer, self.stubBuffer.length); - // Exit parsing loop - data = new Buffer(0); - } - } else { - if(data.length > 4) { - // Retrieve the message size - // var sizeOfMessage = data.readUInt32LE(0); - var sizeOfMessage = data[0] | data[1] << 8 | data[2] << 16 | data[3] << 24; - // If we have a negative sizeOfMessage emit error and return - if(sizeOfMessage < 0 || sizeOfMessage > self.maxBsonMessageSize) { - var errorObject = {err:"socketHandler", trace:'', bin:self.buffer, parseState:{ - sizeOfMessage: sizeOfMessage, - bytesRead: self.bytesRead, - stubBuffer: self.stubBuffer}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - return; - } - - // Ensure that the size of message is larger than 0 and less than the max allowed - if(sizeOfMessage > 4 && sizeOfMessage < self.maxBsonMessageSize && sizeOfMessage > data.length) { - self.buffer = new Buffer(sizeOfMessage); - // Copy all the data into the buffer - data.copy(self.buffer, 0); - // Update bytes read - self.bytesRead = data.length; - // Update sizeOfMessage - self.sizeOfMessage = sizeOfMessage; - // Ensure stub buffer is null - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - - } else if(sizeOfMessage > 4 && sizeOfMessage < self.maxBsonMessageSize && sizeOfMessage == data.length) { - try { - var emitBuffer = data; - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - // Emit the message - self.messageHandler(new Response(self.bson, emitBuffer, self.responseOptions), self); - } catch (err) { - var errorObject = {err:"socketHandler", trace:err, bin:self.buffer, parseState:{ - sizeOfMessage:self.sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - } - } else if(sizeOfMessage <= 4 || sizeOfMessage > self.maxBsonMessageSize) { - var errorObject = {err:"socketHandler", trace:null, bin:data, parseState:{ - sizeOfMessage:sizeOfMessage, - bytesRead:0, - buffer:null, - stubBuffer:null}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - - // Clear out the state of the parser - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - } else { - var emitBuffer = data.slice(0, sizeOfMessage); - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Copy rest of message - data = data.slice(sizeOfMessage); - // Emit the message - self.messageHandler(new Response(self.bson, emitBuffer, self.responseOptions), self); - } - } else { - // Create a buffer that contains the space for the non-complete message - self.stubBuffer = new Buffer(data.length) - // Copy the data to the stub buffer - data.copy(self.stubBuffer, 0); - // Exit parsing loop - data = new Buffer(0); - } - } - } - } - } -} - -/** - * Connect - * @method - */ -Connection.prototype.connect = function(_options) { - var self = this; - _options = _options || {}; - // Check if we are overriding the promoteLongs - if(typeof _options.promoteLongs == 'boolean') { - self.responseOptions.promoteLongs = _options.promoteLongs; - } - - // Create new connection instance - self.connection = self.domainSocket - ? net.createConnection(self.host) - : net.createConnection(self.port, self.host); - - // Set the options for the connection - self.connection.setKeepAlive(self.keepAlive, self.keepAliveInitialDelay); - self.connection.setTimeout(self.connectionTimeout); - self.connection.setNoDelay(self.noDelay); - - // If we have ssl enabled - if(self.ssl) { - var sslOptions = { - socket: self.connection - , rejectUnauthorized: self.rejectUnauthorized - } - - if(self.ca) sslOptions.ca = self.ca; - if(self.cert) sslOptions.cert = self.cert; - if(self.key) sslOptions.key = self.key; - if(self.passphrase) sslOptions.passphrase = self.passphrase; - - // Attempt SSL connection - self.connection = tls.connect(self.port, self.host, sslOptions, function() { - // Error on auth or skip - if(self.connection.authorizationError && self.rejectUnauthorized) { - return self.emit("error", self.connection.authorizationError, self, {ssl:true}); - } - - // Set socket timeout instead of connection timeout - self.connection.setTimeout(self.socketTimeout); - // We are done emit connect - self.emit('connect', self); - }); - self.connection.setTimeout(self.connectionTimeout); - } else { - self.connection.on('connect', function() { - // Set socket timeout instead of connection timeout - self.connection.setTimeout(self.socketTimeout); - // Emit connect event - self.emit('connect', self); - }); - } - - // Add handlers for events - self.connection.once('error', errorHandler(self)); - self.connection.once('timeout', timeoutHandler(self)); - self.connection.once('close', closeHandler(self)); - self.connection.on('data', dataHandler(self)); -} - -/** - * Destroy connection - * @method - */ -Connection.prototype.destroy = function() { - if(this.connection) this.connection.destroy(); - this.destroyed = true; -} - -/** - * Write to connection - * @method - * @param {Command} command Command to write out need to implement toBin and toBinUnified - */ -Connection.prototype.write = function(buffer) { - // Debug Log - if(this.logger.isDebug()) { - if(!Array.isArray(buffer)) { - this.logger.debug(f('writing buffer [%s] to %s:%s', buffer.toString('hex'), this.host, this.port)); - } else { - for(var i = 0; i < buffer.length; i++) - this.logger.debug(f('writing buffer [%s] to %s:%s', buffer[i].toString('hex'), this.host, this.port)); - } - } - // Write out the command - if(!Array.isArray(buffer)) return this.connection.write(buffer, 'binary'); - // Iterate over all buffers and write them in order to the socket - for(var i = 0; i < buffer.length; i++) this.connection.write(buffer[i], 'binary'); -} - -/** - * Return id of connection as a string - * @method - * @return {string} - */ -Connection.prototype.toString = function() { - return "" + this.id; -} - -/** - * Return json object of connection - * @method - * @return {object} - */ -Connection.prototype.toJSON = function() { - return {id: this.id, host: this.host, port: this.port}; -} - -/** - * Is the connection connected - * @method - * @return {boolean} - */ -Connection.prototype.isConnected = function() { - if(this.destroyed) return false; - return !this.connection.destroyed && this.connection.writable; -} - -/** - * A server connect event, used to verify that the connection is up and running - * - * @event Connection#connect - * @type {Connection} - */ - -/** - * The server connection closed, all pool connections closed - * - * @event Connection#close - * @type {Connection} - */ - -/** - * The server connection caused an error, all pool connections closed - * - * @event Connection#error - * @type {Connection} - */ - -/** - * The server connection timed out, all pool connections closed - * - * @event Connection#timeout - * @type {Connection} - */ - -/** - * The driver experienced an invalid message, all pool connections closed - * - * @event Connection#parseError - * @type {Connection} - */ - -module.exports = Connection; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js deleted file mode 100644 index 69c6f93b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js +++ /dev/null @@ -1,196 +0,0 @@ -"use strict"; - -var f = require('util').format - , MongoError = require('../error'); - -// Filters for classes -var classFilters = {}; -var filteredClasses = {}; -var level = null; -// Save the process id -var pid = process.pid; -// current logger -var currentLogger = null; - -/** - * Creates a new Logger instance - * @class - * @param {string} className The Class name associated with the logging instance - * @param {object} [options=null] Optional settings. - * @param {Function} [options.logger=null] Custom logger function; - * @param {string} [options.loggerLevel=error] Override default global log level. - * @return {Logger} a Logger instance. - */ -var Logger = function(className, options) { - if(!(this instanceof Logger)) return new Logger(className, options); - options = options || {}; - - // Current reference - var self = this; - this.className = className; - - // Current logger - if(currentLogger == null && options.logger) { - currentLogger = options.logger; - } else if(currentLogger == null) { - currentLogger = console.log; - } - - // Set level of logging, default is error - if(level == null) { - level = options.loggerLevel || 'error'; - } - - // Add all class names - if(filteredClasses[this.className] == null) classFilters[this.className] = true; -} - -/** - * Log a message at the debug level - * @method - * @param {string} message The message to log - * @param {object} object additional meta data to log - * @return {null} - */ -Logger.prototype.debug = function(message, object) { - if(this.isDebug() - && ((Object.keys(filteredClasses).length > 0 && filteredClasses[this.className]) - || (Object.keys(filteredClasses).length == 0 && classFilters[this.className]))) { - var dateTime = new Date().getTime(); - var msg = f("[%s-%s:%s] %s %s", 'DEBUG', this.className, pid, dateTime, message); - var state = { - type: 'debug', message: message, className: this.className, pid: pid, date: dateTime - }; - if(object) state.meta = object; - currentLogger(msg, state); - } -} - -/** - * Log a message at the info level - * @method - * @param {string} message The message to log - * @param {object} object additional meta data to log - * @return {null} - */ -Logger.prototype.info = function(message, object) { - if(this.isInfo() - && ((Object.keys(filteredClasses).length > 0 && filteredClasses[this.className]) - || (Object.keys(filteredClasses).length == 0 && classFilters[this.className]))) { - var dateTime = new Date().getTime(); - var msg = f("[%s-%s:%s] %s %s", 'INFO', this.className, pid, dateTime, message); - var state = { - type: 'info', message: message, className: this.className, pid: pid, date: dateTime - }; - if(object) state.meta = object; - currentLogger(msg, state); - } -}, - -/** - * Log a message at the error level - * @method - * @param {string} message The message to log - * @param {object} object additional meta data to log - * @return {null} - */ -Logger.prototype.error = function(message, object) { - if(this.isError() - && ((Object.keys(filteredClasses).length > 0 && filteredClasses[this.className]) - || (Object.keys(filteredClasses).length == 0 && classFilters[this.className]))) { - var dateTime = new Date().getTime(); - var msg = f("[%s-%s:%s] %s %s", 'ERROR', this.className, pid, dateTime, message); - var state = { - type: 'error', message: message, className: this.className, pid: pid, date: dateTime - }; - if(object) state.meta = object; - currentLogger(msg, state); - } -}, - -/** - * Is the logger set at info level - * @method - * @return {boolean} - */ -Logger.prototype.isInfo = function() { - return level == 'info' || level == 'debug'; -}, - -/** - * Is the logger set at error level - * @method - * @return {boolean} - */ -Logger.prototype.isError = function() { - return level == 'error' || level == 'info' || level == 'debug'; -}, - -/** - * Is the logger set at debug level - * @method - * @return {boolean} - */ -Logger.prototype.isDebug = function() { - return level == 'debug'; -} - -/** - * Resets the logger to default settings, error and no filtered classes - * @method - * @return {null} - */ -Logger.reset = function() { - level = 'error'; - filteredClasses = {}; -} - -/** - * Get the current logger function - * @method - * @return {function} - */ -Logger.currentLogger = function() { - return currentLogger; -} - -/** - * Set the current logger function - * @method - * @param {function} logger Logger function. - * @return {null} - */ -Logger.setCurrentLogger = function(logger) { - if(typeof logger != 'function') throw new MongoError("current logger must be a function"); - currentLogger = logger; -} - -/** - * Set what classes to log. - * @method - * @param {string} type The type of filter (currently only class) - * @param {string[]} values The filters to apply - * @return {null} - */ -Logger.filter = function(type, values) { - if(type == 'class' && Array.isArray(values)) { - filteredClasses = {}; - - values.forEach(function(x) { - filteredClasses[x] = true; - }); - } -} - -/** - * Set the current log level - * @method - * @param {string} level Set current log level (debug, info, error) - * @return {null} - */ -Logger.setLevel = function(_level) { - if(_level != 'info' && _level != 'error' && _level != 'debug') throw new Error(f("%s is an illegal logging level", _level)); - level = _level; -} - -module.exports = Logger; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js deleted file mode 100644 index 7ae7a44f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js +++ /dev/null @@ -1,298 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , EventEmitter = require('events').EventEmitter - , Connection = require('./connection') - , Query = require('./commands').Query - , Logger = require('./logger') - , f = require('util').format; - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -var _id = 0; - -/** - * Creates a new Pool instance - * @class - * @param {string} options.host The server host - * @param {number} options.port The server port - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passPhrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=false] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @fires Pool#connect - * @fires Pool#close - * @fires Pool#error - * @fires Pool#timeout - * @fires Pool#parseError - * @return {Pool} A cursor instance - */ -var Pool = function(options) { - var self = this; - // Add event listener - EventEmitter.call(this); - // Set empty if no options passed - this.options = options || {}; - this.size = typeof options.size == 'number' ? options.size : 5; - // Message handler - this.messageHandler = options.messageHandler; - // No bson parser passed in - if(!options.bson) throw new Error("must pass in valid bson parser"); - // Contains all connections - this.connections = []; - this.state = DISCONNECTED; - // Round robin index - this.index = 0; - this.dead = false; - // Logger instance - this.logger = Logger('Pool', options); - // Pool id - this.id = _id++; - // Grouping tag used for debugging purposes - this.tag = options.tag; -} - -inherits(Pool, EventEmitter); - -var errorHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] errored out [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('error', err, self); - } - } -} - -var timeoutHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] timed out [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('timeout', err, self); - } - } -} - -var closeHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] closed [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('close', err, self); - } - } -} - -var parseErrorHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] errored out [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('parseError', err, self); - } - } -} - -var connectHandler = function(self) { - return function(connection) { - self.connections.push(connection); - // We have connected to all servers - if(self.connections.length == self.size) { - self.state = CONNECTED; - // Done connecting - self.emit("connect", self); - } - } -} - -/** - * Destroy pool - * @method - */ -Pool.prototype.destroy = function() { - this.state = DESTROYED; - // Set dead - this.dead = true; - // Destroy all the connections - this.connections.forEach(function(c) { - // Destroy all event emitters - ["close", "message", "error", "timeout", "parseError", "connect"].forEach(function(e) { - c.removeAllListeners(e); - }); - - // Destroy the connection - c.destroy(); - }); -} - -var execute = null; - -try { - execute = setImmediate; -} catch(err) { - execute = process.nextTick; -} - -/** - * Connect pool - * @method - */ -Pool.prototype.connect = function(_options) { - var self = this; - // Set to connecting - this.state = CONNECTING - // No dead - this.dead = false; - - // Ensure we allow for a little time to setup connections - var wait = 1; - - // Connect all sockets - for(var i = 0; i < this.size; i++) { - setTimeout(function() { - execute(function() { - self.options.messageHandler = self.messageHandler; - var connection = new Connection(self.options); - - // Add all handlers - connection.once('close', closeHandler(self)); - connection.once('error', errorHandler(self)); - connection.once('timeout', timeoutHandler(self)); - connection.once('parseError', parseErrorHandler(self)); - connection.on('connect', connectHandler(self)); - - // Start connection - connection.connect(_options); - }); - }, wait); - - // wait for 1 miliseconds before attempting to connect, spacing out connections - wait = wait + 1; - } -} - -/** - * Get a pool connection (round-robin) - * @method - * @return {Connection} - */ -Pool.prototype.get = function() { - // if(this.dead) return null; - var connection = this.connections[this.index++]; - this.index = this.index % this.connections.length; - return connection; -} - -/** - * Reduce the poolSize to the provided max connections value - * @method - * @param {number} maxConnections reduce the poolsize to maxConnections - */ -Pool.prototype.capConnections = function(maxConnections) { - // Do we have more connections than specified slice it - if(this.connections.length > maxConnections) { - this.connections = this.connections.slice(0, maxConnections); - // Get the rest of the connections - var connections = this.connections.slice(maxConnections); - // Remove all listeners - for(var i = 0; i < connections.length; i++) { - connections[i].removeAllListeners('close'); - connections[i].removeAllListeners('error'); - connections[i].removeAllListeners('timeout'); - connections[i].removeAllListeners('parseError'); - connections[i].removeAllListeners('connect'); - connections[i].destroy(); - } - } -} - -/** - * Get all pool connections - * @method - * @return {array} - */ -Pool.prototype.getAll = function() { - return this.connections.slice(0); -} - -/** - * Is the pool connected - * @method - * @return {boolean} - */ -Pool.prototype.isConnected = function() { - for(var i = 0; i < this.connections.length; i++) { - if(!this.connections[i].isConnected()) return false; - } - - return this.state == CONNECTED; -} - -/** - * Was the pool destroyed - * @method - * @return {boolean} - */ -Pool.prototype.isDestroyed = function() { - return this.state == DESTROYED; -} - - -/** - * A server connect event, used to verify that the connection is up and running - * - * @event Pool#connect - * @type {Pool} - */ - -/** - * The server connection closed, all pool connections closed - * - * @event Pool#close - * @type {Pool} - */ - -/** - * The server connection caused an error, all pool connections closed - * - * @event Pool#error - * @type {Pool} - */ - -/** - * The server connection timed out, all pool connections closed - * - * @event Pool#timeout - * @type {Pool} - */ - -/** - * The driver experienced an invalid message, all pool connections closed - * - * @event Pool#parseError - * @type {Pool} - */ - -module.exports = Pool; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js deleted file mode 100644 index 7f0b89da..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; - -// Set property function -var setProperty = function(obj, prop, flag, values) { - Object.defineProperty(obj, prop.name, { - enumerable:true, - set: function(value) { - if(typeof value != 'boolean') throw new Error(f("%s required a boolean", prop.name)); - // Flip the bit to 1 - if(value == true) values.flags |= flag; - // Flip the bit to 0 if it's set, otherwise ignore - if(value == false && (values.flags & flag) == flag) values.flags ^= flag; - prop.value = value; - } - , get: function() { return prop.value; } - }); -} - -// Set property function -var getProperty = function(obj, propName, fieldName, values, func) { - Object.defineProperty(obj, propName, { - enumerable:true, - get: function() { - // Not parsed yet, parse it - if(values[fieldName] == null && obj.isParsed && !obj.isParsed()) { - obj.parse(); - } - - // Do we have a post processing function - if(typeof func == 'function') return func(values[fieldName]); - // Return raw value - return values[fieldName]; - } - }); -} - -// Set simple property -var getSingleProperty = function(obj, name, value) { - Object.defineProperty(obj, name, { - enumerable:true, - get: function() { - return value - } - }); -} - -// Shallow copy -var copy = function(fObj, tObj) { - tObj = tObj || {}; - for(var name in fObj) tObj[name] = fObj[name]; - return tObj; -} - -var debugOptions = function(debugFields, options) { - var finaloptions = {}; - debugFields.forEach(function(n) { - finaloptions[n] = options[n]; - }); - - return finaloptions; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) return callback; - return domain.bind(callback); -} - -exports.setProperty = setProperty; -exports.getProperty = getProperty; -exports.getSingleProperty = getSingleProperty; -exports.copy = copy; -exports.bindToCurrentDomain = bindToCurrentDomain; -exports.debugOptions = debugOptions; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js deleted file mode 100644 index 984924e3..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js +++ /dev/null @@ -1,768 +0,0 @@ -"use strict"; - -var Long = require('bson').Long - , Logger = require('./connection/logger') - , MongoError = require('./error') - , f = require('util').format; - -/** - * This is a cursor results callback - * - * @callback resultCallback - * @param {error} error An error object. Set to null if no error present - * @param {object} document - */ - -/** - * @fileOverview The **Cursor** class is an internal class that embodies a cursor on MongoDB - * allowing for iteration over the results returned from the underlying query. - * - * **CURSORS Cannot directly be instantiated** - * @example - * var Server = require('mongodb-core').Server - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new Server({host: 'localhost', port: 27017}); - * // Wait for the connection event - * server.on('connect', function(server) { - * assert.equal(null, err); - * - * // Execute the write - * var cursor = _server.cursor('integration_tests.inserts_example4', { - * find: 'integration_tests.example4' - * , query: {a:1} - * }, { - * readPreference: new ReadPreference('secondary'); - * }); - * - * // Get the first document - * cursor.next(function(err, doc) { - * assert.equal(null, err); - * server.destroy(); - * }); - * }); - * - * // Start connecting - * server.connect(); - */ - -/** - * Creates a new Cursor, not to be used directly - * @class - * @param {object} bson An instance of the BSON parser - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|Long} cmd The selector (can be a command or a cursorId) - * @param {object} [options=null] Optional settings. - * @param {object} [options.batchSize=1000] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {object} [options.transforms=null] Transform methods for the cursor results - * @param {function} [options.transforms.query] Transform the value returned from the initial query - * @param {function} [options.transforms.doc] Transform each document returned from Cursor.prototype.next - * @param {object} topology The server topology instance. - * @param {object} topologyOptions The server topology options. - * @return {Cursor} A cursor instance - * @property {number} cursorBatchSize The current cursorBatchSize for the cursor - * @property {number} cursorLimit The current cursorLimit for the cursor - * @property {number} cursorSkip The current cursorSkip for the cursor - */ -var Cursor = function(bson, ns, cmd, options, topology, topologyOptions) { - options = options || {}; - // Cursor reference - var self = this; - // Initial query - var query = null; - - // Cursor connection - this.connection = null; - // Cursor server - this.server = null; - - // Do we have a not connected handler - this.disconnectHandler = options.disconnectHandler; - - // Set local values - this.bson = bson; - this.ns = ns; - this.cmd = cmd; - this.options = options; - this.topology = topology; - - // All internal state - this.cursorState = { - cursorId: null - , cmd: cmd - , documents: options.documents || [] - , cursorIndex: 0 - , dead: false - , killed: false - , init: false - , notified: false - , limit: options.limit || cmd.limit || 0 - , skip: options.skip || cmd.skip || 0 - , batchSize: options.batchSize || cmd.batchSize || 1000 - , currentLimit: 0 - // Result field name if not a cursor (contains the array of results) - , transforms: options.transforms - } - - // Callback controller - this.callbacks = null; - - // Logger - this.logger = Logger('Cursor', options); - - // - // Did we pass in a cursor id - if(typeof cmd == 'number') { - this.cursorState.cursorId = Long.fromNumber(cmd); - this.cursorState.lastCursorId = this.cursorState.cursorId; - } else if(cmd instanceof Long) { - this.cursorState.cursorId = cmd; - this.cursorState.lastCursorId = cmd; - } -} - -Cursor.prototype.setCursorBatchSize = function(value) { - this.cursorState.batchSize = value; -} - -Cursor.prototype.cursorBatchSize = function() { - return this.cursorState.batchSize; -} - -Cursor.prototype.setCursorLimit = function(value) { - this.cursorState.limit = value; -} - -Cursor.prototype.cursorLimit = function() { - return this.cursorState.limit; -} - -Cursor.prototype.setCursorSkip = function(value) { - this.cursorState.skip = value; -} - -Cursor.prototype.cursorSkip = function() { - return this.cursorState.skip; -} - -// // -// // Execute getMore command -// var execGetMore = function(self, callback) { -// } - -// -// Execute the first query -var execInitialQuery = function(self, query, cmd, options, cursorState, connection, logger, callbacks, callback) { - if(logger.isDebug()) { - logger.debug(f("issue initial query [%s] with flags [%s]" - , JSON.stringify(cmd) - , JSON.stringify(query))); - } - - var queryCallback = function(err, result) { - if(err) return callback(err); - - if(result.queryFailure) { - return callback(MongoError.create(result.documents[0]), null); - } - - // Check if we have a command cursor - if(Array.isArray(result.documents) && result.documents.length == 1 - && (!cmd.find || (cmd.find && cmd.virtual == false)) - && (result.documents[0].cursor != 'string' - || result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || Array.isArray(result.documents[0].result)) - ) { - - // We have a an error document return the error - if(result.documents[0]['$err'] - || result.documents[0]['errmsg']) { - return callback(MongoError.create(result.documents[0]), null); - } - - // We have a cursor document - if(result.documents[0].cursor != null - && typeof result.documents[0].cursor != 'string') { - var id = result.documents[0].cursor.id; - // If we have a namespace change set the new namespace for getmores - if(result.documents[0].cursor.ns) { - self.ns = result.documents[0].cursor.ns; - } - // Promote id to long if needed - cursorState.cursorId = typeof id == 'number' ? Long.fromNumber(id) : id; - cursorState.lastCursorId = cursorState.cursorId; - - // If we have a firstBatch set it - if(Array.isArray(result.documents[0].cursor.firstBatch)) { - cursorState.documents = result.documents[0].cursor.firstBatch;//.reverse(); - } - - // Return after processing command cursor - return callback(null, null); - } - - if(Array.isArray(result.documents[0].result)) { - cursorState.documents = result.documents[0].result; - cursorState.cursorId = Long.ZERO; - return callback(null, null); - } - } - - // Otherwise fall back to regular find path - cursorState.cursorId = result.cursorId; - cursorState.lastCursorId = result.cursorId; - cursorState.documents = result.documents; - - // Transform the results with passed in transformation method if provided - if(cursorState.transforms && typeof cursorState.transforms.query == 'function') { - cursorState.documents = cursorState.transforms.query(result); - } - - // Return callback - callback(null, null); - } - - // If we have a raw query decorate the function - if(options.raw || cmd.raw) { - queryCallback.raw = options.raw || cmd.raw; - } - - // Do we have documentsReturnedIn set on the query - if(typeof query.documentsReturnedIn == 'string') { - queryCallback.documentsReturnedIn = query.documentsReturnedIn; - } - - // Set up callback - callbacks.register(query.requestId, queryCallback); - - // Write the initial command out - connection.write(query.toBin()); -} - -// -// Handle callback (including any exceptions thrown) -var handleCallback = function(callback, err, result) { - try { - callback(err, result); - } catch(err) { - process.nextTick(function() { - throw err; - }); - } -} - - -// Internal methods -Cursor.prototype._find = function(callback) { - var self = this; - // execInitialQuery(self, self.query, self.cmd, self.options, self.cursorState, self.connection, self.logger, self.callbacks, function(err, r) { - if(self.logger.isDebug()) { - self.logger.debug(f("issue initial query [%s] with flags [%s]" - , JSON.stringify(self.cmd) - , JSON.stringify(self.query))); - } - - var queryCallback = function(err, result) { - if(err) return callback(err); - - if(result.queryFailure) { - return callback(MongoError.create(result.documents[0]), null); - } - - // Check if we have a command cursor - if(Array.isArray(result.documents) && result.documents.length == 1 - && (!self.cmd.find || (self.cmd.find && self.cmd.virtual == false)) - && (result.documents[0].cursor != 'string' - || result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || Array.isArray(result.documents[0].result)) - ) { - - // We have a an error document return the error - if(result.documents[0]['$err'] - || result.documents[0]['errmsg']) { - return callback(MongoError.create(result.documents[0]), null); - } - - // We have a cursor document - if(result.documents[0].cursor != null - && typeof result.documents[0].cursor != 'string') { - var id = result.documents[0].cursor.id; - // If we have a namespace change set the new namespace for getmores - if(result.documents[0].cursor.ns) { - self.ns = result.documents[0].cursor.ns; - } - // Promote id to long if needed - self.cursorState.cursorId = typeof id == 'number' ? Long.fromNumber(id) : id; - self.cursorState.lastCursorId = self.cursorState.cursorId; - // If we have a firstBatch set it - if(Array.isArray(result.documents[0].cursor.firstBatch)) { - self.cursorState.documents = result.documents[0].cursor.firstBatch;//.reverse(); - } - - // Return after processing command cursor - return callback(null, null); - } - - if(Array.isArray(result.documents[0].result)) { - self.cursorState.documents = result.documents[0].result; - self.cursorState.cursorId = Long.ZERO; - return callback(null, null); - } - } - - // Otherwise fall back to regular find path - self.cursorState.cursorId = result.cursorId; - self.cursorState.documents = result.documents; - self.cursorState.lastCursorId = result.cursorId; - - // Transform the results with passed in transformation method if provided - if(self.cursorState.transforms && typeof self.cursorState.transforms.query == 'function') { - self.cursorState.documents = self.cursorState.transforms.query(result); - } - - // Return callback - callback(null, null); - } - - // If we have a raw query decorate the function - if(self.options.raw || self.cmd.raw) { - queryCallback.raw = self.options.raw || self.cmd.raw; - } - - // Do we have documentsReturnedIn set on the query - if(typeof self.query.documentsReturnedIn == 'string') { - queryCallback.documentsReturnedIn = self.query.documentsReturnedIn; - } - - // Set up callback - self.callbacks.register(self.query.requestId, queryCallback); - - // Write the initial command out - self.connection.write(self.query.toBin()); -} - -Cursor.prototype._getmore = function(callback) { - if(this.logger.isDebug()) this.logger.debug(f("schedule getMore call for query [%s]", JSON.stringify(this.query))) - // Determine if it's a raw query - var raw = this.options.raw || this.cmd.raw; - - // Set the current batchSize - var batchSize = this.cursorState.batchSize; - if(this.cursorState.limit > 0 - && ((this.cursorState.currentLimit + batchSize) > this.cursorState.limit)) { - batchSize = this.cursorState.limit - this.cursorState.currentLimit; - } - - // We have a wire protocol handler - this.server.wireProtocolHandler.getMore(this.bson, this.ns, this.cursorState, batchSize, raw, this.connection, this.callbacks, this.options, callback); -} - -Cursor.prototype._killcursor = function(callback) { - // Set cursor to dead - this.cursorState.dead = true; - this.cursorState.killed = true; - // Remove documents - this.cursorState.documents = []; - - // If no cursor id just return - if(this.cursorState.cursorId == null || this.cursorState.cursorId.isZero() || this.cursorState.init == false) { - if(callback) callback(null, null); - return; - } - - // Execute command - this.server.wireProtocolHandler.killCursor(this.bson, this.ns, this.cursorState.cursorId, this.connection, this.callbacks, callback); -} - -/** - * Clone the cursor - * @method - * @return {Cursor} - */ -Cursor.prototype.clone = function() { - return this.topology.cursor(this.ns, this.cmd, this.options); -} - -/** - * Checks if the cursor is dead - * @method - * @return {boolean} A boolean signifying if the cursor is dead or not - */ -Cursor.prototype.isDead = function() { - return this.cursorState.dead == true; -} - -/** - * Checks if the cursor was killed by the application - * @method - * @return {boolean} A boolean signifying if the cursor was killed by the application - */ -Cursor.prototype.isKilled = function() { - return this.cursorState.killed == true; -} - -/** - * Checks if the cursor notified it's caller about it's death - * @method - * @return {boolean} A boolean signifying if the cursor notified the callback - */ -Cursor.prototype.isNotified = function() { - return this.cursorState.notified == true; -} - -/** - * Returns current buffered documents length - * @method - * @return {number} The number of items in the buffered documents - */ -Cursor.prototype.bufferedCount = function() { - return this.cursorState.documents.length - this.cursorState.cursorIndex; -} - -/** - * Returns current buffered documents - * @method - * @return {Array} An array of buffered documents - */ -Cursor.prototype.readBufferedDocuments = function(number) { - var unreadDocumentsLength = this.cursorState.documents.length - this.cursorState.cursorIndex; - var length = number < unreadDocumentsLength ? number : unreadDocumentsLength; - var elements = this.cursorState.documents.slice(this.cursorState.cursorIndex, this.cursorState.cursorIndex + length); - - // Transform the doc with passed in transformation method if provided - if(this.cursorState.transforms && typeof this.cursorState.transforms.doc == 'function') { - // Transform all the elements - for(var i = 0; i < elements.length; i++) { - elements[i] = this.cursorState.transforms.doc(elements[i]); - } - } - - // Ensure we do not return any more documents than the limit imposed - // Just return the number of elements up to the limit - if(this.cursorState.limit > 0 && (this.cursorState.currentLimit + elements.length) > this.cursorState.limit) { - elements = elements.slice(0, (this.cursorState.limit - this.cursorState.currentLimit)); - this.kill(); - } - - // Adjust current limit - this.cursorState.currentLimit = this.cursorState.currentLimit + elements.length; - this.cursorState.cursorIndex = this.cursorState.cursorIndex + elements.length; - - // Return elements - return elements; -} - -/** - * Kill the cursor - * @method - * @param {resultCallback} callback A callback function - */ -Cursor.prototype.kill = function(callback) { - this._killcursor(callback); -} - -/** - * Resets the cursor - * @method - * @return {null} - */ -Cursor.prototype.rewind = function() { - if(this.cursorState.init) { - if(!this.cursorState.dead) { - this.kill(); - } - - this.cursorState.currentLimit = 0; - this.cursorState.init = false; - this.cursorState.dead = false; - this.cursorState.killed = false; - this.cursorState.notified = false; - this.cursorState.documents = []; - this.cursorState.cursorId = null; - this.cursorState.cursorIndex = 0; - } -} - -/** - * Validate if the connection is dead and return error - */ -var isConnectionDead = function(self, callback) { - if(self.connection - && !self.connection.isConnected()) { - self.cursorState.notified = true; - self.cursorState.killed = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - callback(MongoError.create(f('connection to host %s:%s was destroyed', self.connection.host, self.connection.port))) - return true; - } - - return false; -} - -/** - * Validate if the cursor is dead but was not explicitly killed by user - */ -var isCursorDeadButNotkilled = function(self, callback) { - // Cursor is dead but not marked killed, return null - if(self.cursorState.dead && !self.cursorState.killed) { - self.cursorState.notified = true; - self.cursorState.killed = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); - return true; - } - - return false; -} - -/** - * Validate if the cursor is dead and was killed by user - */ -var isCursorDeadAndKilled = function(self, callback) { - if(self.cursorState.dead && self.cursorState.killed) { - handleCallback(callback, MongoError.create("cursor is dead")); - return true; - } - - return false; -} - -/** - * Validate if the cursor was killed by the user - */ -var isCursorKilled = function(self, callback) { - if(self.cursorState.killed) { - self.cursorState.notified = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); - return true; - } - - return false; -} - -/** - * Mark cursor as being dead and notified - */ -var setCursorDeadAndNotified = function(self, callback) { - self.cursorState.dead = true; - self.cursorState.notified = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); -} - -/** - * Mark cursor as being notified - */ -var setCursorNotified = function(self, callback) { - self.cursorState.notified = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); -} - -var nextFunction = function(self, callback) { - // We have notified about it - if(self.cursorState.notified) { - return callback(new Error('cursor is exhausted')); - } - - // Cursor is killed return null - if(isCursorKilled(self, callback)) return; - - // Cursor is dead but not marked killed, return null - if(isCursorDeadButNotkilled(self, callback)) return; - - // We have a dead and killed cursor, attempting to call next should error - if(isCursorDeadAndKilled(self, callback)) return; - - // We have just started the cursor - if(!self.cursorState.init) { - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.topology.isConnected(self.options) && self.disconnectHandler != null) { - return self.disconnectHandler.addObjectAndMethod('cursor', self, 'next', [callback], callback); - } - - try { - // Get a server - self.server = self.topology.getServer(self.options); - // Get a connection - self.connection = self.server.getConnection(); - // Get the callbacks - self.callbacks = self.server.getCallbacks(); - } catch(err) { - return callback(err); - } - - // Set as init - self.cursorState.init = true; - - try { - // Get the right wire protocol command - self.query = self.server.wireProtocolHandler.command(self.bson, self.ns, self.cmd, self.cursorState, self.topology, self.options); - } catch(err) { - return callback(err); - } - } - - // Process exhaust messages - var processExhaustMessages = function(err, result) { - if(err) { - self.cursorState.dead = true; - self.callbacks.unregister(self.query.requestId); - return callback(err); - } - - // Concatenate all the documents - self.cursorState.documents = self.cursorState.documents.concat(result.documents); - - // If we have no documents left - if(Long.ZERO.equals(result.cursorId)) { - self.cursorState.cursorId = Long.ZERO; - self.callbacks.unregister(self.query.requestId); - return nextFunction(self, callback); - } - - // Set up next listener - self.callbacks.register(result.requestId, processExhaustMessages) - - // Initial result - if(self.cursorState.cursorId == null) { - self.cursorState.cursorId = result.cursorId; - self.cursorState.lastCursorId = result.cursorId; - nextFunction(self, callback); - } - } - - // If we have exhaust - if(self.cmd.exhaust && self.cursorState.cursorId == null) { - // Handle all the exhaust responses - self.callbacks.register(self.query.requestId, processExhaustMessages); - // Write the initial command out - return self.connection.write(self.query.toBin()); - } else if(self.cmd.exhaust && self.cursorState.cursorIndex < self.cursorState.documents.length) { - return handleCallback(callback, null, self.cursorState.documents[self.cursorState.cursorIndex++]); - } else if(self.cmd.exhaust && Long.ZERO.equals(self.cursorState.cursorId)) { - self.callbacks.unregister(self.query.requestId); - return setCursorNotified(self, callback); - } else if(self.cmd.exhaust) { - return setTimeout(function() { - if(Long.ZERO.equals(self.cursorState.cursorId)) return; - nextFunction(self, callback); - }, 1); - } - - // If we don't have a cursorId execute the first query - if(self.cursorState.cursorId == null) { - // Check if connection is dead and return if not possible to - // execute the query against the db - if(isConnectionDead(self, callback)) return; - - // Check if topology is destroyed - if(self.topology.isDestroyed()) return callback(new MongoError(f('connection destroyed, not possible to instantiate cursor'))); - - // query, cmd, options, cursorState, callback - self._find(function(err, r) { - if(err) return handleCallback(callback, err, null); - if(self.cursorState.documents.length == 0 && !self.cmd.tailable && !self.cmd.awaitData) { - return setCursorNotified(self, callback); - } - - nextFunction(self, callback); - }); - } else if(self.cursorState.limit > 0 && self.cursorState.currentLimit >= self.cursorState.limit) { - // Ensure we kill the cursor on the server - self.kill(); - // Set cursor in dead and notified state - return setCursorDeadAndNotified(self, callback); - } else if(self.cursorState.cursorIndex == self.cursorState.documents.length - && !Long.ZERO.equals(self.cursorState.cursorId)) { - // Ensure an empty cursor state - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - - // Check if topology is destroyed - if(self.topology.isDestroyed()) return callback(new MongoError(f('connection destroyed, not possible to instantiate cursor'))); - - // Check if connection is dead and return if not possible to - // execute a getmore on this connection - if(isConnectionDead(self, callback)) return; - - // Execute the next get more - self._getmore(function(err, doc) { - if(err) return handleCallback(callback, err); - if(self.cursorState.documents.length == 0 - && Long.ZERO.equals(self.cursorState.cursorId)) { - self.cursorState.dead = true; - } - - // Tailable cursor getMore result, notify owner about it - // No attempt is made here to retry, this is left to the user of the - // core module to handle to keep core simple - if(self.cursorState.documents.length == 0 && self.cmd.tailable) { - return handleCallback(callback, MongoError.create({ - message: "No more documents in tailed cursor" - , tailable: self.cmd.tailable - , awaitData: self.cmd.awaitData - })); - } - - if(self.cursorState.limit > 0 && self.cursorState.currentLimit >= self.cursorState.limit) { - return setCursorDeadAndNotified(self, callback); - } - - nextFunction(self, callback); - }); - } else if(self.cursorState.documents.length == self.cursorState.cursorIndex - && self.cmd.tailable) { - return handleCallback(callback, MongoError.create({ - message: "No more documents in tailed cursor" - , tailable: self.cmd.tailable - , awaitData: self.cmd.awaitData - })); - } else if(self.cursorState.documents.length == self.cursorState.cursorIndex - && Long.ZERO.equals(self.cursorState.cursorId)) { - setCursorDeadAndNotified(self, callback); - } else { - if(self.cursorState.limit > 0 && self.cursorState.currentLimit >= self.cursorState.limit) { - // Ensure we kill the cursor on the server - self.kill(); - // Set cursor in dead and notified state - return setCursorDeadAndNotified(self, callback); - } - - // Increment the current cursor limit - self.cursorState.currentLimit += 1; - - // Get the document - var doc = self.cursorState.documents[self.cursorState.cursorIndex++]; - - // Transform the doc with passed in transformation method if provided - if(self.cursorState.transforms && typeof self.cursorState.transforms.doc == 'function') { - doc = self.cursorState.transforms.doc(doc); - } - - // Return the document - handleCallback(callback, null, doc); - } -} - -/** - * Retrieve the next document from the cursor - * @method - * @param {resultCallback} callback A callback function - */ -Cursor.prototype.next = function(callback) { - nextFunction(this, callback); -} - -module.exports = Cursor; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js deleted file mode 100644 index 4e17ef3d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; - -/** - * Creates a new MongoError - * @class - * @augments Error - * @param {string} message The error message - * @return {MongoError} A MongoError instance - */ -function MongoError(message) { - this.name = 'MongoError'; - this.message = message; - Error.captureStackTrace(this, MongoError); -} - -/** - * Creates a new MongoError object - * @method - * @param {object} options The error options - * @return {MongoError} A MongoError instance - */ -MongoError.create = function(options) { - var err = null; - - if(options instanceof Error) { - err = new MongoError(options.message); - err.stack = options.stack; - } else if(typeof options == 'string') { - err = new MongoError(options); - } else { - err = new MongoError(options.message || options.errmsg || options.$err || "n/a"); - // Other options - for(var name in options) { - err[name] = options[name]; - } - } - - return err; -} - -// Extend JavaScript error -MongoError.prototype = new Error; - -module.exports = MongoError; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js deleted file mode 100644 index dcceda4b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js +++ /dev/null @@ -1,59 +0,0 @@ -var fs = require('fs'); - -/* Note: because this plugin uses process.on('uncaughtException'), only one - * of these can exist at any given time. This plugin and anything else that - * uses process.on('uncaughtException') will conflict. */ -exports.attachToRunner = function(runner, outputFile) { - var smokeOutput = { results : [] }; - var runningTests = {}; - - var integraPlugin = { - beforeTest: function(test, callback) { - test.startTime = Date.now(); - runningTests[test.name] = test; - callback(); - }, - afterTest: function(test, callback) { - smokeOutput.results.push({ - status: test.status, - start: test.startTime, - end: Date.now(), - test_file: test.name, - exit_code: 0, - url: "" - }); - delete runningTests[test.name]; - callback(); - }, - beforeExit: function(obj, callback) { - fs.writeFile(outputFile, JSON.stringify(smokeOutput), function() { - callback(); - }); - } - }; - - // In case of exception, make sure we write file - process.on('uncaughtException', function(err) { - // Mark all currently running tests as failed - for (var testName in runningTests) { - smokeOutput.results.push({ - status: "fail", - start: runningTests[testName].startTime, - end: Date.now(), - test_file: testName, - exit_code: 0, - url: "" - }); - } - - // write file - fs.writeFileSync(outputFile, JSON.stringify(smokeOutput)); - - // Standard NodeJS uncaught exception handler - console.error(err.stack); - process.exit(1); - }); - - runner.plugin(integraPlugin); - return integraPlugin; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js deleted file mode 100644 index ff7bf1b0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -var setProperty = require('../connection/utils').setProperty - , getProperty = require('../connection/utils').getProperty - , getSingleProperty = require('../connection/utils').getSingleProperty; - -/** - * Creates a new CommandResult instance - * @class - * @param {object} result CommandResult object - * @param {Connection} connection A connection instance associated with this result - * @return {CommandResult} A cursor instance - */ -var CommandResult = function(result, connection) { - this.result = result; - this.connection = connection; -} - -/** - * Convert CommandResult to JSON - * @method - * @return {object} - */ -CommandResult.prototype.toJSON = function() { - return this.result; -} - -/** - * Convert CommandResult to String representation - * @method - * @return {string} - */ -CommandResult.prototype.toString = function() { - return JSON.stringify(this.toJSON()); -} - -module.exports = CommandResult; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js deleted file mode 100644 index c54514a4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js +++ /dev/null @@ -1,1000 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , b = require('bson') - , bindToCurrentDomain = require('../connection/utils').bindToCurrentDomain - , EventEmitter = require('events').EventEmitter - , BasicCursor = require('../cursor') - , BSON = require('bson').native().BSON - , BasicCursor = require('../cursor') - , Server = require('./server') - , Logger = require('../connection/logger') - , ReadPreference = require('./read_preference') - , Session = require('./session') - , MongoError = require('../error'); - -/** - * @fileOverview The **Mongos** class is a class that represents a Mongos Proxy topology and is - * used to construct connections. - * - * @example - * var Mongos = require('mongodb-core').Mongos - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new Mongos([{host: 'localhost', port: 30000}]); - * // Wait for the connection event - * server.on('connect', function(server) { - * server.destroy(); - * }); - * - * // Start connecting - * server.connect(); - */ - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -// All bson types -var bsonTypes = [b.Long, b.ObjectID, b.Binary, b.Code, b.DBRef, b.Symbol, b.Double, b.Timestamp, b.MaxKey, b.MinKey]; -// BSON parser -var bsonInstance = null; - -// Instance id -var mongosId = 0; - -// -// Clone the options -var cloneOptions = function(options) { - var opts = {}; - for(var name in options) { - opts[name] = options[name]; - } - return opts; -} - -var State = function(readPreferenceStrategies) { - // Internal state - this.s = { - connectedServers: [] - , disconnectedServers: [] - , readPreferenceStrategies: readPreferenceStrategies - } -} - -// -// A Mongos connected -State.prototype.connected = function(server) { - // Locate in disconnected servers and remove - this.s.disconnectedServers = this.s.disconnectedServers.filter(function(s) { - return !s.equals(server); - }); - - var found = false; - // Check if the server exists - this.s.connectedServers.forEach(function(s) { - if(s.equals(server)) found = true; - }); - - // Add to disconnected list if it does not already exist - if(!found) this.s.connectedServers.push(server); -} - -// -// A Mongos disconnected -State.prototype.disconnected = function(server) { - // Locate in disconnected servers and remove - this.s.connectedServers = this.s.connectedServers.filter(function(s) { - return !s.equals(server); - }); - - var found = false; - // Check if the server exists - this.s.disconnectedServers.forEach(function(s) { - if(s.equals(server)) found = true; - }); - - // Add to disconnected list if it does not already exist - if(!found) this.s.disconnectedServers.push(server); -} - -// -// Return the list of disconnected servers -State.prototype.disconnectedServers = function() { - return this.s.disconnectedServers.slice(0); -} - -// -// Get connectedServers -State.prototype.connectedServers = function() { - return this.s.connectedServers.slice(0) -} - -// -// Get all servers -State.prototype.getAll = function() { - return this.s.connectedServers.slice(0).concat(this.s.disconnectedServers); -} - -// -// Get all connections -State.prototype.getAllConnections = function() { - var connections = []; - this.s.connectedServers.forEach(function(e) { - connections = connections.concat(e.connections()); - }); - return connections; -} - -// -// Destroy the state -State.prototype.destroy = function() { - // Destroy any connected servers - while(this.s.connectedServers.length > 0) { - var server = this.s.connectedServers.shift(); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Server destroy - server.destroy(); - // Add to list of disconnected servers - this.s.disconnectedServers.push(server); - } -} - -// -// Are we connected -State.prototype.isConnected = function() { - return this.s.connectedServers.length > 0; -} - -// -// Pick a server -State.prototype.pickServer = function(readPreference) { - readPreference = readPreference || ReadPreference.primary; - - // Do we have a custom readPreference strategy, use it - if(this.s.readPreferenceStrategies != null && this.s.readPreferenceStrategies[readPreference] != null) { - return this.s.readPreferenceStrategies[readPreference].pickServer(connectedServers, readPreference); - } - - // No valid connections - if(this.s.connectedServers.length == 0) throw new MongoError("no mongos proxy available"); - // Pick first one - return this.s.connectedServers[0]; -} - -/** - * Creates a new Mongos instance - * @class - * @param {array} seedlist A list of seeds for the replicaset - * @param {number} [options.reconnectTries=30] Reconnect retries for HA if no servers available - * @param {number} [options.haInterval=5000] The High availability period for replicaset inquiry - * @param {boolean} [options.emitError=false] Server will emit errors events - * @param {Cursor} [options.cursorFactory=Cursor] The cursor factory class used for all query cursors - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=1000] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @return {Mongos} A cursor instance - * @fires Mongos#connect - * @fires Mongos#joined - * @fires Mongos#left - */ -var Mongos = function(seedlist, options) { - var self = this; - options = options || {}; - - // Add event listener - EventEmitter.call(this); - - // Validate seedlist - if(!Array.isArray(seedlist)) throw new MongoError("seedlist must be an array"); - // Validate list - if(seedlist.length == 0) throw new MongoError("seedlist must contain at least one entry"); - // Validate entries - seedlist.forEach(function(e) { - if(typeof e.host != 'string' || typeof e.port != 'number') - throw new MongoError("seedlist entry must contain a host and port"); - }); - - // BSON Parser, ensure we have a single instance - bsonInstance = bsonInstance == null ? new BSON(bsonTypes) : bsonInstance; - // Pick the right bson parser - var bson = options.bson ? options.bson : bsonInstance; - // Add bson parser to options - options.bson = bson; - - // The Mongos state - this.s = { - // Seed list for sharding passed in - seedlist: seedlist - // Passed in options - , options: options - // Logger - , logger: Logger('Mongos', options) - // Reconnect tries - , reconnectTries: options.reconnectTries || 30 - // Ha interval - , haInterval: options.haInterval || 5000 - // Have omitted fullsetup - , fullsetup: false - // Cursor factory - , Cursor: options.cursorFactory || BasicCursor - // Current credentials used for auth - , credentials: [] - // BSON Parser - , bsonInstance: bsonInstance - , bson: bson - // Default state - , state: DISCONNECTED - // Swallow or emit errors - , emitError: typeof options.emitError == 'boolean' ? options.emitError : false - // Contains any alternate strategies for picking - , readPreferenceStrategies: {} - // Auth providers - , authProviders: {} - // Unique instance id - , id: mongosId++ - // Authentication in progress - , authInProgress: false - // Servers added while auth in progress - , authInProgressServers: [] - // Current retries left - , retriesLeft: options.reconnectTries || 30 - // Do we have a not connected handler - , disconnectHandler: options.disconnectHandler - } - - // Set up the connection timeout for the options - options.connectionTimeout = options.connectionTimeout || 1000; - - // Create a new state for the mongos - this.s.mongosState = new State(this.s.readPreferenceStrategies); - - // BSON property (find a server and pass it along) - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - var servers = self.s.mongosState.getAll(); - return servers.length > 0 ? servers[0].bson : null; - } - }); - - Object.defineProperty(this, 'id', { - enumerable:true, get: function() { return self.s.id; } - }); - - Object.defineProperty(this, 'type', { - enumerable:true, get: function() { return 'mongos'; } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return self.s.haInterval; } - }); - - Object.defineProperty(this, 'state', { - enumerable:true, get: function() { return self.s.mongosState; } - }); -} - -inherits(Mongos, EventEmitter); - -/** - * Name of BSON parser currently used - * @method - * @return {string} - */ -Mongos.prototype.parserType = function() { - if(this.s.bson.serialize.toString().indexOf('[native code]') != -1) - return 'c++'; - return 'js'; -} - -/** - * Execute a command - * @method - * @param {string} type Type of BSON parser to use (c++ or js) - */ -Mongos.prototype.setBSONParserType = function(type) { - var nBSON = null; - - if(type == 'c++') { - nBSON = require('bson').native().BSON; - } else if(type == 'js') { - nBSON = require('bson').pure().BSON; - } else { - throw new MongoError(f("% parser not supported", type)); - } - - this.s.options.bson = new nBSON(bsonTypes); -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -Mongos.prototype.lastIsMaster = function() { - var connectedServers = this.s.mongosState.connectedServers(); - if(connectedServers.length > 0) return connectedServers[0].lastIsMaster(); - return null; -} - -/** - * Initiate server connect - * @method - */ -Mongos.prototype.connect = function(_options) { - var self = this; - // Start replicaset inquiry process - setTimeout(mongosInquirer(self, self.s), self.s.haInterval); - // Additional options - if(_options) for(var name in _options) self.s.options[name] = _options[name]; - // For all entries in the seedlist build a server instance - self.s.seedlist.forEach(function(e) { - // Clone options - var opts = cloneOptions(self.s.options); - // Add host and port - opts.host = e.host; - opts.port = e.port; - opts.reconnect = false; - opts.readPreferenceStrategies = self.s.readPreferenceStrategies; - // Share the auth store - opts.authProviders = self.s.authProviders; - // Don't emit errors - opts.emitError = true; - // Create a new Server - self.s.mongosState.disconnected(new Server(opts)); - }); - - // Get the disconnected servers - var servers = self.s.mongosState.disconnectedServers(); - - // Attempt to connect to all the servers - while(servers.length > 0) { - // Get the server - var server = servers.shift(); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect', 'message', 'parseError'].forEach(function(e) { - server.removeAllListeners(e); - }); - - // Set up the event handlers - server.once('error', errorHandlerTemp(self, self.s, server)); - server.once('close', errorHandlerTemp(self, self.s, server)); - server.once('timeout', errorHandlerTemp(self, self.s, server)); - server.once('parseError', errorHandlerTemp(self, self.s, server)); - server.once('connect', connectHandler(self, self.s, 'connect')); - - if(self.s.logger.isInfo()) self.s.logger.info(f('connecting to server %s', server.name)); - // Attempt to connect - server.connect(); - } -} - -/** - * Destroy the server connection - * @method - */ -Mongos.prototype.destroy = function(emitClose) { - this.s.state = DESTROYED; - // Emit close - if(emitClose && self.listeners('close').length > 0) self.emit('close', self); - // Destroy the state - this.s.mongosState.destroy(); -} - -/** - * Figure out if the server is connected - * @method - * @return {boolean} - */ -Mongos.prototype.isConnected = function() { - return this.s.mongosState.isConnected(); -} - -/** - * Figure out if the server instance was destroyed by calling destroy - * @method - * @return {boolean} - */ -Mongos.prototype.isDestroyed = function() { - return this.s.state == DESTROYED; -} - -// -// Operations -// - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.insert = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('insert', ns, ops, options, callback); - } - - executeWriteOperation(this.s, 'insert', ns, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.update = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('update', ns, ops, options, callback); - } - - executeWriteOperation(this.s, 'update', ns, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.remove = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('remove', ns, ops, options, callback); - } - - executeWriteOperation(this.s, 'remove', ns, ops, options, callback); -} - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Connection} [options.connection] Specify connection object to execute command against - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.command = function(ns, cmd, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - var self = this; - - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('command', ns, cmd, options, callback); - } - - var server = null; - // Ensure we have no options - options = options || {}; - - // We need to execute the command on all servers - if(options.onAll) { - var servers = self.s.mongosState.getAll(); - var count = servers.length; - var cmdErr = null; - - for(var i = 0; i < servers.length; i++) { - servers[i].command(ns, cmd, options, function(err, r) { - count = count - 1; - // Finished executing command - if(count == 0) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(state, ns); - // Return the error - callback(err, r); - } - }); - } - - return; - } - - - try { - // Get a primary - server = self.s.mongosState.pickServer(options.writeConcern ? ReadPreference.primary : options.readPreference); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no mongos found")); - server.command(ns, cmd, options, function(err, r) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(self.s, ns); - callback(err, r); - }); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.cursor = function(ns, cmd, cursorOptions) { - cursorOptions = cursorOptions || {}; - var FinalCursor = cursorOptions.cursorFactory || this.s.Cursor; - return new FinalCursor(this.s.bson, ns, cmd, cursorOptions, this, this.s.options); -} - -/** - * Authenticate using a specified mechanism - * @method - * @param {string} mechanism The Auth mechanism we are invoking - * @param {string} db The db we are invoking the mechanism against - * @param {...object} param Parameters for the specific mechanism - * @param {authResultCallback} callback A callback function - */ -Mongos.prototype.auth = function(mechanism, db) { - var allArgs = Array.prototype.slice.call(arguments, 0).slice(0); - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - var callback = args.pop(); - - // If we don't have the mechanism fail - if(this.s.authProviders[mechanism] == null && mechanism != 'default') - throw new MongoError(f("auth provider %s does not exist", mechanism)); - - // Authenticate against all the servers - var servers = this.s.mongosState.connectedServers().slice(0); - var count = servers.length; - // Correct authentication - var authenticated = true; - var authErr = null; - // Set auth in progress - this.s.authInProgress = true; - - // Authenticate against all servers - while(servers.length > 0) { - var server = servers.shift(); - // Arguments without a callback - var argsWithoutCallback = [mechanism, db].concat(args.slice(0)); - // Create arguments - var finalArguments = argsWithoutCallback.concat([function(err, r) { - count = count - 1; - if(err) authErr = err; - if(!r) authenticated = false; - - // We are done - if(count == 0) { - // We have more servers that are not authenticated, let's authenticate - if(self.s.authInProgressServers.length > 0) { - self.s.authInProgressServers = []; - return self.auth.apply(self, [mechanism, db].concat(args).concat([callback])); - } - - // Auth is done - self.s.authInProgress = false; - // Add successful credentials - if(authErr == null) addCredentials(self.s, db, argsWithoutCallback); - // Return the auth error - if(authErr) return callback(authErr, false); - // Successfully authenticated session - callback(null, new Session({}, self)); - } - }]); - - // Execute the auth - server.auth.apply(server, finalArguments); - } -} - -// -// Plugin methods -// - -/** - * Add custom read preference strategy - * @method - * @param {string} name Name of the read preference strategy - * @param {object} strategy Strategy object instance - */ -Mongos.prototype.addReadPreferenceStrategy = function(name, strategy) { - if(this.s.readPreferenceStrategies == null) this.s.readPreferenceStrategies = {}; - this.s.readPreferenceStrategies[name] = strategy; -} - -/** - * Add custom authentication mechanism - * @method - * @param {string} name Name of the authentication mechanism - * @param {object} provider Authentication object instance - */ -Mongos.prototype.addAuthProvider = function(name, provider) { - this.s.authProviders[name] = provider; -} - -/** - * Get connection - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Connection} - */ -Mongos.prototype.getConnection = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - var server = this.s.mongosState.pickServer(options.readPreference); - if(server == null) return null; - // Return connection - return server.getConnection(); -} - -/** - * Get server - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Server} - */ -Mongos.prototype.getServer = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - return this.s.mongosState.pickServer(options.readPreference); -} - -/** - * All raw connections - * @method - * @return {Connection[]} - */ -Mongos.prototype.connections = function() { - return this.s.mongosState.getAllConnections(); -} - -// -// Inquires about state changes -// -var mongosInquirer = function(self, state) { - return function() { - if(state.state == DESTROYED) return - if(state.state == CONNECTED) state.retriesLeft = state.reconnectTries; - - // If we have a disconnected site - if(state.state == DISCONNECTED && state.retriesLeft == 0) { - self.destroy(); - return self.emit('error', new MongoError(f('failed to reconnect after %s', state.reconnectTries))); - } else if(state == DISCONNECTED) { - state.retriesLeft = state.retriesLeft - 1; - } - - // If we have a primary and a disconnect handler, execute - // buffered operations - if(state.mongosState.isConnected() && state.disconnectHandler) { - state.disconnectHandler.execute(); - } - - // Log the information - if(state.logger.isDebug()) state.logger.debug(f('mongos ha proceess running')); - - // Let's query any disconnected proxies - var disconnectedServers = state.mongosState.disconnectedServers(); - if(disconnectedServers.length == 0) return setTimeout(mongosInquirer(self, state), state.haInterval); - - // Count of connections waiting to be connected - var connectionCount = disconnectedServers.length; - if(state.logger.isDebug()) state.logger.debug(f('mongos ha proceess found %d disconnected proxies', connectionCount)); - - // Let's attempt to reconnect - while(disconnectedServers.length > 0) { - var server = disconnectedServers.shift(); - if(state.logger.isDebug()) state.logger.debug(f('attempting to connect to server %s', server.name)); - - // Remove any listeners - ['error', 'close', 'timeout', 'connect', 'message', 'parseError'].forEach(function(e) { - server.removeAllListeners(e); - }); - - // Set up the event handlers - server.once('error', errorHandlerTemp(self, state, server)); - server.once('close', errorHandlerTemp(self, state, server)); - server.once('timeout', errorHandlerTemp(self, state, server)); - server.once('connect', connectHandler(self, state, 'ha')); - // Start connect - server.connect(); - } - - // Let's keep monitoring but wait for possible timeout to happen - return setTimeout(mongosInquirer(self, state), state.options.connectionTimeout + state.haInterval); - } -} - -// -// Error handler for initial connect -var errorHandlerTemp = function(self, state, server) { - return function(err, server) { - // Log the information - if(state.logger.isInfo()) state.logger.info(f('server %s disconnected with error %s', server.name, JSON.stringify(err))); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Signal disconnect of server - state.mongosState.disconnected(server); - } -} - -// -// Handlers -var errorHandler = function(self, state) { - return function(err, server) { - if(state.logger.isInfo()) state.logger.info(f('server %s errored out with %s', server.name, JSON.stringify(err))); - state.mongosState.disconnected(server); - // No more servers left emit close - if(state.mongosState.connectedServers().length == 0) { - state.state = DISCONNECTED; - } - - // Signal server left - self.emit('left', 'mongos', server); - if(state.emitError) self.emit('error', err, server); - } -} - -var timeoutHandler = function(self, state) { - return function(err, server) { - if(state.logger.isInfo()) state.logger.info(f('server %s timed out', server.name)); - state.mongosState.disconnected(server); - - // No more servers emit close event if no entries left - if(state.mongosState.connectedServers().length == 0) { - state.state = DISCONNECTED; - } - - // Signal server left - self.emit('left', 'mongos', server); - } -} - -var closeHandler = function(self, state) { - return function(err, server) { - if(state.logger.isInfo()) state.logger.info(f('server %s closed', server.name)); - state.mongosState.disconnected(server); - - // No more servers left emit close - if(state.mongosState.connectedServers().length == 0) { - state.state = DISCONNECTED; - } - - // Signal server left - self.emit('left', 'mongos', server); - } -} - -// Connect handler -var connectHandler = function(self, state, e) { - return function(server) { - if(state.logger.isInfo()) state.logger.info(f('connected to %s', server.name)); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect', 'message', 'parseError'].forEach(function(e) { - server.removeAllListeners(e); - }); - - // finish processing the server - var processNewServer = function(_server) { - // Add the server handling code - if(_server.isConnected()) { - _server.once('error', errorHandler(self, state)); - _server.once('close', closeHandler(self, state)); - _server.once('timeout', timeoutHandler(self, state)); - _server.once('parseError', timeoutHandler(self, state)); - } - - // Emit joined event - self.emit('joined', 'mongos', _server); - - // Add to list connected servers - state.mongosState.connected(_server); - - // Do we have a reconnect event - if('ha' == e && state.mongosState.connectedServers().length == 1) { - self.emit('reconnect', _server); - } - - // Full setup - if(state.mongosState.disconnectedServers().length == 0 && - state.mongosState.connectedServers().length > 0 && - !state.fullsetup) { - state.fullsetup = true; - self.emit('fullsetup'); - } - - // all connected - if(state.mongosState.disconnectedServers().length == 0 && - state.mongosState.connectedServers().length == state.seedlist.length && - !state.all) { - state.all = true; - self.emit('all'); - } - - // Set connected - if(state.state == DISCONNECTED) { - state.state = CONNECTED; - self.emit('connect', self); - } - } - - // Is there an authentication process ongoing - if(state.authInProgress) { - state.authInProgressServers.push(server); - } - - // No credentials just process server - if(state.credentials.length == 0) return processNewServer(server); - - // Do we have credentials, let's apply them all - var count = state.credentials.length; - // Apply the credentials - for(var i = 0; i < state.credentials.length; i++) { - server.auth.apply(server, state.credentials[i].concat([function(err, r) { - count = count - 1; - if(count == 0) processNewServer(server); - }])); - } - } -} - -// -// Add server to the list if it does not exist -var addToListIfNotExist = function(list, server) { - var found = false; - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Check if the server already exists - for(var i = 0; i < list.length; i++) { - if(list[i].equals(server)) found = true; - } - - if(!found) { - list.push(server); - } -} - -// Add the new credential for a db, removing the old -// credential from the cache -var addCredentials = function(state, db, argsWithoutCallback) { - // Remove any credentials for the db - clearCredentials(state, db + ".dummy"); - // Add new credentials to list - state.credentials.push(argsWithoutCallback); -} - -// Clear out credentials for a namespace -var clearCredentials = function(state, ns) { - var db = ns.split('.')[0]; - var filteredCredentials = []; - - // Filter out all credentials for the db the user is logging out off - for(var i = 0; i < state.credentials.length; i++) { - if(state.credentials[i][1] != db) filteredCredentials.push(state.credentials[i]); - } - - // Set new list of credentials - state.credentials = filteredCredentials; -} - -var processReadPreference = function(cmd, options) { - options = options || {} - // No read preference specified - if(options.readPreference == null) return cmd; -} - -// -// Execute write operation -var executeWriteOperation = function(state, op, ns, ops, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - var server = null; - // Ensure we have no options - options = options || {}; - try { - // Get a primary - server = state.mongosState.pickServer(); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no mongos found")); - // Execute the command - server[op](ns, ops, options, callback); -} - -/** - * A mongos connect event, used to verify that the connection is up and running - * - * @event Mongos#connect - * @type {Mongos} - */ - -/** - * A server member left the mongos list - * - * @event Mongos#left - * @type {Mongos} - * @param {string} type The type of member that left (mongos) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the mongos list - * - * @event Mongos#joined - * @type {Mongos} - * @param {string} type The type of member that left (mongos) - * @param {Server} server The server object that joined - */ - -module.exports = Mongos; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js deleted file mode 100644 index 913ca1b8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; - -var needSlaveOk = ['primaryPreferred', 'secondary', 'secondaryPreferred', 'nearest']; - -/** - * @fileOverview The **ReadPreference** class is a class that represents a MongoDB ReadPreference and is - * used to construct connections. - * - * @example - * var ReplSet = require('mongodb-core').ReplSet - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new ReplSet([{host: 'localhost', port: 30000}], {setName: 'rs'}); - * // Wait for the connection event - * server.on('connect', function(server) { - * var cursor = server.cursor('db.test' - * , {find: 'db.test', query: {}} - * , {readPreference: new ReadPreference('secondary')}); - * cursor.next(function(err, doc) { - * server.destroy(); - * }); - * }); - * - * // Start connecting - * server.connect(); - */ - -/** - * Creates a new Pool instance - * @class - * @param {string} preference A string describing the preference (primary|primaryPreferred|secondary|secondaryPreferred|nearest) - * @param {object} tags The tags object - * @param {object} [options] Additional read preference options - * @property {string} preference The preference string (primary|primaryPreferred|secondary|secondaryPreferred|nearest) - * @property {object} tags The tags object - * @property {object} options Additional read preference options - * @return {ReadPreference} - */ -var ReadPreference = function(preference, tags, options) { - this.preference = preference; - this.tags = tags; - this.options = options; -} - -/** - * This needs slaveOk bit set - * @method - * @return {boolean} - */ -ReadPreference.prototype.slaveOk = function() { - return needSlaveOk.indexOf(this.preference) != -1; -} - -/** - * Are the two read preference equal - * @method - * @return {boolean} - */ -ReadPreference.prototype.equals = function(readPreference) { - return readPreference.preference == this.preference; -} - -/** - * Return JSON representation - * @method - * @return {Object} - */ -ReadPreference.prototype.toJSON = function() { - var readPreference = {mode: this.preference}; - if(Array.isArray(this.tags)) readPreference.tags = this.tags; - return readPreference; -} - -/** - * Primary read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.primary = new ReadPreference('primary'); -/** - * Primary Preferred read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.primaryPreferred = new ReadPreference('primaryPreferred'); -/** - * Secondary read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.secondary = new ReadPreference('secondary'); -/** - * Secondary Preferred read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.secondaryPreferred = new ReadPreference('secondaryPreferred'); -/** - * Nearest read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.nearest = new ReadPreference('nearest'); - -module.exports = ReadPreference; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js deleted file mode 100644 index bd863aa4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js +++ /dev/null @@ -1,1369 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , b = require('bson') - , bindToCurrentDomain = require('../connection/utils').bindToCurrentDomain - , debugOptions = require('../connection/utils').debugOptions - , EventEmitter = require('events').EventEmitter - , Server = require('./server') - , ReadPreference = require('./read_preference') - , MongoError = require('../error') - , Ping = require('./strategies/ping') - , Session = require('./session') - , BasicCursor = require('../cursor') - , BSON = require('bson').native().BSON - , State = require('./replset_state') - , Logger = require('../connection/logger'); - -/** - * @fileOverview The **ReplSet** class is a class that represents a Replicaset topology and is - * used to construct connecctions. - * - * @example - * var ReplSet = require('mongodb-core').ReplSet - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new ReplSet([{host: 'localhost', port: 30000}], {setName: 'rs'}); - * // Wait for the connection event - * server.on('connect', function(server) { - * server.destroy(); - * }); - * - * // Start connecting - * server.connect(); - */ - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -// -// ReplSet instance id -var replSetId = 1; - -// -// Clone the options -var cloneOptions = function(options) { - var opts = {}; - for(var name in options) { - opts[name] = options[name]; - } - return opts; -} - -// All bson types -var bsonTypes = [b.Long, b.ObjectID, b.Binary, b.Code, b.DBRef, b.Symbol, b.Double, b.Timestamp, b.MaxKey, b.MinKey]; -// BSON parser -var bsonInstance = null; - -/** - * Creates a new Replset instance - * @class - * @param {array} seedlist A list of seeds for the replicaset - * @param {boolean} options.setName The Replicaset set name - * @param {boolean} [options.secondaryOnlyConnectionAllowed=false] Allow connection to a secondary only replicaset - * @param {number} [options.haInterval=5000] The High availability period for replicaset inquiry - * @param {boolean} [options.emitError=false] Server will emit errors events - * @param {Cursor} [options.cursorFactory=Cursor] The cursor factory class used for all query cursors - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @param {number} [options.pingInterval=5000] Ping interval to check the response time to the different servers - * @param {number} [options.acceptableLatency=250] Acceptable latency for selecting a server for reading (in milliseconds) - * @return {ReplSet} A cursor instance - * @fires ReplSet#connect - * @fires ReplSet#ha - * @fires ReplSet#joined - * @fires ReplSet#left - */ -var ReplSet = function(seedlist, options) { - var self = this; - options = options || {}; - - // Validate seedlist - if(!Array.isArray(seedlist)) throw new MongoError("seedlist must be an array"); - // Validate list - if(seedlist.length == 0) throw new MongoError("seedlist must contain at least one entry"); - // Validate entries - seedlist.forEach(function(e) { - if(typeof e.host != 'string' || typeof e.port != 'number') - throw new MongoError("seedlist entry must contain a host and port"); - }); - - // Add event listener - EventEmitter.call(this); - - // Set the bson instance - bsonInstance = bsonInstance == null ? new BSON(bsonTypes) : bsonInstance; - - // Internal state hash for the object - this.s = { - options: options - // Logger instance - , logger: Logger('ReplSet', options) - // Uniquely identify the replicaset instance - , id: replSetId++ - // Index - , index: 0 - // Ha Index - , haId: 0 - // Current credentials used for auth - , credentials: [] - // Factory overrides - , Cursor: options.cursorFactory || BasicCursor - // BSON Parser, ensure we have a single instance - , bsonInstance: bsonInstance - // Pick the right bson parser - , bson: options.bson ? options.bson : bsonInstance - // Special replicaset options - , secondaryOnlyConnectionAllowed: typeof options.secondaryOnlyConnectionAllowed == 'boolean' - ? options.secondaryOnlyConnectionAllowed : false - , haInterval: options.haInterval || 10000 - // Are we running in debug mode - , debug: typeof options.debug == 'boolean' ? options.debug : false - // The replicaset name - , setName: options.setName - // Swallow or emit errors - , emitError: typeof options.emitError == 'boolean' ? options.emitError : false - // Grouping tag used for debugging purposes - , tag: options.tag - // Do we have a not connected handler - , disconnectHandler: options.disconnectHandler - // Currently connecting servers - , connectingServers: {} - // Contains any alternate strategies for picking - , readPreferenceStrategies: {} - // Auth providers - , authProviders: {} - // All the servers - , disconnectedServers: [] - // Initial connection servers - , initialConnectionServers: [] - // High availability process running - , highAvailabilityProcessRunning: false - // Full setup - , fullsetup: false - // All servers accounted for (used for testing) - , all: false - // Seedlist - , seedlist: seedlist - // Authentication in progress - , authInProgress: false - // Servers added while auth in progress - , authInProgressServers: [] - // Minimum heartbeat frequency used if we detect a server close - , minHeartbeatFrequencyMS: 500 - } - - // Add bson parser to options - options.bson = this.s.bson; - // Set up the connection timeout for the options - options.connectionTimeout = options.connectionTimeout || 10000; - - // Replicaset state - var replState = new State(this, { - id: this.s.id, setName: this.s.setName - , connectingServers: this.s.connectingServers - , secondaryOnlyConnectionAllowed: this.s.secondaryOnlyConnectionAllowed - }); - - // Add Replicaset state to our internal state - this.s.replState = replState; - - // BSON property (find a server and pass it along) - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - var servers = self.s.replState.getAll(); - return servers.length > 0 ? servers[0].bson : null; - } - }); - - Object.defineProperty(this, 'id', { - enumerable:true, get: function() { return self.s.id; } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return self.s.haInterval; } - }); - - Object.defineProperty(this, 'state', { - enumerable:true, get: function() { return self.s.replState; } - }); - - // - // Debug options - if(self.s.debug) { - // Add access to the read Preference Strategies - Object.defineProperty(this, 'readPreferenceStrategies', { - enumerable: true, get: function() { return self.s.readPreferenceStrategies; } - }); - } - - Object.defineProperty(this, 'type', { - enumerable:true, get: function() { return 'replset'; } - }); - - // Add the ping strategy for nearest - this.addReadPreferenceStrategy('nearest', new Ping(options)); -} - -inherits(ReplSet, EventEmitter); - -// -// Plugin methods -// - -/** - * Add custom read preference strategy - * @method - * @param {string} name Name of the read preference strategy - * @param {object} strategy Strategy object instance - */ -ReplSet.prototype.addReadPreferenceStrategy = function(name, func) { - this.s.readPreferenceStrategies[name] = func; -} - -/** - * Add custom authentication mechanism - * @method - * @param {string} name Name of the authentication mechanism - * @param {object} provider Authentication object instance - */ -ReplSet.prototype.addAuthProvider = function(name, provider) { - if(this.s.authProviders == null) this.s.authProviders = {}; - this.s.authProviders[name] = provider; -} - -/** - * Name of BSON parser currently used - * @method - * @return {string} - */ -ReplSet.prototype.parserType = function() { - if(this.s.bson.serialize.toString().indexOf('[native code]') != -1) - return 'c++'; - return 'js'; -} - -/** - * Execute a command - * @method - * @param {string} type Type of BSON parser to use (c++ or js) - */ -ReplSet.prototype.setBSONParserType = function(type) { - var nBSON = null; - - if(type == 'c++') { - nBSON = require('bson').native().BSON; - } else if(type == 'js') { - nBSON = require('bson').pure().BSON; - } else { - throw new MongoError(f("% parser not supported", type)); - } - - this.s.options.bson = new nBSON(bsonTypes); -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -ReplSet.prototype.lastIsMaster = function() { - return this.s.replState.lastIsMaster(); -} - -/** - * Get connection - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Connection} - */ -ReplSet.prototype.getConnection = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - var server = pickServer(this, this.s, options.readPreference); - if(server == null) return null; - // Return connection - return server.getConnection(); -} - -/** - * All raw connections - * @method - * @return {Connection[]} - */ -ReplSet.prototype.connections = function() { - return this.s.replState.getAllConnections(); -} - -/** - * Get server - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Server} - */ -ReplSet.prototype.getServer = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - return pickServer(this, this.s, options.readPreference); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.cursor = function(ns, cmd, cursorOptions) { - cursorOptions = cursorOptions || {}; - var FinalCursor = cursorOptions.cursorFactory || this.s.Cursor; - return new FinalCursor(this.s.bson, ns, cmd, cursorOptions, this, this.s.options); -} - -// -// Execute write operation -var executeWriteOperation = function(self, op, ns, ops, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - var server = null; - // Ensure we have no options - options = options || {}; - // Get a primary - try { - server = pickServer(self, self.s, ReadPreference.primary); - if(self.s.debug) self.emit('pickedServer', ReadPreference.primary, server); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no server found")); - - // Handler - var handler = function(err, r) { - // We have a no master error, immediately refresh the view of the replicaset - if(notMasterError(r) || notMasterError(err)) replicasetInquirer(self, self.s, true)(); - // Return the result - callback(err, r); - } - - // Add operationId if existing - if(callback.operationId) handler.operationId = callback.operationId; - // Execute the command - server[op](ns, ops, options, handler); -} - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Connection} [options.connection] Specify connection object to execute command against - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.command = function(ns, cmd, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - - var server = null; - var self = this; - // Ensure we have no options - options = options || {}; - - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected(options) && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('command', ns, cmd, options, callback); - } - - // We need to execute the command on all servers - if(options.onAll) { - var servers = this.s.replState.getAll(); - var count = servers.length; - var cmdErr = null; - - for(var i = 0; i < servers.length; i++) { - servers[i].command(ns, cmd, options, function(err, r) { - count = count - 1; - // Finished executing command - if(count == 0) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(self.s, ns); - // We have a no master error, immediately refresh the view of the replicaset - if(notMasterError(r) || notMasterError(err)) replicasetInquirer(self, self.s, true)(); - // Return the error - callback(err, r); - } - }); - } - - return; - } - - // Pick the right server based on readPreference - try { - server = pickServer(self, self.s, options.writeConcern ? ReadPreference.primary : options.readPreference); - if(self.s.debug) self.emit('pickedServer', options.writeConcern ? ReadPreference.primary : options.readPreference, server); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no server found")); - // Execute the command - server.command(ns, cmd, options, function(err, r) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(self.s, ns); - // We have a no master error, immediately refresh the view of the replicaset - if(notMasterError(r) || notMasterError(err)) { - replicasetInquirer(self, self.s, true)(); - } - // Return the error - callback(err, r); - }); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.remove = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('remove', ns, ops, options, callback); - } - - executeWriteOperation(this, 'remove', ns, ops, options, callback); -} - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.insert = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('insert', ns, ops, options, callback); - } - - executeWriteOperation(this, 'insert', ns, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.update = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('update', ns, ops, options, callback); - } - - executeWriteOperation(this, 'update', ns, ops, options, callback); -} - -/** - * Authenticate using a specified mechanism - * @method - * @param {string} mechanism The Auth mechanism we are invoking - * @param {string} db The db we are invoking the mechanism against - * @param {...object} param Parameters for the specific mechanism - * @param {authResultCallback} callback A callback function - */ -ReplSet.prototype.auth = function(mechanism, db) { - var allArgs = Array.prototype.slice.call(arguments, 0).slice(0); - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - var callback = args.pop(); - - // If we don't have the mechanism fail - if(this.s.authProviders[mechanism] == null && mechanism != 'default') - throw new MongoError(f("auth provider %s does not exist", mechanism)); - - // Authenticate against all the servers - var servers = this.s.replState.getAll().slice(0); - var count = servers.length; - // Correct authentication - var authenticated = true; - var authErr = null; - // Set auth in progress - this.s.authInProgress = true; - - // Authenticate against all servers - while(servers.length > 0) { - var server = servers.shift(); - - // Arguments without a callback - var argsWithoutCallback = [mechanism, db].concat(args.slice(0)); - // Create arguments - var finalArguments = argsWithoutCallback.concat([function(err, r) { - count = count - 1; - if(err) authErr = err; - if(!r) authenticated = false; - - // We are done - if(count == 0) { - // We have more servers that are not authenticated, let's authenticate - if(self.s.authInProgressServers.length > 0) { - self.s.authInProgressServers = []; - return self.auth.apply(self, [mechanism, db].concat(args).concat([callback])); - } - - // Auth is done - self.s.authInProgress = false; - // Add successful credentials - if(authErr == null) addCredentials(self.s, db, argsWithoutCallback); - // Return the auth error - if(authErr) return callback(authErr, false); - // Successfully authenticated session - callback(null, new Session({}, self)); - } - }]); - - // Execute the auth - server.auth.apply(server, finalArguments); - } -} - -ReplSet.prototype.state = function() { - return this.s.replState.state; -} - -/** - * Ensure single socket connections to arbiters and hidden servers - * @method - */ -var handleIsmaster = function(self) { - return function(ismaster, _server) { - if(ismaster.arbiterOnly) { - _server.s.options.size = 1; - } else if(ismaster.hidden) { - _server.s.options.size = 1; - } - } -} - -/** - * Initiate server connect - * @method - */ -ReplSet.prototype.connect = function(_options) { - var self = this; - // Start replicaset inquiry process - setTimeout(replicasetInquirer(this, this.s, false), this.s.haInterval); - // Additional options - if(_options) for(var name in _options) this.s.options[name] = _options[name]; - - // Set the state as connecting - this.s.replState.state = CONNECTING; - - // No fullsetup reached - this.s.fullsetup = false; - - // For all entries in the seedlist build a server instance - this.s.seedlist.forEach(function(e) { - // Clone options - var opts = cloneOptions(self.s.options); - // Add host and port - opts.host = e.host; - opts.port = e.port; - opts.reconnect = false; - opts.readPreferenceStrategies = self.s.readPreferenceStrategies; - opts.emitError = true; - if(self.s.tag) opts.tag = self.s.tag; - // Share the auth store - opts.authProviders = self.s.authProviders; - // Create a new Server - var server = new Server(opts); - // Handle the ismaster - server.on('ismaster', handleIsmaster(self)); - // Add to list of disconnected servers - self.s.disconnectedServers.push(server); - // Add to list of inflight Connections - self.s.initialConnectionServers.push(server); - }); - - // Attempt to connect to all the servers - while(this.s.disconnectedServers.length > 0) { - // Get the server - var server = this.s.disconnectedServers.shift(); - - // Set up the event handlers - server.once('error', errorHandlerTemp(this, this.s, 'error')); - server.once('close', errorHandlerTemp(this, this.s, 'close')); - server.once('timeout', errorHandlerTemp(this, this.s, 'timeout')); - server.once('connect', connectHandler(this, this.s)); - - // Attempt to connect - server.connect(); - } -} - -/** - * Figure out if the server is connected - * @method - * @return {boolean} - */ -ReplSet.prototype.isConnected = function(options) { - options = options || {}; - // If we specified a read preference check if we are connected to something - // than can satisfy this - if(options.readPreference - && options.readPreference.equals(ReadPreference.secondary)) - return this.s.replState.isSecondaryConnected(); - - if(options.readPreference - && options.readPreference.equals(ReadPreference.primary)) - return this.s.replState.isSecondaryConnected() || this.s.replState.isPrimaryConnected(); - - if(this.s.secondaryOnlyConnectionAllowed - && this.s.replState.isSecondaryConnected()) return true; - return this.s.replState.isPrimaryConnected(); -} - -/** - * Figure out if the replicaset instance was destroyed by calling destroy - * @method - * @return {boolean} - */ -ReplSet.prototype.isDestroyed = function() { - return this.s.replState.state == DESTROYED; -} - -/** - * Destroy the server connection - * @method - */ -ReplSet.prototype.destroy = function(emitClose) { - var self = this; - if(this.s.logger.isInfo()) this.s.logger.info(f('[%s] destroyed', this.s.id)); - this.s.replState.state = DESTROYED; - - // Emit close - if(emitClose && self.listeners('close').length > 0) self.emit('close', self); - - // Destroy state - this.s.replState.destroy(); - - // Clear out any listeners - var events = ['timeout', 'error', 'close', 'joined', 'left']; - events.forEach(function(e) { - self.removeAllListeners(e); - }); -} - -/** - * A replset connect event, used to verify that the connection is up and running - * - * @event ReplSet#connect - * @type {ReplSet} - */ - -/** - * The replset high availability event - * - * @event ReplSet#ha - * @type {function} - * @param {string} type The stage in the high availability event (start|end) - * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only - * @param {number} data.id The id for this high availability request - * @param {object} data.state An object containing the information about the current replicaset - */ - -/** - * A server member left the replicaset - * - * @event ReplSet#left - * @type {function} - * @param {string} type The type of member that left (primary|secondary|arbiter) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the replicaset - * - * @event ReplSet#joined - * @type {function} - * @param {string} type The type of member that joined (primary|secondary|arbiter) - * @param {Server} server The server object that joined - */ - -// -// Inquires about state changes -// - -// Add the new credential for a db, removing the old -// credential from the cache -var addCredentials = function(s, db, argsWithoutCallback) { - // Remove any credentials for the db - clearCredentials(s, db + ".dummy"); - // Add new credentials to list - s.credentials.push(argsWithoutCallback); -} - -// Clear out credentials for a namespace -var clearCredentials = function(s, ns) { - var db = ns.split('.')[0]; - var filteredCredentials = []; - - // Filter out all credentials for the db the user is logging out off - for(var i = 0; i < s.credentials.length; i++) { - if(s.credentials[i][1] != db) filteredCredentials.push(s.credentials[i]); - } - - // Set new list of credentials - s.credentials = filteredCredentials; -} - -// -// Filter serves by tags -var filterByTags = function(readPreference, servers) { - if(readPreference.tags == null) return servers; - var filteredServers = []; - var tags = readPreference.tags; - - // Iterate over all the servers - for(var i = 0; i < servers.length; i++) { - var serverTag = servers[i].lastIsMaster().tags || {}; - // Did we find the a matching server - var found = true; - // Check if the server is valid - for(var name in tags) { - if(serverTag[name] != tags[name]) found = false; - } - - // Add to candidate list - if(found) filteredServers.push(servers[i]); - } - - // Returned filtered servers - return filteredServers; -} - -// -// Pick a server based on readPreference -var pickServer = function(self, s, readPreference) { - // If no read Preference set to primary by default - readPreference = readPreference || ReadPreference.primary; - - // Do we have a custom readPreference strategy, use it - if(s.readPreferenceStrategies != null && s.readPreferenceStrategies[readPreference.preference] != null) { - if(s.readPreferenceStrategies[readPreference.preference] == null) throw new MongoError(f("cannot locate read preference handler for %s", readPreference.preference)); - var server = s.readPreferenceStrategies[readPreference.preference].pickServer(s.replState, readPreference); - if(s.debug) self.emit('pickedServer', readPreference, server); - return server; - } - - // Filter out any hidden secondaries - var secondaries = s.replState.secondaries.filter(function(server) { - if(server.lastIsMaster().hidden) return false; - return true; - }); - - // Check if we can satisfy and of the basic read Preferences - if(readPreference.equals(ReadPreference.secondary) - && secondaries.length == 0) - throw new MongoError("no secondary server available"); - - if(readPreference.equals(ReadPreference.secondaryPreferred) - && secondaries.length == 0 - && s.replState.primary == null) - throw new MongoError("no secondary or primary server available"); - - if(readPreference.equals(ReadPreference.primary) - && s.replState.primary == null) - throw new MongoError("no primary server available"); - - // Secondary - if(readPreference.equals(ReadPreference.secondary)) { - s.index = (s.index + 1) % secondaries.length; - return secondaries[s.index]; - } - - // Secondary preferred - if(readPreference.equals(ReadPreference.secondaryPreferred)) { - if(secondaries.length > 0) { - // Apply tags if present - var servers = filterByTags(readPreference, secondaries); - // If have a matching server pick one otherwise fall through to primary - if(servers.length > 0) { - s.index = (s.index + 1) % servers.length; - return servers[s.index]; - } - } - - return s.replState.primary; - } - - // Primary preferred - if(readPreference.equals(ReadPreference.primaryPreferred)) { - if(s.replState.primary) return s.replState.primary; - - if(secondaries.length > 0) { - // Apply tags if present - var servers = filterByTags(readPreference, secondaries); - // If have a matching server pick one otherwise fall through to primary - if(servers.length > 0) { - s.index = (s.index + 1) % servers.length; - return servers[s.index]; - } - - // Throw error a we have not valid secondary or primary servers - throw new MongoError("no secondary or primary server available"); - } - } - - // Return the primary - return s.replState.primary; -} - -var replicasetInquirer = function(self, state, norepeat) { - return function() { - if(state.replState.state == DESTROYED) return - // Process already running don't rerun - if(state.highAvailabilityProcessRunning) return; - // Started processes - state.highAvailabilityProcessRunning = true; - if(state.logger.isInfo()) state.logger.info(f('[%s] monitoring process running %s', state.id, JSON.stringify(state.replState))); - - // Unique HA id to identify the current look running - var localHaId = state.haId++; - - // Clean out any failed connection attempts - state.connectingServers = {}; - - // Controls if we are doing a single inquiry or repeating - norepeat = typeof norepeat == 'boolean' ? norepeat : false; - - // If we have a primary and a disconnect handler, execute - // buffered operations - if(state.replState.isPrimaryConnected() && state.replState.isSecondaryConnected() && state.disconnectHandler) { - state.disconnectHandler.execute(); - } - - // Emit replicasetInquirer - self.emit('ha', 'start', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - - // Let's process all the disconnected servers - while(state.disconnectedServers.length > 0) { - // Get the first disconnected server - var server = state.disconnectedServers.shift(); - if(state.logger.isInfo()) state.logger.info(f('[%s] monitoring attempting to connect to %s', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - // Set up the event handlers - server.once('error', errorHandlerTemp(self, state, 'error')); - server.once('close', errorHandlerTemp(self, state, 'close')); - server.once('timeout', errorHandlerTemp(self, state, 'timeout')); - server.once('connect', connectHandler(self, state)); - // Attempt to connect - server.connect(); - } - - // Cleanup state (removed disconnected servers) - state.replState.clean(); - - // We need to query all servers - var servers = state.replState.getAll(); - var serversLeft = servers.length; - - // If no servers and we are not destroyed keep pinging - if(servers.length == 0 && state.replState.state == CONNECTED) { - // Emit ha process end - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunning - state.highAvailabilityProcessRunning = false; - // Restart ha process - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - - // - // ismaster for Master server - var primaryIsMaster = null; - - // Kill the server connection if it hangs - var timeoutServer = function(_server) { - return setTimeout(function() { - if(_server.isConnected()) { - _server.connections()[0].connection.destroy(); - } - }, self.s.options.connectionTimeout); - } - - // - // Inspect a specific servers ismaster - var inspectServer = function(server) { - if(state.replState.state == DESTROYED) return; - // Did we get a server - if(server && server.isConnected()) { - // Get the timeout id - var timeoutId = timeoutServer(server); - // Execute ismaster - server.command('system.$cmd', {ismaster:true}, function(err, r) { - // Clear out the timeoutServer - clearTimeout(timeoutId); - // If the state was destroyed - if(state.replState.state == DESTROYED) return; - // Count down the number of servers left - serversLeft = serversLeft - 1; - // If we have an error but still outstanding server request return - if(err && serversLeft > 0) return; - // We had an error and have no more servers to inspect, schedule a new check - if(err && serversLeft == 0) { - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunnfing - state.highAvailabilityProcessRunning = false; - // Return the replicasetInquirer - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - - // Let all the read Preferences do things to the servers - var rPreferencesCount = Object.keys(state.readPreferenceStrategies).length; - - // Handle the primary - var ismaster = r.result; - if(state.logger.isDebug()) state.logger.debug(f('[%s] monitoring process ismaster %s', state.id, JSON.stringify(ismaster))); - - // Update the replicaset state - state.replState.update(ismaster, server); - - // Add any new servers - if(err == null && ismaster.ismaster && Array.isArray(ismaster.hosts)) { - // Hosts to process - var hosts = ismaster.hosts; - // Add arbiters to list of hosts if we have any - if(Array.isArray(ismaster.arbiters)) { - hosts = hosts.concat(ismaster.arbiters.map(function(x) { - return {host: x, arbiter:true}; - })); - } - - if(Array.isArray(ismaster.passives)) hosts = hosts.concat(ismaster.passives); - // Process all the hsots - processHosts(self, state, hosts); - } - - // No read Preferences strategies - if(rPreferencesCount == 0) { - // Don't schedule a new inquiry - if(serversLeft > 0) return; - // Emit ha process end - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunning - state.highAvailabilityProcessRunning = false; - // Let's keep monitoring - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - - // No servers left to query, execute read preference strategies - if(serversLeft == 0) { - // Go over all the read preferences - for(var name in state.readPreferenceStrategies) { - state.readPreferenceStrategies[name].ha(self, state.replState, function() { - rPreferencesCount = rPreferencesCount - 1; - - if(rPreferencesCount == 0) { - // Add any new servers in primary ismaster - if(err == null - && ismaster.ismaster - && Array.isArray(ismaster.hosts)) { - processHosts(self, state, ismaster.hosts); - } - - // Emit ha process end - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunning - state.highAvailabilityProcessRunning = false; - // Let's keep monitoring - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - }); - } - } - }); - } - } - - // Call ismaster on all servers - for(var i = 0; i < servers.length; i++) { - inspectServer(servers[i]); - } - - // If no more initial servers and new scheduled servers to connect - if(state.replState.secondaries.length >= 1 && state.replState.primary != null && !state.fullsetup) { - state.fullsetup = true; - self.emit('fullsetup', self); - } - - // If all servers are accounted for and we have not sent the all event - if(state.replState.primary != null && self.lastIsMaster() - && Array.isArray(self.lastIsMaster().hosts) && !state.all) { - var length = 1 + state.replState.secondaries.length; - // If we have all secondaries + primary - if(length == self.lastIsMaster().hosts.length + 1) { - state.all = true; - self.emit('all', self); - } - } - } -} - -// Error handler for initial connect -var errorHandlerTemp = function(self, state, event) { - return function(err, server) { - // Log the information - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s disconnected', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - // Filter out any connection servers - state.initialConnectionServers = state.initialConnectionServers.filter(function(_server) { - return server.name != _server.name; - }); - - // Connection is destroyed, ignore - if(state.replState.state == DESTROYED) return; - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Push to list of disconnected servers - addToListIfNotExist(state.disconnectedServers, server); - - // End connection operation if we have no legal replicaset state - if(state.initialConnectionServers == 0 && state.replState.state == CONNECTING) { - if((state.secondaryOnlyConnectionAllowed && !state.replState.isSecondaryConnected() && !state.replState.isPrimaryConnected()) - || (!state.secondaryOnlyConnectionAllowed && !state.replState.isPrimaryConnected())) { - if(state.logger.isInfo()) state.logger.info(f('[%s] no valid seed servers in list', state.id)); - - if(self.listeners('error').length > 0) - return self.emit('error', new MongoError('no valid seed servers in list')); - } - } - - // If the number of disconnected servers is equal to - // the number of seed servers we cannot connect - if(state.disconnectedServers.length == state.seedlist.length && state.replState.state == CONNECTING) { - if(state.emitError && self.listeners('error').length > 0) { - if(state.logger.isInfo()) state.logger.info(f('[%s] no valid seed servers in list', state.id)); - - if(self.listeners('error').length > 0) - self.emit('error', new MongoError('no valid seed servers in list')); - } - } - } -} -// TODO with arbiter -// - if connected to an arbiter, shut down all but single server connection - -// Connect handler -var connectHandler = function(self, state) { - return function(server) { - if(state.logger.isInfo()) state.logger.info(f('[%s] connected to %s', state.id, server.name)); - // Destroyed connection - if(state.replState.state == DESTROYED) { - server.destroy(false, false); - return; - } - - // Filter out any connection servers - state.initialConnectionServers = state.initialConnectionServers.filter(function(_server) { - return server.name != _server.name; - }); - - // Process the new server - var processNewServer = function() { - // Discover any additional servers - var ismaster = server.lastIsMaster(); - - // Are we an arbiter, restrict number of connections to - // one single connection - if(ismaster.arbiterOnly) { - server.capConnections(1); - } - - // Deal with events - var events = ['error', 'close', 'timeout', 'connect', 'message']; - // Remove any non used handlers - events.forEach(function(e) { - server.removeAllListeners(e); - }) - - // Clean up - delete state.connectingServers[server.name]; - // Update the replicaset state, destroy if not added - if(!state.replState.update(ismaster, server)) { - return server.destroy(); - } - - // Add the server handling code - if(server.isConnected()) { - server.on('error', errorHandler(self, state)); - server.on('close', closeHandler(self, state)); - server.on('timeout', timeoutHandler(self, state)); - } - - // Hosts to process - var hosts = ismaster.hosts; - // Add arbiters to list of hosts if we have any - if(Array.isArray(ismaster.arbiters)) { - hosts = hosts.concat(ismaster.arbiters.map(function(x) { - return {host: x, arbiter:true}; - })); - } - - if(Array.isArray(ismaster.passives)) hosts = hosts.concat(ismaster.passives); - - // Add any new servers - processHosts(self, state, hosts); - - // If have the server instance already destroy it - if(state.initialConnectionServers.length == 0 && Object.keys(state.connectingServers).length == 0 - && !state.replState.isPrimaryConnected() && !state.secondaryOnlyConnectionAllowed && state.replState.state == CONNECTING) { - if(state.logger.isInfo()) state.logger.info(f('[%s] no primary found in replicaset', state.id)); - self.emit('error', new MongoError("no primary found in replicaset")); - return self.destroy(); - } - - // If no more initial servers and new scheduled servers to connect - if(state.replState.secondaries.length >= 1 && state.replState.primary != null && !state.fullsetup) { - state.fullsetup = true; - self.emit('fullsetup', self); - } - } - - // Save up new members to be authenticated against - if(self.s.authInProgress) { - self.s.authInProgressServers.push(server); - } - - // No credentials just process server - if(state.credentials.length == 0) return processNewServer(); - // Do we have credentials, let's apply them all - var count = state.credentials.length; - // Apply the credentials - for(var i = 0; i < state.credentials.length; i++) { - server.auth.apply(server, state.credentials[i].concat([function(err, r) { - count = count - 1; - if(count == 0) processNewServer(); - }])); - } - } -} - -// -// Detect if we need to add new servers -var processHosts = function(self, state, hosts) { - if(state.replState.state == DESTROYED) return; - if(Array.isArray(hosts)) { - // Check any hosts exposed by ismaster - for(var i = 0; i < hosts.length; i++) { - // Get the object - var host = hosts[i]; - var options = {}; - - // Do we have an arbiter - if(typeof host == 'object') { - host = host.host; - options.arbiter = host.arbiter; - } - - // If not found we need to create a new connection - if(!state.replState.contains(host)) { - if(state.connectingServers[host] == null && !inInitialConnectingServers(self, state, host)) { - if(state.logger.isInfo()) state.logger.info(f('[%s] scheduled server %s for connection', state.id, host)); - // Make sure we know what is trying to connect - state.connectingServers[host] = host; - // Connect the server - connectToServer(self, state, host.split(':')[0], parseInt(host.split(':')[1], 10), options); - } - } - } - } -} - -var inInitialConnectingServers = function(self, state, address) { - for(var i = 0; i < state.initialConnectionServers.length; i++) { - if(state.initialConnectionServers[i].name == address) return true; - } - return false; -} - -// Connect to a new server -var connectToServer = function(self, state, host, port, options) { - options = options || {}; - var opts = cloneOptions(state.options); - opts.host = host; - opts.port = port; - opts.reconnect = false; - opts.readPreferenceStrategies = state.readPreferenceStrategies; - if(state.tag) opts.tag = state.tag; - // Share the auth store - opts.authProviders = state.authProviders; - opts.emitError = true; - - // Do we have an arbiter set the poolSize to 1 - if(options.arbiter) { - opts.size = 1; - } - - // Create a new server instance - var server = new Server(opts); - // Handle the ismaster - server.on('ismaster', handleIsmaster(self)); - // Set up the event handlers - server.once('error', errorHandlerTemp(self, state, 'error')); - server.once('close', errorHandlerTemp(self, state, 'close')); - server.once('timeout', errorHandlerTemp(self, state, 'timeout')); - server.once('connect', connectHandler(self, state)); - // Attempt to connect - server.connect(); -} - -// -// Add server to the list if it does not exist -var addToListIfNotExist = function(list, server) { - var found = false; - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Check if the server already exists - for(var i = 0; i < list.length; i++) { - if(list[i].equals(server)) found = true; - } - - if(!found) { - list.push(server); - } - - return found; -} - -var errorHandler = function(self, state) { - return function(err, server) { - if(state.replState.state == DESTROYED) return; - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s errored out with %s', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name, JSON.stringify(err))); - var found = addToListIfNotExist(state.disconnectedServers, server); - if(!found) self.emit('left', state.replState.remove(server), server); - if(found && state.emitError && self.listeners('error').length > 0) self.emit('error', err, server); - - // Fire off a detection of missing server using minHeartbeatFrequencyMS - setTimeout(function() { - replicasetInquirer(self, self.s, true)(); - }, self.s.minHeartbeatFrequencyMS); - } -} - -var timeoutHandler = function(self, state) { - return function(err, server) { - if(state.replState.state == DESTROYED) return; - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s timed out', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - var found = addToListIfNotExist(state.disconnectedServers, server); - if(!found) self.emit('left', state.replState.remove(server), server); - - // Fire off a detection of missing server using minHeartbeatFrequencyMS - setTimeout(function() { - replicasetInquirer(self, self.s, true)(); - }, self.s.minHeartbeatFrequencyMS); - } -} - -var closeHandler = function(self, state) { - return function(err, server) { - if(state.replState.state == DESTROYED) return; - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s closed', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - var found = addToListIfNotExist(state.disconnectedServers, server); - if(!found) self.emit('left', state.replState.remove(server), server); - - // Fire off a detection of missing server using minHeartbeatFrequencyMS - setTimeout(function() { - replicasetInquirer(self, self.s, true)(); - }, self.s.minHeartbeatFrequencyMS); - } -} - -// -// Validate if a non-master or recovering error -var notMasterError = function(r) { - // Get result of any - var result = r && r.result ? r.result : r; - - // Explore if we have a not master error - if(result && (result.err == 'not master' - || result.errmsg == 'not master' || (result['$err'] && result['$err'].indexOf('not master or secondary') != -1) - || (result['$err'] && result['$err'].indexOf("not master and slaveOk=false") != -1) - || result.errmsg == 'node is recovering')) { - return true; - } - - return false; -} - -module.exports = ReplSet; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js deleted file mode 100644 index 951a0432..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js +++ /dev/null @@ -1,483 +0,0 @@ -"use strict"; - -var Logger = require('../connection/logger') - , f = require('util').format - , ObjectId = require('bson').ObjectId - , MongoError = require('../error'); - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -/** - * Creates a new Replicaset State object - * @class - * @property {object} primary Primary property - * @property {array} secondaries List of secondaries - * @property {array} arbiters List of arbiters - * @return {State} A cursor instance - */ -var State = function(replSet, options) { - this.replSet = replSet; - this.options = options; - this.secondaries = []; - this.arbiters = []; - this.passives = []; - this.primary = null; - // Initial state is disconnected - this.state = DISCONNECTED; - // Current electionId - this.electionId = null; - // Get a logger instance - this.logger = Logger('ReplSet', options); - // Unpacked options - this.id = options.id; - this.setName = options.setName; - this.connectingServers = options.connectingServers; - this.secondaryOnlyConnectionAllowed = options.secondaryOnlyConnectionAllowed; -} - -/** - * Is there a secondary connected - * @method - * @return {boolean} - */ -State.prototype.isSecondaryConnected = function() { - for(var i = 0; i < this.secondaries.length; i++) { - if(this.secondaries[i].isConnected()) return true; - } - - return false; -} - -/** - * Is there a primary connection - * @method - * @return {boolean} - */ -State.prototype.isPrimaryConnected = function() { - return this.primary != null && this.primary.isConnected(); -} - -/** - * Is the given address the primary - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.isPrimary = function(address) { - if(this.primary == null) return false; - return this.primary && this.primary.equals(address); -} - -/** - * Is the given address a secondary - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.isSecondary = function(address) { - // Check if the server is a secondary at the moment - for(var i = 0; i < this.secondaries.length; i++) { - if(this.secondaries[i].equals(address)) { - return true; - } - } - - return false; -} - -/** - * Is the given address a secondary - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.isPassive = function(address) { - // Check if the server is a secondary at the moment - for(var i = 0; i < this.passives.length; i++) { - if(this.passives[i].equals(address)) { - return true; - } - } - - return false; -} - -/** - * Does the replicaset contain this server - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.contains = function(address) { - if(this.primary && this.primary.equals(address)) return true; - for(var i = 0; i < this.secondaries.length; i++) { - if(this.secondaries[i].equals(address)) return true; - } - - for(var i = 0; i < this.arbiters.length; i++) { - if(this.arbiters[i].equals(address)) return true; - } - - for(var i = 0; i < this.passives.length; i++) { - if(this.passives[i].equals(address)) return true; - } - - return false; -} - -/** - * Clean out all dead connections - * @method - */ -State.prototype.clean = function() { - if(this.primary != null && !this.primary.isConnected()) { - this.primary = null; - } - - // Filter out disconnected servers - this.secondaries = this.secondaries.filter(function(s) { - return s.isConnected(); - }); - - // Filter out disconnected servers - this.arbiters = this.arbiters.filter(function(s) { - return s.isConnected(); - }); -} - -/** - * Destroy state - * @method - */ -State.prototype.destroy = function() { - this.state = DESTROYED; - if(this.primary) this.primary.destroy(); - this.secondaries.forEach(function(s) { - s.destroy(); - }); -} - -/** - * Remove server from state - * @method - * @param {Server} Server to remove - * @return {string} Returns type of server removed (primary|secondary) - */ -State.prototype.remove = function(server) { - if(this.primary && this.primary.equals(server)) { - this.primary = null; - } - - var length = this.arbiters.length; - // Filter out the server from the arbiters - this.arbiters = this.arbiters.filter(function(s) { - return !s.equals(server); - }); - if(this.arbiters.length < length) return 'arbiter'; - - var length = this.passives.length; - // Filter out the server from the passives - this.passives = this.passives.filter(function(s) { - return !s.equals(server); - }); - - // We have removed a passive - if(this.passives.length < length) { - // Ensure we removed it from the list of secondaries as well if it exists - this.secondaries = this.secondaries.filter(function(s) { - return !s.equals(server); - }); - } - - // Filter out the server from the secondaries - this.secondaries = this.secondaries.filter(function(s) { - return !s.equals(server); - }); - - // Get the isMaster - var isMaster = server.lastIsMaster(); - // Return primary if the server was primary - if(isMaster.ismaster) return 'primary'; - if(isMaster.secondary) return 'secondary'; - if(isMaster.passive) return 'passive'; - return 'arbiter'; -} - -/** - * Get the server by name - * @method - * @param {string} address Server address - * @return {Server} - */ -State.prototype.get = function(server) { - var found = false; - // All servers to search - var servers = this.primary ? [this.primary] : []; - servers = servers.concat(this.secondaries); - // Locate the server - for(var i = 0; i < servers.length; i++) { - if(servers[i].equals(server)) { - return servers[i]; - } - } -} - -/** - * Get all the servers in the set - * @method - * @return {array} - */ -State.prototype.getAll = function() { - var servers = []; - if(this.primary) servers.push(this.primary); - return servers.concat(this.secondaries); -} - -/** - * All raw connections - * @method - * @return {array} - */ -State.prototype.getAllConnections = function() { - var connections = []; - if(this.primary) connections = connections.concat(this.primary.connections()); - this.secondaries.forEach(function(s) { - connections = connections.concat(s.connections()); - }) - - return connections; -} - -/** - * Return JSON object - * @method - * @return {object} - */ -State.prototype.toJSON = function() { - return { - primary: this.primary ? this.primary.lastIsMaster().me : null - , secondaries: this.secondaries.map(function(s) { - return s.lastIsMaster().me - }) - } -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -State.prototype.lastIsMaster = function() { - if(this.primary) return this.primary.lastIsMaster(); - if(this.secondaries.length > 0) return this.secondaries[0].lastIsMaster(); - return {}; -} - -/** - * Promote server to primary - * @method - * @param {Server} server Server we wish to promote - */ -State.prototype.promotePrimary = function(server) { - var currentServer = this.get(server); - // Server does not exist in the state, add it as new primary - if(currentServer == null) { - this.primary = server; - return; - } - - // We found a server, make it primary and remove it from the secondaries - // Remove the server first - this.remove(currentServer); - // Set as primary - this.primary = currentServer; -} - -var add = function(list, server) { - // Check if the server is a secondary at the moment - for(var i = 0; i < list.length; i++) { - if(list[i].equals(server)) return false; - } - - list.push(server); - return true; -} - -/** - * Add server to list of secondaries - * @method - * @param {Server} server Server we wish to add - */ -State.prototype.addSecondary = function(server) { - return add(this.secondaries, server); -} - -/** - * Add server to list of arbiters - * @method - * @param {Server} server Server we wish to add - */ -State.prototype.addArbiter = function(server) { - return add(this.arbiters, server); -} - -/** - * Add server to list of passives - * @method - * @param {Server} server Server we wish to add - */ -State.prototype.addPassive = function(server) { - return add(this.passives, server); -} - -var compareObjectIds = function(id1, id2) { - var a = new Buffer(id1.toHexString(), 'hex'); - var b = new Buffer(id2.toHexString(), 'hex'); - - if(a === b) { - return 0; - } - - if(typeof Buffer.compare === 'function') { - return Buffer.compare(a, b); - } - - var x = a.length; - var y = b.length; - var len = Math.min(x, y); - - for (var i = 0; i < len; i++) { - if (a[i] !== b[i]) { - break; - } - } - - if (i !== len) { - x = a[i]; - y = b[i]; - } - - return x < y ? -1 : y < x ? 1 : 0; -} - -/** - * Update the state given a specific ismaster result - * @method - * @param {object} ismaster IsMaster result - * @param {Server} server IsMaster Server source - */ -State.prototype.update = function(ismaster, server) { - var self = this; - // Not in a known connection valid state - if(!ismaster.ismaster && !ismaster.secondary && !ismaster.arbiterOnly) { - // Remove the state - var result = self.remove(server); - if(self.state == CONNECTED) { - if(self.logger.isInfo()) self.logger.info(f('[%s] removing %s from set', self.id, ismaster.me)); - self.replSet.emit('left', self.remove(server), server); - } - - return false; - } - - // Set the setName if it's not set from the first server - if(self.setName == null && ismaster.setName) { - if(self.logger.isInfo()) self.logger.info(f('[%s] setting setName to %s', self.id, ismaster.setName)); - self.setName = ismaster.setName; - } - - // Check if the replicaset name matches the provided one - if(ismaster.setName && self.setName != ismaster.setName) { - if(self.logger.isError()) self.logger.error(f('[%s] server in replset %s is not part of the specified setName %s', self.id, ismaster.setName, self.setName)); - self.remove(server); - self.replSet.emit('error', new MongoError("provided setName for Replicaset Connection does not match setName found in server seedlist")); - return false; - } - - // Log information - if(self.logger.isInfo()) self.logger.info(f('[%s] updating replicaset state %s', self.id, JSON.stringify(this))); - - // It's a master set it - if(ismaster.ismaster && self.setName == ismaster.setName && !self.isPrimary(ismaster.me)) { - // Check if the electionId is not null - if(ismaster.electionId instanceof ObjectId && self.electionId instanceof ObjectId) { - if(compareObjectIds(self.electionId, ismaster.electionId) == -1) { - self.electionId = ismaster.electionId; - } else if(compareObjectIds(self.electionId, ismaster.electionId) == 0) { - self.electionId = ismaster.electionId; - } else { - return false; - } - } - - // Initial electionId - if(ismaster.electionId instanceof ObjectId && self.electionId == null) { - self.electionId = ismaster.electionId; - } - - // Promote to primary - self.promotePrimary(server); - // Log change of primary - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to primary', self.id, ismaster.me)); - // Emit primary - self.replSet.emit('joined', 'primary', this.primary); - - // We are connected - if(self.state == CONNECTING) { - self.state = CONNECTED; - self.replSet.emit('connect', self.replSet); - } else { - self.state = CONNECTED; - self.replSet.emit('reconnect', server); - } - } else if(!ismaster.ismaster && self.setName == ismaster.setName - && ismaster.arbiterOnly) { - if(self.addArbiter(server)) { - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to arbiter', self.id, ismaster.me)); - self.replSet.emit('joined', 'arbiter', server); - return true; - }; - - return false; - } else if(!ismaster.ismaster && self.setName == ismaster.setName - && ismaster.secondary && ismaster.passive) { - if(self.addPassive(server) && self.addSecondary(server)) { - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to passive', self.id, ismaster.me)); - self.replSet.emit('joined', 'passive', server); - - // If we have secondaryOnlyConnectionAllowed and just a passive it's - // still a valid connection - if(self.secondaryOnlyConnectionAllowed && self.state == CONNECTING) { - self.state = CONNECTED; - self.replSet.emit('connect', self.replSet); - } - - return true; - }; - - return false; - } else if(!ismaster.ismaster && self.setName == ismaster.setName - && ismaster.secondary) { - if(self.addSecondary(server)) { - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to secondary', self.id, ismaster.me)); - self.replSet.emit('joined', 'secondary', server); - - if(self.secondaryOnlyConnectionAllowed && self.state == CONNECTING) { - self.state = CONNECTED; - self.replSet.emit('connect', self.replSet); - } - - return true; - }; - - return false; - } - - // Return update applied - return true; -} - -module.exports = State; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js deleted file mode 100644 index b5e7e82e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js +++ /dev/null @@ -1,1241 +0,0 @@ - "use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , bindToCurrentDomain = require('../connection/utils').bindToCurrentDomain - , EventEmitter = require('events').EventEmitter - , Pool = require('../connection/pool') - , b = require('bson') - , Query = require('../connection/commands').Query - , MongoError = require('../error') - , ReadPreference = require('./read_preference') - , BasicCursor = require('../cursor') - , CommandResult = require('./command_result') - , getSingleProperty = require('../connection/utils').getSingleProperty - , getProperty = require('../connection/utils').getProperty - , debugOptions = require('../connection/utils').debugOptions - , BSON = require('bson').native().BSON - , PreTwoSixWireProtocolSupport = require('../wireprotocol/2_4_support') - , TwoSixWireProtocolSupport = require('../wireprotocol/2_6_support') - , ThreeTwoWireProtocolSupport = require('../wireprotocol/3_2_support') - , Session = require('./session') - , Logger = require('../connection/logger') - , MongoCR = require('../auth/mongocr') - , X509 = require('../auth/x509') - , Plain = require('../auth/plain') - , GSSAPI = require('../auth/gssapi') - , SSPI = require('../auth/sspi') - , ScramSHA1 = require('../auth/scram'); - -/** - * @fileOverview The **Server** class is a class that represents a single server topology and is - * used to construct connections. - * - * @example - * var Server = require('mongodb-core').Server - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new Server({host: 'localhost', port: 27017}); - * // Wait for the connection event - * server.on('connect', function(server) { - * server.destroy(); - * }); - * - * // Start connecting - * server.connect(); - */ - -// All bson types -var bsonTypes = [b.Long, b.ObjectID, b.Binary, b.Code, b.DBRef, b.Symbol, b.Double, b.Timestamp, b.MaxKey, b.MinKey]; -// BSON parser -var bsonInstance = null; -// Server instance id -var serverId = 0; -// Callbacks instance id -var callbackId = 0; - -// Single store for all callbacks -var Callbacks = function() { - // EventEmitter.call(this); - var self = this; - // Callbacks - this.callbacks = {}; - // Set the callbacks id - this.id = callbackId++; - // Set the type to server - this.type = 'server'; -} - -// -// Clone the options -var cloneOptions = function(options) { - var opts = {}; - for(var name in options) { - opts[name] = options[name]; - } - return opts; -} - -// -// Flush all callbacks -Callbacks.prototype.flush = function(err) { - for(var id in this.callbacks) { - if(!isNaN(parseInt(id, 10))) { - var callback = this.callbacks[id]; - delete this.callbacks[id]; - callback(err, null); - } - } -} - -Callbacks.prototype.emit = function(id, err, value) { - var callback = this.callbacks[id]; - delete this.callbacks[id]; - callback(err, value); -} - -Callbacks.prototype.raw = function(id) { - if(this.callbacks[id] == null) return false; - return this.callbacks[id].raw == true ? true : false -} - -Callbacks.prototype.documentsReturnedIn = function(id) { - if(this.callbacks[id] == null) return false; - return typeof this.callbacks[id].documentsReturnedIn == 'string' ? this.callbacks[id].documentsReturnedIn : null; -} - -Callbacks.prototype.unregister = function(id) { - delete this.callbacks[id]; -} - -Callbacks.prototype.register = function(id, callback) { - this.callbacks[id] = bindToCurrentDomain(callback); -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) return callback; - return domain.bind(callback); -} - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -// Supports server -var supportsServer = function(_s) { - return _s.ismaster && typeof _s.ismaster.minWireVersion == 'number'; -} - -// -// createWireProtocolHandler -var createWireProtocolHandler = function(result) { - // 3.2 wire protocol handler - if(result && result.maxWireVersion >= 4) { - return new ThreeTwoWireProtocolSupport(new TwoSixWireProtocolSupport()); - } - - // 2.6 wire protocol handler - if(result && result.maxWireVersion >= 2) { - return new TwoSixWireProtocolSupport(); - } - - // 2.4 or earlier wire protocol handler - return new PreTwoSixWireProtocolSupport(); -} - -// -// Reconnect server -var reconnectServer = function(self, state) { - // If the current reconnect retries is 0 stop attempting to reconnect - if(state.currentReconnectRetry == 0) { - return self.destroy(true, true); - } - - // Adjust the number of retries - state.currentReconnectRetry = state.currentReconnectRetry - 1; - - // Set status to connecting - state.state = CONNECTING; - // Create a new Pool - state.pool = new Pool(state.options); - // error handler - var reconnectErrorHandler = function(err) { - state.state = DISCONNECTED; - // Destroy the pool - state.pool.destroy(); - // Adjust the number of retries - state.currentReconnectRetry = state.currentReconnectRetry - 1; - // No more retries - if(state.currentReconnectRetry <= 0) { - self.state = DESTROYED; - self.emit('error', f('failed to connect to %s:%s after %s retries', state.options.host, state.options.port, state.reconnectTries)); - } else { - setTimeout(function() { - reconnectServer(self, state); - }, state.reconnectInterval); - } - } - - // - // Attempt to connect - state.pool.once('connect', function() { - // Reset retries - state.currentReconnectRetry = state.reconnectTries; - - // Remove any non used handlers - var events = ['error', 'close', 'timeout', 'parseError']; - events.forEach(function(e) { - state.pool.removeAllListeners(e); - }); - - // Set connected state - state.state = CONNECTED; - - // Add proper handlers - state.pool.once('error', reconnectErrorHandler); - state.pool.once('close', closeHandler(self, state)); - state.pool.once('timeout', timeoutHandler(self, state)); - state.pool.once('parseError', fatalErrorHandler(self, state)); - - // We need to ensure we have re-authenticated - var keys = Object.keys(state.authProviders); - if(keys.length == 0) return self.emit('reconnect', self); - - // Execute all providers - var count = keys.length; - // Iterate over keys - for(var i = 0; i < keys.length; i++) { - state.authProviders[keys[i]].reauthenticate(self, state.pool, function(err, r) { - count = count - 1; - // We are done, emit reconnect event - if(count == 0) { - return self.emit('reconnect', self); - } - }); - } - }); - - // - // Handle connection failure - state.pool.once('error', errorHandler(self, state)); - state.pool.once('close', errorHandler(self, state)); - state.pool.once('timeout', errorHandler(self, state)); - state.pool.once('parseError', errorHandler(self, state)); - - // Connect pool - state.pool.connect(); -} - -// -// Handlers -var messageHandler = function(self, state) { - return function(response, connection) { - try { - // Parse the message - response.parse({raw: state.callbacks.raw(response.responseTo), documentsReturnedIn: state.callbacks.documentsReturnedIn(response.responseTo)}); - if(state.logger.isDebug()) state.logger.debug(f('message [%s] received from %s', response.raw.toString('hex'), self.name)); - state.callbacks.emit(response.responseTo, null, response); - } catch (err) { - state.callbacks.flush(new MongoError(err)); - self.destroy(); - } - } -} - -var errorHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'error', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s errored out with %s', self.name, JSON.stringify(err))); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s received an error %s", self.name, JSON.stringify(err)))); - // Destroy all connections - self.destroy(); - // Emit error event - if(state.emitError && self.listeners('error').length > 0) self.emit('error', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - } -} - -var fatalErrorHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'error', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s errored out with %s', self.name, JSON.stringify(err))); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s received an error %s", self.name, JSON.stringify(err)))); - // Emit error event - if(self.listeners('error').length > 0) self.emit('error', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - // Destroy all connections - self.destroy(); - } -} - -var timeoutHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'timeout', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s timed out', self.name)); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s timed out", self.name))); - // Emit error event - self.emit('timeout', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - // Destroy all connections - self.destroy(); - } -} - -var closeHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'close', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s closed', self.name)); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s sockets closed", self.name))); - // Emit error event - self.emit('close', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - // Destroy all connections - self.destroy(); - } -} - -var connectHandler = function(self, state) { - // Apply all stored authentications - var applyAuthentications = function(callback) { - // We need to ensure we have re-authenticated - var keys = Object.keys(state.authProviders); - if(keys.length == 0) return callback(null, null); - - // Execute all providers - var count = keys.length; - // Iterate over keys - for(var i = 0; i < keys.length; i++) { - state.authProviders[keys[i]].reauthenticate(self, state.pool, function(err, r) { - count = count - 1; - // We are done, emit reconnect event - if(count == 0) { - return callback(null, null); - } - }); - } - } - - return function(connection) { - // Apply any applyAuthentications - applyAuthentications(function() { - - // Execute an ismaster - self.command('system.$cmd', {ismaster:true}, function(err, r) { - if(err) { - state.state = DISCONNECTED; - return self.emit('close', err, self); - } - - // Set the current ismaster - if(!err) { - state.ismaster = r.result; - } - - // Emit the ismaster - self.emit('ismaster', r.result, self); - - // Determine the wire protocol handler - state.wireProtocolHandler = createWireProtocolHandler(state.ismaster); - - // Set the wireProtocolHandler - state.options.wireProtocolHandler = state.wireProtocolHandler; - - // Log the ismaster if available - if(state.logger.isInfo()) state.logger.info(f('server %s connected with ismaster [%s]', self.name, JSON.stringify(r.result))); - - // Validate if we it's a server we can connect to - if(!supportsServer(state) && state.wireProtocolHandler == null) { - state.state = DISCONNECTED - return self.emit('error', new MongoError("non supported server version"), self); - } - - // Set the details - if(state.ismaster && state.ismaster.me) state.serverDetails.name = state.ismaster.me; - - // No read preference strategies just emit connect - if(state.readPreferenceStrategies == null) { - state.state = CONNECTED; - return self.emit('connect', self); - } - - // Signal connect to all readPreferences - notifyStrategies(self, self.s, 'connect', [self], function(err, result) { - state.state = CONNECTED; - return self.emit('connect', self); - }); - }); - }); - } -} - -var slaveOk = function(r) { - if(r) return r.slaveOk() - return false; -} - -// -// Execute readPreference Strategies -var notifyStrategies = function(self, state, op, params, callback) { - if(typeof callback != 'function') { - // Notify query start to any read Preference strategies - for(var name in state.readPreferenceStrategies) { - if(state.readPreferenceStrategies[name][op]) { - var strat = state.readPreferenceStrategies[name]; - strat[op].apply(strat, params); - } - } - // Finish up - return; - } - - // Execute the async callbacks - var nPreferences = Object.keys(state.readPreferenceStrategies).length; - if(nPreferences == 0) return callback(null, null); - for(var name in state.readPreferenceStrategies) { - if(state.readPreferenceStrategies[name][op]) { - var strat = state.readPreferenceStrategies[name]; - // Add a callback to params - var cParams = params.slice(0); - cParams.push(function(err, r) { - nPreferences = nPreferences - 1; - if(nPreferences == 0) { - callback(null, null); - } - }) - // Execute the readPreference - strat[op].apply(strat, cParams); - } - } -} - -var debugFields = ['reconnect', 'reconnectTries', 'reconnectInterval', 'emitError', 'cursorFactory', 'host' - , 'port', 'size', 'keepAlive', 'keepAliveInitialDelay', 'noDelay', 'connectionTimeout' - , 'socketTimeout', 'singleBufferSerializtion', 'ssl', 'ca', 'cert', 'key', 'rejectUnauthorized', 'promoteLongs']; - -/** - * Creates a new Server instance - * @class - * @param {boolean} [options.reconnect=true] Server will attempt to reconnect on loss of connection - * @param {number} [options.reconnectTries=30] Server attempt to reconnect #times - * @param {number} [options.reconnectInterval=1000] Server will wait # milliseconds between retries - * @param {boolean} [options.emitError=false] Server will emit errors events - * @param {Cursor} [options.cursorFactory=Cursor] The cursor factory class used for all query cursors - * @param {string} options.host The server host - * @param {number} options.port The server port - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @return {Server} A cursor instance - * @fires Server#connect - * @fires Server#close - * @fires Server#error - * @fires Server#timeout - * @fires Server#parseError - * @fires Server#reconnect - */ -var Server = function(options) { - var self = this; - - // Add event listener - EventEmitter.call(this); - - // BSON Parser, ensure we have a single instance - if(bsonInstance == null) { - bsonInstance = new BSON(bsonTypes); - } - - // Reconnect retries - var reconnectTries = options.reconnectTries || 30; - - // Keeps all the internal state of the server - this.s = { - // Options - options: options - // Contains all the callbacks - , callbacks: new Callbacks() - // Logger - , logger: Logger('Server', options) - // Server state - , state: DISCONNECTED - // Reconnect option - , reconnect: typeof options.reconnect == 'boolean' ? options.reconnect : true - , reconnectTries: reconnectTries - , reconnectInterval: options.reconnectInterval || 1000 - // Swallow or emit errors - , emitError: typeof options.emitError == 'boolean' ? options.emitError : false - // Current state - , currentReconnectRetry: reconnectTries - // Contains the ismaster - , ismaster: null - // Contains any alternate strategies for picking - , readPreferenceStrategies: options.readPreferenceStrategies - // Auth providers - , authProviders: options.authProviders || {} - // Server instance id - , id: serverId++ - // Grouping tag used for debugging purposes - , tag: options.tag - // Do we have a not connected handler - , disconnectHandler: options.disconnectHandler - // wireProtocolHandler methods - , wireProtocolHandler: options.wireProtocolHandler || new PreTwoSixWireProtocolSupport() - // Factory overrides - , Cursor: options.cursorFactory || BasicCursor - // BSON Parser, ensure we have a single instance - , bsonInstance: bsonInstance - // Pick the right bson parser - , bson: options.bson ? options.bson : bsonInstance - // Internal connection pool - , pool: null - // Server details - , serverDetails: { - host: options.host - , port: options.port - , name: options.port ? f("%s:%s", options.host, options.port) : options.host - } - } - - // Reference state - var s = this.s; - - // Add bson parser to options - options.bson = s.bson; - - // Set error properties - getProperty(this, 'name', 'name', s.serverDetails, {}); - getProperty(this, 'bson', 'bson', s.options, {}); - getProperty(this, 'wireProtocolHandler', 'wireProtocolHandler', s.options, {}); - getSingleProperty(this, 'id', s.id); - - // Add auth providers - this.addAuthProvider('mongocr', new MongoCR()); - this.addAuthProvider('x509', new X509()); - this.addAuthProvider('plain', new Plain()); - this.addAuthProvider('gssapi', new GSSAPI()); - this.addAuthProvider('sspi', new SSPI()); - this.addAuthProvider('scram-sha-1', new ScramSHA1()); -} - -inherits(Server, EventEmitter); - -/** - * Execute a command - * @method - * @param {string} type Type of BSON parser to use (c++ or js) - */ -Server.prototype.setBSONParserType = function(type) { - var nBSON = null; - - if(type == 'c++') { - nBSON = require('bson').native().BSON; - } else if(type == 'js') { - nBSON = require('bson').pure().BSON; - } else { - throw new MongoError(f("% parser not supported", type)); - } - - this.s.options.bson = new nBSON(bsonTypes); -} - -/** - * Reduce the poolSize to the provided max connections value - * @method - * @param {number} maxConnections reduce the poolsize to maxConnections - */ -Server.prototype.capConnections = function(maxConnections) { - this.s.pool.capConnections(maxConnections); -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -Server.prototype.lastIsMaster = function() { - return this.s.ismaster; -} - -/** - * Initiate server connect - * @method - */ -Server.prototype.connect = function(_options) { - var self = this; - // Set server specific settings - _options = _options || {} - // Set the promotion - if(typeof _options.promoteLongs == 'boolean') { - self.s.options.promoteLongs = _options.promoteLongs; - } - - // Destroy existing pool - if(self.s.pool) { - self.s.pool.destroy(); - self.s.pool = null; - } - - // Set the state to connection - self.s.state = CONNECTING; - // Create a new connection pool - if(!self.s.pool) { - self.s.options.messageHandler = messageHandler(self, self.s); - self.s.pool = new Pool(self.s.options); - } - - // Add all the event handlers - self.s.pool.once('timeout', timeoutHandler(self, self.s)); - self.s.pool.once('close', closeHandler(self, self.s)); - self.s.pool.once('error', errorHandler(self, self.s)); - self.s.pool.once('connect', connectHandler(self, self.s)); - self.s.pool.once('parseError', fatalErrorHandler(self, self.s)); - - // Connect the pool - self.s.pool.connect(); -} - -/** - * Destroy the server connection - * @method - */ -Server.prototype.destroy = function(emitClose, emitDestroy) { - var self = this; - if(self.s.logger.isDebug()) self.s.logger.debug(f('destroy called on server %s', self.name)); - // Emit close - if(emitClose && self.listeners('close').length > 0) self.emit('close', self); - - // Emit destroy event - if(emitDestroy) self.emit('destroy', self); - // Set state as destroyed - self.s.state = DESTROYED; - // Close the pool - self.s.pool.destroy(); - // Flush out all the callbacks - if(self.s.callbacks) self.s.callbacks.flush(new MongoError(f("server %s sockets closed", self.name))); -} - -/** - * Figure out if the server is connected - * @method - * @return {boolean} - */ -Server.prototype.isConnected = function() { - var self = this; - if(self.s.pool) return self.s.pool.isConnected(); - return false; -} - -/** - * Figure out if the server instance was destroyed by calling destroy - * @method - * @return {boolean} - */ -Server.prototype.isDestroyed = function() { - return this.s.state == DESTROYED; -} - -var executeSingleOperation = function(self, ns, cmd, queryOptions, options, onAll, callback) { - // Create a query instance - var query = new Query(self.s.bson, ns, cmd, queryOptions); - - // Set slave OK - query.slaveOk = slaveOk(options.readPreference); - - // Notify query start to any read Preference strategies - if(self.s.readPreferenceStrategies != null) - notifyStrategies(self, self.s, 'startOperation', [self, query, new Date()]); - - // Get a connection (either passed or from the pool) - var connection = options.connection || self.s.pool.get(); - - // Double check if we have a valid connection - if(!connection.isConnected()) { - return callback(new MongoError(f("no connection available to server %s", self.name))); - } - - // Print cmd and execution connection if in debug mode for logging - if(self.s.logger.isDebug()) { - var json = connection.toJSON(); - self.s.logger.debug(f('cmd [%s] about to be executed on connection with id %s at %s:%s', JSON.stringify(cmd), json.id, json.host, json.port)); - } - - // Execute multiple queries - if(onAll) { - var connections = self.s.pool.getAll(); - var total = connections.length; - // We have an error - var error = null; - // Execute on all connections - for(var i = 0; i < connections.length; i++) { - try { - query.incRequestId(); - connections[i].write(query.toBin()); - } catch(err) { - total = total - 1; - if(total == 0) return callback(MongoError.create(err)); - } - - // Register the callback - self.s.callbacks.register(query.requestId, function(err, result) { - if(err) error = err; - total = total - 1; - - // Done - if(total == 0) { - // Notify end of command - notifyStrategies(self, self.s, 'endOperation', [self, error, result, new Date()]); - if(error) return callback(MongoError.create(error)); - // Execute callback, catch and rethrow if needed - try { callback(null, new CommandResult(result.documents[0], connections)); } - catch(err) { process.nextTick(function() { throw err}); } - } - }); - } - - return; - } - - // Execute a single command query - try { - connection.write(query.toBin()); - } catch(err) { - return callback(MongoError.create(err)); - } - - // Register the callback - self.s.callbacks.register(query.requestId, function(err, result) { - // Notify end of command - notifyStrategies(self, self.s, 'endOperation', [self, err, result, new Date()]); - if(err) return callback(err); - if(result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || result.documents[0]['err'] - || result.documents[0]['code']) return callback(MongoError.create(result.documents[0])); - // Execute callback, catch and rethrow if needed - try { callback(null, new CommandResult(result.documents[0], connection)); } - catch(err) { process.nextTick(function() { throw err}); } - }); -} - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Connection} [options.connection] Specify connection object to execute command against - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.command = function(ns, cmd, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Ensure we have no options - options = options || {}; - // Do we have a read Preference it need to be of type ReadPreference - if(options.readPreference && !(options.readPreference instanceof ReadPreference)) { - throw new Error("readPreference must be an instance of ReadPreference"); - } - - // Debug log - if(self.s.logger.isDebug()) self.s.logger.debug(f('executing command [%s] against %s', JSON.stringify({ - ns: ns, cmd: cmd, options: debugOptions(debugFields, options) - }), self.name)); - - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('command', ns, cmd, options, callback); - } - - // If we have no connection error - if(!self.s.pool.isConnected()) return callback(new MongoError(f("no connection available to server %s", self.name))); - - // Execute on all connections - var onAll = typeof options.onAll == 'boolean' ? options.onAll : false; - - // Check keys - var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys: false; - - // Serialize function - var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - - // Ignore undefined values - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - - // Query options - var queryOptions = { - numberToSkip: 0, numberToReturn: -1, checkKeys: checkKeys - }; - - // Set up the serialize functions and ignore undefined - if(serializeFunctions) queryOptions.serializeFunctions = serializeFunctions; - if(ignoreUndefined) queryOptions.ignoreUndefined = ignoreUndefined; - - // Single operation execution - if(!Array.isArray(cmd)) { - return executeSingleOperation(self, ns, cmd, queryOptions, options, onAll, callback); - } - - // Build commands for each of the instances - var queries = new Array(cmd.length); - for(var i = 0; i < cmd.length; i++) { - queries[i] = new Query(self.s.bson, ns, cmd[i], queryOptions); - queries[i].slaveOk = slaveOk(options.readPreference); - } - - // Notify query start to any read Preference strategies - if(self.s.readPreferenceStrategies != null) - notifyStrategies(self, self.s, 'startOperation', [self, queries, new Date()]); - - // Get a connection (either passed or from the pool) - var connection = options.connection || self.s.pool.get(); - - // Double check if we have a valid connection - if(!connection.isConnected()) { - return callback(new MongoError(f("no connection available to server %s", self.name))); - } - - // Print cmd and execution connection if in debug mode for logging - if(self.s.logger.isDebug()) { - var json = connection.toJSON(); - self.s.logger.debug(f('cmd [%s] about to be executed on connection with id %s at %s:%s', JSON.stringify(queries), json.id, json.host, json.port)); - } - - // Canceled operations - var canceled = false; - // Number of operations left - var operationsLeft = queries.length; - // Results - var results = []; - - // We need to nest the callbacks - for(var i = 0; i < queries.length; i++) { - // Get the query object - var query = queries[i]; - - // Execute a single command query - try { - connection.write(query.toBin()); - } catch(err) { - return callback(MongoError.create(err)); - } - - // Register the callback - self.s.callbacks.register(query.requestId, function(err, result) { - // If it's canceled ignore the operation - if(canceled) return; - // Update the current index - operationsLeft = operationsLeft - 1; - - // If we have an error cancel the operation - if(err) { - canceled = true; - return callback(err); - } - - // Return the result - if(result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || result.documents[0]['err'] - || result.documents[0]['code']) { - - // Set to canceled - canceled = true; - // Return the error - return callback(MongoError.create(result.documents[0])); - } - - // Push results - results.push(result.documents[0]); - - // We are done, return the result - if(operationsLeft == 0) { - // Notify end of command - notifyStrategies(self, self.s, 'endOperation', [self, err, result, new Date()]); - - // Turn into command results - var commandResults = new Array(results.length); - for(var i = 0; i < results.length; i++) { - commandResults[i] = new CommandResult(results[i], connection); - } - - // Execute callback, catch and rethrow if needed - try { callback(null, commandResults); } - catch(err) { process.nextTick(function() { throw err}); } - } - }); - } -} - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.insert = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('insert', ns, ops, options, callback); - } - - // Setup the docs as an array - ops = Array.isArray(ops) ? ops : [ops]; - // Execute write - return self.s.wireProtocolHandler.insert(self, self.s.ismaster, ns, self.s.bson, self.s.pool, self.s.callbacks, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.update = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('update', ns, ops, options, callback); - } - - // Setup the docs as an array - ops = Array.isArray(ops) ? ops : [ops]; - - // Execute write - return self.s.wireProtocolHandler.update(self, self.s.ismaster, ns, self.s.bson, self.s.pool, self.s.callbacks, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.remove = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('remove', ns, ops, options, callback); - } - - // Setup the docs as an array - ops = Array.isArray(ops) ? ops : [ops]; - // Execute write - return self.s.wireProtocolHandler.remove(self, self.s.ismaster, ns, self.s.bson, self.s.pool, self.s.callbacks, ops, options, callback); -} - -/** - * Authenticate using a specified mechanism - * @method - * @param {string} mechanism The Auth mechanism we are invoking - * @param {string} db The db we are invoking the mechanism against - * @param {...object} param Parameters for the specific mechanism - * @param {authResultCallback} callback A callback function - */ -Server.prototype.auth = function(mechanism, db) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - var callback = args.pop(); - - // If we don't have the mechanism fail - if(self.s.authProviders[mechanism] == null && mechanism != 'default') - throw new MongoError(f("auth provider %s does not exist", mechanism)); - - // If we have the default mechanism we pick mechanism based on the wire - // protocol max version. If it's >= 3 then scram-sha1 otherwise mongodb-cr - if(mechanism == 'default' && self.s.ismaster && self.s.ismaster.maxWireVersion >= 3) { - mechanism = 'scram-sha-1'; - } else if(mechanism == 'default') { - mechanism = 'mongocr'; - } - - // Actual arguments - var finalArguments = [self, self.s.pool, db].concat(args.slice(0)).concat([function(err, r) { - if(err) return callback(err); - if(!r) return callback(new MongoError('could not authenticate')); - callback(null, new Session({}, self)); - }]); - - // Let's invoke the auth mechanism - self.s.authProviders[mechanism].auth.apply(self.s.authProviders[mechanism], finalArguments); -} - -// -// Plugin methods -// - -/** - * Add custom read preference strategy - * @method - * @param {string} name Name of the read preference strategy - * @param {object} strategy Strategy object instance - */ -Server.prototype.addReadPreferenceStrategy = function(name, strategy) { - var self = this; - if(self.s.readPreferenceStrategies == null) self.s.readPreferenceStrategies = {}; - self.s.readPreferenceStrategies[name] = strategy; -} - -/** - * Add custom authentication mechanism - * @method - * @param {string} name Name of the authentication mechanism - * @param {object} provider Authentication object instance - */ -Server.prototype.addAuthProvider = function(name, provider) { - var self = this; - self.s.authProviders[name] = provider; -} - -/** - * Compare two server instances - * @method - * @param {Server} server Server to compare equality against - * @return {boolean} - */ -Server.prototype.equals = function(server) { - if(typeof server == 'string') return server == this.name; - return server.name == this.name; -} - -/** - * All raw connections - * @method - * @return {Connection[]} - */ -Server.prototype.connections = function() { - return this.s.pool.getAll(); -} - -/** - * Get server - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Server} - */ -Server.prototype.getServer = function(options) { - return this; -} - -/** - * Get connection - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Connection} - */ -Server.prototype.getConnection = function(options) { - return this.s.pool.get(); -} - -/** - * Get callbacks object - * @method - * @return {Callbacks} - */ -Server.prototype.getCallbacks = function() { - return this.s.callbacks; -} - -/** - * Name of BSON parser currently used - * @method - * @return {string} - */ -Server.prototype.parserType = function() { - var s = this.s; - if(s.options.bson.serialize.toString().indexOf('[native code]') != -1) - return 'c++'; - return 'js'; -} - -// // Command -// { -// find: ns -// , query: -// , limit: -// , fields: -// , skip: -// , hint: -// , explain: -// , snapshot: -// , batchSize: -// , returnKey: -// , maxScan: -// , min: -// , max: -// , showDiskLoc: -// , comment: -// , maxTimeMS: -// , raw: -// , readPreference: -// , tailable: -// , oplogReplay: -// , noCursorTimeout: -// , awaitdata: -// , exhaust: -// , partial: -// } - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.cursor = function(ns, cmd, cursorOptions) { - var s = this.s; - cursorOptions = cursorOptions || {}; - // Set up final cursor type - var FinalCursor = cursorOptions.cursorFactory || s.Cursor; - // Return the cursor - return new FinalCursor(s.bson, ns, cmd, cursorOptions, this, s.options); -} - -/** - * A server connect event, used to verify that the connection is up and running - * - * @event Server#connect - * @type {Server} - */ - -/** - * The server connection closed, all pool connections closed - * - * @event Server#close - * @type {Server} - */ - -/** - * The server connection caused an error, all pool connections closed - * - * @event Server#error - * @type {Server} - */ - -/** - * The server connection timed out, all pool connections closed - * - * @event Server#timeout - * @type {Server} - */ - -/** - * The driver experienced an invalid message, all pool connections closed - * - * @event Server#parseError - * @type {Server} - */ - -/** - * The server reestablished the connection - * - * @event Server#reconnect - * @type {Server} - */ - -/** - * This is an insert result callback - * - * @callback opResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {CommandResult} command result - */ - -/** - * This is an authentication result callback - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {Session} an authenticated session - */ - -module.exports = Server; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js deleted file mode 100644 index 032c3c5e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , EventEmitter = require('events').EventEmitter; - -/** - * Creates a new Authentication Session - * @class - * @param {object} [options] Options for the session - * @param {{Server}|{ReplSet}|{Mongos}} topology The topology instance underpinning the session - */ -var Session = function(options, topology) { - this.options = options; - this.topology = topology; - - // Add event listener - EventEmitter.call(this); -} - -inherits(Session, EventEmitter); - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {object} [options.readPreference] Specify read preference if command supports it - * @param {object} [options.connection] Specify connection object to execute command against - * @param {opResultCallback} callback A callback function - */ -Session.prototype.command = function(ns, cmd, options, callback) { - this.topology.command(ns, cmd, options, callback); -} - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {opResultCallback} callback A callback function - */ -Session.prototype.insert = function(ns, ops, options, callback) { - this.topology.insert(ns, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {opResultCallback} callback A callback function - */ -Session.prototype.update = function(ns, ops, options, callback) { - this.topology.update(ns, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {opResultCallback} callback A callback function - */ -Session.prototype.remove = function(ns, ops, options, callback) { - this.topology.remove(ns, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {boolean} [options.tailable=false] Tailable flag set - * @param {boolean} [options.oplogReply=false] oplogReply flag set - * @param {boolean} [options.awaitdata=false] awaitdata flag set - * @param {boolean} [options.exhaust=false] exhaust flag set - * @param {boolean} [options.partial=false] partial flag set - * @param {opResultCallback} callback A callback function - */ -Session.prototype.cursor = function(ns, cmd, options) { - return this.topology.cursor(ns, cmd, options); -} - -module.exports = Session; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js deleted file mode 100644 index 3a7b460c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; - -var Logger = require('../../connection/logger') - , EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , f = require('util').format; - -/** - * Creates a new Ping read preference strategy instance - * @class - * @param {number} [options.pingInterval=5000] Ping interval to check the response time to the different servers - * @param {number} [options.acceptableLatency=250] Acceptable latency for selecting a server for reading (in milliseconds) - * @return {Ping} A cursor instance - */ -var Ping = function(options) { - // Add event listener - EventEmitter.call(this); - - // Contains the ping state - this.s = { - // Contains all the ping data - pings: {} - // Set no options if none provided - , options: options || {} - // Logger - , logger: Logger('Ping', options) - // Ping interval - , pingInterval: options.pingInterval || 10000 - , acceptableLatency: options.acceptableLatency || 15 - // Debug options - , debug: typeof options.debug == 'boolean' ? options.debug : false - // Index - , index: 0 - // Current ping time - , lastPing: null - - } - - // Log the options set - if(this.s.logger.isDebug()) this.s.logger.debug(f('ping strategy interval [%s], acceptableLatency [%s]', this.s.pingInterval, this.s.acceptableLatency)); - - // If we have enabled debug - if(this.s.debug) { - // Add access to the read Preference Strategies - Object.defineProperty(this, 'data', { - enumerable: true, get: function() { return this.s.pings; } - }); - } -} - -inherits(Ping, EventEmitter); - -/** - * @ignore - */ -var filterByTags = function(readPreference, servers) { - if(readPreference.tags == null) return servers; - var filteredServers = []; - var tags = readPreference.tags; - - // Iterate over all the servers - for(var i = 0; i < servers.length; i++) { - var serverTag = servers[i].lastIsMaster().tags || {}; - // Did we find the a matching server - var found = true; - // Check if the server is valid - for(var name in tags) { - if(serverTag[name] != tags[name]) found = false; - } - - // Add to candidate list - if(found) filteredServers.push(servers[i]); - } - - // Returned filtered servers - return filteredServers; -} - -/** - * Pick a server - * @method - * @param {State} set The current replicaset state object - * @param {ReadPreference} readPreference The current readPreference object - * @param {readPreferenceResultCallback} callback The callback to return the result from the function - * @return {object} - */ -Ping.prototype.pickServer = function(set, readPreference) { - var self = this; - // Only get primary and secondaries as seeds - var seeds = {}; - var servers = []; - if(set.primary) { - servers.push(set.primary); - } - - for(var i = 0; i < set.secondaries.length; i++) { - servers.push(set.secondaries[i]); - } - - // Filter by tags - servers = filterByTags(readPreference, servers); - - // Transform the list - var serverList = []; - // for(var name in seeds) { - for(var i = 0; i < servers.length; i++) { - serverList.push({name: servers[i].name, time: self.s.pings[servers[i].name] || 0}); - } - - // Sort by time - serverList.sort(function(a, b) { - return a.time > b.time; - }); - - // Locate lowest time (picked servers are lowest time + acceptable Latency margin) - var lowest = serverList.length > 0 ? serverList[0].time : 0; - - // Filter by latency - serverList = serverList.filter(function(s) { - return s.time <= lowest + self.s.acceptableLatency; - }); - - // No servers, default to primary - if(serverList.length == 0 && set.primary) { - if(self.s.logger.isInfo()) self.s.logger.info(f('picked primary server [%s]', set.primary.name)); - return set.primary; - } else if(serverList.length == 0) { - return null - } - - // We picked first server - if(self.s.logger.isInfo()) self.s.logger.info(f('picked server [%s] with ping latency [%s]', serverList[0].name, serverList[0].time)); - - // Add to the index - self.s.index = self.s.index + 1; - // Select the index - self.s.index = self.s.index % serverList.length; - // Return the first server of the sorted and filtered list - return set.get(serverList[self.s.index].name); -} - -/** - * Start of an operation - * @method - * @param {Server} server The server the operation is running against - * @param {object} query The operation running - * @param {Date} date The start time of the operation - * @return {object} - */ -Ping.prototype.startOperation = function(server, query, date) { -} - -/** - * End of an operation - * @method - * @param {Server} server The server the operation is running against - * @param {error} err An error from the operation - * @param {object} result The result from the operation - * @param {Date} date The start time of the operation - * @return {object} - */ -Ping.prototype.endOperation = function(server, err, result, date) { -} - -/** - * High availability process running - * @method - * @param {State} set The current replicaset state object - * @param {resultCallback} callback The callback to return the result from the function - * @return {object} - */ -Ping.prototype.ha = function(topology, state, callback) { - var self = this; - var servers = state.getAll(); - var count = servers.length; - - // No servers return - if(servers.length == 0) return callback(null, null); - - // Return if we have not yet reached the ping interval - if(self.s.lastPing != null) { - var diff = new Date().getTime() - self.s.lastPing.getTime(); - if(diff < self.s.pingInterval) return callback(null, null); - } - - // Execute operation - var operation = function(_server) { - var start = new Date(); - // Execute ping against server - _server.command('system.$cmd', {ismaster:1}, function(err, r) { - count = count - 1; - var time = new Date().getTime() - start.getTime(); - self.s.pings[_server.name] = time; - // Log info for debug - if(self.s.logger.isDebug()) self.s.logger.debug(f('ha latency for server [%s] is [%s] ms', _server.name, time)); - // We are done with all the servers - if(count == 0) { - // Emit ping event - topology.emit('ping', err, r ? r.result : null); - // Update the last ping time - self.s.lastPing = new Date(); - // Return - callback(null, null); - } - }); - } - - // Let's ping all servers - while(servers.length > 0) { - operation(servers.shift()); - } -} - -var removeServer = function(self, server) { - delete self.s.pings[server.name]; -} - -/** - * Server connection closed - * @method - * @param {Server} server The server that closed - */ -Ping.prototype.close = function(server) { - removeServer(this, server); -} - -/** - * Server connection errored out - * @method - * @param {Server} server The server that errored out - */ -Ping.prototype.error = function(server) { - removeServer(this, server); -} - -/** - * Server connection timeout - * @method - * @param {Server} server The server that timed out - */ -Ping.prototype.timeout = function(server) { - removeServer(this, server); -} - -/** - * Server connection happened - * @method - * @param {Server} server The server that connected - * @param {resultCallback} callback The callback to return the result from the function - */ -Ping.prototype.connect = function(server, callback) { - var self = this; - // Get the command start date - var start = new Date(); - // Execute ping against server - server.command('system.$cmd', {ismaster:1}, function(err, r) { - var time = new Date().getTime() - start.getTime(); - self.s.pings[server.name] = time; - // Log info for debug - if(self.s.logger.isDebug()) self.s.logger.debug(f('connect latency for server [%s] is [%s] ms', server.name, time)); - // Set last ping - self.s.lastPing = new Date(); - // Done, return - callback(null, null); - }); -} - -/** - * This is a result from a readPreference strategy - * - * @callback readPreferenceResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {Server} server The server picked by the strategy - */ - -module.exports = Ping; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js deleted file mode 100644 index bce88d27..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js +++ /dev/null @@ -1,581 +0,0 @@ -"use strict"; - -var Insert = require('./commands').Insert - , Update = require('./commands').Update - , Remove = require('./commands').Remove - , Query = require('../connection/commands').Query - , copy = require('../connection/utils').copy - , KillCursor = require('../connection/commands').KillCursor - , GetMore = require('../connection/commands').GetMore - , Query = require('../connection/commands').Query - , ReadPreference = require('../topologies/read_preference') - , f = require('util').format - , CommandResult = require('../topologies/command_result') - , MongoError = require('../error') - , Long = require('bson').Long; - -// Write concern fields -var writeConcernFields = ['w', 'wtimeout', 'j', 'fsync']; - -var WireProtocol = function() {} - -// -// Needs to support legacy mass insert as well as ordered/unordered legacy -// emulation -// -WireProtocol.prototype.insert = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - options = options || {}; - // Default is ordered execution - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - var legacy = typeof options.legacy == 'boolean' ? options.legacy : false; - ops = Array.isArray(ops) ? ops :[ops]; - - // If we have more than a 1000 ops fails - if(ops.length > 1000) return callback(new MongoError("exceeded maximum write batch size of 1000")); - - // Write concern - var writeConcern = options.writeConcern || {w:1}; - - // We are unordered - if(!ordered || writeConcern.w == 0) { - return executeUnordered('insert', Insert, ismaster, ns, bson, pool, callbacks, ops, options, callback); - } - - return executeOrdered('insert', Insert, ismaster, ns, bson, pool, callbacks, ops, options, callback); -} - -WireProtocol.prototype.update = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - options = options || {}; - // Default is ordered execution - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - ops = Array.isArray(ops) ? ops :[ops]; - - // Write concern - var writeConcern = options.writeConcern || {w:1}; - - // We are unordered - if(!ordered || writeConcern.w == 0) { - return executeUnordered('update', Update, ismaster, ns, bson, pool, callbacks, ops, options, callback); - } - - return executeOrdered('update', Update, ismaster, ns, bson, pool, callbacks, ops, options, callback); -} - -WireProtocol.prototype.remove = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - options = options || {}; - // Default is ordered execution - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - ops = Array.isArray(ops) ? ops :[ops]; - - // Write concern - var writeConcern = options.writeConcern || {w:1}; - - // We are unordered - if(!ordered || writeConcern.w == 0) { - return executeUnordered('remove', Remove, ismaster, ns, bson, pool, callbacks, ops, options, callback); - } - - return executeOrdered('remove', Remove, ismaster, ns, bson, pool, callbacks, ops, options, callback); -} - -WireProtocol.prototype.killCursor = function(bson, ns, cursorId, connection, callbacks, callback) { - // Create a kill cursor command - var killCursor = new KillCursor(bson, [cursorId]); - // Execute the kill cursor command - if(connection && connection.isConnected()) connection.write(killCursor.toBin()); - // Set cursor to 0 - cursorId = Long.ZERO; - // Return to caller - if(callback) callback(null, null); -} - -WireProtocol.prototype.getMore = function(bson, ns, cursorState, batchSize, raw, connection, callbacks, options, callback) { - // Create getMore command - var getMore = new GetMore(bson, ns, cursorState.cursorId, {numberToReturn: batchSize}); - - // Query callback - var queryCallback = function(err, r) { - if(err) return callback(err); - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - return callback(new MongoError("cursor killed or timed out"), null); - } - - // Ensure we have a Long valie cursor id - var cursorId = typeof r.cursorId == 'number' - ? Long.fromNumber(r.cursorId) - : r.cursorId; - - // Set all the values - cursorState.documents = r.documents; - cursorState.cursorId = cursorId; - - // Return - callback(null); - } - - // If we have a raw query decorate the function - if(raw) { - queryCallback.raw = raw; - } - - // Register a callback - callbacks.register(getMore.requestId, queryCallback); - // Write out the getMore command - connection.write(getMore.toBin()); -} - -WireProtocol.prototype.command = function(bson, ns, cmd, cursorState, topology, options) { - // Establish type of command - if(cmd.find) { - return setupClassicFind(bson, ns, cmd, cursorState, topology, options) - } else if(cursorState.cursorId != null) { - } else if(cmd) { - return setupCommand(bson, ns, cmd, cursorState, topology, options); - } else { - throw new MongoError(f("command %s does not return a cursor", JSON.stringify(cmd))); - } -} - -// -// Execute a find command -var setupClassicFind = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Ensure we have at least some options - options = options || {}; - // Set the optional batchSize - cursorState.batchSize = cmd.batchSize || cursorState.batchSize; - var numberToReturn = 0; - - // Unpack the limit and batchSize values - if(cursorState.limit == 0) { - numberToReturn = cursorState.batchSize; - } else if(cursorState.limit < 0 || cursorState.limit < cursorState.batchSize || (cursorState.limit > 0 && cursorState.batchSize == 0)) { - numberToReturn = cursorState.limit; - } else { - numberToReturn = cursorState.batchSize; - } - - var numberToSkip = cursorState.skip || 0; - // Build actual find command - var findCmd = {}; - // Using special modifier - var usesSpecialModifier = false; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' && readPreference) { - findCmd['$readPreference'] = readPreference.toJSON(); - usesSpecialModifier = true; - } - - // Add special modifiers to the query - if(cmd.sort) findCmd['orderby'] = cmd.sort, usesSpecialModifier = true; - if(cmd.hint) findCmd['$hint'] = cmd.hint, usesSpecialModifier = true; - if(cmd.snapshot) findCmd['$snapshot'] = cmd.snapshot, usesSpecialModifier = true; - if(cmd.returnKey) findCmd['$returnKey'] = cmd.returnKey, usesSpecialModifier = true; - if(cmd.maxScan) findCmd['$maxScan'] = cmd.maxScan, usesSpecialModifier = true; - if(cmd.min) findCmd['$min'] = cmd.min, usesSpecialModifier = true; - if(cmd.max) findCmd['$max'] = cmd.max, usesSpecialModifier = true; - if(cmd.showDiskLoc) findCmd['$showDiskLoc'] = cmd.showDiskLoc, usesSpecialModifier = true; - if(cmd.comment) findCmd['$comment'] = cmd.comment, usesSpecialModifier = true; - if(cmd.maxTimeMS) findCmd['$maxTimeMS'] = cmd.maxTimeMS, usesSpecialModifier = true; - - // If we have explain, return a single document and close cursor - if(cmd.explain) { - numberToReturn = -1; - usesSpecialModifier = true; - findCmd['$explain'] = true; - } - - // If we have a special modifier - if(usesSpecialModifier) { - findCmd['$query'] = cmd.query; - } else { - findCmd = cmd.query; - } - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server find command does not support a readConcern level of %s', cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) { - cmd = copy(cmd); - delete cmd['readConcern']; - } - - // Set up the serialize and ignoreUndefined fields - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Build Query object - var query = new Query(bson, ns, findCmd, { - numberToSkip: numberToSkip, numberToReturn: numberToReturn - , checkKeys: false, returnFieldSelector: cmd.fields - , serializeFunctions: serializeFunctions, ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Set up the option bits for wire protocol - if(typeof cmd.tailable == 'boolean') query.tailable = cmd.tailable; - if(typeof cmd.oplogReplay == 'boolean') query.oplogReplay = cmd.oplogReplay; - if(typeof cmd.noCursorTimeout == 'boolean') query.noCursorTimeout = cmd.noCursorTimeout; - if(typeof cmd.awaitData == 'boolean') query.awaitData = cmd.awaitData; - if(typeof cmd.exhaust == 'boolean') query.exhaust = cmd.exhaust; - if(typeof cmd.partial == 'boolean') query.partial = cmd.partial; - // Return the query - return query; -} - -// -// Set up a command cursor -var setupCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Set empty options object - options = options || {} - - // Final query - var finalCmd = {}; - for(var name in cmd) { - finalCmd[name] = cmd[name]; - } - - // Build command namespace - var parts = ns.split(/\./); - - // // We have a Mongos topology, check if we need to add a readPreference - // if(topology.type == 'mongos' && readPreference) { - // finalCmd['$readPreference'] = readPreference.toJSON(); - // } - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server %s command does not support a readConcern level of %s', JSON.stringify(cmd), cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) delete cmd['readConcern']; - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - - // Set up the serialize and ignoreUndefined fields - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' - && readPreference - && readPreference.preference != 'primary') { - finalCmd = { - '$query': finalCmd, - '$readPreference': readPreference.toJSON() - }; - } - - // Build Query object - var query = new Query(bson, f('%s.$cmd', parts.shift()), finalCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) { - return callback; - } else { - return domain.bind(callback); - } -} - -var hasWriteConcern = function(writeConcern) { - if(writeConcern.w - || writeConcern.wtimeout - || writeConcern.j == true - || writeConcern.fsync == true - || Object.keys(writeConcern).length == 0) { - return true; - } - return false; -} - -var cloneWriteConcern = function(writeConcern) { - var wc = {}; - if(writeConcern.w != null) wc.w = writeConcern.w; - if(writeConcern.wtimeout != null) wc.wtimeout = writeConcern.wtimeout; - if(writeConcern.j != null) wc.j = writeConcern.j; - if(writeConcern.fsync != null) wc.fsync = writeConcern.fsync; - return wc; -} - -// -// Aggregate up all the results -// -var aggregateWriteOperationResults = function(opType, ops, results, connection) { - var finalResult = { ok: 1, n: 0 } - - // Map all the results coming back - for(var i = 0; i < results.length; i++) { - var result = results[i]; - var op = ops[i]; - - if((result.upserted || (result.updatedExisting == false)) && finalResult.upserted == null) { - finalResult.upserted = []; - } - - // Push the upserted document to the list of upserted values - if(result.upserted) { - finalResult.upserted.push({index: i, _id: result.upserted}); - } - - // We have an upsert where we passed in a _id - if(result.updatedExisting == false && result.n == 1 && result.upserted == null) { - finalResult.upserted.push({index: i, _id: op.q._id}); - } - - // We have an insert command - if(result.ok == 1 && opType == 'insert' && result.err == null) { - finalResult.n = finalResult.n + 1; - } - - // We have a command error - if(result != null && result.ok == 0 || result.err || result.errmsg) { - if(result.ok == 0) finalResult.ok = 0; - finalResult.code = result.code; - finalResult.errmsg = result.errmsg || result.err || result.errMsg; - - // Check if we have a write error - if(result.code == 11000 - || result.code == 11001 - || result.code == 12582 - || result.code == 16544 - || result.code == 16538 - || result.code == 16542 - || result.code == 14 - || result.code == 13511) { - if(finalResult.writeErrors == null) finalResult.writeErrors = []; - finalResult.writeErrors.push({ - index: i - , code: result.code - , errmsg: result.errmsg || result.err || result.errMsg - }); - } else { - finalResult.writeConcernError = { - code: result.code - , errmsg: result.errmsg || result.err || result.errMsg - } - } - } else if(typeof result.n == 'number') { - finalResult.n += result.n; - } else { - finalResult.n += 1; - } - - // Result as expected - if(result != null && result.lastOp) finalResult.lastOp = result.lastOp; - } - - // Return finalResult aggregated results - return new CommandResult(finalResult, connection); -} - -// -// Execute all inserts in an ordered manner -// -var executeOrdered = function(opType ,command, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - var _ops = ops.slice(0); - // Bind to current domain - callback = bindToCurrentDomain(callback); - // Collect all the getLastErrors - var getLastErrors = []; - - // Execute an operation - var executeOp = function(list, _callback) { - // Get a pool connection - var connection = pool.get(); - // No more items in the list - if(list.length == 0) { - return process.nextTick(function() { - _callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - }); - } - - // Get the first operation - var doc = list.shift(); - - // Create an insert command - var op = new command(Query.getRequestId(), ismaster, bson, ns, [doc], options); - // Write concern - var optionWriteConcern = options.writeConcern || {w:1}; - // Final write concern - var writeConcern = cloneWriteConcern(optionWriteConcern); - - // Get the db name - var db = ns.split('.').shift(); - - // Error out if no connection available - if(connection == null) - return _callback(new MongoError("no connection available")); - - try { - // Execute the insert - connection.write(op.toBin()); - - // If write concern 0 don't fire getLastError - if(hasWriteConcern(writeConcern)) { - var getLastErrorCmd = {getlasterror: 1}; - // Merge all the fields - for(var i = 0; i < writeConcernFields.length; i++) { - if(writeConcern[writeConcernFields[i]] != null) - getLastErrorCmd[writeConcernFields[i]] = writeConcern[writeConcernFields[i]]; - } - - // Create a getLastError command - var getLastErrorOp = new Query(bson, f("%s.$cmd", db), getLastErrorCmd, {numberToReturn: -1}); - // Write the lastError message - connection.write(getLastErrorOp.toBin()); - // Register the callback - callbacks.register(getLastErrorOp.requestId, function(err, result) { - if(err) return callback(err); - // Get the document - var doc = result.documents[0]; - // Save the getLastError document - getLastErrors.push(doc); - // If we have an error terminate - if(doc.ok == 0 || doc.err || doc.errmsg) return callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - // Execute the next op in the list - executeOp(list, callback); - }); - } - } catch(err) { - if(typeof err == 'string') err = new MongoError(err); - // We have a serialization error, rewrite as a write error to have same behavior as modern - // write commands - getLastErrors.push({ ok: 1, errmsg: err.message, code: 14 }); - // Return due to an error - process.nextTick(function() { - callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - }); - } - } - - // Execute the operations - executeOp(_ops, callback); -} - -var executeUnordered = function(opType, command, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - // Bind to current domain - callback = bindToCurrentDomain(callback); - // Total operations to write - var totalOps = ops.length; - // Collect all the getLastErrors - var getLastErrors = []; - // Write concern - var optionWriteConcern = options.writeConcern || {w:1}; - // Final write concern - var writeConcern = cloneWriteConcern(optionWriteConcern); - // Driver level error - var error; - - // Execute all the operations - for(var i = 0; i < ops.length; i++) { - // Create an insert command - var op = new command(Query.getRequestId(), ismaster, bson, ns, [ops[i]], options); - // Get db name - var db = ns.split('.').shift(); - - // Get a pool connection - var connection = pool.get(); - - // Error out if no connection available - if(connection == null) { - return process.nextTick(function() { - _callback(new MongoError("no connection available")); - }); - } - - try { - // Execute the insert - connection.write(op.toBin()); - - // If write concern 0 don't fire getLastError - if(hasWriteConcern(writeConcern)) { - var getLastErrorCmd = {getlasterror: 1}; - // Merge all the fields - for(var j = 0; j < writeConcernFields.length; j++) { - if(writeConcern[writeConcernFields[j]] != null) - getLastErrorCmd[writeConcernFields[j]] = writeConcern[writeConcernFields[j]]; - } - - // Create a getLastError command - var getLastErrorOp = new Query(bson, f("%s.$cmd", db), getLastErrorCmd, {numberToReturn: -1}); - // Write the lastError message - connection.write(getLastErrorOp.toBin()); - - // Give the result from getLastError the right index - var callbackOp = function(_index) { - return function(err, result) { - if(err) error = err; - // Update the number of operations executed - totalOps = totalOps - 1; - // Save the getLastError document - if(!err) getLastErrors[_index] = result.documents[0]; - // Check if we are done - if(totalOps == 0) { - process.nextTick(function() { - if(error) return callback(error); - callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - }); - } - } - } - - // Register the callback - callbacks.register(getLastErrorOp.requestId, callbackOp(i)); - } - } catch(err) { - if(typeof err == 'string') err = new MongoError(err); - // Update the number of operations executed - totalOps = totalOps - 1; - // We have a serialization error, rewrite as a write error to have same behavior as modern - // write commands - getLastErrors[i] = { ok: 1, errmsg: err.message, code: 14 }; - // Check if we are done - if(totalOps == 0) { - callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - } - } - } - - // Empty w:0 return - if(writeConcern - && writeConcern.w == 0 && callback) { - callback(null, null); - } -} - -module.exports = WireProtocol; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js deleted file mode 100644 index b3608cb2..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js +++ /dev/null @@ -1,317 +0,0 @@ -"use strict"; - -var Insert = require('./commands').Insert - , Update = require('./commands').Update - , Remove = require('./commands').Remove - , Query = require('../connection/commands').Query - , copy = require('../connection/utils').copy - , KillCursor = require('../connection/commands').KillCursor - , GetMore = require('../connection/commands').GetMore - , Query = require('../connection/commands').Query - , ReadPreference = require('../topologies/read_preference') - , f = require('util').format - , CommandResult = require('../topologies/command_result') - , MongoError = require('../error') - , Long = require('bson').Long; - -var WireProtocol = function() {} - -// -// Execute a write operation -var executeWrite = function(topology, type, opsField, ns, ops, options, callback) { - if(ops.length == 0) throw new MongoError("insert must contain at least one document"); - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // Split the ns up to get db and collection - var p = ns.split("."); - var d = p.shift(); - // Options - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - var writeConcern = options.writeConcern || {}; - // return skeleton - var writeCommand = {}; - writeCommand[type] = p.join('.'); - writeCommand[opsField] = ops; - writeCommand.ordered = ordered; - - // Did we specify a write concern - if(writeConcern && Object.keys(writeConcern).length > 0) { - writeCommand.writeConcern = writeConcern; - } - - // Options object - var opts = {}; - if(type == 'insert') opts.checkKeys = true; - // Ensure we support serialization of functions - if(options.serializeFunctions) opts.serializeFunctions = options.serializeFunctions; - if(options.ignoreUndefined) opts.ignoreUndefined = options.ignoreUndefined; - // Execute command - topology.command(f("%s.$cmd", d), writeCommand, opts, callback); -} - -// -// Needs to support legacy mass insert as well as ordered/unordered legacy -// emulation -// -WireProtocol.prototype.insert = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'insert', 'documents', ns, ops, options, callback); -} - -WireProtocol.prototype.update = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'update', 'updates', ns, ops, options, callback); -} - -WireProtocol.prototype.remove = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'delete', 'deletes', ns, ops, options, callback); -} - -WireProtocol.prototype.killCursor = function(bson, ns, cursorId, connection, callbacks, callback) { - // Create a kill cursor command - var killCursor = new KillCursor(bson, [cursorId]); - // Execute the kill cursor command - if(connection && connection.isConnected()) connection.write(killCursor.toBin()); - // Set cursor to 0 - cursorId = Long.ZERO; - // Return to caller - if(callback) callback(null, null); -} - -WireProtocol.prototype.getMore = function(bson, ns, cursorState, batchSize, raw, connection, callbacks, options, callback) { - // Create getMore command - var getMore = new GetMore(bson, ns, cursorState.cursorId, {numberToReturn: batchSize}); - - // Query callback - var queryCallback = function(err, r) { - if(err) return callback(err); - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - return callback(new MongoError("cursor killed or timed out"), null); - } - - // Ensure we have a Long valie cursor id - var cursorId = typeof r.cursorId == 'number' - ? Long.fromNumber(r.cursorId) - : r.cursorId; - - // Set all the values - cursorState.documents = r.documents; - cursorState.cursorId = cursorId; - - // Return - callback(null); - } - - // If we have a raw query decorate the function - if(raw) { - queryCallback.raw = raw; - } - - // Register a callback - callbacks.register(getMore.requestId, queryCallback); - // Write out the getMore command - connection.write(getMore.toBin()); -} - -WireProtocol.prototype.command = function(bson, ns, cmd, cursorState, topology, options) { - // Establish type of command - if(cmd.find) { - return setupClassicFind(bson, ns, cmd, cursorState, topology, options) - } else if(cursorState.cursorId != null) { - } else if(cmd) { - return setupCommand(bson, ns, cmd, cursorState, topology, options); - } else { - throw new MongoError(f("command %s does not return a cursor", JSON.stringify(cmd))); - } -} - -// -// Execute a find command -var setupClassicFind = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Ensure we have at least some options - options = options || {}; - // Set the optional batchSize - cursorState.batchSize = cmd.batchSize || cursorState.batchSize; - var numberToReturn = 0; - - // Unpack the limit and batchSize values - if(cursorState.limit == 0) { - numberToReturn = cursorState.batchSize; - } else if(cursorState.limit < 0 || cursorState.limit < cursorState.batchSize || (cursorState.limit > 0 && cursorState.batchSize == 0)) { - numberToReturn = cursorState.limit; - } else { - numberToReturn = cursorState.batchSize; - } - - var numberToSkip = cursorState.skip || 0; - // Build actual find command - var findCmd = {}; - // Using special modifier - var usesSpecialModifier = false; - - // Add special modifiers to the query - if(cmd.sort) findCmd['orderby'] = cmd.sort, usesSpecialModifier = true; - if(cmd.hint) findCmd['$hint'] = cmd.hint, usesSpecialModifier = true; - if(cmd.snapshot) findCmd['$snapshot'] = cmd.snapshot, usesSpecialModifier = true; - if(cmd.returnKey) findCmd['$returnKey'] = cmd.returnKey, usesSpecialModifier = true; - if(cmd.maxScan) findCmd['$maxScan'] = cmd.maxScan, usesSpecialModifier = true; - if(cmd.min) findCmd['$min'] = cmd.min, usesSpecialModifier = true; - if(cmd.max) findCmd['$max'] = cmd.max, usesSpecialModifier = true; - if(cmd.showDiskLoc) findCmd['$showDiskLoc'] = cmd.showDiskLoc, usesSpecialModifier = true; - if(cmd.comment) findCmd['$comment'] = cmd.comment, usesSpecialModifier = true; - if(cmd.maxTimeMS) findCmd['$maxTimeMS'] = cmd.maxTimeMS, usesSpecialModifier = true; - - // If we have explain, return a single document and close cursor - if(cmd.explain) { - numberToReturn = -1; - usesSpecialModifier = true; - findCmd['$explain'] = true; - } - - // If we have a special modifier - if(usesSpecialModifier) { - findCmd['$query'] = cmd.query; - } else { - findCmd = cmd.query; - } - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server find command does not support a readConcern level of %s', cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) { - cmd = copy(cmd); - delete cmd['readConcern']; - } - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // // We have a Mongos topology, check if we need to add a readPreference - // if(topology.type == 'mongos' && readPreference) { - // findCmd['$readPreference'] = readPreference.toJSON(); - // usesSpecialModifier = true; - // } - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' - && readPreference - && readPreference.preference != 'primary') { - findCmd = { - '$query': findCmd, - '$readPreference': readPreference.toJSON() - }; - - usesSpecialModifier = true; - } - - // Build Query object - var query = new Query(bson, ns, findCmd, { - numberToSkip: numberToSkip, numberToReturn: numberToReturn - , checkKeys: false, returnFieldSelector: cmd.fields - , serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Set up the option bits for wire protocol - if(typeof cmd.tailable == 'boolean') query.tailable = cmd.tailable; - if(typeof cmd.oplogReplay == 'boolean') query.oplogReplay = cmd.oplogReplay; - if(typeof cmd.noCursorTimeout == 'boolean') query.noCursorTimeout = cmd.noCursorTimeout; - if(typeof cmd.awaitData == 'boolean') query.awaitData = cmd.awaitData; - if(typeof cmd.exhaust == 'boolean') query.exhaust = cmd.exhaust; - if(typeof cmd.partial == 'boolean') query.partial = cmd.partial; - // Return the query - return query; -} - -// -// Set up a command cursor -var setupCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Set empty options object - options = options || {} - - // Final query - var finalCmd = {}; - for(var name in cmd) { - finalCmd[name] = cmd[name]; - } - - // Build command namespace - var parts = ns.split(/\./); - - // // We have a Mongos topology, check if we need to add a readPreference - // if(topology.type == 'mongos' && readPreference) { - // finalCmd['$readPreference'] = readPreference.toJSON(); - // } - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server %s command does not support a readConcern level of %s', JSON.stringify(cmd), cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) delete cmd['readConcern']; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' - && readPreference - && readPreference.preference != 'primary') { - finalCmd = { - '$query': finalCmd, - '$readPreference': readPreference.toJSON() - }; - } - - // Build Query object - var query = new Query(bson, f('%s.$cmd', parts.shift()), finalCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) { - return callback; - } else { - return domain.bind(callback); - } -} - -module.exports = WireProtocol; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js deleted file mode 100644 index 851c076b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js +++ /dev/null @@ -1,509 +0,0 @@ -"use strict"; - -var Insert = require('./commands').Insert - , Update = require('./commands').Update - , Remove = require('./commands').Remove - , Query = require('../connection/commands').Query - , copy = require('../connection/utils').copy - , KillCursor = require('../connection/commands').KillCursor - , GetMore = require('../connection/commands').GetMore - , Query = require('../connection/commands').Query - , ReadPreference = require('../topologies/read_preference') - , f = require('util').format - , CommandResult = require('../topologies/command_result') - , MongoError = require('../error') - , Long = require('bson').Long; - -var WireProtocol = function(legacyWireProtocol) { - this.legacyWireProtocol = legacyWireProtocol; -} - -// -// Execute a write operation -var executeWrite = function(topology, type, opsField, ns, ops, options, callback) { - if(ops.length == 0) throw new MongoError("insert must contain at least one document"); - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // Split the ns up to get db and collection - var p = ns.split("."); - var d = p.shift(); - // Options - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - var writeConcern = options.writeConcern; - - // return skeleton - var writeCommand = {}; - writeCommand[type] = p.join('.'); - writeCommand[opsField] = ops; - writeCommand.ordered = ordered; - - // Did we specify a write concern - if(writeConcern && Object.keys(writeConcern).length > 0) { - writeCommand.writeConcern = writeConcern; - } - - // Do we have bypassDocumentValidation set, then enable it on the write command - if(typeof options.bypassDocumentValidation == 'boolean') { - writeCommand.bypassDocumentValidation = options.bypassDocumentValidation; - } - - // Options object - var opts = {}; - if(type == 'insert') opts.checkKeys = true; - // Ensure we support serialization of functions - if(options.serializeFunctions) opts.serializeFunctions = options.serializeFunctions; - if(options.ignoreUndefined) opts.ignoreUndefined = options.ignoreUndefined; - // Execute command - topology.command(f("%s.$cmd", d), writeCommand, opts, callback); -} - -// -// Needs to support legacy mass insert as well as ordered/unordered legacy -// emulation -// -WireProtocol.prototype.insert = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'insert', 'documents', ns, ops, options, callback); -} - -WireProtocol.prototype.update = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'update', 'updates', ns, ops, options, callback); -} - -WireProtocol.prototype.remove = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'delete', 'deletes', ns, ops, options, callback); -} - -WireProtocol.prototype.killCursor = function(bson, ns, cursorId, connection, callbacks, callback) { - // Build command namespace - var parts = ns.split(/\./); - // Command namespace - var commandns = f('%s.$cmd', parts.shift()); - // Create getMore command - var killcursorCmd = { - killCursors: parts.join('.'), - cursors: [cursorId] - } - - // Build Query object - var query = new Query(bson, commandns, killcursorCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, returnFieldSelector: null - }); - - // Set query flags - query.slaveOk = true; - - // Execute the kill cursor command - if(connection && connection.isConnected()) { - connection.write(query.toBin()); - } - - // Kill cursor callback - var killCursorCallback = function(err, r) { - if(err) { - if(typeof callback != 'function') return; - return callback(err); - } - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - if(typeof callback != 'function') return; - return callback(new MongoError("cursor killed or timed out"), null); - } - - if(!Array.isArray(r.documents) || r.documents.length == 0) { - if(typeof callback != 'function') return; - return callback(new MongoError(f('invalid getMore result returned for cursor id %s', cursorState.cursorId))); - } - - // Return the result - if(typeof callback == 'function') { - callback(null, r.documents[0]); - } - } - - // Register a callback - callbacks.register(query.requestId, killCursorCallback); -} - -WireProtocol.prototype.getMore = function(bson, ns, cursorState, batchSize, raw, connection, callbacks, options, callback) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - // Build command namespace - var parts = ns.split(/\./); - // Command namespace - var commandns = f('%s.$cmd', parts.shift()); - - // Check if we have an maxTimeMS set - var maxTimeMS = typeof cursorState.cmd.maxTimeMS == 'number' ? cursorState.cmd.maxTimeMS : 3000; - - // Create getMore command - var getMoreCmd = { - getMore: cursorState.cursorId, - collection: parts.join('.'), - batchSize: Math.abs(batchSize), - maxTimeMS: maxTimeMS - } - - // Build Query object - var query = new Query(bson, commandns, getMoreCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, returnFieldSelector: null - }); - - // Set query flags - query.slaveOk = true; - - // Query callback - var queryCallback = function(err, r) { - if(err) return callback(err); - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - return callback(new MongoError("cursor killed or timed out"), null); - } - - if(!Array.isArray(r.documents) || r.documents.length == 0) - return callback(new MongoError(f('invalid getMore result returned for cursor id %s', cursorState.cursorId))); - - // Raw, return all the extracted documents - if(raw) { - cursorState.documents = r.documents; - cursorState.cursorId = r.cursorId; - return callback(null, r.documents); - } - - // Ensure we have a Long valie cursor id - var cursorId = typeof r.documents[0].cursor.id == 'number' - ? Long.fromNumber(r.documents[0].cursor.id) - : r.documents[0].cursor.id; - - // Set all the values - cursorState.documents = r.documents[0].cursor.nextBatch; - cursorState.cursorId = cursorId; - - // Return the result - callback(null, r.documents[0]); - } - - // If we have a raw query decorate the function - if(raw) { - queryCallback.raw = raw; - } - - // Add the result field needed - queryCallback.documentsReturnedIn = 'nextBatch'; - - // Register a callback - callbacks.register(query.requestId, queryCallback); - // Write out the getMore command - connection.write(query.toBin()); -} - -WireProtocol.prototype.command = function(bson, ns, cmd, cursorState, topology, options) { - // Establish type of command - if(cmd.find) { - if(cmd.exhaust) { - return this.legacyWireProtocol.command(bson, ns, cmd, cursorState, topology, options); - } - - // Create the find command - var query = executeFindCommand(bson, ns, cmd, cursorState, topology, options) - // Mark the cmd as virtual - cmd.virtual = false; - // Signal the documents are in the firstBatch value - query.documentsReturnedIn = 'firstBatch'; - // Return the query - return query; - } else if(cursorState.cursorId != null) { - } else if(cmd) { - return setupCommand(bson, ns, cmd, cursorState, topology, options); - } else { - throw new MongoError(f("command %s does not return a cursor", JSON.stringify(cmd))); - } -} - -// // Command -// { -// find: ns -// , query: -// , limit: -// , fields: -// , skip: -// , hint: -// , explain: -// , snapshot: -// , batchSize: -// , returnKey: -// , maxScan: -// , min: -// , max: -// , showDiskLoc: -// , comment: -// , maxTimeMS: -// , raw: -// , readPreference: -// , tailable: -// , oplogReplay: -// , noCursorTimeout: -// , awaitdata: -// , exhaust: -// , partial: -// } - -// FIND/GETMORE SPEC -// { -// “find”: , -// “filter”: { ... }, -// “sort”: { ... }, -// “projection”: { ... }, -// “hint”: { ... }, -// “skip”: , -// “limit”: , -// “batchSize”: , -// “singleBatch”: , -// “comment”: , -// “maxScan”: , -// “maxTimeMS”: , -// “max”: { ... }, -// “min”: { ... }, -// “returnKey”: , -// “showRecordId”: , -// “snapshot”: , -// “tailable”: , -// “oplogReplay”: , -// “noCursorTimeout”: , -// “awaitData”: , -// “partial”: , -// “$readPreference”: { ... } -// } - -// -// Execute a find command -var executeFindCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Ensure we have at least some options - options = options || {}; - // Set the optional batchSize - cursorState.batchSize = cmd.batchSize || cursorState.batchSize; - - // Build command namespace - var parts = ns.split(/\./); - // Command namespace - var commandns = f('%s.$cmd', parts.shift()); - - // Build actual find command - var findCmd = { - find: parts.join('.') - }; - - // I we provided a filter - if(cmd.query) findCmd.filter = cmd.query; - - // Sort value - var sortValue = cmd.sort; - - // Handle issue of sort being an Array - if(Array.isArray(sortValue)) { - var sortObject = {}; - - if(sortValue.length > 0 && !Array.isArray(sortValue[0])) { - var sortDirection = sortValue[1]; - // Translate the sort order text - if(sortDirection == 'asc') { - sortDirection = 1; - } else if(sortDirection == 'desc') { - sortDirection = -1; - } - - // Set the sort order - sortObject[sortValue[0]] = sortDirection; - } else { - for(var i = 0; i < sortValue.length; i++) { - var sortDirection = sortValue[i][1]; - // Translate the sort order text - if(sortDirection == 'asc') { - sortDirection = 1; - } else if(sortDirection == 'desc') { - sortDirection = -1; - } - - // Set the sort order - sortObject[sortValue[i][0]] = sortDirection; - } - } - - sortValue = sortObject; - }; - - // Add sort to command - if(cmd.sort) findCmd.sort = sortValue; - // Add a projection to the command - if(cmd.fields) findCmd.projection = cmd.fields; - // Add a hint to the command - if(cmd.hint) findCmd.hint = cmd.hint; - // Add a skip - if(cmd.skip) findCmd.skip = cmd.skip; - // Add a limit - if(cmd.limit) findCmd.limit = cmd.limit; - // Add a batchSize - if(typeof cmd.batchSize == 'number') findCmd.batchSize = Math.abs(cmd.batchSize); - - // Check if we wish to have a singleBatch - if(cmd.limit < 0) { - findCmd.limit = Math.abs(cmd.limit); - findCmd.singleBatch = true; - } - - // If we have comment set - if(cmd.comment) findCmd.comment = cmd.comment; - - // If we have maxScan - if(cmd.maxScan) findCmd.maxScan = cmd.maxScan; - - // If we have maxTimeMS set - if(cmd.maxTimeMS) findCmd.maxTimeMS = cmd.maxTimeMS; - - // If we have min - if(cmd.min) findCmd.min = cmd.min; - - // If we have max - if(cmd.max) findCmd.max = cmd.max; - - // If we have returnKey set - if(cmd.returnKey) findCmd.returnKey = cmd.returnKey; - - // If we have showDiskLoc set - if(cmd.showDiskLoc) findCmd.showRecordId = cmd.showDiskLoc; - - // If we have snapshot set - if(cmd.snapshot) findCmd.snapshot = cmd.snapshot; - - // If we have tailable set - if(cmd.tailable) findCmd.tailable = cmd.tailable; - - // If we have oplogReplay set - if(cmd.oplogReplay) findCmd.oplogReplay = cmd.oplogReplay; - - // If we have noCursorTimeout set - if(cmd.noCursorTimeout) findCmd.noCursorTimeout = cmd.noCursorTimeout; - - // If we have awaitData set - if(cmd.awaitData) findCmd.awaitData = cmd.awaitData; - if(cmd.awaitdata) findCmd.awaitData = cmd.awaitdata; - - // If we have partial set - if(cmd.partial) findCmd.partial = cmd.partial; - - // If we have explain, we need to rewrite the find command - // to wrap it in the explain command - if(cmd.explain) { - findCmd = { - explain: findCmd - } - } - - // Did we provide a readConcern - if(cmd.readConcern) findCmd.readConcern = cmd.readConcern; - - // Set up the serialize and ignoreUndefined fields - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' - && readPreference - && readPreference.preference != 'primary') { - findCmd = { - '$query': findCmd, - '$readPreference': readPreference.toJSON() - }; - } - - // Build Query object - var query = new Query(bson, commandns, findCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, returnFieldSelector: null - , serializeFunctions: serializeFunctions, ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -// -// Set up a command cursor -var setupCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Set empty options object - options = options || {} - - // Final query - var finalCmd = {}; - for(var name in cmd) { - finalCmd[name] = cmd[name]; - } - - // Build command namespace - var parts = ns.split(/\./); - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - - // Set up the serialize and ignoreUndefined fields - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' - && readPreference - && readPreference.preference != 'primary') { - finalCmd = { - '$query': finalCmd, - '$readPreference': readPreference.toJSON() - }; - } - - // Build Query object - var query = new Query(bson, f('%s.$cmd', parts.shift()), finalCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) { - return callback; - } else { - return domain.bind(callback); - } -} - -module.exports = WireProtocol; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js deleted file mode 100644 index 9c665ee8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js +++ /dev/null @@ -1,357 +0,0 @@ -"use strict"; - -var MongoError = require('../error'); - -// Wire command operation ids -var OP_UPDATE = 2001; -var OP_INSERT = 2002; -var OP_DELETE = 2006; - -var Insert = function(requestId, ismaster, bson, ns, documents, options) { - // Basic options needed to be passed in - if(ns == null) throw new MongoError("ns must be specified for query"); - if(!Array.isArray(documents) || documents.length == 0) throw new MongoError("documents array must contain at least one document to insert"); - - // Validate that we are not passing 0x00 in the colletion name - if(!!~ns.indexOf("\x00")) { - throw new MongoError("namespace cannot contain a null character"); - } - - // Set internal - this.requestId = requestId; - this.bson = bson; - this.ns = ns; - this.documents = documents; - this.ismaster = ismaster; - - // Ensure empty options - options = options || {}; - - // Unpack options - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : true; - this.continueOnError = typeof options.continueOnError == 'boolean' ? options.continueOnError : false; - // Set flags - this.flags = this.continueOnError ? 1 : 0; -} - -// To Binary -Insert.prototype.toBin = function() { - // Contains all the buffers to be written - var buffers = []; - - // Header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // Flags - + Buffer.byteLength(this.ns) + 1 // namespace - ); - - // Add header to buffers - buffers.push(header); - - // Total length of the message - var totalLength = header.length; - - // Serialize all the documents - for(var i = 0; i < this.documents.length; i++) { - var buffer = this.bson.serialize(this.documents[i] - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - - // Document is larger than maxBsonObjectSize, terminate serialization - if(buffer.length > this.ismaster.maxBsonObjectSize) { - throw new MongoError("Document exceeds maximum allowed bson size of " + this.ismaster.maxBsonObjectSize + " bytes"); - } - - // Add to total length of wire protocol message - totalLength = totalLength + buffer.length; - // Add to buffer - buffers.push(buffer); - } - - // Command is larger than maxMessageSizeBytes terminate serialization - if(totalLength > this.ismaster.maxMessageSizeBytes) { - throw new MongoError("Command exceeds maximum message size of " + this.ismaster.maxMessageSizeBytes + " bytes"); - } - - // Add all the metadata - var index = 0; - - // Write header length - header[index + 3] = (totalLength >> 24) & 0xff; - header[index + 2] = (totalLength >> 16) & 0xff; - header[index + 1] = (totalLength >> 8) & 0xff; - header[index] = (totalLength) & 0xff; - index = index + 4; - - // Write header requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // No flags - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Operation - header[index + 3] = (OP_INSERT >> 24) & 0xff; - header[index + 2] = (OP_INSERT >> 16) & 0xff; - header[index + 1] = (OP_INSERT >> 8) & 0xff; - header[index] = (OP_INSERT) & 0xff; - index = index + 4; - - // Flags - header[index + 3] = (this.flags >> 24) & 0xff; - header[index + 2] = (this.flags >> 16) & 0xff; - header[index + 1] = (this.flags >> 8) & 0xff; - header[index] = (this.flags) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Return the buffers - return buffers; -} - -var Update = function(requestId, ismaster, bson, ns, update, options) { - // Basic options needed to be passed in - if(ns == null) throw new MongoError("ns must be specified for query"); - - // Ensure empty options - options = options || {}; - - // Set internal - this.requestId = requestId; - this.bson = bson; - this.ns = ns; - this.ismaster = ismaster; - - // Unpack options - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false; - - // Unpack the update document - this.upsert = typeof update[0].upsert == 'boolean' ? update[0].upsert : false; - this.multi = typeof update[0].multi == 'boolean' ? update[0].multi : false; - this.q = update[0].q; - this.u = update[0].u; - - // Create flag value - this.flags = this.upsert ? 1 : 0; - this.flags = this.multi ? this.flags | 2 : this.flags; -} - -// To Binary -Update.prototype.toBin = function() { - // Contains all the buffers to be written - var buffers = []; - - // Header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // ZERO - + Buffer.byteLength(this.ns) + 1 // namespace - + 4 // Flags - ); - - // Add header to buffers - buffers.push(header); - - // Total length of the message - var totalLength = header.length; - - // Serialize the selector - var selector = this.bson.serialize(this.q - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - buffers.push(selector); - totalLength = totalLength + selector.length; - - // Serialize the update - var update = this.bson.serialize(this.u - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - buffers.push(update); - totalLength = totalLength + update.length; - - // Index in header buffer - var index = 0; - - // Write header length - header[index + 3] = (totalLength >> 24) & 0xff; - header[index + 2] = (totalLength >> 16) & 0xff; - header[index + 1] = (totalLength >> 8) & 0xff; - header[index] = (totalLength) & 0xff; - index = index + 4; - - // Write header requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // No flags - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Operation - header[index + 3] = (OP_UPDATE >> 24) & 0xff; - header[index + 2] = (OP_UPDATE >> 16) & 0xff; - header[index + 1] = (OP_UPDATE >> 8) & 0xff; - header[index] = (OP_UPDATE) & 0xff; - index = index + 4; - - // Write ZERO - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Flags - header[index + 3] = (this.flags >> 24) & 0xff; - header[index + 2] = (this.flags >> 16) & 0xff; - header[index + 1] = (this.flags >> 8) & 0xff; - header[index] = (this.flags) & 0xff; - index = index + 4; - - // Return the buffers - return buffers; -} - -var Remove = function(requestId, ismaster, bson, ns, remove, options) { - // Basic options needed to be passed in - if(ns == null) throw new MongoError("ns must be specified for query"); - - // Ensure empty options - options = options || {}; - - // Set internal - this.requestId = requestId; - this.bson = bson; - this.ns = ns; - this.ismaster = ismaster; - - // Unpack options - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false; - - // Unpack the update document - this.limit = typeof remove[0].limit == 'number' ? remove[0].limit : 1; - this.q = remove[0].q; - - // Create flag value - this.flags = this.limit == 1 ? 1 : 0; -} - -// To Binary -Remove.prototype.toBin = function() { - // Contains all the buffers to be written - var buffers = []; - - // Header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // ZERO - + Buffer.byteLength(this.ns) + 1 // namespace - + 4 // Flags - ); - - // Add header to buffers - buffers.push(header); - - // Total length of the message - var totalLength = header.length; - - // Serialize the selector - var selector = this.bson.serialize(this.q - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - buffers.push(selector); - totalLength = totalLength + selector.length; - - // Index in header buffer - var index = 0; - - // Write header length - header[index + 3] = (totalLength >> 24) & 0xff; - header[index + 2] = (totalLength >> 16) & 0xff; - header[index + 1] = (totalLength >> 8) & 0xff; - header[index] = (totalLength) & 0xff; - index = index + 4; - - // Write header requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // No flags - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Operation - header[index + 3] = (OP_DELETE >> 24) & 0xff; - header[index + 2] = (OP_DELETE >> 16) & 0xff; - header[index + 1] = (OP_DELETE >> 8) & 0xff; - header[index] = (OP_DELETE) & 0xff; - index = index + 4; - - // Write ZERO - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Write ZERO - header[index + 3] = (this.flags >> 24) & 0xff; - header[index + 2] = (this.flags >> 16) & 0xff; - header[index + 1] = (this.flags >> 8) & 0xff; - header[index] = (this.flags) & 0xff; - index = index + 4; - - // Return the buffers - return buffers; -} - -module.exports = { - Insert: Insert - , Update: Update - , Remove: Remove -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml deleted file mode 100644 index b0fb9f4d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.12" - - "iojs-v1.8.4" - - "iojs-v2.5.0" - - "iojs-v3.3.0" - - "4" -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 -before_install: - - '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28' - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CXX=g++-4.8; fi - - $CXX --version - - npm explore npm -g -- npm install node-gyp@latest \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md deleted file mode 100644 index 7428b0d0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md +++ /dev/null @@ -1,4 +0,0 @@ -kerberos -======== - -Kerberos library for node.js \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp deleted file mode 100644 index 6655299c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp +++ /dev/null @@ -1,46 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'kerberos', - 'cflags!': [ '-fno-exceptions' ], - 'cflags_cc!': [ '-fno-exceptions' ], - 'include_dirs': [ '> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = rm -rf "$@" && cp -af "$<" "$@" - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,kerberos.target.mk)))),) - include kerberos.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/ubuntu/workspace/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/config.gypi -I/home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/ubuntu/.node-gyp/0.10.35/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/ubuntu/.node-gyp/0.10.35" "-Dmodule_root_dir=/home/ubuntu/workspace/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos" binding.gyp -Makefile: $(srcdir)/../../../../../../../../../../.nvm/v0.10.35/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../../.node-gyp/0.10.35/common.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d deleted file mode 100644 index e06bd939..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d +++ /dev/null @@ -1,4 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/base64.o := cc '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/base64.o.d.raw -c -o Release/obj.target/kerberos/lib/base64.o ../lib/base64.c -Release/obj.target/kerberos/lib/base64.o: ../lib/base64.c ../lib/base64.h -../lib/base64.c: -../lib/base64.h: diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d deleted file mode 100644 index 8cbc346a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d +++ /dev/null @@ -1,63 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/kerberos.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -fno-rtti -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d.raw -c -o Release/obj.target/kerberos/lib/kerberos.o ../lib/kerberos.cc -Release/obj.target/kerberos/lib/kerberos.o: ../lib/kerberos.cc \ - ../lib/kerberos.h /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /usr/include/mit-krb5/gssapi/gssapi.h \ - /usr/include/mit-krb5/gssapi/gssapi_generic.h \ - /usr/include/mit-krb5/gssapi/gssapi_krb5.h \ - /usr/include/mit-krb5/gssapi/gssapi_ext.h /usr/include/mit-krb5/krb5.h \ - /usr/include/mit-krb5/krb5/krb5.h ../node_modules/nan/nan.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_version.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_pre_12_inl.h \ - ../node_modules/nan/nan_maybe_pre_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_pre_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_pre_12_inl.h \ - ../node_modules/nan/nan_persistent_pre_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h \ - ../lib/kerberosgss.h ../lib/worker.h ../lib/kerberos_context.h -../lib/kerberos.cc: -../lib/kerberos.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/usr/include/mit-krb5/gssapi/gssapi.h: -/usr/include/mit-krb5/gssapi/gssapi_generic.h: -/usr/include/mit-krb5/gssapi/gssapi_krb5.h: -/usr/include/mit-krb5/gssapi/gssapi_ext.h: -/usr/include/mit-krb5/krb5.h: -/usr/include/mit-krb5/krb5/krb5.h: -../node_modules/nan/nan.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_version.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_pre_12_inl.h: -../node_modules/nan/nan_maybe_pre_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_pre_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_pre_12_inl.h: -../node_modules/nan/nan_persistent_pre_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: -../lib/kerberosgss.h: -../lib/worker.h: -../lib/kerberos_context.h: diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d deleted file mode 100644 index 8144d1b0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d +++ /dev/null @@ -1,62 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/kerberos_context.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -fno-rtti -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d.raw -c -o Release/obj.target/kerberos/lib/kerberos_context.o ../lib/kerberos_context.cc -Release/obj.target/kerberos/lib/kerberos_context.o: \ - ../lib/kerberos_context.cc ../lib/kerberos_context.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /usr/include/mit-krb5/gssapi/gssapi.h \ - /usr/include/mit-krb5/gssapi/gssapi_generic.h \ - /usr/include/mit-krb5/gssapi/gssapi_krb5.h \ - /usr/include/mit-krb5/gssapi/gssapi_ext.h /usr/include/mit-krb5/krb5.h \ - /usr/include/mit-krb5/krb5/krb5.h ../node_modules/nan/nan.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_version.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_pre_12_inl.h \ - ../node_modules/nan/nan_maybe_pre_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_pre_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_pre_12_inl.h \ - ../node_modules/nan/nan_persistent_pre_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h \ - ../lib/kerberosgss.h -../lib/kerberos_context.cc: -../lib/kerberos_context.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/usr/include/mit-krb5/gssapi/gssapi.h: -/usr/include/mit-krb5/gssapi/gssapi_generic.h: -/usr/include/mit-krb5/gssapi/gssapi_krb5.h: -/usr/include/mit-krb5/gssapi/gssapi_ext.h: -/usr/include/mit-krb5/krb5.h: -/usr/include/mit-krb5/krb5/krb5.h: -../node_modules/nan/nan.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_version.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_pre_12_inl.h: -../node_modules/nan/nan_maybe_pre_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_pre_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_pre_12_inl.h: -../node_modules/nan/nan_persistent_pre_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: -../lib/kerberosgss.h: diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d deleted file mode 100644 index 1eecdc99..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d +++ /dev/null @@ -1,16 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/kerberosgss.o := cc '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d.raw -c -o Release/obj.target/kerberos/lib/kerberosgss.o ../lib/kerberosgss.c -Release/obj.target/kerberos/lib/kerberosgss.o: ../lib/kerberosgss.c \ - ../lib/kerberosgss.h /usr/include/mit-krb5/gssapi/gssapi.h \ - /usr/include/mit-krb5/gssapi/gssapi_generic.h \ - /usr/include/mit-krb5/gssapi/gssapi_krb5.h \ - /usr/include/mit-krb5/gssapi/gssapi_ext.h /usr/include/mit-krb5/krb5.h \ - /usr/include/mit-krb5/krb5/krb5.h ../lib/base64.h -../lib/kerberosgss.c: -../lib/kerberosgss.h: -/usr/include/mit-krb5/gssapi/gssapi.h: -/usr/include/mit-krb5/gssapi/gssapi_generic.h: -/usr/include/mit-krb5/gssapi/gssapi_krb5.h: -/usr/include/mit-krb5/gssapi/gssapi_ext.h: -/usr/include/mit-krb5/krb5.h: -/usr/include/mit-krb5/krb5/krb5.h: -../lib/base64.h: diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d deleted file mode 100644 index 8fe448ed..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d +++ /dev/null @@ -1,49 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/worker.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -fno-rtti -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/worker.o.d.raw -c -o Release/obj.target/kerberos/lib/worker.o ../lib/worker.cc -Release/obj.target/kerberos/lib/worker.o: ../lib/worker.cc \ - ../lib/worker.h /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - ../node_modules/nan/nan.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_version.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_pre_12_inl.h \ - ../node_modules/nan/nan_maybe_pre_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_pre_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_pre_12_inl.h \ - ../node_modules/nan/nan_persistent_pre_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h -../lib/worker.cc: -../lib/worker.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -../node_modules/nan/nan.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_version.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_pre_12_inl.h: -../node_modules/nan/nan_maybe_pre_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_pre_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_pre_12_inl.h: -../node_modules/nan/nan_persistent_pre_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/linker.lock b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/linker.lock deleted file mode 100644 index e69de29b..00000000 diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/base64.o b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/base64.o deleted file mode 100644 index b7308d88d55a579f8473f8a8e5f4f048459a753b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3600 zcmbVO>u(fQ6u+}OeLtq9g@OgUJOzQJTM7cUu+#3g11^+47Dds`c00AD?QYqfN&$f- z(`q-kgfAw>KfzBX#>Nm+cZ(^cpOhF;6QgMq%i{wW6R|?qb7t;sr_*ghJju+x=XZYR zG3Va7GZ)>S1`Ed#CLGyM<~4>A@-Sn5?$oAEQb_WMSBm}KD#iYl)Cbwqh+ihd31yWO z`$f~f!dTi&sEDFjito~f*iV|tkaG6|WA)bR`{Fr&Fj!wF$%4Wtp(Cl)D|6s}wXe<@yzVLGo0qa~vHz$&RpUQ(}H z6Zb6Y)B$0%v}~mLi7?vw)Fq78&nBmMF)_`nQ^QcP{UWkzzn0VeGd0M<5=?_{8_WV||WI8mY7& zQp`QAckQx!`tIaxDuwGOwjI=)i>J3f`q~?2m5_;~5 z7a$wkK2|bxOBgBwP@TCbyk89y=pxN43ZvD<&gg7P7%E4DFxJXxv;xpv!WdsBMjwN5 z7K4G&qR!MRWg6o?K%T&@x@b)q5PsGP=d5Z92`R`lsS$41M{A0K@Fi&O*m&}e1(ur^ zlQX<0ew=gVeD54_h$_DU($*?x#pJI%MEAs-En_K=(}hytPf-}Fb|hyluAB+y$SF=| zLz)x7l;WqX;ui^|=D4BWVu+9l>91+tS+3Z)m|MCR)=Be{VvqEG3_pYxFIX>6?8m#` z0Lb>cC-&{#gh8KxjeLXO08g=SozpJhd2n>Mv^2Hsvu%vzlEZReD164|@9hl*{7QEy zXzTQM_sSg@Y$?I|pHcP$??Cmg-7oFgyYJ`Ah3!AsRxOLlh`;JOS)lSVW*44Y*4UN*lL$7!aA89(; z+|t_SJ@)Er$6xoi2Rh`=x4XJe_Vo4zL;a`15oO?=(}QQuqO)Gd)*Xa2*4OW|ZT7Yg z1eF0>wSAAhYP)0afTlXO=m0!?DQy6EwuNwmMO=A)R`ylcd@BK8O>Gj6VqwvHmimHB zQMGOZbq}@m1D8l>J5-R__<_}>^43Bw7oxcHI&l#5NF`9ZC_jmO7OPI@`zb%7yXj1O zI9ZzuMM64u8qHVezWe!C(MD#YI5SNz1@9*GcpID`t)9d-v(i9HbN>yv{(4Tcoi z-gv~jJ)-ynJwU)Ha+j|&?C+Clb^m{`fh#_mc1jq+IO+V7)d0e@XrW5VLFY{vs#3lV zMlm=DsyNL?1q9a#WfNS8o6?Y^89*`!4W}z`$2G;6X8N=GJHQuXR>5Ty=C8fE1_R5_ zMkm;CZZUAQDQ!y9gxgFy?osr|y=Igo_1|a&Vb1chvDttbsdv&XN*Zn_#mx0jQ~!^Q zL1E6;kHLPJq)T;E`;fpsphR5%9JrW2TmNFf%xi}(QTl(efYXzs|DGb&Gj1oHo}0>u2ubde&;34EVELELM`W2*mSX znV~;y|7-=^eDSK`eY n>z2TK=pln=xjb+neC>pCeDzZArL%{AN~g)clTCd8rYD4eIjk zGMBH~({IzQ>GJ1>T65E}m+z3J{JQ0b_jkwtK!2x>K8{;RMTPVN{~7uIp*;_dXe{k{ zkVbV&?X`(dq|`5?u|h4gjsur++;*|e_iYpMAyE!I&I7?_^yRJQzUUjj!qrG0zv1%b zZE!W_I%xZv=<-R8F5f1XZ|n|g`<#})xcoOzSI&Et`lrj^MUVNqE$J@b zPSG`TuA~qZj8D|Bx=HgIHl);F(9+UES_7kLJ2|D>P!4xBCkD?qOduY(h=sTm-{#0c z!0}Q=tH$v=C}L5$GT!9)UlGwrY73gaD_ARGH5p1)j^CW`+oCfT`1XoC!k+)r|NpIj znt1*Z?Rzngu!6>?9n{n0K%>Foy6KBogJa3xwRTM{9T_S0qiBS={A=dY!8(#}G4-$Q z)RP4AuMxr5w=G3prg_nphPt-$vmAzR?{)D|>8oK4DgUz9q;kZHrk zXDOwWM|M`)(mFAoKdyvaqXhMD5FD0mTSaFV3wwN?aaB`lGtm!WpN8 z6&m4;MlLMUAKSS?*hbn9daM26P0;lWZvDkmM>Kru?U3&u+>^px^#Faw)$pOWtq9b+ zS_&zjnuKrK@+y_4B5jVFVy%cdf=07Fud`n<&*ztxyBOOz$)^-OiRdJa(ofY;q@1ecskEq{kqBAwqkO;!&RV?-? zW_+S~tE^|ldf9K#RCSV$=8Y~HFXYk9lbb^J6|xpy7s!%@eJSfZo<5;=KEuNlG$xi=C2eXxhBC?_qFsYoxY7v(|8yw1mlAA!urQZ zOUP9+w9`6#;tw=AZ<|xgWsLC6N*LiQpE|-fqaxoYuB1s~!~T{QI$BHuGQU5WgG(lgUHg3h6+P)Hd{Af&>fA7*;Y$wTDir&uqnY|5 zxk{Fl@5?g+pHO5}{ZmyiZ*E{VhtJ^pSn=(F93dNYL|{Ed>6C7?ZV&LB6N<+zffcMk z$FH#Qw^!t;<=Thw2Z;v@`U4$AS^ZKQQx6bQp$f{na5Qd)^PxJz8hTGN2TXk`7}uMl z!chG~>oIeDi2a%41C0<`@%T2?eL~Il-Om#r>b{mkPR55$J^kmW)*Yk>F)Wt5VP%4k z;`y-s;u33H-RD&9;h2>Aadfio5J}x4q|TS)kuSrvZ7JeHNL|3)oYF9gdO%%GS6fPh zi}v#URL~z%>kipc=6`SFg0AII)J3!%ueo{%ArY-8KHQ?B5s7GHQ|cQCuH*Y$rs%RY zrG5{ogkbie%C7s5UUgapvxSu16wK6m(>ETX)O5rg%AE*%@c#dinG`JlV1oj=KbFg?xng2He zfkpI3-e-YzW#9_Z9X3HE5fF--0#&RBh2Laho*d*j2{|+(*dJ|*kXJ#?(Wiu{^8{!N zT*pxjXP7#26VOj=GABoG8qjnr!JJZA-ny)y#*U#b*bkLSkKa!#e zttRFl7Ng`^wf<7ex>M=axn6*<(AOf|)2(%N3$J0P$d!HKV=*ZWNgT^I?mLA8NZoZ^ zjFkEe66ev8=WNMYOOgh!nN#XFQ;`HeQjz69yh1qw!@yygcXq^@umWSl{r;Ze?_+}YvAMfTrLQ=7L>Niwh(yCq_=*+Q0 z*h6vYAjTt#PcA&xWpKarQ-`KVMz+wm6K~V~Vg0=n_nnV~2YC5$4G&a#u|&&{HNxR= zdBP$ig@{-$1)ih$5*lBodS$h)Ugxr|Fh3u&-QL?nHuFs@H5JjKF>GO0N|s}oz4h`? zZE4-IS2Ru7rC~~a7S#4l5sw9_rWGvR{f;*0+FYUJLg7_Usr`!fotolviZx zCX77&a(As)WDbkza*Bw8S~+V3qfFFmnPz{K5@4>;4h)mp)BHr!e`&s%W1er~c($Nr zzx2MEZ-$uWn-o6guX6Q#vs-p+G2e8Gm~Se@eA9{Mn=fg3O*2gg0v0n(dzyq?zAgp6 zsbbA8E_*0P55g**)g7d<|DY&PtfDDc{iGWXgGtp9C!Xg-S;2|tIBqyB`1oiOPs``W zKk+1n+4nO|Jh1-zCfdByU50WRr=c!Q^UfMEmT`R3df3gfO*rrD(eus+mh(*8}V z&O3*wKwb}DB#o@+a1*rinB#Uz{mf7Vrarev_!)vL&o|>B0v~a{scBt(V7`IS=klH0 zi|bP0>(eWNwqp6tcLwMJ{!?B}`_+Xl4T-=$0$wcBG&D+}Qh=XrKH3>JIUMoQM$9bwo}pZ_ zH9r+4yX6d2;M*grsBh3U(-gnC`J3?XGx7eJy#D#|7rFkSIR9rcAH}BBFIU$;lcUW? z9=hp)*FOXJ80VvGkxO3xToExJ-9x(74H+8NeN+j-yI5k)bfmsV_tj|v6#cL6b-IGx zCf0?z3#x%bb=XDI99?5YyBkLL+OMaxYNjjj)rdPpVz#4HAOE5nCS;@im z)V+kn_0(1LbH$3Il|*S*DaKj=DGQyob(+jjq1?t z_5(DDgysB9On>4QI^7Mf4CSP|!SWj_URJD!N%G$`HNiYCzW*5{oG$v8>W?(x?_wVY z`!lV72FlJ;&)tyk6TXJWIE9(l6$QS*z4)eMaD5S*(ojm;RVWfSt^*YUK+iZ@;N0%5 z#!36Ij+lWDsD@2wPe_ccUMA}=r{eR%$6;VJIZ9q<2FK+%IWDFAH1k_irQ`yV2NAE!cs5pFp7&5PvZJU=+no&6z~ft~j|(BVwB;M5 zG=RmWZCgGWb}RL4BI^=pq?o?#qWOI!ouYfDp>?#pj#TmGr(LsVlTk;U%WoA{|CDRi zzV9AwE^q$p@z3SE$Yr6m#?LjEi*=Z6URu9@E8_t5E4W`eG#D>*e-rWaMZ$Q$l)6OV zU5F!mk0EdY=MBbJyq^7vM8&-SnaER1wc~i(i#lMie^WfJmW8YS-m3d)H59tT;@A={ z@|bUenb-N|&=VF-^d$#h3cSgG-imUXxV~rzc{1XQ8;hH3*4G#O{LcTyCmI|-Jw7>% zl=}aF<5TjEqs6D+zx{vlNqx`rfANVUa+D}`T=D7We!lR(zJ9uKG_7zVuMNEgt-FTn z#M51HeiZX?^YY;Q2UkI}9#yL%x_08{h16G8`jN-#eyuC_KAu*aV5N7B(iyhWdyj7) zz)J5CaXSH4dWj;JTPw16_QEvBYbK6uw}?yFN7`_Q-9(YADKs6M9%!li^zSiA1z3K{>JeK>9=W2 z|MW#P96K#V!v_YPp2`x~&vHuS+#j8rGAnUS9JRWfL8X-^kG~ z1!VTH-(d2Czmv4Q%a==*(5+YToUx7%^aBAI8o4y_@Guui4-kt|gFlar`Vet~c%Yqr z%hBZ8o-69@Y-xTlx<}6@OQnTT9X>#xj?%PY-(S=3pSUCEjG><%@gv2f=?74kaKQAf zttGB2tJ_HwxsJ|rc-D^9qs-+Ozj6xUP4Yo^eY3Ce+@9NMu)H1gRpCd(*F4y~60#tN5j=7xU{@uOe#oJWany*zC3OS8ckc=yhB1i_|TD!>?F3zj(4l z{a950`o7`A>WlSnKXshJc{4b{`o+}le2o@4`Ukywo_F1}g=hb;U)Bxf$zIOM`M%hm z&C5tpP+px--<8N2cyd$oE|}1p_ck@}Z{8(xNr9&3^>}_CpWhvJ{=p-k4_r^f4@Ev} z{-*gOse$iTifJ}*u}SC?epsTG)-Fc#yHHx-ER)>lY>(0=G&Kd1Od?UsrQ)AFlEdWtHCdWyVL zd!K1^FQ0gor`St0Z(4Z6VO>tCL zmh^Fykdvl(Djkzci>8oF*(8!HCKpdED!$q=xw@>F9nIxg>gmItCY41cWu8fnNuE;A z6xlix%gfmZeMn<96}QZIwsTJ=ze1}Mte#pJ1Q#6z2(K_r4G_o zR#hU}*vh2;rae|ZVm}2dQ(jg&(@{}gRaG*v)Z>^j)l+8WsFEs&r>uyiCWZSMdT}2| zc?G+psMJwBm72#>HYMmx_E2P#$$rpxNIo?%`Mz{miKlc@Zh18ia4{CySV~ZcgA6Gv zr?KQH7K4F0N0qmztk}bH;BUy%$KjpoaZvZFF7-MlSC&r`$6-Til&7kKItUHR$z+Km z?3^4*P&w`>4$)Jh*UHKc(Q_l6U{yaJ2~^Or)Q|1$JE_P^!$%Gq3&S#a=wJ{shFiI6#DUDPjC~`DgKKpHk}Q&rozfrsmYp8OGcM#ud3H>aaUX-Elnt164+w^9m zUGhdbyNO=7CjBIxM$fNAdz54W6)&_$Kg~CX#A$PT(F2Cm=JLjrYQ5_4_R%(<9=ttd zGG5*9QJxawEiEyf`nwI|ffyS-`M)y8Wf=Fip`wVVcBbuV$u466ZO8q3th76ob$;6F zcw<)QmN;W+jGcBLjp_bmyzypCXWHKz)8mnN|5fES8SP&#~UrS6aE%&+#YME{rh8?KN?Fao{hD? zM#jaSVHor6-S3Dup0}TF82_@f*xb0;q~xJ^5?ddCieY@md$%UgA9A!WMp`f@i7faw zQCslOM7Cg8B3baQ%`i6E?T;iH+wIN=l8iZVCoE4g?vJz6{=;$1pW({99A|$c(fB%! zEVv`S`%8(&+V~p7*qC6yFUfc`CA(`x9QH<@fePiXvYoQofs$=+B+}hpc%b z=1kf-$NqehaenfqL}S!Gvi#3&>?@LtciUtxN;2-Wb^Lph@s!O@`_J2$ueVW-*KPLK zlgKwz_#?61UraLo6g$>1p0l&qtM&rJSR7~HmuNf|m;7F$u_w+)S`WtCe@rxL6O#Wy zRZX~wY>c)@0;{dG3xud=!C*zA8xGUjq?JrmpgwIt&&v11JG z9wfGd&3!D+em|KKmwXGkO`H2~Vea-M}LDar>_GihR?UElPRf$f+*w04Rv3+;( zpQn@Py^eoXmOiB{eI|u0^|d!fy+s;U*zEsoPj1ZoYkT9M?SuzYjQO#4+P@=~`C{%@ zPsZBkr5L-}(mD3-_q8{c+xa`6{c-kNQjCLf$^U6@ER27NYn@EPlK+`tJQwo=seHv|-%g{%mbodxsE<8iPJ(eytey6k#xj43 zYw%*MeOH3<1=nDqz55#p#>@6g3}aawi>;3H8pi5)`-TK#Lwxen3C8<8G#+E~*YKYY z5~!VP+tS|c{O5nytaZv;3)_*mYUvt9dTVVv_SO^a$XnwLF<;5!{FONS z-gd?}JkIZm@BVH(iYXUR+)iMz6$uk5nzyxYOf(*8o4h>HSl^c3HTpgKZhkxZvyA_& z=0AVpKcBQC_rAitmOR^@Bfi6aPaEUBugDT2wYENl`q}9V$$^7!KEb#tCiR~kjXPuV z2<(dK8t7@8o%SEKbt1`iwys+`8t>Z%Z|X>~ zA@%u=#w)SiiR_8({7^^ZFon>L#%w!F-f!=^w4<@wKKQ|oMnhccZ5@q!0rE)V5j{p2`u?xLf3aY z7zYvtzum#u+%|P<2jl&=-HFt;>%6Liac?_2?JsM`k}tRG`fLZ|y>^42>0m5POkLW+ zSe@9N$gafBi%5T>o%U}|V#&Lcy4=>mSeZ2V)(*zuq|}=`7>km-6Iqko`P)?EFUfY= z|0tOy|DD|BpQ%P;`@vtQ8XvSz{Up`c-@ZGMJ5xHplWIJhVyFF=Q_dpEgDEGym1-;{W^Q zJKyH7eB~;eZj8A6;{9H<-j-j+=`W%_b8Q#z+)%es!s>trbOq%tDRzwconvHC**WK2 zDDI{3?Sga8kyk&xr)QmWP66H0C>_juQeeoLj>~71c&9qXIL>wGTNSzTjs`^(NYl$p zCPk{|0xT3mUfxyqS*W2KIJxR>fKXQ$yiFvG9amIZ?HSU?!MT5Trb)9roL*Att)|P? z=mm@|qnkl=i^w`1Isd4m++cZ+a`L931`QCKyK6QQ}Z*~5mjkbBQt~z_0 zi`$W!eD({=zREI`Lb88Ijtj~bhRJ>_MU5rA6?#eb{6^a!=EaiUB9?Wr-k$VvkS{o0 z!+*>+)JRd5a~*>m+gYLHLUxkRf_8@LL^HE-pOWoC`?Bou$?R)Bx7y+ym+`JT$Il)F zZO*B)dD-0IiQ{>bM-_DNd0Gr|qFeA`vThd2Nff^Asbn57$+WpZ)_)jp&X=zQcAmX1uFcD= z?*gg|*PGVxBJl-(nEd(kY(wi}Z_s74Y^{)_?;(ys_Ni9L?reo@tZJuYu_3(`vhUIr zBd1CHNBfN0-`oc52k9t^|0dZf?5u*sYk0$bg=PB)rygB4on&__dtWA7!rEfkt+x5G zjrKpxi>r&bt!=~lhm(Hp)AN*mm&q0``!RJctPh?)-!?*ZgnVhQu=8CdyAt()>}4!V zohFOU&sF{PHf+lJa1K|ZtzOtWlO*kfTYxe|G0S08kHR9qSm8Bjwv-tXJ2zn5ixiK z#sAgpdv=?MQ4aDKrxgAp`o{3&xM5Ns+xV)|SKroTqw44R^WrX~j-HUfT8AYHonEE0 zTTmy@n{~FaB*JxAq|Tqt=S3YZ3f93$tC~5@TQrfj-b%Ths`n~ArA2At%dRxOQ*ES8 ztg12uNONB{GLx1*&h*gAEq`Rj^epFqVd~4BF`j7^rA1y(-pJAJjI&3Um*tjM%;aw) zLOI6Jmpk67{LvZiyu7@j8F|xT{p>FzI9u2h>suFH{%l+~S5T|MeGDmu5h*ldox@1aOk+-^%TZ?KTE*tWBH%fa_ z?YK=dOQuzvJ*=qMOJAPmk8$T^ReDH4ncJH;Cf$wopeq4ds#hpfLf?eCiz+LNxamY= zs}rK#$z?>Tca0gR`d6qe^DG2|wKSc_!=V>bYfMgayQkFDxGU&lgTL}B@y>KlPdCzv z%co7F?`VxQ`jX0%HhkpRzGQOo)hfSds(W%JeaC2|O{pxWYWz&;cNE9OI@qKyTOD(J z;WUswm(oXth2YjIznJSt9`ny=MgBsP<%IcpU45+OUm|jc=bzb%{1c+&zpNGcr$)&i zTn~XBEC1;R#`-rwKJ5pq{54U^zpWMdYop|UqZRq*M#+CuEAn$)Ibr=@rDI)hy|t?U zT_SgQ{<0lhlWDQqo;OVGs7-44q0yC&wJmt6_Y!$DccR?#_~CEPbbY!= zZ17yj<*Vg{qK2`{RIWb3vY2@8XPxH!yH$Q&p3Y-FcG3w^f3<$oayoyU25M`r|9q97 z|5p>H&sF(Pnhe&5dV4=*;(c@eyIfM+-%J(L_Urt-7Uq4ko!$bOUzs5f=&z}o##6+i zwciSxEMbGn$?eDY6ma|JO2? z{{^vV<=2j&6O@L^P4KU|{JnH0TKW6!vS1xYxO}d&x%>_!7Ongps(f)>6D&Ql{`@}4 zXys3hljZMMdAWT01}CC?w?+9CBW1=(D!<;C>wlR=`Iqqj+MtB>=QXUk{x_)dP0eq- ztIA)Z*1SR){gGPr5v_?;etshzrrL4x=xFxyPvE2ZZ$}jSd0lR{e}zT)`&Iek`WXx} z`;W(WwDMgEbb``jDlfNRclwyif5)Qyii>5&qm}=rMfv-ql;0yt`CnU|F9_kuC{c7l8zHx|6cSl*Pq|p#FFOtWn4m#(&=&&{A(`%V#*)Q|0`7a6I4zv z{|x$=%P*(=?TMShtkGMQujQ4RV19jkl|}if?IP>X_rbM3?U(CR{b>`HvQ_zyN;ScA zj^Li$;rkpcVlyk?#Tun_xe5Mt1oz}l9p#JWzuwCJ2}+***M~l4`}u!aL@Pi07|Vak zqWrm0%1?_@K7ZdX%2#&kO|2@ww+3qKFde^PQT{$vzDvn-{n?l1`tR1|(-zZXs(dZ4 z&zX<;_4v{JpU&@lq@?=^m(ObionP}d)NxtT+|Dah`8?(@Nv$#u^F);&WqAKRmEX*D ze$5>!zp47hPL+R!DgJBwb^flDKU)1=s{Z@v9uX(5{{Z^v{JQ>p?M5mhl3sT@O()Iv z^Rd}>R#xkkD$~W+g7oYR9hT6?Tt3|%idy~(pUhu*qTK4g=JGW+Z&@zZ_@>3o`Pe2_ z(vfFu@@`hd30uUfON!W{T>0`Ey$$JiC@q<4%j;z36HJ^BZAM2$LmPTbNXRc%XrbCx zE1sHnF1BXXN%|s;7`w`f>iV1*1VI z&xJ}pTgmqfog)3eg(JCJtK=7}GisSGj%>kiZ`4WJd_eNt?&)ffI#f9mUqLF zO{~bmkT|f(yUbxHzEb)Z^9^K5dR^b1{KECkPLh13+!$%Zxg95{W4ykziItE#0UMiG zp#Y#=zOUT|czA!{6-8vSL4U)uHZg-Ek^44-XV%DMiTg(kjV@Q%h> z6sG+HO1{Y?|AXSIO`M-A=63neq=z5#WByMQ=VuX_e{bTQ6i+t!^S6q3GjWIF{CW#a zrz@Uk;{3=PmwSncXDEJ^iDxO!*SDDXCF!ikgpFLq`5GCMOY!ihdgzrOiVs6!+8?F3 zc|=~Uc#TQ^3dN_Gc#+^{E9vOKxX-^FPJ@o4qE#)2=k;A<@SUJKrf>cjTzI7QmQ&x~=ZQhY*BdCbp) zaaymqqmMl1XT3Nj(WMvb*^n-eHNRBx3F=agpV8vt$*tk(OAU!q3y^Nqwiz!|-MSZX2POq~7f7$*Iz z@317%IEkj;#XQPo!B`9ViNrg={fFMN7$f+i1b%6P`?7+J4EMC63U}Dg&iO?Qg##`w zucVhMM9Pc~zN`UdoLS*I_&p7HJ|jK+y!>$oN|-h9Z#2Tr4-D5JUJemmK$;jS5VTPW zm~4!AQj4EfORJ!#zS0Jg8}yTcp(nY9I`gLIIS0Dkg`@JujJec3Z0yL~G5Hscbh}AB zLfZgY<$Py<{WP5V!3sTPH^$A6;RT;p>+c>QOQA>9qyf&1s1_WjPD`UBt=3N-wjzss z3b7R#TKPnxrDoxBex9!&BU3-Vsh@M?-b4?~<&C<4Jv}g|a!NHnELW8$I(Q}y0*l@g zK2oCgps1tC)XT^=EKI&vC8Dcl^otaV95Uf1NmUWUCfMmiuW$()HNo?;N~Xad*(3UK z3F5KQV1IQ&f3<3z;RP3-pHtv=S5;4R=esGgh}X+-6iO?|rKcAQatHDsr`UDUGqbdx zA^v8Hzx~AD{^IWd@s}Q?B^mMOZ1Gnp$PfxL1kVr(GK7K*p&&yj$PfxLM6L{>CPU=S z6nQg6-b|4GQc{62RE=o|LL@;q$=s7zy@Ke$Q zxAF+KL9u6RzXf0ab%cVIuQP|1(EEL=JksGuke5G02sv9kDsS-sd6c%{wTN+~$HQff zRd>(G%$@2fzS=WsxQE{91#dvgE8+THK*nd~)kv;>3m`@~@quH><&*hkR>8r>eJV>< zu;f|~{RY8P>7mymSyq-NvXZh%ZhG?(&A~?0huNjIVWT)#gagqB&SsnGwOnGz2Q8L{ zo;{|V&St8RLPCS!2r88d0~5 zYTL}w9D1qHt1GE{c!PzUtxgV5L&RJi%93{#o7azD=;qAe zSfW>TVi^*0RywRh_*Wm~zjSw&UJ8;6ODNVU9Q28HYtZn4uA-{kqUtGAm5s98e#7Vo zJ*C06${WS*3g*%N3j)>AGAEUIsI94!dnzl-%H5^v-F*DoJ!)&iQ$sJ*bGs|(jdR|~ z?&7Ie8`J3bn0H66PAJ zrL*6dsg>n3LUj-Cp<&`2IwYWI2?H_2o$2{ix@g%6Lg%Pc%Rv%4q58iweXMtKRsp@( z%{!G&7E3QtT{*Lo8F+DJiPyt&d4XM#-=T6VX#X+nM*m|u0i ze4Sv(ak3Sh8R|r+)=_Mbmj-;L(pnqX`!WtWv#7aE@6wajgk&5{! z4x?A%h2;v(KhpfH{3?uc5sSWz^kVUL#cKZjmfNd;tEXBu@>gFR(WqO}52JX3Izpp{ z+G$|e5Rw;Rt@Tn!Tljz!mr|`9kRe@JVU~$&$m2ImE0f*vCo0pml**2$Uj=KKD<|kN zoCl~Sy{o;^f1ep{1C8MZMct?%w z)?#X-$vw<96liI(D4`z+UQ1n_>lj>B;6$m%Nknoedo$xUJ25wFga zqnAoD%R8OyFg@(F*5DFTlqJ0zY6|B7a~XLh;eH64c(~MvAMHxT!z{8-s0-bEv4(Vk@P!EQ}792=0z{eNr5wb=8P`K z%R6tmcV>kr!m2DyqO1}_Ca6V{yWdb+^HBZCO-EQW1{YXoQ~i!wwctQKa_Cl*O4hLQ z%3=@cHMuL;^haFL_TvRnc+ZCwB6s|V3FVjvjeAm6xqGU($v_LZ;+i5i-8kUYoW8ZC zUOlYtyZ2RF{`zPdedxdGh@`)NWnKoHWjLAT=SnO%%5PGfzar>QAFcmQkS_=R74Qn+ z2Q2td^*xhWf0^QJ=QW^*|Jg4m=BWP;3;wBv{*LN957tvjA6+jeaMXXE1s`s~p9Wq9 z`nLl|{e9JQ32cuS@iu zfTKObfTKO5fulW_14nzN07rXfS@1c)(Vl04qdo5cUj*ajL*Taq{~Y)oz`q5K_4)xg z*2|VanJIDn96%o(2T~Ph|D!z);CF(2CUC4*7Vx`3J|8&7u`$5;S$b`c8#wyE9QZvT zUjzJJ;I+W-1AYf^wEqd6{2O^~C%tG^B=#FW)2aF2fuo*%z_Gsjfn$9S0)G(n zC#dI0xZK6S`vAv!Ie}xloDUrB9045dyaYJfSpgjN%mR+>H5WLxR}*k-uVuioUM~X2 zayJ6U_WB!eY_BhYqn?An(GU8OY;(LyXh)4fi8;1cC*X_eobD$l178As0PqFC3xK2l zOMv6N{}pi5e*ie@IShO*l-o9u4k(%H+tq^i0FLFR1IKddwSH0cj|aYtB(&eI2L2Fm ze!i6x+xakkw0xc79QV!!ejCU?0(=$lM}fZy{4wAk0LOLaCl>s7NtBrq+llg-inEZ2vxxNBesvlW~;T54X@q*SC-2 ztY;wb0U(d_)DYk}Zw>?gBy-)o1<*4U z_=~{#d0|dG%`BvkwsSi065uz3p4GtVHT@!Sz0eQ00-p`?i-Dtmo&=8b-3!3cKd%DE zcKIvtIZ*Dm7QAh$FkiGU+S%QLJ1uyz;^z1>734Ag&_B-=$t+)MA%6>SwDW%8=%0sy z<9xaTILfaEj`RKo;HYN@aFpK(9Od@_$8!H=!M_KNdJ;N>+6(oh0!R5g;MhM46leeQ zI}LRI9|!UnSFZ$)adk3qjH_k9(avSS(Viz1XM6aOaBUC0#a|>IUue%Oz|o#9z|o#h zfWHj-OX)duPOSfF`si|R1-=IOBfwVxe;xR8;QX9BC)WQAeYF11fTNzc6IfcxucWP( z?*$y~DFKep-hBTs-HoJXDoj(&I%IL5tKfun!k z0gm&?N5IiP`+;M-v;fC>q(kRWd!aoS0Z02UQJlv${}e;_=ZPS{2>4aNZwFop9LIG% zaI|v)aI|xY1z%~wH(GH1T?Ho|*Qh_|Hv&iSQ5L+&g8LOW&yP(Yzm$s7{=CmZeu;(r zlfcpb)fRfzf;^V{C*TXfp7(&`e6$-l_QQR^QT|`RQUCYAQ9ka(kpEGCd*CSF6*$WG z0FLtMz)?O6ILhY%M|u9e3n%VB$Zr9T<7k26+#k-Rk8bySK_17^GT^s^{FA_O96bjd z?fDw`9iYe7g$^jO{cGu??U?`^=a)NxW4v7f9P9f$@KvCH8*q$Qdw`>!gTOIP+D{^- zl-T~~>7(sW29AFCjRkiA$9nx9_zR$a0`M1sPf^@FkCXw&dE{Eqvl{f=3>^J12RM%R zyMUvAmI1#T^e+dF{@DN=+vU%|F+K-?qdkX#uY+dhY*9*)2H^^hTF{h9qC6-U4kM@58@biGD0M7<~lH%OYrvpC~ zj&ux<4c;&h3li;soG0F1iB8anS=f z+T#X}@uv#-TCnGJ;1~x^R2_`%#CiWr;8@=@;HyCYdBA4@zXCYwxdu4K!&$(e2R(Cu zqaSXy;CBPZdOZaE1-TqcT!4;{fXnNEpQxP{ea^*8lpJ2`v&@GKNo^Lw#((fH-h|)z@G;G z7;yB%YT)RH^@^MQ@EXXYAKn6ves~`^`k@*0<2<+@_69LLLK3x16SuT`Aw#CB`|`K4h00+3Gwei!ibfIkR48~Ed(e>(8x zAdl;rmp~rl)kferFTVjC<=+L4@*e|7`2cW~KL8x%4+BT}#GX`1O5A^NU2y_%ly?9} z{k?&sd?s+zKL|L==L1Lm7g_LIfMY*jpg8xR9Qx>felN&lKVJqM`}vc=v7bK&9PRuX zIK~rOFEWBsEPZf2GZr|;feFAd4pacgIIsvf#(`D9QN9H@t}8m6F3c2mqCbBFd=-gk zf1Uvx=jEZmQO~8oF@8<~{ygX}2abN8VZm<#j`f-c`~}dz5jd`wUR9jq|3Z-eGw>4N zAA+9M!1n-0KkNfO8{`iGNB{8ubLYhU2iHp}z|lY5fn&R*1D`{>bUR)I9POD59M?-T zfusBi;J6;x037|WU2*d`eGBAqoW2hn$LYtwah!e&9LM8f#m)13YH#+k^fUUuD{!3O zy}+NQeA=IP0Y^VP1|0qHjN)cLyae*-hmF9|53d17KkNpM)XMCcemhu6*t?H z0rF_iVBlzv3-qLc-!24x9`JF%vw=?l{nLSaKpxj=6(EmsvIh8E&{GE-<^8}>{tnwu&DHsH9vdJ{P6`3N}b`5ZXP{|h+k{~kEX$Mqp6QsQ|E_2&V< zh0f{mSfDuftMh@619^-;R|3cQGa2}kpr;Ht+S3FaDfo9$c)@@VHvz|qc) zz|qckfn%KfNb$B*rwvfA{UDEV@_XPICx6?QGE?Gqd73`j|K|Y5az_Hk_39$v7{~qy z9M@fc2af*y1o$ej=U>2Q0Z-*%L5b~0J-vXVA2NYIPkD5G2LW#co@>EJ0LOY=0{jKg z(+C{blZzDRcEt7My}(OA&!eCR*OSixM?b6rj`4OY@G{W9130cHKLn2c`4Tv`%MZYD zo;~R-DvT1h7uu5s9M_XWfuo*Ffuo)h3;rr_^v|Ca=kbf{ocBQ<$M46$ar_2=BZs4eY32>BO4jkoQ0FLsX z0muIKh2rM<;sD5Fe>)5u`&*nd)Lz)%+5<;B(}Az2th!%i14lcDD{i*)B9KQrF9nWv z76C^)y})sPxlwWRyw(KrWnllkz;RxC8Tiv6{{e6;_bcEyul36a`FRECxf(de{~Lg# zKW_$(^V&k-7(Z74M?G7CqaWS@j`P}wz_CBIK2h(*uL*u@Q;Bnp!_;c27qIn{}wpv{{cA4pU_{J z6>%NZ6*$VD4jk=C1CH_ofulV+z)^lAaFibh9OWB;V}F~cIQNI4;I}(Kei85ofZq=M z5#ZS0mIFsScK}}xdUgXxJNGKicIJWnHz1F89s+(l$j1zz14_JJLOVMFzk|-{{&TA0 z=6Nk0=qDR8V;mEv5lVNmW3AdmHG0FL!)1djDu0vzMdyTG4@az6!*b~Y={ zb`A&me}g>Q`6F<&(|$H(reyYiPvCdZdF}r!;5fhE0(?2h-wym4;12`G^}sgZD?$D} z;3%KUL6Z{O{~Ud^ou>guznuYm7071+$9ZZjaMW`ZaO`h2z@G>GwZL)Q&9&gS0mpjX z5Bvqt|2FU!fxoY~dHt{(IIbVQ06nWg&$qzQ4~Kwbe{MIBGE?GqLH~3Hj_U^paP$wo z;9DftgYA+79OwOufTKN=f#dq&df=#M0dUl_#DcH1;9mhpzx`Wr9>2J*XaRW~zwzgU z{D9*(1vti;u8OmMZX!J{93a0GcpnRSr-l4b;MiUT7JLkFoPVzXj`QOb;HbYGILcoS z9OdhQqx=HkD1SF_lz#*`$}b0w@@s&j{AS=N|0Zzs&tHI}{FjPz`=&uVehd6O;NJt! z25uij2b6exO{b6UC+!qx{kRV74Dwj7Q-GtLnTm7#c@^|e2YHNdHvxYQz%g#@0FLARBgNUynV{!$kiQoA*TAm>o;;WiD4FBc$-uGP^Ay+Zc!kVv3a`$;~?j|6#~FD?cC7m%L{9Q|Jb{0)$w4IJhDz_DHK1&;PF1CH(TgyP&T zPe8fPf;_g%Cg9jEJAq@n>;aDL@)dAwmjl563ikY{IQ#z(z}xZ7Zc5xw(Epu*@1%3O z|MUX>KJawl9{|q+j&=?Qj_q=E7j`I1yu^lf3j_p_k9NTfK;@pm#=%f2>1;}GN)&j?NyaPD4;}YQ5 zj!ywc|EvOz?YKs9ZpQ+!^Hq??c6c)H@;j$7!X{gVdr*p5ShV>^xkj_v3Mj_r6AaP&_laBRn!igP=T1UqMg zJhtNk;Mk5!fMYv81svOP6>zk3GjMFjKLW>g{1`aOe-0em@c?ja$HTy}9qs3nQz&se zzC<70j>(F1|G{=V1vs{2CU9)WA;7U6^MRv(E&`72c!}a|$es(qP7laqJ5~V4cB}=C z?dS)N?YIy)+PM@sw#yU1u^ra}NBK>_u^rzAj_vpXaBRnq73X%`3jPUzJhtN@;Mk5S zeA9;#w>!4uZ-HYw_5zOn=?fg&v7h2?NPi)HbbreMd2Gi5;Mk5=0LONm0vy}195~u} zBXDe&*}$J+bwBXGf&9b3(atTv@qWvDz)}A1!0~>?KY*kBAq$?!UxrbN zr4P!VWWj%L!3SFK3oQ5*7W^6uev<{i+k!uC!Pi*uH!S$a7W^9v-gcO9XM{id0)LZ4 z^tecf3CULgf6Rhk${mmrw-?I4Z^19M3GoQ|gBJY9#OU(NlcMuMP_K_jMAwV$ceUy5^`O-woccgtzEI*1qns;MJiS^DTgH7AMw&`uhti`DohL^5-jV z*8f}JH6TA+agHZ5f%Dpf6YIH_K3czrAtmjHALOA?s-PgkKimd8-f- z=U~;Z&H|413;>SyWGimA=M>;K(!MTN>u32{z>Af#wY);JjO?8cnYQnX$a?H$RxAQ|ZI$Dc~%h9xt%*JaCrRV|XX< zo>El&ja7bS9ld~Se=|QF_!S_}=bBWx9^hQAjwwyRS-wyOyr)cjvEn;TJUdAi9;@1i zb@0bXmOL3amusm0nhl)g9UY{6K5&-5Ny&SGv-||rsc!(z@+qQl!_fVO5Bal06i)XB zP4erM{1?C(P3TE~DE%8atC*_Vskdr>t>2+Kq7yjFpQQXX2{`B3kWPOnO#{yIE0p|V z;KCktLGU`A5*cMww_pEF7eZQZXXYSma zLdBl5=j?a5^L_XE-tT?i?|t9z=icvzJH7tK{JcCvr#xe+k-5{TVYp{x%F9G?nNeZP z7qpYGVCR#Klw|4@h@9S{NO?J z#=4v8HrCx-7ua~9bjC8nOzpTpvL6~P9lCLBZ0xw7e#n^89#lVD*C!r1aj#&QJODhC zZ;1NR8M{aoVZXX{Y!~IV3V&+0FV!&X{Z+%^S?_DjOLu=+D*gfoit3-#-j{qy&}T>= zAd)O2?l)5|Gr4h}IZRi|Ad8Kf!}V;rmjx?Z%N-#v){Xs?IzU$OzDzwZQ`2=+3?8g7 zldmb;P%Ne6f%-o~_rG-aN-_=k<9Mqy5ye}!{W{owYnX_o*qKShPbPHU;m}!TrY_43 zoyV-b-bb?k_Q5`zt8URD5TUb6fbbhVl#@0&9&`P=SvyS`UB#o1f zpS1lFe|_Sw91Sxf$FH!D7*)bFbIeo`xyc-Qy>#~_6e{FH;SCDbdwxp>;y_S?Eq;^d zl&&VLxOwnwBKK5qtlsbfDK#dV`cgN|n(j*;GE<+*M6qXd)zEL_B^h(LXjYjc;z5s- zmJ3e3n3q^@CXblkJ$9**ka&b*a8!%cff8S1rfTI)@+DnKIZ4f^Amt}^ofwpMTruVu z-L-SVQ0dT8Qq@c?FFsyP1vRcbr%pU)4o{*k8|HAe%&z6^`OE1?aFwi+2em+d@;3q+ zvCeOD);e4EHUHnfmi5EIz73Z6oyPYNzg-x=Ez@O$y&B(arf#8N9*f66S`6#)DC2m0 zI*!wl5?|yYGns}=Es0CqC)QKj@ZNCR;axfuq!>QVKXQDVsZ5-ouj71DR-8Zm=f*jY zqjBbsk6?eAfc}#9pYwm${-)fcwVQ{V#6IhAQ;C?Yl1B-dE{cbn+#;9TxQz!K=BE$7 zGl$4{eJl~v7_GasqKcwe{8GIozQIE!=HRVmM(NOZh*r}n*m0 znf$gvx7yj7g)o!YK0{#XrPEA_wN=NPnS4>~meSS3*Pi$8*cfdyb*v;`(tIh;G?SYZ z)mE8(Sg_8_khGV;nA+#hKUh%Btl1o>wyck`hg;{-jv{$EDa0-}y+2B}P6L zbJc!Ct!M-PF*xzDKc2p={3(9cHhifivv_4wkH$lNr3lw_T&Ki{^1MQG zD@CsiPyL8{mk3vQ%2eyV8nM1)!K@RHiJ`2YiRBOK7VdJU>N1)*F>USp}^K?S0Wr5xF!;e@D+$|+8pYP2e!w8{pG#XF?m0KsV@=_ z#UjCQV_zuTRUb`6;&bM@m%1yA{!nb7Zy+9Gpxigm916x7Lcw_NoVmv3vN56Ft^M(x zj993h@b#hK79x*@x(5P63hOg}sl31TS`sUP-e9CF912+EItW=AifszTq676&>dTHe zaUbZ9Mg~GgVt~80HDtttv7S&|6uUyZ*^0x~Ow~!SFzRu(LNrJ1E<^nAdK4 z_aU6^K;i}xDvHGWvCR7$@y4cf_uW(_80{WS1XA@SwA?HjJeD^!nyfF0XTQ%8Z*OuJ zX8F!Xyppk3H>^e2S8o}=db6$;`$>!bars_pu)ZWuy?U~jabubZ6?9Ve_#sSnUxLx=CA(+D`$)Xt zZePutB~hLI{!8uU&ieZ{Z41t`RtNEw#o-fl_v>F@ByQp@# zVSFiX`mTIqe;(~J-pMPZ;urEsKGmLA9WabX@?3Z48_(pKhVhWXFRG$e_vcL`(tpgG zX>B!a=0o&A_wBq(NArz0^N7mRPMqD^Ns6% zM@>oBsZ$A=-*6(&*iME2VlISs%%glk;d8~tq9uDujJxv6#)_%Gy#$QqZT>^C@mBsk zDnH=be6-jYDws>5t=M>|kjn=PH~&+y@l4S*RQ`R@g|8GFsbXUIcg4){AQ#ig zOo^8fG$Y8(v)(w-cE5;;wMiwt#EoS2NH1RE7%)fKC)h=G_k9G#b zOSmMfm(I;J6{UfAFy7bcZo4{{NqdARO$Rpa8@Knxd);mBYu%Q4a$}YR#os|qnzrkM z;qazl=N2KSCA~NZo!14!iO|w{Zf@b>gyM~=d^F4l{w*FP+nVJIp4D=A#Oc$CBO=tr?kksWv!97 zqb%>@iNz%&G*m7joG(ryFzY6leKx;-Qc)cd5XQ^f60W4g=Mjde-#CeBx$b(#C|T>~ z5Ed6ThQZIEvK{jsbj8mh-c1uWa^{^t1DC4z(#5HPf6_V(x&lm8H^E?j2f2>YBm4t2 z`74>ooY2VGa!GrVX()B^572foP1A&kVk`La3sg>jik9tUDq3;O1ANIax1 z)c3GJ|AbF-#(mZ{&%33?FFaEG5VyEk`=x?zW-&tPLgHD#1?+dy34# z;{0b6(|JUq{o%H@X}ZTXT(GBbuqgj|CSOT9F#YG4FQr@=_qdw4fk`c%lLDB2zo4e~ z4_5vS!>&CA=3rs|pzfmJf9wqDrz`v2>d60Y=I$&oTi)`nU_5A)ZyFdd1W+E>&|F1Rou?u*Q~R1Lx7B)T8WWMucwaQq7TVe$rj4+- zxiwI^usIs3kM{2jZVHDoE!twizW9KzwKCxKdK)Ue+l=y9lqIn)p7Pr4TMyl8g~}6= zaNm|tcqd|Moia0Sb$f&+e!)21)P}5z=J!8I99=%L9R)9XkU2=oF>LyuSF(z_tpbyfeCWD?R-f<&kJS zRNmCwKA&{$+@jitdIQ}tesC)9iA72Ovykq{H;gGZe3mJU$0w(9x+>`s;|Fr5_9oGA z!uGUVJ?-`_qIGurrZZ@-=VO%La0cx=Y~=IYb-MlUwQ0Zh4BBhwqW=CfXurcoe$N@S z-(}Oj)uz3hFrHq;9)@zAMpU7^Od~S4+#3ANg|;bD);7w!ezk$(_&bL#ZI9`SnCEAf zucm8-(hDN1AXTH5f;1hkJqvC>89}%)!6y(i4C&JsA|dn zW0kc2+JA=#V_k|Yj9Zj^v4^F4ovij7r3yRwz5KR=(k|6emVYi?R{3ucW+%Uli77S6 zEd6Vh{~M~YlYi_c*+h>+md{V5R{2v%xSjkCC132hB`fi3l|PXh+sW@xkC7);Tb9q? zJ6Yui9OUZv78VbJL~yY5b?up8gqD`*kS!U*$?j zZYXo{SE{|s!oaNrR9NWUmiu2&dpr9bv$5Y5)Yhv1M3T!YTIF|~ru<@RZztdEkcz5I z?4PbA$SQwO7#@ zBMq0otp!*rbUO{lReQ>^(x__xnkBHc{+c*S4ejhd+94^XtM=UgPtv8^YxQ_dvWO53 zA5bp}hAfI%_2+vFiD>U;VU&(ckoh%~Ev3sU{}Y7S$v;^m+clQTT>o0-YuuVMU4ilT zm=))Hm)J?=*0_v`xuBpI@9=Z#Tw>&O0Dy`Ykl~nKObT?5^S4W^;Mw#m6#X*g zm|0Nm5-TnMROI(1%zv+f{ZQ>Pc!kVOF0pcD)O04*1n2)xYryalgQ_>&gAN#W01@Kp*w zV8L4z{(TF6gTnvSf(I0CfsHPO^WFzjpTgBPHC+`^xHpZ+!hpi(TkstU-)_NgS9rGt z|BS#PSXKSM3B1rkEpJ_h{RxDNBGfLqC=%_G%XX&aII&wn7lM@^o6rZ;o=r5p-+wouNfZs~^Oqf5r6#vf?emTr16$*dSf&N9pr^5QE z`MmCczoYPe#dn6vCs8Qa>3<&KGhsg0&o}c3zdV1oYMt39m=1hC?SSugz`x;uzv_UW zLm_LY|Ah{CIpJ)#lVTjpa|-UvgAVjBIN-l`z>8?8*y(eb13u3I?{L6(5YGCyP&{(t za~4j2RQNvfGbdiZIc=nuQA}S!`f}3vVTJFbcATnYX1q!G<*(Cu%WRgTMT|>RW&dtb zUrhx%o0l=ssyM)^Xj)~8CDqlpHOcbnIuqbhA<)>~T;Jwf z-5dzmajTKvD)@2^F6cz2Ex<=M)#6JCUvq19phile(;BJ3B3lLiOqPy1=XOyaQk_8) zd0=%04bJfJ%8|1;I;!g1+V8LQw1(pJZJ$06<4;ZK6iA$lrH$+f)U?K9eUTnAaxPc6@8*Y?`J%F}#DuJ!JaA8xBp8ie+Q zdpxH2cDl7Q+8^>%(pS#(jfaH14zW*ba$lq?ur@S6Q#Fk-o9_keOzNp=OMg}^XY=e? zw*uA{n!efPl@%>9QY#kUsh100QfSes$V9&~l(ML&Hp`CU1NF4!6it<|1ZS0}!Rf2?vuxNL(Vhk5cJa0R$1kZ}eUATeORCqCNltHVt*;%PLoLE29l6$x zj*MLLar&Dg;vU()H9LMQt7#Xe;?ftfM5UZ^?B&`=N@WG@*6HJ`L}xr23&iy&TuNr{ z$6X%YXKBr4^ohwsLmm$e1s`z?@{D6I(^KK250~igBxrULBfLgVCt}#@71XO&EYAWt zP3zCggb~w|lciGZQL~I92Y7m5TIg-mB?qLZLOHIrFg=6RkO#74c>8Ge&2%DX>d7^u zWZdY`jQ6Gi*y(y(s{*`nCIbZ)wf6Nyg7HKwL_2I}H`Qn#XtQNzotzK$JeAa;`Y`Q; zn&}fQ{(KMmlG)BX3tLE&a6B5{*&oW4mSb>|rMLf%qFTr@vb*WAKw7DX4Dt1#Fp=d! z!b{tr)`euLnt-o$0excFS{Lxr-iMlcs-#T*i=J3C%z{0vwOBgp;`GF_DIvaGlu|tl zwTd>@R$)-v7>#v?s5h2gq%{^!vlT;2V%I=4&@0wey6M~z4A7#wqc2WR)cOR9U!VBt z`hflg(fTR8)z^@1TAqV_nz>&}6fZqUoehoP4 z$$uuoiTj0mPFC+otoHE$j`mpwINE0u;HalQ$7TN5-^YO-@q>UPpYH>X{Vh=MJ+1o7 zbERDW%5x%#qyC)^e6|3NcKaOQsORH=W4{hL;6Dc(`5Xlt`+F{TloDrrhNR=R5^(+m zN#o6c-wb#s;3zi+INIlL0q0LVH2<#w-U0YG0Y^K$1b7hWe+2j@z)RJ8VRk>Ct}daA z)A@j3LHAmpO97t+_-uuD1~~fVe!$T$Uj-cf@*LpkmlAcZ!~H_POai=v>a<@j0v!EvCE)0n3c%40+ZAs0 z%N>BDUxoljzuXJ_(Jx;BdhWWO#~uZG)aR>!qhJ0(;hgn=9g5DO8%k`q&2(w|OaZ(X z@Cv}uzh1z%0DUXqD**2R9Q_zkIP2K}^xJ^m3;3OYHv;}J;41)s3UHMB&kEOm)OPqO z;ONJn1CD^P1swT*0Qi+aUqt7IoY-H;e+uAhs7~|05O9o#D!_5P zELJ$%e=G2526`MX>i~}c{mp5d$!gDHg)@H~cT<5L^|=UewDT&!(a!A-_y)i~O|rEgHv=96JO(&_`=IG}DxCe; z2l!n;&(C$5{yxAHfIkNKHo%_-9OudXfTMjz0pAXMegHW3>n93l`(Fk0zW{n%FOCDg z1L)rdd?(=V1OM587t%R3Cyoc?e=*?bM>pW;uL{7iU$uavzphg_`>TsC?UyE?M}Msc z9Q`!}_$|Ok{|}zs;n0HC#kIY%uqPzgr0KQt`%m??kJO^^pdVU~pjj+lYM?3J?;l%iS zy0o6RGf2s*=WYq-@YjB^^1mPG*;bnW-zeP5|I0ux_Py%jCv zV}}#txc@(2pb|H!toiU7$4T3BiHa+h#mU;=8VL&=^;xEHt3KREPK^8L(sDI_#&O>0 zq!wV zOqCgDf9Z6SDrlTzofAJJaAJItD9N9%s50X^#u$1T@F}Xy**k!r3%HvVr^I~t(#dbZ z`&C64@bfe=FT-4u*>vJW>n4ZTBr>89R`up)`0cZNp3Tpaa*8u0D z{;vEe;7tFhqMxV+Dp&KRzc-&}!B6tQq*M(!^Vu&@I=ca!`RMP&Lx3~=_Y}Q8Z_;x0 Sci;C}=-*WI-vS)R`~Lz3D*!|Q diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberosgss.o b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberosgss.o deleted file mode 100644 index 2f1b25f42ff835318e876d934b929af55526cbdd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16448 zcmb_i4Rn;%nf^i&hyqU5b!#lPOl$BYZjBj0z@ODjl7VmP1UQ5gwiYMDWFk2vlQ=&t zh^b*SQ~5efn>~wN+MeS^_jsDRxaG8KPhkBSH4-@L9#-8hTRe)kMMkLqB5G~+dGF86 zJ74nkbh~@;oBQ48zW4pR?|tw6ZoJzUSUIb#%+RIGxXCECG-?=Q3ySYe;dBw?25h8W`~x)DU7?9s8}eu}R;fL@frJ>6~f#MqQ~k2z#6aK4DZ8`~223 zu2c(PGvgZ#WGiW$-}>)>_4Yv`J46E>r?)_M@KH0nX*^(UsR~%NwMw@@_?ucwpp*WS?9%YZS9W@V`?fHgrFm>nYNr37XHwjd~ymUV11J_M zvVD)HbFTE~q3xOPnc2T0ZwaOH5Bz>=ssz{%V1(wM=BnM?b@n`HQ<#fKR$#Pg-PEP8tG~x%LoFrh#B$4t6RK^@o3ed zRhaVA2oD`xerqBz05wR0-#X5f2v~0gtTzOqh}2@ZBPbIK0#;|$Bn_J~cTJFY#FTA% z+O-htK)4oi&%=#UR7Sj?IqF*2r29q3nZGU0ulBd!`dxcr%@t)M*tOcG^>o6c&5(+k zR!h}nIq4&bh9{~_>$p;?+qJM2PGeJk=E-h3zgUToX1xf3jiwc=HYb~_V2xo;Qh1_j zu2HpH*1nUf7ILI8%XiYuh}CCiZ>ch~$&+Sw@a2FNIc;XD1&LffR~N031K~;kq)1AL z`bKEW<2}>%vQ8;dbL*+o74X@;y_^(^D7d@5y>5E_00XH{#E&`&K$nkNL&Oh z&w5@ktyd)d@XjhDG2hI_VZz{9#balUnVw3_m#xVb>5a@zcL^$dGlOxL6pX98m11K^ z_)f=%@3_|U_)K&n9ya)`DVZ{%`ukXk`@q7?-0e0eeWQZgq;E{s2UI;S>Vnq($yIKN zoJd?Sbc5kaKSU`r>l^iF*1*(FdyxbW_%ds%eV!bx#MW9`W0?Ea+B$j(SY5S{*IFx# z4_Kd=R%Zp{qe`N&JL@EGdwtMB<2Q? zCe@Z=W(LQ|ua$yPTl$IAUg!2f#F)^SbsvV}dyS9;ketbKc?4 z%98g7vdMk^%yOUSD4BJX)TJFqm?iaAS_iE6paA?yLZl5MTwUomi9GAeLDD{O5JWj5 zGOec&X1j%&g4TM=A`=`exroffj4Rw81 zL;gNNh5RtXoSimHbowet%}htm%-&gs-C7!lQ&XumfJPD=qAAUwzo9#xoQ&MFBN%Uv#t~v8yHUt(rE5N8xcNVx&)U7>b5 zm)roWaz4+mz48D<0cc^A3;~4oIh~3B)7)6GF$6irA zLK-6y0$G7081V0ffVH$%`xN2OX=VgnX+->pd@%f&Fp_dzAt+#vD}~$vOWKZfnM>vg zcOf2J=_d)@H9>A=!7-A_k~TAi#seSl&=@J~Gmnt%T16N|Mw(&a3uR*dL9zOWAdy^3 zYAUB7U9ph44)O4Z;$``?coA%-uUDM@{nlqXdY;9xqsg4a^g{fkw@TG2PkY6F1Kh3f zI#oBSdIi-@yYB!CuPHI#F;yR@S}1`88L&%kS3ouQ2HhBaKenL`MzGJ37z$A}h zjl*d;z8o((z9eqSv`yIEfBMSzneWA?AF2GZRNn>^OpCGQ);s zRn&S9k~0p%orQ@L8;mPmi4GP&;N&*5?bx&B{-&o{QC|vb6$dlUn=7>d6kcqBByYO9 zbYA3Mxdq=%eaFdTINrfo)i!yrA&!Q2HkCoGszCOZn&Rm|?XriINxsXl8GDCM&Jv!N z+NL&R^i0k@`Yv;>+NrQlO`nBP5W+cy{HV2~2}$>Zd;U56$o+Jt@tq}tt_3aMf$}c_ z5a;Fp_4#plXSF<2Ru|8d!#isvR>Lv3#4xGFvu9n&DYFhUg;lz_TiA+vKu2`ZKb zXwBlrGd&Ix{}1O=`~JHfJHZOE-lfH3P=Tv<})O`Pyst)gT8?IC*zB+Ik#fh{p zhfu2a91U1+>hCZSEQyW9a|%vj>YPC7x-j{k6WD`u*f-upY|pUyE-4ogzrDCX=|g)Y zfbHC${ifU%=oEttSSJpLlQK(WTI!k)S2SX^U;6WIqHXy_O@NeZRY6>d3#6&OCg(jV|$e@&v# zJLz+8MDZT>)#Ap(hpvHZw#GJJ8xEsYWsV1<{aul*kr-Ol=J@7FtUn&yxDl-yY=ZK5 z4cWW@4klR2x@^aoI8l70G)rCz9{_qCw+vd@RGtPLCSO+iq;wtn@4e+VD+B~?r-yKROwgk;XcO)b6gu6RtT2(Qa#P9T2x4Ur|+*fhjY3PUKe!^_s{IxE(uGAFi1q z(j4SsI^d0&*|q~_ro9F!mcG^~%ho`EQQS^IZ8uF7`#{PM z!jJMiFo?)`PmGjKiDckGbuTMNz$x)Jxl;zU+!B`mNk*xainWZqG=_*Uv8J`_v8?b} zlCLLa*ixM_N)pxjq=B%=&$a1)=5^n?b!*mL?_LzY&}fVF^~ZL&L%qHI;ZUNdKkDud z_4G!%j79OfMe%wAR1H_fjoah#U{Bvbe=HG*9mSE!=-q6co3a6A&*7KsI+@c@l;>hFPDXY3c*ED;nQn`yl2SI(WzU-di6SN&4{ zs+N}P-E|$ClhH)dy|iIP!{Vzw*Cj>MQ!fEh66F$E8D)2_Gs?DCmo1n#r)mUAiW24J zs?Vg_dr|ebX0^9!yl$Cm7{srw?Sy_f!m5me&f>R*(wXy@Jv(qEu_%twd`MSI+Vi+f_tMdgSm>IYmF3ws}u^ z>u|-aj8tGNRXz-;1<5-^hk_Mfq=!wjb`q62w-dj_w}$jYxfpwHk?(iQzbXxcee;FV zE#OP^rlOB>`wISO9iB7m$r8P{EBYlk&=mNul>YPWnT-METZMq;xke*M#uWV%oWAut z<=G0~p32tY*|Xl1R?d2e>XmcJ)|b_o3%E{X>xoiZan~fuEwfQ+AC~C;I1PX%C=Kx) zeTmR!)QOm^x9GQ6q&L(ca!CU%KciuDJZ?0^`l&(Wo(4~8bA@gi4dMR2KCCyRA=;ma zG^|?PadkWq3U37gF^y~qcE>1l{hx~)9LODHDlbi{vGsEtHH_-grm+C+3L8evwO32< z*q_OIJ}Qz^C7WVB(d(6X2&b^(<)3YGbsy34La|0X|J3mwj3u6n@$jPMzt2IuYx%lv zQkZ@G=%sStI$0Hdwf%bh8Z};pT!BtI==mZd-t7M0pvKdh;N^L7vNH_&HsD3e)paL2 z^*g6~PmSjoz1wM%3bX5fUX5?Gb!huF-vPYL6hH2pC52lFr1-fIj~=hpqwuoNJ&mlR zz(l!QR)t@?{?xXqC}_7VR6{P1^+l*CR_*esdnWl?>g2fBY{uE;ORDL=L|0+FEAB(> zz2(zpK~j{@s0rz3Q$jH;H!AI{@wa>ON13r!^@#lp@0TfDJ4@_az$m_men2@v>`}m$ z;wdxc7za>O`GTyBX4Hg_sJ6yQ9^nHD*Y3Yf;nYt>)6;wTw5(+qy}*f2BN3oz`aAJX zc(p)__-=(OxX@4Sa?sCI$_*71w$5@9p{3yWM02{If2i=>&1u^T}<`z5o#Sf zx{vDlAe{;Sq65Cj0l&%tU+#e4oSu*oep^10l(7$|F#2uzXMKxEuKlAr+|~6 zPpZ5j=g%-+b)Y}xfPdnEUx=hm{Ew;B_hU6_b--uR=Vk|dtpnbn_z$V2EzZS|5p$rw z#{vJL1HRt@KjeTPalnrOCqIluLx3kOMyKfbVs{f8v1WfRjGew85c>ZvfPI4tUxD{|5*BUmWm99Pq~-@E09$1NY40h8b544PkMu z5sAh6V@5yj8)8BEF7H1Q+f_3d>`q3*!C=GkYnLxESnImQthKChId3gq%3DjW?! z%d+LmjD|onVILCX({{2%n6RP&^Xcob2w7#Ed>Yc3a6{;pE#R3F+iu zUnCw6-5wzkiC9;1z!3f2u}H*5Fzx1t-@IUKZzL+FHA9l#`DvuQW!LN~DbggP{54HqXuMc*#`_=_ld)s_}#6_WW2)mvv za52}kuW$CY`&xrw_cedZbZ(C76lYCO58Wd=l8b9R5n*IU;l5QM1ECm#SIn-uAzilA z2>15KBQhq#;b1Hh@9*7KY!j27P;bwjMW_pZaf$WsU|~!PC)_g->SY+e{GH*3HW}^h ziEcH(NiIxsozRhA&Po6m$wEciY*6U?l?u|JxYNTewkYZ|Rp9mL)A%AHMj?9oJCeqi z5Qu_pTHIA?yjh@;>wT2)28J)h zxr_?&p{pD%_eO==`K)F5HH>}>!#V#SI`AK7^jy#97|!{hWPIq#M(g<-Mo-`U8h_V; z{+t8-e~<%E?DoFQ@J94&{*^d)P$7D{o6`6t4CnK8gTjd&*MAkG=lb93K;P*=zl-7Y zjj8qddxmp;{)yoftD1hC;dD2k@fQ_t*Z(-9=lU-q$DmNP43Fm1sBro+U(Rro(XU|m zZ4Br7e@o${58W|o{#l08ozs3iRDQ;A?*B&_f3E*ohF_2In!mn^q3#kQ|1eP7|EKi#ov`ca0HKLdEEJj?iSf1YPJ_vf5>avbTyC-pugXm!N?{{JB007|!)+S2)Ghm+)x*4>EdwZu~i; zU%==eV>nHnj>FRo|1zWhl;QkbBtD)&NBZ-8@&)>+Mj^ZjkJfV;!?{2G4CnEDJHx-h z`0QYK9m9thzKP-YD4hIu1;a-f&h2`T@!@tIV)$*0&$EnAEyG`6IQd!o;eCd4x#t;w zF1PY?7>q*xT!KgQSbeM z?Nj|4*MCQ!u;KdeWFOdY{r9cQ%VdYBTjs|F>@Qnr#nDcNoXy%3Tb zlg1k!!UymXNc27Q#zYe@^jZ@<-|S4g40DBFvUAS)&d1Hl~Rma=<}J` z@>nDED(f=MUvsO0SMwQv5!9Po(X#$)+@|cah6-89VUK_z`UdIig+Wl#CLQN3eul_o z^B4%FNOZ<@M~jpZ5~^0*^=lxqmL-Y#afH=+E=c|=Nz89aTZs=!(WHJiZjc`}PnthT zxnlm<{lb(77znl)yMu0L$Ytt(UN$-|Q_(;6Snq$1ILxo&NEP@hi^^H>i-TYdvg9aFk;Z# zf~~I|;RoUwWbC6%7$(j%|0&{4^KZ%XyNhBm=<~;1M^wc1vfqbCNNHHc6=NNyodhqN z(TZ8eZfz7`F?4ktme>Ikul~wWpJg~%XDH-cZ2jupzDT_OHlP~L_2t+)ZIA@K*`_)V zC2x}i#G6iXkv>y>k9gF{k_6Oxwn#VeY+F3kyi#HA;;ekOA50WpGIyppH' to 'Local' - Local info[2] = { Nan::Null(), result}; - ^~~~~~ -/Users/christkv/.node-gyp/0.10.35/deps/v8/include/v8.h:269:26: note: candidate constructor (the implicit copy constructor) not viable: cannot bind base class object of type 'Handle' to derived class reference 'const v8::Local &' for 1st argument -template class Local : public Handle { - ^ -/Users/christkv/.node-gyp/0.10.35/deps/v8/include/v8.h:272:29: note: candidate template ignored: could not match 'Local' against 'Handle' - template inline Local(Local that) - ^ -/Users/christkv/.node-gyp/0.10.35/deps/v8/include/v8.h:281:29: note: candidate template ignored: could not match 'S *' against 'Handle' - template inline Local(S* that) : Handle(that) { } - ^ -1 error generated. -make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1 -gyp ERR! build error -gyp ERR! stack Error: `make` failed with exit code: 2 -gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) -gyp ERR! stack at ChildProcess.emit (events.js:98:17) -gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12) -gyp ERR! System Darwin 14.3.0 -gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" -gyp ERR! cwd /Users/christkv/coding/projects/kerberos -gyp ERR! node -v v0.10.35 -gyp ERR! node-gyp -v v1.0.1 -gyp ERR! not ok diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js deleted file mode 100644 index b8c85327..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js +++ /dev/null @@ -1,6 +0,0 @@ -// Get the Kerberos library -module.exports = require('./lib/kerberos'); -// Set up the auth processes -module.exports['processes'] = { - MongoAuthProcess: require('./lib/auth_processes/mongodb').MongoAuthProcess -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js deleted file mode 100644 index f1e9231a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js +++ /dev/null @@ -1,281 +0,0 @@ -var format = require('util').format; - -var MongoAuthProcess = function(host, port, service_name) { - // Check what system we are on - if(process.platform == 'win32') { - this._processor = new Win32MongoProcessor(host, port, service_name); - } else { - this._processor = new UnixMongoProcessor(host, port, service_name); - } -} - -MongoAuthProcess.prototype.init = function(username, password, callback) { - this._processor.init(username, password, callback); -} - -MongoAuthProcess.prototype.transition = function(payload, callback) { - this._processor.transition(payload, callback); -} - -/******************************************************************* - * - * Win32 SSIP Processor for MongoDB - * - *******************************************************************/ -var Win32MongoProcessor = function(host, port, service_name) { - this.host = host; - this.port = port - // SSIP classes - this.ssip = require("../kerberos").SSIP; - // Set up first transition - this._transition = Win32MongoProcessor.first_transition(this); - // Set up service name - service_name = service_name || "mongodb"; - // Set up target - this.target = format("%s/%s", service_name, host); - // Number of retries - this.retries = 10; -} - -Win32MongoProcessor.prototype.init = function(username, password, callback) { - var self = this; - // Save the values used later - this.username = username; - this.password = password; - // Aquire credentials - this.ssip.SecurityCredentials.aquire_kerberos(username, password, function(err, security_credentials) { - if(err) return callback(err); - // Save credentials - self.security_credentials = security_credentials; - // Callback with success - callback(null); - }); -} - -Win32MongoProcessor.prototype.transition = function(payload, callback) { - if(this._transition == null) return callback(new Error("Transition finished")); - this._transition(payload, callback); -} - -Win32MongoProcessor.first_transition = function(self) { - return function(payload, callback) { - self.ssip.SecurityContext.initialize( - self.security_credentials, - self.target, - payload, function(err, security_context) { - if(err) return callback(err); - - // If no context try again until we have no more retries - if(!security_context.hasContext) { - if(self.retries == 0) return callback(new Error("Failed to initialize security context")); - // Update the number of retries - self.retries = self.retries - 1; - // Set next transition - return self.transition(payload, callback); - } - - // Set next transition - self._transition = Win32MongoProcessor.second_transition(self); - self.security_context = security_context; - // Return the payload - callback(null, security_context.payload); - }); - } -} - -Win32MongoProcessor.second_transition = function(self) { - return function(payload, callback) { - // Perform a step - self.security_context.initialize(self.target, payload, function(err, security_context) { - if(err) return callback(err); - - // If no context try again until we have no more retries - if(!security_context.hasContext) { - if(self.retries == 0) return callback(new Error("Failed to initialize security context")); - // Update the number of retries - self.retries = self.retries - 1; - // Set next transition - self._transition = Win32MongoProcessor.first_transition(self); - // Retry - return self.transition(payload, callback); - } - - // Set next transition - self._transition = Win32MongoProcessor.third_transition(self); - // Return the payload - callback(null, security_context.payload); - }); - } -} - -Win32MongoProcessor.third_transition = function(self) { - return function(payload, callback) { - var messageLength = 0; - // Get the raw bytes - var encryptedBytes = new Buffer(payload, 'base64'); - var encryptedMessage = new Buffer(messageLength); - // Copy first byte - encryptedBytes.copy(encryptedMessage, 0, 0, messageLength); - // Set up trailer - var securityTrailerLength = encryptedBytes.length - messageLength; - var securityTrailer = new Buffer(securityTrailerLength); - // Copy the bytes - encryptedBytes.copy(securityTrailer, 0, messageLength, securityTrailerLength); - - // Types used - var SecurityBuffer = self.ssip.SecurityBuffer; - var SecurityBufferDescriptor = self.ssip.SecurityBufferDescriptor; - - // Set up security buffers - var buffers = [ - new SecurityBuffer(SecurityBuffer.DATA, encryptedBytes) - , new SecurityBuffer(SecurityBuffer.STREAM, securityTrailer) - ]; - - // Set up the descriptor - var descriptor = new SecurityBufferDescriptor(buffers); - - // Decrypt the data - self.security_context.decryptMessage(descriptor, function(err, security_context) { - if(err) return callback(err); - - var length = 4; - if(self.username != null) { - length += self.username.length; - } - - var bytesReceivedFromServer = new Buffer(length); - bytesReceivedFromServer[0] = 0x01; // NO_PROTECTION - bytesReceivedFromServer[1] = 0x00; // NO_PROTECTION - bytesReceivedFromServer[2] = 0x00; // NO_PROTECTION - bytesReceivedFromServer[3] = 0x00; // NO_PROTECTION - - if(self.username != null) { - var authorization_id_bytes = new Buffer(self.username, 'utf8'); - authorization_id_bytes.copy(bytesReceivedFromServer, 4, 0); - } - - self.security_context.queryContextAttributes(0x00, function(err, sizes) { - if(err) return callback(err); - - var buffers = [ - new SecurityBuffer(SecurityBuffer.TOKEN, new Buffer(sizes.securityTrailer)) - , new SecurityBuffer(SecurityBuffer.DATA, bytesReceivedFromServer) - , new SecurityBuffer(SecurityBuffer.PADDING, new Buffer(sizes.blockSize)) - ] - - var descriptor = new SecurityBufferDescriptor(buffers); - - self.security_context.encryptMessage(descriptor, 0x80000001, function(err, security_context) { - if(err) return callback(err); - callback(null, security_context.payload); - }); - }); - }); - } -} - -/******************************************************************* - * - * UNIX MIT Kerberos processor - * - *******************************************************************/ -var UnixMongoProcessor = function(host, port, service_name) { - this.host = host; - this.port = port - // SSIP classes - this.Kerberos = require("../kerberos").Kerberos; - this.kerberos = new this.Kerberos(); - service_name = service_name || "mongodb"; - // Set up first transition - this._transition = UnixMongoProcessor.first_transition(this); - // Set up target - this.target = format("%s@%s", service_name, host); - // Number of retries - this.retries = 10; -} - -UnixMongoProcessor.prototype.init = function(username, password, callback) { - var self = this; - this.username = username; - this.password = password; - // Call client initiate - this.kerberos.authGSSClientInit( - self.target - , this.Kerberos.GSS_C_MUTUAL_FLAG, function(err, context) { - self.context = context; - // Return the context - callback(null, context); - }); -} - -UnixMongoProcessor.prototype.transition = function(payload, callback) { - if(this._transition == null) return callback(new Error("Transition finished")); - this._transition(payload, callback); -} - -UnixMongoProcessor.first_transition = function(self) { - return function(payload, callback) { - self.kerberos.authGSSClientStep(self.context, '', function(err, result) { - if(err) return callback(err); - // Set up the next step - self._transition = UnixMongoProcessor.second_transition(self); - // Return the payload - callback(null, self.context.response); - }) - } -} - -UnixMongoProcessor.second_transition = function(self) { - return function(payload, callback) { - self.kerberos.authGSSClientStep(self.context, payload, function(err, result) { - if(err && self.retries == 0) return callback(err); - // Attempt to re-establish a context - if(err) { - // Adjust the number of retries - self.retries = self.retries - 1; - // Call same step again - return self.transition(payload, callback); - } - - // Set up the next step - self._transition = UnixMongoProcessor.third_transition(self); - // Return the payload - callback(null, self.context.response || ''); - }); - } -} - -UnixMongoProcessor.third_transition = function(self) { - return function(payload, callback) { - // GSS Client Unwrap - self.kerberos.authGSSClientUnwrap(self.context, payload, function(err, result) { - if(err) return callback(err, false); - - // Wrap the response - self.kerberos.authGSSClientWrap(self.context, self.context.response, self.username, function(err, result) { - if(err) return callback(err, false); - // Set up the next step - self._transition = UnixMongoProcessor.fourth_transition(self); - // Return the payload - callback(null, self.context.response); - }); - }); - } -} - -UnixMongoProcessor.fourth_transition = function(self) { - return function(payload, callback) { - // Clean up context - self.kerberos.authGSSClientClean(self.context, function(err, result) { - if(err) return callback(err, false); - // Set the transition to null - self._transition = null; - // Callback with valid authentication - callback(null, true); - }); - } -} - -// Set the process -exports.MongoAuthProcess = MongoAuthProcess; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c deleted file mode 100644 index aca0a61c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#include "base64.h" - -#include -#include -#include -#include - -void die2(const char *message) { - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -// base64 tables -static char basis_64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static signed char index_64[128] = -{ - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, - 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, - 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, - -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, - 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 -}; -#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) - -// base64_encode : base64 encode -// -// value : data to encode -// vlen : length of data -// (result) : new char[] - c-str of result -char *base64_encode(const unsigned char *value, int vlen) -{ - char *result = (char *)malloc((vlen * 4) / 3 + 5); - if(result == NULL) die2("Memory allocation failed"); - char *out = result; - while (vlen >= 3) - { - *out++ = basis_64[value[0] >> 2]; - *out++ = basis_64[((value[0] << 4) & 0x30) | (value[1] >> 4)]; - *out++ = basis_64[((value[1] << 2) & 0x3C) | (value[2] >> 6)]; - *out++ = basis_64[value[2] & 0x3F]; - value += 3; - vlen -= 3; - } - if (vlen > 0) - { - *out++ = basis_64[value[0] >> 2]; - unsigned char oval = (value[0] << 4) & 0x30; - if (vlen > 1) oval |= value[1] >> 4; - *out++ = basis_64[oval]; - *out++ = (vlen < 2) ? '=' : basis_64[(value[1] << 2) & 0x3C]; - *out++ = '='; - } - *out = '\0'; - - return result; -} - -// base64_decode : base64 decode -// -// value : c-str to decode -// rlen : length of decoded result -// (result) : new unsigned char[] - decoded result -unsigned char *base64_decode(const char *value, int *rlen) -{ - *rlen = 0; - int c1, c2, c3, c4; - - int vlen = strlen(value); - unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1); - if(result == NULL) die2("Memory allocation failed"); - unsigned char *out = result; - - while (1) - { - if (value[0]==0) - return result; - c1 = value[0]; - if (CHAR64(c1) == -1) - goto base64_decode_error;; - c2 = value[1]; - if (CHAR64(c2) == -1) - goto base64_decode_error;; - c3 = value[2]; - if ((c3 != '=') && (CHAR64(c3) == -1)) - goto base64_decode_error;; - c4 = value[3]; - if ((c4 != '=') && (CHAR64(c4) == -1)) - goto base64_decode_error;; - - value += 4; - *out++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4); - *rlen += 1; - if (c3 != '=') - { - *out++ = ((CHAR64(c2) << 4) & 0xf0) | (CHAR64(c3) >> 2); - *rlen += 1; - if (c4 != '=') - { - *out++ = ((CHAR64(c3) << 6) & 0xc0) | CHAR64(c4); - *rlen += 1; - } - } - } - -base64_decode_error: - *result = 0; - *rlen = 0; - return result; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h deleted file mode 100644 index 9152e6a3..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ -#ifndef BASE64_H -#define BASE64_H - -char *base64_encode(const unsigned char *value, int vlen); -unsigned char *base64_decode(const char *value, int *rlen); - -#endif \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc deleted file mode 100644 index 5b25d74b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc +++ /dev/null @@ -1,893 +0,0 @@ -#include "kerberos.h" -#include -#include -#include "worker.h" -#include "kerberos_context.h" - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) -#endif - -void die(const char *message) { - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -// Call structs -typedef struct AuthGSSClientCall { - uint32_t flags; - char *uri; -} AuthGSSClientCall; - -typedef struct AuthGSSClientStepCall { - KerberosContext *context; - char *challenge; -} AuthGSSClientStepCall; - -typedef struct AuthGSSClientUnwrapCall { - KerberosContext *context; - char *challenge; -} AuthGSSClientUnwrapCall; - -typedef struct AuthGSSClientWrapCall { - KerberosContext *context; - char *challenge; - char *user_name; -} AuthGSSClientWrapCall; - -typedef struct AuthGSSClientCleanCall { - KerberosContext *context; -} AuthGSSClientCleanCall; - -typedef struct AuthGSSServerInitCall { - char *service; - bool constrained_delegation; - char *username; -} AuthGSSServerInitCall; - -typedef struct AuthGSSServerCleanCall { - KerberosContext *context; -} AuthGSSServerCleanCall; - -typedef struct AuthGSSServerStepCall { - KerberosContext *context; - char *auth_data; -} AuthGSSServerStepCall; - -Kerberos::Kerberos() : Nan::ObjectWrap() { -} - -Nan::Persistent Kerberos::constructor_template; - -void Kerberos::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("Kerberos").ToLocalChecked()); - - // Set up method for the Kerberos instance - Nan::SetPrototypeMethod(t, "authGSSClientInit", AuthGSSClientInit); - Nan::SetPrototypeMethod(t, "authGSSClientStep", AuthGSSClientStep); - Nan::SetPrototypeMethod(t, "authGSSClientUnwrap", AuthGSSClientUnwrap); - Nan::SetPrototypeMethod(t, "authGSSClientWrap", AuthGSSClientWrap); - Nan::SetPrototypeMethod(t, "authGSSClientClean", AuthGSSClientClean); - Nan::SetPrototypeMethod(t, "authGSSServerInit", AuthGSSServerInit); - Nan::SetPrototypeMethod(t, "authGSSServerClean", AuthGSSServerClean); - Nan::SetPrototypeMethod(t, "authGSSServerStep", AuthGSSServerStep); - - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("Kerberos").ToLocalChecked(), t->GetFunction()); -} - -NAN_METHOD(Kerberos::New) { - // Create a Kerberos instance - Kerberos *kerberos = new Kerberos(); - // Return the kerberos object - kerberos->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientInit -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientInit(Worker *worker) { - gss_client_state *state; - gss_client_response *response; - - // Allocate state - state = (gss_client_state *)malloc(sizeof(gss_client_state)); - if(state == NULL) die("Memory allocation failed"); - - // Unpack the parameter data struct - AuthGSSClientCall *call = (AuthGSSClientCall *)worker->parameters; - // Start the kerberos client - response = authenticate_gss_client_init(call->uri, call->flags, state); - - // Release the parameter struct memory - free(call->uri); - free(call); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - free(state); - } else { - worker->return_value = state; - } - - // Free structure - free(response); -} - -static Local _map_authGSSClientInit(Worker *worker) { - KerberosContext *context = KerberosContext::New(); - context->state = (gss_client_state *)worker->return_value; - return context->handle(); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientInit) { - // Ensure valid call - if(info.Length() != 3) return Nan::ThrowError("Requires a service string uri, integer flags and a callback function"); - if(info.Length() == 3 && (!info[0]->IsString() || !info[1]->IsInt32() || !info[2]->IsFunction())) - return Nan::ThrowError("Requires a service string uri, integer flags and a callback function"); - - Local service = info[0]->ToString(); - // Convert uri string to c-string - char *service_str = (char *)calloc(service->Utf8Length() + 1, sizeof(char)); - if(service_str == NULL) die("Memory allocation failed"); - - // Write v8 string to c-string - service->WriteUtf8(service_str); - - // Allocate a structure - AuthGSSClientCall *call = (AuthGSSClientCall *)calloc(1, sizeof(AuthGSSClientCall)); - if(call == NULL) die("Memory allocation failed"); - call->flags =info[1]->ToInt32()->Uint32Value(); - call->uri = service_str; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[2]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientInit; - worker->mapper = _map_authGSSClientInit; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientStep -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientStep(Worker *worker) { - gss_client_state *state; - gss_client_response *response; - char *challenge; - - // Unpack the parameter data struct - AuthGSSClientStepCall *call = (AuthGSSClientStepCall *)worker->parameters; - // Get the state - state = call->context->state; - challenge = call->challenge; - - // Check what kind of challenge we have - if(call->challenge == NULL) { - challenge = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_client_step(state, challenge); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->challenge != NULL) free(call->challenge); - free(call); - free(response); -} - -static Local _map_authGSSClientStep(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientStep) { - // Ensure valid call - if(info.Length() != 2 && info.Length() != 3) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 2 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 3 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - - // Challenge string - char *challenge_str = NULL; - // Let's unpack the parameters - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - int callbackArg = 1; - - // If we have a challenge string - if(info.Length() == 3) { - // Unpack the challenge string - Local challenge = info[1]->ToString(); - // Convert uri string to c-string - challenge_str = (char *)calloc(challenge->Utf8Length() + 1, sizeof(char)); - if(challenge_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - challenge->WriteUtf8(challenge_str); - - callbackArg = 2; - } - - // Allocate a structure - AuthGSSClientStepCall *call = (AuthGSSClientStepCall *)calloc(1, sizeof(AuthGSSClientStepCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->challenge = challenge_str; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[callbackArg]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientStep; - worker->mapper = _map_authGSSClientStep; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientUnwrap -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientUnwrap(Worker *worker) { - gss_client_response *response; - char *challenge; - - // Unpack the parameter data struct - AuthGSSClientUnwrapCall *call = (AuthGSSClientUnwrapCall *)worker->parameters; - challenge = call->challenge; - - // Check what kind of challenge we have - if(call->challenge == NULL) { - challenge = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_client_unwrap(call->context->state, challenge); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->challenge != NULL) free(call->challenge); - free(call); - free(response); -} - -static Local _map_authGSSClientUnwrap(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientUnwrap) { - // Ensure valid call - if(info.Length() != 2 && info.Length() != 3) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 2 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 3 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - - // Challenge string - char *challenge_str = NULL; - // Let's unpack the parameters - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - // If we have a challenge string - if(info.Length() == 3) { - // Unpack the challenge string - Local challenge = info[1]->ToString(); - // Convert uri string to c-string - challenge_str = (char *)calloc(challenge->Utf8Length() + 1, sizeof(char)); - if(challenge_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - challenge->WriteUtf8(challenge_str); - } - - // Allocate a structure - AuthGSSClientUnwrapCall *call = (AuthGSSClientUnwrapCall *)calloc(1, sizeof(AuthGSSClientUnwrapCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->challenge = challenge_str; - - // Unpack the callback - Local callbackHandle = info.Length() == 3 ? Local::Cast(info[2]) : Local::Cast(info[1]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientUnwrap; - worker->mapper = _map_authGSSClientUnwrap; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientWrap -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientWrap(Worker *worker) { - gss_client_response *response; - char *user_name = NULL; - - // Unpack the parameter data struct - AuthGSSClientWrapCall *call = (AuthGSSClientWrapCall *)worker->parameters; - user_name = call->user_name; - - // Check what kind of challenge we have - if(call->user_name == NULL) { - user_name = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_client_wrap(call->context->state, call->challenge, user_name); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->challenge != NULL) free(call->challenge); - if(call->user_name != NULL) free(call->user_name); - free(call); - free(response); -} - -static Local _map_authGSSClientWrap(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientWrap) { - // Ensure valid call - if(info.Length() != 3 && info.Length() != 4) return Nan::ThrowError("Requires a GSS context, the result from the authGSSClientResponse after authGSSClientUnwrap, optional user name and callback function"); - if(info.Length() == 3 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsFunction())) return Nan::ThrowError("Requires a GSS context, the result from the authGSSClientResponse after authGSSClientUnwrap, optional user name and callback function"); - if(info.Length() == 4 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsString() || !info[3]->IsFunction())) return Nan::ThrowError("Requires a GSS context, the result from the authGSSClientResponse after authGSSClientUnwrap, optional user name and callback function"); - - // Challenge string - char *challenge_str = NULL; - char *user_name_str = NULL; - - // Let's unpack the kerberos context - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - // Unpack the challenge string - Local challenge = info[1]->ToString(); - // Convert uri string to c-string - challenge_str = (char *)calloc(challenge->Utf8Length() + 1, sizeof(char)); - if(challenge_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - challenge->WriteUtf8(challenge_str); - - // If we have a user string - if(info.Length() == 4) { - // Unpack user name - Local user_name = info[2]->ToString(); - // Convert uri string to c-string - user_name_str = (char *)calloc(user_name->Utf8Length() + 1, sizeof(char)); - if(user_name_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - user_name->WriteUtf8(user_name_str); - } - - // Allocate a structure - AuthGSSClientWrapCall *call = (AuthGSSClientWrapCall *)calloc(1, sizeof(AuthGSSClientWrapCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->challenge = challenge_str; - call->user_name = user_name_str; - - // Unpack the callback - Local callbackHandle = info.Length() == 4 ? Local::Cast(info[3]) : Local::Cast(info[2]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientWrap; - worker->mapper = _map_authGSSClientWrap; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientClean -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientClean(Worker *worker) { - gss_client_response *response; - - // Unpack the parameter data struct - AuthGSSClientCleanCall *call = (AuthGSSClientCleanCall *)worker->parameters; - - // Perform authentication step - response = authenticate_gss_client_clean(call->context->state); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - free(call); - free(response); -} - -static Local _map_authGSSClientClean(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientClean) { - // Ensure valid call - if(info.Length() != 2) return Nan::ThrowError("Requires a GSS context and callback function"); - if(!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction()) return Nan::ThrowError("Requires a GSS context and callback function"); - - // Let's unpack the kerberos context - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - // Allocate a structure - AuthGSSClientCleanCall *call = (AuthGSSClientCleanCall *)calloc(1, sizeof(AuthGSSClientCleanCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[1]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientClean; - worker->mapper = _map_authGSSClientClean; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSServerInit -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSServerInit(Worker *worker) { - gss_server_state *state; - gss_client_response *response; - - // Allocate state - state = (gss_server_state *)malloc(sizeof(gss_server_state)); - if(state == NULL) die("Memory allocation failed"); - - // Unpack the parameter data struct - AuthGSSServerInitCall *call = (AuthGSSServerInitCall *)worker->parameters; - // Start the kerberos service - response = authenticate_gss_server_init(call->service, call->constrained_delegation, call->username, state); - - // Release the parameter struct memory - free(call->service); - free(call->username); - free(call); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - free(state); - } else { - worker->return_value = state; - } - - // Free structure - free(response); -} - -static Local _map_authGSSServerInit(Worker *worker) { - KerberosContext *context = KerberosContext::New(); - context->server_state = (gss_server_state *)worker->return_value; - return context->handle(); -} - -// Server Initialize method -NAN_METHOD(Kerberos::AuthGSSServerInit) { - // Ensure valid call - if(info.Length() != 4) return Nan::ThrowError("Requires a service string, constrained delegation boolean, a username string (or NULL) for S4U2Self protocol transition and a callback function"); - - if(!info[0]->IsString() || - !info[1]->IsBoolean() || - !(info[2]->IsString() || info[2]->IsNull()) || - !info[3]->IsFunction() - ) return Nan::ThrowError("Requires a service string, constrained delegation boolean, a username string (or NULL) for S4U2Self protocol transition and a callback function"); - - if (!info[1]->BooleanValue() && !info[2]->IsNull()) return Nan::ThrowError("S4U2Self only possible when constrained delegation is enabled"); - - // Allocate a structure - AuthGSSServerInitCall *call = (AuthGSSServerInitCall *)calloc(1, sizeof(AuthGSSServerInitCall)); - if(call == NULL) die("Memory allocation failed"); - - Local service = info[0]->ToString(); - // Convert service string to c-string - char *service_str = (char *)calloc(service->Utf8Length() + 1, sizeof(char)); - if(service_str == NULL) die("Memory allocation failed"); - - // Write v8 string to c-string - service->WriteUtf8(service_str); - - call->service = service_str; - - call->constrained_delegation = info[1]->BooleanValue(); - - if (info[2]->IsNull()) - { - call->username = NULL; - } - else - { - Local tmpString = info[2]->ToString(); - - char *tmpCstr = (char *)calloc(tmpString->Utf8Length() + 1, sizeof(char)); - if(tmpCstr == NULL) die("Memory allocation failed"); - - tmpString->WriteUtf8(tmpCstr); - - call->username = tmpCstr; - } - - // Unpack the callback - Local callbackHandle = Local::Cast(info[3]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSServerInit; - worker->mapper = _map_authGSSServerInit; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSServerClean -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSServerClean(Worker *worker) { - gss_client_response *response; - - // Unpack the parameter data struct - AuthGSSServerCleanCall *call = (AuthGSSServerCleanCall *)worker->parameters; - - // Perform authentication step - response = authenticate_gss_server_clean(call->context->server_state); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - free(call); - free(response); -} - -static Local _map_authGSSServerClean(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSServerClean) { - // // Ensure valid call - if(info.Length() != 2) return Nan::ThrowError("Requires a GSS context and callback function"); - if(!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction()) return Nan::ThrowError("Requires a GSS context and callback function"); - - // Let's unpack the kerberos context - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsServerInstance()) { - return Nan::ThrowError("GSS context is not a server instance"); - } - - // Allocate a structure - AuthGSSServerCleanCall *call = (AuthGSSServerCleanCall *)calloc(1, sizeof(AuthGSSServerCleanCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[1]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSServerClean; - worker->mapper = _map_authGSSServerClean; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSServerStep -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSServerStep(Worker *worker) { - gss_server_state *state; - gss_client_response *response; - char *auth_data; - - // Unpack the parameter data struct - AuthGSSServerStepCall *call = (AuthGSSServerStepCall *)worker->parameters; - // Get the state - state = call->context->server_state; - auth_data = call->auth_data; - - // Check if we got auth_data or not - if(call->auth_data == NULL) { - auth_data = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_server_step(state, auth_data); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->auth_data != NULL) free(call->auth_data); - free(call); - free(response); -} - -static Local _map_authGSSServerStep(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSServerStep) { - // Ensure valid call - if(info.Length() != 3) return Nan::ThrowError("Requires a GSS context, auth-data string and callback function"); - if(!KerberosContext::HasInstance(info[0])) return Nan::ThrowError("1st arg must be a GSS context"); - if (!info[1]->IsString()) return Nan::ThrowError("2nd arg must be auth-data string"); - if (!info[2]->IsFunction()) return Nan::ThrowError("3rd arg must be a callback function"); - - // Auth-data string - char *auth_data_str = NULL; - // Let's unpack the parameters - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsServerInstance()) { - return Nan::ThrowError("GSS context is not a server instance"); - } - - // Unpack the auth_data string - Local auth_data = info[1]->ToString(); - // Convert uri string to c-string - auth_data_str = (char *)calloc(auth_data->Utf8Length() + 1, sizeof(char)); - if(auth_data_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - auth_data->WriteUtf8(auth_data_str); - - // Allocate a structure - AuthGSSServerStepCall *call = (AuthGSSServerStepCall *)calloc(1, sizeof(AuthGSSServerStepCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->auth_data = auth_data_str; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[2]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSServerStep; - worker->mapper = _map_authGSSServerStep; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// UV Lib callbacks -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void Kerberos::Process(uv_work_t* work_req) { - // Grab the worker - Worker *worker = static_cast(work_req->data); - // Execute the worker code - worker->execute(worker); -} - -void Kerberos::After(uv_work_t* work_req) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Get the worker reference - Worker *worker = static_cast(work_req->data); - - // If we have an error - if(worker->error) { - Local err = v8::Exception::Error(Nan::New(worker->error_message).ToLocalChecked()); - Local obj = err->ToObject(); - obj->Set(Nan::New("code").ToLocalChecked(), Nan::New(worker->error_code)); - Local info[2] = { err, Nan::Null() }; - // Execute the error - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } else { - // // Map the data - Local result = worker->mapper(worker); - // Set up the callback with a null first - #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - Local info[2] = { Nan::Null(), result}; - #else - Local info[2] = { Nan::Null(), Nan::New(result)}; - #endif - - // Wrap the callback function call in a TryCatch so that we can call - // node's FatalException afterwards. This makes it possible to catch - // the exception from JavaScript land using the - // process.on('uncaughtException') event. - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } - - // Clean up the memory - delete worker->callback; - delete worker; -} - -// Exporting function -NAN_MODULE_INIT(init) { - Kerberos::Initialize(target); - KerberosContext::Initialize(target); -} - -NODE_MODULE(kerberos, init); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h deleted file mode 100644 index beafa4d8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef KERBEROS_H -#define KERBEROS_H - -#include -#include -#include -#include - -#include "nan.h" -#include -#include - -extern "C" { - #include "kerberosgss.h" -} - -using namespace v8; -using namespace node; - -class Kerberos : public Nan::ObjectWrap { - -public: - Kerberos(); - ~Kerberos() {}; - - // Constructor used for creating new Kerberos objects from C++ - static Nan::Persistent constructor_template; - - // Initialize function for the object - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - - // Method available - static NAN_METHOD(AuthGSSClientInit); - static NAN_METHOD(AuthGSSClientStep); - static NAN_METHOD(AuthGSSClientUnwrap); - static NAN_METHOD(AuthGSSClientWrap); - static NAN_METHOD(AuthGSSClientClean); - static NAN_METHOD(AuthGSSServerInit); - static NAN_METHOD(AuthGSSServerClean); - static NAN_METHOD(AuthGSSServerStep); - -private: - static NAN_METHOD(New); - // Handles the uv calls - static void Process(uv_work_t* work_req); - // Called after work is done - static void After(uv_work_t* work_req); -}; - -#endif diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js deleted file mode 100644 index c7bae583..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js +++ /dev/null @@ -1,164 +0,0 @@ -var kerberos = require('../build/Release/kerberos') - , KerberosNative = kerberos.Kerberos; - -var Kerberos = function() { - this._native_kerberos = new KerberosNative(); -} - -// callback takes two arguments, an error string if defined and a new context -// uri should be given as service@host. Services are not always defined -// in a straightforward way. Use 'HTTP' for SPNEGO / Negotiate authentication. -Kerberos.prototype.authGSSClientInit = function(uri, flags, callback) { - return this._native_kerberos.authGSSClientInit(uri, flags, callback); -} - -// This will obtain credentials using a credentials cache. To override the default -// location (posible /tmp/krb5cc_nnnnnn, where nnnn is your numeric uid) use -// the environment variable KRB5CNAME. -// The credentials (suitable for using in an 'Authenticate: ' header, when prefixed -// with 'Negotiate ') will be available as context.response inside the callback -// if no error is indicated. -// callback takes one argument, an error string if defined -Kerberos.prototype.authGSSClientStep = function(context, challenge, callback) { - if(typeof challenge == 'function') { - callback = challenge; - challenge = ''; - } - - return this._native_kerberos.authGSSClientStep(context, challenge, callback); -} - -Kerberos.prototype.authGSSClientUnwrap = function(context, challenge, callback) { - if(typeof challenge == 'function') { - callback = challenge; - challenge = ''; - } - - return this._native_kerberos.authGSSClientUnwrap(context, challenge, callback); -} - -Kerberos.prototype.authGSSClientWrap = function(context, challenge, user_name, callback) { - if(typeof user_name == 'function') { - callback = user_name; - user_name = ''; - } - - return this._native_kerberos.authGSSClientWrap(context, challenge, user_name, callback); -} - -// free memory used by a context created using authGSSClientInit. -// callback takes one argument, an error string if defined. -Kerberos.prototype.authGSSClientClean = function(context, callback) { - return this._native_kerberos.authGSSClientClean(context, callback); -} - -// The server will obtain credentials using a keytab. To override the -// default location (probably /etc/krb5.keytab) set the KRB5_KTNAME -// environment variable. -// The service name should be in the form service, or service@host.name -// e.g. for HTTP, use "HTTP" or "HTTP@my.host.name". See gss_import_name -// for GSS_C_NT_HOSTBASED_SERVICE. -// -// a boolean turns on "constrained_delegation". this enables acquisition of S4U2Proxy -// credentials which will be stored in a credentials cache during the authGSSServerStep -// method. this parameter is optional. -// -// when "constrained_delegation" is enabled, a username can (optionally) be provided and -// S4U2Self protocol transition will be initiated. In this case, we will not -// require any "auth" data during the authGSSServerStep. This parameter is optional -// but constrained_delegation MUST be enabled for this to work. When S4U2Self is -// used, the username will be assumed to have been already authenticated, and no -// actual authentication will be performed. This is basically a way to "bootstrap" -// kerberos credentials (which can then be delegated with S4U2Proxy) for a user -// authenticated externally. -// -// callback takes two arguments, an error string if defined and a new context -// -Kerberos.prototype.authGSSServerInit = function(service, constrained_delegation, username, callback) { - if(typeof(constrained_delegation) === 'function') { - callback = constrained_delegation; - constrained_delegation = false; - username = null; - } - - if (typeof(constrained_delegation) === 'string') { - throw new Error("S4U2Self protocol transation is not possible without enabling constrained delegation"); - } - - if (typeof(username) === 'function') { - callback = username; - username = null; - } - - constrained_delegation = !!constrained_delegation; - - return this._native_kerberos.authGSSServerInit(service, constrained_delegation, username, callback); -}; - -//callback takes one argument, an error string if defined. -Kerberos.prototype.authGSSServerClean = function(context, callback) { - return this._native_kerberos.authGSSServerClean(context, callback); -}; - -// authData should be the base64 encoded authentication data obtained -// from client, e.g., in the Authorization header (without the leading -// "Negotiate " string) during SPNEGO authentication. The authenticated user -// is available in context.username after successful authentication. -// callback takes one argument, an error string if defined. -// -// Note: when S4U2Self protocol transition was requested in the authGSSServerInit -// no actual authentication will be performed and authData will be ignored. -// -Kerberos.prototype.authGSSServerStep = function(context, authData, callback) { - return this._native_kerberos.authGSSServerStep(context, authData, callback); -}; - -Kerberos.prototype.acquireAlternateCredentials = function(user_name, password, domain) { - return this._native_kerberos.acquireAlternateCredentials(user_name, password, domain); -} - -Kerberos.prototype.prepareOutboundPackage = function(principal, inputdata) { - return this._native_kerberos.prepareOutboundPackage(principal, inputdata); -} - -Kerberos.prototype.decryptMessage = function(challenge) { - return this._native_kerberos.decryptMessage(challenge); -} - -Kerberos.prototype.encryptMessage = function(challenge) { - return this._native_kerberos.encryptMessage(challenge); -} - -Kerberos.prototype.queryContextAttribute = function(attribute) { - if(typeof attribute != 'number' && attribute != 0x00) throw new Error("Attribute not supported"); - return this._native_kerberos.queryContextAttribute(attribute); -} - -// Some useful result codes -Kerberos.AUTH_GSS_CONTINUE = 0; -Kerberos.AUTH_GSS_COMPLETE = 1; - -// Some useful gss flags -Kerberos.GSS_C_DELEG_FLAG = 1; -Kerberos.GSS_C_MUTUAL_FLAG = 2; -Kerberos.GSS_C_REPLAY_FLAG = 4; -Kerberos.GSS_C_SEQUENCE_FLAG = 8; -Kerberos.GSS_C_CONF_FLAG = 16; -Kerberos.GSS_C_INTEG_FLAG = 32; -Kerberos.GSS_C_ANON_FLAG = 64; -Kerberos.GSS_C_PROT_READY_FLAG = 128; -Kerberos.GSS_C_TRANS_FLAG = 256; - -// Export Kerberos class -exports.Kerberos = Kerberos; - -// If we have SSPI (windows) -if(kerberos.SecurityCredentials) { - // Put all SSPI classes in it's own namespace - exports.SSIP = { - SecurityCredentials: require('./win32/wrappers/security_credentials').SecurityCredentials - , SecurityContext: require('./win32/wrappers/security_context').SecurityContext - , SecurityBuffer: require('./win32/wrappers/security_buffer').SecurityBuffer - , SecurityBufferDescriptor: require('./win32/wrappers/security_buffer_descriptor').SecurityBufferDescriptor - } -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc deleted file mode 100644 index bf241185..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc +++ /dev/null @@ -1,134 +0,0 @@ -#include "kerberos_context.h" - -Nan::Persistent KerberosContext::constructor_template; - -KerberosContext::KerberosContext() : Nan::ObjectWrap() { - state = NULL; - server_state = NULL; -} - -KerberosContext::~KerberosContext() { -} - -KerberosContext* KerberosContext::New() { - Nan::HandleScope scope; - Local obj = Nan::New(constructor_template)->GetFunction()->NewInstance(); - KerberosContext *kerberos_context = Nan::ObjectWrap::Unwrap(obj); - return kerberos_context; -} - -NAN_METHOD(KerberosContext::New) { - // Create code object - KerberosContext *kerberos_context = new KerberosContext(); - // Wrap it - kerberos_context->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -void KerberosContext::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(static_cast(New)); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("KerberosContext").ToLocalChecked()); - - // Get prototype - Local proto = t->PrototypeTemplate(); - - // Getter for the response - Nan::SetAccessor(proto, Nan::New("response").ToLocalChecked(), KerberosContext::ResponseGetter); - - // Getter for the username - Nan::SetAccessor(proto, Nan::New("username").ToLocalChecked(), KerberosContext::UsernameGetter); - - // Getter for the targetname - server side only - Nan::SetAccessor(proto, Nan::New("targetname").ToLocalChecked(), KerberosContext::TargetnameGetter); - - Nan::SetAccessor(proto, Nan::New("delegatedCredentialsCache").ToLocalChecked(), KerberosContext::DelegatedCredentialsCacheGetter); - - // Set persistent - constructor_template.Reset(t); - // NanAssignPersistent(constructor_template, t); - - // Set the symbol - target->ForceSet(Nan::New("KerberosContext").ToLocalChecked(), t->GetFunction()); -} - - -// Response Setter / Getter -NAN_GETTER(KerberosContext::ResponseGetter) { - gss_client_state *client_state; - gss_server_state *server_state; - - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - // Response could come from client or server state... - client_state = context->state; - server_state = context->server_state; - - // If client state is in use, take response from there, otherwise from server - char *response = client_state != NULL ? client_state->response : - server_state != NULL ? server_state->response : NULL; - - if(response == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - // Return the response - info.GetReturnValue().Set(Nan::New(response).ToLocalChecked()); - } -} - -// username Getter -NAN_GETTER(KerberosContext::UsernameGetter) { - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - gss_client_state *client_state = context->state; - gss_server_state *server_state = context->server_state; - - // If client state is in use, take response from there, otherwise from server - char *username = client_state != NULL ? client_state->username : - server_state != NULL ? server_state->username : NULL; - - if(username == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - info.GetReturnValue().Set(Nan::New(username).ToLocalChecked()); - } -} - -// targetname Getter - server side only -NAN_GETTER(KerberosContext::TargetnameGetter) { - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - gss_server_state *server_state = context->server_state; - - char *targetname = server_state != NULL ? server_state->targetname : NULL; - - if(targetname == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - info.GetReturnValue().Set(Nan::New(targetname).ToLocalChecked()); - } -} - -// targetname Getter - server side only -NAN_GETTER(KerberosContext::DelegatedCredentialsCacheGetter) { - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - gss_server_state *server_state = context->server_state; - - char *delegated_credentials_cache = server_state != NULL ? server_state->delegated_credentials_cache : NULL; - - if(delegated_credentials_cache == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - info.GetReturnValue().Set(Nan::New(delegated_credentials_cache).ToLocalChecked()); - } -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h deleted file mode 100644 index 23eb5778..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef KERBEROS_CONTEXT_H -#define KERBEROS_CONTEXT_H - -#include -#include -#include -#include - -#include "nan.h" -#include -#include - -extern "C" { - #include "kerberosgss.h" -} - -using namespace v8; -using namespace node; - -class KerberosContext : public Nan::ObjectWrap { - -public: - KerberosContext(); - ~KerberosContext(); - - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - inline bool IsClientInstance() { - return state != NULL; - } - - inline bool IsServerInstance() { - return server_state != NULL; - } - - // Constructor used for creating new Kerberos objects from C++ - static Nan::Persistent constructor_template; - - // Initialize function for the object - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - - // Public constructor - static KerberosContext* New(); - - // Handle to the kerberos client context - gss_client_state *state; - - // Handle to the kerberos server context - gss_server_state *server_state; - -private: - static NAN_METHOD(New); - // In either client state or server state - static NAN_GETTER(ResponseGetter); - static NAN_GETTER(UsernameGetter); - // Only in the "server_state" - static NAN_GETTER(TargetnameGetter); - static NAN_GETTER(DelegatedCredentialsCacheGetter); -}; -#endif diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c deleted file mode 100644 index 2fbca00c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c +++ /dev/null @@ -1,931 +0,0 @@ -/** - * Copyright (c) 2006-2010 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **/ -/* - * S4U2Proxy implementation - * Copyright (C) 2015 David Mansfield - * Code inspired by mod_auth_kerb. - */ - -#include "kerberosgss.h" - -#include "base64.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -void die1(const char *message) { - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -static gss_client_response *gss_error(const char *func, const char *op, OM_uint32 err_maj, OM_uint32 err_min); -static gss_client_response *other_error(const char *fmt, ...); -static gss_client_response *krb5_ctx_error(krb5_context context, krb5_error_code problem); - -static gss_client_response *store_gss_creds(gss_server_state *state); -static gss_client_response *create_krb5_ccache(gss_server_state *state, krb5_context context, krb5_principal princ, krb5_ccache *ccache); - -/* -char* server_principal_details(const char* service, const char* hostname) -{ - char match[1024]; - int match_len = 0; - char* result = NULL; - - int code; - krb5_context kcontext; - krb5_keytab kt = NULL; - krb5_kt_cursor cursor = NULL; - krb5_keytab_entry entry; - char* pname = NULL; - - // Generate the principal prefix we want to match - snprintf(match, 1024, "%s/%s@", service, hostname); - match_len = strlen(match); - - code = krb5_init_context(&kcontext); - if (code) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot initialize Kerberos5 context", code)); - return NULL; - } - - if ((code = krb5_kt_default(kcontext, &kt))) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot get default keytab", code)); - goto end; - } - - if ((code = krb5_kt_start_seq_get(kcontext, kt, &cursor))) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot get sequence cursor from keytab", code)); - goto end; - } - - while ((code = krb5_kt_next_entry(kcontext, kt, &entry, &cursor)) == 0) - { - if ((code = krb5_unparse_name(kcontext, entry.principal, &pname))) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot parse principal name from keytab", code)); - goto end; - } - - if (strncmp(pname, match, match_len) == 0) - { - result = malloc(strlen(pname) + 1); - strcpy(result, pname); - krb5_free_unparsed_name(kcontext, pname); - krb5_free_keytab_entry_contents(kcontext, &entry); - break; - } - - krb5_free_unparsed_name(kcontext, pname); - krb5_free_keytab_entry_contents(kcontext, &entry); - } - - if (result == NULL) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Principal not found in keytab", -1)); - } - -end: - if (cursor) - krb5_kt_end_seq_get(kcontext, kt, &cursor); - if (kt) - krb5_kt_close(kcontext, kt); - krb5_free_context(kcontext); - - return result; -} -*/ -gss_client_response *authenticate_gss_client_init(const char* service, long int gss_flags, gss_client_state* state) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; - gss_client_response *response = NULL; - int ret = AUTH_GSS_COMPLETE; - - state->server_name = GSS_C_NO_NAME; - state->context = GSS_C_NO_CONTEXT; - state->gss_flags = gss_flags; - state->username = NULL; - state->response = NULL; - - // Import server name first - name_token.length = strlen(service); - name_token.value = (char *)service; - - maj_stat = gss_import_name(&min_stat, &name_token, gss_krb5_nt_service_name, &state->server_name); - - if (GSS_ERROR(maj_stat)) { - response = gss_error(__func__, "gss_import_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - -end: - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - return response; -} - -gss_client_response *authenticate_gss_client_clean(gss_client_state *state) { - OM_uint32 min_stat; - int ret = AUTH_GSS_COMPLETE; - gss_client_response *response = NULL; - - if(state->context != GSS_C_NO_CONTEXT) - gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); - - if(state->server_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &state->server_name); - - if(state->username != NULL) { - free(state->username); - state->username = NULL; - } - - if (state->response != NULL) { - free(state->response); - state->response = NULL; - } - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - return response; -} - -gss_client_response *authenticate_gss_client_step(gss_client_state* state, const char* challenge) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_CONTINUE; - gss_client_response *response = NULL; - - // Always clear out the old response - if (state->response != NULL) { - free(state->response); - state->response = NULL; - } - - // If there is a challenge (data from the server) we need to give it to GSS - if (challenge && *challenge) { - int len; - input_token.value = base64_decode(challenge, &len); - input_token.length = len; - } - - // Do GSSAPI step - maj_stat = gss_init_sec_context(&min_stat, - GSS_C_NO_CREDENTIAL, - &state->context, - state->server_name, - GSS_C_NO_OID, - (OM_uint32)state->gss_flags, - 0, - GSS_C_NO_CHANNEL_BINDINGS, - &input_token, - NULL, - &output_token, - NULL, - NULL); - - if ((maj_stat != GSS_S_COMPLETE) && (maj_stat != GSS_S_CONTINUE_NEEDED)) { - response = gss_error(__func__, "gss_init_sec_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - ret = (maj_stat == GSS_S_COMPLETE) ? AUTH_GSS_COMPLETE : AUTH_GSS_CONTINUE; - // Grab the client response to send back to the server - if(output_token.length) { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); - maj_stat = gss_release_buffer(&min_stat, &output_token); - } - - // Try to get the user name if we have completed all GSS operations - if (ret == AUTH_GSS_COMPLETE) { - gss_name_t gssuser = GSS_C_NO_NAME; - maj_stat = gss_inquire_context(&min_stat, state->context, &gssuser, NULL, NULL, NULL, NULL, NULL, NULL); - - if(GSS_ERROR(maj_stat)) { - response = gss_error(__func__, "gss_inquire_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - gss_buffer_desc name_token; - name_token.length = 0; - maj_stat = gss_display_name(&min_stat, gssuser, &name_token, NULL); - - if(GSS_ERROR(maj_stat)) { - if(name_token.value) - gss_release_buffer(&min_stat, &name_token); - gss_release_name(&min_stat, &gssuser); - - response = gss_error(__func__, "gss_display_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } else { - state->username = (char *)malloc(name_token.length + 1); - if(state->username == NULL) die1("Memory allocation failed"); - strncpy(state->username, (char*) name_token.value, name_token.length); - state->username[name_token.length] = 0; - gss_release_buffer(&min_stat, &name_token); - gss_release_name(&min_stat, &gssuser); - } - } - -end: - if(output_token.value) - gss_release_buffer(&min_stat, &output_token); - if(input_token.value) - free(input_token.value); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_client_unwrap(gss_client_state *state, const char *challenge) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - gss_client_response *response = NULL; - int ret = AUTH_GSS_CONTINUE; - - // Always clear out the old response - if(state->response != NULL) { - free(state->response); - state->response = NULL; - } - - // If there is a challenge (data from the server) we need to give it to GSS - if(challenge && *challenge) { - int len; - input_token.value = base64_decode(challenge, &len); - input_token.length = len; - } - - // Do GSSAPI step - maj_stat = gss_unwrap(&min_stat, - state->context, - &input_token, - &output_token, - NULL, - NULL); - - if(maj_stat != GSS_S_COMPLETE) { - response = gss_error(__func__, "gss_unwrap", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } else { - ret = AUTH_GSS_COMPLETE; - } - - // Grab the client response - if(output_token.length) { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); - gss_release_buffer(&min_stat, &output_token); - } -end: - if(output_token.value) - gss_release_buffer(&min_stat, &output_token); - if(input_token.value) - free(input_token.value); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_CONTINUE; - gss_client_response *response = NULL; - char buf[4096], server_conf_flags; - unsigned long buf_size; - - // Always clear out the old response - if(state->response != NULL) { - free(state->response); - state->response = NULL; - } - - if(challenge && *challenge) { - int len; - input_token.value = base64_decode(challenge, &len); - input_token.length = len; - } - - if(user) { - // get bufsize - server_conf_flags = ((char*) input_token.value)[0]; - ((char*) input_token.value)[0] = 0; - buf_size = ntohl(*((long *) input_token.value)); - free(input_token.value); -#ifdef PRINTFS - printf("User: %s, %c%c%c\n", user, - server_conf_flags & GSS_AUTH_P_NONE ? 'N' : '-', - server_conf_flags & GSS_AUTH_P_INTEGRITY ? 'I' : '-', - server_conf_flags & GSS_AUTH_P_PRIVACY ? 'P' : '-'); - printf("Maximum GSS token size is %ld\n", buf_size); -#endif - - // agree to terms (hack!) - buf_size = htonl(buf_size); // not relevant without integrity/privacy - memcpy(buf, &buf_size, 4); - buf[0] = GSS_AUTH_P_NONE; - // server decides if principal can log in as user - strncpy(buf + 4, user, sizeof(buf) - 4); - input_token.value = buf; - input_token.length = 4 + strlen(user); - } - - // Do GSSAPI wrap - maj_stat = gss_wrap(&min_stat, - state->context, - 0, - GSS_C_QOP_DEFAULT, - &input_token, - NULL, - &output_token); - - if (maj_stat != GSS_S_COMPLETE) { - response = gss_error(__func__, "gss_wrap", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } else - ret = AUTH_GSS_COMPLETE; - // Grab the client response to send back to the server - if (output_token.length) { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; - gss_release_buffer(&min_stat, &output_token); - } -end: - if (output_token.value) - gss_release_buffer(&min_stat, &output_token); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_server_init(const char *service, bool constrained_delegation, const char *username, gss_server_state *state) -{ - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_COMPLETE; - gss_client_response *response = NULL; - gss_cred_usage_t usage = GSS_C_ACCEPT; - - state->context = GSS_C_NO_CONTEXT; - state->server_name = GSS_C_NO_NAME; - state->client_name = GSS_C_NO_NAME; - state->server_creds = GSS_C_NO_CREDENTIAL; - state->client_creds = GSS_C_NO_CREDENTIAL; - state->username = NULL; - state->targetname = NULL; - state->response = NULL; - state->constrained_delegation = constrained_delegation; - state->delegated_credentials_cache = NULL; - - // Server name may be empty which means we aren't going to create our own creds - size_t service_len = strlen(service); - if (service_len != 0) - { - // Import server name first - name_token.length = strlen(service); - name_token.value = (char *)service; - - maj_stat = gss_import_name(&min_stat, &name_token, GSS_C_NT_HOSTBASED_SERVICE, &state->server_name); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_import_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - if (state->constrained_delegation) - { - usage = GSS_C_BOTH; - } - - // Get credentials - maj_stat = gss_acquire_cred(&min_stat, state->server_name, GSS_C_INDEFINITE, - GSS_C_NO_OID_SET, usage, &state->server_creds, NULL, NULL); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_acquire_cred", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - } - - // If a username was passed, perform the S4U2Self protocol transition to acquire - // a credentials from that user as if we had done gss_accept_sec_context. - // In this scenario, the passed username is assumed to be already authenticated - // by some external mechanism, and we are here to "bootstrap" some gss credentials. - // In authenticate_gss_server_step we will bypass the actual authentication step. - if (username != NULL) - { - gss_name_t gss_username; - - name_token.length = strlen(username); - name_token.value = (char *)username; - - maj_stat = gss_import_name(&min_stat, &name_token, GSS_C_NT_USER_NAME, &gss_username); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_import_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - maj_stat = gss_acquire_cred_impersonate_name(&min_stat, - state->server_creds, - gss_username, - GSS_C_INDEFINITE, - GSS_C_NO_OID_SET, - GSS_C_INITIATE, - &state->client_creds, - NULL, - NULL); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_acquire_cred_impersonate_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - } - - gss_release_name(&min_stat, &gss_username); - - if (response != NULL) - { - goto end; - } - - // because the username MAY be a "local" username, - // we want get the canonical name from the acquired creds. - maj_stat = gss_inquire_cred(&min_stat, state->client_creds, &state->client_name, NULL, NULL, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_inquire_cred", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - } - -end: - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_server_clean(gss_server_state *state) -{ - OM_uint32 min_stat; - int ret = AUTH_GSS_COMPLETE; - gss_client_response *response = NULL; - - if (state->context != GSS_C_NO_CONTEXT) - gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); - if (state->server_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &state->server_name); - if (state->client_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &state->client_name); - if (state->server_creds != GSS_C_NO_CREDENTIAL) - gss_release_cred(&min_stat, &state->server_creds); - if (state->client_creds != GSS_C_NO_CREDENTIAL) - gss_release_cred(&min_stat, &state->client_creds); - if (state->username != NULL) - { - free(state->username); - state->username = NULL; - } - if (state->targetname != NULL) - { - free(state->targetname); - state->targetname = NULL; - } - if (state->response != NULL) - { - free(state->response); - state->response = NULL; - } - if (state->delegated_credentials_cache) - { - // TODO: what about actually destroying the cache? It can't be done now as - // the whole point is having it around for the lifetime of the "session" - free(state->delegated_credentials_cache); - } - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_server_step(gss_server_state *state, const char *auth_data) -{ - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_CONTINUE; - gss_client_response *response = NULL; - - // Always clear out the old response - if (state->response != NULL) - { - free(state->response); - state->response = NULL; - } - - // we don't need to check the authentication token if S4U2Self protocol - // transition was done, because we already have the client credentials. - if (state->client_creds == GSS_C_NO_CREDENTIAL) - { - if (auth_data && *auth_data) - { - int len; - input_token.value = base64_decode(auth_data, &len); - input_token.length = len; - } - else - { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->message = strdup("No auth_data value in request from client"); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - maj_stat = gss_accept_sec_context(&min_stat, - &state->context, - state->server_creds, - &input_token, - GSS_C_NO_CHANNEL_BINDINGS, - &state->client_name, - NULL, - &output_token, - NULL, - NULL, - &state->client_creds); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_accept_sec_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - // Grab the server response to send back to the client - if (output_token.length) - { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); - maj_stat = gss_release_buffer(&min_stat, &output_token); - } - } - - // Get the user name - maj_stat = gss_display_name(&min_stat, state->client_name, &output_token, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_display_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - state->username = (char *)malloc(output_token.length + 1); - strncpy(state->username, (char*) output_token.value, output_token.length); - state->username[output_token.length] = 0; - - // Get the target name if no server creds were supplied - if (state->server_creds == GSS_C_NO_CREDENTIAL) - { - gss_name_t target_name = GSS_C_NO_NAME; - maj_stat = gss_inquire_context(&min_stat, state->context, NULL, &target_name, NULL, NULL, NULL, NULL, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_inquire_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - maj_stat = gss_display_name(&min_stat, target_name, &output_token, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_display_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - state->targetname = (char *)malloc(output_token.length + 1); - strncpy(state->targetname, (char*) output_token.value, output_token.length); - state->targetname[output_token.length] = 0; - } - - if (state->constrained_delegation && state->client_creds != GSS_C_NO_CREDENTIAL) - { - if ((response = store_gss_creds(state)) != NULL) - { - goto end; - } - } - - ret = AUTH_GSS_COMPLETE; - -end: - if (output_token.length) - gss_release_buffer(&min_stat, &output_token); - if (input_token.value) - free(input_token.value); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -static gss_client_response *store_gss_creds(gss_server_state *state) -{ - OM_uint32 maj_stat, min_stat; - krb5_principal princ = NULL; - krb5_ccache ccache = NULL; - krb5_error_code problem; - krb5_context context; - gss_client_response *response = NULL; - - problem = krb5_init_context(&context); - if (problem) { - response = other_error("No auth_data value in request from client"); - return response; - } - - problem = krb5_parse_name(context, state->username, &princ); - if (problem) { - response = krb5_ctx_error(context, problem); - goto end; - } - - if ((response = create_krb5_ccache(state, context, princ, &ccache))) - { - goto end; - } - - maj_stat = gss_krb5_copy_ccache(&min_stat, state->client_creds, ccache); - if (GSS_ERROR(maj_stat)) { - response = gss_error(__func__, "gss_krb5_copy_ccache", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - krb5_cc_close(context, ccache); - ccache = NULL; - - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - // TODO: something other than AUTH_GSS_COMPLETE? - response->return_code = AUTH_GSS_COMPLETE; - - end: - if (princ) - krb5_free_principal(context, princ); - if (ccache) - krb5_cc_destroy(context, ccache); - krb5_free_context(context); - - return response; -} - -static gss_client_response *create_krb5_ccache(gss_server_state *state, krb5_context kcontext, krb5_principal princ, krb5_ccache *ccache) -{ - char *ccname = NULL; - int fd; - krb5_error_code problem; - krb5_ccache tmp_ccache = NULL; - gss_client_response *error = NULL; - - // TODO: mod_auth_kerb used a temp file under /run/httpd/krbcache. what can we do? - ccname = strdup("FILE:/tmp/krb5cc_nodekerberos_XXXXXX"); - if (!ccname) die1("Memory allocation failed"); - - fd = mkstemp(ccname + strlen("FILE:")); - if (fd < 0) { - error = other_error("mkstemp() failed: %s", strerror(errno)); - goto end; - } - - close(fd); - - problem = krb5_cc_resolve(kcontext, ccname, &tmp_ccache); - if (problem) { - error = krb5_ctx_error(kcontext, problem); - goto end; - } - - problem = krb5_cc_initialize(kcontext, tmp_ccache, princ); - if (problem) { - error = krb5_ctx_error(kcontext, problem); - goto end; - } - - state->delegated_credentials_cache = strdup(ccname); - - // TODO: how/when to cleanup the creds cache file? - // TODO: how to expose the credentials expiration time? - - *ccache = tmp_ccache; - tmp_ccache = NULL; - - end: - if (tmp_ccache) - krb5_cc_destroy(kcontext, tmp_ccache); - - if (ccname && error) - unlink(ccname); - - if (ccname) - free(ccname); - - return error; -} - - -gss_client_response *gss_error(const char *func, const char *op, OM_uint32 err_maj, OM_uint32 err_min) { - OM_uint32 maj_stat, min_stat; - OM_uint32 msg_ctx = 0; - gss_buffer_desc status_string; - - gss_client_response *response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - - char *message = NULL; - message = calloc(1024, 1); - if(message == NULL) die1("Memory allocation failed"); - - response->message = message; - - int nleft = 1024; - int n; - - n = snprintf(message, nleft, "%s(%s)", func, op); - message += n; - nleft -= n; - - do { - maj_stat = gss_display_status (&min_stat, - err_maj, - GSS_C_GSS_CODE, - GSS_C_NO_OID, - &msg_ctx, - &status_string); - if(GSS_ERROR(maj_stat)) - break; - - n = snprintf(message, nleft, ": %.*s", - (int)status_string.length, (char*)status_string.value); - message += n; - nleft -= n; - - gss_release_buffer(&min_stat, &status_string); - - maj_stat = gss_display_status (&min_stat, - err_min, - GSS_C_MECH_CODE, - GSS_C_NULL_OID, - &msg_ctx, - &status_string); - if(!GSS_ERROR(maj_stat)) { - n = snprintf(message, nleft, ": %.*s", - (int)status_string.length, (char*)status_string.value); - message += n; - nleft -= n; - - gss_release_buffer(&min_stat, &status_string); - } - } while (!GSS_ERROR(maj_stat) && msg_ctx != 0); - - return response; -} - -static gss_client_response *krb5_ctx_error(krb5_context context, krb5_error_code problem) -{ - gss_client_response *response = NULL; - const char *error_text = krb5_get_error_message(context, problem); - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->message = strdup(error_text); - // TODO: something other than AUTH_GSS_ERROR? AUTH_KRB5_ERROR ? - response->return_code = AUTH_GSS_ERROR; - krb5_free_error_message(context, error_text); - return response; -} - -static gss_client_response *other_error(const char *fmt, ...) -{ - size_t needed; - char *msg; - gss_client_response *response = NULL; - va_list ap, aps; - - va_start(ap, fmt); - - va_copy(aps, ap); - needed = snprintf(NULL, 0, fmt, aps); - va_end(aps); - - msg = malloc(needed); - if (!msg) die1("Memory allocation failed"); - - vsnprintf(msg, needed, fmt, ap); - va_end(ap); - - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->message = msg; - - // TODO: something other than AUTH_GSS_ERROR? - response->return_code = AUTH_GSS_ERROR; - - return response; -} - - -#pragma clang diagnostic pop - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h deleted file mode 100644 index fa7e3111..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2006-2009 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ -#ifndef KERBEROS_GSS_H -#define KERBEROS_GSS_H - -#include - -#include -#include -#include - -#define krb5_get_err_text(context,code) error_message(code) - -#define AUTH_GSS_ERROR -1 -#define AUTH_GSS_COMPLETE 1 -#define AUTH_GSS_CONTINUE 0 - -#define GSS_AUTH_P_NONE 1 -#define GSS_AUTH_P_INTEGRITY 2 -#define GSS_AUTH_P_PRIVACY 4 - -typedef struct { - int return_code; - char *message; -} gss_client_response; - -typedef struct { - gss_ctx_id_t context; - gss_name_t server_name; - long int gss_flags; - char* username; - char* response; -} gss_client_state; - -typedef struct { - gss_ctx_id_t context; - gss_name_t server_name; - gss_name_t client_name; - gss_cred_id_t server_creds; - gss_cred_id_t client_creds; - char* username; - char* targetname; - char* response; - bool constrained_delegation; - char* delegated_credentials_cache; -} gss_server_state; - -// char* server_principal_details(const char* service, const char* hostname); - -gss_client_response *authenticate_gss_client_init(const char* service, long int gss_flags, gss_client_state* state); -gss_client_response *authenticate_gss_client_clean(gss_client_state *state); -gss_client_response *authenticate_gss_client_step(gss_client_state *state, const char *challenge); -gss_client_response *authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge); -gss_client_response *authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user); - -gss_client_response *authenticate_gss_server_init(const char* service, bool constrained_delegation, const char *username, gss_server_state* state); -gss_client_response *authenticate_gss_server_clean(gss_server_state *state); -gss_client_response *authenticate_gss_server_step(gss_server_state *state, const char *challenge); - -#endif diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js deleted file mode 100644 index d9120fba..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js +++ /dev/null @@ -1,15 +0,0 @@ -// Load the native SSPI classes -var kerberos = require('../build/Release/kerberos') - , Kerberos = kerberos.Kerberos - , SecurityBuffer = require('./win32/wrappers/security_buffer').SecurityBuffer - , SecurityBufferDescriptor = require('./win32/wrappers/security_buffer_descriptor').SecurityBufferDescriptor - , SecurityCredentials = require('./win32/wrappers/security_credentials').SecurityCredentials - , SecurityContext = require('./win32/wrappers/security_context').SecurityContext; -var SSPI = function() { -} - -exports.SSPI = SSPI; -exports.SecurityBuffer = SecurityBuffer; -exports.SecurityBufferDescriptor = SecurityBufferDescriptor; -exports.SecurityCredentials = SecurityCredentials; -exports.SecurityContext = SecurityContext; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c deleted file mode 100644 index 502a021c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#include "base64.h" - -#include -#include - -// base64 tables -static char basis_64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static signed char index_64[128] = -{ - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, - 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, - 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, - -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, - 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 -}; -#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) - -// base64_encode : base64 encode -// -// value : data to encode -// vlen : length of data -// (result) : new char[] - c-str of result -char *base64_encode(const unsigned char *value, int vlen) -{ - char *result = (char *)malloc((vlen * 4) / 3 + 5); - char *out = result; - unsigned char oval; - - while (vlen >= 3) - { - *out++ = basis_64[value[0] >> 2]; - *out++ = basis_64[((value[0] << 4) & 0x30) | (value[1] >> 4)]; - *out++ = basis_64[((value[1] << 2) & 0x3C) | (value[2] >> 6)]; - *out++ = basis_64[value[2] & 0x3F]; - value += 3; - vlen -= 3; - } - if (vlen > 0) - { - *out++ = basis_64[value[0] >> 2]; - oval = (value[0] << 4) & 0x30; - if (vlen > 1) oval |= value[1] >> 4; - *out++ = basis_64[oval]; - *out++ = (vlen < 2) ? '=' : basis_64[(value[1] << 2) & 0x3C]; - *out++ = '='; - } - *out = '\0'; - - return result; -} - -// base64_decode : base64 decode -// -// value : c-str to decode -// rlen : length of decoded result -// (result) : new unsigned char[] - decoded result -unsigned char *base64_decode(const char *value, int *rlen) -{ - int c1, c2, c3, c4; - int vlen = (int)strlen(value); - unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1); - unsigned char *out = result; - *rlen = 0; - - while (1) - { - if (value[0]==0) - return result; - c1 = value[0]; - if (CHAR64(c1) == -1) - goto base64_decode_error;; - c2 = value[1]; - if (CHAR64(c2) == -1) - goto base64_decode_error;; - c3 = value[2]; - if ((c3 != '=') && (CHAR64(c3) == -1)) - goto base64_decode_error;; - c4 = value[3]; - if ((c4 != '=') && (CHAR64(c4) == -1)) - goto base64_decode_error;; - - value += 4; - *out++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4); - *rlen += 1; - if (c3 != '=') - { - *out++ = ((CHAR64(c2) << 4) & 0xf0) | (CHAR64(c3) >> 2); - *rlen += 1; - if (c4 != '=') - { - *out++ = ((CHAR64(c3) << 6) & 0xc0) | CHAR64(c4); - *rlen += 1; - } - } - } - -base64_decode_error: - *result = 0; - *rlen = 0; - return result; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h deleted file mode 100644 index f0e1f061..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -char *base64_encode(const unsigned char *value, int vlen); -unsigned char *base64_decode(const char *value, int *rlen); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc deleted file mode 100644 index c7b583f5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc +++ /dev/null @@ -1,51 +0,0 @@ -#include "kerberos.h" -#include -#include -#include "base64.h" -#include "wrappers/security_buffer.h" -#include "wrappers/security_buffer_descriptor.h" -#include "wrappers/security_context.h" -#include "wrappers/security_credentials.h" - -Nan::Persistent Kerberos::constructor_template; - -Kerberos::Kerberos() : Nan::ObjectWrap() { -} - -void Kerberos::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("Kerberos").ToLocalChecked()); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - Nan::Set(target, Nan::New("Kerberos").ToLocalChecked(), t->GetFunction()); -} - -NAN_METHOD(Kerberos::New) { - // Load the security.dll library - load_library(); - // Create a Kerberos instance - Kerberos *kerberos = new Kerberos(); - // Return the kerberos object - kerberos->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -// Exporting function -NAN_MODULE_INIT(init) { - Kerberos::Initialize(target); - SecurityContext::Initialize(target); - SecurityBuffer::Initialize(target); - SecurityBufferDescriptor::Initialize(target); - SecurityCredentials::Initialize(target); -} - -NODE_MODULE(kerberos, init); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h deleted file mode 100644 index 0fd27604..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef KERBEROS_H -#define KERBEROS_H - -#include -#include -#include -#include "nan.h" - -extern "C" { - #include "kerberos_sspi.h" - #include "base64.h" -} - -using namespace v8; -using namespace node; - -class Kerberos : public Nan::ObjectWrap { - -public: - Kerberos(); - ~Kerberos() {}; - - // Constructor used for creating new Kerberos objects from C++ - static Nan::Persistent constructor_template; - - // Initialize function for the object - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - - // Method available - static NAN_METHOD(AcquireAlternateCredentials); - static NAN_METHOD(PrepareOutboundPackage); - static NAN_METHOD(DecryptMessage); - static NAN_METHOD(EncryptMessage); - static NAN_METHOD(QueryContextAttributes); - -private: - static NAN_METHOD(New); - - // Pointer to context object - SEC_WINNT_AUTH_IDENTITY m_Identity; - // credentials - CredHandle m_Credentials; - // Expiry time for ticket - TimeStamp Expiration; - // package info - SecPkgInfo m_PkgInfo; - // context - CtxtHandle m_Context; - // Do we have a context - bool m_HaveContext; - // Attributes - DWORD CtxtAttr; - - // Handles the uv calls - static void Process(uv_work_t* work_req); - // Called after work is done - static void After(uv_work_t* work_req); -}; - -#endif \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c deleted file mode 100644 index d75c9ab0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c +++ /dev/null @@ -1,244 +0,0 @@ -#include "kerberos_sspi.h" -#include -#include - -static HINSTANCE _sspi_security_dll = NULL; -static HINSTANCE _sspi_secur32_dll = NULL; - -/** - * Encrypt A Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_EncryptMessage(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo) { - // Create function pointer instance - encryptMessage_fn pfn_encryptMessage = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - // Map function to library method - pfn_encryptMessage = (encryptMessage_fn)GetProcAddress(_sspi_security_dll, "EncryptMessage"); - // Check if the we managed to map function pointer - if(!pfn_encryptMessage) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_encryptMessage)(phContext, fQOP, pMessage, MessageSeqNo); -} - -/** - * Acquire Credentials - */ -SECURITY_STATUS SEC_ENTRY _sspi_AcquireCredentialsHandle( - LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse, - void * pvLogonId, void * pAuthData, SEC_GET_KEY_FN pGetKeyFn, void * pvGetKeyArgument, - PCredHandle phCredential, PTimeStamp ptsExpiry -) { - SECURITY_STATUS status; - // Create function pointer instance - acquireCredentialsHandle_fn pfn_acquireCredentialsHandle = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - // Map function - #ifdef _UNICODE - pfn_acquireCredentialsHandle = (acquireCredentialsHandle_fn)GetProcAddress(_sspi_security_dll, "AcquireCredentialsHandleW"); - #else - pfn_acquireCredentialsHandle = (acquireCredentialsHandle_fn)GetProcAddress(_sspi_security_dll, "AcquireCredentialsHandleA"); - #endif - - // Check if the we managed to map function pointer - if(!pfn_acquireCredentialsHandle) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Status - status = (*pfn_acquireCredentialsHandle)(pszPrincipal, pszPackage, fCredentialUse, - pvLogonId, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry - ); - - // Call the function - return status; -} - -/** - * Delete Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_DeleteSecurityContext(PCtxtHandle phContext) { - // Create function pointer instance - deleteSecurityContext_fn pfn_deleteSecurityContext = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - // Map function - pfn_deleteSecurityContext = (deleteSecurityContext_fn)GetProcAddress(_sspi_security_dll, "DeleteSecurityContext"); - - // Check if the we managed to map function pointer - if(!pfn_deleteSecurityContext) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_deleteSecurityContext)(phContext); -} - -/** - * Decrypt Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, unsigned long MessageSeqNo, unsigned long pfQOP) { - // Create function pointer instance - decryptMessage_fn pfn_decryptMessage = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - // Map function - pfn_decryptMessage = (decryptMessage_fn)GetProcAddress(_sspi_security_dll, "DecryptMessage"); - - // Check if the we managed to map function pointer - if(!pfn_decryptMessage) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_decryptMessage)(phContext, pMessage, MessageSeqNo, pfQOP); -} - -/** - * Initialize Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_initializeSecurityContext( - PCredHandle phCredential, PCtxtHandle phContext, - LPSTR pszTargetName, unsigned long fContextReq, - unsigned long Reserved1, unsigned long TargetDataRep, - PSecBufferDesc pInput, unsigned long Reserved2, - PCtxtHandle phNewContext, PSecBufferDesc pOutput, - unsigned long * pfContextAttr, PTimeStamp ptsExpiry -) { - SECURITY_STATUS status; - // Create function pointer instance - initializeSecurityContext_fn pfn_initializeSecurityContext = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - // Map function - #ifdef _UNICODE - pfn_initializeSecurityContext = (initializeSecurityContext_fn)GetProcAddress(_sspi_security_dll, "InitializeSecurityContextW"); - #else - pfn_initializeSecurityContext = (initializeSecurityContext_fn)GetProcAddress(_sspi_security_dll, "InitializeSecurityContextA"); - #endif - - // Check if the we managed to map function pointer - if(!pfn_initializeSecurityContext) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Execute intialize context - status = (*pfn_initializeSecurityContext)( - phCredential, phContext, pszTargetName, fContextReq, - Reserved1, TargetDataRep, pInput, Reserved2, - phNewContext, pOutput, pfContextAttr, ptsExpiry - ); - - // Call the function - return status; -} -/** - * Query Context Attributes - */ -SECURITY_STATUS SEC_ENTRY _sspi_QueryContextAttributes( - PCtxtHandle phContext, unsigned long ulAttribute, void * pBuffer -) { - // Create function pointer instance - queryContextAttributes_fn pfn_queryContextAttributes = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - #ifdef _UNICODE - pfn_queryContextAttributes = (queryContextAttributes_fn)GetProcAddress(_sspi_security_dll, "QueryContextAttributesW"); - #else - pfn_queryContextAttributes = (queryContextAttributes_fn)GetProcAddress(_sspi_security_dll, "QueryContextAttributesA"); - #endif - - // Check if the we managed to map function pointer - if(!pfn_queryContextAttributes) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_queryContextAttributes)( - phContext, ulAttribute, pBuffer - ); -} - -/** - * InitSecurityInterface - */ -PSecurityFunctionTable _ssip_InitSecurityInterface() { - INIT_SECURITY_INTERFACE InitSecurityInterface; - PSecurityFunctionTable pSecurityInterface = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return NULL; - - #ifdef _UNICODE - // Get the address of the InitSecurityInterface function. - InitSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress ( - _sspi_secur32_dll, - TEXT("InitSecurityInterfaceW")); - #else - // Get the address of the InitSecurityInterface function. - InitSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress ( - _sspi_secur32_dll, - TEXT("InitSecurityInterfaceA")); - #endif - - if(!InitSecurityInterface) { - printf (TEXT("Failed in getting the function address, Error: %x"), GetLastError ()); - return NULL; - } - - // Use InitSecurityInterface to get the function table. - pSecurityInterface = (*InitSecurityInterface)(); - - if(!pSecurityInterface) { - printf (TEXT("Failed in getting the function table, Error: %x"), GetLastError ()); - return NULL; - } - - return pSecurityInterface; -} - -/** - * Load security.dll dynamically - */ -int load_library() { - DWORD err; - // Load the library - _sspi_security_dll = LoadLibrary("security.dll"); - - // Check if the library loaded - if(_sspi_security_dll == NULL) { - err = GetLastError(); - return err; - } - - // Load the library - _sspi_secur32_dll = LoadLibrary("secur32.dll"); - - // Check if the library loaded - if(_sspi_secur32_dll == NULL) { - err = GetLastError(); - return err; - } - - return 0; -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h deleted file mode 100644 index a3008dc5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef SSPI_C_H -#define SSPI_C_H - -#define SECURITY_WIN32 1 - -#include -#include - -/** - * Encrypt A Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_EncryptMessage(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo); - -typedef DWORD (WINAPI *encryptMessage_fn)(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo); - -/** - * Acquire Credentials - */ -SECURITY_STATUS SEC_ENTRY _sspi_AcquireCredentialsHandle( - LPSTR pszPrincipal, // Name of principal - LPSTR pszPackage, // Name of package - unsigned long fCredentialUse, // Flags indicating use - void * pvLogonId, // Pointer to logon ID - void * pAuthData, // Package specific data - SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func - void * pvGetKeyArgument, // Value to pass to GetKey() - PCredHandle phCredential, // (out) Cred Handle - PTimeStamp ptsExpiry // (out) Lifetime (optional) -); - -typedef DWORD (WINAPI *acquireCredentialsHandle_fn)( - LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse, - void * pvLogonId, void * pAuthData, SEC_GET_KEY_FN pGetKeyFn, void * pvGetKeyArgument, - PCredHandle phCredential, PTimeStamp ptsExpiry - ); - -/** - * Delete Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_DeleteSecurityContext( - PCtxtHandle phContext // Context to delete -); - -typedef DWORD (WINAPI *deleteSecurityContext_fn)(PCtxtHandle phContext); - -/** - * Decrypt Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_DecryptMessage( - PCtxtHandle phContext, - PSecBufferDesc pMessage, - unsigned long MessageSeqNo, - unsigned long pfQOP -); - -typedef DWORD (WINAPI *decryptMessage_fn)( - PCtxtHandle phContext, PSecBufferDesc pMessage, unsigned long MessageSeqNo, unsigned long pfQOP); - -/** - * Initialize Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_initializeSecurityContext( - PCredHandle phCredential, // Cred to base context - PCtxtHandle phContext, // Existing context (OPT) - LPSTR pszTargetName, // Name of target - unsigned long fContextReq, // Context Requirements - unsigned long Reserved1, // Reserved, MBZ - unsigned long TargetDataRep, // Data rep of target - PSecBufferDesc pInput, // Input Buffers - unsigned long Reserved2, // Reserved, MBZ - PCtxtHandle phNewContext, // (out) New Context handle - PSecBufferDesc pOutput, // (inout) Output Buffers - unsigned long * pfContextAttr, // (out) Context attrs - PTimeStamp ptsExpiry // (out) Life span (OPT) -); - -typedef DWORD (WINAPI *initializeSecurityContext_fn)( - PCredHandle phCredential, PCtxtHandle phContext, LPSTR pszTargetName, unsigned long fContextReq, - unsigned long Reserved1, unsigned long TargetDataRep, PSecBufferDesc pInput, unsigned long Reserved2, - PCtxtHandle phNewContext, PSecBufferDesc pOutput, unsigned long * pfContextAttr, PTimeStamp ptsExpiry); - -/** - * Query Context Attributes - */ -SECURITY_STATUS SEC_ENTRY _sspi_QueryContextAttributes( - PCtxtHandle phContext, // Context to query - unsigned long ulAttribute, // Attribute to query - void * pBuffer // Buffer for attributes -); - -typedef DWORD (WINAPI *queryContextAttributes_fn)( - PCtxtHandle phContext, unsigned long ulAttribute, void * pBuffer); - -/** - * InitSecurityInterface - */ -PSecurityFunctionTable _ssip_InitSecurityInterface(); - -typedef DWORD (WINAPI *initSecurityInterface_fn) (); - -/** - * Load security.dll dynamically - */ -int load_library(); - -#endif \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc deleted file mode 100644 index e7a472f6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "worker.h" - -Worker::Worker() { -} - -Worker::~Worker() { -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h deleted file mode 100644 index c2ccb6b5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef WORKER_H_ -#define WORKER_H_ - -#include -#include -#include -#include - -using namespace node; -using namespace v8; - -class Worker { - public: - Worker(); - virtual ~Worker(); - - // libuv's request struct. - uv_work_t request; - // Callback - Nan::Callback *callback; - // Parameters - void *parameters; - // Results - void *return_value; - // Did we raise an error - bool error; - // The error message - char *error_message; - // Error code if not message - int error_code; - // Any return code - int return_code; - // Method we are going to fire - void (*execute)(Worker *worker); - Local (*mapper)(Worker *worker); -}; - -#endif // WORKER_H_ diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc deleted file mode 100644 index fdf8e491..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "security_buffer.h" - -using namespace node; - -Nan::Persistent SecurityBuffer::constructor_template; - -SecurityBuffer::SecurityBuffer(uint32_t security_type, size_t size) : Nan::ObjectWrap() { - this->size = size; - this->data = calloc(size, sizeof(char)); - this->security_type = security_type; - // Set up the data in the sec_buffer - this->sec_buffer.BufferType = security_type; - this->sec_buffer.cbBuffer = (unsigned long)size; - this->sec_buffer.pvBuffer = this->data; -} - -SecurityBuffer::SecurityBuffer(uint32_t security_type, size_t size, void *data) : Nan::ObjectWrap() { - this->size = size; - this->data = data; - this->security_type = security_type; - // Set up the data in the sec_buffer - this->sec_buffer.BufferType = security_type; - this->sec_buffer.cbBuffer = (unsigned long)size; - this->sec_buffer.pvBuffer = this->data; -} - -SecurityBuffer::~SecurityBuffer() { - free(this->data); -} - -NAN_METHOD(SecurityBuffer::New) { - SecurityBuffer *security_obj; - - if(info.Length() != 2) - return Nan::ThrowError("Two parameters needed integer buffer type and [32 bit integer/Buffer] required"); - - if(!info[0]->IsInt32()) - return Nan::ThrowError("Two parameters needed integer buffer type and [32 bit integer/Buffer] required"); - - if(!info[1]->IsInt32() && !Buffer::HasInstance(info[1])) - return Nan::ThrowError("Two parameters needed integer buffer type and [32 bit integer/Buffer] required"); - - // Unpack buffer type - uint32_t buffer_type = info[0]->ToUint32()->Value(); - - // If we have an integer - if(info[1]->IsInt32()) { - security_obj = new SecurityBuffer(buffer_type, info[1]->ToUint32()->Value()); - } else { - // Get the length of the Buffer - size_t length = Buffer::Length(info[1]->ToObject()); - // Allocate space for the internal void data pointer - void *data = calloc(length, sizeof(char)); - // Write the data to out of V8 heap space - memcpy(data, Buffer::Data(info[1]->ToObject()), length); - // Create new SecurityBuffer - security_obj = new SecurityBuffer(buffer_type, length, data); - } - - // Wrap it - security_obj->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -NAN_METHOD(SecurityBuffer::ToBuffer) { - // Unpack the Security Buffer object - SecurityBuffer *security_obj = Nan::ObjectWrap::Unwrap(info.This()); - // Create a Buffer - Local buffer = Nan::CopyBuffer((char *)security_obj->data, (uint32_t)security_obj->size).ToLocalChecked(); - // Return the buffer - info.GetReturnValue().Set(buffer); -} - -void SecurityBuffer::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityBuffer").ToLocalChecked()); - - // Class methods - Nan::SetPrototypeMethod(t, "toBuffer", ToBuffer); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityBuffer").ToLocalChecked(), t->GetFunction()); -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h deleted file mode 100644 index 0c97d564..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef SECURITY_BUFFER_H -#define SECURITY_BUFFER_H - -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include -#include -#include -#include - -using namespace v8; -using namespace node; - -class SecurityBuffer : public Nan::ObjectWrap { - public: - SecurityBuffer(uint32_t security_type, size_t size); - SecurityBuffer(uint32_t security_type, size_t size, void *data); - ~SecurityBuffer(); - - // Internal values - void *data; - size_t size; - uint32_t security_type; - SecBuffer sec_buffer; - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(ToBuffer); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - private: - static NAN_METHOD(New); -}; - -#endif \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js deleted file mode 100644 index 4996163c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js +++ /dev/null @@ -1,12 +0,0 @@ -var SecurityBufferNative = require('../../../build/Release/kerberos').SecurityBuffer; - -// Add some attributes -SecurityBufferNative.VERSION = 0; -SecurityBufferNative.EMPTY = 0; -SecurityBufferNative.DATA = 1; -SecurityBufferNative.TOKEN = 2; -SecurityBufferNative.PADDING = 9; -SecurityBufferNative.STREAM = 10; - -// Export the modified class -exports.SecurityBuffer = SecurityBufferNative; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc deleted file mode 100644 index fce0d81c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc +++ /dev/null @@ -1,182 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include "security_buffer_descriptor.h" -#include "security_buffer.h" - -Nan::Persistent SecurityBufferDescriptor::constructor_template; - -SecurityBufferDescriptor::SecurityBufferDescriptor() : Nan::ObjectWrap() { -} - -SecurityBufferDescriptor::SecurityBufferDescriptor(const Nan::Persistent& arrayObjectPersistent) : Nan::ObjectWrap() { - SecurityBuffer *security_obj = NULL; - // Get the Local value - Local arrayObject = Nan::New(arrayObjectPersistent); - - // Safe reference to array - this->arrayObject = arrayObject; - - // Unpack the array and ensure we have a valid descriptor - this->secBufferDesc.cBuffers = arrayObject->Length(); - this->secBufferDesc.ulVersion = SECBUFFER_VERSION; - - if(arrayObject->Length() == 1) { - // Unwrap the buffer - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(0)->ToObject()); - // Assign the buffer - this->secBufferDesc.pBuffers = &security_obj->sec_buffer; - } else { - this->secBufferDesc.pBuffers = new SecBuffer[arrayObject->Length()]; - this->secBufferDesc.cBuffers = arrayObject->Length(); - - // Assign the buffers - for(uint32_t i = 0; i < arrayObject->Length(); i++) { - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(i)->ToObject()); - this->secBufferDesc.pBuffers[i].BufferType = security_obj->sec_buffer.BufferType; - this->secBufferDesc.pBuffers[i].pvBuffer = security_obj->sec_buffer.pvBuffer; - this->secBufferDesc.pBuffers[i].cbBuffer = security_obj->sec_buffer.cbBuffer; - } - } -} - -SecurityBufferDescriptor::~SecurityBufferDescriptor() { -} - -size_t SecurityBufferDescriptor::bufferSize() { - SecurityBuffer *security_obj = NULL; - - if(this->secBufferDesc.cBuffers == 1) { - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(0)->ToObject()); - return security_obj->size; - } else { - int bytesToAllocate = 0; - - for(unsigned int i = 0; i < this->secBufferDesc.cBuffers; i++) { - bytesToAllocate += this->secBufferDesc.pBuffers[i].cbBuffer; - } - - // Return total size - return bytesToAllocate; - } -} - -char *SecurityBufferDescriptor::toBuffer() { - SecurityBuffer *security_obj = NULL; - char *data = NULL; - - if(this->secBufferDesc.cBuffers == 1) { - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(0)->ToObject()); - data = (char *)malloc(security_obj->size * sizeof(char)); - memcpy(data, security_obj->data, security_obj->size); - } else { - size_t bytesToAllocate = this->bufferSize(); - char *data = (char *)calloc(bytesToAllocate, sizeof(char)); - int offset = 0; - - for(unsigned int i = 0; i < this->secBufferDesc.cBuffers; i++) { - memcpy((data + offset), this->secBufferDesc.pBuffers[i].pvBuffer, this->secBufferDesc.pBuffers[i].cbBuffer); - offset +=this->secBufferDesc.pBuffers[i].cbBuffer; - } - - // Return the data - return data; - } - - return data; -} - -NAN_METHOD(SecurityBufferDescriptor::New) { - SecurityBufferDescriptor *security_obj; - Nan::Persistent arrayObject; - - if(info.Length() != 1) - return Nan::ThrowError("There must be 1 argument passed in where the first argument is a [int32 or an Array of SecurityBuffers]"); - - if(!info[0]->IsInt32() && !info[0]->IsArray()) - return Nan::ThrowError("There must be 1 argument passed in where the first argument is a [int32 or an Array of SecurityBuffers]"); - - if(info[0]->IsArray()) { - Local array = Local::Cast(info[0]); - // Iterate over all items and ensure we the right type - for(uint32_t i = 0; i < array->Length(); i++) { - if(!SecurityBuffer::HasInstance(array->Get(i))) { - return Nan::ThrowError("There must be 1 argument passed in where the first argument is a [int32 or an Array of SecurityBuffers]"); - } - } - } - - // We have a single integer - if(info[0]->IsInt32()) { - // Create new SecurityBuffer instance - Local argv[] = {Nan::New(0x02), info[0]}; - Local security_buffer = Nan::New(SecurityBuffer::constructor_template)->GetFunction()->NewInstance(2, argv); - // Create a new array - Local array = Nan::New(1); - // Set the first value - array->Set(0, security_buffer); - - // Create persistent handle - Nan::Persistent persistenHandler; - persistenHandler.Reset(array); - - // Create descriptor - security_obj = new SecurityBufferDescriptor(persistenHandler); - } else { - // Create a persistent handler - Nan::Persistent persistenHandler; - persistenHandler.Reset(Local::Cast(info[0])); - // Create a descriptor - security_obj = new SecurityBufferDescriptor(persistenHandler); - } - - // Wrap it - security_obj->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -NAN_METHOD(SecurityBufferDescriptor::ToBuffer) { - // Unpack the Security Buffer object - SecurityBufferDescriptor *security_obj = Nan::ObjectWrap::Unwrap(info.This()); - - // Get the buffer - char *buffer_data = security_obj->toBuffer(); - size_t buffer_size = security_obj->bufferSize(); - - // Create a Buffer - Local buffer = Nan::CopyBuffer(buffer_data, (uint32_t)buffer_size).ToLocalChecked(); - - // Return the buffer - info.GetReturnValue().Set(buffer); -} - -void SecurityBufferDescriptor::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityBufferDescriptor").ToLocalChecked()); - - // Class methods - Nan::SetPrototypeMethod(t, "toBuffer", ToBuffer); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityBufferDescriptor").ToLocalChecked(), t->GetFunction()); -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h deleted file mode 100644 index dc28f7e1..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SECURITY_BUFFER_DESCRIPTOR_H -#define SECURITY_BUFFER_DESCRIPTOR_H - -#include -#include -#include - -#include -#include -#include -#include - -using namespace v8; -using namespace node; - -class SecurityBufferDescriptor : public Nan::ObjectWrap { - public: - Local arrayObject; - SecBufferDesc secBufferDesc; - - SecurityBufferDescriptor(); - SecurityBufferDescriptor(const Nan::Persistent& arrayObjectPersistent); - ~SecurityBufferDescriptor(); - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - char *toBuffer(); - size_t bufferSize(); - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(ToBuffer); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - private: - static NAN_METHOD(New); -}; - -#endif \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js deleted file mode 100644 index 9421392e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js +++ /dev/null @@ -1,3 +0,0 @@ -var SecurityBufferDescriptorNative = require('../../../build/Release/kerberos').SecurityBufferDescriptor; -// Export the modified class -exports.SecurityBufferDescriptor = SecurityBufferDescriptorNative; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc deleted file mode 100644 index 5d7ad549..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc +++ /dev/null @@ -1,856 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "security_context.h" -#include "security_buffer_descriptor.h" - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) -#endif - -static LPSTR DisplaySECError(DWORD ErrCode); - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// UV Lib callbacks -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void Process(uv_work_t* work_req) { - // Grab the worker - Worker *worker = static_cast(work_req->data); - // Execute the worker code - worker->execute(worker); -} - -static void After(uv_work_t* work_req) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Get the worker reference - Worker *worker = static_cast(work_req->data); - - // If we have an error - if(worker->error) { - Local err = v8::Exception::Error(Nan::New(worker->error_message).ToLocalChecked()); - Local obj = err->ToObject(); - obj->Set(Nan::New("code").ToLocalChecked(), Nan::New(worker->error_code)); - Local info[2] = { err, Nan::Null() }; - // Execute the error - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } else { - // // Map the data - Local result = worker->mapper(worker); - // Set up the callback with a null first - Local info[2] = { Nan::Null(), result}; - // Wrap the callback function call in a TryCatch so that we can call - // node's FatalException afterwards. This makes it possible to catch - // the exception from JavaScript land using the - // process.on('uncaughtException') event. - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } - - // Clean up the memory - delete worker->callback; - delete worker; -} - -Nan::Persistent SecurityContext::constructor_template; - -SecurityContext::SecurityContext() : Nan::ObjectWrap() { -} - -SecurityContext::~SecurityContext() { - if(this->hasContext) { - _sspi_DeleteSecurityContext(&this->m_Context); - } -} - -NAN_METHOD(SecurityContext::New) { - PSecurityFunctionTable pSecurityInterface = NULL; - DWORD dwNumOfPkgs; - SECURITY_STATUS status; - - // Create code object - SecurityContext *security_obj = new SecurityContext(); - // Get security table interface - pSecurityInterface = _ssip_InitSecurityInterface(); - // Call the security interface - status = (*pSecurityInterface->EnumerateSecurityPackages)( - &dwNumOfPkgs, - &security_obj->m_PkgInfo); - if(status != SEC_E_OK) { - printf(TEXT("Failed in retrieving security packages, Error: %x"), GetLastError()); - return Nan::ThrowError("Failed in retrieving security packages"); - } - - // Wrap it - security_obj->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -// -// Async InitializeContext -// -typedef struct SecurityContextStaticInitializeCall { - char *service_principal_name_str; - char *decoded_input_str; - int decoded_input_str_length; - SecurityContext *context; -} SecurityContextStaticInitializeCall; - -static void _initializeContext(Worker *worker) { - // Status of operation - SECURITY_STATUS status; - BYTE *out_bound_data_str = NULL; - SecurityContextStaticInitializeCall *call = (SecurityContextStaticInitializeCall *)worker->parameters; - - // Structures used for c calls - SecBufferDesc ibd, obd; - SecBuffer ib, ob; - - // - // Prepare data structure for returned data from SSPI - ob.BufferType = SECBUFFER_TOKEN; - ob.cbBuffer = call->context->m_PkgInfo->cbMaxToken; - // Allocate space for return data - out_bound_data_str = new BYTE[ob.cbBuffer + sizeof(DWORD)]; - ob.pvBuffer = out_bound_data_str; - // prepare buffer description - obd.cBuffers = 1; - obd.ulVersion = SECBUFFER_VERSION; - obd.pBuffers = &ob; - - // - // Prepare the data we are passing to the SSPI method - if(call->decoded_input_str_length > 0) { - ib.BufferType = SECBUFFER_TOKEN; - ib.cbBuffer = call->decoded_input_str_length; - ib.pvBuffer = call->decoded_input_str; - // prepare buffer description - ibd.cBuffers = 1; - ibd.ulVersion = SECBUFFER_VERSION; - ibd.pBuffers = &ib; - } - - // Perform initialization step - status = _sspi_initializeSecurityContext( - &call->context->security_credentials->m_Credentials - , NULL - , const_cast(call->service_principal_name_str) - , 0x02 // MUTUAL - , 0 - , 0 // Network - , call->decoded_input_str_length > 0 ? &ibd : NULL - , 0 - , &call->context->m_Context - , &obd - , &call->context->CtxtAttr - , &call->context->Expiration - ); - - // If we have a ok or continue let's prepare the result - if(status == SEC_E_OK - || status == SEC_I_COMPLETE_NEEDED - || status == SEC_I_CONTINUE_NEEDED - || status == SEC_I_COMPLETE_AND_CONTINUE - ) { - call->context->hasContext = true; - call->context->payload = base64_encode((const unsigned char *)ob.pvBuffer, ob.cbBuffer); - - // Set the context - worker->return_code = status; - worker->return_value = call->context; - } else if(status == SEC_E_INSUFFICIENT_MEMORY) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INSUFFICIENT_MEMORY There is not enough memory available to complete the requested action."; - } else if(status == SEC_E_INTERNAL_ERROR) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INTERNAL_ERROR An error occurred that did not map to an SSPI error code."; - } else if(status == SEC_E_INVALID_HANDLE) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INVALID_HANDLE The handle passed to the function is not valid."; - } else if(status == SEC_E_INVALID_TOKEN) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INVALID_TOKEN The error is due to a malformed input token, such as a token corrupted in transit, a token of incorrect size, or a token passed into the wrong security package. Passing a token to the wrong package can happen if the client and server did not negotiate the proper security package."; - } else if(status == SEC_E_LOGON_DENIED) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_LOGON_DENIED The logon failed."; - } else if(status == SEC_E_NO_AUTHENTICATING_AUTHORITY) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_NO_AUTHENTICATING_AUTHORITY No authority could be contacted for authentication. The domain name of the authenticating party could be wrong, the domain could be unreachable, or there might have been a trust relationship failure."; - } else if(status == SEC_E_NO_CREDENTIALS) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_NO_CREDENTIALS No credentials are available in the security package."; - } else if(status == SEC_E_TARGET_UNKNOWN) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_TARGET_UNKNOWN The target was not recognized."; - } else if(status == SEC_E_UNSUPPORTED_FUNCTION) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_UNSUPPORTED_FUNCTION A context attribute flag that is not valid (ISC_REQ_DELEGATE or ISC_REQ_PROMPT_FOR_CREDS) was specified in the fContextReq parameter."; - } else if(status == SEC_E_WRONG_PRINCIPAL) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_WRONG_PRINCIPAL The principal that received the authentication request is not the same as the one passed into the pszTargetName parameter. This indicates a failure in mutual authentication."; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } - - // Clean up data - if(call->decoded_input_str != NULL) free(call->decoded_input_str); - if(call->service_principal_name_str != NULL) free(call->service_principal_name_str); -} - -static Local _map_initializeContext(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::InitializeContext) { - char *service_principal_name_str = NULL, *input_str = NULL, *decoded_input_str = NULL; - int decoded_input_str_length = NULL; - // Store reference to security credentials - SecurityCredentials *security_credentials = NULL; - - // We need 3 parameters - if(info.Length() != 4) - return Nan::ThrowError("Initialize must be called with [credential:SecurityCredential, servicePrincipalName:string, input:string, callback:function]"); - - // First parameter must be an instance of SecurityCredentials - if(!SecurityCredentials::HasInstance(info[0])) - return Nan::ThrowError("First parameter for Initialize must be an instance of SecurityCredentials"); - - // Second parameter must be a string - if(!info[1]->IsString()) - return Nan::ThrowError("Second parameter for Initialize must be a string"); - - // Third parameter must be a base64 encoded string - if(!info[2]->IsString()) - return Nan::ThrowError("Second parameter for Initialize must be a string"); - - // Third parameter must be a callback - if(!info[3]->IsFunction()) - return Nan::ThrowError("Third parameter for Initialize must be a callback function"); - - // Let's unpack the values - Local service_principal_name = info[1]->ToString(); - service_principal_name_str = (char *)calloc(service_principal_name->Utf8Length() + 1, sizeof(char)); - service_principal_name->WriteUtf8(service_principal_name_str); - - // Unpack the user name - Local input = info[2]->ToString(); - - if(input->Utf8Length() > 0) { - input_str = (char *)calloc(input->Utf8Length() + 1, sizeof(char)); - input->WriteUtf8(input_str); - - // Now let's get the base64 decoded string - decoded_input_str = (char *)base64_decode(input_str, &decoded_input_str_length); - // Free original allocation - free(input_str); - } - - // Unpack the Security credentials - security_credentials = Nan::ObjectWrap::Unwrap(info[0]->ToObject()); - // Create Security context instance - Local security_context_value = Nan::New(constructor_template)->GetFunction()->NewInstance(); - // Unwrap the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(security_context_value); - // Add a reference to the security_credentials - security_context->security_credentials = security_credentials; - - // Build the call function - SecurityContextStaticInitializeCall *call = (SecurityContextStaticInitializeCall *)calloc(1, sizeof(SecurityContextStaticInitializeCall)); - call->context = security_context; - call->decoded_input_str = decoded_input_str; - call->decoded_input_str_length = decoded_input_str_length; - call->service_principal_name_str = service_principal_name_str; - - // Callback - Local callback = Local::Cast(info[3]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _initializeContext; - worker->mapper = _map_initializeContext; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -NAN_GETTER(SecurityContext::PayloadGetter) { - // Unpack the context object - SecurityContext *context = Nan::ObjectWrap::Unwrap(info.This()); - // Return the low bits - info.GetReturnValue().Set(Nan::New(context->payload).ToLocalChecked()); -} - -NAN_GETTER(SecurityContext::HasContextGetter) { - // Unpack the context object - SecurityContext *context = Nan::ObjectWrap::Unwrap(info.This()); - // Return the low bits - info.GetReturnValue().Set(Nan::New(context->hasContext)); -} - -// -// Async InitializeContextStep -// -typedef struct SecurityContextStepStaticInitializeCall { - char *service_principal_name_str; - char *decoded_input_str; - int decoded_input_str_length; - SecurityContext *context; -} SecurityContextStepStaticInitializeCall; - -static void _initializeContextStep(Worker *worker) { - // Outbound data array - BYTE *out_bound_data_str = NULL; - // Status of operation - SECURITY_STATUS status; - // Unpack data - SecurityContextStepStaticInitializeCall *call = (SecurityContextStepStaticInitializeCall *)worker->parameters; - SecurityContext *context = call->context; - // Structures used for c calls - SecBufferDesc ibd, obd; - SecBuffer ib, ob; - - // - // Prepare data structure for returned data from SSPI - ob.BufferType = SECBUFFER_TOKEN; - ob.cbBuffer = context->m_PkgInfo->cbMaxToken; - // Allocate space for return data - out_bound_data_str = new BYTE[ob.cbBuffer + sizeof(DWORD)]; - ob.pvBuffer = out_bound_data_str; - // prepare buffer description - obd.cBuffers = 1; - obd.ulVersion = SECBUFFER_VERSION; - obd.pBuffers = &ob; - - // - // Prepare the data we are passing to the SSPI method - if(call->decoded_input_str_length > 0) { - ib.BufferType = SECBUFFER_TOKEN; - ib.cbBuffer = call->decoded_input_str_length; - ib.pvBuffer = call->decoded_input_str; - // prepare buffer description - ibd.cBuffers = 1; - ibd.ulVersion = SECBUFFER_VERSION; - ibd.pBuffers = &ib; - } - - // Perform initialization step - status = _sspi_initializeSecurityContext( - &context->security_credentials->m_Credentials - , context->hasContext == true ? &context->m_Context : NULL - , const_cast(call->service_principal_name_str) - , 0x02 // MUTUAL - , 0 - , 0 // Network - , call->decoded_input_str_length ? &ibd : NULL - , 0 - , &context->m_Context - , &obd - , &context->CtxtAttr - , &context->Expiration - ); - - // If we have a ok or continue let's prepare the result - if(status == SEC_E_OK - || status == SEC_I_COMPLETE_NEEDED - || status == SEC_I_CONTINUE_NEEDED - || status == SEC_I_COMPLETE_AND_CONTINUE - ) { - // Set the new payload - if(context->payload != NULL) free(context->payload); - context->payload = base64_encode((const unsigned char *)ob.pvBuffer, ob.cbBuffer); - worker->return_code = status; - worker->return_value = context; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } - - // Clean up data - if(call->decoded_input_str != NULL) free(call->decoded_input_str); - if(call->service_principal_name_str != NULL) free(call->service_principal_name_str); -} - -static Local _map_initializeContextStep(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::InitalizeStep) { - char *service_principal_name_str = NULL, *input_str = NULL, *decoded_input_str = NULL; - int decoded_input_str_length = NULL; - - // We need 3 parameters - if(info.Length() != 3) - return Nan::ThrowError("Initialize must be called with [servicePrincipalName:string, input:string, callback:function]"); - - // Second parameter must be a string - if(!info[0]->IsString()) - return Nan::ThrowError("First parameter for Initialize must be a string"); - - // Third parameter must be a base64 encoded string - if(!info[1]->IsString()) - return Nan::ThrowError("Second parameter for Initialize must be a string"); - - // Third parameter must be a base64 encoded string - if(!info[2]->IsFunction()) - return Nan::ThrowError("Third parameter for Initialize must be a callback function"); - - // Let's unpack the values - Local service_principal_name = info[0]->ToString(); - service_principal_name_str = (char *)calloc(service_principal_name->Utf8Length() + 1, sizeof(char)); - service_principal_name->WriteUtf8(service_principal_name_str); - - // Unpack the user name - Local input = info[1]->ToString(); - - if(input->Utf8Length() > 0) { - input_str = (char *)calloc(input->Utf8Length() + 1, sizeof(char)); - input->WriteUtf8(input_str); - // Now let's get the base64 decoded string - decoded_input_str = (char *)base64_decode(input_str, &decoded_input_str_length); - // Free input string - free(input_str); - } - - // Unwrap the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - - // Create call structure - SecurityContextStepStaticInitializeCall *call = (SecurityContextStepStaticInitializeCall *)calloc(1, sizeof(SecurityContextStepStaticInitializeCall)); - call->context = security_context; - call->decoded_input_str = decoded_input_str; - call->decoded_input_str_length = decoded_input_str_length; - call->service_principal_name_str = service_principal_name_str; - - // Callback - Local callback = Local::Cast(info[2]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _initializeContextStep; - worker->mapper = _map_initializeContextStep; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// -// Async EncryptMessage -// -typedef struct SecurityContextEncryptMessageCall { - SecurityContext *context; - SecurityBufferDescriptor *descriptor; - unsigned long flags; -} SecurityContextEncryptMessageCall; - -static void _encryptMessage(Worker *worker) { - SECURITY_STATUS status; - // Unpack call - SecurityContextEncryptMessageCall *call = (SecurityContextEncryptMessageCall *)worker->parameters; - // Unpack the security context - SecurityContext *context = call->context; - SecurityBufferDescriptor *descriptor = call->descriptor; - - // Let's execute encryption - status = _sspi_EncryptMessage( - &context->m_Context - , call->flags - , &descriptor->secBufferDesc - , 0 - ); - - // We've got ok - if(status == SEC_E_OK) { - int bytesToAllocate = (int)descriptor->bufferSize(); - // Free up existing payload - if(context->payload != NULL) free(context->payload); - // Save the payload - context->payload = base64_encode((unsigned char *)descriptor->toBuffer(), bytesToAllocate); - // Set result - worker->return_code = status; - worker->return_value = context; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } -} - -static Local _map_encryptMessage(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::EncryptMessage) { - if(info.Length() != 3) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - if(!SecurityBufferDescriptor::HasInstance(info[0])) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - if(!info[1]->IsUint32()) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - if(!info[2]->IsFunction()) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - - // Unpack the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - - // Unpack the descriptor - SecurityBufferDescriptor *descriptor = Nan::ObjectWrap::Unwrap(info[0]->ToObject()); - - // Create call structure - SecurityContextEncryptMessageCall *call = (SecurityContextEncryptMessageCall *)calloc(1, sizeof(SecurityContextEncryptMessageCall)); - call->context = security_context; - call->descriptor = descriptor; - call->flags = (unsigned long)info[1]->ToInteger()->Value(); - - // Callback - Local callback = Local::Cast(info[2]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _encryptMessage; - worker->mapper = _map_encryptMessage; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// -// Async DecryptMessage -// -typedef struct SecurityContextDecryptMessageCall { - SecurityContext *context; - SecurityBufferDescriptor *descriptor; -} SecurityContextDecryptMessageCall; - -static void _decryptMessage(Worker *worker) { - unsigned long quality = 0; - SECURITY_STATUS status; - - // Unpack parameters - SecurityContextDecryptMessageCall *call = (SecurityContextDecryptMessageCall *)worker->parameters; - SecurityContext *context = call->context; - SecurityBufferDescriptor *descriptor = call->descriptor; - - // Let's execute encryption - status = _sspi_DecryptMessage( - &context->m_Context - , &descriptor->secBufferDesc - , 0 - , (unsigned long)&quality - ); - - // We've got ok - if(status == SEC_E_OK) { - int bytesToAllocate = (int)descriptor->bufferSize(); - // Free up existing payload - if(context->payload != NULL) free(context->payload); - // Save the payload - context->payload = base64_encode((unsigned char *)descriptor->toBuffer(), bytesToAllocate); - // Set return values - worker->return_code = status; - worker->return_value = context; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } -} - -static Local _map_decryptMessage(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::DecryptMessage) { - if(info.Length() != 2) - return Nan::ThrowError("DecryptMessage takes an instance of SecurityBufferDescriptor and a callback function"); - if(!SecurityBufferDescriptor::HasInstance(info[0])) - return Nan::ThrowError("DecryptMessage takes an instance of SecurityBufferDescriptor and a callback function"); - if(!info[1]->IsFunction()) - return Nan::ThrowError("DecryptMessage takes an instance of SecurityBufferDescriptor and a callback function"); - - // Unpack the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - // Unpack the descriptor - SecurityBufferDescriptor *descriptor = Nan::ObjectWrap::Unwrap(info[0]->ToObject()); - // Create call structure - SecurityContextDecryptMessageCall *call = (SecurityContextDecryptMessageCall *)calloc(1, sizeof(SecurityContextDecryptMessageCall)); - call->context = security_context; - call->descriptor = descriptor; - - // Callback - Local callback = Local::Cast(info[1]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _decryptMessage; - worker->mapper = _map_decryptMessage; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// -// Async QueryContextAttributes -// -typedef struct SecurityContextQueryContextAttributesCall { - SecurityContext *context; - uint32_t attribute; -} SecurityContextQueryContextAttributesCall; - -static void _queryContextAttributes(Worker *worker) { - SECURITY_STATUS status; - - // Cast to data structure - SecurityContextQueryContextAttributesCall *call = (SecurityContextQueryContextAttributesCall *)worker->parameters; - - // Allocate some space - SecPkgContext_Sizes *sizes = (SecPkgContext_Sizes *)calloc(1, sizeof(SecPkgContext_Sizes)); - // Let's grab the query context attribute - status = _sspi_QueryContextAttributes( - &call->context->m_Context, - call->attribute, - sizes - ); - - if(status == SEC_E_OK) { - worker->return_code = status; - worker->return_value = sizes; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } -} - -static Local _map_queryContextAttributes(Worker *worker) { - // Cast to data structure - SecurityContextQueryContextAttributesCall *call = (SecurityContextQueryContextAttributesCall *)worker->parameters; - // Unpack the attribute - uint32_t attribute = call->attribute; - - // Convert data - if(attribute == SECPKG_ATTR_SIZES) { - SecPkgContext_Sizes *sizes = (SecPkgContext_Sizes *)worker->return_value; - // Create object - Local value = Nan::New(); - value->Set(Nan::New("maxToken").ToLocalChecked(), Nan::New(uint32_t(sizes->cbMaxToken))); - value->Set(Nan::New("maxSignature").ToLocalChecked(), Nan::New(uint32_t(sizes->cbMaxSignature))); - value->Set(Nan::New("blockSize").ToLocalChecked(), Nan::New(uint32_t(sizes->cbBlockSize))); - value->Set(Nan::New("securityTrailer").ToLocalChecked(), Nan::New(uint32_t(sizes->cbSecurityTrailer))); - return value; - } - - // Return the value - return Nan::Null(); -} - -NAN_METHOD(SecurityContext::QueryContextAttributes) { - if(info.Length() != 2) - return Nan::ThrowError("QueryContextAttributes method takes a an integer Attribute specifier and a callback function"); - if(!info[0]->IsInt32()) - return Nan::ThrowError("QueryContextAttributes method takes a an integer Attribute specifier and a callback function"); - if(!info[1]->IsFunction()) - return Nan::ThrowError("QueryContextAttributes method takes a an integer Attribute specifier and a callback function"); - - // Unpack the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - - // Unpack the int value - uint32_t attribute = info[0]->ToInt32()->Value(); - - // Check that we have a supported attribute - if(attribute != SECPKG_ATTR_SIZES) - return Nan::ThrowError("QueryContextAttributes only supports the SECPKG_ATTR_SIZES attribute"); - - // Create call structure - SecurityContextQueryContextAttributesCall *call = (SecurityContextQueryContextAttributesCall *)calloc(1, sizeof(SecurityContextQueryContextAttributesCall)); - call->attribute = attribute; - call->context = security_context; - - // Callback - Local callback = Local::Cast(info[1]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _queryContextAttributes; - worker->mapper = _map_queryContextAttributes; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -void SecurityContext::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(static_cast(SecurityContext::New)); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityContext").ToLocalChecked()); - - // Class methods - Nan::SetMethod(t, "initialize", SecurityContext::InitializeContext); - - // Set up method for the instance - Nan::SetPrototypeMethod(t, "initialize", SecurityContext::InitalizeStep); - Nan::SetPrototypeMethod(t, "decryptMessage", SecurityContext::DecryptMessage); - Nan::SetPrototypeMethod(t, "queryContextAttributes", SecurityContext::QueryContextAttributes); - Nan::SetPrototypeMethod(t, "encryptMessage", SecurityContext::EncryptMessage); - - // Get prototype - Local proto = t->PrototypeTemplate(); - - // Getter for the response - Nan::SetAccessor(proto, Nan::New("payload").ToLocalChecked(), SecurityContext::PayloadGetter); - Nan::SetAccessor(proto, Nan::New("hasContext").ToLocalChecked(), SecurityContext::HasContextGetter); - - // Set persistent - SecurityContext::constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityContext").ToLocalChecked(), t->GetFunction()); -} - -static LPSTR DisplaySECError(DWORD ErrCode) { - LPSTR pszName = NULL; // WinError.h - - switch(ErrCode) { - case SEC_E_BUFFER_TOO_SMALL: - pszName = "SEC_E_BUFFER_TOO_SMALL - The message buffer is too small. Used with the Digest SSP."; - break; - - case SEC_E_CRYPTO_SYSTEM_INVALID: - pszName = "SEC_E_CRYPTO_SYSTEM_INVALID - The cipher chosen for the security context is not supported. Used with the Digest SSP."; - break; - case SEC_E_INCOMPLETE_MESSAGE: - pszName = "SEC_E_INCOMPLETE_MESSAGE - The data in the input buffer is incomplete. The application needs to read more data from the server and call DecryptMessageSync (General) again."; - break; - - case SEC_E_INVALID_HANDLE: - pszName = "SEC_E_INVALID_HANDLE - A context handle that is not valid was specified in the phContext parameter. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_INVALID_TOKEN: - pszName = "SEC_E_INVALID_TOKEN - The buffers are of the wrong type or no buffer of type SECBUFFER_DATA was found. Used with the Schannel SSP."; - break; - - case SEC_E_MESSAGE_ALTERED: - pszName = "SEC_E_MESSAGE_ALTERED - The message has been altered. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_OUT_OF_SEQUENCE: - pszName = "SEC_E_OUT_OF_SEQUENCE - The message was not received in the correct sequence."; - break; - - case SEC_E_QOP_NOT_SUPPORTED: - pszName = "SEC_E_QOP_NOT_SUPPORTED - Neither confidentiality nor integrity are supported by the security context. Used with the Digest SSP."; - break; - - case SEC_I_CONTEXT_EXPIRED: - pszName = "SEC_I_CONTEXT_EXPIRED - The message sender has finished using the connection and has initiated a shutdown."; - break; - - case SEC_I_RENEGOTIATE: - pszName = "SEC_I_RENEGOTIATE - The remote party requires a new handshake sequence or the application has just initiated a shutdown."; - break; - - case SEC_E_ENCRYPT_FAILURE: - pszName = "SEC_E_ENCRYPT_FAILURE - The specified data could not be encrypted."; - break; - - case SEC_E_DECRYPT_FAILURE: - pszName = "SEC_E_DECRYPT_FAILURE - The specified data could not be decrypted."; - break; - case -1: - pszName = "Failed to load security.dll library"; - break; - } - - return pszName; -} - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h deleted file mode 100644 index 1d9387d6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef SECURITY_CONTEXT_H -#define SECURITY_CONTEXT_H - -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include -#include -#include -#include -#include "security_credentials.h" -#include "../worker.h" -#include - -extern "C" { - #include "../kerberos_sspi.h" - #include "../base64.h" -} - -using namespace v8; -using namespace node; - -class SecurityContext : public Nan::ObjectWrap { - public: - SecurityContext(); - ~SecurityContext(); - - // Security info package - PSecPkgInfo m_PkgInfo; - // Do we have a context - bool hasContext; - // Reference to security credentials - SecurityCredentials *security_credentials; - // Security context - CtxtHandle m_Context; - // Attributes - DWORD CtxtAttr; - // Expiry time for ticket - TimeStamp Expiration; - // Payload - char *payload; - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(InitializeContext); - static NAN_METHOD(InitalizeStep); - static NAN_METHOD(DecryptMessage); - static NAN_METHOD(QueryContextAttributes); - static NAN_METHOD(EncryptMessage); - - // Payload getter - static NAN_GETTER(PayloadGetter); - // hasContext getter - static NAN_GETTER(HasContextGetter); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - // private: - // Create a new instance - static NAN_METHOD(New); -}; - -#endif diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js deleted file mode 100644 index ef04e927..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js +++ /dev/null @@ -1,3 +0,0 @@ -var SecurityContextNative = require('../../../build/Release/kerberos').SecurityContext; -// Export the modified class -exports.SecurityContext = SecurityContextNative; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc deleted file mode 100644 index 732af3f8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc +++ /dev/null @@ -1,348 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "security_credentials.h" - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) -#endif - -static LPSTR DisplaySECError(DWORD ErrCode); - -Nan::Persistent SecurityCredentials::constructor_template; - -SecurityCredentials::SecurityCredentials() : Nan::ObjectWrap() { -} - -SecurityCredentials::~SecurityCredentials() { -} - -NAN_METHOD(SecurityCredentials::New) { - // Create security credentials instance - SecurityCredentials *security_credentials = new SecurityCredentials(); - // Wrap it - security_credentials->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -// Call structs -typedef struct SecurityCredentialCall { - char *package_str; - char *username_str; - char *password_str; - char *domain_str; - SecurityCredentials *credentials; -} SecurityCredentialCall; - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientInit -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authSSPIAquire(Worker *worker) { - // Status of operation - SECURITY_STATUS status; - - // Unpack data - SecurityCredentialCall *call = (SecurityCredentialCall *)worker->parameters; - - // // Unwrap the credentials - // SecurityCredentials *security_credentials = (SecurityCredentials *)call->credentials; - SecurityCredentials *security_credentials = new SecurityCredentials(); - - // If we have domain string - if(call->domain_str != NULL) { - security_credentials->m_Identity.Domain = USTR(_tcsdup(call->domain_str)); - security_credentials->m_Identity.DomainLength = (unsigned long)_tcslen(call->domain_str); - } else { - security_credentials->m_Identity.Domain = NULL; - security_credentials->m_Identity.DomainLength = 0; - } - - // Set up the user - security_credentials->m_Identity.User = USTR(_tcsdup(call->username_str)); - security_credentials->m_Identity.UserLength = (unsigned long)_tcslen(call->username_str); - - // If we have a password string - if(call->password_str != NULL) { - // Set up the password - security_credentials->m_Identity.Password = USTR(_tcsdup(call->password_str)); - security_credentials->m_Identity.PasswordLength = (unsigned long)_tcslen(call->password_str); - } - - #ifdef _UNICODE - security_credentials->m_Identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; - #else - security_credentials->m_Identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI; - #endif - - // Attempt to acquire credentials - status = _sspi_AcquireCredentialsHandle( - NULL, - call->package_str, - SECPKG_CRED_OUTBOUND, - NULL, - call->password_str != NULL ? &security_credentials->m_Identity : NULL, - NULL, NULL, - &security_credentials->m_Credentials, - &security_credentials->Expiration - ); - - // We have an error - if(status != SEC_E_OK) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } else { - worker->return_code = status; - worker->return_value = security_credentials; - } - - // Free up parameter structure - if(call->package_str != NULL) free(call->package_str); - if(call->domain_str != NULL) free(call->domain_str); - if(call->password_str != NULL) free(call->password_str); - if(call->username_str != NULL) free(call->username_str); - free(call); -} - -static Local _map_authSSPIAquire(Worker *worker) { - return Nan::Null(); -} - -NAN_METHOD(SecurityCredentials::Aquire) { - char *package_str = NULL, *username_str = NULL, *password_str = NULL, *domain_str = NULL; - // Unpack the variables - if(info.Length() != 2 && info.Length() != 3 && info.Length() != 4 && info.Length() != 5) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(!info[0]->IsString()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(!info[1]->IsString()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(info.Length() == 3 && (!info[2]->IsString() && !info[2]->IsFunction())) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(info.Length() == 4 && (!info[3]->IsString() && !info[3]->IsUndefined() && !info[3]->IsNull()) && !info[3]->IsFunction()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(info.Length() == 5 && !info[4]->IsFunction()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - Local callbackHandle; - - // Figure out which parameter is the callback - if(info.Length() == 5) { - callbackHandle = Local::Cast(info[4]); - } else if(info.Length() == 4) { - callbackHandle = Local::Cast(info[3]); - } else if(info.Length() == 3) { - callbackHandle = Local::Cast(info[2]); - } - - // Unpack the package - Local package = info[0]->ToString(); - package_str = (char *)calloc(package->Utf8Length() + 1, sizeof(char)); - package->WriteUtf8(package_str); - - // Unpack the user name - Local username = info[1]->ToString(); - username_str = (char *)calloc(username->Utf8Length() + 1, sizeof(char)); - username->WriteUtf8(username_str); - - // If we have a password - if(info.Length() == 3 || info.Length() == 4 || info.Length() == 5) { - Local password = info[2]->ToString(); - password_str = (char *)calloc(password->Utf8Length() + 1, sizeof(char)); - password->WriteUtf8(password_str); - } - - // If we have a domain - if((info.Length() == 4 || info.Length() == 5) && info[3]->IsString()) { - Local domain = info[3]->ToString(); - domain_str = (char *)calloc(domain->Utf8Length() + 1, sizeof(char)); - domain->WriteUtf8(domain_str); - } - - // Allocate call structure - SecurityCredentialCall *call = (SecurityCredentialCall *)calloc(1, sizeof(SecurityCredentialCall)); - call->domain_str = domain_str; - call->package_str = package_str; - call->password_str = password_str; - call->username_str = username_str; - - // Unpack the callback - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authSSPIAquire; - worker->mapper = _map_authSSPIAquire; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, SecurityCredentials::Process, (uv_after_work_cb)SecurityCredentials::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -void SecurityCredentials::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityCredentials").ToLocalChecked()); - - // Class methods - Nan::SetMethod(t, "aquire", Aquire); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityCredentials").ToLocalChecked(), t->GetFunction()); - - // Attempt to load the security.dll library - load_library(); -} - -static LPSTR DisplaySECError(DWORD ErrCode) { - LPSTR pszName = NULL; // WinError.h - - switch(ErrCode) { - case SEC_E_BUFFER_TOO_SMALL: - pszName = "SEC_E_BUFFER_TOO_SMALL - The message buffer is too small. Used with the Digest SSP."; - break; - - case SEC_E_CRYPTO_SYSTEM_INVALID: - pszName = "SEC_E_CRYPTO_SYSTEM_INVALID - The cipher chosen for the security context is not supported. Used with the Digest SSP."; - break; - case SEC_E_INCOMPLETE_MESSAGE: - pszName = "SEC_E_INCOMPLETE_MESSAGE - The data in the input buffer is incomplete. The application needs to read more data from the server and call DecryptMessage (General) again."; - break; - - case SEC_E_INVALID_HANDLE: - pszName = "SEC_E_INVALID_HANDLE - A context handle that is not valid was specified in the phContext parameter. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_INVALID_TOKEN: - pszName = "SEC_E_INVALID_TOKEN - The buffers are of the wrong type or no buffer of type SECBUFFER_DATA was found. Used with the Schannel SSP."; - break; - - case SEC_E_MESSAGE_ALTERED: - pszName = "SEC_E_MESSAGE_ALTERED - The message has been altered. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_OUT_OF_SEQUENCE: - pszName = "SEC_E_OUT_OF_SEQUENCE - The message was not received in the correct sequence."; - break; - - case SEC_E_QOP_NOT_SUPPORTED: - pszName = "SEC_E_QOP_NOT_SUPPORTED - Neither confidentiality nor integrity are supported by the security context. Used with the Digest SSP."; - break; - - case SEC_I_CONTEXT_EXPIRED: - pszName = "SEC_I_CONTEXT_EXPIRED - The message sender has finished using the connection and has initiated a shutdown."; - break; - - case SEC_I_RENEGOTIATE: - pszName = "SEC_I_RENEGOTIATE - The remote party requires a new handshake sequence or the application has just initiated a shutdown."; - break; - - case SEC_E_ENCRYPT_FAILURE: - pszName = "SEC_E_ENCRYPT_FAILURE - The specified data could not be encrypted."; - break; - - case SEC_E_DECRYPT_FAILURE: - pszName = "SEC_E_DECRYPT_FAILURE - The specified data could not be decrypted."; - break; - case -1: - pszName = "Failed to load security.dll library"; - break; - - } - - return pszName; -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// UV Lib callbacks -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void SecurityCredentials::Process(uv_work_t* work_req) { - // Grab the worker - Worker *worker = static_cast(work_req->data); - // Execute the worker code - worker->execute(worker); -} - -void SecurityCredentials::After(uv_work_t* work_req) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Get the worker reference - Worker *worker = static_cast(work_req->data); - - // If we have an error - if(worker->error) { - Local err = v8::Exception::Error(Nan::New(worker->error_message).ToLocalChecked()); - Local obj = err->ToObject(); - obj->Set(Nan::New("code").ToLocalChecked(), Nan::New(worker->error_code)); - Local info[2] = { err, Nan::Null() }; - // Execute the error - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } else { - SecurityCredentials *return_value = (SecurityCredentials *)worker->return_value; - // Create a new instance - Local result = Nan::New(constructor_template)->GetFunction()->NewInstance(); - // Unwrap the credentials - SecurityCredentials *security_credentials = Nan::ObjectWrap::Unwrap(result); - // Set the values - security_credentials->m_Identity = return_value->m_Identity; - security_credentials->m_Credentials = return_value->m_Credentials; - security_credentials->Expiration = return_value->Expiration; - // Set up the callback with a null first - Local info[2] = { Nan::Null(), result}; - // Wrap the callback function call in a TryCatch so that we can call - // node's FatalException afterwards. This makes it possible to catch - // the exception from JavaScript land using the - // process.on('uncaughtException') event. - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } - - // Clean up the memory - delete worker->callback; - delete worker; -} - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h deleted file mode 100644 index 71751a0f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SECURITY_CREDENTIALS_H -#define SECURITY_CREDENTIALS_H - -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include -#include -#include -#include -#include -#include "../worker.h" -#include - -extern "C" { - #include "../kerberos_sspi.h" -} - -// SEC_WINNT_AUTH_IDENTITY makes it unusually hard -// to compile for both Unicode and ansi, so I use this macro: -#ifdef _UNICODE -#define USTR(str) (str) -#else -#define USTR(str) ((unsigned char*)(str)) -#endif - -using namespace v8; -using namespace node; - -class SecurityCredentials : public Nan::ObjectWrap { - public: - SecurityCredentials(); - ~SecurityCredentials(); - - // Pointer to context object - SEC_WINNT_AUTH_IDENTITY m_Identity; - // credentials - CredHandle m_Credentials; - // Expiry time for ticket - TimeStamp Expiration; - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(Aquire); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - private: - // Create a new instance - static NAN_METHOD(New); - // Handles the uv calls - static void Process(uv_work_t* work_req); - // Called after work is done - static void After(uv_work_t* work_req); -}; - -#endif \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js deleted file mode 100644 index 4215c927..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js +++ /dev/null @@ -1,22 +0,0 @@ -var SecurityCredentialsNative = require('../../../build/Release/kerberos').SecurityCredentials; - -// Add simple kebros helper -SecurityCredentialsNative.aquire_kerberos = function(username, password, domain, callback) { - if(typeof password == 'function') { - callback = password; - password = null; - } else if(typeof domain == 'function') { - callback = domain; - domain = null; - } - - // We are going to use the async version - if(typeof callback == 'function') { - return SecurityCredentialsNative.aquire('Kerberos', username, password, domain, callback); - } else { - return SecurityCredentialsNative.aquireSync('Kerberos', username, password, domain); - } -} - -// Export the modified class -exports.SecurityCredentials = SecurityCredentialsNative; \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc deleted file mode 100644 index e7a472f6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "worker.h" - -Worker::Worker() { -} - -Worker::~Worker() { -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h deleted file mode 100644 index 1b0dced5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef WORKER_H_ -#define WORKER_H_ - -#include -#include -#include -#include - -using namespace node; -using namespace v8; - -class Worker { - public: - Worker(); - virtual ~Worker(); - - // libuv's request struct. - uv_work_t request; - // Callback - Nan::Callback *callback; - // Parameters - void *parameters; - // Results - void *return_value; - // Did we raise an error - bool error; - // The error message - char *error_message; - // Error code if not message - int error_code; - // Any return code - int return_code; - // Method we are going to fire - void (*execute)(Worker *worker); - Local (*mapper)(Worker *worker); -}; - -#endif // WORKER_H_ diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc deleted file mode 100644 index 47971da6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc +++ /dev/null @@ -1,30 +0,0 @@ -## DNT config file -## see https://github.com/rvagg/dnt - -NODE_VERSIONS="\ - master \ - v0.11.13 \ - v0.10.30 \ - v0.10.29 \ - v0.10.28 \ - v0.10.26 \ - v0.10.25 \ - v0.10.24 \ - v0.10.23 \ - v0.10.22 \ - v0.10.21 \ - v0.10.20 \ - v0.10.19 \ - v0.8.28 \ - v0.8.27 \ - v0.8.26 \ - v0.8.24 \ -" -OUTPUT_PREFIX="nan-" -TEST_CMD=" \ - cd /dnt/ && \ - npm install && \ - node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ - node_modules/.bin/tap --gc test/js/*-test.js \ -" - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md deleted file mode 100644 index 457e7c44..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md +++ /dev/null @@ -1,374 +0,0 @@ -# NAN ChangeLog - -**Version 2.0.9: current Node 4.0.0, Node 12: 0.12.7, Node 10: 0.10.40, iojs: 3.2.0** - -### 2.0.9 Sep 8 2015 - - - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 - -### 2.0.8 Aug 28 2015 - - - Work around duplicate linking bug in clang 11902da - -### 2.0.7 Aug 26 2015 - - - Build: Repackage - -### 2.0.6 Aug 26 2015 - - - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 - - Bugfix: Remove unused static std::map instances 525bddc - - Bugfix: Make better use of maybe versions of APIs bfba85b - - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d - -### 2.0.5 Aug 10 2015 - - - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 - - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d - -### 2.0.4 Aug 6 2015 - - - Build: Repackage - -### 2.0.3 Aug 6 2015 - - - Bugfix: Don't use clang++ / g++ syntax extension. 231450e - -### 2.0.2 Aug 6 2015 - - - Build: Repackage - -### 2.0.1 Aug 6 2015 - - - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 - - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 - - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f - - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed - -### 2.0.0 Jul 31 2015 - - - Change: Renamed identifiers with leading underscores b5932b4 - - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 - - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 - - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 - - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 - - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d - - Change: Remove Nan prefix from all names 72d1f67 - - Change: Update Buffer API for new upstream changes d5d3291 - - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a - - Change: Get rid of Handles e6c0daf - - Feature: Support io.js 3 with V8 4.4 - - Feature: Introduce NanPersistent 7fed696 - - Feature: Introduce NanGlobal 4408da1 - - Feature: Added NanTryCatch 10f1ca4 - - Feature: Update for V8 v4.3 4b6404a - - Feature: Introduce NanNewOneByteString c543d32 - - Feature: Introduce namespace Nan 67ed1b1 - - Removal: Remove NanLocker and NanUnlocker dd6e401 - - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 - - Removal: Remove NanReturn* macros d90a25c - - Removal: Remove HasInstance e8f84fe - - -### 1.9.0 Jul 31 2015 - - - Feature: Added `NanFatalException` 81d4a2c - - Feature: Added more error types 4265f06 - - Feature: Added dereference and function call operators to NanCallback c4b2ed0 - - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c - - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 - - Feature: Added NanErrnoException dd87d9e - - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 - - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c - - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b - -### 1.8.4 Apr 26 2015 - - - Build: Repackage - -### 1.8.3 Apr 26 2015 - - - Bugfix: Include missing header 1af8648 - -### 1.8.2 Apr 23 2015 - - - Build: Repackage - -### 1.8.1 Apr 23 2015 - - - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 - -### 1.8.0 Apr 23 2015 - - - Feature: Allow primitives with NanReturnValue 2e4475e - - Feature: Added comparison operators to NanCallback 55b075e - - Feature: Backport thread local storage 15bb7fa - - Removal: Remove support for signatures with arguments 8a2069d - - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 - -### 1.7.0 Feb 28 2015 - - - Feature: Made NanCallback::Call accept optional target 8d54da7 - - Feature: Support atom-shell 0.21 0b7f1bb - -### 1.6.2 Feb 6 2015 - - - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 - -### 1.6.1 Jan 23 2015 - - - Build: version bump - -### 1.5.3 Jan 23 2015 - - - Build: repackage - -### 1.6.0 Jan 23 2015 - - - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af - - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 - - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 - -### 1.5.2 Jan 23 2015 - - - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 - - Bugfix: Readded missing String constructors 18d828f - - Bugfix: Add overload handling NanNew(..) 5ef813b - - Bugfix: Fix uv_work_cb versioning 997e4ae - - Bugfix: Add function factory and test 4eca89c - - Bugfix: Add object template factory and test cdcb951 - - Correctness: Lifted an io.js related typedef c9490be - - Correctness: Make explicit downcasts of String lengths 00074e6 - - Windows: Limit the scope of disabled warning C4530 83d7deb - -### 1.5.1 Jan 15 2015 - - - Build: version bump - -### 1.4.3 Jan 15 2015 - - - Build: version bump - -### 1.4.2 Jan 15 2015 - - - Feature: Support io.js 0dbc5e8 - -### 1.5.0 Jan 14 2015 - - - Feature: Support io.js b003843 - - Correctness: Improved NanNew internals 9cd4f6a - - Feature: Implement progress to NanAsyncWorker 8d6a160 - -### 1.4.1 Nov 8 2014 - - - Bugfix: Handle DEBUG definition correctly - - Bugfix: Accept int as Boolean - -### 1.4.0 Nov 1 2014 - - - Feature: Added NAN_GC_CALLBACK 6a5c245 - - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 - - Correctness: Added constness to references in NanHasInstance 02c61cd - - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 - - Windoze: Shut Visual Studio up when compiling 8d558c1 - - License: Switch to plain MIT from custom hacked MIT license 11de983 - - Build: Added test target to Makefile e232e46 - - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 - - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 - - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 - -### 1.3.0 Aug 2 2014 - - - Added NanNew(std::string) - - Added NanNew(std::string&) - - Added NanAsciiString helper class - - Added NanUtf8String helper class - - Added NanUcs2String helper class - - Deprecated NanRawString() - - Deprecated NanCString() - - Added NanGetIsolateData(v8::Isolate *isolate) - - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) - - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) - - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - -### 1.2.0 Jun 5 2014 - - - Add NanSetPrototypeTemplate - - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, - introduced _NanWeakCallbackDispatcher - - Removed -Wno-unused-local-typedefs from test builds - - Made test builds Windows compatible ('Sleep()') - -### 1.1.2 May 28 2014 - - - Release to fix more stuff-ups in 1.1.1 - -### 1.1.1 May 28 2014 - - - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 - -### 1.1.0 May 25 2014 - - - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead - - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), - (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, - v8::String::ExternalAsciiStringResource* - - Deprecate NanSymbol() - - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker - -### 1.0.0 May 4 2014 - - - Heavy API changes for V8 3.25 / Node 0.11.13 - - Use cpplint.py - - Removed NanInitPersistent - - Removed NanPersistentToLocal - - Removed NanFromV8String - - Removed NanMakeWeak - - Removed NanNewLocal - - Removed NAN_WEAK_CALLBACK_OBJECT - - Removed NAN_WEAK_CALLBACK_DATA - - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions - - Introduce NanUndefined, NanNull, NanTrue and NanFalse - - Introduce NanEscapableScope and NanEscapeScope - - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) - - Introduce NanMakeCallback for node::MakeCallback - - Introduce NanSetTemplate - - Introduce NanGetCurrentContext - - Introduce NanCompileScript and NanRunScript - - Introduce NanAdjustExternalMemory - - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback - - Introduce NanGetHeapStatistics - - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() - -### 0.8.0 Jan 9 2014 - - - NanDispose -> NanDisposePersistent, deprecate NanDispose - - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() - -### 0.7.1 Jan 9 2014 - - - Fixes to work against debug builds of Node - - Safer NanPersistentToLocal (avoid reinterpret_cast) - - Speed up common NanRawString case by only extracting flattened string when necessary - -### 0.7.0 Dec 17 2013 - - - New no-arg form of NanCallback() constructor. - - NanCallback#Call takes Handle rather than Local - - Removed deprecated NanCallback#Run method, use NanCallback#Call instead - - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS - - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() - - Introduce NanRawString() for char* (or appropriate void*) from v8::String - (replacement for NanFromV8String) - - Introduce NanCString() for null-terminated char* from v8::String - -### 0.6.0 Nov 21 2013 - - - Introduce NanNewLocal(v8::Handle value) for use in place of - v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 - -### 0.5.2 Nov 16 2013 - - - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public - -### 0.5.1 Nov 12 2013 - - - Use node::MakeCallback() instead of direct v8::Function::Call() - -### 0.5.0 Nov 11 2013 - - - Added @TooTallNate as collaborator - - New, much simpler, "include_dirs" for binding.gyp - - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros - -### 0.4.4 Nov 2 2013 - - - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ - -### 0.4.3 Nov 2 2013 - - - Include node_object_wrap.h, removed from node.h for Node 0.11.8. - -### 0.4.2 Nov 2 2013 - - - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for - Node 0.11.8 release. - -### 0.4.1 Sep 16 2013 - - - Added explicit `#include ` as it was removed from node.h for v0.11.8 - -### 0.4.0 Sep 2 2013 - - - Added NAN_INLINE and NAN_DEPRECATED and made use of them - - Added NanError, NanTypeError and NanRangeError - - Cleaned up code - -### 0.3.2 Aug 30 2013 - - - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent - in NanAsyncWorker - -### 0.3.1 Aug 20 2013 - - - fix "not all control paths return a value" compile warning on some platforms - -### 0.3.0 Aug 19 2013 - - - Made NAN work with NPM - - Lots of fixes to NanFromV8String, pulling in features from new Node core - - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API - - Added optional error number argument for NanThrowError() - - Added NanInitPersistent() - - Added NanReturnNull() and NanReturnEmptyString() - - Added NanLocker and NanUnlocker - - Added missing scopes - - Made sure to clear disposed Persistent handles - - Changed NanAsyncWorker to allocate error messages on the heap - - Changed NanThrowError(Local) to NanThrowError(Handle) - - Fixed leak in NanAsyncWorker when errmsg is used - -### 0.2.2 Aug 5 2013 - - - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() - -### 0.2.1 Aug 5 2013 - - - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for - NanFromV8String() - -### 0.2.0 Aug 5 2013 - - - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, - NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY - - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, - _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, - _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, - _NAN_PROPERTY_QUERY_ARGS - - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer - - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, - NAN_WEAK_CALLBACK_DATA, NanMakeWeak - - Renamed THROW_ERROR to _NAN_THROW_ERROR - - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) - - Added NanBufferUse(char*, uint32_t) - - Added NanNewContextHandle(v8::ExtensionConfiguration*, - v8::Handle, v8::Handle) - - Fixed broken NanCallback#GetFunction() - - Added optional encoding and size arguments to NanFromV8String() - - Added NanGetPointerSafe() and NanSetPointerSafe() - - Added initial test suite (to be expanded) - - Allow NanUInt32OptionValue to convert any Number object - -### 0.1.0 Jul 21 2013 - - - Added `NAN_GETTER`, `NAN_SETTER` - - Added `NanThrowError` with single Local argument - - Added `NanNewBufferHandle` with single uint32_t argument - - Added `NanHasInstance(Persistent&, Handle)` - - Added `Local NanCallback#GetFunction()` - - Added `NanCallback#Call(int, Local[])` - - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md deleted file mode 100644 index 77666cdf..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2015 NAN contributors ------------------------------------ - -*NAN contributors listed at * - -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/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md deleted file mode 100644 index db3daec9..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md +++ /dev/null @@ -1,367 +0,0 @@ -Native Abstractions for Node.js -=============================== - -**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10 and 0.12 as well as io.js.** - -***Current version: 2.0.9*** - -*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* - -[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) - -[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](http://travis-ci.org/nodejs/nan) -[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) - -Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. - -This project also contains some helper utilities that make addon development a bit more pleasant. - - * **[News & Updates](#news)** - * **[Usage](#usage)** - * **[Example](#example)** - * **[API](#api)** - * **[Tests](#tests)** - * **[Governance & Contributing](#governance)** - - -## News & Updates - - -## Usage - -Simply add **NAN** as a dependency in the *package.json* of your Node addon: - -``` bash -$ npm install --save nan -``` - -Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: - -``` python -"include_dirs" : [ - "` when compiling your addon. - - -## Example - -Just getting started with Nan? Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. - -For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. - -For another example, see **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. - - -## API - -Additional to the NAN documentation below, please consult: - -* [The V8 Getting Started Guide](https://developers.google.com/v8/get_started) -* [The V8 Embedders Guide](https://developers.google.com/v8/embed) -* [V8 API Documentation](http://v8docs.nodesource.com/) - - - -### JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://developers.google.com/v8/embed#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetPrototypeMethod() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - -### Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - -### Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - -### New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - -### Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - -### Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - -### Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - -### Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - -### Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - -### Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - -### Asynchronous work helpers - -`Nan::AsyncWorker` and `Nan::AsyncProgressWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorker - - Nan::AsyncQueueWorker - -### Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - -### V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - -### Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - -### Miscellaneous Node Helpers - - - Nan::MakeCallback() - - Nan::ObjectWrap - - NAN_MODULE_INIT() - - Nan::Export() - - - - - -### Tests - -To run the NAN tests do: - -``` sh -npm install -npm run-script rebuild-tests -npm test -``` - -Or just: - -``` sh -npm install -make test -``` - - -## Governance & Contributing - -NAN is governed by the [io.js](https://iojs.org/) Addon API Working Group - -### Addon API Working Group (WG) - -The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. - -Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other io.js projects. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project [README.md](./README.md#collaborators). - -Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. - -_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. - -For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). - -### Consensus Seeking Process - -The WG follows a [Consensus Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. - -Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. - -If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. - -### Developer's Certificate of Origin 1.0 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or -* (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or -* (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. - - -### WG Members / Collaborators - - - - - - - - - -
      Rod VaggGitHub/rvaggTwitter/@rvagg
      Benjamin ByholmGitHub/kkoopa-
      Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
      Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
      Brett LawsonGitHub/brett19Twitter/@brett19x
      Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
      David SiegelGitHub/agnat-
      - -## Licence & copyright - -Copyright (c) 2015 NAN WG Members / Collaborators (listed above). - -Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml deleted file mode 100644 index 1378d310..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml +++ /dev/null @@ -1,38 +0,0 @@ -# http://www.appveyor.com/docs/appveyor-yml - -# Test against these versions of Io.js and Node.js. -environment: - matrix: - # node.js - - nodejs_version: "0.8" - - nodejs_version: "0.10" - - nodejs_version: "0.12" - # io.js - - nodejs_version: "1" - - nodejs_version: "2" - - nodejs_version: "3" - -# Install scripts. (runs after repo cloning) -install: - # Get the latest stable version of Node 0.STABLE.latest - - ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version} - - ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)} - - IF %nodejs_version% LSS 1 npm -g install npm - - IF %nodejs_version% LSS 1 set PATH=%APPDATA%\npm;%PATH% - # Typical npm stuff. - - npm install - - IF %nodejs_version% EQU 0.8 (node node_modules\node-gyp\bin\node-gyp.js rebuild --msvs_version=2013 --directory test) ELSE (npm run rebuild-tests) - -# Post-install test scripts. -test_script: - # Output useful info for debugging. - - node --version - - npm --version - # run tests - - IF %nodejs_version% LSS 1 (npm test) ELSE (iojs node_modules\tap\bin\tap.js --gc test/js/*-test.js) - -# Don't actually build. -build: off - -# Set build version format here instead of in the admin panel. -version: "{build}" diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh deleted file mode 100755 index 75a975af..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -files=" \ - methods.md \ - scopes.md \ - persistent.md \ - new.md \ - converters.md \ - maybe_types.md \ - script.md \ - errors.md \ - buffers.md \ - callback.md \ - asyncworker.md \ - string_bytes.md \ - v8_internals.md \ - v8_misc.md \ - node_misc.md \ -" - -__dirname=$(dirname "${BASH_SOURCE[0]}") -head=$(perl -e 'while (<>) { if (!$en){print;} if ($_=~/ NanNew("foo").ToLocalChecked() */ - if (arguments[groups[3][0]] === 'NanNew') { - return [arguments[0], '.ToLocalChecked()'].join(''); - } - - /* insert warning for removed functions as comment on new line above */ - switch (arguments[groups[4][0]]) { - case 'GetIndexedPropertiesExternalArrayData': - case 'GetIndexedPropertiesExternalArrayDataLength': - case 'GetIndexedPropertiesExternalArrayDataType': - case 'GetIndexedPropertiesPixelData': - case 'GetIndexedPropertiesPixelDataLength': - case 'HasIndexedPropertiesInExternalArrayData': - case 'HasIndexedPropertiesInPixelData': - case 'SetIndexedPropertiesToExternalArrayData': - case 'SetIndexedPropertiesToPixelData': - return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); - default: - } - - /* remove unnecessary NanScope() */ - switch (arguments[groups[5][0]]) { - case 'NAN_GETTER': - case 'NAN_METHOD': - case 'NAN_SETTER': - case 'NAN_INDEX_DELETER': - case 'NAN_INDEX_ENUMERATOR': - case 'NAN_INDEX_GETTER': - case 'NAN_INDEX_QUERY': - case 'NAN_INDEX_SETTER': - case 'NAN_PROPERTY_DELETER': - case 'NAN_PROPERTY_ENUMERATOR': - case 'NAN_PROPERTY_GETTER': - case 'NAN_PROPERTY_QUERY': - case 'NAN_PROPERTY_SETTER': - return arguments[groups[5][0] - 1]; - default: - } - - /* Value converstion */ - switch (arguments[groups[6][0]]) { - case 'Boolean': - case 'Int32': - case 'Integer': - case 'Number': - case 'Object': - case 'String': - case 'Uint32': - return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); - default: - } - - /* other value conversion */ - switch (arguments[groups[7][0]]) { - case 'BooleanValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Int32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'IntegerValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Uint32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - default: - } - - /* NAN_WEAK_CALLBACK */ - if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { - return ['template\nvoid ', - arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); - } - - /* use methods on NAN classes instead */ - switch (arguments[groups[9][0]]) { - case 'NanDisposePersistent': - return [arguments[groups[9][0] + 1], '.Reset('].join(''); - case 'NanObjectWrapHandle': - return [arguments[groups[9][0] + 1], '->handle('].join(''); - default: - } - - /* use method on NanPersistent instead */ - if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { - return arguments[groups[10][0] + 1] + '.SetWeak('; - } - - /* These return Maybes, the upper ones take no arguments */ - switch (arguments[groups[11][0]]) { - case 'GetEndColumn': - case 'GetFunction': - case 'GetLineNumber': - case 'GetOwnPropertyNames': - case 'GetPropertyNames': - case 'GetSourceLine': - case 'GetStartColumn': - case 'NewInstance': - case 'ObjectProtoToString': - case 'ToArrayIndex': - case 'ToDetailString': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); - case 'CallAsConstructor': - case 'CallAsFunction': - case 'CloneElementAt': - case 'Delete': - case 'ForceSet': - case 'Get': - case 'GetPropertyAttributes': - case 'GetRealNamedProperty': - case 'GetRealNamedPropertyInPrototypeChain': - case 'Has': - case 'HasOwnProperty': - case 'HasRealIndexedProperty': - case 'HasRealNamedCallbackProperty': - case 'HasRealNamedProperty': - case 'Set': - case 'SetAccessor': - case 'SetIndexedPropertyHandler': - case 'SetNamedPropertyHandler': - case 'SetPrototype': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); - default: - } - - /* Automatic ToLocalChecked(), take it or leave it */ - switch (arguments[groups[12][0]]) { - case 'Date': - case 'String': - case 'RegExp': - return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); - default: - } - - /* NanEquals is now required for uniformity */ - if (arguments[groups[13][0]] === 'Equals') { - return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); - } - - /* use method on replacement class instead */ - if (arguments[groups[14][0]] === 'NanAssignPersistent') { - return [arguments[groups[14][0] + 1], '.Reset('].join(''); - } - - /* args --> info */ - if (arguments[groups[15][0]] === 'args') { - return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); - } - - /* ObjectWrap --> NanObjectWrap */ - if (arguments[groups[16][0]] === 'ObjectWrap') { - return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); - } - - /* Persistent --> NanPersistent */ - if (arguments[groups[17][0]] === 'Persistent') { - return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); - } - - /* This should not happen. A switch is probably missing a case if it does. */ - throw 'Unhandled match: ' + arguments[0]; -} - -/* reads a file, runs replacement and writes it back */ -function processFile(file) { - fs.readFile(file, {encoding: 'utf8'}, function (err, data) { - if (err) { - throw err; - } - - /* run replacement twice, might need more runs */ - fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { - if (err) { - throw err; - } - }); - }); -} - -/* process file names from command line and process the identified files */ -for (i = 2, length = process.argv.length; i < length; i++) { - glob(process.argv[i], function (err, matches) { - if (err) { - throw err; - } - matches.forEach(processFile); - }); -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md deleted file mode 100644 index 7f07e4b8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md +++ /dev/null @@ -1,14 +0,0 @@ -1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, -false positives and missed opportunities. The input files are rewritten in place. Make sure that -you have backups. You will have to manually review the changes afterwards and do some touchups. - -```sh -$ tools/1to2.js - - Usage: 1to2 [options] - - Options: - - -h, --help output usage information - -V, --version output the version number -``` diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json deleted file mode 100644 index 2dcdd789..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "1to2", - "version": "1.0.0", - "description": "NAN 1 -> 2 Migration Script", - "main": "1to2.js", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "contributors": [ - "Benjamin Byholm (https://github.com/kkoopa/)", - "Mathias Küsel (https://github.com/mathiask88/)" - ], - "dependencies": { - "glob": "~5.0.10", - "commander": "~2.8.1" - }, - "license": "MIT" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json deleted file mode 100644 index d1eae758..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json +++ /dev/null @@ -1,56 +0,0 @@ -{ - "name": "kerberos", - "version": "0.0.15", - "description": "Kerberos library for Node.js", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/christkv/kerberos.git" - }, - "keywords": [ - "kerberos", - "security", - "authentication" - ], - "dependencies": { - "nan": "~2.0" - }, - "devDependencies": { - "nodeunit": "latest" - }, - "scripts": { - "install": "(node-gyp rebuild) || (exit 0)", - "test": "nodeunit ./test" - }, - "author": { - "name": "Christian Amor Kvalheim" - }, - "license": "Apache 2.0", - "gitHead": "035be2e4619d7f3d7ea5103da1f60a6045ef8d7c", - "bugs": { - "url": "https://github.com/christkv/kerberos/issues" - }, - "homepage": "https://github.com/christkv/kerberos", - "_id": "kerberos@0.0.15", - "_shasum": "c7dd5a2d311ce79c308c2670a9187d9bf745ed52", - "_from": "kerberos@~0.0", - "_npmVersion": "2.14.4", - "_nodeVersion": "4.1.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "c7dd5a2d311ce79c308c2670a9187d9bf745ed52", - "tarball": "http://registry.npmjs.org/kerberos/-/kerberos-0.0.15.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/kerberos/-/kerberos-0.0.15.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js deleted file mode 100644 index a06c5fdf..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js +++ /dev/null @@ -1,34 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Simple initialize of Kerberos object'] = function(test) { - var Kerberos = require('../lib/kerberos.js').Kerberos; - var kerberos = new Kerberos(); - // console.dir(kerberos) - - // Initiate kerberos client - kerberos.authGSSClientInit('mongodb@kdc.10gen.me', Kerberos.GSS_C_MUTUAL_FLAG, function(err, context) { - console.log("===================================== authGSSClientInit") - test.equal(null, err); - test.ok(context != null && typeof context == 'object'); - // console.log("===================================== authGSSClientInit") - console.dir(err) - console.dir(context) - // console.dir(typeof result) - - // Perform the first step - kerberos.authGSSClientStep(context, function(err, result) { - console.log("===================================== authGSSClientStep") - console.dir(err) - console.dir(result) - console.dir(context) - - test.done(); - }); - }); -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js deleted file mode 100644 index c8509db8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js +++ /dev/null @@ -1,15 +0,0 @@ -if (/^win/.test(process.platform)) { - -exports['Simple initialize of Kerberos win32 object'] = function(test) { - var KerberosNative = require('../build/Release/kerberos').Kerberos; - // console.dir(KerberosNative) - var kerberos = new KerberosNative(); - console.log("=========================================== 0") - console.dir(kerberos.acquireAlternateCredentials("dev1@10GEN.ME", "a")); - console.log("=========================================== 1") - console.dir(kerberos.prepareOutboundPackage("mongodb/kdc.10gen.com")); - console.log("=========================================== 2") - test.done(); -} - -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js deleted file mode 100644 index 3531b6bc..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js +++ /dev/null @@ -1,41 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Initialize a security Buffer Descriptor'] = function(test) { - var SecurityBufferDescriptor = require('../../lib/sspi.js').SecurityBufferDescriptor - SecurityBuffer = require('../../lib/sspi.js').SecurityBuffer; - - // Create descriptor with single Buffer - var securityDescriptor = new SecurityBufferDescriptor(100); - try { - // Fail to work due to no valid Security Buffer - securityDescriptor = new SecurityBufferDescriptor(["hello"]); - test.ok(false); - } catch(err){} - - // Should Correctly construct SecurityBuffer - var buffer = new SecurityBuffer(SecurityBuffer.DATA, 100); - securityDescriptor = new SecurityBufferDescriptor([buffer]); - // Should correctly return a buffer - var result = securityDescriptor.toBuffer(); - test.equal(100, result.length); - - // Should Correctly construct SecurityBuffer - var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - securityDescriptor = new SecurityBufferDescriptor([buffer]); - var result = securityDescriptor.toBuffer(); - test.equal("hello world", result.toString()); - - // Test passing in more than one Buffer - var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - var buffer2 = new SecurityBuffer(SecurityBuffer.STREAM, new Buffer("adam and eve")); - securityDescriptor = new SecurityBufferDescriptor([buffer, buffer2]); - var result = securityDescriptor.toBuffer(); - test.equal("hello worldadam and eve", result.toString()); - test.done(); -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js deleted file mode 100644 index b52b9598..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js +++ /dev/null @@ -1,22 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Initialize a security Buffer'] = function(test) { - var SecurityBuffer = require('../../lib/sspi.js').SecurityBuffer; - // Create empty buffer - var securityBuffer = new SecurityBuffer(SecurityBuffer.DATA, 100); - var buffer = securityBuffer.toBuffer(); - test.equal(100, buffer.length); - - // Access data passed in - var allocated_buffer = new Buffer(256); - securityBuffer = new SecurityBuffer(SecurityBuffer.DATA, allocated_buffer); - buffer = securityBuffer.toBuffer(); - test.deepEqual(allocated_buffer, buffer); - test.done(); -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js deleted file mode 100644 index 77581800..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js +++ /dev/null @@ -1,55 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Initialize a set of security credentials'] = function(test) { - var SecurityCredentials = require('../../lib/sspi.js').SecurityCredentials; - - // Aquire some credentials - try { - var credentials = SecurityCredentials.aquire('Kerberos', 'dev1@10GEN.ME', 'a'); - } catch(err) { - console.dir(err) - test.ok(false); - } - - - - // console.dir(SecurityCredentials); - - // var SecurityBufferDescriptor = require('../../lib/sspi.js').SecurityBufferDescriptor - // SecurityBuffer = require('../../lib/sspi.js').SecurityBuffer; - - // // Create descriptor with single Buffer - // var securityDescriptor = new SecurityBufferDescriptor(100); - // try { - // // Fail to work due to no valid Security Buffer - // securityDescriptor = new SecurityBufferDescriptor(["hello"]); - // test.ok(false); - // } catch(err){} - - // // Should Correctly construct SecurityBuffer - // var buffer = new SecurityBuffer(SecurityBuffer.DATA, 100); - // securityDescriptor = new SecurityBufferDescriptor([buffer]); - // // Should correctly return a buffer - // var result = securityDescriptor.toBuffer(); - // test.equal(100, result.length); - - // // Should Correctly construct SecurityBuffer - // var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - // securityDescriptor = new SecurityBufferDescriptor([buffer]); - // var result = securityDescriptor.toBuffer(); - // test.equal("hello world", result.toString()); - - // // Test passing in more than one Buffer - // var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - // var buffer2 = new SecurityBuffer(SecurityBuffer.STREAM, new Buffer("adam and eve")); - // securityDescriptor = new SecurityBufferDescriptor([buffer, buffer2]); - // var result = securityDescriptor.toBuffer(); - // test.equal("hello worldadam and eve", result.toString()); - test.done(); -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json deleted file mode 100644 index cd832a66..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "mongodb-core", - "version": "1.2.19", - "description": "Core MongoDB driver functionality, no bells and whistles and meant for integration not end applications", - "main": "index.js", - "scripts": { - "test": "node test/runner.js -t functional" - }, - "repository": { - "type": "git", - "url": "git://github.com/christkv/mongodb-core.git" - }, - "keywords": [ - "mongodb", - "core" - ], - "dependencies": { - "bson": "~0.4.19", - "kerberos": "~0.0" - }, - "devDependencies": { - "integra": "0.1.8", - "optimist": "latest", - "jsdoc": "3.3.0-alpha8", - "semver": "4.1.0", - "gleak": "0.5.0", - "mongodb-tools": "~1.0", - "mkdirp": "0.5.0", - "rimraf": "2.2.6", - "mongodb-version-manager": "^0.8.8", - "co": "4.5.4" - }, - "optionalDependencies": { - "kerberos": "~0.0" - }, - "author": { - "name": "Christian Kvalheim" - }, - "license": "Apache 2.0", - "bugs": { - "url": "https://github.com/christkv/mongodb-core/issues" - }, - "homepage": "https://github.com/christkv/mongodb-core", - "gitHead": "16dd75df9f6745dd5437f289c6466084e09c72ab", - "_id": "mongodb-core@1.2.19", - "_shasum": "fcb35f6b6abc5c3de1f1a4a5db526b9e306f3eb7", - "_from": "mongodb-core@1.2.19", - "_npmVersion": "2.14.7", - "_nodeVersion": "4.2.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "fcb35f6b6abc5c3de1f1a4a5db526b9e306f3eb7", - "tarball": "http://registry.npmjs.org/mongodb-core/-/mongodb-core-1.2.19.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-1.2.19.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat deleted file mode 100644 index 25ccf0b6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat +++ /dev/null @@ -1,11000 +0,0 @@ -1 2 -2 1 -3 0 -4 0 -5 1 -6 0 -7 0 -8 0 -9 0 -10 1 -11 0 -12 0 -13 0 -14 1 -15 0 -16 0 -17 0 -18 1 -19 0 -20 0 -21 0 -22 1 -23 0 -24 0 -25 0 -26 0 -27 1 -28 0 -29 0 -30 0 -31 1 -32 0 -33 0 -34 0 -35 0 -36 0 -37 1 -38 0 -39 0 -40 0 -41 0 -42 0 -43 1 -44 0 -45 0 -46 0 -47 0 -48 0 -49 0 -50 0 -51 0 -52 0 -53 0 -54 0 -55 0 -56 0 -57 0 -58 0 -59 1 -60 0 -61 2 -62 0 -63 0 -64 1 -65 0 -66 0 -67 0 -68 1 -69 0 -70 0 -71 0 -72 0 -73 1 -74 0 -75 0 -76 0 -77 0 -78 0 -79 1 -80 0 -81 0 -82 0 -83 0 -84 0 -85 0 -86 1 -87 0 -88 0 -89 0 -90 0 -91 0 -92 0 -93 1 -94 0 -95 0 -96 0 -97 0 -98 0 -99 0 -100 0 -101 1 -102 0 -103 0 -104 0 -105 0 -106 0 -107 0 -108 1 -109 0 -110 0 -111 0 -112 0 -113 0 -114 0 -115 1 -116 0 -117 0 -118 0 -119 1 -120 0 -121 0 -122 0 -123 0 -124 0 -125 0 -126 1 -127 0 -128 1 -129 0 -130 0 -131 0 -132 1 -133 1 -134 0 -135 0 -136 0 -137 1 -138 0 -139 0 -140 0 -141 0 -142 0 -143 0 -144 1 -145 0 -146 0 -147 0 -148 0 -149 0 -150 0 -151 0 -152 0 -153 1 -154 0 -155 0 -156 0 -157 0 -158 0 -159 0 -160 0 -161 0 -162 0 -163 0 -164 0 -165 0 -166 0 -167 0 -168 0 -169 0 -170 1 -171 0 -172 0 -173 0 -174 0 -175 0 -176 0 -177 0 -178 1 -179 0 -180 0 -181 0 -182 0 -183 0 -184 0 -185 0 -186 1 -187 0 -188 0 -189 0 -190 0 -191 0 -192 1 -193 0 -194 0 -195 0 -196 1 -197 0 -198 0 -199 0 -200 1 -201 0 -202 0 -203 0 -204 0 -205 0 -206 0 -207 1 -208 0 -209 0 -210 0 -211 0 -212 0 -213 0 -214 0 -215 1 -216 0 -217 0 -218 0 -219 0 -220 0 -221 0 -222 0 -223 1 -224 0 -225 0 -226 0 -227 0 -228 0 -229 0 -230 1 -231 0 -232 0 -233 0 -234 0 -235 0 -236 0 -237 1 -238 0 -239 0 -240 0 -241 0 -242 0 -243 0 -244 0 -245 1 -246 0 -247 0 -248 0 -249 0 -250 0 -251 0 -252 0 -253 0 -254 1 -255 0 -256 0 -257 0 -258 0 -259 1 -260 0 -261 0 -262 0 -263 0 -264 0 -265 1 -266 0 -267 0 -268 0 -269 0 -270 0 -271 0 -272 1 -273 0 -274 0 -275 0 -276 0 -277 0 -278 0 -279 0 -280 0 -281 1 -282 0 -283 1 -284 0 -285 0 -286 1 -287 0 -288 0 -289 0 -290 0 -291 1 -292 0 -293 0 -294 0 -295 0 -296 1 -297 0 -298 0 -299 0 -300 0 -301 0 -302 0 -303 1 -304 0 -305 0 -306 0 -307 0 -308 0 -309 1 -310 0 -311 0 -312 0 -313 0 -314 0 -315 0 -316 1 -317 0 -318 0 -319 0 -320 0 -321 0 -322 0 -323 0 -324 0 -325 1 -326 0 -327 0 -328 0 -329 0 -330 0 -331 0 -332 0 -333 0 -334 1 -335 0 -336 0 -337 0 -338 0 -339 0 -340 0 -341 0 -342 0 -343 1 -344 0 -345 0 -346 0 -347 0 -348 0 -349 0 -350 0 -351 0 -352 1 -353 0 -354 0 -355 0 -356 0 -357 0 -358 0 -359 0 -360 0 -361 1 -362 0 -363 0 -364 0 -365 0 -366 0 -367 0 -368 0 -369 1 -370 0 -371 0 -372 0 -373 0 -374 0 -375 0 -376 0 -377 1 -378 0 -379 0 -380 0 -381 0 -382 0 -383 0 -384 0 -385 1 -386 0 -387 0 -388 0 -389 0 -390 1 -391 0 -392 0 -393 0 -394 0 -395 0 -396 0 -397 0 -398 0 -399 0 -400 0 -401 0 -402 1 -403 0 -404 0 -405 0 -406 0 -407 0 -408 0 -409 0 -410 1 -411 0 -412 0 -413 0 -414 0 -415 0 -416 0 -417 0 -418 0 -419 1 -420 0 -421 0 -422 0 -423 0 -424 0 -425 0 -426 0 -427 1 -428 0 -429 0 -430 0 -431 0 -432 0 -433 0 -434 0 -435 1 -436 0 -437 0 -438 0 -439 0 -440 0 -441 0 -442 0 -443 1 -444 0 -445 0 -446 0 -447 0 -448 0 -449 0 -450 1 -451 0 -452 0 -453 0 -454 0 -455 0 -456 1 -457 0 -458 0 -459 0 -460 0 -461 0 -462 0 -463 0 -464 1 -465 0 -466 0 -467 0 -468 0 -469 0 -470 0 -471 0 -472 0 -473 1 -474 0 -475 0 -476 0 -477 0 -478 0 -479 0 -480 0 -481 1 -482 0 -483 0 -484 0 -485 0 -486 0 -487 0 -488 0 -489 0 -490 1 -491 0 -492 0 -493 0 -494 0 -495 0 -496 0 -497 0 -498 0 -499 0 -500 0 -501 0 -502 0 -503 0 -504 1 -505 0 -506 0 -507 0 -508 0 -509 0 -510 0 -511 0 -512 1 -513 0 -514 0 -515 0 -516 0 -517 0 -518 0 -519 4 -520 0 -521 1 -522 0 -523 0 -524 0 -525 1 -526 0 -527 0 -528 0 -529 0 -530 1 -531 0 -532 0 -533 0 -534 1 -535 0 -536 0 -537 0 -538 0 -539 1 -540 0 -541 0 -542 0 -543 0 -544 0 -545 1 -546 0 -547 0 -548 0 -549 0 -550 0 -551 1 -552 0 -553 0 -554 0 -555 0 -556 0 -557 0 -558 0 -559 1 -560 0 -561 0 -562 0 -563 0 -564 0 -565 0 -566 0 -567 1 -568 0 -569 0 -570 0 -571 0 -572 0 -573 0 -574 0 -575 0 -576 1 -577 0 -578 0 -579 0 -580 0 -581 0 -582 0 -583 0 -584 0 -585 0 -586 0 -587 0 -588 0 -589 0 -590 0 -591 0 -592 0 -593 1 -594 0 -595 0 -596 0 -597 0 -598 0 -599 0 -600 0 -601 0 -602 1 -603 0 -604 0 -605 0 -606 0 -607 0 -608 0 -609 0 -610 0 -611 1 -612 0 -613 0 -614 0 -615 0 -616 0 -617 0 -618 0 -619 0 -620 1 -621 0 -622 0 -623 0 -624 0 -625 0 -626 0 -627 0 -628 0 -629 1 -630 0 -631 0 -632 0 -633 0 -634 0 -635 0 -636 0 -637 0 -638 0 -639 1 -640 0 -641 0 -642 0 -643 0 -644 0 -645 0 -646 1 -647 0 -648 0 -649 0 -650 0 -651 0 -652 1 -653 1 -654 0 -655 0 -656 1 -657 0 -658 1 -659 0 -660 0 -661 0 -662 0 -663 0 -664 1 -665 0 -666 0 -667 0 -668 0 -669 0 -670 0 -671 0 -672 0 -673 0 -674 0 -675 0 -676 0 -677 1 -678 0 -679 0 -680 0 -681 0 -682 0 -683 0 -684 0 -685 0 -686 1 -687 0 -688 0 -689 0 -690 0 -691 0 -692 0 -693 0 -694 0 -695 1 -696 0 -697 0 -698 0 -699 0 -700 0 -701 0 -702 0 -703 1 -704 0 -705 0 -706 0 -707 0 -708 0 -709 0 -710 0 -711 0 -712 1 -713 0 -714 0 -715 0 -716 0 -717 0 -718 0 -719 0 -720 1 -721 0 -722 0 -723 0 -724 0 -725 0 -726 0 -727 0 -728 1 -729 0 -730 0 -731 0 -732 0 -733 0 -734 0 -735 0 -736 0 -737 1 -738 0 -739 0 -740 0 -741 0 -742 0 -743 0 -744 0 -745 1 -746 0 -747 0 -748 0 -749 0 -750 0 -751 0 -752 0 -753 1 -754 0 -755 0 -756 0 -757 0 -758 0 -759 0 -760 0 -761 1 -762 0 -763 0 -764 0 -765 0 -766 0 -767 0 -768 1 -769 0 -770 0 -771 0 -772 0 -773 0 -774 0 -775 0 -776 0 -777 1 -778 0 -779 0 -780 0 -781 0 -782 0 -783 0 -784 0 -785 0 -786 1 -787 0 -788 0 -789 0 -790 0 -791 0 -792 1 -793 0 -794 0 -795 0 -796 0 -797 0 -798 0 -799 0 -800 0 -801 1 -802 0 -803 0 -804 0 -805 0 -806 0 -807 0 -808 0 -809 0 -810 0 -811 0 -812 0 -813 0 -814 0 -815 0 -816 0 -817 0 -818 0 -819 0 -820 1 -821 0 -822 0 -823 0 -824 0 -825 0 -826 0 -827 0 -828 0 -829 1 -830 0 -831 0 -832 0 -833 0 -834 0 -835 0 -836 0 -837 1 -838 0 -839 0 -840 0 -841 0 -842 0 -843 0 -844 0 -845 0 -846 1 -847 0 -848 0 -849 0 -850 0 -851 0 -852 0 -853 0 -854 0 -855 2 -856 0 -857 0 -858 0 -859 0 -860 0 -861 0 -862 1 -863 0 -864 0 -865 0 -866 0 -867 0 -868 0 -869 0 -870 0 -871 1 -872 0 -873 0 -874 0 -875 0 -876 0 -877 0 -878 1 -879 0 -880 0 -881 0 -882 0 -883 0 -884 0 -885 0 -886 0 -887 0 -888 0 -889 0 -890 0 -891 0 -892 0 -893 0 -894 0 -895 0 -896 1 -897 0 -898 0 -899 0 -900 0 -901 0 -902 0 -903 0 -904 0 -905 0 -906 1 -907 0 -908 0 -909 0 -910 0 -911 0 -912 0 -913 0 -914 0 -915 1 -916 0 -917 0 -918 0 -919 0 -920 0 -921 0 -922 1 -923 0 -924 0 -925 0 -926 0 -927 0 -928 0 -929 0 -930 1 -931 0 -932 0 -933 0 -934 0 -935 0 -936 0 -937 0 -938 0 -939 1 -940 0 -941 0 -942 0 -943 0 -944 0 -945 0 -946 0 -947 0 -948 0 -949 1 -950 0 -951 0 -952 0 -953 0 -954 0 -955 0 -956 0 -957 0 -958 1 -959 0 -960 0 -961 0 -962 0 -963 0 -964 0 -965 0 -966 0 -967 0 -968 1 -969 0 -970 0 -971 0 -972 0 -973 0 -974 0 -975 0 -976 0 -977 0 -978 1 -979 0 -980 0 -981 0 -982 0 -983 0 -984 0 -985 0 -986 0 -987 0 -988 1 -989 0 -990 0 -991 0 -992 0 -993 0 -994 0 -995 0 -996 0 -997 1 -998 0 -999 0 -1000 0 -1001 0 -1002 0 -1003 0 -1004 0 -1005 1 -1006 0 -1007 0 -1008 0 -1009 0 -1010 0 -1011 0 -1012 1 -1013 0 -1014 0 -1015 0 -1016 0 -1017 0 -1018 0 -1019 0 -1020 0 -1021 0 -1022 0 -1023 0 -1024 0 -1025 0 -1026 0 -1027 0 -1028 0 -1029 0 -1030 0 -1031 1 -1032 0 -1033 0 -1034 0 -1035 0 -1036 0 -1037 0 -1038 0 -1039 0 -1040 0 -1041 0 -1042 1 -1043 0 -1044 0 -1045 0 -1046 0 -1047 0 -1048 0 -1049 0 -1050 1 -1051 0 -1052 0 -1053 0 -1054 0 -1055 0 -1056 0 -1057 1 -1058 0 -1059 0 -1060 0 -1061 0 -1062 0 -1063 0 -1064 0 -1065 0 -1066 0 -1067 1 -1068 0 -1069 0 -1070 0 -1071 0 -1072 0 -1073 0 -1074 0 -1075 0 -1076 0 -1077 1 -1078 0 -1079 0 -1080 0 -1081 0 -1082 0 -1083 0 -1084 0 -1085 0 -1086 0 -1087 1 -1088 0 -1089 0 -1090 0 -1091 0 -1092 0 -1093 0 -1094 1 -1095 0 -1096 0 -1097 0 -1098 0 -1099 0 -1100 0 -1101 0 -1102 1 -1103 0 -1104 0 -1105 0 -1106 0 -1107 0 -1108 0 -1109 0 -1110 0 -1111 1 -1112 0 -1113 0 -1114 0 -1115 0 -1116 0 -1117 0 -1118 0 -1119 0 -1120 1 -1121 0 -1122 0 -1123 0 -1124 0 -1125 0 -1126 0 -1127 0 -1128 0 -1129 0 -1130 1 -1131 0 -1132 0 -1133 0 -1134 0 -1135 0 -1136 0 -1137 0 -1138 0 -1139 0 -1140 1 -1141 0 -1142 0 -1143 0 -1144 0 -1145 0 -1146 0 -1147 0 -1148 0 -1149 0 -1150 0 -1151 1 -1152 0 -1153 0 -1154 0 -1155 0 -1156 0 -1157 0 -1158 0 -1159 0 -1160 1 -1161 0 -1162 0 -1163 0 -1164 0 -1165 0 -1166 0 -1167 1 -1168 0 -1169 0 -1170 0 -1171 0 -1172 0 -1173 0 -1174 0 -1175 0 -1176 1 -1177 0 -1178 0 -1179 0 -1180 0 -1181 0 -1182 1 -1183 0 -1184 0 -1185 0 -1186 0 -1187 0 -1188 0 -1189 0 -1190 1 -1191 0 -1192 0 -1193 0 -1194 0 -1195 0 -1196 0 -1197 0 -1198 1 -1199 0 -1200 0 -1201 0 -1202 0 -1203 0 -1204 0 -1205 0 -1206 1 -1207 0 -1208 0 -1209 0 -1210 0 -1211 0 -1212 0 -1213 0 -1214 0 -1215 0 -1216 1 -1217 0 -1218 0 -1219 0 -1220 0 -1221 0 -1222 0 -1223 0 -1224 0 -1225 0 -1226 1 -1227 0 -1228 0 -1229 0 -1230 0 -1231 0 -1232 0 -1233 0 -1234 0 -1235 0 -1236 0 -1237 0 -1238 0 -1239 1 -1240 0 -1241 0 -1242 0 -1243 0 -1244 0 -1245 0 -1246 0 -1247 0 -1248 1 -1249 0 -1250 0 -1251 0 -1252 0 -1253 0 -1254 0 -1255 0 -1256 0 -1257 1 -1258 0 -1259 0 -1260 0 -1261 0 -1262 0 -1263 0 -1264 0 -1265 0 -1266 1 -1267 0 -1268 0 -1269 0 -1270 0 -1271 0 -1272 0 -1273 0 -1274 0 -1275 1 -1276 0 -1277 0 -1278 0 -1279 0 -1280 0 -1281 0 -1282 0 -1283 0 -1284 0 -1285 0 -1286 0 -1287 0 -1288 0 -1289 0 -1290 0 -1291 0 -1292 0 -1293 1 -1294 0 -1295 0 -1296 0 -1297 0 -1298 0 -1299 0 -1300 0 -1301 0 -1302 0 -1303 0 -1304 0 -1305 0 -1306 0 -1307 0 -1308 0 -1309 0 -1310 1 -1311 0 -1312 0 -1313 0 -1314 0 -1315 0 -1316 0 -1317 0 -1318 1 -1319 0 -1320 0 -1321 0 -1322 0 -1323 0 -1324 0 -1325 0 -1326 0 -1327 1 -1328 0 -1329 0 -1330 0 -1331 0 -1332 0 -1333 0 -1334 0 -1335 0 -1336 1 -1337 0 -1338 0 -1339 0 -1340 0 -1341 0 -1342 0 -1343 0 -1344 0 -1345 0 -1346 1 -1347 0 -1348 0 -1349 0 -1350 0 -1351 0 -1352 0 -1353 0 -1354 0 -1355 0 -1356 1 -1357 0 -1358 0 -1359 0 -1360 0 -1361 0 -1362 0 -1363 0 -1364 0 -1365 1 -1366 0 -1367 0 -1368 0 -1369 0 -1370 0 -1371 0 -1372 0 -1373 1 -1374 0 -1375 0 -1376 0 -1377 0 -1378 0 -1379 0 -1380 0 -1381 0 -1382 0 -1383 1 -1384 0 -1385 0 -1386 0 -1387 0 -1388 0 -1389 0 -1390 0 -1391 0 -1392 1 -1393 0 -1394 0 -1395 0 -1396 0 -1397 0 -1398 0 -1399 0 -1400 1 -1401 0 -1402 0 -1403 0 -1404 0 -1405 0 -1406 0 -1407 0 -1408 0 -1409 0 -1410 1 -1411 0 -1412 0 -1413 0 -1414 0 -1415 0 -1416 0 -1417 0 -1418 0 -1419 0 -1420 1 -1421 0 -1422 0 -1423 0 -1424 0 -1425 0 -1426 0 -1427 0 -1428 0 -1429 0 -1430 0 -1431 1 -1432 0 -1433 0 -1434 0 -1435 0 -1436 0 -1437 0 -1438 0 -1439 0 -1440 0 -1441 1 -1442 0 -1443 0 -1444 0 -1445 0 -1446 0 -1447 2 -1448 0 -1449 0 -1450 0 -1451 0 -1452 0 -1453 0 -1454 0 -1455 1 -1456 0 -1457 0 -1458 0 -1459 0 -1460 0 -1461 0 -1462 0 -1463 0 -1464 0 -1465 1 -1466 0 -1467 0 -1468 0 -1469 0 -1470 0 -1471 0 -1472 0 -1473 0 -1474 0 -1475 1 -1476 0 -1477 0 -1478 0 -1479 0 -1480 0 -1481 0 -1482 0 -1483 0 -1484 0 -1485 1 -1486 0 -1487 0 -1488 0 -1489 0 -1490 0 -1491 0 -1492 0 -1493 0 -1494 1 -1495 0 -1496 0 -1497 0 -1498 0 -1499 0 -1500 0 -1501 0 -1502 0 -1503 1 -1504 0 -1505 0 -1506 0 -1507 0 -1508 0 -1509 0 -1510 0 -1511 0 -1512 0 -1513 0 -1514 0 -1515 0 -1516 0 -1517 0 -1518 0 -1519 0 -1520 1 -1521 0 -1522 0 -1523 0 -1524 0 -1525 0 -1526 0 -1527 0 -1528 0 -1529 1 -1530 0 -1531 0 -1532 0 -1533 0 -1534 0 -1535 0 -1536 0 -1537 0 -1538 0 -1539 1 -1540 0 -1541 0 -1542 0 -1543 0 -1544 0 -1545 0 -1546 0 -1547 0 -1548 1 -1549 0 -1550 0 -1551 0 -1552 0 -1553 0 -1554 0 -1555 0 -1556 0 -1557 1 -1558 0 -1559 0 -1560 0 -1561 0 -1562 0 -1563 0 -1564 0 -1565 0 -1566 0 -1567 1 -1568 0 -1569 0 -1570 0 -1571 0 -1572 0 -1573 0 -1574 0 -1575 1 -1576 0 -1577 0 -1578 0 -1579 0 -1580 0 -1581 0 -1582 0 -1583 0 -1584 1 -1585 0 -1586 0 -1587 0 -1588 0 -1589 0 -1590 0 -1591 0 -1592 0 -1593 1 -1594 0 -1595 0 -1596 0 -1597 0 -1598 0 -1599 0 -1600 0 -1601 0 -1602 1 -1603 0 -1604 0 -1605 0 -1606 0 -1607 0 -1608 0 -1609 0 -1610 0 -1611 1 -1612 0 -1613 0 -1614 0 -1615 0 -1616 0 -1617 0 -1618 0 -1619 0 -1620 0 -1621 1 -1622 0 -1623 0 -1624 0 -1625 0 -1626 0 -1627 0 -1628 0 -1629 0 -1630 0 -1631 1 -1632 0 -1633 0 -1634 0 -1635 0 -1636 0 -1637 0 -1638 0 -1639 0 -1640 1 -1641 0 -1642 0 -1643 0 -1644 0 -1645 0 -1646 0 -1647 0 -1648 0 -1649 0 -1650 1 -1651 0 -1652 0 -1653 0 -1654 0 -1655 0 -1656 0 -1657 0 -1658 0 -1659 0 -1660 1 -1661 0 -1662 0 -1663 0 -1664 0 -1665 0 -1666 0 -1667 0 -1668 0 -1669 0 -1670 1 -1671 0 -1672 0 -1673 0 -1674 0 -1675 0 -1676 0 -1677 0 -1678 0 -1679 0 -1680 1 -1681 0 -1682 0 -1683 0 -1684 0 -1685 0 -1686 0 -1687 0 -1688 0 -1689 0 -1690 1 -1691 0 -1692 0 -1693 0 -1694 0 -1695 0 -1696 0 -1697 0 -1698 0 -1699 0 -1700 0 -1701 1 -1702 0 -1703 0 -1704 0 -1705 0 -1706 0 -1707 0 -1708 1 -1709 0 -1710 0 -1711 0 -1712 0 -1713 0 -1714 0 -1715 0 -1716 1 -1717 0 -1718 0 -1719 0 -1720 0 -1721 0 -1722 0 -1723 0 -1724 0 -1725 0 -1726 0 -1727 0 -1728 0 -1729 0 -1730 0 -1731 0 -1732 0 -1733 0 -1734 1 -1735 0 -1736 0 -1737 0 -1738 0 -1739 0 -1740 0 -1741 0 -1742 0 -1743 1 -1744 0 -1745 0 -1746 0 -1747 0 -1748 0 -1749 0 -1750 0 -1751 0 -1752 0 -1753 1 -1754 0 -1755 0 -1756 0 -1757 0 -1758 0 -1759 0 -1760 0 -1761 0 -1762 0 -1763 1 -1764 0 -1765 0 -1766 0 -1767 0 -1768 0 -1769 0 -1770 0 -1771 0 -1772 0 -1773 1 -1774 0 -1775 0 -1776 0 -1777 0 -1778 0 -1779 0 -1780 0 -1781 0 -1782 0 -1783 1 -1784 0 -1785 0 -1786 0 -1787 0 -1788 0 -1789 0 -1790 0 -1791 0 -1792 0 -1793 1 -1794 0 -1795 0 -1796 0 -1797 0 -1798 0 -1799 0 -1800 0 -1801 0 -1802 0 -1803 1 -1804 0 -1805 0 -1806 0 -1807 0 -1808 0 -1809 0 -1810 0 -1811 0 -1812 0 -1813 1 -1814 0 -1815 0 -1816 0 -1817 0 -1818 0 -1819 0 -1820 0 -1821 0 -1822 1 -1823 0 -1824 0 -1825 0 -1826 0 -1827 0 -1828 0 -1829 1 -1830 0 -1831 0 -1832 0 -1833 0 -1834 0 -1835 0 -1836 0 -1837 0 -1838 0 -1839 1 -1840 0 -1841 0 -1842 0 -1843 0 -1844 0 -1845 0 -1846 0 -1847 0 -1848 0 -1849 1 -1850 0 -1851 0 -1852 0 -1853 0 -1854 0 -1855 0 -1856 0 -1857 0 -1858 0 -1859 1 -1860 0 -1861 0 -1862 0 -1863 0 -1864 0 -1865 0 -1866 0 -1867 0 -1868 0 -1869 1 -1870 0 -1871 0 -1872 0 -1873 0 -1874 0 -1875 0 -1876 0 -1877 0 -1878 0 -1879 1 -1880 0 -1881 0 -1882 0 -1883 0 -1884 0 -1885 0 -1886 0 -1887 0 -1888 0 -1889 1 -1890 0 -1891 0 -1892 0 -1893 0 -1894 0 -1895 0 -1896 0 -1897 0 -1898 0 -1899 0 -1900 0 -1901 0 -1902 0 -1903 0 -1904 0 -1905 0 -1906 0 -1907 0 -1908 0 -1909 0 -1910 1 -1911 0 -1912 0 -1913 0 -1914 0 -1915 0 -1916 0 -1917 0 -1918 0 -1919 0 -1920 0 -1921 0 -1922 0 -1923 0 -1924 0 -1925 0 -1926 0 -1927 0 -1928 0 -1929 0 -1930 1 -1931 0 -1932 0 -1933 0 -1934 0 -1935 0 -1936 0 -1937 0 -1938 0 -1939 1 -1940 0 -1941 0 -1942 0 -1943 0 -1944 0 -1945 0 -1946 0 -1947 0 -1948 0 -1949 1 -1950 0 -1951 0 -1952 0 -1953 0 -1954 0 -1955 0 -1956 0 -1957 0 -1958 1 -1959 0 -1960 0 -1961 0 -1962 0 -1963 0 -1964 0 -1965 0 -1966 0 -1967 0 -1968 1 -1969 0 -1970 0 -1971 0 -1972 0 -1973 0 -1974 0 -1975 0 -1976 0 -1977 0 -1978 1 -1979 0 -1980 0 -1981 0 -1982 0 -1983 0 -1984 0 -1985 0 -1986 0 -1987 0 -1988 1 -1989 0 -1990 0 -1991 0 -1992 0 -1993 0 -1994 0 -1995 0 -1996 1 -1997 0 -1998 0 -1999 0 -2000 0 -2001 0 -2002 0 -2003 0 -2004 1 -2005 0 -2006 0 -2007 0 -2008 0 -2009 0 -2010 0 -2011 0 -2012 0 -2013 0 -2014 1 -2015 0 -2016 0 -2017 0 -2018 0 -2019 0 -2020 0 -2021 0 -2022 0 -2023 0 -2024 1 -2025 0 -2026 0 -2027 0 -2028 0 -2029 0 -2030 0 -2031 0 -2032 0 -2033 1 -2034 0 -2035 0 -2036 0 -2037 0 -2038 0 -2039 0 -2040 0 -2041 2 -2042 0 -2043 0 -2044 0 -2045 0 -2046 0 -2047 0 -2048 0 -2049 1 -2050 0 -2051 0 -2052 0 -2053 0 -2054 0 -2055 0 -2056 0 -2057 0 -2058 0 -2059 0 -2060 0 -2061 0 -2062 0 -2063 0 -2064 0 -2065 0 -2066 0 -2067 1 -2068 0 -2069 0 -2070 0 -2071 0 -2072 0 -2073 0 -2074 0 -2075 0 -2076 1 -2077 0 -2078 0 -2079 0 -2080 0 -2081 0 -2082 0 -2083 0 -2084 0 -2085 0 -2086 1 -2087 0 -2088 0 -2089 0 -2090 0 -2091 0 -2092 0 -2093 0 -2094 0 -2095 0 -2096 1 -2097 0 -2098 0 -2099 0 -2100 0 -2101 0 -2102 0 -2103 0 -2104 0 -2105 1 -2106 0 -2107 0 -2108 0 -2109 0 -2110 0 -2111 0 -2112 0 -2113 0 -2114 0 -2115 0 -2116 1 -2117 0 -2118 0 -2119 0 -2120 0 -2121 0 -2122 0 -2123 0 -2124 0 -2125 1 -2126 0 -2127 0 -2128 0 -2129 0 -2130 0 -2131 0 -2132 0 -2133 1 -2134 0 -2135 0 -2136 0 -2137 0 -2138 0 -2139 0 -2140 0 -2141 1 -2142 0 -2143 0 -2144 0 -2145 0 -2146 0 -2147 0 -2148 0 -2149 0 -2150 1 -2151 0 -2152 0 -2153 0 -2154 0 -2155 0 -2156 0 -2157 0 -2158 0 -2159 1 -2160 0 -2161 0 -2162 0 -2163 0 -2164 0 -2165 0 -2166 0 -2167 0 -2168 0 -2169 1 -2170 0 -2171 0 -2172 0 -2173 0 -2174 0 -2175 0 -2176 0 -2177 1 -2178 0 -2179 0 -2180 0 -2181 0 -2182 0 -2183 0 -2184 0 -2185 0 -2186 0 -2187 1 -2188 0 -2189 0 -2190 0 -2191 0 -2192 0 -2193 0 -2194 0 -2195 0 -2196 1 -2197 0 -2198 0 -2199 0 -2200 0 -2201 0 -2202 0 -2203 0 -2204 1 -2205 0 -2206 0 -2207 0 -2208 0 -2209 0 -2210 0 -2211 0 -2212 0 -2213 0 -2214 1 -2215 0 -2216 0 -2217 0 -2218 0 -2219 0 -2220 0 -2221 0 -2222 0 -2223 0 -2224 1 -2225 0 -2226 0 -2227 0 -2228 0 -2229 0 -2230 0 -2231 0 -2232 0 -2233 1 -2234 0 -2235 0 -2236 0 -2237 0 -2238 0 -2239 0 -2240 0 -2241 0 -2242 1 -2243 0 -2244 0 -2245 0 -2246 0 -2247 0 -2248 0 -2249 0 -2250 1 -2251 0 -2252 0 -2253 0 -2254 0 -2255 0 -2256 0 -2257 0 -2258 0 -2259 0 -2260 1 -2261 0 -2262 0 -2263 0 -2264 0 -2265 0 -2266 0 -2267 0 -2268 0 -2269 0 -2270 1 -2271 0 -2272 0 -2273 0 -2274 0 -2275 0 -2276 0 -2277 0 -2278 0 -2279 0 -2280 1 -2281 0 -2282 0 -2283 0 -2284 0 -2285 0 -2286 0 -2287 0 -2288 0 -2289 0 -2290 1 -2291 0 -2292 0 -2293 0 -2294 0 -2295 0 -2296 0 -2297 0 -2298 1 -2299 0 -2300 0 -2301 0 -2302 0 -2303 0 -2304 0 -2305 0 -2306 1 -2307 0 -2308 0 -2309 0 -2310 0 -2311 0 -2312 0 -2313 0 -2314 0 -2315 1 -2316 0 -2317 0 -2318 0 -2319 0 -2320 0 -2321 0 -2322 0 -2323 0 -2324 0 -2325 1 -2326 0 -2327 0 -2328 0 -2329 0 -2330 0 -2331 0 -2332 0 -2333 0 -2334 0 -2335 1 -2336 0 -2337 0 -2338 0 -2339 0 -2340 0 -2341 0 -2342 0 -2343 0 -2344 0 -2345 1 -2346 0 -2347 0 -2348 0 -2349 0 -2350 0 -2351 0 -2352 0 -2353 1 -2354 0 -2355 0 -2356 0 -2357 0 -2358 0 -2359 0 -2360 0 -2361 1 -2362 0 -2363 0 -2364 0 -2365 0 -2366 0 -2367 0 -2368 0 -2369 0 -2370 0 -2371 1 -2372 0 -2373 0 -2374 0 -2375 0 -2376 0 -2377 0 -2378 0 -2379 0 -2380 0 -2381 1 -2382 0 -2383 0 -2384 0 -2385 0 -2386 0 -2387 0 -2388 0 -2389 0 -2390 1 -2391 0 -2392 0 -2393 0 -2394 0 -2395 0 -2396 0 -2397 0 -2398 0 -2399 0 -2400 0 -2401 0 -2402 0 -2403 0 -2404 0 -2405 0 -2406 0 -2407 0 -2408 0 -2409 0 -2410 0 -2411 1 -2412 0 -2413 0 -2414 0 -2415 0 -2416 0 -2417 0 -2418 0 -2419 0 -2420 0 -2421 1 -2422 0 -2423 0 -2424 0 -2425 0 -2426 0 -2427 0 -2428 0 -2429 0 -2430 0 -2431 0 -2432 0 -2433 0 -2434 0 -2435 0 -2436 0 -2437 0 -2438 0 -2439 0 -2440 1 -2441 0 -2442 0 -2443 0 -2444 0 -2445 0 -2446 0 -2447 0 -2448 0 -2449 0 -2450 0 -2451 1 -2452 0 -2453 0 -2454 0 -2455 0 -2456 0 -2457 0 -2458 0 -2459 0 -2460 0 -2461 1 -2462 0 -2463 0 -2464 0 -2465 0 -2466 0 -2467 0 -2468 0 -2469 1 -2470 0 -2471 0 -2472 0 -2473 0 -2474 0 -2475 0 -2476 0 -2477 1 -2478 0 -2479 0 -2480 0 -2481 0 -2482 0 -2483 0 -2484 0 -2485 0 -2486 1 -2487 0 -2488 0 -2489 0 -2490 0 -2491 0 -2492 0 -2493 0 -2494 0 -2495 0 -2496 1 -2497 0 -2498 0 -2499 0 -2500 0 -2501 0 -2502 0 -2503 0 -2504 0 -2505 0 -2506 1 -2507 0 -2508 0 -2509 0 -2510 0 -2511 0 -2512 0 -2513 0 -2514 0 -2515 0 -2516 1 -2517 0 -2518 0 -2519 0 -2520 0 -2521 0 -2522 0 -2523 0 -2524 0 -2525 0 -2526 0 -2527 1 -2528 0 -2529 0 -2530 0 -2531 0 -2532 0 -2533 0 -2534 0 -2535 0 -2536 0 -2537 1 -2538 0 -2539 0 -2540 0 -2541 0 -2542 0 -2543 0 -2544 0 -2545 0 -2546 0 -2547 0 -2548 0 -2549 0 -2550 0 -2551 0 -2552 0 -2553 0 -2554 0 -2555 0 -2556 0 -2557 1 -2558 0 -2559 0 -2560 0 -2561 0 -2562 0 -2563 0 -2564 0 -2565 0 -2566 1 -2567 0 -2568 0 -2569 0 -2570 0 -2571 0 -2572 0 -2573 0 -2574 0 -2575 1 -2576 0 -2577 0 -2578 0 -2579 0 -2580 0 -2581 0 -2582 0 -2583 0 -2584 1 -2585 0 -2586 0 -2587 0 -2588 0 -2589 0 -2590 0 -2591 0 -2592 0 -2593 0 -2594 0 -2595 1 -2596 0 -2597 0 -2598 0 -2599 0 -2600 0 -2601 0 -2602 0 -2603 0 -2604 0 -2605 1 -2606 0 -2607 0 -2608 0 -2609 0 -2610 0 -2611 0 -2612 0 -2613 0 -2614 0 -2615 0 -2616 0 -2617 0 -2618 0 -2619 0 -2620 0 -2621 0 -2622 0 -2623 0 -2624 0 -2625 1 -2626 0 -2627 0 -2628 0 -2629 0 -2630 0 -2631 0 -2632 0 -2633 0 -2634 0 -2635 1 -2636 0 -2637 0 -2638 0 -2639 1 -2640 0 -2641 0 -2642 0 -2643 1 -2644 0 -2645 0 -2646 0 -2647 0 -2648 0 -2649 0 -2650 0 -2651 0 -2652 0 -2653 1 -2654 0 -2655 0 -2656 0 -2657 0 -2658 0 -2659 0 -2660 0 -2661 0 -2662 0 -2663 1 -2664 0 -2665 0 -2666 0 -2667 0 -2668 0 -2669 0 -2670 0 -2671 1 -2672 0 -2673 0 -2674 0 -2675 0 -2676 0 -2677 0 -2678 0 -2679 1 -2680 0 -2681 0 -2682 0 -2683 0 -2684 0 -2685 0 -2686 0 -2687 0 -2688 0 -2689 1 -2690 0 -2691 0 -2692 0 -2693 0 -2694 0 -2695 0 -2696 0 -2697 0 -2698 0 -2699 1 -2700 0 -2701 0 -2702 0 -2703 0 -2704 0 -2705 0 -2706 0 -2707 0 -2708 0 -2709 1 -2710 0 -2711 0 -2712 0 -2713 0 -2714 0 -2715 0 -2716 1 -2717 0 -2718 0 -2719 0 -2720 0 -2721 0 -2722 0 -2723 0 -2724 1 -2725 0 -2726 0 -2727 0 -2728 0 -2729 0 -2730 0 -2731 0 -2732 0 -2733 0 -2734 1 -2735 0 -2736 0 -2737 0 -2738 0 -2739 0 -2740 0 -2741 0 -2742 0 -2743 0 -2744 1 -2745 0 -2746 0 -2747 0 -2748 0 -2749 0 -2750 0 -2751 0 -2752 0 -2753 1 -2754 0 -2755 0 -2756 0 -2757 0 -2758 0 -2759 0 -2760 0 -2761 0 -2762 0 -2763 1 -2764 0 -2765 0 -2766 0 -2767 0 -2768 0 -2769 0 -2770 0 -2771 0 -2772 0 -2773 1 -2774 0 -2775 0 -2776 0 -2777 0 -2778 0 -2779 0 -2780 0 -2781 0 -2782 0 -2783 1 -2784 0 -2785 0 -2786 0 -2787 0 -2788 0 -2789 0 -2790 0 -2791 0 -2792 1 -2793 0 -2794 0 -2795 0 -2796 0 -2797 0 -2798 0 -2799 0 -2800 0 -2801 0 -2802 0 -2803 0 -2804 0 -2805 0 -2806 0 -2807 0 -2808 0 -2809 0 -2810 0 -2811 0 -2812 0 -2813 0 -2814 0 -2815 0 -2816 0 -2817 0 -2818 0 -2819 0 -2820 0 -2821 1 -2822 0 -2823 0 -2824 0 -2825 0 -2826 0 -2827 0 -2828 0 -2829 0 -2830 0 -2831 1 -2832 0 -2833 0 -2834 0 -2835 0 -2836 0 -2837 0 -2838 0 -2839 0 -2840 0 -2841 1 -2842 0 -2843 0 -2844 0 -2845 0 -2846 0 -2847 0 -2848 0 -2849 0 -2850 0 -2851 1 -2852 0 -2853 0 -2854 0 -2855 0 -2856 0 -2857 0 -2858 0 -2859 0 -2860 0 -2861 1 -2862 0 -2863 0 -2864 0 -2865 0 -2866 0 -2867 0 -2868 0 -2869 0 -2870 0 -2871 1 -2872 0 -2873 0 -2874 0 -2875 0 -2876 0 -2877 0 -2878 0 -2879 0 -2880 1 -2881 0 -2882 0 -2883 0 -2884 0 -2885 0 -2886 0 -2887 0 -2888 1 -2889 0 -2890 0 -2891 0 -2892 0 -2893 0 -2894 0 -2895 0 -2896 0 -2897 1 -2898 0 -2899 0 -2900 0 -2901 0 -2902 0 -2903 0 -2904 0 -2905 0 -2906 1 -2907 0 -2908 0 -2909 0 -2910 0 -2911 0 -2912 0 -2913 0 -2914 1 -2915 0 -2916 0 -2917 0 -2918 0 -2919 0 -2920 0 -2921 0 -2922 1 -2923 0 -2924 0 -2925 0 -2926 0 -2927 0 -2928 0 -2929 0 -2930 0 -2931 0 -2932 0 -2933 0 -2934 0 -2935 0 -2936 0 -2937 0 -2938 1 -2939 0 -2940 0 -2941 0 -2942 0 -2943 0 -2944 0 -2945 0 -2946 0 -2947 0 -2948 0 -2949 1 -2950 0 -2951 0 -2952 0 -2953 0 -2954 0 -2955 0 -2956 0 -2957 0 -2958 0 -2959 1 -2960 0 -2961 0 -2962 0 -2963 0 -2964 0 -2965 0 -2966 0 -2967 0 -2968 1 -2969 0 -2970 0 -2971 0 -2972 0 -2973 0 -2974 0 -2975 0 -2976 0 -2977 1 -2978 0 -2979 0 -2980 0 -2981 0 -2982 0 -2983 0 -2984 0 -2985 0 -2986 0 -2987 1 -2988 0 -2989 0 -2990 0 -2991 0 -2992 0 -2993 0 -2994 0 -2995 0 -2996 0 -2997 1 -2998 0 -2999 0 -3000 0 -3001 0 -3002 0 -3003 0 -3004 0 -3005 0 -3006 0 -3007 0 -3008 0 -3009 0 -3010 0 -3011 0 -3012 0 -3013 0 -3014 0 -3015 1 -3016 0 -3017 0 -3018 0 -3019 0 -3020 0 -3021 0 -3022 0 -3023 0 -3024 0 -3025 1 -3026 0 -3027 0 -3028 0 -3029 0 -3030 0 -3031 0 -3032 0 -3033 0 -3034 1 -3035 0 -3036 0 -3037 0 -3038 0 -3039 0 -3040 0 -3041 0 -3042 1 -3043 0 -3044 0 -3045 0 -3046 0 -3047 0 -3048 0 -3049 0 -3050 0 -3051 0 -3052 1 -3053 0 -3054 0 -3055 0 -3056 0 -3057 0 -3058 0 -3059 0 -3060 0 -3061 0 -3062 1 -3063 0 -3064 0 -3065 0 -3066 0 -3067 0 -3068 0 -3069 0 -3070 0 -3071 0 -3072 1 -3073 0 -3074 0 -3075 0 -3076 0 -3077 0 -3078 0 -3079 0 -3080 0 -3081 0 -3082 1 -3083 0 -3084 0 -3085 0 -3086 0 -3087 0 -3088 0 -3089 0 -3090 0 -3091 0 -3092 1 -3093 0 -3094 0 -3095 0 -3096 0 -3097 0 -3098 0 -3099 0 -3100 0 -3101 0 -3102 1 -3103 0 -3104 0 -3105 0 -3106 0 -3107 0 -3108 0 -3109 0 -3110 0 -3111 0 -3112 1 -3113 0 -3114 0 -3115 0 -3116 0 -3117 0 -3118 0 -3119 0 -3120 1 -3121 0 -3122 0 -3123 0 -3124 0 -3125 0 -3126 0 -3127 0 -3128 0 -3129 1 -3130 0 -3131 0 -3132 0 -3133 0 -3134 0 -3135 0 -3136 0 -3137 0 -3138 0 -3139 1 -3140 0 -3141 0 -3142 0 -3143 0 -3144 0 -3145 0 -3146 0 -3147 0 -3148 0 -3149 1 -3150 0 -3151 0 -3152 0 -3153 0 -3154 0 -3155 0 -3156 0 -3157 1 -3158 0 -3159 0 -3160 0 -3161 0 -3162 0 -3163 0 -3164 0 -3165 1 -3166 0 -3167 0 -3168 0 -3169 0 -3170 0 -3171 0 -3172 0 -3173 0 -3174 0 -3175 1 -3176 0 -3177 0 -3178 0 -3179 0 -3180 0 -3181 0 -3182 0 -3183 0 -3184 0 -3185 1 -3186 0 -3187 0 -3188 0 -3189 0 -3190 0 -3191 0 -3192 0 -3193 0 -3194 0 -3195 0 -3196 1 -3197 0 -3198 0 -3199 0 -3200 0 -3201 0 -3202 0 -3203 0 -3204 0 -3205 0 -3206 0 -3207 1 -3208 0 -3209 0 -3210 0 -3211 0 -3212 0 -3213 0 -3214 0 -3215 1 -3216 0 -3217 0 -3218 0 -3219 0 -3220 0 -3221 0 -3222 0 -3223 1 -3224 0 -3225 0 -3226 0 -3227 0 -3228 0 -3229 0 -3230 0 -3231 0 -3232 1 -3233 0 -3234 1 -3235 0 -3236 0 -3237 0 -3238 0 -3239 1 -3240 0 -3241 0 -3242 0 -3243 0 -3244 0 -3245 0 -3246 0 -3247 0 -3248 1 -3249 0 -3250 0 -3251 0 -3252 0 -3253 0 -3254 0 -3255 0 -3256 0 -3257 0 -3258 1 -3259 0 -3260 0 -3261 0 -3262 0 -3263 0 -3264 0 -3265 0 -3266 0 -3267 0 -3268 0 -3269 1 -3270 0 -3271 0 -3272 0 -3273 0 -3274 0 -3275 0 -3276 0 -3277 0 -3278 1 -3279 0 -3280 0 -3281 0 -3282 0 -3283 0 -3284 0 -3285 0 -3286 0 -3287 1 -3288 0 -3289 0 -3290 0 -3291 0 -3292 0 -3293 0 -3294 0 -3295 0 -3296 0 -3297 1 -3298 0 -3299 0 -3300 0 -3301 0 -3302 0 -3303 0 -3304 0 -3305 0 -3306 0 -3307 1 -3308 0 -3309 0 -3310 0 -3311 0 -3312 0 -3313 0 -3314 0 -3315 0 -3316 0 -3317 1 -3318 0 -3319 0 -3320 0 -3321 0 -3322 0 -3323 0 -3324 0 -3325 1 -3326 0 -3327 0 -3328 0 -3329 0 -3330 0 -3331 0 -3332 0 -3333 0 -3334 0 -3335 1 -3336 0 -3337 0 -3338 0 -3339 0 -3340 0 -3341 0 -3342 0 -3343 0 -3344 1 -3345 0 -3346 0 -3347 0 -3348 0 -3349 0 -3350 0 -3351 0 -3352 0 -3353 0 -3354 1 -3355 0 -3356 0 -3357 0 -3358 0 -3359 0 -3360 0 -3361 0 -3362 0 -3363 0 -3364 0 -3365 1 -3366 0 -3367 0 -3368 0 -3369 0 -3370 0 -3371 0 -3372 0 -3373 0 -3374 0 -3375 1 -3376 0 -3377 0 -3378 0 -3379 0 -3380 0 -3381 0 -3382 0 -3383 0 -3384 0 -3385 0 -3386 1 -3387 0 -3388 0 -3389 0 -3390 0 -3391 0 -3392 0 -3393 0 -3394 0 -3395 0 -3396 0 -3397 1 -3398 0 -3399 0 -3400 0 -3401 0 -3402 0 -3403 0 -3404 0 -3405 0 -3406 0 -3407 1 -3408 0 -3409 0 -3410 0 -3411 0 -3412 0 -3413 0 -3414 0 -3415 0 -3416 0 -3417 1 -3418 0 -3419 0 -3420 0 -3421 0 -3422 0 -3423 0 -3424 0 -3425 0 -3426 0 -3427 0 -3428 1 -3429 0 -3430 0 -3431 0 -3432 0 -3433 0 -3434 0 -3435 0 -3436 0 -3437 1 -3438 0 -3439 0 -3440 0 -3441 0 -3442 0 -3443 0 -3444 0 -3445 1 -3446 0 -3447 0 -3448 0 -3449 0 -3450 0 -3451 0 -3452 0 -3453 0 -3454 1 -3455 0 -3456 0 -3457 0 -3458 0 -3459 0 -3460 0 -3461 0 -3462 0 -3463 0 -3464 1 -3465 0 -3466 0 -3467 0 -3468 0 -3469 0 -3470 0 -3471 0 -3472 0 -3473 0 -3474 1 -3475 0 -3476 0 -3477 0 -3478 0 -3479 0 -3480 0 -3481 0 -3482 0 -3483 0 -3484 1 -3485 0 -3486 0 -3487 0 -3488 0 -3489 0 -3490 0 -3491 0 -3492 0 -3493 0 -3494 1 -3495 0 -3496 0 -3497 0 -3498 0 -3499 0 -3500 0 -3501 0 -3502 0 -3503 0 -3504 1 -3505 0 -3506 0 -3507 0 -3508 0 -3509 0 -3510 0 -3511 0 -3512 0 -3513 0 -3514 1 -3515 0 -3516 0 -3517 0 -3518 0 -3519 0 -3520 0 -3521 0 -3522 0 -3523 0 -3524 1 -3525 0 -3526 0 -3527 0 -3528 0 -3529 0 -3530 0 -3531 0 -3532 0 -3533 1 -3534 0 -3535 0 -3536 0 -3537 0 -3538 0 -3539 0 -3540 0 -3541 0 -3542 0 -3543 0 -3544 0 -3545 0 -3546 0 -3547 0 -3548 0 -3549 0 -3550 0 -3551 1 -3552 0 -3553 0 -3554 0 -3555 0 -3556 0 -3557 0 -3558 0 -3559 0 -3560 0 -3561 1 -3562 0 -3563 0 -3564 0 -3565 0 -3566 0 -3567 0 -3568 0 -3569 0 -3570 1 -3571 0 -3572 0 -3573 0 -3574 0 -3575 0 -3576 0 -3577 0 -3578 0 -3579 0 -3580 1 -3581 0 -3582 0 -3583 0 -3584 0 -3585 0 -3586 0 -3587 0 -3588 0 -3589 0 -3590 1 -3591 0 -3592 0 -3593 0 -3594 0 -3595 0 -3596 0 -3597 0 -3598 0 -3599 1 -3600 0 -3601 0 -3602 0 -3603 0 -3604 0 -3605 0 -3606 0 -3607 0 -3608 0 -3609 1 -3610 0 -3611 0 -3612 0 -3613 0 -3614 0 -3615 0 -3616 0 -3617 0 -3618 0 -3619 0 -3620 1 -3621 0 -3622 0 -3623 0 -3624 0 -3625 0 -3626 0 -3627 0 -3628 0 -3629 0 -3630 1 -3631 0 -3632 0 -3633 0 -3634 0 -3635 0 -3636 0 -3637 0 -3638 0 -3639 1 -3640 0 -3641 0 -3642 0 -3643 0 -3644 0 -3645 1 -3646 0 -3647 0 -3648 0 -3649 0 -3650 0 -3651 1 -3652 0 -3653 0 -3654 0 -3655 0 -3656 0 -3657 0 -3658 1 -3659 0 -3660 0 -3661 0 -3662 0 -3663 0 -3664 0 -3665 0 -3666 1 -3667 0 -3668 0 -3669 0 -3670 0 -3671 0 -3672 0 -3673 0 -3674 0 -3675 0 -3676 1 -3677 0 -3678 0 -3679 0 -3680 0 -3681 0 -3682 0 -3683 0 -3684 0 -3685 1 -3686 0 -3687 0 -3688 0 -3689 0 -3690 0 -3691 0 -3692 0 -3693 0 -3694 0 -3695 1 -3696 0 -3697 0 -3698 0 -3699 0 -3700 0 -3701 0 -3702 0 -3703 0 -3704 0 -3705 0 -3706 1 -3707 0 -3708 0 -3709 0 -3710 0 -3711 0 -3712 0 -3713 0 -3714 0 -3715 0 -3716 1 -3717 0 -3718 0 -3719 0 -3720 0 -3721 0 -3722 0 -3723 0 -3724 0 -3725 0 -3726 0 -3727 0 -3728 0 -3729 0 -3730 0 -3731 0 -3732 0 -3733 0 -3734 0 -3735 0 -3736 1 -3737 0 -3738 0 -3739 0 -3740 0 -3741 0 -3742 0 -3743 0 -3744 0 -3745 0 -3746 1 -3747 0 -3748 0 -3749 0 -3750 0 -3751 0 -3752 0 -3753 0 -3754 0 -3755 0 -3756 1 -3757 0 -3758 0 -3759 0 -3760 0 -3761 0 -3762 0 -3763 1 -3764 0 -3765 0 -3766 0 -3767 0 -3768 0 -3769 0 -3770 0 -3771 1 -3772 0 -3773 0 -3774 0 -3775 0 -3776 0 -3777 0 -3778 1 -3779 0 -3780 0 -3781 0 -3782 0 -3783 0 -3784 0 -3785 0 -3786 0 -3787 0 -3788 0 -3789 0 -3790 0 -3791 0 -3792 0 -3793 0 -3794 0 -3795 0 -3796 0 -3797 1 -3798 0 -3799 0 -3800 0 -3801 0 -3802 0 -3803 0 -3804 0 -3805 0 -3806 1 -3807 0 -3808 0 -3809 0 -3810 0 -3811 0 -3812 0 -3813 0 -3814 0 -3815 0 -3816 0 -3817 1 -3818 0 -3819 0 -3820 0 -3821 0 -3822 0 -3823 0 -3824 0 -3825 0 -3826 0 -3827 1 -3828 0 -3829 1 -3830 0 -3831 0 -3832 0 -3833 0 -3834 1 -3835 0 -3836 0 -3837 0 -3838 0 -3839 0 -3840 0 -3841 0 -3842 0 -3843 0 -3844 0 -3845 1 -3846 0 -3847 0 -3848 0 -3849 0 -3850 0 -3851 0 -3852 0 -3853 0 -3854 0 -3855 1 -3856 0 -3857 0 -3858 0 -3859 0 -3860 0 -3861 0 -3862 0 -3863 1 -3864 0 -3865 0 -3866 0 -3867 0 -3868 0 -3869 0 -3870 0 -3871 0 -3872 0 -3873 1 -3874 0 -3875 0 -3876 0 -3877 0 -3878 0 -3879 0 -3880 0 -3881 0 -3882 0 -3883 1 -3884 0 -3885 0 -3886 0 -3887 0 -3888 0 -3889 0 -3890 0 -3891 0 -3892 0 -3893 0 -3894 1 -3895 0 -3896 0 -3897 0 -3898 0 -3899 0 -3900 0 -3901 0 -3902 0 -3903 0 -3904 0 -3905 1 -3906 0 -3907 0 -3908 0 -3909 0 -3910 0 -3911 0 -3912 0 -3913 0 -3914 1 -3915 0 -3916 0 -3917 0 -3918 0 -3919 0 -3920 0 -3921 0 -3922 0 -3923 0 -3924 0 -3925 1 -3926 0 -3927 0 -3928 0 -3929 0 -3930 0 -3931 0 -3932 0 -3933 0 -3934 1 -3935 0 -3936 0 -3937 0 -3938 0 -3939 0 -3940 0 -3941 0 -3942 0 -3943 0 -3944 0 -3945 1 -3946 0 -3947 0 -3948 0 -3949 0 -3950 0 -3951 0 -3952 0 -3953 0 -3954 0 -3955 1 -3956 0 -3957 0 -3958 0 -3959 0 -3960 0 -3961 0 -3962 0 -3963 0 -3964 0 -3965 0 -3966 1 -3967 0 -3968 0 -3969 0 -3970 0 -3971 0 -3972 0 -3973 0 -3974 0 -3975 1 -3976 0 -3977 0 -3978 0 -3979 0 -3980 0 -3981 0 -3982 0 -3983 0 -3984 1 -3985 0 -3986 0 -3987 0 -3988 0 -3989 0 -3990 0 -3991 0 -3992 0 -3993 0 -3994 1 -3995 0 -3996 0 -3997 0 -3998 0 -3999 0 -4000 0 -4001 0 -4002 0 -4003 0 -4004 0 -4005 0 -4006 0 -4007 0 -4008 0 -4009 0 -4010 0 -4011 0 -4012 0 -4013 0 -4014 1 -4015 0 -4016 0 -4017 0 -4018 0 -4019 0 -4020 0 -4021 0 -4022 0 -4023 0 -4024 1 -4025 0 -4026 0 -4027 0 -4028 0 -4029 0 -4030 0 -4031 0 -4032 0 -4033 0 -4034 0 -4035 1 -4036 0 -4037 0 -4038 0 -4039 0 -4040 0 -4041 0 -4042 0 -4043 0 -4044 0 -4045 1 -4046 0 -4047 0 -4048 0 -4049 0 -4050 0 -4051 0 -4052 0 -4053 0 -4054 0 -4055 0 -4056 1 -4057 0 -4058 0 -4059 0 -4060 0 -4061 0 -4062 0 -4063 0 -4064 0 -4065 0 -4066 1 -4067 0 -4068 0 -4069 0 -4070 0 -4071 0 -4072 0 -4073 0 -4074 1 -4075 0 -4076 0 -4077 0 -4078 0 -4079 0 -4080 0 -4081 0 -4082 0 -4083 0 -4084 1 -4085 0 -4086 0 -4087 0 -4088 0 -4089 0 -4090 0 -4091 0 -4092 0 -4093 1 -4094 0 -4095 0 -4096 0 -4097 0 -4098 0 -4099 0 -4100 0 -4101 0 -4102 1 -4103 0 -4104 0 -4105 0 -4106 0 -4107 0 -4108 0 -4109 0 -4110 0 -4111 0 -4112 1 -4113 0 -4114 0 -4115 0 -4116 0 -4117 0 -4118 0 -4119 0 -4120 0 -4121 0 -4122 1 -4123 0 -4124 0 -4125 0 -4126 0 -4127 0 -4128 0 -4129 0 -4130 0 -4131 0 -4132 0 -4133 1 -4134 0 -4135 0 -4136 0 -4137 0 -4138 0 -4139 0 -4140 0 -4141 0 -4142 0 -4143 0 -4144 1 -4145 0 -4146 0 -4147 0 -4148 0 -4149 0 -4150 0 -4151 0 -4152 0 -4153 0 -4154 1 -4155 0 -4156 0 -4157 0 -4158 0 -4159 0 -4160 0 -4161 0 -4162 0 -4163 0 -4164 0 -4165 1 -4166 0 -4167 0 -4168 0 -4169 0 -4170 0 -4171 0 -4172 0 -4173 0 -4174 0 -4175 0 -4176 1 -4177 0 -4178 0 -4179 0 -4180 0 -4181 0 -4182 0 -4183 0 -4184 0 -4185 1 -4186 0 -4187 0 -4188 0 -4189 0 -4190 0 -4191 0 -4192 0 -4193 0 -4194 0 -4195 1 -4196 0 -4197 0 -4198 0 -4199 0 -4200 0 -4201 0 -4202 0 -4203 0 -4204 0 -4205 0 -4206 0 -4207 0 -4208 0 -4209 0 -4210 0 -4211 0 -4212 1 -4213 0 -4214 0 -4215 0 -4216 0 -4217 0 -4218 0 -4219 0 -4220 0 -4221 1 -4222 0 -4223 0 -4224 0 -4225 0 -4226 0 -4227 0 -4228 0 -4229 0 -4230 1 -4231 0 -4232 0 -4233 0 -4234 0 -4235 0 -4236 0 -4237 0 -4238 0 -4239 1 -4240 0 -4241 0 -4242 0 -4243 0 -4244 0 -4245 0 -4246 0 -4247 0 -4248 0 -4249 1 -4250 0 -4251 0 -4252 0 -4253 0 -4254 0 -4255 0 -4256 0 -4257 0 -4258 1 -4259 0 -4260 0 -4261 0 -4262 0 -4263 0 -4264 0 -4265 0 -4266 0 -4267 0 -4268 1 -4269 0 -4270 0 -4271 0 -4272 0 -4273 0 -4274 0 -4275 0 -4276 0 -4277 0 -4278 1 -4279 0 -4280 0 -4281 0 -4282 0 -4283 0 -4284 0 -4285 0 -4286 0 -4287 0 -4288 0 -4289 1 -4290 0 -4291 0 -4292 0 -4293 0 -4294 0 -4295 0 -4296 0 -4297 0 -4298 0 -4299 1 -4300 0 -4301 0 -4302 0 -4303 0 -4304 0 -4305 0 -4306 0 -4307 0 -4308 0 -4309 1 -4310 0 -4311 0 -4312 0 -4313 0 -4314 0 -4315 0 -4316 0 -4317 0 -4318 1 -4319 0 -4320 0 -4321 0 -4322 0 -4323 0 -4324 0 -4325 0 -4326 0 -4327 1 -4328 0 -4329 0 -4330 0 -4331 0 -4332 0 -4333 0 -4334 0 -4335 0 -4336 0 -4337 1 -4338 0 -4339 0 -4340 0 -4341 0 -4342 0 -4343 0 -4344 0 -4345 0 -4346 0 -4347 1 -4348 0 -4349 0 -4350 0 -4351 0 -4352 0 -4353 0 -4354 0 -4355 1 -4356 0 -4357 0 -4358 0 -4359 0 -4360 0 -4361 0 -4362 0 -4363 0 -4364 0 -4365 0 -4366 0 -4367 0 -4368 0 -4369 0 -4370 0 -4371 0 -4372 0 -4373 0 -4374 1 -4375 0 -4376 0 -4377 0 -4378 0 -4379 0 -4380 0 -4381 0 -4382 0 -4383 0 -4384 1 -4385 0 -4386 0 -4387 0 -4388 0 -4389 0 -4390 0 -4391 0 -4392 0 -4393 1 -4394 0 -4395 0 -4396 0 -4397 0 -4398 0 -4399 0 -4400 0 -4401 0 -4402 0 -4403 1 -4404 0 -4405 0 -4406 0 -4407 0 -4408 0 -4409 0 -4410 0 -4411 0 -4412 1 -4413 0 -4414 0 -4415 0 -4416 0 -4417 0 -4418 0 -4419 0 -4420 0 -4421 0 -4422 0 -4423 1 -4424 0 -4425 0 -4426 0 -4427 0 -4428 0 -4429 0 -4430 2 -4431 0 -4432 0 -4433 0 -4434 0 -4435 0 -4436 0 -4437 1 -4438 0 -4439 0 -4440 0 -4441 0 -4442 0 -4443 0 -4444 0 -4445 1 -4446 0 -4447 0 -4448 0 -4449 0 -4450 0 -4451 0 -4452 0 -4453 0 -4454 1 -4455 0 -4456 0 -4457 0 -4458 0 -4459 0 -4460 0 -4461 0 -4462 1 -4463 0 -4464 0 -4465 0 -4466 0 -4467 0 -4468 0 -4469 0 -4470 0 -4471 1 -4472 0 -4473 0 -4474 0 -4475 0 -4476 0 -4477 0 -4478 0 -4479 0 -4480 1 -4481 0 -4482 0 -4483 0 -4484 0 -4485 0 -4486 0 -4487 0 -4488 1 -4489 0 -4490 0 -4491 0 -4492 0 -4493 0 -4494 0 -4495 0 -4496 0 -4497 1 -4498 0 -4499 0 -4500 0 -4501 0 -4502 0 -4503 0 -4504 0 -4505 1 -4506 0 -4507 0 -4508 0 -4509 0 -4510 0 -4511 0 -4512 0 -4513 1 -4514 0 -4515 0 -4516 0 -4517 0 -4518 0 -4519 0 -4520 1 -4521 0 -4522 0 -4523 0 -4524 0 -4525 0 -4526 0 -4527 0 -4528 0 -4529 1 -4530 0 -4531 0 -4532 0 -4533 0 -4534 0 -4535 0 -4536 0 -4537 0 -4538 1 -4539 0 -4540 0 -4541 0 -4542 0 -4543 0 -4544 0 -4545 0 -4546 1 -4547 0 -4548 0 -4549 0 -4550 0 -4551 0 -4552 1 -4553 0 -4554 0 -4555 0 -4556 0 -4557 0 -4558 0 -4559 1 -4560 0 -4561 0 -4562 0 -4563 0 -4564 0 -4565 0 -4566 0 -4567 1 -4568 0 -4569 0 -4570 0 -4571 0 -4572 0 -4573 0 -4574 0 -4575 1 -4576 0 -4577 0 -4578 0 -4579 0 -4580 0 -4581 0 -4582 0 -4583 1 -4584 0 -4585 0 -4586 0 -4587 0 -4588 0 -4589 0 -4590 0 -4591 1 -4592 0 -4593 0 -4594 0 -4595 0 -4596 0 -4597 0 -4598 0 -4599 0 -4600 1 -4601 0 -4602 0 -4603 0 -4604 0 -4605 0 -4606 0 -4607 1 -4608 0 -4609 0 -4610 0 -4611 0 -4612 0 -4613 0 -4614 0 -4615 0 -4616 1 -4617 0 -4618 0 -4619 0 -4620 0 -4621 0 -4622 0 -4623 0 -4624 0 -4625 1 -4626 0 -4627 0 -4628 0 -4629 0 -4630 0 -4631 0 -4632 0 -4633 0 -4634 1 -4635 0 -4636 0 -4637 0 -4638 0 -4639 0 -4640 0 -4641 0 -4642 0 -4643 0 -4644 0 -4645 0 -4646 0 -4647 0 -4648 0 -4649 0 -4650 0 -4651 0 -4652 1 -4653 0 -4654 0 -4655 0 -4656 0 -4657 0 -4658 0 -4659 0 -4660 0 -4661 1 -4662 0 -4663 0 -4664 0 -4665 1 -4666 0 -4667 0 -4668 0 -4669 0 -4670 0 -4671 0 -4672 1 -4673 0 -4674 0 -4675 0 -4676 0 -4677 0 -4678 1 -4679 0 -4680 0 -4681 0 -4682 0 -4683 0 -4684 0 -4685 0 -4686 1 -4687 0 -4688 0 -4689 0 -4690 0 -4691 0 -4692 0 -4693 0 -4694 1 -4695 0 -4696 0 -4697 0 -4698 0 -4699 0 -4700 0 -4701 0 -4702 1 -4703 0 -4704 0 -4705 0 -4706 0 -4707 0 -4708 0 -4709 1 -4710 0 -4711 0 -4712 0 -4713 0 -4714 0 -4715 0 -4716 0 -4717 1 -4718 0 -4719 0 -4720 0 -4721 0 -4722 0 -4723 0 -4724 0 -4725 1 -4726 0 -4727 0 -4728 0 -4729 0 -4730 0 -4731 0 -4732 0 -4733 0 -4734 1 -4735 0 -4736 0 -4737 0 -4738 0 -4739 0 -4740 0 -4741 0 -4742 0 -4743 0 -4744 1 -4745 0 -4746 0 -4747 0 -4748 0 -4749 0 -4750 0 -4751 0 -4752 1 -4753 0 -4754 0 -4755 0 -4756 0 -4757 0 -4758 0 -4759 0 -4760 1 -4761 0 -4762 0 -4763 0 -4764 0 -4765 0 -4766 0 -4767 0 -4768 0 -4769 1 -4770 0 -4771 0 -4772 0 -4773 0 -4774 0 -4775 0 -4776 0 -4777 0 -4778 1 -4779 0 -4780 0 -4781 0 -4782 0 -4783 0 -4784 0 -4785 0 -4786 1 -4787 0 -4788 0 -4789 0 -4790 0 -4791 0 -4792 0 -4793 0 -4794 0 -4795 0 -4796 1 -4797 0 -4798 0 -4799 0 -4800 0 -4801 0 -4802 0 -4803 0 -4804 1 -4805 0 -4806 0 -4807 0 -4808 0 -4809 0 -4810 0 -4811 0 -4812 0 -4813 1 -4814 0 -4815 0 -4816 0 -4817 0 -4818 0 -4819 0 -4820 0 -4821 0 -4822 1 -4823 0 -4824 0 -4825 0 -4826 0 -4827 0 -4828 0 -4829 0 -4830 0 -4831 1 -4832 0 -4833 0 -4834 0 -4835 0 -4836 0 -4837 0 -4838 0 -4839 0 -4840 0 -4841 0 -4842 0 -4843 0 -4844 0 -4845 0 -4846 0 -4847 0 -4848 0 -4849 0 -4850 0 -4851 0 -4852 0 -4853 0 -4854 0 -4855 0 -4856 0 -4857 0 -4858 0 -4859 0 -4860 0 -4861 0 -4862 0 -4863 0 -4864 0 -4865 1 -4866 0 -4867 0 -4868 0 -4869 0 -4870 0 -4871 0 -4872 1 -4873 0 -4874 0 -4875 0 -4876 0 -4877 0 -4878 0 -4879 0 -4880 1 -4881 0 -4882 0 -4883 0 -4884 0 -4885 0 -4886 0 -4887 0 -4888 0 -4889 0 -4890 1 -4891 0 -4892 0 -4893 0 -4894 0 -4895 0 -4896 0 -4897 0 -4898 1 -4899 0 -4900 0 -4901 0 -4902 0 -4903 0 -4904 0 -4905 1 -4906 0 -4907 0 -4908 0 -4909 0 -4910 0 -4911 0 -4912 0 -4913 1 -4914 0 -4915 0 -4916 0 -4917 0 -4918 0 -4919 0 -4920 0 -4921 0 -4922 0 -4923 1 -4924 0 -4925 0 -4926 0 -4927 0 -4928 0 -4929 0 -4930 0 -4931 0 -4932 0 -4933 1 -4934 0 -4935 0 -4936 0 -4937 0 -4938 0 -4939 0 -4940 0 -4941 0 -4942 0 -4943 0 -4944 0 -4945 0 -4946 0 -4947 0 -4948 1 -4949 0 -4950 0 -4951 0 -4952 0 -4953 0 -4954 0 -4955 0 -4956 1 -4957 0 -4958 0 -4959 0 -4960 0 -4961 0 -4962 0 -4963 0 -4964 1 -4965 0 -4966 0 -4967 0 -4968 0 -4969 0 -4970 0 -4971 0 -4972 1 -4973 0 -4974 0 -4975 0 -4976 0 -4977 0 -4978 0 -4979 1 -4980 0 -4981 0 -4982 0 -4983 0 -4984 0 -4985 0 -4986 0 -4987 1 -4988 0 -4989 0 -4990 0 -4991 0 -4992 0 -4993 0 -4994 1 -4995 0 -4996 0 -4997 0 -4998 0 -4999 0 -5000 0 -5001 0 -5002 0 -5003 1 -5004 0 -5005 0 -5006 0 -5007 0 -5008 0 -5009 0 -5010 0 -5011 0 -5012 1 -5013 0 -5014 0 -5015 0 -5016 0 -5017 0 -5018 0 -5019 0 -5020 1 -5021 0 -5022 0 -5023 0 -5024 0 -5025 0 -5026 0 -5027 0 -5028 0 -5029 1 -5030 0 -5031 0 -5032 0 -5033 0 -5034 0 -5035 0 -5036 0 -5037 1 -5038 0 -5039 0 -5040 0 -5041 0 -5042 0 -5043 0 -5044 0 -5045 1 -5046 0 -5047 0 -5048 0 -5049 0 -5050 0 -5051 0 -5052 0 -5053 1 -5054 0 -5055 0 -5056 0 -5057 0 -5058 0 -5059 0 -5060 0 -5061 0 -5062 1 -5063 0 -5064 0 -5065 0 -5066 0 -5067 0 -5068 0 -5069 0 -5070 0 -5071 0 -5072 0 -5073 0 -5074 0 -5075 0 -5076 0 -5077 0 -5078 0 -5079 1 -5080 0 -5081 0 -5082 0 -5083 0 -5084 0 -5085 0 -5086 1 -5087 0 -5088 0 -5089 0 -5090 0 -5091 0 -5092 0 -5093 0 -5094 1 -5095 0 -5096 0 -5097 0 -5098 0 -5099 0 -5100 0 -5101 0 -5102 0 -5103 1 -5104 0 -5105 0 -5106 0 -5107 0 -5108 0 -5109 0 -5110 1 -5111 0 -5112 0 -5113 0 -5114 0 -5115 0 -5116 0 -5117 0 -5118 1 -5119 0 -5120 0 -5121 0 -5122 0 -5123 0 -5124 0 -5125 0 -5126 0 -5127 1 -5128 0 -5129 0 -5130 0 -5131 0 -5132 0 -5133 0 -5134 1 -5135 0 -5136 0 -5137 0 -5138 0 -5139 0 -5140 0 -5141 1 -5142 0 -5143 0 -5144 0 -5145 0 -5146 0 -5147 0 -5148 0 -5149 1 -5150 0 -5151 0 -5152 0 -5153 0 -5154 0 -5155 0 -5156 0 -5157 0 -5158 1 -5159 0 -5160 0 -5161 0 -5162 0 -5163 0 -5164 0 -5165 0 -5166 0 -5167 1 -5168 0 -5169 0 -5170 0 -5171 0 -5172 0 -5173 0 -5174 0 -5175 1 -5176 0 -5177 0 -5178 0 -5179 0 -5180 0 -5181 0 -5182 1 -5183 0 -5184 0 -5185 0 -5186 0 -5187 0 -5188 0 -5189 0 -5190 1 -5191 0 -5192 0 -5193 0 -5194 0 -5195 0 -5196 0 -5197 0 -5198 0 -5199 1 -5200 0 -5201 0 -5202 0 -5203 0 -5204 0 -5205 0 -5206 0 -5207 0 -5208 1 -5209 0 -5210 0 -5211 0 -5212 0 -5213 0 -5214 0 -5215 0 -5216 0 -5217 0 -5218 1 -5219 0 -5220 0 -5221 0 -5222 0 -5223 0 -5224 0 -5225 0 -5226 1 -5227 0 -5228 0 -5229 0 -5230 0 -5231 0 -5232 0 -5233 0 -5234 1 -5235 0 -5236 0 -5237 0 -5238 0 -5239 0 -5240 0 -5241 0 -5242 1 -5243 0 -5244 0 -5245 0 -5246 0 -5247 0 -5248 0 -5249 0 -5250 0 -5251 1 -5252 0 -5253 0 -5254 0 -5255 0 -5256 0 -5257 0 -5258 0 -5259 0 -5260 0 -5261 0 -5262 0 -5263 0 -5264 0 -5265 0 -5266 0 -5267 0 -5268 1 -5269 0 -5270 0 -5271 0 -5272 0 -5273 0 -5274 0 -5275 0 -5276 1 -5277 0 -5278 0 -5279 0 -5280 0 -5281 0 -5282 0 -5283 1 -5284 0 -5285 0 -5286 0 -5287 0 -5288 0 -5289 0 -5290 0 -5291 0 -5292 0 -5293 1 -5294 0 -5295 0 -5296 0 -5297 0 -5298 0 -5299 0 -5300 0 -5301 1 -5302 0 -5303 0 -5304 0 -5305 0 -5306 0 -5307 0 -5308 0 -5309 0 -5310 1 -5311 0 -5312 0 -5313 0 -5314 0 -5315 0 -5316 0 -5317 0 -5318 1 -5319 0 -5320 0 -5321 0 -5322 0 -5323 0 -5324 0 -5325 1 -5326 0 -5327 0 -5328 0 -5329 0 -5330 0 -5331 0 -5332 0 -5333 0 -5334 0 -5335 0 -5336 0 -5337 0 -5338 0 -5339 0 -5340 0 -5341 0 -5342 1 -5343 0 -5344 0 -5345 0 -5346 0 -5347 0 -5348 0 -5349 1 -5350 0 -5351 0 -5352 0 -5353 0 -5354 0 -5355 0 -5356 0 -5357 0 -5358 1 -5359 0 -5360 0 -5361 0 -5362 0 -5363 0 -5364 0 -5365 0 -5366 1 -5367 0 -5368 0 -5369 0 -5370 0 -5371 0 -5372 0 -5373 1 -5374 0 -5375 0 -5376 0 -5377 0 -5378 0 -5379 0 -5380 0 -5381 1 -5382 0 -5383 0 -5384 0 -5385 0 -5386 0 -5387 0 -5388 0 -5389 0 -5390 1 -5391 0 -5392 0 -5393 0 -5394 0 -5395 0 -5396 0 -5397 0 -5398 1 -5399 0 -5400 0 -5401 0 -5402 0 -5403 0 -5404 0 -5405 0 -5406 1 -5407 0 -5408 0 -5409 0 -5410 0 -5411 0 -5412 0 -5413 0 -5414 1 -5415 0 -5416 0 -5417 0 -5418 0 -5419 0 -5420 0 -5421 0 -5422 1 -5423 0 -5424 0 -5425 0 -5426 0 -5427 0 -5428 0 -5429 0 -5430 0 -5431 0 -5432 0 -5433 0 -5434 0 -5435 0 -5436 0 -5437 0 -5438 1 -5439 0 -5440 0 -5441 0 -5442 0 -5443 0 -5444 0 -5445 0 -5446 0 -5447 1 -5448 0 -5449 0 -5450 0 -5451 0 -5452 0 -5453 0 -5454 0 -5455 0 -5456 1 -5457 0 -5458 0 -5459 0 -5460 0 -5461 0 -5462 0 -5463 0 -5464 1 -5465 0 -5466 0 -5467 0 -5468 0 -5469 0 -5470 0 -5471 0 -5472 1 -5473 0 -5474 0 -5475 0 -5476 0 -5477 0 -5478 0 -5479 0 -5480 0 -5481 1 -5482 0 -5483 0 -5484 0 -5485 0 -5486 0 -5487 0 -5488 0 -5489 1 -5490 0 -5491 0 -5492 0 -5493 0 -5494 0 -5495 0 -5496 0 -5497 0 -5498 1 -5499 0 -5500 0 -5501 0 -5502 0 -5503 0 -5504 0 -5505 0 -5506 1 -5507 0 -5508 0 -5509 0 -5510 0 -5511 0 -5512 0 -5513 0 -5514 1 -5515 0 -5516 0 -5517 0 -5518 0 -5519 0 -5520 0 -5521 0 -5522 0 -5523 1 -5524 0 -5525 0 -5526 0 -5527 0 -5528 0 -5529 0 -5530 0 -5531 1 -5532 0 -5533 0 -5534 0 -5535 0 -5536 0 -5537 0 -5538 0 -5539 0 -5540 1 -5541 0 -5542 0 -5543 0 -5544 0 -5545 0 -5546 0 -5547 0 -5548 0 -5549 1 -5550 0 -5551 0 -5552 0 -5553 0 -5554 0 -5555 0 -5556 0 -5557 0 -5558 0 -5559 0 -5560 0 -5561 0 -5562 0 -5563 0 -5564 0 -5565 1 -5566 0 -5567 0 -5568 0 -5569 0 -5570 0 -5571 1 -5572 0 -5573 0 -5574 0 -5575 0 -5576 0 -5577 0 -5578 0 -5579 1 -5580 0 -5581 0 -5582 0 -5583 0 -5584 0 -5585 0 -5586 0 -5587 0 -5588 1 -5589 0 -5590 0 -5591 0 -5592 0 -5593 0 -5594 0 -5595 0 -5596 1 -5597 0 -5598 0 -5599 0 -5600 0 -5601 0 -5602 0 -5603 0 -5604 0 -5605 0 -5606 1 -5607 0 -5608 0 -5609 0 -5610 0 -5611 0 -5612 0 -5613 0 -5614 1 -5615 0 -5616 0 -5617 0 -5618 0 -5619 0 -5620 0 -5621 0 -5622 1 -5623 0 -5624 0 -5625 0 -5626 0 -5627 0 -5628 0 -5629 0 -5630 0 -5631 0 -5632 0 -5633 0 -5634 0 -5635 0 -5636 0 -5637 0 -5638 1 -5639 0 -5640 0 -5641 0 -5642 0 -5643 0 -5644 0 -5645 0 -5646 0 -5647 1 -5648 0 -5649 0 -5650 0 -5651 0 -5652 0 -5653 0 -5654 1 -5655 0 -5656 0 -5657 0 -5658 0 -5659 0 -5660 0 -5661 0 -5662 1 -5663 0 -5664 0 -5665 0 -5666 0 -5667 0 -5668 0 -5669 0 -5670 1 -5671 0 -5672 0 -5673 0 -5674 0 -5675 0 -5676 0 -5677 0 -5678 0 -5679 1 -5680 2 -5681 1 -5682 0 -5683 0 -5684 0 -5685 0 -5686 0 -5687 1 -5688 0 -5689 0 -5690 0 -5691 0 -5692 1 -5693 0 -5694 0 -5695 0 -5696 0 -5697 1 -5698 0 -5699 0 -5700 0 -5701 0 -5702 0 -5703 0 -5704 0 -5705 1 -5706 0 -5707 0 -5708 0 -5709 0 -5710 0 -5711 1 -5712 0 -5713 0 -5714 0 -5715 0 -5716 0 -5717 0 -5718 0 -5719 0 -5720 0 -5721 0 -5722 0 -5723 0 -5724 0 -5725 0 -5726 1 -5727 0 -5728 0 -5729 0 -5730 0 -5731 0 -5732 0 -5733 0 -5734 1 -5735 0 -5736 0 -5737 0 -5738 0 -5739 0 -5740 0 -5741 0 -5742 1 -5743 0 -5744 0 -5745 0 -5746 0 -5747 0 -5748 0 -5749 0 -5750 0 -5751 1 -5752 0 -5753 0 -5754 0 -5755 0 -5756 0 -5757 0 -5758 0 -5759 1 -5760 0 -5761 0 -5762 0 -5763 0 -5764 0 -5765 0 -5766 1 -5767 0 -5768 0 -5769 0 -5770 0 -5771 0 -5772 0 -5773 0 -5774 1 -5775 0 -5776 0 -5777 0 -5778 0 -5779 0 -5780 0 -5781 0 -5782 1 -5783 0 -5784 0 -5785 0 -5786 0 -5787 0 -5788 0 -5789 0 -5790 0 -5791 1 -5792 0 -5793 0 -5794 0 -5795 0 -5796 0 -5797 0 -5798 0 -5799 0 -5800 1 -5801 0 -5802 0 -5803 0 -5804 0 -5805 0 -5806 0 -5807 0 -5808 0 -5809 1 -5810 0 -5811 0 -5812 0 -5813 0 -5814 0 -5815 0 -5816 1 -5817 0 -5818 0 -5819 0 -5820 0 -5821 0 -5822 0 -5823 0 -5824 0 -5825 1 -5826 0 -5827 0 -5828 0 -5829 0 -5830 0 -5831 0 -5832 0 -5833 0 -5834 1 -5835 0 -5836 0 -5837 0 -5838 0 -5839 0 -5840 0 -5841 0 -5842 1 -5843 0 -5844 0 -5845 0 -5846 0 -5847 0 -5848 0 -5849 0 -5850 1 -5851 0 -5852 0 -5853 0 -5854 0 -5855 0 -5856 0 -5857 0 -5858 1 -5859 0 -5860 0 -5861 0 -5862 0 -5863 0 -5864 0 -5865 0 -5866 0 -5867 1 -5868 0 -5869 0 -5870 0 -5871 0 -5872 0 -5873 0 -5874 0 -5875 1 -5876 0 -5877 0 -5878 0 -5879 0 -5880 0 -5881 0 -5882 0 -5883 0 -5884 1 -5885 0 -5886 0 -5887 0 -5888 0 -5889 0 -5890 0 -5891 1 -5892 0 -5893 0 -5894 0 -5895 0 -5896 0 -5897 0 -5898 0 -5899 0 -5900 1 -5901 0 -5902 0 -5903 0 -5904 0 -5905 0 -5906 0 -5907 0 -5908 0 -5909 1 -5910 0 -5911 0 -5912 0 -5913 0 -5914 0 -5915 0 -5916 0 -5917 1 -5918 0 -5919 0 -5920 0 -5921 0 -5922 0 -5923 0 -5924 0 -5925 0 -5926 1 -5927 0 -5928 0 -5929 0 -5930 0 -5931 0 -5932 0 -5933 0 -5934 1 -5935 0 -5936 0 -5937 0 -5938 0 -5939 0 -5940 0 -5941 0 -5942 0 -5943 0 -5944 1 -5945 0 -5946 0 -5947 0 -5948 0 -5949 0 -5950 0 -5951 0 -5952 0 -5953 0 -5954 0 -5955 0 -5956 0 -5957 0 -5958 0 -5959 0 -5960 0 -5961 0 -5962 0 -5963 0 -5964 0 -5965 0 -5966 0 -5967 0 -5968 0 -5969 0 -5970 1 -5971 0 -5972 0 -5973 0 -5974 0 -5975 0 -5976 0 -5977 0 -5978 1 -5979 0 -5980 0 -5981 0 -5982 0 -5983 0 -5984 0 -5985 0 -5986 0 -5987 1 -5988 0 -5989 0 -5990 0 -5991 0 -5992 0 -5993 0 -5994 0 -5995 0 -5996 1 -5997 0 -5998 0 -5999 0 -6000 0 -6001 0 -6002 0 -6003 0 -6004 0 -6005 0 -6006 1 -6007 0 -6008 0 -6009 0 -6010 0 -6011 0 -6012 0 -6013 0 -6014 1 -6015 0 -6016 0 -6017 0 -6018 0 -6019 0 -6020 0 -6021 0 -6022 0 -6023 1 -6024 0 -6025 0 -6026 0 -6027 0 -6028 0 -6029 0 -6030 0 -6031 1 -6032 0 -6033 0 -6034 0 -6035 0 -6036 0 -6037 0 -6038 1 -6039 0 -6040 0 -6041 0 -6042 0 -6043 0 -6044 0 -6045 0 -6046 0 -6047 0 -6048 1 -6049 0 -6050 0 -6051 0 -6052 0 -6053 0 -6054 0 -6055 1 -6056 0 -6057 0 -6058 0 -6059 0 -6060 0 -6061 1 -6062 0 -6063 0 -6064 0 -6065 0 -6066 0 -6067 0 -6068 1 -6069 0 -6070 0 -6071 0 -6072 0 -6073 0 -6074 0 -6075 0 -6076 1 -6077 0 -6078 0 -6079 0 -6080 0 -6081 0 -6082 0 -6083 0 -6084 0 -6085 1 -6086 0 -6087 0 -6088 0 -6089 0 -6090 0 -6091 0 -6092 0 -6093 0 -6094 0 -6095 1 -6096 0 -6097 0 -6098 0 -6099 0 -6100 0 -6101 0 -6102 0 -6103 0 -6104 1 -6105 0 -6106 0 -6107 0 -6108 0 -6109 0 -6110 0 -6111 0 -6112 1 -6113 0 -6114 0 -6115 0 -6116 0 -6117 0 -6118 0 -6119 0 -6120 0 -6121 0 -6122 0 -6123 0 -6124 0 -6125 1 -6126 0 -6127 0 -6128 0 -6129 0 -6130 0 -6131 0 -6132 0 -6133 0 -6134 0 -6135 0 -6136 0 -6137 0 -6138 0 -6139 0 -6140 0 -6141 0 -6142 1 -6143 0 -6144 0 -6145 0 -6146 0 -6147 0 -6148 0 -6149 0 -6150 1 -6151 0 -6152 0 -6153 0 -6154 0 -6155 0 -6156 0 -6157 0 -6158 0 -6159 1 -6160 0 -6161 0 -6162 0 -6163 0 -6164 0 -6165 0 -6166 0 -6167 1 -6168 0 -6169 0 -6170 0 -6171 0 -6172 0 -6173 0 -6174 0 -6175 1 -6176 0 -6177 0 -6178 0 -6179 0 -6180 0 -6181 0 -6182 0 -6183 1 -6184 0 -6185 0 -6186 0 -6187 0 -6188 0 -6189 0 -6190 0 -6191 0 -6192 1 -6193 0 -6194 0 -6195 0 -6196 0 -6197 0 -6198 0 -6199 0 -6200 0 -6201 1 -6202 0 -6203 0 -6204 0 -6205 0 -6206 0 -6207 0 -6208 0 -6209 0 -6210 1 -6211 0 -6212 0 -6213 0 -6214 0 -6215 0 -6216 0 -6217 1 -6218 0 -6219 0 -6220 0 -6221 0 -6222 0 -6223 0 -6224 0 -6225 1 -6226 0 -6227 0 -6228 0 -6229 0 -6230 0 -6231 0 -6232 0 -6233 0 -6234 1 -6235 0 -6236 0 -6237 0 -6238 0 -6239 0 -6240 0 -6241 1 -6242 0 -6243 0 -6244 0 -6245 0 -6246 0 -6247 0 -6248 0 -6249 0 -6250 1 -6251 0 -6252 0 -6253 0 -6254 0 -6255 0 -6256 0 -6257 0 -6258 1 -6259 0 -6260 0 -6261 0 -6262 0 -6263 0 -6264 0 -6265 0 -6266 0 -6267 0 -6268 1 -6269 0 -6270 0 -6271 0 -6272 0 -6273 0 -6274 0 -6275 0 -6276 0 -6277 1 -6278 0 -6279 0 -6280 0 -6281 0 -6282 0 -6283 0 -6284 0 -6285 1 -6286 0 -6287 0 -6288 0 -6289 0 -6290 0 -6291 0 -6292 1 -6293 0 -6294 0 -6295 0 -6296 0 -6297 0 -6298 0 -6299 1 -6300 0 -6301 0 -6302 0 -6303 0 -6304 0 -6305 0 -6306 0 -6307 1 -6308 0 -6309 0 -6310 0 -6311 0 -6312 0 -6313 0 -6314 0 -6315 1 -6316 0 -6317 0 -6318 0 -6319 0 -6320 0 -6321 0 -6322 0 -6323 0 -6324 1 -6325 0 -6326 0 -6327 0 -6328 0 -6329 0 -6330 0 -6331 0 -6332 1 -6333 0 -6334 0 -6335 0 -6336 0 -6337 0 -6338 0 -6339 0 -6340 0 -6341 1 -6342 0 -6343 0 -6344 0 -6345 0 -6346 0 -6347 0 -6348 0 -6349 0 -6350 1 -6351 0 -6352 0 -6353 0 -6354 0 -6355 0 -6356 0 -6357 0 -6358 1 -6359 0 -6360 0 -6361 0 -6362 0 -6363 0 -6364 0 -6365 0 -6366 1 -6367 0 -6368 0 -6369 0 -6370 0 -6371 0 -6372 0 -6373 0 -6374 0 -6375 1 -6376 0 -6377 0 -6378 0 -6379 0 -6380 0 -6381 0 -6382 0 -6383 1 -6384 0 -6385 0 -6386 0 -6387 0 -6388 0 -6389 0 -6390 0 -6391 4 -6392 0 -6393 1 -6394 0 -6395 0 -6396 0 -6397 1 -6398 0 -6399 0 -6400 0 -6401 0 -6402 1 -6403 0 -6404 0 -6405 0 -6406 0 -6407 1 -6408 0 -6409 0 -6410 0 -6411 0 -6412 1 -6413 0 -6414 0 -6415 0 -6416 0 -6417 0 -6418 1 -6419 0 -6420 0 -6421 0 -6422 0 -6423 0 -6424 0 -6425 1 -6426 0 -6427 0 -6428 0 -6429 0 -6430 0 -6431 0 -6432 0 -6433 0 -6434 1 -6435 0 -6436 0 -6437 0 -6438 0 -6439 0 -6440 0 -6441 0 -6442 0 -6443 1 -6444 0 -6445 0 -6446 0 -6447 0 -6448 0 -6449 0 -6450 0 -6451 0 -6452 1 -6453 0 -6454 0 -6455 0 -6456 0 -6457 0 -6458 0 -6459 0 -6460 0 -6461 0 -6462 0 -6463 1 -6464 0 -6465 0 -6466 0 -6467 0 -6468 0 -6469 0 -6470 0 -6471 0 -6472 1 -6473 0 -6474 0 -6475 0 -6476 0 -6477 0 -6478 0 -6479 0 -6480 0 -6481 0 -6482 1 -6483 0 -6484 0 -6485 0 -6486 0 -6487 0 -6488 0 -6489 0 -6490 0 -6491 0 -6492 1 -6493 0 -6494 0 -6495 0 -6496 0 -6497 0 -6498 0 -6499 0 -6500 0 -6501 0 -6502 0 -6503 0 -6504 0 -6505 0 -6506 0 -6507 0 -6508 0 -6509 0 -6510 0 -6511 0 -6512 1 -6513 0 -6514 0 -6515 0 -6516 0 -6517 0 -6518 0 -6519 0 -6520 0 -6521 1 -6522 0 -6523 0 -6524 0 -6525 0 -6526 0 -6527 0 -6528 0 -6529 0 -6530 0 -6531 1 -6532 0 -6533 0 -6534 0 -6535 0 -6536 0 -6537 0 -6538 0 -6539 0 -6540 1 -6541 0 -6542 0 -6543 0 -6544 0 -6545 0 -6546 0 -6547 0 -6548 0 -6549 0 -6550 1 -6551 0 -6552 0 -6553 0 -6554 0 -6555 0 -6556 0 -6557 0 -6558 0 -6559 0 -6560 1 -6561 0 -6562 0 -6563 0 -6564 0 -6565 0 -6566 0 -6567 0 -6568 0 -6569 1 -6570 0 -6571 0 -6572 0 -6573 0 -6574 0 -6575 0 -6576 0 -6577 1 -6578 0 -6579 0 -6580 0 -6581 0 -6582 0 -6583 0 -6584 0 -6585 0 -6586 1 -6587 0 -6588 0 -6589 0 -6590 0 -6591 0 -6592 0 -6593 0 -6594 0 -6595 1 -6596 0 -6597 0 -6598 0 -6599 0 -6600 0 -6601 0 -6602 0 -6603 0 -6604 1 -6605 0 -6606 0 -6607 0 -6608 0 -6609 0 -6610 0 -6611 0 -6612 0 -6613 1 -6614 0 -6615 0 -6616 0 -6617 0 -6618 0 -6619 0 -6620 0 -6621 0 -6622 1 -6623 0 -6624 0 -6625 0 -6626 0 -6627 0 -6628 0 -6629 0 -6630 0 -6631 1 -6632 0 -6633 0 -6634 0 -6635 0 -6636 0 -6637 0 -6638 0 -6639 0 -6640 1 -6641 0 -6642 0 -6643 0 -6644 0 -6645 0 -6646 0 -6647 0 -6648 0 -6649 0 -6650 1 -6651 0 -6652 0 -6653 0 -6654 0 -6655 0 -6656 0 -6657 0 -6658 0 -6659 0 -6660 1 -6661 0 -6662 0 -6663 0 -6664 0 -6665 0 -6666 0 -6667 0 -6668 0 -6669 1 -6670 0 -6671 0 -6672 0 -6673 0 -6674 0 -6675 0 -6676 0 -6677 0 -6678 0 -6679 1 -6680 0 -6681 0 -6682 0 -6683 0 -6684 0 -6685 0 -6686 0 -6687 0 -6688 1 -6689 0 -6690 0 -6691 0 -6692 0 -6693 0 -6694 0 -6695 0 -6696 0 -6697 0 -6698 1 -6699 0 -6700 0 -6701 0 -6702 0 -6703 0 -6704 0 -6705 0 -6706 1 -6707 0 -6708 0 -6709 0 -6710 0 -6711 0 -6712 0 -6713 0 -6714 0 -6715 0 -6716 1 -6717 0 -6718 0 -6719 0 -6720 0 -6721 0 -6722 0 -6723 0 -6724 0 -6725 0 -6726 1 -6727 0 -6728 0 -6729 0 -6730 0 -6731 0 -6732 0 -6733 0 -6734 0 -6735 0 -6736 0 -6737 1 -6738 0 -6739 0 -6740 0 -6741 0 -6742 0 -6743 0 -6744 0 -6745 0 -6746 1 -6747 0 -6748 0 -6749 0 -6750 0 -6751 0 -6752 0 -6753 0 -6754 0 -6755 0 -6756 1 -6757 0 -6758 0 -6759 0 -6760 0 -6761 0 -6762 0 -6763 0 -6764 0 -6765 0 -6766 1 -6767 0 -6768 0 -6769 0 -6770 0 -6771 0 -6772 0 -6773 0 -6774 0 -6775 1 -6776 0 -6777 0 -6778 0 -6779 0 -6780 0 -6781 0 -6782 0 -6783 0 -6784 1 -6785 0 -6786 0 -6787 0 -6788 0 -6789 0 -6790 0 -6791 0 -6792 0 -6793 0 -6794 1 -6795 0 -6796 0 -6797 0 -6798 0 -6799 0 -6800 0 -6801 0 -6802 0 -6803 1 -6804 0 -6805 0 -6806 0 -6807 0 -6808 0 -6809 0 -6810 0 -6811 0 -6812 0 -6813 1 -6814 0 -6815 0 -6816 0 -6817 0 -6818 0 -6819 0 -6820 0 -6821 0 -6822 0 -6823 0 -6824 1 -6825 0 -6826 0 -6827 0 -6828 0 -6829 0 -6830 0 -6831 0 -6832 1 -6833 0 -6834 0 -6835 0 -6836 0 -6837 0 -6838 0 -6839 0 -6840 0 -6841 0 -6842 1 -6843 0 -6844 0 -6845 0 -6846 0 -6847 0 -6848 0 -6849 0 -6850 0 -6851 1 -6852 0 -6853 0 -6854 0 -6855 0 -6856 0 -6857 0 -6858 0 -6859 0 -6860 0 -6861 0 -6862 1 -6863 0 -6864 0 -6865 0 -6866 0 -6867 0 -6868 0 -6869 0 -6870 0 -6871 1 -6872 0 -6873 0 -6874 0 -6875 0 -6876 0 -6877 0 -6878 0 -6879 1 -6880 0 -6881 0 -6882 0 -6883 0 -6884 0 -6885 0 -6886 1 -6887 0 -6888 0 -6889 0 -6890 0 -6891 0 -6892 0 -6893 0 -6894 0 -6895 1 -6896 0 -6897 0 -6898 0 -6899 0 -6900 0 -6901 0 -6902 0 -6903 0 -6904 0 -6905 0 -6906 0 -6907 0 -6908 0 -6909 0 -6910 0 -6911 0 -6912 0 -6913 0 -6914 1 -6915 0 -6916 0 -6917 0 -6918 0 -6919 0 -6920 0 -6921 0 -6922 0 -6923 1 -6924 0 -6925 0 -6926 0 -6927 0 -6928 0 -6929 0 -6930 0 -6931 0 -6932 0 -6933 0 -6934 1 -6935 0 -6936 0 -6937 0 -6938 0 -6939 0 -6940 0 -6941 0 -6942 0 -6943 0 -6944 1 -6945 0 -6946 0 -6947 0 -6948 0 -6949 0 -6950 0 -6951 0 -6952 0 -6953 0 -6954 1 -6955 0 -6956 0 -6957 0 -6958 0 -6959 0 -6960 0 -6961 0 -6962 0 -6963 0 -6964 1 -6965 0 -6966 0 -6967 0 -6968 0 -6969 0 -6970 0 -6971 0 -6972 0 -6973 0 -6974 1 -6975 0 -6976 0 -6977 0 -6978 0 -6979 0 -6980 0 -6981 0 -6982 0 -6983 1 -6984 0 -6985 0 -6986 0 -6987 0 -6988 0 -6989 0 -6990 0 -6991 0 -6992 1 -6993 0 -6994 0 -6995 0 -6996 0 -6997 0 -6998 0 -6999 0 -7000 0 -7001 1 -7002 0 -7003 0 -7004 0 -7005 0 -7006 0 -7007 0 -7008 0 -7009 0 -7010 1 -7011 0 -7012 0 -7013 0 -7014 0 -7015 0 -7016 0 -7017 0 -7018 0 -7019 0 -7020 1 -7021 0 -7022 0 -7023 0 -7024 0 -7025 0 -7026 0 -7027 0 -7028 0 -7029 0 -7030 1 -7031 0 -7032 0 -7033 0 -7034 0 -7035 0 -7036 0 -7037 0 -7038 0 -7039 1 -7040 0 -7041 0 -7042 0 -7043 0 -7044 0 -7045 0 -7046 0 -7047 0 -7048 1 -7049 0 -7050 0 -7051 0 -7052 0 -7053 0 -7054 0 -7055 0 -7056 0 -7057 0 -7058 0 -7059 1 -7060 0 -7061 0 -7062 0 -7063 0 -7064 0 -7065 0 -7066 0 -7067 0 -7068 0 -7069 1 -7070 0 -7071 0 -7072 0 -7073 0 -7074 0 -7075 0 -7076 0 -7077 0 -7078 0 -7079 1 -7080 0 -7081 0 -7082 0 -7083 0 -7084 0 -7085 0 -7086 0 -7087 1 -7088 0 -7089 0 -7090 0 -7091 0 -7092 0 -7093 0 -7094 0 -7095 0 -7096 0 -7097 1 -7098 0 -7099 0 -7100 0 -7101 0 -7102 0 -7103 0 -7104 0 -7105 1 -7106 0 -7107 0 -7108 0 -7109 0 -7110 0 -7111 0 -7112 0 -7113 0 -7114 1 -7115 0 -7116 0 -7117 0 -7118 0 -7119 0 -7120 0 -7121 0 -7122 0 -7123 0 -7124 1 -7125 0 -7126 0 -7127 0 -7128 0 -7129 0 -7130 0 -7131 0 -7132 0 -7133 0 -7134 1 -7135 0 -7136 0 -7137 0 -7138 0 -7139 0 -7140 0 -7141 0 -7142 0 -7143 1 -7144 0 -7145 0 -7146 0 -7147 0 -7148 0 -7149 0 -7150 0 -7151 0 -7152 1 -7153 0 -7154 0 -7155 0 -7156 0 -7157 0 -7158 0 -7159 0 -7160 0 -7161 0 -7162 1 -7163 0 -7164 0 -7165 0 -7166 0 -7167 0 -7168 0 -7169 0 -7170 0 -7171 0 -7172 1 -7173 0 -7174 0 -7175 0 -7176 0 -7177 0 -7178 0 -7179 0 -7180 0 -7181 0 -7182 1 -7183 0 -7184 0 -7185 0 -7186 0 -7187 0 -7188 0 -7189 0 -7190 0 -7191 0 -7192 0 -7193 1 -7194 0 -7195 0 -7196 0 -7197 0 -7198 0 -7199 0 -7200 0 -7201 0 -7202 0 -7203 1 -7204 0 -7205 0 -7206 0 -7207 0 -7208 0 -7209 0 -7210 0 -7211 0 -7212 0 -7213 0 -7214 0 -7215 0 -7216 0 -7217 0 -7218 0 -7219 0 -7220 0 -7221 0 -7222 1 -7223 0 -7224 0 -7225 0 -7226 0 -7227 0 -7228 0 -7229 0 -7230 0 -7231 0 -7232 1 -7233 0 -7234 0 -7235 0 -7236 0 -7237 0 -7238 0 -7239 0 -7240 0 -7241 0 -7242 0 -7243 1 -7244 0 -7245 0 -7246 0 -7247 0 -7248 0 -7249 0 -7250 0 -7251 0 -7252 0 -7253 1 -7254 0 -7255 0 -7256 0 -7257 0 -7258 0 -7259 0 -7260 0 -7261 0 -7262 0 -7263 0 -7264 1 -7265 0 -7266 0 -7267 0 -7268 0 -7269 0 -7270 0 -7271 0 -7272 0 -7273 0 -7274 1 -7275 0 -7276 0 -7277 0 -7278 0 -7279 0 -7280 0 -7281 0 -7282 0 -7283 0 -7284 0 -7285 1 -7286 0 -7287 0 -7288 0 -7289 0 -7290 0 -7291 0 -7292 0 -7293 0 -7294 0 -7295 0 -7296 0 -7297 0 -7298 0 -7299 0 -7300 0 -7301 0 -7302 0 -7303 0 -7304 1 -7305 0 -7306 0 -7307 0 -7308 0 -7309 0 -7310 0 -7311 0 -7312 0 -7313 0 -7314 0 -7315 1 -7316 0 -7317 0 -7318 0 -7319 0 -7320 0 -7321 0 -7322 0 -7323 0 -7324 1 -7325 0 -7326 0 -7327 0 -7328 0 -7329 0 -7330 0 -7331 0 -7332 0 -7333 1 -7334 0 -7335 0 -7336 0 -7337 0 -7338 0 -7339 0 -7340 0 -7341 0 -7342 1 -7343 0 -7344 0 -7345 0 -7346 0 -7347 0 -7348 0 -7349 0 -7350 0 -7351 0 -7352 1 -7353 0 -7354 0 -7355 0 -7356 0 -7357 0 -7358 0 -7359 0 -7360 0 -7361 0 -7362 0 -7363 1 -7364 0 -7365 0 -7366 0 -7367 0 -7368 0 -7369 0 -7370 0 -7371 0 -7372 1 -7373 0 -7374 0 -7375 0 -7376 0 -7377 0 -7378 0 -7379 0 -7380 0 -7381 0 -7382 1 -7383 0 -7384 0 -7385 0 -7386 0 -7387 0 -7388 0 -7389 0 -7390 0 -7391 1 -7392 0 -7393 0 -7394 0 -7395 0 -7396 0 -7397 0 -7398 0 -7399 0 -7400 0 -7401 1 -7402 0 -7403 0 -7404 0 -7405 0 -7406 0 -7407 0 -7408 0 -7409 0 -7410 0 -7411 0 -7412 1 -7413 0 -7414 0 -7415 0 -7416 0 -7417 0 -7418 0 -7419 0 -7420 0 -7421 0 -7422 1 -7423 0 -7424 0 -7425 0 -7426 0 -7427 0 -7428 0 -7429 0 -7430 0 -7431 0 -7432 1 -7433 0 -7434 0 -7435 0 -7436 0 -7437 0 -7438 0 -7439 0 -7440 0 -7441 1 -7442 0 -7443 0 -7444 0 -7445 0 -7446 0 -7447 0 -7448 0 -7449 1 -7450 0 -7451 0 -7452 0 -7453 0 -7454 0 -7455 0 -7456 0 -7457 0 -7458 0 -7459 0 -7460 1 -7461 0 -7462 0 -7463 0 -7464 0 -7465 0 -7466 0 -7467 0 -7468 0 -7469 1 -7470 0 -7471 0 -7472 0 -7473 0 -7474 0 -7475 0 -7476 0 -7477 0 -7478 1 -7479 0 -7480 0 -7481 0 -7482 0 -7483 0 -7484 0 -7485 0 -7486 0 -7487 1 -7488 0 -7489 0 -7490 0 -7491 0 -7492 0 -7493 0 -7494 0 -7495 0 -7496 0 -7497 1 -7498 0 -7499 0 -7500 0 -7501 0 -7502 0 -7503 0 -7504 0 -7505 0 -7506 0 -7507 0 -7508 1 -7509 0 -7510 0 -7511 0 -7512 0 -7513 0 -7514 0 -7515 0 -7516 0 -7517 0 -7518 1 -7519 0 -7520 0 -7521 0 -7522 0 -7523 0 -7524 0 -7525 0 -7526 0 -7527 0 -7528 0 -7529 0 -7530 0 -7531 0 -7532 0 -7533 0 -7534 0 -7535 0 -7536 0 -7537 0 -7538 0 -7539 1 -7540 0 -7541 0 -7542 0 -7543 0 -7544 0 -7545 0 -7546 0 -7547 0 -7548 0 -7549 2 -7550 0 -7551 0 -7552 0 -7553 0 -7554 0 -7555 0 -7556 0 -7557 1 -7558 0 -7559 0 -7560 0 -7561 0 -7562 0 -7563 0 -7564 0 -7565 0 -7566 0 -7567 0 -7568 1 -7569 0 -7570 0 -7571 0 -7572 0 -7573 0 -7574 0 -7575 0 -7576 0 -7577 0 -7578 0 -7579 0 -7580 0 -7581 0 -7582 0 -7583 0 -7584 0 -7585 0 -7586 0 -7587 0 -7588 1 -7589 0 -7590 0 -7591 0 -7592 0 -7593 0 -7594 0 -7595 0 -7596 0 -7597 0 -7598 0 -7599 1 -7600 0 -7601 0 -7602 0 -7603 0 -7604 0 -7605 0 -7606 0 -7607 0 -7608 0 -7609 0 -7610 1 -7611 0 -7612 0 -7613 0 -7614 0 -7615 0 -7616 0 -7617 0 -7618 0 -7619 0 -7620 0 -7621 1 -7622 0 -7623 0 -7624 0 -7625 0 -7626 0 -7627 1 -7628 0 -7629 0 -7630 0 -7631 0 -7632 0 -7633 0 -7634 1 -7635 0 -7636 0 -7637 0 -7638 0 -7639 0 -7640 0 -7641 1 -7642 0 -7643 0 -7644 0 -7645 0 -7646 0 -7647 0 -7648 0 -7649 1 -7650 0 -7651 0 -7652 0 -7653 0 -7654 0 -7655 0 -7656 0 -7657 0 -7658 0 -7659 0 -7660 1 -7661 0 -7662 0 -7663 0 -7664 0 -7665 0 -7666 0 -7667 0 -7668 0 -7669 0 -7670 1 -7671 0 -7672 0 -7673 0 -7674 0 -7675 0 -7676 0 -7677 0 -7678 0 -7679 0 -7680 0 -7681 1 -7682 0 -7683 0 -7684 0 -7685 0 -7686 0 -7687 0 -7688 0 -7689 0 -7690 0 -7691 1 -7692 0 -7693 0 -7694 0 -7695 0 -7696 0 -7697 0 -7698 0 -7699 0 -7700 0 -7701 0 -7702 1 -7703 0 -7704 0 -7705 0 -7706 0 -7707 0 -7708 0 -7709 0 -7710 0 -7711 0 -7712 1 -7713 0 -7714 0 -7715 0 -7716 0 -7717 0 -7718 0 -7719 0 -7720 0 -7721 0 -7722 1 -7723 0 -7724 0 -7725 0 -7726 0 -7727 0 -7728 0 -7729 0 -7730 0 -7731 0 -7732 1 -7733 0 -7734 0 -7735 0 -7736 0 -7737 0 -7738 0 -7739 0 -7740 0 -7741 0 -7742 1 -7743 0 -7744 0 -7745 0 -7746 0 -7747 0 -7748 0 -7749 0 -7750 0 -7751 0 -7752 1 -7753 0 -7754 0 -7755 0 -7756 0 -7757 0 -7758 0 -7759 0 -7760 0 -7761 1 -7762 0 -7763 0 -7764 0 -7765 0 -7766 0 -7767 0 -7768 0 -7769 0 -7770 1 -7771 0 -7772 0 -7773 0 -7774 0 -7775 0 -7776 0 -7777 0 -7778 0 -7779 1 -7780 0 -7781 0 -7782 0 -7783 0 -7784 0 -7785 0 -7786 0 -7787 0 -7788 0 -7789 1 -7790 0 -7791 0 -7792 0 -7793 0 -7794 0 -7795 0 -7796 0 -7797 0 -7798 0 -7799 1 -7800 0 -7801 0 -7802 0 -7803 0 -7804 0 -7805 0 -7806 0 -7807 0 -7808 0 -7809 0 -7810 1 -7811 0 -7812 0 -7813 0 -7814 0 -7815 0 -7816 0 -7817 0 -7818 0 -7819 1 -7820 0 -7821 0 -7822 0 -7823 0 -7824 0 -7825 0 -7826 0 -7827 0 -7828 1 -7829 0 -7830 0 -7831 0 -7832 0 -7833 0 -7834 0 -7835 0 -7836 0 -7837 0 -7838 0 -7839 1 -7840 0 -7841 0 -7842 0 -7843 0 -7844 0 -7845 0 -7846 0 -7847 0 -7848 0 -7849 1 -7850 0 -7851 0 -7852 0 -7853 0 -7854 0 -7855 0 -7856 0 -7857 0 -7858 1 -7859 0 -7860 0 -7861 0 -7862 0 -7863 0 -7864 0 -7865 0 -7866 0 -7867 0 -7868 1 -7869 0 -7870 0 -7871 0 -7872 0 -7873 0 -7874 0 -7875 0 -7876 0 -7877 0 -7878 0 -7879 0 -7880 0 -7881 0 -7882 0 -7883 0 -7884 0 -7885 0 -7886 0 -7887 1 -7888 0 -7889 0 -7890 0 -7891 0 -7892 0 -7893 0 -7894 0 -7895 0 -7896 0 -7897 0 -7898 1 -7899 0 -7900 0 -7901 0 -7902 0 -7903 0 -7904 0 -7905 0 -7906 0 -7907 0 -7908 1 -7909 0 -7910 0 -7911 0 -7912 0 -7913 0 -7914 0 -7915 0 -7916 0 -7917 0 -7918 1 -7919 0 -7920 0 -7921 0 -7922 0 -7923 0 -7924 0 -7925 0 -7926 0 -7927 0 -7928 1 -7929 0 -7930 0 -7931 0 -7932 0 -7933 0 -7934 0 -7935 0 -7936 0 -7937 0 -7938 1 -7939 0 -7940 0 -7941 0 -7942 0 -7943 0 -7944 0 -7945 0 -7946 0 -7947 0 -7948 1 -7949 0 -7950 0 -7951 0 -7952 0 -7953 0 -7954 0 -7955 0 -7956 0 -7957 0 -7958 1 -7959 0 -7960 0 -7961 0 -7962 0 -7963 0 -7964 0 -7965 0 -7966 0 -7967 0 -7968 1 -7969 0 -7970 0 -7971 0 -7972 0 -7973 0 -7974 0 -7975 0 -7976 0 -7977 0 -7978 1 -7979 0 -7980 0 -7981 0 -7982 0 -7983 0 -7984 0 -7985 1 -7986 0 -7987 0 -7988 0 -7989 0 -7990 0 -7991 0 -7992 0 -7993 0 -7994 0 -7995 1 -7996 0 -7997 0 -7998 0 -7999 0 -8000 0 -8001 0 -8002 0 -8003 0 -8004 0 -8005 0 -8006 1 -8007 0 -8008 0 -8009 0 -8010 0 -8011 0 -8012 0 -8013 0 -8014 0 -8015 1 -8016 0 -8017 0 -8018 0 -8019 0 -8020 0 -8021 0 -8022 0 -8023 0 -8024 0 -8025 1 -8026 0 -8027 0 -8028 0 -8029 0 -8030 0 -8031 0 -8032 0 -8033 0 -8034 0 -8035 0 -8036 1 -8037 0 -8038 0 -8039 0 -8040 0 -8041 0 -8042 0 -8043 0 -8044 0 -8045 0 -8046 1 -8047 0 -8048 0 -8049 0 -8050 0 -8051 0 -8052 0 -8053 0 -8054 0 -8055 0 -8056 0 -8057 1 -8058 0 -8059 0 -8060 0 -8061 0 -8062 0 -8063 0 -8064 0 -8065 0 -8066 0 -8067 1 -8068 0 -8069 0 -8070 0 -8071 0 -8072 0 -8073 0 -8074 0 -8075 0 -8076 0 -8077 0 -8078 1 -8079 0 -8080 0 -8081 0 -8082 0 -8083 0 -8084 0 -8085 0 -8086 0 -8087 0 -8088 1 -8089 0 -8090 0 -8091 0 -8092 0 -8093 0 -8094 0 -8095 0 -8096 0 -8097 0 -8098 1 -8099 0 -8100 0 -8101 0 -8102 0 -8103 0 -8104 0 -8105 1 -8106 0 -8107 0 -8108 0 -8109 0 -8110 0 -8111 0 -8112 0 -8113 0 -8114 0 -8115 1 -8116 0 -8117 0 -8118 0 -8119 0 -8120 0 -8121 0 -8122 0 -8123 0 -8124 0 -8125 1 -8126 0 -8127 0 -8128 0 -8129 0 -8130 0 -8131 0 -8132 0 -8133 0 -8134 1 -8135 0 -8136 0 -8137 0 -8138 0 -8139 0 -8140 0 -8141 0 -8142 0 -8143 0 -8144 0 -8145 1 -8146 0 -8147 0 -8148 0 -8149 0 -8150 0 -8151 0 -8152 0 -8153 0 -8154 0 -8155 0 -8156 1 -8157 0 -8158 0 -8159 0 -8160 0 -8161 0 -8162 0 -8163 0 -8164 0 -8165 0 -8166 1 -8167 0 -8168 0 -8169 0 -8170 0 -8171 0 -8172 0 -8173 0 -8174 0 -8175 0 -8176 1 -8177 0 -8178 0 -8179 0 -8180 0 -8181 0 -8182 0 -8183 0 -8184 0 -8185 0 -8186 1 -8187 0 -8188 0 -8189 0 -8190 0 -8191 0 -8192 0 -8193 0 -8194 0 -8195 0 -8196 0 -8197 1 -8198 0 -8199 0 -8200 0 -8201 0 -8202 0 -8203 0 -8204 0 -8205 0 -8206 0 -8207 1 -8208 0 -8209 0 -8210 0 -8211 0 -8212 0 -8213 0 -8214 0 -8215 0 -8216 1 -8217 0 -8218 0 -8219 0 -8220 0 -8221 0 -8222 0 -8223 0 -8224 0 -8225 1 -8226 0 -8227 0 -8228 0 -8229 0 -8230 0 -8231 0 -8232 0 -8233 0 -8234 0 -8235 1 -8236 0 -8237 0 -8238 0 -8239 0 -8240 0 -8241 0 -8242 0 -8243 0 -8244 1 -8245 0 -8246 0 -8247 0 -8248 0 -8249 0 -8250 0 -8251 0 -8252 0 -8253 0 -8254 1 -8255 0 -8256 0 -8257 0 -8258 0 -8259 0 -8260 0 -8261 0 -8262 0 -8263 0 -8264 0 -8265 1 -8266 0 -8267 0 -8268 0 -8269 0 -8270 0 -8271 0 -8272 0 -8273 0 -8274 0 -8275 1 -8276 0 -8277 0 -8278 0 -8279 0 -8280 0 -8281 0 -8282 0 -8283 0 -8284 0 -8285 0 -8286 1 -8287 0 -8288 0 -8289 0 -8290 0 -8291 0 -8292 0 -8293 0 -8294 0 -8295 0 -8296 1 -8297 0 -8298 0 -8299 0 -8300 0 -8301 0 -8302 0 -8303 0 -8304 1 -8305 0 -8306 0 -8307 0 -8308 0 -8309 0 -8310 0 -8311 0 -8312 0 -8313 0 -8314 1 -8315 0 -8316 0 -8317 0 -8318 0 -8319 0 -8320 0 -8321 0 -8322 0 -8323 0 -8324 1 -8325 0 -8326 0 -8327 0 -8328 0 -8329 0 -8330 0 -8331 0 -8332 0 -8333 0 -8334 0 -8335 0 -8336 0 -8337 0 -8338 0 -8339 0 -8340 0 -8341 0 -8342 1 -8343 0 -8344 0 -8345 0 -8346 0 -8347 0 -8348 0 -8349 0 -8350 0 -8351 1 -8352 0 -8353 0 -8354 0 -8355 0 -8356 0 -8357 0 -8358 0 -8359 0 -8360 0 -8361 1 -8362 0 -8363 0 -8364 0 -8365 0 -8366 0 -8367 0 -8368 0 -8369 0 -8370 0 -8371 1 -8372 0 -8373 0 -8374 0 -8375 0 -8376 0 -8377 0 -8378 0 -8379 0 -8380 1 -8381 0 -8382 0 -8383 0 -8384 0 -8385 0 -8386 0 -8387 0 -8388 0 -8389 1 -8390 0 -8391 0 -8392 0 -8393 0 -8394 0 -8395 0 -8396 0 -8397 0 -8398 0 -8399 1 -8400 0 -8401 0 -8402 0 -8403 0 -8404 0 -8405 0 -8406 0 -8407 0 -8408 0 -8409 1 -8410 0 -8411 0 -8412 0 -8413 0 -8414 0 -8415 0 -8416 0 -8417 0 -8418 0 -8419 1 -8420 0 -8421 0 -8422 0 -8423 0 -8424 0 -8425 0 -8426 0 -8427 0 -8428 0 -8429 0 -8430 1 -8431 0 -8432 0 -8433 0 -8434 0 -8435 0 -8436 0 -8437 0 -8438 1 -8439 0 -8440 0 -8441 0 -8442 0 -8443 0 -8444 0 -8445 0 -8446 0 -8447 1 -8448 0 -8449 0 -8450 0 -8451 0 -8452 0 -8453 0 -8454 0 -8455 0 -8456 0 -8457 1 -8458 0 -8459 0 -8460 0 -8461 0 -8462 0 -8463 0 -8464 0 -8465 0 -8466 0 -8467 1 -8468 0 -8469 0 -8470 0 -8471 0 -8472 0 -8473 0 -8474 0 -8475 0 -8476 0 -8477 1 -8478 0 -8479 0 -8480 0 -8481 0 -8482 0 -8483 0 -8484 0 -8485 0 -8486 1 -8487 0 -8488 0 -8489 0 -8490 0 -8491 0 -8492 0 -8493 0 -8494 0 -8495 0 -8496 0 -8497 0 -8498 0 -8499 0 -8500 0 -8501 0 -8502 0 -8503 0 -8504 0 -8505 0 -8506 1 -8507 0 -8508 0 -8509 0 -8510 0 -8511 0 -8512 0 -8513 0 -8514 0 -8515 0 -8516 0 -8517 0 -8518 0 -8519 0 -8520 0 -8521 0 -8522 0 -8523 1 -8524 0 -8525 0 -8526 0 -8527 0 -8528 0 -8529 0 -8530 0 -8531 0 -8532 1 -8533 0 -8534 0 -8535 0 -8536 0 -8537 0 -8538 0 -8539 0 -8540 0 -8541 1 -8542 0 -8543 0 -8544 0 -8545 0 -8546 0 -8547 0 -8548 0 -8549 1 -8550 0 -8551 0 -8552 0 -8553 0 -8554 0 -8555 0 -8556 0 -8557 0 -8558 0 -8559 1 -8560 0 -8561 0 -8562 0 -8563 0 -8564 0 -8565 0 -8566 0 -8567 0 -8568 1 -8569 0 -8570 0 -8571 0 -8572 0 -8573 0 -8574 0 -8575 0 -8576 0 -8577 1 -8578 0 -8579 0 -8580 0 -8581 0 -8582 0 -8583 0 -8584 0 -8585 0 -8586 1 -8587 0 -8588 0 -8589 0 -8590 0 -8591 0 -8592 0 -8593 0 -8594 0 -8595 0 -8596 1 -8597 0 -8598 0 -8599 0 -8600 0 -8601 0 -8602 0 -8603 0 -8604 0 -8605 0 -8606 1 -8607 0 -8608 0 -8609 0 -8610 0 -8611 0 -8612 0 -8613 0 -8614 0 -8615 0 -8616 1 -8617 0 -8618 0 -8619 0 -8620 0 -8621 0 -8622 0 -8623 0 -8624 0 -8625 1 -8626 0 -8627 0 -8628 0 -8629 0 -8630 0 -8631 0 -8632 0 -8633 1 -8634 0 -8635 0 -8636 0 -8637 0 -8638 0 -8639 0 -8640 0 -8641 0 -8642 0 -8643 1 -8644 0 -8645 0 -8646 0 -8647 0 -8648 0 -8649 0 -8650 0 -8651 1 -8652 0 -8653 0 -8654 0 -8655 0 -8656 0 -8657 0 -8658 0 -8659 0 -8660 1 -8661 0 -8662 0 -8663 0 -8664 0 -8665 0 -8666 0 -8667 0 -8668 0 -8669 1 -8670 0 -8671 0 -8672 0 -8673 0 -8674 0 -8675 0 -8676 0 -8677 1 -8678 0 -8679 0 -8680 0 -8681 0 -8682 0 -8683 0 -8684 0 -8685 0 -8686 1 -8687 0 -8688 0 -8689 0 -8690 0 -8691 0 -8692 0 -8693 0 -8694 0 -8695 0 -8696 1 -8697 0 -8698 0 -8699 0 -8700 0 -8701 0 -8702 0 -8703 0 -8704 0 -8705 1 -8706 0 -8707 0 -8708 0 -8709 0 -8710 0 -8711 0 -8712 0 -8713 0 -8714 0 -8715 1 -8716 0 -8717 0 -8718 0 -8719 0 -8720 0 -8721 0 -8722 0 -8723 0 -8724 0 -8725 1 -8726 0 -8727 0 -8728 0 -8729 0 -8730 0 -8731 0 -8732 0 -8733 0 -8734 0 -8735 1 -8736 0 -8737 0 -8738 0 -8739 0 -8740 0 -8741 0 -8742 0 -8743 0 -8744 0 -8745 1 -8746 0 -8747 0 -8748 0 -8749 0 -8750 0 -8751 0 -8752 0 -8753 0 -8754 0 -8755 1 -8756 0 -8757 0 -8758 0 -8759 0 -8760 0 -8761 0 -8762 0 -8763 1 -8764 0 -8765 0 -8766 0 -8767 0 -8768 0 -8769 0 -8770 1 -8771 0 -8772 0 -8773 0 -8774 0 -8775 0 -8776 0 -8777 0 -8778 0 -8779 0 -8780 1 -8781 0 -8782 0 -8783 0 -8784 0 -8785 0 -8786 0 -8787 0 -8788 0 -8789 1 -8790 0 -8791 0 -8792 0 -8793 0 -8794 0 -8795 0 -8796 0 -8797 0 -8798 1 -8799 0 -8800 0 -8801 0 -8802 0 -8803 0 -8804 0 -8805 0 -8806 0 -8807 3 -8808 0 -8809 0 -8810 1 -8811 0 -8812 0 -8813 0 -8814 0 -8815 1 -8816 0 -8817 0 -8818 0 -8819 0 -8820 1 -8821 0 -8822 0 -8823 0 -8824 1 -8825 0 -8826 0 -8827 0 -8828 0 -8829 0 -8830 1 -8831 0 -8832 0 -8833 0 -8834 0 -8835 0 -8836 0 -8837 1 -8838 0 -8839 0 -8840 0 -8841 0 -8842 0 -8843 0 -8844 0 -8845 1 -8846 0 -8847 0 -8848 0 -8849 0 -8850 0 -8851 0 -8852 0 -8853 0 -8854 0 -8855 1 -8856 0 -8857 0 -8858 0 -8859 0 -8860 0 -8861 0 -8862 0 -8863 0 -8864 0 -8865 1 -8866 0 -8867 0 -8868 0 -8869 0 -8870 0 -8871 0 -8872 1 -8873 0 -8874 0 -8875 0 -8876 0 -8877 0 -8878 0 -8879 0 -8880 1 -8881 0 -8882 0 -8883 0 -8884 0 -8885 0 -8886 0 -8887 0 -8888 1 -8889 0 -8890 0 -8891 0 -8892 0 -8893 0 -8894 0 -8895 0 -8896 0 -8897 0 -8898 0 -8899 0 -8900 0 -8901 0 -8902 0 -8903 0 -8904 0 -8905 1 -8906 0 -8907 0 -8908 0 -8909 0 -8910 0 -8911 0 -8912 1 -8913 0 -8914 0 -8915 0 -8916 0 -8917 0 -8918 0 -8919 0 -8920 1 -8921 0 -8922 0 -8923 0 -8924 0 -8925 0 -8926 0 -8927 0 -8928 0 -8929 1 -8930 0 -8931 0 -8932 0 -8933 0 -8934 0 -8935 0 -8936 0 -8937 0 -8938 0 -8939 1 -8940 0 -8941 0 -8942 0 -8943 0 -8944 0 -8945 0 -8946 0 -8947 0 -8948 0 -8949 1 -8950 0 -8951 0 -8952 0 -8953 0 -8954 0 -8955 0 -8956 0 -8957 0 -8958 0 -8959 1 -8960 0 -8961 0 -8962 0 -8963 0 -8964 0 -8965 0 -8966 0 -8967 0 -8968 0 -8969 1 -8970 0 -8971 0 -8972 0 -8973 0 -8974 0 -8975 0 -8976 0 -8977 0 -8978 1 -8979 0 -8980 0 -8981 0 -8982 0 -8983 0 -8984 0 -8985 0 -8986 0 -8987 1 -8988 0 -8989 0 -8990 0 -8991 0 -8992 0 -8993 0 -8994 0 -8995 0 -8996 0 -8997 1 -8998 0 -8999 0 -9000 0 -9001 0 -9002 0 -9003 0 -9004 0 -9005 0 -9006 1 -9007 0 -9008 0 -9009 0 -9010 0 -9011 0 -9012 0 -9013 0 -9014 1 -9015 0 -9016 0 -9017 0 -9018 0 -9019 0 -9020 0 -9021 0 -9022 1 -9023 0 -9024 0 -9025 0 -9026 0 -9027 0 -9028 0 -9029 0 -9030 1 -9031 0 -9032 0 -9033 0 -9034 0 -9035 0 -9036 0 -9037 0 -9038 1 -9039 0 -9040 0 -9041 0 -9042 0 -9043 0 -9044 0 -9045 0 -9046 0 -9047 1 -9048 0 -9049 0 -9050 0 -9051 0 -9052 0 -9053 0 -9054 0 -9055 1 -9056 0 -9057 0 -9058 0 -9059 0 -9060 0 -9061 0 -9062 0 -9063 1 -9064 0 -9065 0 -9066 0 -9067 0 -9068 0 -9069 0 -9070 0 -9071 0 -9072 0 -9073 1 -9074 0 -9075 0 -9076 0 -9077 0 -9078 0 -9079 0 -9080 0 -9081 0 -9082 0 -9083 0 -9084 0 -9085 0 -9086 0 -9087 0 -9088 0 -9089 0 -9090 0 -9091 0 -9092 1 -9093 0 -9094 0 -9095 0 -9096 0 -9097 0 -9098 0 -9099 0 -9100 1 -9101 0 -9102 0 -9103 0 -9104 0 -9105 0 -9106 0 -9107 0 -9108 1 -9109 0 -9110 0 -9111 0 -9112 0 -9113 0 -9114 0 -9115 0 -9116 0 -9117 1 -9118 0 -9119 0 -9120 0 -9121 0 -9122 0 -9123 0 -9124 0 -9125 0 -9126 1 -9127 0 -9128 0 -9129 0 -9130 0 -9131 0 -9132 0 -9133 0 -9134 0 -9135 1 -9136 0 -9137 0 -9138 0 -9139 0 -9140 0 -9141 0 -9142 0 -9143 1 -9144 0 -9145 0 -9146 0 -9147 0 -9148 0 -9149 0 -9150 0 -9151 0 -9152 1 -9153 0 -9154 0 -9155 0 -9156 0 -9157 0 -9158 0 -9159 0 -9160 0 -9161 1 -9162 0 -9163 0 -9164 0 -9165 0 -9166 0 -9167 0 -9168 0 -9169 1 -9170 0 -9171 0 -9172 0 -9173 0 -9174 0 -9175 0 -9176 0 -9177 0 -9178 1 -9179 0 -9180 0 -9181 0 -9182 0 -9183 0 -9184 0 -9185 0 -9186 0 -9187 0 -9188 1 -9189 0 -9190 0 -9191 0 -9192 0 -9193 0 -9194 0 -9195 0 -9196 0 -9197 1 -9198 0 -9199 0 -9200 0 -9201 0 -9202 0 -9203 0 -9204 0 -9205 0 -9206 0 -9207 0 -9208 0 -9209 0 -9210 0 -9211 0 -9212 0 -9213 0 -9214 0 -9215 0 -9216 0 -9217 0 -9218 0 -9219 0 -9220 0 -9221 1 -9222 0 -9223 0 -9224 0 -9225 0 -9226 0 -9227 0 -9228 1 -9229 0 -9230 0 -9231 0 -9232 0 -9233 0 -9234 0 -9235 0 -9236 0 -9237 1 -9238 0 -9239 0 -9240 0 -9241 0 -9242 0 -9243 0 -9244 0 -9245 0 -9246 1 -9247 0 -9248 0 -9249 0 -9250 0 -9251 0 -9252 0 -9253 0 -9254 0 -9255 1 -9256 0 -9257 0 -9258 0 -9259 0 -9260 0 -9261 1 -9262 0 -9263 0 -9264 0 -9265 0 -9266 0 -9267 0 -9268 0 -9269 0 -9270 0 -9271 0 -9272 0 -9273 0 -9274 0 -9275 0 -9276 1 -9277 0 -9278 0 -9279 0 -9280 0 -9281 0 -9282 0 -9283 0 -9284 0 -9285 0 -9286 0 -9287 0 -9288 0 -9289 0 -9290 1 -9291 0 -9292 0 -9293 0 -9294 0 -9295 0 -9296 0 -9297 0 -9298 0 -9299 0 -9300 1 -9301 0 -9302 0 -9303 0 -9304 0 -9305 0 -9306 0 -9307 0 -9308 1 -9309 0 -9310 0 -9311 0 -9312 0 -9313 0 -9314 0 -9315 0 -9316 1 -9317 0 -9318 0 -9319 0 -9320 0 -9321 0 -9322 0 -9323 1 -9324 0 -9325 0 -9326 0 -9327 0 -9328 0 -9329 0 -9330 0 -9331 1 -9332 0 -9333 0 -9334 0 -9335 0 -9336 0 -9337 0 -9338 1 -9339 0 -9340 0 -9341 0 -9342 0 -9343 0 -9344 0 -9345 1 -9346 0 -9347 0 -9348 0 -9349 0 -9350 0 -9351 0 -9352 0 -9353 0 -9354 0 -9355 1 -9356 0 -9357 0 -9358 0 -9359 0 -9360 0 -9361 0 -9362 0 -9363 1 -9364 0 -9365 0 -9366 0 -9367 0 -9368 0 -9369 0 -9370 1 -9371 0 -9372 0 -9373 0 -9374 0 -9375 0 -9376 0 -9377 0 -9378 1 -9379 0 -9380 0 -9381 0 -9382 0 -9383 0 -9384 0 -9385 0 -9386 0 -9387 0 -9388 0 -9389 0 -9390 0 -9391 0 -9392 0 -9393 0 -9394 0 -9395 1 -9396 0 -9397 0 -9398 0 -9399 0 -9400 0 -9401 0 -9402 0 -9403 1 -9404 0 -9405 0 -9406 0 -9407 0 -9408 0 -9409 0 -9410 0 -9411 0 -9412 1 -9413 0 -9414 0 -9415 0 -9416 0 -9417 0 -9418 0 -9419 0 -9420 1 -9421 0 -9422 0 -9423 0 -9424 0 -9425 0 -9426 0 -9427 0 -9428 0 -9429 1 -9430 0 -9431 0 -9432 0 -9433 0 -9434 0 -9435 0 -9436 0 -9437 0 -9438 0 -9439 1 -9440 0 -9441 0 -9442 0 -9443 0 -9444 0 -9445 0 -9446 0 -9447 0 -9448 0 -9449 1 -9450 0 -9451 0 -9452 0 -9453 0 -9454 0 -9455 0 -9456 0 -9457 1 -9458 0 -9459 0 -9460 0 -9461 0 -9462 0 -9463 0 -9464 1 -9465 0 -9466 0 -9467 0 -9468 0 -9469 0 -9470 0 -9471 0 -9472 0 -9473 1 -9474 0 -9475 0 -9476 0 -9477 0 -9478 0 -9479 0 -9480 0 -9481 1 -9482 0 -9483 0 -9484 0 -9485 0 -9486 0 -9487 0 -9488 1 -9489 0 -9490 0 -9491 0 -9492 0 -9493 0 -9494 0 -9495 0 -9496 0 -9497 1 -9498 0 -9499 0 -9500 0 -9501 0 -9502 0 -9503 0 -9504 0 -9505 0 -9506 0 -9507 0 -9508 0 -9509 0 -9510 0 -9511 0 -9512 0 -9513 0 -9514 1 -9515 0 -9516 0 -9517 0 -9518 0 -9519 0 -9520 0 -9521 0 -9522 1 -9523 0 -9524 0 -9525 0 -9526 0 -9527 0 -9528 0 -9529 0 -9530 1 -9531 0 -9532 0 -9533 0 -9534 0 -9535 0 -9536 0 -9537 0 -9538 1 -9539 0 -9540 0 -9541 0 -9542 0 -9543 0 -9544 0 -9545 0 -9546 0 -9547 1 -9548 0 -9549 0 -9550 0 -9551 0 -9552 0 -9553 0 -9554 0 -9555 1 -9556 0 -9557 0 -9558 0 -9559 0 -9560 0 -9561 0 -9562 0 -9563 1 -9564 0 -9565 0 -9566 0 -9567 0 -9568 0 -9569 0 -9570 0 -9571 0 -9572 1 -9573 0 -9574 0 -9575 0 -9576 0 -9577 0 -9578 0 -9579 0 -9580 1 -9581 0 -9582 0 -9583 0 -9584 0 -9585 0 -9586 0 -9587 0 -9588 0 -9589 1 -9590 0 -9591 0 -9592 0 -9593 0 -9594 0 -9595 0 -9596 0 -9597 0 -9598 0 -9599 0 -9600 0 -9601 0 -9602 0 -9603 0 -9604 0 -9605 0 -9606 0 -9607 0 -9608 1 -9609 0 -9610 0 -9611 0 -9612 0 -9613 0 -9614 0 -9615 1 -9616 0 -9617 0 -9618 0 -9619 0 -9620 0 -9621 0 -9622 1 -9623 0 -9624 0 -9625 0 -9626 0 -9627 0 -9628 0 -9629 0 -9630 1 -9631 0 -9632 0 -9633 0 -9634 0 -9635 0 -9636 0 -9637 0 -9638 0 -9639 1 -9640 0 -9641 0 -9642 0 -9643 0 -9644 0 -9645 0 -9646 0 -9647 0 -9648 1 -9649 0 -9650 0 -9651 0 -9652 0 -9653 0 -9654 0 -9655 0 -9656 1 -9657 0 -9658 0 -9659 0 -9660 0 -9661 0 -9662 0 -9663 1 -9664 0 -9665 0 -9666 0 -9667 0 -9668 0 -9669 0 -9670 0 -9671 0 -9672 0 -9673 1 -9674 0 -9675 0 -9676 0 -9677 0 -9678 0 -9679 0 -9680 0 -9681 1 -9682 0 -9683 0 -9684 0 -9685 0 -9686 0 -9687 0 -9688 0 -9689 1 -9690 0 -9691 0 -9692 0 -9693 0 -9694 0 -9695 0 -9696 1 -9697 0 -9698 0 -9699 0 -9700 0 -9701 0 -9702 0 -9703 0 -9704 1 -9705 0 -9706 0 -9707 0 -9708 0 -9709 0 -9710 0 -9711 0 -9712 1 -9713 0 -9714 0 -9715 0 -9716 0 -9717 0 -9718 0 -9719 0 -9720 0 -9721 0 -9722 1 -9723 0 -9724 0 -9725 0 -9726 0 -9727 0 -9728 0 -9729 0 -9730 0 -9731 1 -9732 0 -9733 0 -9734 0 -9735 0 -9736 0 -9737 0 -9738 0 -9739 0 -9740 1 -9741 0 -9742 0 -9743 0 -9744 0 -9745 0 -9746 0 -9747 0 -9748 0 -9749 1 -9750 0 -9751 0 -9752 0 -9753 0 -9754 0 -9755 0 -9756 1 -9757 0 -9758 0 -9759 0 -9760 0 -9761 0 -9762 0 -9763 0 -9764 0 -9765 0 -9766 0 -9767 0 -9768 0 -9769 0 -9770 0 -9771 0 -9772 0 -9773 1 -9774 0 -9775 0 -9776 0 -9777 0 -9778 0 -9779 0 -9780 1 -9781 0 -9782 0 -9783 0 -9784 0 -9785 0 -9786 0 -9787 0 -9788 1 -9789 0 -9790 0 -9791 0 -9792 0 -9793 0 -9794 0 -9795 0 -9796 0 -9797 0 -9798 0 -9799 0 -9800 0 -9801 0 -9802 0 -9803 1 -9804 0 -9805 0 -9806 0 -9807 0 -9808 0 -9809 0 -9810 0 -9811 0 -9812 1 -9813 0 -9814 0 -9815 0 -9816 0 -9817 0 -9818 0 -9819 0 -9820 1 -9821 0 -9822 0 -9823 0 -9824 0 -9825 0 -9826 0 -9827 0 -9828 0 -9829 1 -9830 0 -9831 0 -9832 0 -9833 0 -9834 0 -9835 0 -9836 0 -9837 0 -9838 1 -9839 0 -9840 0 -9841 0 -9842 0 -9843 0 -9844 0 -9845 0 -9846 0 -9847 0 -9848 1 -9849 0 -9850 0 -9851 0 -9852 0 -9853 0 -9854 4 -9855 0 -9856 0 -9857 1 -9858 0 -9859 0 -9860 0 -9861 0 -9862 1 -9863 0 -9864 0 -9865 0 -9866 0 -9867 0 -9868 1 -9869 0 -9870 0 -9871 0 -9872 0 -9873 1 -9874 0 -9875 0 -9876 0 -9877 0 -9878 1 -9879 0 -9880 0 -9881 0 -9882 0 -9883 0 -9884 0 -9885 0 -9886 1 -9887 0 -9888 0 -9889 0 -9890 0 -9891 0 -9892 0 -9893 0 -9894 0 -9895 1 -9896 0 -9897 0 -9898 0 -9899 0 -9900 0 -9901 0 -9902 0 -9903 0 -9904 1 -9905 0 -9906 0 -9907 0 -9908 0 -9909 0 -9910 0 -9911 0 -9912 0 -9913 0 -9914 0 -9915 0 -9916 0 -9917 0 -9918 0 -9919 0 -9920 0 -9921 0 -9922 0 -9923 0 -9924 1 -9925 0 -9926 0 -9927 0 -9928 0 -9929 0 -9930 0 -9931 0 -9932 0 -9933 0 -9934 1 -9935 0 -9936 0 -9937 0 -9938 0 -9939 0 -9940 0 -9941 0 -9942 0 -9943 0 -9944 1 -9945 0 -9946 0 -9947 0 -9948 0 -9949 0 -9950 0 -9951 0 -9952 0 -9953 0 -9954 1 -9955 0 -9956 0 -9957 0 -9958 0 -9959 0 -9960 0 -9961 0 -9962 0 -9963 1 -9964 0 -9965 0 -9966 0 -9967 0 -9968 0 -9969 0 -9970 0 -9971 0 -9972 1 -9973 0 -9974 0 -9975 0 -9976 0 -9977 0 -9978 0 -9979 0 -9980 0 -9981 0 -9982 0 -9983 1 -9984 0 -9985 0 -9986 0 -9987 0 -9988 0 -9989 0 -9990 0 -9991 0 -9992 0 -9993 1 -9994 0 -9995 0 -9996 0 -9997 0 -9998 0 -9999 0 -10000 0 -10001 0 -10002 0 -10003 0 -10004 1 -10005 0 -10006 0 -10007 0 -10008 0 -10009 0 -10010 0 -10011 0 -10012 0 -10013 1 -10014 0 -10015 0 -10016 0 -10017 0 -10018 0 -10019 0 -10020 0 -10021 0 -10022 0 -10023 1 -10024 0 -10025 0 -10026 0 -10027 0 -10028 0 -10029 0 -10030 0 -10031 1 -10032 0 -10033 0 -10034 0 -10035 0 -10036 0 -10037 0 -10038 0 -10039 0 -10040 0 -10041 1 -10042 0 -10043 0 -10044 0 -10045 0 -10046 0 -10047 0 -10048 0 -10049 0 -10050 0 -10051 1 -10052 0 -10053 0 -10054 0 -10055 0 -10056 0 -10057 0 -10058 0 -10059 0 -10060 1 -10061 0 -10062 0 -10063 0 -10064 0 -10065 0 -10066 0 -10067 0 -10068 0 -10069 1 -10070 0 -10071 0 -10072 0 -10073 0 -10074 0 -10075 0 -10076 0 -10077 0 -10078 1 -10079 0 -10080 0 -10081 0 -10082 0 -10083 0 -10084 0 -10085 0 -10086 0 -10087 1 -10088 0 -10089 0 -10090 0 -10091 0 -10092 0 -10093 0 -10094 0 -10095 0 -10096 0 -10097 1 -10098 0 -10099 0 -10100 0 -10101 0 -10102 0 -10103 0 -10104 0 -10105 0 -10106 0 -10107 0 -10108 1 -10109 0 -10110 0 -10111 0 -10112 0 -10113 0 -10114 0 -10115 0 -10116 0 -10117 0 -10118 1 -10119 0 -10120 0 -10121 0 -10122 0 -10123 0 -10124 0 -10125 0 -10126 0 -10127 1 -10128 0 -10129 0 -10130 0 -10131 0 -10132 0 -10133 0 -10134 0 -10135 0 -10136 0 -10137 1 -10138 0 -10139 0 -10140 0 -10141 0 -10142 0 -10143 0 -10144 0 -10145 0 -10146 0 -10147 1 -10148 0 -10149 0 -10150 0 -10151 0 -10152 0 -10153 0 -10154 0 -10155 0 -10156 0 -10157 1 -10158 0 -10159 0 -10160 0 -10161 0 -10162 0 -10163 0 -10164 0 -10165 0 -10166 0 -10167 1 -10168 0 -10169 0 -10170 0 -10171 0 -10172 0 -10173 0 -10174 0 -10175 0 -10176 1 -10177 0 -10178 0 -10179 0 -10180 0 -10181 0 -10182 0 -10183 0 -10184 0 -10185 1 -10186 0 -10187 0 -10188 0 -10189 0 -10190 0 -10191 0 -10192 0 -10193 1 -10194 0 -10195 0 -10196 0 -10197 0 -10198 0 -10199 0 -10200 0 -10201 1 -10202 0 -10203 0 -10204 0 -10205 0 -10206 0 -10207 0 -10208 0 -10209 0 -10210 0 -10211 1 -10212 0 -10213 0 -10214 0 -10215 0 -10216 0 -10217 0 -10218 0 -10219 0 -10220 1 -10221 0 -10222 0 -10223 0 -10224 0 -10225 0 -10226 0 -10227 0 -10228 0 -10229 0 -10230 1 -10231 0 -10232 0 -10233 0 -10234 0 -10235 0 -10236 0 -10237 0 -10238 0 -10239 0 -10240 1 -10241 0 -10242 0 -10243 0 -10244 0 -10245 0 -10246 0 -10247 0 -10248 0 -10249 0 -10250 1 -10251 0 -10252 0 -10253 0 -10254 0 -10255 0 -10256 0 -10257 0 -10258 0 -10259 0 -10260 1 -10261 0 -10262 0 -10263 0 -10264 1 -10265 0 -10266 0 -10267 0 -10268 0 -10269 0 -10270 1 -10271 0 -10272 0 -10273 0 -10274 0 -10275 0 -10276 0 -10277 0 -10278 1 -10279 0 -10280 0 -10281 0 -10282 0 -10283 0 -10284 0 -10285 0 -10286 1 -10287 0 -10288 0 -10289 0 -10290 0 -10291 0 -10292 0 -10293 0 -10294 0 -10295 0 -10296 1 -10297 0 -10298 0 -10299 0 -10300 0 -10301 0 -10302 0 -10303 0 -10304 0 -10305 1 -10306 0 -10307 0 -10308 0 -10309 0 -10310 0 -10311 0 -10312 0 -10313 0 -10314 1 -10315 0 -10316 0 -10317 0 -10318 0 -10319 0 -10320 0 -10321 0 -10322 0 -10323 1 -10324 0 -10325 0 -10326 0 -10327 0 -10328 0 -10329 0 -10330 0 -10331 0 -10332 0 -10333 1 -10334 0 -10335 0 -10336 0 -10337 0 -10338 0 -10339 0 -10340 0 -10341 0 -10342 0 -10343 0 -10344 0 -10345 0 -10346 0 -10347 0 -10348 0 -10349 0 -10350 0 -10351 1 -10352 0 -10353 0 -10354 0 -10355 0 -10356 0 -10357 0 -10358 0 -10359 0 -10360 1 -10361 0 -10362 0 -10363 0 -10364 0 -10365 0 -10366 0 -10367 0 -10368 0 -10369 0 -10370 1 -10371 0 -10372 0 -10373 0 -10374 0 -10375 0 -10376 0 -10377 0 -10378 0 -10379 0 -10380 1 -10381 0 -10382 0 -10383 0 -10384 0 -10385 0 -10386 0 -10387 1 -10388 0 -10389 0 -10390 0 -10391 0 -10392 0 -10393 0 -10394 0 -10395 1 -10396 0 -10397 0 -10398 0 -10399 0 -10400 0 -10401 0 -10402 0 -10403 0 -10404 1 -10405 0 -10406 0 -10407 0 -10408 0 -10409 0 -10410 0 -10411 0 -10412 0 -10413 0 -10414 1 -10415 0 -10416 0 -10417 0 -10418 0 -10419 0 -10420 0 -10421 0 -10422 0 -10423 1 -10424 0 -10425 0 -10426 0 -10427 0 -10428 0 -10429 0 -10430 0 -10431 0 -10432 0 -10433 1 -10434 0 -10435 0 -10436 0 -10437 0 -10438 0 -10439 0 -10440 0 -10441 0 -10442 0 -10443 1 -10444 0 -10445 0 -10446 0 -10447 0 -10448 0 -10449 0 -10450 0 -10451 0 -10452 1 -10453 0 -10454 0 -10455 0 -10456 0 -10457 0 -10458 0 -10459 0 -10460 1 -10461 0 -10462 0 -10463 0 -10464 0 -10465 0 -10466 0 -10467 0 -10468 0 -10469 1 -10470 0 -10471 0 -10472 0 -10473 0 -10474 0 -10475 0 -10476 0 -10477 0 -10478 0 -10479 1 -10480 0 -10481 0 -10482 0 -10483 0 -10484 0 -10485 0 -10486 0 -10487 0 -10488 0 -10489 1 -10490 0 -10491 0 -10492 0 -10493 0 -10494 0 -10495 0 -10496 0 -10497 0 -10498 1 -10499 0 -10500 0 -10501 0 -10502 0 -10503 0 -10504 0 -10505 0 -10506 1 -10507 0 -10508 0 -10509 0 -10510 0 -10511 0 -10512 0 -10513 0 -10514 0 -10515 0 -10516 0 -10517 1 -10518 0 -10519 0 -10520 0 -10521 0 -10522 0 -10523 0 -10524 0 -10525 0 -10526 0 -10527 1 -10528 0 -10529 0 -10530 0 -10531 0 -10532 0 -10533 0 -10534 0 -10535 0 -10536 1 -10537 0 -10538 0 -10539 0 -10540 0 -10541 0 -10542 0 -10543 0 -10544 0 -10545 1 -10546 0 -10547 0 -10548 0 -10549 0 -10550 0 -10551 0 -10552 0 -10553 0 -10554 0 -10555 1 -10556 0 -10557 0 -10558 0 -10559 0 -10560 0 -10561 0 -10562 0 -10563 0 -10564 0 -10565 0 -10566 1 -10567 0 -10568 0 -10569 0 -10570 0 -10571 0 -10572 0 -10573 0 -10574 0 -10575 0 -10576 0 -10577 0 -10578 0 -10579 0 -10580 0 -10581 0 -10582 0 -10583 0 -10584 0 -10585 0 -10586 0 -10587 1 -10588 0 -10589 0 -10590 0 -10591 0 -10592 0 -10593 0 -10594 0 -10595 0 -10596 0 -10597 0 -10598 1 -10599 0 -10600 0 -10601 0 -10602 0 -10603 0 -10604 0 -10605 0 -10606 0 -10607 0 -10608 0 -10609 1 -10610 0 -10611 0 -10612 0 -10613 0 -10614 0 -10615 0 -10616 0 -10617 1 -10618 0 -10619 0 -10620 0 -10621 0 -10622 0 -10623 0 -10624 0 -10625 1 -10626 0 -10627 0 -10628 0 -10629 0 -10630 0 -10631 0 -10632 0 -10633 0 -10634 1 -10635 0 -10636 0 -10637 0 -10638 0 -10639 0 -10640 0 -10641 0 -10642 0 -10643 0 -10644 1 -10645 0 -10646 0 -10647 0 -10648 0 -10649 0 -10650 0 -10651 0 -10652 0 -10653 1 -10654 0 -10655 0 -10656 0 -10657 0 -10658 0 -10659 0 -10660 0 -10661 1 -10662 0 -10663 0 -10664 0 -10665 0 -10666 0 -10667 0 -10668 0 -10669 0 -10670 0 -10671 1 -10672 0 -10673 0 -10674 0 -10675 0 -10676 0 -10677 0 -10678 0 -10679 0 -10680 0 -10681 1 -10682 0 -10683 0 -10684 0 -10685 0 -10686 0 -10687 0 -10688 0 -10689 0 -10690 0 -10691 0 -10692 0 -10693 0 -10694 0 -10695 0 -10696 0 -10697 0 -10698 0 -10699 0 -10700 0 -10701 1 -10702 0 -10703 0 -10704 0 -10705 0 -10706 0 -10707 0 -10708 0 -10709 0 -10710 0 -10711 1 -10712 0 -10713 0 -10714 0 -10715 0 -10716 0 -10717 0 -10718 0 -10719 0 -10720 0 -10721 1 -10722 0 -10723 0 -10724 0 -10725 0 -10726 0 -10727 0 -10728 0 -10729 0 -10730 1 -10731 0 -10732 0 -10733 0 -10734 0 -10735 0 -10736 0 -10737 0 -10738 0 -10739 0 -10740 1 -10741 0 -10742 0 -10743 0 -10744 0 -10745 0 -10746 0 -10747 0 -10748 0 -10749 1 -10750 0 -10751 0 -10752 0 -10753 0 -10754 0 -10755 0 -10756 0 -10757 0 -10758 0 -10759 1 -10760 0 -10761 0 -10762 0 -10763 0 -10764 0 -10765 0 -10766 0 -10767 0 -10768 0 -10769 0 -10770 1 -10771 0 -10772 0 -10773 0 -10774 0 -10775 0 -10776 0 -10777 0 -10778 0 -10779 0 -10780 1 -10781 0 -10782 0 -10783 0 -10784 0 -10785 0 -10786 0 -10787 0 -10788 0 -10789 0 -10790 1 -10791 0 -10792 0 -10793 0 -10794 0 -10795 0 -10796 0 -10797 0 -10798 0 -10799 0 -10800 1 -10801 0 -10802 0 -10803 0 -10804 0 -10805 0 -10806 0 -10807 0 -10808 0 -10809 0 -10810 0 -10811 0 -10812 0 -10813 0 -10814 0 -10815 0 -10816 0 -10817 0 -10818 0 -10819 0 -10820 1 -10821 0 -10822 0 -10823 0 -10824 0 -10825 0 -10826 0 -10827 0 -10828 0 -10829 0 -10830 0 -10831 1 -10832 0 -10833 0 -10834 0 -10835 0 -10836 0 -10837 0 -10838 0 -10839 0 -10840 1 -10841 0 -10842 0 -10843 0 -10844 0 -10845 0 -10846 0 -10847 0 -10848 0 -10849 0 -10850 0 -10851 0 -10852 0 -10853 0 -10854 0 -10855 0 -10856 0 -10857 0 -10858 0 -10859 0 -10860 1 -10861 0 -10862 0 -10863 0 -10864 0 -10865 0 -10866 0 -10867 0 -10868 0 -10869 1 -10870 0 -10871 0 -10872 0 -10873 0 -10874 0 -10875 0 -10876 0 -10877 0 -10878 0 -10879 0 -10880 1 -10881 0 -10882 0 -10883 0 -10884 0 -10885 0 -10886 0 -10887 0 -10888 0 -10889 0 -10890 1 -10891 0 -10892 0 -10893 0 -10894 0 -10895 0 -10896 0 -10897 0 -10898 0 -10899 0 -10900 1 -10901 0 -10902 0 -10903 0 -10904 0 -10905 0 -10906 0 -10907 0 -10908 0 -10909 0 -10910 0 -10911 1 -10912 0 -10913 0 -10914 0 -10915 0 -10916 0 -10917 0 -10918 0 -10919 0 -10920 0 -10921 1 -10922 0 -10923 0 -10924 0 -10925 0 -10926 0 -10927 0 -10928 0 -10929 0 -10930 0 -10931 1 -10932 0 -10933 0 -10934 0 -10935 0 -10936 0 -10937 0 -10938 0 -10939 0 -10940 1 -10941 0 -10942 0 -10943 0 -10944 0 -10945 0 -10946 0 -10947 0 -10948 0 -10949 1 -10950 0 -10951 0 -10952 0 -10953 0 -10954 0 -10955 0 -10956 0 -10957 0 -10958 1 -10959 0 -10960 0 -10961 0 -10962 0 -10963 0 -10964 0 -10965 0 -10966 0 -10967 0 -10968 1 -10969 0 -10970 0 -10971 0 -10972 0 -10973 0 -10974 0 -10975 0 -10976 0 -10977 0 -10978 1 -10979 0 -10980 0 -10981 0 -10982 0 -10983 0 -10984 0 -10985 0 -10986 0 -10987 0 -10988 0 -10989 1 -10990 0 -10991 0 -10992 0 -10993 0 -10994 0 -10995 0 -10996 0 -10997 0 -10998 0 -10999 0 -11000 1 \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore deleted file mode 100644 index 38344f87..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -build/ -test/ -examples/ -fs.js -zlib.js \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE deleted file mode 100644 index 0c44ae71..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md deleted file mode 100644 index 34c11897..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# readable-stream - -***Node-core streams for userland*** - -[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true)](https://nodei.co/npm/readable-stream/) -[![NPM](https://nodei.co/npm-dl/readable-stream.png)](https://nodei.co/npm/readable-stream/) - -This package is a mirror of the Streams2 and Streams3 implementations in Node-core. - -If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. - -**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. - -**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js deleted file mode 100644 index ca807af8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_duplex.js") diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index b513d61a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -module.exports = Duplex; - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -} -/**/ - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -forEach(objectKeys(Writable.prototype), function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; -}); - -function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js deleted file mode 100644 index 895ca50a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); -}; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index 63072209..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,982 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Readable.ReadableState = ReadableState; - -var EE = require('events').EventEmitter; - -/**/ -if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -var Stream = require('stream'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var StringDecoder; - -util.inherits(Readable, Stream); - -function ReadableState(options, stream) { - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = false; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // In streams that never have any data, and do push(null) right away, - // the consumer can miss the 'end' event if they do some I/O before - // consuming the stream. So, we don't emit('end') until some reading - // happens. - this.calledRead = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (typeof chunk === 'string' && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null || chunk === undefined) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) { - state.buffer.unshift(chunk); - } else { - state.reading = false; - state.buffer.push(chunk); - } - - if (state.needReadable) - emitReadable(stream); - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - - - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; -}; - -// Don't raise the hwm > 128MB -var MAX_HWM = 0x800000; -function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; -} - -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (n === null || isNaN(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function(n) { - var state = this._readableState; - state.calledRead = true; - var nOrig = n; - var ret; - - if (typeof n !== 'number' || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - ret = null; - - // In cases where the decoder did not receive enough data - // to produce a full chunk, then immediately received an - // EOF, state.buffer will contain [, ]. - // howMuchToRead will see this and coerce the amount to - // read to zero (because it's looking at the length of the - // first in state.buffer), and we'll end up here. - // - // This can only happen via state.decoder -- no other venue - // exists for pushing a zero-length chunk into state.buffer - // and triggering this behavior. In this case, we return our - // remaining data and end the stream, if appropriate. - if (state.length > 0 && state.decoder) { - ret = fromList(n, state); - state.length -= ret.length; - } - - if (state.length === 0) - endReadable(this); - - return ret; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - - // if we currently have less than the highWaterMark, then also read some - if (state.length - n <= state.highWaterMark) - doRead = true; - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) - doRead = false; - - if (doRead) { - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read called its callback synchronously, then `reading` - // will be false, and we need to re-evaluate how much data we - // can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we happened to read() exactly the remaining amount in the - // buffer, and the EOF has been seen at this point, then make sure - // that we emit 'end' on the very next tick. - if (state.ended && !state.endEmitted && state.length === 0) - endReadable(this); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && - !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - - -function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // if we've ended and we have some data left, then emit - // 'readable' now to make sure it gets picked up. - if (state.length > 0) - emitReadable(stream); - else - endReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (state.emittedReadable) - return; - - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); -} - -function emitReadable_(stream) { - stream.emit('readable'); -} - - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - if (readable !== src) return; - cleanup(); - } - - function onend() { - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (!dest._writableState || dest._writableState.needDrain) - ondrain(); - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - // the handler that waits for readable events after all - // the data gets sucked out in flow. - // This would be easier to follow with a .once() handler - // in flow(), but that is too slow. - this.on('readable', pipeOnReadable); - - state.flowing = true; - process.nextTick(function() { - flow(src); - }); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function() { - var dest = this; - var state = src._readableState; - state.awaitDrain--; - if (state.awaitDrain === 0) - flow(src); - }; -} - -function flow(src) { - var state = src._readableState; - var chunk; - state.awaitDrain = 0; - - function write(dest, i, list) { - var written = dest.write(chunk); - if (false === written) { - state.awaitDrain++; - } - } - - while (state.pipesCount && null !== (chunk = src.read())) { - - if (state.pipesCount === 1) - write(state.pipes, 0, null); - else - forEach(state.pipes, write); - - src.emit('data', chunk); - - // if anyone needs a drain, then we have to wait for that. - if (state.awaitDrain > 0) - return; - } - - // if every destination was unpiped, either before entering this - // function, or in the while loop, then stop flowing. - // - // NB: This is a pretty rare edge case. - if (state.pipesCount === 0) { - state.flowing = false; - - // if there were data event listeners added, then switch to old mode. - if (EE.listenerCount(src, 'data') > 0) - emitDataEvents(src); - return; - } - - // at this point, no one needed a drain, so we just ran out of data - // on the next readable event, start it over again. - state.ranOut = true; -} - -function pipeOnReadable() { - if (this._readableState.ranOut) { - this._readableState.ranOut = false; - flow(this); - } -} - - -Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data' && !this._readableState.flowing) - emitDataEvents(this); - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - this.read(0); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function() { - emitDataEvents(this); - this.read(0); - this.emit('resume'); -}; - -Readable.prototype.pause = function() { - emitDataEvents(this, true); - this.emit('pause'); -}; - -function emitDataEvents(stream, startPaused) { - var state = stream._readableState; - - if (state.flowing) { - // https://github.com/isaacs/readable-stream/issues/16 - throw new Error('Cannot switch to old mode now.'); - } - - var paused = startPaused || false; - var readable = false; - - // convert to an old-style stream. - stream.readable = true; - stream.pipe = Stream.prototype.pipe; - stream.on = stream.addListener = Stream.prototype.on; - - stream.on('readable', function() { - readable = true; - - var c; - while (!paused && (null !== (c = stream.read()))) - stream.emit('data', c); - - if (c === null) { - readable = false; - stream._readableState.needReadable = true; - } - }); - - stream.pause = function() { - paused = true; - this.emit('pause'); - }; - - stream.resume = function() { - paused = false; - if (readable) - process.nextTick(function() { - stream.emit('readable'); - }); - else - this.read(0); - this.emit('resume'); - }; - - // now make it start, just in case it hadn't already. - stream.emit('readable'); -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - if (state.decoder) - chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - //if (state.objectMode && util.isNullOrUndefined(chunk)) - if (state.objectMode && (chunk === null || chunk === undefined)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (typeof stream[i] === 'function' && - typeof this[i] === 'undefined') { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - - - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted && state.calledRead) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -function indexOf (xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index eb188df3..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - - -function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (data !== null && data !== undefined) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - - -function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - var ts = this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('finish', function() { - if ('function' === typeof this._flush) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); -} - -Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); -}; - -Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - - -function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var rs = stream._readableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index 4bdaa4fa..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, cb), and it'll handle all -// the drain event emission and buffering. - -module.exports = Writable; - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Writable.WritableState = WritableState; - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Stream = require('stream'); - -util.inherits(Writable, Stream); - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; -} - -function WritableState(options, stream) { - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; -} - -function Writable(options) { - var Duplex = require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; - - -function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; -} - -Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (Buffer.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (typeof cb !== 'function') - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) - ret = writeOrBuffer(this, state, chunk, encoding, cb); - - return ret; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - typeof chunk === 'string') { - chunk = new Buffer(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - if (Buffer.isBuffer(chunk)) - encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) - state.needDrain = true; - - if (state.writing) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, len, chunk, encoding, cb); - - return ret; -} - -function doWrite(stream, state, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - cb(er); - }); - else - cb(er); - - stream._writableState.errorEmitted = true; - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && !state.bufferProcessing && state.buffer.length) - clearBuffer(stream, state); - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - cb(); - if (finished) - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - state.bufferProcessing = false; - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; -} - -Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); -}; - -Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (typeof chunk !== 'undefined' && chunk !== null) - this.write(chunk, encoding); - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); -}; - - -function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); -} - -function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - state.finished = true; - stream.emit('finish'); - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md deleted file mode 100644 index 5a76b414..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# core-util-is - -The `util.is*` functions introduced in Node v0.12. diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch deleted file mode 100644 index a06d5c05..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch +++ /dev/null @@ -1,604 +0,0 @@ -diff --git a/lib/util.js b/lib/util.js -index a03e874..9074e8e 100644 ---- a/lib/util.js -+++ b/lib/util.js -@@ -19,430 +19,6 @@ - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - --var formatRegExp = /%[sdj%]/g; --exports.format = function(f) { -- if (!isString(f)) { -- var objects = []; -- for (var i = 0; i < arguments.length; i++) { -- objects.push(inspect(arguments[i])); -- } -- return objects.join(' '); -- } -- -- var i = 1; -- var args = arguments; -- var len = args.length; -- var str = String(f).replace(formatRegExp, function(x) { -- if (x === '%%') return '%'; -- if (i >= len) return x; -- switch (x) { -- case '%s': return String(args[i++]); -- case '%d': return Number(args[i++]); -- case '%j': -- try { -- return JSON.stringify(args[i++]); -- } catch (_) { -- return '[Circular]'; -- } -- default: -- return x; -- } -- }); -- for (var x = args[i]; i < len; x = args[++i]) { -- if (isNull(x) || !isObject(x)) { -- str += ' ' + x; -- } else { -- str += ' ' + inspect(x); -- } -- } -- return str; --}; -- -- --// Mark that a method should not be used. --// Returns a modified function which warns once by default. --// If --no-deprecation is set, then it is a no-op. --exports.deprecate = function(fn, msg) { -- // Allow for deprecating things in the process of starting up. -- if (isUndefined(global.process)) { -- return function() { -- return exports.deprecate(fn, msg).apply(this, arguments); -- }; -- } -- -- if (process.noDeprecation === true) { -- return fn; -- } -- -- var warned = false; -- function deprecated() { -- if (!warned) { -- if (process.throwDeprecation) { -- throw new Error(msg); -- } else if (process.traceDeprecation) { -- console.trace(msg); -- } else { -- console.error(msg); -- } -- warned = true; -- } -- return fn.apply(this, arguments); -- } -- -- return deprecated; --}; -- -- --var debugs = {}; --var debugEnviron; --exports.debuglog = function(set) { -- if (isUndefined(debugEnviron)) -- debugEnviron = process.env.NODE_DEBUG || ''; -- set = set.toUpperCase(); -- if (!debugs[set]) { -- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { -- var pid = process.pid; -- debugs[set] = function() { -- var msg = exports.format.apply(exports, arguments); -- console.error('%s %d: %s', set, pid, msg); -- }; -- } else { -- debugs[set] = function() {}; -- } -- } -- return debugs[set]; --}; -- -- --/** -- * Echos the value of a value. Trys to print the value out -- * in the best way possible given the different types. -- * -- * @param {Object} obj The object to print out. -- * @param {Object} opts Optional options object that alters the output. -- */ --/* legacy: obj, showHidden, depth, colors*/ --function inspect(obj, opts) { -- // default options -- var ctx = { -- seen: [], -- stylize: stylizeNoColor -- }; -- // legacy... -- if (arguments.length >= 3) ctx.depth = arguments[2]; -- if (arguments.length >= 4) ctx.colors = arguments[3]; -- if (isBoolean(opts)) { -- // legacy... -- ctx.showHidden = opts; -- } else if (opts) { -- // got an "options" object -- exports._extend(ctx, opts); -- } -- // set default options -- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; -- if (isUndefined(ctx.depth)) ctx.depth = 2; -- if (isUndefined(ctx.colors)) ctx.colors = false; -- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; -- if (ctx.colors) ctx.stylize = stylizeWithColor; -- return formatValue(ctx, obj, ctx.depth); --} --exports.inspect = inspect; -- -- --// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics --inspect.colors = { -- 'bold' : [1, 22], -- 'italic' : [3, 23], -- 'underline' : [4, 24], -- 'inverse' : [7, 27], -- 'white' : [37, 39], -- 'grey' : [90, 39], -- 'black' : [30, 39], -- 'blue' : [34, 39], -- 'cyan' : [36, 39], -- 'green' : [32, 39], -- 'magenta' : [35, 39], -- 'red' : [31, 39], -- 'yellow' : [33, 39] --}; -- --// Don't use 'blue' not visible on cmd.exe --inspect.styles = { -- 'special': 'cyan', -- 'number': 'yellow', -- 'boolean': 'yellow', -- 'undefined': 'grey', -- 'null': 'bold', -- 'string': 'green', -- 'date': 'magenta', -- // "name": intentionally not styling -- 'regexp': 'red' --}; -- -- --function stylizeWithColor(str, styleType) { -- var style = inspect.styles[styleType]; -- -- if (style) { -- return '\u001b[' + inspect.colors[style][0] + 'm' + str + -- '\u001b[' + inspect.colors[style][1] + 'm'; -- } else { -- return str; -- } --} -- -- --function stylizeNoColor(str, styleType) { -- return str; --} -- -- --function arrayToHash(array) { -- var hash = {}; -- -- array.forEach(function(val, idx) { -- hash[val] = true; -- }); -- -- return hash; --} -- -- --function formatValue(ctx, value, recurseTimes) { -- // Provide a hook for user-specified inspect functions. -- // Check that value is an object with an inspect function on it -- if (ctx.customInspect && -- value && -- isFunction(value.inspect) && -- // Filter out the util module, it's inspect function is special -- value.inspect !== exports.inspect && -- // Also filter out any prototype objects using the circular check. -- !(value.constructor && value.constructor.prototype === value)) { -- var ret = value.inspect(recurseTimes, ctx); -- if (!isString(ret)) { -- ret = formatValue(ctx, ret, recurseTimes); -- } -- return ret; -- } -- -- // Primitive types cannot have properties -- var primitive = formatPrimitive(ctx, value); -- if (primitive) { -- return primitive; -- } -- -- // Look up the keys of the object. -- var keys = Object.keys(value); -- var visibleKeys = arrayToHash(keys); -- -- if (ctx.showHidden) { -- keys = Object.getOwnPropertyNames(value); -- } -- -- // Some type of object without properties can be shortcutted. -- if (keys.length === 0) { -- if (isFunction(value)) { -- var name = value.name ? ': ' + value.name : ''; -- return ctx.stylize('[Function' + name + ']', 'special'); -- } -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } -- if (isDate(value)) { -- return ctx.stylize(Date.prototype.toString.call(value), 'date'); -- } -- if (isError(value)) { -- return formatError(value); -- } -- } -- -- var base = '', array = false, braces = ['{', '}']; -- -- // Make Array say that they are Array -- if (isArray(value)) { -- array = true; -- braces = ['[', ']']; -- } -- -- // Make functions say that they are functions -- if (isFunction(value)) { -- var n = value.name ? ': ' + value.name : ''; -- base = ' [Function' + n + ']'; -- } -- -- // Make RegExps say that they are RegExps -- if (isRegExp(value)) { -- base = ' ' + RegExp.prototype.toString.call(value); -- } -- -- // Make dates with properties first say the date -- if (isDate(value)) { -- base = ' ' + Date.prototype.toUTCString.call(value); -- } -- -- // Make error with message first say the error -- if (isError(value)) { -- base = ' ' + formatError(value); -- } -- -- if (keys.length === 0 && (!array || value.length == 0)) { -- return braces[0] + base + braces[1]; -- } -- -- if (recurseTimes < 0) { -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } else { -- return ctx.stylize('[Object]', 'special'); -- } -- } -- -- ctx.seen.push(value); -- -- var output; -- if (array) { -- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); -- } else { -- output = keys.map(function(key) { -- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); -- }); -- } -- -- ctx.seen.pop(); -- -- return reduceToSingleString(output, base, braces); --} -- -- --function formatPrimitive(ctx, value) { -- if (isUndefined(value)) -- return ctx.stylize('undefined', 'undefined'); -- if (isString(value)) { -- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') -- .replace(/'/g, "\\'") -- .replace(/\\"/g, '"') + '\''; -- return ctx.stylize(simple, 'string'); -- } -- if (isNumber(value)) { -- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, -- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . -- if (value === 0 && 1 / value < 0) -- return ctx.stylize('-0', 'number'); -- return ctx.stylize('' + value, 'number'); -- } -- if (isBoolean(value)) -- return ctx.stylize('' + value, 'boolean'); -- // For some reason typeof null is "object", so special case here. -- if (isNull(value)) -- return ctx.stylize('null', 'null'); --} -- -- --function formatError(value) { -- return '[' + Error.prototype.toString.call(value) + ']'; --} -- -- --function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { -- var output = []; -- for (var i = 0, l = value.length; i < l; ++i) { -- if (hasOwnProperty(value, String(i))) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- String(i), true)); -- } else { -- output.push(''); -- } -- } -- keys.forEach(function(key) { -- if (!key.match(/^\d+$/)) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- key, true)); -- } -- }); -- return output; --} -- -- --function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { -- var name, str, desc; -- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; -- if (desc.get) { -- if (desc.set) { -- str = ctx.stylize('[Getter/Setter]', 'special'); -- } else { -- str = ctx.stylize('[Getter]', 'special'); -- } -- } else { -- if (desc.set) { -- str = ctx.stylize('[Setter]', 'special'); -- } -- } -- if (!hasOwnProperty(visibleKeys, key)) { -- name = '[' + key + ']'; -- } -- if (!str) { -- if (ctx.seen.indexOf(desc.value) < 0) { -- if (isNull(recurseTimes)) { -- str = formatValue(ctx, desc.value, null); -- } else { -- str = formatValue(ctx, desc.value, recurseTimes - 1); -- } -- if (str.indexOf('\n') > -1) { -- if (array) { -- str = str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n').substr(2); -- } else { -- str = '\n' + str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n'); -- } -- } -- } else { -- str = ctx.stylize('[Circular]', 'special'); -- } -- } -- if (isUndefined(name)) { -- if (array && key.match(/^\d+$/)) { -- return str; -- } -- name = JSON.stringify('' + key); -- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { -- name = name.substr(1, name.length - 2); -- name = ctx.stylize(name, 'name'); -- } else { -- name = name.replace(/'/g, "\\'") -- .replace(/\\"/g, '"') -- .replace(/(^"|"$)/g, "'"); -- name = ctx.stylize(name, 'string'); -- } -- } -- -- return name + ': ' + str; --} -- -- --function reduceToSingleString(output, base, braces) { -- var numLinesEst = 0; -- var length = output.reduce(function(prev, cur) { -- numLinesEst++; -- if (cur.indexOf('\n') >= 0) numLinesEst++; -- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; -- }, 0); -- -- if (length > 60) { -- return braces[0] + -- (base === '' ? '' : base + '\n ') + -- ' ' + -- output.join(',\n ') + -- ' ' + -- braces[1]; -- } -- -- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; --} -- -- - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { -@@ -522,166 +98,10 @@ function isPrimitive(arg) { - exports.isPrimitive = isPrimitive; - - function isBuffer(arg) { -- return arg instanceof Buffer; -+ return Buffer.isBuffer(arg); - } - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); --} -- -- --function pad(n) { -- return n < 10 ? '0' + n.toString(10) : n.toString(10); --} -- -- --var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', -- 'Oct', 'Nov', 'Dec']; -- --// 26 Feb 16:19:34 --function timestamp() { -- var d = new Date(); -- var time = [pad(d.getHours()), -- pad(d.getMinutes()), -- pad(d.getSeconds())].join(':'); -- return [d.getDate(), months[d.getMonth()], time].join(' '); --} -- -- --// log is just a thin wrapper to console.log that prepends a timestamp --exports.log = function() { -- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); --}; -- -- --/** -- * Inherit the prototype methods from one constructor into another. -- * -- * The Function.prototype.inherits from lang.js rewritten as a standalone -- * function (not on Function.prototype). NOTE: If this file is to be loaded -- * during bootstrapping this function needs to be rewritten using some native -- * functions as prototype setup using normal JavaScript does not work as -- * expected during bootstrapping (see mirror.js in r114903). -- * -- * @param {function} ctor Constructor function which needs to inherit the -- * prototype. -- * @param {function} superCtor Constructor function to inherit prototype from. -- */ --exports.inherits = function(ctor, superCtor) { -- ctor.super_ = superCtor; -- ctor.prototype = Object.create(superCtor.prototype, { -- constructor: { -- value: ctor, -- enumerable: false, -- writable: true, -- configurable: true -- } -- }); --}; -- --exports._extend = function(origin, add) { -- // Don't do anything if add isn't an object -- if (!add || !isObject(add)) return origin; -- -- var keys = Object.keys(add); -- var i = keys.length; -- while (i--) { -- origin[keys[i]] = add[keys[i]]; -- } -- return origin; --}; -- --function hasOwnProperty(obj, prop) { -- return Object.prototype.hasOwnProperty.call(obj, prop); --} -- -- --// Deprecated old stuff. -- --exports.p = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- console.error(exports.inspect(arguments[i])); -- } --}, 'util.p: Use console.error() instead'); -- -- --exports.exec = exports.deprecate(function() { -- return require('child_process').exec.apply(this, arguments); --}, 'util.exec is now called `child_process.exec`.'); -- -- --exports.print = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(String(arguments[i])); -- } --}, 'util.print: Use console.log instead'); -- -- --exports.puts = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(arguments[i] + '\n'); -- } --}, 'util.puts: Use console.log instead'); -- -- --exports.debug = exports.deprecate(function(x) { -- process.stderr.write('DEBUG: ' + x + '\n'); --}, 'util.debug: Use console.error instead'); -- -- --exports.error = exports.deprecate(function(x) { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stderr.write(arguments[i] + '\n'); -- } --}, 'util.error: Use console.error instead'); -- -- --exports.pump = exports.deprecate(function(readStream, writeStream, callback) { -- var callbackCalled = false; -- -- function call(a, b, c) { -- if (callback && !callbackCalled) { -- callback(a, b, c); -- callbackCalled = true; -- } -- } -- -- readStream.addListener('data', function(chunk) { -- if (writeStream.write(chunk) === false) readStream.pause(); -- }); -- -- writeStream.addListener('drain', function() { -- readStream.resume(); -- }); -- -- readStream.addListener('end', function() { -- writeStream.end(); -- }); -- -- readStream.addListener('close', function() { -- call(); -- }); -- -- readStream.addListener('error', function(err) { -- writeStream.end(); -- call(err); -- }); -- -- writeStream.addListener('error', function(err) { -- readStream.destroy(); -- call(err); -- }); --}, 'util.pump(): Use readableStream.pipe() instead'); -- -- --var uv; --exports._errnoException = function(err, syscall) { -- if (isUndefined(uv)) uv = process.binding('uv'); -- var errname = uv.errname(err); -- var e = new Error(syscall + ' ' + errname); -- e.code = errname; -- e.errno = errname; -- e.syscall = syscall; -- return e; --}; -+} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js deleted file mode 100644 index 9074e8eb..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return Buffer.isBuffer(arg); -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json deleted file mode 100644 index 2b7593c1..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "core-util-is", - "version": "1.0.1", - "description": "The `util.is*` functions introduced in Node v0.12.", - "main": "lib/util.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/core-util-is" - }, - "keywords": [ - "util", - "isBuffer", - "isArray", - "isNumber", - "isString", - "isRegExp", - "isThis", - "isThat", - "polyfill" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/isaacs/core-util-is/issues" - }, - "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", - "readmeFilename": "README.md", - "homepage": "https://github.com/isaacs/core-util-is", - "_id": "core-util-is@1.0.1", - "dist": { - "shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", - "tarball": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "_from": "core-util-is@~1.0.0", - "_npmVersion": "1.3.23", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", - "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", - "scripts": {} -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js deleted file mode 100644 index 007fa105..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && objectToString(e) === '[object Error]'; -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return arg instanceof Buffer; -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -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. - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md deleted file mode 100644 index b1c56658..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js deleted file mode 100644 index 29f5e24f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('util').inherits diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js deleted file mode 100644 index c1e78a75..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,23 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json deleted file mode 100644 index 6c556ed3..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.1", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inherits" - }, - "license": "ISC", - "scripts": { - "test": "node test" - }, - "bugs": { - "url": "https://github.com/isaacs/inherits/issues" - }, - "_id": "inherits@2.0.1", - "dist": { - "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "_from": "inherits@~2.0.1", - "_npmVersion": "1.3.8", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/isaacs/inherits" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js deleted file mode 100644 index fc53012d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js +++ /dev/null @@ -1,25 +0,0 @@ -var inherits = require('./inherits.js') -var assert = require('assert') - -function test(c) { - assert(c.constructor === Child) - assert(c.constructor.super_ === Parent) - assert(Object.getPrototypeOf(c) === Child.prototype) - assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) - assert(c instanceof Child) - assert(c instanceof Parent) -} - -function Child() { - Parent.call(this) - test(this) -} - -function Parent() {} - -inherits(Child, Parent) - -var c = new Child -test(c) - -console.log('ok') diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md deleted file mode 100644 index 052a62b8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md +++ /dev/null @@ -1,54 +0,0 @@ - -# isarray - -`Array#isArray` for older browsers. - -## Usage - -```js -var isArray = require('isarray'); - -console.log(isArray([])); // => true -console.log(isArray({})); // => false -``` - -## Installation - -With [npm](http://npmjs.org) do - -```bash -$ npm install isarray -``` - -Then bundle for the browser with -[browserify](https://github.com/substack/browserify). - -With [component](http://component.io) do - -```bash -$ component install juliangruber/isarray -``` - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js deleted file mode 100644 index ec58596a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js +++ /dev/null @@ -1,209 +0,0 @@ - -/** - * Require the given path. - * - * @param {String} path - * @return {Object} exports - * @api public - */ - -function require(path, parent, orig) { - var resolved = require.resolve(path); - - // lookup failed - if (null == resolved) { - orig = orig || path; - parent = parent || 'root'; - var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); - err.path = orig; - err.parent = parent; - err.require = true; - throw err; - } - - var module = require.modules[resolved]; - - // perform real require() - // by invoking the module's - // registered function - if (!module.exports) { - module.exports = {}; - module.client = module.component = true; - module.call(this, module.exports, require.relative(resolved), module); - } - - return module.exports; -} - -/** - * Registered modules. - */ - -require.modules = {}; - -/** - * Registered aliases. - */ - -require.aliases = {}; - -/** - * Resolve `path`. - * - * Lookup: - * - * - PATH/index.js - * - PATH.js - * - PATH - * - * @param {String} path - * @return {String} path or null - * @api private - */ - -require.resolve = function(path) { - if (path.charAt(0) === '/') path = path.slice(1); - var index = path + '/index.js'; - - var paths = [ - path, - path + '.js', - path + '.json', - path + '/index.js', - path + '/index.json' - ]; - - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; - if (require.modules.hasOwnProperty(path)) return path; - } - - if (require.aliases.hasOwnProperty(index)) { - return require.aliases[index]; - } -}; - -/** - * Normalize `path` relative to the current path. - * - * @param {String} curr - * @param {String} path - * @return {String} - * @api private - */ - -require.normalize = function(curr, path) { - var segs = []; - - if ('.' != path.charAt(0)) return path; - - curr = curr.split('/'); - path = path.split('/'); - - for (var i = 0; i < path.length; ++i) { - if ('..' == path[i]) { - curr.pop(); - } else if ('.' != path[i] && '' != path[i]) { - segs.push(path[i]); - } - } - - return curr.concat(segs).join('/'); -}; - -/** - * Register module at `path` with callback `definition`. - * - * @param {String} path - * @param {Function} definition - * @api private - */ - -require.register = function(path, definition) { - require.modules[path] = definition; -}; - -/** - * Alias a module definition. - * - * @param {String} from - * @param {String} to - * @api private - */ - -require.alias = function(from, to) { - if (!require.modules.hasOwnProperty(from)) { - throw new Error('Failed to alias "' + from + '", it does not exist'); - } - require.aliases[to] = from; -}; - -/** - * Return a require function relative to the `parent` path. - * - * @param {String} parent - * @return {Function} - * @api private - */ - -require.relative = function(parent) { - var p = require.normalize(parent, '..'); - - /** - * lastIndexOf helper. - */ - - function lastIndexOf(arr, obj) { - var i = arr.length; - while (i--) { - if (arr[i] === obj) return i; - } - return -1; - } - - /** - * The relative require() itself. - */ - - function localRequire(path) { - var resolved = localRequire.resolve(path); - return require(resolved, parent, path); - } - - /** - * Resolve relative to the parent. - */ - - localRequire.resolve = function(path) { - var c = path.charAt(0); - if ('/' == c) return path.slice(1); - if ('.' == c) return require.normalize(p, path); - - // resolve deps by returning - // the dep in the nearest "deps" - // directory - var segs = parent.split('/'); - var i = lastIndexOf(segs, 'deps') + 1; - if (!i) i = 0; - path = segs.slice(0, i + 1).join('/') + '/deps/' + path; - return path; - }; - - /** - * Check if module is defined at `path`. - */ - - localRequire.exists = function(path) { - return require.modules.hasOwnProperty(localRequire.resolve(path)); - }; - - return localRequire; -}; -require.register("isarray/index.js", function(exports, require, module){ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - -}); -require.alias("isarray/index.js", "isarray/index.js"); - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json deleted file mode 100644 index 9e31b683..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name" : "isarray", - "description" : "Array#isArray for older browsers", - "version" : "0.0.1", - "repository" : "juliangruber/isarray", - "homepage": "https://github.com/juliangruber/isarray", - "main" : "index.js", - "scripts" : [ - "index.js" - ], - "dependencies" : {}, - "keywords": ["browser","isarray","array"], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js deleted file mode 100644 index 5f5ad45d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json deleted file mode 100644 index 19228ab6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "isarray", - "description": "Array#isArray for older browsers", - "version": "0.0.1", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/isarray.git" - }, - "homepage": "https://github.com/juliangruber/isarray", - "main": "index.js", - "scripts": { - "test": "tap test/*.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "*" - }, - "keywords": [ - "browser", - "isarray", - "array" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "_id": "isarray@0.0.1", - "dist": { - "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "_from": "isarray@0.0.1", - "_npmVersion": "1.2.18", - "_npmUser": { - "name": "juliangruber", - "email": "julian@juliangruber.com" - }, - "maintainers": [ - { - "name": "juliangruber", - "email": "julian@juliangruber.com" - } - ], - "directories": {}, - "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - }, - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore deleted file mode 100644 index 206320cc..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -build -test diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE deleted file mode 100644 index 6de584a4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. - -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/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md deleted file mode 100644 index 4d2aa001..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md +++ /dev/null @@ -1,7 +0,0 @@ -**string_decoder.js** (`require('string_decoder')`) from Node.js core - -Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details. - -Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.** - -The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version. \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js deleted file mode 100644 index b00e54fb..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var Buffer = require('buffer').Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; - - -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} - -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json deleted file mode 100644 index a8c586bf..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "string_decoder", - "version": "0.10.31", - "description": "The string_decoder module from Node core", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "tap": "~0.4.8" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/rvagg/string_decoder.git" - }, - "homepage": "https://github.com/rvagg/string_decoder", - "keywords": [ - "string", - "decoder", - "browser", - "browserify" - ], - "license": "MIT", - "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0", - "bugs": { - "url": "https://github.com/rvagg/string_decoder/issues" - }, - "_id": "string_decoder@0.10.31", - "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "_from": "string_decoder@~0.10.x", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json deleted file mode 100644 index 8fe02c53..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "readable-stream", - "version": "1.0.31", - "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", - "main": "readable.js", - "dependencies": { - "core-util-is": "~1.0.0", - "isarray": "0.0.1", - "string_decoder": "~0.10.x", - "inherits": "~2.0.1" - }, - "devDependencies": { - "tap": "~0.2.6" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/readable-stream" - }, - "keywords": [ - "readable", - "stream", - "pipe" - ], - "browser": { - "util": false - }, - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/isaacs/readable-stream/issues" - }, - "homepage": "https://github.com/isaacs/readable-stream", - "_id": "readable-stream@1.0.31", - "_shasum": "8f2502e0bc9e3b0da1b94520aabb4e2603ecafae", - "_from": "readable-stream@1.0.31", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "8f2502e0bc9e3b0da1b94520aabb4e2603ecafae", - "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js deleted file mode 100644 index 27e8d8a5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_passthrough.js") diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js deleted file mode 100644 index 4d1ddfc7..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,6 +0,0 @@ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js deleted file mode 100644 index 5d482f07..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_transform.js") diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js b/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js deleted file mode 100644 index e1e9efdf..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_writable.js") diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/package.json b/Associations/node_modules/mongoose/node_modules/mongodb/package.json deleted file mode 100644 index d0247d0d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "mongodb", - "version": "2.0.46", - "description": "MongoDB legacy driver emulation layer on top of mongodb-core", - "main": "index.js", - "repository": { - "type": "git", - "url": "git@github.com:mongodb/node-mongodb-native.git" - }, - "keywords": [ - "mongodb", - "driver", - "legacy" - ], - "dependencies": { - "mongodb-core": "1.2.19", - "readable-stream": "1.0.31", - "es6-promise": "2.1.1" - }, - "devDependencies": { - "integra": "0.1.8", - "optimist": "0.6.1", - "bson": "~0.4", - "jsdoc": "3.3.0-beta3", - "semver": "4.1.0", - "rimraf": "2.2.6", - "gleak": "0.5.0", - "mongodb-version-manager": "^0.8.8", - "mongodb-tools": "~1.0", - "co": "4.5.4", - "bluebird": "2.9.27" - }, - "author": { - "name": "Christian Kvalheim" - }, - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/mongodb/node-mongodb-native/issues" - }, - "scripts": { - "test": "node test/runner.js -t functional" - }, - "homepage": "https://github.com/mongodb/node-mongodb-native", - "gitHead": "ba3cf959d728f7b0c86d3ef439b729a155d5c175", - "_id": "mongodb@2.0.46", - "_shasum": "b1b857465e45e259b1e0e033698341a64cb93559", - "_from": "mongodb@2.0.46", - "_npmVersion": "2.14.7", - "_nodeVersion": "4.2.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "b1b857465e45e259b1e0e033698341a64cb93559", - "tarball": "http://registry.npmjs.org/mongodb/-/mongodb-2.0.46.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.0.46.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/t.js b/Associations/node_modules/mongoose/node_modules/mongodb/t.js deleted file mode 100644 index af73362c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/t.js +++ /dev/null @@ -1,73 +0,0 @@ -var MongoClient = require('./').MongoClient - , assert = require('assert') - , cappedCollectionName = "capped_test"; - - -function capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); -} - - function createTailedCursor(db, callback) { - var collection = db.collection(cappedCollectionName) - , cursor = collection.find({}, { tailable: true, awaitdata: true, numberOfRetries: Number.MAX_VALUE}) - , stream = cursor.stream() - , statusGetters = ['notified', 'closed', 'dead', 'killed']; - - console.log('After stream open'); - statusGetters.forEach(function (s) { - var getter = 'is' + capitalizeFirstLetter(s); - console.log("cursor " + getter + " => ", cursor[getter]()); - }); - - - stream.on('error', callback); - stream.on('end', callback.bind(null, 'end')); - stream.on('close', callback.bind(null, 'close')); - stream.on('readable', callback.bind(null, 'readable')); - stream.on('data', callback.bind(null, null, 'data')); - - console.log('After stream attach events'); - statusGetters.forEach(function (s) { - var getter = 'is' + capitalizeFirstLetter(s); - console.log("cursor " + getter + " => ", cursor[getter]()); - }); - } - - function cappedStreamEvent(err, evName, data) { - if (err) { - console.log("capped stream got error", err); - return; - } - - if (evName) { - console.log("capped stream got event", evName); - } - - if (data) { - console.log("capped stream got data", data); - } - } - - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - db.createCollection(cappedCollectionName, - { "capped": true, - "size": 100000, - "max": 5000 }, - function(err, collection) { - - assert.equal(null, err); - console.log("Created capped collection " + cappedCollectionName); - - createTailedCursor(db, cappedStreamEvent); - }); - - - //db.close(); -}); \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/t1.js b/Associations/node_modules/mongoose/node_modules/mongodb/t1.js deleted file mode 100644 index 0e25aaf0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/t1.js +++ /dev/null @@ -1,101 +0,0 @@ -var MongoClient = require('./').MongoClient; - -MongoClient.connect('mongodb://localhost:31000/test?rs_name=rs', function (err, db) { - var collection = db.collection('test'); - - setInterval(function() { - console.dir(db.serverConfig.s.replset.s.replState.arbiters[0].connections().length) - }, 1000); - - // db.close(); - // collection.insertMany([{a:1}, {a:2}], {w:1}, function (err, docs) { - // if (err) { - // console.log("ERROR"); - // } - - // collection.find().sort({'a': -1}).toArray(function(err, items) { - // if (err) { - // console.log("ERROR"); - // } - // console.log("Items: ", items); - // }); - // }); -}); - -// var MongoClient = require('./').MongoClient; - -// MongoClient.connect('mongodb://localhost:27017/page-testing', function (err, db) { -// collection = db.collection('test'); - -// collection.insertMany([{a:1}, {a:2}], {w:1}, function (err, docs) { -// if (err) { -// console.log("ERROR"); -// } - -// collection.find().sort({'a': -1}).toArray(function(err, items) { -// if (err) { -// console.log("ERROR"); -// } -// console.log("Items: ", items); -// }); -// }); -// }); -// var database = null; -// -// var MongoClient = require('./').MongoClient; -// -// function connect_to_mongo(callback) { -// if (database != null) { -// callback(null, database); -// } else { -// var connection = "mongodb://127.0.0.1:27017/test_db"; -// MongoClient.connect(connection, { -// server : { -// reconnectTries : 5, -// reconnectInterval: 1000, -// autoReconnect : true -// } -// }, function (err, db) { -// database = db; -// callback(err, db); -// }); -// } -// } -// -// function log(message) { -// console.log(new Date(), message); -// } -// -// var queryNumber = 0; -// -// function make_query(db) { -// var currentNumber = queryNumber; -// ++queryNumber; -// log("query " + currentNumber + ": started"); -// -// setTimeout(function() { -// make_query(db); -// }, 5000); -// -// var collection = db.collection('test_collection'); -// collection.findOne({}, -// function (err, result) { -// if (err != null) { -// log("query " + currentNumber + ": find one error: " + err.message); -// return; -// } -// log("query " + currentNumber + ": find one result: " + result); -// } -// ); -// } -// -// connect_to_mongo( -// function(err, db) { -// if (err != null) { -// log(err.message); -// return; -// } -// -// make_query(db); -// } -// ); diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/boot.sh b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/boot.sh deleted file mode 100644 index 29c78163..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/boot.sh +++ /dev/null @@ -1,3 +0,0 @@ -mongod --verbose --smallfiles --noprealloc --setParameter enableTestCommands=1 \ ---port 39000 --dbpath ./data --sslMode allowSSL --sslCAFile ./ca.pem \ ---sslPEMKeyFile ./server_password.pem --sslPEMKeyPassword serverpassword --nojournal \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/ca.pem b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/ca.pem deleted file mode 100644 index 30bf3f77..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/ca.pem +++ /dev/null @@ -1,49 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDmDCCAoCgAwIBAgIDCZNjMA0GCSqGSIb3DQEBBQUAMHUxEjAQBgNVBAMTCWxv -Y2FsaG9zdDEVMBMGA1UECxMMSW50ZWdyYXRpb25zMRAwDgYDVQQKEwdNb25nb0RC -MRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazELMAkG -A1UEBhMCVVMwHhcNMTUxMDA1MTgwNzUyWhcNMzUxMDA1MTgwNzUyWjB1MRIwEAYD -VQQDEwlsb2NhbGhvc3QxFTATBgNVBAsTDEludGVncmF0aW9uczEQMA4GA1UEChMH -TW9uZ29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlv -cmsxCzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -hmVxb75ocS+U3gN9YFFVWayHNUX+YbIEt2a/GwBd2IGF+gCtUVZgnQy+Sd1ElDrE -WO4SesU5zcsSdDdFQTzc73Pd6nyQ68WIr67w+W++EBF4y3ZSpRT8S1kjOWvh4UI4 -enf/hf0eHsrcXZUNS5UfjGmAeXp11OBgc6kFXMrOqvkb8QnA7us1BkJHbLCBc11H -FUFQNY62J6EZ2AWjYsRRBA8C+5POIdlA4d0rD+4WrqoV/hP7Jry4lNOvRjy8POgR -0nUu30XNuk33Qew4OvpqbFjxHfyivvrq242BJaj8aZR0KTJx4pNaCTpGexT6JQwg -1wZ3GtLWg42mWcYUcp7NkwIDAQABozEwLzAMBgNVHRMEBTADAQH/MB8GA1UdEQQY -MBaCCWxvY2FsaG9zdIIJMTI3LjAuMC4xMA0GCSqGSIb3DQEBBQUAA4IBAQACrNA2 -S6DGjp+18w+PiJzTcdgMnwMZzuLhDXrFtnndxT5BybsNNkY4QllGZCceRsqy4U78 -Lm54qHGKVATblH68t+Cg2gYpMOBnL6we/B1fl845CCLWnVGWRIYDQvjMS4TMQeAQ -kgkB1VNujUibUncJ6V1Dz9W2Fm1lwwxO3vJgLyfq1pHHvOpryLRUE8dt6VnuVRvE -mPdIBiLThLw12SV6ID2bU4ueomrSGztrqU8JJCLNaLtPZYdEcrEEmGRurk1vdK60 -ETxs1UnnpctCTLq03+iw/MQzvNpvbsKvim6i/p6Txi+16I9Xo9uSilpXeiI8NF+M -QiwvYpMwBAsBDPFY ------END CERTIFICATE----- ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAhmVxb75ocS+U3gN9YFFVWayHNUX+YbIEt2a/GwBd2IGF+gCt -UVZgnQy+Sd1ElDrEWO4SesU5zcsSdDdFQTzc73Pd6nyQ68WIr67w+W++EBF4y3ZS -pRT8S1kjOWvh4UI4enf/hf0eHsrcXZUNS5UfjGmAeXp11OBgc6kFXMrOqvkb8QnA -7us1BkJHbLCBc11HFUFQNY62J6EZ2AWjYsRRBA8C+5POIdlA4d0rD+4WrqoV/hP7 -Jry4lNOvRjy8POgR0nUu30XNuk33Qew4OvpqbFjxHfyivvrq242BJaj8aZR0KTJx -4pNaCTpGexT6JQwg1wZ3GtLWg42mWcYUcp7NkwIDAQABAoIBAAONQsY1PgVfwItt -hC67d4n7KUebJfHnBoDiUkKga9qA8c19nxb7NWpxH8ZL9rgEJZREFnDwLWrm5wHz -Q/1JYn1hjofX6uyQN+CMuwmcjmVWUN7vrZd3SoOjQ28NDtcpLNzvtu0Pl3Aw5EoE -2mkY89B+KUsMlXiexW3JFb8yDOwvx1HRSS5XX1uX8q7oyGt+J+p7b8Y029D09TdE -qflOQnimE83SKpCvsmMQsFFGBe+1aazTSQbsCWyrSe/Hucmbhj4I8HqO9KxIQGV4 -yrB2hqisC1OMcmYKNnNboGD4Cv/FH5QIjhmIfYxsmVQXjBN6TDV/NvWzoN10YkO/ -Ivn4XEECgYEA0MZRdQmXrZ31yPdC63SjTGPD3hrj+UnQs09PffOqblMcJyz+Xxtc -BdOUi4yM1jFdgAOlWJs6RH9Jbv1sbPekcuDtIOeIa6pK/WrlGJVVjUshshXKfvf3 -BKyaLI13ydo+4yJx8IqYnnzUhh1XTxq9oZOg/Qji0z3A50eGHeJjNlsCgYEApMwI -2dg8z7CH3v9DHe+QrlTDd8YHQs5T7B4DabmPknIypNaR1EtT+2L3IBwpM9FZY2S1 -5jWf9qPrav17iGwXTR/ElD/z46c6c2Cbfz1osFC0lgCLIHQnTNMA968wBRAz9ovB -9rBHujsVFf3VStCbZw2uIUBC/vlY6HAMH8kWmykCgYEAlu1n4eZHYtn434nxNOqj -SwwsgxqJiKRWXeqOGw3WPd+TULb0Rakvw36Lur6m6gnSAEOiewXs/6vNWJGYmsYE -epAknU8EjmETyVRHvpfmuzh/aZDbTSLRzu1An8i9uo0uPWGfYTew0ZKIyVPY1HUO -dgqVrZeI8xGHrStFx8Dr3FUCgYEAmeOKVFtQFiXkC0JVW4wNkC3JRnye5SylQ7WX -PFAymO+ZCULxdMxPBU4aNVr2wtO45E70aaAj236g5Q0GIZPGgpeqy0GZLzpHI9zP -+BbRPuxuZjDluo2c8WmM2r42WlQSIiXKH+HnaSmo/BtH5RA+PhKRS62lolIYSx3u -xHPUb1kCgYEAsHdcgO/uu2xYFKGTA4REoDZFhZ1BFPFcEOJfppXOs/u8/jfQqoIg -BMtspjqQv4BNhEE8T9ant6W6KZDGjE72/DI/Ei9a2260Ef3suUnYzFXRZTIy1/uz -U3SLb99bl60sUMxo2mYCn7mwgaFr0n+EFRKHcMPV6RfHVZO//VqCvmA= ------END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client.pem b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client.pem deleted file mode 100644 index b74742e6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client.pem +++ /dev/null @@ -1,48 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDhDCCAmygAwIBAgIDBigQMA0GCSqGSIb3DQEBBQUAMHUxEjAQBgNVBAMTCWxv -Y2FsaG9zdDEVMBMGA1UECxMMSW50ZWdyYXRpb25zMRAwDgYDVQQKEwdNb25nb0RC -MRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazELMAkG -A1UEBhMCVVMwHhcNMTUxMDA1MTgxMDE2WhcNMzUxMDA1MTgxMDE2WjBvMRIwEAYD -VQQDEwlsb2NhbGhvc3QxDzANBgNVBAsTBktlcm5lbDEQMA4GA1UEChMHTW9uZ29E -QjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsxCzAJ -BgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArstPxdOf -/QkCW85DOV5BMAAtjzdccONRlS4X7I0Jf96BkZmO1xXHQDJIdFZ7ejFc3HAUwIvH -HMT4PRmlFDXKfvdRSBgzOWm7KBCWHj9P+pZWtGB82W1/8nn6mIlucfAeS5QoUd0T -8Oxgm7yyPTTpPLO3OnhlihEvtrxsp7AJ8qsB3OCTpX2W3dm4wYS/PwOGFrGvz/GY -h+mgZBXVuk3jkl+qPadNJaoaRE01COCWXWP90G9/iSjcXs7RhHDWD6PA9NRxYgCO -bmzrEdrRViA5X70LuAy2NoitxVDzClzJeSrUwV1PfsPa9/hG0yDhCPW6FayoqZ7g -eSl0LR4rlCm8zQIDAQABoyMwITAfBgNVHREEGDAWgglsb2NhbGhvc3SCCTEyNy4w -LjAuMTANBgkqhkiG9w0BAQUFAAOCAQEAO6sdYHpgQT4ADqWDcRysLKk8QYAoIcx7 -Z14bplQ+xHVuDGzgzAoQhoVGCNXYYgkvlB7z/1bdDCBkjIeVLkC4W9p/x8RZdKK8 -rd7vxiBBfXSZzFxHZP9fY1k0r0/oWYGqelstCllOQ9s1SXQU+AbHxPtQ+2xABf0a -Pk71TymsNTNPx+ZqcP0OBZDNHaGYmy7QHo5/J+c7dNRUIRdB/sQmf20I2+/TaZVq -otBRw4dWp4X7wqtlYwnK0K12ujb7O5xoB6IjiYibpof455fTFg8SLW/lT9+NFjoV -78EhJ53vt+rdidLDZlme+GyJ6tZZajYYkZniOph8kLflDZ5yzU5ZIA== ------END CERTIFICATE----- ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEArstPxdOf/QkCW85DOV5BMAAtjzdccONRlS4X7I0Jf96BkZmO -1xXHQDJIdFZ7ejFc3HAUwIvHHMT4PRmlFDXKfvdRSBgzOWm7KBCWHj9P+pZWtGB8 -2W1/8nn6mIlucfAeS5QoUd0T8Oxgm7yyPTTpPLO3OnhlihEvtrxsp7AJ8qsB3OCT -pX2W3dm4wYS/PwOGFrGvz/GYh+mgZBXVuk3jkl+qPadNJaoaRE01COCWXWP90G9/ -iSjcXs7RhHDWD6PA9NRxYgCObmzrEdrRViA5X70LuAy2NoitxVDzClzJeSrUwV1P -fsPa9/hG0yDhCPW6FayoqZ7geSl0LR4rlCm8zQIDAQABAoIBABFYHT9NA3gRN8my -Sttbbe58Zgjq/mI5PDQoUbloOUQV6RdwfEr9XzsQgj4BAtmaIlPBT13XwNcq+FLf -w5Cg0coNcmRL+nE8+5Q7KRoxQBdmaY4WcO0GP4bo8aPHJ01o/SiUt/d/j2X9nox1 -id4m7OnYD1te7PxpPinMwp9VCXeptDZK0m052lB0ZjvVSC8onSZtqE03o6x9Gagv -cKqwuPVGECt8081j4ev8BnvmzsdtEtXi1+GB4PCjTSroZIJXj0L+TUQStd9fFp37 -poMqzrCMTohyDvZ6GlrdDJhHP9HZkUCORvNlqKjMWgbfNCeId1oaAAf9QUMjgFT2 -3tsAWWECgYEA5NzSj7LNSnohKKkCq3lPEKpmVPMFwOrK5y/XMhl6x1ftYP/YRkEx -43aO8D9VHJdXCwxVhUc/iyP9YjIMlhvUa+HEX66mpGtWUO1rU51EyMCa+XEHnFtB -1SaEgOfHlJYl/52o30oGPpQ1cCV4GTpreQz2lo0GOK+rw9cI0auD2MUCgYEAw4U6 -53vyznG1Ek+PvJj+GeT1yGy6rYamkkJprCplIl6flFS4Vybuu/I87nWkuN5smTV9 -Tuu/ae56ILLlZQvIBphqAuJQ+uWky07mwH6pNsc/ZW3Z8HYaNhPbx9zAvfT0aaoK -q5VcfdzaElld3Xf8+O6Ex1rxBe+leEKWy5CTxGkCgYEAzQLu7+CYu5WprHWxuY9i -fyhVoNVOGyF4fx5A5FUkwfuG3jRxNYXjPcKPirEA+iqrw27aERjg2DB2I4d39OOb -JsTIF3opNvIcEUSMtwsTec3nRXm1+p9Y2qq1WY/HHdhe05sUkmkKLPaw4/P8oITP -j1FId1Z+8zqSYE15TfEZm40CgYEAumQvhHBgR7iUoxEf+O5tByiDuv8Uc8qyzynq -7Ys5AKvuO40Mc2EVJC1JMxcJ4oeARgp9HBiYURdcbAG/uDWkCc2Q+pDgHF+CW6Mr -TgUxsZv+7uXrZ1ZfpIAH/J+RS0XTH0xQgcSQ+Rfq+KUjW7dAfdt8z0P+E+ei+mOY -uBVrGUkCgYBsL8E68LZBRjtOfgwJz6lNalkgZdeexcnNiQ9O5qrElRrY8nh2Ds98 -ifNsqD3f+fFp0PPSGymqeWl7R7rjCTpUvpuo2bFR7ctpV36cT40enKKq3Sw1sgCb -gRkQqjjNqYu+tHKXpQbKXh1zKW/o2Hkls+r8H/F3N7q0ujZ8ADbnYw== ------END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client_password.pem b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client_password.pem deleted file mode 100644 index 021e59b9..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/client_password.pem +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDhDCCAmygAwIBAgIDCXYCMA0GCSqGSIb3DQEBBQUAMHUxEjAQBgNVBAMTCWxv -Y2FsaG9zdDEVMBMGA1UECxMMSW50ZWdyYXRpb25zMRAwDgYDVQQKEwdNb25nb0RC -MRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazELMAkG -A1UEBhMCVVMwHhcNMTUxMDA1MTgxNTU5WhcNMzUxMDA1MTgxNTU5WjBvMRIwEAYD -VQQDEwlsb2NhbGhvc3QxDzANBgNVBAsTBktlcm5lbDEQMA4GA1UEChMHTW9uZ29E -QjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsxCzAJ -BgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAta9xPfZM -/1BOGOb4Q370yEXBzbbZozUvrk8DddhoGPNtbIsQZqsgLltfipjOOdk2I0hQlIxl -lzVY6lEj4DQgji2N7v36ncTv0zPPfkCA8bCqQkRqps8rOiai9m/IzAHf0Xn1BQeT -T+nloK5lVja0cMObSIz03BH+fjoG7hokdkwdouzmnJD+/sBxFlf5viFILeqkp6cs -ig74hDecCrjSNg4ggOj2ovZT06AklLLHCqfKxJFTfbbU3bC2WSBDbEEEFx+wBdo4 -PQFP/Tb8m0azVhvHQcZfPCpau5chzfvZNeUyzFGZ18hzevC1xOMyCkYMPaCISHdC -/tBd2PSWZUZJdwIDAQABoyMwITAfBgNVHREEGDAWgglsb2NhbGhvc3SCCTEyNy4w -LjAuMTANBgkqhkiG9w0BAQUFAAOCAQEAHSu12dUtCLepzr6ORukco5PdIUdQNFsX -KYc9kcTdriSP/b0K8cqAOBM13f/kLJDlnWh7ztkMqkBTl3ERxxPxNWamxknFoZxd -pECOTH4AEB2vyrQ9T8HXuv21pZsJM00d+hf1Ye89MzdXz72T3m8t+djkFFCdLXDI -f47CA+7WX1L2+426J2VnEsoRRcN0zCMtUj2XqE/wy+ASUOpLDwAHxstOcMZETLX8 -6PTZ3+vKIc00xL2H9A/4RjQXMHEovwtANZdtYX1uWK5Xz2Eq081/KqnpNoKZe/rr -b6dF0JbkYq3J+BI/OOjJWOpHgUKWg3I6aosw6g6MJ+xsGImplF1DtQ== ------END CERTIFICATE----- ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIFHzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQIkyaQoZbRA4sCAggA -MB0GCWCGSAFlAwQBAgQQhq07PWgmZVtZv7vehsHg3wSCBNDcvkYZfWfS8YqnyxzO -r+OaYFQKysdRrnHHqYZNwuSd8Piobau203jQvRvYtk90BwNso9joBU1f5B3FASJg -33rkE0Ls/XmVSpRnRRDRbMos/xAjoQAmer6c4mFFpPN8Dk5DEPbu8U5mH4vxn68Q -WyoXw7xxyAr586nykShRA00vE900Zhi+ajt4McU55CR46WwYkT4rciUpWpIpBUct -VXjZJiz8DAvUnVFR6ALmCMrOT17CQNoQwCjOX944myRwJCqijsnwl8BD+km0H6/J -7lUpQpIyIgFOhHk5f/VJEVeMdiVpohXTFRglkzuj/TNGqW05W9USJ/w3RoSIz/OV -HmhErNpkODejwcVmEtQIFSJkiKWGgDdoY0W/a/OKhvk0vQtwb9X3aVN84EFwinks -olBMmTJ/zRla61Or91KYchu5jSd2CPA3u+vqDuKMkavMYPTFg2RyrH/8FrPvr8EL -aLQjqY8pgaw4mIidljlhQAYAgfaJFxkbRHQBKdWXSbRQEk0fQuQfgXL7wA5RKl2R -RsP0ZkxsDmpyb9drR1yyLAeWVDRx1QkEbgZqku1I+lpKnUT/n1Kmi2mb0CdV61T7 -vt2T4em1Yj2Qff9IUhEdCfDKF1AYWYnA6wPgE3DUuVZ+WXh+21s5WvMbWe9II9kT -i3ZMLmCXr9B3x7nGdY4DBmW3XX/23pPIDX7h03eyJezHZDNa/LYho6RP17WDnJCr -ExfpQ6Vabq19vTDl5YWIaTIJsBKRjkUZrJNgRpgSUl5sUQtOlL1BL6+kr4cACd43 -jba9HNivQ3RslSj6d3mhqsxv0XfrOaJmkoSNL7UJ3JblRfyUQhxOeBtQowaNE67d -omYz7PcyJcKNtDTpwpKpj0tGQ7gva+EtKHr+ZkCuHUC5Rbl2bhhWIn8YR2ptm9s6 -eieBv4beS7jd9L+dBTibYeWtqVyO5P9OKrDXn4FPyu5H6Wd9ajk8tkYrPm32l3t3 -Zrn943LWaxDYHYr9/72HzY+0LAoy3bTayNqWvVWod7VKoy/I++z21CzodWOlWDCy -XExhQDmlCcXAuY7dxYObXhjdygaflPkLlF9Rm/akJrMi9jKrvY6cM8WJpNAK3Zv9 -O+p9owg8rpuADoTEREiE6AgWfWOLeySMTs+Zt96sg6z2e5JyFhuU0FAlLqZGz2pX -4jNEc0/a5hX1COETuaWd5RngLXn1vCmPnfDqfr22UTk+YkxOxRT3ZbF53D9o5vli -c+on9dDYChEg7Uoxt4a51RsTWGMZfhtmIjiVd8mRCZr4hhrCJqPh4lUJ3qIJQtrO -omaV0JTFjpU0AhRzMt+RgITgM2ESmxE53FAT1E+zsySUKh/+/mPoeQ3eQDoDDf+q -nx9qLlvHrtd9eo2FfaWLyXWNN9KYNSCJ7u58s4Uz5+1a11+riy7I6hFPfnErFa0F -KAyUf7mvHATO1gFre9ILBnZzJ46QlWbMQE11d1ZfJM8st1nmNg+wHkzDoFTVi49F -nZu8pGZtkTQqrdzNhmjdVMXOzU0FfnxRuX2/iT+KmyfibzcE0gPQRoQia3FpI2rY -4FBmFMovgsehjjIWQkvBkbLQxGDmQgvXy1MAfA23XrMh1dvIYgEP+lotxNjtbk8M -KPll2OWzO0tXaj+OTreP/C5JTQ== ------END ENCRYPTED PRIVATE KEY----- \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/connect.js b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/connect.js deleted file mode 100644 index 912cbfa4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/connect.js +++ /dev/null @@ -1,29 +0,0 @@ -var MongoClient = require('../').MongoClient, - fs = require('fs'); - -var cert = fs.readFileSync(__dirname + "/client.pem"); -var ca = fs.readFileSync(__dirname + "/ca.pem"); -var key = fs.readFileSync(__dirname + "/client_password.pem"); - -var options = { - server: { - sslValidate: false, - sslCert: cert, - sslKey: cert - } -} - -// var options = { uri_decode_auth: true, -// db: {}, -// server: -// { sslCA: '-----BEGIN CERTIFICATE-----\nMIIDmDCCAoCgAwIBAgIDCZNjMA0GCSqGSIb3DQEBBQUAMHUxEjAQBgNVBAMTCWxv\nY2FsaG9zdDEVMBMGA1UECxMMSW50ZWdyYXRpb25zMRAwDgYDVQQKEwdNb25nb0RC\nMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazELMAkG\nA1UEBhMCVVMwHhcNMTUxMDA1MTgwNzUyWhcNMzUxMDA1MTgwNzUyWjB1MRIwEAYD\nVQQDEwlsb2NhbGhvc3QxFTATBgNVBAsTDEludGVncmF0aW9uczEQMA4GA1UEChMH\nTW9uZ29EQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlv\ncmsxCzAJBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA\nhmVxb75ocS+U3gN9YFFVWayHNUX+YbIEt2a/GwBd2IGF+gCtUVZgnQy+Sd1ElDrE\nWO4SesU5zcsSdDdFQTzc73Pd6nyQ68WIr67w+W++EBF4y3ZSpRT8S1kjOWvh4UI4\nenf/hf0eHsrcXZUNS5UfjGmAeXp11OBgc6kFXMrOqvkb8QnA7us1BkJHbLCBc11H\nFUFQNY62J6EZ2AWjYsRRBA8C+5POIdlA4d0rD+4WrqoV/hP7Jry4lNOvRjy8POgR\n0nUu30XNuk33Qew4OvpqbFjxHfyivvrq242BJaj8aZR0KTJx4pNaCTpGexT6JQwg\n1wZ3GtLWg42mWcYUcp7NkwIDAQABozEwLzAMBgNVHRMEBTADAQH/MB8GA1UdEQQY\nMBaCCWxvY2FsaG9zdIIJMTI3LjAuMC4xMA0GCSqGSIb3DQEBBQUAA4IBAQACrNA2\nS6DGjp+18w+PiJzTcdgMnwMZzuLhDXrFtnndxT5BybsNNkY4QllGZCceRsqy4U78\nLm54qHGKVATblH68t+Cg2gYpMOBnL6we/B1fl845CCLWnVGWRIYDQvjMS4TMQeAQ\nkgkB1VNujUibUncJ6V1Dz9W2Fm1lwwxO3vJgLyfq1pHHvOpryLRUE8dt6VnuVRvE\nmPdIBiLThLw12SV6ID2bU4ueomrSGztrqU8JJCLNaLtPZYdEcrEEmGRurk1vdK60\nETxs1UnnpctCTLq03+iw/MQzvNpvbsKvim6i/p6Txi+16I9Xo9uSilpXeiI8NF+M\nQiwvYpMwBAsBDPFY\n-----END CERTIFICATE-----\n-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEAhmVxb75ocS+U3gN9YFFVWayHNUX+YbIEt2a/GwBd2IGF+gCt\nUVZgnQy+Sd1ElDrEWO4SesU5zcsSdDdFQTzc73Pd6nyQ68WIr67w+W++EBF4y3ZS\npRT8S1kjOWvh4UI4enf/hf0eHsrcXZUNS5UfjGmAeXp11OBgc6kFXMrOqvkb8QnA\n7us1BkJHbLCBc11HFUFQNY62J6EZ2AWjYsRRBA8C+5POIdlA4d0rD+4WrqoV/hP7\nJry4lNOvRjy8POgR0nUu30XNuk33Qew4OvpqbFjxHfyivvrq242BJaj8aZR0KTJx\n4pNaCTpGexT6JQwg1wZ3GtLWg42mWcYUcp7NkwIDAQABAoIBAAONQsY1PgVfwItt\nhC67d4n7KUebJfHnBoDiUkKga9qA8c19nxb7NWpxH8ZL9rgEJZREFnDwLWrm5wHz\nQ/1JYn1hjofX6uyQN+CMuwmcjmVWUN7vrZd3SoOjQ28NDtcpLNzvtu0Pl3Aw5EoE\n2mkY89B+KUsMlXiexW3JFb8yDOwvx1HRSS5XX1uX8q7oyGt+J+p7b8Y029D09TdE\nqflOQnimE83SKpCvsmMQsFFGBe+1aazTSQbsCWyrSe/Hucmbhj4I8HqO9KxIQGV4\nyrB2hqisC1OMcmYKNnNboGD4Cv/FH5QIjhmIfYxsmVQXjBN6TDV/NvWzoN10YkO/\nIvn4XEECgYEA0MZRdQmXrZ31yPdC63SjTGPD3hrj+UnQs09PffOqblMcJyz+Xxtc\nBdOUi4yM1jFdgAOlWJs6RH9Jbv1sbPekcuDtIOeIa6pK/WrlGJVVjUshshXKfvf3\nBKyaLI13ydo+4yJx8IqYnnzUhh1XTxq9oZOg/Qji0z3A50eGHeJjNlsCgYEApMwI\n2dg8z7CH3v9DHe+QrlTDd8YHQs5T7B4DabmPknIypNaR1EtT+2L3IBwpM9FZY2S1\n5jWf9qPrav17iGwXTR/ElD/z46c6c2Cbfz1osFC0lgCLIHQnTNMA968wBRAz9ovB\n9rBHujsVFf3VStCbZw2uIUBC/vlY6HAMH8kWmykCgYEAlu1n4eZHYtn434nxNOqj\nSwwsgxqJiKRWXeqOGw3WPd+TULb0Rakvw36Lur6m6gnSAEOiewXs/6vNWJGYmsYE\nepAknU8EjmETyVRHvpfmuzh/aZDbTSLRzu1An8i9uo0uPWGfYTew0ZKIyVPY1HUO\ndgqVrZeI8xGHrStFx8Dr3FUCgYEAmeOKVFtQFiXkC0JVW4wNkC3JRnye5SylQ7WX\nPFAymO+ZCULxdMxPBU4aNVr2wtO45E70aaAj236g5Q0GIZPGgpeqy0GZLzpHI9zP\n+BbRPuxuZjDluo2c8WmM2r42WlQSIiXKH+HnaSmo/BtH5RA+PhKRS62lolIYSx3u\nxHPUb1kCgYEAsHdcgO/uu2xYFKGTA4REoDZFhZ1BFPFcEOJfppXOs/u8/jfQqoIg\nBMtspjqQv4BNhEE8T9ant6W6KZDGjE72/DI/Ei9a2260Ef3suUnYzFXRZTIy1/uz\nU3SLb99bl60sUMxo2mYCn7mwgaFr0n+EFRKHcMPV6RfHVZO//VqCvmA=\n-----END RSA PRIVATE KEY-----', -// sslCert: '-----BEGIN CERTIFICATE-----\nMIIDhDCCAmygAwIBAgIDBigQMA0GCSqGSIb3DQEBBQUAMHUxEjAQBgNVBAMTCWxv\nY2FsaG9zdDEVMBMGA1UECxMMSW50ZWdyYXRpb25zMRAwDgYDVQQKEwdNb25nb0RC\nMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazELMAkG\nA1UEBhMCVVMwHhcNMTUxMDA1MTgxMDE2WhcNMzUxMDA1MTgxMDE2WjBvMRIwEAYD\nVQQDEwlsb2NhbGhvc3QxDzANBgNVBAsTBktlcm5lbDEQMA4GA1UEChMHTW9uZ29E\nQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsxCzAJ\nBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArstPxdOf\n/QkCW85DOV5BMAAtjzdccONRlS4X7I0Jf96BkZmO1xXHQDJIdFZ7ejFc3HAUwIvH\nHMT4PRmlFDXKfvdRSBgzOWm7KBCWHj9P+pZWtGB82W1/8nn6mIlucfAeS5QoUd0T\n8Oxgm7yyPTTpPLO3OnhlihEvtrxsp7AJ8qsB3OCTpX2W3dm4wYS/PwOGFrGvz/GY\nh+mgZBXVuk3jkl+qPadNJaoaRE01COCWXWP90G9/iSjcXs7RhHDWD6PA9NRxYgCO\nbmzrEdrRViA5X70LuAy2NoitxVDzClzJeSrUwV1PfsPa9/hG0yDhCPW6FayoqZ7g\neSl0LR4rlCm8zQIDAQABoyMwITAfBgNVHREEGDAWgglsb2NhbGhvc3SCCTEyNy4w\nLjAuMTANBgkqhkiG9w0BAQUFAAOCAQEAO6sdYHpgQT4ADqWDcRysLKk8QYAoIcx7\nZ14bplQ+xHVuDGzgzAoQhoVGCNXYYgkvlB7z/1bdDCBkjIeVLkC4W9p/x8RZdKK8\nrd7vxiBBfXSZzFxHZP9fY1k0r0/oWYGqelstCllOQ9s1SXQU+AbHxPtQ+2xABf0a\nPk71TymsNTNPx+ZqcP0OBZDNHaGYmy7QHo5/J+c7dNRUIRdB/sQmf20I2+/TaZVq\notBRw4dWp4X7wqtlYwnK0K12ujb7O5xoB6IjiYibpof455fTFg8SLW/lT9+NFjoV\n78EhJ53vt+rdidLDZlme+GyJ6tZZajYYkZniOph8kLflDZ5yzU5ZIA==\n-----END CERTIFICATE-----\n-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEArstPxdOf/QkCW85DOV5BMAAtjzdccONRlS4X7I0Jf96BkZmO\n1xXHQDJIdFZ7ejFc3HAUwIvHHMT4PRmlFDXKfvdRSBgzOWm7KBCWHj9P+pZWtGB8\n2W1/8nn6mIlucfAeS5QoUd0T8Oxgm7yyPTTpPLO3OnhlihEvtrxsp7AJ8qsB3OCT\npX2W3dm4wYS/PwOGFrGvz/GYh+mgZBXVuk3jkl+qPadNJaoaRE01COCWXWP90G9/\niSjcXs7RhHDWD6PA9NRxYgCObmzrEdrRViA5X70LuAy2NoitxVDzClzJeSrUwV1P\nfsPa9/hG0yDhCPW6FayoqZ7geSl0LR4rlCm8zQIDAQABAoIBABFYHT9NA3gRN8my\nSttbbe58Zgjq/mI5PDQoUbloOUQV6RdwfEr9XzsQgj4BAtmaIlPBT13XwNcq+FLf\nw5Cg0coNcmRL+nE8+5Q7KRoxQBdmaY4WcO0GP4bo8aPHJ01o/SiUt/d/j2X9nox1\nid4m7OnYD1te7PxpPinMwp9VCXeptDZK0m052lB0ZjvVSC8onSZtqE03o6x9Gagv\ncKqwuPVGECt8081j4ev8BnvmzsdtEtXi1+GB4PCjTSroZIJXj0L+TUQStd9fFp37\npoMqzrCMTohyDvZ6GlrdDJhHP9HZkUCORvNlqKjMWgbfNCeId1oaAAf9QUMjgFT2\n3tsAWWECgYEA5NzSj7LNSnohKKkCq3lPEKpmVPMFwOrK5y/XMhl6x1ftYP/YRkEx\n43aO8D9VHJdXCwxVhUc/iyP9YjIMlhvUa+HEX66mpGtWUO1rU51EyMCa+XEHnFtB\n1SaEgOfHlJYl/52o30oGPpQ1cCV4GTpreQz2lo0GOK+rw9cI0auD2MUCgYEAw4U6\n53vyznG1Ek+PvJj+GeT1yGy6rYamkkJprCplIl6flFS4Vybuu/I87nWkuN5smTV9\nTuu/ae56ILLlZQvIBphqAuJQ+uWky07mwH6pNsc/ZW3Z8HYaNhPbx9zAvfT0aaoK\nq5VcfdzaElld3Xf8+O6Ex1rxBe+leEKWy5CTxGkCgYEAzQLu7+CYu5WprHWxuY9i\nfyhVoNVOGyF4fx5A5FUkwfuG3jRxNYXjPcKPirEA+iqrw27aERjg2DB2I4d39OOb\nJsTIF3opNvIcEUSMtwsTec3nRXm1+p9Y2qq1WY/HHdhe05sUkmkKLPaw4/P8oITP\nj1FId1Z+8zqSYE15TfEZm40CgYEAumQvhHBgR7iUoxEf+O5tByiDuv8Uc8qyzynq\n7Ys5AKvuO40Mc2EVJC1JMxcJ4oeARgp9HBiYURdcbAG/uDWkCc2Q+pDgHF+CW6Mr\nTgUxsZv+7uXrZ1ZfpIAH/J+RS0XTH0xQgcSQ+Rfq+KUjW7dAfdt8z0P+E+ei+mOY\nuBVrGUkCgYBsL8E68LZBRjtOfgwJz6lNalkgZdeexcnNiQ9O5qrElRrY8nh2Ds98\nifNsqD3f+fFp0PPSGymqeWl7R7rjCTpUvpuo2bFR7ctpV36cT40enKKq3Sw1sgCb\ngRkQqjjNqYu+tHKXpQbKXh1zKW/o2Hkls+r8H/F3N7q0ujZ8ADbnYw==\n-----END RSA PRIVATE KEY-----', -// sslKey: '-----BEGIN CERTIFICATE-----\nMIIDhDCCAmygAwIBAgIDBigQMA0GCSqGSIb3DQEBBQUAMHUxEjAQBgNVBAMTCWxv\nY2FsaG9zdDEVMBMGA1UECxMMSW50ZWdyYXRpb25zMRAwDgYDVQQKEwdNb25nb0RC\nMRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazELMAkG\nA1UEBhMCVVMwHhcNMTUxMDA1MTgxMDE2WhcNMzUxMDA1MTgxMDE2WjBvMRIwEAYD\nVQQDEwlsb2NhbGhvc3QxDzANBgNVBAsTBktlcm5lbDEQMA4GA1UEChMHTW9uZ29E\nQjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsxCzAJ\nBgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArstPxdOf\n/QkCW85DOV5BMAAtjzdccONRlS4X7I0Jf96BkZmO1xXHQDJIdFZ7ejFc3HAUwIvH\nHMT4PRmlFDXKfvdRSBgzOWm7KBCWHj9P+pZWtGB82W1/8nn6mIlucfAeS5QoUd0T\n8Oxgm7yyPTTpPLO3OnhlihEvtrxsp7AJ8qsB3OCTpX2W3dm4wYS/PwOGFrGvz/GY\nh+mgZBXVuk3jkl+qPadNJaoaRE01COCWXWP90G9/iSjcXs7RhHDWD6PA9NRxYgCO\nbmzrEdrRViA5X70LuAy2NoitxVDzClzJeSrUwV1PfsPa9/hG0yDhCPW6FayoqZ7g\neSl0LR4rlCm8zQIDAQABoyMwITAfBgNVHREEGDAWgglsb2NhbGhvc3SCCTEyNy4w\nLjAuMTANBgkqhkiG9w0BAQUFAAOCAQEAO6sdYHpgQT4ADqWDcRysLKk8QYAoIcx7\nZ14bplQ+xHVuDGzgzAoQhoVGCNXYYgkvlB7z/1bdDCBkjIeVLkC4W9p/x8RZdKK8\nrd7vxiBBfXSZzFxHZP9fY1k0r0/oWYGqelstCllOQ9s1SXQU+AbHxPtQ+2xABf0a\nPk71TymsNTNPx+ZqcP0OBZDNHaGYmy7QHo5/J+c7dNRUIRdB/sQmf20I2+/TaZVq\notBRw4dWp4X7wqtlYwnK0K12ujb7O5xoB6IjiYibpof455fTFg8SLW/lT9+NFjoV\n78EhJ53vt+rdidLDZlme+GyJ6tZZajYYkZniOph8kLflDZ5yzU5ZIA==\n-----END CERTIFICATE-----\n-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEArstPxdOf/QkCW85DOV5BMAAtjzdccONRlS4X7I0Jf96BkZmO\n1xXHQDJIdFZ7ejFc3HAUwIvHHMT4PRmlFDXKfvdRSBgzOWm7KBCWHj9P+pZWtGB8\n2W1/8nn6mIlucfAeS5QoUd0T8Oxgm7yyPTTpPLO3OnhlihEvtrxsp7AJ8qsB3OCT\npX2W3dm4wYS/PwOGFrGvz/GYh+mgZBXVuk3jkl+qPadNJaoaRE01COCWXWP90G9/\niSjcXs7RhHDWD6PA9NRxYgCObmzrEdrRViA5X70LuAy2NoitxVDzClzJeSrUwV1P\nfsPa9/hG0yDhCPW6FayoqZ7geSl0LR4rlCm8zQIDAQABAoIBABFYHT9NA3gRN8my\nSttbbe58Zgjq/mI5PDQoUbloOUQV6RdwfEr9XzsQgj4BAtmaIlPBT13XwNcq+FLf\nw5Cg0coNcmRL+nE8+5Q7KRoxQBdmaY4WcO0GP4bo8aPHJ01o/SiUt/d/j2X9nox1\nid4m7OnYD1te7PxpPinMwp9VCXeptDZK0m052lB0ZjvVSC8onSZtqE03o6x9Gagv\ncKqwuPVGECt8081j4ev8BnvmzsdtEtXi1+GB4PCjTSroZIJXj0L+TUQStd9fFp37\npoMqzrCMTohyDvZ6GlrdDJhHP9HZkUCORvNlqKjMWgbfNCeId1oaAAf9QUMjgFT2\n3tsAWWECgYEA5NzSj7LNSnohKKkCq3lPEKpmVPMFwOrK5y/XMhl6x1ftYP/YRkEx\n43aO8D9VHJdXCwxVhUc/iyP9YjIMlhvUa+HEX66mpGtWUO1rU51EyMCa+XEHnFtB\n1SaEgOfHlJYl/52o30oGPpQ1cCV4GTpreQz2lo0GOK+rw9cI0auD2MUCgYEAw4U6\n53vyznG1Ek+PvJj+GeT1yGy6rYamkkJprCplIl6flFS4Vybuu/I87nWkuN5smTV9\nTuu/ae56ILLlZQvIBphqAuJQ+uWky07mwH6pNsc/ZW3Z8HYaNhPbx9zAvfT0aaoK\nq5VcfdzaElld3Xf8+O6Ex1rxBe+leEKWy5CTxGkCgYEAzQLu7+CYu5WprHWxuY9i\nfyhVoNVOGyF4fx5A5FUkwfuG3jRxNYXjPcKPirEA+iqrw27aERjg2DB2I4d39OOb\nJsTIF3opNvIcEUSMtwsTec3nRXm1+p9Y2qq1WY/HHdhe05sUkmkKLPaw4/P8oITP\nj1FId1Z+8zqSYE15TfEZm40CgYEAumQvhHBgR7iUoxEf+O5tByiDuv8Uc8qyzynq\n7Ys5AKvuO40Mc2EVJC1JMxcJ4oeARgp9HBiYURdcbAG/uDWkCc2Q+pDgHF+CW6Mr\nTgUxsZv+7uXrZ1ZfpIAH/J+RS0XTH0xQgcSQ+Rfq+KUjW7dAfdt8z0P+E+ei+mOY\nuBVrGUkCgYBsL8E68LZBRjtOfgwJz6lNalkgZdeexcnNiQ9O5qrElRrY8nh2Ds98\nifNsqD3f+fFp0PPSGymqeWl7R7rjCTpUvpuo2bFR7ctpV36cT40enKKq3Sw1sgCb\ngRkQqjjNqYu+tHKXpQbKXh1zKW/o2Hkls+r8H/F3N7q0ujZ8ADbnYw==\n-----END RSA PRIVATE KEY-----' }, -// replSet: { connectWithNoPrimary: true }, -// mongos: {} } - -MongoClient.connect('mongodb://localhost:39000/test?ssl=true?', options, function(err) { - console.dir(err); - -}) - diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger deleted file mode 100644 index a8cda737..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger +++ /dev/null @@ -1,2 +0,0 @@ -WiredTiger -WiredTiger 2.6.2: (June 4, 2015) diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.lock b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.lock deleted file mode 100644 index 3d842068..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.lock +++ /dev/null @@ -1 +0,0 @@ -WiredTiger lock file diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.turtle b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.turtle deleted file mode 100644 index afb605dc..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.turtle +++ /dev/null @@ -1,6 +0,0 @@ -WiredTiger version string -WiredTiger 2.6.2: (June 4, 2015) -WiredTiger version -major=2,minor=6,patch=2 -file:WiredTiger.wt -allocation_size=4KB,app_metadata=,block_allocation=best,block_compressor=,cache_resident=0,checkpoint=(WiredTigerCheckpoint.41=(addr="018581e4c6553bd08681e44d72bf598981e42f54fd43808080e28fc0e3027fc0",order=41,time=1444229807,size=172032,write_gen=80)),checkpoint_lsn=(4294967295,9223372036854775807),checksum=uncompressed,collator=,columns=,dictionary=0,encryption=(keyid=,name=),format=btree,huffman_key=,huffman_value=,id=0,internal_item_max=0,internal_key_max=0,internal_key_truncate=,internal_page_max=4KB,key_format=S,key_gap=10,leaf_item_max=0,leaf_key_max=0,leaf_page_max=32KB,leaf_value_max=0,log=(enabled=),memory_page_max=5MB,os_cache_dirty_max=0,os_cache_max=0,prefix_compression=0,prefix_compression_min=4,split_deepen_min_child=0,split_deepen_per_child=0,split_pct=75,value_format=S,version=(major=1,minor=1) diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.wt b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTiger.wt deleted file mode 100644 index 3d2e3cdb56714ae559fd308c788f628dd9296ec3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 45056 zcmeI5OKjXk7{?vNqY_Bz0XS4btd`40a#P!D@2)Eu(ISwl5=vAGsz5Tc_H62A{iyA2 z8&Jin6)IB2fn&IFK%D3WA+9Sbap2NxZ;_&2=!Fv(PJH8idXwxnX_7YWe^X~Yv!3zH zZ|3iLWWTQ`?#)Ouk|fb z6R1+zXXy}YezE>HXFhu%&e#7v(!Sfd+gZ0eYn^sme2NzcfB*=900@8p2!H?xfB*=9 z00@A<0VVJ@mHTx%`s@E=C;$7ozy4pJ6&nC=X8*pXQ)~kq&_+hFK>!3m00ck)1V8`; zKmY_l00f>{0%v+PpLtD^j?no_&(p7hB+cDeT@&m7^G?`Yio;fP-1gnN?XZ+J!zHQx z1B)Wt=P7e3#wsR7LiJMtG)v(fX=Tyj(0CFQ{^%xXf3?DMi_yn?)9`QFOq3ELIB}M)klKG7Vogyo(cHF3ZRw{^%K4kt>4If@c%4<}Nh)_^ozRbBo+MeH zW6lL`Q^<39kXnjNL1#G%JqnDR+s!2Cg_D+VwSs;g+}*5xu9x*i7Ozl_JaFQbNEFs8 zQS*7OC5z^==H#vxta=)AE?;Oh8a@kby2Kg;F0*EfTQa3l4eAdmj|0}Uy_Ea5&#qGD zgE&gISyUQRSy?Lb=%7h74x5{oQVk(-<~M(>q{hxf^XgUrer z<(5TdW$u-QdYo0_0joE;OBMFHAI2;8Ad#_fQVtV(R)|J$y*TaHVG!A^B{f&WyK48L z3zUkyG1B(Ez|!R;YI>>davt$OMA^;-ujx{X+y@bl$3BRh)T$bCxBNXQi>F%h<=(@p z9MxK0Y}LNlbW=5QYC9Nm(;>IsykifC zukFa~yG(8q=Xz56&a2y1+8)kZA99G?$>6v_yLFwU%3KrLrOD^+&pp-3^61=i=krdH z(LPQ)X+F*OXXZI+q+H0Pn_D>1p!n-lsrD8?!|QgkEZSmvsg2Apbus$6Rc)D6P1*TwP|jXNoud=_7XNO)%v?0v{fZ$t7E%YBTMQ_W0PNLwR^iMbKJcw!8hF! zY(4Bt?T$LB{(CsSKQvcrQL!=7-??Z>?{#Z6d?HHiZ*!Fp4VCRqPHnRddDGq|ULXJh zAOHd&00JNY0wD0L5%{QA;c@?ehd)2}r}+E7@c(z?`u(-l`rpqQ8q^mAKmY_l00ck) z1V8`;KmY_l00f>o0y@>`6*|P4U-=-uhirA|EC|^z6JaLyki2`{|`MrZ1xrToP&qqm$qU55BvYF!9VQ( zgDp(6VE?~c9yMV9zYqR2wquYC`+wN~kGr(lhW{G4+eoeL$PM=Y0~a;(D(wF!IiG_4 zzwj3({C2?p-`c|de}jVDx~u68hkOBKzHlDV`%Ss$YHD}A-@yK#T)Yk3vBCbo>#`E| z{}Wtx!v6n2Zr`HNAOHd&00JNY0w4eaAh06>HA+Qa`yYJ&|Hd2Vj`hF)PyhMfY-io> jtic9gM{JP@1V8`;KmY_l00ck)1V8`;KmY_D7lHo)x+(^3 diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTigerLAS.wt b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/WiredTigerLAS.wt deleted file mode 100644 index 3f019cba9b5ed0b1a0275084adb91169387c9683..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4096 zcmeIuF%bYD32 diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/_mdb_catalog.wt b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/_mdb_catalog.wt deleted file mode 100644 index 97fa92265e53d46e998e44173c6975f4616c44f5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16384 zcmeI%F-yZh6bJB^q}AXcrIY9)xCxP@QPb5)UHl3qB!?bNo6uaPRflx)V<`9`oP;hS zbaCz0B7OovaP(ckO}a|u{~*10@0yqEZ@ctpYLG!hQ+wx;2LuEl009U<00Izz00bZa z0SG_<0{>V*zXQ;rI5Bx#t?);UX!d1I^jdXPj9-p9vpO+7bHVK9ROc~CqcGXaRoGMg ztd*qaWTlysDKBsEvK@t4CSo#bxx5lwxF@Q}ZY%~OryHJIE-5|anTY6wv)X0(Lc(f` zA+76qOY-fU@FT;HpekovYAx6S**y`)Lo)16KT%S5qWT4wbeEs7WIQ;HMOV=-m&~%| z7H8$=9M1_30ypp*`^`ho_x-^0nu~t4Da%&d+#pJmL`0gvaewW?-$6hC0uX=z1Rwwb z2tWV=5P$##{zO2Z`E~ew>3l^``22tN(7rCu|K#2lqxXq5z0)fQ2tWV=5P$##AOHaf zKmY;|fB*!RSfIgsU*oI%!=2Cn^QZZT&fh*ai`VgNTogP(KmY;|fB*y_009U<00Izz K00bbgR07{El4T(P diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/collection-0-757073248613337118.wt b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/collection-0-757073248613337118.wt deleted file mode 100644 index 528f2fef23a4d15811a380c84ef62cfb95fea226..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 36864 zcmeI4Uu+b|8Ng@HcgI=r*=Kw>mT}Eq+9Esl9=rGd90J&mQ$tO;3PeamvFCQ@&I^0H z$L`)?qdwSB2yKK=omNWQ)QTHbN@=O(r_h%)qA7CP2t=zQa8*iyM3qt@9{T5@lIb@D zC`GLVeslAUX7^@h=g;^3W_IpoZ@=liBoKiRaw+iHx8VaF5O3BYp)P5x1~~YdpRfNrCu&~e;cI_uojCvQ`FF1k!)aoIUqy!m zkN^@u0!RP}AOR$R1dsp{Kmter2`p0rS&+LCj(h9>8+yZs_tyW{8u$Z%HQeJ9fMwdh zC^iy60!RP}AOR$R1dsp{Kmter34FQ2y{} z6VIsSxF#(z@);=hNhLe8Bu8o;m)hhzm)c{@&+xgAp!q zbe&40WmY1d+`!f^vhh0?xD7;fox|)Zvxm#naSm9v7F|ocIa(VIlPBQv`o^bPHV{wA z(wJ{mht2j^benD8K176rZ!kAUZBWc*Hd({lVoszkFA)Fcs4 zQFnI+S6}LcvWa-QpysoxtjRIxEv9H`H671pv&ncS9V?`@WLzsywLrW8pkgowTCs@7 z_j(-#g?yLmoN>pE9Fq6aDs@y_FS`R~G4g(f8e)Al0$Lw`t94dNsU!zX738JE3&)Iu9&877D?}S z-r5GK&;g<#4G^wnPLX6qA1r2SBiBj!4xdL)Zg^H=V zFgO~Y^R0p*rdOe7q=L>2!3jW(*^k>Kje(9f6;eW>8XX%+YMF5NnyzG3 z;3!BouwWa0OngP((;=x!ZJi#jJrpSEj_{ALl((tMg2Q!Y#V`a(IsEw!+L3W}Q!25N zS}FtWv9Zq6-mb32(}Hx`3z454<9110H&cQ>b1N{dXfWhJ7YjzUVNs1~jjfwR$#J!3 z)vhi@As$0F_to~%2I+cszQgF2^17)FQ+HSx5Qzuonj&+D`@ZQ3whUShf%}74&KOJ_ zdEIr$rb#-Yv3#Wn2_-t#=UC>p{9dNI+x3HtUiAvzP+DWv$csCO zMIb@1>^v zvoCO9v&mj<>1Vd97xbBDKtN&flpp+=Q-1Q&C&9-(FP!p+4)fU`>Zr>qa{S6Ee_+?Q z-??51yNG6k4fWYABFQ*}%?up$c zFwhRoU1+-R%?nMWruhp^p&_eC!u5rE5k^Jca&&jRxw^9XRuh?6obxZiFU?t^QyGYQ=f8Dw7Nm$r)2Zy`*~P~2gMMvenEd<^)qE%$ z2Yie-l}sv`Se9%2TGOwlLH1bvjz}OAmoLvPjszd{?Qro=OVA36aK*lUZWhLEHl9jf z+aK|6_+T2+67?fN=*x!igTAjJ>}|YK|5LgB$%I!o7l)He@YBOd@(pM)oQB&un_Sov z^v-|v2OvSRN6zx`^Pe5m2g0;Jl=g_xi%=9D5+P-@J6O zoi8i7{r};~8z(mYo#dmFs+n^}Jy?A4RF@B8B32&(JyNJ@0kBfBojVo_XfJ@9*;Y?)OE?VhED(rBk4s*SD=n3m{0E z7a2l@1RoI!n+yema}j?&ok4M61+bw9qJW&sLpZ#@7*JtU4wuemL4Xp{)xv5SqeD1U zG=!qjd7kq}o57Kuu3-S#-uP^O9?>80gxz@ zP2n@BTxg*H1qxv>*kpvq=0JDWDY%qM_|$DEGi@h4w>wzATERg zG(xZfKolwf1K6n)NOT@3j>ADBp|#*p8Uu+4URVei4oT}k5`vd5bb5An77}5HP+43q z1M&u&C=Q>+qO)kwYOrtt2X1aoFh_v6q(Hop)-I!rT-$O zz(%km!kQzTcPoJvM(40uOe%{9JwyRb6grm&JRpQLw?a7NK%wywMh3nHdO!skvIoLx zWU>j23khLRVJ9a~B0O&&Yyg6Qfz`+ighfLeV05%FTKc-1VKsk*OQpbU)*Q92mVp+A z8^+o!kQcx}Xk2JJa05Dk#YVH4bRIf@gD|P+5H_8~qjF$$0Lj4ye1lUik3%Q(&t~_htVOtKn@k5z-TWJGVsl%(^zPMHxLdLECC~*70hCXvp{|zG$z6Yn{-wf z5JN$SkORSr%HgnqCKsLG5(94+Bv}2hgbufl46#?@)uEz<3TK z;1Xy7hdhMOV>8$^IvHUAP%MzcEFPN82TuT+0~|&DH&mf+AtgEt;m{F(;AWvHCY>uV z8|}|Q$kci9EIvah_IC(`eiD=okIq6fsZ2661h_dOVlHkP8vjpmi-?#DoG!=)0X7yI zBomJhOr(H<0dUy>5QB|SfE(veU=TivIaxyki-k}OIxBcif}kAcL;QCf8JcK+I*a0q z@O%YAAQUKk8kOh!UkN$C&*nm)KR|451SlhaI*$ukfu%Tw>d&Wv9VQZC&1JJ({DY`u zo*O+%*k%@pasgC?MxCo;F60bYP#8!YyeQN#fny;Q7Lo%?I*UkUvN@52h!84=F02@o zj<7J8Oe7=>*rO|KLg91{mEumPQ8^H_fE^4t1)ot%2`cOFJ_m^aOKg}FC(t}xLIBhz zP<;PtZKA;3FengI1pp-IK1?=?21*m)SprsQG?xidJpfcY=sG&{dn`8SIKrkSz_V;o}d}LBVB|#`XNFMA`S%Q>ur*e5VY=ECd;hF;r^o4rRpzJ`4MHvX&nyxVhgMmO#`LiAV(E7HZ@?p&qmX>}zRrsT`11z99&g8_woX=DGBt z<^Rb=nm-2;4TMO{esfrWEyH;vEOro^&tV}9FlIob0QC-S1pXFbQF%}@5GXBlgm(tm z67*so*h0-i7c}d?VgCc_|A0A1^%pe3g!m^c(08f-_L@NRKf|XYfbieJgFyN~SOM`| zIzv7JI*LC@5Gz6M%m+&3x4nYQ5TBDn0Y63Nb9kd*`*#N6L1+cu=Yl<9uFWlggZ@`y z2eP?5;Q%ZG)9qg=EiykqPXQ4UWIl%j=8ik4rN76yfSUzU6;cHxHh~;4j_3%BizXsu zYc@L=P2#Y%1QVHIGMAUqOdB=_*dQorlz{qQ z^GqC2AOvAK2t5JXh`E4NcoPx04v%oc=`08(ge3?&zyiCt!QRkcmk$9MRv%0{3~(hi zg2zFi;~*lx&)vYt0@EA$OBlR`%3)C%u;<(j1)k$IfxWV4@8Hw(&NCae~S3Mj*jNcUN#?Cpf{uHbfUs zK;|xB(=~u?oNV3fVZ0lRvmrUaM4~rr>kZ_%0h!>@0bj7ayF2Vogh|%IEnS#o<3#ju z+KS%_$0AP69aaHbjAFJuU3q zO9zh75kdvPfC`ce$;R0o#u40rA_qL|?S}ItfUKE&yAkZ19EdJ(x>0)DI*MoepSEIU6`dbPigU{BKBa|vr4^aO8tS^2)jKm~ z29xg>Z}xp5Vr~6)ujm8c(nU+{3-2rpU9dLKJhb=P_8!sgpFcIVaUh8WpKFtUUMwEU zxj#rJ(rjzG4<##nu8q)M_w`IS!U)`7xjbO_#ud$JQ?<(A)rP6Re)`Vz_B8D+E2^wW zjX91r$Wo$b_cec7Gd6DZ@le+$Tg&_W=CSK6Sd}dq{F14reJyJ+W#pI+Ic@fE>*HMYY|Vr{h;PlG@4C~dIa?mg94{i7C-^My z?0EWwI@DmSbFtdIZ-wm#&DTj&Ow|C7M@wYb+Bdekw*1_JG}tWcn`s&_du}BCcy~rn z0e;BO`@}CT+5F>JYh#xd?aGIf>lKC%`}#BP(eI5Nk$F;EIH;m@koIUatspCCVo5}| z>#C|*jZwYh>mD;WO)WZ^nt$l@vn~_sE4En3sklTQZ&-PAi&;Qr&gf733kt(&-d)R= zOdV>)@H)N^$2+>m#Vo0|!y`N6Xx}bYDA-noB`YU}Z?>%zEgeDmRw>?3geMn2h)qcQ z>^l46R8H@O<9h!28tLt9KlYO8#=S4Ml@?8XQ4PBy-?lb<_w6FTWzW2SUZ#a!X=Ik) zka5a51Glw%^i8PCUQXNpPEn7)`b*pr6Wt35I|8}&6Qw~{dABV*iACB*MLTz#z5Lc` z_jZYojHE+aZVYH)c%17o$@2Cs%adDtFipq!8EuH`$a!KWYN zGkx!6*TUf%Rt5Pxu6}NK{VZa)-o&S~S-VlPmc6;V7m;*dMVs8TwCFaKIn?(WE}FJ$ zA?u)i{A#ZyUz=)(pT6Mo{f&a{fuA!2l(gX!$`7*>zejhb=6>g>yA6!QzWh5Pu1*ak)g_VF{gpNEQf^^2fDmo>>77koH07Q^UQf-k{KhN3NWxTrnVl;5~!x`ySofVbRR8++& ztF1>L5u&yRUE2BfgRSYwMPG`K%HMu?M_%%r!ZR<*0e1;6{9uasw;D~ZvWb*2uEj}x zLpCvPu>V1y+qGEBeXnos>p!|S+&BGU!4}CGrxhMDQ8npW*>+#mjHI@y6}ui8aQ%^4 zc3@#7#bb?4mcuE|AC2h;X}Q^l&n!%PqZ4r^&h)-)!JxUgOibhj`PXQ%cyip%TipGoyp1>BMy%-i&es2YLwujLRckJx&GqU2DU_5I zr$y=TP+Ql~@~39Ld27xqyPt@e-QbGL@v#!g)MF`{h$jwyFxr@(Rrf6K>o>V0!Q*Cs z-We1<{#-3xw0O{~bk>w1){)gA+1TA#ml>_~gD2Ntx8G+;kh~;1Q2+R!&3buF&+3V% zvEo@DqRI|TA8)G14t=`}w^M?6GC?l&^6coux31??vz)7(mvpYJ^kcJ%R0|?e9MNb7 z`PgxFo|uO9MW*-kc9eJEtqqDsp(}SDcGelaYrR0q?%C9f{!o#$jhH@hi?fK=<`mJb zVRB^>9Vy=V$|z?BUxKA6zix3%deC)fIxaAzQKB0<6F=T=9AST`_*ThBjEeJeT*8}z zYuQiBt8N&FZ!LN}N$WW(mnAleF?6~k@8K(hD>@Ww(nniY|G}$=s1oCeQa`8T@TQ^K za_cd_xI@MlkF`?|xNSQgN=m*lee0L0^b;$C_G48Eg>e@z9-eN>=iJN_=Uvgr{nTT4 zYAUl>bs{(Dl-~6%r9G34^2C}piubA-Dsy<3=~z)YqgWmLC+he)Gpnz;!=j_(#+1a) zW~sZjsylt{id_p!)JpZv_be_mAGhZ6o`t{2(tXpD!7As_R}U#4E%dk=jeco6TV5vl z2D{CwwcKX!ij=~}l^ZEtBl;uy$4^Bl9trw`+1GLO`WPZgsBB3H=Xy-2i&;}MzM|gd z(*|aB2j$})MA_OGx`oK>+J|GDRom9Rl*o@yV%K$^aH*$R@A-UfLuqH&0b19s1yNsr ze7s;_PcC4GJwkRlJ}H;()iR&d%IS1+-b_C^^MHBEyW2)h zB2SgeYh+coUm~SHPI`ONv{5=}XX0DrLd34xQ<54%7IhWdQ=>5$3l+Bm9xoho%dh+7 z^|)MI%?mQTgJg((epK&f{q@U6hy2zvq90{_pLa;rdGr{H6_%c`57w!crjDZctC!<$ zH{g=$ClfCXUVD2*NsM01to13}TCTNP;TEces-C-Jusk`jR#0~+r-NPCwKYd9oOC5-jz_{ zT{B*76Ic{D*`7;w^*WJ-`}3R5*!WuMd*$+3_4n7fOVoZlNWRoC{pzq;+L|4b3wuWR z{)OlO2hTdvHAY33e>qvRlw(S7+aG#6Fk$b`i|2xv2LE8#TUJD#%-TV%Ti>-CCY+c z_Uur-7v>SNSaN+8*Y=p#dkIGd-#Ose)`~4tBE~q{o@LLK&WK--J|uoBED_g)`@>nU zu$Vj}aVO<@MauE6gx#*&c3SSF!Wm1nRQuK;3UN_H*KR4?y$_Bmt@{@aRZS8ceR=yADZS-gcK^^;^1hqQFD>0Jv-^9k(iOuy`z+#W zvZ!D07U@N%ZF+jGGF*2vYst}gTHRr*6osQv#sx)BUlT)XWq*9tmU(d~=;TkO=_>(d zh_1m}f;in4Q^w-UJ@;{ubv^b`BJgr?$z6Rouf;@pBG|9#(ytZ_#})hOeRbXY__iwO z#CgRav;BEpUk#2F)sEh6ricv&ZpyDtEzDMOyEI|+ZdFjo*;ssu{D@WY23w7T8=tMH zT_^VO3tR_v**kAZ=uR&vnvwU+Xgzx`Eu)-rcQ0CP6qD3(XtGjN zU#xM;d30ksT0gg5ec-!cJe+Xh?$X@$iTKhY(*$VW#P{o)GM2<1YE|E#DVaQY^2>;9 zTd8DQ$DW!8Sw%dnrMJ)TT=KU*e-j(^b*5?1Zc{hq+vCx9 znISIq1*svP-OQHW=Xsn9e_9^2G##1rgvcS`7z^{rj6hI7- zn*KQ4*sLgJm%=H+uNN)+$k8i#+BhSc|5~B%vHsNAyF9T@m4u}Gp=!}~OuNx>x59o(?=f@Ip>Q3-Tjnb9}=$Jk$z>C|gC^^BucK8vb}Z|to6WVrUd&Z+Ud{rjEk zhg7ckCzN%5FnD7+ookxa}# zHp<`n%#-o{^yn8>H!5Z9G$x1d_Yapriz9ss-_va4GEZArm?e1_uQ;o^NqqD7F=hF? z7CKddtVQ2&=ca1lD$BDcjbZrB%5;-A%Lh(tjPzFB*-&$LtAz$vOZEBn&EA+1&Bm=Z z{3E}dHA5NqlaEcSo8DFJqOQlEau+A_@@p;_M47K^yC5mjZFI|NK(1cZ6m^GeB9goz z{MGDYq^M)csym!-*~ugI9Q-mSaOYSg%gijG|5Db~I4xo@V@dY+LVstOzI zy)AO>&9uszVm z$t6|cK~jWP&HQo?!F_@4=3RH$#QkkZtn7N!~wl!!Z;GejZ+sZbjIB={$-ezkp{Ybo zebu*ac13S4qO79)D)Rl+K$`+3u_O5rhUe^_62?_-56K0SSCqV7bI?J4ux;nCb56U* za4NoFX!3CC^ldMudEh(dtM+@RbYk(Z8jgMJ!=^@I7uBLq{7~GkY@XBqZiDEZXX zt5dPV#vaYql&%t`B%bz4%ebzst1Qhsx?EHm_9uUgq?r^AkY-{Em!46-Hf}NY>BNs} zzb;uz)on?G&52J9={@6{vAZsMeA^`T^yH{6Tv zQKZ2Qb2?-GE>tIa@#0OLtsTAn64obodCmkW$23;ITb4GYQgiS?zsjNq;J-Q1_riQd z;-}(YN^mj?-Iq3;JpXIzn%qrGpV`Z+bbM><9z4qMD(?Tfy15iRs%-LXw`FteGT+fx zO1oBC@()(6~M?H7-ZLSM4dkWb66pJ+y5C$5>iC6^g|0}#*Cea8OAyoW|BmVSr}%1qgfb=vcw5lN~M!Zr$tJu zEOF|PHcM$CEtF1Z5ur{CmG}M)o%6iU^M0PcUZ2m*xbOSAuKRm!-|N0T2ZClta9L0n zubD)ZgCGrYQal?%|KwQ$CR7Q|<)b8A9?Kiy2%t6vATAO!gyO#yFbQm-h$}!KAPHIF z2sj69ypWBBFwtCb@XV1JII^~~<1nKfn0OZ6($3C-O<>tE?W`Oe9Bi!Y?JPNVEE_8p zhr#4P3VZ=e!efgdMHB^w!Q%;-46#56%>qkNl1R+vLzq}b0zSrXR{!M8K6X=kdXu#fkO>EB#-_OAmBKpVF}Gff2^R=si`SQ zUJ%blL?Rv(0yZ&134(BuXvhF80>A-{MuG7-2b_I!G)%CDeI&dj*b+~$fiO$~Kc342 z_v!tIC=0fSeHh5J;7nM_NCHCm@Ffl%!$A&4CU_W@qKiC!|0S}upc?={PYm2wU;c+%rX0T}#L&Rpm0%Tg+ z3TKPMixLns)EH4xX1zx1K7SMK>N%22<Y(QI+Ve-z}*zCZ*4et-lbDQKf8u2=-Qf~7Kx9VLkdJA8(eBoZJ2 zQL${Mn8r<((Ttpe2tZ{-v#0x51o;CM3?5PjKP+|v8dwNJfHc99i}KrD0C@z& z1E?y13jU4S6o9)4P(J7i00?Ctz5s~^tqJg`ffW`j;)7D>fNlq@V>z>j2ms^ANDIX? zcUq1urhnTBEEq!eMhS=q;4832fK-19 zxe+}8Zm>7adN>Ov0~e1nE5QoV_$fps`}wkyW(2JvZLp8C5V3`zsv_bUB2l71$ePiz zfwca&7Io$vShSTPar&vT8f@9kAVCDN0*Me|ph>oe41by+0@6?Po+bx3wouIFfW{Sr zFhlZyP5>)FM35DEge``S038ikxI#+67RuNKU<)(jAWG@~IQK6O{TFAZrT%sRog@DO zUKvg9{|QbG1Bjdb?_ozl{cHXgqv-xK`w$?1h=2-D_XD&6m19Lw(PX2=Hfr;5n ziBJdz7acU?Kkorl8v(TrnE(;D7$KNvTm~Y-`Z1U!fglb`6$)_ZNas0D7q$j7UP5HC zgfd2O1v(mlFwun{2|@`(1Cj9E1VZ2g$_W@$`rihkGLT@9W&I?J1mGcOR8;nqK||-x z5GHaF2qS}qRs_HT2hiXU=>RBuVX8Y_HuG1(LV-Z+C`BY#D@$uTFs2E3 z+f;%@5ScN;CnJ}csDhvp2VKd)ry8i)WI#u=Yh02yyE<9Vh*W-zK|O7}B^xpr7< zdpo>WAnZn61G~bOI2*htP(~F!*bK1*O^6RDBoA;L>_>*($uN~hhUqjn*pC(jQ;B5Q z&y5Vbh1kPH^yxq&Q(-@P5IFHfPl&LaUqCPrqoZn8wy+z;gXRUh(_o?-)f@Kn3xPdC zfE^mJ2|kwK3-+SZVY(koCCRp|V5%F%Zw)2TJrH)MlWDfruwQ^bu;50e07M}$4SdKn zR0Y)rm%tu=;Mx#^Elj5Z9PVy@sA+2)Vfx1smRic70$|_@Y5>*EpAHkrG;oo(I~+nI z29rV6O#jlzo)m9Ca3^q>?iU0TgG10)SCD%U(cc~RAlL$r*U{XF6bc;T4ih{{R3h-3 z3^eF4h3Mr0Q$kVeLGD1GiW>0-xdUTxdM*M6#)z0PZ1f>K{qW^Wz*}PDe`{MXkbs)( zF&~-zua9}O+ZAO~LJ4K|SXT&=mLAaaD_COJ<$Sp%b%{|kG|x1+^>R4U-)@xnMP7NyHO1|RG;j*rnfdxj z9SJEPyDQ_C71gw*zW@65Ys$pS+*;)~vB&T1d#e|#;`c)i+g*LQwQ$MQ(~(|vqc~=T zT2hh5eZ7@u)XGT$gZt98tyQNRe4bI*lm~VjlD(`p>OS6?sP1pxM=OcrL1Nzw+9EK8aD)udDg!x3j8RibLq&Jp9m+ z9BdH%UZ*m$Kl|1}#qkeO)@ISws{?yFX-DywMGt));Gt!I?$R;YiSznF*)`SIk!Zf9 zU*b8+Xj(ATg6aS0+#g&dke2S4{brBL`&}!m3qPGWEPwKG?EHXY>GGqrU9TT5Nj{f= zoUUxWGk@KorI_CA_PYum;fhWbSxu=;?d~V7F6;=;s9+>V&@Z2PQHPi0nqJWSbS|J|5)Y(n=h zDCL86Qp2F}*~sA7<>AjI^UZtT8SvL@)?673B~ON*+|=m2czj`9uUUIYsJdhK%0iE+ zVNZv(THUF0Uw!(c?-G~S%yQs+6jw8@?s5zq($eN)-3wC{d{VMccE$`>hT-g|Dt>8sRktuQQ~tQILtaddBWK&Tp&Q0zqh$_HZ0Ka``xTkG z2Sv7WV=pbc6n;;sYgv_KUv!L;*DgIch{t}k$9(tK$!eA!*UPXi(I-V#Xm?b(*LGvwxJ=(W^*lXBP&fa)c zPpj#iq80_?^!KN|8aCvXF(A#Qeb*Smr3uAb?Kqgb@to>{6n&e~7*(43dy^HyZH-4Y z*mjX^=T7QYm5@fZAMtP6aXoM8!CAN(%X1c9s?nvRim#c4sZL6BEAB0*t5Y9hgbb2j zhxyz-YTk7{uVVJ16p9OGul{2;G*{F_YOk2cQ}ziLw>7y$%~N;D*f925MT@Fi6hGu# zI>}t8zRX@X!$)`DtGZ&cVU|iuqMrD(8kAt%#t`mvOJf{ZB^a@u#mzqpa7wjZT+JVEk||GLDW$Y}pP+`4oF8qx zr2kE64M&nbj;UD1v95jkT7&vza`2Vj?ZVj7$-!!m4|&On97pSwZ#GBQ7}PQ&Q*q@h zs@oDfmV{bh6O_M1x5W64jzKL_e3UN z6~0$&T^*C2o}I3q@uBNZ-J&CPBRQ_6KH)cV6;C`l#)R7MhGnTf%2^vl7x&Iza>w|l z*8C4zK6ML1O8f;aFM=_#1f|1!^5YH96-TY`WKH@U6OPVKi&Ub+@m+r%7&5EMimk7ve0b6ovbGQ6-8l5X zvV~vleX4KcvWJRc6zx};hRQrhr82L(=j>I}!9n#3M;71O;igaUrsv|jE<*e<-nW_x z-@JMARH6cRHJ$azm(cN=`@O8Y+evrYG>b#pI)4p}Iu(A(g{o;?Gl73rN3zcf%Y0Ku zP+PB0A8;qfE*P6@6dmSZnP59-oOqa!T0$aP4uxl(C4a+Z4!k7^3t{Ek7NzkWW8OFaKg6trwkmBF*bh)d@- zc^kgAy!Ca(u3+TY$xZrY7x!<{$@ueOnPjwojr+CDMk|^tdVMa3+UzZAtZp!U=U&bJ zuJ@H`v-l5Py>;YKc9z|FPU7zFGfHDiTVtUH`l$wjl6yjxdinSHA;QWnebLC8Jjbsi zm6wiQBG+scwj^B&KW}gSP5-fS?H}Ep zu_2)^Y8Nl+sdkUJ>TqzWQTPeEc2ce3@qHPG6<7UQu4b$-bpMP*r=K0?bN%Y$2RDzZ z4wmb8F4P)gzV|B&Jz3~j<@Lw9eD_;6s~+L-r=Nd*S|9GE@$Scu3FuT)?e-l(Ar)Io zuH;9&qGm0ip84_Jv7+X_T-8gvfp1z?N=t((TMp<9ZyuJ*SayhX^77b+O`h)!44%6r z?<(HXJIjPKlIA=7;^Y)Mn6)!WwUq{Tla!))^*9DW6iFS z4HfybG#7U*4{+4lTM+43x!0!&6WCaPXVXhk>9DG6J-?{ulE?bWE6(ajLFTI#M#w~- zU-IkJO+OmVRMki&k25+A0^Hw=tVZPbQR&te%9GiavspXyJ#u#7399n5cI&ikR8RZi zRpaVYely9`vrLkL&&_+*Ml9NSmk6olH61Kbj4D=tnd0Q)bZ7nRFJ*n)3kBuRh<$|H zYS+%$Yb^RMUYs+f5cTYe*P|n@PPZ+OF)Oy#A@1pkIEuLqT=q~)lv;KjrRz=i};+<*ZhHv|%EaLmwl+Dc=9uz~uqFc() z=V4t})4Dh87CD`F_H!jJTSczbmke+Q*9y~q%!-^lwj$JYH2kC~eedC{w1qhbYMIYC z`?Ia@@^>pQ{^EQ7uorfI+Po7N8eZrqsY~Wk_8*de^vfHX?nr|9$-f%+UROyBHCdYL zs{67c-|#_|YwBn^L+X6r<6_v>mlxN!b!Cy^-&QM_s4TdheWB5J!7P0KFXb!DRCc z!no!ht;2Vq#@+HaR}F?c=>&vehy}Aahw7ZmJ=#b56k6wW1YtKXl&bqL`ncqD^|6BG zp^Unwik1CKuZBiisO9givQL!83Sw&AoFRUL(_r|QI@N={d(vEYWxthf>y19x>*}*f`(y--wRg#cyYv7G53ke z%ls(wi?=ERNxpssW9qEbgr~=`4_iilY*=4vyUN0FC>-x;wRQaPf`?c7vSu}GED(o8 z-~`(eum1UI{>K2f)rHGC5$CAq=QaoUU)^!dn0Pwvx?tte(T`V6da6F>jQAwJHOx7= zZvP@oUxu%_*XV%mDa{SVuF~*I4?{ag-QReebe99uirq6E26iL>7nF~*3 zJ}J2|RI`akRj9Yttlt&QnpbZU_=_+l0*DT{XnvL zFYfbGOhKAS*JR*$+_%O!!KbUEMZ?1Nm8%lc6*v5L>3a-ij&pgvs9>wko<-ieyPoWK zJVtnzG>2RE__MZ}+^&3co6%FXXRM0o9nWVciFQ2NA3b$B^oQpe@#tBkWOB)n!G(K9 z0YCn#eR_M!`=ZCeH+@rEMxNDe{C-1CI1u|+ZPu24i?}^nUn?e~tK8}h#@}?u-k+M4 J5YWCK`X5E+AHDzp diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-46-31Z-00000 b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-46-31Z-00000 deleted file mode 100644 index 3bccabc6576a480976a5cb9265e44f881aa77e53..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7089 zcmb_ec{r47|9=cwLXoVg9x9QB89PzN*cm1>wi3q7GYqpei#4)Ep+(tBL@U~~T3VH@ zQ>Re0ib|W3L@6zP_cL_PdCz-Y?_WRHH8bw-{arra{mxT_AcZg%14=Axb|OnbkcudQ zk3i_3G=oQnV!*w0gqX!C(O&|XSVSOX@wgD+gv?FwCbn3<0Kr0- zNR}vI`pO7gS(sZh=@GVc90O-&ZEcI-8P;@bb6Zm2X{C6JN%drtGE+dR43PY7Z z7|{5Uh$!s83UZpx6GC7PEkE;|A?%#6`k_Mg-ISg+wJbd{8>J89*{~B#F zz};9V3Umbkgiaq0j~fYE6W~z>CoERT0j16a-43RX*))yI0~1Fwv`{>=r}z*N8Pp>O z0i6V4EFg72MYw25Q4yht$OHJf450(?z*1rd3)&8hSd5iqteM;5a5xBKEg4T(EF*$X z6GcH78wsn4DT5}WK^R+T=9DQRo5W)v03%Kk3<0uU4B`Ri6(HdurQb|Mf-ArcXj4x+?te;=r|*GA zD+v<&-x4bU$$A05|G`0wOFpnM=a$~;xhP$`axc>=m$p#}nDb zbH!M5GYf05W$`$x6uhaQi?<7b;u01#wVqXI>^NG2&=pKBN&=S-Ork+x3JJpBCk$F= zY{_hxjw%Q$9={xP9zQBUi0-JVh@sOIjjt=(#R!+4Kypunnn486Fi!il4Dfh>70ovE zGlEeuLn_G#W?5q`Y^-tat6?J9A9jSzOe}G3Ko}KtMQ9>1nh;M=NUq>IfaC%@yTD|M z3rwXDVG_j;CKFs>643=F2HC&_bn{bO$S{fO2X5TZ8v;xu`33+sDk^4f1rxnpDekZ{ z1tt*59x#a%1iJ`tY^R1!>fl90?{GSQpl@4ec2HSA1vp;%eKBwrt( zfk^fSh=O1W__$C|5mXu&fn7}*zZ4fYZx0f%2^^-9{9r;r5c+8HbM_(im;O+{0uR*o@IRkkzs>B224s5ZhwFU+#Mo5oB(0Aw#C!@Pwdh2JFO|&cgG4fLsNcz zdwoNvwku@jC&P{_{L$~$VNY+VKVBTuuoHiGPspZE-Z}Z+?XI`gcBZ(#4?EJXd`D|! zBadA_Oe{Yfvg^$sO5F>_^bZ`~Z*ZTp&?mpCd^ol^T5ESFW8UC>^?B+>{zdW0PKEsu z11rsjHqLeYkYcp^@Ep14C2@2knOtQhuU*AEV3UG~Yc|n|J_(+3MvF{0?B1cgNSTzB zLm1y#v+>|flf3=o^;({vh+jk1<}^-PezhD}P7;ZHx-E3P57-}K8v48T2<;-qv(CDc z9&TT~OwPh#$B6bfBcsyO8NUvm`EX${@rzH>OxMe~y=RS^XVRS-U*5Se;OXFT z;a-PSH`_8d+w+OS+k49!EprzfD_d)9eEN)cPvmaL&wAz-X#s(%zBSC+P@H-GU>=*+ z9UfisRMY>sv5krMI{lpYnU}(F>r5(N>W^y8yJ~BHP2nYGMmNbsgn_5Cm8SWIWXR-Qa>XkPWef(Qp1Jxs9U6hPQ`Nd-NPf9 zrSZD$iw@uz234Db7YknnxVq`QT4dCv(v|tHq-Jqu!MapYfPrS-B(-^f9->6PCPm5D zb+vHOKC^4nyH?f9SkjJVNfhnFJ}jMh>6Y*uBP zYI|H`hwg-VZ`9e&8+tZH(IZdHo?J0%n|-4{N&XeQCG%`w%AC$))@wTdj39s24I!L4 za^hNWev6>R>|;Uh%RQ^rw`<-kd&nx-^#O8dH+Z0(^XRkC`hk76QJt)%)9V*O7FR}n zzHR*_FO$Bb&tgZ9v1R26h@MaNE2zrWX({@!#g%Ylbk7jYo4~knWcFIsgCp7&JNU@q z%NZ3V%sjeN%@JQ6>WP%Aep`wn=W1(Leq1JHp7tSm*7vU5ZaC)Lp2`PbKfioJam~JI zGg(M{PtDoEBjo5URIkbL>xngakvGzTE8K-Vd95MWW|-Wq*|%8uZmx3StqnuNS4bgy zr6-bZ)9Iz#_P8qFs5V2v-&bf?eP3JXr=h<~AzmhI?Wx#v8WojNYD>bKY5XO2 zo>z6urEt2z9QtsZ@^YQ)JFY+8oU=|3XV}~@uNJ9_ZeD&^B`M-41xLrzw+u^bmTJGz zl*ux8{W|BX7IW2tj7|5VX6_Bk{)}5bN_pe$+3OLUldDZpyEjpi0vXtzz6oi(+PSGj z?elIUL!=WcH<{}4;D^%1!2@1oM~3sY?Wqus@e0b_Y-I#M5#Ax0vw+-aRWXt3YHxXy;tPH-4*V1_l&K_-k7cnvPXiw zk^)a|IF7w}RN#Huae(c4wOTV)kw0d%cnft@rj_Yd|Hkc=k%q&}`c^Hr-udi+sJzw* zonTz6mlCC}y!cVYHod+*OOnnSl-7l9KXxpg=dHmX9Mp4E%qhP6Mw8L`eqFWF>fnaF z;)qk!8-Agd36~b+JT$CZ^O5<;v%J~SaNMh$uve7!Wz{nu*w8d^z^lhKbxV|wR<;ap$Z{ck%f{*i@cXvzuarfYflKdy!15S?7!@2vS=Mt;d zf5^SB(_;R-cXxHiv4PRg4+T%QrHwR{)D)P6IjBWBTnN(Z-?!vAcFT2~@>AW6Lzx3F zkQIvxe>eweHZ&e))UT7SbF0|hQ*?ImUA3YlV{#8cb+P?ihF0Fm*gv|XTKof*o>K?A z!j_Y}4d%}e&l)sibR3Ugvj6$JB6z)y?O~OYBRj4gccj@|GRiJh*xaIJaLyugH1p;1 z!vg2?C#d>z`}*axIxOG4^xS3rNv}wJg_7q!H1|$mU?o<=x7SrQ+Bo`G$4#x`P3Qlt zc+_Ys99ya4);IIdaK`NYnLUZEwFS?TS*{=4wqw6xYQLCuX>V3}^m9(FdzMcvvo7e$ zvD-_$#VN0&|EQ|e;W`{i;6xuY;>%b)zr)fVuTHifA z=`>eJ&nC~`Z?$JH-QegYj@_GuwtEEJALpwT^Hk*(PE|eZ547BVE)b_S&)wqwEx+4$ zmdc+hs`fw7%)Ahg0xykXf3Cc;ehXjel>FWGbS*2}s;(_L-OFAL6K>U?Mvk!!1~Qxu zOyV}Bhxe2!?aTeTPX6&xuZM(G*y4)l>L&i6LSL-H9*ULv$hCq(^>O%3Q0QBIyWxs} zFGo2p=-3a z!t*(qqNDAD=T>j3^0f*eXQ+x7C0ZSoJH1ouoMA~&^w}J(W7!#dr5g*LG|JcMy^E+e zFuoPl8A0%4s2OVREq<(?OS*n1|18}sLkgxfWKr}$sSRE^5M8Oh;gn+2bEN(~<$zb{v!e3@{p_?q{O!*AFBu*$)XM8Z!G1tGGN}=g`G%wl))s9%2f7wvTo!NW1r$fHg~8Do5~inkS`YnBjm| zbS{v6G2ecb{q42wUn}}qr?($@N*KWZsrYb}g#v+|6n}1QCX{bCsZ(=cbDc9@a ziLeD`%0QRnKUV#5LECpHXbQ?!Io;lk}d! zg^FbqMcaJVQ3ITc{J}WFz4cFbUW~+$?8l7#*S7Y!-_Yl88=<;we;XXW@nbqIeq|Rkx&gY*sw+CGoa7*eu0 zX!VeChNIub(oX%s(__Qw;|ksQt@k-`4=dy?SO%h{ciQzuZu?bUPRO<;|MFj}_=sN? zJNB$5Z`fmPm0-7h)@t8YxbETHeU+O!UnHyyb-KD?^CpGGM#F98;Ms8M;J3z8F~c)n zBt1~p8&R)euS{l#Y!14;B7Z$?_RGH3=t*kj;key#XPSFw#1z%5d+2yaS{)2MBVBhg zXUHXV^-5Z8@`!2f{H0zqe(p;?92{z8Bi?n0WKinh-5OtgV4`(i>|=e~tOBp@L$S~C z7d;c~uRp!q^5o3Po{E#!UbD=l$7ZyBm=z%X{=|>`llrO#;b+7Np0kD&qwIYQPKG~A z)kzY6O;OVuH875|ynVT~m!IwSa$#so^XT@n>MLe-mn%#6l@q>&$ENDanisB{>^i${ zpVbe_K#N?@j&IK$)(D*T@_UPU#osw;-#hXLe;R(nr}Uq*PNIEn4`{&la8_K!n1Xjz z9;@=TbKD2jkJtPb8PoleC`YJS>rUz^mn8E#OTxSI56PsAOo$D34t`sqck;Mu(u+4? zfs@IFBD=CX&%(wxe)_68nf!UzK2H8B@qz{)yTE5W&ejbN-tJi1f2B>TS8rp&o6)0_ N4HFx+%P;yv{|9PX_C^2z diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-47-25Z-00000 b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-47-25Z-00000 deleted file mode 100644 index 21c79eee3e293407ed1efd85debc64d33f4bc7bd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7238 zcmb_ec|4SB`+tljLWo4jgUXU&#!iaCSTY!fC|btM7^9hIrdb%#W(lRDXj2Y#B%uW* zl;seTR3sfKQX+{~l*;d(;k@U4&-?kjfBok3d7fwP>%Ok*{$BfiTONYswlb&?H|mZH zQ38UL`LP@tB>G8G*%asu*q00!Fql*?B!UgylLG8KKAFq^mjEi7#^o{C2n0AGOEavQ zJ(|O%p&=BV!QU{yWem2gENvqw;r0{^6=Pv*Yfr;cZ7H^v_V)JHmUgxl5w=uoOKJp} z5&=oE*i-?N#)G6qC{Sc3lT9J>*<5G=Sn^_dd>RWvMUkV)JPMb=;o}iH1EE1OV3Wn( z8O4K8fJY2g1c*ulV1PJ{3Q5fa#c{dhSV#|SDq|o?(FY3w!y#o0NKW*zgwD*)&O(xG z4h`Y)m{15HqPPMCVIXu!2Q2)+28l#~F=qB=c01`X)(T!PV8+507_2pfqOe&U1{0j8 z^gpazGvU)WZ3!#_{Wc!>3Q8~*0b=unpp3#9d>-TsmaZGi?;ovA3YZ%W?F3Z;0ExN}i;d7hX#zY8!3vEA-VJB-Xb^y*C?@b&Aon9c`GYoO zIZs2_paqG$7=*Hdl;-$od?H9t77dgZgtCT~04fa;AnYi%fQyisVDNy}0XhJL z2N94&XnZIYC{z}EBIG0>iMlf%kWll`MeX}<*#8Fgf54pM`WG~jgZ>>B=)|;tdQEil zzsFBk1mVA<2Z4lwup;KU1c$bW_^9DTQLseWG#@F+zw8yIhU}akD)=iopVg~GCW9Y4H%b0iB}B4$eDTCA1>^7^H88Ih$^j_k zC;~1Q45~m-e1Fe>ku(BQ88QGYu8~|YzZhhMhxQ>;T-faGXd;(wCK};Phq=5}rf>u} zDwQkl0M0;088k@I!p8*?H4J4$z;b1Cfr+9XfD&>4V*ttm4l-U`E@DT4zOz=uD!#gi zJnKg0#xM{FC59!+3V;RnBf%liziulcHmo%mjTqoMnvl;WL)jo;f9;dNj05AI{4Zs& zH;s$XnDBi`FXk%|-0VGA1=YvW*T>tJaC6Ws#EGky)sWwZGXLPUVJw6L-T zV;PIF*^M<1z!UH|5`JsQ+&ot%Gh@iHJa^FQNU;b794T@_1P{miYlRY}AyeEt=DiA> zip82*f@+A2<%x#coX14%SL9!JQIXRSO019PPN)fZK;*`Gn@j+Y7ntcxqX1)ABxV%o zV+=EF(N=c07*BuLl^6s&!xm=N7!M#U5_G4L`2tZu)`L8A2iqHb@UR;mCX(=QAjuW> zAqBuh93J*@#lx;4b}&wKRUqMsuuotB*zpkU;9yrDzYTybP$Xt)1G^I3NuID93C6h+ zyq94)KHxS0* zN#GzaH#mfZ+kgjIGxsIoJqTVt;7nj}picmd+YlnUWd*ne;C$U+cdQMtcq7RbM*?cMv2|sx%gimCWx8CJt*)|&YjIrn@O$_KF8?wl z?w)T|!?~1D=QhvMr^le#ALae=lS8*}DaSEaoAXW6$+r1xyQ0pi-Z*wIY1bDIcc~6YEZFb6n#&Z{*y|B!1Fm;Mjnw5$s+`D>088$oUV)QQW+sYHhx&;YqXO+_5 zhp=KDjHIrfc>Lp9t&l4JD>smGzgBu8biL$^Uqe^O0W0jImF90AMJ^vQuB2?HGS>{N zetdEAL{aJV$=`Q2bs6Yvy*g1IWpw&WWi9_+`KVo7jatFB*@Q8bjNeWScv%;}->Ap3 z#4qZqQA-R&l`#x8|bQNdH>g z67%OFch8i*Pb#+ImT7)LLV8J0#)$0-nXA!AsV8k|8q<97zHtgU7Ihv$<#so2t6Lm> z;h=oh@hhQ`P&sI&ILG+B=#S6kxg+FJ5xC#SUuwASG?G#N?8y8MKtQj91fs zZ2g@|)yxB<9D6JJ#j?KA4WH`;3ry>5SH>B|q1BaR;SJ9Ss= z{sX6^ltoO=i^3Mo-qpyV_K8$ z_Vit1)ZM)g-8@0jl&qX7I2$#X7gHm{_}afK>t4dEUfsdIUlaYmC{uMio2t5{L%KFw zXD)14`!l%J%%MorRLC_m-1eiAaB6s2d^7Y0jn?>}X;iy!Xrwal*Npt$MG4z}lVEbP z)pvz6w~&9He~F#Zkm<82QjV31(8iI}{P6La+l!dg!sHt^Uk5i!-E+gLcq=F8YW8Hh z1>nO}en%%w49DgUJ|?%RL`4LeFnnI$c6Kx?o%2lbLkQ;g@nz?VD*T&u@0PSX zwpcP=G2lb#jakWqChD0T$)TF6ni(De7xePdtgz-sm5Co^E6Ss*27U~iL^!qFfef_M z^gCar7G9*RFb%U+S)v_&^!#(@Za0HtQ72y(s97pInUP%UpQYs7I+mik(d2QH?+M1? zu1CocF2tC-@!ysD6KXUS)};_1 zzIiOLGcW7ilB%FT6jh^gE48rreaHKX-i>>bRH#Zn6g=L2zm~(yO>DiJ@2(NAoi-Ww zqWA@N`92rSWV!k(e1XlS?e$?Ry0xuGNu?19Gx5dw=e+!{>+*;jC*S!UTli@jCF4mY z59i`Agf(~U^&TIod!E4kX^~xT@(_hoqYvi5%R!To%qSUKqiwg#`_t0X_Af{^J zn)UTs^3suZ<;^YY4lfg0?K4i9Qn9WIAP1zDX{8B5zNX{b^`@HqhX;2wbfEjnqqkCcd-U%$NYP0||Is1d{vLVnuZjfGUk51vw9!us@7%+!GgMtQ-1vHTX8|5g;lJ*nttZTt#&Xxb(fu? zl@49r_^o-b^FAFSsf=+J*DMSS_uuRqBnqW!NEud&K*TICj3b1OW3 z*TGV|SJsD%`dbTjTqIqrRBy;-)*t`bqpDRipmR`KZL_7cMt(-N#?OS3>f2h^4K6wK zJTh@BIY>p9%G}y`#D#b~)LdA@q;0KtGn(?w#pQmH{kcc~tP5vjX)EiK%7A_^DzVSa z|9S2Elqf@`8r##8*l9xJug3{VoEoUlS9|ZVnSML#F~*HQa!zqmy;Z8!QGMqPTLycs z$P|uND9)aWAdK=7*S%d4sP68%_9?GQ+cDAP;40iV!zX;xNTjYiKd)lyzF*~Oz3!V| z?uVAXk^VZ4=4<#r`ZgH825G7P5#}4jI5Dxsvm$rnd*X-w(~q9KCWpvO_%x7QK7O?D z`u)jovNQTUJx>%Ww+~FprepRyuf|xaR!yOTbggg=jkuJCZ_DUmrT$?tKCtigqQN^0 z17CGwp@>K`iUjkH7B;FHky}j9BrQsdUAVGO#*|Pv^+jkdas6Zhaka-yg%B@nw`%mT zdnxzB!hPEmO8m2m!(KEMhN$fxKACwm^+e6P$Lcx5$a&e)CFnh40>WtLLrmli--tyo z3)zibt#R9nm0lfMokVHHC#8jUG>Q7rV=7iMLbZoaxoL)?`gwWk@kaP(Z z){~bNze#u>zTfks-RsWHV-vrQd#^8+k@Zo1EbNVnth7yL4kh;`gc?6zbv1%@ zAi&yCODnG-ty**KF>BR7Wz#pPDU>Mg#1o!0W`;r4i_f?uJT`p)RX4|e&oF|$`oyRTNXv7IVzzDup$&vW#4sU{YceDYm>;cQ~Q^qSMdXnlou zo$IRPClxIUxI<%a4K_%B=E+4V9Qc|!wTg)D_PmY%ed4l5_?Wt4G(^a${CNY>T`bkx z-@lw}J$)tpoZ1Ex_`-w1XDhSFE3=C0QcTYEu3yle+n@EB)Gn3fd5t_(OZZ$MDbu(c zRW#XAtmOB?!G71&YwHa^zx3zG&M1eCLcw1THEaLUbcoqBbAGzKOIr|2C5$iHUuYOZ z%GApthjc379TrJl@DVtkoW5!wYmtAGi|SHI3|y^}ih3fjKY4sKe2-M;`vb2#tgFKn z-`d?=vpClbnaX%?y1ugFZfuzg>jRV zY9oe2jLkmtMtQ`Kzu-+m;6SL#FucIc3Qj&r#7l#a!r7Z1l z?-4HYw^ze2FjICJFElnuuL>S1sWo~mt<^nz`ss75!zoGqBrQpolpNGq-W{E=6E~B3 zFs&Z3ZM1FiT8YwK9RV6veEQvk`Stn61}@{puQiVFhxZv(rzRUM)G?a4CU@9F>N}A< zsI?!X^4;x&vpXd8q(k`w(HSc}0@Au1AOD0pRBR`an|x*01>be|u5B)k%&%7xHsn_; zSSvIcHPLL}7(a7-vkxhD5w>hSpokyMkR>>0KUb{7a4yDe>;1I2e$^jm-f=2jFTUP) z<=~R>idD&GlC<DA4MCPCVlL?DCOs(3Z=I9?vY4BR>&! zu3Ss`qg*RBIFiu*$6onIWN(=^^VH{?rwAXI!Rj5wf`*af9g@Ba6CBibw8`)2;Z2*3 zPp2F?peB1=wfVM7>O=iF9J?AC#N4>mT+;}-g=kg(q+-ddH#ks!?%D_)AXJ1ly zt$=mV9x;vA)<`A4dqA&Vx#j{-j((Z6)qjK4NNqp!2d)w0Xm8ckxvF9RdRqk)?jz!! zQgU#hf8U5|6h-FBv*ic;HAgy`Bfh!aw2{MZMVG!RcFg<;X6bBeWc4uty? z9>gl_w2{7j|IM`KCJo2j;a4lAN>bcTx|EIX9sN(1V_V#+(E$7_YJGZ>I zmP%ZCut80I)rgkwbDa|PvYJmV>r$LU_M#_;jMrQ+&--Y1>UP2*1LW=KhgVYhpKXj| ztPj^VKi`q!(XF)QPSfWjiB)wLmA5IqS8|=dHjK#{r>i^6{PONX9N$m-Wd=K4-QTu! z;!&C9o2+-&_%oesc}JPU-Tg<(CI;lU#GRLKG<-aCBV>w^uyV_}s+q_(@ABWPy>%t7 zm|7n#vnj}N$i`~#lxO5Wno>tgl;>Wy`oO-@uWnN0w1+-+9qqpKu2a?9Uq2t*AANh} zOW4mlxpg;oI#u1x9c6ug>#LBl*XR4jU$e^|6R%aqjY<66^*yG)rVFsw)h*n!=bL0a zXV1Ifsex^y$0yBare3H&+w^1CwU!&|dxArEfBw@DagwO}Fq~FkIQjT~hf`?I?x%jp rm#3x6XWo_`+TOUk;(FD@gB8(}-D*G zB}$v3-I5|jvZRls<#%T2yFSnNuire+y?4$z?|pf_&p8DMlH0;!LK0KWYdj?&NL3KW zMIg~nlF4B}x!_!qE@ZKp>(CGmbWaM9^93}X0D@*2FwqE)&*GpEpo9o!cr!aJmxo{> zOejm>J9}gdjw}f_Aq=`51INT!*x1-1c%}`*hG1uBXGO5Ju?VqYS`nBbG)4#{70F== z*$5w+BeDWRW3xF7nt;QDWWbUi#}^=x5GI@!P2)3oEUtirhO$ruk_Ly7ocM4)gaI^S zV?_or5nv2pN0^Y*tf5Xk9xV>i1Ba?ONK*8{L%?xJ)dG?eeF#v=@87>6Ne&l5`Fu9y z2R1Q0A&RolP-qcYcz^>cl?>y|?96QALt(rnyk5wTgDr4)D+t5jL~>bdpile1NSUxL zyq<>65YC2`ghsP?95fO^1<-vA(8Of%1t0=qlV(;l9wSWbe5|eY7HdnOf&sY#;h_wM zJ?zBgvJsd}_NBnH{=wED2{_n@!KR_1SZkbx8P3d#U<@14X?%nUbI=)Tf|<1$jvtL0 zi{yo{X`y^50E7V>f^x8&NR|K_!lOkZST2W!3J@NQ4e?w@1aEN47w}jN0hY#Q(fA-H zFg7%lNr$mqK^PCAF=6aRkTUS*vqDjk^#0+xVLh(@5C7!=e8Ei{tG2b(N38i-+H zxr{KdLU=q5(Bxt9hg=8@#)b${h5!`Uzio1PtZ0x`YzPZsi&O&X|4cRb3!LZCL|h^* z;7~vl3OH;|D2qX31EWw-!>9nu5rQWK%L9Qz{?k;kZZRb`n#N<%=pf8uQIRaZ$Zag0 zM`Iwf;!z=6EcQBaui(Bo~A^Hg+a&rl$W-d5evmNgM%GgUB`%3yMh~ z1THc`!vJ$Rz#uk<#sp!UJ%K^`m<|k6Q#>BRuvuutj090T%%=FCd1Nog(pe~T3r(;^ zBm}~M#t%gVTmGvcXZJaL2;c+6;m3kDqO$~i$Pp}MnFw7N3U(rCv1|Ao)Po+5Fa%Uq zyclLAr1-#8S|~Ep$9%{guwZbIEch^yXi;Dx3?7;fmMoNlL~?j>q*yM(V~INkV>{YB#(WUIfXD$3p-jF5aLHP%7z_FkU@pc+ zjB^A#91aIzY{htm#WLw!njj3q*ojHa%$YO+4cLf-6lZkt*+eH7U=!HGi&@Of88kDl z2uAT1km?^IPZGrqiJK)PK_g@N%s_`NK`|!`H}n+3Q{GEc=7=)_m67=M#PPR0*00V5@Hw+Of41-m7J=ZxWg0L?vzUo0;OOGp`8lfMZ_@33evIo>UU-LnXo# zsyFQEM1m_qfj z2U941u!|p%Lj^LyV*y^UtB()tLxDZlh_?u^Cy`9qK=yL>f}MRxRBKC^;^7V?5IxDj zB0rc49uif=BH{*0U>6Ed>xZ|7eLR63&P0kxw51t-=3@cJT8K>rh5;3x9-c&ZAJ~aR z1&Y==!+umJUlORAnJ<;Jmb{JvbOMKcDBiG>ub=2{iLdN(1}*<`Wd})u=7^ymD}wZ4M+k~7Db;q%Tx#>w;p*LopIzvMj#909 zsY!53DWy$1b?=LmqOvaL{wa1<=()E$)noS8zb-PVr`J~<8&&)eOnzQ?sB z$2Q6_NxP-w=A?6$tXV^7{i>hE!ePf;v+1h?0|S#^2il*@ehja2FB;Sim#6%a#TJ~e zXx*psdwO?i{h~F`n!UBhm+Kv|@!h2Dp4$ED=vY?1VPMSuh6AmIRi`&yAA6f&o@)hH z)~WT$H*UH9cWH#pMc(a;cLGi^@1HkVSmBUIUpl|G=u66vK`Q;XJqe9%?v$DOae*>< z^-+6%#Q61xiXGTD`iHAhqz_+v)lONYvpmC5-zLt9{GyDPE1jNTaJJ+}7B zr~5|VcV<*9?MWW7(o6h#y79DLDC^K+YE9MSV6A>*E8;PW+MM>eTX9E7;pdE?*0`vZu4X6N`H1ISE>hlneO1fv*cQ0r^)z{mX{^_(5Wx0>O2)#1zPsy2TvM| z`R$2uwzt}YQVz*P3_NSC`LsM|ufKlV)klhy;EoNAdEpwL7TzZxvDdRX8-cST_srdJ zI>L52xl2F&Q`*%)+-9?iO8qYyGLD*y%N^?+Ny3|Rf~_tvP_;Pknr|*Qy?uWz#^}*mo`p~O9F@bguZ5h_> zSs9%7VK;p8_|~V7s%1WGRN;I+Ecv3VEcFW#6aeQ)x+zUIo-pWDX? z8eHPh%>KEBQBoAIl_6v6%<6DCnx-uB;O!L(2k=&OzUq4S^FyxsX8I<}k9ggmY+vaS zHHhn%wIY~E+1QT^F84~u8fkdPC_OGLHaZ--($wP7SW0oMj_Z=cIK-ej z&3`HXy|2q!t-c&JmTcHfA$h|*OzT6(6{ZCW4--u2<9cS&8ofJ@xhgL?cqq%C)_diw zt5@2(tZ1bTbN32NXuFPMIvl*tL)twkG+T6(Z2?&y!^SSfj@JEye^ ztxc@FHcP(OKX#z%QdQ=JBNLkK^g0Gs zqmFgIB;1z8mw7RnDXqt)Trsz%bw1xS-;j6WLAdnWbJ>rMmRZuOc;YBRrgzI~%pIr6IB{rxjzEt8_D?w%camsiSsn#^x$R$gRP zs&$z-lvG;xG^^v({GCf`Z=KAnRV^aJ`ro?K&ktRY)sn_}Vcc~LHqzJ1#WD;arBL7L z7rVVAvzu}KqpJ?-Z|X>384nZQL8WspNE06SrCJujEzI zA6pos`?NMEW(=KKybB3Rd05#&ZuQ=LzwluBoI59OIbKXJr%JIk8P6*}Q42O=0h2|I>MMLK~X! z!ic&KWufBNXUkvg*J5`kYz}%kr^j!3`G-N{M%nZN`h-I5hri8yvZ_CAa&bHBSHm~9hA~059eu3Y#^S})G`G1|)DJLtdD}r5Ac{R=c?b=I*9xHdsk}$lY#HGR;|^p#Ldj z(-tbB^Hk#NC2iygg@B}wa`&z-G@34#lV2=vulR7|ig)3eZ?BkQqD+LE=IZ6)1z8d} zB45)Y*feO5*JGjEKHCf(s_T8KQLk?>&Hn1L-GOq|w>44%>~F?3dZ!=L$thlFvOn2F zR*D$>z@_d<|K4rs$gL4Ig1710sm~@CZofbF+GtG#>7H)Njw*&-&D-3%=GR9XmC$$)m{1 zr~M>y@cF6cD;Swz!mpA8>(ImGfH~QOvu1C$)!G_PI0j341|tpccPwzh+r+p&)r&ZM z*VwoA)pXU>Ux~@a$h%9F&GgJPPt}ZriaR#&P8?1udf|MiE<~LdR94;;Q1vWxUf^)R z&%}e}XP@pKYhG{@-=|M**~@zIw%o+f#QS*KbxFH-tvP4U`R`Ma-#d0oO+MFu#9|xv zZH(UXjRU#KQchtzKBp-3-k*PMc%CK6dcj!Ioz^UweS+m90?kqt&*RS)>TPbVW?h%txMP9S!;MAfd8Qk>-a(aJohx+JE=iwEHZ<4Mf3M)B z=|1c`c)O-9Q|eR~iDp=X9qPHmshRrr;Kd!2By&Q;9;^D}4bfI<=3c&%FDe7N_Tu5% zVxjHuKw~cBCw4XeIKAU;%+?3XDiO()s=46}UEyIDpQo}vrWQoIEHPTEZQNyYCO*huiR68f% z?cu%Q^xGA^19x05uc)V-+*P??$8^Pw&2AIRO5XX;dy={y$%z@F9kkO3ICD6z6JB%1 zY&amsDdLL|`?&BV10wXis8v;M`{Yi5U?G%>&-JELsa`8^VYyCR@ z-iv&%2)@kHCtzkeiBHMCN2=M;{uC`;=e2{;pg=)v&^$Cl%5sT zgmB)KLJGNZ{N=B)uB#~0k->Uxa%sOROhTe8pB_`5d}#JjSyE`lRq%^QSngA$-tSs< za#y1>tlGWIYj>R6XqlWq?{Z*!%Y)sx4>z>;?Mb<%-Q;I z!6okIPim`f!H>rC#~Z&{ODSAj;YMp~D_z#3G)I}DIhPl>bUOCP3MJ3N}H6tN?X84g6-1l5^9-VyWXlBouuQ{KCOKs zWq2LR(vEOCqZ!89(zYoZ!MW^c%GK}Cgf8>m#I`hK47`)5Mn9qzVDyv#z7g?;Xk8D>T3LAKc29{W_Fkd{Rgj-A4 zIbN~g*`gatD$(y2v#wv;)Ga@fc6)f)hrf0;U@6sI@lDrgQ>RK&wD*vb0wgnfd|i7# zrmnplIB!=|VtM(mf(A~;j5!amieyI7>)rFZOG@I0> zjn%bN6KA9J=yt=-&8ZIg3G?fJQd70MH*`Nxk6C!)(%AI{k6TyKgilP`sNdZJc@E2K4`G|+SsnHi>}HQecr<33szQbG|mpa z^ZHWZrBBDL-h2&MM+-^1*4x%~BOI&F7Jg};Z=`!)dEd?8s&hkI4qkl6YF|wX z+7_&|-@Nw45maw{VvVyWlmw>*D<7qw^k|Jcq|l zlng#}zy$e)FGa}VoWcC&Geg)Ti6K3KmQrN<+K$FYTk4yf*Q^?U)FT%s-1|Zy`ggjDitwi1KDmD3d-e})jVb=68`gFaI~47iSKIv!byrfqOlD{NPD zkQPc(sU(#aqDWav%63YA&kUV&zUO;g-@kryUGMwOb3gZeKc9Pls^&n@tPLy%)EeI4 zMwtOY%EDM46O#O77+gA(3-)EgL@YLAB@)hs9-slcKuF^Y{}Mn&Gx-7*7l8mLWNm@7 zaKP~RObmpIU3+aPRWh^8k`QRX6IHYU^&60eqp+l3ClaLIT z$3z4IHWUnqD82|mSV#n<3l_d$gG%*=u@(*%_Hhv~&Ia}rv14H?EY21}(YYKRiw(}3 z|6i;O*dF$zAybUgZY3hoEIt?EFcBfthyo`uSOOvNfE3cyipHl$N{tuW+ikG30Y}gw z51>4PPG1VU@_1|}?Cl*yhNta=?LZK)unC<_Ln1JCSSt&xg{`$IY!XHjFc~lxnc}v# zu(QAlq7hSxzHl}zLIAA>Zoq^iTnv}P5@N#nG!7HP3Ya)G#nSdL&pe`Ft)o$=B*Py9fZrgo_Zm5G2@t5P5u7G>9rDoW*2Ijs)8O4mJ1- zjOWuNQj$}^rjRBQa@pJn7M;chpb(J5h!DdSfhQcp2aaO?8>;kdDJLeH#%IyOfSaYN zI4pt0Y)lxRMrTf|M?`F?+TS6N`bknYLKcGIFgbJ%54c$@o{F29+5c1A#Nw&IS%Ykl zU_&q%>A_Ei*fXfAd*jyR|xN&+12H|5k(ap?oI0(gNAseSONXlV4#DB+;ZH@_J zA&d<);RcBk2n7m1f+^haUkN!)=L#UuA0Vzk49X~sB@{p|U@6aFhKV8og+mj&3Al)F zSQL{kq_X0qZDs~q0HD$$m{WBufP8=m3Jb}D4}%#kaV&(wL8@TMLdZ-GmmfJm|@*8xX#YFz@bC3+Mgur2VgXZDO z15igm@%^i{p@F&4kQh`203_)?94-<8N)zCj4OSQo@NO7az=Qw{MJYkR0l6Oz${(~L z>uDOo1uaP0#UPXoq%_6H6jDHfa+sjBAe1en4ya5-l4Ai(fsnuj1|bZA6EMk6dN2mm zA?Ud%ytL0*J7BR`2xTwrR~QTXe zVnF`_1S?2k3XXtHa3ulQfMzXavaqDnEO?Smi?e~0e=|{tWG`myG@~t~0q7Q%0wy2$ zVFQmQ5X5l#jA=9H9Oo0`R{K z!W2TOK%uhK55c*BBVgCc_|A0Bg^%peB#P}yH(1)4-=`+c>|BT&2 z34s5O90ZaH!bzB?k{ent;bVkRB!QA-(sYz$ep@R^3;8KM4DeTGI-`vwURM$%Ah$)7GyU_(kzq_5r@F#0~00nkCJfzYxv0n4jNHfDpE&*p5r88m0nvUo^_}3 zV^|1;lERYY1i%9OQsH3eubYa54QC6+A{MxgDHif+P!0&#?|mwmZ(!8Z{!#{eG5H9S z4F^qKXW%K>rSK{+PF+P2u$3K*vs-G5UutayQ``fj^L-i2=W>Nh#fS)FZDoT8BN>Oa z+lsUFCwdcIsl*MzQ?p!|#*U%I3P_;MQDYH0I8x$-aDl7f_X;IRLbkMTOnVhL6^Apo z2DK0wE07GdDUV57uf)G3K68_ZiO^%o9&u0|@PNdP(>5&uJS)LGXPfw&!V)o)0J15} z!eeag@mLQ(m_P}HU0^EU;O!bE; zu0)tjAi{)Td)QTSO`sAfFgd^^q9svPx02!vZNlDf)h2TvN^!9W2gWUs&R684(?CS$G5GdXNQ7}ve z50NSnkw}9>U=kS|8;rAq11JE8JAo`wZDWC(`dGnYD=Aa}3>-o6r4W1qU{@j)9JJCM z4yL*W5kb~WeW}D1-Yd!AOki*T*&lWd3YOfk{N4RsecWLZ&JI`{LM6C*d&9x*Fm8n# z#TD311QG$Tx2p#U_FgT~?(YudDH0_sLF~ZDo0@^3yP^d2NT%e{J9WwBh`_yJ)BhS? z5R?zZq!;&|oPS>2L69I>=>QN&y0)b&1c?t7%=gMP#6Np_{pHIxG*fFiikP%F39j*( zCogYz-!SjfOL9=&W)r{Al1&b=DY2C>-Hd! zbJD6y=_kHA=DGZ*%woGPKQ|BVnM%7uv#*O>-mf$Dt@vy*E?z>Y%eZjMUSUG^ z2mjqOXZ$*K*Lieo*V(lfFwOUJGV`7@bYEGUlC1O(I`}qNPP+GV&o(GN&fTm(8HYT* zzHrc{JO9nVBbPR`g;kViWa!HwUJ}~#N_D{P#!RDSO*fCUp7c0XUNc{{6s>76x|cOc zfhsrqTag$0)Tw-__m|h0pS#~^gIhu+C4JWWqEFi0rn<*79fz^{2T3~lBWf}ud()kp znLVT@FDkV>hnV6o^0WH4p%14XD&Cp(=wv=AnU!7AqELLlf#kEI|FS;DpE`u|>`plG z!)p2Bw~M+d(amose-I7_-hKH%)=X<$p*$k-=QSahKt2@Qx zVeZYc_X?wi<}SYxI&OepP>Y{k7VN75m-sHKNZ(TPp6%mNv1Lon+R~IuD-?Ap4}1UIAf zh3x|M6Nm~iy0P6P*Wy5v|DM=PnIZ)xzoNB8N0)Y@&gZ|v;nN*W1GgB^Ow9^cG&20h z4+Mv6tKUO))AyI0KDqD5@iOg5O+0nTTHN>j$B+0PhxFP$_$y&{T;&|6>jTvjeG~fz z2zEPfpqj7V*x*ERa=E$nQhdVPQ10lTPud0!k~AWnXbw<4!j(>_^>mDMr{+nW{k@z zR34$$56L&$C!H|SyEtZZU~O(gW{!=~@Vf%p2e~>I9OM@pzY-a$XsW1dG@E?*!8%-G zFUsX_&(~H@ny(vcx!dO$zDcE0_6<+wjjF<_>eR?aa`qF!VfDNo@h!6B+~a%va;;PY z>df~#2+WQdC=Pj~+n{Yam!4QMYX-BYs37NoY>%@#Zd}DePOCHFl*e3y{G(YRw9cy+ zJp6X7%!*bFRM{n5LQ9P}M0WXE>1{iMyAT=j(eq)Lsv1}yE^+Xl1mgf(N`WM;17tlSlO{lMUxJ-`K2wbPYH2=)s4fgAUu1j7rLG$L_fkeaC7? zcE&)ypZXt~uM1wYF75ja88m2&X{SFQ*2TYcoVjOBnhtGnlVSds@zvv5U**-3b}zKU zasr}`UX^Pk`mgjmrWa|mrc%jP$1{JGc^XbOXR&iNJ8*Y>3D)ISPF|c`E%u>S&vwd> z_j1{N3(p4}?a?NZNGGp(CKzI`J?`B4Y0fjljTiG1#lLzqslM8}7RR;>V;TxP)rSl` za9zjT0z*6_Mi<@BRZ^rngplHqO}wn;nCo9yRuw)^DEAsifAv!9x*bAqMmX92s1mSfq_z~9Su6Z?i{fRo3L{p?;W;k-ZIac`PMTc?JvH% z+n%8#wn;Tj8&y%Satrm}Q9l1XGx%9%h`0V|onJ{ueOUdx$1<90v|BX|Q>}f*P~UML z&U(pdEgxsEU7I$HHUG9qXi*&QzrQ!Ez6HH&`3Y{4S607OLRwX*{)d2g61v#pYIg^> zTt2PP^_*BJJNsm&N9C~IqlpXVGgS{|x)x_P3fA6Vq(n&Rs#d(Zc_y@MPdB!z@kq^i zN_1x5lOilq1of|8<$SG%XQi!=%zX6c>=0hP*8*zA zey;(_T?+SMl2dT`QKfQkGQdB4R_=}=8H%VKK3Z|`oOlO5lLmQ|9~mFqcOu*sIRsZBl6KIdwt<{Zjpue(t0 zktzl4^Xlj7PJX<)*y9i}%hd3LX*SR7Jhq^H@9nebmM{f3jBcl6sOg=6tcHy237h-$u(wkO48A@A!x6=HQuH3`t_Zn+|xG$ia zDJ17Potzifr+wG|#AxySDow|%uK6{uA9zF*xqTe<+D^nOB-vKo`NfPc3oY$i_JSI& z_)NGl@5ANO7s_g8v}QV&F!#PT*%ws%-uuj)%3SkDvz(M$A+=!bb5$Es{2CwX`imM~ zMe9~?XkL` z>Y!~!Mv?4c+O?HSL{#T-_-2IO-W)ruU6QQ zF}6iTlKb?I zpPpOt=FZTvhfBN_eRa5 zR)=1lZ5b}D%0!p75oyMyn7+3SzNg2>9=0|tNwT!Qw$rxy^tEW)9hQDUGOfj{+jimL z@`ED#fx9((=@Tqx!RfG;dod;N_coW$aC<6m+m6`UyzXcQ9T zN|lH2)z6OP9YsigFo)fPP{-6|WxRH+SJ^krGt^A5Kv(GB;xt@cTe@<#+3N4X6t$PA z`-^+Jqwl!DYw-JiGRN08@iRX)ZpWQcGgp>9({~1MQTOQ)bo{l(y@HLG z?)1KX-!bALKD;2c*!Sh}w9geiN{4PW!Q1nkJlejxe-A|J<6+hG^bfMMNf)C;@8%~S z7gUT=X&psFiyZFjH!Zxc;qmFaiBh-xr81@PJx{6~O#J69l`l%fwW?lp$!w-w%j`*8 z5j#hBp_(HZd4DQKS?n#4!I{t9PI7Kbd*_^(8?(l+-%(kK&-LqCu_SHpZrP|c3y@-s zOPiGAojsOa?YS1NWz~_mBu(a6tenLWXVuxVBPFvdpusG~BS*yVva$!phD@G@#-EBB zv1^}o9?ruWm$xN#J!Le>X`l)cJ}xW`(^x?*=;eLs-}@O$StV1EaCzje8#Br;i}@-_ z-W!eTTsKdYU4j0R=c1WZZ5#h)i+r-)HTgUb6ZV|>gLwR{PzT+C>U<|PS3-ei)cDSK zp++kzMt$HVX-6AsWZfDHY=|jODzY0(Gu$}m{o+5XRy&c*1TNcobeE4j>iM3vo94W@ z^QgmCVaUsjeE$U~z8+Ab!QpP2WSYxbKciJTKI`d+Tmw$QEHo%m~JsM6q))h2_w zr6vIfj-)1Pr59YLw}&5`Y172Xkv}))b>WByW?rJo$@1z>O}V)uCGUfUGg^0iQq}$( zZC*NDGn%3P`4Y)fBhjj!s_S&3B=Kj5?Crt08|7tF*1 zOGao5RD5qI519HsJ=~V9XoI-RlZytSv%|mA2t)H-YPFaqNMiF64MOc!b24vePDkYh z4fMgp{UfpuhlAzlU3bk*-3n$Tn9a+&BW zijXqSJh*ie^~AWP-e!G88$EeZQ*mBXfuli2lkQHp?7sPjM#s;+T3wU+`ckqIp850e zr4-Wxcj#K*847U+$zQE6Va1M*?|R7xD_y{*72Wzj;?!#s z8sAP#L@A2nuN}u)yT0XheGawV-In7#0lc6Op~&s0sEb9LdATJMM#+gPu%O30I@L+@rj zr;NXITFv)9#BbY&9QeUW++4G#_lMt5;Fj8r+>u*@M+W$7&Mb>gl3jnaDt7sal*81v zsy`Am_v@_G-uLR@(qdeH>>O6n%P$xml+niWmYQu&F*!Sr|M|0Ecf_)~_2)OoOq}cE zo}1)MSoVD>yD776a`v{j>x^GK?|sWxel1HllM3VY#zrT9a(AsgRk#pdWwCE`a_sf% zo4@`XQFPKAkG&3n6*16iGy4CKr+kr$$pnbRk5KCm??x2p(Ix<_y@Zpv5-v{ zBd8oURRnwjBUmg34MqsWVL~RA0VBLY$iTmd&Eg@X-k=JZUN{qInN zPhh-|DwUF+0yf3eC^4VIXR+y24gkdiIm{Cy_)*{qMF@eTnE!-2efBgbBAO~>Q)$4> z)2g^^k<@GiO-Q9PXVvqfIMZtX3c<9Wq-7&!^AKDnm(CRcH^;`##LdLy|5MyzV`l<~ z2H7CR#zTN)5=Q|O8K7VQTs{EA;ZqsFjk7y22p_|NZeoH$K{6aRFJeZ6v>awb{C6BV zYY{Xyj}c522TPSeGNABTOmXmkCFCrfFM>dSfcTaL5skW%_B0oe4zv% zD_{!Q(-k9QK3y1GE>#c>>_JaAp%}K1$)K=VOd$l#;YR>T>2G+0B9r%bpMzw9C0H(l z0GfxJ06_f>itit-Z7wi38j1r|0RTz650}qlfzkwcl)wss0N$nXMNA05P@X1;xFGjK zLHUC=gr24G_@D(%cQHuD0#cpfV~R;2LAgv&T9Aw-qyeZ*o;1fOOpzGN2L|yNA_riS z)%3v#P=}!B%2-eLIkYVjiG*Zqru!8F!JrAK;xI_YcAC}Hj6oGs0Y>C3NYKNGdU@=YrIG~}Y^_rT|sip#HuSHovYJV}2@Wjnb$t__5K_f|nCC#SUNXhK$}jsnT6CrGoz8fXHENEZ6-I_V#&-T`CpX~#utgFCuRW{hySR7 zS+&qffI^WTB@}`|MFGY4_xzVi^FS&?27m<{CIs_~P34IYL@M2p&yPTmgnU!!225{@!G}!#F%l zBI98S84DB19xw@mhlyA`jPxq7Urk1N4xAPVkt6KiGvrfhk0oBV>EqRWi} zcZbOTHNZdzPzN&JYxPs@>l|nNjasI280{u(siC zg3URF$cqA0(c2}qMuQLNtQ)LO9f|2c|5AT@T+Z)PpN8Jr#((SXqx=@`xZZRYvC zb871QlxI}sxITTwswedHALeKJ4#Y3FJmy*VG&z32t+yiTMy=1*m7aC$A1)b4eL`aD zrM3T78RNT3u5Gu@e2jbYp*7`0;fC?S(ksed#u=#FN)sQ>{K{k%UNy}1VSQeiSxGuj zaBlnBx91mh`KikdeyM62y_{+2YonQScm1}=hZ!;Vjg&NAgb}ITPG)uXCPl5x?!B@! zlK6JDhSSkC(Tj%LDGNsSU0x>nzWZ|I5>+Dg${@-_Br-Odm0UZeCSjqB6OF72qPY(9`Pdai0DMvLQ3 zd>r%;Z`x(%K4x)v#j#fyR9^cLi{?B%;eszd;%v2=ye+X`IgT9(@6r};P16Z}@`v83 zTz%skQX?=6yJdr01@T#$|B361I@ag}v$Tx$xZje;ZmKu=+IzKpF7>LtKra4B8)^<< zXPyo%v3of8)r$15P=P6S{hE_{v1>~fW$6?v%X~M?BKb!uT54>Sc(vF3iVeP#Ip33T z{=NR9v&-P6Lx(q3A79+Apw-ZiyK(b`A?Ey>{DghDul9?d`Q((nYWjM-{+{-S_;g%T zd8tU~E%RI>bkPrD#`B7v=*O|CccxaatZX{J_XgC@)BaKTUBxQ8cK_JGp^odHzqJk| zPCW0aQ?cFo(7*GCignOJ_Sy>(-QCLE`_DTAj3rggo>~>E^5@ffdYVhq+Z@6IP2IzX zUyL0__F0Ubv?%*B)wm&eeC+6uWHs66>F3xbbx883?S$@ChEa)%sw(&OlBW(oID)&+ z5~GHYyXJhse$~jyCRhJXySz~aQ&f*p_RdOo8*NwacsBI8sMl#%zOlOg*N{4$Jo_Ch zC$e#SBHuH!DWSfM+I1;bn*F5akc;1NOE&{Uvd~{Aztvz;Nj>uo8}Bw z#YT&-J^Ices|D>A!!8zYc*b|!k4xy=&9pzzU%Wkn9C1#yuhYhAqSE4DH{y&pX?LHavkfNU!~Y5H|Q@^Ep1)<7?Y8oF8?R>{fX@Fg!W|xQNo=`mrmKE zmD6|+h7Bw-9gCdRob-;GWG^_!Ah?D446JlC6n2E=U<+O#+}1pg{K_aI)&wd-u&)?kn^h|WZUN|DKml~!_<2kZ9x!!E$vWigR$aT{Ht^+OQ8F@!aNXIxe=*u0>6Wnr!o13hC^U_7A>`!EUBXKLi`DfYizkaRxR+6?F zlklJh^RJ4%kvnLo?#^{{BIOcRD-xM!%G33K@*H^&Hnzz6CLd{-tGK7`2{&Nmw1`7EejJd{|$1}u1@FS443tV5&JWKzg^gjF1i(ZJW#gO`P^=g zW!E>74fTtI&h0#}q^P=ArTUjKJ>a_6f^x6Z+*-Cy`fU(+M`-63v(k*5lN?Oa(g@v1PXY58-t z&1O}L4!B(3$GXQ1+uXjW)E(Ec>F9~~lNYJX9h z56-B{YQbskjDB2W_|g&Ug=kZ5*3R#{@0>O9+fZVUM@9thd59l0-96NvHK+#H7~6~P zN;u7nm=5!z(uuSkTNv|RDbHPTFk$tD()n#Azg7{*mesqW!tCf9k{wHr?nu$Nci-af z@1gmuM6H^H)rqGbnoIh<9^9#iH&xt>u`=c=hs!@+zj^m!v)Ec;-VG1$2cKxGkl#Z! ztS5#kvG-UO+m$Cr9Lw%n%(P8Blh+sGCu?8f>s-Bk+0nuL;A;k* z#&s#%_+>pn>~P&c!JfGI%m&S%SiP3z`YQ^O#7!-EH(f`{?VkB0DjSA7jgFQt zYw%!{=(8BP4JIB%Lt7Y{=g_U+)u~nt;#yA@eknq-b|u~}!Tg@2I1trqp|dwG>BaLa z5tcbtWiM2(_gJnBZV}mS)~{@!ydN)gAUMbw%(t>v4JRz=yR_o7X&39-nm!TBZOpg$ zxbAKe-KZmefOrUzi7Q}V=nWv$bgk;{LWun;!f!;aQ&1b7oD4r(a_=#^Vv~E049dav z68$38_DOqHMe~CKF{x}Y=hTWf;Kuw-5 zbtJ}KL2lrQ_G8APpT1CM_;~iHZ+_~nwWxV9H{!P5zF~mM;oWji$}_x>U{KOSxx8!t zjr=2qeVdl6ptM_47;Cj%Ljvo&-F0-k2eG$^`1SK)2JeQ4xSKDnF{H~xwK zoN#3M(xXM3Md#O@-dCv;nyu4Se)zD2`m8rSfo}LqaQuMYygj^+q+d2&n~Pe$Jdne+ zGRz`BFT7SLU%F(ZdhUV67M54xOL~p?Hh~s z{7UV5cX_MJr0f-meIlP(ct~BznLE;5K*{by2(vdp7Iq*cI|+eTsT~ zh1GJg+7o#uB@qoS$F1Ln>`fILrmi&qp5#LAH~Nww3`(>3L?t9#U4D<$5O{CJI+=H8 z*2@a;k8iyVS(jWJ^ybs{jinDgqhAEt;q+GgQ5D2|G(KVSE%1zxajb9;W^t|!uS2qe zJ0x(v;i+~f)U5WFx~0P0JtU^6`myo~iRzveIt}CD#i=3A} z%}rhQ)u4W|Wgd2H+r|B1)k{*ze8jQknyI_P<(=LcpRi_bIc8kex@FMqrPhmVLQvVU3Wh-B`@p6i#;Y-xDYg!|?l#6J5 ziCN;y_N9=6e#AAU zbl8gV0qPO+2b~@b^jSPSjeKH#?PNL+`{I$CL@Q~erJuWWt;PQQ)MIT9)Y}6t$2KW7 zzdS^44cRQ$uhlV>vvsw&Y~|qbo4~G|0kA z-vIhy;)-^gB=U#Gt71wUx3c%jAO`!`!G@A;KmU}nXD?EKyL5Z0@&(hBsbyZe-pk42 z?r8F;$obgOn?vuI<}uyr4R2}NPrqG1?&U8V5OdP%=THve%MmMNpT0y~y?!Z%U%x0$ z`JwXJM%@Ru?OL;#)_LR)oaqMk9`nYUW+3`t5UDt@wBh{3k&7 zL6u|3c%EYt-~3Bl%FX#+S5av7w&Pp4E*0nG3ww<_v?OoeXvlSIjfWP$zF6Ec)!%7x zut`qd$;WtkQ=ICqg@K=pn#9#Zq1uCbeVg+A5V1;EFSMMcUG1&CQ_$;&4L-ZZhM?Ty zHJG)|$C4)MOZzid&t1k!d9!|5cJI!dw~Xjr#^d%+z4z*_Qpjra&B~Ab&3$PpiluD( zXuSILj+ZC8Ohow+c|q3}9MB3KuQ|VA-e8wC@#J^*!^#8pQ;C-5!MB{7eq^~9I)D4T zJKF!%!q_X@c4WjSD2YE4gO~KQ!=<%xWL4zl%@#Mlq{J46Qexh(dUZ2*wU@7E|4F+f z6vuCVZhHS1B3vdE;T!g9uUU|0flE>pT5@a%B?Sz+@1O|b+bTz_3+nZ{;z9Y=5p)#TQPn0 zm!=BNR!%Ly5;JvLWt^H{9hX+xQ&l;Voi=*8)--jgZY7(mIz#=ZMt4uf z-}qBucB5;Z+vIR|+NL(maI=yfoWPsg<^@mOrtL60X&6}U*A`IecP_Bf?}CH7eg7>x zt>_}*74L0TEwmlT zgE5sIp&JI})B5K)yr7-ELm*DQ*pV%qXtARRMY?w@9NMZ>L$xEila^`y>~W0QT1Jnz a@wQUQd~Wh_!1VjQ4Ei74e!1FY=>GxPeH*j@ diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-52-31Z-00000 b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-52-31Z-00000 deleted file mode 100644 index 68dab1d7f446e610ecbf980ef09f6dcb55211db2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7847 zcmb_fc{r5o`+p7DqJ*SGFCt_Z`@W8`FT==^tuZskXg0Gjl%>+5l$1Jzs3c1&inLkU zkR>T9r4mw##1Yy0J%e-3ce$?bU%$DociwsK=f3afbMMdGS_wg7VH6_NE%(G8D*!=K zoH!;4;(r8*3<8t|_65Va6e`h$9>IWGgaA96gJ*I67C^+1SZoS|4gpTcKu1r<49R4X zkPw1Q;rK0YX@V_71Ct0sxETROMCqHDn342|CIk}$Gcz+I15*?I2os`_0Wktkh=7D> z3?i3GVnZwVC=hrml|jIB7%WHxEZK2v4v7XKqVO?zHi1Q9axioP7!FD4Lt^}w0hIgu_isp$!6eby zY$_B0hzJ&!PN&exkRn)kfejqa9Y*Px>6pfoVLe0Gl}n9-^-+385Q4yFvN_kL!l#SBpQLn1a9W>mg2T`>;F^Sc)X>+8Gvly zW1}NMGI6-TL?S2{0G9y(Q5kq5aO3h048ljWB5d8Nrw1XZ6#C934g7Lg4)H&6q-rC> zDRg2Oo)gAb0wF-*lS!Pg|4PVZI)e>?{s1x9JWxjA6b>7*1xryPDV$3N6dImq&t}lQ z!lOt84vrGP*k%NT*Z?Y?Oj@dAHslFJ5GY6#yojV2zGEST9wY;n6uJkA#$d%^cuW$D zvRE+){l&td(eTU|V2{CK6N;snZ$x10me=s$^VSmh>__3^f^cnSc0Yz-9hv4 zVgjf?LGk@ZYZC(I#y~t!6#x*w`_LG4GAK=eM;xq>NZ{RY2Ac!{7?O(wHVx!{1So&d zh76WzbOvZai(L#t7(%O;_(&WqNKhIHloo_Ag4O~miO$b4UlN;xW&nfeM79+$$$0T# zB&b8sa}g$sea^rPg+f6H)5U&;L=wZ9cupjQFk58R(Iw(Jcz_YL3=;G(4+ar{1QF*q zI6jnE(7ymdACg#t!=|F`906=VGgxHO(Iwz@nEXzwX9!9C#e~IpxRK(P8I2%0K-bY_ zlUTqHVN5)m9m`-5m!*s$*?*V9F7E@4CW~RR{7b?bkW816&>2w-E{l$*g0TY{2dIAt z4g4=iCvl(yK%vy49|E!fiQk(+gdxN-biQr>!2TDg{{!X{*Wb|i6XRcDfj&(7cc1ak z{nyxS;sf~a$Uz{PAU!_wQgTC~d_H10mLDj7CM`!v@GoomX(76#hX{TOE@!klpZr() zIDokFea{B8#Y9_L@ZGaC7Tp=-MXyUOC|EHI>eLE-%~`}xvzkj9WIU_nQ+!0e*n>1?D2o?y>l>_lQ&3?2UXrkXG1tQ3LC zwIdQ)i`8!nWTZfI9;90R0I)qq+#m@`% zp$QntdMM*WJzXD+JH`%&2@6=7AWIY9TU?%^zq>9^y!-&0FJH{S7)HB0;+$az z9BhZiy1*VD0kC5L(1Qay!J`kpU}s-n*w+Kb+Aop}U@Y3*W1G9TgE#Epi@_Ni!X93p zKm!`<4iE*vIPhR_d=b7hI0Sa|0LKRC8NFFi!3+9^g!1u&;*?Z08rizhU_}_}Fa#xz~Vq0 z+Roh_4sd|=ob0i7z-|nX@P*y&oE>5J?R@P%4nQ8uSKHI?hVoZYj{D>s5Gca{>44Ovh`ms?jT6eip2rY2pFJCV4CuBM}orAHa7-d&3^qm zcHPxKcGxBsV4RsJf`*PCP4f@6xN|-BXY-xwLwQyfmhh#bI}t_qtU^Yv4Cg7-F;@%A zhD-gHE|d~;6A}}X)mF+-IX57nDebMK>J)bf%GXVdzU-U=iM{vV)*CXxxEg;HtCW@V z`fKS-LfHIl?bX_=r85>@YdWR0tw@w0pKP&lZd2ge6GbQP&alJY-}6>2d^co&V)YvP zGxLVB`h^v*EDIKNhPLFG_$)9VCTyTtjZdH2>hG)=kb1mv0P$f{+_e9u#N7riuhmPo zXijBI5!a84SdRWkrf$aD*3K%Px31F8=u7@06gO2OnP)9}K|_{UZhYXjc)2__`@*^A zQpv_9m=Uv2{ByP}QRK->Tz8Ag8LhFI<3-W(Q=D+P6)nu1&m7nI_-akt-M$Iah}smo z*tk4mPTM0;+vv>MPSp9lLm5t^szfx)ZkZl}ZVW}P`L5!=27JFsi=gk1C`%Y_K)UOM#v&6u8IB8uD)4P{+Ep1g5;)rzY*2+ zod$z|urg+Chp!O$@Q=wmFWTy5RRBZf} z%%)=oft$#PMP*k3Xl3dr0xYmK=m$ncUj+m=9Kb)-5=vsd;Tbuon%6u5wp4D^- z8{Lb&{WFl(Mbd_69$EDJWMlcdKzA`I36yL__l92H7Fi(+(3g zC)uoZ5`|kcRmX)3hev)U1_d3vJRzONJF<7r$0+X`O0x$D>1r=Qogj|OsXz3%bTx=d|zZJ1rJb*5wHn!-#+PoDeFTTynjs^ow{ ze})>~HF|XF8pCF8&L(W(k26uX1~em|ch#(WTu}6CPCn;|W0a_j(#C^U*oCzjYGNWe z&r%W(O3O}*3We2k47Fd>SwjOTsR0%2zLLyHnS=_=hS?FpaSLqU?L+czmRQ2-O3S*Z zb0<>{R{Tk{8T4_C;5Fg}Pyc)+q%w#;w-TY7X0>5!p?kLGB^PP@%X2MCu0?-5IwyO! z0`aVA*Lul4XY08k4OaN35HfEb8!s5Ybt6&m`A59Qe64D_zX>SAXP|YmS}6b$XY|H!5~o=rrQa#oM+)8DHiyC3jrRZC{sGl$c~5 zmZP{e-_X2fFLiI;x#Ezd^A6*J<9o9c1pEdiGKbG>ZjWM1&^lVhS{r3-%4;F(e#HbI^Cf`VuzKbtn zpMFeRz?yt~5cqbBy2xyk$FuL&9_pW(zZUJ@;rhGJ|IkmiZITx{thChXP4ONxU-f{p zAc}LBrNG8iBigylK+6vTmqm+i>?n6zyC+$^a9#46gYAPaLZR-gN45v7w$i@ctJ#Ag zd}hfjcwcJ?=ZHstGpEXJdq((#8?&nDUX!JlUr~QUIn6|*Anb$uvGsihO|z((#7)|T zwzz_q+^p5j!V#iXE}9C>?C6XHt-Pr3&;9E+?~2+`e?M1mjm&v#W1(Bx!(T+h@JfC* zj-fZaMKoajXeq6)=h`+YY%bXQ!1_?;fXiN7wi>mU|%dIbX#; z?s=+nF{@r&yqsLKuUGrYF3Z?=M~mA|1S_BlpEaj!_VlHk7A_Ao2=Z^=U4p!RL|UTK zcEHzJ%18CvVcULHQRxy`Fr3;4s*5Gh_$a+V`wlV}`_xn#T$9(YOX z`Kizj)y#`~(Ut+vYd2c%)41Mg_Y31Am*zr$pmj+3hRN&I+h2c(%02V#_9-j%cU2XL z29|Xl>TLQOy$+iZ++Zi^aO1}EgGDRDrx}hkgE^GMK9kuUn#$9>;G@pUHcF@CZnvJ6 zxVN+5q9aOK*6?7evRm5PrWSZ5LP=a-;<10^U}e;^M=JzvKB|Q27GW>CG_GJK4|kF} zw3Bo&4gOws1xA%#4SMNtN)CGe=%4D}>B6vFg8YlOQl5wj?=)UIRaaI;#3exVc86ir zlR@>XwJRiLNgj4VPIQI7DsSSrmPZQ2$ z7CB}kB(X|K_UtV$#ZP|ftJv~HD7Q^+HbqVp{H?rf7f_w3gfV^=%j{~{d7(kmvGV?_ zqWKs%!gz(=o1z{)M|;sj{U;=g4o7SIuQ2mHmSRN~H#0j6Kiuo&dK9sCMC;d{tooke z2a}E>_pPT@+^79ae3{r3nH6Pmtzn4#XnI>fq{u*?`-d6j>$16l1buhy@EB#^vUZ}# zDtqnw1{S%Gwp%He7u73OdVlkh3=ADpF;%?2vdW1pR~$ES#5vEXVV@z>oM4k?fA4fs z>OlK_-kyrym1Mc6V}ey8X6s3v_b8c53b%*TLSe#Lv{7cA-){Vcp3E}bc zk(0;MQ-{2*YAv`UnV;5QGn~YJ?DE@}7baYJYwg*<&y(=Rs^Hsk*I4vUZ5=P;PX!H! zhLx-gH7xYkrEMRO_=G4|G5{|l&78H4HzF%w4IhEbnD&X0!(U4K zDlYleeBD*;`{2dnh}njy5X|^`WaIVC11mG0aNeBSUy*=%v7>F`Rk%G$ho-@{vp(mm znPa}|w#WFRIa47$;fC9^%VG|0E4*pBpKnIUtf@S&^=7~0k)hUVy5L5ks=B&&4UuCf z9m;*=OX^X*=_NSP2l}G^b(OA%%Q*#?vpvk7KN8p{)x2(?=b&#=m%u(aU(kP7e`-!S zIq0D7jkBA7UHTE8-kh_;C&#qR>yP2F7HkcEB>f}#g5|LO!_RL=s#gd3s~Xow-1gpo zzU}-K)c{&)f5XGAgUu(I7bSOfD0ZjuS~t4b-to+t*S3EBrT(*@TIbM)Z6!U!rZwhk z&ThHmohoBYJ^zb#MsSOXe!%?!rJ7Nm%8b3nENw@>>*3)QEeisxH!8U7x|ccGp~u;` zuc@&Ck64*-#2-HFcrbP65!>OO0y)8W0|7hn;H?7sSYdAXC+7@>w4t%NF;ofMpQoL+ z_bYFBL}-elf|s07d=`1>jntgTwND}Gf-x-_t9E}kbzAjZ$lm^w2CeqaX{}g`(lRmk^) zdlMm)W`DxFqh#;?{W=G_-fw#-d$d4BdbB&xqL+?U6!fpxnkQT#lsX^d`Id-tgf{-@ zNi}!Zx}VeeEad~;L&0Rz+m1YPy-f5YzYYO5`+=lF=eyctuS3Ly9>!fcv#C(IxVdlg z9wFdVh)YeskTPq_VeF2FRhg>~AFO@}a31p$sKj3L2|7&F}hnn(CP3u*AGgQUA5*~MES{#e@H@)g49&g~- z`0{8$BkzcJ;{m9qyd4Vet27h+`5;SC{mLhi$e$(0{d=86G;1!*3w#p@#jsbrFVNio zxpSM|aTU^~t_@f3wh0bLR>|{9LB-=Z6*ODPG}|jstq~o>f)B)BscI!-80qm*?VA$-I*A zO~a}48MEQLq#eC+v?u0TCek(LSYEPU+;6l@wj@kGyj$~%tq%oxAbI|f8+mBmhnk8{ zDT>LN)r2#LtYeFuj|CjRwLviX(uQNPtqMFHrE8Gfy^d$I4@Yj@Xne8iSU;~Xu=M_& z1{qW*yv17+Nwa*$y1x_tk%L`vAT82?^_hU>kkF28bdj8Uvoq>6m8)h8!IlE25w zuzJO$sqGp2RLUKqk)&3mCT*8svzwL)Zxvb+BHGv9)2YR~8m6tkIkx^l z`qJxWB0~;kwOM>fELt^~|0sN-)IRlP#?8D7-}k;Yi+4mE`SR+(i<71O!{y=J43qXS zJeH=%klX1gzG7rkl7~SZm3djjtx4c!ko=!Ne4H{KE5uktGewpCw|^?#<20ouKCkz4 zIHa{~xZEi6>jSfc6|2sqp%X+}RJ#2annc#52)yD2N@oa83L7eIIf-ojhAp|W>itfb z7k<6dzyHOX8ikoLjo%-(xm*5zrI@{y{Z-+<=LX?lE3YdKbgbV>%`)*QtD-!(d)RV* zuaQG7Fa7k!HOSzpfj6RU)%8})LS9nloVxm0PtI-BTOUmP5v~&#^}x;0pD{^MS9gg0 zsP>_x#L>^kak$9yio`BQw6^|a?S7;B!pCf}-BTsoMc=bEJD>Yjze_k{dwLQY{GI;;dv0Lfb|me0e)a3;jpr$Z5p~5FMrVhtsx81w$yupnaof^Dd#m#McZoVh1 zu6jQG>c^>|-;*hcru{+5Bj4TaZEvG4&meg{bCc{JH5%DMgKzN6FS7OLbu zzrRP#%x|}slVNEpyNT5V6i!9$)4u;*dhYaxm&svQJ>|X*_~dDKxm@sEU{NgRZ*Hoc zr&MxhPZn}#CxtEVhHhbW^_}zFzOK1joRTn-o|x;^{p5X8R`9RKIgbXaY6De+5;|x4 zXPckwifpzh``nw+ z7&Rb;rnKDEewBJe(&y%hs2{jD48Qq!D4v!Z2p0*(`0AES05=sE|m6HY8GM zRj8=6si^2p3yLf){LT#T@_oP8_5JHN*Y!NlocrAOeLnYo>SjQYY7mXxS?z=6H)@3k-XS&A%p-t zGO$uW3?={r#F-38VH&7|KtPLu48f)r3X+$8&=4>j(!xNh(hn9oIypHB$@BP3u29H< zsDOwNh`C%gHxyb37T#ckO!kCP=C95_T7JVqgpkZ3Q9dyhuKq1J2X?FIEO@ z1H03>Q;gGYC2%Ed0goHWWS$reh@ zMurGzbmp{ru9zcJ`)3Gbev+1rh|NVtG9&4ceBkEj=&86ZU;h6Tx9I4pz+pi)NU?E| zAelsBU?Kw)41mi6fH*uF1GsT|2L|C|tfnttjz&WW4x1Y>r9oN_(;@ylj+_<95H^<) zL=y!`l|Tqk_@PWu(0?W5G@U1eK!1RE!e~%NA#9NlvIk2Q1~Wt)3Mi4ZXh$KB>m3r# zq>ISxSXrBqQxF2Ev{2?$9Sb2ZAc8wW>_+-+c~}2bSO?8J?hdc=G|& z5m0>pYHbR@TnQ8nssaF#cArQdHx!g6z@r9MNF?xX2v5j_01OQoK^O^gp9RVvv?1&? zjmrZqNY=$5ge5d{ijOHGfdq|Yg3^KzR?r+kWpbrCMqvs?cpfl_%Mh*xCRxi4MuIv7 zJr{wK^*O993Wb6YHnM(&L^4A7G*K9Yu$8fzTQF!M8o-E}1_^o?k;ecaLBypEP6{Oo z^e;fbKjIma>Ls|ECmbdLL-S$-=biPl+{vWHXI~%M0g;1zZ{jj2+N8K>b5_;D328 zQv@Xgg<3K{P;&rD+M7XyA;dIvscnD5{s+|m0dtD$FKE(<@lRNw4>SMMXVP>38M{SN z0RJ612qY7PmNHKzHxwx4V}y{Tfs$s@bd==(v{srHDpPtG;II62Mw>{pgBqxL`O*4EVQ`dNIXvfOqA9?LdyNG;im#PXarfQ$Q%WF&T1*E?AjvrtP@QT z#pXf?87yf|04%UK8Ky#i-BhG(Xe%%lQNVS~Xpw*hWr2YGxlac34UBr)U&>$)rhv=j zz`j%08F)%|CA>~19+S3SsehdX%*|pZmmWiOjfHLk4@liOZPPNq;|AtA$JECRmWr8Dh-NSw zhqSc8p$nkp^LdL^HvJXsh zAizXC0mf5pU+XKm<%2Q zSt=rx28Y1TL~tw>Z4FaM0EZKvC{=A~j-L8p;Ao5tDgXwKAbFGUUKH4YKn4f7Il)x2 zgD(MO&D57naPf2_f-`}^6rvC8;7gU>uzZ|+9K4)hXS6l2*pG~N@brYKPB7ZVk>mjE zCIATv?CId@40~>rYWHyh@+7GeHxN58@}_1W=&lGMJ&Y;6^iExJBgNp}u=#%tF9`Ai zVzP@nwBer@cMv259-?U$4^pMG|_uTLLNQBl3Ap|U~qjpzM~mYP|Pt86?SfzL9u`236cN57h3 zxpA4sxSC?k(4om+_jp|m zHMz?#xcLf~&`Yf9)V}1-#^>(+espQiuB$pfYkhi>LtD4)^$zrl>QY`stTValpPTSP z-W(I|9v1xk8$Ut8{em6kMr)c$XWP}1XJ=i@&NoKTPbui)NB6NOiy;1}$6d=T8*P^c z9S=h)CwSxGhE!;C;cT7T4v(-*Am`99da%Zwvz7oJy^-&kDIL(gemLmXvpb>HsXT===T zpg!tW)km8xMZt>3T}~q__7>w*d368F$@@$H@mi zTz^qlbAFi}kr8=VMYITo*O@1tKX`G0(oaP!z0B+GT*>#P$$fUmKZ-S6lFIy@_ARWc zol(-Vq?*Docn6u@z|S_-EiLuB2vwL!T5F8F-RA^(P@9{(@GMN(FP9ZnX}cL2-_R|O zn2+xo`#e>z-g88CTyh$; zb-Hc1j0>7=a-aJ-`mZ`;^USV2Oz(e_ZAJSOae94qP*MGimqT)y@tt3;rxo`G_r@wd z{Lp3hpzip^kxMqUJFZSXP2W*Ly`N4ACTG4HhR9>rB%cJSIHxu>FLszLmGm$uor zjOP}--#Id{`+my`seCO1$fgi!N-+Hb#r+eRwTOGcAcKT{%hEkS9N*L zc74O>1WrOhVc4dtq67DYT6N-5ZKXvn$H()|9PFBxX>X`99x4CG`Gm=-h{k}$S+lJ^ z3W}az-*%;)^ss?tn`TzJVtjD-dWQuC*CEvnthe(OZde*0)p7j&zDdLMX;)~O(*tZ; zS{f-P3vvsNF1WVsYf||B8b6}LuU|!b%1)+f&Ry4kd1f8C%yGMdnbKBj=`s($S9PhF z_xMCghVHroKmDUc!<$~=F;!me_IF!HC*FLz*=rkoHFTA=bw9UON{S_U zkp8}fT;{=~I}C*OwNc;VO=k#gsJLCT_-|2lv+Ud(^{{ebHdQa0)}$?nwoEol8P%Rs z=NRmhdj3-tf!dMg=V>^4bKTPJ+ab4SJ&@NuGXI(G;$*Vd7-Cr4b*({s%Ht1e0RbuB zQ7eXwMCK=0KG`2boF6NsuQ@&t=aKOl6PHpKY{;T)b5}TFUfbay*|5FLF+jk39*IL+kmLy3_FAbW9BSDhN z<;VKFape<*D-J}R3EyK`tBNY=>q|4auil4Gtg1+Q*|9vxzvb;|{XHv4w*IsDAG2N= z*^JHJ?Q|*zA*{k4%`~pk8q!vDq^n=iYQkGsI)-jbZ?%1=m{CS9{O z_4{f1iA{s)w-CEe=OfaNMVmQag@?EUKE0{U_X*Xr_ndH_`|#AYPv1$cth$Z_T#N6w z#U_q*LEqHB6$^(aRio4#V(N^1E9Cjw#CQj;5$DyF_bK5fGc5v7bt-pbt;R3PslK_O z+VI>{Kkk6t0|WLq%iMRwOw*euR5tBVd|7=}e@|EayqCTwiDONl(2)gt!|0`jj%?NM z-Md?QyK$wMa-D+~2kPnWLc4TLxf7Rp+w0ra%WmiL0wXQG%SM|iDXb-V7M`{5BiKc_@EeK7OM`gUM*p^1 zo|%6Am+hY`6G?-lHX8rRi}@Sqv!8C#P9>MMM5C40UlOUu%|F}{C+GjwCvEp>|Ad=< zJ*kc%`Hrf!3Ns${5pAD&+9RFe#}BpdBeH!wd-rlSouX*2G1O9zv(oEzKZF}L%htH6 z)9PB88hWYx@!TUzxkW0KbC5f_#c3^$owPPiUaNkC_f7PL>!_UPiOULW^93uIu|f6w zQm(yoy&~6eIZdRrZ0Gi?PC3dqVCsP*13{1fP%EjwB3#XULL$~?vjZ}QhJ$K(8ZIh4Ju#eCBdiW=E-mTV`hU-%*(oI6Ccf$vcjBH8KEIF9o zWi8%?Hga@W5sn#KfA?I58jGW|>-}NBJAN?CYW8uWKsqrt{Q2rh>>!L(ADX-MJ za)srp9kumKcO4=Y`#XJeq^zzrSW6Ux};KX>umc(9Wgf6qO(>AEFPn{diNt@jG)#=C&5K%ipIY7vS~Y^nbRl zS&;2J_9aCr3fZp9&j@vM)m@eq^SUyH{XRJCTE=^~M3rmx)$~`2F;5Qrprb~H&CL?W zRh6xjZpA*`qEni^tT>BZT(H8~sORuPj&jZu-dN--&BZE`9Xl#BJGy74ru$IK;&SpE z&tOe&sF`k<+?q%6?~AK@i|hS08>_U$r{eCHGtb6f$SV=IYm|-r7#&!6WqY(}a**jW zAvRFYty4Cy*;D=_JW?|#>HhcI6Q&cDPhB<{%s+4`?{)i|z-9~stG?%xfroN@qlCP0 zrpfCv?|hM|`J(G0DlRKQ@pzm#PwbLp^Qu2l)M->FOus-~y+!|}f$D<;H_i^5=|#2w zmi&$<&s(q)RW+l`E`#a_AI`_bv~bv0qha)QNOm^u@!#?HDbpKO3B<_YDr~sqZ6$4ddWJM7>~izsvtf5 zAKkc@g8DEKv3J+b>le<-?GPHPXFqy#rTjTw+wyTtVRnJ3CQBd+9aT6kFx{;l0PlS1 zMW)Q#=6|=M-t@7OUdJEW=Q`=t7-c6FoYGEBoZ^=Ib87jUKC7>}0Y4Zz_^olw8k%vz z&V$z0mbau!RZ){TUt8e6SUI}bPSt7OGM1;=eA9t=%?y{h!}*Ojaq6@?J%&Z`X%PQG zzTD1)Bi!uI!fU|Wqw+RCDMv2z``~2t;kD3~xDD-&@dG}D!g_Tp^_!&66$^)~J69cx z=axG~KMLBdK?vWcqVACOO5-YuU%Dmu#V_^7WY2;-{95|DO6Bd83jRqe%6XN8==_f# zv{!5NC|k@+erg=))S_tPb*UyGlB!_zQ66=i)ZVaUMg!&C%y+5LvkW-iF^45zN;tuBXKR(OvA|{cxjyZ1nLt$$CfY z9RrOj6eW+kqixfLM^26;OY9zRYrEjm)G%XFW(D>q7@7wLai>R^M9rx~{5o?#X-i_cX<7w6+fyZVgKkyYO!$zPjkLvee>G?R7iW z<}Io}P8#yub;4^6&V^F1EN^<_9J24&lg78Tb9|y>-)Q$g-$IBwVJDtR=%^rS$PHdw zGI#OVw}Tz37Vhw>81b`?(>IKblb2pmTX%hk{1Q^=vqBQHHwiaagqmo&Gd3 z%I~U*h;1TT`rwX{$mO_J?+>LvwoR<}pYe=;L^AlMByGUWKS$uVD%l~^@Bran@|(1f)_u?e=Y^&Fl?o z;!aWulcTbts&2hfjJR-dj@tsKlh(z77j$aR?EXRsT(^dHwqfkht&IIih>4R0?Ce7t zUPsSX-(?)Q!Pt3dIF!Lm~;q>e5 zs2Yr@-ps9<@n@kU{VilcaFG4G&6pTfy`PVtmEV}Dv$OR`@yiaIp9`X1Ei}m55j{ue z!CHyQMDxoR_1x{Th~C8KYkWRw_97Pdva`gV@+Raj&>qu z#v6D1T=&iRS7QWkfUwZAh zAZ+9^0pG|VWG@)IyZmXc>#08mb~ZG)f4*0>V-s@H@R0A|87@_>@jY(*E%V{{gUMfA zYJCBQ8zzQd`wj)2m*j4Z&Dt8SIC=T-f%{t)KJ;4>v~kJR4*^#lTRzUv;^0*ay diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-55-09Z-00000 b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-55-09Z-00000 deleted file mode 100644 index 6cb8ef450ebba7b3b61d46c885d1cad5fdeeeccf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7306 zcmb_ec{o(<`#;8(2q9~9h)`zCVlB#GEZHVAmWniH2BVoX(=4`%L=;7fvLq!-3GGFw zNDJCjN}^JcR%J`lo8L3TyL{j8b$$Q(&2^n~=DDByzMs#%KbI9DNFj{HfT)Rgoyk%V zq$-T(F(L6!n!%+*d0<~UT*P8CJdp@4bVmlT3xqVj@Gk*W43jTlaS;e`LIeyBV~^(X znP>TS0iDm{2}wvK3t>WXV3Wg5h!#L7 zz#{=G2E?@i^pIw)&z6dESx4_GGHz;%}v1AV6cK1 z#9XW|f=!DQKx=>-&=Ck1&E>F!=m;s0b80l?@85keP&1p5ynkI#w$QAJ0vm~8QpK>OdJ27iI^e41EF zdAa2`z<1)=OEtQboMO-KV6u`?h+5A)$N07wvVaf1^>i3R-& z5b%)FG#mljh3E!g0~$fXgt4U4Fg$Um#aThBe=?CtK3>fD8AfYJ6VNf10wy2$A&f^8 z2x7T>#*CB=r176pBhd(8j1Creg5`-Jg74Z=o8;l*$I6(bFF2MiN2vZ29 z0fnj(KLqCilDId62t%kD=wjRchW!ty{{!YU*I&@Y6XTz-Kp$rQr_aRa{xfz9!~p&~ zau7%+2q$KqPHt$On2!-o76(e4Ni$KB{?l4us`=HV7`G-Py0(5?8W3GOg0=i zeVu`)WtYN1V4M;~kucr{#@Q^jwp~iV!(>;gWWFzh`CP7WX&fR#6Yy5HU?k(PHi_fX5TebGDhkIV=`4qxzV`EL*gd zoh{a573@L|fSq7G#v1DmgvEkxOqx(64#-N7XKr9S(1!%Ol3+501XC$4un)x_CKE}p zj|&NQ3ATfY;%fqhM23B+{$R&lyhDUteEb3d8&xbuuz_8?-6$TgD+MOHkUe1^pJ3Q6 z80et@o#4TP7wkc$!c-ra>?|P>V6uz1Pk{F-*Hy49l|-?zf_?mafd&_{H$W5&Q@}%_ zh(*NG;1Jl&2OJxWvw^8(fWy_rN37ZkgPZ=~;W)emDgXwKAp4PBe5o*zL;(kRy28N} zVju}*&GeT-a`*Q10cQe(sXqQNF)&zs!}53aC;Ga=Za5oY@oI_-(c2pic7<{7&SWC6 zn*=1Nus6}e4fb9m*6!~L7Bmhazx=F z#3UE@?7@Ft+(D2aS;+u6Del^eE)Wz~SiQ_^mvN2g^WcG)pbc=zL$@8p&&-|DuI!8r zoZWY0@6o*ukIyebTOD~aS|zhUDLM4!V0n3l#onq9oY1NiI=odyZd;#bw|vvLR+~M2 z(Lc1czc+1Fx%y1YoxfRKX#vX2ZP=jo=P37}wa2FZ3Zqw>HgDb>wr{L5SK$Mz{C=LU zcJyqYL=-ycVsYD^q)lIs*N-nv6`K0%4ObK=ezyo(xXGCa*nSZ&uKW&mRD}+ zF#hZOgXLazPAdiGE!JC;2A_t#N=RH1#Lg57Oz7p-mzBQcYtZxe+$%Kgdwgxt_fB(u zGvVF37I#Z--MDm7dC2|+qJg7`w3d#wiPaf)yd4o`((QPX7U8yE|NSd6JEWAlx_7sE zz_!e@n_4dQrGd53!+NdXF^%`{a34C16RdYGuR6STN#(f_SDSY`oyMgIR>`Y6rTi*sXTq?A z10QqP^iEzx-qj^1*LCu!d37X>F5IT$>+3?Cy-4qH%3JXcuF3r5jE|{`jnNUed(4JQ zsYAO{%c?dT5cYfahlS@esm5M8*{h3AmH1*jLJ92{B%&|<+f#j|@ACHr8qGDtH|ZLq zJgtPE-Q)7M@}}MCY~3w7r6R$#gk3+kCXPf+Li&v_2k(_kcAv(X1SgzNs^$1R`&qDL z-j|??LFw_$H|V`F$Fb@x`}ZN$PP%{8Ea(ea6*B2q*qt;r@&Nf=PPe!9Pqu!cNyli% zD|czNU>1*SXgb)xrel9EscR7^EH6<(@Fu`xdy^>TSn-(iQs7XL-JBF=dTax@dv zk`s@6HPaj(?&LE+5Nz_;7LC zt0}FP!zM#xQ`A)9iuFPX~ZkTJOwEmb(p`G`s z8(C`KZh1qx_p832RVk4(*iCDDy~UMuN;Oa8*yl9%yg+NZCZ)x3V~0-d*}StiMjCGh z%6*sJ`MOYjx%?K?qioY&L+d(}RwvC-=}yC}!(J8nIc0Tu3f9CDzxVaM`xe$K_0sOI z-XR-sM4ecXiP-mjTAIm*6G+P7 zOQ}X*hP5|FV1~8G(SI9ZWwA@o461)Rj~x5$P{361!Pfeqivb1QGI@_ig+z6&w9(?G z)lXLremroxnkfp(B59r|L@U^hwIOroZ=Ovudg73Lxl0FgdoO86{|;0!PA+W6+hVPP zqvx+WA1oZ2eY>Nw-+x($LdV*X^_|gYNK<3ao@3%}hf9%y{G{B-4H_k3dzdw`6?|9b zz~VI-H~mePu%7geC74B=?}=_Y#9R`ure54*87~+ANP2WiA$B$~{<2Y^+Ctu3pJXCp z#C~!0b$aw7m84A-$b#et9evGm#;M(lz6BCCLcW8`1*NSN#!g$uV%1zDAzG7nXSu!R zilpVW)xL+m9XWCP!WN``gRk@UM`|CNvhMWv>QM8aD71y`siXS}HtklHD!al>Jo!+m z;#NL)(57IZqn^-NyxMbM|HzkGed!T_eLzL%)lHa(b!U4Fdmm&x4D6!?%W-`gDb7Pf z4F^2RR?PiQI(5222kG4EkdbQr`1!Vj>l51eUuD~tM{V1dzD+r0(kPCPH8LwDOl+?1YWbcR!fFVu|h8<}dTjcBZ_wGPhn<+eTyL`CDIiVtS-=AOw3 zUwoS}>0ieGHamH}OjVazP+h}Wzq9NghiPunq=sjqWtW~g2=qu%)lm}*Pt!v*pDU+C zd}6%o-C~q=c3xW3T?4AZm9av)`Qyn)yB(Aa+=u7%eqojp$cCenCfD)Wa!mz2{Hc@6 zgRoD=4u3K~pB7zr(R<|ili;9Uh<)qGV|*(o$MaL~#zjwM3;i?)QVnLYq1jctI(tqx zn`ypNu2{<8SlKtP4BYhU!U{Vfwv7GjQia#9xpQZSuiD>KvocFW#ZnG=SasfY#SQTCwTDgL(ZguG=_GPWJU0O)$hg#g6wezX{uB2%Fp&G-;kY)H78^vK-F)lIB znTY=sns%D>3zORaF@(Pdo^|iRVV+@O{Pp_KZRITyM(fm8cMWM8>sKxdbsLcGs2d}B zbY5^u8RglN?otNBCnih1HQz03_~GHe+5>uFlIF1up{D)f?Q%HTxv> z*}wYhEp64VdrJ$y&pFc|5gD#cczxjTL+!SQ zZYyh)tJdiS?D)x`&#|&wWm}@R+Hvp2#wb!#qkl=z4Tj_VR@tM1Ce99?-Z@Ne^uFsE znvR+pq)S`*t?`#b&pKE+WN}jK>pMH5gV(&SS)ki<(KW2ezR1Kd^aS-_e2qbQeoC?I zvI5gNMlzos6^XR^bT+K~y{CBN_fZ4$lnDiSYq^^V4>qZvIJmgE(iTjhbQ8$g;oJ>EhZ*V34hnjiPm6}_3d*pMU-wxPPW|RKFX&{20q>*%J zY*nuNtv)1{CyZOh)H$b7py{aj!5Mc^TP@rkH) zs^3)@YAwe4+4J=1;o5S_i!Jw+%t!rE%udd^pEXR*a{45jYFX@=4UC-`>Qg2-OApM+xa`lORQdFX4Gs&0nqpl4T> zWj0>%Y3|7g?%TtV;ywj|Q8(ISxmOxzyAr}t!F+p{mYHTlv;se01R z>4&yC4rHvY#l*;+rtMJ~&KYj}VS`eV3A!yR>#$0v-JkC`sK_gf*>L&!nOUwK z^6OoTkHxRmjH?J=aBJ?6g~PL=VXH6QK3z_4-BR0SW~;QX`I=;Bd`(JY*Q&HPnr7AE zIE~M@AIX?rgR=BC5YOmDeQ;_I@nc}!67TLa>d=8|`Mq(s8`1~fD0so|hZ;Yt*9>&z zb?Fy6#lK#Ca=VK3gC@_EqSA|(l)kwxQL?oYZEtW5R{VUtX^3wypzQZ$&X<@IlSesP zw;SXwwVKX%<5i=E$@-_y$lpD$x8u0+q6k`J#>Hp*l7|(;W4j&I9lHD5;xF20e|Z$& z=t(4Rvhb}4uW?N0zR61Zal)hN*rn^WCEAK;{Dz!%|Ht$ORQ{0{mspvihE1`j(Y}Wc zYh{lu&MVPzo@k%_=~Qo;eEr63Avp}g-5z`Q&3CoYBWVqWJ||uz+(@QP6cwiF?Idkm zBc1sw(Bt)o?e4YQuk&8)AM9|{2sm$JEz>BU8@#9Y4kggE!7TY(-xFF;y|R{@lHcZe z$5IE5*GkR0w4v4vW$&^}Q+}ynfxKLJ-p7&rnAR*L^!kU)jv$*QA8TH5pZ-2dQ!SeR z(UZ1sy~{;gB@}T8am%c_bN!msL(`61R_khB(3_3g%ktX~J1op>*Wc-!^GUC8eB$); zHH~TA7gAJgnZJrIY&XxnN!K0~q7n|>`$o8cjdOT#+iO;^%317oCCd)=VzTH1@>lfEzc=g5syzak6znJMa~794z6A2z?YEbF5__t}>neX~|# z0&3PY(Gv~~$7MDAp*eEtkLWpZR|5R=4jtv%@ng^EwhXo{xSZt_y!GCAzq$RHFsHX0 z@$pi6=^f81n^n|P?;a}cd15zdJy^cXVR2I2JoN`FVj_RH_1r2)t|p-R<2A`%o48p~YW%MZ&~lb%lx8 zsflHVmLi1-!H>!MJJ+uK3ag$Pf6W}G4ivs3RiGC0z9ja$jC|dG`46{&w^L)+?k^l$ z7=LWy5vReyxhU%DsDVl60+S=ZU)o+unpk1^`^Sdvsj#W#KbtfAjJICYsxPe{{VKaY z{==)bTYmk03BH&u)$XU7lXC0&5^^`6r%!DjAF9j_-E#MLeZkfKAF&aMoLQucr*3=|pAp1a0LK55K^u+K`wd4Oj;K8j{U6_XUSI$K diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-55-38Z-00000 b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/diagnostic.data/metrics.2015-10-07T14-55-38Z-00000 deleted file mode 100644 index 071df5b10b7ff5dbfc99fa1a984de75b42bee4a5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7541 zcmb_ec{r5a`+tl*gh(p!M2Q$?3}cTm#!`lnA<8ypGnz%SSlVnANufnrXcJMkq=;-4 zLZwh?k)%~3rG?^m2JicRm+Sie^_%N@o@dT|?)yHUdq33*5F{VMqCu0R9Zn<(2vQNo zM$#eiPm;!?LfK$nGEBr`)7-fX9@H)c*abogU--8GB8tuzuy|Yua6%Xpw23t`l21oM z2qsJDH@9U7w#+e>3~HD)6-7gtSz21t(KJh{CC1v?+5%%`X~wXmSzu@k3Y7s#ad)rW=L(??1UQMt5(t3@W+2V3D12)8jPWs6*buBaID!hf0p(08 z)dt2zMzZO!hld{#p0f|ef*_z^11g)sWg@XCGZU1F1;!9I2%`w-G?>So<;Iv`O;Ca; zuAx{TgH2%yppC!{NCuaOwF5NZ{s}nAx})8T~)SEhc6*a2SvcVr*O_ zNG72Om`DQ!1K{!iAU2Oe18$t#fkF6a_EaMyG#Wy%S=`OD8pP!=7vg{7$TmiXvADDl ziZDd11VVtqXVQfs|CNw)be;eL{Q=?$Vn7*%v4jH15iI3s^e_<I{}93DTG5EDt~vt}v= zVK!4391bNi3fP00X+qH~KAlEpG3k5=lHhFylH%W}gFK!4PoIM%fhBkj%>y(KuSfv( zJ1D;YXl+u!+$bmpR0RMe?miqImkCM};F$+jNF?xX7*9Zl01TxWf`9{Zp8?7rv?0tK zjmrZqXr_xn2y;kzmX9tZfdu8yL1{q<3uqyr(z)UsBhv*!JP#Per3vhTN!Xc#k)RGi z&qY|y^f`<*3Wb6YRx|wyiKK-^QiS0U!g_|)#FR!6QUFHO97xc^h&&nq2_i0TaAGLY zpnm~^8KgK1N5ID8TmWo9!^|+5m{KVwk>XB^HiuOHVj>ZU>*%p_j24gvpqrQq=zQRZ zkVuL^5Y6M$=A^KY`oBw&=JtU`%b76Q{UxymkgVpAaCs3t5uZz8gRuh|2dIAt5Bx95 zr3;}wK%vTvAN;ccN!*)3gdxNnbg^y!!2TDg{{!YM*Wb{@6XRcDfj&(Ccb|#R{nyy( zhyna}{L5N#TFA}np@F}Wa~Z8KCjXT_&LFO0 z-wOb3CedaWV)x9BMGqcx#_KAxdC3yS&Q6j4RR!TZfpBJ87K2gvANfD07CHe?$Wujp zJ{VGDPIB4$HdfU$@IuA|2Y`4s2~2-siyK489qQBV0>8N80p z=hE4*-|Te;o|UzMH-K@96ER^kER4q5SXkO%%wUo;d1k)b!h9Z2XcNN~Au(p=mS7~K zQP`bm)Aa-o0?vmJ;y*jfRVeIeO02*Iv^k$xE)^Upb^=3y6a2M8h?9^#(>Lb43Y>~Y z8)HB%gvScR18vr0;?^tnuM3~PMMURPV~K8CpNcZgL%$2SZ@f6#SF+q zLzrcWG`F%uxp~8Qk}vECo0(XkT!FAy(1lJBio^j~3-ZhbZ2J)jurmQB`4C{T4<07^ ztcOWB0!+jcV7$K-j1ylId-70UXYFqFA-L33~Qp2FIAqKn1|S5hO1X-jfXD2tME- zcW2n&2j@osSu^|fA-H}v@ug7^h!!BqnusFa6kMr<={heX7 zs}l(a>?QySGVFnKbAdfJinXtI2J$4a5_b?gF!E++An2|L0X3X1zVyysaycS!Z`ks` zh8G0Ys)CvnU)-1dzWXm1cMv2ow)4K5+Julu=U;8-W_u>O*x?kBSQBEt*@n?U_ z0^ESnA%N#s>oByQ$Ly*DEaeU?ypK_@DmTrRrjYXeSE%pK+>3VYGzui zOPk(UZ=C+yt~Q^$YK)N97E{iXA3L;L0yDQ2FTN1;p5P>sPzu8CuyR2VuGx|sTd(Lo zBh}}Yduw-fK&4*c`c;~}N1dyawHk(f^k4fAI2wQPG}s+_W)H=1%nq?DHVb_QX>Nbs zEp^t)HA)&Q--{=n&a^P=(_eBGy;?^Ooi)U~|H3r6Uh*{eMpnhi%#g; zmvdp{p+jjy5h?0>qT9BjWof>ywL+}!2k4!bdTdI%>4~Y#MaGSmg52`ljs&mzT{rHw z-nTlrU;cx7`j6J#sqVJqE(u?@#om3=eX1o~rq%RJF< zgM?QbqbwL@pV=$l+f>v@#)vi@uDsfhdhENm^^o3o#yv86_nuS_JR6FQiC27sknS;C z6kk!u64-m4bGr3dPorWW_Lfi=^J78ViZi+!PjA2VFlM2M@A)w`LAb?!<;(bMQT6qY zuVv}!)JkYMoQ9KwE_~p;7!DcH;Vmn3AKlbYJhbf%wNvujQ1Yh9a472fW91RPLNlMXZ0-|dub`F^f+=Z^{H zjrs33GENg~!fr`lFpLTbjeg)p3~f3`U4wX2e`(D8NGN72id%w9NOv4v=;2x*Gd|@L zKR*rjg0R_Z_hZpyOE+d|y;q%_Qpv^aa&yRH{%Hfb7Gpd2m5XdTUwcF>v;BTAai#In za_bZi&%?zj2ouC=#k_mj7YkTRUUyPjCDt-B6iR&iFFD#N^*Q51S4F8k>hsa{LucQ41_2(5@?X118sq=s~Z^c{|RB~Hf)YfgWXaAUIgjX%8z zZgqPONvyRB4SI#HQ+5@cB*y=-A}*9D(1{w&(#fKu z)%5Ih3#`)w7V{nJUhjU}d8%;Zxk}IZjpc_AF$-ROAqH%flNrIIWWC|M*k}*uir~$J zo_)AiK9SPnxliY9CTO%{vf>K@jW?t*Ud5C@Kc2JE`h#L;5<4;H%!Qzk@+6{9Xf^tR zgpJO+vs1ZOQ=`AR!YaFJH{3K2E<6ySfYR8zlCbx>zY#XlVS|xDcreyp(J;mMSMy4} zM02|Y8Qt6ug+s7GzV_>Em534L&7`Y48^ZQxG1bEtpB`l(tP(!&nE&I~{i8{jx+7!; z&X1fT+B1YzX=88daec2X+pq`i86FTnt zpgL#+5%quCZ#7$=t}n3b&i`L*=pm9HPkPM7bMl+MzD9v-1u~kNOGh(-`YQ3_BMT`;e~#hqV9S6@d5JN zLY>u8FNvMQworD0ak4vop8TE!GftqgO!ZZz*w77^5d-t1DlX~V(T#~dd)0$K1gR}K z)!{x6c<7#m|J{vGYa-qnaRP#mgdLRDWv)kf=9Dd!QqaL4bX%An%4Y1^x09wF_TXIn zX2nL0ux;VHo5L@e9+IZk-a?61*O6sJioYHiKdGF@?%Np@6d*m4Z43_;Eq7E{Z2IKA zKJCG$AOj_D@9H$aW~XC>bu8chp6#>_=ju1R9(VbTsmnMOo*0uF$de79*5gVij)l2A zO4|>qc{4R{={G&9%KzAS^XsCbvE@%Z2z{lv#F}DB-Xlrb_jiWxFIzokc)8QkBESDA z!W=0R*=5&jGWD^yU*ER)rh|7S>m&QzW8>s85BFBtP1vj?rV8Cp+MwR8D0T6j;qKK^ zdEZNZ`c#I=S$GC*sqwSZ>nlDs@Af>Kdeo)^?P%1Rr9KNEzA0iNiVGGQN&Plvaon}` zutwi%8n0ZTW2$-J@R(X?Q0UOdgOm+QpOz$qtzF!S@F4nsyyWODOUM`{Wl&IcZL2pF zFWeNgK#p2CFRmQ&Jth>!%NMn0;I1_t(Oem1E1lWXir(E|w?~~Tt+A);1ixx=f`3{< z;qK)pWsR#e+f{q7lTx*66ZJHm9;Y2O^5|>b?ce;z6Rm4uoLg#w-(;NobhmD|U-$1b zhtMVh`f*%krCr6SiHhsXd3Qr;%4c^y+S**E{%QxsMO!uNuiI9DIVQdB^6F&Mv7U7Uj!SX(n8&V|8`1ly66XV+ z+b&fDh%r4v*w0{kZ+9$I5RDe5#9}lqP>xFfXMb~hW9-f5)yX02(8C!I>Uv$1& z*0jzjNj2|WWd?VlzlCLhNm0)Jg`J_!!zsC*MG2RrT##cjS@Vi@Wrn8Q9!ccLa|3q; zWmJ}vbJQ7E!pmVpGx@_x_x8O>y`BGR3(fBNaL#q|&F*>Eev^iR@ZVP2x7=8fr*Nz- z?B)L5g)N~M8nfPR*)P{vdxhE|{p+On`R$aE51jQ@U#auM6cfj;40E;f>+BJQLrEJ~eB;hbRR4uV zgr8Pqv~;MQLur=2ntDZf>ewu6oqq0F)zGlC_Cs=#vV#4Y2cAEc|4MIo_d-K;TmN3! z@@uVKH;s26&WK&R>3!*WnJZUScWCEvdMf<7loyXW9{!WyZEs)DIV}GRQ4_R#6BN@@ zMGCRo;@Zae!#D8Z#Tp8}>pzk&gR?tZF8A)r>k99b($LC*Mn;UnWL&)$8pREap`7;%JVE5UA|baiV~!` ze2kZyYK!ljDhmBx-6WI0FQ@6E&R~*x{`0PSC0x?owu3t6EJ#STga@#YV#ho<>$qWl|6A>r=j=U z+K~x?EIO~?kHnK5cByX_wkI>xFRu%^?U|&HBUFhb%TNpX?AlRx>@Mnf*(Gd8zTBVqQpp&54p@{e33) zFZpgxd|-T1_N1m}<;|vS2K({&sCLQE$!n?ViV=Egn-){++!?zEPDI$G9bG<#X~z=F z4_v<%eSE+?Aa;v?X}rxxi9F@~Wn6`l>T8Rm-6nfpjk(0Q8nf@=qAdnRg*(O{E&pz@ zE_(1*h`Zu~!6n(hu})*krdmxwf|B8P zhm2I+e-W`68Y=D5=nFaWWerQx*W{q9!}~j$gV%^)pnMvS;yV{-xvLdOIDLdv0qD$KB)*DUtp`} zz5jhjV)s5q|69Lu>sF&wBgK5v&y4c(w9}`jD;}HgyD8I>6|i>I<-VKYX~{Ni(RP$; z$g_C2>dQslDD9gUvy(A{cY`{D1e=v6COmKyMtn(sXKrKB@@IN+gG^O9wX)vp=K7Ow zWz4y&4lVV!I{j2@*-kAz+QwD%^yXvFs+LB5z3{W&+vEB4d(Rh{)#FOOaU!Wyg$l_$ zRCeK~suTHlC$79I(KQV&+tab={)2;hVY`RQg|^R;3U)FF4*zhy!+Wiuy$vI~N7>^@ zP}mEsWXBhkyPuQLcY990zZZlE&W>1dUc~nNsNPog+B|O$Ei?P^zr>N{%l+FZ<95b_FS+()-r9Hq&xkj z&h7g2xWnfz-52Wya~_4%SNQI%|MB`n+%MUl>G~fdmT}*hn?@CtyDRsnt2f$ZENy5j$hiFiDEHkSvuJJolk4*Wn_p_gDl-Pg zKK-bFY?@gb^4rjOLrwS3r6?XUTsFVt=M-zwn9OT)sOoI4u?^3$8C>_{*LU3^h t?nUkCEitr?eHQu^Z|Qw0+e16r&0dy0t+g|Mqf`A*`O(xO3k06;HB?%XV00IagfB*srAbV)|aKt&&fjW|3ACCcdGUO!M#VXH@cf!-Ok(1)|1ZK z!(Q)AYjvY{XT7)9S#QPG+9b&%@AKH3xtduB!Z>zOo@%n#Xy$R07Tec?FtN_LBDoQS zsr4?idep5Tv^Gv`q)F6hy41Hb-Ohs0xj0L5O;&=iou_SIeE)F}dijmq>7G^TCV>C~ z2q1s}0tg_000IagfB*u25zv}nV|xDo@%vA|wf@)n|L?ZPr+Z7~NI`Kp3j`2A009IL zKmY**5I_I{1Q4j8fY$#tY31|(>C5lm&Yu5Y9(>`+{|a7Ix{Lq<2q1s}0tg_000Iag zfWVZ%eaWv#E9?JYx3+Rt|38)a|MCWaI&T4-QX@qG0R#|0009ILKmY**5I~?B0$THH z45jIR0haUs_kSKat^cbq|G&{pGjEI64?LGH69^!H00IagfB*srAb<2kmK_x9gwL}D7XPpH>wM0`;O+kpMgkTzF1WihVLvwSpQ=8G| ze;~9ZGz4NG5p7K^J&!*sYN;u%zAwJ_p6_|bd!KW8-n-`(OD#r=VHl;Z(MxG42q1s} z0tg_000IagfB*srAn=C;1{&vPN!u#5L%;VJhHLNoR_6!W4PQ2!sZ{g+bKOEg009IL zKmY**5I_I{1Q0*~0S61%GIoztjrleHA5XV!>U#NkC|xWR3+13J(rMjFK>z^+5I_I{ z1Q0*~0R#|000D;z%*wcXr8eXLO3ZWLjQ`6Xod6it4>JG`y}k?^0R#|0009ILKmY** z5J2F63k)_+|4Ley)J|Q<{r{seGpF(YN-DG+kIn^mBiq4nC>4q)cP=KRzb|pPyA};6 z_ag`OIRovB$Pd^&XZ8Ab@KXU3`c#Hp6CI4UE0N~**fc#w$KmY**5I_I{ z1Q0*~0R#|mq=3f!T0ZCh-)-cp8vp-J{(pCEOds?A6HARQ8UzqP009ILKmY**5I_I{ J1Q7VPz$*nBke~nn diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/storage.bson b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/data/storage.bson deleted file mode 100644 index d07b1bc249a341b17fcffba33372751d168c7ac9..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 95 zcma!NU|?V_F3B%SOiyJ91ag>C^U^c(QW>~`?DEW_)Rd6S^wc5-=KO+^%>2A!1|6U{ hM+#6P8K|i;AhpQF30c4`zsNH$CAA{87^sec0RYjz8ruK> diff --git a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/server_password.pem b/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/server_password.pem deleted file mode 100644 index f29c60ef..00000000 --- a/Associations/node_modules/mongoose/node_modules/mongodb/test_boot/server_password.pem +++ /dev/null @@ -1,51 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDhDCCAmygAwIBAgIDBHSUMA0GCSqGSIb3DQEBBQUAMHUxEjAQBgNVBAMTCWxv -Y2FsaG9zdDEVMBMGA1UECxMMSW50ZWdyYXRpb25zMRAwDgYDVQQKEwdNb25nb0RC -MRYwFAYDVQQHEw1OZXcgWW9yayBDaXR5MREwDwYDVQQIEwhOZXcgWW9yazELMAkG -A1UEBhMCVVMwHhcNMTUxMDA1MTgxNDM1WhcNMzUxMDA1MTgxNDM1WjBvMRIwEAYD -VQQDEwlsb2NhbGhvc3QxDzANBgNVBAsTBktlcm5lbDEQMA4GA1UEChMHTW9uZ29E -QjEWMBQGA1UEBxMNTmV3IFlvcmsgQ2l0eTERMA8GA1UECBMITmV3IFlvcmsxCzAJ -BgNVBAYTAlVTMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAh0BxOBv1 -b61NuBT+9K6CxW1+z0gDUwq9uq3kNQ5GTS80CUsEBWVWDypeXEwG5S2DyfbRLGAp -B1DwPJEWagxpVYrGTcLaOYyI0NsSP+e1mGUKosDRPrMuFYjFRGAJ5CGSlOLrDsnI -nRg9PeqUCrcrnn/SopQOQL9LKQgXg8F2d2RHgjpWlbs70soV8WlSQmdIlaemwBgY -4PzyVmzEn1bd50FK3xicqiDd9sYbbB66Touj7qofUd3EhbzGDZ+L4/CPPB9LOrFk -7CKgyrG26c+HNxLBgU2lqImBaBz756taHFl5kMm81b9MVtDxqcLMkar3mSZhQkJV -C/eDMVSV6Dji4QIDAQABoyMwITAfBgNVHREEGDAWgglsb2NhbGhvc3SCCTEyNy4w -LjAuMTANBgkqhkiG9w0BAQUFAAOCAQEAOpkRV0MpPBQEiHwzCyHmCyDL7SWL5yZY -zThKu3+falIdSFur3S+h7Bcgj7BVTKe368OLfBiTxLjgwFu5ohItuvxAiJ3J1+2n -awnJFhNoayboURA7pjrretTsUOOkozPD9DMtw8wdfZ8itCB2/jysmzm/yTKvEfLv -dkTcm6woUwJUA7o8QaIrL0bxyOlgfy0+5NCm8anVj53a42yCyL1Wz6NX4+kbzntN -F6h4wrjK0DvgdJsQNXz035BRo0NZfygHk5nH4OwqzjadIfQsNyKz7z8xcR2142nl -vh2Gt0LE9NHyQGAnjClEMH/z1OizmYoWrXJWJ3sOAQqO3D5Xdd5M8Q== ------END CERTIFICATE----- ------BEGIN ENCRYPTED PRIVATE KEY----- -MIIFHzBJBgkqhkiG9w0BBQ0wPDAbBgkqhkiG9w0BBQwwDgQI+rkdko8FHaICAggA -MB0GCWCGSAFlAwQBAgQQb46Jd6bUgVumEFwAal391QSCBND2HRh6uf7JCluFj9pA -Iy2iyLw1zqBOGuGcnaIBD2B/2tQ1P8sIC0khVy0d3/S+eLl/B6FG4eWNaLVxboSy -BXHnWu1cYl8N4c2xhg4W7UNCfT9o1I7xqak5m2F38ImsRBm0nK/8HVx9yxuwzPDt -IhNbSlsD7rht++8czm+89akgCZ3XtJK6JUyOCV0b1CHJPyM6EyG/3fS8zGK2eHFn -FA7Q7V19VyaRs4ZB/Xo0bQH/H5wyQqiybxUB8DdnGPbedGlFc6ewzYdxw9krQxek -vZRQRaB6L+0F8XwukcE8zldBlrdEWQIv/Jl0GfyDtnsFYAPzdAyMjmDf1V7+vJVZ -Lq4bmKK3A2DtuR1zivLY/9LPZMIss9JMsGscfl/v1n3OmjtZloJ1fDvnIpoouXG1 -g0p+BhwmVE65YwzDlzDvDD4v/hpvqEJKLcq6cBVmFzrXyWbx5udtRH+MAcu3xVeF -rvjaSyD2rSQMxySq+3uF+01rS8JgcYh4jkpCRgdwoF6zV896vmsou+FxmTf9G/Mk -WDjBugGW8wXXVuX01BniiFbYDMcKs2T8v7tOpXC4fJaM/+/J7GypJNoWedwa325L -Got8mFbrVvZ665IoODqUe6MT1JHTMjuTLmnkRelOpPQEOPKjOLGvJA6Auhpdr8Jb -ZBId1jALfu39e1gIJK1OOaWva7VJfBVpTeruItcwCP0vjK1hOxJcl435RWp4PN59 -hUww9bH84DD4RodtIUoFb8qiFZUtMFb3WQD98ovV71J3FjOK0ie3My39h9Disc5L -yb1Y+b6y3Fv3BaDP7lywCtZZmOeo1NhY734YjqWNMecHjGbPWpkYMdORDT4BEVUS -9FPzTULkxEhVCFjY3vsVuo7QRD0dsdGoZsQ+fJt6nPYghmWTLYYCUT5Dm1pSsOXt -bRIKMz6UT80WcnO4IfWtCTiP8gUi0KGKiQBV+IRXO5dGyb6myfyvsSmg26QxaUE/ -cn257JbO9PheQbETwOz59ehoBeV676jXS6vTl99K1jWHcQxL+TuY5B5WG2I7/zAm -jG0NvS5h6S6mU55ZrMVCM/ZH86zkzZRGAm2WyXuVOTZaPK3HXKTcLwEHV/K4eYjY -Gnr24i0zosqjqBQsHHrQXitzbit7MVgEiSvGcoiobO2jRltROUQYaZbhStS9F4O+ -adA5NOkJqqIbrGypJAU3gSlhSxqXMb4WTn6FDRYfw1QBlHcU5CSvuGXSiiwiKi4U -gni6fiDqXS2o3Op14FDC98OtzkaCKEFvIsr8HpG2B+Ol6hIScmqDJgLqR3vLZJgx -aiFNgMo6b9O8lc36yVGRk+nSaMfw90LL9pxdwxeKXhpG39N9yZo2G7KNAckZCube -6BZyMerjIPWVxpQc8hRFTU+RZG3NRNjyNwaPDU7geJuOy0Ez3AoCVM3ct4rM599X -oPka+cBp7ZbzTufBmiHVAwM+kZJkqX+O82QU8GHuYewHUTuYNFIFM7x+GiTa2YiD -aNPdoM2xayvCowXiizBvVrHn9DB2m1FHupGa7OuKpyiNDArsKQIhslP46mqPu2V0 -BiXRr7dd2zFvCCQP3l3n7zM58yW1geQUYGsrsScJgKppIc2QttD2iiv0TEZ0ZTrN -+GVpzwmLTBMKBVHu7ZW3fM/MUg== ------END ENCRYPTED PRIVATE KEY----- \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mpath/.npmignore b/Associations/node_modules/mongoose/node_modules/mpath/.npmignore deleted file mode 100644 index be106cac..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -*.sw* -node_modules/ diff --git a/Associations/node_modules/mongoose/node_modules/mpath/.travis.yml b/Associations/node_modules/mongoose/node_modules/mpath/.travis.yml deleted file mode 100644 index 09c230f0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 diff --git a/Associations/node_modules/mongoose/node_modules/mpath/History.md b/Associations/node_modules/mongoose/node_modules/mpath/History.md deleted file mode 100644 index 4fbf3385..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/History.md +++ /dev/null @@ -1,16 +0,0 @@ - -0.1.1 / 2012-12-21 -================== - - * added; map support - -0.1.0 / 2012-12-13 -================== - - * added; set('array.property', val, object) support - * added; get('array.property', object) support - -0.0.1 / 2012-11-03 -================== - - * initial release diff --git a/Associations/node_modules/mongoose/node_modules/mpath/LICENSE b/Associations/node_modules/mongoose/node_modules/mpath/LICENSE deleted file mode 100644 index 38c529da..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.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/Associations/node_modules/mongoose/node_modules/mpath/Makefile b/Associations/node_modules/mongoose/node_modules/mpath/Makefile deleted file mode 100644 index b0bb0819..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @node_modules/mocha/bin/mocha -A $(T) - -.PHONY: test diff --git a/Associations/node_modules/mongoose/node_modules/mpath/README.md b/Associations/node_modules/mongoose/node_modules/mpath/README.md deleted file mode 100644 index 9831dd06..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/README.md +++ /dev/null @@ -1,278 +0,0 @@ -#mpath - -{G,S}et javascript object values using MongoDB-like path notation. - -###Getting - -```js -var mpath = require('mpath'); - -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.get('comments.1.title', obj) // 'exciting!' -``` - -`mpath.get` supports array property notation as well. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.get('comments.title', obj) // ['funny', 'exciting!'] -``` - -Array property and indexing syntax, when used together, are very powerful. - -```js -var obj = { - array: [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: 'Turkey Day' }] }} - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; -} - -var found = mpath.get('array.o.array.x.b.1', obj); - -console.log(found); // prints.. - - [ [6, undefined] - , [2, undefined, undefined] - , [null, 1] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - -``` - -#####Field selection rules: - -The following rules are iteratively applied to each `segment` in the passed `path`. For example: - -```js -var path = 'one.two.14'; // path -'one' // segment 0 -'two' // segment 1 -14 // segment 2 -``` - -- 1) when value of the segment parent is not an array, return the value of `parent.segment` -- 2) when value of the segment parent is an array - - a) if the segment is an integer, replace the parent array with the value at `parent[segment]` - - b) if not an integer, keep the array but replace each array `item` with the value returned from calling `get(remainingSegments, item)` or undefined if falsey. - -#####Maps - -`mpath.get` also accepts an optional `map` argument which receives each individual found value. The value returned from the `map` function will be used in the original found values place. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.get('comments.title', obj, function (val) { - return 'funny' == val - ? 'amusing' - : val; -}); -// ['amusing', 'exciting!'] -``` - -###Setting - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.1.title', 'hilarious', obj) -console.log(obj.comments[1].title) // 'hilarious' -``` - -`mpath.set` supports the same array property notation as `mpath.get`. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.title', ['hilarious', 'fruity'], obj); - -console.log(obj); // prints.. - - { comments: [ - { title: 'hilarious' }, - { title: 'fruity' } - ]} -``` - -Array property and indexing syntax can be used together also when setting. - -```js -var obj = { - array: [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: 'Turkey Day' }] }} - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ] -} - -mpath.set('array.1.o', 'this was changed', obj); - -console.log(require('util').inspect(obj, false, 1000)); // prints.. - -{ - array: [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: 'this was changed' } - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; -} - -mpath.set('array.o.array.x', 'this was changed too', obj); - -console.log(require('util').inspect(obj, false, 1000)); // prints.. - -{ - array: [ - { o: { array: [{x: 'this was changed too'}, { y: 10, x: 'this was changed too'} ] }} - , { o: 'this was changed' } - , { o: { array: [{x: 'this was changed too'}, { x: 'this was changed too'}] }} - , { o: { array: [{x: 'this was changed too'}] }} - , { o: { array: [{x: 'this was changed too', y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; -} -``` - -####Setting arrays - -By default, setting a property within an array to another array results in each element of the new array being set to the item in the destination array at the matching index. An example is helpful. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.title', ['hilarious', 'fruity'], obj); - -console.log(obj); // prints.. - - { comments: [ - { title: 'hilarious' }, - { title: 'fruity' } - ]} -``` - -If we do not desire this destructuring-like assignment behavior we may instead specify the `$` operator in the path being set to force the array to be copied directly. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.$.title', ['hilarious', 'fruity'], obj); - -console.log(obj); // prints.. - - { comments: [ - { title: ['hilarious', 'fruity'] }, - { title: ['hilarious', 'fruity'] } - ]} -``` - -####Field assignment rules - -The rules utilized mirror those used on `mpath.get`, meaning we can take values returned from `mpath.get`, update them, and reassign them using `mpath.set`. Note that setting nested arrays of arrays can get unweildy quickly. Check out the [tests](https://github.com/aheckmann/mpath/blob/master/test/index.js) for more extreme examples. - -#####Maps - -`mpath.set` also accepts an optional `map` argument which receives each individual value being set. The value returned from the `map` function will be used in the original values place. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.title', ['hilarious', 'fruity'], obj, function (val) { - return val.length; -}); - -console.log(obj); // prints.. - - { comments: [ - { title: 9 }, - { title: 6 } - ]} -``` - -### Custom object types - -Sometimes you may want to enact the same functionality on custom object types that store all their real data internally, say for an ODM type object. No fear, `mpath` has you covered. Simply pass the name of the property being used to store the internal data and it will be traversed instead: - -```js -var mpath = require('mpath'); - -var obj = { - comments: [ - { title: 'exciting!', _doc: { title: 'great!' }} - ] -} - -mpath.get('comments.0.title', obj, '_doc') // 'great!' -mpath.set('comments.0.title', 'nov 3rd', obj, '_doc') -mpath.get('comments.0.title', obj, '_doc') // 'nov 3rd' -mpath.get('comments.0.title', obj) // 'exciting' -``` - -When used with a `map`, the `map` argument comes last. - -```js -mpath.get(path, obj, '_doc', map); -mpath.set(path, val, obj, '_doc', map); -``` - -[LICENSE](https://github.com/aheckmann/mpath/blob/master/LICENSE) - diff --git a/Associations/node_modules/mongoose/node_modules/mpath/index.js b/Associations/node_modules/mongoose/node_modules/mpath/index.js deleted file mode 100644 index f7b65dd5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = exports = require('./lib'); diff --git a/Associations/node_modules/mongoose/node_modules/mpath/lib/index.js b/Associations/node_modules/mongoose/node_modules/mpath/lib/index.js deleted file mode 100644 index 24e1e832..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/lib/index.js +++ /dev/null @@ -1,183 +0,0 @@ - -/** - * Returns the value of object `o` at the given `path`. - * - * ####Example: - * - * var obj = { - * comments: [ - * { title: 'exciting!', _doc: { title: 'great!' }} - * , { title: 'number dos' } - * ] - * } - * - * mpath.get('comments.0.title', o) // 'exciting!' - * mpath.get('comments.0.title', o, '_doc') // 'great!' - * mpath.get('comments.title', o) // ['exciting!', 'number dos'] - * - * // summary - * mpath.get(path, o) - * mpath.get(path, o, special) - * mpath.get(path, o, map) - * mpath.get(path, o, special, map) - * - * @param {String} path - * @param {Object} o - * @param {String} [special] When this property name is present on any object in the path, walking will continue on the value of this property. - * @param {Function} [map] Optional function which receives each individual found value. The value returned from `map` is used in the original values place. - */ - -exports.get = function (path, o, special, map) { - if ('function' == typeof special) { - map = special; - special = undefined; - } - - map || (map = K); - - var parts = 'string' == typeof path - ? path.split('.') - : path - - if (!Array.isArray(parts)) { - throw new TypeError('Invalid `path`. Must be either string or array'); - } - - var obj = o - , part; - - for (var i = 0; i < parts.length; ++i) { - part = parts[i]; - - if (Array.isArray(obj) && !/^\d+$/.test(part)) { - // reading a property from the array items - var paths = parts.slice(i); - - return obj.map(function (item) { - return item - ? exports.get(paths, item, special, map) - : map(undefined); - }); - } - - obj = special && obj[special] - ? obj[special][part] - : obj[part]; - - if (!obj) return map(obj); - } - - return map(obj); -} - -/** - * Sets the `val` at the given `path` of object `o`. - * - * @param {String} path - * @param {Anything} val - * @param {Object} o - * @param {String} [special] When this property name is present on any object in the path, walking will continue on the value of this property. - * @param {Function} [map] Optional function which is passed each individual value before setting it. The value returned from `map` is used in the original values place. - - */ - -exports.set = function (path, val, o, special, map, _copying) { - if ('function' == typeof special) { - map = special; - special = undefined; - } - - map || (map = K); - - var parts = 'string' == typeof path - ? path.split('.') - : path - - if (!Array.isArray(parts)) { - throw new TypeError('Invalid `path`. Must be either string or array'); - } - - if (null == o) return; - - // the existance of $ in a path tells us if the user desires - // the copying of an array instead of setting each value of - // the array to the one by one to matching positions of the - // current array. - var copy = _copying || /\$/.test(path) - , obj = o - , part - - for (var i = 0, len = parts.length - 1; i < len; ++i) { - part = parts[i]; - - if ('$' == part) { - if (i == len - 1) { - break; - } else { - continue; - } - } - - if (Array.isArray(obj) && !/^\d+$/.test(part)) { - var paths = parts.slice(i); - if (!copy && Array.isArray(val)) { - for (var j = 0; j < obj.length && j < val.length; ++j) { - // assignment of single values of array - exports.set(paths, val[j], obj[j], special, map, copy); - } - } else { - for (var j = 0; j < obj.length; ++j) { - // assignment of entire value - exports.set(paths, val, obj[j], special, map, copy); - } - } - return; - } - - obj = special && obj[special] - ? obj[special][part] - : obj[part]; - - if (!obj) return; - } - - // process the last property of the path - - part = parts[len]; - - // use the special property if exists - if (special && obj[special]) { - obj = obj[special]; - } - - // set the value on the last branch - if (Array.isArray(obj) && !/^\d+$/.test(part)) { - if (!copy && Array.isArray(val)) { - for (var item, j = 0; j < obj.length && j < val.length; ++j) { - item = obj[j]; - if (item) { - if (item[special]) item = item[special]; - item[part] = map(val[j]); - } - } - } else { - for (var j = 0; j < obj.length; ++j) { - item = obj[j]; - if (item) { - if (item[special]) item = item[special]; - item[part] = map(val); - } - } - } - } else { - obj[part] = map(val); - } -} - -/*! - * Returns the value passed to it. - */ - -function K (v) { - return v; -} diff --git a/Associations/node_modules/mongoose/node_modules/mpath/package.json b/Associations/node_modules/mongoose/node_modules/mpath/package.json deleted file mode 100644 index 848aed09..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/package.json +++ /dev/null @@ -1,52 +0,0 @@ -{ - "name": "mpath", - "version": "0.1.1", - "description": "{G,S}et object values using MongoDB path notation", - "main": "index.js", - "scripts": { - "test": "make test" - }, - "repository": { - "type": "git", - "url": "git://github.com/aheckmann/mpath.git" - }, - "keywords": [ - "mongodb", - "path", - "get", - "set" - ], - "author": { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - "license": "MIT", - "devDependencies": { - "mocha": "1.6.0" - }, - "_id": "mpath@0.1.1", - "dist": { - "shasum": "23da852b7c232ee097f4759d29c0ee9cd22d5e46", - "tarball": "http://registry.npmjs.org/mpath/-/mpath-0.1.1.tgz" - }, - "_npmVersion": "1.1.59", - "_npmUser": { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - }, - "maintainers": [ - { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - } - ], - "directories": {}, - "_shasum": "23da852b7c232ee097f4759d29c0ee9cd22d5e46", - "_from": "mpath@0.1.1", - "_resolved": "https://registry.npmjs.org/mpath/-/mpath-0.1.1.tgz", - "bugs": { - "url": "https://github.com/aheckmann/mpath/issues" - }, - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/aheckmann/mpath" -} diff --git a/Associations/node_modules/mongoose/node_modules/mpath/test/index.js b/Associations/node_modules/mongoose/node_modules/mpath/test/index.js deleted file mode 100644 index 98e119a7..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpath/test/index.js +++ /dev/null @@ -1,1630 +0,0 @@ - -/** - * Test dependencies. - */ - -var mpath = require('../') -var assert = require('assert') - -/** - * logging helper - */ - -function log (o) { - console.log(); - console.log(require('util').inspect(o, false, 1000)); -} - -/** - * special path for override tests - */ - -var special = '_doc'; - -/** - * Tests - */ - -describe('mpath', function(){ - - /** - * test doc creator - */ - - function doc () { - var o = { first: { second: { third: [3,{ name: 'aaron' }, 9] }}}; - o.comments = [ - { name: 'one' } - , { name: 'two', _doc: { name: '2' }} - , { name: 'three' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}] }} - ]; - o.name = 'jiro'; - o.array = [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: {b: 'hi'}}] }} - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; - o.arr = [ - { arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true } - ] - return o; - } - - describe('get', function(){ - var o = doc(); - - it('`path` must be a string or array', function(done){ - assert.throws(function () { - mpath.get({}, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(4, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(function(){}, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(/asdf/, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(Math, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(Buffer, o); - }, /Must be either string or array/); - assert.doesNotThrow(function () { - mpath.get('string', o); - }); - assert.doesNotThrow(function () { - mpath.get([], o); - }); - done(); - }) - - describe('without `special`', function(){ - it('works', function(done){ - assert.equal('jiro', mpath.get('name', o)); - - assert.deepEqual( - { second: { third: [3,{ name: 'aaron' }, 9] }} - , mpath.get('first', o) - ); - - assert.deepEqual( - { third: [3,{ name: 'aaron' }, 9] } - , mpath.get('first.second', o) - ); - - assert.deepEqual( - [3,{ name: 'aaron' }, 9] - , mpath.get('first.second.third', o) - ); - - assert.deepEqual( - 3 - , mpath.get('first.second.third.0', o) - ); - - assert.deepEqual( - 9 - , mpath.get('first.second.third.2', o) - ); - - assert.deepEqual( - { name: 'aaron' } - , mpath.get('first.second.third.1', o) - ); - - assert.deepEqual( - 'aaron' - , mpath.get('first.second.third.1.name', o) - ); - - assert.deepEqual([ - { name: 'one' } - , { name: 'two', _doc: { name: '2' }} - , { name: 'three' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}]}}], - mpath.get('comments', o)); - - assert.deepEqual({ name: 'one' }, mpath.get('comments.0', o)); - assert.deepEqual('one', mpath.get('comments.0.name', o)); - assert.deepEqual('two', mpath.get('comments.1.name', o)); - assert.deepEqual('three', mpath.get('comments.2.name', o)); - - assert.deepEqual([{},{ comments: [{val: 'twoo'}]}] - , mpath.get('comments.2.comments', o)); - - assert.deepEqual({ comments: [{val: 'twoo'}]} - , mpath.get('comments.2.comments.1', o)); - - assert.deepEqual('twoo', mpath.get('comments.2.comments.1.comments.0.val', o)); - - done(); - }) - - it('handles array.property dot-notation', function(done){ - assert.deepEqual( - ['one', 'two', 'three'] - , mpath.get('comments.name', o) - ); - done(); - }) - - it('handles array.array notation', function(done){ - assert.deepEqual( - [undefined, undefined, [{}, {comments:[{val:'twoo'}]}]] - , mpath.get('comments.comments', o) - ); - done(); - }) - - it('handles prop.prop.prop.arrayProperty notation', function(done){ - assert.deepEqual( - [undefined, 'aaron', undefined] - , mpath.get('first.second.third.name', o) - ); - assert.deepEqual( - [1, 'aaron', 1] - , mpath.get('first.second.third.name', o, function (v) { - return undefined === v ? 1 : v; - }) - ); - done(); - }) - - it('handles array.prop.array', function(done){ - assert.deepEqual( - [ [{x: {b: [4,6,8]}}, { y: 10} ] - , [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: {b: 'hi'}}] - , [{x: {b: null }}, { x: { b: [null, 1]}}] - , [{x: null }] - , [{y: 3 }] - , [3, 0, null] - , undefined - ] - , mpath.get('array.o.array', o) - ); - done(); - }) - - it('handles array.prop.array.index', function(done){ - assert.deepEqual( - [ {x: {b: [4,6,8]}} - , {x: {b: [1,2,3]}} - , {x: {b: null }} - , {x: null } - , {y: 3 } - , 3 - , undefined - ] - , mpath.get('array.o.array.0', o) - ); - done(); - }) - - it('handles array.prop.array.index.prop', function(done){ - assert.deepEqual( - [ {b: [4,6,8]} - , {b: [1,2,3]} - , {b: null } - , null - , undefined - , undefined - , undefined - ] - , mpath.get('array.o.array.0.x', o) - ); - done(); - }) - - it('handles array.prop.array.prop', function(done){ - assert.deepEqual( - [ [undefined, 10 ] - , [undefined, undefined, undefined] - , [undefined, undefined] - , [undefined] - , [3] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.y', o) - ); - assert.deepEqual( - [ [{b: [4,6,8]}, undefined] - , [{b: [1,2,3]}, {z: 10 }, {b: 'hi'}] - , [{b: null }, { b: [null, 1]}] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.x', o) - ); - done(); - }) - - it('handles array.prop.array.prop.prop', function(done){ - assert.deepEqual( - [ [[4,6,8], undefined] - , [[1,2,3], undefined, 'hi'] - , [null, [null, 1]] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.x.b', o) - ); - done(); - }) - - it('handles array.prop.array.prop.prop.index', function(done){ - assert.deepEqual( - [ [6, undefined] - , [2, undefined, 'i'] // undocumented feature (string indexing) - , [null, 1] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.x.b.1', o) - ); - assert.deepEqual( - [ [6, 0] - , [2, 0, 'i'] // undocumented feature (string indexing) - , [null, 1] - , [null] - , [0] - , [0, 0, 0] - , 0 - ] - , mpath.get('array.o.array.x.b.1', o, function (v) { - return undefined === v ? 0 : v; - }) - ); - done(); - }) - - it('handles array.index.prop.prop', function(done){ - assert.deepEqual( - [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: {b: 'hi'}}] - , mpath.get('array.1.o.array', o) - ); - assert.deepEqual( - ['hi','hi','hi'] - , mpath.get('array.1.o.array', o, function (v) { - if (Array.isArray(v)) { - return v.map(function (val) { - return 'hi'; - }) - } - return v; - }) - ); - done(); - }) - - it('handles array.array.index', function(done){ - assert.deepEqual( - [{ a: { c: 48 }}, undefined] - , mpath.get('arr.arr.1', o) - ); - assert.deepEqual( - ['woot', undefined] - , mpath.get('arr.arr.1', o, function (v) { - if (v && v.a && v.a.c) return 'woot'; - return v; - }) - ); - done(); - }) - - it('handles array.array.index.prop', function(done){ - assert.deepEqual( - [{ c: 48 }, 'woot'] - , mpath.get('arr.arr.1.a', o, function (v) { - if (undefined === v) return 'woot'; - return v; - }) - ); - assert.deepEqual( - [{ c: 48 }, undefined] - , mpath.get('arr.arr.1.a', o) - ); - mpath.set('arr.arr.1.a', [{c:49},undefined], o) - assert.deepEqual( - [{ c: 49 }, undefined] - , mpath.get('arr.arr.1.a', o) - ); - mpath.set('arr.arr.1.a', [{c:48},undefined], o) - done(); - }) - - it('handles array.array.index.prop.prop', function(done){ - assert.deepEqual( - [48, undefined] - , mpath.get('arr.arr.1.a.c', o) - ); - assert.deepEqual( - [48, 'woot'] - , mpath.get('arr.arr.1.a.c', o, function (v) { - if (undefined === v) return 'woot'; - return v; - }) - ); - done(); - }) - - }) - - describe('with `special`', function(){ - it('works', function(done){ - assert.equal('jiro', mpath.get('name', o, special)); - - assert.deepEqual( - { second: { third: [3,{ name: 'aaron' }, 9] }} - , mpath.get('first', o, special) - ); - - assert.deepEqual( - { third: [3,{ name: 'aaron' }, 9] } - , mpath.get('first.second', o, special) - ); - - assert.deepEqual( - [3,{ name: 'aaron' }, 9] - , mpath.get('first.second.third', o, special) - ); - - assert.deepEqual( - 3 - , mpath.get('first.second.third.0', o, special) - ); - - assert.deepEqual( - 4 - , mpath.get('first.second.third.0', o, special, function (v) { - return 3 === v ? 4 : v; - }) - ); - - assert.deepEqual( - 9 - , mpath.get('first.second.third.2', o, special) - ); - - assert.deepEqual( - { name: 'aaron' } - , mpath.get('first.second.third.1', o, special) - ); - - assert.deepEqual( - 'aaron' - , mpath.get('first.second.third.1.name', o, special) - ); - - assert.deepEqual([ - { name: 'one' } - , { name: 'two', _doc: { name: '2' }} - , { name: 'three' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}]}}], - mpath.get('comments', o, special)); - - assert.deepEqual({ name: 'one' }, mpath.get('comments.0', o, special)); - assert.deepEqual('one', mpath.get('comments.0.name', o, special)); - assert.deepEqual('2', mpath.get('comments.1.name', o, special)); - assert.deepEqual('3', mpath.get('comments.2.name', o, special)); - assert.deepEqual('nice', mpath.get('comments.2.name', o, special, function (v) { - return '3' === v ? 'nice' : v; - })); - - assert.deepEqual([{},{ _doc: { comments: [{ val: 2 }] }}] - , mpath.get('comments.2.comments', o, special)); - - assert.deepEqual({ _doc: { comments: [{val: 2}]}} - , mpath.get('comments.2.comments.1', o, special)); - - assert.deepEqual(2, mpath.get('comments.2.comments.1.comments.0.val', o, special)); - done(); - }) - - it('handles array.property dot-notation', function(done){ - assert.deepEqual( - ['one', '2', '3'] - , mpath.get('comments.name', o, special) - ); - assert.deepEqual( - ['one', 2, '3'] - , mpath.get('comments.name', o, special, function (v) { - return '2' === v ? 2 : v - }) - ); - done(); - }) - - it('handles array.array notation', function(done){ - assert.deepEqual( - [undefined, undefined, [{}, {_doc: { comments:[{val:2}]}}]] - , mpath.get('comments.comments', o, special) - ); - done(); - }) - - it('handles array.array.index.array', function(done){ - assert.deepEqual( - [undefined, undefined, [{val:2}]] - , mpath.get('comments.comments.1.comments', o, special) - ); - done(); - }) - - it('handles array.array.index.array.prop', function(done){ - assert.deepEqual( - [undefined, undefined, [2]] - , mpath.get('comments.comments.1.comments.val', o, special) - ); - assert.deepEqual( - ['nil', 'nil', [2]] - , mpath.get('comments.comments.1.comments.val', o, special, function (v) { - return undefined === v ? 'nil' : v; - }) - ); - done(); - }) - }) - - }) - - describe('set', function(){ - describe('without `special`', function(){ - var o = doc(); - - it('works', function(done){ - mpath.set('name', 'a new val', o, function (v) { - return 'a new val' === v ? 'changed' : v; - }); - assert.deepEqual('changed', o.name); - - mpath.set('name', 'changed', o); - assert.deepEqual('changed', o.name); - - mpath.set('first.second.third', [1,{name:'x'},9], o); - assert.deepEqual([1,{name:'x'},9], o.first.second.third); - - mpath.set('first.second.third.1.name', 'y', o) - assert.deepEqual([1,{name:'y'},9], o.first.second.third); - - mpath.set('comments.1.name', 'ttwwoo', o); - assert.deepEqual({ name: 'ttwwoo', _doc: { name: '2' }}, o.comments[1]); - - mpath.set('comments.2.comments.1.comments.0.expand', 'added', o); - assert.deepEqual( - { val: 'twoo', expand: 'added'} - , o.comments[2].comments[1].comments[0]); - - mpath.set('comments.2.comments.1.comments.2', 'added', o); - assert.equal(3, o.comments[2].comments[1].comments.length); - assert.deepEqual( - { val: 'twoo', expand: 'added'} - , o.comments[2].comments[1].comments[0]); - assert.deepEqual( - undefined - , o.comments[2].comments[1].comments[1]); - assert.deepEqual( - 'added' - , o.comments[2].comments[1].comments[2]); - - done(); - }) - - describe('array.path', function(){ - describe('with single non-array value', function(){ - it('works', function(done){ - mpath.set('arr.yep', false, o, function (v) { - return false === v ? true: v; - }); - assert.deepEqual([ - { yep: true, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true } - ], o.arr); - - mpath.set('arr.yep', false, o); - - assert.deepEqual([ - { yep: false, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: false } - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('that are equal in length', function(done){ - mpath.set('arr.yep', ['one',2], o, function (v) { - return 'one' === v ? 1 : v; - }); - assert.deepEqual([ - { yep: 1, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - mpath.set('arr.yep', ['one',2], o); - - assert.deepEqual([ - { yep: 'one', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - - done(); - }) - - it('that is less than length', function(done){ - mpath.set('arr.yep', [47], o, function (v) { - return 47 === v ? 4 : v; - }); - assert.deepEqual([ - { yep: 4, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - - mpath.set('arr.yep', [47], o); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - - done(); - }) - - it('that is greater than length', function(done){ - mpath.set('arr.yep', [5,6,7], o, function (v) { - return 5 === v ? 'five' : v; - }); - assert.deepEqual([ - { yep: 'five', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 6 } - ], o.arr); - - mpath.set('arr.yep', [5,6,7], o); - assert.deepEqual([ - { yep: 5, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 6 } - ], o.arr); - - done(); - }) - }) - }) - - describe('array.$.path', function(){ - describe('with single non-array value', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', {xtra: 'double good'}, o, function (v) { - return v && v.xtra ? 'hi' : v; - }); - assert.deepEqual([ - { yep: 'hi', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 'hi'} - ], o.arr); - - mpath.set('arr.$.yep', {xtra: 'double good'}, o); - assert.deepEqual([ - { yep: {xtra:'double good'}, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: {xtra:'double good'}} - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', [15], o, function (v) { - return v.length === 1 ? [] : v; - }); - assert.deepEqual([ - { yep: [], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: []} - ], o.arr); - - mpath.set('arr.$.yep', [15], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: [15]} - ], o.arr); - - done(); - }) - }) - }) - - describe('array.index.path', function(){ - it('works', function(done){ - mpath.set('arr.1.yep', 0, o, function (v) { - return 0 === v ? 'zero' : v; - }); - assert.deepEqual([ - { yep: [15] , arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 'zero' } - ], o.arr); - - mpath.set('arr.1.yep', 0, o); - assert.deepEqual([ - { yep: [15] , arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.e', 35, o, function (v) { - return 35 === v ? 3 : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 3}, { a: { c: 48 }, e: 3}, { d: 'yep', e: 3 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.e', 35, o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 35}, { a: { c: 48 }, e: 35}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.e', ['a','b'], o, function (v) { - return 'a' === v ? 'x' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 'x'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.e', ['a','b'], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 'a'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.a.b', 36, o, function (v) { - return 36 === v ? 3 : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 3 }, e: 'a'}, { a: { c: 48, b: 3 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.a.b', 36, o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 36 }, e: 'a'}, { a: { c: 48, b: 36 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.a.b', [1,2,3,4], o, function (v) { - return 2 === v ? 'two' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 1 }, e: 'a'}, { a: { c: 48, b: 'two' }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.a.b', [1,2,3,4], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 1 }, e: 'a'}, { a: { c: 48, b: 2 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.$.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.$.a.b', '$', o, function (v) { - return '$' === v ? 'dolla billz' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 'dolla billz' }, e: 'a'}, { a: { c: 48, b: 'dolla billz' }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', '$', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: '$' }, e: 'a'}, { a: { c: 48, b: '$' }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.$.a.b', [1], o, function (v) { - return Array.isArray(v) ? {} : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: {} }, e: 'a'}, { a: { c: 48, b: {} }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', [1], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: [1] }, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.array.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.0.a', 'single', o, function (v) { - return 'single' === v ? 'double' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'double', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.arr.0.a', 'single', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o, function (v) { - return 4 === v ? 3 : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 3, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: false } - ], o.arr); - - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 4, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: false } - ], o.arr); - - done(); - }) - }) - - describe('array.array.$.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.$.0.a', 'singles', o, function (v) { - return 0; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 0, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.arr.$.0.a', 'singles', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'singles', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('$.arr.arr.0.a', 'single', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o, function (v) { - return 'nope' - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'nope', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - mpath.set('arr.$.arr.0.a', [4,8,15,16,23,42,108], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - done(); - }) - }) - - describe('array.array.path.index', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.a.7', 47, o, function (v) { - return 1 - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,1], e: 'a'}, { a: { c: 48, b: [1], '7': 1 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - mpath.set('arr.arr.a.7', 47, o); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,47], e: 'a'}, { a: { c: 48, b: [1], '7': 47 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - done(); - }) - it('with array', function(done){ - o.arr[1].arr = [{ a: [] }, { a: [] }, { a: null }]; - mpath.set('arr.arr.a.7', [[null,46], [undefined, 'woot']], o); - - var a1 = []; - var a2 = []; - a1[7] = undefined; - a2[7] = 'woot'; - - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,null], e: 'a'}, { a: { c: 48, b: [1], '7': 46 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0, arr: [{a:a1},{a:a2},{a:null}] } - ], o.arr); - - done(); - }) - }) - - describe('handles array.array.path', function(){ - it('with single', function(done){ - o.arr[1].arr = [{},{}]; - assert.deepEqual([{},{}], o.arr[1].arr); - o.arr.push({ arr: 'something else' }); - o.arr.push({ arr: ['something else'] }); - o.arr.push({ arr: [[]] }); - o.arr.push({ arr: [5] }); - - var weird = []; - weird.e = 'xmas'; - - // test - mpath.set('arr.arr.e', 47, o, function (v) { - return 'xmas' - }); - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 'xmas'} - , { a: { c: 48, b: [1], '7': 46 }, e: 'xmas'} - , { d: 'yep', e: 'xmas' } - ] - } - , { yep: 0, arr: [{e: 'xmas'}, {e:'xmas'}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - weird.e = 47; - - mpath.set('arr.arr.e', 47, o); - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 47} - , { a: { c: 48, b: [1], '7': 46 }, e: 47} - , { d: 'yep', e: 47 } - ] - } - , { yep: 0, arr: [{e: 47}, {e:47}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - done(); - }) - it('with arrays', function(done){ - mpath.set('arr.arr.e', [[1,2,3],[4,5],null,[],[6], [7,8,9]], o, function (v) { - return 10; - }); - - var weird = []; - weird.e = 10; - - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 10} - , { a: { c: 48, b: [1], '7': 46 }, e: 10} - , { d: 'yep', e: 10 } - ] - } - , { yep: 0, arr: [{e: 10}, {e:10}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - mpath.set('arr.arr.e', [[1,2,3],[4,5],null,[],[6], [7,8,9]], o); - - weird.e = 6; - - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 1} - , { a: { c: 48, b: [1], '7': 46 }, e: 2} - , { d: 'yep', e: 3 } - ] - } - , { yep: 0, arr: [{e: 4}, {e:5}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - done(); - }) - }) - }) - - describe('with `special`', function(){ - var o = doc(); - - it('works', function(done){ - mpath.set('name', 'chan', o, special, function (v) { - return 'hi'; - }); - assert.deepEqual('hi', o.name); - - mpath.set('name', 'changer', o, special); - assert.deepEqual('changer', o.name); - - mpath.set('first.second.third', [1,{name:'y'},9], o, special); - assert.deepEqual([1,{name:'y'},9], o.first.second.third); - - mpath.set('first.second.third.1.name', 'z', o, special) - assert.deepEqual([1,{name:'z'},9], o.first.second.third); - - mpath.set('comments.1.name', 'ttwwoo', o, special); - assert.deepEqual({ name: 'two', _doc: { name: 'ttwwoo' }}, o.comments[1]); - - mpath.set('comments.2.comments.1.comments.0.expander', 'adder', o, special, function (v) { - return 'super' - }); - assert.deepEqual( - { val: 2, expander: 'super'} - , o.comments[2]._doc.comments[1]._doc.comments[0]); - - mpath.set('comments.2.comments.1.comments.0.expander', 'adder', o, special); - assert.deepEqual( - { val: 2, expander: 'adder'} - , o.comments[2]._doc.comments[1]._doc.comments[0]); - - mpath.set('comments.2.comments.1.comments.2', 'set', o, special); - assert.equal(3, o.comments[2]._doc.comments[1]._doc.comments.length); - assert.deepEqual( - { val: 2, expander: 'adder'} - , o.comments[2]._doc.comments[1]._doc.comments[0]); - assert.deepEqual( - undefined - , o.comments[2]._doc.comments[1]._doc.comments[1]); - assert.deepEqual( - 'set' - , o.comments[2]._doc.comments[1]._doc.comments[2]); - done(); - }) - - describe('array.path', function(){ - describe('with single non-array value', function(){ - it('works', function(done){ - o.arr[1]._doc = { special: true } - - mpath.set('arr.yep', false, o, special, function (v) { - return 'yes'; - }); - assert.deepEqual([ - { yep: 'yes', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 'yes'}} - ], o.arr); - - mpath.set('arr.yep', false, o, special); - assert.deepEqual([ - { yep: false, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: false }} - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('that are equal in length', function(done){ - mpath.set('arr.yep', ['one',2], o, special, function (v) { - return 2 === v ? 20 : v; - }); - assert.deepEqual([ - { yep: 'one', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 20}} - ], o.arr); - - mpath.set('arr.yep', ['one',2], o, special); - assert.deepEqual([ - { yep: 'one', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - done(); - }) - - it('that is less than length', function(done){ - mpath.set('arr.yep', [47], o, special, function (v) { - return 80; - }); - assert.deepEqual([ - { yep: 80, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - mpath.set('arr.yep', [47], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - // add _doc to first element - o.arr[0]._doc = { yep: 46, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - - mpath.set('arr.yep', [20], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }], _doc: { yep: 20, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - done(); - }) - - it('that is greater than length', function(done){ - mpath.set('arr.yep', [5,6,7], o, special, function () { - return 'x'; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }], _doc: { yep: 'x', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 'x'}} - ], o.arr); - - mpath.set('arr.yep', [5,6,7], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }], _doc: { yep: 5, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 6}} - ], o.arr); - - done(); - }) - }) - }) - - describe('array.$.path', function(){ - describe('with single non-array value', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', {xtra: 'double good'}, o, special, function (v) { - return 9; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: 9, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 9}} - ], o.arr); - - mpath.set('arr.$.yep', {xtra: 'double good'}, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: {xtra:'double good'}, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: {xtra:'double good'}}} - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', [15], o, special, function (v) { - return 'array' - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: 'array', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 'array'}} - ], o.arr); - - mpath.set('arr.$.yep', [15], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: [15]}} - ], o.arr); - - done(); - }) - }) - }) - - describe('array.index.path', function(){ - it('works', function(done){ - mpath.set('arr.1.yep', 0, o, special, function (v) { - return 1; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 1}} - ], o.arr); - - mpath.set('arr.1.yep', 0, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.e', 35, o, special, function (v) { - return 30 - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 30}, { a: { c: 48 }, e: 30}, { d: 'yep', e: 30 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.e', 35, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 35}, { a: { c: 48 }, e: 35}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.e', ['a','b'], o, special, function (v) { - return 'a' === v ? 'A' : v; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 'A'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.e', ['a','b'], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 'a'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.a.b', 36, o, special, function (v) { - return 20 - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 20 }, e: 'a'}, { a: { c: 48, b: 20 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.a.b', 36, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 36 }, e: 'a'}, { a: { c: 48, b: 36 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.a.b', [1,2,3,4], o, special, function (v) { - return v*2; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 2 }, e: 'a'}, { a: { c: 48, b: 4 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.a.b', [1,2,3,4], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 1 }, e: 'a'}, { a: { c: 48, b: 2 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.$.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.$.a.b', '$', o, special, function (v) { - return 'dollaz' - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 'dollaz' }, e: 'a'}, { a: { c: 48, b: 'dollaz' }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', '$', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: '$' }, e: 'a'}, { a: { c: 48, b: '$' }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.$.a.b', [1], o, special, function (v) { - return {}; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: {} }, e: 'a'}, { a: { c: 48, b: {} }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', [1], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: [1] }, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.array.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.0.a', 'single', o, special, function (v) { - return 88; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 88, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.0.a', 'single', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o, special, function (v) { - return v*2; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 8, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 4, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.array.$.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.$.0.a', 'singles', o, special, function (v) { - return v.toUpperCase(); - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'SINGLES', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.$.0.a', 'singles', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'singles', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('$.arr.arr.0.a', 'single', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o, special, function (v) { - return Array - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: Array, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.$.arr.0.a', [4,8,15,16,23,42,108], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.array.path.index', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.a.7', 47, o, special, function (v) { - return Object; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,Object], e: 'a'}, { a: { c: 48, b: [1], '7': Object }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.a.7', 47, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,47], e: 'a'}, { a: { c: 48, b: [1], '7': 47 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - o.arr[1]._doc.arr = [{ a: [] }, { a: [] }, { a: null }]; - mpath.set('arr.arr.a.7', [[null,46], [undefined, 'woot']], o, special, function (v) { - return undefined === v ? 'nope' : v; - }); - - var a1 = []; - var a2 = []; - a1[7] = 'nope'; - a2[7] = 'woot'; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,null], e: 'a'}, { a: { c: 48, b: [1], '7': 46 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { arr: [{a:a1},{a:a2},{a:null}], special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.a.7', [[null,46], [undefined, 'woot']], o, special); - - a1[7] = undefined; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,null], e: 'a'}, { a: { c: 48, b: [1], '7': 46 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { arr: [{a:a1},{a:a2},{a:null}], special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('handles array.array.path', function(){ - it('with single', function(done){ - o.arr[1]._doc.arr = [{},{}]; - assert.deepEqual([{},{}], o.arr[1]._doc.arr); - o.arr.push({ _doc: { arr: 'something else' }}); - o.arr.push({ _doc: { arr: ['something else'] }}); - o.arr.push({ _doc: { arr: [[]] }}); - o.arr.push({ _doc: { arr: [5] }}); - - // test - mpath.set('arr.arr.e', 47, o, special); - - var weird = []; - weird.e = 47; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { - yep: [15] - , arr: [ - { a: [4,8,15,16,23,42,108,null], e: 47} - , { a: { c: 48, b: [1], '7': 46 }, e: 47} - , { d: 'yep', e: 47 } - ] - } - } - , { yep: true - , _doc: { - arr: [ - {e:47} - , {e:47} - ] - , special: true - , yep: 0 - } - } - , { _doc: { arr: 'something else' }} - , { _doc: { arr: ['something else'] }} - , { _doc: { arr: [weird] }} - , { _doc: { arr: [5] }} - ] - , o.arr); - - done(); - }) - it('with arrays', function(done){ - mpath.set('arr.arr.e', [[1,2,3],[4,5],null,[],[6], [7,8,9]], o, special); - - var weird = []; - weird.e = 6; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { - yep: [15] - , arr: [ - { a: [4,8,15,16,23,42,108,null], e: 1} - , { a: { c: 48, b: [1], '7': 46 }, e: 2} - , { d: 'yep', e: 3 } - ] - } - } - , { yep: true - , _doc: { - arr: [ - {e:4} - , {e:5} - ] - , special: true - , yep: 0 - } - } - , { _doc: { arr: 'something else' }} - , { _doc: { arr: ['something else'] }} - , { _doc: { arr: [weird] }} - , { _doc: { arr: [5] }} - ] - , o.arr); - - done(); - }) - }) - - }) - - describe('get/set integration', function(){ - var o = doc(); - - it('works', function(done){ - var vals = mpath.get('array.o.array.x.b', o); - - vals[0][0][2] = 10; - vals[1][0][1] = 0; - vals[1][1] = 'Rambaldi'; - vals[1][2] = [12,14]; - vals[2] = [{changed:true}, [null, ['changed','to','array']]]; - - mpath.set('array.o.array.x.b', vals, o); - - var t = [ - { o: { array: [{x: {b: [4,6,10]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,0,3]}}, { x: {b:'Rambaldi',z: 10 }}, { x: {b: [12,14]}}] }} - , { o: { array: [{x: {b: {changed:true}}}, { x: { b: [null, ['changed','to','array']]}}]}} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; - assert.deepEqual(t, o.array); - done(); - }) - - it('array.prop', function(done){ - mpath.set('comments.name', ['this', 'was', 'changed'], o); - - assert.deepEqual([ - { name: 'this' } - , { name: 'was', _doc: { name: '2' }} - , { name: 'changed' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}] }} - ], o.comments); - - mpath.set('comments.name', ['also', 'changed', 'this'], o, special); - - assert.deepEqual([ - { name: 'also' } - , { name: 'was', _doc: { name: 'changed' }} - , { name: 'changed' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: 'this', comments: [{},{ _doc: { comments: [{ val: 2 }] }}] }} - ], o.comments); - - done(); - }) - - }) - - describe('multiple $ use', function(){ - var o = doc(); - it('is ok', function(done){ - assert.doesNotThrow(function () { - mpath.set('arr.$.arr.$.a', 35, o); - }); - done(); - }) - }) - - it('ignores setting a nested path that doesnt exist', function(done){ - var o = doc(); - assert.doesNotThrow(function(){ - mpath.set('thing.that.is.new', 10, o); - }) - done(); - }) - }) - -}) diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/.npmignore b/Associations/node_modules/mongoose/node_modules/mpromise/.npmignore deleted file mode 100644 index e86496f9..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -*.sw* -node_modules/ -.DS_Store -.idea \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/.travis.yml b/Associations/node_modules/mongoose/node_modules/mpromise/.travis.yml deleted file mode 100644 index d63ba095..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.10 - - 0.11 diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/History.md b/Associations/node_modules/mongoose/node_modules/mpromise/History.md deleted file mode 100644 index a64788e8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/History.md +++ /dev/null @@ -1,74 +0,0 @@ -0.5.1 / 2014-01-20 -================== - - * fixed; `end` is much more consistent (especially for `then` chains) - -0.4.4 / 2014-01-20 -================== - - * fixed; `end` is much more consistent (especially for `then` chains) - -0.4.3 / 2013-12-17 -================== - - * fixed; non-A+ behavior on fulfill and reject [lbeschastny](https://github.com/lbeschastny) - * tests; simplified harness + compatible with travis + compatible with windows - -0.5.0 / 2013-12-14 -================== - - * fixed; non-A+ behavior on fulfill and reject [lbeschastny](https://github.com/lbeschastny) - * tests; simplified harness + compatible with travis + compatible with windows - -0.4.2 / 2013-11-26 -================== - - * fixed; enter the domain only if not the present domain - * added; `end` returns the promise - -0.4.1 / 2013-10-26 -================== - - * Add `all` - * Longjohn for easier debugging - * can end a promise chain with an error handler - * Add ```chain``` - -0.4.0 / 2013-10-24 -================== - - * fixed; now plays nice with domains #3 [refack](https://github.com/refack) - * updated; compatibility for Promises A+ 2.0.0 [refack](https://github.com/refack) - * updated; guard against invalid arguments [refack](https://github.com/refack) - -0.3.0 / 2013-07-25 -================== - - * updated; sliced to 0.0.5 - * fixed; then is passed all fulfillment values - * use setImmediate if available - * conform to Promises A+ 1.1 - -0.2.1 / 2013-02-09 -================== - - * fixed; conformancy with A+ 1.2 - -0.2.0 / 2013-01-09 -================== - - * added; .end() - * fixed; only catch handler executions - -0.1.0 / 2013-01-08 -================== - - * cleaned up API - * customizable event names - * docs - -0.0.1 / 2013-01-07 -================== - - * original release - diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/LICENSE b/Associations/node_modules/mongoose/node_modules/mpromise/LICENSE deleted file mode 100644 index 38c529da..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.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/Associations/node_modules/mongoose/node_modules/mpromise/README.md b/Associations/node_modules/mongoose/node_modules/mpromise/README.md deleted file mode 100644 index 2906f563..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/README.md +++ /dev/null @@ -1,224 +0,0 @@ -#mpromise -========== - -[![Build Status](https://travis-ci.org/aheckmann/mpromise.png)](https://travis-ci.org/aheckmann/mpromise) - -A [promises/A+](https://github.com/promises-aplus/promises-spec) conformant implementation, written for [mongoose](http://mongoosejs.com). - -## installation - -``` -$ npm install mpromise -``` - -## docs - -An `mpromise` can be in any of three states, pending, fulfilled (success), or rejected (error). Once it is either fulfilled or rejected it's state can no longer be changed. - -The exports object is the Promise constructor. - -```js -var Promise = require('mpromise'); -``` - -The constructor accepts an optional function which is executed when the promise is first resolved (either fulfilled or rejected). - -```js -var promise = new Promise(fn); -``` - -This is the same as passing the `fn` to `onResolve` directly. - -```js -var promise = new Promise; -promise.onResolve(function (err, args..) { - ... -}); -``` - -### Methods - -####fulfill - -Fulfilling a promise with values: - -```js -var promise = new Promise; -promise.fulfill(args...); -``` - -If the promise has already been fulfilled or rejected, no action is taken. - -####reject - -Rejecting a promise with a reason: - -```js -var promise = new Promise; -promise.reject(reason); -``` - -If the promise has already been fulfilled or rejected, no action is taken. - -####resolve - -Node.js callback style promise resolution `(err, args...)`: - -```js -var promise = new Promise; -promise.resolve([reason], [arg1, arg2, ...]); -``` - -If the promise has already been fulfilled or rejected, no action is taken. - -####onFulfill - -To register a function for execution when the promise is fulfilled, pass it to `onFulfill`. When executed it will receive the arguments passed to `fulfill()`. - -```js -var promise = new Promise; -promise.onFulfill(function (a, b) { - assert.equal(3, a + b); -}); -promise.fulfill(1, 2); -``` - -The function will only be called once when the promise is fulfilled, never when rejected. - -Registering a function with `onFulfill` after the promise has already been fulfilled results in the immediate execution of the function with the original arguments used to fulfill the promise. - -```js -var promise = new Promise; -promise.fulfill(" :D "); -promise.onFulfill(function (arg) { - console.log(arg); // logs " :D " -}) -``` - -####onReject - -To register a function for execution when the promise is rejected, pass it to `onReject`. When executed it will receive the argument passed to `reject()`. - -```js -var promise = new Promise; -promise.onReject(function (reason) { - assert.equal('sad', reason); -}); -promise.reject('sad'); -``` - -The function will only be called once when the promise is rejected, never when fulfilled. - -Registering a function with `onReject` after the promise has already been rejected results in the immediate execution of the function with the original argument used to reject the promise. - -```js -var promise = new Promise; -promise.reject(" :( "); -promise.onReject(function (reason) { - console.log(reason); // logs " :( " -}) -``` - -####onResolve - -Allows registration of node.js style callbacks `(err, args..)` to handle either promise resolution type (fulfill or reject). - -```js -// fulfillment -var promise = new Promise; -promise.onResolve(function (err, a, b) { - console.log(a + b); // logs 3 -}); -promise.fulfill(1, 2); - -// rejection -var promise = new Promise; -promise.onResolve(function (err) { - if (err) { - console.log(err.message); // logs "failed" - } -}); -promise.reject(new Error('failed')); -``` - -####then - -Creates a new promise and returns it. If `onFulfill` or `onReject` are passed, they are added as SUCCESS/ERROR callbacks to this promise after the nextTick. - -Conforms to [promises/A+](https://github.com/promises-aplus/promises-spec) specification and passes its [tests](https://github.com/promises-aplus/promises-tests). - -```js -// promise.then(onFulfill, onReject); - -var p = new Promise; - -p.then(function (arg) { - return arg + 1; -}).then(function (arg) { - throw new Error(arg + ' is an error!'); -}).then(null, function (err) { - assert.ok(err instanceof Error); - assert.equal('2 is an error', err.message); -}); -p.fullfill(1); -``` - -####end - -Signifies that this promise was the last in a chain of `then()s`: if a handler passed to the call to `then` which produced this promise throws, the exception be rethrown. -You can pass an OnReject handler to `end` so that exceptions will be handled (like a final catch clause); -This method returns it's promise for easy use with `return`. - -```js -var p = new Promise; -p.then(function(){ throw new Error('shucks') }); -setTimeout(function () { - p.fulfill(); - // error was caught and swallowed by the promise returned from - // p.then(). we either have to always register handlers on - // the returned promises or we can do the following... -}, 10); - -// this time we use .end() which prevents catching thrown errors -var p = new Promise; -setTimeout(function () { - p.fulfill(); // throws "shucks" -}, 10); -return p.then(function(){ throw new Error('shucks') }).end(); // <-- -``` - - -### chain - -Allows direct promise to promise chaining (especially useful by a outside aggregating function). It doesn't use the asynchronous `resolve` algorithm and so excepts only another Promise as it's argument. - -```js -function makeMeAPromise(i) { - var p = new Promise; - p.fulfill(i); - return p; -} - -var returnPromise = initialPromise = new Promise; -for (i=0; i<10; ++i) - returnPromise = returnPromise.chain(makeMeAPromise(i)); - -initialPromise.fulfill(); -return returnPromise; -``` - -###Event names - -If you'd like to alter this implementations event names used to signify success and failure you may do so by setting `Promise.SUCCESS` or `Promise.FAILURE` respectively. - -```js -Promise.SUCCESS = 'complete'; -Promise.FAILURE = 'err'; -``` - -###Luke, use the Source -For more ideas read the [source](https://github.com/aheckmann/mpromise/blob/master/lib), [tests](https://github.com/aheckmann/mpromise/blob/master/test), or the [mongoose implementation](https://github.com/LearnBoost/mongoose/blob/3.6x/lib/promise.js). - -## license - -[MIT](https://github.com/aheckmann/mpromise/blob/master/LICENSE) diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/lib/promise.js b/Associations/node_modules/mongoose/node_modules/mpromise/lib/promise.js deleted file mode 100644 index ff2768f1..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/lib/promise.js +++ /dev/null @@ -1,440 +0,0 @@ -'use strict'; -var util = require('util'); -var EventEmitter = require('events').EventEmitter; -function toArray(arr, start, end) { - return Array.prototype.slice.call(arr, start, end) -} -function strongUnshift(x, arrLike) { - var arr = toArray(arrLike); - arr.unshift(x); - return arr; -} - - -/** - * Promise constructor. - * - * _NOTE: The success and failure event names can be overridden by setting `Promise.SUCCESS` and `Promise.FAILURE` respectively._ - * - * @param {Function} back a function that accepts `fn(err, ...){}` as signature - * @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter - * @event `reject`: Emits when the promise is rejected (event name may be overridden) - * @event `fulfill`: Emits when the promise is fulfilled (event name may be overridden) - * @api public - */ -function Promise(back) { - this.emitter = new EventEmitter(); - this.emitted = {}; - this.ended = false; - if ('function' == typeof back) - this.onResolve(back); -} - - -/* - * Module exports. - */ -module.exports = Promise; - - -/*! - * event names - */ -Promise.SUCCESS = 'fulfill'; -Promise.FAILURE = 'reject'; - - -/** - * Adds `listener` to the `event`. - * - * If `event` is either the success or failure event and the event has already been emitted, the`listener` is called immediately and passed the results of the original emitted event. - * - * @param {String} event - * @param {Function} callback - * @return {Promise} this - * @api private - */ -Promise.prototype.on = function (event, callback) { - if (this.emitted[event]) - callback.apply(undefined, this.emitted[event]); - else - this.emitter.on(event, callback); - - return this; -}; - - -/** - * Keeps track of emitted events to run them on `on`. - * - * @api private - */ -Promise.prototype.safeEmit = function (event) { - // ensures a promise can't be fulfill() or reject() more than once - if (event == Promise.SUCCESS || event == Promise.FAILURE) { - if (this.emitted[Promise.SUCCESS] || this.emitted[Promise.FAILURE]) { - return this; - } - this.emitted[event] = toArray(arguments, 1); - } - - this.emitter.emit.apply(this.emitter, arguments); - return this; -}; - - -/** - * Fulfills this promise with passed arguments. - * - * If this promise has already been fulfilled or rejected, no action is taken. - * - * @api public - */ -Promise.prototype.fulfill = function () { - return this.safeEmit.apply(this, strongUnshift(Promise.SUCCESS, arguments)); -}; - - -/** - * Rejects this promise with `reason`. - * - * If this promise has already been fulfilled or rejected, no action is taken. - * - * @api public - * @param {Object|String} reason - * @return {Promise} this - */ -Promise.prototype.reject = function (reason) { - if (this.ended && !this.hasRejectListeners()) throw reason; - return this.safeEmit(Promise.FAILURE, reason); -}; - - -/** - * Resolves this promise to a rejected state if `err` is passed or - * fulfilled state if no `err` is passed. - * - * @param {Error} [err] error or null - * @param {Object} [val] value to fulfill the promise with - * @api public - */ -Promise.prototype.resolve = function (err, val) { - if (err) return this.reject(err); - return this.fulfill(val); -}; - - -/** - * Adds a listener to the SUCCESS event. - * - * @return {Promise} this - * @api public - */ -Promise.prototype.onFulfill = function (fn) { - if (!fn) return this; - if ('function' != typeof fn) throw new TypeError("fn should be a function"); - return this.on(Promise.SUCCESS, fn); -}; - - -Promise.prototype.hasRejectListeners = function () { - return this.emitter.listeners(Promise.FAILURE).length > 0; -}; - - -/** - * Adds a listener to the FAILURE event. - * - * @return {Promise} this - * @api public - */ -Promise.prototype.onReject = function (fn) { - if (!fn) return this; - if ('function' != typeof fn) throw new TypeError("fn should be a function"); - return this.on(Promise.FAILURE, fn); -}; - - -/** - * Adds a single function as a listener to both SUCCESS and FAILURE. - * - * It will be executed with traditional node.js argument position: - * function (err, args...) {} - * - * Also marks the promise as `end`ed, since it's the common use-case, and yet has no - * side effects unless `fn` is undefined or null. - * - * @param {Function} fn - * @return {Promise} this - */ -Promise.prototype.onResolve = function (fn) { - this.end(); - if (!fn) return this; - if ('function' != typeof fn) throw new TypeError("fn should be a function"); - this.on(Promise.FAILURE, function (err) { fn.call(this, err); }); - this.on(Promise.SUCCESS, function () { fn.apply(this, strongUnshift(null, arguments)); }); - return this; -}; - - -/** - * Creates a new promise and returns it. If `onFulfill` or - * `onReject` are passed, they are added as SUCCESS/ERROR callbacks - * to this promise after the next tick. - * - * Conforms to [promises/A+](https://github.com/promises-aplus/promises-spec) specification. Read for more detail how to use this method. - * - * ####Example: - * - * var p = new Promise; - * p.then(function (arg) { - * return arg + 1; - * }).then(function (arg) { - * throw new Error(arg + ' is an error!'); - * }).then(null, function (err) { - * assert.ok(err instanceof Error); - * assert.equal('2 is an error', err.message); - * }); - * p.complete(1); - * - * @see promises-A+ https://github.com/promises-aplus/promises-spec - * @param {Function} onFulfill - * @param {Function} [onReject] - * @return {Promise} newPromise - */ -Promise.prototype.then = function (onFulfill, onReject) { - var newPromise = new Promise; - - if ('function' == typeof onFulfill) { - this.onFulfill(handler(newPromise, onFulfill)); - } else { - this.onFulfill(newPromise.fulfill.bind(newPromise)); - } - - if ('function' == typeof onReject) { - this.onReject(handler(newPromise, onReject)); - } else { - this.onReject(newPromise.reject.bind(newPromise)); - } - - return newPromise; -}; - - -function handler(promise, fn) { - function newTickHandler() { - var pDomain = promise.emitter.domain; - if (pDomain && pDomain !== process.domain) pDomain.enter(); - try { - var x = fn.apply(undefined, boundHandler.args); - } catch (err) { - promise.reject(err); - return; - } - resolve(promise, x); - } - function boundHandler() { - boundHandler.args = arguments; - process.nextTick(newTickHandler); - } - return boundHandler; -} - - -function resolve(promise, x) { - function fulfillOnce() { - if (done++) return; - resolve.apply(undefined, strongUnshift(promise, arguments)); - } - function rejectOnce(reason) { - if (done++) return; - promise.reject(reason); - } - - if (promise === x) { - promise.reject(new TypeError("promise and x are the same")); - return; - } - var rest = toArray(arguments, 1); - var type = typeof x; - if ('undefined' == type || null == x || !('object' == type || 'function' == type)) { - promise.fulfill.apply(promise, rest); - return; - } - - try { - var theThen = x.then; - } catch (err) { - promise.reject(err); - return; - } - - if ('function' != typeof theThen) { - promise.fulfill.apply(promise, rest); - return; - } - - var done = 0; - try { - var ret = theThen.call(x, fulfillOnce, rejectOnce); - return ret; - } catch (err) { - if (done++) return; - promise.reject(err); - } -} - - -/** - * Signifies that this promise was the last in a chain of `then()s`: if a handler passed to the call to `then` which produced this promise throws, the exception will go uncaught. - * - * ####Example: - * - * var p = new Promise; - * p.then(function(){ throw new Error('shucks') }); - * setTimeout(function () { - * p.fulfill(); - * // error was caught and swallowed by the promise returned from - * // p.then(). we either have to always register handlers on - * // the returned promises or we can do the following... - * }, 10); - * - * // this time we use .end() which prevents catching thrown errors - * var p = new Promise; - * var p2 = p.then(function(){ throw new Error('shucks') }).end(); // <-- - * setTimeout(function () { - * p.fulfill(); // throws "shucks" - * }, 10); - * - * @api public - * @param {Function} [onReject] - * @return {Promise} this - */ -Promise.prototype.end = function (onReject) { - this.onReject(onReject); - this.ended = true; - return this; -}; - - -/** - * A debug utility function that adds handlers to a promise that will log some output to the `console` - * - * ####Example: - * - * var p = new Promise; - * p.then(function(){ throw new Error('shucks') }); - * setTimeout(function () { - * p.fulfill(); - * // error was caught and swallowed by the promise returned from - * // p.then(). we either have to always register handlers on - * // the returned promises or we can do the following... - * }, 10); - * - * // this time we use .end() which prevents catching thrown errors - * var p = new Promise; - * var p2 = p.then(function(){ throw new Error('shucks') }).end(); // <-- - * setTimeout(function () { - * p.fulfill(); // throws "shucks" - * }, 10); - * - * @api public - * @param {Promise} p - * @param {String} name - * @return {Promise} this - */ -Promise.trace = function (p, name) { - p.then( - function () { - console.log("%s fulfill %j", name, toArray(arguments)); - }, - function () { - console.log("%s reject %j", name, toArray(arguments)); - } - ) -}; - - -Promise.prototype.chain = function (p2) { - var p1 = this; - p1.onFulfill(p2.fulfill.bind(p2)); - p1.onReject(p2.reject.bind(p2)); - return p2; -}; - - -Promise.prototype.all = function (promiseOfArr) { - var pRet = new Promise; - this.then(promiseOfArr).then( - function (promiseArr) { - var count = 0; - var ret = []; - var errSentinel; - if (!promiseArr.length) pRet.resolve(); - promiseArr.forEach(function (promise, index) { - if (errSentinel) return; - count++; - promise.then( - function (val) { - if (errSentinel) return; - ret[index] = val; - --count; - if (count == 0) pRet.fulfill(ret); - }, - function (err) { - if (errSentinel) return; - errSentinel = err; - pRet.reject(err); - } - ); - }); - return pRet; - } - , pRet.reject.bind(pRet) - ); - return pRet; -}; - - -Promise.hook = function (arr) { - var p1 = new Promise; - var pFinal = new Promise; - var signalP = function () { - --count; - if (count == 0) - pFinal.fulfill(); - return pFinal; - }; - var count = 1; - var ps = p1; - arr.forEach(function (hook) { - ps = ps.then( - function () { - var p = new Promise; - count++; - hook(p.resolve.bind(p), signalP); - return p; - } - ) - }); - ps = ps.then(signalP); - p1.resolve(); - return ps; -}; - - -/* This is for the A+ tests, but it's very useful as well */ -Promise.fulfilled = function fulfilled() { var p = new Promise; p.fulfill.apply(p, arguments); return p; }; -Promise.rejected = function rejected(reason) { return new Promise().reject(reason); }; -Promise.deferred = function deferred() { - var p = new Promise; - return { - promise: p, - reject: p.reject.bind(p), - resolve: p.fulfill.bind(p), - callback: p.resolve.bind(p) - } -}; -/* End A+ tests adapter bit */ - - diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/package.json b/Associations/node_modules/mongoose/node_modules/mpromise/package.json deleted file mode 100644 index 247f6a78..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "mpromise", - "version": "0.5.4", - "publishConfig": { - "tag": "beta" - }, - "description": "Promises A+ conformant implementation", - "main": "lib/promise.js", - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "promises-aplus-tests": "2.0.3", - "mocha": "1.17.1" - }, - "repository": { - "type": "git", - "url": "git://github.com/aheckmann/mpromise" - }, - "keywords": [ - "promise", - "mongoose", - "aplus", - "a+", - "plus" - ], - "author": { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/aheckmann/mpromise/issues" - }, - "homepage": "https://github.com/aheckmann/mpromise", - "_id": "mpromise@0.5.4", - "dist": { - "shasum": "b610613ec6de37419f944b35f0783b4de9f5dc75", - "tarball": "http://registry.npmjs.org/mpromise/-/mpromise-0.5.4.tgz" - }, - "_from": "mpromise@0.5.4", - "_npmVersion": "1.3.26", - "_npmUser": { - "name": "refack", - "email": "refael@empeeric.com" - }, - "maintainers": [ - { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - }, - { - "name": "refack", - "email": "refael@empeeric.com" - } - ], - "directories": {}, - "_shasum": "b610613ec6de37419f944b35f0783b4de9f5dc75", - "_resolved": "https://registry.npmjs.org/mpromise/-/mpromise-0.5.4.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js b/Associations/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js deleted file mode 100644 index a6a6be74..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js +++ /dev/null @@ -1,28 +0,0 @@ -var Promise = require('../') - , Domain = require('domain').Domain - , assert = require('assert'); - - -describe("domains", function () { - it("exceptions should not breakout of domain boundaries", function (done) { - if (process.version.indexOf('v0.10') != 0) return done(); - var d = new Domain; - d.on('error', function (err) { - assert.equal(err.message, 'gaga'); - done() - }); - - var p = new Promise(); - d.run(function () { - p.then( - function () {} - ).then( - function () { throw new Error('gaga'); } - ).end(); - }); - - process.nextTick(function () { - p.fulfill(); - }); - }); -}); diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/test/promise.test.js b/Associations/node_modules/mongoose/node_modules/mpromise/test/promise.test.js deleted file mode 100644 index 30be6903..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/test/promise.test.js +++ /dev/null @@ -1,554 +0,0 @@ -/*global describe,it */ -/** - * Module dependencies. - */ - -var assert = require('assert'); -var Promise = require('../'); - -/** - * Test. - */ - -describe('promise', function () { - it('events fire right after fulfill()', function (done) { - var promise = new Promise() - , called = 0; - - promise.on('fulfill', function (a, b) { - assert.equal(a, '1'); - assert.equal(b, '2'); - called++; - }); - - promise.fulfill('1', '2'); - - promise.on('fulfill', function (a, b) { - assert.equal(a, '1'); - assert.equal(b, '2'); - called++; - }); - - assert.equal(2, called); - done(); - }); - - it('events fire right after reject()', function (done) { - var promise = new Promise() - , called = 0; - - promise.on('reject', function (err) { - assert.ok(err instanceof Error); - called++; - }); - - promise.reject(new Error('booyah')); - - promise.on('reject', function (err) { - assert.ok(err instanceof Error); - called++; - }); - - assert.equal(2, called); - done() - }); - - describe('onResolve()', function () { - it('from constructor works', function (done) { - var called = 0; - - var promise = new Promise(function (err) { - assert.ok(err instanceof Error); - called++; - }); - - promise.reject(new Error('dawg')); - - assert.equal(1, called); - done(); - }); - - it('after fulfill()', function (done) { - var promise = new Promise() - , called = 0; - - promise.fulfill('woot'); - - promise.onResolve(function (err, data) { - assert.equal(data, 'woot'); - called++; - }); - - promise.onResolve(function (err) { - assert.strictEqual(err, null); - called++; - }); - - assert.equal(2, called); - done(); - }) - }); - - describe('onFulfill shortcut', function () { - it('works', function (done) { - var promise = new Promise() - , called = 0; - - promise.onFulfill(function (woot) { - assert.strictEqual(woot, undefined); - called++; - }); - - promise.fulfill(); - - assert.equal(1, called); - done(); - }); - }); - - describe('onReject shortcut', function () { - it('works', function (done) { - var promise = new Promise() - , called = 0; - - promise.onReject(function (err) { - assert.ok(err instanceof Error); - called++; - }); - - promise.reject(new Error); - assert.equal(1, called); - done(); - }) - }); - - describe('return values', function () { - it('on()', function (done) { - var promise = new Promise(); - assert.ok(promise.on('jump', function () {}) instanceof Promise); - done() - }); - - it('onFulfill()', function (done) { - var promise = new Promise(); - assert.ok(promise.onFulfill(function () {}) instanceof Promise); - done(); - }); - it('onReject()', function (done) { - var promise = new Promise(); - assert.ok(promise.onReject(function () {}) instanceof Promise); - done(); - }); - it('onResolve()', function (done) { - var promise = new Promise(); - assert.ok(promise.onResolve(function () {}) instanceof Promise); - done(); - }) - }); - - describe('casting errors', function () { - describe('reject()', function () { - it('does not cast arguments to Error', function (done) { - var p = new Promise(function (err) { - assert.equal(3, err); - done(); - }); - - p.reject(3); - }) - }) - }); - - describe('then', function () { - describe('catching', function () { - it('should not catch returned promise fulfillments', function (done) { - var errorSentinal - , p = new Promise; - p.then(function () { throw errorSentinal = new Error("boo!") }); - - p.fulfill(); - done(); - }); - - - it('should not catch returned promise fulfillments even async', function (done) { - var errorSentinal - , p = new Promise; - p.then(function () { throw errorSentinal = new Error("boo!") }); - - setTimeout(function () { - p.fulfill(); - done(); - }, 10); - }); - - - it('can be disabled using .end()', function (done) { - if (process.version.indexOf('v0.8') == 0) return done(); - var errorSentinal - , overTimeout - , domain = require('domain').create(); - - domain.once('error', function (err) { - assert(err, errorSentinal); - clearTimeout(overTimeout); - done() - }); - - domain.run(function () { - var p = new Promise; - var p2 = p.then(function () { - throw errorSentinal = new Error('shucks') - }); - p2.end(); - - p.fulfill(); - }); - overTimeout = setTimeout(function () { done(new Error('error was swallowed')); }, 10); - }); - - - it('can be disabled using .end() even when async', function (done) { - if (process.version.indexOf('v0.10') != 0) return done(); - var errorSentinal - , overTimeout - , domain = require('domain').create(); - - domain.on('error', function (err) { - assert(err, errorSentinal); - clearTimeout(overTimeout); - done() - }); - - domain.run(function () { - var p = new Promise; - var p2 = p.then(function () { - throw errorSentinal = new Error("boo!") - }); - p2.end(); - - setTimeout(function () {p.fulfill();}, 10); - }); - overTimeout = setTimeout(function () { done(new Error('error was swallowed')); }, 20); - }); - - - it('can be handled using .end() so no throwing', function (done) { - var errorSentinal - , overTimeout - , domain = require('domain').create(); - - domain.run(function () { - var p = new Promise; - var p2 = p.then(function () { - throw errorSentinal = new Error("boo!") - }); - p2.end(function (err) { - assert.equal(err, errorSentinal); - clearTimeout(overTimeout); - done() - }); - - setTimeout(function () {p.fulfill();}, 10); - }); - overTimeout = setTimeout(function () { done(new Error('error was swallowed')); }, 20); - }); - - }); - - it('persistent', function (done) { - var p = new Promise; - v = null; - - function ensure(val) { - v = v || val; - assert.equal(v, val); - } - - function guard() { - throw new Error('onReject should not be called'); - } - - p.then(ensure, guard).end(); - - p.fulfill('foo'); - p.fulfill('bar'); - p.reject(new Error('baz')); - - p.then(ensure, guard).end(); - - setTimeout(done, 0); - }); - - - it('accepts multiple completion values', function (done) { - var p = new Promise; - - p.then(function (a, b) { - assert.equal(2, arguments.length); - assert.equal('hi', a); - assert.equal(4, b); - done(); - }, done).end(); - - p.fulfill('hi', 4); - }) - }); - - describe('fulfill values and splats', function () { - it('should handle multiple values', function (done) { - var p = new Promise; - p.onFulfill(function (a, b, c) { - assert.equal('a', a); - assert.equal('b', b); - assert.equal('c', c); - done(); - }); - p.fulfill('a', 'b', 'c'); - }); - - it('should handle multiple values from a then', function (done) { - Promise.fulfilled().then( - function () { - return Promise.fulfilled().then( - function () { - var p = new Promise; - p.fulfill('a', 'b', 'c'); - return p; - } - ); - } - ).onFulfill( - function (a, b, c) { - assert.equal('a', a); - assert.equal('b', b); - assert.equal('c', c); - done(); - } - ).end() - }); - - it('should work with `fulfilled` convenience method', function (done) { - Promise.fulfilled('a', 'b', 'c').then(function (a, b, c) { - assert.equal('a', a); - assert.equal('b', b); - assert.equal('c', c); - done(); - }) - }); - }); - - - describe('end', function () { - it("should return the promise", function (done) { - var p = new Promise; - var p1 = p.end(); - assert.equal(p, p1); - done(); - }); - - - it("should throw for chain", function (done) { - var p = new Promise; - p.then().then().then().then().end(); - try { - p.reject('bad'); - } catch (e) { - done(); - } - }); - - - it("should not throw for chain with reject handler", function (done) { - var p = new Promise; - p.then().then().then().then().end(function () { - done(); - }); - try { - p.reject('bad'); - } catch (e) { - done(e); - } - }); - }); - - - describe('chain', function () { - it('should propagate fulfillment', function (done) { - var varSentinel = {a: 'a'}; - var p1 = new Promise; - p1.chain(new Promise(function (err, doc) { - assert.equal(doc, varSentinel); - done(); - })); - p1.fulfill(varSentinel); - }); - - - it('should propagate rejection', function (done) { - var e = new Error("gaga"); - var p1 = new Promise; - p1.chain(new Promise(function (err) { - assert.equal(err, e); - done(); - })); - p1.reject(e); - }); - - - it('should propagate resolution err', function (done) { - var e = new Error("gaga"); - var p1 = new Promise; - p1.chain(new Promise(function (err) { - assert.equal(err, e); - done(); - })); - p1.resolve(e); - }); - - - it('should propagate resolution val', function (done) { - var varSentinel = {a: 'a'}; - var p1 = new Promise; - p1.chain(new Promise(function (err, val) { - assert.equal(val, varSentinel); - done(); - })); - p1.resolve(null, varSentinel); - }) - }); - - - describe("all", function () { - it("works", function (done) { - var count = 0; - var p = new Promise; - var p2 = p.all(function () { - return [ - (function () { - var p = new Promise(); - count++; - p.resolve(); - return p; - })() - , (function () { - var p = new Promise(); - count++; - p.resolve(); - return p; - })() - ]; - }); - p2.then(function () { - assert.equal(count, 2); - done(); - }); - p.resolve(); - }); - - - it("handles rejects", function (done) { - var count = 0; - var p = new Promise; - var p2 = p.all(function () { - return [ - (function () { - var p = new Promise(); - count++; - p.resolve(); - return p; - })() - , (function () { - count++; - throw new Error("gaga"); - })() - ]; - }); - p2.onReject(function (err) { - assert(err.message, "gaga"); - assert.equal(count, 2); - done(); - }); - p.resolve(); - }); - }); - - - describe("deferred", function () { - it("works", function (done) { - var d = Promise.deferred(); - assert.ok(d.promise instanceof Promise); - assert.ok(d.reject instanceof Function); - assert.ok(d.resolve instanceof Function); - assert.ok(d.callback instanceof Function); - done(); - }); - }); - - - describe("hook", function () { - it("works", function (done) { - var run = 0; - var l1 = function (ser, par) { - run++; - ser(); - par(); - }; - Promise.hook([l1, l1, l1]).then(function () { - assert(run, 3); - done(); - }) - - }); - - - it("works with async serial hooks", function (done) { - this.timeout(800); - var run = 0; - var l1 = function (ser, par) { - run++; - setTimeout(function () {ser();}, 200); - par(); - }; - Promise.hook([l1, l1, l1]).then(function () { - assert(run, 3); - done(); - }) - }); - - - it("works with async parallel hooks", function (done) { - this.timeout(400); - var run = 0; - var l1 = function (ser, par) { - run++; - ser(); - setTimeout(function () {par();}, 200); - }; - Promise.hook([l1, l1, l1]).then(function () { - assert(run, 3); - done(); - }) - }); - - - it("catches errors in hook logic", function (done) { - var run = 0; - var l1 = function (ser, par) { - run++; - ser(); - par(); - }; - var l2 = function (ser, par) { - run++; - ser(); - par(); - throw new Error("err") - }; - Promise.hook([l1, l2, l1]).end(function (err) { - assert(run, 2); - done(); - }); - }); - }); -}); diff --git a/Associations/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js b/Associations/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js deleted file mode 100644 index d30bb32c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Module dependencies. - */ -var Promise = require('../lib/promise'); -var aplus = require('promises-aplus-tests'); - -// tests -describe("run A+ suite", function () { - aplus.mocha({ - fulfilled: Promise.fulfilled, - rejected: Promise.rejected, - deferred: Promise.deferred - }); -}); - diff --git a/Associations/node_modules/mongoose/node_modules/mquery/.npmignore b/Associations/node_modules/mongoose/node_modules/mquery/.npmignore deleted file mode 100644 index 5a14ae1e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -*.sw* -node_modules/ -coverage/ diff --git a/Associations/node_modules/mongoose/node_modules/mquery/.travis.yml b/Associations/node_modules/mongoose/node_modules/mquery/.travis.yml deleted file mode 100644 index 4dc3a7d4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.10 - - 0.11 -services: - - mongodb diff --git a/Associations/node_modules/mongoose/node_modules/mquery/History.md b/Associations/node_modules/mongoose/node_modules/mquery/History.md deleted file mode 100644 index 99726648..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/History.md +++ /dev/null @@ -1,230 +0,0 @@ - -1.6.2 / 2015-07-12 -================== - - * fixed; support exec cb being called synchronously #66 - -1.6.1 / 2015-06-16 -================== - - * fixed; do not treat $meta projection as inclusive [vkarpov15](https://github.com/vkarpov15) - -1.6.0 / 2015-05-27 -================== - - * update dependencies #65 [bachp](https://github.com/bachp) - -1.5.0 / 2015-03-31 -================== - - * fixed; debug output - * fixed; allow hint usage with count #61 [trueinsider](https://github.com/trueinsider) - -1.4.0 / 2015-03-29 -================== - - * added; object support to slice() #60 [vkarpov15](https://github.com/vkarpov15) - * debug; improved output #57 [flyvictor](https://github.com/flyvictor) - -1.3.0 / 2014-11-06 -================== - - * added; setTraceFunction() #53 from [jlai](https://github.com/jlai) - -1.2.1 / 2014-09-26 -================== - - * fixed; distinct assignment in toConstructor() #51 from [esco](https://github.com/esco) - -1.2.0 / 2014-09-18 -================== - - * added; stream() support for find() - -1.1.0 / 2014-09-15 -================== - - * add #then for co / koa support - * start checking code coverage - -1.0.0 / 2014-07-07 -================== - - * Remove broken require() calls until they're actually implemented #48 [vkarpov15](https://github.com/vkarpov15) - -0.9.0 / 2014-05-22 -================== - - * added; thunk() support - * release 0.8.0 - -0.8.0 / 2014-05-15 -================== - - * added; support for maxTimeMS #44 [yoitsro](https://github.com/yoitsro) - * updated; devDependency (driver to 1.4.4) - -0.7.0 / 2014-05-02 -================== - - * fixed; pass $maxDistance in $near object as described in docs #43 [vkarpov15](https://github.com/vkarpov15) - * fixed; cloning buffers #42 [gjohnson](https://github.com/gjohnson) - * tests; a little bit more `mongodb` agnostic #34 [refack](https://github.com/refack) - -0.6.0 / 2014-04-01 -================== - - * fixed; Allow $meta args in sort() so text search sorting works #37 [vkarpov15](https://github.com/vkarpov15) - -0.5.3 / 2014-02-22 -================== - - * fixed; cloning mongodb.Binary - -0.5.2 / 2014-01-30 -================== - - * fixed; cloning ObjectId constructors - * fixed; cloning of ReadPreferences #30 [ashtuchkin](https://github.com/ashtuchkin) - * tests; use specific mongodb version #29 [AvianFlu](https://github.com/AvianFlu) - * tests; remove dependency on ObjectId #28 [refack](https://github.com/refack) - * tests; add failing ReadPref test - -0.5.1 / 2014-01-17 -================== - - * added; deprecation notice to tags parameter #27 [ashtuchkin](https://github.com/ashtuchkin) - * readme; add links - -0.5.0 / 2014-01-16 -================== - - * removed; mongodb driver dependency #26 [ashtuchkin](https://github.com/ashtuchkin) - * removed; first class support of read preference tags #26 (still supported though) [ashtuchkin](https://github.com/ashtuchkin) - * added; better ObjectId clone support - * fixed; cloning objects that have no constructor #21 - * docs; cleaned up [ashtuchkin](https://github.com/ashtuchkin) - -0.4.2 / 2014-01-08 -================== - - * updated; debug module 0.7.4 [refack](https://github.com/refack) - -0.4.1 / 2014-01-07 -================== - - * fixed; inclusive/exclusive logic - -0.4.0 / 2014-01-06 -================== - - * added; selected() - * added; selectedInclusively() - * added; selectedExclusively() - -0.3.3 / 2013-11-14 -================== - - * Fix Mongo DB Dependency #20 [rschmukler](https://github.com/rschmukler) - -0.3.2 / 2013-09-06 -================== - - * added; geometry support for near() - -0.3.1 / 2013-08-22 -================== - - * fixed; update retains key order #19 - -0.3.0 / 2013-08-22 -================== - - * less hardcoded isNode env detection #18 [vshulyak](https://github.com/vshulyak) - * added; validation of findAndModify varients - * clone update doc before execution - * stricter env checks - -0.2.7 / 2013-08-2 -================== - - * Now support GeoJSON point values for Query#near - -0.2.6 / 2013-07-30 -================== - - * internally, 'asc' and 'desc' for sorts are now converted into 1 and -1, respectively - -0.2.5 / 2013-07-30 -================== - - * updated docs - * changed internal representation of `sort` to use objects instead of arrays - -0.2.4 / 2013-07-25 -================== - - * updated; sliced to 0.0.5 - -0.2.3 / 2013-07-09 -================== - - * now using a callback in collection.find instead of directly calling toArray() on the cursor [ebensing](https://github.com/ebensing) - -0.2.2 / 2013-07-09 -================== - - * now exposing mongodb export to allow for better testing [ebensing](https://github.com/ebensing) - -0.2.1 / 2013-07-08 -================== - - * select no longer accepts arrays as parameters [ebensing](https://github.com/ebensing) - -0.2.0 / 2013-07-05 -================== - - * use $geoWithin by default - -0.1.2 / 2013-07-02 -================== - - * added use$geoWithin flag [ebensing](https://github.com/ebensing) - * fix read preferences typo [ebensing](https://github.com/ebensing) - * fix reference to old param name in exists() [ebensing](https://github.com/ebensing) - -0.1.1 / 2013-06-24 -================== - - * fixed; $intersects -> $geoIntersects #14 [ebensing](https://github.com/ebensing) - * fixed; Retain key order when copying objects #15 [ebensing](https://github.com/ebensing) - * bump mongodb dev dep - -0.1.0 / 2013-05-06 -================== - - * findAndModify; return the query - * move mquery.proto.canMerge to mquery.canMerge - * overwrite option now works with non-empty objects - * use strict mode - * validate count options - * validate distinct options - * add aggregate to base collection methods - * clone merge arguments - * clone merged update arguments - * move subclass to mquery.prototype.toConstructor - * fixed; maxScan casing - * use regexp-clone - * added; geometry/intersects support - * support $and - * near: do not use "radius" - * callbacks always fire on next turn of loop - * defined collection interface - * remove time from tests - * clarify goals - * updated docs; - -0.0.1 / 2012-12-15 -================== - - * initial release diff --git a/Associations/node_modules/mongoose/node_modules/mquery/LICENSE b/Associations/node_modules/mongoose/node_modules/mquery/LICENSE deleted file mode 100644 index 38c529da..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.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/Associations/node_modules/mongoose/node_modules/mquery/Makefile b/Associations/node_modules/mongoose/node_modules/mquery/Makefile deleted file mode 100644 index dbb28318..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/Makefile +++ /dev/null @@ -1,22 +0,0 @@ - -test: - @NODE_ENV=test ./node_modules/.bin/mocha $(T) $(TESTS) - -test-cov: - @NODE_ENV=test node \ - node_modules/.bin/istanbul cover \ - ./node_modules/.bin/_mocha \ - -- -u exports \ - -open-cov: - open coverage/lcov-report/index.html - -test-travis: - @NODE_ENV=test node \ - node_modules/.bin/istanbul cover \ - ./node_modules/.bin/_mocha \ - --report lcovonly \ - -- -u exports \ - --bail - -.PHONY: test test-cov open-cov test-travis diff --git a/Associations/node_modules/mongoose/node_modules/mquery/README.md b/Associations/node_modules/mongoose/node_modules/mquery/README.md deleted file mode 100644 index f7bf7f44..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/README.md +++ /dev/null @@ -1,1220 +0,0 @@ -#mquery -=========== - -`mquery` is a fluent mongodb query builder designed to run in multiple environments. As of v0.1, `mquery` runs on `Node.js` only with support for the MongoDB shell and browser environments planned for upcoming releases. - -##Features - - - fluent query builder api - - custom base query support - - MongoDB 2.4 geoJSON support - - method + option combinations validation - - node.js driver compatibility - - environment detection - - [debug](https://github.com/visionmedia/debug) support - - separated collection implementations for maximum flexibility - -[![Build Status](https://travis-ci.org/aheckmann/mquery.png)](https://travis-ci.org/aheckmann/mquery) - -##Use - -```js -require('mongodb').connect(uri, function (err, db) { - if (err) return handleError(err); - - // get a collection - var collection = db.collection('artists'); - - // pass it to the constructor - mquery(collection).find({..}, callback); - - // or pass it to the collection method - mquery().find({..}).collection(collection).exec(callback) - - // or better yet, create a custom query constructor that has it always set - var Artist = mquery(collection).toConstructor(); - Artist().find(..).where(..).exec(callback) -}) -``` - -`mquery` requires a collection object to work with. In the example above we just pass the collection object created using the official [MongoDB driver](https://github.com/mongodb/node-mongodb-native). - - -##Fluent API - -- [find](#find) -- [findOne](#findOne) -- [count](#count) -- [remove](#remove) -- [update](#update) -- [findOneAndUpdate](#findoneandupdate) -- [findOneAndRemove](#findoneandremove) -- [distinct](#distinct) -- [exec](#exec) -- [stream](#stream) -- [all](#all) -- [and](#and) -- [box](#box) -- [circle](#circle) -- [elemMatch](#elemmatch) -- [equals](#equals) -- [exists](#exists) -- [geometry](#geometry) -- [gt](#gt) -- [gte](#gte) -- [in](#in) -- [intersects](#intersects) -- [lt](#lt) -- [lte](#lte) -- [maxDistance](#maxdistance) -- [mod](#mod) -- [ne](#ne) -- [nin](#nin) -- [nor](#nor) -- [near](#near) -- [or](#or) -- [polygon](#polygon) -- [regex](#regex) -- [select](#select) -- [selected](#selected) -- [selectedInclusively](#selectedinclusively) -- [selectedExclusively](#selectedexclusively) -- [size](#size) -- [slice](#slice) -- [within](#within) -- [where](#where) -- [$where](#where-1) -- [batchSize](#batchsize) -- [comment](#comment) -- [hint](#hint) -- [limit](#limit) -- [maxScan](#maxscan) -- [maxTime](#maxtime) -- [skip](#skip) -- [sort](#sort) -- [read](#read) -- [slaveOk](#slaveok) -- [snapshot](#snapshot) -- [tailable](#tailable) - -## Helpers - -- [collection](#collection) -- [then](#then) -- [thunk](#thunk) -- [merge](#mergeobject) -- [setOptions](#setoptionsoptions) -- [setTraceFunction](#settracefunctionfunc) -- [mquery.setGlobalTraceFunction](#mquerysetglobaltracefunctionfunc) -- [mquery.canMerge](#mquerycanmerge) -- [mquery.use$geoWithin](#mqueryusegeowithin) - -###find() - -Declares this query a _find_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().find() -mquery().find(match) -mquery().find(callback) -mquery().find(match, function (err, docs) { - assert(Array.isArray(docs)); -}) -``` - -###findOne() - -Declares this query a _findOne_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().findOne() -mquery().findOne(match) -mquery().findOne(callback) -mquery().findOne(match, function (err, doc) { - if (doc) { - // the document may not be found - console.log(doc); - } -}) -``` - -###count() - -Declares this query a _count_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().count() -mquery().count(match) -mquery().count(callback) -mquery().count(match, function (err, number){ - console.log('we found %d matching documents', number); -}) -``` - -###remove() - -Declares this query a _remove_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().remove() -mquery().remove(match) -mquery().remove(callback) -mquery().remove(match, function (err){}) -``` - -###update() - -Declares this query an _update_ query. Optionally pass an update document, match clause, options or callback. If a callback is passed, the query is executed. To force execution without passing a callback, run `update(true)`. - -```js -mquery().update() -mquery().update(match, updateDocument) -mquery().update(match, updateDocument, options) - -// the following all execute the command -mquery().update(callback) -mquery().update({$set: updateDocument, callback) -mquery().update(match, updateDocument, callback) -mquery().update(match, updateDocument, options, function (err, result){}) -mquery().update(true) // executes (unsafe write) -``` - -#####the update document - -All paths passed that are not `$atomic` operations will become `$set` ops. For example: - -```js -mquery(collection).where({ _id: id }).update({ title: 'words' }, callback) -``` - -becomes - -```js -collection.update({ _id: id }, { $set: { title: 'words' }}, callback) -``` - -This behavior can be overridden using the `overwrite` option (see below). - -#####options - -Options are passed to the `setOptions()` method. - -- overwrite - -Passing an empty object `{ }` as the update document will result in a no-op unless the `overwrite` option is passed. Without the `overwrite` option, the update operation will be ignored and the callback executed without sending the command to MongoDB to prevent accidently overwritting documents in the collection. - -```js -var q = mquery(collection).where({ _id: id }).setOptions({ overwrite: true }); -q.update({ }, callback); // overwrite with an empty doc -``` - -The `overwrite` option isn't just for empty objects, it also provides a means to override the default `$set` conversion and send the update document as is. - -```js -// create a base query -var base = mquery({ _id: 108 }).collection(collection).toConstructor(); - -base().findOne(function (err, doc) { - console.log(doc); // { _id: 108, name: 'cajon' }) - - base().setOptions({ overwrite: true }).update({ changed: true }, function (err) { - base.findOne(function (err, doc) { - console.log(doc); // { _id: 108, changed: true }) - the doc was overwritten - }); - }); -}) -``` - -- multi - -Updates only modify a single document by default. To update multiple documents, set the `multi` option to `true`. - -```js -mquery() - .collection(coll) - .update({ name: /^match/ }, { $addToSet: { arr: 4 }}, { multi: true }, callback) - -// another way of doing it -mquery({ name: /^match/ }) - .collection(coll) - .setOptions({ multi: true }) - .update({ $addToSet: { arr: 4 }}, callback) - -// update multiple documents with an empty doc -var q = mquery(collection).where({ name: /^match/ }); -q.setOptions({ multi: true, overwrite: true }) -q.update({ }); -q.update(function (err, result) { - console.log(arguments); -}); -``` - -###findOneAndUpdate() - -Declares this query a _findAndModify_ with update query. Optionally pass a match clause, update document, options, or callback. If a callback is passed, the query is executed. - -When executed, the first matching document (if found) is modified according to the update document and passed back to the callback. - -#####options - -Options are passed to the `setOptions()` method. - -- `new`: boolean - true to return the modified document rather than the original. defaults to true -- `upsert`: boolean - creates the object if it doesn't exist. defaults to false -- `sort`: if multiple docs are found by the match condition, sets the sort order to choose which doc to update - -```js -query.findOneAndUpdate() -query.findOneAndUpdate(updateDocument) -query.findOneAndUpdate(match, updateDocument) -query.findOneAndUpdate(match, updateDocument, options) - -// the following all execute the command -query.findOneAndUpdate(callback) -query.findOneAndUpdate(updateDocument, callback) -query.findOneAndUpdate(match, updateDocument, callback) -query.findOneAndUpdate(match, updateDocument, options, function (err, doc) { - if (doc) { - // the document may not be found - console.log(doc); - } -}) - ``` - -###findOneAndRemove() - -Declares this query a _findAndModify_ with remove query. Optionally pass a match clause, options, or callback. If a callback is passed, the query is executed. - -When executed, the first matching document (if found) is modified according to the update document, removed from the collection and passed to the callback. - -#####options - -Options are passed to the `setOptions()` method. - -- `sort`: if multiple docs are found by the condition, sets the sort order to choose which doc to modify and remove - -```js -A.where().findOneAndRemove() -A.where().findOneAndRemove(match) -A.where().findOneAndRemove(match, options) - -// the following all execute the command -A.where().findOneAndRemove(callback) -A.where().findOneAndRemove(match, callback) -A.where().findOneAndRemove(match, options, function (err, doc) { - if (doc) { - // the document may not be found - console.log(doc); - } -}) - ``` - -###distinct() - -Declares this query a _distinct_ query. Optionally pass the distinct field, a match clause or callback. If a callback is passed the query is executed. - -```js -mquery().distinct() -mquery().distinct(match) -mquery().distinct(match, field) -mquery().distinct(field) - -// the following all execute the command -mquery().distinct(callback) -mquery().distinct(field, callback) -mquery().distinct(match, callback) -mquery().distinct(match, field, function (err, result) { - console.log(result); -}) -``` - -###exec() - -Executes the query. - -```js -mquery().findOne().where('route').intersects(polygon).exec(function (err, docs){}) -``` - -###stream() - -Executes the query and returns a stream. - -```js -var stream = mquery().find().stream(options); -stream.on('data', cb); -stream.on('close', fn); -``` - -Note: this only works with `find()` operations. - -Note: returns the stream object directly from the node-mongodb-native driver. (currently streams1 type stream). Any options will be passed along to the [driver method](http://mongodb.github.io/node-mongodb-native/api-generated/cursor.html#stream). - -------------- - -###all() - -Specifies an `$all` query condition - -```js -mquery().where('permission').all(['read', 'write']) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/all/) - -###and() - -Specifies arguments for an `$and` condition - -```js -mquery().and([{ color: 'green' }, { status: 'ok' }]) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/and/) - -###box() - -Specifies a `$box` condition - -```js -var lowerLeft = [40.73083, -73.99756] -var upperRight= [40.741404, -73.988135] - -mquery().where('location').within().box(lowerLeft, upperRight) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/box/) - -###circle() - -Specifies a `$center` or `$centerSphere` condition. - -```js -var area = { center: [50, 50], radius: 10, unique: true } -query.where('loc').within().circle(area) -query.circle('loc', area); - -// for spherical calculations -var area = { center: [50, 50], radius: 10, unique: true, spherical: true } -query.where('loc').within().circle(area) -query.circle('loc', area); -``` - -- [MongoDB Documentation - center](http://docs.mongodb.org/manual/reference/operator/center/) -- [MongoDB Documentation - centerSphere](http://docs.mongodb.org/manual/reference/operator/centerSphere/) - -###elemMatch() - -Specifies an `$elemMatch` condition - -```js -query.where('comment').elemMatch({ author: 'autobot', votes: {$gte: 5}}) - -query.elemMatch('comment', function (elem) { - elem.where('author').equals('autobot'); - elem.where('votes').gte(5); -}) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/elemMatch/) - -###equals() - -Specifies the complementary comparison value for the path specified with `where()`. - -```js -mquery().where('age').equals(49); - -// is the same as - -mquery().where({ 'age': 49 }); -``` - -###exists() - -Specifies an `$exists` condition - -```js -// { name: { $exists: true }} -mquery().where('name').exists() -mquery().where('name').exists(true) -mquery().exists('name') - -// { name: { $exists: false }} -mquery().where('name').exists(false); -mquery().exists('name', false); -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/exists/) - -###geometry() - -Specifies a `$geometry` condition - -```js -var polyA = [[[ 10, 20 ], [ 10, 40 ], [ 30, 40 ], [ 30, 20 ]]] -query.where('loc').within().geometry({ type: 'Polygon', coordinates: polyA }) - -// or -var polyB = [[ 0, 0 ], [ 1, 1 ]] -query.where('loc').within().geometry({ type: 'LineString', coordinates: polyB }) - -// or -var polyC = [ 0, 0 ] -query.where('loc').within().geometry({ type: 'Point', coordinates: polyC }) - -// or -query.where('loc').intersects().geometry({ type: 'Point', coordinates: polyC }) - -// or -query.where('loc').near().geometry({ type: 'Point', coordinates: [3,5] }) -``` - -`geometry()` **must** come after `intersects()`, `within()`, or `near()`. - -The `object` argument must contain `type` and `coordinates` properties. - -- type `String` -- coordinates `Array` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/geometry/) - -###gt() - -Specifies a `$gt` query condition. - -```js -mquery().where('clicks').gt(999) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/gt/) - -###gte() - -Specifies a `$gte` query condition. - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/gte/) - -```js -mquery().where('clicks').gte(1000) -``` - -###in() - -Specifies an `$in` query condition. - -```js -mquery().where('author_id').in([3, 48901, 761]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/in/) - -###intersects() - -Declares an `$geoIntersects` query for `geometry()`. - -```js -query.where('path').intersects().geometry({ - type: 'LineString' - , coordinates: [[180.0, 11.0], [180, 9.0]] -}) - -// geometry arguments are supported -query.where('path').intersects({ - type: 'LineString' - , coordinates: [[180.0, 11.0], [180, 9.0]] -}) -``` - -**Must** be used after `where()`. - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/geoIntersects/) - -###lt() - -Specifies a `$lt` query condition. - -```js -mquery().where('clicks').lt(50) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/lt/) - -###lte() - -Specifies a `$lte` query condition. - -```js -mquery().where('clicks').lte(49) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/lte/) - -###maxDistance() - -Specifies a `$maxDistance` query condition. - -```js -mquery().where('location').near({ center: [139, 74.3] }).maxDistance(5) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/maxDistance/) - -###mod() - -Specifies a `$mod` condition - -```js -mquery().where('count').mod(2, 0) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/mod/) - -###ne() - -Specifies a `$ne` query condition. - -```js -mquery().where('status').ne('ok') -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/ne/) - -###nin() - -Specifies an `$nin` query condition. - -```js -mquery().where('author_id').nin([3, 48901, 761]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/nin/) - -###nor() - -Specifies arguments for an `$nor` condition. - -```js -mquery().nor([{ color: 'green' }, { status: 'ok' }]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/nor/) - -###near() - -Specifies arguments for a `$near` or `$nearSphere` condition. - -These operators return documents sorted by distance. - -####Example - -```js -query.where('loc').near({ center: [10, 10] }); -query.where('loc').near({ center: [10, 10], maxDistance: 5 }); -query.near('loc', { center: [10, 10], maxDistance: 5 }); - -// GeoJSON -query.where('loc').near({ center: { type: 'Point', coordinates: [10, 10] }}); -query.where('loc').near({ center: { type: 'Point', coordinates: [10, 10] }, maxDistance: 5, spherical: true }); -query.where('loc').near().geometry({ type: 'Point', coordinates: [10, 10] }); - -// For a $nearSphere condition, pass the `spherical` option. -query.near({ center: [10, 10], maxDistance: 5, spherical: true }); -``` - -[MongoDB Documentation](http://www.mongodb.org/display/DOCS/Geospatial+Indexing) - -###or() - -Specifies arguments for an `$or` condition. - -```js -mquery().or([{ color: 'red' }, { status: 'emergency' }]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/or/) - -###polygon() - -Specifies a `$polygon` condition - -```js -mquery().where('loc').within().polygon([10,20], [13, 25], [7,15]) -mquery().polygon('loc', [10,20], [13, 25], [7,15]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/polygon/) - -###regex() - -Specifies a `$regex` query condition. - -```js -mquery().where('name').regex(/^sixstepsrecords/) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/regex/) - -###select() - -Specifies which document fields to include or exclude - -```js -// 1 means include, 0 means exclude -mquery().select({ name: 1, address: 1, _id: 0 }) - -// or - -mquery().select('name address -_id') -``` - -#####String syntax - -When passing a string, prefixing a path with `-` will flag that path as excluded. When a path does not have the `-` prefix, it is included. - -```js -// include a and b, exclude c -query.select('a b -c'); - -// or you may use object notation, useful when -// you have keys already prefixed with a "-" -query.select({a: 1, b: 1, c: 0}); -``` - -_Cannot be used with `distinct()`._ - -###selected() - -Determines if the query has selected any fields. - -```js -var query = mquery(); -query.selected() // false -query.select('-name'); -query.selected() // true -``` - -###selectedInclusively() - -Determines if the query has selected any fields inclusively. - -```js -var query = mquery().select('name'); -query.selectedInclusively() // true - -var query = mquery(); -query.selected() // false -query.select('-name'); -query.selectedInclusively() // false -query.selectedExclusively() // true -``` - -###selectedExclusively() - -Determines if the query has selected any fields exclusively. - -```js -var query = mquery().select('-name'); -query.selectedExclusively() // true - -var query = mquery(); -query.selected() // false -query.select('name'); -query.selectedExclusively() // false -query.selectedInclusively() // true -``` - -###size() - -Specifies a `$size` query condition. - -```js -mquery().where('someArray').size(6) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/size/) - -###slice() - -Specifies a `$slice` projection for a `path` - -```js -mquery().where('comments').slice(5) -mquery().where('comments').slice(-5) -mquery().where('comments').slice([-10, 5]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/projection/slice/) - -###within() - -Sets a `$geoWithin` or `$within` argument for geo-spatial queries. - -```js -mquery().within().box() -mquery().within().circle() -mquery().within().geometry() - -mquery().where('loc').within({ center: [50,50], radius: 10, unique: true, spherical: true }); -mquery().where('loc').within({ box: [[40.73, -73.9], [40.7, -73.988]] }); -mquery().where('loc').within({ polygon: [[],[],[],[]] }); - -mquery().where('loc').within([], [], []) // polygon -mquery().where('loc').within([], []) // box -mquery().where('loc').within({ type: 'LineString', coordinates: [...] }); // geometry -``` - -As of mquery 2.0, `$geoWithin` is used by default. This impacts you if running MongoDB < 2.4. To alter this behavior, see [mquery.use$geoWithin](#mqueryusegeowithin). - -**Must** be used after `where()`. - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/geoWithin/) - -###where() - -Specifies a `path` for use with chaining - -```js -// instead of writing: -mquery().find({age: {$gte: 21, $lte: 65}}); - -// we can instead write: -mquery().where('age').gte(21).lte(65); - -// passing query conditions is permitted too -mquery().find().where({ name: 'vonderful' }) - -// chaining -mquery() -.where('age').gte(21).lte(65) -.where({ 'name': /^vonderful/i }) -.where('friends').slice(10) -.exec(callback) -``` - -###$where() - -Specifies a `$where` condition. - -Use `$where` when you need to select documents using a JavaScript expression. - -```js -query.$where('this.comments.length > 10 || this.name.length > 5').exec(callback) - -query.$where(function () { - return this.comments.length > 10 || this.name.length > 5; -}) -``` - -Only use `$where` when you have a condition that cannot be met using other MongoDB operators like `$lt`. Be sure to read about all of [its caveats](http://docs.mongodb.org/manual/reference/operator/where/) before using. - ------------ - -###batchSize() - -Specifies the batchSize option. - -```js -query.batchSize(100) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.batchSize/) - -###comment() - -Specifies the comment option. - -```js -query.comment('login query'); -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/) - -###hint() - -Sets query hints. - -```js -mquery().hint({ indexA: 1, indexB: -1 }) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/hint/) - -###limit() - -Specifies the limit option. - -```js -query.limit(20) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.limit/) - -###maxScan() - -Specifies the maxScan option. - -```js -query.maxScan(100) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/maxScan/) - -###maxTime() - -Specifies the maxTimeMS option. - -```js -query.maxTime(100) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.maxTimeMS/) - - -###skip() - -Specifies the skip option. - -```js -query.skip(100).limit(20) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.skip/) - -###sort() - -Sets the query sort order. - -If an object is passed, key values allowed are `asc`, `desc`, `ascending`, `descending`, `1`, and `-1`. - -If a string is passed, it must be a space delimited list of path names. The sort order of each path is ascending unless the path name is prefixed with `-` which will be treated as descending. - -```js -// these are equivalent -query.sort({ field: 'asc', test: -1 }); -query.sort('field -test'); -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.sort/) - -###read() - -Sets the readPreference option for the query. - -```js -mquery().read('primary') -mquery().read('p') // same as primary - -mquery().read('primaryPreferred') -mquery().read('pp') // same as primaryPreferred - -mquery().read('secondary') -mquery().read('s') // same as secondary - -mquery().read('secondaryPreferred') -mquery().read('sp') // same as secondaryPreferred - -mquery().read('nearest') -mquery().read('n') // same as nearest -``` - -#####Preferences: - -- `primary` - (default) Read from primary only. Operations will produce an error if primary is unavailable. Cannot be combined with tags. -- `secondary` - Read from secondary if available, otherwise error. -- `primaryPreferred` - Read from primary if available, otherwise a secondary. -- `secondaryPreferred` - Read from a secondary if available, otherwise read from the primary. -- `nearest` - All operations read from among the nearest candidates, but unlike other modes, this option will include both the primary and all secondaries in the random selection. - -Aliases - -- `p` primary -- `pp` primaryPreferred -- `s` secondary -- `sp` secondaryPreferred -- `n` nearest - -#####Preference Tags: - -To keep the separation of concerns between `mquery` and your driver -clean, `mquery#read()` no longer handles specifying a second `tags` argument as of version 0.5. -If you need to specify tags, pass any non-string argument as the first argument. -`mquery` will pass this argument untouched to your collections methods later. -For example: - -```js -// example of specifying tags using the Node.js driver -var ReadPref = require('mongodb').ReadPreference; -var preference = new ReadPref('secondary', [{ dc:'sf', s: 1 },{ dc:'ma', s: 2 }]); -mquery(..).read(preference).exec(); -``` - -Read more about how to use read preferences [here](http://docs.mongodb.org/manual/applications/replication/#read-preference) and [here](http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences). - -###slaveOk() - -Sets the slaveOk option. `true` allows reading from secondaries. - -**deprecated** use [read()](#read) preferences instead if on mongodb >= 2.2 - -```js -query.slaveOk() // true -query.slaveOk(true) -query.slaveOk(false) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/rs.slaveOk/) - -###snapshot() - -Specifies this query as a snapshot query. - -```js -mquery().snapshot() // true -mquery().snapshot(true) -mquery().snapshot(false) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/snapshot/) - -###tailable() - -Sets tailable option. - -```js -mquery().tailable() <== true -mquery().tailable(true) -mquery().tailable(false) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB Documentation](http://docs.mongodb.org/manual/tutorial/create-tailable-cursor/) - -##Helpers - -###collection() - -Sets the querys collection. - -```js -mquery().collection(aCollection) -``` - -###then() - -Executes the query and returns a promise which will be resolved with the query results or rejected if the query responds with an error. - -```js -mquery().find(..).then(success, error); -``` - -This is very useful when combined with [co](https://github.com/visionmedia/co) or [koa](https://github.com/koajs/koa), which automatically resolve promise-like objects for you. - -```js -co(function*(){ - var doc = yield mquery().findOne({ _id: 499 }); - console.log(doc); // { _id: 499, name: 'amazing', .. } -})(); -``` - -_NOTE_: -The returned promise is a [bluebird](https://github.com/petkaantonov/bluebird/) promise but this is customizable. If you want to -use your favorite promise library, simply set `mquery.Promise = YourPromiseConstructor`. -Your `Promise` must be [promises A+](http://promisesaplus.com/) compliant. - -###thunk() - -Returns a thunk which when called runs the query's `exec` method passing the results to the callback. - -```js -var thunk = mquery(collection).find({..}).thunk(); - -thunk(function(err, results) { - -}) -``` - -###merge(object) - -Merges other mquery or match condition objects into this one. When an muery instance is passed, its match conditions, field selection and options are merged. - -```js -var drum = mquery({ type: 'drum' }).collection(instruments); -var redDrum = mqery({ color: 'red' }).merge(drum); -redDrum.count(function (err, n) { - console.log('there are %d red drums', n); -}) -``` - -Internally uses `mquery.canMerge` to determine validity. - -###setOptions(options) - -Sets query options. - -```js -mquery().setOptions({ collection: coll, limit: 20 }) -``` - -#####options - -- [tailable](#tailable) * -- [sort](#sort) * -- [limit](#limit) * -- [skip](#skip) * -- [maxScan](#maxscan) * -- [maxTime](#maxtime) * -- [batchSize](#batchSize) * -- [comment](#comment) * -- [snapshot](#snapshot) * -- [hint](#hint) * -- [slaveOk](#slaveOk) * -- [safe](http://docs.mongodb.org/manual/reference/write-concern/): Boolean - passed through to the collection. Setting to `true` is equivalent to `{ w: 1 }` -- [collection](#collection): the collection to query against - -_* denotes a query helper method is also available_ - -###setTraceFunction(func) - -Set a function to trace this query. Useful for profiling or logging. - -```js -function traceFunction (method, queryInfo, query) { - console.log('starting ' + method + ' query'); - - return function (err, result, millis) { - console.log('finished ' + method + ' query in ' + millis + 'ms'); - }; -} - -mquery().setTraceFunction(traceFunction).findOne({name: 'Joe'}, cb); -``` - -The trace function is passed (method, queryInfo, query) - -- method is the name of the method being called (e.g. findOne) -- queryInfo contains information about the query: - - conditions: query conditions/criteria - - options: options such as sort, fields, etc - - doc: document being updated -- query is the query object - -The trace function should return a callback function which accepts: -- err: error, if any -- result: result, if any -- millis: time spent waiting for query result - -NOTE: stream requests are not traced. - -###mquery.setGlobalTraceFunction(func) - -Similar to `setTraceFunction()` but automatically applied to all queries. - -```js -mquery.setTraceFunction(traceFunction); -``` - -###mquery.canMerge(conditions) - -Determines if `conditions` can be merged using `mquery().merge()`. - -```js -var query = mquery({ type: 'drum' }); -var okToMerge = mquery.canMerge(anObject) -if (okToMerge) { - query.merge(anObject); -} -``` - -##mquery.use$geoWithin - -MongoDB 2.4 introduced the `$geoWithin` operator which replaces and is 100% backward compatible with `$within`. As of mquery 0.2, we default to using `$geoWithin` for all `within()` calls. - -If you are running MongoDB < 2.4 this will be problematic. To force `mquery` to be backward compatible and always use `$within`, set the `mquery.use$geoWithin` flag to `false`. - -```js -mquery.use$geoWithin = false; -``` - -##Custom Base Queries - -Often times we want custom base queries that encapsulate predefined criteria. With `mquery` this is easy. First create the query you want to reuse and call its `toConstructor()` method which returns a new subclass of `mquery` that retains all options and criteria of the original. - -```js -var greatMovies = mquery(movieCollection).where('rating').gte(4.5).toConstructor(); - -// use it! -greatMovies().count(function (err, n) { - console.log('There are %d great movies', n); -}); - -greatMovies().where({ name: /^Life/ }).select('name').find(function (err, docs) { - console.log(docs); -}); -``` - -##Validation - -Method and options combinations are checked for validity at runtime to prevent creation of invalid query constructs. For example, a `distinct` query does not support specifying options like `hint` or field selection. In this case an error will be thrown so you can catch these mistakes in development. - -##Debug support - -Debug mode is provided through the use of the [debug](https://github.com/visionmedia/debug) module. To enable: - - DEBUG=mquery node yourprogram.js - -Read the debug module documentation for more details. - -## General compatibility - -#### ObjectIds - -`mquery` clones query arguments before passing them to a `collection` method for execution. -This prevents accidental side-affects to the objects you pass. -To clone `ObjectIds` we need to make some assumptions. - -First, to check if an object is an `ObjectId`, we check its constructors name. If it matches either -`ObjectId` or `ObjectID` we clone it. - -To clone `ObjectIds`, we call its optional `clone` method. If a `clone` method does not exist, we fall -back to calling `new obj.constructor(obj.id)`. We assume, for compatibility with the -Node.js driver, that the `ObjectId` instance has a public `id` property and that -when creating an `ObjectId` instance we can pass that `id` as an argument. - -#### Read Preferences - -`mquery` supports specifying [Read Preferences]() to control from which MongoDB node your query will read. -The Read Preferences spec also support specifying tags. To pass tags, some -drivers (Node.js driver) require passing a special constructor that handles both the read preference and its tags. -If you need to specify tags, pass an instance of your drivers ReadPreference constructor or roll your own. `mquery` will store whatever you provide and pass later to your collection during execution. - -##Future goals - - - mongo shell compatibility - - browser compatibility - -## Installation - - $ npm install mquery - -## License - -[MIT](https://github.com/aheckmann/mquery/blob/master/LICENSE) - diff --git a/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js b/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js deleted file mode 100644 index bce3c38b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -/** - * methods a collection must implement - */ - -var methods = [ - 'find' - , 'findOne' - , 'update' - , 'remove' - , 'count' - , 'distinct' - , 'findAndModify' - , 'aggregate' - , 'findStream' -]; - -/** - * Collection base class from which implementations inherit - */ - -function Collection () {} - -for (var i = 0, len = methods.length; i < len; ++i) { - var method = methods[i]; - Collection.prototype[method] = notImplemented(method); -} - -module.exports = exports = Collection; -Collection.methods = methods; - -/** - * creates a function which throws an implementation error - */ - -function notImplemented (method) { - return function () { - throw new Error('collection.' + method + ' not implemented'); - } -} - diff --git a/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/index.js b/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/index.js deleted file mode 100644 index e3cf44d4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var env = require('../env') - -if ('unknown' == env.type) { - throw new Error('Unknown environment') -} - -module.exports = - env.isNode ? require('./node') : - env.isMongo ? require('./collection') : - require('./collection'); - diff --git a/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/node.js b/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/node.js deleted file mode 100644 index f2544566..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/lib/collection/node.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -/** - * Module dependencies - */ - -var Collection = require('./collection'); -var utils = require('../utils'); - -function NodeCollection (col) { - this.collection = col; - this.collectionName = col.collectionName; -} - -/** - * inherit from collection base class - */ - -utils.inherits(NodeCollection, Collection); - -/** - * find(match, options, function(err, docs)) - */ - -NodeCollection.prototype.find = function (match, options, cb) { - this.collection.find(match, options, function (err, cursor) { - if (err) return cb(err); - - cursor.toArray(cb); - }); -} - -/** - * findOne(match, options, function(err, doc)) - */ - -NodeCollection.prototype.findOne = function (match, options, cb) { - this.collection.findOne(match, options, cb); -} - -/** - * count(match, options, function(err, count)) - */ - -NodeCollection.prototype.count = function (match, options, cb) { - this.collection.count(match, options, cb); -} - -/** - * distinct(prop, match, options, function(err, count)) - */ - -NodeCollection.prototype.distinct = function (prop, match, options, cb) { - this.collection.distinct(prop, match, options, cb); -} - -/** - * update(match, update, options, function(err[, result])) - */ - -NodeCollection.prototype.update = function (match, update, options, cb) { - this.collection.update(match, update, options, cb); -} - -/** - * remove(match, options, function(err[, result]) - */ - -NodeCollection.prototype.remove = function (match, options, cb) { - this.collection.remove(match, options, cb); -} - -/** - * findAndModify(match, update, options, function(err, doc)) - */ - -NodeCollection.prototype.findAndModify = function (match, update, options, cb) { - var sort = Array.isArray(options.sort) ? options.sort : []; - this.collection.findAndModify(match, sort, update, options, cb); -} - -/** - * var stream = findStream(match, findOptions, streamOptions) - */ - -NodeCollection.prototype.findStream = function(match, findOptions, streamOptions) { - return this.collection.find(match, findOptions).stream(streamOptions); -} - -/** - * aggregation(operators..., function(err, doc)) - * TODO - */ - -/** - * Expose - */ - -module.exports = exports = NodeCollection; - diff --git a/Associations/node_modules/mongoose/node_modules/mquery/lib/env.js b/Associations/node_modules/mongoose/node_modules/mquery/lib/env.js deleted file mode 100644 index 3313b462..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/lib/env.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -exports.isNode = 'undefined' != typeof process - && 'object' == typeof module - && 'object' == typeof global - && 'function' == typeof Buffer - && process.argv - -exports.isMongo = !exports.isNode - && 'function' == typeof printjson - && 'function' == typeof ObjectId - && 'function' == typeof rs - && 'function' == typeof sh; - -exports.isBrowser = !exports.isNode - && !exports.isMongo - && 'undefined' != typeof window; - -exports.type = exports.isNode ? 'node' - : exports.isMongo ? 'mongo' - : exports.isBrowser ? 'browser' - : 'unknown' diff --git a/Associations/node_modules/mongoose/node_modules/mquery/lib/mquery.js b/Associations/node_modules/mongoose/node_modules/mquery/lib/mquery.js deleted file mode 100644 index ca078676..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/lib/mquery.js +++ /dev/null @@ -1,2612 +0,0 @@ -'use strict'; - -/** - * Dependencies - */ - -var slice = require('sliced') -var assert = require('assert') -var util = require('util') -var utils = require('./utils') -var debug = require('debug')('mquery'); - -/** - * Query constructor used for building queries. - * - * ####Example: - * - * var query = new Query({ name: 'mquery' }); - * query.setOptions({ collection: moduleCollection }) - * query.where('age').gte(21).exec(callback); - * - * @param {Object} [criteria] - * @param {Object} [options] - * @api public - */ - -function Query (criteria, options) { - if (!(this instanceof Query)) - return new Query(criteria, options); - - var proto = this.constructor.prototype; - - this.op = proto.op || undefined; - - this.options = {}; - this.setOptions(proto.options); - - this._conditions = proto._conditions - ? utils.clone(proto._conditions) - : {}; - - this._fields = proto._fields - ? utils.clone(proto._fields) - : undefined; - - this._update = proto._update - ? utils.clone(proto._update) - : undefined; - - this._path = proto._path || undefined; - this._distinct = proto._distinct || undefined; - this._collection = proto._collection || undefined; - this._traceFunction = proto._traceFunction || undefined; - - if (options) { - this.setOptions(options); - } - - if (criteria) { - if (criteria.find && criteria.remove && criteria.update) { - // quack quack! - this.collection(criteria); - } else { - this.find(criteria); - } - } -} - -/** - * This is a parameter that the user can set which determines if mquery - * uses $within or $geoWithin for queries. It defaults to true which - * means $geoWithin will be used. If using MongoDB < 2.4 you should - * set this to false. - * - * @api public - * @property use$geoWithin - */ - -var $withinCmd = '$geoWithin'; -Object.defineProperty(Query, 'use$geoWithin', { - get: function ( ) { return $withinCmd == '$geoWithin' } - , set: function (v) { - if (true === v) { - // mongodb >= 2.4 - $withinCmd = '$geoWithin'; - } else { - $withinCmd = '$within'; - } - } -}); - -/** - * Converts this query to a constructor function with all arguments and options retained. - * - * ####Example - * - * // Create a query that will read documents with a "video" category from - * // `aCollection` on the primary node in the replica-set unless it is down, - * // in which case we'll read from a secondary node. - * var query = mquery({ category: 'video' }) - * query.setOptions({ collection: aCollection, read: 'primaryPreferred' }); - * - * // create a constructor based off these settings - * var Video = query.toConstructor(); - * - * // Video is now a subclass of mquery() and works the same way but with the - * // default query parameters and options set. - * - * // run a query with the previous settings but filter for movies with names - * // that start with "Life". - * Video().where({ name: /^Life/ }).exec(cb); - * - * @return {Query} new Query - * @api public - */ - -Query.prototype.toConstructor = function toConstructor () { - function CustomQuery (criteria, options) { - if (!(this instanceof CustomQuery)) - return new CustomQuery(criteria, options); - Query.call(this, criteria, options); - } - - utils.inherits(CustomQuery, Query); - - // set inherited defaults - var p = CustomQuery.prototype; - - p.options = {}; - p.setOptions(this.options); - - p.op = this.op; - p._conditions = utils.clone(this._conditions); - p._fields = utils.clone(this._fields); - p._update = utils.clone(this._update); - p._path = this._path; - p._distinct = this._distinct; - p._collection = this._collection; - p._traceFunction = this._traceFunction; - - return CustomQuery; -} - -/** - * Sets query options. - * - * ####Options: - * - * - [tailable](http://www.mongodb.org/display/DOCS/Tailable+Cursors) * - * - [sort](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsort(\)%7D%7D) * - * - [limit](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Blimit%28%29%7D%7D) * - * - [skip](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bskip%28%29%7D%7D) * - * - [maxScan](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24maxScan) * - * - [maxTime](http://docs.mongodb.org/manual/reference/operator/meta/maxTimeMS/#op._S_maxTimeMS) * - * - [batchSize](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7BbatchSize%28%29%7D%7D) * - * - [comment](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24comment) * - * - [snapshot](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsnapshot%28%29%7D%7D) * - * - [hint](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24hint) * - * - [slaveOk](http://docs.mongodb.org/manual/applications/replication/#read-preference) * - * - [safe](http://www.mongodb.org/display/DOCS/getLastError+Command) - * - collection the collection to query against - * - * _* denotes a query helper method is also available_ - * - * @param {Object} options - * @api public - */ - -Query.prototype.setOptions = function (options) { - if (!(options && utils.isObject(options))) - return this; - - // set arbitrary options - var methods = utils.keys(options) - , method - - for (var i = 0; i < methods.length; ++i) { - method = methods[i]; - - // use methods if exist (safer option manipulation) - if ('function' == typeof this[method]) { - var args = utils.isArray(options[method]) - ? options[method] - : [options[method]]; - this[method].apply(this, args) - } else { - this.options[method] = options[method]; - } - } - - return this; -} - -/** - * Sets this Querys collection. - * - * @param {Collection} coll - * @return {Query} this - */ - -Query.prototype.collection = function collection (coll) { - this._collection = new Query.Collection(coll); - - return this; -} - -/** - * Specifies a `$where` condition - * - * Use `$where` when you need to select documents using a JavaScript expression. - * - * ####Example - * - * query.$where('this.comments.length > 10 || this.name.length > 5') - * - * query.$where(function () { - * return this.comments.length > 10 || this.name.length > 5; - * }) - * - * @param {String|Function} js javascript string or function - * @return {Query} this - * @memberOf Query - * @method $where - * @api public - */ - -Query.prototype.$where = function (js) { - this._conditions.$where = js; - return this; -} - -/** - * Specifies a `path` for use with chaining. - * - * ####Example - * - * // instead of writing: - * User.find({age: {$gte: 21, $lte: 65}}, callback); - * - * // we can instead write: - * User.where('age').gte(21).lte(65); - * - * // passing query conditions is permitted - * User.find().where({ name: 'vonderful' }) - * - * // chaining - * User - * .where('age').gte(21).lte(65) - * .where('name', /^vonderful/i) - * .where('friends').slice(10) - * .exec(callback) - * - * @param {String} [path] - * @param {Object} [val] - * @return {Query} this - * @api public - */ - -Query.prototype.where = function () { - if (!arguments.length) return this; - if (!this.op) this.op = 'find'; - - var type = typeof arguments[0]; - - if ('string' == type) { - this._path = arguments[0]; - - if (2 === arguments.length) { - this._conditions[this._path] = arguments[1]; - } - - return this; - } - - if ('object' == type && !Array.isArray(arguments[0])) { - return this.merge(arguments[0]); - } - - throw new TypeError('path must be a string or object'); -} - -/** - * Specifies the complementary comparison value for paths specified with `where()` - * - * ####Example - * - * User.where('age').equals(49); - * - * // is the same as - * - * User.where('age', 49); - * - * @param {Object} val - * @return {Query} this - * @api public - */ - -Query.prototype.equals = function equals (val) { - this._ensurePath('equals'); - var path = this._path; - this._conditions[path] = val; - return this; -} - -/** - * Specifies arguments for an `$or` condition. - * - * ####Example - * - * query.or([{ color: 'red' }, { status: 'emergency' }]) - * - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -Query.prototype.or = function or (array) { - var or = this._conditions.$or || (this._conditions.$or = []); - if (!utils.isArray(array)) array = [array]; - or.push.apply(or, array); - return this; -} - -/** - * Specifies arguments for a `$nor` condition. - * - * ####Example - * - * query.nor([{ color: 'green' }, { status: 'ok' }]) - * - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -Query.prototype.nor = function nor (array) { - var nor = this._conditions.$nor || (this._conditions.$nor = []); - if (!utils.isArray(array)) array = [array]; - nor.push.apply(nor, array); - return this; -} - -/** - * Specifies arguments for a `$and` condition. - * - * ####Example - * - * query.and([{ color: 'green' }, { status: 'ok' }]) - * - * @see $and http://docs.mongodb.org/manual/reference/operator/and/ - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -Query.prototype.and = function and (array) { - var and = this._conditions.$and || (this._conditions.$and = []); - if (!Array.isArray(array)) array = [array]; - and.push.apply(and, array); - return this; -} - -/** - * Specifies a $gt query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * ####Example - * - * Thing.find().where('age').gt(21) - * - * // or - * Thing.find().gt('age', 21) - * - * @method gt - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $gte query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method gte - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $lt query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method lt - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $lte query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method lte - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $ne query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method ne - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $in query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method in - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $nin query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method nin - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $all query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method all - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $size query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method size - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $regex query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method regex - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $maxDistance query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method maxDistance - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/*! - * gt, gte, lt, lte, ne, in, nin, all, regex, size, maxDistance - * - * Thing.where('type').nin(array) - */ - -'gt gte lt lte ne in nin all regex size maxDistance'.split(' ').forEach(function ($conditional) { - Query.prototype[$conditional] = function () { - var path, val; - - if (1 === arguments.length) { - this._ensurePath($conditional); - val = arguments[0]; - path = this._path; - } else { - val = arguments[1]; - path = arguments[0]; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds['$' + $conditional] = val; - return this; - }; -}) - -/** - * Specifies a `$mod` condition - * - * @param {String} [path] - * @param {Number} val - * @return {Query} this - * @api public - */ - -Query.prototype.mod = function () { - var val, path; - - if (1 === arguments.length) { - this._ensurePath('mod') - val = arguments[0]; - path = this._path; - } else if (2 === arguments.length && !utils.isArray(arguments[1])) { - this._ensurePath('mod') - val = slice(arguments); - path = this._path; - } else if (3 === arguments.length) { - val = slice(arguments, 1); - path = arguments[0]; - } else { - val = arguments[1]; - path = arguments[0]; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds.$mod = val; - return this; -} - -/** - * Specifies an `$exists` condition - * - * ####Example - * - * // { name: { $exists: true }} - * Thing.where('name').exists() - * Thing.where('name').exists(true) - * Thing.find().exists('name') - * - * // { name: { $exists: false }} - * Thing.where('name').exists(false); - * Thing.find().exists('name', false); - * - * @param {String} [path] - * @param {Number} val - * @return {Query} this - * @api public - */ - -Query.prototype.exists = function () { - var path, val; - - if (0 === arguments.length) { - this._ensurePath('exists'); - path = this._path; - val = true; - } else if (1 === arguments.length) { - if ('boolean' === typeof arguments[0]) { - this._ensurePath('exists'); - path = this._path; - val = arguments[0]; - } else { - path = arguments[0]; - val = true; - } - } else if (2 === arguments.length) { - path = arguments[0]; - val = arguments[1]; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds.$exists = val; - return this; -} - -/** - * Specifies an `$elemMatch` condition - * - * ####Example - * - * query.elemMatch('comment', { author: 'autobot', votes: {$gte: 5}}) - * - * query.where('comment').elemMatch({ author: 'autobot', votes: {$gte: 5}}) - * - * query.elemMatch('comment', function (elem) { - * elem.where('author').equals('autobot'); - * elem.where('votes').gte(5); - * }) - * - * query.where('comment').elemMatch(function (elem) { - * elem.where({ author: 'autobot' }); - * elem.where('votes').gte(5); - * }) - * - * @param {String|Object|Function} path - * @param {Object|Function} criteria - * @return {Query} this - * @api public - */ - -Query.prototype.elemMatch = function () { - if (null == arguments[0]) - throw new TypeError("Invalid argument"); - - var fn, path, criteria; - - if ('function' === typeof arguments[0]) { - this._ensurePath('elemMatch'); - path = this._path; - fn = arguments[0]; - } else if (utils.isObject(arguments[0])) { - this._ensurePath('elemMatch'); - path = this._path; - criteria = arguments[0]; - } else if ('function' === typeof arguments[1]) { - path = arguments[0]; - fn = arguments[1]; - } else if (arguments[1] && utils.isObject(arguments[1])) { - path = arguments[0]; - criteria = arguments[1]; - } else { - throw new TypeError("Invalid argument"); - } - - if (fn) { - criteria = new Query; - fn(criteria); - criteria = criteria._conditions; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds.$elemMatch = criteria; - return this; -} - -// Spatial queries - -/** - * Sugar for geo-spatial queries. - * - * ####Example - * - * query.within().box() - * query.within().circle() - * query.within().geometry() - * - * query.where('loc').within({ center: [50,50], radius: 10, unique: true, spherical: true }); - * query.where('loc').within({ box: [[40.73, -73.9], [40.7, -73.988]] }); - * query.where('loc').within({ polygon: [[],[],[],[]] }); - * - * query.where('loc').within([], [], []) // polygon - * query.where('loc').within([], []) // box - * query.where('loc').within({ type: 'LineString', coordinates: [...] }); // geometry - * - * ####NOTE: - * - * Must be used after `where()`. - * - * @memberOf Query - * @return {Query} this - * @api public - */ - -Query.prototype.within = function within () { - // opinionated, must be used after where - this._ensurePath('within'); - this._geoComparison = $withinCmd; - - if (0 === arguments.length) { - return this; - } - - if (2 === arguments.length) { - return this.box.apply(this, arguments); - } else if (2 < arguments.length) { - return this.polygon.apply(this, arguments); - } - - var area = arguments[0]; - - if (!area) - throw new TypeError('Invalid argument'); - - if (area.center) - return this.circle(area); - - if (area.box) - return this.box.apply(this, area.box); - - if (area.polygon) - return this.polygon.apply(this, area.polygon); - - if (area.type && area.coordinates) - return this.geometry(area); - - throw new TypeError('Invalid argument'); -} - -/** - * Specifies a $box condition - * - * ####Example - * - * var lowerLeft = [40.73083, -73.99756] - * var upperRight= [40.741404, -73.988135] - * - * query.where('loc').within().box(lowerLeft, upperRight) - * query.box('loc', lowerLeft, upperRight ) - * - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @see Query#within #query_Query-within - * @param {String} path - * @param {Object} val - * @return {Query} this - * @api public - */ - -Query.prototype.box = function () { - var path, box; - - if (3 === arguments.length) { - // box('loc', [], []) - path = arguments[0]; - box = [arguments[1], arguments[2]]; - } else if (2 === arguments.length) { - // box([], []) - this._ensurePath('box'); - path = this._path; - box = [arguments[0], arguments[1]]; - } else { - throw new TypeError("Invalid argument"); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds[this._geoComparison || $withinCmd] = { '$box': box }; - return this; -} - -/** - * Specifies a $polygon condition - * - * ####Example - * - * query.where('loc').within().polygon([10,20], [13, 25], [7,15]) - * query.polygon('loc', [10,20], [13, 25], [7,15]) - * - * @param {String|Array} [path] - * @param {Array|Object} [val] - * @return {Query} this - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -Query.prototype.polygon = function () { - var val, path; - - if ('string' == typeof arguments[0]) { - // polygon('loc', [],[],[]) - path = arguments[0]; - val = slice(arguments, 1); - } else { - // polygon([],[],[]) - this._ensurePath('polygon'); - path = this._path; - val = slice(arguments); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds[this._geoComparison || $withinCmd] = { '$polygon': val }; - return this; -} - -/** - * Specifies a $center or $centerSphere condition. - * - * ####Example - * - * var area = { center: [50, 50], radius: 10, unique: true } - * query.where('loc').within().circle(area) - * query.center('loc', area); - * - * // for spherical calculations - * var area = { center: [50, 50], radius: 10, unique: true, spherical: true } - * query.where('loc').within().circle(area) - * query.center('loc', area); - * - * @param {String} [path] - * @param {Object} area - * @return {Query} this - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -Query.prototype.circle = function () { - var path, val; - - if (1 === arguments.length) { - this._ensurePath('circle'); - path = this._path; - val = arguments[0]; - } else if (2 === arguments.length) { - path = arguments[0]; - val = arguments[1]; - } else { - throw new TypeError("Invalid argument"); - } - - if (!('radius' in val && val.center)) - throw new Error('center and radius are required'); - - var conds = this._conditions[path] || (this._conditions[path] = {}); - - var type = val.spherical - ? '$centerSphere' - : '$center'; - - var wKey = this._geoComparison || $withinCmd; - conds[wKey] = {}; - conds[wKey][type] = [val.center, val.radius]; - - if ('unique' in val) - conds[wKey].$uniqueDocs = !! val.unique; - - return this; -} - -/** - * Specifies a `$near` or `$nearSphere` condition - * - * These operators return documents sorted by distance. - * - * ####Example - * - * query.where('loc').near({ center: [10, 10] }); - * query.where('loc').near({ center: [10, 10], maxDistance: 5 }); - * query.where('loc').near({ center: [10, 10], maxDistance: 5, spherical: true }); - * query.near('loc', { center: [10, 10], maxDistance: 5 }); - * query.near({ center: { type: 'Point', coordinates: [..] }}) - * query.near().geometry({ type: 'Point', coordinates: [..] }) - * - * @param {String} [path] - * @param {Object} val - * @return {Query} this - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -Query.prototype.near = function near () { - var path, val; - - this._geoComparison = '$near'; - - if (0 === arguments.length) { - return this; - } else if (1 === arguments.length) { - this._ensurePath('near'); - path = this._path; - val = arguments[0]; - } else if (2 === arguments.length) { - path = arguments[0]; - val = arguments[1]; - } else { - throw new TypeError("Invalid argument"); - } - - if (!val.center) { - throw new Error('center is required'); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - - var type = val.spherical - ? '$nearSphere' - : '$near'; - - // center could be a GeoJSON object or an Array - if (Array.isArray(val.center)) { - conds[type] = val.center; - - var radius = 'maxDistance' in val - ? val.maxDistance - : null; - - if (null != radius) { - conds.$maxDistance = radius; - } - } else { - // GeoJSON? - if (val.center.type != 'Point' || !Array.isArray(val.center.coordinates)) { - throw new Error(util.format("Invalid GeoJSON specified for %s", type)); - } - conds[type] = { $geometry : val.center }; - - // MongoDB 2.6 insists on maxDistance being in $near / $nearSphere - if ('maxDistance' in val) { - conds[type]['$maxDistance'] = val.maxDistance; - } - } - - return this; -} - -/** - * Declares an intersects query for `geometry()`. - * - * ####Example - * - * query.where('path').intersects().geometry({ - * type: 'LineString' - * , coordinates: [[180.0, 11.0], [180, 9.0]] - * }) - * - * query.where('path').intersects({ - * type: 'LineString' - * , coordinates: [[180.0, 11.0], [180, 9.0]] - * }) - * - * @param {Object} [arg] - * @return {Query} this - * @api public - */ - -Query.prototype.intersects = function intersects () { - // opinionated, must be used after where - this._ensurePath('intersects'); - - this._geoComparison = '$geoIntersects'; - - if (0 === arguments.length) { - return this; - } - - var area = arguments[0]; - - if (null != area && area.type && area.coordinates) - return this.geometry(area); - - throw new TypeError('Invalid argument'); -} - -/** - * Specifies a `$geometry` condition - * - * ####Example - * - * var polyA = [[[ 10, 20 ], [ 10, 40 ], [ 30, 40 ], [ 30, 20 ]]] - * query.where('loc').within().geometry({ type: 'Polygon', coordinates: polyA }) - * - * // or - * var polyB = [[ 0, 0 ], [ 1, 1 ]] - * query.where('loc').within().geometry({ type: 'LineString', coordinates: polyB }) - * - * // or - * var polyC = [ 0, 0 ] - * query.where('loc').within().geometry({ type: 'Point', coordinates: polyC }) - * - * // or - * query.where('loc').intersects().geometry({ type: 'Point', coordinates: polyC }) - * - * ####NOTE: - * - * `geometry()` **must** come after either `intersects()` or `within()`. - * - * The `object` argument must contain `type` and `coordinates` properties. - * - type {String} - * - coordinates {Array} - * - * The most recent path passed to `where()` is used. - * - * @param {Object} object Must contain a `type` property which is a String and a `coordinates` property which is an Array. See the examples. - * @return {Query} this - * @see http://docs.mongodb.org/manual/release-notes/2.4/#new-geospatial-indexes-with-geojson-and-improved-spherical-geometry - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @see $geometry http://docs.mongodb.org/manual/reference/operator/geometry/ - * @api public - */ - -Query.prototype.geometry = function geometry () { - if (!('$within' == this._geoComparison || - '$geoWithin' == this._geoComparison || - '$near' == this._geoComparison || - '$geoIntersects' == this._geoComparison)) { - throw new Error('geometry() must come after `within()`, `intersects()`, or `near()'); - } - - var val, path; - - if (1 === arguments.length) { - this._ensurePath('geometry'); - path = this._path; - val = arguments[0]; - } else { - throw new TypeError("Invalid argument"); - } - - if (!(val.type && Array.isArray(val.coordinates))) { - throw new TypeError('Invalid argument'); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds[this._geoComparison] = { $geometry: val }; - - return this; -} - -// end spatial - -/** - * Specifies which document fields to include or exclude - * - * ####String syntax - * - * When passing a string, prefixing a path with `-` will flag that path as excluded. When a path does not have the `-` prefix, it is included. - * - * ####Example - * - * // include a and b, exclude c - * query.select('a b -c'); - * - * // or you may use object notation, useful when - * // you have keys already prefixed with a "-" - * query.select({a: 1, b: 1, c: 0}); - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Object|String} arg - * @return {Query} this - * @see SchemaType - * @api public - */ - -Query.prototype.select = function select () { - var arg = arguments[0]; - if (!arg) return this; - - if (arguments.length !== 1) { - throw new Error("Invalid select: select only takes 1 argument"); - } - - this._validate('select'); - - var fields = this._fields || (this._fields = {}); - var type = typeof arg; - - if ('string' == type || 'object' == type && 'number' == typeof arg.length && !Array.isArray(arg)) { - if ('string' == type) - arg = arg.split(/\s+/); - - for (var i = 0, len = arg.length; i < len; ++i) { - var field = arg[i]; - if (!field) continue; - var include = '-' == field[0] ? 0 : 1; - if (include === 0) field = field.substring(1); - fields[field] = include; - } - - return this; - } - - if (utils.isObject(arg) && !Array.isArray(arg)) { - var keys = utils.keys(arg); - for (var i = 0; i < keys.length; ++i) { - fields[keys[i]] = arg[keys[i]]; - } - return this; - } - - throw new TypeError('Invalid select() argument. Must be string or object.'); -} - -/** - * Specifies a $slice condition for a `path` - * - * ####Example - * - * query.slice('comments', 5) - * query.slice('comments', -5) - * query.slice('comments', [10, 5]) - * query.where('comments').slice(5) - * query.where('comments').slice([-10, 5]) - * - * @param {String} [path] - * @param {Number} val number/range of elements to slice - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields#RetrievingaSubsetofFields-RetrievingaSubrangeofArrayElements - * @api public - */ - -Query.prototype.slice = function () { - if (0 === arguments.length) - return this; - - this._validate('slice'); - - var path, val; - - if (1 === arguments.length) { - var arg = arguments[0]; - if (typeof arg === 'object' && !Array.isArray(arg)) { - var keys = Object.keys(arg); - var numKeys = keys.length; - for (var i = 0; i < numKeys; ++i) { - this.slice(keys[i], arg[keys[i]]); - } - return this; - } - this._ensurePath('slice'); - path = this._path; - val = arguments[0]; - } else if (2 === arguments.length) { - if ('number' === typeof arguments[0]) { - this._ensurePath('slice'); - path = this._path; - val = slice(arguments); - } else { - path = arguments[0]; - val = arguments[1]; - } - } else if (3 === arguments.length) { - path = arguments[0]; - val = slice(arguments, 1); - } - - var myFields = this._fields || (this._fields = {}); - myFields[path] = { '$slice': val }; - return this; -} - -/** - * Sets the sort order - * - * If an object is passed, values allowed are 'asc', 'desc', 'ascending', 'descending', 1, and -1. - * - * If a string is passed, it must be a space delimited list of path names. The sort order of each path is ascending unless the path name is prefixed with `-` which will be treated as descending. - * - * ####Example - * - * // these are equivalent - * query.sort({ field: 'asc', test: -1 }); - * query.sort('field -test'); - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Object|String} arg - * @return {Query} this - * @api public - */ - -Query.prototype.sort = function (arg) { - if (!arg) return this; - - this._validate('sort'); - - var type = typeof arg; - - if (1 === arguments.length && 'string' == type) { - arg = arg.split(/\s+/); - - for (var i = 0, len = arg.length; i < len; ++i) { - var field = arg[i]; - if (!field) continue; - var ascend = '-' == field[0] ? -1 : 1; - if (ascend === -1) field = field.substring(1); - push(this.options, field, ascend); - } - - return this; - } - - if (utils.isObject(arg)) { - var keys = utils.keys(arg); - for (var i = 0; i < keys.length; ++i) { - var field = keys[i]; - push(this.options, field, arg[field]); - } - - return this; - } - - throw new TypeError('Invalid sort() argument. Must be a string or object.'); -} - -/*! - * @ignore - */ - -function push (opts, field, value) { - if (value && value.$meta) { - var s = opts.sort || (opts.sort = {}); - s[field] = { $meta : value.$meta }; - return; - } - - var val = String(value || 1).toLowerCase(); - if (!/^(?:ascending|asc|descending|desc|1|-1)$/.test(val)) { - if (utils.isArray(value)) value = '['+value+']'; - throw new TypeError('Invalid sort value: {' + field + ': ' + value + ' }'); - } - // store `sort` in a sane format - var s = opts.sort || (opts.sort = {}); - var valueStr = value.toString() - .replace("asc", "1") - .replace("ascending", "1") - .replace("desc", "-1") - .replace("descending", "-1"); - s[field] = parseInt(valueStr, 10); -} - -/** - * Specifies the limit option. - * - * ####Example - * - * query.limit(20) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method limit - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Blimit%28%29%7D%7D - * @api public - */ -/** - * Specifies the skip option. - * - * ####Example - * - * query.skip(100).limit(20) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method skip - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bskip%28%29%7D%7D - * @api public - */ -/** - * Specifies the maxScan option. - * - * ####Example - * - * query.maxScan(100) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method maxScan - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24maxScan - * @api public - */ -/** - * Specifies the batchSize option. - * - * ####Example - * - * query.batchSize(100) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method batchSize - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7BbatchSize%28%29%7D%7D - * @api public - */ -/** - * Specifies the `comment` option. - * - * ####Example - * - * query.comment('login query') - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method comment - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24comment - * @api public - */ - -/*! - * limit, skip, maxScan, batchSize, comment - * - * Sets these associated options. - * - * query.comment('feed query'); - */ - -;['limit', 'skip', 'maxScan', 'batchSize', 'comment'].forEach(function (method) { - Query.prototype[method] = function (v) { - this._validate(method); - this.options[method] = v; - return this; - }; -}) - -/** - * Specifies the maxTimeMS option. - * - * ####Example - * - * query.maxTime(100) - * - * @method maxTime - * @memberOf Query - * @param {Number} val - * @see mongodb http://docs.mongodb.org/manual/reference/operator/meta/maxTimeMS/#op._S_maxTimeMS - * @api public - */ - -Query.prototype.maxTime = function (v) { - this._validate('maxTime'); - this.options.maxTimeMS = v; - return this; -}; - -/** - * Specifies this query as a `snapshot` query. - * - * ####Example - * - * mquery().snapshot() // true - * mquery().snapshot(true) - * mquery().snapshot(false) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsnapshot%28%29%7D%7D - * @return {Query} this - * @api public - */ - -Query.prototype.snapshot = function () { - this._validate('snapshot'); - - this.options.snapshot = arguments.length - ? !! arguments[0] - : true - - return this; -} - -/** - * Sets query hints. - * - * ####Example - * - * query.hint({ indexA: 1, indexB: -1}) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Object} val a hint object - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24hint - * @api public - */ - -Query.prototype.hint = function () { - if (0 === arguments.length) return this; - - this._validate('hint'); - - var arg = arguments[0]; - if (utils.isObject(arg)) { - var hint = this.options.hint || (this.options.hint = {}); - - // must keep object keys in order so don't use Object.keys() - for (var k in arg) { - hint[k] = arg[k]; - } - - return this; - } - - throw new TypeError('Invalid hint. ' + arg); -} - -/** - * Sets the slaveOk option. _Deprecated_ in MongoDB 2.2 in favor of read preferences. - * - * ####Example: - * - * query.slaveOk() // true - * query.slaveOk(true) - * query.slaveOk(false) - * - * @deprecated use read() preferences instead if on mongodb >= 2.2 - * @param {Boolean} v defaults to true - * @see mongodb http://docs.mongodb.org/manual/applications/replication/#read-preference - * @see read() - * @return {Query} this - * @api public - */ - -Query.prototype.slaveOk = function (v) { - this.options.slaveOk = arguments.length ? !!v : true; - return this; -} - -/** - * Sets the readPreference option for the query. - * - * ####Example: - * - * new Query().read('primary') - * new Query().read('p') // same as primary - * - * new Query().read('primaryPreferred') - * new Query().read('pp') // same as primaryPreferred - * - * new Query().read('secondary') - * new Query().read('s') // same as secondary - * - * new Query().read('secondaryPreferred') - * new Query().read('sp') // same as secondaryPreferred - * - * new Query().read('nearest') - * new Query().read('n') // same as nearest - * - * // you can also use mongodb.ReadPreference class to also specify tags - * new Query().read(mongodb.ReadPreference('secondary', [{ dc:'sf', s: 1 },{ dc:'ma', s: 2 }])) - * - * ####Preferences: - * - * primary - (default) Read from primary only. Operations will produce an error if primary is unavailable. Cannot be combined with tags. - * secondary Read from secondary if available, otherwise error. - * primaryPreferred Read from primary if available, otherwise a secondary. - * secondaryPreferred Read from a secondary if available, otherwise read from the primary. - * nearest All operations read from among the nearest candidates, but unlike other modes, this option will include both the primary and all secondaries in the random selection. - * - * Aliases - * - * p primary - * pp primaryPreferred - * s secondary - * sp secondaryPreferred - * n nearest - * - * Read more about how to use read preferences [here](http://docs.mongodb.org/manual/applications/replication/#read-preference) and [here](http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences). - * - * @param {String|ReadPreference} pref one of the listed preference options or their aliases - * @see mongodb http://docs.mongodb.org/manual/applications/replication/#read-preference - * @see driver http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences - * @return {Query} this - * @api public - */ - -Query.prototype.read = function (pref) { - if (arguments.length > 1 && !Query.prototype.read.deprecationWarningIssued) { - console.error("Deprecation warning: 'tags' argument is not supported anymore in Query.read() method. Please use mongodb.ReadPreference object instead."); - Query.prototype.read.deprecationWarningIssued = true; - } - this.options.readPreference = utils.readPref(pref); - return this; -} - -/** - * Sets tailable option. - * - * ####Example - * - * query.tailable() <== true - * query.tailable(true) - * query.tailable(false) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Boolean} v defaults to true - * @see mongodb http://www.mongodb.org/display/DOCS/Tailable+Cursors - * @api public - */ - -Query.prototype.tailable = function () { - this._validate('tailable'); - - this.options.tailable = arguments.length - ? !! arguments[0] - : true; - - return this; -} - -/** - * Merges another Query or conditions object into this one. - * - * When a Query is passed, conditions, field selection and options are merged. - * - * @param {Query|Object} source - * @return {Query} this - */ - -Query.prototype.merge = function (source) { - if (!source) - return this; - - if (!Query.canMerge(source)) - throw new TypeError('Invalid argument. Expected instanceof mquery or plain object'); - - if (source instanceof Query) { - // if source has a feature, apply it to ourselves - - if (source._conditions) { - utils.merge(this._conditions, source._conditions); - } - - if (source._fields) { - this._fields || (this._fields = {}); - utils.merge(this._fields, source._fields); - } - - if (source.options) { - this.options || (this.options = {}); - utils.merge(this.options, source.options); - } - - if (source._update) { - this._update || (this._update = {}); - utils.mergeClone(this._update, source._update); - } - - if (source._distinct) { - this._distinct = source._distinct; - } - - return this; - } - - // plain object - utils.merge(this._conditions, source); - - return this; -} - -/** - * Finds documents. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * query.find() - * query.find(callback) - * query.find({ name: 'Burning Lights' }, callback) - * - * @param {Object} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.find = function (criteria, callback) { - this.op = 'find'; - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) return this; - - var self = this - , conds = this._conditions - , options = this._optionsForExec() - - options.fields = this._fieldsForExec() - - debug('find', this._collection.collectionName, conds, options); - callback = this._wrapCallback('find', callback, { - conditions: conds - , options: options - }); - - this._collection.find(conds, options, utils.tick(callback)); - return this; -} - -/** - * Executes the query as a findOne() operation. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * query.findOne().where('name', /^Burning/); - * - * query.findOne({ name: /^Burning/ }) - * - * query.findOne({ name: /^Burning/ }, callback); // executes - * - * query.findOne(function (err, doc) { - * if (err) return handleError(err); - * if (doc) { - * // doc may be null if no document matched - * - * } - * }); - * - * @param {Object|Query} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.findOne = function (criteria, callback) { - this.op = 'findOne'; - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) return this; - - var self = this - , conds = this._conditions - , options = this._optionsForExec() - - options.fields = this._fieldsForExec(); - - debug('findOne', this._collection.collectionName, conds, options); - callback = this._wrapCallback('findOne', callback, { - conditions: conds - , options: options - }); - - this._collection.findOne(conds, options, utils.tick(callback)); - - return this; -} - -/** - * Exectues the query as a count() operation. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * query.count().where('color', 'black').exec(callback); - * - * query.count({ color: 'black' }).count(callback) - * - * query.count({ color: 'black' }, callback) - * - * query.where('color', 'black').count(function (err, count) { - * if (err) return handleError(err); - * console.log('there are %d kittens', count); - * }) - * - * @param {Object} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Count - * @api public - */ - -Query.prototype.count = function (criteria, callback) { - this.op = 'count'; - this._validate(); - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) return this; - - var conds = this._conditions - , options = this._optionsForExec() - - debug('count', this._collection.collectionName, conds, options); - callback = this._wrapCallback('count', callback, { - conditions: conds - , options: options - }); - - this._collection.count(conds, options, utils.tick(callback)); - return this; -} - -/** - * Declares or executes a distinct() operation. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * distinct(criteria, field, fn) - * distinct(criteria, field) - * distinct(field, fn) - * distinct(field) - * distinct(fn) - * distinct() - * - * @param {Object|Query} [criteria] - * @param {String} [field] - * @param {Function} [callback] - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Distinct - * @api public - */ - -Query.prototype.distinct = function (criteria, field, callback) { - this.op = 'distinct'; - this._validate(); - - if (!callback) { - switch (typeof field) { - case 'function': - callback = field; - if ('string' == typeof criteria) { - field = criteria; - criteria = undefined; - } - break; - case 'undefined': - case 'string': - break; - default: - throw new TypeError('Invalid `field` argument. Must be string or function') - break; - } - - switch (typeof criteria) { - case 'function': - callback = criteria; - criteria = field = undefined; - break; - case 'string': - field = criteria; - criteria = undefined; - break; - } - } - - if ('string' == typeof field) { - this._distinct = field; - } - - if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) { - return this; - } - - if (!this._distinct) { - throw new Error('No value for `distinct` has been declared'); - } - - var conds = this._conditions - , options = this._optionsForExec() - - debug('distinct', this._collection.collectionName, conds, options); - callback = this._wrapCallback('distinct', callback, { - conditions: conds - , options: options - }); - - this._collection.distinct(this._distinct, conds, options, utils.tick(callback)); - - return this; -} - -/** - * Declare and/or execute this query as an update() operation. - * - * _All paths passed that are not $atomic operations will become $set ops._ - * - * ####Example - * - * mquery({ _id: id }).update({ title: 'words' }, ...) - * - * becomes - * - * collection.update({ _id: id }, { $set: { title: 'words' }}, ...) - * - * ####Note - * - * Passing an empty object `{}` as the doc will result in a no-op unless the `overwrite` option is passed. Without the `overwrite` option set, the update operation will be ignored and the callback executed without sending the command to MongoDB so as to prevent accidently overwritting documents in the collection. - * - * ####Note - * - * The operation is only executed when a callback is passed. To force execution without a callback (which would be an unsafe write), we must first call update() and then execute it by using the `exec()` method. - * - * var q = mquery(collection).where({ _id: id }); - * q.update({ $set: { name: 'bob' }}).update(); // not executed - * - * var q = mquery(collection).where({ _id: id }); - * q.update({ $set: { name: 'bob' }}).exec(); // executed as unsafe - * - * // keys that are not $atomic ops become $set. - * // this executes the same command as the previous example. - * q.update({ name: 'bob' }).where({ _id: id }).exec(); - * - * var q = mquery(collection).update(); // not executed - * - * // overwriting with empty docs - * var q.where({ _id: id }).setOptions({ overwrite: true }) - * q.update({ }, callback); // executes - * - * // multi update with overwrite to empty doc - * var q = mquery(collection).where({ _id: id }); - * q.setOptions({ multi: true, overwrite: true }) - * q.update({ }); - * q.update(callback); // executed - * - * // multi updates - * mquery() - * .collection(coll) - * .update({ name: /^match/ }, { $set: { arr: [] }}, { multi: true }, callback) - * // more multi updates - * mquery({ }) - * .collection(coll) - * .setOptions({ multi: true }) - * .update({ $set: { arr: [] }}, callback) - * - * // single update by default - * mquery({ email: 'address@example.com' }) - * .collection(coll) - * .update({ $inc: { counter: 1 }}, callback) - * - * // summary - * update(criteria, doc, opts, cb) // executes - * update(criteria, doc, opts) - * update(criteria, doc, cb) // executes - * update(criteria, doc) - * update(doc, cb) // executes - * update(doc) - * update(cb) // executes - * update(true) // executes (unsafe write) - * update() - * - * @param {Object} [criteria] - * @param {Object} [doc] the update command - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.update = function update (criteria, doc, options, callback) { - this.op = 'update'; - var force; - - switch (arguments.length) { - case 3: - if ('function' == typeof options) { - callback = options; - options = undefined; - } - break; - case 2: - if ('function' == typeof doc) { - callback = doc; - doc = criteria; - criteria = undefined; - } - break; - case 1: - switch (typeof criteria) { - case 'function': - callback = criteria; - criteria = options = doc = undefined; - break; - case 'boolean': - // execution with no callback (unsafe write) - force = criteria; - criteria = undefined; - break; - default: - doc = criteria; - criteria = options = undefined; - break; - } - } - - if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (doc) { - this._mergeUpdate(doc); - } - - if (utils.isObject(options)) { - // { overwrite: true } - this.setOptions(options); - } - - // we are done if we don't have callback and they are - // not forcing an unsafe write. - if (!(force || callback)) - return this; - - if (!this._update || - !this.options.overwrite && 0 === utils.keys(this._update).length) { - callback && utils.soon(callback.bind(null, null, 0)); - return this; - } - - options = this._optionsForExec(); - if (!callback) options.safe = false; - - var criteria = this._conditions; - doc = this._updateForExec(); - - debug('update', this._collection.collectionName, criteria, doc, options); - callback = this._wrapCallback('update', callback, { - conditions: criteria - , doc: doc - , options: options - }); - - this._collection.update(criteria, doc, options, utils.tick(callback)); - - return this; -} - -/** - * Declare and/or execute this query as a remove() operation. - * - * ####Example - * - * mquery(collection).remove({ artist: 'Anne Murray' }, callback) - * - * ####Note - * - * The operation is only executed when a callback is passed. To force execution without a callback (which would be an unsafe write), we must first call remove() and then execute it by using the `exec()` method. - * - * // not executed - * var query = mquery(collection).remove({ name: 'Anne Murray' }) - * - * // executed - * mquery(collection).remove({ name: 'Anne Murray' }, callback) - * mquery(collection).remove({ name: 'Anne Murray' }).remove(callback) - * - * // executed without a callback (unsafe write) - * query.exec() - * - * // summary - * query.remove(conds, fn); // executes - * query.remove(conds) - * query.remove(fn) // executes - * query.remove() - * - * @param {Object|Query} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.remove = function (criteria, callback) { - this.op = 'remove'; - var force; - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } else if (true === criteria) { - force = criteria; - criteria = undefined; - } - - if (!(force || callback)) - return this; - - var options = this._optionsForExec() - if (!callback) options.safe = false; - - var conds = this._conditions; - - debug('remove', this._collection.collectionName, conds, options); - callback = this._wrapCallback('remove', callback, { - conditions: conds - , options: options - }); - - this._collection.remove(conds, options, utils.tick(callback)); - - return this; -} - -/** - * Issues a mongodb [findAndModify](http://www.mongodb.org/display/DOCS/findAndModify+Command) update command. - * - * Finds a matching document, updates it according to the `update` arg, passing any `options`, and returns the found document (if any) to the callback. The query executes immediately if `callback` is passed. - * - * ####Available options - * - * - `new`: bool - true to return the modified document rather than the original. defaults to true - * - `upsert`: bool - creates the object if it doesn't exist. defaults to false. - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - * ####Examples - * - * query.findOneAndUpdate(conditions, update, options, callback) // executes - * query.findOneAndUpdate(conditions, update, options) // returns Query - * query.findOneAndUpdate(conditions, update, callback) // executes - * query.findOneAndUpdate(conditions, update) // returns Query - * query.findOneAndUpdate(update, callback) // returns Query - * query.findOneAndUpdate(update) // returns Query - * query.findOneAndUpdate(callback) // executes - * query.findOneAndUpdate() // returns Query - * - * @param {Object|Query} [query] - * @param {Object} [doc] - * @param {Object} [options] - * @param {Function} [callback] - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @return {Query} this - * @api public - */ - -Query.prototype.findOneAndUpdate = function (criteria, doc, options, callback) { - this.op = 'findOneAndUpdate'; - this._validate(); - - switch (arguments.length) { - case 3: - if ('function' == typeof options) { - callback = options; - options = {}; - } - break; - case 2: - if ('function' == typeof doc) { - callback = doc; - doc = criteria; - criteria = undefined; - } - options = undefined; - break; - case 1: - if ('function' == typeof criteria) { - callback = criteria; - criteria = options = doc = undefined; - } else { - doc = criteria; - criteria = options = undefined; - } - } - - if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - // apply doc - if (doc) { - this._mergeUpdate(doc); - } - - options && this.setOptions(options); - - if (!callback) return this; - return this._findAndModify('update', callback); -} - -/** - * Issues a mongodb [findAndModify](http://www.mongodb.org/display/DOCS/findAndModify+Command) remove command. - * - * Finds a matching document, removes it, passing the found document (if any) to the callback. Executes immediately if `callback` is passed. - * - * ####Available options - * - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - * ####Examples - * - * A.where().findOneAndRemove(conditions, options, callback) // executes - * A.where().findOneAndRemove(conditions, options) // return Query - * A.where().findOneAndRemove(conditions, callback) // executes - * A.where().findOneAndRemove(conditions) // returns Query - * A.where().findOneAndRemove(callback) // executes - * A.where().findOneAndRemove() // returns Query - * - * @param {Object} [conditions] - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @api public - */ - -Query.prototype.findOneAndRemove = function (conditions, options, callback) { - this.op = 'findOneAndRemove'; - this._validate(); - - if ('function' == typeof options) { - callback = options; - options = undefined; - } else if ('function' == typeof conditions) { - callback = conditions; - conditions = undefined; - } - - // apply conditions - if (Query.canMerge(conditions)) { - this.merge(conditions); - } - - // apply options - options && this.setOptions(options); - - if (!callback) return this; - - return this._findAndModify('remove', callback); -} - -/** - * _findAndModify - * - * @param {String} type - either "remove" or "update" - * @param {Function} callback - * @api private - */ - -Query.prototype._findAndModify = function (type, callback) { - assert.equal('function', typeof callback); - - var opts = this._optionsForExec() - , self = this - , fields - , sort - , doc - - if ('remove' == type) { - opts.remove = true; - } else { - if (!('new' in opts)) opts.new = true; - if (!('upsert' in opts)) opts.upsert = false; - - doc = this._updateForExec() - if (!doc) { - if (opts.upsert) { - // still need to do the upsert to empty doc - doc = { $set: {} }; - } else { - return this.findOne(callback); - } - } - } - - var fields = this._fieldsForExec(); - if (fields) { - opts.fields = fields; - } - - var conds = this._conditions; - - debug('findAndModify', this._collection.collectionName, conds, doc, opts); - callback = this._wrapCallback('findAndModify', callback, { - conditions: conds - , doc: doc - , options: opts - }); - - this._collection - .findAndModify(conds, doc, opts, utils.tick(callback)); - - return this; -} - -/** - * Wrap callback to add tracing - * - * @param {Function} callback - * @param {Object} [queryInfo] - * @api private - */ -Query.prototype._wrapCallback = function (method, callback, queryInfo) { - var traceFunction = this._traceFunction || Query.traceFunction; - - if (traceFunction) { - queryInfo.collectionName = this._collection.collectionName; - - var traceCallback = traceFunction && - traceFunction.call(null, method, queryInfo, this); - - var startTime = new Date().getTime(); - - return function wrapperCallback (err, result) { - if (traceCallback) { - var millis = new Date().getTime() - startTime; - traceCallback.call(null, err, result, millis); - } - - if (callback) { - callback.apply(null, arguments); - } - }; - } - - return callback; -} - -/** - * Add trace function that gets called when the query is executed. - * The function will be called with (method, queryInfo, query) and - * should return a callback function which will be called - * with (err, result, millis) when the query is complete. - * - * queryInfo is an object containing: { - * collectionName: , - * conditions: , - * options: , - * doc: [document to update, if applicable] - * } - * - * NOTE: Does not trace stream queries. - * - * @param {Function} traceFunction - * @return {Query} this - * @api public - */ -Query.prototype.setTraceFunction = function (traceFunction) { - this._traceFunction = traceFunction; - return this; -} - -/** - * Executes the query - * - * ####Examples - * - * query.exec(); - * query.exec(callback); - * query.exec('update'); - * query.exec('find', callback); - * - * @param {String|Function} [operation] - * @param {Function} [callback] - * @api public - */ - -Query.prototype.exec = function exec (op, callback) { - switch (typeof op) { - case 'function': - callback = op; - op = null; - break; - case 'string': - this.op = op; - break; - } - - assert.ok(this.op, "Missing query type: (find, update, etc)"); - - if ('update' == this.op || 'remove' == this.op) { - callback || (callback = true); - } - - this[this.op](callback); -} - -/** - * Returns a thunk which when called runs this.exec() - * - * The thunk receives a callback function which will be - * passed to `this.exec()` - * - * @return {Function} - * @api public - */ - -Query.prototype.thunk = function() { - var self = this; - return function(cb) { - self.exec(cb); - } -} - -/** - * Executes the query returning a `Promise` which will be - * resolved with either the doc(s) or rejected with the error. - * - * @param {Function} [resolve] - * @param {Function} [reject] - * @return {Promise} - * @api public - */ - -Query.prototype.then = function(resolve, reject) { - var self = this; - var promise = new Query.Promise(function(success, error) { - self.exec(function(err, val) { - if (err) error(err); - else success(val); - self = success = error = null; - }); - }); - return promise.then(resolve, reject); -} - -/** - * Returns a stream for the given find query. - * - * @throws Error if operation is not a find - * @returns {Stream} Node 0.8 style - */ - -Query.prototype.stream = function(streamOptions) { - if ('find' != this.op) - throw new Error('stream() is only available for find'); - - var conds = this._conditions; - - var options = this._optionsForExec() - options.fields = this._fieldsForExec() - - debug('stream', this._collection.collectionName, conds, options, streamOptions); - - return this._collection.findStream(conds, options, streamOptions); -} - -/** - * Determines if field selection has been made. - * - * @return {Boolean} - * @api public - */ - -Query.prototype.selected = function selected () { - return !! (this._fields && Object.keys(this._fields).length > 0); -} - -/** - * Determines if inclusive field selection has been made. - * - * query.selectedInclusively() // false - * query.select('name') - * query.selectedInclusively() // true - * query.selectedExlusively() // false - * - * @returns {Boolean} - */ - -Query.prototype.selectedInclusively = function selectedInclusively () { - if (!this._fields) return false; - - var keys = Object.keys(this._fields); - if (0 === keys.length) return false; - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (0 === this._fields[key]) return false; - if (this._fields[key] && - typeof this._fields[key] === 'object' && - this._fields[key].$meta) { - return false; - } - } - - return true; -} - -/** - * Determines if exclusive field selection has been made. - * - * query.selectedExlusively() // false - * query.select('-name') - * query.selectedExlusively() // true - * query.selectedInclusively() // false - * - * @returns {Boolean} - */ - -Query.prototype.selectedExclusively = function selectedExclusively () { - if (!this._fields) return false; - - var keys = Object.keys(this._fields); - if (0 === keys.length) return false; - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (0 === this._fields[key]) return true; - } - - return false; -} - -/** - * Merges `doc` with the current update object. - * - * @param {Object} doc - */ - -Query.prototype._mergeUpdate = function (doc) { - if (!this._update) this._update = {}; - if (doc instanceof Query) { - if (doc._update) { - utils.mergeClone(this._update, doc._update); - } - } else { - utils.mergeClone(this._update, doc); - } -} - -/** - * Returns default options. - * - * @return {Object} - * @api private - */ - -Query.prototype._optionsForExec = function () { - var options = utils.clone(this.options, { retainKeyOrder: true }); - return options; -} - -/** - * Returns fields selection for this query. - * - * @return {Object} - * @api private - */ - -Query.prototype._fieldsForExec = function () { - return utils.clone(this._fields, { retainKeyOrder: true }); -} - -/** - * Return an update document with corrected $set operations. - * - * @api private - */ - -Query.prototype._updateForExec = function () { - var update = utils.clone(this._update, { retainKeyOrder: true }) - , ops = utils.keys(update) - , i = ops.length - , ret = {} - , hasKeys - , val - - while (i--) { - var op = ops[i]; - - if (this.options.overwrite) { - ret[op] = update[op]; - continue; - } - - if ('$' !== op[0]) { - // fix up $set sugar - if (!ret.$set) { - if (update.$set) { - ret.$set = update.$set; - } else { - ret.$set = {}; - } - } - ret.$set[op] = update[op]; - ops.splice(i, 1); - if (!~ops.indexOf('$set')) ops.push('$set'); - } else if ('$set' === op) { - if (!ret.$set) { - ret[op] = update[op]; - } - } else { - ret[op] = update[op]; - } - } - - return ret; -} - -/** - * Make sure _path is set. - * - * @parmam {String} method - */ - -Query.prototype._ensurePath = function (method) { - if (!this._path) { - var msg = method + '() must be used after where() ' - + 'when called with these arguments' - throw new Error(msg); - } -} - -/*! - * Permissions - */ - -Query.permissions = require('./permissions'); - -Query._isPermitted = function (a, b) { - var denied = Query.permissions[b]; - if (!denied) return true; - return true !== denied[a]; -} - -Query.prototype._validate = function (action) { - var fail; - var validator; - - if (undefined === action) { - - validator = Query.permissions[this.op]; - if ('function' != typeof validator) return true; - - fail = validator(this); - - } else if (!Query._isPermitted(action, this.op)) { - fail = action; - } - - if (fail) { - throw new Error(fail + ' cannot be used with ' + this.op); - } -} - -/** - * Determines if `conds` can be merged using `mquery().merge()` - * - * @param {Object} conds - * @return {Boolean} - */ - -Query.canMerge = function (conds) { - return conds instanceof Query || utils.isObject(conds); -} - -/** - * Set a trace function that will get called whenever a - * query is executed. - * - * See `setTraceFunction()` for details. - * - * @param {Object} conds - * @return {Boolean} - */ -Query.setGlobalTraceFunction = function (traceFunction) { - Query.traceFunction = traceFunction; -} - -/*! - * Exports. - */ - -Query.utils = utils; -Query.env = require('./env') -Query.Collection = require('./collection'); -Query.BaseCollection = require('./collection/collection'); -Query.Promise = require('bluebird'); -module.exports = exports = Query; - -// TODO -// test utils diff --git a/Associations/node_modules/mongoose/node_modules/mquery/lib/permissions.js b/Associations/node_modules/mongoose/node_modules/mquery/lib/permissions.js deleted file mode 100644 index 5008a972..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/lib/permissions.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -var denied = exports; - -denied.distinct = function (self) { - if (self._fields && Object.keys(self._fields).length > 0) { - return 'field selection and slice' - } - - var keys = Object.keys(denied.distinct); - var err; - - keys.every(function (option) { - if (self.options[option]) { - err = option; - return false; - } - return true; - }); - - return err; -}; -denied.distinct.select = -denied.distinct.slice = -denied.distinct.sort = -denied.distinct.limit = -denied.distinct.skip = -denied.distinct.batchSize = -denied.distinct.comment = -denied.distinct.maxScan = -denied.distinct.snapshot = -denied.distinct.hint = -denied.distinct.tailable = true; - - -// aggregation integration - - -denied.findOneAndUpdate = -denied.findOneAndRemove = function (self) { - var keys = Object.keys(denied.findOneAndUpdate); - var err; - - keys.every(function (option) { - if (self.options[option]) { - err = option; - return false; - } - return true; - }); - - return err; -} -denied.findOneAndUpdate.limit = -denied.findOneAndUpdate.skip = -denied.findOneAndUpdate.batchSize = -denied.findOneAndUpdate.maxScan = -denied.findOneAndUpdate.snapshot = -denied.findOneAndUpdate.hint = -denied.findOneAndUpdate.tailable = -denied.findOneAndUpdate.comment = true; - - -denied.count = function (self) { - if (self._fields && Object.keys(self._fields).length > 0) { - return 'field selection and slice' - } - - var keys = Object.keys(denied.count); - var err; - - keys.every(function (option) { - if (self.options[option]) { - err = option; - return false; - } - return true; - }); - - return err; -} - -denied.count.select = -denied.count.slice = -denied.count.sort = -denied.count.batchSize = -denied.count.comment = -denied.count.maxScan = -denied.count.snapshot = -denied.count.tailable = true; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/lib/utils.js b/Associations/node_modules/mongoose/node_modules/mquery/lib/utils.js deleted file mode 100644 index 6707ce23..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/lib/utils.js +++ /dev/null @@ -1,331 +0,0 @@ -'use strict'; - -/*! - * Module dependencies. - */ - -var RegExpClone = require('regexp-clone') - -/** - * Clones objects - * - * @param {Object} obj the object to clone - * @param {Object} options - * @return {Object} the cloned object - * @api private - */ - -var clone = exports.clone = function clone (obj, options) { - if (obj === undefined || obj === null) - return obj; - - if (Array.isArray(obj)) - return exports.cloneArray(obj, options); - - if (obj.constructor) { - if (/ObjectI[dD]$/.test(obj.constructor.name)) { - return 'function' == typeof obj.clone - ? obj.clone() - : new obj.constructor(obj.id); - } - - if ('ReadPreference' === obj._type && obj.isValid && obj.toObject) { - return 'function' == typeof obj.clone - ? obj.clone() - : new obj.constructor(obj.mode, clone(obj.tags, options)); - } - - if ('Binary' == obj._bsontype && obj.buffer && obj.value) { - return 'function' == typeof obj.clone - ? obj.clone() - : new obj.constructor(obj.value(true), obj.sub_type); - } - - if ('Date' === obj.constructor.name || 'Function' === obj.constructor.name) - return new obj.constructor(+obj); - - if ('RegExp' === obj.constructor.name) - return RegExpClone(obj); - - if ('Buffer' === obj.constructor.name) - return exports.cloneBuffer(obj); - } - - if (isObject(obj)) - return exports.cloneObject(obj, options); - - if (obj.valueOf) - return obj.valueOf(); -}; - -/*! - * ignore - */ - -var cloneObject = exports.cloneObject = function cloneObject (obj, options) { - var retainKeyOrder = options && options.retainKeyOrder - , minimize = options && options.minimize - , ret = {} - , hasKeys - , keys - , val - , k - , i - - if (retainKeyOrder) { - for (k in obj) { - val = clone(obj[k], options); - - if (!minimize || ('undefined' !== typeof val)) { - hasKeys || (hasKeys = true); - ret[k] = val; - } - } - } else { - // faster - - keys = Object.keys(obj); - i = keys.length; - - while (i--) { - k = keys[i]; - val = clone(obj[k], options); - - if (!minimize || ('undefined' !== typeof val)) { - if (!hasKeys) hasKeys = true; - ret[k] = val; - } - } - } - - return minimize - ? hasKeys && ret - : ret; -}; - -var cloneArray = exports.cloneArray = function cloneArray (arr, options) { - var ret = []; - for (var i = 0, l = arr.length; i < l; i++) - ret.push(clone(arr[i], options)); - return ret; -}; - -/** - * process.nextTick helper. - * - * Wraps the given `callback` in a try/catch. If an error is - * caught it will be thrown on nextTick. - * - * node-mongodb-native had a habit of state corruption when - * an error was immediately thrown from within a collection - * method (find, update, etc) callback. - * - * @param {Function} [callback] - * @api private - */ - -var tick = exports.tick = function tick (callback) { - if ('function' !== typeof callback) return; - return function () { - // callbacks should always be fired on the next - // turn of the event loop. A side benefit is - // errors thrown from executing the callback - // will not cause drivers state to be corrupted - // which has historically been a problem. - var args = arguments; - soon(function(){ - callback.apply(this, args); - }); - } -} - -/** - * Merges `from` into `to` without overwriting existing properties. - * - * @param {Object} to - * @param {Object} from - * @api private - */ - -var merge = exports.merge = function merge (to, from) { - var keys = Object.keys(from) - , i = keys.length - , key - - while (i--) { - key = keys[i]; - if ('undefined' === typeof to[key]) { - to[key] = from[key]; - } else { - if (exports.isObject(from[key])) { - merge(to[key], from[key]); - } else { - to[key] = from[key]; - } - } - } -} - -/** - * Same as merge but clones the assigned values. - * - * @param {Object} to - * @param {Object} from - * @api private - */ - -var mergeClone = exports.mergeClone = function mergeClone (to, from) { - var keys = Object.keys(from) - , i = keys.length - , key - - while (i--) { - key = keys[i]; - if ('undefined' === typeof to[key]) { - // make sure to retain key order here because of a bug handling the $each - // operator in mongodb 2.4.4 - to[key] = clone(from[key], { retainKeyOrder : 1}); - } else { - if (exports.isObject(from[key])) { - mergeClone(to[key], from[key]); - } else { - // make sure to retain key order here because of a bug handling the - // $each operator in mongodb 2.4.4 - to[key] = clone(from[key], { retainKeyOrder : 1}); - } - } - } -} - -/** - * Read pref helper (mongo 2.2 drivers support this) - * - * Allows using aliases instead of full preference names: - * - * p primary - * pp primaryPreferred - * s secondary - * sp secondaryPreferred - * n nearest - * - * @param {String} pref - */ - -exports.readPref = function readPref (pref) { - switch (pref) { - case 'p': - pref = 'primary'; - break; - case 'pp': - pref = 'primaryPreferred'; - break; - case 's': - pref = 'secondary'; - break; - case 'sp': - pref = 'secondaryPreferred'; - break; - case 'n': - pref = 'nearest'; - break; - } - - return pref; -} - -/** - * Object.prototype.toString.call helper - */ - -var _toString = Object.prototype.toString; -var toString = exports.toString = function (arg) { - return _toString.call(arg); -} - -/** - * Determines if `arg` is an object. - * - * @param {Object|Array|String|Function|RegExp|any} arg - * @return {Boolean} - */ - -var isObject = exports.isObject = function (arg) { - return '[object Object]' == exports.toString(arg); -} - -/** - * Determines if `arg` is an array. - * - * @param {Object} - * @return {Boolean} - * @see nodejs utils - */ - -var isArray = exports.isArray = function (arg) { - return Array.isArray(arg) || - 'object' == typeof arg && '[object Array]' == exports.toString(arg); -} - -/** - * Object.keys helper - */ - -exports.keys = Object.keys || function (obj) { - var keys = []; - for (var k in obj) if (obj.hasOwnProperty(k)) { - keys.push(k); - } - return keys; -} - -/** - * Basic Object.create polyfill. - * Only one argument is supported. - * - * Based on https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create - */ - -exports.create = 'function' == typeof Object.create - ? Object.create - : create; - -function create (proto) { - if (arguments.length > 1) { - throw new Error("Adding properties is not supported") - } - - function F () {} - F.prototype = proto; - return new F; -} - -/** - * inheritance - */ - -exports.inherits = function (ctor, superCtor) { - ctor.prototype = exports.create(superCtor.prototype); - ctor.prototype.constructor = ctor; -} - -/** - * nextTick helper - * compat with node 0.10 which behaves differently than previous versions - */ - -var soon = exports.soon = 'function' == typeof setImmediate - ? setImmediate - : process.nextTick; - -/** - * Clones the contents of a buffer. - * - * @param {Buffer} buff - * @return {Buffer} - */ - -exports.cloneBuffer = function (buff) { - var dupe = new Buffer(buff.length); - buff.copy(dupe, 0, 0, buff.length); - return dupe; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE deleted file mode 100644 index a3966cf9..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Petka Antonov - -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/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md deleted file mode 100644 index 5e920957..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md +++ /dev/null @@ -1,676 +0,0 @@ - - Promises/A+ logo - -[![Build Status](https://travis-ci.org/petkaantonov/bluebird.svg?branch=master)](https://travis-ci.org/petkaantonov/bluebird) -[![coverage-98%](http://img.shields.io/badge/coverage-98%-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html) - - -# Introduction - -Bluebird is a fully featured [promise](#what-are-promises-and-why-should-i-use-them) library with focus on innovative features and performance - - - -# Topics - -- [Features](#features) -- [Quick start](#quick-start) -- [API Reference and examples](API.md) -- [Support](#support) -- [What are promises and why should I use them?](#what-are-promises-and-why-should-i-use-them) -- [Questions and issues](#questions-and-issues) -- [Error handling](#error-handling) -- [Development](#development) - - [Testing](#testing) - - [Benchmarking](#benchmarks) - - [Custom builds](#custom-builds) - - [For library authors](#for-library-authors) -- [What is the sync build?](#what-is-the-sync-build) -- [License](#license) -- [Snippets for common problems](https://github.com/petkaantonov/bluebird/wiki/Snippets) -- [Promise anti-patterns](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns) -- [Changelog](changelog.md) -- [Optimization guide](#optimization-guide) - -# Features -bluebird logo - -- [Promises A+](http://promisesaplus.com) -- [Synchronous inspection](API.md#synchronous-inspection) -- [Concurrency coordination](API.md#collections) -- [Promisification on steroids](API.md#promisification) -- [Resource management through a parallel of python `with`/C# `using`](API.md#resource-management) -- [Cancellation and timeouts](API.md#cancellation) -- [Parallel for C# `async` and `await`](API.md#generators) -- Mind blowing utilities such as - - [`.bind()`](API.md#binddynamic-thisarg---promise) - - [`.call()`](API.md#callstring-propertyname--dynamic-arg---promise) - - [`Promise.join()`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) - - [And](API.md#core) [much](API.md#timers) [more](API.md#utility)! -- [Practical debugging solutions and sane defaults](#error-handling) -- [Sick performance](benchmark/) - -
      - -# Quick start - -## Node.js - - npm install bluebird - -Then: - -```js -var Promise = require("bluebird"); -``` - -## Browsers - -There are many ways to use bluebird in browsers: - -- Direct downloads - - Full build [bluebird.js](https://cdn.jsdelivr.net/bluebird/latest/bluebird.js) - - Full build minified [bluebird.min.js](https://cdn.jsdelivr.net/bluebird/latest/bluebird.min.js) -- You may use browserify on the main export -- You may use the [bower](http://bower.io) package. - -When using script tags the global variables `Promise` and `P` (alias for `Promise`) become available. - -A [minimal bluebird browser build](#custom-builds) is ≈38.92KB minified*, 11.65KB gzipped and has no external dependencies. - -*Google Closure Compiler using Simple. - -#### Browser support - -Browsers that [implement ECMA-262, edition 3](http://en.wikipedia.org/wiki/Ecmascript#Implementations) and later are supported. - -[![Selenium Test Status](https://saucelabs.com/browser-matrix/petka_antonov.svg)](https://saucelabs.com/u/petka_antonov) - -**Note** that in ECMA-262, edition 3 (IE7, IE8 etc.) it is not possible to use methods that have keyword names like `.catch` and `.finally`. The [API documentation](API.md) always lists a compatible alternative name that you can use if you need to support these browsers. For example `.catch` is replaced with `.caught` and `.finally` with `.lastly`. - -Also, [long stack trace](API.md#promiselongstacktraces---void) support is only available in Chrome, Firefox and Internet Explorer 10+. - -After quick start, see [API Reference and examples](API.md) - -
      - -# Support - -- Mailing list: [bluebird-js@googlegroups.com](https://groups.google.com/forum/#!forum/bluebird-js) -- IRC: #promises @freenode -- StackOverflow: [bluebird tag](http://stackoverflow.com/questions/tagged/bluebird) -- Bugs and feature requests: [github issue tracker](https://github.com/petkaantonov/bluebird/issues?state=open) - -
      - -# What are promises and why should I use them? - -You should use promises to turn this: - -```js -fs.readFile("file.json", function(err, val) { - if( err ) { - console.error("unable to read file"); - } - else { - try { - val = JSON.parse(val); - console.log(val.success); - } - catch( e ) { - console.error("invalid json in file"); - } - } -}); -``` - -Into this: - -```js -fs.readFileAsync("file.json").then(JSON.parse).then(function(val) { - console.log(val.success); -}) -.catch(SyntaxError, function(e) { - console.error("invalid json in file"); -}) -.catch(function(e) { - console.error("unable to read file") -}); -``` - -*If you are wondering "there is no `readFileAsync` method on `fs` that returns a promise", see [promisification](API.md#promisification)* - -Actually you might notice the latter has a lot in common with code that would do the same using synchronous I/O: - -```js -try { - var val = JSON.parse(fs.readFileSync("file.json")); - console.log(val.success); -} -//Syntax actually not supported in JS but drives the point -catch(SyntaxError e) { - console.error("invalid json in file"); -} -catch(Error e) { - console.error("unable to read file") -} -``` - -And that is the point - being able to have something that is a lot like `return` and `throw` in synchronous code. - -You can also use promises to improve code that was written with callback helpers: - - -```js -//Copyright Plato http://stackoverflow.com/a/19385911/995876 -//CC BY-SA 2.5 -mapSeries(URLs, function (URL, done) { - var options = {}; - needle.get(URL, options, function (error, response, body) { - if (error) { - return done(error) - } - try { - var ret = JSON.parse(body); - return done(null, ret); - } - catch (e) { - done(e); - } - }); -}, function (err, results) { - if (err) { - console.log(err) - } else { - console.log('All Needle requests successful'); - // results is a 1 to 1 mapping in order of URLs > needle.body - processAndSaveAllInDB(results, function (err) { - if (err) { - return done(err) - } - console.log('All Needle requests saved'); - done(null); - }); - } -}); -``` - -Is more pleasing to the eye when done with promises: - -```js -Promise.promisifyAll(needle); -var options = {}; - -var current = Promise.resolve(); -Promise.map(URLs, function(URL) { - current = current.then(function () { - return needle.getAsync(URL, options); - }); - return current; -}).map(function(responseAndBody){ - return JSON.parse(responseAndBody[1]); -}).then(function (results) { - return processAndSaveAllInDB(results); -}).then(function(){ - console.log('All Needle requests saved'); -}).catch(function (e) { - console.log(e); -}); -``` - -Also promises don't just give you correspondences for synchronous features but can also be used as limited event emitters or callback aggregators. - -More reading: - - - [Promise nuggets](https://promise-nuggets.github.io/) - - [Why I am switching to promises](http://spion.github.io/posts/why-i-am-switching-to-promises.html) - - [What is the the point of promises](http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/#toc_1) - - [Snippets for common problems](https://github.com/petkaantonov/bluebird/wiki/Snippets) - - [Promise anti-patterns](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns) - -# Questions and issues - -If you find a bug in bluebird or have a feature request, file an issue in the [github issue tracker](https://github.com/petkaantonov/bluebird/issues). Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`. - -# Error handling - -This is a problem every promise library needs to handle in some way. Unhandled rejections/exceptions don't really have a good agreed-on asynchronous correspondence. The problem is that it is impossible to predict the future and know if a rejected promise will eventually be handled. - -There are two common pragmatic attempts at solving the problem that promise libraries do. - -The more popular one is to have the user explicitly communicate that they are done and any unhandled rejections should be thrown, like so: - -```js -download().then(...).then(...).done(); -``` - -For handling this problem, in my opinion, this is completely unacceptable and pointless. The user must remember to explicitly call `.done` and that cannot be justified when the problem is forgetting to create an error handler in the first place. - -The second approach, which is what bluebird by default takes, is to call a registered handler if a rejection is unhandled by the start of a second turn. The default handler is to write the stack trace to `stderr` or `console.error` in browsers. This is close to what happens with synchronous code - your code doesn't work as expected and you open console and see a stack trace. Nice. - -Of course this is not perfect, if your code for some reason needs to swoop in and attach error handler to some promise after the promise has been hanging around a while then you will see annoying messages. In that case you can use the `.done()` method to signal that any hanging exceptions should be thrown. - -If you want to override the default handler for these possibly unhandled rejections, you can pass yours like so: - -```js -Promise.onPossiblyUnhandledRejection(function(error){ - throw error; -}); -``` - -If you want to also enable long stack traces, call: - -```js -Promise.longStackTraces(); -``` - -right after the library is loaded. - -In node.js use the environment flag `BLUEBIRD_DEBUG`: - -``` -BLUEBIRD_DEBUG=1 node server.js -``` - -to enable long stack traces in all instances of bluebird. - -Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. Long stack traces imply a substantial performance penalty, even after using every trick to optimize them. - -Long stack traces are enabled by default in the debug build. - -#### Expected and unexpected errors - -A practical problem with Promises/A+ is that it models Javascript `try-catch` too closely for its own good. Therefore by default promises inherit `try-catch` warts such as the inability to specify the error types that the catch block is eligible for. It is an anti-pattern in every other language to use catch-all handlers because they swallow exceptions that you might not know about. - -Now, Javascript does have a perfectly fine and working way of creating error type hierarchies. It is still quite awkward to use them with the built-in `try-catch` however: - -```js -try { - //code -} -catch(e) { - if( e instanceof WhatIWantError) { - //handle - } - else { - throw e; - } -} -``` - -Without such checking, unexpected errors would be silently swallowed. However, with promises, bluebird brings the future (hopefully) here now and extends the `.catch` to [accept potential error type eligibility](API.md#catchfunction-errorclass-function-handler---promise). - -For instance here it is expected that some evil or incompetent entity will try to crash our server from `SyntaxError` by providing syntactically invalid JSON: - -```js -getJSONFromSomewhere().then(function(jsonString) { - return JSON.parse(jsonString); -}).then(function(object) { - console.log("it was valid json: ", object); -}).catch(SyntaxError, function(e){ - console.log("don't be evil"); -}); -``` - -Here any kind of unexpected error will automatically reported on `stderr` along with a stack trace because we only register a handler for the expected `SyntaxError`. - -Ok, so, that's pretty neat. But actually not many libraries define error types and it is in fact a complete ghetto out there with ad hoc strings being attached as some arbitrary property name like `.name`, `.type`, `.code`, not having any property at all or even throwing strings as errors and so on. So how can we still listen for expected errors? - -Bluebird defines a special error type `OperationalError` (you can get a reference from `Promise.OperationalError`). This type of error is given as rejection reason by promisified methods when -their underlying library gives an untyped, but expected error. Primitives such as strings, and error objects that are directly created like `new Error("database didn't respond")` are considered untyped. - -Example of such library is the node core library `fs`. So if we promisify it, we can catch just the errors we want pretty easily and have programmer errors be redirected to unhandled rejection handler so that we notice them: - -```js -//Read more about promisification in the API Reference: -//API.md -var fs = Promise.promisifyAll(require("fs")); - -fs.readFileAsync("myfile.json").then(JSON.parse).then(function (json) { - console.log("Successful json") -}).catch(SyntaxError, function (e) { - console.error("file contains invalid json"); -}).catch(Promise.OperationalError, function (e) { - console.error("unable to read file, because: ", e.message); -}); -``` - -The last `catch` handler is only invoked when the `fs` module explicitly used the `err` argument convention of async callbacks to inform of an expected error. The `OperationalError` instance will contain the original error in its `.cause` property but it does have a direct copy of the `.message` and `.stack` too. In this code any unexpected error - be it in our code or the `fs` module - would not be caught by these handlers and therefore not swallowed. - -Since a `catch` handler typed to `Promise.OperationalError` is expected to be used very often, it has a neat shorthand: - -```js -.error(function (e) { - console.error("unable to read file, because: ", e.message); -}); -``` - -See [API documentation for `.error()`](API.md#error-rejectedhandler----promise) - -Finally, Bluebird also supports predicate-based filters. If you pass a -predicate function instead of an error type, the predicate will receive -the error as an argument. The return result will be used to determine whether -the error handler should be called. - -Predicates should allow for very fine grained control over caught errors: -pattern matching, error typesets with set operations and many other techniques -can be implemented on top of them. - -Example of using a predicate-based filter: - -```js -var Promise = require("bluebird"); -var request = Promise.promisify(require("request")); - -function clientError(e) { - return e.code >= 400 && e.code < 500; -} - -request("http://www.google.com").then(function(contents){ - console.log(contents); -}).catch(clientError, function(e){ - //A client error like 400 Bad Request happened -}); -``` - -**Danger:** The JavaScript language allows throwing primitive values like strings. Throwing primitives can lead to worse or no stack traces. Primitives [are not exceptions](http://www.devthought.com/2011/12/22/a-string-is-not-an-error/). You should consider always throwing Error objects when handling exceptions. - -
      - -#### How do long stack traces differ from e.g. Q? - -Bluebird attempts to have more elaborate traces. Consider: - -```js -Error.stackTraceLimit = 25; -Q.longStackSupport = true; -Q().then(function outer() { - return Q().then(function inner() { - return Q().then(function evenMoreInner() { - a.b.c.d(); - }).catch(function catcher(e){ - console.error(e.stack); - }); - }) -}); -``` - -You will see - - ReferenceError: a is not defined - at evenMoreInner (:7:13) - From previous event: - at inner (:6:20) - -Compare to: - -```js -Error.stackTraceLimit = 25; -Promise.longStackTraces(); -Promise.resolve().then(function outer() { - return Promise.resolve().then(function inner() { - return Promise.resolve().then(function evenMoreInner() { - a.b.c.d() - }).catch(function catcher(e){ - console.error(e.stack); - }); - }); -}); -``` - - ReferenceError: a is not defined - at evenMoreInner (:7:13) - From previous event: - at inner (:6:36) - From previous event: - at outer (:5:32) - From previous event: - at :4:21 - at Object.InjectedScript._evaluateOn (:572:39) - at Object.InjectedScript._evaluateAndWrap (:531:52) - at Object.InjectedScript.evaluate (:450:21) - - -A better and more practical example of the differences can be seen in gorgikosev's [debuggability competition](https://github.com/spion/async-compare#debuggability). - -
      - -# Development - -For development tasks such as running benchmarks or testing, you need to clone the repository and install dev-dependencies. - -Install [node](http://nodejs.org/) and [npm](https://npmjs.org/) - - git clone git@github.com:petkaantonov/bluebird.git - cd bluebird - npm install - -## Testing - -To run all tests, run - - node tools/test - -If you need to run generator tests run the `tool/test.js` script with `--harmony` argument and node 0.11+: - - node-dev --harmony tools/test - -You may specify an individual test file to run with the `--run` script flag: - - node tools/test --run=cancel.js - - -This enables output from the test and may give a better idea where the test is failing. The paramter to `--run` can be any file name located in `test/mocha` folder. - -#### Testing in browsers - -To run the test in a browser instead of node, pass the flag `--browser` to the test tool - - node tools/test --run=cancel.js --browser - -This will automatically create a server (default port 9999) and open it in your default browser once the tests have been compiled. - -Keep the test tab active because some tests are timing-sensitive and will fail if the browser is throttling timeouts. Chrome will do this for example when the tab is not active. - -#### Supported options by the test tool - -The value of boolean flags is determined by presence, if you want to pass false value for a boolean flag, use the `no-`-prefix e.g. `--no-browser`. - - - `--run=String`. Which tests to run (or compile when testing in browser). Default `"all"`. Can also be a glob string (relative to ./test/mocha folder) - - `--cover=String`. Create code coverage using the String as istanbul reporter. Coverage is created in the ./coverage folder. No coverage is created by default, default reporter is `"html"` (use `--cover` to use default reporter). - - `--browser` - Whether to compile tests for browsers. Default `false`. - - `--port=Number` - Whe port where local server is hosted when testing in browser. Default `9999` - - `--execute-browser-tests` - Whether to execute the compiled tests for browser when using `--browser`. Default `true`. - - `--open-browser` - Whether to open the default browser when executing browser tests. Default `true`. - - `--fake-timers` - Whether to use fake timers (`setTimeout` etc) when running tests in node. Default `true`. - - `--js-hint` - Whether to run JSHint on source files. Default `true`. - - `--saucelabs` Wheter to create a tunnel to sauce labs and run tests in their VMs instead of your browser when compiling tests for browser.Default `false`. - -## Benchmarks - -To run a benchmark, run the given command for a benchmark while on the project root. Requires bash (on windows the mingw32 that comes with git works fine too). - -Node 0.11.2+ is required to run the generator examples. - -### 1\. DoxBee sequential - -Currently the most relevant benchmark is @gorkikosev's benchmark in the article [Analysis of generators and other async patterns in node](http://spion.github.io/posts/analysis-generators-and-other-async-patterns-node.html). The benchmark emulates a situation where n amount of users are making a request in parallel to execute some mixed async/sync action. The benchmark has been modified to include a warm-up phase to minimize any JITing during timed sections. - -Command: `bench doxbee` - -### 2\. Made-up parallel - -This made-up scenario runs 15 shimmed queries in parallel. - -Command: `bench parallel` - -## Custom builds - -Custom builds for browsers are supported through a command-line utility. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
      The following features can be disabled
      Feature(s)Command line identifier
      .any and Promise.anyany
      .race and Promise.racerace
      .call and .getcall_get
      .filter and Promise.filterfilter
      .map and Promise.mapmap
      .reduce and Promise.reducereduce
      .props and Promise.propsprops
      .settle and Promise.settlesettle
      .some and Promise.somesome
      .nodeifynodeify
      Promise.coroutine and Promise.spawngenerators
      Progressionprogress
      Promisificationpromisify
      Cancellationcancel
      Timerstimers
      Resource managementusing
      - - -Make sure you have cloned the repo somewhere and did `npm install` successfully. - -After that you can run: - - node tools/build --features="core" - - -The above builds the most minimal build you can get. You can add more features separated by spaces from the above list: - - node tools/build --features="core filter map reduce" - -The custom build file will be found from `/js/browser/bluebird.js`. It will have a comment that lists the disabled and enabled features. - -Note that the build leaves the `/js/main` etc folders with same features so if you use the folder for node.js at the same time, don't forget to build -a full version afterwards (after having taken a copy of the bluebird.js somewhere): - - node tools/build --debug --main --zalgo --browser --minify - -#### Supported options by the build tool - -The value of boolean flags is determined by presence, if you want to pass false value for a boolean flag, use the `no-`-prefix e.g. `--no-debug`. - - - `--main` - Whether to build the main build. The main build is placed at `js/main` directory. Default `false`. - - `--debug` - Whether to build the debug build. The debug build is placed at `js/debug` directory. Default `false`. - - `--zalgo` - Whether to build the zalgo build. The zalgo build is placed at `js/zalgo` directory. Default `false`. - - `--browser` - Whether to compile the browser build. The browser build file is placed at `js/browser/bluebird.js` Default `false`. - - `--minify` - Whether to minify the compiled browser build. The minified browser build file is placed at `js/browser/bluebird.min.js` Default `true`. - - `--features=String` - See [custom builds](#custom-builds) - -
      - -## For library authors - -Building a library that depends on bluebird? You should know about a few features. - -If your library needs to do something obtrusive like adding or modifying methods on the `Promise` prototype, uses long stack traces or uses a custom unhandled rejection handler then... that's totally ok as long as you don't use `require("bluebird")`. Instead you should create a file -that creates an isolated copy. For example, creating a file called `bluebird-extended.js` that contains: - -```js - //NOTE the function call right after -module.exports = require("bluebird/js/main/promise")(); -``` - -Your library can then use `var Promise = require("bluebird-extended");` and do whatever it wants with it. Then if the application or other library uses their own bluebird promises they will all play well together because of Promises/A+ thenable assimilation magic. - -You should also know about [`.nodeify()`](API.md#nodeifyfunction-callback---promise) which makes it easy to provide a dual callback/promise API. - -
      - -## What is the sync build? - -You may now use sync build by: - - var Promise = require("bluebird/zalgo"); - -The sync build is provided to see how forced asynchronity affects benchmarks. It should not be used in real code due to the implied hazards. - -The normal async build gives Promises/A+ guarantees about asynchronous resolution of promises. Some people think this affects performance or just plain love their code having a possibility -of stack overflow errors and non-deterministic behavior. - -The sync build skips the async call trampoline completely, e.g code like: - - async.invoke( this.fn, this, val ); - -Appears as this in the sync build: - - this.fn(val); - -This should pressure the CPU slightly less and thus the sync build should perform better. Indeed it does, but only marginally. The biggest performance boosts are from writing efficient Javascript, not from compromising determinism. - -Note that while some benchmarks are waiting for the next event tick, the CPU is actually not in use during that time. So the resulting benchmark result is not completely accurate because on node.js you only care about how much the CPU is taxed. Any time spent on CPU is time the whole process (or server) is paralyzed. And it is not graceful like it would be with threads. - - -```js -var cache = new Map(); //ES6 Map or DataStructures/Map or whatever... -function getResult(url) { - var resolver = Promise.pending(); - if (cache.has(url)) { - resolver.resolve(cache.get(url)); - } - else { - http.get(url, function(err, content) { - if (err) resolver.reject(err); - else { - cache.set(url, content); - resolver.resolve(content); - } - }); - } - return resolver.promise; -} - - - -//The result of console.log is truly random without async guarantees -function guessWhatItPrints( url ) { - var i = 3; - getResult(url).then(function(){ - i = 4; - }); - console.log(i); -} -``` - -# Optimization guide - -Articles about optimization will be periodically posted in [the wiki section](https://github.com/petkaantonov/bluebird/wiki), polishing edits are welcome. - -A single cohesive guide compiled from the articles will probably be done eventually. - -# License - -The MIT License (MIT) - -Copyright (c) 2014 Petka Antonov - -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/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md deleted file mode 100644 index 46729e1e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md +++ /dev/null @@ -1,1643 +0,0 @@ -## 2.9.26 (2015-05-25) - -Bugfixes: - - - Fix crash in NW [#624](.) - - Fix [`.return()`](.) not supporting `undefined` as return value [#627](.) - -## 2.9.25 (2015-04-28) - -Bugfixes: - - - Fix crash in node 0.8 - -## 2.9.24 (2015-04-02) - -Bugfixes: - - - Fix not being able to load multiple bluebird copies introduced in 2.9.22 ([#559](.), [#561](.), [#560](.)). - -## 2.9.23 (2015-04-02) - -Bugfixes: - - - Fix node.js domain propagation ([#521](.)). - -## 2.9.22 (2015-04-02) - - - Fix `.promisify` crashing in phantom JS ([#556](.)) - -## 2.9.21 (2015-03-30) - - - Fix error object's `'stack'`' overwriting causing an error when its defined to be a setter that throws an error ([#552](.)). - -## 2.9.20 (2015-03-29) - -Bugfixes: - - - Fix regression where there is a long delay between calling `.cancel()` and promise actually getting cancelled in Chrome when long stack traces are enabled - -## 2.9.19 (2015-03-29) - -Bugfixes: - - - Fix crashing in Chrome when long stack traces are disabled - -## 2.9.18 (2015-03-29) - -Bugfixes: - - - Fix settlePromises using trampoline - -## 2.9.17 (2015-03-29) - - -Bugfixes: - - - Fix Chrome DevTools async stack traceability ([#542](.)). - -## 2.9.16 (2015-03-28) - -Features: - - - Use setImmediate if available - -## 2.9.15 (2015-03-26) - -Features: - - - Added `.asCallback` alias for `.nodeify`. - -Bugfixes: - - - Don't always use nextTick, but try to pick up setImmediate or setTimeout in NW. Fixes [#534](.), [#525](.) - - Make progress a core feature. Fixes [#535](.) Note that progress has been removed in 3.x - this is only a fix necessary for 2.x custom builds. - -## 2.9.14 (2015-03-12) - -Bugfixes: - - - Always use process.nextTick. Fixes [#525](.) - -## 2.9.13 (2015-02-27) - -Bugfixes: - - - Fix .each, .filter, .reduce and .map callbacks being called synchornously if the input is immediate. ([#513](.)) - -## 2.9.12 (2015-02-19) - -Bugfixes: - - - Fix memory leak introduced in 2.9.0 ([#502](.)) - -## 2.9.11 (2015-02-19) - -Bugfixes: - - - Fix [#503](.) - -## 2.9.10 (2015-02-18) - -Bugfixes: - - - Fix [#501](.) - -## 2.9.9 (2015-02-12) - -Bugfixes: - - - Fix `TypeError: Cannot assign to read only property 'length'` when jsdom has declared a read-only length for all objects to inherit. - -## 2.9.8 (2015-02-10) - -Bugfixes: - - - Fix regression introduced in 2.9.7 where promisify didn't properly dynamically look up methods on `this` - -## 2.9.7 (2015-02-08) - -Bugfixes: - - - Fix `promisify` not retaining custom properties of the function. This enables promisifying the `"request"` module's export function and its methods at the same time. - - Fix `promisifyAll` methods being dependent on `this` when they are not originally dependent on `this`. This enables e.g. passing promisified `fs` functions directly as callbacks without having to bind them to `fs`. - - Fix `process.nextTick` being used over `setImmediate` in node. - -## 2.9.6 (2015-02-02) - -Bugfixes: - - - Node environment detection can no longer be fooled - -## 2.9.5 (2015-02-02) - -Misc: - - - Warn when [`.then()`](.) is passed non-functions - -## 2.9.4 (2015-01-30) - -Bugfixes: - - - Fix [.timeout()](.) not calling `clearTimeout` with the proper handle in node causing the process to wait for unneeded timeout. This was a regression introduced in 2.9.1. - -## 2.9.3 (2015-01-27) - -Bugfixes: - - - Fix node-webkit compatibility issue ([#467](https://github.com/petkaantonov/bluebird/pull/467)) - - Fix long stack trace support in recent firefox versions - -## 2.9.2 (2015-01-26) - -Bugfixes: - - - Fix critical bug regarding to using promisifyAll in browser that was introduced in 2.9.0 ([#466](https://github.com/petkaantonov/bluebird/issues/466)). - -Misc: - - - Add `"browser"` entry point to package.json - -## 2.9.1 (2015-01-24) - -Features: - - - If a bound promise is returned by the callback to [`Promise.method`](#promisemethodfunction-fn---function) and [`Promise.try`](#promisetryfunction-fn--arraydynamicdynamic-arguments--dynamic-ctx----promise), the returned promise will be bound to the same value - -## 2.9.0 (2015-01-24) - -Features: - - - Add [`Promise.fromNode`](API.md#promisefromnodefunction-resolver---promise) - - Add new paramter `value` for [`Promise.bind`](API.md#promisebinddynamic-thisarg--dynamic-value---promise) - -Bugfixes: - - - Fix several issues with [`cancellation`](API.md#cancellation) and [`.bind()`](API.md#binddynamic-thisarg---promise) interoperation when `thisArg` is a promise or thenable - - Fix promises created in [`disposers`](API#disposerfunction-disposer---disposer) not having proper long stack trace context - - Fix [`Promise.join`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) sometimes passing the passed in callback function as the last argument to itself. - -Misc: - - - Reduce minified full browser build file size by not including unused code generation functionality. - - Major internal refactoring related to testing code and source code file layout - -## 2.8.2 (2015-01-20) - -Features: - - - [Global rejection events](https://github.com/petkaantonov/bluebird/blob/master/API.md#global-rejection-events) are now fired both as DOM3 events and as legacy events in browsers - -## 2.8.1 (2015-01-20) - -Bugfixes: - - - Fix long stack trace stiching consistency when rejected from thenables - -## 2.8.0 (2015-01-19) - -Features: - - - Major debuggability improvements: - - Long stack traces have been re-designed. They are now much more readable, - succint, relevant and consistent across bluebird features. - - Long stack traces are supported now in IE10+ - -## 2.7.1 (2015-01-15) - -Bugfixes: - - - Fix [#447](https://github.com/petkaantonov/bluebird/issues/447) - -## 2.7.0 (2015-01-15) - -Features: - - - Added more context to stack traces originating from coroutines ([#421](https://github.com/petkaantonov/bluebird/issues/421)) - - Implemented [global rejection events](https://github.com/petkaantonov/bluebird/blob/master/API.md#global-rejection-events) ([#428](https://github.com/petkaantonov/bluebird/issues/428), [#357](https://github.com/petkaantonov/bluebird/issues/357)) - - [Custom promisifiers](https://github.com/petkaantonov/bluebird/blob/master/API.md#option-promisifier) are now passed the default promisifier which can be used to add enhancements on top of normal node promisification - - [Promisification filters](https://github.com/petkaantonov/bluebird/blob/master/API.md#option-filter) are now passed `passesDefaultFilter` boolean - -Bugfixes: - - - Fix `.noConflict()` call signature ([#446]()) - - Fix `Promise.method`ified functions being called with `undefined` when they were called with no arguments - -## 2.6.4 (2015-01-12) - -Bugfixes: - - - `OperationalErrors` thrown by promisified functions retain custom properties, such as `.code` and `.path`. - -## 2.6.3 (2015-01-12) - -Bugfixes: - - - Fix [#429](https://github.com/petkaantonov/bluebird/issues/429) - - Fix [#432](https://github.com/petkaantonov/bluebird/issues/432) - - Fix [#433](https://github.com/petkaantonov/bluebird/issues/433) - -## 2.6.2 (2015-01-07) - -Bugfixes: - - - Fix [#426](https://github.com/petkaantonov/bluebird/issues/426) - -## 2.6.1 (2015-01-07) - -Bugfixes: - - - Fixed built browser files not being included in the git tag release for bower - -## 2.6.0 (2015-01-06) - -Features: - - - Significantly improve parallel promise performance and memory usage (+50% faster, -50% less memory) - - -## 2.5.3 (2014-12-30) - -## 2.5.2 (2014-12-29) - -Bugfixes: - - - Fix bug where already resolved promise gets attached more handlers while calling its handlers resulting in some handlers not being called - - Fix bug where then handlers are not called in the same order as they would run if Promises/A+ 2.3.2 was implemented as adoption - - Fix bug where using `Object.create(null)` as a rejection reason would crash bluebird - -## 2.5.1 (2014-12-29) - -Bugfixes: - - - Fix `.finally` throwing null error when it is derived from a promise that is resolved with a promise that is resolved with a promise - -## 2.5.0 (2014-12-28) - -Features: - - - [`.get`](#API.md#https://github.com/petkaantonov/bluebird/blob/master/API.md#getstring-propertyname---promise) now supports negative indexing. - -Bugfixes: - - - Fix bug with `Promise.method` wrapped function returning a promise that never resolves if the function returns a promise that is resolved with another promise - - Fix bug with `Promise.delay` never resolving if the value is a promise that is resolved with another promise - -## 2.4.3 (2014-12-28) - -Bugfixes: - - - Fix memory leak as described in [this Promises/A+ spec issue](https://github.com/promises-aplus/promises-spec/issues/179). - -## 2.4.2 (2014-12-21) - -Bugfixes: - - - Fix bug where spread rejected handler is ignored in case of rejection - - Fix synchronous scheduler passed to `setScheduler` causing infinite loop - -## 2.4.1 (2014-12-20) - -Features: - - - Error messages now have links to wiki pages for additional information - - Promises now clean up all references (to handlers, child promises etc) as soon as possible. - -## 2.4.0 (2014-12-18) - -Features: - - - Better filtering of bluebird internal calls in long stack traces, especially when using minified file in browsers - - Small performance improvements for all collection methods - - Promises now delete references to handlers attached to them as soon as possible - - Additional stack traces are now output on stderr/`console.warn` for errors that are thrown in the process/window from rejected `.done()` promises. See [#411](https://github.com/petkaantonov/bluebird/issues/411) - -## 2.3.11 (2014-10-31) - -Bugfixes: - - - Fix [#371](https://github.com/petkaantonov/bluebird/issues/371), [#373](https://github.com/petkaantonov/bluebird/issues/373) - - -## 2.3.10 (2014-10-28) - -Features: - - - `Promise.method` no longer wraps primitive errors - - `Promise.try` no longer wraps primitive errors - -## 2.3.7 (2014-10-25) - -Bugfixes: - - - Fix [#359](https://github.com/petkaantonov/bluebird/issues/359), [#362](https://github.com/petkaantonov/bluebird/issues/362) and [#364](https://github.com/petkaantonov/bluebird/issues/364) - -## 2.3.6 (2014-10-15) - -Features: - - - Implement [`.reflect()`](API.md#reflect---promisepromiseinspection) - -## 2.3.5 (2014-10-06) - -Bugfixes: - - - Fix issue when promisifying methods whose names contain the string 'args' - -## 2.3.4 (2014-09-27) - - - `P` alias was not declared inside WebWorkers - -## 2.3.3 (2014-09-27) - -Bugfixes: - - - Fix [#318](https://github.com/petkaantonov/bluebird/issues/318), [#314](https://github.com/petkaantonov/bluebird/issues/#314) - -## 2.3.2 (2014-08-25) - -Bugfixes: - - - `P` alias for `Promise` now exists in global scope when using browser builds without a module loader, fixing an issue with firefox extensions - -## 2.3.1 (2014-08-23) - -Features: - - - `.using` can now be used with disposers created from different bluebird copy - -## 2.3.0 (2014-08-13) - -Features: - - - [`.bind()`](API.md#binddynamic-thisarg---promise) and [`Promise.bind()`](API.md#promisebinddynamic-thisarg---promise) now await for the resolution of the `thisArg` if it's a promise or a thenable - -Bugfixes: - - - Fix [#276](https://github.com/petkaantonov/bluebird/issues/276) - -## 2.2.2 (2014-07-14) - - - Fix [#259](https://github.com/petkaantonov/bluebird/issues/259) - -## 2.2.1 (2014-07-07) - - - Fix multiline error messages only showing the first line - -## 2.2.0 (2014-07-07) - -Bugfixes: - - - `.any` and `.some` now consistently reject with RangeError when input array contains too few promises - - Fix iteration bug with `.reduce` when input array contains already fulfilled promises - -## 2.1.3 (2014-06-18) - -Bugfixes: - - - Fix [#235](https://github.com/petkaantonov/bluebird/issues/235) - -## 2.1.2 (2014-06-15) - -Bugfixes: - - - Fix [#232](https://github.com/petkaantonov/bluebird/issues/232) - -## 2.1.1 (2014-06-11) - -## 2.1.0 (2014-06-11) - -Features: - - - Add [`promisifier`](API.md#option-promisifier) option to `Promise.promisifyAll()` - - Improve performance of `.props()` and collection methods when used with immediate values - - -Bugfixes: - - - Fix a bug where .reduce calls the callback for an already visited item - - Fix a bug where stack trace limit is calculated to be too small, which resulted in too short stack traces - -Add undocumented experimental `yieldHandler` option to `Promise.coroutine` - -## 2.0.7 (2014-06-08) -## 2.0.6 (2014-06-07) -## 2.0.5 (2014-06-05) -## 2.0.4 (2014-06-05) -## 2.0.3 (2014-06-05) -## 2.0.2 (2014-06-04) -## 2.0.1 (2014-06-04) - -## 2.0.0 (2014-06-04) - -#What's new in 2.0 - -- [Resource management](API.md#resource-management) - never leak resources again -- [Promisification](API.md#promisification) on steroids - entire modules can now be promisified with one line of code -- [`.map()`](API.md#mapfunction-mapper--object-options---promise), [`.each()`](API.md#eachfunction-iterator---promise), [`.filter()`](API.md#filterfunction-filterer--object-options---promise), [`.reduce()`](API.md#reducefunction-reducer--dynamic-initialvalue---promise) reimagined from simple sugar to powerful concurrency coordination tools -- [API Documentation](API.md) has been reorganized and more elaborate examples added -- Deprecated [progression](#progression-migration) and [deferreds](#deferred-migration) -- Improved performance and readability - -Features: - -- Added [`using()`](API.md#promiseusingpromisedisposer-promise-promisedisposer-promise--function-handler---promise) and [`disposer()`](API.md#disposerfunction-disposer---disposer) -- [`.map()`](API.md#mapfunction-mapper--object-options---promise) now calls the handler as soon as items in the input array become fulfilled -- Added a concurrency option to [`.map()`](API.md#mapfunction-mapper--object-options---promise) -- [`.filter()`](API.md#filterfunction-filterer--object-options---promise) now calls the handler as soon as items in the input array become fulfilled -- Added a concurrency option to [`.filter()`](API.md#filterfunction-filterer--object-options---promise) -- [`.reduce()`](API.md#reducefunction-reducer--dynamic-initialvalue---promise) now calls the handler as soon as items in the input array become fulfilled, but in-order -- Added [`.each()`](API.md#eachfunction-iterator---promise) -- [`Promise.resolve()`](API.md#promiseresolvedynamic-value---promise) behaves like `Promise.cast`. `Promise.cast` deprecated. -- [Synchronous inspection](API.md#synchronous-inspection): Removed `.inspect()`, added [`.value()`](API.md#value---dynamic) and [`.reason()`](API.md#reason---dynamic) -- [`Promise.join()`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) now takes a function as the last argument -- Added [`Promise.setScheduler()`](API.md#promisesetschedulerfunction-scheduler---void) -- [`.cancel()`](API.md#cancelerror-reason---promise) supports a custom cancellation reason -- [`.timeout()`](API.md#timeoutint-ms--string-message---promise) now cancels the promise instead of rejecting it -- [`.nodeify()`](API.md#nodeifyfunction-callback--object-options---promise) now supports passing multiple success results when mapping promises to nodebacks -- Added `suffix` and `filter` options to [`Promise.promisifyAll()`](API.md#promisepromisifyallobject-target--object-options---object) - -Breaking changes: - -- Sparse array holes are not skipped by collection methods but treated as existing elements with `undefined` value -- `.map()` and `.filter()` do not call the given mapper or filterer function in any specific order -- Removed the `.inspect()` method -- Yielding an array from a coroutine is not supported by default. You can use [`coroutine.addYieldHandler()`](API.md#promisecoroutineaddyieldhandlerfunction-handler---void) to configure the old behavior (or any behavior you want). -- [`.any()`](API.md#any---promise) and [`.some()`](API.md#someint-count---promise) no longer use an array as the rejection reason. [`AggregateError`](API.md#aggregateerror) is used instead. - - -## 1.2.4 (2014-04-27) - -Bugfixes: - - - Fix promisifyAll causing a syntax error when a method name is not a valid identifier - - Fix syntax error when es5.js is used in strict mode - -## 1.2.3 (2014-04-17) - -Bugfixes: - - - Fix [#179](https://github.com/petkaantonov/bluebird/issues/179) - -## 1.2.2 (2014-04-09) - -Bugfixes: - - - Promisified methods from promisifyAll no longer call the original method when it is overriden - - Nodeify doesn't pass second argument to the callback if the promise is fulfilled with `undefined` - -## 1.2.1 (2014-03-31) - -Bugfixes: - - - Fix [#168](https://github.com/petkaantonov/bluebird/issues/168) - -## 1.2.0 (2014-03-29) - -Features: - - - New method: [`.value()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#value---dynamic) - - New method: [`.reason()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#reason---dynamic) - - New method: [`Promise.onUnhandledRejectionHandled()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promiseonunhandledrejectionhandledfunction-handler---undefined) - - `Promise.map()`, `.map()`, `Promise.filter()` and `.filter()` start calling their callbacks as soon as possible while retaining a correct order. See [`8085922f`](https://github.com/petkaantonov/bluebird/commit/8085922fb95a9987fda0cf2337598ab4a98dc315). - -Bugfixes: - - - Fix [#165](https://github.com/petkaantonov/bluebird/issues/165) - - Fix [#166](https://github.com/petkaantonov/bluebird/issues/166) - -## 1.1.1 (2014-03-18) - -Bugfixes: - - - [#138](https://github.com/petkaantonov/bluebird/issues/138) - - [#144](https://github.com/petkaantonov/bluebird/issues/144) - - [#148](https://github.com/petkaantonov/bluebird/issues/148) - - [#151](https://github.com/petkaantonov/bluebird/issues/151) - -## 1.1.0 (2014-03-08) - -Features: - - - Implement [`Promise.prototype.tap()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#tapfunction-handler---promise) - - Implement [`Promise.coroutine.addYieldHandler()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisecoroutineaddyieldhandlerfunction-handler---void) - - Deprecate `Promise.prototype.spawn` - -Bugfixes: - - - Fix already rejected promises being reported as unhandled when handled through collection methods - - Fix browserisfy crashing from checking `process.version.indexOf` - -## 1.0.8 (2014-03-03) - -Bugfixes: - - - Fix active domain being lost across asynchronous boundaries in Node.JS 10.xx - -## 1.0.7 (2014-02-25) - -Bugfixes: - - - Fix handled errors being reported - -## 1.0.6 (2014-02-17) - -Bugfixes: - - - Fix bug with unhandled rejections not being reported - when using `Promise.try` or `Promise.method` without - attaching further handlers - -## 1.0.5 (2014-02-15) - -Features: - - - Node.js performance: promisified functions try to check amount of passed arguments in most optimal order - - Node.js promisified functions will have same `.length` as the original function minus one (for the callback parameter) - -## 1.0.4 (2014-02-09) - -Features: - - - Possibly unhandled rejection handler will always get a stack trace, even if the rejection or thrown error was not an error - - Unhandled rejections are tracked per promise, not per error. So if you create multiple branches from a single ancestor and that ancestor gets rejected, each branch with no error handler with the end will cause a possibly unhandled rejection handler invocation - -Bugfixes: - - - Fix unhandled non-writable objects or primitives not reported by possibly unhandled rejection handler - -## 1.0.3 (2014-02-05) - -Bugfixes: - - - [#93](https://github.com/petkaantonov/bluebird/issues/88) - -## 1.0.2 (2014-02-04) - -Features: - - - Significantly improve performance of foreign bluebird thenables - -Bugfixes: - - - [#88](https://github.com/petkaantonov/bluebird/issues/88) - -## 1.0.1 (2014-01-28) - -Features: - - - Error objects that have property `.isAsync = true` will now be caught by `.error()` - -Bugfixes: - - - Fix TypeError and RangeError shims not working without `new` operator - -## 1.0.0 (2014-01-12) - -Features: - - - `.filter`, `.map`, and `.reduce` no longer skip sparse array holes. This is a backwards incompatible change. - - Like `.map` and `.filter`, `.reduce` now allows returning promises and thenables from the iteration function. - -Bugfixes: - - - [#58](https://github.com/petkaantonov/bluebird/issues/58) - - [#61](https://github.com/petkaantonov/bluebird/issues/61) - - [#64](https://github.com/petkaantonov/bluebird/issues/64) - - [#60](https://github.com/petkaantonov/bluebird/issues/60) - -## 0.11.6-1 (2013-12-29) - -## 0.11.6-0 (2013-12-29) - -Features: - - - You may now return promises and thenables from the filterer function used in `Promise.filter` and `Promise.prototype.filter`. - - - `.error()` now catches additional sources of rejections: - - - Rejections originating from `Promise.reject` - - - Rejections originating from thenables using - the `reject` callback - - - Rejections originating from promisified callbacks - which use the `errback` argument - - - Rejections originating from `new Promise` constructor - where the `reject` callback is called explicitly - - - Rejections originating from `PromiseResolver` where - `.reject()` method is called explicitly - -Bugfixes: - - - Fix `captureStackTrace` being called when it was `null` - - Fix `Promise.map` not unwrapping thenables - -## 0.11.5-1 (2013-12-15) - -## 0.11.5-0 (2013-12-03) - -Features: - - - Improve performance of collection methods - - Improve performance of promise chains - -## 0.11.4-1 (2013-12-02) - -## 0.11.4-0 (2013-12-02) - -Bugfixes: - - - Fix `Promise.some` behavior with arguments like negative integers, 0... - - Fix stack traces of synchronously throwing promisified functions' - -## 0.11.3-0 (2013-12-02) - -Features: - - - Improve performance of generators - -Bugfixes: - - - Fix critical bug with collection methods. - -## 0.11.2-0 (2013-12-02) - -Features: - - - Improve performance of all collection methods - -## 0.11.1-0 (2013-12-02) - -Features: - -- Improve overall performance. -- Improve performance of promisified functions. -- Improve performance of catch filters. -- Improve performance of .finally. - -Bugfixes: - -- Fix `.finally()` rejecting if passed non-function. It will now ignore non-functions like `.then`. -- Fix `.finally()` not converting thenables returned from the handler to promises. -- `.spread()` now rejects if the ultimate value given to it is not spreadable. - -## 0.11.0-0 (2013-12-02) - -Features: - - - Improve overall performance when not using `.bind()` or cancellation. - - Promises are now not cancellable by default. This is backwards incompatible change - see [`.cancellable()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#cancellable---promise) - - [`Promise.delay`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisedelaydynamic-value-int-ms---promise) - - [`.delay()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#delayint-ms---promise) - - [`.timeout()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#timeoutint-ms--string-message---promise) - -## 0.10.14-0 (2013-12-01) - -Bugfixes: - - - Fix race condition when mixing 3rd party asynchrony. - -## 0.10.13-1 (2013-11-30) - -## 0.10.13-0 (2013-11-30) - -Bugfixes: - - - Fix another bug with progression. - -## 0.10.12-0 (2013-11-30) - -Bugfixes: - - - Fix bug with progression. - -## 0.10.11-4 (2013-11-29) - -## 0.10.11-2 (2013-11-29) - -Bugfixes: - - - Fix `.race()` not propagating bound values. - -## 0.10.11-1 (2013-11-29) - -Features: - - - Improve performance of `Promise.race` - -## 0.10.11-0 (2013-11-29) - -Bugfixes: - - - Fixed `Promise.promisifyAll` invoking property accessors. Only data properties with function values are considered. - -## 0.10.10-0 (2013-11-28) - -Features: - - - Disable long stack traces in browsers by default. Call `Promise.longStackTraces()` to enable them. - -## 0.10.9-1 (2013-11-27) - -Bugfixes: - - - Fail early when `new Promise` is constructed incorrectly - -## 0.10.9-0 (2013-11-27) - -Bugfixes: - - - Promise.props now takes a [thenable-for-collection](https://github.com/petkaantonov/bluebird/blob/f41edac61b7c421608ff439bb5a09b7cffeadcf9/test/mocha/props.js#L197-L217) - - All promise collection methods now reject when a promise-or-thenable-for-collection turns out not to give a collection - -## 0.10.8-0 (2013-11-25) - -Features: - - - All static collection methods take thenable-for-collection - -## 0.10.7-0 (2013-11-25) - -Features: - - - throw TypeError when thenable resolves with itself - - Make .race() and Promise.race() forever pending on empty collections - -## 0.10.6-0 (2013-11-25) - -Bugfixes: - - - Promise.resolve and PromiseResolver.resolve follow thenables too. - -## 0.10.5-0 (2013-11-24) - -Bugfixes: - - - Fix infinite loop when thenable resolves with itself - -## 0.10.4-1 (2013-11-24) - -Bugfixes: - - - Fix a file missing from build. (Critical fix) - -## 0.10.4-0 (2013-11-24) - -Features: - - - Remove dependency of es5-shim and es5-sham when using ES3. - -## 0.10.3-0 (2013-11-24) - -Features: - - - Improve performance of `Promise.method` - -## 0.10.2-1 (2013-11-24) - -Features: - - - Rename PromiseResolver#asCallback to PromiseResolver#callback - -## 0.10.2-0 (2013-11-24) - -Features: - - - Remove memoization of thenables - -## 0.10.1-0 (2013-11-21) - -Features: - - - Add methods `Promise.resolve()`, `Promise.reject()`, `Promise.defer()` and `.resolve()`. - -## 0.10.0-1 (2013-11-17) - -## 0.10.0-0 (2013-11-17) - -Features: - - - Implement `Promise.method()` - - Implement `.return()` - - Implement `.throw()` - -Bugfixes: - - - Fix promises being able to use themselves as resolution or follower value - -## 0.9.11-1 (2013-11-14) - -Features: - - - Implicit `Promise.all()` when yielding an array from generators - -## 0.9.11-0 (2013-11-13) - -Bugfixes: - - - Fix `.spread` not unwrapping thenables - -## 0.9.10-2 (2013-11-13) - -Features: - - - Improve performance of promisified functions on V8 - -Bugfixes: - - - Report unhandled rejections even when long stack traces are disabled - - Fix `.error()` showing up in stack traces - -## 0.9.10-1 (2013-11-05) - -Bugfixes: - - - Catch filter method calls showing in stack traces - -## 0.9.10-0 (2013-11-05) - -Bugfixes: - - - Support primitives in catch filters - -## 0.9.9-0 (2013-11-05) - -Features: - - - Add `Promise.race()` and `.race()` - -## 0.9.8-0 (2013-11-01) - -Bugfixes: - - - Fix bug with `Promise.try` not unwrapping returned promises and thenables - -## 0.9.7-0 (2013-10-29) - -Bugfixes: - - - Fix bug with build files containing duplicated code for promise.js - -## 0.9.6-0 (2013-10-28) - -Features: - - - Improve output of reporting unhandled non-errors - - Implement RejectionError wrapping and `.error()` method - -## 0.9.5-0 (2013-10-27) - -Features: - - - Allow fresh copies of the library to be made - -## 0.9.4-1 (2013-10-27) - -## 0.9.4-0 (2013-10-27) - -Bugfixes: - - - Rollback non-working multiple fresh copies feature - -## 0.9.3-0 (2013-10-27) - -Features: - - - Allow fresh copies of the library to be made - - Add more components to customized builds - -## 0.9.2-1 (2013-10-25) - -## 0.9.2-0 (2013-10-25) - -Features: - - - Allow custom builds - -## 0.9.1-1 (2013-10-22) - -Bugfixes: - - - Fix unhandled rethrown exceptions not reported - -## 0.9.1-0 (2013-10-22) - -Features: - - - Improve performance of `Promise.try` - - Extend `Promise.try` to accept arguments and ctx to make it more usable in promisification of synchronous functions. - -## 0.9.0-0 (2013-10-18) - -Features: - - - Implement `.bind` and `Promise.bind` - -Bugfixes: - - - Fix `.some()` when argument is a pending promise that later resolves to an array - -## 0.8.5-1 (2013-10-17) - -Features: - - - Enable process wide long stack traces through BLUEBIRD_DEBUG environment variable - -## 0.8.5-0 (2013-10-16) - -Features: - - - Improve performance of all collection methods - -Bugfixes: - - - Fix .finally passing the value to handlers - - Remove kew from benchmarks due to bugs in the library breaking the benchmark - - Fix some bluebird library calls potentially appearing in stack traces - -## 0.8.4-1 (2013-10-15) - -Bugfixes: - - - Fix .pending() call showing in long stack traces - -## 0.8.4-0 (2013-10-15) - -Bugfixes: - - - Fix PromiseArray and its sub-classes swallowing possibly unhandled rejections - -## 0.8.3-3 (2013-10-14) - -Bugfixes: - - - Fix AMD-declaration using named module. - -## 0.8.3-2 (2013-10-14) - -Features: - - - The mortals that can handle it may now release Zalgo by `require("bluebird/zalgo");` - -## 0.8.3-1 (2013-10-14) - -Bugfixes: - - - Fix memory leak when using the same promise to attach handlers over and over again - -## 0.8.3-0 (2013-10-13) - -Features: - - - Add `Promise.props()` and `Promise.prototype.props()`. They work like `.all()` for object properties. - -Bugfixes: - - - Fix bug with .some returning garbage when sparse arrays have rejections - -## 0.8.2-2 (2013-10-13) - -Features: - - - Improve performance of `.reduce()` when `initialValue` can be synchronously cast to a value - -## 0.8.2-1 (2013-10-12) - -Bugfixes: - - - Fix .npmignore having irrelevant files - -## 0.8.2-0 (2013-10-12) - -Features: - - - Improve performance of `.some()` - -## 0.8.1-0 (2013-10-11) - -Bugfixes: - - - Remove uses of dynamic evaluation (`new Function`, `eval` etc) when strictly not necessary. Use feature detection to use static evaluation to avoid errors when dynamic evaluation is prohibited. - -## 0.8.0-3 (2013-10-10) - -Features: - - - Add `.asCallback` property to `PromiseResolver`s - -## 0.8.0-2 (2013-10-10) - -## 0.8.0-1 (2013-10-09) - -Features: - - - Improve overall performance. Be able to sustain infinite recursion when using promises. - -## 0.8.0-0 (2013-10-09) - -Bugfixes: - - - Fix stackoverflow error when function calls itself "synchronously" from a promise handler - -## 0.7.12-2 (2013-10-09) - -Bugfixes: - - - Fix safari 6 not using `MutationObserver` as a scheduler - - Fix process exceptions interfering with internal queue flushing - -## 0.7.12-1 (2013-10-09) - -Bugfixes: - - - Don't try to detect if generators are available to allow shims to be used - -## 0.7.12-0 (2013-10-08) - -Features: - - - Promisification now consider all functions on the object and its prototype chain - - Individual promisifcation uses current `this` if no explicit receiver is given - - Give better stack traces when promisified callbacks throw or errback primitives such as strings by wrapping them in an `Error` object. - -Bugfixes: - - - Fix runtime APIs throwing synchronous errors - -## 0.7.11-0 (2013-10-08) - -Features: - - - Deprecate `Promise.promisify(Object target)` in favor of `Promise.promisifyAll(Object target)` to avoid confusion with function objects - - Coroutines now throw error when a non-promise is `yielded` - -## 0.7.10-1 (2013-10-05) - -Features: - - - Make tests pass Internet Explorer 8 - -## 0.7.10-0 (2013-10-05) - -Features: - - - Create browser tests - -## 0.7.9-1 (2013-10-03) - -Bugfixes: - - - Fix promise cast bug when thenable fulfills using itself as the fulfillment value - -## 0.7.9-0 (2013-10-03) - -Features: - - - More performance improvements when long stack traces are enabled - -## 0.7.8-1 (2013-10-02) - -Features: - - - Performance improvements when long stack traces are enabled - -## 0.7.8-0 (2013-10-02) - -Bugfixes: - - - Fix promisified methods not turning synchronous exceptions into rejections - -## 0.7.7-1 (2013-10-02) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.7-0 (2013-10-01) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.6-0 (2013-09-29) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.5-0 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.4-1 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.4-0 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.3-1 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.3-0 (2013-09-27) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.2-0 (2013-09-27) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-5 (2013-09-26) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-4 (2013-09-25) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-3 (2013-09-25) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-2 (2013-09-24) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-1 (2013-09-24) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-0 (2013-09-24) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.0-1 (2013-09-23) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.0-0 (2013-09-23) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.5-2 (2013-09-20) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.5-1 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.5-0 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.4-1 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.4-0 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-4 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-3 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-2 (2013-09-16) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-1 (2013-09-16) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-0 (2013-09-15) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.2-1 (2013-09-14) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.2-0 (2013-09-14) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.1-0 (2013-09-14) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.0-0 (2013-09-13) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-6 (2013-09-12) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-5 (2013-09-12) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-4 (2013-09-12) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-3 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-2 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-1 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-0 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.8-1 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.8-0 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.7-0 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.6-1 (2013-09-10) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.6-0 (2013-09-10) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.5-1 (2013-09-10) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.5-0 (2013-09-09) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.4-1 (2013-09-08) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.4-0 (2013-09-08) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.3-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.2-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.1-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.0-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.4.0-0 (2013-09-06) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.3.0-1 (2013-09-06) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.3.0 (2013-09-06) diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js deleted file mode 100644 index 69a6ffd8..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js +++ /dev/null @@ -1,5105 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2014 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 2.9.26 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, cancel, using, filter, any, each, timers -*/ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0; -}; - -Async.prototype.throwLater = function(fn, arg) { - if (arguments.length === 1) { - arg = fn; - fn = function () { throw arg; }; - } - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - if (typeof setTimeout !== "undefined") { - setTimeout(function() { - fn(arg); - }, 0); - } else try { - this._schedule(function() { - fn(arg); - }); - } catch (e) { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/m3OTXk\u000a"); - } -}; - -Async.prototype._getDomain = function() {}; - -if (!true) { -if (util.isNode) { - var EventsModule = _dereq_("events"); - - var domainGetter = function() { - var domain = process.domain; - if (domain === null) return undefined; - return domain; - }; - - if (EventsModule.usingDomains) { - Async.prototype._getDomain = domainGetter; - } else { - var descriptor = - Object.getOwnPropertyDescriptor(EventsModule, "usingDomains"); - - if (descriptor) { - if (!descriptor.configurable) { - process.on("domainsActivated", function() { - Async.prototype._getDomain = domainGetter; - }); - } else { - var usingDomains = false; - Object.defineProperty(EventsModule, "usingDomains", { - configurable: false, - enumerable: true, - get: function() { - return usingDomains; - }, - set: function(value) { - if (usingDomains || !value) return; - usingDomains = true; - Async.prototype._getDomain = domainGetter; - util.toFastProperties(process); - process.emit("domainsActivated"); - } - }); - } - } - } -} -} - -function AsyncInvokeLater(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._lateQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncInvoke(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncSettlePromises(promise) { - var domain = this._getDomain(); - if (domain !== undefined) { - var fn = domain.bind(promise._settlePromises); - this._normalQueue.push(fn, promise, undefined); - } else { - this._normalQueue._pushOne(promise); - } - this._queueTick(); -} - -if (!util.hasDevTools) { - Async.prototype.invokeLater = AsyncInvokeLater; - Async.prototype.invoke = AsyncInvoke; - Async.prototype.settlePromises = AsyncSettlePromises; -} else { - Async.prototype.invokeLater = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvokeLater.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 100); - } - }; - - Async.prototype.invoke = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvoke.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 0); - } - }; - - Async.prototype.settlePromises = function(promise) { - if (this._trampolineEnabled) { - AsyncSettlePromises.call(this, promise); - } else { - setTimeout(function() { - promise._settlePromises(); - }, 0); - } - }; -} - -Async.prototype.invokeFirst = function (fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.unshift(fn, receiver, arg); - this._queueTick(); -}; - -Async.prototype._drainQueue = function(queue) { - while (queue.length() > 0) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - continue; - } - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -}; - -Async.prototype._drainQueues = function () { - this._drainQueue(this._normalQueue); - this._reset(); - this._drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = new Async(); -module.exports.firstLineError = firstLineError; - -},{"./queue.js":28,"./schedule.js":31,"./util.js":38,"events":39}],3:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise) { -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - this._setBoundTo(thisArg); - if (this._isPending()) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, ret._progress, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, ret._progress, ret, context); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 131072; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~131072); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 131072) === 131072; -}; - -Promise.bind = function (thisArg, value) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - - if (maybePromise instanceof Promise) { - maybePromise._then(function(thisArg) { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - }, ret._reject, ret._progress, ret, null); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - } - return ret; -}; -}; - -},{}],4:[function(_dereq_,module,exports){ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = _dereq_("./promise.js")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; - -},{"./promise.js":23}],5:[function(_dereq_,module,exports){ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} - -module.exports = function(Promise) { -var util = _dereq_("./util.js"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; - -var getMethodCaller; -var getGetter; -if (!true) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; - -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; - -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; - } - } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; - -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); - } - return fn; -} - -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - if (!true) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); - } - } - } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; - -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; - } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; - -},{"./util.js":38}],6:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var errors = _dereq_("./errors.js"); -var async = _dereq_("./async.js"); -var CancellationError = errors.CancellationError; - -Promise.prototype._cancel = function (reason) { - if (!this.isCancellable()) return this; - var parent; - var promiseToReject = this; - while ((parent = promiseToReject._cancellationParent) !== undefined && - parent.isCancellable()) { - promiseToReject = parent; - } - this._unsetCancellable(); - promiseToReject._target()._rejectCallback(reason, false, true); -}; - -Promise.prototype.cancel = function (reason) { - if (!this.isCancellable()) return this; - if (reason === undefined) reason = new CancellationError(); - async.invokeLater(this._cancel, this, reason); - return this; -}; - -Promise.prototype.cancellable = function () { - if (this._cancellable()) return this; - async.enableTrampoline(); - this._setCancellable(); - this._cancellationParent = undefined; - return this; -}; - -Promise.prototype.uncancellable = function () { - var ret = this.then(); - ret._unsetCancellable(); - return ret; -}; - -Promise.prototype.fork = function (didFulfill, didReject, didProgress) { - var ret = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - - ret._setCancellable(); - ret._cancellationParent = undefined; - return ret; -}; -}; - -},{"./async.js":2,"./errors.js":13}],7:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var async = _dereq_("./async.js"); -var util = _dereq_("./util.js"); -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var warn; - -function CapturedTrace(parent) { - this._parent = parent; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.parent = function() { - return this._parent; -}; - -CapturedTrace.prototype.hasParent = function() { - return this._parent !== undefined; -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = CapturedTrace.parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = stackFramePattern.test(line) || - " (No stack trace)" === line; - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0) { - stack = stack.slice(i); - } - return stack; -} - -CapturedTrace.parseStackAndMessage = function(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: cleanStack(stack) - }; -}; - -CapturedTrace.formatAndLogError = function(error, title) { - if (typeof console !== "undefined") { - var message; - if (typeof error === "object" || typeof error === "function") { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof warn === "function") { - warn(message); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -}; - -CapturedTrace.unhandledRejection = function (reason) { - CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: "); -}; - -CapturedTrace.isSupported = function () { - return typeof captureStackTrace === "function"; -}; - -CapturedTrace.fireRejectionEvent = -function(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent(name, reason, promise); - } catch (e) { - globalEventFired = true; - async.throwLater(e); - } - - var domEventFired = false; - if (fireDomEvent) { - try { - domEventFired = fireDomEvent(name.toLowerCase(), { - reason: reason, - promise: promise - }); - } catch (e) { - domEventFired = true; - async.throwLater(e); - } - } - - if (!globalEventFired && !localEventFired && !domEventFired && - name === "unhandledRejection") { - CapturedTrace.formatAndLogError(reason, "Unhandled rejection "); - } -}; - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj.toString(); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} -CapturedTrace.setBounds = function(firstLineError, lastLineError) { - if (!CapturedTrace.isSupported()) return; - var firstStackLines = firstLineError.stack.split("\n"); - var lastStackLines = lastLineError.stack.split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow) { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -var fireDomEvent; -var fireGlobalEvent = (function() { - if (util.isNode) { - return function(name, reason, promise) { - if (name === "rejectionHandled") { - return process.emit(name, promise); - } else { - return process.emit(name, reason, promise); - } - }; - } else { - var customEventWorks = false; - var anyEventWorks = true; - try { - var ev = new self.CustomEvent("test"); - customEventWorks = ev instanceof CustomEvent; - } catch (e) {} - if (!customEventWorks) { - try { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - self.dispatchEvent(event); - } catch (e) { - anyEventWorks = false; - } - } - if (anyEventWorks) { - fireDomEvent = function(type, detail) { - var event; - if (customEventWorks) { - event = new self.CustomEvent(type, { - detail: detail, - bubbles: false, - cancelable: true - }); - } else if (self.dispatchEvent) { - event = document.createEvent("CustomEvent"); - event.initCustomEvent(type, false, true, detail); - } - - return event ? !self.dispatchEvent(event) : false; - }; - } - - var toWindowMethodNameMap = {}; - toWindowMethodNameMap["unhandledRejection"] = ("on" + - "unhandledRejection").toLowerCase(); - toWindowMethodNameMap["rejectionHandled"] = ("on" + - "rejectionHandled").toLowerCase(); - - return function(name, reason, promise) { - var methodName = toWindowMethodNameMap[name]; - var method = self[methodName]; - if (!method) return false; - if (name === "rejectionHandled") { - method.call(self, promise); - } else { - method.call(self, reason, promise); - } - return true; - }; - } -})(); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - warn = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - warn = function(message) { - process.stderr.write("\u001b[31m" + message + "\u001b[39m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - warn = function(message) { - console.warn("%c" + message, "color: red"); - }; - } -} - -return CapturedTrace; -}; - -},{"./async.js":2,"./util.js":38}],8:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = _dereq_("./util.js"); -var errors = _dereq_("./errors.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var keys = _dereq_("./es5.js").keys; -var TypeError = errors.TypeError; - -function CatchFilter(instances, callback, promise) { - this._instances = instances; - this._callback = callback; - this._promise = promise; -} - -function safePredicate(predicate, e) { - var safeObject = {}; - var retfilter = tryCatch(predicate).call(safeObject, e); - - if (retfilter === errorObj) return retfilter; - - var safeKeys = keys(safeObject); - if (safeKeys.length) { - errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"); - return errorObj; - } - return retfilter; -} - -CatchFilter.prototype.doFilter = function (e) { - var cb = this._callback; - var promise = this._promise; - var boundTo = promise._boundTo; - for (var i = 0, len = this._instances.length; i < len; ++i) { - var item = this._instances[i]; - var itemIsErrorType = item === Error || - (item != null && item.prototype instanceof Error); - - if (itemIsErrorType && e instanceof item) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } else if (typeof item === "function" && !itemIsErrorType) { - var shouldHandle = safePredicate(item, e); - if (shouldHandle === errorObj) { - e = errorObj.e; - break; - } else if (shouldHandle) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } - } - } - NEXT_FILTER.e = e; - return NEXT_FILTER; -}; - -return CatchFilter; -}; - -},{"./errors.js":13,"./es5.js":14,"./util.js":38}],9:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, CapturedTrace, isDebugging) { -var contextStack = []; -function Context() { - this._trace = new CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.pop(); - } -}; - -function createContext() { - if (isDebugging()) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} - -Promise.prototype._peekContext = peekContext; -Promise.prototype._pushContext = Context.prototype._pushContext; -Promise.prototype._popContext = Context.prototype._popContext; - -return createContext; -}; - -},{}],10:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, CapturedTrace) { -var async = _dereq_("./async.js"); -var Warning = _dereq_("./errors.js").Warning; -var util = _dereq_("./util.js"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var debugging = false || (util.isNode && - (!!process.env["BLUEBIRD_DEBUG"] || - process.env["NODE_ENV"] === "development")); - -if (debugging) { - async.disableTrampolineIfNecessary(); -} - -Promise.prototype._ensurePossibleRejectionHandled = function () { - this._setRejectionIsUnhandled(); - async.invokeLater(this._notifyUnhandledRejection, this, undefined); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - CapturedTrace.fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._getCarriedStackTrace() || this._settledValue; - this._setUnhandledRejectionIsNotified(); - CapturedTrace.fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 524288; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~524288); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 524288) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 2097152; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~2097152); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 2097152) > 0; -}; - -Promise.prototype._setCarriedStackTrace = function (capturedTrace) { - this._bitField = this._bitField | 1048576; - this._fulfillmentHandler0 = capturedTrace; -}; - -Promise.prototype._isCarryingStackTrace = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._getCarriedStackTrace = function () { - return this._isCarryingStackTrace() - ? this._fulfillmentHandler0 - : undefined; -}; - -Promise.prototype._captureStackTrace = function () { - if (debugging) { - this._trace = new CapturedTrace(this._peekContext()); - } - return this; -}; - -Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { - if (debugging && canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = CapturedTrace.parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -}; - -Promise.prototype._warn = function(message) { - var warning = new Warning(message); - var ctx = this._peekContext(); - if (ctx) { - ctx.attachExtraTrace(warning); - } else { - var parsed = CapturedTrace.parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - CapturedTrace.formatAndLogError(warning, ""); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - unhandledRejectionHandled = typeof fn === "function" ? fn : undefined; -}; - -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && - debugging === false - ) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a"); - } - debugging = CapturedTrace.isSupported(); - if (debugging) { - async.disableTrampolineIfNecessary(); - } -}; - -Promise.hasLongStackTraces = function () { - return debugging && CapturedTrace.isSupported(); -}; - -if (!CapturedTrace.isSupported()) { - Promise.longStackTraces = function(){}; - debugging = false; -} - -return function() { - return debugging; -}; -}; - -},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util.js"); -var isPrimitive = util.isPrimitive; -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; - -module.exports = function(Promise) { -var returner = function () { - return this; -}; -var thrower = function () { - throw this; -}; -var returnUndefined = function() {}; -var throwUndefined = function() { - throw undefined; -}; - -var wrapper = function (value, action) { - if (action === 1) { - return function () { - throw value; - }; - } else if (action === 2) { - return function () { - return value; - }; - } -}; - - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value === undefined) return this.then(returnUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(value)) { - return this._then( - wrapper(value, 2), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(returner, undefined, undefined, value, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - if (reason === undefined) return this.then(throwUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(reason)) { - return this._then( - wrapper(reason, 1), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(thrower, undefined, undefined, reason, undefined); -}; -}; - -},{"./util.js":38}],12:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; - -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, null, INTERNAL); -}; - -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, null, INTERNAL); -}; -}; - -},{}],13:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5.js"); -var Objectfreeze = es5.freeze; -var util = _dereq_("./util.js"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; - -},{"./es5.js":14,"./util.js":38}],14:[function(_dereq_,module,exports){ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} - -},{}],15:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; - -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; - -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; - -},{}],16:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) { -var util = _dereq_("./util.js"); -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; -var isPrimitive = util.isPrimitive; -var thrower = util.thrower; - -function returnThis() { - return this; -} -function throwThis() { - throw this; -} -function return$(r) { - return function() { - return r; - }; -} -function throw$(r) { - return function() { - throw r; - }; -} -function promisedFinally(ret, reasonOrValue, isFulfilled) { - var then; - if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) { - then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue); - } else { - then = isFulfilled ? returnThis : throwThis; - } - return ret._then(then, thrower, undefined, reasonOrValue, undefined); -} - -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo) - : handler(); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, reasonOrValue, - promise.isFulfilled()); - } - } - - if (promise.isRejected()) { - NEXT_FILTER.e = reasonOrValue; - return NEXT_FILTER; - } else { - return reasonOrValue; - } -} - -function tapHandler(value) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo, value) - : handler(value); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, value, true); - } - } - return value; -} - -Promise.prototype._passThroughHandler = function (handler, isFinally) { - if (typeof handler !== "function") return this.then(); - - var promiseAndHandler = { - promise: this, - handler: handler - }; - - return this._then( - isFinally ? finallyHandler : tapHandler, - isFinally ? finallyHandler : undefined, undefined, - promiseAndHandler, undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThroughHandler(handler, true); -}; - -Promise.prototype.tap = function (handler) { - return this._passThroughHandler(handler, false); -}; -}; - -},{"./util.js":38}],17:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise) { -var errors = _dereq_("./errors.js"); -var TypeError = errors.TypeError; -var util = _dereq_("./util.js"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; - -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; - } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} - -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; -} - -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; - -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._next(undefined); -}; - -PromiseSpawn.prototype._continue = function (result) { - if (result === errorObj) { - return this._promise._rejectCallback(result.e, false, true); - } - - var value = result.value; - if (result.done === true) { - this._promise._resolveCallback(value); - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._throw( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } - } - maybePromise._then( - this._next, - this._throw, - undefined, - this, - null - ); - } -}; - -PromiseSpawn.prototype._throw = function (reason) { - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._next = function (value) { - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; - -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - spawn._generator = generator; - spawn._next(undefined); - return spawn.promise(); - }; -}; - -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - yieldHandlers.push(fn); -}; - -Promise.spawn = function (generatorFunction) { - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; - -},{"./errors.js":13,"./util.js":38}],18:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) { -var util = _dereq_("./util.js"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!true) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var caller = function(count) { - var values = []; - for (var i = 1; i <= count; ++i) values.push("holder.p" + i); - return new Function("holder", " \n\ - 'use strict'; \n\ - var callback = holder.fn; \n\ - return callback(values); \n\ - ".replace(/values/g, values.join(", "))); - }; - var thenCallbacks = []; - var callers = [undefined]; - for (var i = 1; i <= 5; ++i) { - thenCallbacks.push(thenCallback(i)); - callers.push(caller(i)); - } - - var Holder = function(total, fn) { - this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null; - this.fn = fn; - this.total = total; - this.now = 0; - }; - - Holder.prototype.callers = callers; - Holder.prototype.checkFulfillment = function(promise) { - var now = this.now; - now++; - var total = this.total; - if (now >= total) { - var handler = this.callers[total]; - promise._pushContext(); - var ret = tryCatch(handler)(this); - promise._popContext(); - if (ret === errorObj) { - promise._rejectCallback(ret.e, false, true); - } else { - promise._resolveCallback(ret); - } - } else { - this.now = now; - } - }; - - var reject = function (reason) { - this._reject(reason); - }; -} -} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!true) { - if (last < 6 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var holder = new Holder(last, fn); - var callbacks = thenCallbacks; - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - } else if (maybePromise._isFulfilled()) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else { - ret._reject(maybePromise._reason()); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - return ret; - } - } - } - var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; - -},{"./util.js":38}],19:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = _dereq_("./async.js"); -var util = _dereq_("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var PENDING = {}; -var EMPTY_ARRAY = []; - -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._callback = fn; - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = limit >= 1 ? [] : EMPTY_ARRAY; - async.invoke(init, this, undefined); -} -util.inherits(MappingPromiseArray, PromiseArray); -function init() {this._init$(undefined, -2);} - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - if (values[index] === PENDING) { - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return; - } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return; - } - if (preservedValues !== null) preservedValues[index] = value; - - var callback = this._callback; - var receiver = this._promise._boundTo; - this._promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - this._promise._popContext(); - if (ret === errorObj) return this._reject(ret.e); - - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - if (limit >= 1) this._inFlight++; - values[index] = PENDING; - return maybePromise._proxyPromiseArray(this, index); - } else if (maybePromise._isFulfilled()) { - ret = maybePromise._value(); - } else { - return this._reject(maybePromise._reason()); - } - } - values[index] = ret; - } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); - } else { - this._resolve(values); - } - - } -}; - -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); - } -}; - -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; - } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; - -function map(promises, fn, options, _filter) { - var limit = typeof options === "object" && options !== null - ? options.concurrency - : 0; - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter); -} - -Promise.prototype.map = function (fn, options) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - - return map(this, fn, options, null).promise(); -}; - -Promise.map = function (promises, fn, options, _filter) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - return map(promises, fn, options, _filter).promise(); -}; - - -}; - -},{"./async.js":2,"./util.js":38}],20:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util.js"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn, args, ctx) { - if (typeof fn !== "function") { - return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = util.isArray(args) - ? tryCatch(fn).apply(ctx, args) - : tryCatch(fn).call(ctx, args); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false, true); - } else { - this._resolveCallback(value, true); - } -}; -}; - -},{"./util.js":38}],21:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var util = _dereq_("./util.js"); -var async = _dereq_("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundTo; - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var target = promise._target(); - var newReason = target._getCarriedStackTrace(); - newReason.cause = reason; - reason = newReason; - } - var ret = tryCatch(nodeback).call(promise._boundTo, reason); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -Promise.prototype.asCallback = -Promise.prototype.nodeify = function (nodeback, options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); - } - return this; -}; -}; - -},{"./async.js":2,"./util.js":38}],22:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, PromiseArray) { -var util = _dereq_("./util.js"); -var async = _dereq_("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -Promise.prototype.progressed = function (handler) { - return this._then(undefined, undefined, handler, undefined, undefined); -}; - -Promise.prototype._progress = function (progressValue) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._target()._progressUnchecked(progressValue); - -}; - -Promise.prototype._progressHandlerAt = function (index) { - return index === 0 - ? this._progressHandler0 - : this[(index << 2) + index - 5 + 2]; -}; - -Promise.prototype._doProgressWith = function (progression) { - var progressValue = progression.value; - var handler = progression.handler; - var promise = progression.promise; - var receiver = progression.receiver; - - var ret = tryCatch(handler).call(receiver, progressValue); - if (ret === errorObj) { - if (ret.e != null && - ret.e.name !== "StopProgressPropagation") { - var trace = util.canAttachTrace(ret.e) - ? ret.e : new Error(util.toString(ret.e)); - promise._attachExtraTrace(trace); - promise._progress(ret.e); - } - } else if (ret instanceof Promise) { - ret._then(promise._progress, null, null, promise, undefined); - } else { - promise._progress(ret); - } -}; - - -Promise.prototype._progressUnchecked = function (progressValue) { - var len = this._length(); - var progress = this._progress; - for (var i = 0; i < len; i++) { - var handler = this._progressHandlerAt(i); - var promise = this._promiseAt(i); - if (!(promise instanceof Promise)) { - var receiver = this._receiverAt(i); - if (typeof handler === "function") { - handler.call(receiver, progressValue, promise); - } else if (receiver instanceof PromiseArray && - !receiver._isResolved()) { - receiver._promiseProgressed(progressValue, promise); - } - continue; - } - - if (typeof handler === "function") { - async.invoke(this._doProgressWith, this, { - handler: handler, - promise: promise, - receiver: this._receiverAt(i), - value: progressValue - }); - } else { - async.invoke(progress, promise, progressValue); - } - } -}; -}; - -},{"./async.js":2,"./util.js":38}],23:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a"); -}; -var reflect = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -var util = _dereq_("./util.js"); -var async = _dereq_("./async.js"); -var errors = _dereq_("./errors.js"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {e: null}; -var tryConvertToPromise = _dereq_("./thenables.js")(Promise, INTERNAL); -var PromiseArray = - _dereq_("./promise_array.js")(Promise, INTERNAL, - tryConvertToPromise, apiRejection); -var CapturedTrace = _dereq_("./captured_trace.js")(); -var isDebugging = _dereq_("./debuggability.js")(Promise, CapturedTrace); - /*jshint unused:false*/ -var createContext = - _dereq_("./context.js")(Promise, CapturedTrace, isDebugging); -var CatchFilter = _dereq_("./catch_filter.js")(NEXT_FILTER); -var PromiseResolver = _dereq_("./promise_resolver.js"); -var nodebackForPromise = PromiseResolver._nodebackForPromise; -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function Promise(resolver) { - if (typeof resolver !== "function") { - throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a"); - } - if (this.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a"); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._progressHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._settledValue = undefined; - if (resolver !== INTERNAL) this._resolveFromResolver(resolver); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (typeof item === "function") { - catchInstances[j++] = item; - } else { - return Promise.reject( - new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a")); - } - } - catchInstances.length = j; - fn = arguments[i]; - var catchFilter = new CatchFilter(catchInstances, fn, this); - return this._then(undefined, catchFilter.doFilter, undefined, - catchFilter, undefined); - } - return this._then(undefined, fn, undefined, undefined, undefined); -}; - -Promise.prototype.reflect = function () { - return this._then(reflect, reflect, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject, didProgress) { - if (isDebugging() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, didProgress, - undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject, didProgress) { - var promise = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (didFulfill, didReject) { - return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined); -}; - -Promise.prototype.isCancellable = function () { - return !this.isResolved() && - this._cancellable(); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = function(fn) { - var ret = new Promise(INTERNAL); - var result = tryCatch(fn)(nodebackForPromise(ret)); - if (result === errorObj) { - ret._rejectCallback(result.e, true, true); - } - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.defer = Promise.pending = function () { - var promise = new Promise(INTERNAL); - return new PromiseResolver(promise); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - var val = ret; - ret = new Promise(INTERNAL); - ret._fulfillUnchecked(val); - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - var prev = async._schedule; - async._schedule = fn; - return prev; -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - didProgress, - receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var ret = haveInternalData ? internalData : new Promise(INTERNAL); - - if (!haveInternalData) { - ret._propagateFrom(this, 4 | 1); - ret._captureStackTrace(); - } - - var target = this._target(); - if (target !== this) { - if (receiver === undefined) receiver = this._boundTo; - if (!haveInternalData) ret._setIsMigrated(); - } - - var callbackIndex = - target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver); - - if (target._isResolved() && !target._isSettlePromisesQueued()) { - async.invoke( - target._settlePromiseAtPostResolution, target, callbackIndex); - } - - return ret; -}; - -Promise.prototype._settlePromiseAtPostResolution = function (index) { - if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled(); - this._settlePromiseAt(index); -}; - -Promise.prototype._length = function () { - return this._bitField & 131071; -}; - -Promise.prototype._isFollowingOrFulfilledOrRejected = function () { - return (this._bitField & 939524096) > 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 536870912) === 536870912; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -131072) | - (len & 131071); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 134217728; -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 536870912; -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 33554432; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 33554432) > 0; -}; - -Promise.prototype._cancellable = function () { - return (this._bitField & 67108864) > 0; -}; - -Promise.prototype._setCancellable = function () { - this._bitField = this._bitField | 67108864; -}; - -Promise.prototype._unsetCancellable = function () { - this._bitField = this._bitField & (~67108864); -}; - -Promise.prototype._setIsMigrated = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._unsetIsMigrated = function () { - this._bitField = this._bitField & (~4194304); -}; - -Promise.prototype._isMigrated = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 - ? this._receiver0 - : this[ - index * 5 - 5 + 4]; - if (ret === undefined && this._isBound()) { - return this._boundTo; - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return index === 0 - ? this._promise0 - : this[index * 5 - 5 + 3]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return index === 0 - ? this._fulfillmentHandler0 - : this[index * 5 - 5 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return index === 0 - ? this._rejectionHandler0 - : this[index * 5 - 5 + 1]; -}; - -Promise.prototype._migrateCallbacks = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var progress = follower._progressHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (promise instanceof Promise) promise._setIsMigrated(); - this._addCallbacks(fulfill, reject, progress, promise, receiver); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - progress, - promise, - receiver -) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - if (receiver !== undefined) this._receiver0 = receiver; - if (typeof fulfill === "function" && !this._isCarryingStackTrace()) - this._fulfillmentHandler0 = fulfill; - if (typeof reject === "function") this._rejectionHandler0 = reject; - if (typeof progress === "function") this._progressHandler0 = progress; - } else { - var base = index * 5 - 5; - this[base + 3] = promise; - this[base + 4] = receiver; - if (typeof fulfill === "function") - this[base + 0] = fulfill; - if (typeof reject === "function") - this[base + 1] = reject; - if (typeof progress === "function") - this[base + 2] = progress; - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - if (index === 0) { - this._promise0 = promiseSlotValue; - this._receiver0 = receiver; - } else { - var base = index * 5 - 5; - this[base + 3] = promiseSlotValue; - this[base + 4] = receiver; - } - this._setLength(index + 1); -}; - -Promise.prototype._proxyPromiseArray = function (promiseArray, index) { - this._setProxyHandlers(promiseArray, index); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (this._isFollowingOrFulfilledOrRejected()) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false, true); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - var propagationFlags = 1 | (shouldBind ? 4 : 0); - this._propagateFrom(maybePromise, propagationFlags); - var promise = maybePromise._target(); - if (promise._isPending()) { - var len = this._length(); - for (var i = 0; i < len; ++i) { - promise._migrateCallbacks(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(promise); - } else if (promise._isFulfilled()) { - this._fulfillUnchecked(promise._value()); - } else { - this._rejectUnchecked(promise._reason(), - promise._getCarriedStackTrace()); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, shouldNotMarkOriginatingFromRejection) { - if (!shouldNotMarkOriginatingFromRejection) { - util.markAsOriginatingFromRejection(reason); - } - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason, hasStack ? undefined : trace); -}; - -Promise.prototype._resolveFromResolver = function (resolver) { - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = tryCatch(resolver)(function(value) { - if (promise === null) return; - promise._resolveCallback(value); - promise = null; - }, function (reason) { - if (promise === null) return; - promise._rejectCallback(reason, synchronous); - promise = null; - }); - synchronous = false; - this._popContext(); - - if (r !== undefined && r === errorObj && promise !== null) { - promise._rejectCallback(r.e, true, true); - promise = null; - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - if (promise._isRejected()) return; - promise._pushContext(); - var x; - if (receiver === APPLY && !this._isRejected()) { - x = tryCatch(handler).apply(this._boundTo, value); - } else { - x = tryCatch(handler).call(receiver, value); - } - promise._popContext(); - - if (x === errorObj || x === promise || x === NEXT_FILTER) { - var err = x === promise ? makeSelfResolutionError() : x.e; - promise._rejectCallback(err, false, true); - } else { - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._cleanValues = function () { - if (this._cancellable()) { - this._cancellationParent = undefined; - } -}; - -Promise.prototype._propagateFrom = function (parent, flags) { - if ((flags & 1) > 0 && parent._cancellable()) { - this._setCancellable(); - this._cancellationParent = parent; - } - if ((flags & 4) > 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -}; - -Promise.prototype._fulfill = function (value) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._fulfillUnchecked(value); -}; - -Promise.prototype._reject = function (reason, carriedStackTrace) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._rejectUnchecked(reason, carriedStackTrace); -}; - -Promise.prototype._settlePromiseAt = function (index) { - var promise = this._promiseAt(index); - var isPromise = promise instanceof Promise; - - if (isPromise && promise._isMigrated()) { - promise._unsetIsMigrated(); - return async.invoke(this._settlePromiseAt, this, index); - } - var handler = this._isFulfilled() - ? this._fulfillmentHandlerAt(index) - : this._rejectionHandlerAt(index); - - var carriedStackTrace = - this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined; - var value = this._settledValue; - var receiver = this._receiverAt(index); - - - this._clearCallbackDataAtIndex(index); - - if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof PromiseArray) { - if (!receiver._isResolved()) { - if (this._isFulfilled()) { - receiver._promiseFulfilled(value, promise); - } - else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (this._isFulfilled()) { - promise._fulfill(value); - } else { - promise._reject(value, carriedStackTrace); - } - } - - if (index >= 4 && (index & 31) === 4) - async.invokeLater(this._setLength, this, 0); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - if (index === 0) { - if (!this._isCarryingStackTrace()) { - this._fulfillmentHandler0 = undefined; - } - this._rejectionHandler0 = - this._progressHandler0 = - this._receiver0 = - this._promise0 = undefined; - } else { - var base = index * 5 - 5; - this[base + 3] = - this[base + 4] = - this[base + 0] = - this[base + 1] = - this[base + 2] = undefined; - } -}; - -Promise.prototype._isSettlePromisesQueued = function () { - return (this._bitField & - -1073741824) === -1073741824; -}; - -Promise.prototype._setSettlePromisesQueued = function () { - this._bitField = this._bitField | -1073741824; -}; - -Promise.prototype._unsetSettlePromisesQueued = function () { - this._bitField = this._bitField & (~-1073741824); -}; - -Promise.prototype._queueSettlePromises = function() { - async.settlePromises(this); - this._setSettlePromisesQueued(); -}; - -Promise.prototype._fulfillUnchecked = function (value) { - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err, undefined); - } - this._setFulfilled(); - this._settledValue = value; - this._cleanValues(); - - if (this._length() > 0) { - this._queueSettlePromises(); - } -}; - -Promise.prototype._rejectUncheckedCheckError = function (reason) { - var trace = util.ensureErrorObject(reason); - this._rejectUnchecked(reason, trace === reason ? undefined : trace); -}; - -Promise.prototype._rejectUnchecked = function (reason, trace) { - if (reason === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err); - } - this._setRejected(); - this._settledValue = reason; - this._cleanValues(); - - if (this._isFinal()) { - async.throwLater(function(e) { - if ("stack" in e) { - async.invokeFirst( - CapturedTrace.unhandledRejection, undefined, e); - } - throw e; - }, trace === undefined ? reason : trace); - return; - } - - if (trace !== undefined && trace !== reason) { - this._setCarriedStackTrace(trace); - } - - if (this._length() > 0) { - this._queueSettlePromises(); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._settlePromises = function () { - this._unsetSettlePromisesQueued(); - var len = this._length(); - for (var i = 0; i < len; i++) { - this._settlePromiseAt(i); - } -}; - -Promise._makeSelfResolutionError = makeSelfResolutionError; -_dereq_("./progress.js")(Promise, PromiseArray); -_dereq_("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection); -_dereq_("./bind.js")(Promise, INTERNAL, tryConvertToPromise); -_dereq_("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise); -_dereq_("./direct_resolve.js")(Promise); -_dereq_("./synchronous_inspection.js")(Promise); -_dereq_("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL); -Promise.Promise = Promise; -_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -_dereq_('./cancel.js')(Promise); -_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext); -_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise); -_dereq_('./nodeify.js')(Promise); -_dereq_('./call_get.js')(Promise); -_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -_dereq_('./settle.js')(Promise, PromiseArray); -_dereq_('./some.js')(Promise, PromiseArray, apiRejection); -_dereq_('./promisify.js')(Promise, INTERNAL); -_dereq_('./any.js')(Promise); -_dereq_('./each.js')(Promise, INTERNAL); -_dereq_('./timers.js')(Promise, INTERNAL); -_dereq_('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._progressHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - p._settledValue = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - CapturedTrace.setBounds(async.firstLineError, util.lastLineError); - return Promise; - -}; - -},{"./any.js":1,"./async.js":2,"./bind.js":3,"./call_get.js":5,"./cancel.js":6,"./captured_trace.js":7,"./catch_filter.js":8,"./context.js":9,"./debuggability.js":10,"./direct_resolve.js":11,"./each.js":12,"./errors.js":13,"./filter.js":15,"./finally.js":16,"./generators.js":17,"./join.js":18,"./map.js":19,"./method.js":20,"./nodeify.js":21,"./progress.js":22,"./promise_array.js":24,"./promise_resolver.js":25,"./promisify.js":26,"./props.js":27,"./race.js":29,"./reduce.js":30,"./settle.js":32,"./some.js":33,"./synchronous_inspection.js":34,"./thenables.js":35,"./timers.js":36,"./using.js":37,"./util.js":38}],24:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection) { -var util = _dereq_("./util.js"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - var parent; - if (values instanceof Promise) { - parent = values; - promise._propagateFrom(parent, 1 | 4); - } - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - this._values = values; - if (values._isFulfilled()) { - values = values._value(); - if (!isArray(values)) { - var err = new Promise.TypeError("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - this.__hardReject__(err); - return; - } - } else if (values._isPending()) { - values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - return; - } else { - this._reject(values._reason()); - return; - } - } else if (!isArray(values)) { - this._promise._reject(apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a")._reason()); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var promise = this._promise; - for (var i = 0; i < len; ++i) { - var isResolved = this._isResolved(); - var maybePromise = tryConvertToPromise(values[i], promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (isResolved) { - maybePromise._unsetRejectionIsUnhandled(); - } else if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, i); - } else if (maybePromise._isFulfilled()) { - this._promiseFulfilled(maybePromise._value(), i); - } else { - this._promiseRejected(maybePromise._reason(), i); - } - } else if (!isResolved) { - this._promiseFulfilled(maybePromise, i); - } - } -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype.__hardReject__ = -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false, true); -}; - -PromiseArray.prototype._promiseProgressed = function (progressValue, index) { - this._promise._progress({ - index: index, - value: progressValue - }); -}; - - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -PromiseArray.prototype._promiseRejected = function (reason, index) { - this._totalResolved++; - this._reject(reason); -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; - -},{"./util.js":38}],25:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util.js"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = _dereq_("./errors.js"); -var TimeoutError = errors.TimeoutError; -var OperationalError = errors.OperationalError; -var haveGetters = util.haveGetters; -var es5 = _dereq_("./es5.js"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise) { - return function(err, value) { - if (promise === null) return; - - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (arguments.length > 2) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - promise._fulfill(args); - } else { - promise._fulfill(value); - } - - promise = null; - }; -} - - -var PromiseResolver; -if (!haveGetters) { - PromiseResolver = function (promise) { - this.promise = promise; - this.asCallback = nodebackForPromise(promise); - this.callback = this.asCallback; - }; -} -else { - PromiseResolver = function (promise) { - this.promise = promise; - }; -} -if (haveGetters) { - var prop = { - get: function() { - return nodebackForPromise(this.promise); - } - }; - es5.defineProperty(PromiseResolver.prototype, "asCallback", prop); - es5.defineProperty(PromiseResolver.prototype, "callback", prop); -} - -PromiseResolver._nodebackForPromise = nodebackForPromise; - -PromiseResolver.prototype.toString = function () { - return "[object PromiseResolver]"; -}; - -PromiseResolver.prototype.resolve = -PromiseResolver.prototype.fulfill = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._resolveCallback(value); -}; - -PromiseResolver.prototype.reject = function (reason) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._rejectCallback(reason); -}; - -PromiseResolver.prototype.progress = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._progress(value); -}; - -PromiseResolver.prototype.cancel = function (err) { - this.promise.cancel(err); -}; - -PromiseResolver.prototype.timeout = function () { - this.reject(new TimeoutError("timeout")); -}; - -PromiseResolver.prototype.isResolved = function () { - return this.promise.isResolved(); -}; - -PromiseResolver.prototype.toJSON = function () { - return this.promise.toJSON(); -}; - -module.exports = PromiseResolver; - -},{"./errors.js":13,"./es5.js":14,"./util.js":38}],26:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = _dereq_("./util.js"); -var nodebackForPromise = _dereq_("./promise_resolver.js") - ._nodebackForPromise; -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = _dereq_("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyPropsPattern = - /^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/; -var defaultFilter = function(name, func) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - !util.isClass(func); -}; - -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} - -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} - -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/iWrZbw\u000a" - .replace("%s", suffix)); - } - } - } - } -} - -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} - -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; - -var makeNodePromisifiedEval; -if (!true) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; - -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; - -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; - -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; - -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; - - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); - } - - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } - - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; - } - - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "INTERNAL","'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - return promise; \n\ - }; \n\ - ret.__isPromisified__ = true; \n\ - return ret; \n\ - " - .replace("Parameters", parameterDeclaration(newParameterCount)) - .replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode))( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - INTERNAL - ); -}; -} - -function makeNodePromisifiedClosure(callback, receiver, _, fn) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; - } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - return promise; - } - promisified.__isPromisified__ = true; - return promisified; -} - -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; - -function promisifyAll(obj, suffix, filter, promisifier) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); - - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - obj[promisifiedKey] = promisifier === makeNodePromisified - ? makeNodePromisified(key, THIS, key, fn, suffix) - : promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, fn, suffix); - }); - } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver) { - return makeNodePromisified(callback, receiver, undefined, callback); -} - -Promise.promisify = function (fn, receiver) { - if (typeof fn !== "function") { - throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - if (isPromisified(fn)) { - return fn; - } - var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/9ITlV0\u000a"); - } - options = Object(options); - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; - - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/8FZo5V\u000a"); - } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier); - promisifyAll(value, suffix, filter, promisifier); - } - } - - return promisifyAll(target, suffix, filter, promisifier); -}; -}; - - -},{"./errors":13,"./promise_resolver.js":25,"./util.js":38}],27:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util.js"); -var isObject = util.isObject; -var es5 = _dereq_("./es5.js"); - -function PropertiesPromiseArray(obj) { - var keys = es5.keys(obj); - var len = keys.length; - var values = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - values[i] = obj[key]; - values[i + len] = key; - } - this.constructor$(values); -} -util.inherits(PropertiesPromiseArray, PromiseArray); - -PropertiesPromiseArray.prototype._init = function () { - this._init$(undefined, -3) ; -}; - -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - this._resolve(val); - } -}; - -PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { - this._promise._progress({ - key: this._values[index + this.length()], - value: value - }); -}; - -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; - -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); - - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/OsFKC8\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } - - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 4); - } - return ret; -} - -Promise.prototype.props = function () { - return props(this); -}; - -Promise.props = function (promises) { - return props(promises); -}; -}; - -},{"./es5.js":14,"./util.js":38}],28:[function(_dereq_,module,exports){ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype._unshiftOne = function(value) { - var capacity = this._capacity; - this._checkCapacity(this.length() + 1); - var front = this._front; - var i = (((( front - 1 ) & - ( capacity - 1) ) ^ capacity ) - capacity ); - this[i] = value; - this._front = i; - this._length = this.length() + 1; -}; - -Queue.prototype.unshift = function(fn, receiver, arg) { - this._unshiftOne(arg); - this._unshiftOne(receiver); - this._unshiftOne(fn); -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; - -},{}],29:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var isArray = _dereq_("./util.js").isArray; - -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; - -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); - - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else if (!isArray(promises)) { - return apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - } - - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 4 | 1); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; - - if (val === undefined && !(i in promises)) { - continue; - } - - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} - -Promise.race = function (promises) { - return race(promises, undefined); -}; - -Promise.prototype.race = function () { - return race(this, undefined); -}; - -}; - -},{"./util.js":38}],30:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = _dereq_("./async.js"); -var util = _dereq_("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -function ReductionPromiseArray(promises, fn, accum, _each) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._preservedValues = _each === INTERNAL ? [] : null; - this._zerothIsAccum = (accum === undefined); - this._gotAccum = false; - this._reducingIndex = (this._zerothIsAccum ? 1 : 0); - this._valuesPhase = undefined; - var maybePromise = tryConvertToPromise(accum, this._promise); - var rejected = false; - var isPromise = maybePromise instanceof Promise; - if (isPromise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, -1); - } else if (maybePromise._isFulfilled()) { - accum = maybePromise._value(); - this._gotAccum = true; - } else { - this._reject(maybePromise._reason()); - rejected = true; - } - } - if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true; - this._callback = fn; - this._accum = accum; - if (!rejected) async.invoke(init, this, undefined); -} -function init() { - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); - -ReductionPromiseArray.prototype._init = function () {}; - -ReductionPromiseArray.prototype._resolveEmptyArray = function () { - if (this._gotAccum || this._zerothIsAccum) { - this._resolve(this._preservedValues !== null - ? [] : this._accum); - } -}; - -ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - values[index] = value; - var length = this.length(); - var preservedValues = this._preservedValues; - var isEach = preservedValues !== null; - var gotAccum = this._gotAccum; - var valuesPhase = this._valuesPhase; - var valuesPhaseIndex; - if (!valuesPhase) { - valuesPhase = this._valuesPhase = new Array(length); - for (valuesPhaseIndex=0; valuesPhaseIndex 10) || (version[0] > 0) - ? function(fn) { global.setImmediate(fn); } : process.nextTick; - - if (!schedule) { - if (typeof setImmediate !== "undefined") { - schedule = setImmediate; - } else if (typeof setTimeout !== "undefined") { - schedule = setTimeout; - } else { - schedule = noAsyncScheduler; - } - } -} else if (typeof MutationObserver !== "undefined") { - schedule = function(fn) { - var div = document.createElement("div"); - var observer = new MutationObserver(fn); - observer.observe(div, {attributes: true}); - return function() { div.classList.toggle("foo"); }; - }; - schedule.isStatic = true; -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; - -},{"./util.js":38}],32:[function(_dereq_,module,exports){ -"use strict"; -module.exports = - function(Promise, PromiseArray) { -var PromiseInspection = Promise.PromiseInspection; -var util = _dereq_("./util.js"); - -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); - -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 268435456; - ret._settledValue = value; - this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 134217728; - ret._settledValue = reason; - this._promiseResolved(index, ret); -}; - -Promise.settle = function (promises) { - return new SettledPromiseArray(promises).promise(); -}; - -Promise.prototype.settle = function () { - return new SettledPromiseArray(this).promise(); -}; -}; - -},{"./util.js":38}],33:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = _dereq_("./util.js"); -var RangeError = _dereq_("./errors.js").RangeError; -var AggregateError = _dereq_("./errors.js").AggregateError; -var isArray = util.isArray; - - -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); - -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; - -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; - -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; - -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; - -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; - -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - } - -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - e.push(this._values[i]); - } - this._reject(e); - } -}; - -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; - -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; - -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; - -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; - -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; - -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; - -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; - -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/1wAmHx\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} - -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; - -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; - -Promise._SomePromiseArray = SomePromiseArray; -}; - -},{"./errors.js":13,"./util.js":38}],34:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValue = promise._settledValue; - } - else { - this._bitField = 0; - this._settledValue = undefined; - } -} - -PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.isFulfilled = -Promise.prototype._isFulfilled = function () { - return (this._bitField & 268435456) > 0; -}; - -PromiseInspection.prototype.isRejected = -Promise.prototype._isRejected = function () { - return (this._bitField & 134217728) > 0; -}; - -PromiseInspection.prototype.isPending = -Promise.prototype._isPending = function () { - return (this._bitField & 402653184) === 0; -}; - -PromiseInspection.prototype.isResolved = -Promise.prototype._isResolved = function () { - return (this._bitField & 402653184) > 0; -}; - -Promise.prototype.isPending = function() { - return this._target()._isPending(); -}; - -Promise.prototype.isRejected = function() { - return this._target()._isRejected(); -}; - -Promise.prototype.isFulfilled = function() { - return this._target()._isFulfilled(); -}; - -Promise.prototype.isResolved = function() { - return this._target()._isResolved(); -}; - -Promise.prototype._value = function() { - return this._settledValue; -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue; -}; - -Promise.prototype.value = function() { - var target = this._target(); - if (!target.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return target._settledValue; -}; - -Promise.prototype.reason = function() { - var target = this._target(); - if (!target.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - target._unsetRejectionIsUnhandled(); - return target._settledValue; -}; - - -Promise.PromiseInspection = PromiseInspection; -}; - -},{}],35:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util.js"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) { - return obj; - } - else if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfillUnchecked, - ret._rejectUncheckedCheckError, - ret._progressUnchecked, - ret, - null - ); - return ret; - } - var then = util.tryCatch(getThen)(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - return doThenable(obj, then, context); - } - } - return obj; -} - -function getThen(obj) { - return obj.then; -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - return hasProp.call(obj, "_promise0"); -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, - resolveFromThenable, - rejectFromThenable, - progressFromThenable); - synchronous = false; - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolveFromThenable(value) { - if (!promise) return; - if (x === value) { - promise._rejectCallback( - Promise._makeSelfResolutionError(), false, true); - } else { - promise._resolveCallback(value); - } - promise = null; - } - - function rejectFromThenable(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - - function progressFromThenable(value) { - if (!promise) return; - if (typeof promise._progress === "function") { - promise._progress(value); - } - } - return ret; -} - -return tryConvertToPromise; -}; - -},{"./util.js":38}],36:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util.js"); -var TimeoutError = Promise.TimeoutError; - -var afterTimeout = function (promise, message) { - if (!promise.isPending()) return; - if (typeof message !== "string") { - message = "operation timed out"; - } - var err = new TimeoutError(message); - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._cancel(err); -}; - -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (value, ms) { - if (ms === undefined) { - ms = value; - value = undefined; - var ret = new Promise(INTERNAL); - setTimeout(function() { ret._fulfill(); }, ms); - return ret; - } - ms = +ms; - return Promise.resolve(value)._then(afterValue, null, null, ms, undefined); -}; - -Promise.prototype.delay = function (ms) { - return delay(this, ms); -}; - -function successClear(value) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - return value; -} - -function failureClear(reason) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - throw reason; -} - -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret = this.then().cancellable(); - ret._cancellationParent = this; - var handle = setTimeout(function timeoutTimeout() { - afterTimeout(ret, message); - }, ms); - return ret._then(successClear, failureClear, undefined, handle, undefined); -}; - -}; - -},{"./util.js":38}],37:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext) { - var TypeError = _dereq_("./errors.js").TypeError; - var inherits = _dereq_("./util.js").inherits; - var PromiseInspection = Promise.PromiseInspection; - - function inspectionMapper(inspections) { - var len = inspections.length; - for (var i = 0; i < len; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - return Promise.reject(inspection.error()); - } - inspections[i] = inspection._settledValue; - } - return inspections; - } - - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } - - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = Promise.defer(); - function iterator() { - if (i >= len) return ret.resolve(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); - } - } - iterator(); - } - iterator(); - return ret.promise; - } - - function disposerSuccess(value) { - var inspection = new PromiseInspection(); - inspection._settledValue = value; - inspection._bitField = 268435456; - return dispose(this, inspection).thenReturn(value); - } - - function disposerFail(reason) { - var inspection = new PromiseInspection(); - inspection._settledValue = reason; - inspection._bitField = 134217728; - return dispose(this, inspection).thenThrow(reason); - } - - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } - - Disposer.prototype.data = function () { - return this._data; - }; - - Disposer.prototype.promise = function () { - return this._promise; - }; - - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return null; - }; - - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== null - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; - - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; - - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); - - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; - - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } - - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - len--; - var resources = new Array(len); - for (var i = 0; i < len; ++i) { - var resource = arguments[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } - - var promise = Promise.settle(resources) - .then(inspectionMapper) - .then(function(vals) { - promise._pushContext(); - var ret; - try { - ret = fn.apply(undefined, vals); - } finally { - promise._popContext(); - } - return ret; - }) - ._then( - disposerSuccess, disposerFail, undefined, resources, undefined); - resources.promise = promise; - return promise; - }; - - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 262144; - this._disposer = disposer; - }; - - Promise.prototype._isDisposable = function () { - return (this._bitField & 262144) > 0; - }; - - Promise.prototype._getDisposer = function () { - return this._disposer; - }; - - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~262144); - this._disposer = undefined; - }; - - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; - -}; - -},{"./errors.js":13,"./util.js":38}],38:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5.js"); -var canEvaluate = typeof navigator == "undefined"; -var haveGetters = (function(){ - try { - var o = {}; - es5.defineProperty(o, "f", { - get: function () { - return 3; - } - }); - return o.f === 3; - } - catch (e) { - return false; - } - -})(); - -var errorObj = {e: {}}; -var tryCatchTarget; -function tryCatcher() { - try { - return tryCatchTarget.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return !isPrimitive(value); -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - - -var wrapsPrimitiveReceiver = (function() { - return this !== "string"; -}).call("string"); - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - if (es5.isES5) { - var oProto = Object.prototype; - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && obj !== oProto) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - return function(obj) { - var ret = []; - /*jshint forin:false */ - for (var key in obj) { - ret.push(key); - } - return ret; - }; - } - -})(); - -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - if (es5.isES5) return keys.length > 1; - return keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function f() {} - f.prototype = obj; - var l = 8; - while (l--) new f(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return obj instanceof Error && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } - } -} - -var ret = { - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - haveGetters: haveGetters, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - wrapsPrimitiveReceiver: wrapsPrimitiveReceiver, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - hasDevTools: typeof chrome !== "undefined" && chrome && - typeof chrome.loadTimes === "function", - isNode: typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]" -}; -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; - -},{"./es5.js":14}],39:[function(_dereq_,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; - -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - - if (!this._events) - this._events = {}; - - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } - throw TypeError('Uncaught, unspecified "error" event.'); - } - } - - handler = this._events[type]; - - if (isUndefined(handler)) - return false; - - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - handler.apply(this, args); - } - } else if (isObject(handler)) { - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - - return true; -}; - -EventEmitter.prototype.addListener = function(type, listener) { - var m; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events) - this._events = {}; - - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); - - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - var m; - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } - - return this; -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - var fired = false; - - function g() { - this.removeListener(type, g); - - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - - g.listener = listener; - this.on(type, g); - - return this; -}; - -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events || !this._events[type]) - return this; - - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; - } - } - - if (position < 0) - return this; - - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } - - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } - - return this; -}; - -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; - - if (!this._events) - return this; - - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } - - listeners = this._events[type]; - - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; - - return this; -}; - -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; - -EventEmitter.listenerCount = function(emitter, type) { - var ret; - if (!emitter._events || !emitter._events[type]) - ret = 0; - else if (isFunction(emitter._events[type])) - ret = 1; - else - ret = emitter._events[type].length; - return ret; -}; - -function isFunction(arg) { - return typeof arg === 'function'; -} - -function isNumber(arg) { - return typeof arg === 'number'; -} - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} - -function isUndefined(arg) { - return arg === void 0; -} - -},{}]},{},[4])(4) -}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js deleted file mode 100644 index 679f7780..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js +++ /dev/null @@ -1,31 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2014 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 2.9.26 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, cancel, using, filter, any, each, timers -*/ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,r;return function n(t,e,r){function i(s,a){if(!e[s]){if(!t[s]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r?r:e)},l,l.exports,n,t,e,r)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0},r.prototype.throwLater=function(t,e){1===arguments.length&&(e=t,t=function(){throw e});var r=this._getDomain();if(void 0!==r&&(t=r.bind(t)),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")}},r.prototype._getDomain=function(){};l.hasDevTools?(r.prototype.invokeLater=function(t,e,r){this._trampolineEnabled?n.call(this,t,e,r):setTimeout(function(){t.call(e,r)},100)},r.prototype.invoke=function(t,e,r){this._trampolineEnabled?i.call(this,t,e,r):setTimeout(function(){t.call(e,r)},0)},r.prototype.settlePromises=function(t){this._trampolineEnabled?o.call(this,t):setTimeout(function(){t._settlePromises()},0)}):(r.prototype.invokeLater=n,r.prototype.invoke=i,r.prototype.settlePromises=o),r.prototype.invokeFirst=function(t,e,r){var n=this._getDomain();void 0!==n&&(t=n.bind(t)),this._normalQueue.unshift(t,e,r),this._queueTick()},r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var r=t.shift(),n=t.shift();e.call(r,n)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=new r,e.exports.firstLineError=s},{"./queue.js":28,"./schedule.js":31,"./util.js":38,events:39}],3:[function(t,e){"use strict";e.exports=function(t,e,r){var n=function(t,e){this._reject(e)},i=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(n,n,null,this,t)},o=function(t,e){this._setBoundTo(t),this._isPending()&&this._resolveCallback(e.target)},s=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(n){var a=r(n),u=new t(e);u._propagateFrom(this,1);var c=this._target();if(a instanceof t){var l={promiseRejectionQueued:!1,promise:u,target:c,bindingPromise:a};c._then(e,i,u._progress,u,l),a._then(o,s,u._progress,u,l)}else u._setBoundTo(n),u._resolveCallback(c);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=131072|this._bitField,this._boundTo=t):this._bitField=-131073&this._bitField},t.prototype._isBound=function(){return 131072===(131072&this._bitField)},t.bind=function(n,i){var o=r(n),s=new t(e);return o instanceof t?o._then(function(t){s._setBoundTo(t),s._resolveCallback(i)},s._reject,s._progress,s,null):(s._setBoundTo(n),s._resolveCallback(i)),s}}},{}],4:[function(t,e){"use strict";function r(){try{Promise===i&&(Promise=n)}catch(t){}return i}var n;"undefined"!=typeof Promise&&(n=Promise);var i=t("./promise.js")();i.noConflict=r,e.exports=i},{"./promise.js":23}],5:[function(t,e){"use strict";var r=Object.create;if(r){var n=r(null),i=r(null);n[" size"]=i[" size"]=0}e.exports=function(e){function r(t,r){var n;if(null!=t&&(n=t[r]),"function"!=typeof n){var i="Object "+a.classString(t)+" has no method '"+a.toString(r)+"'";throw new e.TypeError(i)}return n}function n(t){var e=this.pop(),n=r(t,e);return n.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}{var s,a=t("./util.js"),u=a.canEvaluate;a.isIdentifier}e.prototype.call=function(t){for(var e=arguments.length,r=new Array(e-1),i=1;e>i;++i)r[i-1]=arguments[i];return r.push(t),this._then(n,void 0,void 0,r,void 0)},e.prototype.get=function(t){var e,r="number"==typeof t;if(r)e=o;else if(u){var n=s(t);e=null!==n?n:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util.js":38}],6:[function(t,e){"use strict";e.exports=function(e){var r=t("./errors.js"),n=t("./async.js"),i=r.CancellationError;e.prototype._cancel=function(t){if(!this.isCancellable())return this;for(var e,r=this;void 0!==(e=r._cancellationParent)&&e.isCancellable();)r=e;this._unsetCancellable(),r._target()._rejectCallback(t,!1,!0)},e.prototype.cancel=function(t){return this.isCancellable()?(void 0===t&&(t=new i),n.invokeLater(this._cancel,this,t),this):this},e.prototype.cancellable=function(){return this._cancellable()?this:(n.enableTrampoline(),this._setCancellable(),this._cancellationParent=void 0,this)},e.prototype.uncancellable=function(){var t=this.then();return t._unsetCancellable(),t},e.prototype.fork=function(t,e,r){var n=this._then(t,e,r,void 0,void 0);return n._setCancellable(),n._cancellationParent=void 0,n}}},{"./async.js":2,"./errors.js":13}],7:[function(t,e){"use strict";e.exports=function(){function e(t){this._parent=t;var r=this._length=1+(void 0===t?0:t._length);j(this,e),r>32&&this.uncycle()}function r(t,e){for(var r=0;r=0;--a)if(n[a]===o){s=a;break}for(var a=s;a>=0;--a){var u=n[a];if(e[i]!==u)break;e.pop(),i--}e=n}}function o(t){for(var e=[],r=0;r0&&(e=e.slice(r)),e}function a(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t.toString();var r=/\[object [a-zA-Z0-9$_]+\]/;if(r.test(e))try{var n=JSON.stringify(t);e=n}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+u(e)+">, no stack trace)"}function u(t){var e=41;return t.lengtht)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;t=this._length=n;for(var n=t-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(var n=0;t>n;++n){var s=e[n].stack,a=r[s];if(void 0!==a&&a!==n){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var u=n>0?e[n-1]:this;t-1>a?(u._parent=e[a+1],u._parent.uncycle(),u._length=u._parent._length+1):(u._parent=void 0,u._length=1);for(var c=u._length+1,l=n-2;l>=0;--l)e[l]._length=c,c++;return}}}},e.prototype.parent=function(){return this._parent},e.prototype.hasParent=function(){return void 0!==this._parent},e.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var s=e.parseStackAndMessage(t),a=s.message,u=[s.stack],c=this;void 0!==c;)u.push(o(c.stack.split("\n"))),c=c._parent;i(u),n(u),p.notEnumerableProp(t,"stack",r(a,u)),p.notEnumerableProp(t,"__stackCleaned__",!0)}},e.parseStackAndMessage=function(t){var e=t.stack,r=t.toString();return e="string"==typeof e&&e.length>0?s(t):[" (No stack trace)"],{message:r,stack:o(e)}},e.formatAndLogError=function(t,e){if("undefined"!=typeof console){var r;if("object"==typeof t||"function"==typeof t){var n=t.stack;r=e+d(n,t)}else r=e+String(t);"function"==typeof l?l(r):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}},e.unhandledRejection=function(t){e.formatAndLogError(t,"^--- With additional stack trace: ")},e.isSupported=function(){return"function"==typeof j},e.fireRejectionEvent=function(t,r,n,i){var o=!1;try{"function"==typeof r&&(o=!0,"rejectionHandled"===t?r(i):r(n,i))}catch(s){h.throwLater(s)}var a=!1;try{a=b(t,n,i)}catch(s){a=!0,h.throwLater(s)}var u=!1;if(m)try{u=m(t.toLowerCase(),{reason:n,promise:i})}catch(s){u=!0,h.throwLater(s)}a||o||u||"unhandledRejection"!==t||e.formatAndLogError(n,"Unhandled rejection ")};var y=function(){return!1},g=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;e.setBounds=function(t,r){if(e.isSupported()){for(var n,i,o=t.stack.split("\n"),s=r.stack.split("\n"),a=-1,u=-1,l=0;la||0>u||!n||!i||n!==i||a>=u||(y=function(t){if(f.test(t))return!0;var e=c(t);return e&&e.fileName===n&&a<=e.line&&e.line<=u?!0:!1})}};var m,j=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():a(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit=Error.stackTraceLimit+6,_=t,d=e;var r=Error.captureStackTrace;return y=function(t){return f.test(t)},function(t,e){Error.stackTraceLimit=Error.stackTraceLimit+6,r(t,e),Error.stackTraceLimit=Error.stackTraceLimit-6}}var n=new Error;if("string"==typeof n.stack&&n.stack.split("\n")[0].indexOf("stackDetection@")>=0)return _=/@/,d=e,v=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in n||!i?(d=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?a(e):e.toString()},null):(_=t,d=e,function(t){Error.stackTraceLimit=Error.stackTraceLimit+6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit=Error.stackTraceLimit-6})}([]),b=function(){if(p.isNode)return function(t,e,r){return"rejectionHandled"===t?process.emit(t,r):process.emit(t,e,r)};var t=!1,e=!0;try{var r=new self.CustomEvent("test");t=r instanceof CustomEvent}catch(n){}if(!t)try{var i=document.createEvent("CustomEvent");i.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(i)}catch(n){e=!1}e&&(m=function(e,r){var n;return t?n=new self.CustomEvent(e,{detail:r,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!1,!0,r)),n?!self.dispatchEvent(n):!1});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,e,r){var n=o[t],i=self[n];return i?("rejectionHandled"===t?i.call(self,r):i.call(self,e,r),!0):!1}}();return"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(l=function(t){console.warn(t)},p.isNode&&process.stderr.isTTY?l=function(t){process.stderr.write(""+t+"\n")}:p.isNode||"string"!=typeof(new Error).stack||(l=function(t){console.warn("%c"+t,"color: red")})),e}},{"./async.js":2,"./util.js":38}],8:[function(t,e){"use strict";e.exports=function(e){function r(t,e,r){this._instances=t,this._callback=e,this._promise=r}function n(t,e){var r={},n=s(t).call(r,e);if(n===a)return n;var i=u(r);return i.length?(a.e=new c("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"),a):n}var i=t("./util.js"),o=t("./errors.js"),s=i.tryCatch,a=i.errorObj,u=t("./es5.js").keys,c=o.TypeError;return r.prototype.doFilter=function(t){for(var r=this._callback,i=this._promise,o=i._boundTo,u=0,c=this._instances.length;c>u;++u){var l=this._instances[u],h=l===Error||null!=l&&l.prototype instanceof Error;if(h&&t instanceof l){var p=s(r).call(o,t);return p===a?(e.e=p.e,e):p}if("function"==typeof l&&!h){var f=n(l,t);if(f===a){t=a.e;break}if(f){var p=s(r).call(o,t);return p===a?(e.e=p.e,e):p}}}return e.e=t,e},r}},{"./errors.js":13,"./es5.js":14,"./util.js":38}],9:[function(t,e){"use strict";e.exports=function(t,e,r){function n(){this._trace=new e(o())}function i(){return r()?new n:void 0}function o(){var t=s.length-1;return t>=0?s[t]:void 0}var s=[];return n.prototype._pushContext=function(){r()&&void 0!==this._trace&&s.push(this._trace)},n.prototype._popContext=function(){r()&&void 0!==this._trace&&s.pop()},t.prototype._peekContext=o,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,i}},{}],10:[function(t,e){"use strict";e.exports=function(e,r){var n,i,o=t("./async.js"),s=t("./errors.js").Warning,a=t("./util.js"),u=a.canAttachTrace,c=!1||a.isNode&&(!!process.env.BLUEBIRD_DEBUG||"development"===process.env.NODE_ENV);return c&&o.disableTrampolineIfNecessary(),e.prototype._ensurePossibleRejectionHandled=function(){this._setRejectionIsUnhandled(),o.invokeLater(this._notifyUnhandledRejection,this,void 0)},e.prototype._notifyUnhandledRejectionIsHandled=function(){r.fireRejectionEvent("rejectionHandled",n,void 0,this)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._getCarriedStackTrace()||this._settledValue;this._setUnhandledRejectionIsNotified(),r.fireRejectionEvent("unhandledRejection",i,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=524288|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-524289&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(524288&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=2097152|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-2097153&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(2097152&this._bitField)>0},e.prototype._setCarriedStackTrace=function(t){this._bitField=1048576|this._bitField,this._fulfillmentHandler0=t},e.prototype._isCarryingStackTrace=function(){return(1048576&this._bitField)>0},e.prototype._getCarriedStackTrace=function(){return this._isCarryingStackTrace()?this._fulfillmentHandler0:void 0},e.prototype._captureStackTrace=function(){return c&&(this._trace=new r(this._peekContext())),this},e.prototype._attachExtraTrace=function(t,e){if(c&&u(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var i=r.parseStackAndMessage(t);a.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),a.notEnumerableProp(t,"__stackCleaned__",!0)}}},e.prototype._warn=function(t){var e=new s(t),n=this._peekContext();if(n)n.attachExtraTrace(e);else{var i=r.parseStackAndMessage(e);e.stack=i.message+"\n"+i.stack.join("\n")}r.formatAndLogError(e,"")},e.onPossiblyUnhandledRejection=function(t){i="function"==typeof t?t:void 0},e.onUnhandledRejectionHandled=function(t){n="function"==typeof t?t:void 0},e.longStackTraces=function(){if(o.haveItemsQueued()&&c===!1)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/DT1qyG\n");c=r.isSupported(),c&&o.disableTrampolineIfNecessary()},e.hasLongStackTraces=function(){return c&&r.isSupported()},r.isSupported()||(e.longStackTraces=function(){},c=!1),function(){return c}}},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(t,e){"use strict";var r=t("./util.js"),n=r.isPrimitive,i=r.wrapsPrimitiveReceiver;e.exports=function(t){var e=function(){return this},r=function(){throw this},o=function(){},s=function(){throw void 0},a=function(t,e){return 1===e?function(){throw t}:2===e?function(){return t}:void 0};t.prototype["return"]=t.prototype.thenReturn=function(t){return void 0===t?this.then(o):i&&n(t)?this._then(a(t,2),void 0,void 0,void 0,void 0):this._then(e,void 0,void 0,t,void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return void 0===t?this.then(s):i&&n(t)?this._then(a(t,1),void 0,void 0,void 0,void 0):this._then(r,void 0,void 0,t,void 0)}}},{"./util.js":38}],12:[function(t,e){"use strict";e.exports=function(t,e){var r=t.reduce;t.prototype.each=function(t){return r(this,t,null,e)},t.each=function(t,n){return r(t,n,null,e)}}},{}],13:[function(t,e){"use strict";function r(t,e){function r(n){return this instanceof r?(l(this,"message","string"==typeof n?n:e),l(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new r(n)}return c(r,Error),r}function n(t){return this instanceof n?(l(this,"name","OperationalError"),l(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(l(this,"message",t.message),l(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new n(t)}var i,o,s=t("./es5.js"),a=s.freeze,u=t("./util.js"),c=u.inherits,l=u.notEnumerableProp,h=r("Warning","warning"),p=r("CancellationError","cancellation error"),f=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{i=TypeError,o=RangeError}catch(d){i=r("TypeError","type error"),o=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y0&&"function"==typeof arguments[e]){t=arguments[e];var n}for(var i=arguments.length,o=new Array(i),s=0;i>s;++s)o[s]=arguments[s];t&&o.pop();var n=new r(o).promise();return void 0!==t?n.spread(t):n}}},{"./util.js":38}],19:[function(t,e){"use strict";e.exports=function(e,r,n,i,o){function s(t,e,r,n){this.constructor$(t),this._promise._captureStackTrace(),this._callback=e,this._preservedValues=n===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=r>=1?[]:_,c.invoke(a,this,void 0)}function a(){this._init$(void 0,-2)}function u(t,e,r,n){var i="object"==typeof r&&null!==r?r.concurrency:0;return i="number"==typeof i&&isFinite(i)&&i>=1?i:0,new s(t,e,i,n)}var c=t("./async.js"),l=t("./util.js"),h=l.tryCatch,p=l.errorObj,f={},_=[];l.inherits(s,r),s.prototype._init=function(){},s.prototype._promiseFulfilled=function(t,r){var n=this._values,o=this.length(),s=this._preservedValues,a=this._limit;if(n[r]===f){if(n[r]=t,a>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return}else{if(a>=1&&this._inFlight>=a)return n[r]=t,void this._queue.push(r);null!==s&&(s[r]=t);var u=this._callback,c=this._promise._boundTo;this._promise._pushContext();var l=h(u).call(c,t,r,o);if(this._promise._popContext(),l===p)return this._reject(l.e);var _=i(l,this._promise);if(_ instanceof e){if(_=_._target(),_._isPending())return a>=1&&this._inFlight++,n[r]=f,_._proxyPromiseArray(this,r);if(!_._isFulfilled())return this._reject(_._reason());l=_._value()}n[r]=l}var d=++this._totalResolved;d>=o&&(null!==s?this._filter(n,s):this._resolve(n))},s.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlighto;++o)t[o]&&(n[i++]=e[o]);n.length=i,this._resolve(n)},s.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return"function"!=typeof t?n("fn must be a function\n\n See http://goo.gl/916lJJ\n"):u(this,t,e,null).promise()},e.map=function(t,e,r,i){return"function"!=typeof e?n("fn must be a function\n\n See http://goo.gl/916lJJ\n"):u(t,e,r,i).promise()}}},{"./async.js":2,"./util.js":38}],20:[function(t,e){"use strict";e.exports=function(e,r,n,i){var o=t("./util.js"),s=o.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n");return function(){var n=new e(r);n._captureStackTrace(),n._pushContext();var i=s(t).apply(this,arguments);return n._popContext(),n._resolveFromSyncValue(i),n}},e.attempt=e["try"]=function(t,n,a){if("function"!=typeof t)return i("fn must be a function\n\n See http://goo.gl/916lJJ\n");var u=new e(r);u._captureStackTrace(),u._pushContext();var c=o.isArray(n)?s(t).apply(a,n):s(t).call(a,n);return u._popContext(),u._resolveFromSyncValue(c),u},e.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1,!0):this._resolveCallback(t,!0)}}},{"./util.js":38}],21:[function(t,e){"use strict";e.exports=function(e){function r(t,e){var r=this;if(!o.isArray(t))return n.call(r,t,e);var i=a(e).apply(r._boundTo,[null].concat(t));i===u&&s.throwLater(i.e)}function n(t,e){var r=this,n=r._boundTo,i=void 0===t?a(e).call(n,null):a(e).call(n,null,t);i===u&&s.throwLater(i.e)}function i(t,e){var r=this;if(!t){var n=r._target(),i=n._getCarriedStackTrace();i.cause=t,t=i}var o=a(e).call(r._boundTo,t);o===u&&s.throwLater(o.e)}var o=t("./util.js"),s=t("./async.js"),a=o.tryCatch,u=o.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(t,e){if("function"==typeof t){var o=n;void 0!==e&&Object(e).spread&&(o=r),this._then(o,i,void 0,this,t)}return this}}},{"./async.js":2,"./util.js":38}],22:[function(t,e){"use strict";e.exports=function(e,r){var n=t("./util.js"),i=t("./async.js"),o=n.tryCatch,s=n.errorObj;e.prototype.progressed=function(t){return this._then(void 0,void 0,t,void 0,void 0)},e.prototype._progress=function(t){this._isFollowingOrFulfilledOrRejected()||this._target()._progressUnchecked(t)},e.prototype._progressHandlerAt=function(t){return 0===t?this._progressHandler0:this[(t<<2)+t-5+2]},e.prototype._doProgressWith=function(t){var r=t.value,i=t.handler,a=t.promise,u=t.receiver,c=o(i).call(u,r);if(c===s){if(null!=c.e&&"StopProgressPropagation"!==c.e.name){var l=n.canAttachTrace(c.e)?c.e:new Error(n.toString(c.e));a._attachExtraTrace(l),a._progress(c.e)}}else c instanceof e?c._then(a._progress,null,null,a,void 0):a._progress(c)},e.prototype._progressUnchecked=function(t){for(var n=this._length(),o=this._progress,s=0;n>s;s++){var a=this._progressHandlerAt(s),u=this._promiseAt(s);if(u instanceof e)"function"==typeof a?i.invoke(this._doProgressWith,this,{handler:a,promise:u,receiver:this._receiverAt(s),value:t}):i.invoke(o,u,t);else{var c=this._receiverAt(s);"function"==typeof a?a.call(c,t,u):c instanceof r&&!c._isResolved()&&c._promiseProgressed(t,u)}}}}},{"./async.js":2,"./util.js":38}],23:[function(t,e){"use strict";e.exports=function(){function e(t){if("function"!=typeof t)throw new c("the promise constructor requires a resolver function\n\n See http://goo.gl/EC22Yn\n");if(this.constructor!==e)throw new c("the promise constructor cannot be invoked directly\n\n See http://goo.gl/KsIlge\n");this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._progressHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._settledValue=void 0,t!==l&&this._resolveFromResolver(t)}function r(t){var r=new e(l);r._fulfillmentHandler0=t,r._rejectionHandler0=t,r._progressHandler0=t,r._promise0=t,r._receiver0=t,r._settledValue=t}var n=function(){return new c("circular promise resolution chain\n\n See http://goo.gl/LhFpo0\n")},i=function(){return new e.PromiseInspection(this._target())},o=function(t){return e.reject(new c(t))},s=t("./util.js"),a=t("./async.js"),u=t("./errors.js"),c=e.TypeError=u.TypeError;e.RangeError=u.RangeError,e.CancellationError=u.CancellationError,e.TimeoutError=u.TimeoutError,e.OperationalError=u.OperationalError,e.RejectionError=u.OperationalError,e.AggregateError=u.AggregateError;var l=function(){},h={},p={e:null},f=t("./thenables.js")(e,l),_=t("./promise_array.js")(e,l,f,o),d=t("./captured_trace.js")(),v=t("./debuggability.js")(e,d),y=t("./context.js")(e,d,v),g=t("./catch_filter.js")(p),m=t("./promise_resolver.js"),j=m._nodebackForPromise,b=s.errorObj,w=s.tryCatch;return e.prototype.toString=function(){return"[object Promise]"},e.prototype.caught=e.prototype["catch"]=function(t){var r=arguments.length;if(r>1){var n,i=new Array(r-1),o=0;for(n=0;r-1>n;++n){var s=arguments[n];if("function"!=typeof s)return e.reject(new c("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"));i[o++]=s}i.length=o,t=arguments[n];var a=new g(i,t,this);return this._then(void 0,a.doFilter,void 0,a,void 0)}return this._then(void 0,t,void 0,void 0,void 0)},e.prototype.reflect=function(){return this._then(i,i,void 0,this,void 0)},e.prototype.then=function(t,e,r){if(v()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+s.classString(t);arguments.length>1&&(n+=", "+s.classString(e)),this._warn(n)}return this._then(t,e,r,void 0,void 0)},e.prototype.done=function(t,e,r){var n=this._then(t,e,r,void 0,void 0);n._setIsFinal()},e.prototype.spread=function(t,e){return this.all()._then(t,e,void 0,h,void 0)},e.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable() -},e.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},e.prototype.all=function(){return new _(this).promise()},e.prototype.error=function(t){return this.caught(s.originatesFromRejection,t)},e.is=function(t){return t instanceof e},e.fromNode=function(t){var r=new e(l),n=w(t)(j(r));return n===b&&r._rejectCallback(n.e,!0,!0),r},e.all=function(t){return new _(t).promise()},e.defer=e.pending=function(){var t=new e(l);return new m(t)},e.cast=function(t){var r=f(t);if(!(r instanceof e)){var n=r;r=new e(l),r._fulfillUnchecked(n)}return r},e.resolve=e.fulfilled=e.cast,e.reject=e.rejected=function(t){var r=new e(l);return r._captureStackTrace(),r._rejectCallback(t,!0),r},e.setScheduler=function(t){if("function"!=typeof t)throw new c("fn must be a function\n\n See http://goo.gl/916lJJ\n");var e=a._schedule;return a._schedule=t,e},e.prototype._then=function(t,r,n,i,o){var s=void 0!==o,u=s?o:new e(l);s||(u._propagateFrom(this,5),u._captureStackTrace());var c=this._target();c!==this&&(void 0===i&&(i=this._boundTo),s||u._setIsMigrated());var h=c._addCallbacks(t,r,n,u,i);return c._isResolved()&&!c._isSettlePromisesQueued()&&a.invoke(c._settlePromiseAtPostResolution,c,h),u},e.prototype._settlePromiseAtPostResolution=function(t){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),this._settlePromiseAt(t)},e.prototype._length=function(){return 131071&this._bitField},e.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},e.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},e.prototype._setLength=function(t){this._bitField=-131072&this._bitField|131071&t},e.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},e.prototype._setRejected=function(){this._bitField=134217728|this._bitField},e.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},e.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},e.prototype._isFinal=function(){return(33554432&this._bitField)>0},e.prototype._cancellable=function(){return(67108864&this._bitField)>0},e.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},e.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},e.prototype._setIsMigrated=function(){this._bitField=4194304|this._bitField},e.prototype._unsetIsMigrated=function(){this._bitField=-4194305&this._bitField},e.prototype._isMigrated=function(){return(4194304&this._bitField)>0},e.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[5*t-5+4];return void 0===e&&this._isBound()?this._boundTo:e},e.prototype._promiseAt=function(t){return 0===t?this._promise0:this[5*t-5+3]},e.prototype._fulfillmentHandlerAt=function(t){return 0===t?this._fulfillmentHandler0:this[5*t-5+0]},e.prototype._rejectionHandlerAt=function(t){return 0===t?this._rejectionHandler0:this[5*t-5+1]},e.prototype._migrateCallbacks=function(t,r){var n=t._fulfillmentHandlerAt(r),i=t._rejectionHandlerAt(r),o=t._progressHandlerAt(r),s=t._promiseAt(r),a=t._receiverAt(r);s instanceof e&&s._setIsMigrated(),this._addCallbacks(n,i,o,s,a)},e.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=131066&&(o=0,this._setLength(0)),0===o)this._promise0=n,void 0!==i&&(this._receiver0=i),"function"!=typeof t||this._isCarryingStackTrace()||(this._fulfillmentHandler0=t),"function"==typeof e&&(this._rejectionHandler0=e),"function"==typeof r&&(this._progressHandler0=r);else{var s=5*o-5;this[s+3]=n,this[s+4]=i,"function"==typeof t&&(this[s+0]=t),"function"==typeof e&&(this[s+1]=e),"function"==typeof r&&(this[s+2]=r)}return this._setLength(o+1),o},e.prototype._setProxyHandlers=function(t,e){var r=this._length();if(r>=131066&&(r=0,this._setLength(0)),0===r)this._promise0=e,this._receiver0=t;else{var n=5*r-5;this[n+3]=e,this[n+4]=t}this._setLength(r+1)},e.prototype._proxyPromiseArray=function(t,e){this._setProxyHandlers(t,e)},e.prototype._resolveCallback=function(t,r){if(!this._isFollowingOrFulfilledOrRejected()){if(t===this)return this._rejectCallback(n(),!1,!0);var i=f(t,this);if(!(i instanceof e))return this._fulfill(t);var o=1|(r?4:0);this._propagateFrom(i,o);var s=i._target();if(s._isPending()){for(var a=this._length(),u=0;a>u;++u)s._migrateCallbacks(this,u);this._setFollowing(),this._setLength(0),this._setFollowee(s)}else s._isFulfilled()?this._fulfillUnchecked(s._value()):this._rejectUnchecked(s._reason(),s._getCarriedStackTrace())}},e.prototype._rejectCallback=function(t,e,r){r||s.markAsOriginatingFromRejection(t);var n=s.ensureErrorObject(t),i=n===t;this._attachExtraTrace(n,e?i:!1),this._reject(t,i?void 0:n)},e.prototype._resolveFromResolver=function(t){var e=this;this._captureStackTrace(),this._pushContext();var r=!0,n=w(t)(function(t){null!==e&&(e._resolveCallback(t),e=null)},function(t){null!==e&&(e._rejectCallback(t,r),e=null)});r=!1,this._popContext(),void 0!==n&&n===b&&null!==e&&(e._rejectCallback(n.e,!0,!0),e=null)},e.prototype._settlePromiseFromHandler=function(t,e,r,i){if(!i._isRejected()){i._pushContext();var o;if(o=e!==h||this._isRejected()?w(t).call(e,r):w(t).apply(this._boundTo,r),i._popContext(),o===b||o===i||o===p){var s=o===i?n():o.e;i._rejectCallback(s,!1,!0)}else i._resolveCallback(o)}},e.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},e.prototype._followee=function(){return this._rejectionHandler0},e.prototype._setFollowee=function(t){this._rejectionHandler0=t},e.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=void 0)},e.prototype._propagateFrom=function(t,e){(1&e)>0&&t._cancellable()&&(this._setCancellable(),this._cancellationParent=t),(4&e)>0&&t._isBound()&&this._setBoundTo(t._boundTo)},e.prototype._fulfill=function(t){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(t)},e.prototype._reject=function(t,e){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(t,e)},e.prototype._settlePromiseAt=function(t){var r=this._promiseAt(t),n=r instanceof e;if(n&&r._isMigrated())return r._unsetIsMigrated(),a.invoke(this._settlePromiseAt,this,t);var i=this._isFulfilled()?this._fulfillmentHandlerAt(t):this._rejectionHandlerAt(t),o=this._isCarryingStackTrace()?this._getCarriedStackTrace():void 0,s=this._settledValue,u=this._receiverAt(t);this._clearCallbackDataAtIndex(t),"function"==typeof i?n?this._settlePromiseFromHandler(i,u,s,r):i.call(u,s,r):u instanceof _?u._isResolved()||(this._isFulfilled()?u._promiseFulfilled(s,r):u._promiseRejected(s,r)):n&&(this._isFulfilled()?r._fulfill(s):r._reject(s,o)),t>=4&&4===(31&t)&&a.invokeLater(this._setLength,this,0)},e.prototype._clearCallbackDataAtIndex=function(t){if(0===t)this._isCarryingStackTrace()||(this._fulfillmentHandler0=void 0),this._rejectionHandler0=this._progressHandler0=this._receiver0=this._promise0=void 0;else{var e=5*t-5;this[e+3]=this[e+4]=this[e+0]=this[e+1]=this[e+2]=void 0}},e.prototype._isSettlePromisesQueued=function(){return-1073741824===(-1073741824&this._bitField)},e.prototype._setSettlePromisesQueued=function(){this._bitField=-1073741824|this._bitField},e.prototype._unsetSettlePromisesQueued=function(){this._bitField=1073741823&this._bitField},e.prototype._queueSettlePromises=function(){a.settlePromises(this),this._setSettlePromisesQueued()},e.prototype._fulfillUnchecked=function(t){if(t===this){var e=n();return this._attachExtraTrace(e),this._rejectUnchecked(e,void 0)}this._setFulfilled(),this._settledValue=t,this._cleanValues(),this._length()>0&&this._queueSettlePromises()},e.prototype._rejectUncheckedCheckError=function(t){var e=s.ensureErrorObject(t);this._rejectUnchecked(t,e===t?void 0:e)},e.prototype._rejectUnchecked=function(t,e){if(t===this){var r=n();return this._attachExtraTrace(r),this._rejectUnchecked(r)}return this._setRejected(),this._settledValue=t,this._cleanValues(),this._isFinal()?void a.throwLater(function(t){throw"stack"in t&&a.invokeFirst(d.unhandledRejection,void 0,t),t},void 0===e?t:e):(void 0!==e&&e!==t&&this._setCarriedStackTrace(e),void(this._length()>0?this._queueSettlePromises():this._ensurePossibleRejectionHandled()))},e.prototype._settlePromises=function(){this._unsetSettlePromisesQueued();for(var t=this._length(),e=0;t>e;e++)this._settlePromiseAt(e)},e._makeSelfResolutionError=n,t("./progress.js")(e,_),t("./method.js")(e,l,f,o),t("./bind.js")(e,l,f),t("./finally.js")(e,p,f),t("./direct_resolve.js")(e),t("./synchronous_inspection.js")(e),t("./join.js")(e,_,f,l),e.Promise=e,t("./map.js")(e,_,o,f,l),t("./cancel.js")(e),t("./using.js")(e,o,f,y),t("./generators.js")(e,o,l,f),t("./nodeify.js")(e),t("./call_get.js")(e),t("./props.js")(e,_,f,o),t("./race.js")(e,l,f,o),t("./reduce.js")(e,_,o,f,l),t("./settle.js")(e,_),t("./some.js")(e,_,o),t("./promisify.js")(e,l),t("./any.js")(e),t("./each.js")(e,l),t("./timers.js")(e,l),t("./filter.js")(e,l),s.toFastProperties(e),s.toFastProperties(e.prototype),r({a:1}),r({b:2}),r({c:3}),r(1),r(function(){}),r(void 0),r(!1),r(new e(l)),d.setBounds(a.firstLineError,s.lastLineError),e}},{"./any.js":1,"./async.js":2,"./bind.js":3,"./call_get.js":5,"./cancel.js":6,"./captured_trace.js":7,"./catch_filter.js":8,"./context.js":9,"./debuggability.js":10,"./direct_resolve.js":11,"./each.js":12,"./errors.js":13,"./filter.js":15,"./finally.js":16,"./generators.js":17,"./join.js":18,"./map.js":19,"./method.js":20,"./nodeify.js":21,"./progress.js":22,"./promise_array.js":24,"./promise_resolver.js":25,"./promisify.js":26,"./props.js":27,"./race.js":29,"./reduce.js":30,"./settle.js":32,"./some.js":33,"./synchronous_inspection.js":34,"./thenables.js":35,"./timers.js":36,"./using.js":37,"./util.js":38}],24:[function(t,e){"use strict";e.exports=function(e,r,n,i){function o(t){switch(t){case-2:return[];case-3:return{}}}function s(t){var n,i=this._promise=new e(r);t instanceof e&&(n=t,i._propagateFrom(n,5)),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var a=t("./util.js"),u=a.isArray;return s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function c(t,r){var s=n(this._values,this._promise);if(s instanceof e){if(s=s._target(),this._values=s,!s._isFulfilled())return s._isPending()?void s._then(c,this._reject,void 0,this,r):void this._reject(s._reason());if(s=s._value(),!u(s)){var a=new e.TypeError("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n");return void this.__hardReject__(a)}}else if(!u(s))return void this._promise._reject(i("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n")._reason());if(0===s.length)return void(-5===r?this._resolveEmptyArray():this._resolve(o(r)));var l=this.getActualLength(s.length);this._length=l,this._values=this.shouldCopyValues()?new Array(l):this._values;for(var h=this._promise,p=0;l>p;++p){var f=this._isResolved(),_=n(s[p],h);_ instanceof e?(_=_._target(),f?_._unsetRejectionIsUnhandled():_._isPending()?_._proxyPromiseArray(this,p):_._isFulfilled()?this._promiseFulfilled(_._value(),p):this._promiseRejected(_._reason(),p)):f||this._promiseFulfilled(_,p)}},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype.__hardReject__=s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1,!0)},s.prototype._promiseProgressed=function(t,e){this._promise._progress({index:e,value:t})},s.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var r=++this._totalResolved;r>=this._length&&this._resolve(this._values)},s.prototype._promiseRejected=function(t){this._totalResolved++,this._reject(t)},s.prototype.shouldCopyValues=function(){return!0},s.prototype.getActualLength=function(t){return t},s}},{"./util.js":38}],25:[function(t,e){"use strict";function r(t){return t instanceof Error&&p.getPrototypeOf(t)===Error.prototype}function n(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=p.keys(t),i=0;i2){for(var o=arguments.length,s=new Array(o-1),u=1;o>u;++u)s[u-1]=arguments[u];t._fulfill(s)}else t._fulfill(r);t=null}}}var o,s=t("./util.js"),a=s.maybeWrapAsError,u=t("./errors.js"),c=u.TimeoutError,l=u.OperationalError,h=s.haveGetters,p=t("./es5.js"),f=/^(?:name|message|stack|cause)$/;if(o=h?function(t){this.promise=t}:function(t){this.promise=t,this.asCallback=i(t),this.callback=this.asCallback},h){var _={get:function(){return i(this.promise)}};p.defineProperty(o.prototype,"asCallback",_),p.defineProperty(o.prototype,"callback",_)}o._nodebackForPromise=i,o.prototype.toString=function(){return"[object PromiseResolver]"},o.prototype.resolve=o.prototype.fulfill=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._resolveCallback(t)},o.prototype.reject=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._rejectCallback(t)},o.prototype.progress=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._progress(t)},o.prototype.cancel=function(t){this.promise.cancel(t)},o.prototype.timeout=function(){this.reject(new c("timeout"))},o.prototype.isResolved=function(){return this.promise.isResolved()},o.prototype.toJSON=function(){return this.promise.toJSON()},e.exports=o},{"./errors.js":13,"./es5.js":14,"./util.js":38}],26:[function(t,e){"use strict";e.exports=function(e,r){function n(t){return!b.test(t)}function i(t){try{return t.__isPromisified__===!0}catch(e){return!1}}function o(t,e,r){var n=f.getDataPropertyOrDefault(t,e+r,j);return n?i(n):!1}function s(t,e,r){for(var n=0;ns;s+=2){var c=o[s],l=o[s+1],h=c+e;t[h]=n===E?E(c,p,c,l,e):n(l,function(){return E(c,p,c,l,e)})}return f.toFastProperties(t),t}function l(t,e){return E(t,e,void 0,t)}var h,p={},f=t("./util.js"),_=t("./promise_resolver.js")._nodebackForPromise,d=f.withAppended,v=f.maybeWrapAsError,y=f.canEvaluate,g=t("./errors").TypeError,m="Async",j={__isPromisified__:!0},b=/^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/,w=function(t,e){return f.isIdentifier(t)&&"_"!==t.charAt(0)&&!f.isClass(e)},k=function(t){return t.replace(/([$])/,"\\$")},E=y?h:u;e.promisify=function(t,e){if("function"!=typeof t)throw new g("fn must be a function\n\n See http://goo.gl/916lJJ\n");if(i(t))return t;var r=l(t,arguments.length<2?p:e);return f.copyDescriptors(t,r,n),r},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new g("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/9ITlV0\n");e=Object(e);var r=e.suffix;"string"!=typeof r&&(r=m);var n=e.filter;"function"!=typeof n&&(n=w);var i=e.promisifier;if("function"!=typeof i&&(i=E),!f.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/8FZo5V\n");for(var o=f.inheritedDataKeys(t),s=0;si;++i){var o=e[i];n[i]=t[o],n[i+r]=o}this.constructor$(n)}function s(t){var r,s=n(t);return u(s)?(r=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&r._propagateFrom(s,4),r):i("cannot await properties of a non-object\n\n See http://goo.gl/OsFKC8\n")}var a=t("./util.js"),u=a.isObject,c=t("./es5.js");a.inherits(o,r),o.prototype._init=function(){this._init$(void 0,-3)},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var r=++this._totalResolved;if(r>=this._length){for(var n={},i=this.length(),o=0,s=this.length();s>o;++o)n[this._values[o+i]]=this._values[o];this._resolve(n)}},o.prototype._promiseProgressed=function(t,e){this._promise._progress({key:this._values[e+this.length()],value:t})},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5.js":14,"./util.js":38}],28:[function(t,e){"use strict";function r(t,e,r,n,i){for(var o=0;i>o;++o)r[o+n]=t[o+e],t[o+e]=void 0}function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacityp;++p){var _=t[p];(void 0!==_||p in t)&&e.cast(_)._then(l,h,void 0,c,null)}return c}var s=t("./util.js").isArray,a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util.js":38}],30:[function(t,e){"use strict";e.exports=function(e,r,n,i,o){function s(t,r,n,s){this.constructor$(t),this._promise._captureStackTrace(),this._preservedValues=s===o?[]:null,this._zerothIsAccum=void 0===n,this._gotAccum=!1,this._reducingIndex=this._zerothIsAccum?1:0,this._valuesPhase=void 0;var u=i(n,this._promise),l=!1,h=u instanceof e;h&&(u=u._target(),u._isPending()?u._proxyPromiseArray(this,-1):u._isFulfilled()?(n=u._value(),this._gotAccum=!0):(this._reject(u._reason()),l=!0)),h||this._zerothIsAccum||(this._gotAccum=!0),this._callback=r,this._accum=n,l||c.invoke(a,this,void 0)}function a(){this._init$(void 0,-5)}function u(t,e,r,i){if("function"!=typeof e)return n("fn must be a function\n\n See http://goo.gl/916lJJ\n");var o=new s(t,e,r,i);return o.promise()}var c=t("./async.js"),l=t("./util.js"),h=l.tryCatch,p=l.errorObj;l.inherits(s,r),s.prototype._init=function(){},s.prototype._resolveEmptyArray=function(){(this._gotAccum||this._zerothIsAccum)&&this._resolve(null!==this._preservedValues?[]:this._accum)},s.prototype._promiseFulfilled=function(t,r){var n=this._values;n[r]=t;var o,s=this.length(),a=this._preservedValues,u=null!==a,c=this._gotAccum,l=this._valuesPhase;if(!l)for(l=this._valuesPhase=new Array(s),o=0;s>o;++o)l[o]=0;if(o=l[r],0===r&&this._zerothIsAccum?(this._accum=t,this._gotAccum=c=!0,l[r]=0===o?1:2):-1===r?(this._accum=t,this._gotAccum=c=!0):0===o?l[r]=1:(l[r]=2,this._accum=t),c){for(var f,_=this._callback,d=this._promise._boundTo,v=this._reducingIndex;s>v;++v)if(o=l[v],2!==o){if(1!==o)return;if(t=n[v],this._promise._pushContext(),u?(a.push(t),f=h(_).call(d,t,v,s)):f=h(_).call(d,this._accum,t,v,s),this._promise._popContext(),f===p)return this._reject(f.e);var y=i(f,this._promise);if(y instanceof e){if(y=y._target(),y._isPending())return l[v]=4,y._proxyPromiseArray(this,v);if(!y._isFulfilled())return this._reject(y._reason());f=y._value()}this._reducingIndex=v+1,this._accum=f}else this._reducingIndex=v+1;this._resolve(u?a:this._accum)}},e.prototype.reduce=function(t,e){return u(this,t,e,null)},e.reduce=function(t,e,r,n){return u(t,e,r,n)}}},{"./async.js":2,"./util.js":38}],31:[function(t,e){"use strict";var r,n=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")};if(t("./util.js").isNode){var i=process.versions.node.split(".").map(Number);r=0===i[0]&&i[1]>10||i[0]>0?function(t){global.setImmediate(t)}:process.nextTick,r||(r="undefined"!=typeof setImmediate?setImmediate:"undefined"!=typeof setTimeout?setTimeout:n)}else"undefined"!=typeof MutationObserver?(r=function(t){var e=document.createElement("div"),r=new MutationObserver(t);return r.observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}},r.isStatic=!0):r="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:n;e.exports=r},{"./util.js":38}],32:[function(t,e){"use strict";e.exports=function(e,r){function n(t){this.constructor$(t)}var i=e.PromiseInspection,o=t("./util.js");o.inherits(n,r),n.prototype._promiseResolved=function(t,e){this._values[t]=e;var r=++this._totalResolved;r>=this._length&&this._resolve(this._values)},n.prototype._promiseFulfilled=function(t,e){var r=new i;r._bitField=268435456,r._settledValue=t,this._promiseResolved(e,r)},n.prototype._promiseRejected=function(t,e){var r=new i;r._bitField=134217728,r._settledValue=t,this._promiseResolved(e,r)},e.settle=function(t){return new n(t).promise()},e.prototype.settle=function(){return new n(this).promise()}}},{"./util.js":38}],33:[function(t,e){"use strict";e.exports=function(e,r,n){function i(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return n("expecting a positive integer\n\n See http://goo.gl/1wAmHx\n");var r=new i(t),o=r.promise();return r.setHowMany(e),r.init(),o}var s=t("./util.js"),a=t("./errors.js").RangeError,u=t("./errors.js").AggregateError,c=s.isArray;s.inherits(i,r),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=c(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this._resolve(1===this.howMany()&&this._unwrap?this._values[0]:this._values))},i.prototype._promiseRejected=function(t){if(this._addRejected(t),this.howMany()>this._canPossiblyFulfill()){for(var e=new u,r=this.length();r0},e.prototype.isRejected=t.prototype._isRejected=function(){return(134217728&this._bitField)>0},e.prototype.isPending=t.prototype._isPending=function(){return 0===(402653184&this._bitField)},e.prototype.isResolved=t.prototype._isResolved=function(){return(402653184&this._bitField)>0},t.prototype.isPending=function(){return this._target()._isPending()},t.prototype.isRejected=function(){return this._target()._isRejected()},t.prototype.isFulfilled=function(){return this._target()._isFulfilled()},t.prototype.isResolved=function(){return this._target()._isResolved()},t.prototype._value=function(){return this._settledValue},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue},t.prototype.value=function(){var t=this._target();if(!t.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n");return t._settledValue},t.prototype.reason=function(){var t=this._target();if(!t.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n");return t._unsetRejectionIsUnhandled(),t._settledValue},t.PromiseInspection=e}},{}],35:[function(t,e){"use strict";e.exports=function(e,r){function n(t,n){if(c(t)){if(t instanceof e)return t;if(o(t)){var l=new e(r);return t._then(l._fulfillUnchecked,l._rejectUncheckedCheckError,l._progressUnchecked,l,null),l}var h=a.tryCatch(i)(t);if(h===u){n&&n._pushContext();var l=e.reject(h.e);return n&&n._popContext(),l}if("function"==typeof h)return s(t,h,n)}return t}function i(t){return t.then}function o(t){return l.call(t,"_promise0")}function s(t,n,i){function o(r){l&&(t===r?l._rejectCallback(e._makeSelfResolutionError(),!1,!0):l._resolveCallback(r),l=null)}function s(t){l&&(l._rejectCallback(t,p,!0),l=null)}function c(t){l&&"function"==typeof l._progress&&l._progress(t)}var l=new e(r),h=l;i&&i._pushContext(),l._captureStackTrace(),i&&i._popContext();var p=!0,f=a.tryCatch(n).call(t,o,s,c);return p=!1,l&&f===u&&(l._rejectCallback(f.e,!0,!0),l=null),h}var a=t("./util.js"),u=a.errorObj,c=a.isObject,l={}.hasOwnProperty;return n}},{"./util.js":38}],36:[function(t,e){"use strict";e.exports=function(e,r){function n(t){var e=this;return e instanceof Number&&(e=+e),clearTimeout(e),t}function i(t){var e=this;throw e instanceof Number&&(e=+e),clearTimeout(e),t}var o=t("./util.js"),s=e.TimeoutError,a=function(t,e){if(t.isPending()){"string"!=typeof e&&(e="operation timed out");var r=new s(e);o.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._cancel(r)}},u=function(t){return c(+this).thenReturn(t)},c=e.delay=function(t,n){if(void 0===n){n=t,t=void 0;var i=new e(r);return setTimeout(function(){i._fulfill()},n),i}return n=+n,e.resolve(t)._then(u,null,null,n,void 0)};e.prototype.delay=function(t){return c(this,t)},e.prototype.timeout=function(t,e){t=+t;var r=this.then().cancellable();r._cancellationParent=this;var o=setTimeout(function(){a(r,e)},t);return r._then(n,i,void 0,o,void 0)}}},{"./util.js":38}],37:[function(t,e){"use strict";e.exports=function(e,r,n,i){function o(t){for(var r=t.length,n=0;r>n;++n){var i=t[n];if(i.isRejected())return e.reject(i.error());t[n]=i._settledValue}return t}function s(t){setTimeout(function(){throw t},0)}function a(t){var e=n(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function u(t,r){function i(){if(o>=u)return c.resolve();var l=a(t[o++]);if(l instanceof e&&l._isDisposable()){try{l=n(l._getDisposer().tryDispose(r),t.promise)}catch(h){return s(h)}if(l instanceof e)return l._then(i,s,null,null,null)}i()}var o=0,u=t.length,c=e.defer();return i(),c.promise}function c(t){var e=new v;return e._settledValue=t,e._bitField=268435456,u(this,e).thenReturn(t)}function l(t){var e=new v;return e._settledValue=t,e._bitField=134217728,u(this,e).thenThrow(t)}function h(t,e,r){this._data=t,this._promise=e,this._context=r}function p(t,e,r){this.constructor$(t,e,r)}function f(t){return h.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}var _=t("./errors.js").TypeError,d=t("./util.js").inherits,v=e.PromiseInspection;h.prototype.data=function(){return this._data},h.prototype.promise=function(){return this._promise},h.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},h.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=null!==e?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},h.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},d(p,h),p.prototype.doDispose=function(t,e){var r=this.data();return r.call(t,t,e)},e.using=function(){var t=arguments.length;if(2>t)return r("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return r("fn must be a function\n\n See http://goo.gl/916lJJ\n");t--;for(var s=new Array(t),a=0;t>a;++a){var u=arguments[a];if(h.isDisposer(u)){var p=u;u=u.promise(),u._setDisposable(p)}else{var _=n(u);_ instanceof e&&(u=_._then(f,null,null,{resources:s,index:a},void 0))}s[a]=u}var d=e.settle(s).then(o).then(function(t){d._pushContext();var e;try{e=i.apply(void 0,t)}finally{d._popContext()}return e})._then(c,l,void 0,s,void 0);return s.promise=d,d},e.prototype._setDisposable=function(t){this._bitField=262144|this._bitField,this._disposer=t},e.prototype._isDisposable=function(){return(262144&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-262145&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new _}}},{"./errors.js":13,"./util.js":38}],38:[function(t,e,r){"use strict"; -function n(){try{return T.apply(this,arguments)}catch(t){return F.e=t,F}}function i(t){return T=t,n}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return!o(t)}function a(t){return o(t)?new Error(v(t)):t}function u(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;n>r;++r)i[r]=t[r];return i[r]=e,i}function c(t,e,r){if(!w.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var n=Object.getOwnPropertyDescriptor(t,e);return null!=n?null==n.get&&null==n.set?n.value:r:void 0}function l(t,e,r){if(o(t))return t;var n={value:r,configurable:!0,enumerable:!1,writable:!0};return w.defineProperty(t,e,n),t}function h(t){throw t}function p(t){try{if("function"==typeof t){var e=w.names(t.prototype);return w.isES5?e.length>1:e.length>0&&!(1===e.length&&"constructor"===e[0])}return!1}catch(r){return!1}}function f(t){function e(){}e.prototype=t;for(var r=8;r--;)new e;return t}function _(t){return R.test(t)}function d(t,e,r){for(var n=new Array(t),i=0;t>i;++i)n[i]=e+i+r;return n}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){try{l(t,"isOperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function m(t){return t instanceof Error&&w.propertyIsWritable(t,"stack")}function j(t){return{}.toString.call(t)}function b(t,e,r){for(var n=w.names(t),i=0;it||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,i,a,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=new Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];r.apply(this,a)}else if(o(r)){for(i=arguments.length,a=new Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];for(c=r.slice(),i=c.length,u=0;i>u;u++)c[u].apply(this,a)}return!0},r.prototype.addListener=function(t,e){var i;if(!n(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned){var i;i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,i,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-->0;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(0>i)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],n(r))this.removeListener(t,r);else for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.listenerCount=function(t,e){var r;return r=t._events&&t._events[e]?n(t._events[e])?1:t._events[e].length:0}},{}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); \ No newline at end of file diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js deleted file mode 100644 index 05a6228e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var SomePromiseArray = Promise._SomePromiseArray; -function any(promises) { - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(1); - ret.setUnwrap(); - ret.init(); - return promise; -} - -Promise.any = function (promises) { - return any(promises); -}; - -Promise.prototype.any = function () { - return any(this); -}; - -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js deleted file mode 100644 index a98955c4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -module.exports = (function(){ -var AssertionError = (function() { - function AssertionError(a) { - this.constructor$(a); - this.message = a; - this.name = "AssertionError"; - } - AssertionError.prototype = new Error(); - AssertionError.prototype.constructor = AssertionError; - AssertionError.prototype.constructor$ = Error; - return AssertionError; -})(); - -function getParams(args) { - var params = []; - for (var i = 0; i < args.length; ++i) params.push("arg" + i); - return params; -} - -function nativeAssert(callName, args, expect) { - try { - var params = getParams(args); - var constructorArgs = params; - constructorArgs.push("return " + - callName + "("+ params.join(",") + ");"); - var fn = Function.apply(null, constructorArgs); - return fn.apply(null, args); - } catch (e) { - if (!(e instanceof SyntaxError)) { - throw e; - } else { - return expect; - } - } -} - -return function assert(boolExpr, message) { - if (boolExpr === true) return; - - if (typeof boolExpr === "string" && - boolExpr.charAt(0) === "%") { - var nativeCallName = boolExpr; - var $_len = arguments.length;var args = new Array($_len - 2); for(var $_i = 2; $_i < $_len; ++$_i) {args[$_i - 2] = arguments[$_i];} - if (nativeAssert(nativeCallName, args, message) === message) return; - message = (nativeCallName + " !== " + message); - } - - var ret = new AssertionError(message); - if (Error.captureStackTrace) { - Error.captureStackTrace(ret, assert); - } - throw ret; -}; -})(); diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js deleted file mode 100644 index 3b5f828c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js +++ /dev/null @@ -1,204 +0,0 @@ -"use strict"; -var firstLineError; -try {throw new Error(); } catch (e) {firstLineError = e;} -var schedule = require("./schedule.js"); -var Queue = require("./queue.js"); -var util = require("./util.js"); - -function Async() { - this._isTickUsed = false; - this._lateQueue = new Queue(16); - this._normalQueue = new Queue(16); - this._trampolineEnabled = true; - var self = this; - this.drainQueues = function () { - self._drainQueues(); - }; - this._schedule = - schedule.isStatic ? schedule(this.drainQueues) : schedule; -} - -Async.prototype.disableTrampolineIfNecessary = function() { - if (util.hasDevTools) { - this._trampolineEnabled = false; - } -}; - -Async.prototype.enableTrampoline = function() { - if (!this._trampolineEnabled) { - this._trampolineEnabled = true; - this._schedule = function(fn) { - setTimeout(fn, 0); - }; - } -}; - -Async.prototype.haveItemsQueued = function () { - return this._normalQueue.length() > 0; -}; - -Async.prototype.throwLater = function(fn, arg) { - if (arguments.length === 1) { - arg = fn; - fn = function () { throw arg; }; - } - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - if (typeof setTimeout !== "undefined") { - setTimeout(function() { - fn(arg); - }, 0); - } else try { - this._schedule(function() { - fn(arg); - }); - } catch (e) { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/m3OTXk\u000a"); - } -}; - -Async.prototype._getDomain = function() {}; - -if (!false) { -if (util.isNode) { - var EventsModule = require("events"); - - var domainGetter = function() { - var domain = process.domain; - if (domain === null) return undefined; - return domain; - }; - - if (EventsModule.usingDomains) { - Async.prototype._getDomain = domainGetter; - } else { - var descriptor = - Object.getOwnPropertyDescriptor(EventsModule, "usingDomains"); - - if (descriptor) { - if (!descriptor.configurable) { - process.on("domainsActivated", function() { - Async.prototype._getDomain = domainGetter; - }); - } else { - var usingDomains = false; - Object.defineProperty(EventsModule, "usingDomains", { - configurable: false, - enumerable: true, - get: function() { - return usingDomains; - }, - set: function(value) { - if (usingDomains || !value) return; - usingDomains = true; - Async.prototype._getDomain = domainGetter; - util.toFastProperties(process); - process.emit("domainsActivated"); - } - }); - } - } - } -} -} - -function AsyncInvokeLater(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._lateQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncInvoke(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncSettlePromises(promise) { - var domain = this._getDomain(); - if (domain !== undefined) { - var fn = domain.bind(promise._settlePromises); - this._normalQueue.push(fn, promise, undefined); - } else { - this._normalQueue._pushOne(promise); - } - this._queueTick(); -} - -if (!util.hasDevTools) { - Async.prototype.invokeLater = AsyncInvokeLater; - Async.prototype.invoke = AsyncInvoke; - Async.prototype.settlePromises = AsyncSettlePromises; -} else { - Async.prototype.invokeLater = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvokeLater.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 100); - } - }; - - Async.prototype.invoke = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvoke.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 0); - } - }; - - Async.prototype.settlePromises = function(promise) { - if (this._trampolineEnabled) { - AsyncSettlePromises.call(this, promise); - } else { - setTimeout(function() { - promise._settlePromises(); - }, 0); - } - }; -} - -Async.prototype.invokeFirst = function (fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.unshift(fn, receiver, arg); - this._queueTick(); -}; - -Async.prototype._drainQueue = function(queue) { - while (queue.length() > 0) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - continue; - } - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -}; - -Async.prototype._drainQueues = function () { - this._drainQueue(this._normalQueue); - this._reset(); - this._drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = new Async(); -module.exports.firstLineError = firstLineError; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js deleted file mode 100644 index d6f6da25..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise) { -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - this._setBoundTo(thisArg); - if (this._isPending()) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, ret._progress, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, ret._progress, ret, context); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 131072; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~131072); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 131072) === 131072; -}; - -Promise.bind = function (thisArg, value) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - - if (maybePromise instanceof Promise) { - maybePromise._then(function(thisArg) { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - }, ret._reject, ret._progress, ret, null); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - } - return ret; -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js deleted file mode 100644 index ed6226e7..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = require("./promise.js")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js deleted file mode 100644 index 62c166d5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} - -module.exports = function(Promise) { -var util = require("./util.js"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; - -var getMethodCaller; -var getGetter; -if (!false) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; - -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; - -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; - } - } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; - -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); - } - return fn; -} - -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - if (!false) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); - } - } - } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; - -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; - } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js deleted file mode 100644 index 9eb40b6f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var errors = require("./errors.js"); -var async = require("./async.js"); -var CancellationError = errors.CancellationError; - -Promise.prototype._cancel = function (reason) { - if (!this.isCancellable()) return this; - var parent; - var promiseToReject = this; - while ((parent = promiseToReject._cancellationParent) !== undefined && - parent.isCancellable()) { - promiseToReject = parent; - } - this._unsetCancellable(); - promiseToReject._target()._rejectCallback(reason, false, true); -}; - -Promise.prototype.cancel = function (reason) { - if (!this.isCancellable()) return this; - if (reason === undefined) reason = new CancellationError(); - async.invokeLater(this._cancel, this, reason); - return this; -}; - -Promise.prototype.cancellable = function () { - if (this._cancellable()) return this; - async.enableTrampoline(); - this._setCancellable(); - this._cancellationParent = undefined; - return this; -}; - -Promise.prototype.uncancellable = function () { - var ret = this.then(); - ret._unsetCancellable(); - return ret; -}; - -Promise.prototype.fork = function (didFulfill, didReject, didProgress) { - var ret = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - - ret._setCancellable(); - ret._cancellationParent = undefined; - return ret; -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js deleted file mode 100644 index 6fda9e80..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js +++ /dev/null @@ -1,492 +0,0 @@ -"use strict"; -module.exports = function() { -var async = require("./async.js"); -var util = require("./util.js"); -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var warn; - -function CapturedTrace(parent) { - this._parent = parent; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.parent = function() { - return this._parent; -}; - -CapturedTrace.prototype.hasParent = function() { - return this._parent !== undefined; -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = CapturedTrace.parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = stackFramePattern.test(line) || - " (No stack trace)" === line; - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0) { - stack = stack.slice(i); - } - return stack; -} - -CapturedTrace.parseStackAndMessage = function(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: cleanStack(stack) - }; -}; - -CapturedTrace.formatAndLogError = function(error, title) { - if (typeof console !== "undefined") { - var message; - if (typeof error === "object" || typeof error === "function") { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof warn === "function") { - warn(message); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -}; - -CapturedTrace.unhandledRejection = function (reason) { - CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: "); -}; - -CapturedTrace.isSupported = function () { - return typeof captureStackTrace === "function"; -}; - -CapturedTrace.fireRejectionEvent = -function(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent(name, reason, promise); - } catch (e) { - globalEventFired = true; - async.throwLater(e); - } - - var domEventFired = false; - if (fireDomEvent) { - try { - domEventFired = fireDomEvent(name.toLowerCase(), { - reason: reason, - promise: promise - }); - } catch (e) { - domEventFired = true; - async.throwLater(e); - } - } - - if (!globalEventFired && !localEventFired && !domEventFired && - name === "unhandledRejection") { - CapturedTrace.formatAndLogError(reason, "Unhandled rejection "); - } -}; - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj.toString(); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} -CapturedTrace.setBounds = function(firstLineError, lastLineError) { - if (!CapturedTrace.isSupported()) return; - var firstStackLines = firstLineError.stack.split("\n"); - var lastStackLines = lastLineError.stack.split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow) { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -var fireDomEvent; -var fireGlobalEvent = (function() { - if (util.isNode) { - return function(name, reason, promise) { - if (name === "rejectionHandled") { - return process.emit(name, promise); - } else { - return process.emit(name, reason, promise); - } - }; - } else { - var customEventWorks = false; - var anyEventWorks = true; - try { - var ev = new self.CustomEvent("test"); - customEventWorks = ev instanceof CustomEvent; - } catch (e) {} - if (!customEventWorks) { - try { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - self.dispatchEvent(event); - } catch (e) { - anyEventWorks = false; - } - } - if (anyEventWorks) { - fireDomEvent = function(type, detail) { - var event; - if (customEventWorks) { - event = new self.CustomEvent(type, { - detail: detail, - bubbles: false, - cancelable: true - }); - } else if (self.dispatchEvent) { - event = document.createEvent("CustomEvent"); - event.initCustomEvent(type, false, true, detail); - } - - return event ? !self.dispatchEvent(event) : false; - }; - } - - var toWindowMethodNameMap = {}; - toWindowMethodNameMap["unhandledRejection"] = ("on" + - "unhandledRejection").toLowerCase(); - toWindowMethodNameMap["rejectionHandled"] = ("on" + - "rejectionHandled").toLowerCase(); - - return function(name, reason, promise) { - var methodName = toWindowMethodNameMap[name]; - var method = self[methodName]; - if (!method) return false; - if (name === "rejectionHandled") { - method.call(self, promise); - } else { - method.call(self, reason, promise); - } - return true; - }; - } -})(); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - warn = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - warn = function(message) { - process.stderr.write("\u001b[31m" + message + "\u001b[39m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - warn = function(message) { - console.warn("%c" + message, "color: red"); - }; - } -} - -return CapturedTrace; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js deleted file mode 100644 index 040f0572..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = require("./util.js"); -var errors = require("./errors.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var keys = require("./es5.js").keys; -var TypeError = errors.TypeError; - -function CatchFilter(instances, callback, promise) { - this._instances = instances; - this._callback = callback; - this._promise = promise; -} - -function safePredicate(predicate, e) { - var safeObject = {}; - var retfilter = tryCatch(predicate).call(safeObject, e); - - if (retfilter === errorObj) return retfilter; - - var safeKeys = keys(safeObject); - if (safeKeys.length) { - errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"); - return errorObj; - } - return retfilter; -} - -CatchFilter.prototype.doFilter = function (e) { - var cb = this._callback; - var promise = this._promise; - var boundTo = promise._boundTo; - for (var i = 0, len = this._instances.length; i < len; ++i) { - var item = this._instances[i]; - var itemIsErrorType = item === Error || - (item != null && item.prototype instanceof Error); - - if (itemIsErrorType && e instanceof item) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } else if (typeof item === "function" && !itemIsErrorType) { - var shouldHandle = safePredicate(item, e); - if (shouldHandle === errorObj) { - e = errorObj.e; - break; - } else if (shouldHandle) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } - } - } - NEXT_FILTER.e = e; - return NEXT_FILTER; -}; - -return CatchFilter; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js deleted file mode 100644 index ccd7702b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -module.exports = function(Promise, CapturedTrace, isDebugging) { -var contextStack = []; -function Context() { - this._trace = new CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.pop(); - } -}; - -function createContext() { - if (isDebugging()) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} - -Promise.prototype._peekContext = peekContext; -Promise.prototype._pushContext = Context.prototype._pushContext; -Promise.prototype._popContext = Context.prototype._popContext; - -return createContext; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js deleted file mode 100644 index 5ac17670..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; -module.exports = function(Promise, CapturedTrace) { -var async = require("./async.js"); -var Warning = require("./errors.js").Warning; -var util = require("./util.js"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var debugging = false || (util.isNode && - (!!process.env["BLUEBIRD_DEBUG"] || - process.env["NODE_ENV"] === "development")); - -if (debugging) { - async.disableTrampolineIfNecessary(); -} - -Promise.prototype._ensurePossibleRejectionHandled = function () { - this._setRejectionIsUnhandled(); - async.invokeLater(this._notifyUnhandledRejection, this, undefined); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - CapturedTrace.fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._getCarriedStackTrace() || this._settledValue; - this._setUnhandledRejectionIsNotified(); - CapturedTrace.fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 524288; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~524288); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 524288) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 2097152; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~2097152); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 2097152) > 0; -}; - -Promise.prototype._setCarriedStackTrace = function (capturedTrace) { - this._bitField = this._bitField | 1048576; - this._fulfillmentHandler0 = capturedTrace; -}; - -Promise.prototype._isCarryingStackTrace = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._getCarriedStackTrace = function () { - return this._isCarryingStackTrace() - ? this._fulfillmentHandler0 - : undefined; -}; - -Promise.prototype._captureStackTrace = function () { - if (debugging) { - this._trace = new CapturedTrace(this._peekContext()); - } - return this; -}; - -Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { - if (debugging && canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = CapturedTrace.parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -}; - -Promise.prototype._warn = function(message) { - var warning = new Warning(message); - var ctx = this._peekContext(); - if (ctx) { - ctx.attachExtraTrace(warning); - } else { - var parsed = CapturedTrace.parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - CapturedTrace.formatAndLogError(warning, ""); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - unhandledRejectionHandled = typeof fn === "function" ? fn : undefined; -}; - -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && - debugging === false - ) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a"); - } - debugging = CapturedTrace.isSupported(); - if (debugging) { - async.disableTrampolineIfNecessary(); - } -}; - -Promise.hasLongStackTraces = function () { - return debugging && CapturedTrace.isSupported(); -}; - -if (!CapturedTrace.isSupported()) { - Promise.longStackTraces = function(){}; - debugging = false; -} - -return function() { - return debugging; -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js deleted file mode 100644 index 47a9ce9d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -var util = require("./util.js"); -var isPrimitive = util.isPrimitive; -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; - -module.exports = function(Promise) { -var returner = function () { - return this; -}; -var thrower = function () { - throw this; -}; -var returnUndefined = function() {}; -var throwUndefined = function() { - throw undefined; -}; - -var wrapper = function (value, action) { - if (action === 1) { - return function () { - throw value; - }; - } else if (action === 2) { - return function () { - return value; - }; - } -}; - - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value === undefined) return this.then(returnUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(value)) { - return this._then( - wrapper(value, 2), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(returner, undefined, undefined, value, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - if (reason === undefined) return this.then(throwUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(reason)) { - return this._then( - wrapper(reason, 1), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(thrower, undefined, undefined, reason, undefined); -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js deleted file mode 100644 index a37e22c0..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; - -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, null, INTERNAL); -}; - -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, null, INTERNAL); -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js deleted file mode 100644 index c334bb1c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -var es5 = require("./es5.js"); -var Objectfreeze = es5.freeze; -var util = require("./util.js"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js deleted file mode 100644 index ea41d5a5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js +++ /dev/null @@ -1,80 +0,0 @@ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js deleted file mode 100644 index ed57bf01..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; - -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; - -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js deleted file mode 100644 index ed84a2a1..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) { -var util = require("./util.js"); -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; -var isPrimitive = util.isPrimitive; -var thrower = util.thrower; - -function returnThis() { - return this; -} -function throwThis() { - throw this; -} -function return$(r) { - return function() { - return r; - }; -} -function throw$(r) { - return function() { - throw r; - }; -} -function promisedFinally(ret, reasonOrValue, isFulfilled) { - var then; - if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) { - then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue); - } else { - then = isFulfilled ? returnThis : throwThis; - } - return ret._then(then, thrower, undefined, reasonOrValue, undefined); -} - -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo) - : handler(); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, reasonOrValue, - promise.isFulfilled()); - } - } - - if (promise.isRejected()) { - NEXT_FILTER.e = reasonOrValue; - return NEXT_FILTER; - } else { - return reasonOrValue; - } -} - -function tapHandler(value) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo, value) - : handler(value); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, value, true); - } - } - return value; -} - -Promise.prototype._passThroughHandler = function (handler, isFinally) { - if (typeof handler !== "function") return this.then(); - - var promiseAndHandler = { - promise: this, - handler: handler - }; - - return this._then( - isFinally ? finallyHandler : tapHandler, - isFinally ? finallyHandler : undefined, undefined, - promiseAndHandler, undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThroughHandler(handler, true); -}; - -Promise.prototype.tap = function (handler) { - return this._passThroughHandler(handler, false); -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js deleted file mode 100644 index 4c0568d2..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise) { -var errors = require("./errors.js"); -var TypeError = errors.TypeError; -var util = require("./util.js"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; - -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; - } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} - -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; -} - -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; - -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._next(undefined); -}; - -PromiseSpawn.prototype._continue = function (result) { - if (result === errorObj) { - return this._promise._rejectCallback(result.e, false, true); - } - - var value = result.value; - if (result.done === true) { - this._promise._resolveCallback(value); - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._throw( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } - } - maybePromise._then( - this._next, - this._throw, - undefined, - this, - null - ); - } -}; - -PromiseSpawn.prototype._throw = function (reason) { - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._next = function (value) { - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; - -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - spawn._generator = generator; - spawn._next(undefined); - return spawn.promise(); - }; -}; - -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - yieldHandlers.push(fn); -}; - -Promise.spawn = function (generatorFunction) { - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js deleted file mode 100644 index cf33eb1d..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) { -var util = require("./util.js"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!false) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var caller = function(count) { - var values = []; - for (var i = 1; i <= count; ++i) values.push("holder.p" + i); - return new Function("holder", " \n\ - 'use strict'; \n\ - var callback = holder.fn; \n\ - return callback(values); \n\ - ".replace(/values/g, values.join(", "))); - }; - var thenCallbacks = []; - var callers = [undefined]; - for (var i = 1; i <= 5; ++i) { - thenCallbacks.push(thenCallback(i)); - callers.push(caller(i)); - } - - var Holder = function(total, fn) { - this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null; - this.fn = fn; - this.total = total; - this.now = 0; - }; - - Holder.prototype.callers = callers; - Holder.prototype.checkFulfillment = function(promise) { - var now = this.now; - now++; - var total = this.total; - if (now >= total) { - var handler = this.callers[total]; - promise._pushContext(); - var ret = tryCatch(handler)(this); - promise._popContext(); - if (ret === errorObj) { - promise._rejectCallback(ret.e, false, true); - } else { - promise._resolveCallback(ret); - } - } else { - this.now = now; - } - }; - - var reject = function (reason) { - this._reject(reason); - }; -} -} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!false) { - if (last < 6 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var holder = new Holder(last, fn); - var callbacks = thenCallbacks; - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - } else if (maybePromise._isFulfilled()) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else { - ret._reject(maybePromise._reason()); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - return ret; - } - } - } - var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js deleted file mode 100644 index 66a5b179..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = require("./async.js"); -var util = require("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var PENDING = {}; -var EMPTY_ARRAY = []; - -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._callback = fn; - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = limit >= 1 ? [] : EMPTY_ARRAY; - async.invoke(init, this, undefined); -} -util.inherits(MappingPromiseArray, PromiseArray); -function init() {this._init$(undefined, -2);} - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - if (values[index] === PENDING) { - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return; - } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return; - } - if (preservedValues !== null) preservedValues[index] = value; - - var callback = this._callback; - var receiver = this._promise._boundTo; - this._promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - this._promise._popContext(); - if (ret === errorObj) return this._reject(ret.e); - - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - if (limit >= 1) this._inFlight++; - values[index] = PENDING; - return maybePromise._proxyPromiseArray(this, index); - } else if (maybePromise._isFulfilled()) { - ret = maybePromise._value(); - } else { - return this._reject(maybePromise._reason()); - } - } - values[index] = ret; - } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); - } else { - this._resolve(values); - } - - } -}; - -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); - } -}; - -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; - } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; - -function map(promises, fn, options, _filter) { - var limit = typeof options === "object" && options !== null - ? options.concurrency - : 0; - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter); -} - -Promise.prototype.map = function (fn, options) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - - return map(this, fn, options, null).promise(); -}; - -Promise.map = function (promises, fn, options, _filter) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - return map(promises, fn, options, _filter).promise(); -}; - - -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js deleted file mode 100644 index 3d3eeb17..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = require("./util.js"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn, args, ctx) { - if (typeof fn !== "function") { - return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = util.isArray(args) - ? tryCatch(fn).apply(ctx, args) - : tryCatch(fn).call(ctx, args); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false, true); - } else { - this._resolveCallback(value, true); - } -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js deleted file mode 100644 index f305b936..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var util = require("./util.js"); -var async = require("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundTo; - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var target = promise._target(); - var newReason = target._getCarriedStackTrace(); - newReason.cause = reason; - reason = newReason; - } - var ret = tryCatch(nodeback).call(promise._boundTo, reason); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -Promise.prototype.asCallback = -Promise.prototype.nodeify = function (nodeback, options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); - } - return this; -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js deleted file mode 100644 index 2e3e95e5..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -module.exports = function(Promise, PromiseArray) { -var util = require("./util.js"); -var async = require("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -Promise.prototype.progressed = function (handler) { - return this._then(undefined, undefined, handler, undefined, undefined); -}; - -Promise.prototype._progress = function (progressValue) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._target()._progressUnchecked(progressValue); - -}; - -Promise.prototype._progressHandlerAt = function (index) { - return index === 0 - ? this._progressHandler0 - : this[(index << 2) + index - 5 + 2]; -}; - -Promise.prototype._doProgressWith = function (progression) { - var progressValue = progression.value; - var handler = progression.handler; - var promise = progression.promise; - var receiver = progression.receiver; - - var ret = tryCatch(handler).call(receiver, progressValue); - if (ret === errorObj) { - if (ret.e != null && - ret.e.name !== "StopProgressPropagation") { - var trace = util.canAttachTrace(ret.e) - ? ret.e : new Error(util.toString(ret.e)); - promise._attachExtraTrace(trace); - promise._progress(ret.e); - } - } else if (ret instanceof Promise) { - ret._then(promise._progress, null, null, promise, undefined); - } else { - promise._progress(ret); - } -}; - - -Promise.prototype._progressUnchecked = function (progressValue) { - var len = this._length(); - var progress = this._progress; - for (var i = 0; i < len; i++) { - var handler = this._progressHandlerAt(i); - var promise = this._promiseAt(i); - if (!(promise instanceof Promise)) { - var receiver = this._receiverAt(i); - if (typeof handler === "function") { - handler.call(receiver, progressValue, promise); - } else if (receiver instanceof PromiseArray && - !receiver._isResolved()) { - receiver._promiseProgressed(progressValue, promise); - } - continue; - } - - if (typeof handler === "function") { - async.invoke(this._doProgressWith, this, { - handler: handler, - promise: promise, - receiver: this._receiverAt(i), - value: progressValue - }); - } else { - async.invoke(progress, promise, progressValue); - } - } -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js deleted file mode 100644 index f80d247b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js +++ /dev/null @@ -1,700 +0,0 @@ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a"); -}; -var reflect = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -var util = require("./util.js"); -var async = require("./async.js"); -var errors = require("./errors.js"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {e: null}; -var tryConvertToPromise = require("./thenables.js")(Promise, INTERNAL); -var PromiseArray = - require("./promise_array.js")(Promise, INTERNAL, - tryConvertToPromise, apiRejection); -var CapturedTrace = require("./captured_trace.js")(); -var isDebugging = require("./debuggability.js")(Promise, CapturedTrace); - /*jshint unused:false*/ -var createContext = - require("./context.js")(Promise, CapturedTrace, isDebugging); -var CatchFilter = require("./catch_filter.js")(NEXT_FILTER); -var PromiseResolver = require("./promise_resolver.js"); -var nodebackForPromise = PromiseResolver._nodebackForPromise; -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function Promise(resolver) { - if (typeof resolver !== "function") { - throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a"); - } - if (this.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a"); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._progressHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._settledValue = undefined; - if (resolver !== INTERNAL) this._resolveFromResolver(resolver); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (typeof item === "function") { - catchInstances[j++] = item; - } else { - return Promise.reject( - new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a")); - } - } - catchInstances.length = j; - fn = arguments[i]; - var catchFilter = new CatchFilter(catchInstances, fn, this); - return this._then(undefined, catchFilter.doFilter, undefined, - catchFilter, undefined); - } - return this._then(undefined, fn, undefined, undefined, undefined); -}; - -Promise.prototype.reflect = function () { - return this._then(reflect, reflect, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject, didProgress) { - if (isDebugging() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, didProgress, - undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject, didProgress) { - var promise = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (didFulfill, didReject) { - return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined); -}; - -Promise.prototype.isCancellable = function () { - return !this.isResolved() && - this._cancellable(); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = function(fn) { - var ret = new Promise(INTERNAL); - var result = tryCatch(fn)(nodebackForPromise(ret)); - if (result === errorObj) { - ret._rejectCallback(result.e, true, true); - } - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.defer = Promise.pending = function () { - var promise = new Promise(INTERNAL); - return new PromiseResolver(promise); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - var val = ret; - ret = new Promise(INTERNAL); - ret._fulfillUnchecked(val); - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - var prev = async._schedule; - async._schedule = fn; - return prev; -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - didProgress, - receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var ret = haveInternalData ? internalData : new Promise(INTERNAL); - - if (!haveInternalData) { - ret._propagateFrom(this, 4 | 1); - ret._captureStackTrace(); - } - - var target = this._target(); - if (target !== this) { - if (receiver === undefined) receiver = this._boundTo; - if (!haveInternalData) ret._setIsMigrated(); - } - - var callbackIndex = - target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver); - - if (target._isResolved() && !target._isSettlePromisesQueued()) { - async.invoke( - target._settlePromiseAtPostResolution, target, callbackIndex); - } - - return ret; -}; - -Promise.prototype._settlePromiseAtPostResolution = function (index) { - if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled(); - this._settlePromiseAt(index); -}; - -Promise.prototype._length = function () { - return this._bitField & 131071; -}; - -Promise.prototype._isFollowingOrFulfilledOrRejected = function () { - return (this._bitField & 939524096) > 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 536870912) === 536870912; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -131072) | - (len & 131071); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 134217728; -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 536870912; -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 33554432; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 33554432) > 0; -}; - -Promise.prototype._cancellable = function () { - return (this._bitField & 67108864) > 0; -}; - -Promise.prototype._setCancellable = function () { - this._bitField = this._bitField | 67108864; -}; - -Promise.prototype._unsetCancellable = function () { - this._bitField = this._bitField & (~67108864); -}; - -Promise.prototype._setIsMigrated = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._unsetIsMigrated = function () { - this._bitField = this._bitField & (~4194304); -}; - -Promise.prototype._isMigrated = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 - ? this._receiver0 - : this[ - index * 5 - 5 + 4]; - if (ret === undefined && this._isBound()) { - return this._boundTo; - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return index === 0 - ? this._promise0 - : this[index * 5 - 5 + 3]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return index === 0 - ? this._fulfillmentHandler0 - : this[index * 5 - 5 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return index === 0 - ? this._rejectionHandler0 - : this[index * 5 - 5 + 1]; -}; - -Promise.prototype._migrateCallbacks = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var progress = follower._progressHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (promise instanceof Promise) promise._setIsMigrated(); - this._addCallbacks(fulfill, reject, progress, promise, receiver); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - progress, - promise, - receiver -) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - if (receiver !== undefined) this._receiver0 = receiver; - if (typeof fulfill === "function" && !this._isCarryingStackTrace()) - this._fulfillmentHandler0 = fulfill; - if (typeof reject === "function") this._rejectionHandler0 = reject; - if (typeof progress === "function") this._progressHandler0 = progress; - } else { - var base = index * 5 - 5; - this[base + 3] = promise; - this[base + 4] = receiver; - if (typeof fulfill === "function") - this[base + 0] = fulfill; - if (typeof reject === "function") - this[base + 1] = reject; - if (typeof progress === "function") - this[base + 2] = progress; - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - if (index === 0) { - this._promise0 = promiseSlotValue; - this._receiver0 = receiver; - } else { - var base = index * 5 - 5; - this[base + 3] = promiseSlotValue; - this[base + 4] = receiver; - } - this._setLength(index + 1); -}; - -Promise.prototype._proxyPromiseArray = function (promiseArray, index) { - this._setProxyHandlers(promiseArray, index); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (this._isFollowingOrFulfilledOrRejected()) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false, true); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - var propagationFlags = 1 | (shouldBind ? 4 : 0); - this._propagateFrom(maybePromise, propagationFlags); - var promise = maybePromise._target(); - if (promise._isPending()) { - var len = this._length(); - for (var i = 0; i < len; ++i) { - promise._migrateCallbacks(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(promise); - } else if (promise._isFulfilled()) { - this._fulfillUnchecked(promise._value()); - } else { - this._rejectUnchecked(promise._reason(), - promise._getCarriedStackTrace()); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, shouldNotMarkOriginatingFromRejection) { - if (!shouldNotMarkOriginatingFromRejection) { - util.markAsOriginatingFromRejection(reason); - } - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason, hasStack ? undefined : trace); -}; - -Promise.prototype._resolveFromResolver = function (resolver) { - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = tryCatch(resolver)(function(value) { - if (promise === null) return; - promise._resolveCallback(value); - promise = null; - }, function (reason) { - if (promise === null) return; - promise._rejectCallback(reason, synchronous); - promise = null; - }); - synchronous = false; - this._popContext(); - - if (r !== undefined && r === errorObj && promise !== null) { - promise._rejectCallback(r.e, true, true); - promise = null; - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - if (promise._isRejected()) return; - promise._pushContext(); - var x; - if (receiver === APPLY && !this._isRejected()) { - x = tryCatch(handler).apply(this._boundTo, value); - } else { - x = tryCatch(handler).call(receiver, value); - } - promise._popContext(); - - if (x === errorObj || x === promise || x === NEXT_FILTER) { - var err = x === promise ? makeSelfResolutionError() : x.e; - promise._rejectCallback(err, false, true); - } else { - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._cleanValues = function () { - if (this._cancellable()) { - this._cancellationParent = undefined; - } -}; - -Promise.prototype._propagateFrom = function (parent, flags) { - if ((flags & 1) > 0 && parent._cancellable()) { - this._setCancellable(); - this._cancellationParent = parent; - } - if ((flags & 4) > 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -}; - -Promise.prototype._fulfill = function (value) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._fulfillUnchecked(value); -}; - -Promise.prototype._reject = function (reason, carriedStackTrace) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._rejectUnchecked(reason, carriedStackTrace); -}; - -Promise.prototype._settlePromiseAt = function (index) { - var promise = this._promiseAt(index); - var isPromise = promise instanceof Promise; - - if (isPromise && promise._isMigrated()) { - promise._unsetIsMigrated(); - return async.invoke(this._settlePromiseAt, this, index); - } - var handler = this._isFulfilled() - ? this._fulfillmentHandlerAt(index) - : this._rejectionHandlerAt(index); - - var carriedStackTrace = - this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined; - var value = this._settledValue; - var receiver = this._receiverAt(index); - - - this._clearCallbackDataAtIndex(index); - - if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof PromiseArray) { - if (!receiver._isResolved()) { - if (this._isFulfilled()) { - receiver._promiseFulfilled(value, promise); - } - else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (this._isFulfilled()) { - promise._fulfill(value); - } else { - promise._reject(value, carriedStackTrace); - } - } - - if (index >= 4 && (index & 31) === 4) - async.invokeLater(this._setLength, this, 0); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - if (index === 0) { - if (!this._isCarryingStackTrace()) { - this._fulfillmentHandler0 = undefined; - } - this._rejectionHandler0 = - this._progressHandler0 = - this._receiver0 = - this._promise0 = undefined; - } else { - var base = index * 5 - 5; - this[base + 3] = - this[base + 4] = - this[base + 0] = - this[base + 1] = - this[base + 2] = undefined; - } -}; - -Promise.prototype._isSettlePromisesQueued = function () { - return (this._bitField & - -1073741824) === -1073741824; -}; - -Promise.prototype._setSettlePromisesQueued = function () { - this._bitField = this._bitField | -1073741824; -}; - -Promise.prototype._unsetSettlePromisesQueued = function () { - this._bitField = this._bitField & (~-1073741824); -}; - -Promise.prototype._queueSettlePromises = function() { - async.settlePromises(this); - this._setSettlePromisesQueued(); -}; - -Promise.prototype._fulfillUnchecked = function (value) { - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err, undefined); - } - this._setFulfilled(); - this._settledValue = value; - this._cleanValues(); - - if (this._length() > 0) { - this._queueSettlePromises(); - } -}; - -Promise.prototype._rejectUncheckedCheckError = function (reason) { - var trace = util.ensureErrorObject(reason); - this._rejectUnchecked(reason, trace === reason ? undefined : trace); -}; - -Promise.prototype._rejectUnchecked = function (reason, trace) { - if (reason === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err); - } - this._setRejected(); - this._settledValue = reason; - this._cleanValues(); - - if (this._isFinal()) { - async.throwLater(function(e) { - if ("stack" in e) { - async.invokeFirst( - CapturedTrace.unhandledRejection, undefined, e); - } - throw e; - }, trace === undefined ? reason : trace); - return; - } - - if (trace !== undefined && trace !== reason) { - this._setCarriedStackTrace(trace); - } - - if (this._length() > 0) { - this._queueSettlePromises(); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._settlePromises = function () { - this._unsetSettlePromisesQueued(); - var len = this._length(); - for (var i = 0; i < len; i++) { - this._settlePromiseAt(i); - } -}; - -Promise._makeSelfResolutionError = makeSelfResolutionError; -require("./progress.js")(Promise, PromiseArray); -require("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection); -require("./bind.js")(Promise, INTERNAL, tryConvertToPromise); -require("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise); -require("./direct_resolve.js")(Promise); -require("./synchronous_inspection.js")(Promise); -require("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL); -Promise.Promise = Promise; -require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -require('./cancel.js')(Promise); -require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext); -require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise); -require('./nodeify.js')(Promise); -require('./call_get.js')(Promise); -require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -require('./settle.js')(Promise, PromiseArray); -require('./some.js')(Promise, PromiseArray, apiRejection); -require('./promisify.js')(Promise, INTERNAL); -require('./any.js')(Promise); -require('./each.js')(Promise, INTERNAL); -require('./timers.js')(Promise, INTERNAL); -require('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._progressHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - p._settledValue = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - CapturedTrace.setBounds(async.firstLineError, util.lastLineError); - return Promise; - -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js deleted file mode 100644 index 6dac8664..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection) { -var util = require("./util.js"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - var parent; - if (values instanceof Promise) { - parent = values; - promise._propagateFrom(parent, 1 | 4); - } - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - this._values = values; - if (values._isFulfilled()) { - values = values._value(); - if (!isArray(values)) { - var err = new Promise.TypeError("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - this.__hardReject__(err); - return; - } - } else if (values._isPending()) { - values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - return; - } else { - this._reject(values._reason()); - return; - } - } else if (!isArray(values)) { - this._promise._reject(apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a")._reason()); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var promise = this._promise; - for (var i = 0; i < len; ++i) { - var isResolved = this._isResolved(); - var maybePromise = tryConvertToPromise(values[i], promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (isResolved) { - maybePromise._unsetRejectionIsUnhandled(); - } else if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, i); - } else if (maybePromise._isFulfilled()) { - this._promiseFulfilled(maybePromise._value(), i); - } else { - this._promiseRejected(maybePromise._reason(), i); - } - } else if (!isResolved) { - this._promiseFulfilled(maybePromise, i); - } - } -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype.__hardReject__ = -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false, true); -}; - -PromiseArray.prototype._promiseProgressed = function (progressValue, index) { - this._promise._progress({ - index: index, - value: progressValue - }); -}; - - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -PromiseArray.prototype._promiseRejected = function (reason, index) { - this._totalResolved++; - this._reject(reason); -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js deleted file mode 100644 index b180a328..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -var util = require("./util.js"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = require("./errors.js"); -var TimeoutError = errors.TimeoutError; -var OperationalError = errors.OperationalError; -var haveGetters = util.haveGetters; -var es5 = require("./es5.js"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise) { - return function(err, value) { - if (promise === null) return; - - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (arguments.length > 2) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - promise._fulfill(args); - } else { - promise._fulfill(value); - } - - promise = null; - }; -} - - -var PromiseResolver; -if (!haveGetters) { - PromiseResolver = function (promise) { - this.promise = promise; - this.asCallback = nodebackForPromise(promise); - this.callback = this.asCallback; - }; -} -else { - PromiseResolver = function (promise) { - this.promise = promise; - }; -} -if (haveGetters) { - var prop = { - get: function() { - return nodebackForPromise(this.promise); - } - }; - es5.defineProperty(PromiseResolver.prototype, "asCallback", prop); - es5.defineProperty(PromiseResolver.prototype, "callback", prop); -} - -PromiseResolver._nodebackForPromise = nodebackForPromise; - -PromiseResolver.prototype.toString = function () { - return "[object PromiseResolver]"; -}; - -PromiseResolver.prototype.resolve = -PromiseResolver.prototype.fulfill = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._resolveCallback(value); -}; - -PromiseResolver.prototype.reject = function (reason) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._rejectCallback(reason); -}; - -PromiseResolver.prototype.progress = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._progress(value); -}; - -PromiseResolver.prototype.cancel = function (err) { - this.promise.cancel(err); -}; - -PromiseResolver.prototype.timeout = function () { - this.reject(new TimeoutError("timeout")); -}; - -PromiseResolver.prototype.isResolved = function () { - return this.promise.isResolved(); -}; - -PromiseResolver.prototype.toJSON = function () { - return this.promise.toJSON(); -}; - -module.exports = PromiseResolver; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js deleted file mode 100644 index 03553445..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js +++ /dev/null @@ -1,291 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = require("./util.js"); -var nodebackForPromise = require("./promise_resolver.js") - ._nodebackForPromise; -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = require("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyPropsPattern = - /^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/; -var defaultFilter = function(name, func) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - !util.isClass(func); -}; - -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} - -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} - -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/iWrZbw\u000a" - .replace("%s", suffix)); - } - } - } - } -} - -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} - -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; - -var makeNodePromisifiedEval; -if (!false) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; - -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; - -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; - -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; - -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; - - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); - } - - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } - - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; - } - - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "INTERNAL","'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - return promise; \n\ - }; \n\ - ret.__isPromisified__ = true; \n\ - return ret; \n\ - " - .replace("Parameters", parameterDeclaration(newParameterCount)) - .replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode))( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - INTERNAL - ); -}; -} - -function makeNodePromisifiedClosure(callback, receiver, _, fn) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; - } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - return promise; - } - promisified.__isPromisified__ = true; - return promisified; -} - -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; - -function promisifyAll(obj, suffix, filter, promisifier) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); - - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - obj[promisifiedKey] = promisifier === makeNodePromisified - ? makeNodePromisified(key, THIS, key, fn, suffix) - : promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, fn, suffix); - }); - } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver) { - return makeNodePromisified(callback, receiver, undefined, callback); -} - -Promise.promisify = function (fn, receiver) { - if (typeof fn !== "function") { - throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - if (isPromisified(fn)) { - return fn; - } - var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/9ITlV0\u000a"); - } - options = Object(options); - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; - - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/8FZo5V\u000a"); - } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier); - promisifyAll(value, suffix, filter, promisifier); - } - } - - return promisifyAll(target, suffix, filter, promisifier); -}; -}; - diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js deleted file mode 100644 index d6f9e64b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = require("./util.js"); -var isObject = util.isObject; -var es5 = require("./es5.js"); - -function PropertiesPromiseArray(obj) { - var keys = es5.keys(obj); - var len = keys.length; - var values = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - values[i] = obj[key]; - values[i + len] = key; - } - this.constructor$(values); -} -util.inherits(PropertiesPromiseArray, PromiseArray); - -PropertiesPromiseArray.prototype._init = function () { - this._init$(undefined, -3) ; -}; - -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - this._resolve(val); - } -}; - -PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { - this._promise._progress({ - key: this._values[index + this.length()], - value: value - }); -}; - -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; - -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); - - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/OsFKC8\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } - - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 4); - } - return ret; -} - -Promise.prototype.props = function () { - return props(this); -}; - -Promise.props = function (promises) { - return props(promises); -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js deleted file mode 100644 index 84d57d5f..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype._unshiftOne = function(value) { - var capacity = this._capacity; - this._checkCapacity(this.length() + 1); - var front = this._front; - var i = (((( front - 1 ) & - ( capacity - 1) ) ^ capacity ) - capacity ); - this[i] = value; - this._front = i; - this._length = this.length() + 1; -}; - -Queue.prototype.unshift = function(fn, receiver, arg) { - this._unshiftOne(arg); - this._unshiftOne(receiver); - this._unshiftOne(fn); -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js deleted file mode 100644 index 30e7bb09..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var isArray = require("./util.js").isArray; - -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; - -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); - - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else if (!isArray(promises)) { - return apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - } - - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 4 | 1); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; - - if (val === undefined && !(i in promises)) { - continue; - } - - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} - -Promise.race = function (promises) { - return race(promises, undefined); -}; - -Promise.prototype.race = function () { - return race(this, undefined); -}; - -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js deleted file mode 100644 index 31922201..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = require("./async.js"); -var util = require("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -function ReductionPromiseArray(promises, fn, accum, _each) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._preservedValues = _each === INTERNAL ? [] : null; - this._zerothIsAccum = (accum === undefined); - this._gotAccum = false; - this._reducingIndex = (this._zerothIsAccum ? 1 : 0); - this._valuesPhase = undefined; - var maybePromise = tryConvertToPromise(accum, this._promise); - var rejected = false; - var isPromise = maybePromise instanceof Promise; - if (isPromise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, -1); - } else if (maybePromise._isFulfilled()) { - accum = maybePromise._value(); - this._gotAccum = true; - } else { - this._reject(maybePromise._reason()); - rejected = true; - } - } - if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true; - this._callback = fn; - this._accum = accum; - if (!rejected) async.invoke(init, this, undefined); -} -function init() { - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); - -ReductionPromiseArray.prototype._init = function () {}; - -ReductionPromiseArray.prototype._resolveEmptyArray = function () { - if (this._gotAccum || this._zerothIsAccum) { - this._resolve(this._preservedValues !== null - ? [] : this._accum); - } -}; - -ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - values[index] = value; - var length = this.length(); - var preservedValues = this._preservedValues; - var isEach = preservedValues !== null; - var gotAccum = this._gotAccum; - var valuesPhase = this._valuesPhase; - var valuesPhaseIndex; - if (!valuesPhase) { - valuesPhase = this._valuesPhase = new Array(length); - for (valuesPhaseIndex=0; valuesPhaseIndex 10) || (version[0] > 0) - ? function(fn) { global.setImmediate(fn); } : process.nextTick; - - if (!schedule) { - if (typeof setImmediate !== "undefined") { - schedule = setImmediate; - } else if (typeof setTimeout !== "undefined") { - schedule = setTimeout; - } else { - schedule = noAsyncScheduler; - } - } -} else if (typeof MutationObserver !== "undefined") { - schedule = function(fn) { - var div = document.createElement("div"); - var observer = new MutationObserver(fn); - observer.observe(div, {attributes: true}); - return function() { div.classList.toggle("foo"); }; - }; - schedule.isStatic = true; -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js deleted file mode 100644 index f9299c25..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -module.exports = - function(Promise, PromiseArray) { -var PromiseInspection = Promise.PromiseInspection; -var util = require("./util.js"); - -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); - -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 268435456; - ret._settledValue = value; - this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 134217728; - ret._settledValue = reason; - this._promiseResolved(index, ret); -}; - -Promise.settle = function (promises) { - return new SettledPromiseArray(promises).promise(); -}; - -Promise.prototype.settle = function () { - return new SettledPromiseArray(this).promise(); -}; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js deleted file mode 100644 index f3968cf1..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js +++ /dev/null @@ -1,125 +0,0 @@ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = require("./util.js"); -var RangeError = require("./errors.js").RangeError; -var AggregateError = require("./errors.js").AggregateError; -var isArray = util.isArray; - - -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); - -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; - -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; - -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; - -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; - -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; - -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - } - -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - e.push(this._values[i]); - } - this._reject(e); - } -}; - -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; - -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; - -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; - -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; - -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; - -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; - -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; - -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/1wAmHx\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} - -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; - -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; - -Promise._SomePromiseArray = SomePromiseArray; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js deleted file mode 100644 index 7aac1496..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValue = promise._settledValue; - } - else { - this._bitField = 0; - this._settledValue = undefined; - } -} - -PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.isFulfilled = -Promise.prototype._isFulfilled = function () { - return (this._bitField & 268435456) > 0; -}; - -PromiseInspection.prototype.isRejected = -Promise.prototype._isRejected = function () { - return (this._bitField & 134217728) > 0; -}; - -PromiseInspection.prototype.isPending = -Promise.prototype._isPending = function () { - return (this._bitField & 402653184) === 0; -}; - -PromiseInspection.prototype.isResolved = -Promise.prototype._isResolved = function () { - return (this._bitField & 402653184) > 0; -}; - -Promise.prototype.isPending = function() { - return this._target()._isPending(); -}; - -Promise.prototype.isRejected = function() { - return this._target()._isRejected(); -}; - -Promise.prototype.isFulfilled = function() { - return this._target()._isFulfilled(); -}; - -Promise.prototype.isResolved = function() { - return this._target()._isResolved(); -}; - -Promise.prototype._value = function() { - return this._settledValue; -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue; -}; - -Promise.prototype.value = function() { - var target = this._target(); - if (!target.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return target._settledValue; -}; - -Promise.prototype.reason = function() { - var target = this._target(); - if (!target.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - target._unsetRejectionIsUnhandled(); - return target._settledValue; -}; - - -Promise.PromiseInspection = PromiseInspection; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js deleted file mode 100644 index c858f86a..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js +++ /dev/null @@ -1,89 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = require("./util.js"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) { - return obj; - } - else if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfillUnchecked, - ret._rejectUncheckedCheckError, - ret._progressUnchecked, - ret, - null - ); - return ret; - } - var then = util.tryCatch(getThen)(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - return doThenable(obj, then, context); - } - } - return obj; -} - -function getThen(obj) { - return obj.then; -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - return hasProp.call(obj, "_promise0"); -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, - resolveFromThenable, - rejectFromThenable, - progressFromThenable); - synchronous = false; - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolveFromThenable(value) { - if (!promise) return; - if (x === value) { - promise._rejectCallback( - Promise._makeSelfResolutionError(), false, true); - } else { - promise._resolveCallback(value); - } - promise = null; - } - - function rejectFromThenable(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - - function progressFromThenable(value) { - if (!promise) return; - if (typeof promise._progress === "function") { - promise._progress(value); - } - } - return ret; -} - -return tryConvertToPromise; -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js deleted file mode 100644 index ecf1b576..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = require("./util.js"); -var TimeoutError = Promise.TimeoutError; - -var afterTimeout = function (promise, message) { - if (!promise.isPending()) return; - if (typeof message !== "string") { - message = "operation timed out"; - } - var err = new TimeoutError(message); - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._cancel(err); -}; - -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (value, ms) { - if (ms === undefined) { - ms = value; - value = undefined; - var ret = new Promise(INTERNAL); - setTimeout(function() { ret._fulfill(); }, ms); - return ret; - } - ms = +ms; - return Promise.resolve(value)._then(afterValue, null, null, ms, undefined); -}; - -Promise.prototype.delay = function (ms) { - return delay(this, ms); -}; - -function successClear(value) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - return value; -} - -function failureClear(reason) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - throw reason; -} - -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret = this.then().cancellable(); - ret._cancellationParent = this; - var handle = setTimeout(function timeoutTimeout() { - afterTimeout(ret, message); - }, ms); - return ret._then(successClear, failureClear, undefined, handle, undefined); -}; - -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js deleted file mode 100644 index 40387117..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js +++ /dev/null @@ -1,202 +0,0 @@ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext) { - var TypeError = require("./errors.js").TypeError; - var inherits = require("./util.js").inherits; - var PromiseInspection = Promise.PromiseInspection; - - function inspectionMapper(inspections) { - var len = inspections.length; - for (var i = 0; i < len; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - return Promise.reject(inspection.error()); - } - inspections[i] = inspection._settledValue; - } - return inspections; - } - - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } - - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = Promise.defer(); - function iterator() { - if (i >= len) return ret.resolve(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); - } - } - iterator(); - } - iterator(); - return ret.promise; - } - - function disposerSuccess(value) { - var inspection = new PromiseInspection(); - inspection._settledValue = value; - inspection._bitField = 268435456; - return dispose(this, inspection).thenReturn(value); - } - - function disposerFail(reason) { - var inspection = new PromiseInspection(); - inspection._settledValue = reason; - inspection._bitField = 134217728; - return dispose(this, inspection).thenThrow(reason); - } - - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } - - Disposer.prototype.data = function () { - return this._data; - }; - - Disposer.prototype.promise = function () { - return this._promise; - }; - - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return null; - }; - - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== null - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; - - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; - - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); - - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; - - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } - - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - len--; - var resources = new Array(len); - for (var i = 0; i < len; ++i) { - var resource = arguments[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } - - var promise = Promise.settle(resources) - .then(inspectionMapper) - .then(function(vals) { - promise._pushContext(); - var ret; - try { - ret = fn.apply(undefined, vals); - } finally { - promise._popContext(); - } - return ret; - }) - ._then( - disposerSuccess, disposerFail, undefined, resources, undefined); - resources.promise = promise; - return promise; - }; - - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 262144; - this._disposer = disposer; - }; - - Promise.prototype._isDisposable = function () { - return (this._bitField & 262144) > 0; - }; - - Promise.prototype._getDisposer = function () { - return this._disposer; - }; - - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~262144); - this._disposer = undefined; - }; - - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; - -}; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js deleted file mode 100644 index fbee5deb..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js +++ /dev/null @@ -1,280 +0,0 @@ -"use strict"; -var es5 = require("./es5.js"); -var canEvaluate = typeof navigator == "undefined"; -var haveGetters = (function(){ - try { - var o = {}; - es5.defineProperty(o, "f", { - get: function () { - return 3; - } - }); - return o.f === 3; - } - catch (e) { - return false; - } - -})(); - -var errorObj = {e: {}}; -var tryCatchTarget; -function tryCatcher() { - try { - return tryCatchTarget.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return !isPrimitive(value); -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - - -var wrapsPrimitiveReceiver = (function() { - return this !== "string"; -}).call("string"); - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - if (es5.isES5) { - var oProto = Object.prototype; - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && obj !== oProto) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - return function(obj) { - var ret = []; - /*jshint forin:false */ - for (var key in obj) { - ret.push(key); - } - return ret; - }; - } - -})(); - -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - if (es5.isES5) return keys.length > 1; - return keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function f() {} - f.prototype = obj; - var l = 8; - while (l--) new f(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return obj instanceof Error && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } - } -} - -var ret = { - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - haveGetters: haveGetters, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - wrapsPrimitiveReceiver: wrapsPrimitiveReceiver, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - hasDevTools: typeof chrome !== "undefined" && chrome && - typeof chrome.loadTimes === "function", - isNode: typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]" -}; -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json deleted file mode 100644 index 4371fc34..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json +++ /dev/null @@ -1,97 +0,0 @@ -{ - "name": "bluebird", - "description": "Full featured Promises/A+ implementation with exceptionally good performance", - "version": "2.9.26", - "keywords": [ - "promise", - "performance", - "promises", - "promises-a", - "promises-aplus", - "async", - "await", - "deferred", - "deferreds", - "future", - "flow control", - "dsl", - "fluent interface" - ], - "scripts": { - "lint": "node scripts/jshint.js", - "test": "node tools/test.js", - "istanbul": "istanbul", - "prepublish": "node tools/build.js --no-debug --main --zalgo --browser --minify" - }, - "homepage": "https://github.com/petkaantonov/bluebird", - "repository": { - "type": "git", - "url": "git://github.com/petkaantonov/bluebird.git" - }, - "bugs": { - "url": "http://github.com/petkaantonov/bluebird/issues" - }, - "license": "MIT", - "author": { - "name": "Petka Antonov", - "email": "petka_antonov@hotmail.com", - "url": "http://github.com/petkaantonov/" - }, - "devDependencies": { - "acorn": "~0.6.0", - "baconjs": "^0.7.43", - "bluebird": "^2.9.2", - "body-parser": "^1.10.2", - "browserify": "^8.1.1", - "cli-table": "~0.3.1", - "co": "^4.2.0", - "cross-spawn": "^0.2.3", - "glob": "^4.3.2", - "grunt-saucelabs": "~8.4.1", - "highland": "^2.3.0", - "istanbul": "^0.3.5", - "jshint": "^2.6.0", - "jshint-stylish": "~0.2.0", - "mkdirp": "~0.5.0", - "mocha": "~2.1", - "open": "~0.0.5", - "optimist": "~0.6.1", - "rimraf": "~2.2.6", - "rx": "^2.3.25", - "serve-static": "^1.7.1", - "sinon": "~1.7.3", - "uglify-js": "~2.4.16" - }, - "main": "./js/main/bluebird.js", - "browser": "./js/browser/bluebird.js", - "files": [ - "js/browser", - "js/main", - "js/zalgo", - "LICENSE", - "zalgo.js" - ], - "gitHead": "c6604d44f219af9da683f6e28d818008fa374af2", - "_id": "bluebird@2.9.26", - "_shasum": "362772ea4d09f556a4b9f3b64c2fd136e87e3a55", - "_from": "bluebird@2.9.26", - "_npmVersion": "2.7.1", - "_nodeVersion": "1.6.2", - "_npmUser": { - "name": "esailija", - "email": "petka_antonov@hotmail.com" - }, - "maintainers": [ - { - "name": "esailija", - "email": "petka_antonov@hotmail.com" - } - ], - "dist": { - "shasum": "362772ea4d09f556a4b9f3b64c2fd136e87e3a55", - "tarball": "http://registry.npmjs.org/bluebird/-/bluebird-2.9.26.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.26.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc deleted file mode 100644 index 299877f2..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "laxbreak": true -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore deleted file mode 100644 index 7e6163db..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -support -test -examples -example -*.sock -dist diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md deleted file mode 100644 index 854c9711..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md +++ /dev/null @@ -1,195 +0,0 @@ - -2.2.0 / 2015-05-09 -================== - - * package: update "ms" to v0.7.1 (#202, @dougwilson) - * README: add logging to file example (#193, @DanielOchoa) - * README: fixed a typo (#191, @amir-s) - * browser: expose `storage` (#190, @stephenmathieson) - * Makefile: add a `distclean` target (#189, @stephenmathieson) - -2.1.3 / 2015-03-13 -================== - - * Updated stdout/stderr example (#186) - * Updated example/stdout.js to match debug current behaviour - * Renamed example/stderr.js to stdout.js - * Update Readme.md (#184) - * replace high intensity foreground color for bold (#182, #183) - -2.1.2 / 2015-03-01 -================== - - * dist: recompile - * update "ms" to v0.7.0 - * package: update "browserify" to v9.0.3 - * component: fix "ms.js" repo location - * changed bower package name - * updated documentation about using debug in a browser - * fix: security error on safari (#167, #168, @yields) - -2.1.1 / 2014-12-29 -================== - - * browser: use `typeof` to check for `console` existence - * browser: check for `console.log` truthiness (fix IE 8/9) - * browser: add support for Chrome apps - * Readme: added Windows usage remarks - * Add `bower.json` to properly support bower install - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile deleted file mode 100644 index 5cf4a596..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile +++ /dev/null @@ -1,36 +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 dist - -dist: - @mkdir -p $@ - -dist/debug.js: node_modules browser.js debug.js dist - @$(BROWSERIFY) \ - --standalone debug \ - . > $@ - -distclean: clean - @rm -rf node_modules - -node_modules: package.json - @NODE_ENV= $(NPM) install - @touch node_modules - -.PHONY: all install clean distclean diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md deleted file mode 100644 index b4f45e3c..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md +++ /dev/null @@ -1,188 +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) - -#### Windows note - - On Windows the environment variable is set using the `set` command. - - ```cmd - set DEBUG=*,-not_this - ``` - -Then, run the program to be debugged as usual. - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: - -```js -window.myDebug = require("debug"); -``` - - ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: - -```js -myDebug.enable("worker:*") -``` - - Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - -#### Web Inspector Colors - - Colors are also enabled on "Web Inspectors" that understand the `%c` formatting - option. These are WebKit web inspectors, Firefox ([since version - 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) - and the Firebug plugin for Firefox (any version). - - Colored output looks something like: - - ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) - -### stderr vs stdout - -You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: - -Example _stdout.js_: - -```js -var debug = require('debug'); -var error = debug('app:error'); - -// by default stderr is used -error('goes to stderr!'); - -var log = debug('app:log'); -// set this namespace to log via console.log -log.log = console.log.bind(console); // don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); -``` - -### Save debug output to a file - -You can save all debug statements to a file by piping them. - -Example: - -```bash -$ DEBUG_FD=3 node your-app.js 3> whatever.log -``` - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - -## License - -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json deleted file mode 100644 index 6af573ff..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "visionmedia-debug", - "main": "dist/debug.js", - "version": "2.2.0", - "homepage": "https://github.com/visionmedia/debug", - "authors": [ - "TJ Holowaychuk " - ], - "description": "visionmedia-debug", - "moduleType": [ - "amd", - "es6", - "globals", - "node" - ], - "keywords": [ - "visionmedia", - "debug" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js deleted file mode 100644 index 7c764522..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js +++ /dev/null @@ -1,168 +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; -exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args; - - var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage(){ - try { - return window.localStorage; - } catch (e) {} -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json deleted file mode 100644 index ca106372..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "debug", - "repo": "visionmedia/debug", - "description": "small debugging utility", - "version": "2.2.0", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "rauchg/ms.js": "0.7.1" - } -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/debug.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/debug.js deleted file mode 100644 index 7571a860..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/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/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js deleted file mode 100644 index 1d392a81..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js +++ /dev/null @@ -1,209 +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]; - -/** - * The file descriptor to write the `debug()` calls to. - * Set the `DEBUG_FD` env variable to override with another value. i.e.: - * - * $ DEBUG_FD=3 node script.js 3>debug.log - */ - -var fd = parseInt(process.env.DEBUG_FD, 10) || 2; -var stream = 1 === fd ? process.stdout : - 2 === fd ? process.stderr : - createWritableStdioStream(fd); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); - if (0 === debugColors.length) { - return tty.isatty(fd); - } else { - return '0' !== debugColors - && 'no' !== debugColors - && 'false' !== debugColors - && 'disabled' !== debugColors; - } -} - -/** - * Map %o to `util.inspect()`, since Node doesn't do that out of the box. - */ - -var inspect = (4 === util.inspect.length ? - // node <= 0.8.x - function (v, colors) { - return util.inspect(v, void 0, void 0, colors); - } : - // node > 0.8.x - function (v, colors) { - return util.inspect(v, { colors: colors }); - } -); - -exports.formatters.o = function(v) { - return inspect(v, this.useColors) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - var name = this.namespace; - - if (useColors) { - var c = this.color; - - args[0] = ' \u001b[3' + c + ';1m' + name + ' ' - + '\u001b[0m' - + args[0] + '\u001b[3' + c + 'm' - + ' +' + exports.humanize(this.diff) + '\u001b[0m'; - } else { - args[0] = new Date().toUTCString() - + ' ' + name + ' ' + args[0]; - } - return args; -} - -/** - * Invokes `console.error()` with the specified arguments. - */ - -function log() { - return stream.write(util.format.apply(this, arguments) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Copied from `node/src/node.js`. - * - * XXX: It's lame that node doesn't expose this API out-of-the-box. It also - * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. - */ - -function createWritableStdioStream (fd) { - var stream; - var tty_wrap = process.binding('tty_wrap'); - - // Note stream._type is used for test-module-load-list.js - - switch (tty_wrap.guessHandleType(fd)) { - case 'TTY': - stream = new tty.WriteStream(fd); - stream._type = 'tty'; - - // Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - case 'FILE': - var fs = require('fs'); - stream = new fs.SyncWriteStream(fd, { autoClose: false }); - stream._type = 'fs'; - break; - - case 'PIPE': - case 'TCP': - var net = require('net'); - stream = new net.Socket({ - fd: fd, - readable: false, - writable: true - }); - - // FIXME Should probably have an option in net.Socket to create a - // stream from an existing fd which is writable only. But for now - // we'll just add this hack and set the `readable` member to false. - // Test: ./node test/fixtures/echo.js < /etc/passwd - stream.readable = false; - stream.read = null; - stream._type = 'pipe'; - - // FIXME Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - default: - // Probably an error on in uv_guess_handle() - throw new Error('Implement me. Unknown stream file type!'); - } - - // For supporting legacy API we put the FD here. - stream.fd = fd; - - stream._isStdio = true; - - return stream; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore deleted file mode 100644 index d1aa0ce4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -test -History.md -Makefile -component.json diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md deleted file mode 100644 index 32fdfc17..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md +++ /dev/null @@ -1,66 +0,0 @@ - -0.7.1 / 2015-04-20 -================== - - * prevent extraordinary long inputs (@evilpacket) - * Fixed broken readme link - -0.7.0 / 2014-11-24 -================== - - * add time abbreviations, updated tests and readme for the new units - * fix example in the readme. - * add LICENSE file - -0.6.2 / 2013-12-05 -================== - - * Adding repository section to package.json to suppress warning from NPM. - -0.6.1 / 2013-05-10 -================== - - * fix singularization [visionmedia] - -0.6.0 / 2013-03-15 -================== - - * fix minutes - -0.5.1 / 2013-02-24 -================== - - * add component namespace - -0.5.0 / 2012-11-09 -================== - - * add short formatting as default and .long option - * add .license property to component.json - * add version to component.json - -0.4.0 / 2012-10-22 -================== - - * add rounding to fix crazy decimals - -0.3.0 / 2012-09-07 -================== - - * fix `ms()` [visionmedia] - -0.2.0 / 2012-09-03 -================== - - * add component.json [visionmedia] - * add days support [visionmedia] - * add hours support [visionmedia] - * add minutes support [visionmedia] - * add seconds support [visionmedia] - * add ms string support [visionmedia] - * refactor tests to facilitate ms(number) [visionmedia] - -0.1.0 / 2012-03-07 -================== - - * Initial release diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE deleted file mode 100644 index 6c07561b..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Guillermo Rauch - -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/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md deleted file mode 100644 index 9b4fd035..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# ms.js: miliseconds conversion utility - -```js -ms('2 days') // 172800000 -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2.5 hrs') // 9000000 -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`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). -- 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 diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js deleted file mode 100644 index 4f927716..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js +++ /dev/null @@ -1,125 +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) { - str = '' + str; - if (str.length > 10000) return; - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|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 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - 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/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json deleted file mode 100644 index 253335e6..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "ms", - "version": "0.7.1", - "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" - } - }, - "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", - "bugs": { - "url": "https://github.com/guille/ms.js/issues" - }, - "homepage": "https://github.com/guille/ms.js", - "_id": "ms@0.7.1", - "scripts": {}, - "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", - "_from": "ms@0.7.1", - "_npmVersion": "2.7.5", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "dist": { - "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json b/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json deleted file mode 100644 index 6ecc8c9e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "debug", - "version": "2.2.0", - "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" - } - ], - "license": "MIT", - "dependencies": { - "ms": "0.7.1" - }, - "devDependencies": { - "browserify": "9.0.3", - "mocha": "*" - }, - "main": "./node.js", - "browser": "./browser.js", - "component": { - "scripts": { - "debug/index.js": "browser.js", - "debug/debug.js": "debug.js" - } - }, - "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "homepage": "https://github.com/visionmedia/debug", - "_id": "debug@2.2.0", - "scripts": {}, - "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", - "_from": "debug@2.2.0", - "_npmVersion": "2.7.4", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "dist": { - "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", - "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/package.json b/Associations/node_modules/mongoose/node_modules/mquery/package.json deleted file mode 100644 index e1ce1677..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "mquery", - "version": "1.6.3", - "description": "Expressive query building for MongoDB", - "main": "lib/mquery.js", - "scripts": { - "test": "make test" - }, - "repository": { - "type": "git", - "url": "git://github.com/aheckmann/mquery.git" - }, - "dependencies": { - "bluebird": "2.9.26", - "debug": "2.2.0", - "regexp-clone": "0.0.1", - "sliced": "0.0.5" - }, - "devDependencies": { - "mongodb": "1.4.38", - "mocha": "1.9.x", - "istanbul": "0.3.2" - }, - "bugs": { - "url": "https://github.com/aheckmann/mquery/issues/new" - }, - "author": { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - "license": "MIT", - "keywords": [ - "mongodb", - "query", - "builder" - ], - "homepage": "https://github.com/aheckmann/mquery/", - "gitHead": "cd0c3284df2089eed5f0a331802e15c6ff0e7fab", - "_id": "mquery@1.6.3", - "_shasum": "7c02bfb7e49c8012cece1556c5e65fef61f3c8e5", - "_from": "mquery@1.6.3", - "_npmVersion": "2.9.1", - "_nodeVersion": "0.12.3", - "_npmUser": { - "name": "vkarpov15", - "email": "val@karpov.io" - }, - "dist": { - "shasum": "7c02bfb7e49c8012cece1556c5e65fef61f3c8e5", - "tarball": "http://registry.npmjs.org/mquery/-/mquery-1.6.3.tgz" - }, - "maintainers": [ - { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - }, - { - "name": "ebensing", - "email": "ebensing38@gmail.com" - }, - { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/mquery/-/mquery-1.6.3.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/test/collection/browser.js b/Associations/node_modules/mongoose/node_modules/mquery/test/collection/browser.js deleted file mode 100644 index e69de29b..00000000 diff --git a/Associations/node_modules/mongoose/node_modules/mquery/test/collection/mongo.js b/Associations/node_modules/mongoose/node_modules/mquery/test/collection/mongo.js deleted file mode 100644 index e69de29b..00000000 diff --git a/Associations/node_modules/mongoose/node_modules/mquery/test/collection/node.js b/Associations/node_modules/mongoose/node_modules/mquery/test/collection/node.js deleted file mode 100644 index 43f446ed..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/test/collection/node.js +++ /dev/null @@ -1,29 +0,0 @@ - -var assert = require('assert') -var slice = require('sliced') -var mongo = require('mongodb') -var utils = require('../../').utils; - -var uri = process.env.MQUERY_URI || 'mongodb://localhost/mquery'; -var db; - -exports.getCollection = function (cb) { - mongo.Db.connect(uri, function (err, db_) { - assert.ifError(err); - db = db_; - - var collection = db.collection('stuff'); - collection.opts.safe = true; - - // clean test db before starting - db.dropDatabase(function () { - cb(null, collection); - }); - }) -} - -exports.dropCollection = function (cb) { - db.dropDatabase(function () { - db.close(cb); - }) -} diff --git a/Associations/node_modules/mongoose/node_modules/mquery/test/env.js b/Associations/node_modules/mongoose/node_modules/mquery/test/env.js deleted file mode 100644 index 9b9b80b4..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/test/env.js +++ /dev/null @@ -1,20 +0,0 @@ - -var assert = require('assert') -var env = require('../').env; - -console.log('environment: %s', env.type); - -var col; -switch (env.type) { - case 'node': - col = require('./collection/node'); - break; - case 'mongo': - col = require('./collection/mongo'); - case 'browser': - col = require('./collection/browser'); - default: - throw new Error('missing collection implementation for environment: ' + env.type); -} - -module.exports = exports = col; diff --git a/Associations/node_modules/mongoose/node_modules/mquery/test/index.js b/Associations/node_modules/mongoose/node_modules/mquery/test/index.js deleted file mode 100644 index 747c947e..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/test/index.js +++ /dev/null @@ -1,2875 +0,0 @@ -var mquery = require('../'); -var assert = require('assert'); - -describe('mquery', function(){ - var col; - - before(function(done){ - // get the env specific collection interface - require('./env').getCollection(function (err, collection) { - assert.ifError(err); - col = collection; - done(); - }); - }) - - after(function(done){ - require('./env').dropCollection(done); - }) - - describe('mquery', function(){ - it('is a function', function(){ - assert.equal('function', typeof mquery); - }) - it('creates instances with the `new` keyword', function(){ - assert.ok(mquery() instanceof mquery); - }) - describe('defaults', function(){ - it('are set', function(){ - var m = mquery(); - assert.strictEqual(undefined, m.op); - assert.deepEqual({}, m.options); - }) - }) - describe('criteria', function(){ - it('if collection-like is used as collection', function(){ - var m = mquery(col); - assert.equal(col, m._collection.collection); - }) - it('non-collection-like is used as criteria', function(){ - var m = mquery({ works: true }); - assert.ok(!m._collection); - assert.deepEqual({ works: true }, m._conditions); - }) - }) - describe('options', function(){ - it('are merged when passed', function(){ - var m = mquery(col, { safe: true }); - assert.deepEqual({ safe: true }, m.options); - var m = mquery({ name: 'mquery' }, { safe: true }); - assert.deepEqual({ safe: true }, m.options); - }) - }) - }) - - describe('toConstructor', function(){ - it('creates subclasses of mquery', function(){ - var opts = { safe: { w: 'majority' }, readPreference: 'p' }; - var match = { name: 'test', count: { $gt: 101 }}; - var select = { name: 1, count: 0 } - var update = { $set: { x: true }}; - var path = 'street'; - - var q = mquery().setOptions(opts); - q.where(match); - q.select(select); - q.update(update); - q.where(path); - q.find(); - - var M = q.toConstructor(); - var m = M(); - - assert.ok(m instanceof mquery); - assert.deepEqual(opts, m.options); - assert.deepEqual(match, m._conditions); - assert.deepEqual(select, m._fields); - assert.deepEqual(update, m._update); - assert.equal(path, m._path); - assert.equal('find', m.op); - }) - }) - - describe('setOptions', function(){ - it('calls associated methods', function(){ - var m = mquery(); - assert.equal(m._collection, null); - m.setOptions({ collection: col }); - assert.equal(m._collection.collection, col); - }) - it('directly sets option when no method exists', function(){ - var m = mquery(); - assert.equal(m.options.woot, null); - m.setOptions({ woot: 'yay' }); - assert.equal(m.options.woot, 'yay'); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.setOptions(); - assert.equal(m, n); - var n = m.setOptions({ x: 1 }); - assert.equal(m, n); - }) - }) - - describe('collection', function(){ - it('sets the _collection', function(){ - var m = mquery(); - m.collection(col); - assert.equal(m._collection.collection, col); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.collection(col); - assert.equal(m, n); - }) - }) - - describe('$where', function(){ - it('sets the $where condition', function(){ - var m = mquery(); - function go () {} - m.$where(go); - assert.ok(go === m._conditions.$where); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.$where('x'); - assert.equal(m, n); - }) - }) - - describe('where', function(){ - it('without arguments', function(){ - var m = mquery(); - m.where(); - assert.deepEqual({}, m._conditions); - }) - it('with non-string/object argument', function(){ - var m = mquery(); - - assert.throws(function(){ - m.where([]); - }, /path must be a string or object/); - }) - describe('with one argument', function(){ - it('that is an object', function(){ - var m = mquery(); - m.where({ name: 'flawed' }); - assert.strictEqual(m._conditions.name, 'flawed'); - }) - it('that is a query', function(){ - var m = mquery({ name: 'first' }); - var n = mquery({ name: 'changed' }); - m.where(n); - assert.strictEqual(m._conditions.name, 'changed'); - }) - it('that is a string', function(){ - var m = mquery(); - m.where('name'); - assert.equal('name', m._path); - assert.strictEqual(m._conditions.name, undefined); - }) - }) - it('with two arguments', function(){ - var m = mquery(); - m.where('name', 'The Great Pumpkin'); - assert.equal('name', m._path); - assert.strictEqual(m._conditions.name, 'The Great Pumpkin'); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.where('x', 'y'); - assert.equal(m, n); - var n = m.where() - assert.equal(m, n); - }) - }) - - describe('equals', function(){ - it('must be called after where()', function(){ - var m = mquery(); - assert.throws(function () { - m.equals(); - }, /must be used after where/) - }) - it('sets value of path set with where()', function(){ - var m = mquery(); - m.where('age').equals(1000); - assert.deepEqual({ age: 1000 }, m._conditions); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.where('x').equals(3); - assert.equal(m, n); - }) - }) - - describe('or', function(){ - it('pushes onto the internal $or condition', function(){ - var m = mquery(); - m.or({ 'Nightmare Before Christmas': true }); - assert.deepEqual([{'Nightmare Before Christmas': true }], m._conditions.$or) - }) - it('allows passing arrays', function(){ - var m = mquery(); - var arg = [{ 'Nightmare Before Christmas': true }, { x: 1 }]; - m.or(arg); - assert.deepEqual(arg, m._conditions.$or) - }) - it('allows calling multiple times', function(){ - var m = mquery(); - var arg = [{ looper: true }, { x: 1 }]; - m.or(arg); - m.or({ y: 1 }) - m.or([{ w: 'oo' }, { z: 'oo'} ]) - assert.deepEqual([{looper:true},{x:1},{y:1},{w:'oo'},{z:'oo'}], m._conditions.$or) - }) - it('is chainable', function(){ - var m = mquery(); - m.or({ o: "k"}).where('name', 'table'); - assert.deepEqual({ name: 'table', $or: [{ o: 'k' }] }, m._conditions) - }) - }) - - describe('nor', function(){ - it('pushes onto the internal $nor condition', function(){ - var m = mquery(); - m.nor({ 'Nightmare Before Christmas': true }); - assert.deepEqual([{'Nightmare Before Christmas': true }], m._conditions.$nor) - }) - it('allows passing arrays', function(){ - var m = mquery(); - var arg = [{ 'Nightmare Before Christmas': true }, { x: 1 }]; - m.nor(arg); - assert.deepEqual(arg, m._conditions.$nor) - }) - it('allows calling multiple times', function(){ - var m = mquery(); - var arg = [{ looper: true }, { x: 1 }]; - m.nor(arg); - m.nor({ y: 1 }) - m.nor([{ w: 'oo' }, { z: 'oo'} ]) - assert.deepEqual([{looper:true},{x:1},{y:1},{w:'oo'},{z:'oo'}], m._conditions.$nor) - }) - it('is chainable', function(){ - var m = mquery(); - m.nor({ o: "k"}).where('name', 'table'); - assert.deepEqual({ name: 'table', $nor: [{ o: 'k' }] }, m._conditions) - }) - }) - - describe('and', function(){ - it('pushes onto the internal $and condition', function(){ - var m = mquery(); - m.and({ 'Nightmare Before Christmas': true }); - assert.deepEqual([{'Nightmare Before Christmas': true }], m._conditions.$and) - }) - it('allows passing arrays', function(){ - var m = mquery(); - var arg = [{ 'Nightmare Before Christmas': true }, { x: 1 }]; - m.and(arg); - assert.deepEqual(arg, m._conditions.$and) - }) - it('allows calling multiple times', function(){ - var m = mquery(); - var arg = [{ looper: true }, { x: 1 }]; - m.and(arg); - m.and({ y: 1 }) - m.and([{ w: 'oo' }, { z: 'oo'} ]) - assert.deepEqual([{looper:true},{x:1},{y:1},{w:'oo'},{z:'oo'}], m._conditions.$and) - }) - it('is chainable', function(){ - var m = mquery(); - m.and({ o: "k"}).where('name', 'table'); - assert.deepEqual({ name: 'table', $and: [{ o: 'k' }] }, m._conditions) - }) - }) - - function generalCondition (type) { - return function () { - it('accepts 2 args', function(){ - var m = mquery()[type]('count', 3); - var check = {}; - check['$' + type] = 3; - assert.deepEqual(m._conditions.count, check); - }) - it('uses previously set `where` path if 1 arg passed', function(){ - var m = mquery().where('count')[type](3); - var check = {}; - check['$' + type] = 3; - assert.deepEqual(m._conditions.count, check); - }) - it('throws if 1 arg was passed but no previous `where` was used', function(){ - assert.throws(function(){ - mquery()[type](3); - }, /must be used after where/); - }) - it('is chainable', function(){ - var m = mquery().where('count')[type](3).where('x', 8); - var check = {x: 8, count: {}}; - check.count['$' + type] = 3; - assert.deepEqual(m._conditions, check); - }) - it('overwrites previous value', function(){ - var m = mquery().where('count')[type](3)[type](8); - var check = {}; - check['$' + type] = 8; - assert.deepEqual(m._conditions.count, check); - }) - } - } - - 'gt gte lt lte ne in nin regex size maxDistance'.split(' ').forEach(function (type) { - describe(type, generalCondition(type)) - }) - - describe('mod', function () { - describe('with 1 argument', function(){ - it('requires a previous where()', function(){ - assert.throws(function () { - mquery().mod([30, 10]) - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('madmen').mod([10,20]); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - }) - - describe('with 2 arguments and second is non-Array', function(){ - it('requires a previous where()', function(){ - assert.throws(function () { - mquery().mod('x', 10) - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('madmen').mod(10, 20); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - }) - - it('with 2 arguments and second is an array', function(){ - var m = mquery().mod('madmen', [10,20]); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - - it('with 3 arguments', function(){ - var m = mquery().mod('madmen', 10, 20); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - - it('is chainable', function(){ - var m = mquery().mod('madmen', 10, 20).where('x', 8); - var check = { madmen: { $mod: [10,20] }, x: 8}; - assert.deepEqual(m._conditions, check); - }) - }) - - describe('exists', function(){ - it('with 0 args', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().exists() - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('name').exists(); - var check = { name: { $exists: true }}; - assert.deepEqual(m._conditions, check); - }) - }) - - describe('with 1 arg', function(){ - describe('that is boolean', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().exists() - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().exists('name', false); - var check = { name: { $exists: false }}; - assert.deepEqual(m._conditions, check); - }) - }) - describe('that is not boolean', function(){ - it('sets the value to `true`', function(){ - var m = mquery().where('name').exists('yummy'); - var check = { yummy: { $exists: true }}; - assert.deepEqual(m._conditions, check); - }) - }) - }) - - describe('with 2 args', function(){ - it('works', function(){ - var m = mquery().exists('yummy', false); - var check = { yummy: { $exists: false }}; - assert.deepEqual(m._conditions, check); - }) - }) - - it('is chainable', function(){ - var m = mquery().where('name').exists().find({ x: 1 }); - var check = { name: { $exists: true }, x: 1}; - assert.deepEqual(m._conditions, check); - }) - }) - - describe('elemMatch', function(){ - describe('with null/undefined first argument', function(){ - assert.throws(function () { - mquery().elemMatch(); - }, /Invalid argument/); - assert.throws(function () { - mquery().elemMatch(null); - }, /Invalid argument/); - assert.doesNotThrow(function () { - mquery().elemMatch('', {}); - }); - }) - - describe('with 1 argument', function(){ - it('throws if not a function or object', function(){ - assert.throws(function () { - mquery().elemMatch([]); - }, /Invalid argument/); - }) - - describe('that is an object', function(){ - it('throws if no previous `where` was used', function(){ - assert.throws(function () { - mquery().elemMatch({}); - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('comment').elemMatch({ author: 'joe', votes: {$gte: 3 }}); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - describe('that is a function', function(){ - it('throws if no previous `where` was used', function(){ - assert.throws(function () { - mquery().elemMatch(function(){}); - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('comment').elemMatch(function (query) { - query.where({ author: 'joe', votes: {$gte: 3 }}) - }); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - }) - - describe('with 2 arguments', function(){ - describe('and the 2nd is an object', function(){ - it('works', function(){ - var m = mquery().elemMatch('comment', { author: 'joe', votes: {$gte: 3 }}); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - describe('and the 2nd is a function', function(){ - it('works', function(){ - var m = mquery().elemMatch('comment', function (query) { - query.where({ author: 'joe', votes: {$gte: 3 }}) - }); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - it('and the 2nd is not a function or object', function(){ - assert.throws(function () { - mquery().elemMatch('comment', []); - }, /Invalid argument/); - }) - }) - }) - - describe('within', function(){ - it('is chainable', function(){ - var m = mquery(); - assert.equal(m.where('a').within(), m); - }) - describe('when called with arguments', function(){ - it('must follow where()', function(){ - assert.throws(function () { - mquery().within([]); - }, /must be used after where/); - }) - - describe('of length 1', function(){ - it('throws if not a recognized shape', function(){ - assert.throws(function () { - mquery().where('loc').within({}); - }, /Invalid argument/) - assert.throws(function () { - mquery().where('loc').within(null); - }, /Invalid argument/) - }) - it('delegates to circle when center exists', function(){ - var m = mquery().where('loc').within({ center: [10,10], radius: 3 }); - assert.deepEqual({ $geoWithin: {$center:[[10,10], 3]}}, m._conditions.loc); - }) - it('delegates to box when exists', function(){ - var m = mquery().where('loc').within({ box: [[10,10], [11,14]] }); - assert.deepEqual({ $geoWithin: {$box:[[10,10], [11,14]]}}, m._conditions.loc); - }) - it('delegates to polygon when exists', function(){ - var m = mquery().where('loc').within({ polygon: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $geoWithin: {$polygon:[[10,10], [11,14],[10,9]]}}, m._conditions.loc); - }) - it('delegates to geometry when exists', function(){ - var m = mquery().where('loc').within({ type: 'Polygon', coordinates: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $geoWithin: {$geometry: {type:'Polygon', coordinates: [[10,10], [11,14],[10,9]]}}}, m._conditions.loc); - }) - }) - - describe('of length 2', function(){ - it('delegates to box()', function(){ - var m = mquery().where('loc').within([1,2],[2,5]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $box: [[1,2],[2,5]]}}); - }) - }) - - describe('of length > 2', function(){ - it('delegates to polygon()', function(){ - var m = mquery().where('loc').within([1,2],[2,5],[2,4],[1,3]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $polygon: [[1,2],[2,5],[2,4],[1,3]]}}); - }) - }) - }) - }) - - describe('geoWithin', function(){ - before(function(){ - mquery.use$geoWithin = false; - }) - after(function(){ - mquery.use$geoWithin = true; - }) - describe('when called with arguments', function(){ - describe('of length 1', function(){ - it('delegates to circle when center exists', function(){ - var m = mquery().where('loc').within({ center: [10,10], radius: 3 }); - assert.deepEqual({ $within: {$center:[[10,10], 3]}}, m._conditions.loc); - }) - it('delegates to box when exists', function(){ - var m = mquery().where('loc').within({ box: [[10,10], [11,14]] }); - assert.deepEqual({ $within: {$box:[[10,10], [11,14]]}}, m._conditions.loc); - }) - it('delegates to polygon when exists', function(){ - var m = mquery().where('loc').within({ polygon: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $within: {$polygon:[[10,10], [11,14],[10,9]]}}, m._conditions.loc); - }) - it('delegates to geometry when exists', function(){ - var m = mquery().where('loc').within({ type: 'Polygon', coordinates: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $within: {$geometry: {type:'Polygon', coordinates: [[10,10], [11,14],[10,9]]}}}, m._conditions.loc); - }) - }) - - describe('of length 2', function(){ - it('delegates to box()', function(){ - var m = mquery().where('loc').within([1,2],[2,5]); - assert.deepEqual(m._conditions.loc, { $within: { $box: [[1,2],[2,5]]}}); - }) - }) - - describe('of length > 2', function(){ - it('delegates to polygon()', function(){ - var m = mquery().where('loc').within([1,2],[2,5],[2,4],[1,3]); - assert.deepEqual(m._conditions.loc, { $within: { $polygon: [[1,2],[2,5],[2,4],[1,3]]}}); - }) - }) - }) - }) - - describe('box', function(){ - describe('with 1 argument', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().box('sometihng'); - }, /Invalid argument/); - }) - }) - describe('with > 3 arguments', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().box(1,2,3,4); - }, /Invalid argument/); - }) - }) - - describe('with 2 arguments', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().box([],[]); - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('loc').box([1,2],[3,4]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $box: [[1,2],[3,4]] }}); - }) - }) - - describe('with 3 arguments', function(){ - it('works', function(){ - var m = mquery().box('loc', [1,2],[3,4]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $box: [[1,2],[3,4]] }}); - }) - }) - }) - - describe('polygon', function(){ - describe('when first argument is not a string', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().polygon({}); - }, /must be used after where/); - - assert.doesNotThrow(function () { - mquery().where('loc').polygon([1,2], [2,3], [3,6]); - }); - }) - - it('assigns arguments to within polygon condition', function(){ - var m = mquery().where('loc').polygon([1,2], [2,3], [3,6]); - assert.deepEqual(m._conditions, { loc: {$geoWithin: {$polygon: [[1,2],[2,3],[3,6]]}} }); - }) - }) - - describe('when first arg is a string', function(){ - it('assigns remaining arguments to within polygon condition', function(){ - var m = mquery().polygon('loc', [1,2], [2,3], [3,6]); - assert.deepEqual(m._conditions, { loc: {$geoWithin: {$polygon: [[1,2],[2,3],[3,6]]}} }); - }) - }) - }) - - describe('circle', function(){ - describe('with one arg', function(){ - it('must follow where()', function(){ - assert.throws(function () { - mquery().circle('x'); - }, /must be used after where/); - assert.doesNotThrow(function () { - mquery().where('loc').circle({center:[0,0], radius: 3 }); - }); - }) - it('works', function(){ - var m = mquery().where('loc').circle({center:[0,0], radius: 3 }); - assert.deepEqual(m._conditions, { loc: { $geoWithin: {$center: [[0,0],3] }}}); - }) - }) - describe('with 3 args', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().where('loc').circle(1,2,3); - }, /Invalid argument/); - }) - }) - describe('requires radius and center', function(){ - assert.throws(function () { - mquery().circle('loc', { center: 1 }); - }, /center and radius are required/); - assert.throws(function () { - mquery().circle('loc', { radius: 1 }); - }, /center and radius are required/); - assert.doesNotThrow(function () { - mquery().circle('loc', { center: [1,2], radius: 1 }); - }); - }) - }) - - describe('geometry', function(){ - // within + intersects - var point = { type: 'Point', coordinates: [[0,0],[1,1]] }; - - it('must be called after within or intersects', function(done){ - assert.throws(function () { - mquery().where('a').geometry(point); - }, /must come after/); - - assert.doesNotThrow(function () { - mquery().where('a').within().geometry(point); - }); - - assert.doesNotThrow(function () { - mquery().where('a').intersects().geometry(point); - }); - - done(); - }) - - describe('when called with one argument', function(){ - describe('after within()', function(){ - it('and arg quacks like geoJSON', function(done){ - var m = mquery().where('a').within().geometry(point); - assert.deepEqual({ a: { $geoWithin: { $geometry: point }}}, m._conditions); - done(); - }) - }) - - describe('after intersects()', function(){ - it('and arg quacks like geoJSON', function(done){ - var m = mquery().where('a').intersects().geometry(point); - assert.deepEqual({ a: { $geoIntersects: { $geometry: point }}}, m._conditions); - done(); - }) - }) - - it('and arg does not quack like geoJSON', function(done){ - assert.throws(function () { - mquery().where('b').within().geometry({type:1, coordinates:2}); - }, /Invalid argument/); - done(); - }) - }) - - describe('when called with zero arguments', function(){ - it('throws', function(done){ - assert.throws(function () { - mquery().where('a').within().geometry(); - }, /Invalid argument/); - - done(); - }) - }) - - describe('when called with more than one arguments', function(){ - it('throws', function(done){ - assert.throws(function () { - mquery().where('a').within().geometry({type:'a',coordinates:[]}, 2); - }, /Invalid argument/); - done(); - }) - }) - }) - - describe('intersects', function(){ - it('must be used after where()', function(done){ - var m = mquery(); - assert.throws(function () { - m.intersects(); - }, /must be used after where/) - done(); - }) - - it('sets geo comparison to "$intersects"', function(done){ - var n = mquery().where('a').intersects(); - assert.equal('$geoIntersects', n._geoComparison); - done(); - }) - - it('is chainable', function(){ - var m = mquery(); - assert.equal(m.where('a').intersects(), m); - }) - - it('calls geometry if argument quacks like geojson', function(done){ - var m = mquery(); - var o = { type: 'LineString', coordinates: [[0,1],[3,40]] }; - var ran = false; - - m.geometry = function (arg) { - ran = true; - assert.deepEqual(o, arg); - } - - m.where('a').intersects(o); - assert.ok(ran); - - done(); - }) - - it('throws if argument is not geometry-like', function(done){ - var m = mquery().where('a'); - - assert.throws(function () { - m.intersects(null); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(undefined); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(false); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects({}); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects([]); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(function(){}); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(NaN); - }, /Invalid argument/); - - done(); - }) - }) - - describe('near', function(){ - // near nearSphere - describe('with 0 args', function(){ - it('is compatible with geometry()', function(done){ - var q = mquery().where('x').near().geometry({ type: 'Point', coordinates: [180, 11] }); - assert.deepEqual({ $near: {$geometry: {type:'Point', coordinates: [180,11]}}}, q._conditions.x); - done(); - }) - }) - - describe('with 1 arg', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().near(1); - }, /must be used after where/) - }) - it('does not throw if used after where()', function(){ - assert.doesNotThrow(function () { - mquery().where('loc').near({center:[1,1]}); - }) - }) - }) - describe('with > 2 args', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().near(1,2,3); - }, /Invalid argument/) - }) - }) - - it('creates $geometry args for GeoJSON', function(){ - var m = mquery().where('loc').near({ center: { type: 'Point', coordinates: [10,10] }}); - assert.deepEqual({ $near: {$geometry: {type:'Point', coordinates: [10,10]}}}, m._conditions.loc); - }) - - it('expects `center`', function(){ - assert.throws(function () { - mquery().near('loc', { maxDistance: 3 }); - }, /center is required/) - assert.doesNotThrow(function () { - mquery().near('loc', { center: [3,4] }); - }) - }) - - it('accepts spherical conditions', function(){ - var m = mquery().where('loc').near({ center: [1,2], spherical: true }); - assert.deepEqual(m._conditions, { loc: { $nearSphere: [1,2]}}); - }) - - it('is non-spherical by default', function(){ - var m = mquery().where('loc').near({ center: [1,2] }); - assert.deepEqual(m._conditions, { loc: { $near: [1,2]}}); - }) - - it('supports maxDistance', function(){ - var m = mquery().where('loc').near({ center: [1,2], maxDistance:4 }); - assert.deepEqual(m._conditions, { loc: { $near: [1,2], $maxDistance: 4}}); - }) - - it('is chainable', function(){ - var m = mquery().where('loc').near({ center: [1,2], maxDistance:4 }).find({ x: 1 }); - assert.deepEqual(m._conditions, { loc: { $near: [1,2], $maxDistance: 4}, x: 1}); - }) - - describe('supports passing GeoJSON, gh-13', function(){ - it('with center', function(){ - var m = mquery().where('loc').near({ - center: { type: 'Point', coordinates: [1,1] } - , maxDistance: 2 - }); - - var expect = { - loc: { - $near: { - $geometry: { - type: 'Point' - , coordinates : [1,1] - } - , $maxDistance : 2 - } - } - } - - assert.deepEqual(m._conditions, expect); - }) - }) - }) - - // fields - - describe('select', function(){ - describe('with 0 args', function(){ - it('is chainable', function(){ - var m = mquery() - assert.equal(m, m.select()); - }) - }) - - it('accepts an object', function(){ - var o = { x: 1, y: 1 } - var m = mquery().select(o); - assert.deepEqual(m._fields, o); - }) - - it('accepts a string', function(){ - var o = 'x -y'; - var m = mquery().select(o); - assert.deepEqual(m._fields, { x: 1, y: 0 }); - }) - - it('does not accept an array', function(done){ - assert.throws(function () { - var o = ['x', '-y']; - var m = mquery().select(o); - }, /Invalid select/); - done(); - }) - - it('merges previous arguments', function(){ - var o = { x: 1, y: 0, a: 1 } - var m = mquery().select(o); - m.select('z -u w').select({ x: 0 }) - assert.deepEqual(m._fields, { - x: 0 - , y: 0 - , z: 1 - , u: 0 - , w: 1 - , a: 1 - }); - }) - - it('rejects non-string, object, arrays', function(){ - assert.throws(function () { - mquery().select(function(){}); - }, /Invalid select\(\) argument/); - }) - - it('accepts aguments objects', function(){ - var m = mquery(); - function t () { - m.select(arguments); - assert.deepEqual(m._fields, { x: 1, y: 0 }); - } - t('x', '-y'); - }) - - noDistinct('select'); - no('count', 'select'); - }) - - describe('selected', function() { - it('returns true when fields have been selected', function(done) { - var m = mquery().select({ name: 1 }); - assert.ok(m.selected()); - - var m = mquery().select('name'); - assert.ok(m.selected()); - - done(); - }); - - it('returns false when no fields have been selected', function(done) { - var m = mquery(); - assert.strictEqual(false, m.selected()); - done(); - }); - }); - - describe('selectedInclusively', function() { - describe('returns false', function(){ - it('when no fields have been selected', function(done) { - assert.strictEqual(false, mquery().selectedInclusively()); - assert.equal(false, mquery().select({}).selectedInclusively()); - done(); - }); - it('when any fields have been excluded', function(done) { - assert.strictEqual(false, mquery().select('-name').selectedInclusively()); - assert.strictEqual(false, mquery().select({ name: 0 }).selectedInclusively()); - assert.strictEqual(false, mquery().select('name bio -_id').selectedInclusively()); - assert.strictEqual(false, mquery().select({ name: 1, _id: 0 }).selectedInclusively()); - done(); - }); - it('when using $meta', function(done) { - assert.strictEqual(false, mquery().select({ name: { $meta: 'textScore' } }).selectedInclusively()); - done(); - }); - }); - - describe('returns true', function() { - it('when fields have been included', function(done) { - assert.equal(true, mquery().select('name').selectedInclusively()); - assert.equal(true, mquery().select({ name:1 }).selectedInclusively()); - done(); - }); - }); - }); - - describe('selectedExclusively', function() { - describe('returns false', function(){ - it('when no fields have been selected', function(done) { - assert.equal(false, mquery().selectedExclusively()); - assert.equal(false, mquery().select({}).selectedExclusively()); - done(); - }); - it('when fields have only been included', function(done) { - assert.equal(false, mquery().select('name').selectedExclusively()); - assert.equal(false, mquery().select({ name: 1 }).selectedExclusively()); - done(); - }); - }); - - describe('returns true', function() { - it('when any field has been excluded', function(done) { - assert.equal(true, mquery().select('-name').selectedExclusively()); - assert.equal(true, mquery().select({ name:0 }).selectedExclusively()); - assert.equal(true, mquery().select('-_id').selectedExclusively()); - assert.strictEqual(true, mquery().select('name bio -_id').selectedExclusively()); - assert.strictEqual(true, mquery().select({ name: 1, _id: 0 }).selectedExclusively()); - done(); - }); - }); - }); - - describe('slice', function(){ - describe('with 0 args', function(){ - it('is chainable', function(){ - var m = mquery() - assert.equal(m, m.slice()); - }) - it('is a noop', function(){ - var m = mquery().slice(); - assert.deepEqual(m._fields, undefined); - }) - }) - - describe('with 1 arg', function(){ - it('throws if not called after where()', function(){ - assert.throws(function () { - mquery().slice(1); - }, /must be used after where/); - assert.doesNotThrow(function () { - mquery().where('a').slice(1); - }); - }) - it('that is a number', function(){ - var query = mquery(); - query.where('collection').slice(5); - assert.deepEqual(query._fields, {collection: {$slice: 5}}); - }) - it('that is an array', function(){ - var query = mquery(); - query.where('collection').slice([5,10]); - assert.deepEqual(query._fields, {collection: {$slice: [5,10]}}); - }) - it('that is an object', function() { - var query = mquery(); - query.slice({ collection: [5, 10] }); - assert.deepEqual(query._fields, {collection: {$slice: [5,10]}}); - }) - }) - - describe('with 2 args', function(){ - describe('and first is a number', function(){ - it('throws if not called after where', function(){ - assert.throws(function () { - mquery().slice(2,3); - }, /must be used after where/); - }) - it('does not throw if used after where', function(){ - var query = mquery(); - query.where('collection').slice(2,3); - assert.deepEqual(query._fields, {collection: {$slice: [2,3]}}); - }) - }) - it('and first is not a number', function(){ - var query = mquery().slice('collection', [-5, 2]); - assert.deepEqual(query._fields, {collection: {$slice: [-5,2]}}); - }) - }) - - describe('with 3 args', function(){ - it('works', function(){ - var query = mquery(); - query.slice('collection', 14, 10); - assert.deepEqual(query._fields, {collection: {$slice: [14, 10]}}); - }) - }) - - noDistinct('slice'); - no('count', 'slice'); - }) - - // options - - describe('sort', function(){ - describe('with 0 args', function(){ - it('chains', function(){ - var m = mquery(); - assert.equal(m, m.sort()); - }) - it('has no affect', function(){ - var m = mquery(); - assert.equal(m.options.sort, undefined); - }) - }) - - it('works', function(){ - var query = mquery(); - query.sort('a -c b'); - assert.deepEqual(query.options.sort, { a : 1, b: 1, c : -1}); - - query = mquery(); - query.sort({'a': 1, 'c': -1, 'b': 'asc', e: 'descending', f: 'ascending'}); - assert.deepEqual(query.options.sort, {'a': 1, 'c': -1, 'b': 1, 'e': -1, 'f': 1}); - - query = mquery(); - var e= undefined; - try { - query.sort(['a', 1]); - } catch (err) { - e= err; - } - assert.ok(e, 'uh oh. no error was thrown'); - assert.equal(e.message, 'Invalid sort() argument. Must be a string or object.'); - - e= undefined; - try { - query.sort('a', 1, 'c', -1, 'b', 1); - } catch (err) { - e= err; - } - assert.ok(e, 'uh oh. no error was thrown'); - assert.equal(e.message, 'Invalid sort() argument. Must be a string or object.'); - }) - - it('handles $meta sort options', function(){ - var query = mquery(); - query.sort({ score: { $meta : "textScore" } }); - assert.deepEqual(query.options.sort, { score : { $meta : "textScore" } }); - }) - - no('count', 'sort'); - }) - - function simpleOption (type, options) { - describe(type, function(){ - it('sets the ' + type + ' option', function(){ - var m = mquery()[type](2); - var optionName = options.name || type; - assert.equal(2, m.options[optionName]); - }) - it('is chainable', function(){ - var m = mquery(); - assert.equal(m[type](3), m); - }) - - if (!options.distinct) noDistinct(type); - if (!options.count) no('count', type); - }) - } - - var negated = { - limit: {distinct: false, count: true} - , skip: {distinct: false, count: true} - , maxScan: {distinct: false, count: false} - , batchSize: {distinct: false, count: false} - , maxTime: {distinct: true, count: true, name: 'maxTimeMS' } - , comment: {distinct: false, count: false} - }; - Object.keys(negated).forEach(function (key) { - simpleOption(key, negated[key]); - }) - - describe('snapshot', function(){ - it('works', function(){ - var query = mquery(); - query.snapshot(); - assert.equal(true, query.options.snapshot); - - var query = mquery() - query.snapshot(true); - assert.equal(true, query.options.snapshot); - - var query = mquery() - query.snapshot(false); - assert.equal(false, query.options.snapshot); - }) - noDistinct('snapshot'); - no('count', 'snapshot'); - }) - - describe('hint', function(){ - it('accepts an object', function(){ - var query2 = mquery(); - query2.hint({'a': 1, 'b': -1}); - assert.deepEqual(query2.options.hint, {'a': 1, 'b': -1}); - }) - - it('rejects everything else', function(){ - assert.throws(function(){ - mquery().hint('c'); - }, /Invalid hint./); - assert.throws(function(){ - mquery().hint(['c']); - }, /Invalid hint./); - assert.throws(function(){ - mquery().hint(1); - }, /Invalid hint./); - }) - - describe('does not have side affects', function(){ - it('on invalid arg', function(){ - var m = mquery(); - try { - m.hint(1); - } catch (err) { - // ignore - } - assert.equal(undefined, m.options.hint); - }) - it('on missing arg', function(){ - var m = mquery().hint(); - assert.equal(undefined, m.options.hint); - }) - }) - - noDistinct('hint'); - }) - - describe('slaveOk', function(){ - it('works', function(){ - var query = mquery(); - query.slaveOk(); - assert.equal(true, query.options.slaveOk); - - var query = mquery() - query.slaveOk(true); - assert.equal(true, query.options.slaveOk); - - var query = mquery() - query.slaveOk(false); - assert.equal(false, query.options.slaveOk); - }) - }) - - describe('read', function(){ - it('sets associated readPreference option', function(){ - var m = mquery(); - m.read('p'); - assert.equal('primary', m.options.readPreference); - }) - it('is chainable', function(){ - var m = mquery(); - assert.equal(m, m.read('sp')); - }) - }) - - describe('tailable', function(){ - it('works', function(){ - var query = mquery(); - query.tailable(); - assert.equal(true, query.options.tailable); - - var query = mquery() - query.tailable(true); - assert.equal(true, query.options.tailable); - - var query = mquery() - query.tailable(false); - assert.equal(false, query.options.tailable); - }) - it('is chainable', function(){ - var m = mquery(); - assert.equal(m, m.tailable()); - }) - noDistinct('tailable'); - no('count', 'tailable'); - }) - - // query utilities - - describe('merge', function(){ - describe('with falsy arg', function(){ - it('returns itself', function(){ - var m = mquery(); - assert.equal(m, m.merge()); - assert.equal(m, m.merge(null)); - assert.equal(m, m.merge(0)); - }) - }) - describe('with an argument', function(){ - describe('that is not a query or plain object', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().merge([]); - }, /Invalid argument/); - assert.throws(function () { - mquery().merge('merge'); - }, /Invalid argument/); - assert.doesNotThrow(function () { - mquery().merge({}); - }, /Invalid argument/); - }) - }) - - describe('that is a query', function(){ - it('merges conditions, field selection, and options', function(){ - var m = mquery({ x: 'hi' }, { select: 'x y', another: true }) - var n = mquery().merge(m); - assert.deepEqual(n._conditions, m._conditions); - assert.deepEqual(n._fields, m._fields); - assert.deepEqual(n.options, m.options); - }) - it('clones update arguments', function(done){ - var original = { $set: { iTerm: true }} - var m = mquery().update(original); - var n = mquery().merge(m); - m.update({ $set: { x: 2 }}) - assert.notDeepEqual(m._update, n._update); - done(); - }) - it('is chainable', function(){ - var m = mquery({ x: 'hi' }); - var n = mquery(); - assert.equal(n, n.merge(m)); - }) - }) - - describe('that is an object', function(){ - it('merges', function(){ - var m = { x: 'hi' }; - var n = mquery().merge(m); - assert.deepEqual(n._conditions, { x: 'hi' }); - }) - it('clones update arguments', function(done){ - var original = { $set: { iTerm: true }} - var m = mquery().update(original); - var n = mquery().merge(original); - m.update({ $set: { x: 2 }}) - assert.notDeepEqual(m._update, n._update); - done(); - }) - it('is chainable', function(){ - var m = { x: 'hi' }; - var n = mquery(); - assert.equal(n, n.merge(m)); - }) - }) - }) - }) - - // queries - - describe('find', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.find() - }) - assert.doesNotThrow(function () { - m.find({ x: 1 }) - }) - }) - }) - - it('is chainable', function(){ - var m = mquery().find({ x: 1 }).find().find({ y: 2 }); - assert.deepEqual(m._conditions, {x:1,y:2}); - }) - - it('merges other queries', function(){ - var m = mquery({ name: 'mquery' }); - m.tailable(); - m.select('_id'); - var a = mquery().find(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery' }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery' }, done); - }) - - it('when criteria is passed with a callback', function(done){ - mquery(col).find({ name: 'mquery' }, function (err, docs) { - assert.ifError(err); - assert.equal(1, docs.length); - done(); - }) - }) - it('when Query is passed with a callback', function(done){ - var m = mquery({ name: 'mquery' }); - mquery(col).find(m, function (err, docs) { - assert.ifError(err); - assert.equal(1, docs.length); - done(); - }) - }) - it('when just a callback is passed', function(done){ - mquery({ name: 'mquery' }).collection(col).find(function (err, docs) { - assert.ifError(err); - assert.equal(1, docs.length); - done(); - }); - }) - }) - }) - - describe('findOne', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.findOne() - }) - assert.doesNotThrow(function () { - m.findOne({ x: 1 }) - }) - }) - }) - - it('is chainable', function(){ - var m = mquery(); - var n = m.findOne({ x: 1 }).findOne().findOne({ y: 2 }); - assert.equal(m, n); - assert.deepEqual(m._conditions, {x:1,y:2}); - assert.equal('findOne', m.op); - }) - - it('merges other queries', function(){ - var m = mquery({ name: 'mquery' }); - m.read('nearest'); - m.select('_id'); - var a = mquery().findOne(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery findone' }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery findone' }, done); - }) - - it('when criteria is passed with a callback', function(done){ - mquery(col).findOne({ name: 'mquery findone' }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('mquery findone', doc.name); - done(); - }) - }) - it('when Query is passed with a callback', function(done){ - var m = mquery(col).where({ name: 'mquery findone' }); - mquery(col).findOne(m, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('mquery findone', doc.name); - done(); - }) - }) - it('when just a callback is passed', function(done){ - mquery({ name: 'mquery findone' }).collection(col).findOne(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('mquery findone', doc.name); - done(); - }); - }) - }) - }) - - describe('count', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.count() - }) - assert.doesNotThrow(function () { - m.count({ x: 1 }) - }) - }) - }) - - it('is chainable', function(){ - var m = mquery(); - var n = m.count({ x: 1 }).count().count({ y: 2 }); - assert.equal(m, n); - assert.deepEqual(m._conditions, {x:1,y:2}); - assert.equal('count', m.op); - }) - - it('merges other queries', function(){ - var m = mquery({ name: 'mquery' }); - m.read('nearest'); - m.select('_id'); - var a = mquery().count(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery count' }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery count' }, done); - }) - - it('when criteria is passed with a callback', function(done){ - mquery(col).count({ name: 'mquery count' }, function (err, count) { - assert.ifError(err); - assert.ok(count); - assert.ok(1 === count); - done(); - }) - }) - it('when Query is passed with a callback', function(done){ - var m = mquery({ name: 'mquery count' }); - mquery(col).count(m, function (err, count) { - assert.ifError(err); - assert.ok(count); - assert.ok(1 === count); - done(); - }) - }) - it('when just a callback is passed', function(done){ - mquery({ name: 'mquery count' }).collection(col).count(function (err, count) { - assert.ifError(err); - assert.ok(1 === count); - done(); - }); - }) - }) - - describe('validates its option', function(){ - it('sort', function(done){ - assert.throws(function(){ - var m = mquery().sort('x').count(); - }, /sort cannot be used with count/); - done(); - }) - - it('select', function(done){ - assert.throws(function(){ - var m = mquery().select('x').count(); - }, /field selection and slice cannot be used with count/); - done(); - }) - - it('slice', function(done){ - assert.throws(function(){ - var m = mquery().where('x').slice(-3).count(); - }, /field selection and slice cannot be used with count/); - done(); - }) - - it('limit', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().limit(3).count(); - }) - done(); - }) - - it('skip', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().skip(3).count(); - }) - done(); - }) - - it('batchSize', function(done){ - assert.throws(function(){ - var m = mquery({}, { batchSize: 3 }).count(); - }, /batchSize cannot be used with count/); - done(); - }) - - it('comment', function(done){ - assert.throws(function(){ - var m = mquery().comment('mquery').count(); - }, /comment cannot be used with count/); - done(); - }) - - it('maxScan', function(done){ - assert.throws(function(){ - var m = mquery().maxScan(300).count(); - }, /maxScan cannot be used with count/); - done(); - }) - - it('snapshot', function(done){ - assert.throws(function(){ - var m = mquery().snapshot().count(); - }, /snapshot cannot be used with count/); - done(); - }) - - it('tailable', function(done){ - assert.throws(function(){ - var m = mquery().tailable().count(); - }, /tailable cannot be used with count/); - done(); - }) - }) - }) - - describe('distinct', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.distinct() - }) - assert.doesNotThrow(function () { - m.distinct('name') - }) - assert.doesNotThrow(function () { - m.distinct({ name: 'mquery distinct' }) - }) - assert.doesNotThrow(function () { - m.distinct({ name: 'mquery distinct' }, 'name') - }) - }) - }) - - it('is chainable', function(){ - var m = mquery({x:1}).distinct('name'); - var n = m.distinct({y:2}); - assert.equal(m, n); - assert.deepEqual(n._conditions, {x:1, y:2}); - assert.equal('name', n._distinct); - assert.equal('distinct', n.op); - }); - - it('overwrites field', function(){ - var m = mquery({ name: 'mquery' }).distinct('name'); - m.distinct('rename'); - assert.equal(m._distinct, 'rename'); - m.distinct({x:1}, 'renamed'); - assert.equal(m._distinct, 'renamed'); - }) - - it('merges other queries', function(){ - var m = mquery().distinct({ name: 'mquery' }, 'age') - m.read('nearest'); - var a = mquery().distinct(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - assert.deepEqual(a._distinct, m._distinct); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery distinct', age: 1 }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery distinct' }, done); - }) - - it('when distinct arg is passed with a callback', function(done){ - mquery(col).distinct('distinct', function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }) - }) - describe('when criteria is passed with a callback', function(){ - it('if distinct arg was declared', function(done){ - mquery(col).distinct('age').distinct({ name: 'mquery distinct' }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }) - }) - it('but not if distinct arg was not declared', function(){ - assert.throws(function(){ - mquery(col).distinct({ name: 'mquery distinct' }, function(){}) - }, /No value for `distinct`/) - }) - }) - describe('when Query is passed with a callback', function(){ - var m = mquery({ name: 'mquery distinct' }); - it('if distinct arg was declared', function(done){ - mquery(col).distinct('age').distinct(m, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }) - }) - it('but not if distinct arg was not declared', function(){ - assert.throws(function(){ - mquery(col).distinct(m, function(){}) - }, /No value for `distinct`/) - }) - }) - describe('when just a callback is passed', function(done){ - it('if distinct arg was declared', function(done){ - var m = mquery({ name: 'mquery distinct' }); - m.collection(col); - m.distinct('age'); - m.distinct(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }); - }) - it('but not if no distinct arg was declared', function(){ - var m = mquery(); - m.collection(col); - assert.throws(function () { - m.distinct(function(){}); - }, /No value for `distinct`/); - }) - }) - }) - - describe('validates its option', function(){ - it('sort', function(done){ - assert.throws(function(){ - var m = mquery().sort('x').distinct(); - }, /sort cannot be used with distinct/); - done(); - }) - - it('select', function(done){ - assert.throws(function(){ - var m = mquery().select('x').distinct(); - }, /field selection and slice cannot be used with distinct/); - done(); - }) - - it('slice', function(done){ - assert.throws(function(){ - var m = mquery().where('x').slice(-3).distinct(); - }, /field selection and slice cannot be used with distinct/); - done(); - }) - - it('limit', function(done){ - assert.throws(function(){ - var m = mquery().limit(3).distinct(); - }, /limit cannot be used with distinct/); - done(); - }) - - it('skip', function(done){ - assert.throws(function(){ - var m = mquery().skip(3).distinct(); - }, /skip cannot be used with distinct/); - done(); - }) - - it('batchSize', function(done){ - assert.throws(function(){ - var m = mquery({}, { batchSize: 3 }).distinct(); - }, /batchSize cannot be used with distinct/); - done(); - }) - - it('comment', function(done){ - assert.throws(function(){ - var m = mquery().comment('mquery').distinct(); - }, /comment cannot be used with distinct/); - done(); - }) - - it('maxScan', function(done){ - assert.throws(function(){ - var m = mquery().maxScan(300).distinct(); - }, /maxScan cannot be used with distinct/); - done(); - }) - - it('snapshot', function(done){ - assert.throws(function(){ - var m = mquery().snapshot().distinct(); - }, /snapshot cannot be used with distinct/); - done(); - }) - - it('hint', function(done){ - assert.throws(function(){ - var m = mquery().hint({ x: 1 }).distinct(); - }, /hint cannot be used with distinct/); - done(); - }) - - it('tailable', function(done){ - assert.throws(function(){ - var m = mquery().tailable().distinct(); - }, /tailable cannot be used with distinct/); - done(); - }) - }) - }) - - describe('update', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.update({ name: 'old' }, { name: 'updated' }, { multi: true }) - }) - assert.doesNotThrow(function () { - m.update({ name: 'old' }, { name: 'updated' }) - }) - assert.doesNotThrow(function () { - m.update({ name: 'updated' }) - }) - assert.doesNotThrow(function () { - m.update() - }) - }) - }) - - it('is chainable', function(){ - var m = mquery({x:1}).update({ y: 2 }); - var n = m.where({y:2}); - assert.equal(m, n); - assert.deepEqual(n._conditions, {x:1, y:2}); - assert.deepEqual({ y: 2 }, n._update); - assert.equal('update', n.op); - }); - - it('merges update doc arg', function(){ - var a = [1,2]; - var m = mquery().where({ name: 'mquery' }).update({ x: 'stuff', a: a }); - m.update({ z: 'stuff' }); - assert.deepEqual(m._update, { z: 'stuff', x: 'stuff', a: a }); - assert.deepEqual(m._conditions, { name: 'mquery' }); - assert.ok(!m.options.overwrite); - m.update({}, { z: 'renamed' }, { overwrite: true }); - assert.ok(m.options.overwrite === true); - assert.deepEqual(m._conditions, { name: 'mquery' }); - assert.deepEqual(m._update, { z: 'renamed', x: 'stuff', a: a }); - a.push(3); - assert.notDeepEqual(m._update, { z: 'renamed', x: 'stuff', a: a }); - }) - - it('merges other options', function(){ - var m = mquery(); - m.setOptions({ overwrite: true }); - m.update({ age: 77 }, { name: 'pagemill' }, { multi: true }) - assert.deepEqual({ age: 77 }, m._conditions); - assert.deepEqual({ name: 'pagemill' }, m._update); - assert.deepEqual({ overwrite: true, multi: true }, m.options); - }) - - describe('executes', function(){ - var id; - before(function (done) { - col.insert({ name: 'mquery update', age: 1 }, { safe: true }, function (err, docs) { - var elem = docs[0]; - id = elem._id; - done(); - }); - }); - - after(function(done){ - col.remove({ _id: id }, done); - }) - - describe('when conds + doc + opts + callback passed', function(){ - it('works', function(done){ - var m = mquery(col).where({ _id: id }) - m.update({}, { name: 'Sparky' }, { safe: true }, function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'Sparky'); - done(); - }) - }) - }) - }) - - describe('when conds + doc + callback passed', function(){ - it('works', function (done) { - var m = mquery(col).update({ _id: id }, { name: 'fairgrounds' }, function (err, num, doc) { - assert.ifError(err); - assert.ok(1, num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'fairgrounds'); - done(); - }) - }) - }) - }) - - describe('when doc + callback passed', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }).update({ name: 'changed' }, function (err, num, doc) { - assert.ifError(err); - assert.ok(1, num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'changed'); - done(); - }) - }) - }) - }) - - describe('when just callback passed', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true }); - m.update({ name: 'Frankenweenie' }); - m.update(function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'Frankenweenie'); - done(); - }) - }) - }) - }) - - describe('without a callback', function(){ - it('when forced by exec()', function(done){ - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true, multi: true }); - m.update({ name: 'forced' }); - - var update = m._collection.update; - m._collection.update = function (conds, doc, opts, cb) { - m._collection.update = update; - - assert.ok(!opts.safe); - assert.ok(true === opts.multi); - assert.equal('forced', doc.$set.name); - done(); - } - - m.exec() - }) - }) - - describe('except when update doc is empty and missing overwrite flag', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true }); - m.update({ }, function (err, num) { - assert.ifError(err); - assert.ok(0 === num); - setTimeout(function(){ - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(3, mquery.utils.keys(doc).length); - assert.equal(id, doc._id.toString()); - assert.equal('Frankenweenie', doc.name); - done(); - }) - }, 300); - }) - }) - }); - - describe('when update doc is set with overwrite flag', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true, overwrite: true }); - m.update({ all: 'yep', two: 2 }, function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(3, mquery.utils.keys(doc).length); - assert.equal('yep', doc.all); - assert.equal(2, doc.two); - assert.equal(id, doc._id.toString()); - done(); - }) - }) - }) - }) - - describe('when update doc is empty with overwrite flag', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true, overwrite: true }); - m.update({ }, function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(1, mquery.utils.keys(doc).length); - assert.equal(id, doc._id.toString()); - done(); - }) - }) - }) - }) - - describe('when boolean (true) - exec()', function(){ - it('works', function(done){ - var m = mquery(col).where({ _id: id }); - m.update({ name: 'bool' }).update(true); - setTimeout(function () { - m.findOne(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('bool', doc.name); - done(); - }) - }, 300) - }) - }) - }) - }) - - describe('remove', function(){ - describe('with 0 args', function(){ - var name = 'remove: no args test' - before(function(done){ - col.insert({ name: name }, { safe: true }, done) - }) - after(function(done){ - col.remove({ name: name }, { safe: true }, done) - }) - - it('does not execute', function(done){ - var remove = col.remove; - col.remove = function () { - col.remove = remove; - done(new Error('remove executed!')); - } - - var m = mquery(col).where({ name: name }).remove() - setTimeout(function () { - col.remove = remove; - done(); - }, 10); - }) - - it('chains', function(){ - var m = mquery(); - assert.equal(m, m.remove()); - }) - }) - - describe('with 1 argument', function(){ - var name = 'remove: 1 arg test' - before(function(done){ - col.insert({ name: name }, { safe: true }, done) - }) - after(function(done){ - col.remove({ name: name }, { safe: true }, done) - }) - - describe('that is a', function(){ - it('plain object', function(){ - var m = mquery(col).remove({ name: 'Whiskers' }); - m.remove({ color: '#fff' }) - assert.deepEqual({ name: 'Whiskers', color: '#fff' }, m._conditions); - }) - - it('query', function(){ - var q = mquery({ color: '#fff' }); - var m = mquery(col).remove({ name: 'Whiskers' }); - m.remove(q) - assert.deepEqual({ name: 'Whiskers', color: '#fff' }, m._conditions); - }) - - it('function', function(done){ - mquery(col, { safe: true }).where({name: name}).remove(function (err) { - assert.ifError(err); - mquery(col).findOne({ name: name }, function (err, doc) { - assert.ifError(err); - assert.equal(null, doc); - done(); - }) - }); - }) - - it('boolean (true) - execute', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - mquery(col).findOne({ name: name }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - mquery(col).remove(true); - setTimeout(function () { - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.ok(docs); - assert.equal(0, docs.length); - done(); - }) - }, 300) - }) - }) - }) - }) - }) - - describe('with 2 arguments', function(){ - var name = 'remove: 2 arg test' - beforeEach(function(done){ - col.remove({}, { safe: true }, function (err) { - assert.ifError(err); - col.insert([{ name: 'shelly' }, { name: name }], { safe: true }, function (err) { - assert.ifError(err); - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }) - }) - }) - - describe('plain object + callback', function(){ - it('works', function(done){ - mquery(col).remove({ name: name }, function (err) { - assert.ifError(err); - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.ok(docs); - assert.equal(1, docs.length); - assert.equal('shelly', docs[0].name); - done(); - }) - }); - }) - }) - - describe('mquery + callback', function(){ - it('works', function(done){ - var m = mquery({ name: name }); - mquery(col).remove(m, function (err) { - assert.ifError(err); - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.ok(docs); - assert.equal(1, docs.length); - assert.equal('shelly', docs[0].name); - done(); - }) - }); - }) - }) - }) - }) - - function validateFindAndModifyOptions (method) { - describe('validates its option', function(){ - it('sort', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().sort('x')[method](); - }) - done(); - }) - - it('select', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().select('x')[method](); - }) - done(); - }) - - it('limit', function(done){ - assert.throws(function(){ - var m = mquery().limit(3)[method](); - }, new RegExp('limit cannot be used with ' + method)); - done(); - }) - - it('skip', function(done){ - assert.throws(function(){ - var m = mquery().skip(3)[method](); - }, new RegExp('skip cannot be used with ' + method)); - done(); - }) - - it('batchSize', function(done){ - assert.throws(function(){ - var m = mquery({}, { batchSize: 3 })[method](); - }, new RegExp('batchSize cannot be used with ' + method)); - done(); - }) - - it('maxScan', function(done){ - assert.throws(function(){ - var m = mquery().maxScan(300)[method](); - }, new RegExp('maxScan cannot be used with ' + method)); - done(); - }) - - it('snapshot', function(done){ - assert.throws(function(){ - var m = mquery().snapshot()[method](); - }, new RegExp('snapshot cannot be used with ' + method)); - done(); - }) - - it('hint', function(done){ - assert.throws(function(){ - var m = mquery().hint({ x: 1 })[method](); - }, new RegExp('hint cannot be used with ' + method)); - done(); - }) - - it('tailable', function(done){ - assert.throws(function(){ - var m = mquery().tailable()[method](); - }, new RegExp('tailable cannot be used with ' + method)); - done(); - }) - - it('comment', function(done){ - assert.throws(function(){ - var m = mquery().comment('mquery')[method](); - }, new RegExp('comment cannot be used with ' + method)); - done(); - }) - }) - } - - describe('findOneAndUpdate', function(){ - var name = 'findOneAndUpdate + fn' - - validateFindAndModifyOptions('findOneAndUpdate'); - - describe('with 0 args', function(){ - it('makes no changes', function(){ - var m = mquery(); - var n = m.findOneAndUpdate(); - assert.deepEqual(m, n); - }) - }) - describe('with 1 arg', function(){ - describe('that is an object', function(){ - it('updates the doc', function(){ - var m = mquery(); - var n = m.findOneAndUpdate({ $set: { name: '1 arg' }}); - assert.deepEqual(n._update, { $set: { name: '1 arg' }}); - }) - }) - describe('that is a query', function(){ - it('updates the doc', function(){ - var m = mquery({ name: name }).update({ x: 1 }); - var n = mquery().findOneAndUpdate(m); - assert.deepEqual(n._update, { x: 1 }); - }) - }) - it('that is a function', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var m = mquery({ name: name }).collection(col); - name = '1 arg'; - var n = m.update({ $set: { name: name }}); - n.findOneAndUpdate(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - done(); - }); - }) - }) - }) - describe('with 2 args', function(){ - it('conditions + update', function(){ - var m = mquery(col); - m.findOneAndUpdate({ name: name }, { age: 100 }); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ age: 100 }, m._update); - }) - it('query + update', function(){ - var n = mquery({ name: name }); - var m = mquery(col); - m.findOneAndUpdate(n, { age: 100 }); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ age: 100 }, m._update); - }) - it('update + callback', function(done){ - var m = mquery(col).where({ name: name }); - m.findOneAndUpdate({ $inc: { age: 10 }}, function (err, doc) { - assert.ifError(err); - assert.equal(10, doc.age); - done(); - }); - }) - }) - describe('with 3 args', function(){ - it('conditions + update + options', function(){ - var m = mquery(); - var n = m.findOneAndUpdate({ name: name }, { works: true }, { new: false }); - assert.deepEqual({ name: name}, n._conditions); - assert.deepEqual({ works: true }, n._update); - assert.deepEqual({ new: false }, n.options); - }) - it('conditions + update + callback', function(done){ - var m = mquery(col); - m.findOneAndUpdate({ name: name }, { works: true }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - assert.ok(true === doc.works); - done(); - }); - }) - }) - describe('with 4 args', function(){ - it('conditions + update + options + callback', function(done){ - var m = mquery(col); - m.findOneAndUpdate({ name: name }, { works: false }, { new: false }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - assert.ok(true === doc.works); - done(); - }); - }) - }) - }) - - describe('findOneAndRemove', function(){ - var name = 'findOneAndRemove' - - validateFindAndModifyOptions('findOneAndRemove'); - - describe('with 0 args', function(){ - it('makes no changes', function(){ - var m = mquery(); - var n = m.findOneAndRemove(); - assert.deepEqual(m, n); - }) - }) - describe('with 1 arg', function(){ - describe('that is an object', function(){ - it('updates the doc', function(){ - var m = mquery(); - var n = m.findOneAndRemove({ name: '1 arg' }); - assert.deepEqual(n._conditions, { name: '1 arg' }); - }) - }) - describe('that is a query', function(){ - it('updates the doc', function(){ - var m = mquery({ name: name }); - var n = m.findOneAndRemove(m); - assert.deepEqual(n._conditions, { name: name }); - }) - }) - it('that is a function', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var m = mquery({ name: name }).collection(col); - m.findOneAndRemove(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - done(); - }); - }) - }) - }) - describe('with 2 args', function(){ - it('conditions + options', function(){ - var m = mquery(col); - m.findOneAndRemove({ name: name }, { new: false }); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ new: false }, m.options); - }) - it('query + options', function(){ - var n = mquery({ name: name }); - var m = mquery(col); - m.findOneAndRemove(n, { sort: { x: 1 }}); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ sort: { 'x': 1 }}, m.options); - }) - it('conditions + callback', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var m = mquery(col); - m.findOneAndRemove({ name: name }, function (err, doc) { - assert.ifError(err); - assert.equal(name, doc.name); - done(); - }); - }); - }) - it('query + callback', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var n = mquery({ name: name }) - var m = mquery(col); - m.findOneAndRemove(n, function (err, doc) { - assert.ifError(err); - assert.equal(name, doc.name); - done(); - }); - }); - }) - }) - describe('with 3 args', function(){ - it('conditions + options + callback', function(done){ - name = 'findOneAndRemove + conds + options + cb'; - col.insert([{ name: name }, { name: 'a' }], { safe: true }, function (err) { - assert.ifError(err); - var m = mquery(col); - m.findOneAndRemove({ name: name }, { sort: { name: 1 }}, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - done(); - }); - }) - }) - }) - }) - - describe('exec', function(){ - beforeEach(function(done){ - col.insert([{ name: 'exec', age: 1 }, { name: 'exec', age: 2 }], done); - }) - - afterEach(function(done){ - mquery(col).remove(done); - }) - - it('requires an op', function(){ - assert.throws(function () { - mquery().exec() - }, /Missing query type/); - }) - - describe('find', function() { - it('works', function(done){ - var m = mquery(col).find({ name: 'exec' }); - m.exec(function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }) - - it('works with readPreferences', function (done) { - var m = mquery(col).find({ name: 'exec' }); - try { - var rp = new require('mongodb').ReadPreference('primary'); - m.read(rp); - } catch (e) { - if (e.code === 'MODULE_NOT_FOUND') - e = null; - done(e); - return; - } - m.exec(function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }) - }); - - it('findOne', function(done){ - var m = mquery(col).findOne({ age: 2 }); - m.exec(function (err, doc) { - assert.ifError(err); - assert.equal(2, doc.age); - done(); - }) - }) - - it('count', function(done){ - var m = mquery(col).count({ name: 'exec' }); - m.exec(function (err, count) { - assert.ifError(err); - assert.equal(2, count); - done(); - }) - }) - - it('distinct', function(done){ - var m = mquery({ name: 'exec' }); - m.collection(col); - m.distinct('age'); - m.exec(function (err, array) { - assert.ifError(err); - assert.ok(Array.isArray(array)); - assert.equal(2, array.length); - assert(~array.indexOf(1)); - assert(~array.indexOf(2)); - done(); - }); - }) - - describe('update', function(){ - var num; - - it('with a callback', function(done){ - var m = mquery(col); - m.where({ name: 'exec' }) - - m.count(function (err, _num) { - assert.ifError(err); - num = _num; - m.setOptions({ multi: true }) - m.update({ name: 'exec + update' }); - m.exec(function (err, res) { - assert.ifError(err); - assert.equal(num, res); - mquery(col).find({ name: 'exec + update' }, function (err, docs) { - assert.ifError(err); - assert.equal(num, docs.length); - done(); - }) - }) - }) - }) - - it('without a callback', function(done){ - var m = mquery(col) - m.where({ name: 'exec + update' }).setOptions({ multi: true }) - m.update({ name: 'exec' }); - - // unsafe write - m.exec(); - - setTimeout(function () { - mquery(col).find({ name: 'exec' }, function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }, 200) - }) - it('preserves key ordering', function(done) { - var m = mquery(col); - - var m2 = m.update({ _id : 'something' }, { '1' : 1, '2' : 2, '3' : 3}); - var doc = m2._updateForExec().$set; - var count = 0; - for (var i in doc) { - if (count == 0) { - assert.equal('1', i); - } else if (count == 1) { - assert.equal('2', i); - } else if (count ==2) { - assert.equal('3', i); - } - count++; - } - done(); - }); - }) - - describe('remove', function(){ - it('with a callback', function(done){ - var m = mquery(col).where({ age: 2 }).remove(); - m.exec(function (err, num) { - assert.ifError(err); - assert.equal(1, num); - done(); - }) - }) - - it('without a callback', function(done){ - var m = mquery(col).where({ age: 1 }).remove(); - m.exec(); - - setTimeout(function () { - mquery(col).where('name', 'exec').count(function(err, num) { - assert.equal(1, num); - done(); - }) - }, 200) - }) - }) - - describe('findOneAndUpdate', function(){ - it('with a callback', function(done){ - var m = mquery(col); - m.findOneAndUpdate({ name: 'exec', age: 1 }, { $set: { name: 'findOneAndUpdate' }}); - m.exec(function (err, doc) { - assert.ifError(err); - assert.equal('findOneAndUpdate', doc.name); - done(); - }); - }) - }) - - describe('findOneAndRemove', function(){ - it('with a callback', function(done){ - var m = mquery(col); - m.findOneAndRemove({ name: 'exec', age: 2 }); - m.exec(function (err, doc) { - assert.ifError(err); - assert.equal('exec', doc.name); - assert.equal(2, doc.age); - mquery(col).count({ name: 'exec' }, function (err, num) { - assert.ifError(err); - assert.equal(1, num); - done(); - }); - }); - }) - }) - }) - - describe('setTraceFunction', function() { - beforeEach(function(done){ - col.insert([{ name: 'trace', age: 93 }], done); - }) - - it('calls trace function when executing query', function(done) { - var m = mquery(col); - - var resultTraceCalled; - - m.setTraceFunction(function (method, queryInfo) { - try { - assert.equal('findOne', method); - assert.equal('trace', queryInfo.conditions.name); - } catch (e) { - done(e); - } - - return function(err, result, millis) { - try { - assert.equal(93, result.age); - } catch (e) { - done(e); - } - resultTraceCalled = true; - }; - }); - - m.findOne({name: 'trace'}, function (err, doc) { - assert.ifError(err); - assert.equal(resultTraceCalled, true); - assert.equal(93, doc.age); - done(); - }); - }); - - it('inherits trace function when calling toConstructor', function(done) { - function traceFunction () { return function() {} }; - - var tracedQuery = mquery().setTraceFunction(traceFunction).toConstructor(); - - var query = tracedQuery(); - assert.equal(traceFunction, query._traceFunction); - - done(); - }); - }); - - describe('thunk', function() { - it('returns a function', function(done) { - assert.equal('function', typeof mquery().thunk()); - done(); - }); - - it('passes the fn arg to `exec`', function(done) { - function cb() {} - var m = mquery(); - - m.exec = function testing(fn) { - assert.equal(this, m); - assert.equal(cb, fn); - done(); - } - - m.thunk()(cb); - }); - }); - - describe('then', function() { - before(function(done){ - col.insert([{ name: 'then', age: 1 }, { name: 'then', age: 2 }], done); - }) - - after(function(done){ - mquery(col).remove({ name: 'then' }).exec(done); - }) - - it('returns a promise A+ compat object', function(done) { - var m = mquery(col).find(); - assert.equal('function', typeof m.then); - done(); - }); - - it('creates a promise that is resolved on success', function(done) { - var promise = mquery(col).count({ name: 'then' }).then(); - promise.then(function(count){ - assert.equal(2, count); - done(); - }, done); - }); - - it('supports exec() cb being called synchronously #66', function(done) { - var query = mquery(col).count({ name: 'then' }); - query.exec = function(cb) { - cb(null, 66); - } - - query.then(success, done); - function success(count){ - assert.equal(66, count); - done(); - } - }); - - it('supports other Promise libs', function(done) { - var bluebird = mquery.Promise; - - // hack for testing - mquery.Promise = function P() { - mquery.Promise = bluebird; - this.then = function(x, y) { - return x + y; - } - } - - var val = mquery(col).count({ name: 'exec' }).then(1, 2); - assert.equal(val, 3); - done(); - }); - }); - - describe('stream', function() { - before(function(done){ - col.insert([{ name: 'stream', age: 1 }, { name: 'stream', age: 2 }], done); - }) - - after(function(done){ - mquery(col).remove({ name: 'stream' }).exec(done); - }) - - describe('throws', function() { - describe('if used with non-find operations', function() { - var ops = ['update', 'findOneAndUpdate', 'remove', 'count', 'distinct']; - - ops.forEach(function(op) { - assert.throws(function(){ - mquery(col)[op]().stream(); - }); - }); - }); - }); - - it('returns a stream', function(done) { - var stream = mquery(col).find({ name: 'stream' }).stream(); - var count = 0; - var err; - - stream.on('data', function(doc){ - assert.equal('stream', doc.name); - ++count; - }); - - stream.on('error', function(er) { - err = er; - }); - - stream.on('close', function(){ - if (err) return done(err); - assert.equal(2, count); - done(); - }); - }); - - it('supports find options', function(done) { - var stream = mquery(col) - .find({ name: 'stream' }) - .limit(1) - .select('-_id') - .stream({ transform: xform }); - - function xform(doc) { - doc.name = doc.name + '-xformed'; - return doc; - } - - var count = 0; - var err; - - stream.on('data', function(doc){ - assert(!doc._id); - assert.equal('stream-xformed', doc.name); - ++count; - }); - - stream.on('error', function(er) { - err = er; - }); - - stream.on('close', function(){ - if (err) return done(err); - assert.equal(1, count); - done(); - }); - }); - - }); - - function noDistinct (type) { - it('cannot be used with distinct()', function(done){ - assert.throws(function () { - mquery().distinct('name')[type](4); - }, new RegExp(type + ' cannot be used with distinct')); - done(); - }) - } - - function no (method, type) { - it('cannot be used with ' + method + '()', function(done){ - assert.throws(function () { - mquery()[method]()[type](4); - }, new RegExp(type + ' cannot be used with ' + method)); - done(); - }) - } - - // query internal - - describe('_updateForExec', function(){ - it('returns a clone of the update object with same key order #19', function(done){ - var update = {}; - update.$push = { n: { $each: [{x:10}], $slice: -1, $sort: {x:1}}}; - - var q = mquery().update({ x: 1 }, update); - - // capture original key order - var order = []; - for (var key in q._update.$push.n) { - order.push(key); - } - - // compare output - var doc = q._updateForExec(); - var i = 0; - for (var key in doc.$push.n) { - assert.equal(key, order[i]); - i++; - } - - done(); - }) - }) -}) diff --git a/Associations/node_modules/mongoose/node_modules/mquery/test/utils.test.js b/Associations/node_modules/mongoose/node_modules/mquery/test/utils.test.js deleted file mode 100644 index fa5972a2..00000000 --- a/Associations/node_modules/mongoose/node_modules/mquery/test/utils.test.js +++ /dev/null @@ -1,143 +0,0 @@ - -var utils = require('../lib/utils'); -var assert = require('assert'); - -var mongo; -try { - mongo = new require('mongodb'); -} catch (e) {} - -describe('lib/utils', function() { - describe('clone', function() { - it('clones constructors named ObjectId', function(done) { - function ObjectId (id) { - this.id = id; - } - - var o1 = new ObjectId('1234'); - var o2 = utils.clone(o1); - assert.ok(o2 instanceof ObjectId); - - done(); - }); - - it('clones constructors named ObjectID', function(done) { - function ObjectID (id) { - this.id = id; - } - - var o1 = new ObjectID('1234'); - var o2 = utils.clone(o1); - - assert.ok(o2 instanceof ObjectID); - done(); - }); - - it('does not clone constructors named ObjectIdd', function(done) { - function ObjectIdd (id) { - this.id = id; - } - - var o1 = new ObjectIdd('1234'); - var o2 = utils.clone(o1); - assert.ok(!(o2 instanceof ObjectIdd)); - - done(); - }); - - it('optionally clones ObjectId constructors using its clone method', function(done) { - function ObjectID (id) { - this.id = id; - this.cloned = false; - } - - ObjectID.prototype.clone = function () { - var ret = new ObjectID(this.id); - ret.cloned = true; - return ret; - } - - var id = 1234; - var o1 = new ObjectID(id); - assert.equal(id, o1.id); - assert.equal(false, o1.cloned); - - var o2 = utils.clone(o1); - assert.ok(o2 instanceof ObjectID); - assert.equal(id, o2.id); - assert.ok(o2.cloned); - done(); - }); - - it('clones mongodb.ReadPreferences', function (done) { - if (!mongo) return done(); - - var tags = [ - {dc: 'tag1'} - ]; - var prefs = [ - new mongo.ReadPreference("primary"), - new mongo.ReadPreference(mongo.ReadPreference.PRIMARY_PREFERRED), - new mongo.ReadPreference("primary", tags), - mongo.ReadPreference("primary", tags) - ]; - - var prefsCloned = utils.clone(prefs); - - for (var i = 0; i < prefsCloned.length; i++) { - assert.notEqual(prefs[i], prefsCloned[i]); - assert.ok(prefsCloned[i] instanceof mongo.ReadPreference); - assert.ok(prefsCloned[i].isValid()); - if (prefs[i].tags) { - assert.ok(prefsCloned[i].tags); - assert.notEqual(prefs[i].tags, prefsCloned[i].tags); - assert.notEqual(prefs[i].tags[0], prefsCloned[i].tags[0]); - } else { - assert.equal(prefsCloned[i].tags, null); - } - } - - done(); - }); - - it('clones mongodb.Binary', function(done){ - if (!mongo) return done(); - - var buf = new Buffer('hi'); - var binary= new mongo.Binary(buf, 2); - var clone = utils.clone(binary); - assert.equal(binary.sub_type, clone.sub_type); - assert.equal(String(binary.buffer), String(buf)); - assert.ok(binary !== clone); - done(); - }) - - it('handles objects with no constructor', function(done) { - var name ='335'; - - var o = Object.create(null); - o.name = name; - - var clone; - assert.doesNotThrow(function() { - clone = utils.clone(o); - }); - - assert.equal(name, clone.name); - assert.ok(o != clone); - done(); - }); - - it('handles buffers', function(done){ - var buff = new Buffer(10); - buff.fill(1); - var clone = utils.clone(buff); - - for (var i = 0; i < buff.length; i++) { - assert.equal(buff[i], clone[i]); - } - - done(); - }); - }); -}); diff --git a/Associations/node_modules/mongoose/node_modules/ms/.npmignore b/Associations/node_modules/mongoose/node_modules/ms/.npmignore deleted file mode 100644 index 3c3629e6..00000000 --- a/Associations/node_modules/mongoose/node_modules/ms/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/Associations/node_modules/mongoose/node_modules/ms/Makefile b/Associations/node_modules/mongoose/node_modules/ms/Makefile deleted file mode 100644 index dded504d..00000000 --- a/Associations/node_modules/mongoose/node_modules/ms/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - ./node_modules/.bin/mocha test/test.js - -test-browser: - ./node_modules/.bin/serve test/ - -.PHONY: test diff --git a/Associations/node_modules/mongoose/node_modules/ms/README.md b/Associations/node_modules/mongoose/node_modules/ms/README.md deleted file mode 100644 index c93d43f4..00000000 --- a/Associations/node_modules/mongoose/node_modules/ms/README.md +++ /dev/null @@ -1,65 +0,0 @@ - -# ms.js - -Ever find yourself doing math in your head or writing `1000 * 60 * 60 …`? -Don't want to add obstrusive `Number` prototype extensions to your reusable -/ distributable modules and projects? - -`ms` is a tiny utility that you can leverage when your application needs to -accept a number of miliseconds as a parameter. - -If a number is supplied to `ms`, it returns it immediately (e.g: -If a string that contains the number is supplied, it returns it immediately as -a number (e.g: it returns `100` for `'100'`). - -However, if you pass a string with a number and a valid unit, hte number of -equivalent ms is returned. - -```js -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5ms') // 5000 -ms('100') // '100' -ms(100) // 100 -``` - -## How to use - -### Node - -```js -require('ms') -``` - -### Browser - -```html - -``` - -## Credits - -(The MIT License) - -Copyright (c) 2011 Guillermo Rauch <guillermo@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. diff --git a/Associations/node_modules/mongoose/node_modules/ms/ms.js b/Associations/node_modules/mongoose/node_modules/ms/ms.js deleted file mode 100644 index b4621bcd..00000000 --- a/Associations/node_modules/mongoose/node_modules/ms/ms.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - -# ms.js - -No more painful `setTimeout(fn, 60 * 4 * 3 * 2 * 1 * Infinity * NaN * '☃')`. - - ms('2d') // 172800000 - ms('1.5h') // 5400000 - ms('1h') // 3600000 - ms('1m') // 60000 - ms('5s') // 5000 - ms('500ms') // 500 - ms('100') // '100' - ms(100) // 100 - -**/ - -(function (g) { - var r = /(\d*.?\d+)([mshd]+)/ - , _ = {} - - _.ms = 1; - _.s = 1000; - _.m = _.s * 60; - _.h = _.m * 60; - _.d = _.h * 24; - - function ms (s) { - if (s == Number(s)) return Number(s); - r.exec(s.toLowerCase()); - return RegExp.$1 * _[RegExp.$2]; - } - - g.top ? g.ms = ms : module.exports = ms; -})(this); diff --git a/Associations/node_modules/mongoose/node_modules/ms/package.json b/Associations/node_modules/mongoose/node_modules/ms/package.json deleted file mode 100644 index 60313a77..00000000 --- a/Associations/node_modules/mongoose/node_modules/ms/package.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "name": "ms", - "version": "0.1.0", - "description": "Tiny ms conversion utility", - "main": "./ms", - "devDependencies": { - "mocha": "*", - "expect.js": "*", - "serve": "*" - }, - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "_id": "ms@0.1.0", - "dependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.0.106", - "_nodeVersion": "v0.4.12", - "_defaultsLoaded": true, - "dist": { - "shasum": "f21fac490daf1d7667fd180fe9077389cc9442b2", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.1.0.tgz" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "directories": {}, - "_shasum": "f21fac490daf1d7667fd180fe9077389cc9442b2", - "_from": "ms@0.1.0", - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.1.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Associations/node_modules/mongoose/node_modules/ms/test/index.html b/Associations/node_modules/mongoose/node_modules/ms/test/index.html deleted file mode 100644 index 79edc409..00000000 --- a/Associations/node_modules/mongoose/node_modules/ms/test/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - ms.js tests - - - - - - - - - - - - -
      - - diff --git a/Associations/node_modules/mongoose/node_modules/ms/test/support/jquery.js b/Associations/node_modules/mongoose/node_modules/ms/test/support/jquery.js deleted file mode 100644 index 8ccd0ea7..00000000 --- a/Associations/node_modules/mongoose/node_modules/ms/test/support/jquery.js +++ /dev/null @@ -1,9266 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Nov 21 21:11:03 2011 -0500 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.1", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!memory; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - marginDiv, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
      a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = marginDiv = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - conMarginTop, ptlm, vb, style, html, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; - vb = "visibility:hidden;border:0;"; - style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; - html = "
      " + - "" + - "
      "; - - container = document.createElement("div"); - container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
      t
      "; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Figure out if the W3C box model works as expected - div.innerHTML = ""; - div.style.width = div.style.paddingLeft = "1px"; - jQuery.boxModel = support.boxModel = div.offsetWidth === 2; - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
      "; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.style.cssText = ptlm + vb; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - body.removeChild( container ); - div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, attr, name, - data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { - attr = this[0].attributes; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - jQuery._data( this[0], "parsedAttrs", true ); - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var self = jQuery( this ), - args = [ parts[0], value ]; - - self.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - - // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /\bhover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Determine handlers that should run if there are delegated events - // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on.call( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

      "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
      "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
      ", "
      " ], - thead: [ 1, "", "
      " ], - tr: [ 2, "", "
      " ], - td: [ 3, "", "
      " ], - col: [ 2, "", "
      " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and - -``` - -## Documentation - -### Collections - -* [`each`](#each) -* [`eachSeries`](#eachSeries) -* [`eachLimit`](#eachLimit) -* [`map`](#map) -* [`mapSeries`](#mapSeries) -* [`mapLimit`](#mapLimit) -* [`filter`](#filter) -* [`filterSeries`](#filterSeries) -* [`reject`](#reject) -* [`rejectSeries`](#rejectSeries) -* [`reduce`](#reduce) -* [`reduceRight`](#reduceRight) -* [`detect`](#detect) -* [`detectSeries`](#detectSeries) -* [`sortBy`](#sortBy) -* [`some`](#some) -* [`every`](#every) -* [`concat`](#concat) -* [`concatSeries`](#concatSeries) - -### Control Flow - -* [`series`](#seriestasks-callback) -* [`parallel`](#parallel) -* [`parallelLimit`](#parallellimittasks-limit-callback) -* [`whilst`](#whilst) -* [`doWhilst`](#doWhilst) -* [`until`](#until) -* [`doUntil`](#doUntil) -* [`forever`](#forever) -* [`waterfall`](#waterfall) -* [`compose`](#compose) -* [`seq`](#seq) -* [`applyEach`](#applyEach) -* [`applyEachSeries`](#applyEachSeries) -* [`queue`](#queue) -* [`priorityQueue`](#priorityQueue) -* [`cargo`](#cargo) -* [`auto`](#auto) -* [`retry`](#retry) -* [`iterator`](#iterator) -* [`apply`](#apply) -* [`nextTick`](#nextTick) -* [`times`](#times) -* [`timesSeries`](#timesSeries) - -### Utils - -* [`memoize`](#memoize) -* [`unmemoize`](#unmemoize) -* [`log`](#log) -* [`dir`](#dir) -* [`noConflict`](#noConflict) - - -## Collections - - - -### each(arr, iterator, callback) - -Applies the function `iterator` to each item in `arr`, in parallel. -The `iterator` is called with an item from the list, and a callback for when it -has finished. If the `iterator` passes an error to its `callback`, the main -`callback` (for the `each` function) is immediately called with the error. - -Note, that since this function applies `iterator` to each item in parallel, -there is no guarantee that the iterator functions will complete in order. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the `callback` should be run without - arguments or with an explicit `null` argument. -* `callback(err)` - A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Examples__ - - -```js -// assuming openFiles is an array of file names and saveFile is a function -// to save the modified contents of that file: - -async.each(openFiles, saveFile, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - -```js -// assuming openFiles is an array of file names - -async.each(openFiles, function( file, callback) { - - // Perform operation on file here. - console.log('Processing file ' + file); - - if( file.length > 32 ) { - console.log('This file name is too long'); - callback('File name too long'); - } else { - // Do work to process file here - console.log('File processed'); - callback(); - } -}, function(err){ - // if any of the file processing produced an error, err would equal that error - if( err ) { - // One of the iterations produced an error. - // All processing will now stop. - console.log('A file failed to process'); - } else { - console.log('All files have been processed successfully'); - } -}); -``` - ---------------------------------------- - - - -### eachSeries(arr, iterator, callback) - -The same as [`each`](#each), only `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -This means the `iterator` functions will complete in order. - - ---------------------------------------- - - - -### eachLimit(arr, limit, iterator, callback) - -The same as [`each`](#each), only no more than `limit` `iterator`s will be simultaneously -running at any time. - -Note that the items in `arr` are not processed in batches, so there is no guarantee that -the first `limit` `iterator` functions will complete before any others are started. - -__Arguments__ - -* `arr` - An array to iterate over. -* `limit` - The maximum number of `iterator`s to run at any time. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err)` which must be called once it has - completed. If no error has occured, the callback should be run without - arguments or with an explicit `null` argument. -* `callback(err)` - A callback which is called when all `iterator` functions - have finished, or an error occurs. - -__Example__ - -```js -// Assume documents is an array of JSON objects and requestApi is a -// function that interacts with a rate-limited REST api. - -async.eachLimit(documents, 20, requestApi, function(err){ - // if any of the saves produced an error, err would equal that error -}); -``` - ---------------------------------------- - - -### map(arr, iterator, callback) - -Produces a new array of values by mapping each value in `arr` through -the `iterator` function. The `iterator` is called with an item from `arr` and a -callback for when it has finished processing. Each of these callback takes 2 arguments: -an `error`, and the transformed item from `arr`. If `iterator` passes an error to this -callback, the main `callback` (for the `map` function) is immediately called with the error. - -Note, that since this function applies the `iterator` to each item in parallel, -there is no guarantee that the `iterator` functions will complete in order. -However, the results array will be in the same order as the original `arr`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - A callback which is called when all `iterator` - functions have finished, or an error occurs. Results is an array of the - transformed items from the `arr`. - -__Example__ - -```js -async.map(['file1','file2','file3'], fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - -### mapSeries(arr, iterator, callback) - -The same as [`map`](#map), only the `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - - ---------------------------------------- - - -### mapLimit(arr, limit, iterator, callback) - -The same as [`map`](#map), only no more than `limit` `iterator`s will be simultaneously -running at any time. - -Note that the items are not processed in batches, so there is no guarantee that -the first `limit` `iterator` functions will complete before any others are started. - -__Arguments__ - -* `arr` - An array to iterate over. -* `limit` - The maximum number of `iterator`s to run at any time. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, transformed)` which must be called once - it has completed with an error (which can be `null`) and a transformed item. -* `callback(err, results)` - A callback which is called when all `iterator` - calls have finished, or an error occurs. The result is an array of the - transformed items from the original `arr`. - -__Example__ - -```js -async.mapLimit(['file1','file2','file3'], 1, fs.stat, function(err, results){ - // results is now an array of stats for each file -}); -``` - ---------------------------------------- - - - -### filter(arr, iterator, callback) - -__Alias:__ `select` - -Returns a new array of all the values in `arr` which pass an async truth test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. This operation is -performed in parallel, but the results array will be in the same order as the -original. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The `iterator` is passed a `callback(truthValue)`, which must be called with a - boolean argument once it has completed. -* `callback(results)` - A callback which is called after all the `iterator` - functions have finished. - -__Example__ - -```js -async.filter(['file1','file2','file3'], fs.exists, function(results){ - // results now equals an array of the existing files -}); -``` - ---------------------------------------- - - - -### filterSeries(arr, iterator, callback) - -__Alias:__ `selectSeries` - -The same as [`filter`](#filter) only the `iterator` is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - ---------------------------------------- - - -### reject(arr, iterator, callback) - -The opposite of [`filter`](#filter). Removes values that pass an `async` truth test. - ---------------------------------------- - - -### rejectSeries(arr, iterator, callback) - -The same as [`reject`](#reject), only the `iterator` is applied to each item in `arr` -in series. - - ---------------------------------------- - - -### reduce(arr, memo, iterator, callback) - -__Aliases:__ `inject`, `foldl` - -Reduces `arr` into a single value using an async `iterator` to return -each successive step. `memo` is the initial state of the reduction. -This function only operates in series. - -For performance reasons, it may make sense to split a call to this function into -a parallel map, and then use the normal `Array.prototype.reduce` on the results. -This function is for situations where each step in the reduction needs to be async; -if you can get the data before reducing it, then it's probably a good idea to do so. - -__Arguments__ - -* `arr` - An array to iterate over. -* `memo` - The initial state of the reduction. -* `iterator(memo, item, callback)` - A function applied to each item in the - array to produce the next step in the reduction. The `iterator` is passed a - `callback(err, reduction)` which accepts an optional error as its first - argument, and the state of the reduction as the second. If an error is - passed to the callback, the reduction is stopped and the main `callback` is - immediately called with the error. -* `callback(err, result)` - A callback which is called after all the `iterator` - functions have finished. Result is the reduced value. - -__Example__ - -```js -async.reduce([1,2,3], 0, function(memo, item, callback){ - // pointless async: - process.nextTick(function(){ - callback(null, memo + item) - }); -}, function(err, result){ - // result is now equal to the last value of memo, which is 6 -}); -``` - ---------------------------------------- - - -### reduceRight(arr, memo, iterator, callback) - -__Alias:__ `foldr` - -Same as [`reduce`](#reduce), only operates on `arr` in reverse order. - - ---------------------------------------- - - -### detect(arr, iterator, callback) - -Returns the first value in `arr` that passes an async truth test. The -`iterator` is applied in parallel, meaning the first iterator to return `true` will -fire the detect `callback` with that result. That means the result might not be -the first item in the original `arr` (in terms of order) that passes the test. - -If order within the original `arr` is important, then look at [`detectSeries`](#detectSeries). - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in `arr`. - The iterator is passed a `callback(truthValue)` which must be called with a - boolean argument once it has completed. -* `callback(result)` - A callback which is called as soon as any iterator returns - `true`, or after all the `iterator` functions have finished. Result will be - the first item in the array that passes the truth test (iterator) or the - value `undefined` if none passed. - -__Example__ - -```js -async.detect(['file1','file2','file3'], fs.exists, function(result){ - // result now equals the first file in the list that exists -}); -``` - ---------------------------------------- - - -### detectSeries(arr, iterator, callback) - -The same as [`detect`](#detect), only the `iterator` is applied to each item in `arr` -in series. This means the result is always the first in the original `arr` (in -terms of array order) that passes the truth test. - - ---------------------------------------- - - -### sortBy(arr, iterator, callback) - -Sorts a list by the results of running each `arr` value through an async `iterator`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, sortValue)` which must be called once it - has completed with an error (which can be `null`) and a value to use as the sort - criteria. -* `callback(err, results)` - A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is the items from - the original `arr` sorted by the values returned by the `iterator` calls. - -__Example__ - -```js -async.sortBy(['file1','file2','file3'], function(file, callback){ - fs.stat(file, function(err, stats){ - callback(err, stats.mtime); - }); -}, function(err, results){ - // results is now the original array of files sorted by - // modified date -}); -``` - -__Sort Order__ - -By modifying the callback parameter the sorting order can be influenced: - -```js -//ascending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x); -}, function(err,result){ - //result callback -} ); - -//descending order -async.sortBy([1,9,3,5], function(x, callback){ - callback(err, x*-1); //<- x*-1 instead of x, turns the order around -}, function(err,result){ - //result callback -} ); -``` - ---------------------------------------- - - -### some(arr, iterator, callback) - -__Alias:__ `any` - -Returns `true` if at least one element in the `arr` satisfies an async test. -_The callback for each iterator call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. Once any iterator -call returns `true`, the main `callback` is immediately called. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a callback(truthValue) which must be - called with a boolean argument once it has completed. -* `callback(result)` - A callback which is called as soon as any iterator returns - `true`, or after all the iterator functions have finished. Result will be - either `true` or `false` depending on the values of the async tests. - -__Example__ - -```js -async.some(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then at least one of the files exists -}); -``` - ---------------------------------------- - - -### every(arr, iterator, callback) - -__Alias:__ `all` - -Returns `true` if every element in `arr` satisfies an async test. -_The callback for each `iterator` call only accepts a single argument of `true` or -`false`; it does not accept an error argument first!_ This is in-line with the -way node libraries work with truth tests like `fs.exists`. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A truth test to apply to each item in the array - in parallel. The iterator is passed a callback(truthValue) which must be - called with a boolean argument once it has completed. -* `callback(result)` - A callback which is called after all the `iterator` - functions have finished. Result will be either `true` or `false` depending on - the values of the async tests. - -__Example__ - -```js -async.every(['file1','file2','file3'], fs.exists, function(result){ - // if result is true then every file exists -}); -``` - ---------------------------------------- - - -### concat(arr, iterator, callback) - -Applies `iterator` to each item in `arr`, concatenating the results. Returns the -concatenated list. The `iterator`s are called in parallel, and the results are -concatenated as they return. There is no guarantee that the results array will -be returned in the original order of `arr` passed to the `iterator` function. - -__Arguments__ - -* `arr` - An array to iterate over. -* `iterator(item, callback)` - A function to apply to each item in `arr`. - The iterator is passed a `callback(err, results)` which must be called once it - has completed with an error (which can be `null`) and an array of results. -* `callback(err, results)` - A callback which is called after all the `iterator` - functions have finished, or an error occurs. Results is an array containing - the concatenated results of the `iterator` function. - -__Example__ - -```js -async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files){ - // files is now a list of filenames that exist in the 3 directories -}); -``` - ---------------------------------------- - - -### concatSeries(arr, iterator, callback) - -Same as [`concat`](#concat), but executes in series instead of parallel. - - -## Control Flow - - -### series(tasks, [callback]) - -Run the functions in the `tasks` array in series, each one running once the previous -function has completed. If any functions in the series pass an error to its -callback, no more functions are run, and `callback` is immediately called with the value of the error. -Otherwise, `callback` receives an array of results when `tasks` have completed. - -It is also possible to use an object instead of an array. Each property will be -run as a function, and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`series`](#series). - -**Note** that while many implementations preserve the order of object properties, the -[ECMAScript Language Specifcation](http://www.ecma-international.org/ecma-262/5.1/#sec-8.6) -explicitly states that - -> The mechanics and order of enumerating the properties is not specified. - -So if you rely on the order in which your series of functions are executed, and want -this to work on all platforms, consider using an array. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - -__Example__ - -```js -async.series([ - function(callback){ - // do some stuff ... - callback(null, 'one'); - }, - function(callback){ - // do some more stuff ... - callback(null, 'two'); - } -], -// optional callback -function(err, results){ - // results is now equal to ['one', 'two'] -}); - - -// an example using an object instead of an array -async.series({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equal to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallel(tasks, [callback]) - -Run the `tasks` array of functions in parallel, without waiting until the previous -function has completed. If any of the functions pass an error to its -callback, the main `callback` is immediately called with the value of the error. -Once the `tasks` have completed, the results are passed to the final `callback` as an -array. - -It is also possible to use an object instead of an array. Each property will be -run as a function and the results will be passed to the final `callback` as an object -instead of an array. This can be a more readable way of handling results from -[`parallel`](#parallel). - - -__Arguments__ - -* `tasks` - An array or object containing functions to run. Each function is passed - a `callback(err, result)` which it must call on completion with an error `err` - (which can be `null`) and an optional `result` value. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the task callbacks. - -__Example__ - -```js -async.parallel([ - function(callback){ - setTimeout(function(){ - callback(null, 'one'); - }, 200); - }, - function(callback){ - setTimeout(function(){ - callback(null, 'two'); - }, 100); - } -], -// optional callback -function(err, results){ - // the results array will equal ['one','two'] even though - // the second function had a shorter timeout. -}); - - -// an example using an object instead of an array -async.parallel({ - one: function(callback){ - setTimeout(function(){ - callback(null, 1); - }, 200); - }, - two: function(callback){ - setTimeout(function(){ - callback(null, 2); - }, 100); - } -}, -function(err, results) { - // results is now equals to: {one: 1, two: 2} -}); -``` - ---------------------------------------- - - -### parallelLimit(tasks, limit, [callback]) - -The same as [`parallel`](#parallel), only `tasks` are executed in parallel -with a maximum of `limit` tasks executing at any time. - -Note that the `tasks` are not executed in batches, so there is no guarantee that -the first `limit` tasks will complete before any others are started. - -__Arguments__ - -* `tasks` - An array or object containing functions to run, each function is passed - a `callback(err, result)` it must call on completion with an error `err` (which can - be `null`) and an optional `result` value. -* `limit` - The maximum number of `tasks` to run at any time. -* `callback(err, results)` - An optional callback to run once all the functions - have completed. This function gets a results array (or object) containing all - the result arguments passed to the `task` callbacks. - ---------------------------------------- - - -### whilst(test, fn, callback) - -Repeatedly call `fn`, while `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -__Arguments__ - -* `test()` - synchronous truth test to perform before each execution of `fn`. -* `fn(callback)` - A function which is called each time `test` passes. The function is - passed a `callback(err)`, which must be called once it has completed with an - optional `err` argument. -* `callback(err)` - A callback which is called after the test fails and repeated - execution of `fn` has stopped. - -__Example__ - -```js -var count = 0; - -async.whilst( - function () { return count < 5; }, - function (callback) { - count++; - setTimeout(callback, 1000); - }, - function (err) { - // 5 seconds have passed - } -); -``` - ---------------------------------------- - - -### doWhilst(fn, test, callback) - -The post-check version of [`whilst`](#whilst). To reflect the difference in -the order of operations, the arguments `test` and `fn` are switched. - -`doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. - ---------------------------------------- - - -### until(test, fn, callback) - -Repeatedly call `fn` until `test` returns `true`. Calls `callback` when stopped, -or an error occurs. - -The inverse of [`whilst`](#whilst). - ---------------------------------------- - - -### doUntil(fn, test, callback) - -Like [`doWhilst`](#doWhilst), except the `test` is inverted. Note the argument ordering differs from `until`. - ---------------------------------------- - - -### forever(fn, errback) - -Calls the asynchronous function `fn` with a callback parameter that allows it to -call itself again, in series, indefinitely. - -If an error is passed to the callback then `errback` is called with the -error, and execution stops, otherwise it will never be called. - -```js -async.forever( - function(next) { - // next is suitable for passing to things that need a callback(err [, whatever]); - // it will result in this function being called again. - }, - function(err) { - // if next is called with a value in its first parameter, it will appear - // in here as 'err', and execution will stop. - } -); -``` - ---------------------------------------- - - -### waterfall(tasks, [callback]) - -Runs the `tasks` array of functions in series, each passing their results to the next in -the array. However, if any of the `tasks` pass an error to their own callback, the -next function is not executed, and the main `callback` is immediately called with -the error. - -__Arguments__ - -* `tasks` - An array of functions to run, each function is passed a - `callback(err, result1, result2, ...)` it must call on completion. The first - argument is an error (which can be `null`) and any further arguments will be - passed as arguments in order to the next task. -* `callback(err, [results])` - An optional callback to run once all the functions - have completed. This will be passed the results of the last task's callback. - - - -__Example__ - -```js -async.waterfall([ - function(callback){ - callback(null, 'one', 'two'); - }, - function(arg1, arg2, callback){ - // arg1 now equals 'one' and arg2 now equals 'two' - callback(null, 'three'); - }, - function(arg1, callback){ - // arg1 now equals 'three' - callback(null, 'done'); - } -], function (err, result) { - // result now equals 'done' -}); -``` - ---------------------------------------- - -### compose(fn1, fn2...) - -Creates a function which is a composition of the passed asynchronous -functions. Each function consumes the return value of the function that -follows. Composing functions `f()`, `g()`, and `h()` would produce the result of -`f(g(h()))`, only this version uses callbacks to obtain the return values. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* `functions...` - the asynchronous functions to compose - - -__Example__ - -```js -function add1(n, callback) { - setTimeout(function () { - callback(null, n + 1); - }, 10); -} - -function mul3(n, callback) { - setTimeout(function () { - callback(null, n * 3); - }, 10); -} - -var add1mul3 = async.compose(mul3, add1); - -add1mul3(4, function (err, result) { - // result now equals 15 -}); -``` - ---------------------------------------- - -### seq(fn1, fn2...) - -Version of the compose function that is more natural to read. -Each following function consumes the return value of the latter function. - -Each function is executed with the `this` binding of the composed function. - -__Arguments__ - -* functions... - the asynchronous functions to compose - - -__Example__ - -```js -// Requires lodash (or underscore), express3 and dresende's orm2. -// Part of an app, that fetches cats of the logged user. -// This example uses `seq` function to avoid overnesting and error -// handling clutter. -app.get('/cats', function(request, response) { - function handleError(err, data, callback) { - if (err) { - console.error(err); - response.json({ status: 'error', message: err.message }); - } - else { - callback(data); - } - } - var User = request.models.User; - async.seq( - _.bind(User.get, User), // 'User.get' has signature (id, callback(err, data)) - handleError, - function(user, fn) { - user.getCats(fn); // 'getCats' has signature (callback(err, data)) - }, - handleError, - function(cats) { - response.json({ status: 'ok', message: 'Cats found', data: cats }); - } - )(req.session.user_id); - } -}); -``` - ---------------------------------------- - -### applyEach(fns, args..., callback) - -Applies the provided arguments to each function in the array, calling -`callback` after all functions have completed. If you only provide the first -argument, then it will return a function which lets you pass in the -arguments as if it were a single function call. - -__Arguments__ - -* `fns` - the asynchronous functions to all call with the same arguments -* `args...` - any number of separate arguments to pass to the function -* `callback` - the final argument should be the callback, called when all - functions have completed processing - - -__Example__ - -```js -async.applyEach([enableSearch, updateSchema], 'bucket', callback); - -// partial application example: -async.each( - buckets, - async.applyEach([enableSearch, updateSchema]), - callback -); -``` - ---------------------------------------- - - -### applyEachSeries(arr, iterator, callback) - -The same as [`applyEach`](#applyEach) only the functions are applied in series. - ---------------------------------------- - - -### queue(worker, concurrency) - -Creates a `queue` object with the specified `concurrency`. Tasks added to the -`queue` are processed in parallel (up to the `concurrency` limit). If all -`worker`s are in progress, the task is queued until one becomes available. -Once a `worker` completes a `task`, that `task`'s callback is called. - -__Arguments__ - -* `worker(task, callback)` - An asynchronous function for processing a queued - task, which must call its `callback(err)` argument when finished, with an - optional `error` as an argument. -* `concurrency` - An `integer` for determining how many `worker` functions should be - run in parallel. - -__Queue objects__ - -The `queue` object returned by this function has the following properties and -methods: - -* `length()` - a function returning the number of items waiting to be processed. -* `started` - a function returning whether or not any items have been pushed and processed by the queue -* `running()` - a function returning the number of items currently being processed. -* `idle()` - a function returning false if there are items waiting or being processed, or true if not. -* `concurrency` - an integer for determining how many `worker` functions should be - run in parallel. This property can be changed after a `queue` is created to - alter the concurrency on-the-fly. -* `push(task, [callback])` - add a new task to the `queue`. Calls `callback` once - the `worker` has finished processing the task. Instead of a single task, a `tasks` array - can be submitted. The respective callback is used for every task in the list. -* `unshift(task, [callback])` - add a new task to the front of the `queue`. -* `saturated` - a callback that is called when the `queue` length hits the `concurrency` limit, - and further tasks will be queued. -* `empty` - a callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - a callback that is called when the last item from the `queue` has returned from the `worker`. -* `paused` - a boolean for determining whether the queue is in a paused state -* `pause()` - a function that pauses the processing of tasks until `resume()` is called. -* `resume()` - a function that resumes the processing of queued tasks when the queue is paused. -* `kill()` - a function that empties remaining tasks from the queue forcing it to go idle. - -__Example__ - -```js -// create a queue object with concurrency 2 - -var q = async.queue(function (task, callback) { - console.log('hello ' + task.name); - callback(); -}, 2); - - -// assign a callback -q.drain = function() { - console.log('all items have been processed'); -} - -// add some items to the queue - -q.push({name: 'foo'}, function (err) { - console.log('finished processing foo'); -}); -q.push({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); - -// add some items to the queue (batch-wise) - -q.push([{name: 'baz'},{name: 'bay'},{name: 'bax'}], function (err) { - console.log('finished processing bar'); -}); - -// add some items to the front of the queue - -q.unshift({name: 'bar'}, function (err) { - console.log('finished processing bar'); -}); -``` - - ---------------------------------------- - - -### priorityQueue(worker, concurrency) - -The same as [`queue`](#queue) only tasks are assigned a priority and completed in ascending priority order. There are two differences between `queue` and `priorityQueue` objects: - -* `push(task, priority, [callback])` - `priority` should be a number. If an array of - `tasks` is given, all tasks will be assigned the same priority. -* The `unshift` method was removed. - ---------------------------------------- - - -### cargo(worker, [payload]) - -Creates a `cargo` object with the specified payload. Tasks added to the -cargo will be processed altogether (up to the `payload` limit). If the -`worker` is in progress, the task is queued until it becomes available. Once -the `worker` has completed some tasks, each callback of those tasks is called. -Check out [this animation](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) for how `cargo` and `queue` work. - -While [queue](#queue) passes only one task to one of a group of workers -at a time, cargo passes an array of tasks to a single worker, repeating -when the worker is finished. - -__Arguments__ - -* `worker(tasks, callback)` - An asynchronous function for processing an array of - queued tasks, which must call its `callback(err)` argument when finished, with - an optional `err` argument. -* `payload` - An optional `integer` for determining how many tasks should be - processed per round; if omitted, the default is unlimited. - -__Cargo objects__ - -The `cargo` object returned by this function has the following properties and -methods: - -* `length()` - A function returning the number of items waiting to be processed. -* `payload` - An `integer` for determining how many tasks should be - process per round. This property can be changed after a `cargo` is created to - alter the payload on-the-fly. -* `push(task, [callback])` - Adds `task` to the `queue`. The callback is called - once the `worker` has finished processing the task. Instead of a single task, an array of `tasks` - can be submitted. The respective callback is used for every task in the list. -* `saturated` - A callback that is called when the `queue.length()` hits the concurrency and further tasks will be queued. -* `empty` - A callback that is called when the last item from the `queue` is given to a `worker`. -* `drain` - A callback that is called when the last item from the `queue` has returned from the `worker`. - -__Example__ - -```js -// create a cargo object with payload 2 - -var cargo = async.cargo(function (tasks, callback) { - for(var i=0; i -### auto(tasks, [callback]) - -Determines the best order for running the functions in `tasks`, based on their -requirements. Each function can optionally depend on other functions being completed -first, and each function is run as soon as its requirements are satisfied. - -If any of the functions pass an error to their callback, it will not -complete (so any other functions depending on it will not run), and the main -`callback` is immediately called with the error. Functions also receive an -object containing the results of functions which have completed so far. - -Note, all functions are called with a `results` object as a second argument, -so it is unsafe to pass functions in the `tasks` object which cannot handle the -extra argument. - -For example, this snippet of code: - -```js -async.auto({ - readData: async.apply(fs.readFile, 'data.txt', 'utf-8') -}, callback); -``` - -will have the effect of calling `readFile` with the results object as the last -argument, which will fail: - -```js -fs.readFile('data.txt', 'utf-8', cb, {}); -``` - -Instead, wrap the call to `readFile` in a function which does not forward the -`results` object: - -```js -async.auto({ - readData: function(cb, results){ - fs.readFile('data.txt', 'utf-8', cb); - } -}, callback); -``` - -__Arguments__ - -* `tasks` - An object. Each of its properties is either a function or an array of - requirements, with the function itself the last item in the array. The object's key - of a property serves as the name of the task defined by that property, - i.e. can be used when specifying requirements for other tasks. - The function receives two arguments: (1) a `callback(err, result)` which must be - called when finished, passing an `error` (which can be `null`) and the result of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions. -* `callback(err, results)` - An optional callback which is called when all the - tasks have been completed. It receives the `err` argument if any `tasks` - pass an error to their callback. Results are always returned; however, if - an error occurs, no further `tasks` will be performed, and the results - object will only contain partial results. - - -__Example__ - -```js -async.auto({ - get_data: function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - make_folder: function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - }, - write_file: ['get_data', 'make_folder', function(callback, results){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - callback(null, 'filename'); - }], - email_link: ['write_file', function(callback, results){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - // results.write_file contains the filename returned by write_file. - callback(null, {'file':results.write_file, 'email':'user@example.com'}); - }] -}, function(err, results) { - console.log('err = ', err); - console.log('results = ', results); -}); -``` - -This is a fairly trivial example, but to do this using the basic parallel and -series functions would look like this: - -```js -async.parallel([ - function(callback){ - console.log('in get_data'); - // async code to get some data - callback(null, 'data', 'converted to array'); - }, - function(callback){ - console.log('in make_folder'); - // async code to create a directory to store a file in - // this is run at the same time as getting the data - callback(null, 'folder'); - } -], -function(err, results){ - async.series([ - function(callback){ - console.log('in write_file', JSON.stringify(results)); - // once there is some data and the directory exists, - // write the data to a file in the directory - results.push('filename'); - callback(null); - }, - function(callback){ - console.log('in email_link', JSON.stringify(results)); - // once the file is written let's email a link to it... - callback(null, {'file':results.pop(), 'email':'user@example.com'}); - } - ]); -}); -``` - -For a complicated series of `async` tasks, using the [`auto`](#auto) function makes adding -new tasks much easier (and the code more readable). - - ---------------------------------------- - - -### retry([times = 5], task, [callback]) - -Attempts to get a successful response from `task` no more than `times` times before -returning an error. If the task is successful, the `callback` will be passed the result -of the successfull task. If all attemps fail, the callback will be passed the error and -result (if any) of the final attempt. - -__Arguments__ - -* `times` - An integer indicating how many times to attempt the `task` before giving up. Defaults to 5. -* `task(callback, results)` - A function which receives two arguments: (1) a `callback(err, result)` - which must be called when finished, passing `err` (which can be `null`) and the `result` of - the function's execution, and (2) a `results` object, containing the results of - the previously executed functions (if nested inside another control flow). -* `callback(err, results)` - An optional callback which is called when the - task has succeeded, or after the final failed attempt. It receives the `err` and `result` arguments of the last attempt at completing the `task`. - -The [`retry`](#retry) function can be used as a stand-alone control flow by passing a -callback, as shown below: - -```js -async.retry(3, apiMethod, function(err, result) { - // do something with the result -}); -``` - -It can also be embeded within other control flow functions to retry individual methods -that are not as reliable, like this: - -```js -async.auto({ - users: api.getUsers.bind(api), - payments: async.retry(3, api.getPayments.bind(api)) -}, function(err, results) { - // do something with the results -}); -``` - - ---------------------------------------- - - -### iterator(tasks) - -Creates an iterator function which calls the next function in the `tasks` array, -returning a continuation to call the next one after that. It's also possible to -“peek” at the next iterator with `iterator.next()`. - -This function is used internally by the `async` module, but can be useful when -you want to manually control the flow of functions in series. - -__Arguments__ - -* `tasks` - An array of functions to run. - -__Example__ - -```js -var iterator = async.iterator([ - function(){ sys.p('one'); }, - function(){ sys.p('two'); }, - function(){ sys.p('three'); } -]); - -node> var iterator2 = iterator(); -'one' -node> var iterator3 = iterator2(); -'two' -node> iterator3(); -'three' -node> var nextfn = iterator2.next(); -node> nextfn(); -'three' -``` - ---------------------------------------- - - -### apply(function, arguments..) - -Creates a continuation function with some arguments already applied. - -Useful as a shorthand when combined with other control flow functions. Any arguments -passed to the returned function are added to the arguments originally passed -to apply. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to automatically apply when the - continuation is called. - -__Example__ - -```js -// using apply - -async.parallel([ - async.apply(fs.writeFile, 'testfile1', 'test1'), - async.apply(fs.writeFile, 'testfile2', 'test2'), -]); - - -// the same process without using apply - -async.parallel([ - function(callback){ - fs.writeFile('testfile1', 'test1', callback); - }, - function(callback){ - fs.writeFile('testfile2', 'test2', callback); - } -]); -``` - -It's possible to pass any number of additional arguments when calling the -continuation: - -```js -node> var fn = async.apply(sys.puts, 'one'); -node> fn('two', 'three'); -one -two -three -``` - ---------------------------------------- - - -### nextTick(callback) - -Calls `callback` on a later loop around the event loop. In Node.js this just -calls `process.nextTick`; in the browser it falls back to `setImmediate(callback)` -if available, otherwise `setTimeout(callback, 0)`, which means other higher priority -events may precede the execution of `callback`. - -This is used internally for browser-compatibility purposes. - -__Arguments__ - -* `callback` - The function to call on a later loop around the event loop. - -__Example__ - -```js -var call_order = []; -async.nextTick(function(){ - call_order.push('two'); - // call_order now equals ['one','two'] -}); -call_order.push('one') -``` - - -### times(n, callback) - -Calls the `callback` function `n` times, and accumulates results in the same manner -you would use with [`map`](#map). - -__Arguments__ - -* `n` - The number of times to run the function. -* `callback` - The function to call `n` times. - -__Example__ - -```js -// Pretend this is some complicated async factory -var createUser = function(id, callback) { - callback(null, { - id: 'user' + id - }) -} -// generate 5 users -async.times(5, function(n, next){ - createUser(n, function(err, user) { - next(err, user) - }) -}, function(err, users) { - // we should now have 5 users -}); -``` - - -### timesSeries(n, callback) - -The same as [`times`](#times), only the iterator is applied to each item in `arr` in -series. The next `iterator` is only called once the current one has completed. -The results array will be in the same order as the original. - - -## Utils - - -### memoize(fn, [hasher]) - -Caches the results of an `async` function. When creating a hash to store function -results against, the callback is omitted from the hash and an optional hash -function can be used. - -The cache of results is exposed as the `memo` property of the function returned -by `memoize`. - -__Arguments__ - -* `fn` - The function to proxy and cache results from. -* `hasher` - Tn optional function for generating a custom hash for storing - results. It has all the arguments applied to it apart from the callback, and - must be synchronous. - -__Example__ - -```js -var slow_fn = function (name, callback) { - // do something - callback(null, result); -}; -var fn = async.memoize(slow_fn); - -// fn can now be used as if it were slow_fn -fn('some name', function () { - // callback -}); -``` - - -### unmemoize(fn) - -Undoes a [`memoize`](#memoize)d function, reverting it to the original, unmemoized -form. Handy for testing. - -__Arguments__ - -* `fn` - the memoized function - - -### log(function, arguments) - -Logs the result of an `async` function to the `console`. Only works in Node.js or -in browsers that support `console.log` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.log` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, 'hello ' + name); - }, 1000); -}; -``` -```js -node> async.log(hello, 'world'); -'hello world' -``` - ---------------------------------------- - - -### dir(function, arguments) - -Logs the result of an `async` function to the `console` using `console.dir` to -display the properties of the resulting object. Only works in Node.js or -in browsers that support `console.dir` and `console.error` (such as FF and Chrome). -If multiple arguments are returned from the async function, `console.dir` is -called on each argument in order. - -__Arguments__ - -* `function` - The function you want to eventually apply all arguments to. -* `arguments...` - Any number of arguments to apply to the function. - -__Example__ - -```js -var hello = function(name, callback){ - setTimeout(function(){ - callback(null, {hello: name}); - }, 1000); -}; -``` -```js -node> async.dir(hello, 'world'); -{hello: 'world'} -``` - ---------------------------------------- - - -### noConflict() - -Changes the value of `async` back to its original value, returning a reference to the -`async` object. diff --git a/Databases/node_modules/mongoose/node_modules/async/component.json b/Databases/node_modules/mongoose/node_modules/async/component.json deleted file mode 100644 index bbb01154..00000000 --- a/Databases/node_modules/mongoose/node_modules/async/component.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "name": "async", - "repo": "caolan/async", - "description": "Higher-order functions and common patterns for asynchronous code", - "version": "0.1.23", - "keywords": [], - "dependencies": {}, - "development": {}, - "main": "lib/async.js", - "scripts": [ "lib/async.js" ] -} diff --git a/Databases/node_modules/mongoose/node_modules/async/lib/async.js b/Databases/node_modules/mongoose/node_modules/async/lib/async.js deleted file mode 100755 index 01e8afcc..00000000 --- a/Databases/node_modules/mongoose/node_modules/async/lib/async.js +++ /dev/null @@ -1,1123 +0,0 @@ -/*! - * async - * https://github.com/caolan/async - * - * Copyright 2010-2014 Caolan McMahon - * Released under the MIT license - */ -/*jshint onevar: false, indent:4 */ -/*global setImmediate: false, setTimeout: false, console: false */ -(function () { - - var async = {}; - - // global on the server, window in the browser - var root, previous_async; - - root = this; - if (root != null) { - previous_async = root.async; - } - - async.noConflict = function () { - root.async = previous_async; - return async; - }; - - function only_once(fn) { - var called = false; - return function() { - if (called) throw new Error("Callback was already called."); - called = true; - fn.apply(root, arguments); - } - } - - //// cross-browser compatiblity functions //// - - var _toString = Object.prototype.toString; - - var _isArray = Array.isArray || function (obj) { - return _toString.call(obj) === '[object Array]'; - }; - - var _each = function (arr, iterator) { - if (arr.forEach) { - return arr.forEach(iterator); - } - for (var i = 0; i < arr.length; i += 1) { - iterator(arr[i], i, arr); - } - }; - - var _map = function (arr, iterator) { - if (arr.map) { - return arr.map(iterator); - } - var results = []; - _each(arr, function (x, i, a) { - results.push(iterator(x, i, a)); - }); - return results; - }; - - var _reduce = function (arr, iterator, memo) { - if (arr.reduce) { - return arr.reduce(iterator, memo); - } - _each(arr, function (x, i, a) { - memo = iterator(memo, x, i, a); - }); - return memo; - }; - - var _keys = function (obj) { - if (Object.keys) { - return Object.keys(obj); - } - var keys = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - keys.push(k); - } - } - return keys; - }; - - //// exported async module functions //// - - //// nextTick implementation with browser-compatible fallback //// - if (typeof process === 'undefined' || !(process.nextTick)) { - if (typeof setImmediate === 'function') { - async.nextTick = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - async.setImmediate = async.nextTick; - } - else { - async.nextTick = function (fn) { - setTimeout(fn, 0); - }; - async.setImmediate = async.nextTick; - } - } - else { - async.nextTick = process.nextTick; - if (typeof setImmediate !== 'undefined') { - async.setImmediate = function (fn) { - // not a direct alias for IE10 compatibility - setImmediate(fn); - }; - } - else { - async.setImmediate = async.nextTick; - } - } - - async.each = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - _each(arr, function (x) { - iterator(x, only_once(done) ); - }); - function done(err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(); - } - } - } - }; - async.forEach = async.each; - - async.eachSeries = function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length) { - return callback(); - } - var completed = 0; - var iterate = function () { - iterator(arr[completed], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - if (completed >= arr.length) { - callback(); - } - else { - iterate(); - } - } - }); - }; - iterate(); - }; - async.forEachSeries = async.eachSeries; - - async.eachLimit = function (arr, limit, iterator, callback) { - var fn = _eachLimit(limit); - fn.apply(null, [arr, iterator, callback]); - }; - async.forEachLimit = async.eachLimit; - - var _eachLimit = function (limit) { - - return function (arr, iterator, callback) { - callback = callback || function () {}; - if (!arr.length || limit <= 0) { - return callback(); - } - var completed = 0; - var started = 0; - var running = 0; - - (function replenish () { - if (completed >= arr.length) { - return callback(); - } - - while (running < limit && started < arr.length) { - started += 1; - running += 1; - iterator(arr[started - 1], function (err) { - if (err) { - callback(err); - callback = function () {}; - } - else { - completed += 1; - running -= 1; - if (completed >= arr.length) { - callback(); - } - else { - replenish(); - } - } - }); - } - })(); - }; - }; - - - var doParallel = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.each].concat(args)); - }; - }; - var doParallelLimit = function(limit, fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [_eachLimit(limit)].concat(args)); - }; - }; - var doSeries = function (fn) { - return function () { - var args = Array.prototype.slice.call(arguments); - return fn.apply(null, [async.eachSeries].concat(args)); - }; - }; - - - var _asyncMap = function (eachfn, arr, iterator, callback) { - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - if (!callback) { - eachfn(arr, function (x, callback) { - iterator(x.value, function (err) { - callback(err); - }); - }); - } else { - var results = []; - eachfn(arr, function (x, callback) { - iterator(x.value, function (err, v) { - results[x.index] = v; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - async.map = doParallel(_asyncMap); - async.mapSeries = doSeries(_asyncMap); - async.mapLimit = function (arr, limit, iterator, callback) { - return _mapLimit(limit)(arr, iterator, callback); - }; - - var _mapLimit = function(limit) { - return doParallelLimit(limit, _asyncMap); - }; - - // reduce only has a series version, as doing reduce in parallel won't - // work in many situations. - async.reduce = function (arr, memo, iterator, callback) { - async.eachSeries(arr, function (x, callback) { - iterator(memo, x, function (err, v) { - memo = v; - callback(err); - }); - }, function (err) { - callback(err, memo); - }); - }; - // inject alias - async.inject = async.reduce; - // foldl alias - async.foldl = async.reduce; - - async.reduceRight = function (arr, memo, iterator, callback) { - var reversed = _map(arr, function (x) { - return x; - }).reverse(); - async.reduce(reversed, memo, iterator, callback); - }; - // foldr alias - async.foldr = async.reduceRight; - - var _filter = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.filter = doParallel(_filter); - async.filterSeries = doSeries(_filter); - // select alias - async.select = async.filter; - async.selectSeries = async.filterSeries; - - var _reject = function (eachfn, arr, iterator, callback) { - var results = []; - arr = _map(arr, function (x, i) { - return {index: i, value: x}; - }); - eachfn(arr, function (x, callback) { - iterator(x.value, function (v) { - if (!v) { - results.push(x); - } - callback(); - }); - }, function (err) { - callback(_map(results.sort(function (a, b) { - return a.index - b.index; - }), function (x) { - return x.value; - })); - }); - }; - async.reject = doParallel(_reject); - async.rejectSeries = doSeries(_reject); - - var _detect = function (eachfn, arr, iterator, main_callback) { - eachfn(arr, function (x, callback) { - iterator(x, function (result) { - if (result) { - main_callback(x); - main_callback = function () {}; - } - else { - callback(); - } - }); - }, function (err) { - main_callback(); - }); - }; - async.detect = doParallel(_detect); - async.detectSeries = doSeries(_detect); - - async.some = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (v) { - main_callback(true); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(false); - }); - }; - // any alias - async.any = async.some; - - async.every = function (arr, iterator, main_callback) { - async.each(arr, function (x, callback) { - iterator(x, function (v) { - if (!v) { - main_callback(false); - main_callback = function () {}; - } - callback(); - }); - }, function (err) { - main_callback(true); - }); - }; - // all alias - async.all = async.every; - - async.sortBy = function (arr, iterator, callback) { - async.map(arr, function (x, callback) { - iterator(x, function (err, criteria) { - if (err) { - callback(err); - } - else { - callback(null, {value: x, criteria: criteria}); - } - }); - }, function (err, results) { - if (err) { - return callback(err); - } - else { - var fn = function (left, right) { - var a = left.criteria, b = right.criteria; - return a < b ? -1 : a > b ? 1 : 0; - }; - callback(null, _map(results.sort(fn), function (x) { - return x.value; - })); - } - }); - }; - - async.auto = function (tasks, callback) { - callback = callback || function () {}; - var keys = _keys(tasks); - var remainingTasks = keys.length - if (!remainingTasks) { - return callback(); - } - - var results = {}; - - var listeners = []; - var addListener = function (fn) { - listeners.unshift(fn); - }; - var removeListener = function (fn) { - for (var i = 0; i < listeners.length; i += 1) { - if (listeners[i] === fn) { - listeners.splice(i, 1); - return; - } - } - }; - var taskComplete = function () { - remainingTasks-- - _each(listeners.slice(0), function (fn) { - fn(); - }); - }; - - addListener(function () { - if (!remainingTasks) { - var theCallback = callback; - // prevent final callback from calling itself if it errors - callback = function () {}; - - theCallback(null, results); - } - }); - - _each(keys, function (k) { - var task = _isArray(tasks[k]) ? tasks[k]: [tasks[k]]; - var taskCallback = function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - if (err) { - var safeResults = {}; - _each(_keys(results), function(rkey) { - safeResults[rkey] = results[rkey]; - }); - safeResults[k] = args; - callback(err, safeResults); - // stop subsequent errors hitting callback multiple times - callback = function () {}; - } - else { - results[k] = args; - async.setImmediate(taskComplete); - } - }; - var requires = task.slice(0, Math.abs(task.length - 1)) || []; - var ready = function () { - return _reduce(requires, function (a, x) { - return (a && results.hasOwnProperty(x)); - }, true) && !results.hasOwnProperty(k); - }; - if (ready()) { - task[task.length - 1](taskCallback, results); - } - else { - var listener = function () { - if (ready()) { - removeListener(listener); - task[task.length - 1](taskCallback, results); - } - }; - addListener(listener); - } - }); - }; - - async.retry = function(times, task, callback) { - var DEFAULT_TIMES = 5; - var attempts = []; - // Use defaults if times not passed - if (typeof times === 'function') { - callback = task; - task = times; - times = DEFAULT_TIMES; - } - // Make sure times is a number - times = parseInt(times, 10) || DEFAULT_TIMES; - var wrappedTask = function(wrappedCallback, wrappedResults) { - var retryAttempt = function(task, finalAttempt) { - return function(seriesCallback) { - task(function(err, result){ - seriesCallback(!err || finalAttempt, {err: err, result: result}); - }, wrappedResults); - }; - }; - while (times) { - attempts.push(retryAttempt(task, !(times-=1))); - } - async.series(attempts, function(done, data){ - data = data[data.length - 1]; - (wrappedCallback || callback)(data.err, data.result); - }); - } - // If a callback is passed, run this as a controll flow - return callback ? wrappedTask() : wrappedTask - }; - - async.waterfall = function (tasks, callback) { - callback = callback || function () {}; - if (!_isArray(tasks)) { - var err = new Error('First argument to waterfall must be an array of functions'); - return callback(err); - } - if (!tasks.length) { - return callback(); - } - var wrapIterator = function (iterator) { - return function (err) { - if (err) { - callback.apply(null, arguments); - callback = function () {}; - } - else { - var args = Array.prototype.slice.call(arguments, 1); - var next = iterator.next(); - if (next) { - args.push(wrapIterator(next)); - } - else { - args.push(callback); - } - async.setImmediate(function () { - iterator.apply(null, args); - }); - } - }; - }; - wrapIterator(async.iterator(tasks))(); - }; - - var _parallel = function(eachfn, tasks, callback) { - callback = callback || function () {}; - if (_isArray(tasks)) { - eachfn.map(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - eachfn.each(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.parallel = function (tasks, callback) { - _parallel({ map: async.map, each: async.each }, tasks, callback); - }; - - async.parallelLimit = function(tasks, limit, callback) { - _parallel({ map: _mapLimit(limit), each: _eachLimit(limit) }, tasks, callback); - }; - - async.series = function (tasks, callback) { - callback = callback || function () {}; - if (_isArray(tasks)) { - async.mapSeries(tasks, function (fn, callback) { - if (fn) { - fn(function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - callback.call(null, err, args); - }); - } - }, callback); - } - else { - var results = {}; - async.eachSeries(_keys(tasks), function (k, callback) { - tasks[k](function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (args.length <= 1) { - args = args[0]; - } - results[k] = args; - callback(err); - }); - }, function (err) { - callback(err, results); - }); - } - }; - - async.iterator = function (tasks) { - var makeCallback = function (index) { - var fn = function () { - if (tasks.length) { - tasks[index].apply(null, arguments); - } - return fn.next(); - }; - fn.next = function () { - return (index < tasks.length - 1) ? makeCallback(index + 1): null; - }; - return fn; - }; - return makeCallback(0); - }; - - async.apply = function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - return function () { - return fn.apply( - null, args.concat(Array.prototype.slice.call(arguments)) - ); - }; - }; - - var _concat = function (eachfn, arr, fn, callback) { - var r = []; - eachfn(arr, function (x, cb) { - fn(x, function (err, y) { - r = r.concat(y || []); - cb(err); - }); - }, function (err) { - callback(err, r); - }); - }; - async.concat = doParallel(_concat); - async.concatSeries = doSeries(_concat); - - async.whilst = function (test, iterator, callback) { - if (test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.whilst(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doWhilst = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - var args = Array.prototype.slice.call(arguments, 1); - if (test.apply(null, args)) { - async.doWhilst(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.until = function (test, iterator, callback) { - if (!test()) { - iterator(function (err) { - if (err) { - return callback(err); - } - async.until(test, iterator, callback); - }); - } - else { - callback(); - } - }; - - async.doUntil = function (iterator, test, callback) { - iterator(function (err) { - if (err) { - return callback(err); - } - var args = Array.prototype.slice.call(arguments, 1); - if (!test.apply(null, args)) { - async.doUntil(iterator, test, callback); - } - else { - callback(); - } - }); - }; - - async.queue = function (worker, concurrency) { - if (concurrency === undefined) { - concurrency = 1; - } - function _insert(q, data, pos, callback) { - if (!q.started){ - q.started = true; - } - if (!_isArray(data)) { - data = [data]; - } - if(data.length == 0) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - if (q.drain) { - q.drain(); - } - }); - } - _each(data, function(task) { - var item = { - data: task, - callback: typeof callback === 'function' ? callback : null - }; - - if (pos) { - q.tasks.unshift(item); - } else { - q.tasks.push(item); - } - - if (q.saturated && q.tasks.length === q.concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - var workers = 0; - var q = { - tasks: [], - concurrency: concurrency, - saturated: null, - empty: null, - drain: null, - started: false, - paused: false, - push: function (data, callback) { - _insert(q, data, false, callback); - }, - kill: function () { - q.drain = null; - q.tasks = []; - }, - unshift: function (data, callback) { - _insert(q, data, true, callback); - }, - process: function () { - if (!q.paused && workers < q.concurrency && q.tasks.length) { - var task = q.tasks.shift(); - if (q.empty && q.tasks.length === 0) { - q.empty(); - } - workers += 1; - var next = function () { - workers -= 1; - if (task.callback) { - task.callback.apply(task, arguments); - } - if (q.drain && q.tasks.length + workers === 0) { - q.drain(); - } - q.process(); - }; - var cb = only_once(next); - worker(task.data, cb); - } - }, - length: function () { - return q.tasks.length; - }, - running: function () { - return workers; - }, - idle: function() { - return q.tasks.length + workers === 0; - }, - pause: function () { - if (q.paused === true) { return; } - q.paused = true; - q.process(); - }, - resume: function () { - if (q.paused === false) { return; } - q.paused = false; - q.process(); - } - }; - return q; - }; - - async.priorityQueue = function (worker, concurrency) { - - function _compareTasks(a, b){ - return a.priority - b.priority; - }; - - function _binarySearch(sequence, item, compare) { - var beg = -1, - end = sequence.length - 1; - while (beg < end) { - var mid = beg + ((end - beg + 1) >>> 1); - if (compare(item, sequence[mid]) >= 0) { - beg = mid; - } else { - end = mid - 1; - } - } - return beg; - } - - function _insert(q, data, priority, callback) { - if (!q.started){ - q.started = true; - } - if (!_isArray(data)) { - data = [data]; - } - if(data.length == 0) { - // call drain immediately if there are no tasks - return async.setImmediate(function() { - if (q.drain) { - q.drain(); - } - }); - } - _each(data, function(task) { - var item = { - data: task, - priority: priority, - callback: typeof callback === 'function' ? callback : null - }; - - q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item); - - if (q.saturated && q.tasks.length === q.concurrency) { - q.saturated(); - } - async.setImmediate(q.process); - }); - } - - // Start with a normal queue - var q = async.queue(worker, concurrency); - - // Override push to accept second parameter representing priority - q.push = function (data, priority, callback) { - _insert(q, data, priority, callback); - }; - - // Remove unshift function - delete q.unshift; - - return q; - }; - - async.cargo = function (worker, payload) { - var working = false, - tasks = []; - - var cargo = { - tasks: tasks, - payload: payload, - saturated: null, - empty: null, - drain: null, - drained: true, - push: function (data, callback) { - if (!_isArray(data)) { - data = [data]; - } - _each(data, function(task) { - tasks.push({ - data: task, - callback: typeof callback === 'function' ? callback : null - }); - cargo.drained = false; - if (cargo.saturated && tasks.length === payload) { - cargo.saturated(); - } - }); - async.setImmediate(cargo.process); - }, - process: function process() { - if (working) return; - if (tasks.length === 0) { - if(cargo.drain && !cargo.drained) cargo.drain(); - cargo.drained = true; - return; - } - - var ts = typeof payload === 'number' - ? tasks.splice(0, payload) - : tasks.splice(0, tasks.length); - - var ds = _map(ts, function (task) { - return task.data; - }); - - if(cargo.empty) cargo.empty(); - working = true; - worker(ds, function () { - working = false; - - var args = arguments; - _each(ts, function (data) { - if (data.callback) { - data.callback.apply(null, args); - } - }); - - process(); - }); - }, - length: function () { - return tasks.length; - }, - running: function () { - return working; - } - }; - return cargo; - }; - - var _console_fn = function (name) { - return function (fn) { - var args = Array.prototype.slice.call(arguments, 1); - fn.apply(null, args.concat([function (err) { - var args = Array.prototype.slice.call(arguments, 1); - if (typeof console !== 'undefined') { - if (err) { - if (console.error) { - console.error(err); - } - } - else if (console[name]) { - _each(args, function (x) { - console[name](x); - }); - } - } - }])); - }; - }; - async.log = _console_fn('log'); - async.dir = _console_fn('dir'); - /*async.info = _console_fn('info'); - async.warn = _console_fn('warn'); - async.error = _console_fn('error');*/ - - async.memoize = function (fn, hasher) { - var memo = {}; - var queues = {}; - hasher = hasher || function (x) { - return x; - }; - var memoized = function () { - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - var key = hasher.apply(null, args); - if (key in memo) { - async.nextTick(function () { - callback.apply(null, memo[key]); - }); - } - else if (key in queues) { - queues[key].push(callback); - } - else { - queues[key] = [callback]; - fn.apply(null, args.concat([function () { - memo[key] = arguments; - var q = queues[key]; - delete queues[key]; - for (var i = 0, l = q.length; i < l; i++) { - q[i].apply(null, arguments); - } - }])); - } - }; - memoized.memo = memo; - memoized.unmemoized = fn; - return memoized; - }; - - async.unmemoize = function (fn) { - return function () { - return (fn.unmemoized || fn).apply(null, arguments); - }; - }; - - async.times = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.map(counter, iterator, callback); - }; - - async.timesSeries = function (count, iterator, callback) { - var counter = []; - for (var i = 0; i < count; i++) { - counter.push(i); - } - return async.mapSeries(counter, iterator, callback); - }; - - async.seq = function (/* functions... */) { - var fns = arguments; - return function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - async.reduce(fns, args, function (newargs, fn, cb) { - fn.apply(that, newargs.concat([function () { - var err = arguments[0]; - var nextargs = Array.prototype.slice.call(arguments, 1); - cb(err, nextargs); - }])) - }, - function (err, results) { - callback.apply(that, [err].concat(results)); - }); - }; - }; - - async.compose = function (/* functions... */) { - return async.seq.apply(null, Array.prototype.reverse.call(arguments)); - }; - - var _applyEach = function (eachfn, fns /*args...*/) { - var go = function () { - var that = this; - var args = Array.prototype.slice.call(arguments); - var callback = args.pop(); - return eachfn(fns, function (fn, cb) { - fn.apply(that, args.concat([cb])); - }, - callback); - }; - if (arguments.length > 2) { - var args = Array.prototype.slice.call(arguments, 2); - return go.apply(this, args); - } - else { - return go; - } - }; - async.applyEach = doParallel(_applyEach); - async.applyEachSeries = doSeries(_applyEach); - - async.forever = function (fn, callback) { - function next(err) { - if (err) { - if (callback) { - return callback(err); - } - throw err; - } - fn(next); - } - next(); - }; - - // Node.js - if (typeof module !== 'undefined' && module.exports) { - module.exports = async; - } - // AMD / RequireJS - else if (typeof define !== 'undefined' && define.amd) { - define([], function () { - return async; - }); - } - // included directly via - - - - - -``` - -A simple example of how to use BSON in `node.js`: - -```javascript -var bson = require("bson"); -var BSON = new bson.BSONPure.BSON(); -var Long = bson.BSONPure.Long; - -var doc = {long: Long.fromNumber(100)} - -// Serialize a document -var data = BSON.serialize(doc, false, true, false); -console.log("data:", data); - -// Deserialize the resulting Buffer -var doc_2 = BSON.deserialize(data); -console.log("doc_2:", doc_2); -``` - -The API consists of two simple methods to serialize/deserialize objects to/from BSON format: - - * BSON.serialize(object, checkKeys, asBuffer, serializeFunctions) - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)** - * @return {TypedArray/Array} returns a TypedArray or Array depending on what your browser supports - - * BSON.deserialize(buffer, options, isArray) - * Options - * **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * **promoteBuffers** {Boolean, default:false}, deserialize Binary data directly into node.js Buffer object. - * @param {TypedArray/Array} a TypedArray/Array containing the BSON data - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. diff --git a/Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js b/Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js deleted file mode 100644 index 555aa797..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/bson.js +++ /dev/null @@ -1,1574 +0,0 @@ -var Long = require('../lib/bson/long').Long - , Double = require('../lib/bson/double').Double - , Timestamp = require('../lib/bson/timestamp').Timestamp - , ObjectID = require('../lib/bson/objectid').ObjectID - , Symbol = require('../lib/bson/symbol').Symbol - , Code = require('../lib/bson/code').Code - , MinKey = require('../lib/bson/min_key').MinKey - , MaxKey = require('../lib/bson/max_key').MaxKey - , DBRef = require('../lib/bson/db_ref').DBRef - , Binary = require('../lib/bson/binary').Binary - , BinaryParser = require('../lib/bson/binary_parser').BinaryParser - , writeIEEE754 = require('../lib/bson/float_parser').writeIEEE754 - , readIEEE754 = require('../lib/bson/float_parser').readIEEE754 - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -/** - * Create a new BSON instance - * - * @class - * @return {BSON} instance of BSON Parser. - */ -function BSON () {}; - -/** - * @ignore - * @api private - */ -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_UNDEFINED - **/ -BSON.BSON_DATA_UNDEFINED = 6; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.calculateObjectSize = function calculateObjectSize(object, serializeFunctions) { - var totalLength = (4 + 1); - - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - totalLength += calculateElement(i.toString(), object[i], serializeFunctions) - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Calculate size - for(var key in object) { - totalLength += calculateElement(key, object[key], serializeFunctions) - } - } - - return totalLength; -} - -/** - * @ignore - * @api private - */ -function calculateElement(name, value, serializeFunctions) { - var isBuffer = typeof Buffer !== 'undefined'; - - // If we have toBSON defined, override the current object - if(value && value.toBSON){ - value = value.toBSON(); - } - - switch(typeof value) { - case 'string': - return 1 + (!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1 + 4 + (!isBuffer ? numberOfBytes(value) : Buffer.byteLength(value, 'utf8')) + 1; - case 'number': - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (4 + 1); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - } else { // 64 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - case 'undefined': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - case 'boolean': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 1); - case 'object': - if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (12 + 1); - } else if(value instanceof Date || isDate(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 4 + 1) + value.length; - } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp - || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - // Calculate size depending on the availability of a scope - if(value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Check what kind of subtype we have - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1 + 4); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1); - } - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + ((!isBuffer ? numberOfBytes(value.value) : Buffer.byteLength(value.value, 'utf8')) + 4 + 1 + 1); - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + BSON.calculateObjectSize(ordered_values, serializeFunctions); - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + BSON.calculateObjectSize(value, serializeFunctions) + 1; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else if(serializeFunctions) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1; - } - } - } - - return 0; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.serializeWithBufferAndIndex = function serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) { - // Default setting false - serializeFunctions = serializeFunctions == null ? false : serializeFunctions; - // Write end information (length of the object) - var size = buffer.length; - // Write the size of the object - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return serializeObject(object, checkKeys, buffer, index, serializeFunctions) - 1; -} - -/** - * @ignore - * @api private - */ -var serializeObject = function(object, checkKeys, buffer, index, serializeFunctions) { - if(object.toBSON) { - if(typeof object.toBSON != 'function') throw new Error("toBSON is not a function"); - object = object.toBSON(); - if(object != null && typeof object != 'object') throw new Error("toBSON function did not return an object"); - } - - // Process the object - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - index = packElement(i.toString(), object[i], checkKeys, buffer, index, serializeFunctions); - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Serialize the object - for(var key in object) { - // Check the key and throw error if it's illegal - if (key != '$db' && key != '$ref' && key != '$id') { - // dollars and dots ok - BSON.checkKey(key, !checkKeys); - } - - // Pack the element - index = packElement(key, object[key], checkKeys, buffer, index, serializeFunctions); - } - } - - // Write zero - buffer[index++] = 0; - return index; -} - -var stringToBytes = function(str) { - var ch, st, re = []; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re.concat( st.reverse() ); - } - // return an array of bytes - return re; -} - -var numberOfBytes = function(str) { - var ch, st, re = 0; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re + st.length; - } - // return an array of bytes - return re; -} - -/** - * @ignore - * @api private - */ -var writeToTypedArray = function(buffer, string, index) { - var bytes = stringToBytes(string); - for(var i = 0; i < bytes.length; i++) { - buffer[index + i] = bytes[i]; - } - return bytes.length; -} - -/** - * @ignore - * @api private - */ -var supportsBuffer = typeof Buffer != 'undefined'; - -/** - * @ignore - * @api private - */ -var packElement = function(name, value, checkKeys, buffer, index, serializeFunctions) { - - // If we have toBSON defined, override the current object - if(value && value.toBSON){ - value = value.toBSON(); - } - - var startIndex = index; - - switch(typeof value) { - case 'string': - // console.log("+++++++++++ index string:: " + index) - // Encode String type - buffer[index++] = BSON.BSON_DATA_STRING; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value) + 1 : numberOfBytes(value) + 1; - // console.log("====== key :: " + name + " size ::" + size) - // Write the size of the string to buffer - buffer[index + 3] = (size >> 24) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index] = size & 0xff; - // Ajust the index - index = index + 4; - // Write the string - supportsBuffer ? buffer.write(value, index, 'utf8') : writeToTypedArray(buffer, value, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - // Return index - return index; - case 'number': - // We have an integer value - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // If the value fits in 32 bits encode as int, if it fits in a double - // encode it as a double, otherwise long - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { - // Set int type 32 bits or less - buffer[index++] = BSON.BSON_DATA_INT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the int value - buffer[index++] = value & 0xff; - buffer[index++] = (value >> 8) & 0xff; - buffer[index++] = (value >> 16) & 0xff; - buffer[index++] = (value >> 24) & 0xff; - } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } else { - // Set long type - buffer[index++] = BSON.BSON_DATA_LONG; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var longVal = Long.fromNumber(value); - var lowBits = longVal.getLowBits(); - var highBits = longVal.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - } - } else { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } - - return index; - case 'undefined': - // Set long type - buffer[index++] = BSON.BSON_DATA_NULL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - case 'boolean': - // Write the type - buffer[index++] = BSON.BSON_DATA_BOOLEAN; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; - case 'object': - if(value === null || value instanceof MinKey || value instanceof MaxKey - || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - // Write the type of either min or max key - if(value === null) { - buffer[index++] = BSON.BSON_DATA_NULL; - } else if(value instanceof MinKey) { - buffer[index++] = BSON.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = BSON.BSON_DATA_MAX_KEY; - } - - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - // console.log("+++++++++++ index OBJECTID:: " + index) - // Write the type - buffer[index++] = BSON.BSON_DATA_OID; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write objectid - supportsBuffer ? buffer.write(value.id, index, 'binary') : writeToTypedArray(buffer, value.id, index); - // Ajust index - index = index + 12; - return index; - } else if(value instanceof Date || isDate(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_DATE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the date - var dateInMilis = Long.fromNumber(value.getTime()); - var lowBits = dateInMilis.getLowBits(); - var highBits = dateInMilis.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Get size of the buffer (current write point) - var size = value.length; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the default subtype - buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - value.copy(buffer, index, 0, size); - // Adjust the index - index = index + size; - return index; - } else if(value instanceof Long || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - // Write the type - buffer[index++] = value instanceof Long || value['_bsontype'] == 'Long' ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the date - var lowBits = value.getLowBits(); - var highBits = value.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(value instanceof Double || value['_bsontype'] == 'Double') { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - return index; - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - if(value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.code.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize + 4; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = supportsBuffer ? new Buffer(scopeSize) : new Uint8Array(new ArrayBuffer(scopeSize)); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - supportsBuffer ? scopeObjectBuffer.copy(buffer, index, 0, scopeSize) : buffer.set(scopeObjectBuffer, index); - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.code.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Extract the buffer - var data = value.value(true); - // Calculate size - var size = value.position; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - - // If we have binary type 2 the 4 first bytes are the size - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - } - - // Write the data to the object - supportsBuffer ? data.copy(buffer, index, 0, value.position) : buffer.set(data, index); - // Ajust index - index = index + value.position; - return index; - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - // Write the type - buffer[index++] = BSON.BSON_DATA_SYMBOL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value.value) + 1 : numberOfBytes(value.value) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - buffer.write(value.value, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0x00; - return index; - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - // Message size - var size = BSON.calculateObjectSize(ordered_values, serializeFunctions); - // Serialize the object - var endIndex = BSON.serializeWithBufferAndIndex(ordered_values, checkKeys, buffer, index, serializeFunctions); - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write zero for object - buffer[endIndex++] = 0x00; - // Return the end index - return endIndex; - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - supportsBuffer ? buffer.write(value.source, index, 'utf8') : writeToTypedArray(buffer, value.source, index); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - // Write the type - buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Adjust the index - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var endIndex = serializeObject(value, checkKeys, buffer, index + 4, serializeFunctions); - // Write size - var size = endIndex - index; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return endIndex; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - buffer.write(value.source, index, 'utf8'); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = new Buffer(scopeSize); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize - 4; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - scopeObjectBuffer.copy(buffer, index, 0, scopeSize); - - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else if(serializeFunctions) { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } - } - - // If no value to serialize - return index; -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - // Throw error if we are trying serialize an illegal type - if(object == null || typeof object != 'object' || Array.isArray(object)) - throw new Error("Only javascript objects supported"); - - // Emoty target buffer - var buffer = null; - // Calculate the size of the object - var size = BSON.calculateObjectSize(object, serializeFunctions); - // Fetch the best available type for storing the binary data - if(buffer = typeof Buffer != 'undefined') { - buffer = new Buffer(size); - asBuffer = true; - } else if(typeof Uint8Array != 'undefined') { - buffer = new Uint8Array(new ArrayBuffer(size)); - } else { - buffer = new Array(size); - } - - // If asBuffer is false use typed arrays - BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, 0, serializeFunctions); - // console.log("++++++++++++++++++++++++++++++++++++ OLDJS :: " + buffer.length) - // console.log(buffer.toString('hex')) - // console.log(buffer.toString('ascii')) - return buffer; -} - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Crc state variables shared by function - * - * @ignore - * @api private - */ -var 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]; - -/** - * CRC32 hash method, Fast and enough versitility for our usage - * - * @ignore - * @api private - */ -var crc32 = function(string, start, end) { - var crc = 0 - var x = 0; - var y = 0; - crc = crc ^ (-1); - - for(var i = start, iTop = end; i < iTop;i++) { - y = (crc ^ string[i]) & 0xFF; - x = table[y]; - crc = (crc >>> 8) ^ x; - } - - return crc ^ (-1); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); - options = options != null ? options : {}; - var index = startIndex; - // Loop over all documents - for(var i = 0; i < numberOfDocuments; i++) { - // Find size of the document - var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; - // Update options with index - options['index'] = index; - // Parse the document at this point - documents[docStartIndex + i] = BSON.deserialize(data, options); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEvalWithHash = function(functionCache, hash, functionString, object) { - // Contains the value we are going to set - var value = null; - - // Check for cache hit, eval if missing and return cached function - if(functionCache[hash] == null) { - eval("value = " + functionString); - functionCache[hash] = value; - } - // Set the object - return functionCache[hash].bind(object); -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEval = function(functionString) { - // Contains the value we are going to set - var value = null; - // Eval the function - eval("value = " + functionString); - return value; -} - -/** - * Convert Uint8Array to String - * - * @ignore - * @api private - */ -var convertUint8ArrayToUtf8String = function(byteArray, startIndex, endIndex) { - return BinaryParser.decode_utf8(convertArraytoUtf8BinaryString(byteArray, startIndex, endIndex)); -} - -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - - return result; -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.deserialize = function(buffer, options, isArray) { - // Options - options = options == null ? {} : options; - var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; - var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; - var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; - var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs']; - - // Validate that we have at least 4 bytes of buffer - if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); - - // Set up index - var index = typeof options['index'] == 'number' ? options['index'] : 0; - // Reads in a C style string - var readCStyleString = function() { - // Get the start search index - var i = index; - // Locate the end of the c string - while(buffer[i] !== 0x00 && i < buffer.length) { - i++ - } - // If are at the end of the buffer there is a problem with the document - if(i >= buffer.length) throw new Error("Bad BSON Document: illegal CString") - // Grab utf8 encoded string - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, i) : convertUint8ArrayToUtf8String(buffer, index, i); - // Update index position - index = i + 1; - // Return string - return string; - } - - // Create holding object - var object = isArray ? [] : {}; - - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || size > buffer.length) throw new Error("corrupt bson message"); - - // While we have more left data left keep parsing - while(true) { - // Read the type - var elementType = buffer[index++]; - // If we get a zero it's the last byte, exit - if(elementType == 0) break; - // Read the name of the field - var name = readCStyleString(); - // Switch on the type - switch(elementType) { - case BSON.BSON_DATA_OID: - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('binary', index, index + 12) : convertArraytoUtf8BinaryString(buffer, index, index + 12); - // Decode the oid - object[name] = new ObjectID(string); - // Update index - index = index + 12; - break; - case BSON.BSON_DATA_STRING: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_INT: - // Decode the 32bit value - object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - break; - case BSON.BSON_DATA_NUMBER: - // Decode the double value - object[name] = readIEEE754(buffer, index, 'little', 52, 8); - // Update the index - index = index + 8; - break; - case BSON.BSON_DATA_DATE: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set date object - object[name] = new Date(new Long(lowBits, highBits).toNumber()); - break; - case BSON.BSON_DATA_BOOLEAN: - // Parse the boolean value - object[name] = buffer[index++] == 1; - break; - case BSON.BSON_DATA_UNDEFINED: - case BSON.BSON_DATA_NULL: - // Parse the boolean value - object[name] = null; - break; - case BSON.BSON_DATA_BINARY: - // Decode the size of the binary blob - var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Decode the subtype - var subType = buffer[index++]; - // Decode as raw Buffer object if options specifies it - if(buffer['slice'] != null) { - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Slice the data - object[name] = new Binary(buffer.slice(index, index + binarySize), subType); - } else { - var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize); - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Copy the data - for(var i = 0; i < binarySize; i++) { - _buffer[i] = buffer[index + i]; - } - // Create the binary object - object[name] = new Binary(_buffer, subType); - } - // Update the index - index = index + binarySize; - break; - case BSON.BSON_DATA_ARRAY: - options['index'] = index; - // Decode the size of the array document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, true); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_OBJECT: - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_REGEXP: - // Create the regexp - var source = readCStyleString(); - var regExpOptions = readCStyleString(); - // For each option add the corresponding one for javascript - var optionsArray = new Array(regExpOptions.length); - - // Parse options - for(var i = 0; i < regExpOptions.length; i++) { - switch(regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - object[name] = new RegExp(source, optionsArray.join('')); - break; - case BSON.BSON_DATA_LONG: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Create long object - var long = new Long(lowBits, highBits); - // Promote the long if possible - if(promoteLongs) { - object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; - } else { - object[name] = long; - } - break; - case BSON.BSON_DATA_SYMBOL: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_TIMESTAMP: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set the object - object[name] = new Timestamp(lowBits, highBits); - break; - case BSON.BSON_DATA_MIN_KEY: - // Parse the object - object[name] = new MinKey(); - break; - case BSON.BSON_DATA_MAX_KEY: - // Parse the object - object[name] = new MaxKey(); - break; - case BSON.BSON_DATA_CODE: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Function string - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - } else { - object[name] = new Code(functionString, {}); - } - - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_CODE_W_SCOPE: - // Read the content of the field - var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Javascript function - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - // Parse the element - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Decode the scope object - var scopeObject = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - - // Set the scope on the object - object[name].scope = scopeObject; - } else { - object[name] = new Code(functionString, scopeObject); - } - - // Add string to object - break; - } - } - - // Check if we have a db ref object - if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); - - // Return the final objects - return object; -} - -/** - * Check if key name is valid. - * - * @ignore - * @api private - */ -BSON.checkKey = function checkKey (key, dollarsAndDotsOk) { - if (!key.length) return; - // Check if we have a legal key for the object - if (!!~key.indexOf("\x00")) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - if (!dollarsAndDotsOk) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.prototype.deserialize = function(data, options) { - return BSON.deserialize(data, options); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - return BSON.deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options); -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.prototype.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - return BSON.serialize(object, checkKeys, asBuffer, serializeFunctions); -} - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.prototype.calculateObjectSize = function(object, serializeFunctions) { - return BSON.calculateObjectSize(object, serializeFunctions); -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, buffer, startIndex, serializeFunctions) { - return BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, startIndex, serializeFunctions); -} - -/** - * @ignore - * @api private - */ -module.exports = BSON; -module.exports.Code = Code; -module.exports.Symbol = Symbol; -module.exports.BSON = BSON; -module.exports.DBRef = DBRef; -module.exports.Binary = Binary; -module.exports.ObjectID = ObjectID; -module.exports.Long = Long; -module.exports.Timestamp = Timestamp; -module.exports.Double = Double; -module.exports.MinKey = MinKey; -module.exports.MaxKey = MaxKey; diff --git a/Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js b/Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js deleted file mode 100644 index f19e44fb..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/alternate_parsers/faster_bson.js +++ /dev/null @@ -1,429 +0,0 @@ -/// reduced to ~ 410 LOCs (parser only 300 vs. 1400+) with (some, needed) BSON classes "inlined". -/// Compare ~ 4,300 (22KB vs. 157KB) in browser build at: https://github.com/mongodb/js-bson/blob/master/browser_build/bson.js - -module.exports.calculateObjectSize = calculateObjectSize; - -function calculateObjectSize(object) { - var totalLength = (4 + 1); /// handles the obj.length prefix + terminating '0' ?! - for(var key in object) { /// looks like it handles arrays under the same for...in loop!? - totalLength += calculateElement(key, object[key]) - } - return totalLength; -} - -function calculateElement(name, value) { - var len = 1; /// always starting with 1 for the data type byte! - if (name) len += Buffer.byteLength(name, 'utf8') + 1; /// cstring: name + '0' termination - - if (value === undefined || value === null) return len; /// just the type byte plus name cstring - switch( value.constructor ) { /// removed all checks 'isBuffer' if Node.js Buffer class is present!? - - case ObjectID: /// we want these sorted from most common case to least common/deprecated; - return len + 12; - case String: - return len + 4 + Buffer.byteLength(value, 'utf8') +1; /// - case Number: - if (Math.floor(value) === value) { /// case: integer; pos.# more common, '&&' stops if 1st fails! - if ( value <= 2147483647 && value >= -2147483647 ) // 32 bit - return len + 4; - else return len + 8; /// covers Long-ish JS integers as Longs! - } else return len + 8; /// 8+1 --- covers Double & std. float - case Boolean: - return len + 1; - - case Array: - case Object: - return len + calculateObjectSize(value); - - case Buffer: /// replaces the entire Binary class! - return len + 4 + value.length + 1; - - case Regex: /// these are handled as strings by serializeFast() later, hence 'gim' opts = 3 + 1 chars - return len + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) +1; - case Date: - case Long: - case Timestamp: - case Double: - return len + 8; - - case MinKey: - case MaxKey: - return len; /// these two return the type byte and name cstring only! - } - return 0; -} - -module.exports.serializeFast = serializeFast; -module.exports.serialize = function(object, checkKeys, asBuffer, serializeFunctions, index) { - var buffer = new Buffer(calculateObjectSize(object)); - return serializeFast(object, checkKeys, buffer, 0); -} - -function serializeFast(object, checkKeys, buffer, i) { /// set checkKeys = false in query(..., options object to save performance IFF you're certain your keys are safe/system-set! - var size = buffer.length; - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; /// these get overwritten later! - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - - if (object.constructor === Array) { /// any need to checkKeys here?!? since we're doing for rather than for...in, should be safe from extra (non-numeric) keys added to the array?! - for(var j = 0; j < object.length; j++) { - i = packElement(j.toString(), object[j], checkKeys, buffer, i); - } - } else { /// checkKeys is needed if any suspicion of end-user key tampering/"injection" (a la SQL) - for(var key in object) { /// mostly there should never be direct access to them!? - if (checkKeys && (key.indexOf('\x00') >= 0 || key === '$where') ) { /// = "no script"?!; could add back key.indexOf('$') or maybe check for 'eval'?! -/// took out: || key.indexOf('.') >= 0... Don't we allow dot notation queries?! - console.log('checkKeys error: '); - return new Error('Illegal object key!'); - } - i = packElement(key, object[key], checkKeys, buffer, i); /// checkKeys pass needed for recursion! - } - } - buffer[i++] = 0; /// write terminating zero; !we do NOT -1 the index increase here as original does! - return i; -} - -function packElement(name, value, checkKeys, buffer, i) { /// serializeFunctions removed! checkKeys needed for Array & Object cases pass through (calling serializeFast recursively!) - if (value === undefined || value === null){ - buffer[i++] = 10; /// = BSON.BSON_DATA_NULL; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; /// buffer.write(...) returns bytesWritten! - return i; - } - switch(value.constructor) { - - case ObjectID: - buffer[i++] = 7; /// = BSON.BSON_DATA_OID; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; -/// i += buffer.write(value.id, i, 'binary'); /// OLD: writes a String to a Buffer; 'binary' deprecated!! - value.id.copy(buffer, i); /// NEW ObjectID version has this.id = Buffer at the ready! - return i += 12; - - case String: - buffer[i++] = 2; /// = BSON.BSON_DATA_STRING; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - - var size = Buffer.byteLength(value) + 1; /// includes the terminating '0'!? - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - - i += buffer.write(value, i, 'utf8'); buffer[i++] = 0; - return i; - - case Number: - if ( ~~(value) === value) { /// double-Tilde is equiv. to Math.floor(value) - if ( value <= 2147483647 && value >= -2147483647){ /// = BSON.BSON_INT32_MAX / MIN asf. - buffer[i++] = 16; /// = BSON.BSON_DATA_INT; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - buffer[i++] = value & 0xff; buffer[i++] = (value >> 8) & 0xff; - buffer[i++] = (value >> 16) & 0xff; buffer[i++] = (value >> 24) & 0xff; - -// Else large-ish JS int!? to Long!? - } else { /// if (value <= BSON.JS_INT_MAX && value >= BSON.JS_INT_MIN){ /// 9007199254740992 asf. - buffer[i++] = 18; /// = BSON.BSON_DATA_LONG; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var lowBits = ( value % 4294967296 ) | 0, highBits = ( value / 4294967296 ) | 0; - - buffer[i++] = lowBits & 0xff; buffer[i++] = (lowBits >> 8) & 0xff; - buffer[i++] = (lowBits >> 16) & 0xff; buffer[i++] = (lowBits >> 24) & 0xff; - buffer[i++] = highBits & 0xff; buffer[i++] = (highBits >> 8) & 0xff; - buffer[i++] = (highBits >> 16) & 0xff; buffer[i++] = (highBits >> 24) & 0xff; - } - } else { /// we have a float / Double - buffer[i++] = 1; /// = BSON.BSON_DATA_NUMBER; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; -/// OLD: writeIEEE754(buffer, value, i, 'little', 52, 8); - buffer.writeDoubleLE(value, i); i += 8; - } - return i; - - case Boolean: - buffer[i++] = 8; /// = BSON.BSON_DATA_BOOLEAN; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - buffer[i++] = value ? 1 : 0; - return i; - - case Array: - case Object: - buffer[i++] = value.constructor === Array ? 4 : 3; /// = BSON.BSON_DATA_ARRAY / _OBJECT; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - - var endIndex = serializeFast(value, checkKeys, buffer, i); /// + 4); no longer needed b/c serializeFast writes a temp 4 bytes for length - var size = endIndex - i; - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - return endIndex; - - /// case Binary: /// is basically identical unless special/deprecated options! - case Buffer: /// solves ALL of our Binary needs without the BSON.Binary class!? - buffer[i++] = 5; /// = BSON.BSON_DATA_BINARY; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var size = value.length; - buffer[i++] = size & 0xff; buffer[i++] = (size >> 8) & 0xff; - buffer[i++] = (size >> 16) & 0xff; buffer[i++] = (size >> 24) & 0xff; - - buffer[i++] = 0; /// write BSON.BSON_BINARY_SUBTYPE_DEFAULT; - value.copy(buffer, i); ///, 0, size); << defaults to sourceStart=0, sourceEnd=sourceBuffer.length); - i += size; - return i; - - case RegExp: - buffer[i++] = 11; /// = BSON.BSON_DATA_REGEXP; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - i += buffer.write(value.source, i, 'utf8'); buffer[i++] = 0x00; - - if (value.global) buffer[i++] = 0x73; // s = 'g' for JS Regex! - if (value.ignoreCase) buffer[i++] = 0x69; // i - if (value.multiline) buffer[i++] = 0x6d; // m - buffer[i++] = 0x00; - return i; - - case Date: - buffer[i++] = 9; /// = BSON.BSON_DATA_DATE; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var millis = value.getTime(); - var lowBits = ( millis % 4294967296 ) | 0, highBits = ( millis / 4294967296 ) | 0; - - buffer[i++] = lowBits & 0xff; buffer[i++] = (lowBits >> 8) & 0xff; - buffer[i++] = (lowBits >> 16) & 0xff; buffer[i++] = (lowBits >> 24) & 0xff; - buffer[i++] = highBits & 0xff; buffer[i++] = (highBits >> 8) & 0xff; - buffer[i++] = (highBits >> 16) & 0xff; buffer[i++] = (highBits >> 24) & 0xff; - return i; - - case Long: - case Timestamp: - buffer[i++] = value.constructor === Long ? 18 : 17; /// = BSON.BSON_DATA_LONG / _TIMESTAMP - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - var lowBits = value.getLowBits(), highBits = value.getHighBits(); - - buffer[i++] = lowBits & 0xff; buffer[i++] = (lowBits >> 8) & 0xff; - buffer[i++] = (lowBits >> 16) & 0xff; buffer[i++] = (lowBits >> 24) & 0xff; - buffer[i++] = highBits & 0xff; buffer[i++] = (highBits >> 8) & 0xff; - buffer[i++] = (highBits >> 16) & 0xff; buffer[i++] = (highBits >> 24) & 0xff; - return i; - - case Double: - buffer[i++] = 1; /// = BSON.BSON_DATA_NUMBER; - i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; -/// OLD: writeIEEE754(buffer, value, i, 'little', 52, 8); i += 8; - buffer.writeDoubleLE(value, i); i += 8; - return i - - case MinKey: /// = BSON.BSON_DATA_MINKEY; - buffer[i++] = 127; i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - return i; - case MaxKey: /// = BSON.BSON_DATA_MAXKEY; - buffer[i++] = 255; i += buffer.write(name, i, 'utf8'); buffer[i++] = 0; - return i; - - } /// end of switch - return i; /// ?! If no value to serialize -} - - -module.exports.deserializeFast = deserializeFast; - -function deserializeFast(buffer, i, isArray){ //// , options, isArray) { //// no more options! - if (buffer.length < 5) return new Error('Corrupt bson message < 5 bytes long'); /// from 'throw' - var elementType, tempindex = 0, name; - var string, low, high; /// = lowBits / highBits - /// using 'i' as the index to keep the lines shorter: - i || ( i = 0 ); /// for parseResponse it's 0; set to running index in deserialize(object/array) recursion - var object = isArray ? [] : {}; /// needed for type ARRAY recursion later! - var size = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - if(size < 5 || size > buffer.length) return new Error('Corrupt BSON message'); -/// 'size' var was not used by anything after this, so we can reuse it - - while(true) { // While we have more left data left keep parsing - elementType = buffer[i++]; // Read the type - if (elementType === 0) break; // If we get a zero it's the last byte, exit - - tempindex = i; /// inlined readCStyleString & removed extra i= buffer.length) return new Error('Corrupt BSON document: illegal CString') - name = buffer.toString('utf8', i, tempindex); - i = tempindex + 1; /// Update index position to after the string + '0' termination - - switch(elementType) { - - case 7: /// = BSON.BSON_DATA_OID: - var buf = new Buffer(12); - buffer.copy(buf, 0, i, i += 12 ); /// copy 12 bytes from the current 'i' offset into fresh Buffer - object[name] = new ObjectID(buf); ///... & attach to the new ObjectID instance - break; - - case 2: /// = BSON.BSON_DATA_STRING: - size = buffer[i++] | buffer[i++] <<8 | buffer[i++] <<16 | buffer[i++] <<24; - object[name] = buffer.toString('utf8', i, i += size -1 ); - i++; break; /// need to get the '0' index "tick-forward" back! - - case 16: /// = BSON.BSON_DATA_INT: // Decode the 32bit value - object[name] = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; break; - - case 1: /// = BSON.BSON_DATA_NUMBER: // Decode the double value - object[name] = buffer.readDoubleLE(i); /// slightly faster depending on dec.points; a LOT cleaner - /// OLD: object[name] = readIEEE754(buffer, i, 'little', 52, 8); - i += 8; break; - - case 8: /// = BSON.BSON_DATA_BOOLEAN: - object[name] = buffer[i++] == 1; break; - - case 6: /// = BSON.BSON_DATA_UNDEFINED: /// deprecated - case 10: /// = BSON.BSON_DATA_NULL: - object[name] = null; break; - - case 4: /// = BSON.BSON_DATA_ARRAY - size = buffer[i] | buffer[i+1] <<8 | buffer[i+2] <<16 | buffer[i+3] <<24; /// NO 'i' increment since the size bytes are reread during the recursion! - object[name] = deserializeFast(buffer, i, true ); /// pass current index & set isArray = true - i += size; break; - case 3: /// = BSON.BSON_DATA_OBJECT: - size = buffer[i] | buffer[i+1] <<8 | buffer[i+2] <<16 | buffer[i+3] <<24; - object[name] = deserializeFast(buffer, i, false ); /// isArray = false => Object - i += size; break; - - case 5: /// = BSON.BSON_DATA_BINARY: // Decode the size of the binary blob - size = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - buffer[i++]; /// Skip, as we assume always default subtype, i.e. 0! - object[name] = buffer.slice(i, i += size); /// creates a new Buffer "slice" view of the same memory! - break; - - case 9: /// = BSON.BSON_DATA_DATE: /// SEE notes below on the Date type vs. other options... - low = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - high = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - object[name] = new Date( high * 4294967296 + (low < 0 ? low + 4294967296 : low) ); break; - - case 18: /// = BSON.BSON_DATA_LONG: /// usage should be somewhat rare beyond parseResponse() -> cursorId, where it is handled inline, NOT as part of deserializeFast(returnedObjects); get lowBits, highBits: - low = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - high = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - - size = high * 4294967296 + (low < 0 ? low + 4294967296 : low); /// from long.toNumber() - if (size < JS_INT_MAX && size > JS_INT_MIN) object[name] = size; /// positive # more likely! - else object[name] = new Long(low, high); break; - - case 127: /// = BSON.BSON_DATA_MIN_KEY: /// do we EVER actually get these BACK from MongoDB server?! - object[name] = new MinKey(); break; - case 255: /// = BSON.BSON_DATA_MAX_KEY: - object[name] = new MaxKey(); break; - - case 17: /// = BSON.BSON_DATA_TIMESTAMP: /// somewhat obscure internal BSON type; MongoDB uses it for (pseudo) high-res time timestamp (past millisecs precision is just a counter!) in the Oplog ts: field, etc. - low = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - high = buffer[i++] | buffer[i++] << 8 | buffer[i++] << 16 | buffer[i++] << 24; - object[name] = new Timestamp(low, high); break; - -/// case 11: /// = RegExp is skipped; we should NEVER be getting any from the MongoDB server!? - } /// end of switch(elementType) - } /// end of while(1) - return object; // Return the finalized object -} - - -function MinKey() { this._bsontype = 'MinKey'; } /// these are merely placeholders/stubs to signify the type!? - -function MaxKey() { this._bsontype = 'MaxKey'; } - -function Long(low, high) { - this._bsontype = 'Long'; - this.low_ = low | 0; this.high_ = high | 0; /// force into 32 signed bits. -} -Long.prototype.getLowBits = function(){ return this.low_; } -Long.prototype.getHighBits = function(){ return this.high_; } - -Long.prototype.toNumber = function(){ - return this.high_ * 4294967296 + (this.low_ < 0 ? this.low_ + 4294967296 : this.low_); -} -Long.fromNumber = function(num){ - return new Long(num % 4294967296, num / 4294967296); /// |0 is forced in the constructor! -} -function Double(value) { - this._bsontype = 'Double'; - this.value = value; -} -function Timestamp(low, high) { - this._bsontype = 'Timestamp'; - this.low_ = low | 0; this.high_ = high | 0; /// force into 32 signed bits. -} -Timestamp.prototype.getLowBits = function(){ return this.low_; } -Timestamp.prototype.getHighBits = function(){ return this.high_; } - -/////////////////////////////// ObjectID ///////////////////////////////// -/// machine & proc IDs stored as 1 string, b/c Buffer shouldn't be held for long periods (could use SlowBuffer?!) - -var MACHINE = parseInt(Math.random() * 0xFFFFFF, 10); -var PROCESS = process.pid % 0xFFFF; -var MACHINE_AND_PROC = encodeIntBE(MACHINE, 3) + encodeIntBE(PROCESS, 2); /// keep as ONE string, ready to go. - -function encodeIntBE(data, bytes){ /// encode the bytes to a string - var result = ''; - if (bytes >= 4){ result += String.fromCharCode(Math.floor(data / 0x1000000)); data %= 0x1000000; } - if (bytes >= 3){ result += String.fromCharCode(Math.floor(data / 0x10000)); data %= 0x10000; } - if (bytes >= 2){ result += String.fromCharCode(Math.floor(data / 0x100)); data %= 0x100; } - result += String.fromCharCode(Math.floor(data)); - return result; -} -var _counter = ~~(Math.random() * 0xFFFFFF); /// double-tilde is equivalent to Math.floor() -var checkForHex = new RegExp('^[0-9a-fA-F]{24}$'); - -function ObjectID(id) { - this._bsontype = 'ObjectID'; - if (!id){ this.id = createFromScratch(); /// base case, DONE. - } else { - if (id.constructor === Buffer){ - this.id = id; /// case of - } else if (id.constructor === String) { - if ( id.length === 24 && checkForHex.test(id) ) { - this.id = new Buffer(id, 'hex'); - } else { - this.id = new Error('Illegal/faulty Hexadecimal string supplied!'); /// changed from 'throw' - } - } else if (id.constructor === Number) { - this.id = createFromTime(id); /// this is what should be the only interface for this!? - } - } -} -function createFromScratch() { - var buf = new Buffer(12), i = 0; - var ts = ~~(Date.now()/1000); /// 4 bytes timestamp in seconds, BigEndian notation! - buf[i++] = (ts >> 24) & 0xFF; buf[i++] = (ts >> 16) & 0xFF; - buf[i++] = (ts >> 8) & 0xFF; buf[i++] = (ts) & 0xFF; - - buf.write(MACHINE_AND_PROC, i, 5, 'utf8'); i += 5; /// write 3 bytes + 2 bytes MACHINE_ID and PROCESS_ID - _counter = ++_counter % 0xFFFFFF; /// 3 bytes internal _counter for subsecond resolution; BigEndian - buf[i++] = (_counter >> 16) & 0xFF; - buf[i++] = (_counter >> 8) & 0xFF; - buf[i++] = (_counter) & 0xFF; - return buf; -} -function createFromTime(ts) { - ts || ( ts = ~~(Date.now()/1000) ); /// 4 bytes timestamp in seconds only - var buf = new Buffer(12), i = 0; - buf[i++] = (ts >> 24) & 0xFF; buf[i++] = (ts >> 16) & 0xFF; - buf[i++] = (ts >> 8) & 0xFF; buf[i++] = (ts) & 0xFF; - - for (;i < 12; ++i) buf[i] = 0x00; /// indeces 4 through 11 (8 bytes) get filled up with nulls - return buf; -} -ObjectID.prototype.toHexString = function toHexString() { - return this.id.toString('hex'); -} -ObjectID.prototype.getTimestamp = function getTimestamp() { - return this.id.readUIntBE(0, 4); -} -ObjectID.prototype.getTimestampDate = function getTimestampDate() { - var ts = new Date(); - ts.setTime(this.id.readUIntBE(0, 4) * 1000); - return ts; -} -ObjectID.createPk = function createPk () { ///?override if a PrivateKey factory w/ unique factors is warranted?! - return new ObjectID(); -} -ObjectID.prototype.toJSON = function toJSON() { - return "ObjectID('" +this.id.toString('hex')+ "')"; -} - -/// module.exports.BSON = BSON; /// not needed anymore!? exports.Binary = Binary; -module.exports.ObjectID = ObjectID; -module.exports.MinKey = MinKey; -module.exports.MaxKey = MaxKey; -module.exports.Long = Long; /// ?! we really don't want to do the complicated Long math anywhere for now!? - -//module.exports.Double = Double; -//module.exports.Timestamp = Timestamp; diff --git a/Databases/node_modules/mongoose/node_modules/bson/browser_build/bson.js b/Databases/node_modules/mongoose/node_modules/bson/browser_build/bson.js deleted file mode 100644 index 8e942dd4..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/browser_build/bson.js +++ /dev/null @@ -1,4843 +0,0 @@ -var bson = (function(){ - - var pkgmap = {}, - global = {}, - nativeRequire = typeof require != 'undefined' && require, - lib, ties, main, async; - - function exports(){ return main(); }; - - exports.main = exports; - exports.module = module; - exports.packages = pkgmap; - exports.pkg = pkg; - exports.require = function require(uri){ - return pkgmap.main.index.require(uri); - }; - - - ties = {}; - - aliases = {}; - - - return exports; - -function join() { - return normalize(Array.prototype.join.call(arguments, "/")); -}; - -function normalize(path) { - var ret = [], parts = path.split('/'), cur, prev; - - var i = 0, l = parts.length-1; - for (; i <= l; i++) { - cur = parts[i]; - - if (cur === "." && prev !== undefined) continue; - - if (cur === ".." && ret.length && prev !== ".." && prev !== "." && prev !== undefined) { - ret.pop(); - prev = ret.slice(-1)[0]; - } else { - if (prev === ".") ret.pop(); - ret.push(cur); - prev = cur; - } - } - - return ret.join("/"); -}; - -function dirname(path) { - return path && path.substr(0, path.lastIndexOf("/")) || "."; -}; - -function findModule(workingModule, uri){ - var moduleId = join(dirname(workingModule.id), /\.\/$/.test(uri) ? (uri + 'index') : uri ).replace(/\.js$/, ''), - moduleIndexId = join(moduleId, 'index'), - pkg = workingModule.pkg, - module; - - var i = pkg.modules.length, - id; - - while(i-->0){ - id = pkg.modules[i].id; - - if(id==moduleId || id == moduleIndexId){ - module = pkg.modules[i]; - break; - } - } - - return module; -} - -function newRequire(callingModule){ - function require(uri){ - var module, pkg; - - if(/^\./.test(uri)){ - module = findModule(callingModule, uri); - } else if ( ties && ties.hasOwnProperty( uri ) ) { - return ties[uri]; - } else if ( aliases && aliases.hasOwnProperty( uri ) ) { - return require(aliases[uri]); - } else { - pkg = pkgmap[uri]; - - if(!pkg && nativeRequire){ - try { - pkg = nativeRequire(uri); - } catch (nativeRequireError) {} - - if(pkg) return pkg; - } - - if(!pkg){ - throw new Error('Cannot find module "'+uri+'" @[module: '+callingModule.id+' package: '+callingModule.pkg.name+']'); - } - - module = pkg.index; - } - - if(!module){ - throw new Error('Cannot find module "'+uri+'" @[module: '+callingModule.id+' package: '+callingModule.pkg.name+']'); - } - - module.parent = callingModule; - return module.call(); - }; - - - return require; -} - - -function module(parent, id, wrapper){ - var mod = { pkg: parent, id: id, wrapper: wrapper }, - cached = false; - - mod.exports = {}; - mod.require = newRequire(mod); - - mod.call = function(){ - if(cached) { - return mod.exports; - } - - cached = true; - - global.require = mod.require; - - mod.wrapper(mod, mod.exports, global, global.require); - return mod.exports; - }; - - if(parent.mainModuleId == mod.id){ - parent.index = mod; - parent.parents.length === 0 && ( main = mod.call ); - } - - parent.modules.push(mod); -} - -function pkg(/* [ parentId ...], wrapper */){ - var wrapper = arguments[ arguments.length - 1 ], - parents = Array.prototype.slice.call(arguments, 0, arguments.length - 1), - ctx = wrapper(parents); - - - pkgmap[ctx.name] = ctx; - - arguments.length == 1 && ( pkgmap.main = ctx ); - - return function(modules){ - var id; - for(id in modules){ - module(ctx, id, modules[id]); - } - }; -} - - -}(this)); - -bson.pkg(function(parents){ - - return { - 'name' : 'bson', - 'mainModuleId' : 'bson', - 'modules' : [], - 'parents' : parents - }; - -})({ 'binary': function(module, exports, global, require, undefined){ - /** - * Module dependencies. - */ -if(typeof window === 'undefined') { - var Buffer = require('buffer').Buffer; // TODO just use global Buffer -} - -// Binary default subtype -var BSON_BINARY_SUBTYPE_DEFAULT = 0; - -/** - * @ignore - * @api private - */ -var writeStringToArray = function(data) { - // Create a buffer - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length); - // Write the content to the buffer - for(var i = 0; i < data.length; i++) { - buffer[i] = data.charCodeAt(i); - } - // Write the string to the buffer - return buffer; -} - -/** - * Convert Array ot Uint8Array to Binary String - * - * @ignore - * @api private - */ -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - return result; -}; - -/** - * A class representation of the BSON Binary type. - * - * Sub types - * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. - * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. - * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. - * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. - * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. - * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. - * - * @class Represents the Binary BSON type. - * @param {Buffer} buffer a buffer object containing the binary data. - * @param {Number} [subType] the option binary type. - * @return {Grid} - */ -function Binary(buffer, subType) { - if(!(this instanceof Binary)) return new Binary(buffer, subType); - - this._bsontype = 'Binary'; - - if(buffer instanceof Number) { - this.sub_type = buffer; - this.position = 0; - } else { - this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; - this.position = 0; - } - - if(buffer != null && !(buffer instanceof Number)) { - // Only accept Buffer, Uint8Array or Arrays - if(typeof buffer == 'string') { - // Different ways of writing the length of the string for the different types - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(buffer); - } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) { - this.buffer = writeStringToArray(buffer); - } else { - throw new Error("only String, Buffer, Uint8Array or Array accepted"); - } - } else { - this.buffer = buffer; - } - this.position = buffer.length; - } else { - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(Binary.BUFFER_SIZE); - } else if(typeof Uint8Array != 'undefined'){ - this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); - } else { - this.buffer = new Array(Binary.BUFFER_SIZE); - } - // Set position to start of buffer - this.position = 0; - } -}; - -/** - * Updates this binary with byte_value. - * - * @param {Character} byte_value a single byte we wish to write. - * @api public - */ -Binary.prototype.put = function put(byte_value) { - // If it's a string and a has more than one character throw an error - if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error("only accepts single character String, Uint8Array or Array"); - if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error("only accepts number in a valid unsigned byte range 0-255"); - - // Decode the byte value once - var decoded_byte = null; - if(typeof byte_value == 'string') { - decoded_byte = byte_value.charCodeAt(0); - } else if(byte_value['length'] != null) { - decoded_byte = byte_value[0]; - } else { - decoded_byte = byte_value; - } - - if(this.buffer.length > this.position) { - this.buffer[this.position++] = decoded_byte; - } else { - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - // Create additional overflow buffer - var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); - // Combine the two buffers together - this.buffer.copy(buffer, 0, 0, this.buffer.length); - this.buffer = buffer; - this.buffer[this.position++] = decoded_byte; - } else { - var buffer = null; - // Create a new buffer (typed or normal array) - if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length)); - } else { - buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); - } - - // We need to copy all the content to the new array - for(var i = 0; i < this.buffer.length; i++) { - buffer[i] = this.buffer[i]; - } - - // Reassign the buffer - this.buffer = buffer; - // Write the byte - this.buffer[this.position++] = decoded_byte; - } - } -}; - -/** - * Writes a buffer or string to the binary. - * - * @param {Buffer|String} string a string or buffer to be written to the Binary BSON object. - * @param {Number} offset specify the binary of where to write the content. - * @api public - */ -Binary.prototype.write = function write(string, offset) { - offset = typeof offset == 'number' ? offset : this.position; - - // If the buffer is to small let's extend the buffer - if(this.buffer.length < offset + string.length) { - var buffer = null; - // If we are in node.js - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - buffer = new Buffer(this.buffer.length + string.length); - this.buffer.copy(buffer, 0, 0, this.buffer.length); - } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - // Create a new buffer - buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length)) - // Copy the content - for(var i = 0; i < this.position; i++) { - buffer[i] = this.buffer[i]; - } - } - - // Assign the new buffer - this.buffer = buffer; - } - - if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) { - string.copy(this.buffer, offset, 0, string.length); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length - } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) { - this.buffer.write(string, 'binary', offset); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length; - } else if(Object.prototype.toString.call(string) == '[object Uint8Array]' - || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string[i]; - } - - this.position = offset > this.position ? offset : this.position; - } else if(typeof string == 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string.charCodeAt(i); - } - - this.position = offset > this.position ? offset : this.position; - } -}; - -/** - * Reads **length** bytes starting at **position**. - * - * @param {Number} position read from the given position in the Binary. - * @param {Number} length the number of bytes to read. - * @return {Buffer} - * @api public - */ -Binary.prototype.read = function read(position, length) { - length = length && length > 0 - ? length - : this.position; - - // Let's return the data based on the type we have - if(this.buffer['slice']) { - return this.buffer.slice(position, position + length); - } else { - // Create a buffer to keep the result - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length); - for(var i = 0; i < length; i++) { - buffer[i] = this.buffer[position++]; - } - } - // Return the buffer - return buffer; -}; - -/** - * Returns the value of this binary as a string. - * - * @return {String} - * @api public - */ -Binary.prototype.value = function value(asRaw) { - asRaw = asRaw == null ? false : asRaw; - - // If it's a node.js buffer object - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position); - } else { - if(asRaw) { - // we support the slice command use it - if(this.buffer['slice'] != null) { - return this.buffer.slice(0, this.position); - } else { - // Create a new buffer to copy content to - var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position); - // Copy content - for(var i = 0; i < this.position; i++) { - newBuffer[i] = this.buffer[i]; - } - // Return the buffer - return newBuffer; - } - } else { - return convertArraytoUtf8BinaryString(this.buffer, 0, this.position); - } - } -}; - -/** - * Length. - * - * @return {Number} the length of the binary. - * @api public - */ -Binary.prototype.length = function length() { - return this.position; -}; - -/** - * @ignore - * @api private - */ -Binary.prototype.toJSON = function() { - return this.buffer != null ? this.buffer.toString('base64') : ''; -} - -/** - * @ignore - * @api private - */ -Binary.prototype.toString = function(format) { - return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; -} - -Binary.BUFFER_SIZE = 256; - -/** - * Default BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_DEFAULT = 0; -/** - * Function BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_FUNCTION = 1; -/** - * Byte Array BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_BYTE_ARRAY = 2; -/** - * OLD UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID_OLD = 3; -/** - * UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID = 4; -/** - * MD5 BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_MD5 = 5; -/** - * User BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_USER_DEFINED = 128; - -/** - * Expose. - */ -exports.Binary = Binary; - - -}, - - - -'binary_parser': function(module, exports, global, require, undefined){ - /** - * Binary Parser. - * Jonas Raoni Soares Silva - * http://jsfromhell.com/classes/binary-parser [v1.0] - */ -var chr = String.fromCharCode; - -var maxBits = []; -for (var i = 0; i < 64; i++) { - maxBits[i] = Math.pow(2, i); -} - -function BinaryParser (bigEndian, allowExceptions) { - if(!(this instanceof BinaryParser)) return new BinaryParser(bigEndian, allowExceptions); - - this.bigEndian = bigEndian; - this.allowExceptions = allowExceptions; -}; - -BinaryParser.warn = function warn (msg) { - if (this.allowExceptions) { - throw new Error(msg); - } - - return 1; -}; - -BinaryParser.decodeFloat = function decodeFloat (data, precisionBits, exponentBits) { - var b = new this.Buffer(this.bigEndian, data); - - b.checkBuffer(precisionBits + exponentBits + 1); - - var bias = maxBits[exponentBits - 1] - 1 - , signal = b.readBits(precisionBits + exponentBits, 1) - , exponent = b.readBits(precisionBits, exponentBits) - , significand = 0 - , divisor = 2 - , curByte = b.buffer.length + (-precisionBits >> 3) - 1; - - do { - for (var byteValue = b.buffer[ ++curByte ], startBit = precisionBits % 8 || 8, mask = 1 << startBit; mask >>= 1; ( byteValue & mask ) && ( significand += 1 / divisor ), divisor *= 2 ); - } while (precisionBits -= startBit); - - return exponent == ( bias << 1 ) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity : ( 1 + signal * -2 ) * ( exponent || significand ? !exponent ? Math.pow( 2, -bias + 1 ) * significand : Math.pow( 2, exponent - bias ) * ( 1 + significand ) : 0 ); -}; - -BinaryParser.decodeInt = function decodeInt (data, bits, signed, forceBigEndian) { - var b = new this.Buffer(this.bigEndian || forceBigEndian, data) - , x = b.readBits(0, bits) - , max = maxBits[bits]; //max = Math.pow( 2, bits ); - - return signed && x >= max / 2 - ? x - max - : x; -}; - -BinaryParser.encodeFloat = function encodeFloat (data, precisionBits, exponentBits) { - var bias = maxBits[exponentBits - 1] - 1 - , minExp = -bias + 1 - , maxExp = bias - , minUnnormExp = minExp - precisionBits - , n = parseFloat(data) - , status = isNaN(n) || n == -Infinity || n == +Infinity ? n : 0 - , exp = 0 - , len = 2 * bias + 1 + precisionBits + 3 - , bin = new Array(len) - , signal = (n = status !== 0 ? 0 : n) < 0 - , intPart = Math.floor(n = Math.abs(n)) - , floatPart = n - intPart - , lastBit - , rounded - , result - , i - , j; - - for (i = len; i; bin[--i] = 0); - - for (i = bias + 2; intPart && i; bin[--i] = intPart % 2, intPart = Math.floor(intPart / 2)); - - for (i = bias + 1; floatPart > 0 && i; (bin[++i] = ((floatPart *= 2) >= 1) - 0 ) && --floatPart); - - for (i = -1; ++i < len && !bin[i];); - - if (bin[(lastBit = precisionBits - 1 + (i = (exp = bias + 1 - i) >= minExp && exp <= maxExp ? i + 1 : bias + 1 - (exp = minExp - 1))) + 1]) { - if (!(rounded = bin[lastBit])) { - for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]); - } - - for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0)); - } - - for (i = i - 2 < 0 ? -1 : i - 3; ++i < len && !bin[i];); - - if ((exp = bias + 1 - i) >= minExp && exp <= maxExp) { - ++i; - } else if (exp < minExp) { - exp != bias + 1 - len && exp < minUnnormExp && this.warn("encodeFloat::float underflow"); - i = bias + 1 - (exp = minExp - 1); - } - - if (intPart || status !== 0) { - this.warn(intPart ? "encodeFloat::float overflow" : "encodeFloat::" + status); - exp = maxExp + 1; - i = bias + 2; - - if (status == -Infinity) { - signal = 1; - } else if (isNaN(status)) { - bin[i] = 1; - } - } - - for (n = Math.abs(exp + bias), j = exponentBits + 1, result = ""; --j; result = (n % 2) + result, n = n >>= 1); - - for (n = 0, j = 0, i = (result = (signal ? "1" : "0") + result + bin.slice(i, i + precisionBits).join("")).length, r = []; i; j = (j + 1) % 8) { - n += (1 << j) * result.charAt(--i); - if (j == 7) { - r[r.length] = String.fromCharCode(n); - n = 0; - } - } - - r[r.length] = n - ? String.fromCharCode(n) - : ""; - - return (this.bigEndian ? r.reverse() : r).join(""); -}; - -BinaryParser.encodeInt = function encodeInt (data, bits, signed, forceBigEndian) { - var max = maxBits[bits]; - - if (data >= max || data < -(max / 2)) { - this.warn("encodeInt::overflow"); - data = 0; - } - - if (data < 0) { - data += max; - } - - for (var r = []; data; r[r.length] = String.fromCharCode(data % 256), data = Math.floor(data / 256)); - - for (bits = -(-bits >> 3) - r.length; bits--; r[r.length] = "\0"); - - return ((this.bigEndian || forceBigEndian) ? r.reverse() : r).join(""); -}; - -BinaryParser.toSmall = function( data ){ return this.decodeInt( data, 8, true ); }; -BinaryParser.fromSmall = function( data ){ return this.encodeInt( data, 8, true ); }; -BinaryParser.toByte = function( data ){ return this.decodeInt( data, 8, false ); }; -BinaryParser.fromByte = function( data ){ return this.encodeInt( data, 8, false ); }; -BinaryParser.toShort = function( data ){ return this.decodeInt( data, 16, true ); }; -BinaryParser.fromShort = function( data ){ return this.encodeInt( data, 16, true ); }; -BinaryParser.toWord = function( data ){ return this.decodeInt( data, 16, false ); }; -BinaryParser.fromWord = function( data ){ return this.encodeInt( data, 16, false ); }; -BinaryParser.toInt = function( data ){ return this.decodeInt( data, 32, true ); }; -BinaryParser.fromInt = function( data ){ return this.encodeInt( data, 32, true ); }; -BinaryParser.toLong = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromLong = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toDWord = function( data ){ return this.decodeInt( data, 32, false ); }; -BinaryParser.fromDWord = function( data ){ return this.encodeInt( data, 32, false ); }; -BinaryParser.toQWord = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromQWord = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toFloat = function( data ){ return this.decodeFloat( data, 23, 8 ); }; -BinaryParser.fromFloat = function( data ){ return this.encodeFloat( data, 23, 8 ); }; -BinaryParser.toDouble = function( data ){ return this.decodeFloat( data, 52, 11 ); }; -BinaryParser.fromDouble = function( data ){ return this.encodeFloat( data, 52, 11 ); }; - -// Factor out the encode so it can be shared by add_header and push_int32 -BinaryParser.encode_int32 = function encode_int32 (number, asArray) { - var a, b, c, d, unsigned; - unsigned = (number < 0) ? (number + 0x100000000) : number; - a = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - b = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - c = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - d = Math.floor(unsigned); - return asArray ? [chr(a), chr(b), chr(c), chr(d)] : chr(a) + chr(b) + chr(c) + chr(d); -}; - -BinaryParser.encode_int64 = function encode_int64 (number) { - var a, b, c, d, e, f, g, h, unsigned; - unsigned = (number < 0) ? (number + 0x10000000000000000) : number; - a = Math.floor(unsigned / 0xffffffffffffff); - unsigned &= 0xffffffffffffff; - b = Math.floor(unsigned / 0xffffffffffff); - unsigned &= 0xffffffffffff; - c = Math.floor(unsigned / 0xffffffffff); - unsigned &= 0xffffffffff; - d = Math.floor(unsigned / 0xffffffff); - unsigned &= 0xffffffff; - e = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - f = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - g = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - h = Math.floor(unsigned); - return chr(a) + chr(b) + chr(c) + chr(d) + chr(e) + chr(f) + chr(g) + chr(h); -}; - -/** - * UTF8 methods - */ - -// Take a raw binary string and return a utf8 string -BinaryParser.decode_utf8 = function decode_utf8 (binaryStr) { - var len = binaryStr.length - , decoded = '' - , i = 0 - , c = 0 - , c1 = 0 - , c2 = 0 - , c3; - - while (i < len) { - c = binaryStr.charCodeAt(i); - if (c < 128) { - decoded += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = binaryStr.charCodeAt(i+1); - decoded += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = binaryStr.charCodeAt(i+1); - c3 = binaryStr.charCodeAt(i+2); - decoded += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - - return decoded; -}; - -// Encode a cstring -BinaryParser.encode_cstring = function encode_cstring (s) { - return unescape(encodeURIComponent(s)) + BinaryParser.fromByte(0); -}; - -// Take a utf8 string and return a binary string -BinaryParser.encode_utf8 = function encode_utf8 (s) { - var a = "" - , c; - - for (var n = 0, len = s.length; n < len; n++) { - c = s.charCodeAt(n); - - if (c < 128) { - a += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - a += String.fromCharCode((c>>6) | 192) ; - a += String.fromCharCode((c&63) | 128); - } else { - a += String.fromCharCode((c>>12) | 224); - a += String.fromCharCode(((c>>6) & 63) | 128); - a += String.fromCharCode((c&63) | 128); - } - } - - return a; -}; - -BinaryParser.hprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } - } - - process.stdout.write("\n\n"); -}; - -BinaryParser.ilprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -BinaryParser.hlprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -/** - * BinaryParser buffer constructor. - */ -function BinaryParserBuffer (bigEndian, buffer) { - this.bigEndian = bigEndian || 0; - this.buffer = []; - this.setBuffer(buffer); -}; - -BinaryParserBuffer.prototype.setBuffer = function setBuffer (data) { - var l, i, b; - - if (data) { - i = l = data.length; - b = this.buffer = new Array(l); - for (; i; b[l - i] = data.charCodeAt(--i)); - this.bigEndian && b.reverse(); - } -}; - -BinaryParserBuffer.prototype.hasNeededBits = function hasNeededBits (neededBits) { - return this.buffer.length >= -(-neededBits >> 3); -}; - -BinaryParserBuffer.prototype.checkBuffer = function checkBuffer (neededBits) { - if (!this.hasNeededBits(neededBits)) { - throw new Error("checkBuffer::missing bytes"); - } -}; - -BinaryParserBuffer.prototype.readBits = function readBits (start, length) { - //shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni) - - function shl (a, b) { - for (; b--; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1); - return a; - } - - if (start < 0 || length <= 0) { - return 0; - } - - this.checkBuffer(start + length); - - var offsetLeft - , offsetRight = start % 8 - , curByte = this.buffer.length - ( start >> 3 ) - 1 - , lastByte = this.buffer.length + ( -( start + length ) >> 3 ) - , diff = curByte - lastByte - , sum = ((this.buffer[ curByte ] >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1)) + (diff && (offsetLeft = (start + length) % 8) ? (this.buffer[lastByte++] & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight : 0); - - for(; diff; sum += shl(this.buffer[lastByte++], (diff-- << 3) - offsetRight)); - - return sum; -}; - -/** - * Expose. - */ -BinaryParser.Buffer = BinaryParserBuffer; - -exports.BinaryParser = BinaryParser; - -}, - - - -'bson': function(module, exports, global, require, undefined){ - var Long = require('./long').Long - , Double = require('./double').Double - , Timestamp = require('./timestamp').Timestamp - , ObjectID = require('./objectid').ObjectID - , Symbol = require('./symbol').Symbol - , Code = require('./code').Code - , MinKey = require('./min_key').MinKey - , MaxKey = require('./max_key').MaxKey - , DBRef = require('./db_ref').DBRef - , Binary = require('./binary').Binary - , BinaryParser = require('./binary_parser').BinaryParser - , writeIEEE754 = require('./float_parser').writeIEEE754 - , readIEEE754 = require('./float_parser').readIEEE754 - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -/** - * Create a new BSON instance - * - * @class Represents the BSON Parser - * @return {BSON} instance of BSON Parser. - */ -function BSON () {}; - -/** - * @ignore - * @api private - */ -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.calculateObjectSize = function calculateObjectSize(object, serializeFunctions) { - var totalLength = (4 + 1); - - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - totalLength += calculateElement(i.toString(), object[i], serializeFunctions) - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Calculate size - for(var key in object) { - totalLength += calculateElement(key, object[key], serializeFunctions) - } - } - - return totalLength; -} - -/** - * @ignore - * @api private - */ -function calculateElement(name, value, serializeFunctions) { - var isBuffer = typeof Buffer !== 'undefined'; - - switch(typeof value) { - case 'string': - return 1 + (!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1 + 4 + (!isBuffer ? numberOfBytes(value) : Buffer.byteLength(value, 'utf8')) + 1; - case 'number': - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (4 + 1); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - } else { // 64 bit - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } - case 'undefined': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - case 'boolean': - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 1); - case 'object': - if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1); - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (12 + 1); - } else if(value instanceof Date || isDate(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (1 + 4 + 1) + value.length; - } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp - || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (8 + 1); - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - // Calculate size depending on the availability of a scope - if(value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.code.toString()) : Buffer.byteLength(value.code.toString(), 'utf8')) + 1; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Check what kind of subtype we have - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1 + 4); - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + (value.position + 1 + 4 + 1); - } - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + ((!isBuffer ? numberOfBytes(value.value) : Buffer.byteLength(value.value, 'utf8')) + 4 + 1 + 1); - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + BSON.calculateObjectSize(ordered_values, serializeFunctions); - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + BSON.calculateObjectSize(value, serializeFunctions) + 1; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + (!isBuffer ? numberOfBytes(value.source) : Buffer.byteLength(value.source, 'utf8')) + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1 + BSON.calculateObjectSize(value.scope, serializeFunctions); - } else if(serializeFunctions) { - return (name != null ? ((!isBuffer ? numberOfBytes(name) : Buffer.byteLength(name, 'utf8')) + 1) : 0) + 1 + 4 + (!isBuffer ? numberOfBytes(value.toString()) : Buffer.byteLength(value.toString(), 'utf8')) + 1; - } - } - } - - return 0; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.serializeWithBufferAndIndex = function serializeWithBufferAndIndex(object, checkKeys, buffer, index, serializeFunctions) { - // Default setting false - serializeFunctions = serializeFunctions == null ? false : serializeFunctions; - // Write end information (length of the object) - var size = buffer.length; - // Write the size of the object - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return serializeObject(object, checkKeys, buffer, index, serializeFunctions) - 1; -} - -/** - * @ignore - * @api private - */ -var serializeObject = function(object, checkKeys, buffer, index, serializeFunctions) { - // Process the object - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - index = packElement(i.toString(), object[i], checkKeys, buffer, index, serializeFunctions); - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Serialize the object - for(var key in object) { - // Check the key and throw error if it's illegal - if (key != '$db' && key != '$ref' && key != '$id') { - // dollars and dots ok - BSON.checkKey(key, !checkKeys); - } - - // Pack the element - index = packElement(key, object[key], checkKeys, buffer, index, serializeFunctions); - } - } - - // Write zero - buffer[index++] = 0; - return index; -} - -var stringToBytes = function(str) { - var ch, st, re = []; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re.concat( st.reverse() ); - } - // return an array of bytes - return re; -} - -var numberOfBytes = function(str) { - var ch, st, re = 0; - for (var i = 0; i < str.length; i++ ) { - ch = str.charCodeAt(i); // get char - st = []; // set up "stack" - do { - st.push( ch & 0xFF ); // push byte to stack - ch = ch >> 8; // shift value down by 1 byte - } - while ( ch ); - // add stack contents to result - // done because chars have "wrong" endianness - re = re + st.length; - } - // return an array of bytes - return re; -} - -/** - * @ignore - * @api private - */ -var writeToTypedArray = function(buffer, string, index) { - var bytes = stringToBytes(string); - for(var i = 0; i < bytes.length; i++) { - buffer[index + i] = bytes[i]; - } - return bytes.length; -} - -/** - * @ignore - * @api private - */ -var supportsBuffer = typeof Buffer != 'undefined'; - -/** - * @ignore - * @api private - */ -var packElement = function(name, value, checkKeys, buffer, index, serializeFunctions) { - var startIndex = index; - - switch(typeof value) { - case 'string': - // Encode String type - buffer[index++] = BSON.BSON_DATA_STRING; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value) + 1 : numberOfBytes(value) + 1; - // Write the size of the string to buffer - buffer[index + 3] = (size >> 24) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index] = size & 0xff; - // Ajust the index - index = index + 4; - // Write the string - supportsBuffer ? buffer.write(value, index, 'utf8') : writeToTypedArray(buffer, value, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - // Return index - return index; - case 'number': - // We have an integer value - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // If the value fits in 32 bits encode as int, if it fits in a double - // encode it as a double, otherwise long - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { - // Set int type 32 bits or less - buffer[index++] = BSON.BSON_DATA_INT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the int value - buffer[index++] = value & 0xff; - buffer[index++] = (value >> 8) & 0xff; - buffer[index++] = (value >> 16) & 0xff; - buffer[index++] = (value >> 24) & 0xff; - } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } else { - // Set long type - buffer[index++] = BSON.BSON_DATA_LONG; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var longVal = Long.fromNumber(value); - var lowBits = longVal.getLowBits(); - var highBits = longVal.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - } - } else { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } - - return index; - case 'undefined': - // Set long type - buffer[index++] = BSON.BSON_DATA_NULL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - case 'boolean': - // Write the type - buffer[index++] = BSON.BSON_DATA_BOOLEAN; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; - case 'object': - if(value === null || value instanceof MinKey || value instanceof MaxKey - || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - // Write the type of either min or max key - if(value === null) { - buffer[index++] = BSON.BSON_DATA_NULL; - } else if(value instanceof MinKey) { - buffer[index++] = BSON.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = BSON.BSON_DATA_MAX_KEY; - } - - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - return index; - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OID; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write objectid - supportsBuffer ? buffer.write(value.id, index, 'binary') : writeToTypedArray(buffer, value.id, index); - // Ajust index - index = index + 12; - return index; - } else if(value instanceof Date || isDate(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_DATE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the date - var dateInMilis = Long.fromNumber(value.getTime()); - var lowBits = dateInMilis.getLowBits(); - var highBits = dateInMilis.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Get size of the buffer (current write point) - var size = value.length; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the default subtype - buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - value.copy(buffer, index, 0, size); - // Adjust the index - index = index + size; - return index; - } else if(value instanceof Long || value instanceof Timestamp || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - // Write the type - buffer[index++] = value instanceof Long ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the date - var lowBits = value.getLowBits(); - var highBits = value.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; - } else if(value instanceof Double || value['_bsontype'] == 'Double') { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - return index; - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - if(value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.code.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize + 4; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = supportsBuffer ? new Buffer(scopeSize) : new Uint8Array(new ArrayBuffer(scopeSize)); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - supportsBuffer ? scopeObjectBuffer.copy(buffer, index, 0, scopeSize) : buffer.set(scopeObjectBuffer, index); - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.code.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Extract the buffer - var data = value.value(true); - // Calculate size - var size = value.position; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - - // If we have binary type 2 the 4 first bytes are the size - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - } - - // Write the data to the object - supportsBuffer ? data.copy(buffer, index, 0, value.position) : buffer.set(data, index); - // Ajust index - index = index + value.position; - return index; - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - // Write the type - buffer[index++] = BSON.BSON_DATA_SYMBOL; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate size - var size = supportsBuffer ? Buffer.byteLength(value.value) + 1 : numberOfBytes(value.value) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - buffer.write(value.value, index, 'utf8'); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0x00; - return index; - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Write the type - buffer[index++] = BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - // Message size - var size = BSON.calculateObjectSize(ordered_values, serializeFunctions); - // Serialize the object - var endIndex = BSON.serializeWithBufferAndIndex(ordered_values, checkKeys, buffer, index, serializeFunctions); - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write zero for object - buffer[endIndex++] = 0x00; - // Return the end index - return endIndex; - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - supportsBuffer ? buffer.write(value.source, index, 'utf8') : writeToTypedArray(buffer, value.source, index); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - // Write the type - buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Adjust the index - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - var endIndex = serializeObject(value, checkKeys, buffer, index + 4, serializeFunctions); - // Write size - var size = endIndex - index; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - return endIndex; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - - // Write the regular expression string - buffer.write(value.source, index, 'utf8'); - // Adjust the index - index = index + (supportsBuffer ? Buffer.byteLength(value.source) : numberOfBytes(value.source)); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Calculate the scope size - var scopeSize = BSON.calculateObjectSize(value.scope, serializeFunctions); - // Function string - var functionString = value.toString(); - // Function Size - var codeSize = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - - // Calculate full size of the object - var totalSize = 4 + codeSize + scopeSize; - - // Write the total size of the object - buffer[index++] = totalSize & 0xff; - buffer[index++] = (totalSize >> 8) & 0xff; - buffer[index++] = (totalSize >> 16) & 0xff; - buffer[index++] = (totalSize >> 24) & 0xff; - - // Write the size of the string to buffer - buffer[index++] = codeSize & 0xff; - buffer[index++] = (codeSize >> 8) & 0xff; - buffer[index++] = (codeSize >> 16) & 0xff; - buffer[index++] = (codeSize >> 24) & 0xff; - - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + codeSize - 1; - // Write zero - buffer[index++] = 0; - // Serialize the scope object - var scopeObjectBuffer = new Buffer(scopeSize); - // Execute the serialization into a seperate buffer - serializeObject(value.scope, checkKeys, scopeObjectBuffer, 0, serializeFunctions); - - // Adjusted scope Size (removing the header) - var scopeDocSize = scopeSize - 4; - // Write scope object size - buffer[index++] = scopeDocSize & 0xff; - buffer[index++] = (scopeDocSize >> 8) & 0xff; - buffer[index++] = (scopeDocSize >> 16) & 0xff; - buffer[index++] = (scopeDocSize >> 24) & 0xff; - - // Write the scopeObject into the buffer - scopeObjectBuffer.copy(buffer, index, 0, scopeSize); - - // Adjust index, removing the empty size of the doc (5 bytes 0000000005) - index = index + scopeDocSize - 5; - // Write trailing zero - buffer[index++] = 0; - return index - } else if(serializeFunctions) { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = supportsBuffer ? buffer.write(name, index, 'utf8') : writeToTypedArray(buffer, name, index); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Function string - var functionString = value.toString(); - // Function Size - var size = supportsBuffer ? Buffer.byteLength(functionString) + 1 : numberOfBytes(functionString) + 1; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the string - supportsBuffer ? buffer.write(functionString, index, 'utf8') : writeToTypedArray(buffer, functionString, index); - // Update index - index = index + size - 1; - // Write zero - buffer[index++] = 0; - return index; - } - } - } - - // If no value to serialize - return index; -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - // Throw error if we are trying serialize an illegal type - if(object == null || typeof object != 'object' || Array.isArray(object)) - throw new Error("Only javascript objects supported"); - - // Emoty target buffer - var buffer = null; - // Calculate the size of the object - var size = BSON.calculateObjectSize(object, serializeFunctions); - // Fetch the best available type for storing the binary data - if(buffer = typeof Buffer != 'undefined') { - buffer = new Buffer(size); - asBuffer = true; - } else if(typeof Uint8Array != 'undefined') { - buffer = new Uint8Array(new ArrayBuffer(size)); - } else { - buffer = new Array(size); - } - - // If asBuffer is false use typed arrays - BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, 0, serializeFunctions); - return buffer; -} - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Crc state variables shared by function - * - * @ignore - * @api private - */ -var 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]; - -/** - * CRC32 hash method, Fast and enough versitility for our usage - * - * @ignore - * @api private - */ -var crc32 = function(string, start, end) { - var crc = 0 - var x = 0; - var y = 0; - crc = crc ^ (-1); - - for(var i = start, iTop = end; i < iTop;i++) { - y = (crc ^ string[i]) & 0xFF; - x = table[y]; - crc = (crc >>> 8) ^ x; - } - - return crc ^ (-1); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); - options = options != null ? options : {}; - var index = startIndex; - // Loop over all documents - for(var i = 0; i < numberOfDocuments; i++) { - // Find size of the document - var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; - // Update options with index - options['index'] = index; - // Parse the document at this point - documents[docStartIndex + i] = BSON.deserialize(data, options); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEvalWithHash = function(functionCache, hash, functionString, object) { - // Contains the value we are going to set - var value = null; - - // Check for cache hit, eval if missing and return cached function - if(functionCache[hash] == null) { - eval("value = " + functionString); - functionCache[hash] = value; - } - // Set the object - return functionCache[hash].bind(object); -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEval = function(functionString) { - // Contains the value we are going to set - var value = null; - // Eval the function - eval("value = " + functionString); - return value; -} - -/** - * Convert Uint8Array to String - * - * @ignore - * @api private - */ -var convertUint8ArrayToUtf8String = function(byteArray, startIndex, endIndex) { - return BinaryParser.decode_utf8(convertArraytoUtf8BinaryString(byteArray, startIndex, endIndex)); -} - -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - - return result; -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.deserialize = function(buffer, options, isArray) { - // Options - options = options == null ? {} : options; - var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; - var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; - var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; - var promoteLongs = options['promoteLongs'] || true; - - // Validate that we have at least 4 bytes of buffer - if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); - - // Set up index - var index = typeof options['index'] == 'number' ? options['index'] : 0; - // Reads in a C style string - var readCStyleString = function() { - // Get the start search index - var i = index; - // Locate the end of the c string - while(buffer[i] !== 0x00) { i++ } - // Grab utf8 encoded string - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, i) : convertUint8ArrayToUtf8String(buffer, index, i); - // Update index position - index = i + 1; - // Return string - return string; - } - - // Create holding object - var object = isArray ? [] : {}; - - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || size > buffer.length) throw new Error("corrupt bson message"); - - // While we have more left data left keep parsing - while(true) { - // Read the type - var elementType = buffer[index++]; - // If we get a zero it's the last byte, exit - if(elementType == 0) break; - // Read the name of the field - var name = readCStyleString(); - // Switch on the type - switch(elementType) { - case BSON.BSON_DATA_OID: - var string = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('binary', index, index + 12) : convertArraytoUtf8BinaryString(buffer, index, index + 12); - // Decode the oid - object[name] = new ObjectID(string); - // Update index - index = index + 12; - break; - case BSON.BSON_DATA_STRING: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_INT: - // Decode the 32bit value - object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - break; - case BSON.BSON_DATA_NUMBER: - // Decode the double value - object[name] = readIEEE754(buffer, index, 'little', 52, 8); - // Update the index - index = index + 8; - break; - case BSON.BSON_DATA_DATE: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set date object - object[name] = new Date(new Long(lowBits, highBits).toNumber()); - break; - case BSON.BSON_DATA_BOOLEAN: - // Parse the boolean value - object[name] = buffer[index++] == 1; - break; - case BSON.BSON_DATA_NULL: - // Parse the boolean value - object[name] = null; - break; - case BSON.BSON_DATA_BINARY: - // Decode the size of the binary blob - var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Decode the subtype - var subType = buffer[index++]; - // Decode as raw Buffer object if options specifies it - if(buffer['slice'] != null) { - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Slice the data - object[name] = new Binary(buffer.slice(index, index + binarySize), subType); - } else { - var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize); - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Copy the data - for(var i = 0; i < binarySize; i++) { - _buffer[i] = buffer[index + i]; - } - // Create the binary object - object[name] = new Binary(_buffer, subType); - } - // Update the index - index = index + binarySize; - break; - case BSON.BSON_DATA_ARRAY: - options['index'] = index; - // Decode the size of the array document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, true); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_OBJECT: - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Set the array to the object - object[name] = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - break; - case BSON.BSON_DATA_REGEXP: - // Create the regexp - var source = readCStyleString(); - var regExpOptions = readCStyleString(); - // For each option add the corresponding one for javascript - var optionsArray = new Array(regExpOptions.length); - - // Parse options - for(var i = 0; i < regExpOptions.length; i++) { - switch(regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - object[name] = new RegExp(source, optionsArray.join('')); - break; - case BSON.BSON_DATA_LONG: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Create long object - var long = new Long(lowBits, highBits); - // Promote the long if possible - if(promoteLongs) { - object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; - } else { - object[name] = long; - } - break; - case BSON.BSON_DATA_SYMBOL: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Add string to object - object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_TIMESTAMP: - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set the object - object[name] = new Timestamp(lowBits, highBits); - break; - case BSON.BSON_DATA_MIN_KEY: - // Parse the object - object[name] = new MinKey(); - break; - case BSON.BSON_DATA_MAX_KEY: - // Parse the object - object[name] = new MaxKey(); - break; - case BSON.BSON_DATA_CODE: - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Function string - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - } else { - object[name] = new Code(functionString, {}); - } - - // Update parse index position - index = index + stringSize; - break; - case BSON.BSON_DATA_CODE_W_SCOPE: - // Read the content of the field - var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Javascript function - var functionString = supportsBuffer && Buffer.isBuffer(buffer) ? buffer.toString('utf8', index, index + stringSize - 1) : convertUint8ArrayToUtf8String(buffer, index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - // Parse the element - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Decode the scope object - var scopeObject = BSON.deserialize(buffer, options, false); - // Adjust the index - index = index + objectSize; - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - - // Set the scope on the object - object[name].scope = scopeObject; - } else { - object[name] = new Code(functionString, scopeObject); - } - - // Add string to object - break; - } - } - - // Check if we have a db ref object - if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); - - // Return the final objects - return object; -} - -/** - * Check if key name is valid. - * - * @ignore - * @api private - */ -BSON.checkKey = function checkKey (key, dollarsAndDotsOk) { - if (!key.length) return; - // Check if we have a legal key for the object - if (!!~key.indexOf("\x00")) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - if (!dollarsAndDotsOk) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } -}; - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.prototype.deserialize = function(data, options) { - return BSON.deserialize(data, options); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - return BSON.deserializeStream(data, startIndex, numberOfDocuments, documents, docStartIndex, options); -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.prototype.serialize = function(object, checkKeys, asBuffer, serializeFunctions) { - return BSON.serialize(object, checkKeys, asBuffer, serializeFunctions); -} - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.prototype.calculateObjectSize = function(object, serializeFunctions) { - return BSON.calculateObjectSize(object, serializeFunctions); -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, buffer, startIndex, serializeFunctions) { - return BSON.serializeWithBufferAndIndex(object, checkKeys, buffer, startIndex, serializeFunctions); -} - -/** - * @ignore - * @api private - */ -exports.Code = Code; -exports.Symbol = Symbol; -exports.BSON = BSON; -exports.DBRef = DBRef; -exports.Binary = Binary; -exports.ObjectID = ObjectID; -exports.Long = Long; -exports.Timestamp = Timestamp; -exports.Double = Double; -exports.MinKey = MinKey; -exports.MaxKey = MaxKey; - -}, - - - -'code': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON Code type. - * - * @class Represents the BSON Code type. - * @param {String|Function} code a string or function. - * @param {Object} [scope] an optional scope for the function. - * @return {Code} - */ -function Code(code, scope) { - if(!(this instanceof Code)) return new Code(code, scope); - - this._bsontype = 'Code'; - this.code = code; - this.scope = scope == null ? {} : scope; -}; - -/** - * @ignore - * @api private - */ -Code.prototype.toJSON = function() { - return {scope:this.scope, code:this.code}; -} - -exports.Code = Code; -}, - - - -'db_ref': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON DBRef type. - * - * @class Represents the BSON DBRef type. - * @param {String} namespace the collection name. - * @param {ObjectID} oid the reference ObjectID. - * @param {String} [db] optional db name, if omitted the reference is local to the current db. - * @return {DBRef} - */ -function DBRef(namespace, oid, db) { - if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db); - - this._bsontype = 'DBRef'; - this.namespace = namespace; - this.oid = oid; - this.db = db; -}; - -/** - * @ignore - * @api private - */ -DBRef.prototype.toJSON = function() { - return { - '$ref':this.namespace, - '$id':this.oid, - '$db':this.db == null ? '' : this.db - }; -} - -exports.DBRef = DBRef; -}, - - - -'double': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON Double type. - * - * @class Represents the BSON Double type. - * @param {Number} value the number we want to represent as a double. - * @return {Double} - */ -function Double(value) { - if(!(this instanceof Double)) return new Double(value); - - this._bsontype = 'Double'; - this.value = value; -} - -/** - * Access the number value. - * - * @return {Number} returns the wrapped double number. - * @api public - */ -Double.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - * @api private - */ -Double.prototype.toJSON = function() { - return this.value; -} - -exports.Double = Double; -}, - - - -'float_parser': function(module, exports, global, require, undefined){ - // Copyright (c) 2008, Fair Oaks Labs, Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// -// Modifications to writeIEEE754 to support negative zeroes made by Brian White - -var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { - var e, m, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - nBits = -7, - i = bBE ? 0 : (nBytes - 1), - d = bBE ? 1 : -1, - s = buffer[offset + i]; - - i += d; - - e = s & ((1 << (-nBits)) - 1); - s >>= (-nBits); - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - - m = e & ((1 << (-nBits)) - 1); - e >>= (-nBits); - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity); - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; - -var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { - var e, m, c, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), - i = bBE ? (nBytes-1) : 0, - d = bBE ? -1 : 1, - s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; - - value = Math.abs(value); - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e+eBias >= 1) { - value += rt / c; - } else { - value += rt * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - - e = (e << mLen) | m; - eLen += mLen; - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - - buffer[offset + i - d] |= s * 128; -}; - -exports.readIEEE754 = readIEEE754; -exports.writeIEEE754 = writeIEEE754; -}, - - - -'index': function(module, exports, global, require, undefined){ - try { - exports.BSONPure = require('./bson'); - exports.BSONNative = require('../../ext'); -} catch(err) { - // do nothing -} - -[ './binary_parser' - , './binary' - , './code' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './symbol' - , './timestamp' - , './long'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - exports[i] = module[i]; - } -}); - -// Exports all the classes for the NATIVE JS BSON Parser -exports.native = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './symbol' - , './timestamp' - , './long' - , '../../ext' -].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} - -// Exports all the classes for the PURE JS BSON Parser -exports.pure = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './symbol' - , './timestamp' - , './long' - , '././bson'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} - -}, - - - -'long': function(module, exports, global, require, undefined){ - // Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Long class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Long". This - * implementation is derived from LongLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Longs. - * - * The internal representation of a Long is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class Represents the BSON Long type. - * @param {Number} low the low (signed) 32 bits of the Long. - * @param {Number} high the high (signed) 32 bits of the Long. - */ -function Long(low, high) { - if(!(this instanceof Long)) return new Long(low, high); - - this._bsontype = 'Long'; - /** - * @type {number} - * @api private - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @api private - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {Number} the value, assuming it is a 32-bit integer. - * @api public - */ -Long.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @return {Number} the closest floating-point representation to this value. - * @api public - */ -Long.prototype.toNumber = function() { - return this.high_ * Long.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @return {String} the JSON representation. - * @api public - */ -Long.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @param {Number} [opt_radix] the radix in which the text should be written. - * @return {String} the textual representation of this value. - * @api public - */ -Long.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - // We need to change the Long value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixLong = Long.fromNumber(radix); - var div = this.div(radixLong); - var rem = div.multiply(radixLong).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @return {Number} the high 32-bits as a signed value. - * @api public - */ -Long.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @return {Number} the low 32-bits as a signed value. - * @api public - */ -Long.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @return {Number} the low 32-bits as an unsigned value. - * @api public - */ -Long.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Long. - * - * @return {Number} Returns the number of bits needed to represent the absolute value of this Long. - * @api public - */ -Long.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @return {Boolean} whether this value is zero. - * @api public - */ -Long.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @return {Boolean} whether this value is negative. - * @api public - */ -Long.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @return {Boolean} whether this value is odd. - * @api public - */ -Long.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Long equals the other - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long equals the other - * @api public - */ -Long.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Long does not equal the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long does not equal the other. - * @api public - */ -Long.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Long is less than the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is less than the other. - * @api public - */ -Long.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Long is less than or equal to the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is less than or equal to the other. - * @api public - */ -Long.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Long is greater than the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is greater than the other. - * @api public - */ -Long.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Long is greater than or equal to the other. - * - * @param {Long} other Long to compare against. - * @return {Boolean} whether this Long is greater than or equal to the other. - * @api public - */ -Long.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Long with the given one. - * - * @param {Long} other Long to compare against. - * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - * @api public - */ -Long.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @return {Long} the negation of this value. - * @api public - */ -Long.prototype.negate = function() { - if (this.equals(Long.MIN_VALUE)) { - return Long.MIN_VALUE; - } else { - return this.not().add(Long.ONE); - } -}; - -/** - * Returns the sum of this and the given Long. - * - * @param {Long} other Long to add to this one. - * @return {Long} the sum of this and the given Long. - * @api public - */ -Long.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Long. - * - * @param {Long} other Long to subtract from this. - * @return {Long} the difference of this and the given Long. - * @api public - */ -Long.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Long. - * - * @param {Long} other Long to multiply with this. - * @return {Long} the product of this and the other. - * @api public - */ -Long.prototype.multiply = function(other) { - if (this.isZero()) { - return Long.ZERO; - } else if (other.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } else if (other.equals(Long.MIN_VALUE)) { - return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Longs are small, use float multiplication - if (this.lessThan(Long.TWO_PWR_24_) && - other.lessThan(Long.TWO_PWR_24_)) { - return Long.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Long divided by the given one. - * - * @param {Long} other Long by which to divide. - * @return {Long} this Long divided by the given one. - * @api public - */ -Long.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - if (other.equals(Long.ONE) || - other.equals(Long.NEG_ONE)) { - return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Long.ZERO)) { - return other.isNegative() ? Long.ONE : Long.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Long.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Long.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Long.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Long.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Long modulo the given one. - * - * @param {Long} other Long by which to mod. - * @return {Long} this Long modulo the given one. - * @api public - */ -Long.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @return {Long} the bitwise-NOT of this value. - * @api public - */ -Long.prototype.not = function() { - return Long.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Long and the given one. - * - * @param {Long} other the Long with which to AND. - * @return {Long} the bitwise-AND of this and the other. - * @api public - */ -Long.prototype.and = function(other) { - return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Long and the given one. - * - * @param {Long} other the Long with which to OR. - * @return {Long} the bitwise-OR of this and the other. - * @api public - */ -Long.prototype.or = function(other) { - return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Long and the given one. - * - * @param {Long} other the Long with which to XOR. - * @return {Long} the bitwise-XOR of this and the other. - * @api public - */ -Long.prototype.xor = function(other) { - return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Long with bits shifted to the left by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the left by the given amount. - * @api public - */ -Long.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Long.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Long.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount. - * @api public - */ -Long.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Long.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. - * @api public - */ -Long.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Long.fromBits(high, 0); - } else { - return Long.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Long representing the given (32-bit) integer value. - * - * @param {Number} value the 32-bit integer in question. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Long.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Long(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Long.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @param {Number} value the number in question. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Long.ZERO; - } else if (value <= -Long.TWO_PWR_63_DBL_) { - return Long.MIN_VALUE; - } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { - return Long.MAX_VALUE; - } else if (value < 0) { - return Long.fromNumber(-value).negate(); - } else { - return new Long( - (value % Long.TWO_PWR_32_DBL_) | 0, - (value / Long.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @param {Number} lowBits the low 32-bits. - * @param {Number} highBits the high 32-bits. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromBits = function(lowBits, highBits) { - return new Long(lowBits, highBits); -}; - -/** - * Returns a Long representation of the given string, written using the given radix. - * - * @param {String} str the textual representation of the Long. - * @param {Number} opt_radix the radix in which the text is written. - * @return {Long} the corresponding Long value. - * @api public - */ -Long.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Long.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 8)); - - var result = Long.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Long.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Long.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Long.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Long representations of small integer values. - * @type {Object} - * @api private - */ -Long.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @api private - */ -Long.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @api private - */ -Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; - -/** @type {Long} */ -Long.ZERO = Long.fromInt(0); - -/** @type {Long} */ -Long.ONE = Long.fromInt(1); - -/** @type {Long} */ -Long.NEG_ONE = Long.fromInt(-1); - -/** @type {Long} */ -Long.MAX_VALUE = - Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Long} */ -Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); - -/** - * @type {Long} - * @api private - */ -Long.TWO_PWR_24_ = Long.fromInt(1 << 24); - -/** - * Expose. - */ -exports.Long = Long; -}, - - - -'max_key': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON MaxKey type. - * - * @class Represents the BSON MaxKey type. - * @return {MaxKey} - */ -function MaxKey() { - if(!(this instanceof MaxKey)) return new MaxKey(); - - this._bsontype = 'MaxKey'; -} - -exports.MaxKey = MaxKey; -}, - - - -'min_key': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON MinKey type. - * - * @class Represents the BSON MinKey type. - * @return {MinKey} - */ -function MinKey() { - if(!(this instanceof MinKey)) return new MinKey(); - - this._bsontype = 'MinKey'; -} - -exports.MinKey = MinKey; -}, - - - -'objectid': function(module, exports, global, require, undefined){ - /** - * Module dependencies. - */ -var BinaryParser = require('./binary_parser').BinaryParser; - -/** - * Machine id. - * - * Create a random 3-byte value (i.e. unique for this - * process). Other drivers use a md5 of the machine id here, but - * that would mean an asyc call to gethostname, so we don't bother. - */ -var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10); - -// Regular expression that checks for hex value -var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$"); - -/** -* Create a new ObjectID instance -* -* @class Represents the BSON ObjectID type -* @param {String|Number} id Can be a 24 byte hex string, 12 byte binary string or a Number. -* @return {Object} instance of ObjectID. -*/ -var ObjectID = function ObjectID(id, _hex) { - if(!(this instanceof ObjectID)) return new ObjectID(id, _hex); - - this._bsontype = 'ObjectID'; - var __id = null; - - // Throw an error if it's not a valid setup - if(id != null && 'number' != typeof id && (id.length != 12 && id.length != 24)) - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - - // Generate id based on the input - if(id == null || typeof id == 'number') { - // convert to 12 byte binary string - this.id = this.generate(id); - } else if(id != null && id.length === 12) { - // assume 12 byte string - this.id = id; - } else if(checkForHexRegExp.test(id)) { - return ObjectID.createFromHexString(id); - } else { - throw new Error("Value passed in is not a valid 24 character hex string"); - } - - if(ObjectID.cacheHexString) this.__id = this.toHexString(); -}; - -// Allow usage of ObjectId as well as ObjectID -var ObjectId = ObjectID; - -// Precomputed hex table enables speedy hex string conversion -var hexTable = []; -for (var i = 0; i < 256; i++) { - hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); -} - -/** -* Return the ObjectID id as a 24 byte hex string representation -* -* @return {String} return the 24 byte hex string representation. -* @api public -*/ -ObjectID.prototype.toHexString = function() { - if(ObjectID.cacheHexString && this.__id) return this.__id; - - var hexString = ''; - - for (var i = 0; i < this.id.length; i++) { - hexString += hexTable[this.id.charCodeAt(i)]; - } - - if(ObjectID.cacheHexString) this.__id = hexString; - return hexString; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @return {Number} returns next index value. -* @api private -*/ -ObjectID.prototype.get_inc = function() { - return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @return {Number} returns next index value. -* @api private -*/ -ObjectID.prototype.getInc = function() { - return this.get_inc(); -}; - -/** -* Generate a 12 byte id string used in ObjectID's -* -* @param {Number} [time] optional parameter allowing to pass in a second based timestamp. -* @return {String} return the 12 byte id binary string. -* @api private -*/ -ObjectID.prototype.generate = function(time) { - if ('number' == typeof time) { - var time4Bytes = BinaryParser.encodeInt(time, 32, true, true); - /* for time-based ObjectID the bytes following the time will be zeroed */ - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - } else { - var unixTime = parseInt(Date.now()/1000,10); - var time4Bytes = BinaryParser.encodeInt(unixTime, 32, true, true); - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - } - - return time4Bytes + machine3Bytes + pid2Bytes + index3Bytes; -}; - -/** -* Converts the id into a 24 byte hex string for printing -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.toString = function() { - return this.toHexString(); -}; - -/** -* Converts to a string representation of this Id. -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.inspect = ObjectID.prototype.toString; - -/** -* Converts to its JSON representation. -* -* @return {String} return the 24 byte hex string representation. -* @api private -*/ -ObjectID.prototype.toJSON = function() { - return this.toHexString(); -}; - -/** -* Compares the equality of this ObjectID with `otherID`. -* -* @param {Object} otherID ObjectID instance to compare against. -* @return {Bool} the result of comparing two ObjectID's -* @api public -*/ -ObjectID.prototype.equals = function equals (otherID) { - var id = (otherID instanceof ObjectID || otherID.toHexString) - ? otherID.id - : ObjectID.createFromHexString(otherID).id; - - return this.id === id; -} - -/** -* Returns the generation date (accurate up to the second) that this ID was generated. -* -* @return {Date} the generation date -* @api public -*/ -ObjectID.prototype.getTimestamp = function() { - var timestamp = new Date(); - timestamp.setTime(Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)) * 1000); - return timestamp; -} - -/** -* @ignore -* @api private -*/ -ObjectID.index = parseInt(Math.random() * 0xFFFFFF, 10); - -ObjectID.createPk = function createPk () { - return new ObjectID(); -}; - -/** -* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. -* -* @param {Number} time an integer number representing a number of seconds. -* @return {ObjectID} return the created ObjectID -* @api public -*/ -ObjectID.createFromTime = function createFromTime (time) { - var id = BinaryParser.encodeInt(time, 32, true, true) + - BinaryParser.encodeInt(0, 64, true, true); - return new ObjectID(id); -}; - -/** -* Creates an ObjectID from a hex string representation of an ObjectID. -* -* @param {String} hexString create a ObjectID from a passed in 24 byte hexstring. -* @return {ObjectID} return the created ObjectID -* @api public -*/ -ObjectID.createFromHexString = function createFromHexString (hexString) { - // Throw an error if it's not a valid setup - if(typeof hexString === 'undefined' || hexString != null && hexString.length != 24) - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - - var len = hexString.length; - - if(len > 12*2) { - throw new Error('Id cannot be longer than 12 bytes'); - } - - var result = '' - , string - , number; - - for (var index = 0; index < len; index += 2) { - string = hexString.substr(index, 2); - number = parseInt(string, 16); - result += BinaryParser.fromByte(number); - } - - return new ObjectID(result, hexString); -}; - -/** -* @ignore -*/ -Object.defineProperty(ObjectID.prototype, "generationTime", { - enumerable: true - , get: function () { - return Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)); - } - , set: function (value) { - var value = BinaryParser.encodeInt(value, 32, true, true); - this.id = value + this.id.substr(4); - // delete this.__id; - this.toHexString(); - } -}); - -/** - * Expose. - */ -exports.ObjectID = ObjectID; -exports.ObjectId = ObjectID; - -}, - - - -'symbol': function(module, exports, global, require, undefined){ - /** - * A class representation of the BSON Symbol type. - * - * @class Represents the BSON Symbol type. - * @param {String} value the string representing the symbol. - * @return {Symbol} - */ -function Symbol(value) { - if(!(this instanceof Symbol)) return new Symbol(value); - this._bsontype = 'Symbol'; - this.value = value; -} - -/** - * Access the wrapped string value. - * - * @return {String} returns the wrapped string. - * @api public - */ -Symbol.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - * @api private - */ -Symbol.prototype.toString = function() { - return this.value; -} - -/** - * @ignore - * @api private - */ -Symbol.prototype.inspect = function() { - return this.value; -} - -/** - * @ignore - * @api private - */ -Symbol.prototype.toJSON = function() { - return this.value; -} - -exports.Symbol = Symbol; -}, - - - -'timestamp': function(module, exports, global, require, undefined){ - // Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Timestamp class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Timestamp". This - * implementation is derived from TimestampLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Timestamps. - * - * The internal representation of a Timestamp is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class Represents the BSON Timestamp type. - * @param {Number} low the low (signed) 32 bits of the Timestamp. - * @param {Number} high the high (signed) 32 bits of the Timestamp. - */ -function Timestamp(low, high) { - if(!(this instanceof Timestamp)) return new Timestamp(low, high); - this._bsontype = 'Timestamp'; - /** - * @type {number} - * @api private - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @api private - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {Number} the value, assuming it is a 32-bit integer. - * @api public - */ -Timestamp.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @return {Number} the closest floating-point representation to this value. - * @api public - */ -Timestamp.prototype.toNumber = function() { - return this.high_ * Timestamp.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @return {String} the JSON representation. - * @api public - */ -Timestamp.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @param {Number} [opt_radix] the radix in which the text should be written. - * @return {String} the textual representation of this value. - * @api public - */ -Timestamp.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - // We need to change the Timestamp value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixTimestamp = Timestamp.fromNumber(radix); - var div = this.div(radixTimestamp); - var rem = div.multiply(radixTimestamp).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @return {Number} the high 32-bits as a signed value. - * @api public - */ -Timestamp.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @return {Number} the low 32-bits as a signed value. - * @api public - */ -Timestamp.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @return {Number} the low 32-bits as an unsigned value. - * @api public - */ -Timestamp.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Timestamp. - * - * @return {Number} Returns the number of bits needed to represent the absolute value of this Timestamp. - * @api public - */ -Timestamp.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @return {Boolean} whether this value is zero. - * @api public - */ -Timestamp.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @return {Boolean} whether this value is negative. - * @api public - */ -Timestamp.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @return {Boolean} whether this value is odd. - * @api public - */ -Timestamp.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Timestamp equals the other - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp equals the other - * @api public - */ -Timestamp.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Timestamp does not equal the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp does not equal the other. - * @api public - */ -Timestamp.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Timestamp is less than the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is less than the other. - * @api public - */ -Timestamp.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Timestamp is less than or equal to the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is less than or equal to the other. - * @api public - */ -Timestamp.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Timestamp is greater than the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is greater than the other. - * @api public - */ -Timestamp.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Timestamp is greater than or equal to the other. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} whether this Timestamp is greater than or equal to the other. - * @api public - */ -Timestamp.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Timestamp with the given one. - * - * @param {Timestamp} other Timestamp to compare against. - * @return {Boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - * @api public - */ -Timestamp.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @return {Timestamp} the negation of this value. - * @api public - */ -Timestamp.prototype.negate = function() { - if (this.equals(Timestamp.MIN_VALUE)) { - return Timestamp.MIN_VALUE; - } else { - return this.not().add(Timestamp.ONE); - } -}; - -/** - * Returns the sum of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to add to this one. - * @return {Timestamp} the sum of this and the given Timestamp. - * @api public - */ -Timestamp.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to subtract from this. - * @return {Timestamp} the difference of this and the given Timestamp. - * @api public - */ -Timestamp.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Timestamp. - * - * @param {Timestamp} other Timestamp to multiply with this. - * @return {Timestamp} the product of this and the other. - * @api public - */ -Timestamp.prototype.multiply = function(other) { - if (this.isZero()) { - return Timestamp.ZERO; - } else if (other.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } else if (other.equals(Timestamp.MIN_VALUE)) { - return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Timestamps are small, use float multiplication - if (this.lessThan(Timestamp.TWO_PWR_24_) && - other.lessThan(Timestamp.TWO_PWR_24_)) { - return Timestamp.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Timestamp divided by the given one. - * - * @param {Timestamp} other Timestamp by which to divide. - * @return {Timestamp} this Timestamp divided by the given one. - * @api public - */ -Timestamp.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - if (other.equals(Timestamp.ONE) || - other.equals(Timestamp.NEG_ONE)) { - return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Timestamp.ZERO)) { - return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Timestamp.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Timestamp.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Timestamp.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Timestamp.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Timestamp modulo the given one. - * - * @param {Timestamp} other Timestamp by which to mod. - * @return {Timestamp} this Timestamp modulo the given one. - * @api public - */ -Timestamp.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @return {Timestamp} the bitwise-NOT of this value. - * @api public - */ -Timestamp.prototype.not = function() { - return Timestamp.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to AND. - * @return {Timestamp} the bitwise-AND of this and the other. - * @api public - */ -Timestamp.prototype.and = function(other) { - return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to OR. - * @return {Timestamp} the bitwise-OR of this and the other. - * @api public - */ -Timestamp.prototype.or = function(other) { - return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Timestamp and the given one. - * - * @param {Timestamp} other the Timestamp with which to XOR. - * @return {Timestamp} the bitwise-XOR of this and the other. - * @api public - */ -Timestamp.prototype.xor = function(other) { - return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Timestamp with bits shifted to the left by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the left by the given amount. - * @api public - */ -Timestamp.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Timestamp.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Timestamp.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount. - * @api public - */ -Timestamp.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Timestamp.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @param {Number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. - * @api public - */ -Timestamp.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Timestamp.fromBits(high, 0); - } else { - return Timestamp.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Timestamp representing the given (32-bit) integer value. - * - * @param {Number} value the 32-bit integer in question. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Timestamp.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Timestamp.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @param {Number} value the number in question. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Timestamp.ZERO; - } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MIN_VALUE; - } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MAX_VALUE; - } else if (value < 0) { - return Timestamp.fromNumber(-value).negate(); - } else { - return new Timestamp( - (value % Timestamp.TWO_PWR_32_DBL_) | 0, - (value / Timestamp.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @param {Number} lowBits the low 32-bits. - * @param {Number} highBits the high 32-bits. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromBits = function(lowBits, highBits) { - return new Timestamp(lowBits, highBits); -}; - -/** - * Returns a Timestamp representation of the given string, written using the given radix. - * - * @param {String} str the textual representation of the Timestamp. - * @param {Number} opt_radix the radix in which the text is written. - * @return {Timestamp} the corresponding Timestamp value. - * @api public - */ -Timestamp.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Timestamp.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); - - var result = Timestamp.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Timestamp.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Timestamp.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Timestamp.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Timestamp representations of small integer values. - * @type {Object} - * @api private - */ -Timestamp.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @api private - */ -Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; - -/** @type {Timestamp} */ -Timestamp.ZERO = Timestamp.fromInt(0); - -/** @type {Timestamp} */ -Timestamp.ONE = Timestamp.fromInt(1); - -/** @type {Timestamp} */ -Timestamp.NEG_ONE = Timestamp.fromInt(-1); - -/** @type {Timestamp} */ -Timestamp.MAX_VALUE = - Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Timestamp} */ -Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); - -/** - * @type {Timestamp} - * @api private - */ -Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); - -/** - * Expose. - */ -exports.Timestamp = Timestamp; -}, - - }); - - -if(typeof module != 'undefined' && module.exports ){ - module.exports = bson; - - if( !module.parent ){ - bson(); - } -} - -if(typeof window != 'undefined' && typeof require == 'undefined'){ - window.require = bson.require; -} diff --git a/Databases/node_modules/mongoose/node_modules/bson/browser_build/package.json b/Databases/node_modules/mongoose/node_modules/bson/browser_build/package.json deleted file mode 100644 index 3ebb5876..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/browser_build/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ "name" : "bson" -, "description" : "A bson parser for node.js and the browser" -, "main": "../lib/bson/bson" -, "directories" : { "lib" : "../lib/bson" } -, "engines" : { "node" : ">=0.6.0" } -, "licenses" : [ { "type" : "Apache License, Version 2.0" - , "url" : "http://www.apache.org/licenses/LICENSE-2.0" } ] -} diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary.js deleted file mode 100644 index ef74b16e..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary.js +++ /dev/null @@ -1,344 +0,0 @@ -/** - * Module dependencies. - * @ignore - */ -if(typeof window === 'undefined') { - var Buffer = require('buffer').Buffer; // TODO just use global Buffer -} - -/** - * A class representation of the BSON Binary type. - * - * Sub types - * - **BSON.BSON_BINARY_SUBTYPE_DEFAULT**, default BSON type. - * - **BSON.BSON_BINARY_SUBTYPE_FUNCTION**, BSON function type. - * - **BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY**, BSON byte array type. - * - **BSON.BSON_BINARY_SUBTYPE_UUID**, BSON uuid type. - * - **BSON.BSON_BINARY_SUBTYPE_MD5**, BSON md5 type. - * - **BSON.BSON_BINARY_SUBTYPE_USER_DEFINED**, BSON user defined type. - * - * @class - * @param {Buffer} buffer a buffer object containing the binary data. - * @param {Number} [subType] the option binary type. - * @return {Binary} - */ -function Binary(buffer, subType) { - if(!(this instanceof Binary)) return new Binary(buffer, subType); - - this._bsontype = 'Binary'; - - if(buffer instanceof Number) { - this.sub_type = buffer; - this.position = 0; - } else { - this.sub_type = subType == null ? BSON_BINARY_SUBTYPE_DEFAULT : subType; - this.position = 0; - } - - if(buffer != null && !(buffer instanceof Number)) { - // Only accept Buffer, Uint8Array or Arrays - if(typeof buffer == 'string') { - // Different ways of writing the length of the string for the different types - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(buffer); - } else if(typeof Uint8Array != 'undefined' || (Object.prototype.toString.call(buffer) == '[object Array]')) { - this.buffer = writeStringToArray(buffer); - } else { - throw new Error("only String, Buffer, Uint8Array or Array accepted"); - } - } else { - this.buffer = buffer; - } - this.position = buffer.length; - } else { - if(typeof Buffer != 'undefined') { - this.buffer = new Buffer(Binary.BUFFER_SIZE); - } else if(typeof Uint8Array != 'undefined'){ - this.buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE)); - } else { - this.buffer = new Array(Binary.BUFFER_SIZE); - } - // Set position to start of buffer - this.position = 0; - } -}; - -/** - * Updates this binary with byte_value. - * - * @method - * @param {string} byte_value a single byte we wish to write. - */ -Binary.prototype.put = function put(byte_value) { - // If it's a string and a has more than one character throw an error - if(byte_value['length'] != null && typeof byte_value != 'number' && byte_value.length != 1) throw new Error("only accepts single character String, Uint8Array or Array"); - if(typeof byte_value != 'number' && byte_value < 0 || byte_value > 255) throw new Error("only accepts number in a valid unsigned byte range 0-255"); - - // Decode the byte value once - var decoded_byte = null; - if(typeof byte_value == 'string') { - decoded_byte = byte_value.charCodeAt(0); - } else if(byte_value['length'] != null) { - decoded_byte = byte_value[0]; - } else { - decoded_byte = byte_value; - } - - if(this.buffer.length > this.position) { - this.buffer[this.position++] = decoded_byte; - } else { - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - // Create additional overflow buffer - var buffer = new Buffer(Binary.BUFFER_SIZE + this.buffer.length); - // Combine the two buffers together - this.buffer.copy(buffer, 0, 0, this.buffer.length); - this.buffer = buffer; - this.buffer[this.position++] = decoded_byte; - } else { - var buffer = null; - // Create a new buffer (typed or normal array) - if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - buffer = new Uint8Array(new ArrayBuffer(Binary.BUFFER_SIZE + this.buffer.length)); - } else { - buffer = new Array(Binary.BUFFER_SIZE + this.buffer.length); - } - - // We need to copy all the content to the new array - for(var i = 0; i < this.buffer.length; i++) { - buffer[i] = this.buffer[i]; - } - - // Reassign the buffer - this.buffer = buffer; - // Write the byte - this.buffer[this.position++] = decoded_byte; - } - } -}; - -/** - * Writes a buffer or string to the binary. - * - * @method - * @param {(Buffer|string)} string a string or buffer to be written to the Binary BSON object. - * @param {number} offset specify the binary of where to write the content. - * @return {null} - */ -Binary.prototype.write = function write(string, offset) { - offset = typeof offset == 'number' ? offset : this.position; - - // If the buffer is to small let's extend the buffer - if(this.buffer.length < offset + string.length) { - var buffer = null; - // If we are in node.js - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - buffer = new Buffer(this.buffer.length + string.length); - this.buffer.copy(buffer, 0, 0, this.buffer.length); - } else if(Object.prototype.toString.call(this.buffer) == '[object Uint8Array]') { - // Create a new buffer - buffer = new Uint8Array(new ArrayBuffer(this.buffer.length + string.length)) - // Copy the content - for(var i = 0; i < this.position; i++) { - buffer[i] = this.buffer[i]; - } - } - - // Assign the new buffer - this.buffer = buffer; - } - - if(typeof Buffer != 'undefined' && Buffer.isBuffer(string) && Buffer.isBuffer(this.buffer)) { - string.copy(this.buffer, offset, 0, string.length); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length - } else if(typeof Buffer != 'undefined' && typeof string == 'string' && Buffer.isBuffer(this.buffer)) { - this.buffer.write(string, offset, 'binary'); - this.position = (offset + string.length) > this.position ? (offset + string.length) : this.position; - // offset = string.length; - } else if(Object.prototype.toString.call(string) == '[object Uint8Array]' - || Object.prototype.toString.call(string) == '[object Array]' && typeof string != 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string[i]; - } - - this.position = offset > this.position ? offset : this.position; - } else if(typeof string == 'string') { - for(var i = 0; i < string.length; i++) { - this.buffer[offset++] = string.charCodeAt(i); - } - - this.position = offset > this.position ? offset : this.position; - } -}; - -/** - * Reads **length** bytes starting at **position**. - * - * @method - * @param {number} position read from the given position in the Binary. - * @param {number} length the number of bytes to read. - * @return {Buffer} - */ -Binary.prototype.read = function read(position, length) { - length = length && length > 0 - ? length - : this.position; - - // Let's return the data based on the type we have - if(this.buffer['slice']) { - return this.buffer.slice(position, position + length); - } else { - // Create a buffer to keep the result - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(length)) : new Array(length); - for(var i = 0; i < length; i++) { - buffer[i] = this.buffer[position++]; - } - } - // Return the buffer - return buffer; -}; - -/** - * Returns the value of this binary as a string. - * - * @method - * @return {string} - */ -Binary.prototype.value = function value(asRaw) { - asRaw = asRaw == null ? false : asRaw; - - // Optimize to serialize for the situation where the data == size of buffer - if(asRaw && typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer) && this.buffer.length == this.position) - return this.buffer; - - // If it's a node.js buffer object - if(typeof Buffer != 'undefined' && Buffer.isBuffer(this.buffer)) { - return asRaw ? this.buffer.slice(0, this.position) : this.buffer.toString('binary', 0, this.position); - } else { - if(asRaw) { - // we support the slice command use it - if(this.buffer['slice'] != null) { - return this.buffer.slice(0, this.position); - } else { - // Create a new buffer to copy content to - var newBuffer = Object.prototype.toString.call(this.buffer) == '[object Uint8Array]' ? new Uint8Array(new ArrayBuffer(this.position)) : new Array(this.position); - // Copy content - for(var i = 0; i < this.position; i++) { - newBuffer[i] = this.buffer[i]; - } - // Return the buffer - return newBuffer; - } - } else { - return convertArraytoUtf8BinaryString(this.buffer, 0, this.position); - } - } -}; - -/** - * Length. - * - * @method - * @return {number} the length of the binary. - */ -Binary.prototype.length = function length() { - return this.position; -}; - -/** - * @ignore - */ -Binary.prototype.toJSON = function() { - return this.buffer != null ? this.buffer.toString('base64') : ''; -} - -/** - * @ignore - */ -Binary.prototype.toString = function(format) { - return this.buffer != null ? this.buffer.slice(0, this.position).toString(format) : ''; -} - -/** - * Binary default subtype - * @ignore - */ -var BSON_BINARY_SUBTYPE_DEFAULT = 0; - -/** - * @ignore - */ -var writeStringToArray = function(data) { - // Create a buffer - var buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(data.length)) : new Array(data.length); - // Write the content to the buffer - for(var i = 0; i < data.length; i++) { - buffer[i] = data.charCodeAt(i); - } - // Write the string to the buffer - return buffer; -} - -/** - * Convert Array ot Uint8Array to Binary String - * - * @ignore - */ -var convertArraytoUtf8BinaryString = function(byteArray, startIndex, endIndex) { - var result = ""; - for(var i = startIndex; i < endIndex; i++) { - result = result + String.fromCharCode(byteArray[i]); - } - return result; -}; - -Binary.BUFFER_SIZE = 256; - -/** - * Default BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_DEFAULT = 0; -/** - * Function BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_FUNCTION = 1; -/** - * Byte Array BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_BYTE_ARRAY = 2; -/** - * OLD UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID_OLD = 3; -/** - * UUID BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_UUID = 4; -/** - * MD5 BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_MD5 = 5; -/** - * User BSON type - * - * @classconstant SUBTYPE_DEFAULT - **/ -Binary.SUBTYPE_USER_DEFINED = 128; - -/** - * Expose. - */ -module.exports = Binary; -module.exports.Binary = Binary; diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js deleted file mode 100644 index d2fc811f..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/binary_parser.js +++ /dev/null @@ -1,385 +0,0 @@ -/** - * Binary Parser. - * Jonas Raoni Soares Silva - * http://jsfromhell.com/classes/binary-parser [v1.0] - */ -var chr = String.fromCharCode; - -var maxBits = []; -for (var i = 0; i < 64; i++) { - maxBits[i] = Math.pow(2, i); -} - -function BinaryParser (bigEndian, allowExceptions) { - if(!(this instanceof BinaryParser)) return new BinaryParser(bigEndian, allowExceptions); - - this.bigEndian = bigEndian; - this.allowExceptions = allowExceptions; -}; - -BinaryParser.warn = function warn (msg) { - if (this.allowExceptions) { - throw new Error(msg); - } - - return 1; -}; - -BinaryParser.decodeFloat = function decodeFloat (data, precisionBits, exponentBits) { - var b = new this.Buffer(this.bigEndian, data); - - b.checkBuffer(precisionBits + exponentBits + 1); - - var bias = maxBits[exponentBits - 1] - 1 - , signal = b.readBits(precisionBits + exponentBits, 1) - , exponent = b.readBits(precisionBits, exponentBits) - , significand = 0 - , divisor = 2 - , curByte = b.buffer.length + (-precisionBits >> 3) - 1; - - do { - for (var byteValue = b.buffer[ ++curByte ], startBit = precisionBits % 8 || 8, mask = 1 << startBit; mask >>= 1; ( byteValue & mask ) && ( significand += 1 / divisor ), divisor *= 2 ); - } while (precisionBits -= startBit); - - return exponent == ( bias << 1 ) + 1 ? significand ? NaN : signal ? -Infinity : +Infinity : ( 1 + signal * -2 ) * ( exponent || significand ? !exponent ? Math.pow( 2, -bias + 1 ) * significand : Math.pow( 2, exponent - bias ) * ( 1 + significand ) : 0 ); -}; - -BinaryParser.decodeInt = function decodeInt (data, bits, signed, forceBigEndian) { - var b = new this.Buffer(this.bigEndian || forceBigEndian, data) - , x = b.readBits(0, bits) - , max = maxBits[bits]; //max = Math.pow( 2, bits ); - - return signed && x >= max / 2 - ? x - max - : x; -}; - -BinaryParser.encodeFloat = function encodeFloat (data, precisionBits, exponentBits) { - var bias = maxBits[exponentBits - 1] - 1 - , minExp = -bias + 1 - , maxExp = bias - , minUnnormExp = minExp - precisionBits - , n = parseFloat(data) - , status = isNaN(n) || n == -Infinity || n == +Infinity ? n : 0 - , exp = 0 - , len = 2 * bias + 1 + precisionBits + 3 - , bin = new Array(len) - , signal = (n = status !== 0 ? 0 : n) < 0 - , intPart = Math.floor(n = Math.abs(n)) - , floatPart = n - intPart - , lastBit - , rounded - , result - , i - , j; - - for (i = len; i; bin[--i] = 0); - - for (i = bias + 2; intPart && i; bin[--i] = intPart % 2, intPart = Math.floor(intPart / 2)); - - for (i = bias + 1; floatPart > 0 && i; (bin[++i] = ((floatPart *= 2) >= 1) - 0 ) && --floatPart); - - for (i = -1; ++i < len && !bin[i];); - - if (bin[(lastBit = precisionBits - 1 + (i = (exp = bias + 1 - i) >= minExp && exp <= maxExp ? i + 1 : bias + 1 - (exp = minExp - 1))) + 1]) { - if (!(rounded = bin[lastBit])) { - for (j = lastBit + 2; !rounded && j < len; rounded = bin[j++]); - } - - for (j = lastBit + 1; rounded && --j >= 0; (bin[j] = !bin[j] - 0) && (rounded = 0)); - } - - for (i = i - 2 < 0 ? -1 : i - 3; ++i < len && !bin[i];); - - if ((exp = bias + 1 - i) >= minExp && exp <= maxExp) { - ++i; - } else if (exp < minExp) { - exp != bias + 1 - len && exp < minUnnormExp && this.warn("encodeFloat::float underflow"); - i = bias + 1 - (exp = minExp - 1); - } - - if (intPart || status !== 0) { - this.warn(intPart ? "encodeFloat::float overflow" : "encodeFloat::" + status); - exp = maxExp + 1; - i = bias + 2; - - if (status == -Infinity) { - signal = 1; - } else if (isNaN(status)) { - bin[i] = 1; - } - } - - for (n = Math.abs(exp + bias), j = exponentBits + 1, result = ""; --j; result = (n % 2) + result, n = n >>= 1); - - for (n = 0, j = 0, i = (result = (signal ? "1" : "0") + result + bin.slice(i, i + precisionBits).join("")).length, r = []; i; j = (j + 1) % 8) { - n += (1 << j) * result.charAt(--i); - if (j == 7) { - r[r.length] = String.fromCharCode(n); - n = 0; - } - } - - r[r.length] = n - ? String.fromCharCode(n) - : ""; - - return (this.bigEndian ? r.reverse() : r).join(""); -}; - -BinaryParser.encodeInt = function encodeInt (data, bits, signed, forceBigEndian) { - var max = maxBits[bits]; - - if (data >= max || data < -(max / 2)) { - this.warn("encodeInt::overflow"); - data = 0; - } - - if (data < 0) { - data += max; - } - - for (var r = []; data; r[r.length] = String.fromCharCode(data % 256), data = Math.floor(data / 256)); - - for (bits = -(-bits >> 3) - r.length; bits--; r[r.length] = "\0"); - - return ((this.bigEndian || forceBigEndian) ? r.reverse() : r).join(""); -}; - -BinaryParser.toSmall = function( data ){ return this.decodeInt( data, 8, true ); }; -BinaryParser.fromSmall = function( data ){ return this.encodeInt( data, 8, true ); }; -BinaryParser.toByte = function( data ){ return this.decodeInt( data, 8, false ); }; -BinaryParser.fromByte = function( data ){ return this.encodeInt( data, 8, false ); }; -BinaryParser.toShort = function( data ){ return this.decodeInt( data, 16, true ); }; -BinaryParser.fromShort = function( data ){ return this.encodeInt( data, 16, true ); }; -BinaryParser.toWord = function( data ){ return this.decodeInt( data, 16, false ); }; -BinaryParser.fromWord = function( data ){ return this.encodeInt( data, 16, false ); }; -BinaryParser.toInt = function( data ){ return this.decodeInt( data, 32, true ); }; -BinaryParser.fromInt = function( data ){ return this.encodeInt( data, 32, true ); }; -BinaryParser.toLong = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromLong = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toDWord = function( data ){ return this.decodeInt( data, 32, false ); }; -BinaryParser.fromDWord = function( data ){ return this.encodeInt( data, 32, false ); }; -BinaryParser.toQWord = function( data ){ return this.decodeInt( data, 64, true ); }; -BinaryParser.fromQWord = function( data ){ return this.encodeInt( data, 64, true ); }; -BinaryParser.toFloat = function( data ){ return this.decodeFloat( data, 23, 8 ); }; -BinaryParser.fromFloat = function( data ){ return this.encodeFloat( data, 23, 8 ); }; -BinaryParser.toDouble = function( data ){ return this.decodeFloat( data, 52, 11 ); }; -BinaryParser.fromDouble = function( data ){ return this.encodeFloat( data, 52, 11 ); }; - -// Factor out the encode so it can be shared by add_header and push_int32 -BinaryParser.encode_int32 = function encode_int32 (number, asArray) { - var a, b, c, d, unsigned; - unsigned = (number < 0) ? (number + 0x100000000) : number; - a = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - b = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - c = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - d = Math.floor(unsigned); - return asArray ? [chr(a), chr(b), chr(c), chr(d)] : chr(a) + chr(b) + chr(c) + chr(d); -}; - -BinaryParser.encode_int64 = function encode_int64 (number) { - var a, b, c, d, e, f, g, h, unsigned; - unsigned = (number < 0) ? (number + 0x10000000000000000) : number; - a = Math.floor(unsigned / 0xffffffffffffff); - unsigned &= 0xffffffffffffff; - b = Math.floor(unsigned / 0xffffffffffff); - unsigned &= 0xffffffffffff; - c = Math.floor(unsigned / 0xffffffffff); - unsigned &= 0xffffffffff; - d = Math.floor(unsigned / 0xffffffff); - unsigned &= 0xffffffff; - e = Math.floor(unsigned / 0xffffff); - unsigned &= 0xffffff; - f = Math.floor(unsigned / 0xffff); - unsigned &= 0xffff; - g = Math.floor(unsigned / 0xff); - unsigned &= 0xff; - h = Math.floor(unsigned); - return chr(a) + chr(b) + chr(c) + chr(d) + chr(e) + chr(f) + chr(g) + chr(h); -}; - -/** - * UTF8 methods - */ - -// Take a raw binary string and return a utf8 string -BinaryParser.decode_utf8 = function decode_utf8 (binaryStr) { - var len = binaryStr.length - , decoded = '' - , i = 0 - , c = 0 - , c1 = 0 - , c2 = 0 - , c3; - - while (i < len) { - c = binaryStr.charCodeAt(i); - if (c < 128) { - decoded += String.fromCharCode(c); - i++; - } else if ((c > 191) && (c < 224)) { - c2 = binaryStr.charCodeAt(i+1); - decoded += String.fromCharCode(((c & 31) << 6) | (c2 & 63)); - i += 2; - } else { - c2 = binaryStr.charCodeAt(i+1); - c3 = binaryStr.charCodeAt(i+2); - decoded += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63)); - i += 3; - } - } - - return decoded; -}; - -// Encode a cstring -BinaryParser.encode_cstring = function encode_cstring (s) { - return unescape(encodeURIComponent(s)) + BinaryParser.fromByte(0); -}; - -// Take a utf8 string and return a binary string -BinaryParser.encode_utf8 = function encode_utf8 (s) { - var a = "" - , c; - - for (var n = 0, len = s.length; n < len; n++) { - c = s.charCodeAt(n); - - if (c < 128) { - a += String.fromCharCode(c); - } else if ((c > 127) && (c < 2048)) { - a += String.fromCharCode((c>>6) | 192) ; - a += String.fromCharCode((c&63) | 128); - } else { - a += String.fromCharCode((c>>12) | 224); - a += String.fromCharCode(((c>>6) & 63) | 128); - a += String.fromCharCode((c&63) | 128); - } - } - - return a; -}; - -BinaryParser.hprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - process.stdout.write(number + " ") - } - } - - process.stdout.write("\n\n"); -}; - -BinaryParser.ilprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(10) - : s.charCodeAt(i).toString(10); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -BinaryParser.hlprint = function hprint (s) { - var number; - - for (var i = 0, len = s.length; i < len; i++) { - if (s.charCodeAt(i) < 32) { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '); - } else { - number = s.charCodeAt(i) <= 15 - ? "0" + s.charCodeAt(i).toString(16) - : s.charCodeAt(i).toString(16); - require('util').debug(number+' : '+ s.charAt(i)); - } - } -}; - -/** - * BinaryParser buffer constructor. - */ -function BinaryParserBuffer (bigEndian, buffer) { - this.bigEndian = bigEndian || 0; - this.buffer = []; - this.setBuffer(buffer); -}; - -BinaryParserBuffer.prototype.setBuffer = function setBuffer (data) { - var l, i, b; - - if (data) { - i = l = data.length; - b = this.buffer = new Array(l); - for (; i; b[l - i] = data.charCodeAt(--i)); - this.bigEndian && b.reverse(); - } -}; - -BinaryParserBuffer.prototype.hasNeededBits = function hasNeededBits (neededBits) { - return this.buffer.length >= -(-neededBits >> 3); -}; - -BinaryParserBuffer.prototype.checkBuffer = function checkBuffer (neededBits) { - if (!this.hasNeededBits(neededBits)) { - throw new Error("checkBuffer::missing bytes"); - } -}; - -BinaryParserBuffer.prototype.readBits = function readBits (start, length) { - //shl fix: Henri Torgemane ~1996 (compressed by Jonas Raoni) - - function shl (a, b) { - for (; b--; a = ((a %= 0x7fffffff + 1) & 0x40000000) == 0x40000000 ? a * 2 : (a - 0x40000000) * 2 + 0x7fffffff + 1); - return a; - } - - if (start < 0 || length <= 0) { - return 0; - } - - this.checkBuffer(start + length); - - var offsetLeft - , offsetRight = start % 8 - , curByte = this.buffer.length - ( start >> 3 ) - 1 - , lastByte = this.buffer.length + ( -( start + length ) >> 3 ) - , diff = curByte - lastByte - , sum = ((this.buffer[ curByte ] >> offsetRight) & ((1 << (diff ? 8 - offsetRight : length)) - 1)) + (diff && (offsetLeft = (start + length) % 8) ? (this.buffer[lastByte++] & ((1 << offsetLeft) - 1)) << (diff-- << 3) - offsetRight : 0); - - for(; diff; sum += shl(this.buffer[lastByte++], (diff-- << 3) - offsetRight)); - - return sum; -}; - -/** - * Expose. - */ -BinaryParser.Buffer = BinaryParserBuffer; - -exports.BinaryParser = BinaryParser; diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/bson.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/bson.js deleted file mode 100644 index 36f00573..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/bson.js +++ /dev/null @@ -1,323 +0,0 @@ -// "use strict" - -var writeIEEE754 = require('./float_parser').writeIEEE754, - readIEEE754 = require('./float_parser').readIEEE754, - Map = require('./map'), - Long = require('./long').Long, - Double = require('./double').Double, - Timestamp = require('./timestamp').Timestamp, - ObjectID = require('./objectid').ObjectID, - BSONRegExp = require('./regexp').BSONRegExp, - Symbol = require('./symbol').Symbol, - Code = require('./code').Code, - MinKey = require('./min_key').MinKey, - MaxKey = require('./max_key').MaxKey, - DBRef = require('./db_ref').DBRef, - Binary = require('./binary').Binary; - -// Parts of the parser -var deserialize = require('./parser/deserializer'), - serializer = require('./parser/serializer'), - calculateObjectSize = require('./parser/calculate_size'); - -/** - * @ignore - * @api private - */ -// Max Size -var MAXSIZE = (1024*1024*17); -// Max Document Buffer size -var buffer = new Buffer(MAXSIZE); - -var BSON = function() { -} - -/** - * Serialize a Javascript object. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Boolean} asBuffer return the serialized object as a Buffer object **(ignore)**. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Buffer} returns the Buffer object containing the serialized object. - * @api public - */ -BSON.prototype.serialize = function serialize(object, checkKeys, asBuffer, serializeFunctions, index, ignoreUndefined) { - // Attempt to serialize - var serializationIndex = serializer(buffer, object, checkKeys, index || 0, 0, serializeFunctions, ignoreUndefined); - // Create the final buffer - var finishedBuffer = new Buffer(serializationIndex); - // Copy into the finished buffer - buffer.copy(finishedBuffer, 0, 0, finishedBuffer.length); - // Return the buffer - return finishedBuffer; -} - -/** - * Serialize a Javascript object using a predefined Buffer and index into the buffer, useful when pre-allocating the space for serialization. - * - * @param {Object} object the Javascript object to serialize. - * @param {Boolean} checkKeys the serializer will check if keys are valid. - * @param {Buffer} buffer the Buffer you pre-allocated to store the serialized BSON object. - * @param {Number} index the index in the buffer where we wish to start serializing into. - * @param {Boolean} serializeFunctions serialize the javascript functions **(default:false)**. - * @return {Number} returns the new write index in the Buffer. - * @api public - */ -BSON.prototype.serializeWithBufferAndIndex = function(object, checkKeys, finalBuffer, startIndex, serializeFunctions, ignoreUndefined) { - // Attempt to serialize - var serializationIndex = serializer(buffer, object, checkKeys, startIndex || 0, 0, serializeFunctions, ignoreUndefined); - buffer.copy(finalBuffer, startIndex, 0, serializationIndex); - // Return the index - return startIndex + serializationIndex - 1; -} - -/** - * Deserialize data as BSON. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} buffer the buffer containing the serialized set of BSON documents. - * @param {Object} [options] additional options used for the deserialization. - * @param {Boolean} [isArray] ignore used for recursive parsing. - * @return {Object} returns the deserialized Javascript Object. - * @api public - */ -BSON.prototype.deserialize = function(data, options) { - return deserialize(data, options); -} - -/** - * Calculate the bson size for a passed in Javascript object. - * - * @param {Object} object the Javascript object to calculate the BSON byte size for. - * @param {Boolean} [serializeFunctions] serialize all functions in the object **(default:false)**. - * @return {Number} returns the number of bytes the BSON object will take up. - * @api public - */ -BSON.prototype.calculateObjectSize = function(object, serializeFunctions, ignoreUndefined) { - return calculateObjectSize(object, serializeFunctions, ignoreUndefined); -} - -/** - * Deserialize stream data as BSON documents. - * - * Options - * - **evalFunctions** {Boolean, default:false}, evaluate functions in the BSON document scoped to the object deserialized. - * - **cacheFunctions** {Boolean, default:false}, cache evaluated functions for reuse. - * - **cacheFunctionsCrc32** {Boolean, default:false}, use a crc32 code for caching, otherwise use the string of the function. - * - **promoteLongs** {Boolean, default:true}, when deserializing a Long will fit it into a Number if it's smaller than 53 bits - * - * @param {Buffer} data the buffer containing the serialized set of BSON documents. - * @param {Number} startIndex the start index in the data Buffer where the deserialization is to start. - * @param {Number} numberOfDocuments number of documents to deserialize. - * @param {Array} documents an array where to store the deserialized documents. - * @param {Number} docStartIndex the index in the documents array from where to start inserting documents. - * @param {Object} [options] additional options used for the deserialization. - * @return {Number} returns the next index in the buffer after deserialization **x** numbers of documents. - * @api public - */ -BSON.prototype.deserializeStream = function(data, startIndex, numberOfDocuments, documents, docStartIndex, options) { - // if(numberOfDocuments !== documents.length) throw new Error("Number of expected results back is less than the number of documents"); - options = options != null ? options : {}; - var index = startIndex; - // Loop over all documents - for(var i = 0; i < numberOfDocuments; i++) { - // Find size of the document - var size = data[index] | data[index + 1] << 8 | data[index + 2] << 16 | data[index + 3] << 24; - // Update options with index - options['index'] = index; - // Parse the document at this point - documents[docStartIndex + i] = this.deserialize(data, options); - // Adjust index by the document size - index = index + size; - } - - // Return object containing end index of parsing and list of documents - return index; -} - -/** - * @ignore - * @api private - */ -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// Return BSON -module.exports = BSON; -module.exports.Code = Code; -module.exports.Map = Map; -module.exports.Symbol = Symbol; -module.exports.BSON = BSON; -module.exports.DBRef = DBRef; -module.exports.Binary = Binary; -module.exports.ObjectID = ObjectID; -module.exports.Long = Long; -module.exports.Timestamp = Timestamp; -module.exports.Double = Double; -module.exports.MinKey = MinKey; -module.exports.MaxKey = MaxKey; -module.exports.BSONRegExp = BSONRegExp; diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/code.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/code.js deleted file mode 100644 index 83a42c96..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/code.js +++ /dev/null @@ -1,24 +0,0 @@ -/** - * A class representation of the BSON Code type. - * - * @class - * @param {(string|function)} code a string or function. - * @param {Object} [scope] an optional scope for the function. - * @return {Code} - */ -var Code = function Code(code, scope) { - if(!(this instanceof Code)) return new Code(code, scope); - this._bsontype = 'Code'; - this.code = code; - this.scope = scope == null ? {} : scope; -}; - -/** - * @ignore - */ -Code.prototype.toJSON = function() { - return {scope:this.scope, code:this.code}; -} - -module.exports = Code; -module.exports.Code = Code; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js deleted file mode 100644 index 06789a6c..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/db_ref.js +++ /dev/null @@ -1,32 +0,0 @@ -/** - * A class representation of the BSON DBRef type. - * - * @class - * @param {string} namespace the collection name. - * @param {ObjectID} oid the reference ObjectID. - * @param {string} [db] optional db name, if omitted the reference is local to the current db. - * @return {DBRef} - */ -function DBRef(namespace, oid, db) { - if(!(this instanceof DBRef)) return new DBRef(namespace, oid, db); - - this._bsontype = 'DBRef'; - this.namespace = namespace; - this.oid = oid; - this.db = db; -}; - -/** - * @ignore - * @api private - */ -DBRef.prototype.toJSON = function() { - return { - '$ref':this.namespace, - '$id':this.oid, - '$db':this.db == null ? '' : this.db - }; -} - -module.exports = DBRef; -module.exports.DBRef = DBRef; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/double.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/double.js deleted file mode 100644 index 09ed2229..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/double.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * A class representation of the BSON Double type. - * - * @class - * @param {number} value the number we want to represent as a double. - * @return {Double} - */ -function Double(value) { - if(!(this instanceof Double)) return new Double(value); - - this._bsontype = 'Double'; - this.value = value; -} - -/** - * Access the number value. - * - * @method - * @return {number} returns the wrapped double number. - */ -Double.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - */ -Double.prototype.toJSON = function() { - return this.value; -} - -module.exports = Double; -module.exports.Double = Double; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js deleted file mode 100644 index 6fca3924..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/float_parser.js +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright (c) 2008, Fair Oaks Labs, Inc. -// All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// * Neither the name of Fair Oaks Labs, Inc. nor the names of its contributors -// may be used to endorse or promote products derived from this software -// without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// -// Modifications to writeIEEE754 to support negative zeroes made by Brian White - -var readIEEE754 = function(buffer, offset, endian, mLen, nBytes) { - var e, m, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - nBits = -7, - i = bBE ? 0 : (nBytes - 1), - d = bBE ? 1 : -1, - s = buffer[offset + i]; - - i += d; - - e = s & ((1 << (-nBits)) - 1); - s >>= (-nBits); - nBits += eLen; - for (; nBits > 0; e = e * 256 + buffer[offset + i], i += d, nBits -= 8); - - m = e & ((1 << (-nBits)) - 1); - e >>= (-nBits); - nBits += mLen; - for (; nBits > 0; m = m * 256 + buffer[offset + i], i += d, nBits -= 8); - - if (e === 0) { - e = 1 - eBias; - } else if (e === eMax) { - return m ? NaN : ((s ? -1 : 1) * Infinity); - } else { - m = m + Math.pow(2, mLen); - e = e - eBias; - } - return (s ? -1 : 1) * m * Math.pow(2, e - mLen); -}; - -var writeIEEE754 = function(buffer, value, offset, endian, mLen, nBytes) { - var e, m, c, - bBE = (endian === 'big'), - eLen = nBytes * 8 - mLen - 1, - eMax = (1 << eLen) - 1, - eBias = eMax >> 1, - rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0), - i = bBE ? (nBytes-1) : 0, - d = bBE ? -1 : 1, - s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0; - - value = Math.abs(value); - - if (isNaN(value) || value === Infinity) { - m = isNaN(value) ? 1 : 0; - e = eMax; - } else { - e = Math.floor(Math.log(value) / Math.LN2); - if (value * (c = Math.pow(2, -e)) < 1) { - e--; - c *= 2; - } - if (e+eBias >= 1) { - value += rt / c; - } else { - value += rt * Math.pow(2, 1 - eBias); - } - if (value * c >= 2) { - e++; - c /= 2; - } - - if (e + eBias >= eMax) { - m = 0; - e = eMax; - } else if (e + eBias >= 1) { - m = (value * c - 1) * Math.pow(2, mLen); - e = e + eBias; - } else { - m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen); - e = 0; - } - } - - for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8); - - e = (e << mLen) | m; - eLen += mLen; - for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8); - - buffer[offset + i - d] |= s * 128; -}; - -exports.readIEEE754 = readIEEE754; -exports.writeIEEE754 = writeIEEE754; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/index.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/index.js deleted file mode 100644 index 4fc02186..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/index.js +++ /dev/null @@ -1,86 +0,0 @@ -try { - exports.BSONPure = require('./bson'); - exports.BSONNative = require('./bson'); -} catch(err) { -} - -[ './binary_parser' - , './binary' - , './code' - , './map' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './regexp' - , './symbol' - , './timestamp' - , './long'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - exports[i] = module[i]; - } -}); - -// Exports all the classes for the PURE JS BSON Parser -exports.pure = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './map' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './regexp' - , './symbol' - , './timestamp' - , './long' - , '././bson'].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - // Return classes list - return classes; -} - -// Exports all the classes for the NATIVE JS BSON Parser -exports.native = function() { - var classes = {}; - // Map all the classes - [ './binary_parser' - , './binary' - , './code' - , './map' - , './db_ref' - , './double' - , './max_key' - , './min_key' - , './objectid' - , './regexp' - , './symbol' - , './timestamp' - , './long' - ].forEach(function (path) { - var module = require('./' + path); - for (var i in module) { - classes[i] = module[i]; - } - }); - - // Catch error and return no classes found - try { - classes['BSON'] = require('./bson'); - } catch(err) { - return exports.pure(); - } - - // Return classes list - return classes; -} diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/long.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/long.js deleted file mode 100644 index 6f188850..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/long.js +++ /dev/null @@ -1,856 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * Defines a Long class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Long". This - * implementation is derived from LongLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Longs. - * - * The internal representation of a Long is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class - * @param {number} low the low (signed) 32 bits of the Long. - * @param {number} high the high (signed) 32 bits of the Long. - * @return {Long} - */ -function Long(low, high) { - if(!(this instanceof Long)) return new Long(low, high); - - this._bsontype = 'Long'; - /** - * @type {number} - * @ignore - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @ignore - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @method - * @return {number} the value, assuming it is a 32-bit integer. - */ -Long.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @method - * @return {number} the closest floating-point representation to this value. - */ -Long.prototype.toNumber = function() { - return this.high_ * Long.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @method - * @return {string} the JSON representation. - */ -Long.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @method - * @param {number} [opt_radix] the radix in which the text should be written. - * @return {string} the textual representation of this value. - */ -Long.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - // We need to change the Long value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixLong = Long.fromNumber(radix); - var div = this.div(radixLong); - var rem = div.multiply(radixLong).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @method - * @return {number} the high 32-bits as a signed value. - */ -Long.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @method - * @return {number} the low 32-bits as a signed value. - */ -Long.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @method - * @return {number} the low 32-bits as an unsigned value. - */ -Long.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Long.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Long. - * - * @method - * @return {number} Returns the number of bits needed to represent the absolute value of this Long. - */ -Long.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Long.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @method - * @return {boolean} whether this value is zero. - */ -Long.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @method - * @return {boolean} whether this value is negative. - */ -Long.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @method - * @return {boolean} whether this value is odd. - */ -Long.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Long equals the other - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long equals the other - */ -Long.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Long does not equal the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long does not equal the other. - */ -Long.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Long is less than the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is less than the other. - */ -Long.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Long is less than or equal to the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is less than or equal to the other. - */ -Long.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Long is greater than the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is greater than the other. - */ -Long.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Long is greater than or equal to the other. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} whether this Long is greater than or equal to the other. - */ -Long.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Long with the given one. - * - * @method - * @param {Long} other Long to compare against. - * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - */ -Long.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @method - * @return {Long} the negation of this value. - */ -Long.prototype.negate = function() { - if (this.equals(Long.MIN_VALUE)) { - return Long.MIN_VALUE; - } else { - return this.not().add(Long.ONE); - } -}; - -/** - * Returns the sum of this and the given Long. - * - * @method - * @param {Long} other Long to add to this one. - * @return {Long} the sum of this and the given Long. - */ -Long.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Long. - * - * @method - * @param {Long} other Long to subtract from this. - * @return {Long} the difference of this and the given Long. - */ -Long.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Long. - * - * @method - * @param {Long} other Long to multiply with this. - * @return {Long} the product of this and the other. - */ -Long.prototype.multiply = function(other) { - if (this.isZero()) { - return Long.ZERO; - } else if (other.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - return other.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } else if (other.equals(Long.MIN_VALUE)) { - return this.isOdd() ? Long.MIN_VALUE : Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Longs are small, use float multiplication - if (this.lessThan(Long.TWO_PWR_24_) && - other.lessThan(Long.TWO_PWR_24_)) { - return Long.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Long into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Long.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Long divided by the given one. - * - * @method - * @param {Long} other Long by which to divide. - * @return {Long} this Long divided by the given one. - */ -Long.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Long.ZERO; - } - - if (this.equals(Long.MIN_VALUE)) { - if (other.equals(Long.ONE) || - other.equals(Long.NEG_ONE)) { - return Long.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Long.ZERO)) { - return other.isNegative() ? Long.ONE : Long.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Long.MIN_VALUE)) { - return Long.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Long.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Long.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Long.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Long.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Long modulo the given one. - * - * @method - * @param {Long} other Long by which to mod. - * @return {Long} this Long modulo the given one. - */ -Long.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @method - * @return {Long} the bitwise-NOT of this value. - */ -Long.prototype.not = function() { - return Long.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Long and the given one. - * - * @method - * @param {Long} other the Long with which to AND. - * @return {Long} the bitwise-AND of this and the other. - */ -Long.prototype.and = function(other) { - return Long.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Long and the given one. - * - * @method - * @param {Long} other the Long with which to OR. - * @return {Long} the bitwise-OR of this and the other. - */ -Long.prototype.or = function(other) { - return Long.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Long and the given one. - * - * @method - * @param {Long} other the Long with which to XOR. - * @return {Long} the bitwise-XOR of this and the other. - */ -Long.prototype.xor = function(other) { - return Long.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Long with bits shifted to the left by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the left by the given amount. - */ -Long.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Long.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Long.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount. - */ -Long.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Long.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Long with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Long} this shifted to the right by the given amount, with zeros placed into the new leading bits. - */ -Long.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Long.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Long.fromBits(high, 0); - } else { - return Long.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Long representing the given (32-bit) integer value. - * - * @method - * @param {number} value the 32-bit integer in question. - * @return {Long} the corresponding Long value. - */ -Long.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Long.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Long(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Long.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @method - * @param {number} value the number in question. - * @return {Long} the corresponding Long value. - */ -Long.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Long.ZERO; - } else if (value <= -Long.TWO_PWR_63_DBL_) { - return Long.MIN_VALUE; - } else if (value + 1 >= Long.TWO_PWR_63_DBL_) { - return Long.MAX_VALUE; - } else if (value < 0) { - return Long.fromNumber(-value).negate(); - } else { - return new Long( - (value % Long.TWO_PWR_32_DBL_) | 0, - (value / Long.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Long representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @method - * @param {number} lowBits the low 32-bits. - * @param {number} highBits the high 32-bits. - * @return {Long} the corresponding Long value. - */ -Long.fromBits = function(lowBits, highBits) { - return new Long(lowBits, highBits); -}; - -/** - * Returns a Long representation of the given string, written using the given radix. - * - * @method - * @param {string} str the textual representation of the Long. - * @param {number} opt_radix the radix in which the text is written. - * @return {Long} the corresponding Long value. - */ -Long.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Long.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Long.fromNumber(Math.pow(radix, 8)); - - var result = Long.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Long.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Long.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Long.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Long representations of small integer values. - * @type {Object} - * @ignore - */ -Long.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @ignore - */ -Long.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_32_DBL_ = Long.TWO_PWR_16_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_31_DBL_ = Long.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_48_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_64_DBL_ = Long.TWO_PWR_32_DBL_ * Long.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @ignore - */ -Long.TWO_PWR_63_DBL_ = Long.TWO_PWR_64_DBL_ / 2; - -/** @type {Long} */ -Long.ZERO = Long.fromInt(0); - -/** @type {Long} */ -Long.ONE = Long.fromInt(1); - -/** @type {Long} */ -Long.NEG_ONE = Long.fromInt(-1); - -/** @type {Long} */ -Long.MAX_VALUE = - Long.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Long} */ -Long.MIN_VALUE = Long.fromBits(0, 0x80000000 | 0); - -/** - * @type {Long} - * @ignore - */ -Long.TWO_PWR_24_ = Long.fromInt(1 << 24); - -/** - * Expose. - */ -module.exports = Long; -module.exports.Long = Long; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/map.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/map.js deleted file mode 100644 index f53c8c16..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/map.js +++ /dev/null @@ -1,126 +0,0 @@ -"use strict" - -// We have an ES6 Map available, return the native instance -if(typeof global.Map !== 'undefined') { - module.exports = global.Map; - module.exports.Map = global.Map; -} else { - // We will return a polyfill - var Map = function(array) { - this._keys = []; - this._values = {}; - - for(var i = 0; i < array.length; i++) { - if(array[i] == null) continue; // skip null and undefined - var entry = array[i]; - var key = entry[0]; - var value = entry[1]; - // Add the key to the list of keys in order - this._keys.push(key); - // Add the key and value to the values dictionary with a point - // to the location in the ordered keys list - this._values[key] = {v: value, i: this._keys.length - 1}; - } - } - - Map.prototype.clear = function() { - this._keys = []; - this._values = {}; - } - - Map.prototype.delete = function(key) { - var value = this._values[key]; - if(value == null) return false; - // Delete entry - delete this._values[key]; - // Remove the key from the ordered keys list - this._keys.splice(value.i, 1); - return true; - } - - Map.prototype.entries = function() { - var self = this; - var index = 0; - - return { - next: function() { - var key = self._keys[index++]; - return { - value: key !== undefined ? [key, self._values[key].v] : undefined, - done: key !== undefined ? false : true - } - } - }; - } - - Map.prototype.forEach = function(callback, self) { - self = self || this; - - for(var i = 0; i < this._keys.length; i++) { - var key = this._keys[i]; - // Call the forEach callback - callback.call(self, this._values[key].v, key, self); - } - } - - Map.prototype.get = function(key) { - return this._values[key] ? this._values[key].v : undefined; - } - - Map.prototype.has = function(key) { - return this._values[key] != null; - } - - Map.prototype.keys = function(key) { - var self = this; - var index = 0; - - return { - next: function() { - var key = self._keys[index++]; - return { - value: key !== undefined ? key : undefined, - done: key !== undefined ? false : true - } - } - }; - } - - Map.prototype.set = function(key, value) { - if(this._values[key]) { - this._values[key].v = value; - return this; - } - - // Add the key to the list of keys in order - this._keys.push(key); - // Add the key and value to the values dictionary with a point - // to the location in the ordered keys list - this._values[key] = {v: value, i: this._keys.length - 1}; - return this; - } - - Map.prototype.values = function(key, value) { - var self = this; - var index = 0; - - return { - next: function() { - var key = self._keys[index++]; - return { - value: key !== undefined ? self._values[key].v : undefined, - done: key !== undefined ? false : true - } - } - }; - } - - // Last ismaster - Object.defineProperty(Map.prototype, 'size', { - enumerable:true, - get: function() { return this._keys.length; } - }); - - module.exports = Map; - module.exports.Map = Map; -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js deleted file mode 100644 index 03ee9cdd..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/max_key.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * A class representation of the BSON MaxKey type. - * - * @class - * @return {MaxKey} A MaxKey instance - */ -function MaxKey() { - if(!(this instanceof MaxKey)) return new MaxKey(); - - this._bsontype = 'MaxKey'; -} - -module.exports = MaxKey; -module.exports.MaxKey = MaxKey; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js deleted file mode 100644 index 5e120fbe..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/min_key.js +++ /dev/null @@ -1,14 +0,0 @@ -/** - * A class representation of the BSON MinKey type. - * - * @class - * @return {MinKey} A MinKey instance - */ -function MinKey() { - if(!(this instanceof MinKey)) return new MinKey(); - - this._bsontype = 'MinKey'; -} - -module.exports = MinKey; -module.exports.MinKey = MinKey; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js deleted file mode 100644 index f8ec3839..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/objectid.js +++ /dev/null @@ -1,278 +0,0 @@ -/** - * Module dependencies. - * @ignore - */ -var BinaryParser = require('./binary_parser').BinaryParser; - -/** - * Machine id. - * - * Create a random 3-byte value (i.e. unique for this - * process). Other drivers use a md5 of the machine id here, but - * that would mean an asyc call to gethostname, so we don't bother. - * @ignore - */ -var MACHINE_ID = parseInt(Math.random() * 0xFFFFFF, 10); - -// Regular expression that checks for hex value -var checkForHexRegExp = new RegExp("^[0-9a-fA-F]{24}$"); - -/** -* Create a new ObjectID instance -* -* @class -* @param {(string|number)} id Can be a 24 byte hex string, 12 byte binary string or a Number. -* @property {number} generationTime The generation time of this ObjectId instance -* @return {ObjectID} instance of ObjectID. -*/ -var ObjectID = function ObjectID(id) { - if(!(this instanceof ObjectID)) return new ObjectID(id); - if((id instanceof ObjectID)) return id; - - this._bsontype = 'ObjectID'; - var __id = null; - var valid = ObjectID.isValid(id); - - // Throw an error if it's not a valid setup - if(!valid && id != null){ - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - } else if(valid && typeof id == 'string' && id.length == 24) { - return ObjectID.createFromHexString(id); - } else if(id == null || typeof id == 'number') { - // convert to 12 byte binary string - this.id = this.generate(id); - } else if(id != null && id.length === 12) { - // assume 12 byte string - this.id = id; - } - - if(ObjectID.cacheHexString) this.__id = this.toHexString(); -}; - -// Allow usage of ObjectId as well as ObjectID -var ObjectId = ObjectID; - -// Precomputed hex table enables speedy hex string conversion -var hexTable = []; -for (var i = 0; i < 256; i++) { - hexTable[i] = (i <= 15 ? '0' : '') + i.toString(16); -} - -/** -* Return the ObjectID id as a 24 byte hex string representation -* -* @method -* @return {string} return the 24 byte hex string representation. -*/ -ObjectID.prototype.toHexString = function() { - if(ObjectID.cacheHexString && this.__id) return this.__id; - - var hexString = ''; - - for (var i = 0; i < this.id.length; i++) { - hexString += hexTable[this.id.charCodeAt(i)]; - } - - if(ObjectID.cacheHexString) this.__id = hexString; - return hexString; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @method -* @return {number} returns next index value. -* @ignore -*/ -ObjectID.prototype.get_inc = function() { - return ObjectID.index = (ObjectID.index + 1) % 0xFFFFFF; -}; - -/** -* Update the ObjectID index used in generating new ObjectID's on the driver -* -* @method -* @return {number} returns next index value. -* @ignore -*/ -ObjectID.prototype.getInc = function() { - return this.get_inc(); -}; - -/** -* Generate a 12 byte id string used in ObjectID's -* -* @method -* @param {number} [time] optional parameter allowing to pass in a second based timestamp. -* @return {string} return the 12 byte id binary string. -*/ -ObjectID.prototype.generate = function(time) { - if ('number' != typeof time) { - time = parseInt(Date.now()/1000,10); - } - - var time4Bytes = BinaryParser.encodeInt(time, 32, true, true); - /* for time-based ObjectID the bytes following the time will be zeroed */ - var machine3Bytes = BinaryParser.encodeInt(MACHINE_ID, 24, false); - var pid2Bytes = BinaryParser.fromShort(typeof process === 'undefined' ? Math.floor(Math.random() * 100000) : process.pid % 0xFFFF); - var index3Bytes = BinaryParser.encodeInt(this.get_inc(), 24, false, true); - - return time4Bytes + machine3Bytes + pid2Bytes + index3Bytes; -}; - -/** -* Converts the id into a 24 byte hex string for printing -* -* @return {String} return the 24 byte hex string representation. -* @ignore -*/ -ObjectID.prototype.toString = function() { - return this.toHexString(); -}; - -/** -* Converts to a string representation of this Id. -* -* @return {String} return the 24 byte hex string representation. -* @ignore -*/ -ObjectID.prototype.inspect = ObjectID.prototype.toString; - -/** -* Converts to its JSON representation. -* -* @return {String} return the 24 byte hex string representation. -* @ignore -*/ -ObjectID.prototype.toJSON = function() { - return this.toHexString(); -}; - -/** -* Compares the equality of this ObjectID with `otherID`. -* -* @method -* @param {object} otherID ObjectID instance to compare against. -* @return {boolean} the result of comparing two ObjectID's -*/ -ObjectID.prototype.equals = function equals (otherID) { - var id; - - if(otherID != null && (otherID instanceof ObjectID || otherID.toHexString)) { - id = otherID.id; - } else if(typeof otherID == 'string' && ObjectID.isValid(otherID)) { - id = ObjectID.createFromHexString(otherID).id; - } else { - return false; - } - - return this.id === id; -} - -/** -* Returns the generation date (accurate up to the second) that this ID was generated. -* -* @method -* @return {date} the generation date -*/ -ObjectID.prototype.getTimestamp = function() { - var timestamp = new Date(); - timestamp.setTime(Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)) * 1000); - return timestamp; -} - -/** -* @ignore -*/ -ObjectID.index = parseInt(Math.random() * 0xFFFFFF, 10); - -/** -* @ignore -*/ -ObjectID.createPk = function createPk () { - return new ObjectID(); -}; - -/** -* Creates an ObjectID from a second based number, with the rest of the ObjectID zeroed out. Used for comparisons or sorting the ObjectID. -* -* @method -* @param {number} time an integer number representing a number of seconds. -* @return {ObjectID} return the created ObjectID -*/ -ObjectID.createFromTime = function createFromTime (time) { - var id = BinaryParser.encodeInt(time, 32, true, true) + - BinaryParser.encodeInt(0, 64, true, true); - return new ObjectID(id); -}; - -/** -* Creates an ObjectID from a hex string representation of an ObjectID. -* -* @method -* @param {string} hexString create a ObjectID from a passed in 24 byte hexstring. -* @return {ObjectID} return the created ObjectID -*/ -ObjectID.createFromHexString = function createFromHexString (hexString) { - // Throw an error if it's not a valid setup - if(typeof hexString === 'undefined' || hexString != null && hexString.length != 24) - throw new Error("Argument passed in must be a single String of 12 bytes or a string of 24 hex characters"); - - var len = hexString.length; - - if(len > 12*2) { - throw new Error('Id cannot be longer than 12 bytes'); - } - - var result = '' - , string - , number; - - for (var index = 0; index < len; index += 2) { - string = hexString.substr(index, 2); - number = parseInt(string, 16); - result += BinaryParser.fromByte(number); - } - - return new ObjectID(result, hexString); -}; - -/** -* Checks if a value is a valid bson ObjectId -* -* @method -* @return {boolean} return true if the value is a valid bson ObjectId, return false otherwise. -*/ -ObjectID.isValid = function isValid(id) { - if(id == null) return false; - - if(typeof id == 'number') - return true; - if(typeof id == 'string') { - return id.length == 12 || (id.length == 24 && checkForHexRegExp.test(id)); - } - return false; -}; - -/** -* @ignore -*/ -Object.defineProperty(ObjectID.prototype, "generationTime", { - enumerable: true - , get: function () { - return Math.floor(BinaryParser.decodeInt(this.id.substring(0,4), 32, true, true)); - } - , set: function (value) { - var value = BinaryParser.encodeInt(value, 32, true, true); - this.id = value + this.id.substr(4); - // delete this.__id; - this.toHexString(); - } -}); - -/** - * Expose. - */ -module.exports = ObjectID; -module.exports.ObjectID = ObjectID; -module.exports.ObjectId = ObjectID; diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js deleted file mode 100644 index 03513f32..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/calculate_size.js +++ /dev/null @@ -1,310 +0,0 @@ -"use strict" - -var writeIEEE754 = require('../float_parser').writeIEEE754 - , readIEEE754 = require('../float_parser').readIEEE754 - , Long = require('../long').Long - , Double = require('../double').Double - , Timestamp = require('../timestamp').Timestamp - , ObjectID = require('../objectid').ObjectID - , Symbol = require('../symbol').Symbol - , BSONRegExp = require('../regexp').BSONRegExp - , Code = require('../code').Code - , MinKey = require('../min_key').MinKey - , MaxKey = require('../max_key').MaxKey - , DBRef = require('../db_ref').DBRef - , Binary = require('../binary').Binary; - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -var calculateObjectSize = function calculateObjectSize(object, serializeFunctions, ignoreUndefined) { - var totalLength = (4 + 1); - - if(Array.isArray(object)) { - for(var i = 0; i < object.length; i++) { - totalLength += calculateElement(i.toString(), object[i], serializeFunctions, true, ignoreUndefined) - } - } else { - // If we have toBSON defined, override the current object - if(object.toBSON) { - object = object.toBSON(); - } - - // Calculate size - for(var key in object) { - totalLength += calculateElement(key, object[key], serializeFunctions, false, ignoreUndefined) - } - } - - return totalLength; -} - -/** - * @ignore - * @api private - */ -function calculateElement(name, value, serializeFunctions, isArray, ignoreUndefined) { - // If we have toBSON defined, override the current object - if(value && value.toBSON){ - value = value.toBSON(); - } - - switch(typeof value) { - case 'string': - return 1 + Buffer.byteLength(name, 'utf8') + 1 + 4 + Buffer.byteLength(value, 'utf8') + 1; - case 'number': - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { // 32 bit - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (4 + 1); - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } - } else { // 64 bit - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } - case 'undefined': - if(isArray || !ignoreUndefined) return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1); - return 0; - case 'boolean': - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 1); - case 'object': - if(value == null || value instanceof MinKey || value instanceof MaxKey || value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1); - } else if(value instanceof ObjectID || value['_bsontype'] == 'ObjectID') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (12 + 1); - } else if(value instanceof Date || isDate(value)) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } else if(typeof Buffer !== 'undefined' && Buffer.isBuffer(value)) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (1 + 4 + 1) + value.length; - } else if(value instanceof Long || value instanceof Double || value instanceof Timestamp - || value['_bsontype'] == 'Long' || value['_bsontype'] == 'Double' || value['_bsontype'] == 'Timestamp') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (8 + 1); - } else if(value instanceof Code || value['_bsontype'] == 'Code') { - // Calculate size depending on the availability of a scope - if(value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined); - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.code.toString(), 'utf8') + 1; - } - } else if(value instanceof Binary || value['_bsontype'] == 'Binary') { - // Check what kind of subtype we have - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1 + 4); - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + (value.position + 1 + 4 + 1); - } - } else if(value instanceof Symbol || value['_bsontype'] == 'Symbol') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + Buffer.byteLength(value.value, 'utf8') + 4 + 1 + 1; - } else if(value instanceof DBRef || value['_bsontype'] == 'DBRef') { - // Set up correct object for serialization - var ordered_values = { - '$ref': value.namespace - , '$id' : value.oid - }; - - // Add db reference if it exists - if(null != value.db) { - ordered_values['$db'] = value.db; - } - - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + calculateObjectSize(ordered_values, serializeFunctions, ignoreUndefined); - } else if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else if(value instanceof BSONRegExp || value['_bsontype'] == 'BSONRegExp') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.pattern, 'utf8') + 1 - + Buffer.byteLength(value.options, 'utf8') + 1 - } else { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + calculateObjectSize(value, serializeFunctions, ignoreUndefined) + 1; - } - case 'function': - // WTF for 0.4.X where typeof /someregexp/ === 'function' - if(value instanceof RegExp || Object.prototype.toString.call(value) === '[object RegExp]' || String.call(value) == '[object RegExp]') { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + Buffer.byteLength(value.source, 'utf8') + 1 - + (value.global ? 1 : 0) + (value.ignoreCase ? 1 : 0) + (value.multiline ? 1 : 0) + 1 - } else { - if(serializeFunctions && value.scope != null && Object.keys(value.scope).length > 0) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1 + calculateObjectSize(value.scope, serializeFunctions, ignoreUndefined); - } else if(serializeFunctions) { - return (name != null ? (Buffer.byteLength(name, 'utf8') + 1) : 0) + 1 + 4 + Buffer.byteLength(value.toString(), 'utf8') + 1; - } - } - } - - return 0; -} - -var BSON = {}; - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -module.exports = calculateObjectSize; diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js deleted file mode 100644 index dc1281be..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/deserializer.js +++ /dev/null @@ -1,555 +0,0 @@ -"use strict" - -var writeIEEE754 = require('../float_parser').writeIEEE754, - readIEEE754 = require('../float_parser').readIEEE754, - f = require('util').format, - Long = require('../long').Long, - Double = require('../double').Double, - Timestamp = require('../timestamp').Timestamp, - ObjectID = require('../objectid').ObjectID, - Symbol = require('../symbol').Symbol, - Code = require('../code').Code, - MinKey = require('../min_key').MinKey, - MaxKey = require('../max_key').MaxKey, - DBRef = require('../db_ref').DBRef, - BSONRegExp = require('../regexp').BSONRegExp, - Binary = require('../binary').Binary; - -var deserialize = function(buffer, options, isArray) { - var index = 0; - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || buffer.length < size) { - throw new Error("corrupt bson message"); - } - - // Illegal end value - if(buffer[size - 1] != 0) { - throw new Error("One object, sized correctly, with a spot for an EOO, but the EOO isn't 0x00"); - } - - // Start deserializtion - return deserializeObject(buffer, options, isArray); -} - -// Reads in a C style string -var readCStyleStringSpecial = function(buffer, index) { - // Get the start search index - var i = index; - // Locate the end of the c string - while(buffer[i] !== 0x00 && i < buffer.length) { - i++ - } - // If are at the end of the buffer there is a problem with the document - if(i >= buffer.length) throw new Error("Bad BSON Document: illegal CString") - // Grab utf8 encoded string - var string = buffer.toString('utf8', index, i); - // Update index position - index = i + 1; - // Return string - return {s: string, i: index}; -} - -var deserializeObject = function(buffer, options, isArray) { - // Options - options = options == null ? {} : options; - var evalFunctions = options['evalFunctions'] == null ? false : options['evalFunctions']; - var cacheFunctions = options['cacheFunctions'] == null ? false : options['cacheFunctions']; - var cacheFunctionsCrc32 = options['cacheFunctionsCrc32'] == null ? false : options['cacheFunctionsCrc32']; - var promoteLongs = options['promoteLongs'] == null ? true : options['promoteLongs']; - var fieldsAsRaw = options['fieldsAsRaw'] == null ? {} : options['fieldsAsRaw']; - // Return BSONRegExp objects instead of native regular expressions - var bsonRegExp = typeof options['bsonRegExp'] == 'boolean' ? options['bsonRegExp'] : false; - var promoteBuffers = options['promoteBuffers'] == null ? false : options['promoteBuffers']; - - // Validate that we have at least 4 bytes of buffer - if(buffer.length < 5) throw new Error("corrupt bson message < 5 bytes long"); - - // Set up index - var index = typeof options['index'] == 'number' ? options['index'] : 0; - - // Read the document size - var size = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - - // Ensure buffer is valid size - if(size < 5 || size > buffer.length) throw new Error("corrupt bson message"); - - // Create holding object - var object = isArray ? [] : {}; - - // While we have more left data left keep parsing - while(true) { - // Read the type - var elementType = buffer[index++]; - // If we get a zero it's the last byte, exit - if(elementType == 0) break; - // Read the name of the field - var r = readCStyleStringSpecial(buffer, index); - var name = r.s; - index = r.i; - - // Switch on the type - if(elementType == BSON.BSON_DATA_OID) { - var string = buffer.toString('binary', index, index + 12); - // Decode the oid - object[name] = new ObjectID(string); - // Update index - index = index + 12; - } else if(elementType == BSON.BSON_DATA_STRING) { - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Add string to object - object[name] = buffer.toString('utf8', index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - } else if(elementType == BSON.BSON_DATA_INT) { - // Decode the 32bit value - object[name] = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } else if(elementType == BSON.BSON_DATA_NUMBER) { - // Decode the double value - object[name] = readIEEE754(buffer, index, 'little', 52, 8); - // Update the index - index = index + 8; - } else if(elementType == BSON.BSON_DATA_DATE) { - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set date object - object[name] = new Date(new Long(lowBits, highBits).toNumber()); - } else if(elementType == BSON.BSON_DATA_BOOLEAN) { - // Parse the boolean value - object[name] = buffer[index++] == 1; - } else if(elementType == BSON.BSON_DATA_UNDEFINED || elementType == BSON.BSON_DATA_NULL) { - // Parse the boolean value - object[name] = null; - } else if(elementType == BSON.BSON_DATA_BINARY) { - // Decode the size of the binary blob - var binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Decode the subtype - var subType = buffer[index++]; - // Decode as raw Buffer object if options specifies it - if(buffer['slice'] != null) { - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - if(promoteBuffers) { - // assign reference to sliced Buffer object - object[name] = buffer.slice(index, index + binarySize); - } else { - // Slice the data - object[name] = new Binary(buffer.slice(index, index + binarySize), subType); - } - } else { - var _buffer = typeof Uint8Array != 'undefined' ? new Uint8Array(new ArrayBuffer(binarySize)) : new Array(binarySize); - // If we have subtype 2 skip the 4 bytes for the size - if(subType == Binary.SUBTYPE_BYTE_ARRAY) { - binarySize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - } - // Copy the data - for(var i = 0; i < binarySize; i++) { - _buffer[i] = buffer[index + i]; - } - if(promoteBuffers) { - // assign reference to Buffer object - object[name] = _buffer; - } else { - // Create the binary object - object[name] = new Binary(_buffer, subType); - } - } - // Update the index - index = index + binarySize; - } else if(elementType == BSON.BSON_DATA_ARRAY) { - options['index'] = index; - // Decode the size of the array document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - var arrayOptions = options; - - // All elements of array to be returned as raw bson - if(fieldsAsRaw[name]) { - arrayOptions = {}; - for(var n in options) arrayOptions[n] = options[n]; - arrayOptions['raw'] = true; - } - - // Set the array to the object - object[name] = deserializeObject(buffer, arrayOptions, true); - // Adjust the index - index = index + objectSize; - } else if(elementType == BSON.BSON_DATA_OBJECT) { - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Validate if string Size is larger than the actual provided buffer - if(objectSize <= 0 || objectSize > (buffer.length - index)) throw new Error("bad embedded document length in bson"); - - // We have a raw value - if(options['raw']) { - // Set the array to the object - object[name] = buffer.slice(index, index + objectSize); - } else { - // Set the array to the object - object[name] = deserializeObject(buffer, options, false); - } - - // Adjust the index - index = index + objectSize; - } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == false) { - // Create the regexp - var r = readCStyleStringSpecial(buffer, index); - var source = r.s; - index = r.i; - - var r = readCStyleStringSpecial(buffer, index); - var regExpOptions = r.s; - index = r.i; - - // For each option add the corresponding one for javascript - var optionsArray = new Array(regExpOptions.length); - - // Parse options - for(var i = 0; i < regExpOptions.length; i++) { - switch(regExpOptions[i]) { - case 'm': - optionsArray[i] = 'm'; - break; - case 's': - optionsArray[i] = 'g'; - break; - case 'i': - optionsArray[i] = 'i'; - break; - } - } - - object[name] = new RegExp(source, optionsArray.join('')); - } else if(elementType == BSON.BSON_DATA_REGEXP && bsonRegExp == true) { - // Create the regexp - var r = readCStyleStringSpecial(buffer, index); - var source = r.s; - index = r.i; - - var r = readCStyleStringSpecial(buffer, index); - var regExpOptions = r.s; - index = r.i; - - // Set the object - object[name] = new BSONRegExp(source, regExpOptions); - } else if(elementType == BSON.BSON_DATA_LONG) { - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Create long object - var long = new Long(lowBits, highBits); - // Promote the long if possible - if(promoteLongs) { - object[name] = long.lessThanOrEqual(JS_INT_MAX_LONG) && long.greaterThanOrEqual(JS_INT_MIN_LONG) ? long.toNumber() : long; - } else { - object[name] = long; - } - } else if(elementType == BSON.BSON_DATA_SYMBOL) { - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Add string to object - object[name] = new Symbol(buffer.toString('utf8', index, index + stringSize - 1)); - // Update parse index position - index = index + stringSize; - } else if(elementType == BSON.BSON_DATA_TIMESTAMP) { - // Unpack the low and high bits - var lowBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var highBits = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Set the object - object[name] = new Timestamp(lowBits, highBits); - } else if(elementType == BSON.BSON_DATA_MIN_KEY) { - // Parse the object - object[name] = new MinKey(); - } else if(elementType == BSON.BSON_DATA_MAX_KEY) { - // Parse the object - object[name] = new MaxKey(); - } else if(elementType == BSON.BSON_DATA_CODE) { - // Read the content of the field - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Function string - var functionString = buffer.toString('utf8', index, index + stringSize - 1); - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - } else { - object[name] = new Code(functionString, {}); - } - - // Update parse index position - index = index + stringSize; - } else if(elementType == BSON.BSON_DATA_CODE_W_SCOPE) { - // Read the content of the field - var totalSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - var stringSize = buffer[index++] | buffer[index++] << 8 | buffer[index++] << 16 | buffer[index++] << 24; - // Validate if string Size is larger than the actual provided buffer - if(stringSize <= 0 || stringSize > (buffer.length - index) || buffer[index + stringSize - 1] != 0) throw new Error("bad string length in bson"); - // Javascript function - var functionString = buffer.toString('utf8', index, index + stringSize - 1); - // Update parse index position - index = index + stringSize; - // Parse the element - options['index'] = index; - // Decode the size of the object document - var objectSize = buffer[index] | buffer[index + 1] << 8 | buffer[index + 2] << 16 | buffer[index + 3] << 24; - // Decode the scope object - var scopeObject = deserializeObject(buffer, options, false); - // Adjust the index - index = index + objectSize; - - // If we are evaluating the functions - if(evalFunctions) { - // Contains the value we are going to set - var value = null; - // If we have cache enabled let's look for the md5 of the function in the cache - if(cacheFunctions) { - var hash = cacheFunctionsCrc32 ? crc32(functionString) : functionString; - // Got to do this to avoid V8 deoptimizing the call due to finding eval - object[name] = isolateEvalWithHash(functionCache, hash, functionString, object); - } else { - // Set directly - object[name] = isolateEval(functionString); - } - - // Set the scope on the object - object[name].scope = scopeObject; - } else { - object[name] = new Code(functionString, scopeObject); - } - } - } - - // Check if we have a db ref object - if(object['$id'] != null) object = new DBRef(object['$ref'], object['$id'], object['$db']); - - // Return the final objects - return object; -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEvalWithHash = function(functionCache, hash, functionString, object) { - // Contains the value we are going to set - var value = null; - - // Check for cache hit, eval if missing and return cached function - if(functionCache[hash] == null) { - eval("value = " + functionString); - functionCache[hash] = value; - } - // Set the object - return functionCache[hash].bind(object); -} - -/** - * Ensure eval is isolated. - * - * @ignore - * @api private - */ -var isolateEval = function(functionString) { - // Contains the value we are going to set - var value = null; - // Eval the function - eval("value = " + functionString); - return value; -} - -var BSON = {}; - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -module.exports = deserialize diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js deleted file mode 100644 index de6b13ac..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/parser/serializer.js +++ /dev/null @@ -1,912 +0,0 @@ -"use strict" - -var writeIEEE754 = require('../float_parser').writeIEEE754, - readIEEE754 = require('../float_parser').readIEEE754, - Long = require('../long').Long, - Map = require('../map'), - Double = require('../double').Double, - Timestamp = require('../timestamp').Timestamp, - ObjectID = require('../objectid').ObjectID, - Symbol = require('../symbol').Symbol, - Code = require('../code').Code, - BSONRegExp = require('../regexp').BSONRegExp, - MinKey = require('../min_key').MinKey, - MaxKey = require('../max_key').MaxKey, - DBRef = require('../db_ref').DBRef, - Binary = require('../binary').Binary; - -var regexp = /\x00/ - -// To ensure that 0.4 of node works correctly -var isDate = function isDate(d) { - return typeof d === 'object' && Object.prototype.toString.call(d) === '[object Date]'; -} - -var isRegExp = function isRegExp(d) { - return Object.prototype.toString.call(d) === '[object RegExp]'; -} - -var serializeString = function(buffer, key, value, index) { - // Encode String type - buffer[index++] = BSON.BSON_DATA_STRING; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes + 1; - buffer[index - 1] = 0; - // Write the string - var size = buffer.write(value, index + 4, 'utf8'); - // Write the size of the string to buffer - buffer[index + 3] = (size + 1 >> 24) & 0xff; - buffer[index + 2] = (size + 1 >> 16) & 0xff; - buffer[index + 1] = (size + 1 >> 8) & 0xff; - buffer[index] = size + 1 & 0xff; - // Update index - index = index + 4 + size; - // Write zero - buffer[index++] = 0; - return index; -} - -var serializeNumber = function(buffer, key, value, index) { - // We have an integer value - if(Math.floor(value) === value && value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // If the value fits in 32 bits encode as int, if it fits in a double - // encode it as a double, otherwise long - if(value >= BSON.BSON_INT32_MIN && value <= BSON.BSON_INT32_MAX) { - // Set int type 32 bits or less - buffer[index++] = BSON.BSON_DATA_INT; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the int value - buffer[index++] = value & 0xff; - buffer[index++] = (value >> 8) & 0xff; - buffer[index++] = (value >> 16) & 0xff; - buffer[index++] = (value >> 24) & 0xff; - } else if(value >= BSON.JS_INT_MIN && value <= BSON.JS_INT_MAX) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } else { - // Set long type - buffer[index++] = BSON.BSON_DATA_LONG; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - var longVal = Long.fromNumber(value); - var lowBits = longVal.getLowBits(); - var highBits = longVal.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - } - } else { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - } - - return index; -} - -var serializeUndefined = function(buffer, key, value, index) { - // Set long type - buffer[index++] = BSON.BSON_DATA_NULL; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - return index; -} - -var serializeBoolean = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BOOLEAN; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Encode the boolean value - buffer[index++] = value ? 1 : 0; - return index; -} - -var serializeDate = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_DATE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Write the date - var dateInMilis = Long.fromNumber(value.getTime()); - var lowBits = dateInMilis.getLowBits(); - var highBits = dateInMilis.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; -} - -var serializeRegExp = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - if (value.source && value.source.match(regexp) != null) { - throw Error("value " + value.source + " must not contain null bytes"); - } - // Adjust the index - index = index + buffer.write(value.source, index, 'utf8'); - // Write zero - buffer[index++] = 0x00; - // Write the parameters - if(value.global) buffer[index++] = 0x73; // s - if(value.ignoreCase) buffer[index++] = 0x69; // i - if(value.multiline) buffer[index++] = 0x6d; // m - // Add ending zero - buffer[index++] = 0x00; - return index; -} - -var serializeBSONRegExp = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_REGEXP; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Adjust the index - index = index + buffer.write(value.pattern, index, 'utf8'); - // Write zero - buffer[index++] = 0x00; - // Write the options - index = index + buffer.write(value.options, index, 'utf8'); - // Add ending zero - buffer[index++] = 0x00; - return index; -} - -var serializeMinMax = function(buffer, key, value, index) { - // Write the type of either min or max key - if(value === null) { - buffer[index++] = BSON.BSON_DATA_NULL; - } else if(value instanceof MinKey) { - buffer[index++] = BSON.BSON_DATA_MIN_KEY; - } else { - buffer[index++] = BSON.BSON_DATA_MAX_KEY; - } - - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - return index; -} - -var serializeObjectId = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_OID; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Write the objectId into the shared buffer - buffer.write(value.id, index, 'binary') - - // Ajust index - return index + 12; -} - -var serializeBuffer = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Get size of the buffer (current write point) - var size = value.length; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the default subtype - buffer[index++] = BSON.BSON_BINARY_SUBTYPE_DEFAULT; - // Copy the content form the binary field to the buffer - value.copy(buffer, index, 0, size); - // Adjust the index - index = index + size; - return index; -} - -var serializeObject = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined) { - // Write the type - buffer[index++] = Array.isArray(value) ? BSON.BSON_DATA_ARRAY : BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - var endIndex = serializeInto(buffer, value, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined); - // Write size - var size = endIndex - index; - return endIndex; -} - -var serializeLong = function(buffer, key, value, index) { - // Write the type - buffer[index++] = value instanceof Long ? BSON.BSON_DATA_LONG : BSON.BSON_DATA_TIMESTAMP; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the date - var lowBits = value.getLowBits(); - var highBits = value.getHighBits(); - // Encode low bits - buffer[index++] = lowBits & 0xff; - buffer[index++] = (lowBits >> 8) & 0xff; - buffer[index++] = (lowBits >> 16) & 0xff; - buffer[index++] = (lowBits >> 24) & 0xff; - // Encode high bits - buffer[index++] = highBits & 0xff; - buffer[index++] = (highBits >> 8) & 0xff; - buffer[index++] = (highBits >> 16) & 0xff; - buffer[index++] = (highBits >> 24) & 0xff; - return index; -} - -var serializeDouble = function(buffer, key, value, index) { - // Encode as double - buffer[index++] = BSON.BSON_DATA_NUMBER; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write float - writeIEEE754(buffer, value, index, 'little', 52, 8); - // Ajust index - index = index + 8; - return index; -} - -var serializeFunction = function(buffer, key, value, index, checkKeys, depth) { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Function string - var functionString = value.toString(); - // Write the string - var size = buffer.write(functionString, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = size & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 3] = (size >> 24) & 0xff; - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0; - return index; -} - -var serializeCode = function(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined) { - if(value.scope != null && Object.keys(value.scope).length > 0) { - // Write the type - buffer[index++] = BSON.BSON_DATA_CODE_W_SCOPE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - // Starting index - var startIndex = index; - - // Serialize the function - // Get the function string - var functionString = typeof value.code == 'string' ? value.code : value.code.toString(); - // Index adjustment - index = index + 4; - // Write string into buffer - var codeSize = buffer.write(functionString, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = codeSize & 0xff; - buffer[index + 1] = (codeSize >> 8) & 0xff; - buffer[index + 2] = (codeSize >> 16) & 0xff; - buffer[index + 3] = (codeSize >> 24) & 0xff; - // Write end 0 - buffer[index + 4 + codeSize - 1] = 0; - // Write the - index = index + codeSize + 4; - - // - // Serialize the scope value - var endIndex = serializeInto(buffer, value.scope, checkKeys, index, depth + 1, serializeFunctions, ignoreUndefined) - index = endIndex - 1; - - // Writ the total - var totalSize = endIndex - startIndex; - - // Write the total size of the object - buffer[startIndex++] = totalSize & 0xff; - buffer[startIndex++] = (totalSize >> 8) & 0xff; - buffer[startIndex++] = (totalSize >> 16) & 0xff; - buffer[startIndex++] = (totalSize >> 24) & 0xff; - // Write trailing zero - buffer[index++] = 0; - } else { - buffer[index++] = BSON.BSON_DATA_CODE; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Function string - var functionString = value.code.toString(); - // Write the string - var size = buffer.write(functionString, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = size & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 3] = (size >> 24) & 0xff; - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0; - } - - return index; -} - -var serializeBinary = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_BINARY; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Extract the buffer - var data = value.value(true); - // Calculate size - var size = value.position; - // Write the size of the string to buffer - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - // Write the subtype to the buffer - buffer[index++] = value.sub_type; - - // If we have binary type 2 the 4 first bytes are the size - if(value.sub_type == Binary.SUBTYPE_BYTE_ARRAY) { - buffer[index++] = size & 0xff; - buffer[index++] = (size >> 8) & 0xff; - buffer[index++] = (size >> 16) & 0xff; - buffer[index++] = (size >> 24) & 0xff; - } - - // Write the data to the object - data.copy(buffer, index, 0, value.position); - // Adjust the index - index = index + value.position; - return index; -} - -var serializeSymbol = function(buffer, key, value, index) { - // Write the type - buffer[index++] = BSON.BSON_DATA_SYMBOL; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - // Write the string - var size = buffer.write(value.value, index + 4, 'utf8') + 1; - // Write the size of the string to buffer - buffer[index] = size & 0xff; - buffer[index + 1] = (size >> 8) & 0xff; - buffer[index + 2] = (size >> 16) & 0xff; - buffer[index + 3] = (size >> 24) & 0xff; - // Update index - index = index + 4 + size - 1; - // Write zero - buffer[index++] = 0x00; - return index; -} - -var serializeDBRef = function(buffer, key, value, index, depth, serializeFunctions) { - // Write the type - buffer[index++] = BSON.BSON_DATA_OBJECT; - // Number of written bytes - var numberOfWrittenBytes = buffer.write(key, index, 'utf8'); - - // Encode the name - index = index + numberOfWrittenBytes; - buffer[index++] = 0; - - var startIndex = index; - var endIndex; - - // Serialize object - if(null != value.db) { - endIndex = serializeInto(buffer, { - '$ref': value.namespace - , '$id' : value.oid - , '$db' : value.db - }, false, index, depth + 1, serializeFunctions); - } else { - endIndex = serializeInto(buffer, { - '$ref': value.namespace - , '$id' : value.oid - }, false, index, depth + 1, serializeFunctions); - } - - // Calculate object size - var size = endIndex - startIndex; - // Write the size - buffer[startIndex++] = size & 0xff; - buffer[startIndex++] = (size >> 8) & 0xff; - buffer[startIndex++] = (size >> 16) & 0xff; - buffer[startIndex++] = (size >> 24) & 0xff; - // Set index - return endIndex; -} - -var serializeInto = function serializeInto(buffer, object, checkKeys, startingIndex, depth, serializeFunctions, ignoreUndefined) { - startingIndex = startingIndex || 0; - - // Start place to serialize into - var index = startingIndex + 4; - var self = this; - - // Special case isArray - if(Array.isArray(object)) { - // Get object keys - for(var i = 0; i < object.length; i++) { - var key = "" + i; - var value = object[i]; - - // Is there an override value - if(value && value.toBSON) { - if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function"); - value = value.toBSON(); - } - - var type = typeof value; - if(type == 'string') { - index = serializeString(buffer, key, value, index); - } else if(type == 'number') { - index = serializeNumber(buffer, key, value, index); - } else if(type == 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if(value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if(type == 'undefined' || value == null) { - index = serializeUndefined(buffer, key, value, index); - } else if(value['_bsontype'] == 'ObjectID') { - index = serializeObjectId(buffer, key, value, index); - } else if(Buffer.isBuffer(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if(value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else if(type == 'object' && value['_bsontype'] == null) { - index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if(value['_bsontype'] == 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if(typeof value == 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); - } else if(value['_bsontype'] == 'Code') { - index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if(value['_bsontype'] == 'Symbol') { - index = serializeSymbol(buffer, key, value, index); - } else if(value['_bsontype'] == 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); - } else if(value['_bsontype'] == 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } - } - } else if(object instanceof Map) { - var iterator = object.entries(); - var done = false; - - while(!done) { - // Unpack the next entry - var entry = iterator.next(); - done = entry.done; - // Are we done, then skip and terminate - if(done) continue; - - // Get the entry values - var key = entry.value[0]; - var value = entry.value[1]; - - // Check the type of the value - var type = typeof value; - - // Check the key and throw error if it's illegal - if(key != '$db' && key != '$ref' && key != '$id') { - if (key.match(regexp) != null) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - - if (checkKeys) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } - } - - // console.log("---------------------------------------------------") - // console.dir("key = " + key) - // console.dir("value = " + value) - - if(type == 'string') { - index = serializeString(buffer, key, value, index); - } else if(type == 'number') { - index = serializeNumber(buffer, key, value, index); - } else if(type == 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if(value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if(value === undefined && ignoreUndefined == true) { - } else if(value === null || value === undefined) { - index = serializeUndefined(buffer, key, value, index); - } else if(value['_bsontype'] == 'ObjectID') { - index = serializeObjectId(buffer, key, value, index); - } else if(Buffer.isBuffer(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if(value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else if(type == 'object' && value['_bsontype'] == null) { - index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if(value['_bsontype'] == 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if(value['_bsontype'] == 'Code') { - index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(typeof value == 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); - } else if(value['_bsontype'] == 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if(value['_bsontype'] == 'Symbol') { - index = serializeSymbol(buffer, key, value, index); - } else if(value['_bsontype'] == 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); - } else if(value['_bsontype'] == 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } - } - } else { - // Did we provide a custom serialization method - if(object.toBSON) { - if(typeof object.toBSON != 'function') throw new Error("toBSON is not a function"); - object = object.toBSON(); - if(object != null && typeof object != 'object') throw new Error("toBSON function did not return an object"); - } - - // Iterate over all the keys - for(var key in object) { - var value = object[key]; - // Is there an override value - if(value && value.toBSON) { - if(typeof value.toBSON != 'function') throw new Error("toBSON is not a function"); - value = value.toBSON(); - } - - // Check the type of the value - var type = typeof value; - - // Check the key and throw error if it's illegal - if(key != '$db' && key != '$ref' && key != '$id') { - if (key.match(regexp) != null) { - // The BSON spec doesn't allow keys with null bytes because keys are - // null-terminated. - throw Error("key " + key + " must not contain null bytes"); - } - - if (checkKeys) { - if('$' == key[0]) { - throw Error("key " + key + " must not start with '$'"); - } else if (!!~key.indexOf('.')) { - throw Error("key " + key + " must not contain '.'"); - } - } - } - - if(type == 'string') { - index = serializeString(buffer, key, value, index); - } else if(type == 'number') { - index = serializeNumber(buffer, key, value, index); - } else if(type == 'boolean') { - index = serializeBoolean(buffer, key, value, index); - } else if(value instanceof Date || isDate(value)) { - index = serializeDate(buffer, key, value, index); - } else if(value === undefined && ignoreUndefined == true) { - } else if(value === null || value === undefined) { - index = serializeUndefined(buffer, key, value, index); - } else if(value['_bsontype'] == 'ObjectID') { - index = serializeObjectId(buffer, key, value, index); - } else if(Buffer.isBuffer(value)) { - index = serializeBuffer(buffer, key, value, index); - } else if(value instanceof RegExp || isRegExp(value)) { - index = serializeRegExp(buffer, key, value, index); - } else if(type == 'object' && value['_bsontype'] == null) { - index = serializeObject(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(value['_bsontype'] == 'Long' || value['_bsontype'] == 'Timestamp') { - index = serializeLong(buffer, key, value, index); - } else if(value['_bsontype'] == 'Double') { - index = serializeDouble(buffer, key, value, index); - } else if(value['_bsontype'] == 'Code') { - index = serializeCode(buffer, key, value, index, checkKeys, depth, serializeFunctions, ignoreUndefined); - } else if(typeof value == 'function' && serializeFunctions) { - index = serializeFunction(buffer, key, value, index, checkKeys, depth, serializeFunctions); - } else if(value['_bsontype'] == 'Binary') { - index = serializeBinary(buffer, key, value, index); - } else if(value['_bsontype'] == 'Symbol') { - index = serializeSymbol(buffer, key, value, index); - } else if(value['_bsontype'] == 'DBRef') { - index = serializeDBRef(buffer, key, value, index, depth, serializeFunctions); - } else if(value['_bsontype'] == 'BSONRegExp') { - index = serializeBSONRegExp(buffer, key, value, index); - } else if(value['_bsontype'] == 'MinKey' || value['_bsontype'] == 'MaxKey') { - index = serializeMinMax(buffer, key, value, index); - } - } - } - - // Final padding byte for object - buffer[index++] = 0x00; - - // Final size - var size = index - startingIndex; - // Write the size of the object - buffer[startingIndex++] = size & 0xff; - buffer[startingIndex++] = (size >> 8) & 0xff; - buffer[startingIndex++] = (size >> 16) & 0xff; - buffer[startingIndex++] = (size >> 24) & 0xff; - return index; -} - -var BSON = {}; - -/** - * Contains the function cache if we have that enable to allow for avoiding the eval step on each deserialization, comparison is by md5 - * - * @ignore - * @api private - */ -var functionCache = BSON.functionCache = {}; - -/** - * Number BSON Type - * - * @classconstant BSON_DATA_NUMBER - **/ -BSON.BSON_DATA_NUMBER = 1; -/** - * String BSON Type - * - * @classconstant BSON_DATA_STRING - **/ -BSON.BSON_DATA_STRING = 2; -/** - * Object BSON Type - * - * @classconstant BSON_DATA_OBJECT - **/ -BSON.BSON_DATA_OBJECT = 3; -/** - * Array BSON Type - * - * @classconstant BSON_DATA_ARRAY - **/ -BSON.BSON_DATA_ARRAY = 4; -/** - * Binary BSON Type - * - * @classconstant BSON_DATA_BINARY - **/ -BSON.BSON_DATA_BINARY = 5; -/** - * ObjectID BSON Type - * - * @classconstant BSON_DATA_OID - **/ -BSON.BSON_DATA_OID = 7; -/** - * Boolean BSON Type - * - * @classconstant BSON_DATA_BOOLEAN - **/ -BSON.BSON_DATA_BOOLEAN = 8; -/** - * Date BSON Type - * - * @classconstant BSON_DATA_DATE - **/ -BSON.BSON_DATA_DATE = 9; -/** - * null BSON Type - * - * @classconstant BSON_DATA_NULL - **/ -BSON.BSON_DATA_NULL = 10; -/** - * RegExp BSON Type - * - * @classconstant BSON_DATA_REGEXP - **/ -BSON.BSON_DATA_REGEXP = 11; -/** - * Code BSON Type - * - * @classconstant BSON_DATA_CODE - **/ -BSON.BSON_DATA_CODE = 13; -/** - * Symbol BSON Type - * - * @classconstant BSON_DATA_SYMBOL - **/ -BSON.BSON_DATA_SYMBOL = 14; -/** - * Code with Scope BSON Type - * - * @classconstant BSON_DATA_CODE_W_SCOPE - **/ -BSON.BSON_DATA_CODE_W_SCOPE = 15; -/** - * 32 bit Integer BSON Type - * - * @classconstant BSON_DATA_INT - **/ -BSON.BSON_DATA_INT = 16; -/** - * Timestamp BSON Type - * - * @classconstant BSON_DATA_TIMESTAMP - **/ -BSON.BSON_DATA_TIMESTAMP = 17; -/** - * Long BSON Type - * - * @classconstant BSON_DATA_LONG - **/ -BSON.BSON_DATA_LONG = 18; -/** - * MinKey BSON Type - * - * @classconstant BSON_DATA_MIN_KEY - **/ -BSON.BSON_DATA_MIN_KEY = 0xff; -/** - * MaxKey BSON Type - * - * @classconstant BSON_DATA_MAX_KEY - **/ -BSON.BSON_DATA_MAX_KEY = 0x7f; - -/** - * Binary Default Type - * - * @classconstant BSON_BINARY_SUBTYPE_DEFAULT - **/ -BSON.BSON_BINARY_SUBTYPE_DEFAULT = 0; -/** - * Binary Function Type - * - * @classconstant BSON_BINARY_SUBTYPE_FUNCTION - **/ -BSON.BSON_BINARY_SUBTYPE_FUNCTION = 1; -/** - * Binary Byte Array Type - * - * @classconstant BSON_BINARY_SUBTYPE_BYTE_ARRAY - **/ -BSON.BSON_BINARY_SUBTYPE_BYTE_ARRAY = 2; -/** - * Binary UUID Type - * - * @classconstant BSON_BINARY_SUBTYPE_UUID - **/ -BSON.BSON_BINARY_SUBTYPE_UUID = 3; -/** - * Binary MD5 Type - * - * @classconstant BSON_BINARY_SUBTYPE_MD5 - **/ -BSON.BSON_BINARY_SUBTYPE_MD5 = 4; -/** - * Binary User Defined Type - * - * @classconstant BSON_BINARY_SUBTYPE_USER_DEFINED - **/ -BSON.BSON_BINARY_SUBTYPE_USER_DEFINED = 128; - -// BSON MAX VALUES -BSON.BSON_INT32_MAX = 0x7FFFFFFF; -BSON.BSON_INT32_MIN = -0x80000000; - -BSON.BSON_INT64_MAX = Math.pow(2, 63) - 1; -BSON.BSON_INT64_MIN = -Math.pow(2, 63); - -// JS MAX PRECISE VALUES -BSON.JS_INT_MAX = 0x20000000000000; // Any integer up to 2^53 can be precisely represented by a double. -BSON.JS_INT_MIN = -0x20000000000000; // Any integer down to -2^53 can be precisely represented by a double. - -// Internal long versions -var JS_INT_MAX_LONG = Long.fromNumber(0x20000000000000); // Any integer up to 2^53 can be precisely represented by a double. -var JS_INT_MIN_LONG = Long.fromNumber(-0x20000000000000); // Any integer down to -2^53 can be precisely represented by a double. - -module.exports = serializeInto; diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js deleted file mode 100644 index 6b148b26..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/regexp.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * A class representation of the BSON RegExp type. - * - * @class - * @return {BSONRegExp} A MinKey instance - */ -function BSONRegExp(pattern, options) { - if(!(this instanceof BSONRegExp)) return new BSONRegExp(); - - // Execute - this._bsontype = 'BSONRegExp'; - this.pattern = pattern; - this.options = options; - - // Validate options - for(var i = 0; i < options.length; i++) { - if(!(this.options[i] == 'i' - || this.options[i] == 'm' - || this.options[i] == 'x' - || this.options[i] == 'l' - || this.options[i] == 's' - || this.options[i] == 'u' - )) { - throw new Error('the regular expression options [' + this.options[i] + "] is not supported"); - } - } -} - -module.exports = BSONRegExp; -module.exports.BSONRegExp = BSONRegExp; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js deleted file mode 100644 index 7681a4de..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/symbol.js +++ /dev/null @@ -1,47 +0,0 @@ -/** - * A class representation of the BSON Symbol type. - * - * @class - * @deprecated - * @param {string} value the string representing the symbol. - * @return {Symbol} - */ -function Symbol(value) { - if(!(this instanceof Symbol)) return new Symbol(value); - this._bsontype = 'Symbol'; - this.value = value; -} - -/** - * Access the wrapped string value. - * - * @method - * @return {String} returns the wrapped string. - */ -Symbol.prototype.valueOf = function() { - return this.value; -}; - -/** - * @ignore - */ -Symbol.prototype.toString = function() { - return this.value; -} - -/** - * @ignore - */ -Symbol.prototype.inspect = function() { - return this.value; -} - -/** - * @ignore - */ -Symbol.prototype.toJSON = function() { - return this.value; -} - -module.exports = Symbol; -module.exports.Symbol = Symbol; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js b/Databases/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js deleted file mode 100644 index 7718cafc..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/lib/bson/timestamp.js +++ /dev/null @@ -1,856 +0,0 @@ -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// Copyright 2009 Google Inc. All Rights Reserved - -/** - * This type is for INTERNAL use in MongoDB only and should not be used in applications. - * The appropriate corresponding type is the JavaScript Date type. - * - * Defines a Timestamp class for representing a 64-bit two's-complement - * integer value, which faithfully simulates the behavior of a Java "Timestamp". This - * implementation is derived from TimestampLib in GWT. - * - * Constructs a 64-bit two's-complement integer, given its low and high 32-bit - * values as *signed* integers. See the from* functions below for more - * convenient ways of constructing Timestamps. - * - * The internal representation of a Timestamp is the two given signed, 32-bit values. - * We use 32-bit pieces because these are the size of integers on which - * Javascript performs bit-operations. For operations like addition and - * multiplication, we split each number into 16-bit pieces, which can easily be - * multiplied within Javascript's floating-point representation without overflow - * or change in sign. - * - * In the algorithms below, we frequently reduce the negative case to the - * positive case by negating the input(s) and then post-processing the result. - * Note that we must ALWAYS check specially whether those values are MIN_VALUE - * (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as - * a positive number, it overflows back into a negative). Not handling this - * case would often result in infinite recursion. - * - * @class - * @param {number} low the low (signed) 32 bits of the Timestamp. - * @param {number} high the high (signed) 32 bits of the Timestamp. - */ -function Timestamp(low, high) { - if(!(this instanceof Timestamp)) return new Timestamp(low, high); - this._bsontype = 'Timestamp'; - /** - * @type {number} - * @ignore - */ - this.low_ = low | 0; // force into 32 signed bits. - - /** - * @type {number} - * @ignore - */ - this.high_ = high | 0; // force into 32 signed bits. -}; - -/** - * Return the int value. - * - * @return {number} the value, assuming it is a 32-bit integer. - */ -Timestamp.prototype.toInt = function() { - return this.low_; -}; - -/** - * Return the Number value. - * - * @method - * @return {number} the closest floating-point representation to this value. - */ -Timestamp.prototype.toNumber = function() { - return this.high_ * Timestamp.TWO_PWR_32_DBL_ + - this.getLowBitsUnsigned(); -}; - -/** - * Return the JSON value. - * - * @method - * @return {string} the JSON representation. - */ -Timestamp.prototype.toJSON = function() { - return this.toString(); -} - -/** - * Return the String value. - * - * @method - * @param {number} [opt_radix] the radix in which the text should be written. - * @return {string} the textual representation of this value. - */ -Timestamp.prototype.toString = function(opt_radix) { - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (this.isZero()) { - return '0'; - } - - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - // We need to change the Timestamp value before it can be negated, so we remove - // the bottom-most digit in this base and then recurse to do the rest. - var radixTimestamp = Timestamp.fromNumber(radix); - var div = this.div(radixTimestamp); - var rem = div.multiply(radixTimestamp).subtract(this); - return div.toString(radix) + rem.toInt().toString(radix); - } else { - return '-' + this.negate().toString(radix); - } - } - - // Do several (6) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 6)); - - var rem = this; - var result = ''; - while (true) { - var remDiv = rem.div(radixToPower); - var intval = rem.subtract(remDiv.multiply(radixToPower)).toInt(); - var digits = intval.toString(radix); - - rem = remDiv; - if (rem.isZero()) { - return digits + result; - } else { - while (digits.length < 6) { - digits = '0' + digits; - } - result = '' + digits + result; - } - } -}; - -/** - * Return the high 32-bits value. - * - * @method - * @return {number} the high 32-bits as a signed value. - */ -Timestamp.prototype.getHighBits = function() { - return this.high_; -}; - -/** - * Return the low 32-bits value. - * - * @method - * @return {number} the low 32-bits as a signed value. - */ -Timestamp.prototype.getLowBits = function() { - return this.low_; -}; - -/** - * Return the low unsigned 32-bits value. - * - * @method - * @return {number} the low 32-bits as an unsigned value. - */ -Timestamp.prototype.getLowBitsUnsigned = function() { - return (this.low_ >= 0) ? - this.low_ : Timestamp.TWO_PWR_32_DBL_ + this.low_; -}; - -/** - * Returns the number of bits needed to represent the absolute value of this Timestamp. - * - * @method - * @return {number} Returns the number of bits needed to represent the absolute value of this Timestamp. - */ -Timestamp.prototype.getNumBitsAbs = function() { - if (this.isNegative()) { - if (this.equals(Timestamp.MIN_VALUE)) { - return 64; - } else { - return this.negate().getNumBitsAbs(); - } - } else { - var val = this.high_ != 0 ? this.high_ : this.low_; - for (var bit = 31; bit > 0; bit--) { - if ((val & (1 << bit)) != 0) { - break; - } - } - return this.high_ != 0 ? bit + 33 : bit + 1; - } -}; - -/** - * Return whether this value is zero. - * - * @method - * @return {boolean} whether this value is zero. - */ -Timestamp.prototype.isZero = function() { - return this.high_ == 0 && this.low_ == 0; -}; - -/** - * Return whether this value is negative. - * - * @method - * @return {boolean} whether this value is negative. - */ -Timestamp.prototype.isNegative = function() { - return this.high_ < 0; -}; - -/** - * Return whether this value is odd. - * - * @method - * @return {boolean} whether this value is odd. - */ -Timestamp.prototype.isOdd = function() { - return (this.low_ & 1) == 1; -}; - -/** - * Return whether this Timestamp equals the other - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp equals the other - */ -Timestamp.prototype.equals = function(other) { - return (this.high_ == other.high_) && (this.low_ == other.low_); -}; - -/** - * Return whether this Timestamp does not equal the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp does not equal the other. - */ -Timestamp.prototype.notEquals = function(other) { - return (this.high_ != other.high_) || (this.low_ != other.low_); -}; - -/** - * Return whether this Timestamp is less than the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is less than the other. - */ -Timestamp.prototype.lessThan = function(other) { - return this.compare(other) < 0; -}; - -/** - * Return whether this Timestamp is less than or equal to the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is less than or equal to the other. - */ -Timestamp.prototype.lessThanOrEqual = function(other) { - return this.compare(other) <= 0; -}; - -/** - * Return whether this Timestamp is greater than the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is greater than the other. - */ -Timestamp.prototype.greaterThan = function(other) { - return this.compare(other) > 0; -}; - -/** - * Return whether this Timestamp is greater than or equal to the other. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} whether this Timestamp is greater than or equal to the other. - */ -Timestamp.prototype.greaterThanOrEqual = function(other) { - return this.compare(other) >= 0; -}; - -/** - * Compares this Timestamp with the given one. - * - * @method - * @param {Timestamp} other Timestamp to compare against. - * @return {boolean} 0 if they are the same, 1 if the this is greater, and -1 if the given one is greater. - */ -Timestamp.prototype.compare = function(other) { - if (this.equals(other)) { - return 0; - } - - var thisNeg = this.isNegative(); - var otherNeg = other.isNegative(); - if (thisNeg && !otherNeg) { - return -1; - } - if (!thisNeg && otherNeg) { - return 1; - } - - // at this point, the signs are the same, so subtraction will not overflow - if (this.subtract(other).isNegative()) { - return -1; - } else { - return 1; - } -}; - -/** - * The negation of this value. - * - * @method - * @return {Timestamp} the negation of this value. - */ -Timestamp.prototype.negate = function() { - if (this.equals(Timestamp.MIN_VALUE)) { - return Timestamp.MIN_VALUE; - } else { - return this.not().add(Timestamp.ONE); - } -}; - -/** - * Returns the sum of this and the given Timestamp. - * - * @method - * @param {Timestamp} other Timestamp to add to this one. - * @return {Timestamp} the sum of this and the given Timestamp. - */ -Timestamp.prototype.add = function(other) { - // Divide each number into 4 chunks of 16 bits, and then sum the chunks. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 + b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 + b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 + b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 + b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns the difference of this and the given Timestamp. - * - * @method - * @param {Timestamp} other Timestamp to subtract from this. - * @return {Timestamp} the difference of this and the given Timestamp. - */ -Timestamp.prototype.subtract = function(other) { - return this.add(other.negate()); -}; - -/** - * Returns the product of this and the given Timestamp. - * - * @method - * @param {Timestamp} other Timestamp to multiply with this. - * @return {Timestamp} the product of this and the other. - */ -Timestamp.prototype.multiply = function(other) { - if (this.isZero()) { - return Timestamp.ZERO; - } else if (other.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - return other.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } else if (other.equals(Timestamp.MIN_VALUE)) { - return this.isOdd() ? Timestamp.MIN_VALUE : Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().multiply(other.negate()); - } else { - return this.negate().multiply(other).negate(); - } - } else if (other.isNegative()) { - return this.multiply(other.negate()).negate(); - } - - // If both Timestamps are small, use float multiplication - if (this.lessThan(Timestamp.TWO_PWR_24_) && - other.lessThan(Timestamp.TWO_PWR_24_)) { - return Timestamp.fromNumber(this.toNumber() * other.toNumber()); - } - - // Divide each Timestamp into 4 chunks of 16 bits, and then add up 4x4 products. - // We can skip products that would overflow. - - var a48 = this.high_ >>> 16; - var a32 = this.high_ & 0xFFFF; - var a16 = this.low_ >>> 16; - var a00 = this.low_ & 0xFFFF; - - var b48 = other.high_ >>> 16; - var b32 = other.high_ & 0xFFFF; - var b16 = other.low_ >>> 16; - var b00 = other.low_ & 0xFFFF; - - var c48 = 0, c32 = 0, c16 = 0, c00 = 0; - c00 += a00 * b00; - c16 += c00 >>> 16; - c00 &= 0xFFFF; - c16 += a16 * b00; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c16 += a00 * b16; - c32 += c16 >>> 16; - c16 &= 0xFFFF; - c32 += a32 * b00; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a16 * b16; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c32 += a00 * b32; - c48 += c32 >>> 16; - c32 &= 0xFFFF; - c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; - c48 &= 0xFFFF; - return Timestamp.fromBits((c16 << 16) | c00, (c48 << 16) | c32); -}; - -/** - * Returns this Timestamp divided by the given one. - * - * @method - * @param {Timestamp} other Timestamp by which to divide. - * @return {Timestamp} this Timestamp divided by the given one. - */ -Timestamp.prototype.div = function(other) { - if (other.isZero()) { - throw Error('division by zero'); - } else if (this.isZero()) { - return Timestamp.ZERO; - } - - if (this.equals(Timestamp.MIN_VALUE)) { - if (other.equals(Timestamp.ONE) || - other.equals(Timestamp.NEG_ONE)) { - return Timestamp.MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ONE; - } else { - // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. - var halfThis = this.shiftRight(1); - var approx = halfThis.div(other).shiftLeft(1); - if (approx.equals(Timestamp.ZERO)) { - return other.isNegative() ? Timestamp.ONE : Timestamp.NEG_ONE; - } else { - var rem = this.subtract(other.multiply(approx)); - var result = approx.add(rem.div(other)); - return result; - } - } - } else if (other.equals(Timestamp.MIN_VALUE)) { - return Timestamp.ZERO; - } - - if (this.isNegative()) { - if (other.isNegative()) { - return this.negate().div(other.negate()); - } else { - return this.negate().div(other).negate(); - } - } else if (other.isNegative()) { - return this.div(other.negate()).negate(); - } - - // Repeat the following until the remainder is less than other: find a - // floating-point that approximates remainder / other *from below*, add this - // into the result, and subtract it from the remainder. It is critical that - // the approximate value is less than or equal to the real value so that the - // remainder never becomes negative. - var res = Timestamp.ZERO; - var rem = this; - while (rem.greaterThanOrEqual(other)) { - // Approximate the result of division. This may be a little greater or - // smaller than the actual value. - var approx = Math.max(1, Math.floor(rem.toNumber() / other.toNumber())); - - // We will tweak the approximate result by changing it in the 48-th digit or - // the smallest non-fractional digit, whichever is larger. - var log2 = Math.ceil(Math.log(approx) / Math.LN2); - var delta = (log2 <= 48) ? 1 : Math.pow(2, log2 - 48); - - // Decrease the approximation until it is smaller than the remainder. Note - // that if it is too large, the product overflows and is negative. - var approxRes = Timestamp.fromNumber(approx); - var approxRem = approxRes.multiply(other); - while (approxRem.isNegative() || approxRem.greaterThan(rem)) { - approx -= delta; - approxRes = Timestamp.fromNumber(approx); - approxRem = approxRes.multiply(other); - } - - // We know the answer can't be zero... and actually, zero would cause - // infinite recursion since we would make no progress. - if (approxRes.isZero()) { - approxRes = Timestamp.ONE; - } - - res = res.add(approxRes); - rem = rem.subtract(approxRem); - } - return res; -}; - -/** - * Returns this Timestamp modulo the given one. - * - * @method - * @param {Timestamp} other Timestamp by which to mod. - * @return {Timestamp} this Timestamp modulo the given one. - */ -Timestamp.prototype.modulo = function(other) { - return this.subtract(this.div(other).multiply(other)); -}; - -/** - * The bitwise-NOT of this value. - * - * @method - * @return {Timestamp} the bitwise-NOT of this value. - */ -Timestamp.prototype.not = function() { - return Timestamp.fromBits(~this.low_, ~this.high_); -}; - -/** - * Returns the bitwise-AND of this Timestamp and the given one. - * - * @method - * @param {Timestamp} other the Timestamp with which to AND. - * @return {Timestamp} the bitwise-AND of this and the other. - */ -Timestamp.prototype.and = function(other) { - return Timestamp.fromBits(this.low_ & other.low_, this.high_ & other.high_); -}; - -/** - * Returns the bitwise-OR of this Timestamp and the given one. - * - * @method - * @param {Timestamp} other the Timestamp with which to OR. - * @return {Timestamp} the bitwise-OR of this and the other. - */ -Timestamp.prototype.or = function(other) { - return Timestamp.fromBits(this.low_ | other.low_, this.high_ | other.high_); -}; - -/** - * Returns the bitwise-XOR of this Timestamp and the given one. - * - * @method - * @param {Timestamp} other the Timestamp with which to XOR. - * @return {Timestamp} the bitwise-XOR of this and the other. - */ -Timestamp.prototype.xor = function(other) { - return Timestamp.fromBits(this.low_ ^ other.low_, this.high_ ^ other.high_); -}; - -/** - * Returns this Timestamp with bits shifted to the left by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the left by the given amount. - */ -Timestamp.prototype.shiftLeft = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var low = this.low_; - if (numBits < 32) { - var high = this.high_; - return Timestamp.fromBits( - low << numBits, - (high << numBits) | (low >>> (32 - numBits))); - } else { - return Timestamp.fromBits(0, low << (numBits - 32)); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount. - */ -Timestamp.prototype.shiftRight = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >> numBits); - } else { - return Timestamp.fromBits( - high >> (numBits - 32), - high >= 0 ? 0 : -1); - } - } -}; - -/** - * Returns this Timestamp with bits shifted to the right by the given amount, with the new top bits matching the current sign bit. - * - * @method - * @param {number} numBits the number of bits by which to shift. - * @return {Timestamp} this shifted to the right by the given amount, with zeros placed into the new leading bits. - */ -Timestamp.prototype.shiftRightUnsigned = function(numBits) { - numBits &= 63; - if (numBits == 0) { - return this; - } else { - var high = this.high_; - if (numBits < 32) { - var low = this.low_; - return Timestamp.fromBits( - (low >>> numBits) | (high << (32 - numBits)), - high >>> numBits); - } else if (numBits == 32) { - return Timestamp.fromBits(high, 0); - } else { - return Timestamp.fromBits(high >>> (numBits - 32), 0); - } - } -}; - -/** - * Returns a Timestamp representing the given (32-bit) integer value. - * - * @method - * @param {number} value the 32-bit integer in question. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromInt = function(value) { - if (-128 <= value && value < 128) { - var cachedObj = Timestamp.INT_CACHE_[value]; - if (cachedObj) { - return cachedObj; - } - } - - var obj = new Timestamp(value | 0, value < 0 ? -1 : 0); - if (-128 <= value && value < 128) { - Timestamp.INT_CACHE_[value] = obj; - } - return obj; -}; - -/** - * Returns a Timestamp representing the given value, provided that it is a finite number. Otherwise, zero is returned. - * - * @method - * @param {number} value the number in question. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromNumber = function(value) { - if (isNaN(value) || !isFinite(value)) { - return Timestamp.ZERO; - } else if (value <= -Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MIN_VALUE; - } else if (value + 1 >= Timestamp.TWO_PWR_63_DBL_) { - return Timestamp.MAX_VALUE; - } else if (value < 0) { - return Timestamp.fromNumber(-value).negate(); - } else { - return new Timestamp( - (value % Timestamp.TWO_PWR_32_DBL_) | 0, - (value / Timestamp.TWO_PWR_32_DBL_) | 0); - } -}; - -/** - * Returns a Timestamp representing the 64-bit integer that comes by concatenating the given high and low bits. Each is assumed to use 32 bits. - * - * @method - * @param {number} lowBits the low 32-bits. - * @param {number} highBits the high 32-bits. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromBits = function(lowBits, highBits) { - return new Timestamp(lowBits, highBits); -}; - -/** - * Returns a Timestamp representation of the given string, written using the given radix. - * - * @method - * @param {string} str the textual representation of the Timestamp. - * @param {number} opt_radix the radix in which the text is written. - * @return {Timestamp} the corresponding Timestamp value. - */ -Timestamp.fromString = function(str, opt_radix) { - if (str.length == 0) { - throw Error('number format error: empty string'); - } - - var radix = opt_radix || 10; - if (radix < 2 || 36 < radix) { - throw Error('radix out of range: ' + radix); - } - - if (str.charAt(0) == '-') { - return Timestamp.fromString(str.substring(1), radix).negate(); - } else if (str.indexOf('-') >= 0) { - throw Error('number format error: interior "-" character: ' + str); - } - - // Do several (8) digits each time through the loop, so as to - // minimize the calls to the very expensive emulated div. - var radixToPower = Timestamp.fromNumber(Math.pow(radix, 8)); - - var result = Timestamp.ZERO; - for (var i = 0; i < str.length; i += 8) { - var size = Math.min(8, str.length - i); - var value = parseInt(str.substring(i, i + size), radix); - if (size < 8) { - var power = Timestamp.fromNumber(Math.pow(radix, size)); - result = result.multiply(power).add(Timestamp.fromNumber(value)); - } else { - result = result.multiply(radixToPower); - result = result.add(Timestamp.fromNumber(value)); - } - } - return result; -}; - -// NOTE: Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the -// from* methods on which they depend. - - -/** - * A cache of the Timestamp representations of small integer values. - * @type {Object} - * @ignore - */ -Timestamp.INT_CACHE_ = {}; - -// NOTE: the compiler should inline these constant values below and then remove -// these variables, so there should be no runtime penalty for these. - -/** - * Number used repeated below in calculations. This must appear before the - * first call to any from* function below. - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_16_DBL_ = 1 << 16; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_24_DBL_ = 1 << 24; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_32_DBL_ = Timestamp.TWO_PWR_16_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_31_DBL_ = Timestamp.TWO_PWR_32_DBL_ / 2; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_48_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_16_DBL_; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_64_DBL_ = Timestamp.TWO_PWR_32_DBL_ * Timestamp.TWO_PWR_32_DBL_; - -/** - * @type {number} - * @ignore - */ -Timestamp.TWO_PWR_63_DBL_ = Timestamp.TWO_PWR_64_DBL_ / 2; - -/** @type {Timestamp} */ -Timestamp.ZERO = Timestamp.fromInt(0); - -/** @type {Timestamp} */ -Timestamp.ONE = Timestamp.fromInt(1); - -/** @type {Timestamp} */ -Timestamp.NEG_ONE = Timestamp.fromInt(-1); - -/** @type {Timestamp} */ -Timestamp.MAX_VALUE = - Timestamp.fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0); - -/** @type {Timestamp} */ -Timestamp.MIN_VALUE = Timestamp.fromBits(0, 0x80000000 | 0); - -/** - * @type {Timestamp} - * @ignore - */ -Timestamp.TWO_PWR_24_ = Timestamp.fromInt(1 << 24); - -/** - * Expose. - */ -module.exports = Timestamp; -module.exports.Timestamp = Timestamp; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/bson/package.json b/Databases/node_modules/mongoose/node_modules/bson/package.json deleted file mode 100644 index ef1a2e12..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "bson", - "description": "A bson parser for node.js and the browser", - "keywords": [ - "mongodb", - "bson", - "parser" - ], - "version": "0.4.19", - "author": { - "name": "Christian Amor Kvalheim", - "email": "christkv@gmail.com" - }, - "contributors": [], - "repository": { - "type": "git", - "url": "git://github.com/mongodb/js-bson.git" - }, - "bugs": { - "url": "https://github.com/mongodb/js-bson/issues" - }, - "devDependencies": { - "nodeunit": "0.9.0", - "gleak": "0.2.3", - "one": "2.X.X", - "benchmark": "1.0.0", - "colors": "1.1.0" - }, - "config": { - "native": false - }, - "main": "./lib/bson/index", - "directories": { - "lib": "./lib/bson" - }, - "engines": { - "node": ">=0.6.19" - }, - "scripts": { - "test": "nodeunit ./test/node" - }, - "browser": "lib/bson/bson.js", - "license": "Apache-2.0", - "gitHead": "70852794697af3ff6c08f922b6961e80af94e9f0", - "homepage": "https://github.com/mongodb/js-bson", - "_id": "bson@0.4.19", - "_shasum": "1a340f39a83d163c18af9c5ca92d2b697a35be41", - "_from": "bson@~0.4", - "_npmVersion": "2.14.7", - "_nodeVersion": "4.2.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "octave", - "email": "chinsay@gmail.com" - }, - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "1a340f39a83d163c18af9c5ca92d2b697a35be41", - "tarball": "http://registry.npmjs.org/bson/-/bson-0.4.19.tgz" - }, - "_resolved": "https://registry.npmjs.org/bson/-/bson-0.4.19.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/bson/tools/gleak.js b/Databases/node_modules/mongoose/node_modules/bson/tools/gleak.js deleted file mode 100644 index c707cfcb..00000000 --- a/Databases/node_modules/mongoose/node_modules/bson/tools/gleak.js +++ /dev/null @@ -1,21 +0,0 @@ - -var gleak = require('gleak')(); -gleak.ignore('AssertionError'); -gleak.ignore('testFullSpec_param_found'); -gleak.ignore('events'); -gleak.ignore('Uint8Array'); -gleak.ignore('Uint8ClampedArray'); -gleak.ignore('TAP_Global_Harness'); -gleak.ignore('setImmediate'); -gleak.ignore('clearImmediate'); - -gleak.ignore('DTRACE_NET_SERVER_CONNECTION'); -gleak.ignore('DTRACE_NET_STREAM_END'); -gleak.ignore('DTRACE_NET_SOCKET_READ'); -gleak.ignore('DTRACE_NET_SOCKET_WRITE'); -gleak.ignore('DTRACE_HTTP_SERVER_REQUEST'); -gleak.ignore('DTRACE_HTTP_SERVER_RESPONSE'); -gleak.ignore('DTRACE_HTTP_CLIENT_REQUEST'); -gleak.ignore('DTRACE_HTTP_CLIENT_RESPONSE'); - -module.exports = gleak; diff --git a/Databases/node_modules/mongoose/node_modules/hooks-fixed/.npmignore b/Databases/node_modules/mongoose/node_modules/hooks-fixed/.npmignore deleted file mode 100644 index 96e29a84..00000000 --- a/Databases/node_modules/mongoose/node_modules/hooks-fixed/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -**.swp -node_modules diff --git a/Databases/node_modules/mongoose/node_modules/hooks-fixed/Makefile b/Databases/node_modules/mongoose/node_modules/hooks-fixed/Makefile deleted file mode 100644 index 1db5d653..00000000 --- a/Databases/node_modules/mongoose/node_modules/hooks-fixed/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -test: - @NODE_ENV=test ./node_modules/expresso/bin/expresso \ - $(TESTFLAGS) \ - ./test.js - -test-cov: - @TESTFLAGS=--cov $(MAKE) test - -.PHONY: test test-cov diff --git a/Databases/node_modules/mongoose/node_modules/hooks-fixed/README.md b/Databases/node_modules/mongoose/node_modules/hooks-fixed/README.md deleted file mode 100644 index 98fe85bd..00000000 --- a/Databases/node_modules/mongoose/node_modules/hooks-fixed/README.md +++ /dev/null @@ -1,369 +0,0 @@ -hooks -============ - -Add pre and post middleware hooks to your JavaScript methods. - -## Installation - npm install hooks - -## Motivation -Suppose you have a JavaScript object with a `save` method. - -It would be nice to be able to declare code that runs before `save` and after `save`. -For example, you might want to run validation code before every `save`, -and you might want to dispatch a job to a background job queue after `save`. - -One might have an urge to hard code this all into `save`, but that turns out to -couple all these pieces of functionality (validation, save, and job creation) more -tightly than is necessary. For example, what if someone does not want to do background -job creation after the logical save? - -It is nicer to tack on functionality using what we call `pre` and `post` hooks. These -are functions that you define and that you direct to execute before or after particular -methods. - -## Example -We can use `hooks` to add validation and background jobs in the following way: - -```javascript -var hooks = require('hooks') - , Document = require('./path/to/some/document/constructor'); - -// Add hooks' methods: `hook`, `pre`, and `post` -for (var k in hooks) { - Document[k] = hooks[k]; -} - -// Define a new method that is able to invoke pre and post middleware -Document.hook('save', Document.prototype.save); - -// Define a middleware function to be invoked before 'save' -Document.pre('save', function validate (next) { - // The `this` context inside of `pre` and `post` functions - // is the Document instance - if (this.isValid()) next(); // next() passes control to the next middleware - // or to the target method itself - else next(new Error("Invalid")); // next(error) invokes an error callback -}); - -// Define a middleware function to be invoked after 'save' -Document.post('save', function createJob (next) { - this.sendToBackgroundQueue(); - next(); -}); -``` - -If you already have defined `Document.prototype` methods for which you want pres and posts, -then you do not need to explicitly invoke `Document.hook(...)`. Invoking `Document.pre(methodName, fn)` -or `Document.post(methodName, fn)` will automatically and lazily change `Document.prototype[methodName]` -so that it plays well with `hooks`. An equivalent way to implement the previous example is: - -```javascript -var hooks = require('hooks') - , Document = require('./path/to/some/document/constructor'); - -// Add hooks' methods: `hook`, `pre`, and `post` -for (var k in hooks) { - Document[k] = hooks[k]; -} - -Document.prototype.save = function () { - // ... -}; - -// Define a middleware function to be invoked before 'save' -Document.pre('save', function validate (next) { - // The `this` context inside of `pre` and `post` functions - // is the Document instance - if (this.isValid()) next(); // next() passes control to the next middleware - // or to the target method itself - else next(new Error("Invalid")); // next(error) invokes an error callback -}); - -// Define a middleware function to be invoked after 'save' -Document.post('save', function createJob (next) { - this.sendToBackgroundQueue(); - next(); -}); -``` - -## Pres and Posts as Middleware -We structure pres and posts as middleware to give you maximum flexibility: - -1. You can define **multiple** pres (or posts) for a single method. -2. These pres (or posts) are then executed as a chain of methods. -3. Any functions in this middleware chain can choose to halt the chain's execution by `next`ing an Error from that middleware function. If this occurs, then none of the other middleware in the chain will execute, and the main method (e.g., `save`) will not execute. This is nice, for example, when we don't want a document to save if it is invalid. - -## Defining multiple pres (or posts) -`pre` and `post` are chainable, so you can define multiple via: -```javascript -Document.pre('save', function (next) { - console.log("hello"); - next(); -}).pre('save', function (next) { - console.log("world"); - next(); -}); - -Document.post('save', function (next) { - console.log("hello"); - next(); -}).post('save', function (next) { - console.log("world"); - next(); -}); -``` - -As soon as one pre finishes executing, the next one will be invoked, and so on. - -## Error Handling -You can define a default error handler by passing a 2nd function as the 3rd argument to `hook`: -```javascript -Document.hook('set', function (path, val) { - this[path] = val; -}, function (err) { - // Handler the error here - console.error(err); -}); -``` - -Then, we can pass errors to this handler from a pre or post middleware function: -```javascript -Document.pre('set', function (next, path, val) { - next(new Error()); -}); -``` - -If you do not set up a default handler, then `hooks` makes the default handler that just throws the `Error`. - -The default error handler can be over-rided on a per method invocation basis. - -If the main method that you are surrounding with pre and post middleware expects its last argument to be a function -with callback signature `function (error, ...)`, then that callback becomes the error handler, over-riding the default -error handler you may have set up. - -```javascript -Document.hook('save', function (callback) { - // Save logic goes here - ... -}); - -var doc = new Document(); -doc.save( function (err, saved) { - // We can pass err via `next` in any of our pre or post middleware functions - if (err) console.error(err); - - // Rest of callback logic follows ... -}); -``` - -## Mutating Arguments via Middleware -`pre` and `post` middleware can also accept the intended arguments for the method -they augment. This is useful if you want to mutate the arguments before passing -them along to the next middleware and eventually pass a mutated arguments list to -the main method itself. - -As a simple example, let's define a method `set` that just sets a key, value pair. -If we want to namespace the key, we can do so by adding a `pre` middleware hook -that runs before `set`, alters the arguments by namespacing the `key` argument, and passes them onto `set`: - -```javascript -Document.hook('set', function (key, val) { - this[key] = val; -}); -Document.pre('set', function (next, key, val) { - next('namespace-' + key, val); -}); -var doc = new Document(); -doc.set('hello', 'world'); -console.log(doc.hello); // undefined -console.log(doc['namespace-hello']); // 'world' -``` - -As you can see above, we pass arguments via `next`. - -If you are not mutating the arguments, then you can pass zero arguments -to `next`, and the next middleware function will still have access -to the arguments. - -```javascript -Document.hook('set', function (key, val) { - this[key] = val; -}); -Document.pre('set', function (next, key, val) { - // I have access to key and val here - next(); // We don't need to pass anything to next -}); -Document.pre('set', function (next, key, val) { - // And I still have access to the original key and val here - next(); -}); -``` - -Finally, you can add arguments that downstream middleware can also see: - -```javascript -// Note that in the definition of `set`, there is no 3rd argument, options -Document.hook('set', function (key, val) { - // But... - var options = arguments[2]; // ...I have access to an options argument - // because of pre function pre2 (defined below) - console.log(options); // '{debug: true}' - this[key] = val; -}); -Document.pre('set', function pre1 (next, key, val) { - // I only have access to key and val arguments - console.log(arguments.length); // 3 - next(key, val, {debug: true}); -}); -Document.pre('set', function pre2 (next, key, val, options) { - console.log(arguments.length); // 4 - console.log(options); // '{ debug: true}' - next(); -}); -Document.pre('set', function pre3 (next, key, val, options) { - // I still have access to key, val, AND the options argument introduced via the preceding middleware - console.log(arguments.length); // 4 - console.log(options); // '{ debug: true}' - next(); -}); - -var doc = new Document() -doc.set('hey', 'there'); -``` - -## Post middleware - -Post middleware intercepts the callback originally sent to the asynchronous function you have hooked to. - -This means that the following chain of execution will occur in a typical `save` operation: - -(1) doc.save -> (2) pre --(next)--> (3) save calls back -> (4) post --(next)--> (5) targetFn - -Illustrated below: - -``` -Document.pre('save', function (next) { - this.key = "value"; - next(); -}); -// Post handler occurs before `set` calls back. This is useful if we need to grab something -// async before `set` finishes. -Document.post('set', function (next) { - var me = this; - getSomethingAsync(function(value){ // let's assume it returns "Hello Async" - me.key2 = value; - next(); - }); -}); - -var doc = new Document(); -doc.save(function(err){ - console.log(this.key); // "value" - this value was saved - console.log(this.key2); // "Hello Async" - this value was *not* saved -} - -``` - -Post middleware must call `next()` or execution will stop. - -## Parallel `pre` middleware - -All middleware up to this point has been "serial" middleware -- i.e., middleware whose logic -is executed as a serial chain. - -Some scenarios call for parallel middleware -- i.e., middleware that can wait for several -asynchronous services at once to respond. - -For instance, you may only want to save a Document only after you have checked -that the Document is valid according to two different remote services. - -We accomplish asynchronous middleware by adding a second kind of flow control callback -(the only flow control callback so far has been `next`), called `done`. - -- `next` passes control to the next middleware in the chain -- `done` keeps track of how many parallel middleware have invoked `done` and passes - control to the target method when ALL parallel middleware have invoked `done`. If - you pass an `Error` to `done`, then the error is handled, and the main method that is - wrapped by pres and posts will not get invoked. - -We declare pre middleware that is parallel by passing a 3rd boolean argument to our `pre` -definition method. - -We illustrate via the parallel validation example mentioned above: - -```javascript -Document.hook('save', function targetFn (callback) { - // Save logic goes here - // ... - // This only gets run once the two `done`s are both invoked via preOne and preTwo. -}); - - // true marks this as parallel middleware -Document.pre('save', true, function preOne (next, doneOne, callback) { - remoteServiceOne.validate(this.serialize(), function (err, isValid) { - // The code in here will probably be run after the `next` below this block - // and could possibly be run after the console.log("Hola") in `preTwo - if (err) return doneOne(err); - if (isValid) doneOne(); - }); - next(); // Pass control to the next middleware -}); - -// We will suppose that we need 2 different remote services to validate our document -Document.pre('save', true, function preTwo (next, doneTwo, callback) { - remoteServiceTwo.validate(this.serialize(), function (err, isValid) { - if (err) return doneTwo(err); - if (isValid) doneTwo(); - }); - next(); -}); - -// While preOne and preTwo are parallel, preThree is a serial pre middleware -Document.pre('save', function preThree (next, callback) { - next(); -}); - -var doc = new Document(); -doc.save( function (err, doc) { - // Do stuff with the saved doc here... -}); -``` - -In the above example, flow control may happen in the following way: - -(1) doc.save -> (2) preOne --(next)--> (3) preTwo --(next)--> (4) preThree --(next)--> (wait for dones to invoke) -> (5) doneTwo -> (6) doneOne -> (7) targetFn - -So what's happening is that: - -1. You call `doc.save(...)` -2. First, your preOne middleware gets executed. It makes a remote call to the validation service and `next()`s to the preTwo middleware. -3. Now, your preTwo middleware gets executed. It makes a remote call to another validation service and `next()`s to the preThree middleware. -4. Your preThree middleware gets executed. It immediately `next()`s. But nothing else gets executing until both `doneOne` and `doneTwo` are invoked inside the callbacks handling the response from the two valiation services. -5. We will suppose that validation remoteServiceTwo returns a response to us first. In this case, we call `doneTwo` inside the callback to remoteServiceTwo. -6. Some fractions of a second later, remoteServiceOne returns a response to us. In this case, we call `doneOne` inside the callback to remoteServiceOne. -7. `hooks` implementation keeps track of how many parallel middleware has been defined per target function. It detects that both asynchronous pre middlewares (`preOne` and `preTwo`) have finally called their `done` functions (`doneOne` and `doneTwo`), so the implementation finally invokes our `targetFn` (i.e., our core `save` business logic). - -## Removing Pres - -You can remove a particular pre associated with a hook: - - Document.pre('set', someFn); - Document.removePre('set', someFn); - -And you can also remove all pres associated with a hook: - Document.removePre('set'); // Removes all declared `pre`s on the hook 'set' - -## Tests -To run the tests: - make test - -### Contributors -- [Brian Noguchi](https://github.com/bnoguchi) - -### License -MIT License - ---- -### Author -Brian Noguchi diff --git a/Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js b/Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js deleted file mode 100644 index 6ced3575..00000000 --- a/Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.alt.js +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Hooks are useful if we want to add a method that automatically has `pre` and `post` hooks. - * For example, it would be convenient to have `pre` and `post` hooks for `save`. - * _.extend(Model, mixins.hooks); - * Model.hook('save', function () { - * console.log('saving'); - * }); - * Model.pre('save', function (next, done) { - * console.log('about to save'); - * next(); - * }); - * Model.post('save', function (next, done) { - * console.log('saved'); - * next(); - * }); - * - * var m = new Model(); - * m.save(); - * // about to save - * // saving - * // saved - */ - -// TODO Add in pre and post skipping options -module.exports = { - /** - * Declares a new hook to which you can add pres and posts - * @param {String} name of the function - * @param {Function} the method - * @param {Function} the error handler callback - */ - hook: function (name, fn, err) { - if (arguments.length === 1 && typeof name === 'object') { - for (var k in name) { // `name` is a hash of hookName->hookFn - this.hook(k, name[k]); - } - return; - } - - if (!err) err = fn; - - var proto = this.prototype || this - , pres = proto._pres = proto._pres || {} - , posts = proto._posts = proto._posts || {}; - pres[name] = pres[name] || []; - posts[name] = posts[name] || []; - - function noop () {} - - proto[name] = function () { - var self = this - , pres = this._pres[name] - , posts = this._posts[name] - , numAsyncPres = 0 - , hookArgs = [].slice.call(arguments) - , preChain = pres.map( function (pre, i) { - var wrapper = function () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - if (numAsyncPres) { - // arguments[1] === asyncComplete - if (arguments.length) - hookArgs = [].slice.call(arguments, 2); - pre.apply(self, - [ preChain[i+1] || allPresInvoked, - asyncComplete - ].concat(hookArgs) - ); - } else { - if (arguments.length) - hookArgs = [].slice.call(arguments); - pre.apply(self, - [ preChain[i+1] || allPresDone ].concat(hookArgs)); - } - }; // end wrapper = function () {... - if (wrapper.isAsync = pre.isAsync) - numAsyncPres++; - return wrapper; - }); // end posts.map(...) - function allPresInvoked () { - if (arguments[0] instanceof Error) - err(arguments[0]); - } - - function allPresDone () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - if (arguments.length) - hookArgs = [].slice.call(arguments); - fn.apply(self, hookArgs); - var postChain = posts.map( function (post, i) { - var wrapper = function () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - if (arguments.length) - hookArgs = [].slice.call(arguments); - post.apply(self, - [ postChain[i+1] || noop].concat(hookArgs)); - }; // end wrapper = function () {... - return wrapper; - }); // end posts.map(...) - if (postChain.length) postChain[0](); - } - - if (numAsyncPres) { - complete = numAsyncPres; - function asyncComplete () { - if (arguments[0] instanceof Error) - return err(arguments[0]); - --complete || allPresDone.call(this); - } - } - (preChain[0] || allPresDone)(); - }; - - return this; - }, - - pre: function (name, fn, isAsync) { - var proto = this.prototype - , pres = proto._pres = proto._pres || {}; - if (fn.isAsync = isAsync) { - this.prototype[name].numAsyncPres++; - } - (pres[name] = pres[name] || []).push(fn); - return this; - }, - post: function (name, fn, isAsync) { - var proto = this.prototype - , posts = proto._posts = proto._posts || {}; - (posts[name] = posts[name] || []).push(fn); - return this; - } -}; diff --git a/Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.js b/Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.js deleted file mode 100644 index 756c8337..00000000 --- a/Databases/node_modules/mongoose/node_modules/hooks-fixed/hooks.js +++ /dev/null @@ -1,191 +0,0 @@ -// TODO Add in pre and post skipping options -module.exports = { - /** - * Declares a new hook to which you can add pres and posts - * @param {String} name of the function - * @param {Function} the method - * @param {Function} the error handler callback - */ - hook: function (name, fn, errorCb) { - if (arguments.length === 1 && typeof name === 'object') { - for (var k in name) { // `name` is a hash of hookName->hookFn - this.hook(k, name[k]); - } - return; - } - - var proto = this.prototype || this - , pres = proto._pres = proto._pres || {} - , posts = proto._posts = proto._posts || {}; - pres[name] = pres[name] || []; - posts[name] = posts[name] || []; - - proto[name] = function () { - var self = this - , hookArgs // arguments eventually passed to the hook - are mutable - , lastArg = arguments[arguments.length-1] - , pres = this._pres[name] - , posts = this._posts[name] - , _total = pres.length - , _current = -1 - , _asyncsLeft = proto[name].numAsyncPres - , _asyncsDone = function(err) { - if (err) { - return handleError(err); - } - --_asyncsLeft || _done.apply(self, hookArgs); - } - , handleError = function(err) { - if ('function' == typeof lastArg) - return lastArg(err); - if (errorCb) return errorCb.call(self, err); - throw err; - } - , _next = function () { - if (arguments[0] instanceof Error) { - return handleError(arguments[0]); - } - var _args = Array.prototype.slice.call(arguments) - , currPre - , preArgs; - if (_args.length && !(arguments[0] == null && typeof lastArg === 'function')) - hookArgs = _args; - if (++_current < _total) { - currPre = pres[_current] - if (currPre.isAsync && currPre.length < 2) - throw new Error("Your pre must have next and done arguments -- e.g., function (next, done, ...)"); - if (currPre.length < 1) - throw new Error("Your pre must have a next argument -- e.g., function (next, ...)"); - preArgs = (currPre.isAsync - ? [once(_next), once(_asyncsDone)] - : [once(_next)]).concat(hookArgs); - return currPre.apply(self, preArgs); - } else if (!_asyncsLeft) { - return _done.apply(self, hookArgs); - } - } - , _done = function () { - var args_ = Array.prototype.slice.call(arguments) - , ret, total_, current_, next_, done_, postArgs; - - if (_current === _total) { - - next_ = function () { - if (arguments[0] instanceof Error) { - return handleError(arguments[0]); - } - var args_ = Array.prototype.slice.call(arguments, 1) - , currPost - , postArgs; - if (args_.length) hookArgs = args_; - if (++current_ < total_) { - currPost = posts[current_] - if (currPost.length < 1) - throw new Error("Your post must have a next argument -- e.g., function (next, ...)"); - postArgs = [once(next_)].concat(hookArgs); - return currPost.apply(self, postArgs); - } else if (typeof lastArg === 'function'){ - // All post handlers are done, call original callback function - return lastArg.apply(self, arguments); - } - }; - - // We are assuming that if the last argument provided to the wrapped function is a function, it was expecting - // a callback. We trap that callback and wait to call it until all post handlers have finished. - if(typeof lastArg === 'function'){ - args_[args_.length - 1] = once(next_); - } - - total_ = posts.length; - current_ = -1; - ret = fn.apply(self, args_); // Execute wrapped function, post handlers come afterward - - if (total_ && typeof lastArg !== 'function') return next_(); // no callback provided, execute next_() manually - return ret; - } - }; - - return _next.apply(this, arguments); - }; - - proto[name].numAsyncPres = 0; - - return this; - }, - - pre: function (name, isAsync, fn, errorCb) { - if ('boolean' !== typeof arguments[1]) { - errorCb = fn; - fn = isAsync; - isAsync = false; - } - var proto = this.prototype || this - , pres = proto._pres = proto._pres || {}; - - this._lazySetupHooks(proto, name, errorCb); - - if (fn.isAsync = isAsync) { - proto[name].numAsyncPres++; - } - - (pres[name] = pres[name] || []).push(fn); - return this; - }, - post: function (name, isAsync, fn) { - if (arguments.length === 2) { - fn = isAsync; - isAsync = false; - } - var proto = this.prototype || this - , posts = proto._posts = proto._posts || {}; - - this._lazySetupHooks(proto, name); - (posts[name] = posts[name] || []).push(fn); - return this; - }, - removePre: function (name, fnToRemove) { - var proto = this.prototype || this - , pres = proto._pres || (proto._pres || {}); - if (!pres[name]) return this; - if (arguments.length === 1) { - // Remove all pre callbacks for hook `name` - pres[name].length = 0; - } else { - pres[name] = pres[name].filter( function (currFn) { - return currFn !== fnToRemove; - }); - } - return this; - }, - removePost: function (name, fnToRemove) { - var proto = this.prototype || this - , posts = proto._posts || (proto._posts || {}); - if (!posts[name]) return this; - if (arguments.length === 1) { - // Remove all post callbacks for hook `name` - posts[name].length = 0; - } else { - posts[name] = posts[name].filter( function (currFn) { - return currFn !== fnToRemove; - }); - } - return this; - }, - - _lazySetupHooks: function (proto, methodName, errorCb) { - if ('undefined' === typeof proto[methodName].numAsyncPres) { - this.hook(methodName, proto[methodName], errorCb); - } - } -}; - -function once (fn, scope) { - return function fnWrapper () { - if (fnWrapper.hookCalled) return; - fnWrapper.hookCalled = true; - var ret = fn.apply(scope, arguments); - if (ret && ret.then) { - ret.then(function() {}, function() {}); - } - }; -} diff --git a/Databases/node_modules/mongoose/node_modules/hooks-fixed/package.json b/Databases/node_modules/mongoose/node_modules/hooks-fixed/package.json deleted file mode 100644 index c02444ad..00000000 --- a/Databases/node_modules/mongoose/node_modules/hooks-fixed/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "hooks-fixed", - "description": "Adds pre and post hook functionality to your JavaScript methods.", - "version": "1.1.0", - "keywords": [ - "node", - "hooks", - "middleware", - "pre", - "post" - ], - "homepage": "https://github.com/vkarpov15/hooks-fixed/", - "repository": { - "type": "git", - "url": "git://github.com/vkarpov15/hooks-fixed.git" - }, - "author": { - "name": "Brian Noguchi", - "email": "brian.noguchi@gmail.com", - "url": "https://github.com/bnoguchi/" - }, - "main": "./hooks.js", - "directories": { - "lib": "." - }, - "scripts": { - "test": "make test" - }, - "dependencies": {}, - "devDependencies": { - "expresso": ">=0.7.6", - "should": ">=0.2.1", - "underscore": ">=1.1.4" - }, - "engines": { - "node": ">=0.4.0" - }, - "licenses": [ - "MIT" - ], - "optionalDependencies": {}, - "gitHead": "17ef258ae58d7aa6de7cec5b57f76233a4ba1c96", - "bugs": { - "url": "https://github.com/vkarpov15/hooks-fixed/issues" - }, - "_id": "hooks-fixed@1.1.0", - "_shasum": "0e8c15336708e6611185fe390b44687dd5230dbb", - "_from": "hooks-fixed@1.1.0", - "_npmVersion": "2.9.1", - "_nodeVersion": "0.12.3", - "_npmUser": { - "name": "vkarpov15", - "email": "val@karpov.io" - }, - "dist": { - "shasum": "0e8c15336708e6611185fe390b44687dd5230dbb", - "tarball": "http://registry.npmjs.org/hooks-fixed/-/hooks-fixed-1.1.0.tgz" - }, - "maintainers": [ - { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - } - ], - "_resolved": "https://registry.npmjs.org/hooks-fixed/-/hooks-fixed-1.1.0.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/hooks-fixed/test.js b/Databases/node_modules/mongoose/node_modules/hooks-fixed/test.js deleted file mode 100644 index 81ad79ee..00000000 --- a/Databases/node_modules/mongoose/node_modules/hooks-fixed/test.js +++ /dev/null @@ -1,786 +0,0 @@ -var hooks = require('./hooks') - , should = require('should') - , assert = require('assert') - , _ = require('underscore'); - -// TODO Add in test for making sure all pres get called if pre is defined directly on an instance. -// TODO Test for calling `done` twice or `next` twice in the same function counts only once -module.exports = { - 'should be able to assign multiple hooks at once': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook({ - hook1: function (a) {}, - hook2: function (b) {} - }); - var a = new A(); - assert.equal(typeof a.hook1, 'function'); - assert.equal(typeof a.hook2, 'function'); - }, - 'should run without pres and posts when not present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - }, - 'should run with pres when present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValue = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.preValue.should.equal(2); - }, - 'should run with posts when present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.value = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(2); - }, - 'should run pres and posts when present': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValue = 2; - next(); - }); - A.post('save', function (next) { - this.value = 3; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(3); - a.preValue.should.equal(2); - }, - 'should run posts after pres': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.override = 100; - next(); - }); - A.post('save', function (next) { - this.override = 200; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.override.should.equal(200); - }, - 'should not run a hook if a pre fails': function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function () { - this.value = 1; - }, function (err) { - counter++; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save(); - counter.should.equal(1); - assert.equal(typeof a.value, 'undefined'); - }, - 'should be able to run multiple pres': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.v1 = 1; - next(); - }).pre('save', function (next) { - this.v2 = 2; - next(); - }); - var a = new A(); - a.save(); - a.v1.should.equal(1); - a.v2.should.equal(2); - }, - 'should run multiple pres until a pre fails and not call the hook': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }, function (err) {}); - A.pre('save', function (next) { - this.v1 = 1; - next(); - }).pre('save', function (next) { - next(new Error()); - }).pre('save', function (next) { - this.v3 = 3; - next(); - }); - var a = new A(); - a.save(); - a.v1.should.equal(1); - assert.equal(typeof a.v3, 'undefined'); - assert.equal(typeof a.value, 'undefined'); - }, - 'should be able to run multiple posts': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.value = 2; - next(); - }).post('save', function (next) { - this.value = 3.14; - next(); - }).post('save', function (next) { - this.v3 = 3; - next(); - }); - var a = new A(); - a.save(); - assert.equal(a.value, 3.14); - assert.equal(a.v3, 3); - }, - 'should run only posts up until an error': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }, function (err) {}); - A.post('save', function (next) { - this.value = 2; - next(); - }).post('save', function (next) { - this.value = 3; - next(new Error()); - }).post('save', function (next) { - this.value = 4; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(3); - }, - "should fall back first to the hook method's last argument as the error handler if it is a function of arity 1 or 2": function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (callback) { - this.value = 1; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save( function (err) { - if (err instanceof Error) counter++; - }); - counter.should.equal(1); - should.deepEqual(undefined, a.value); - }, - 'should fall back second to the default error handler if specified': function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (callback) { - this.value = 1; - }, function (err) { - if (err instanceof Error) counter++; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save(); - counter.should.equal(1); - should.deepEqual(undefined, a.value); - }, - 'fallback default error handler should scope to the object': function () { - var A = function () { - this.counter = 0; - }; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (callback) { - this.value = 1; - }, function (err) { - if (err instanceof Error) this.counter++; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - a.save(); - a.counter.should.equal(1); - should.deepEqual(undefined, a.value); - }, - 'should fall back last to throwing the error': function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.hook('save', function (err) { - if (err instanceof Error) return counter++; - this.value = 1; - }); - A.pre('save', true, function (next, done) { - next(new Error()); - }); - var a = new A(); - var didCatch = false; - try { - a.save(); - } catch (e) { - didCatch = true; - e.should.be.an.instanceof(Error); - counter.should.equal(0); - assert.equal(typeof a.value, 'undefined'); - } - didCatch.should.be.true; - }, - "should proceed without mutating arguments if `next(null|undefined)` is called in a serial pre, and the last argument of the target method is a callback with node-like signature function (err, obj) {...} or function (err) {...}": function () { - var A = function () {}; - _.extend(A, hooks); - var counter = 0; - A.prototype.save = function (callback) { - this.value = 1; - callback(); - }; - A.pre('save', function (next) { - next(null); - }); - A.pre('save', function (next) { - next(undefined); - }); - var a = new A(); - a.save( function (err) { - if (err instanceof Error) counter++; - else counter--; - }); - counter.should.equal(-1); - a.value.should.eql(1); - }, - "should proceed with mutating arguments if `next(null|undefined)` is callback in a serial pre, and the last argument of the target method is not a function": function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.set = function (v) { - this.value = v; - }; - A.pre('set', function (next) { - next(undefined); - }); - A.pre('set', function (next) { - next(null); - }); - var a = new A(); - a.set(1); - should.strictEqual(null, a.value); - }, - 'should not run any posts if a pre fails': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 2; - }, function (err) {}); - A.pre('save', function (next) { - this.value = 1; - next(new Error()); - }).post('save', function (next) { - this.value = 3; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - }, - - "can pass the hook's arguments verbatim to pres": function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - }); - A.pre('set', function (next, path, val) { - path.should.equal('hello'); - val.should.equal('world'); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - a.hello.should.equal('world'); - }, -// "can pass the hook's arguments as an array to pres": function () { -// // Great for dynamic arity - e.g., slice(...) -// var A = function () {}; -// _.extend(A, hooks); -// A.hook('set', function (path, val) { -// this[path] = val; -// }); -// A.pre('set', function (next, hello, world) { -// hello.should.equal('hello'); -// world.should.equal('world'); -// next(); -// }); -// var a = new A(); -// a.set('hello', 'world'); -// assert.equal(a.hello, 'world'); -// }, - "can pass the hook's arguments verbatim to posts": function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - }); - A.post('set', function (next, path, val) { - path.should.equal('hello'); - val.should.equal('world'); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - assert.equal(a.hello, 'world'); - }, -// "can pass the hook's arguments as an array to posts": function () { -// var A = function () {}; -// _.extend(A, hooks); -// A.hook('set', function (path, val) { -// this[path] = val; -// }); -// A.post('set', function (next, halt, args) { -// assert.equal(args[0], 'hello'); -// assert.equal(args[1], 'world'); -// next(); -// }); -// var a = new A(); -// a.set('hello', 'world'); -// assert.equal(a.hello, 'world'); -// }, - "pres should be able to modify and pass on a modified version of the hook's arguments": function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - assert.equal(arguments[2], 'optional'); - }); - A.pre('set', function (next, path, val) { - next('foo', 'bar'); - }); - A.pre('set', function (next, path, val) { - assert.equal(path, 'foo'); - assert.equal(val, 'bar'); - next('rock', 'says', 'optional'); - }); - A.pre('set', function (next, path, val, opt) { - assert.equal(path, 'rock'); - assert.equal(val, 'says'); - assert.equal(opt, 'optional'); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - assert.equal(typeof a.hello, 'undefined'); - a.rock.should.equal('says'); - }, - 'posts should see the modified version of arguments if the pres modified them': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - }); - A.pre('set', function (next, path, val) { - next('foo', 'bar'); - }); - A.post('set', function (next, path, val) { - path.should.equal('foo'); - val.should.equal('bar'); - }); - var a = new A(); - a.set('hello', 'world'); - assert.equal(typeof a.hello, 'undefined'); - a.foo.should.equal('bar'); - }, - 'should pad missing arguments (relative to expected arguments of the hook) with null': function () { - // Otherwise, with hookFn = function (a, b, next, ), - // if we use hookFn(a), then because the pre functions are of the form - // preFn = function (a, b, next, ), then it actually gets executed with - // preFn(a, next, ), so when we call next() from within preFn, we are actually - // calling () - - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val, opts) { - this[path] = val; - }); - A.pre('set', function (next, path, val, opts) { - next('foo', 'bar'); - assert.equal(typeof opts, 'undefined'); - }); - var a = new A(); - a.set('hello', 'world'); - }, - - 'should not invoke the target method until all asynchronous middleware have invoked dones': function () { - var counter = 0; - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - counter++; - this[path] = val; - counter.should.equal(7); - }); - A.pre('set', function (next, path, val) { - counter++; - next(); - }); - A.pre('set', true, function (next, done, path, val) { - counter++; - setTimeout(function () { - counter++; - done(); - }, 1000); - next(); - }); - A.pre('set', function (next, path, val) { - counter++; - next(); - }); - A.pre('set', true, function (next, done, path, val) { - counter++; - setTimeout(function () { - counter++; - done(); - }, 500); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - }, - - 'invoking a method twice should run its async middleware twice': function () { - var counter = 0; - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val) { - this[path] = val; - if (path === 'hello') counter.should.equal(1); - if (path === 'foo') counter.should.equal(2); - }); - A.pre('set', true, function (next, done, path, val) { - setTimeout(function () { - counter++; - done(); - }, 1000); - next(); - }); - var a = new A(); - a.set('hello', 'world'); - a.set('foo', 'bar'); - }, - - 'calling the same done multiple times should have the effect of only calling it once': function () { - var A = function () { - this.acked = false; - }; - _.extend(A, hooks); - A.hook('ack', function () { - console.log("UH OH, YOU SHOULD NOT BE SEEING THIS"); - this.acked = true; - }); - A.pre('ack', true, function (next, done) { - next(); - done(); - done(); - }); - A.pre('ack', true, function (next, done) { - next(); - // Notice that done() is not invoked here - }); - var a = new A(); - a.ack(); - setTimeout( function () { - a.acked.should.be.false; - }, 1000); - }, - - 'calling the same next multiple times should have the effect of only calling it once': function (beforeExit) { - var A = function () { - this.acked = false; - }; - _.extend(A, hooks); - A.hook('ack', function () { - console.log("UH OH, YOU SHOULD NOT BE SEEING THIS"); - this.acked = true; - }); - A.pre('ack', function (next) { - // force a throw to re-exec next() - try { - next(new Error('bam')); - } catch (err) { - next(); - } - }); - A.pre('ack', function (next) { - next(); - }); - var a = new A(); - a.ack(); - beforeExit( function () { - a.acked.should.be.false; - }); - }, - - 'asynchronous middleware should be able to pass an error via `done`, stopping the middleware chain': function () { - var counter = 0; - var A = function () {}; - _.extend(A, hooks); - A.hook('set', function (path, val, fn) { - counter++; - this[path] = val; - fn(null); - }); - A.pre('set', true, function (next, done, path, val, fn) { - setTimeout(function () { - counter++; - done(new Error); - }, 1000); - next(); - }); - var a = new A(); - a.set('hello', 'world', function (err) { - err.should.be.an.instanceof(Error); - should.strictEqual(undefined, a['hello']); - counter.should.eql(1); - }); - }, - - 'should be able to remove a particular pre': function () { - var A = function () {} - , preTwo; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValueOne = 2; - next(); - }); - A.pre('save', preTwo = function (next) { - this.preValueTwo = 4; - next(); - }); - A.removePre('save', preTwo); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.preValueOne.should.equal(2); - should.strictEqual(undefined, a.preValueTwo); - }, - - 'should be able to remove all pres associated with a hook': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.pre('save', function (next) { - this.preValueOne = 2; - next(); - }); - A.pre('save', function (next) { - this.preValueTwo = 4; - next(); - }); - A.removePre('save'); - var a = new A(); - a.save(); - a.value.should.equal(1); - should.strictEqual(undefined, a.preValueOne); - should.strictEqual(undefined, a.preValueTwo); - }, - - 'should be able to remove a particular post': function () { - var A = function () {} - , postTwo; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.postValueOne = 2; - next(); - }); - A.post('save', postTwo = function (next) { - this.postValueTwo = 4; - next(); - }); - A.removePost('save', postTwo); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.postValueOne.should.equal(2); - should.strictEqual(undefined, a.postValueTwo); - }, - - 'should be able to remove all posts associated with a hook': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function () { - this.value = 1; - }); - A.post('save', function (next) { - this.postValueOne = 2; - next(); - }); - A.post('save', function (next) { - this.postValueTwo = 4; - next(); - }); - A.removePost('save'); - var a = new A(); - a.save(); - a.value.should.equal(1); - should.strictEqual(undefined, a.postValueOne); - should.strictEqual(undefined, a.postValueTwo); - }, - - '#pre should lazily make a method hookable': function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.save = function () { - this.value = 1; - }; - A.pre('save', function (next) { - this.preValue = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(1); - a.preValue.should.equal(2); - }, - - '#pre lazily making a method hookable should be able to provide a default errorHandler as the last argument': function () { - var A = function () {}; - var preValue = ""; - _.extend(A, hooks); - A.prototype.save = function () { - this.value = 1; - }; - A.pre('save', function (next) { - next(new Error); - }, function (err) { - preValue = 'ERROR'; - }); - var a = new A(); - a.save(); - should.strictEqual(undefined, a.value); - preValue.should.equal('ERROR'); - }, - - '#post should lazily make a method hookable': function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.save = function () { - this.value = 1; - }; - A.post('save', function (next) { - this.value = 2; - next(); - }); - var a = new A(); - a.save(); - a.value.should.equal(2); - }, - - "a lazy hooks setup should handle errors via a method's last argument, if it's a callback": function () { - var A = function () {}; - _.extend(A, hooks); - A.prototype.save = function (fn) {}; - A.pre('save', function (next) { - next(new Error("hi there")); - }); - var a = new A(); - a.save( function (err) { - err.should.be.an.instanceof(Error); - }); - }, - - 'should intercept method callbacks for post handlers': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function (val, callback) { - this.value = val; - callback(); - }); - A.post('save', function (next) { - assert.equal(a.value, 2); - this.value += 2; - setTimeout(next, 10); - }).post('save', function (next) { - assert.equal(a.value, 4); - this.value += 3; - setTimeout(next, 10); - }).post('save', function (next) { - assert.equal(a.value, 7); - this.value2 = 3; - setTimeout(next, 10); - }); - var a = new A(); - a.save(2, function(){ - assert.equal(a.value, 7); - assert.equal(a.value2, 3); - }); - }, - - 'should handle parallel followed by serial': function () { - var A = function () {}; - _.extend(A, hooks); - A.hook('save', function (val, callback) { - this.value = val; - callback(); - }); - A.pre('save', true, function(next, done) { - process.nextTick(function() { - done(); - }); - next(); - }).pre('save', function(done) { - process.nextTick(function() { - done(); - }); - }); - var a = new A(); - a.save(2, function(){ - assert.ok(true); - }); - } -}; diff --git a/Databases/node_modules/mongoose/node_modules/kareem/.npmignore b/Databases/node_modules/mongoose/node_modules/kareem/.npmignore deleted file mode 100644 index 59d842ba..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/.npmignore +++ /dev/null @@ -1,28 +0,0 @@ -# Logs -logs -*.log - -# Runtime data -pids -*.pid -*.seed - -# Directory for instrumented libs generated by jscoverage/JSCover -lib-cov - -# Coverage directory used by tools like istanbul -coverage - -# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) -.grunt - -# Compiled binary addons (http://nodejs.org/api/addons.html) -build/Release - -# Dependency directory -# Commenting this out is preferred by some people, see -# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git- -node_modules - -# Users Environment Variables -.lock-wscript diff --git a/Databases/node_modules/mongoose/node_modules/kareem/.travis.yml b/Databases/node_modules/mongoose/node_modules/kareem/.travis.yml deleted file mode 100644 index 9aa82225..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - "0.12" - - "0.10" - - "iojs" -script: "npm run-script test-travis" -after_script: "npm install coveralls@2.10.0 && cat ./coverage/lcov.info | coveralls" diff --git a/Databases/node_modules/mongoose/node_modules/kareem/LICENSE b/Databases/node_modules/mongoose/node_modules/kareem/LICENSE deleted file mode 100644 index e06d2081..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - diff --git a/Databases/node_modules/mongoose/node_modules/kareem/Makefile b/Databases/node_modules/mongoose/node_modules/kareem/Makefile deleted file mode 100644 index f71ba900..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/Makefile +++ /dev/null @@ -1,5 +0,0 @@ -docs: - node ./docs.js - -coverage: - ./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec ./test/* diff --git a/Databases/node_modules/mongoose/node_modules/kareem/README.md b/Databases/node_modules/mongoose/node_modules/kareem/README.md deleted file mode 100644 index 7d2dc84b..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/README.md +++ /dev/null @@ -1,379 +0,0 @@ -# kareem - - [![Build Status](https://travis-ci.org/vkarpov15/kareem.svg?branch=master)](https://travis-ci.org/vkarpov15/kareem) - [![Coverage Status](https://img.shields.io/coveralls/vkarpov15/kareem.svg)](https://coveralls.io/r/vkarpov15/kareem) - -Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, meant to offer additional flexibility in allowing you to execute hooks whenever necessary, as opposed to simply wrapping a single function. - -Named for the NBA's all-time leading scorer Kareem Abdul-Jabbar, known for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook) - - - -# API - -## pre hooks - -Much like [hooks](https://npmjs.org/package/hooks), kareem lets you define -pre and post hooks: pre hooks are called before a given function executes. -Unlike hooks, kareem stores hooks and other internal state in a separate -object, rather than relying on inheritance. Furthermore, kareem exposes -an `execPre()` function that allows you to execute your pre hooks when -appropriate, giving you more fine-grained control over your function hooks. - - -#### It runs without any hooks specified - -```javascript - - hooks.execPre('cook', null, function() { - done(); - }); - -``` - -#### It runs basic serial pre hooks - -pre hook functions take one parameter, a "done" function that you execute -when your pre hook is finished. - - -```javascript - - var count = 0; - - hooks.pre('cook', function(done) { - ++count; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count); - done(); - }); - -``` - -#### It can run multipe pre hooks - -```javascript - - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function(done) { - ++count1; - done(); - }); - - hooks.pre('cook', function(done) { - ++count2; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - -``` - -#### It can run fully synchronous pre hooks - -If your pre hook function takes no parameters, its assumed to be -fully synchronous. - - -```javascript - - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function() { - ++count1; - }); - - hooks.pre('cook', function() { - ++count2; - }); - - hooks.execPre('cook', null, function(error) { - assert.equal(null, error); - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - -``` - -#### It properly attaches context to pre hooks - -Pre save hook functions are bound to the second parameter to `execPre()` - - -```javascript - - hooks.pre('cook', function(done) { - this.bacon = 3; - done(); - }); - - hooks.pre('cook', function(done) { - this.eggs = 4; - done(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - // In the pre hooks, `this` will refer to `obj` - hooks.execPre('cook', obj, function(error) { - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - done(); - }); - -``` - -#### It can execute parallel (async) pre hooks - -Like the hooks module, you can declare "async" pre hooks - these take two -parameters, the functions `next()` and `done()`. `next()` passes control to -the next pre hook, but the underlying function won't be called until all -async pre hooks have called `done()`. - - -```javascript - - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - hooks.execPre('cook', obj, function() { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - done(); - }); - -``` - -## post hooks - -#### It runs without any hooks specified - -```javascript - - hooks.execPost('cook', null, [1], function(error, eggs) { - assert.ifError(error); - assert.equal(1, eggs); - done(); - }); - -``` - -#### It executes with parameters passed in - -```javascript - - hooks.post('cook', function(eggs, bacon, callback) { - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - -``` - -#### It can use synchronous post hooks - -```javascript - - var execed = {}; - - hooks.post('cook', function(eggs, bacon) { - execed.first = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - }); - - hooks.post('cook', function(eggs, bacon, callback) { - execed.second = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - -``` - -## wrap() - -#### It wraps pre and post calls into one call - -```javascript - - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.ifError(error); - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj, - args); - -``` - -## createWrapper() - -#### It wraps wrap() into a callable function - -```javascript - - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var cook = hooks.createWrapper( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj); - - cook(obj, function(error, result) { - assert.ifError(error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - -``` - -## clone() - -#### It clones a Kareem object - -```javascript - - var k1 = new Kareem(); - k1.pre('cook', function() {}); - k1.post('cook', function() {}); - - var k2 = k1.clone(); - assert.deepEqual(['cook'], Object.keys(k2._pres)); - assert.deepEqual(['cook'], Object.keys(k2._posts)); - -``` - diff --git a/Databases/node_modules/mongoose/node_modules/kareem/docs.js b/Databases/node_modules/mongoose/node_modules/kareem/docs.js deleted file mode 100644 index 4a8d4c89..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/docs.js +++ /dev/null @@ -1,37 +0,0 @@ -var acquit = require('acquit'); - -var content = require('fs').readFileSync('./test/examples.test.js').toString(); -var blocks = acquit.parse(content); - -var mdOutput = - '# kareem\n\n' + - ' [![Build Status](https://travis-ci.org/vkarpov15/kareem.svg?branch=master)](https://travis-ci.org/vkarpov15/kareem)\n' + - ' [![Coverage Status](https://img.shields.io/coveralls/vkarpov15/kareem.svg)](https://coveralls.io/r/vkarpov15/kareem)\n\n' + - 'Re-imagined take on the [hooks](http://npmjs.org/package/hooks) module, ' + - 'meant to offer additional flexibility in allowing you to execute hooks ' + - 'whenever necessary, as opposed to simply wrapping a single function.\n\n' + - 'Named for the NBA\'s all-time leading scorer Kareem Abdul-Jabbar, known ' + - 'for his mastery of the [hook shot](http://en.wikipedia.org/wiki/Kareem_Abdul-Jabbar#Skyhook)\n\n' + - '\n\n' + - '# API\n\n'; - -for (var i = 0; i < blocks.length; ++i) { - var describe = blocks[i]; - mdOutput += '## ' + describe.contents + '\n\n'; - mdOutput += describe.comments[0] ? - acquit.trimEachLine(describe.comments[0]) + '\n\n' : - ''; - - for (var j = 0; j < describe.blocks.length; ++j) { - var it = describe.blocks[j]; - mdOutput += '#### It ' + it.contents + '\n\n'; - mdOutput += it.comments[0] ? - acquit.trimEachLine(it.comments[0]) + '\n\n' : - ''; - mdOutput += '```javascript\n'; - mdOutput += ' ' + it.code + '\n'; - mdOutput += '```\n\n'; - } -} - -require('fs').writeFileSync('README.md', mdOutput); diff --git a/Databases/node_modules/mongoose/node_modules/kareem/gulpfile.js b/Databases/node_modules/mongoose/node_modules/kareem/gulpfile.js deleted file mode 100644 index 635bfc75..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/gulpfile.js +++ /dev/null @@ -1,18 +0,0 @@ -var gulp = require('gulp'); -var mocha = require('gulp-mocha'); -var config = require('./package.json'); -var jscs = require('gulp-jscs'); - -gulp.task('mocha', function() { - return gulp.src('./test/*'). - pipe(mocha({ reporter: 'dot' })); -}); - -gulp.task('jscs', function() { - return gulp.src('./index.js'). - pipe(jscs(config.jscsConfig)); -}); - -gulp.task('watch', function() { - gulp.watch('./index.js', ['jscs', 'mocha']); -}); diff --git a/Databases/node_modules/mongoose/node_modules/kareem/index.js b/Databases/node_modules/mongoose/node_modules/kareem/index.js deleted file mode 100644 index b4b071be..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/index.js +++ /dev/null @@ -1,229 +0,0 @@ -'use strict'; - -function Kareem() { - this._pres = {}; - this._posts = {}; -} - -Kareem.prototype.execPre = function(name, context, callback) { - var pres = this._pres[name] || []; - var numPres = pres.length; - var numAsyncPres = pres.numAsync || 0; - var currentPre = 0; - var asyncPresLeft = numAsyncPres; - var done = false; - - if (!numPres) { - return process.nextTick(function() { - callback(null); - }); - } - - var next = function() { - if (currentPre >= numPres) { - return; - } - var pre = pres[currentPre]; - - if (pre.isAsync) { - pre.fn.call( - context, - function(error) { - if (error) { - if (done) { - return; - } - done = true; - return callback(error); - } - - ++currentPre; - next.apply(context, arguments); - }, - function(error) { - if (error) { - if (done) { - return; - } - done = true; - return callback(error); - } - - if (--numAsyncPres === 0) { - return callback(null); - } - }); - } else if (pre.fn.length > 0) { - var args = [function(error) { - if (error) { - if (done) { - return; - } - done = true; - return callback(error); - } - - if (++currentPre >= numPres) { - if (asyncPresLeft > 0) { - // Leave parallel hooks to run - return; - } else { - return callback(null); - } - } - - next.apply(context, arguments); - }]; - if (arguments.length >= 2) { - for (var i = 1; i < arguments.length; ++i) { - args.push(arguments[i]); - } - } - pre.fn.apply(context, args); - } else { - pre.fn.call(context); - if (++currentPre >= numPres) { - if (asyncPresLeft > 0) { - // Leave parallel hooks to run - return; - } else { - return process.nextTick(function() { - callback(null); - }); - } - } - next(); - } - }; - - next(); -}; - -Kareem.prototype.execPost = function(name, context, args, callback) { - var posts = this._posts[name] || []; - var numPosts = posts.length; - var currentPost = 0; - - if (!numPosts) { - return process.nextTick(function() { - callback.apply(null, [null].concat(args)); - }); - } - - var next = function() { - var post = posts[currentPost]; - - if (post.length > args.length) { - post.apply(context, args.concat(function(error) { - if (error) { - return callback(error); - } - - if (++currentPost >= numPosts) { - return callback.apply(null, [null].concat(args)); - } - - next(); - })); - } else { - post.apply(context, args); - - if (++currentPost >= numPosts) { - return callback.apply(null, [null].concat(args)); - } - - next(); - } - }; - - next(); -}; - -Kareem.prototype.wrap = function(name, fn, context, args, useLegacyPost) { - var lastArg = (args.length > 0 ? args[args.length - 1] : null); - var _this = this; - - this.execPre(name, context, function(error) { - if (error) { - if (typeof lastArg === 'function') { - return lastArg(error); - } - return; - } - - var end = (typeof lastArg === 'function' ? args.length - 1 : args.length); - - fn.apply(context, args.slice(0, end).concat(function() { - if (arguments[0]) { - // Assume error - return typeof lastArg === 'function' ? - lastArg(arguments[0]) : - undefined; - } - - if (useLegacyPost && typeof lastArg === 'function') { - lastArg.apply(context, arguments); - } - - var argsWithoutError = Array.prototype.slice.call(arguments, 1); - _this.execPost(name, context, argsWithoutError, function() { - if (arguments[0]) { - return typeof lastArg === 'function' ? - lastArg(arguments[0]) : - undefined; - } - - return typeof lastArg === 'function' && !useLegacyPost ? - lastArg.apply(context, arguments) : - undefined; - }); - })); - }); -}; - -Kareem.prototype.createWrapper = function(name, fn, context) { - var _this = this; - return function() { - var args = Array.prototype.slice.call(arguments); - _this.wrap(name, fn, context, args); - }; -}; - -Kareem.prototype.pre = function(name, isAsync, fn, error) { - if (typeof arguments[1] !== 'boolean') { - error = fn; - fn = isAsync; - isAsync = false; - } - - this._pres[name] = this._pres[name] || []; - var pres = this._pres[name]; - - if (isAsync) { - pres.numAsync = pres.numAsync || 0; - ++pres.numAsync; - } - - pres.push({ fn: fn, isAsync: isAsync }); - - return this; -}; - -Kareem.prototype.post = function(name, fn) { - (this._posts[name] = this._posts[name] || []).push(fn); - return this; -}; - -Kareem.prototype.clone = function() { - var n = new Kareem(); - for (var key in this._pres) { - n._pres[key] = this._pres[key].slice(); - } - for (var key in this._posts) { - n._posts[key] = this._posts[key].slice(); - } - - return n; -}; - -module.exports = Kareem; diff --git a/Databases/node_modules/mongoose/node_modules/kareem/package.json b/Databases/node_modules/mongoose/node_modules/kareem/package.json deleted file mode 100644 index a7226888..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "name": "kareem", - "version": "1.0.1", - "description": "Next-generation take on pre/post function hooks", - "main": "index.js", - "scripts": { - "test": "./node_modules/mocha/bin/mocha ./test/*", - "test-travis": "./node_modules/istanbul/lib/cli.js cover ./node_modules/mocha/bin/_mocha -- -R spec ./test/*" - }, - "repository": { - "type": "git", - "url": "git://github.com/vkarpov15/kareem.git" - }, - "devDependencies": { - "acquit": "0.0.3", - "gulp": "3.8.10", - "gulp-mocha": "2.0.0", - "gulp-jscs": "1.4.0", - "istanbul": "0.3.5", - "jscs": "1.9.0", - "mocha": "2.0.0" - }, - "jscsConfig": { - "preset": "airbnb", - "requireMultipleVarDecl": null, - "disallowMultipleVarDecl": true - }, - "author": { - "name": "Valeri Karpov", - "email": "val@karpov.io" - }, - "license": "Apache 2.0", - "gitHead": "69710887f85dee09afac690df770dd2febde7268", - "bugs": { - "url": "https://github.com/vkarpov15/kareem/issues" - }, - "homepage": "https://github.com/vkarpov15/kareem", - "_id": "kareem@1.0.1", - "_shasum": "7805d215bb53214ec3af969a1d0b1f17e3e7b95c", - "_from": "kareem@1.0.1", - "_npmVersion": "2.7.4", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - }, - "maintainers": [ - { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - } - ], - "dist": { - "shasum": "7805d215bb53214ec3af969a1d0b1f17e3e7b95c", - "tarball": "http://registry.npmjs.org/kareem/-/kareem-1.0.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/kareem/-/kareem-1.0.1.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/kareem/test/examples.test.js b/Databases/node_modules/mongoose/node_modules/kareem/test/examples.test.js deleted file mode 100644 index 96d2fb8f..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/test/examples.test.js +++ /dev/null @@ -1,339 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -/* Much like [hooks](https://npmjs.org/package/hooks), kareem lets you define - * pre and post hooks: pre hooks are called before a given function executes. - * Unlike hooks, kareem stores hooks and other internal state in a separate - * object, rather than relying on inheritance. Furthermore, kareem exposes - * an `execPre()` function that allows you to execute your pre hooks when - * appropriate, giving you more fine-grained control over your function hooks. - */ -describe('pre hooks', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('runs without any hooks specified', function(done) { - hooks.execPre('cook', null, function() { - done(); - }); - }); - - /* pre hook functions take one parameter, a "done" function that you execute - * when your pre hook is finished. - */ - it('runs basic serial pre hooks', function(done) { - var count = 0; - - hooks.pre('cook', function(done) { - ++count; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count); - done(); - }); - }); - - it('can run multipe pre hooks', function(done) { - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function(done) { - ++count1; - done(); - }); - - hooks.pre('cook', function(done) { - ++count2; - done(); - }); - - hooks.execPre('cook', null, function() { - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - }); - - /* If your pre hook function takes no parameters, its assumed to be - * fully synchronous. - */ - it('can run fully synchronous pre hooks', function(done) { - var count1 = 0; - var count2 = 0; - - hooks.pre('cook', function() { - ++count1; - }); - - hooks.pre('cook', function() { - ++count2; - }); - - hooks.execPre('cook', null, function(error) { - assert.equal(null, error); - assert.equal(1, count1); - assert.equal(1, count2); - done(); - }); - }); - - /* Pre save hook functions are bound to the second parameter to `execPre()` - */ - it('properly attaches context to pre hooks', function(done) { - hooks.pre('cook', function(done) { - this.bacon = 3; - done(); - }); - - hooks.pre('cook', function(done) { - this.eggs = 4; - done(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - // In the pre hooks, `this` will refer to `obj` - hooks.execPre('cook', obj, function(error) { - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - done(); - }); - }); - - /* Like the hooks module, you can declare "async" pre hooks - these take two - * parameters, the functions `next()` and `done()`. `next()` passes control to - * the next pre hook, but the underlying function won't be called until all - * async pre hooks have called `done()`. - */ - it('can execute parallel (async) pre hooks', function(done) { - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - hooks.execPre('cook', obj, function() { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - done(); - }); - }); -}); - -describe('post hooks', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('runs without any hooks specified', function(done) { - hooks.execPost('cook', null, [1], function(error, eggs) { - assert.ifError(error); - assert.equal(1, eggs); - done(); - }); - }); - - it('executes with parameters passed in', function(done) { - hooks.post('cook', function(eggs, bacon, callback) { - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - }); - - it('can use synchronous post hooks', function(done) { - var execed = {}; - - hooks.post('cook', function(eggs, bacon) { - execed.first = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - }); - - hooks.post('cook', function(eggs, bacon, callback) { - execed.second = true; - assert.equal(1, eggs); - assert.equal(2, bacon); - callback(); - }); - - hooks.execPost('cook', null, [1, 2], function(error, eggs, bacon) { - assert.ifError(error); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - assert.equal(1, eggs); - assert.equal(2, bacon); - done(); - }); - }); -}); - -describe('wrap()', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('wraps pre and post calls into one call', function(done) { - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.ifError(error); - assert.equal(null, error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj, - args); - }); -}); - -describe('createWrapper()', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('wraps wrap() into a callable function', function(done) { - hooks.pre('cook', true, function(next, done) { - this.bacon = 3; - next(); - setTimeout(function() { - done(); - }, 5); - }); - - hooks.pre('cook', true, function(next, done) { - next(); - var _this = this; - setTimeout(function() { - _this.eggs = 4; - done(); - }, 10); - }); - - hooks.pre('cook', function(next) { - this.waffles = false; - next(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var cook = hooks.createWrapper( - 'cook', - function(o, callback) { - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - callback(null, o); - }, - obj); - - cook(obj, function(error, result) { - assert.ifError(error); - assert.equal(3, obj.bacon); - assert.equal(4, obj.eggs); - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - - assert.equal(obj, result); - done(); - }); - }); -}); - -describe('clone()', function() { - it('clones a Kareem object', function() { - var k1 = new Kareem(); - k1.pre('cook', function() {}); - k1.post('cook', function() {}); - - var k2 = k1.clone(); - assert.deepEqual(['cook'], Object.keys(k2._pres)); - assert.deepEqual(['cook'], Object.keys(k2._posts)); - }); -}); diff --git a/Databases/node_modules/mongoose/node_modules/kareem/test/post.test.js b/Databases/node_modules/mongoose/node_modules/kareem/test/post.test.js deleted file mode 100644 index 3df0ec59..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/test/post.test.js +++ /dev/null @@ -1,46 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -describe('execPost', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('handles errors', function(done) { - hooks.post('cook', function(eggs, callback) { - callback('error!'); - }); - - hooks.execPost('cook', null, [4], function(error, eggs) { - assert.equal('error!', error); - assert.ok(!eggs); - done(); - }); - }); - - it('multiple posts', function(done) { - hooks.post('cook', function(eggs, callback) { - setTimeout( - function() { - callback(); - }, - 5); - }); - - hooks.post('cook', function(eggs, callback) { - setTimeout( - function() { - callback(); - }, - 5); - }); - - hooks.execPost('cook', null, [4], function(error, eggs) { - assert.ifError(error); - assert.equal(4, eggs); - done(); - }); - }); -}); \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/kareem/test/pre.test.js b/Databases/node_modules/mongoose/node_modules/kareem/test/pre.test.js deleted file mode 100644 index 4c1a212a..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/test/pre.test.js +++ /dev/null @@ -1,226 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -describe('execPre', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('handles errors with multiple pres', function(done) { - var execed = {}; - - hooks.pre('cook', function(done) { - execed.first = true; - done(); - }); - - hooks.pre('cook', function(done) { - execed.second = true; - done('error!'); - }); - - hooks.pre('cook', function(done) { - execed.third = true; - done(); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('handles async errors', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('error!'); - }, - 5); - - next(); - }); - - hooks.pre('cook', true, function(next, done) { - execed.second = true; - setTimeout( - function() { - done('other error!'); - }, - 10); - - next(); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('handles async errors in next()', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('other error!'); - }, - 15); - - next(); - }); - - hooks.pre('cook', true, function(next, done) { - execed.second = true; - setTimeout( - function() { - next('error!'); - done('another error!'); - }, - 5); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('handles async errors in next() when already done', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('other error!'); - }, - 5); - - next(); - }); - - hooks.pre('cook', true, function(next, done) { - execed.second = true; - setTimeout( - function() { - next('error!'); - done('another error!'); - }, - 25); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('other error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('returns correct error when async pre errors', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done('other error!'); - }, - 5); - - next(); - }); - - hooks.pre('cook', function(next) { - execed.second = true; - setTimeout( - function() { - next('error!'); - }, - 15); - }); - - hooks.execPre('cook', null, function(err) { - assert.equal('other error!', err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('lets async pres run when fully sync pres are done', function(done) { - var execed = {}; - - hooks.pre('cook', true, function(next, done) { - execed.first = true; - setTimeout( - function() { - done(); - }, - 5); - - next(); - }); - - hooks.pre('cook', function() { - execed.second = true; - }); - - hooks.execPre('cook', null, function(err) { - assert.ifError(err); - assert.equal(2, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - done(); - }); - }); - - it('allows passing arguments to the next pre', function(done) { - var execed = {}; - - hooks.pre('cook', function(next) { - execed.first = true; - next(null, 'test'); - }); - - hooks.pre('cook', function(next, p) { - execed.second = true; - assert.equal(p, 'test'); - next(); - }); - - hooks.pre('cook', function(next, p) { - execed.third = true; - assert.ok(!p); - next(); - }); - - hooks.execPre('cook', null, function(err) { - assert.ifError(err); - assert.equal(3, Object.keys(execed).length); - assert.ok(execed.first); - assert.ok(execed.second); - assert.ok(execed.third); - done(); - }); - }); -}); diff --git a/Databases/node_modules/mongoose/node_modules/kareem/test/wrap.test.js b/Databases/node_modules/mongoose/node_modules/kareem/test/wrap.test.js deleted file mode 100644 index 3303961a..00000000 --- a/Databases/node_modules/mongoose/node_modules/kareem/test/wrap.test.js +++ /dev/null @@ -1,277 +0,0 @@ -var assert = require('assert'); -var Kareem = require('../'); - -describe('wrap()', function() { - var hooks; - - beforeEach(function() { - hooks = new Kareem(); - }); - - it('handles pre errors', function(done) { - hooks.pre('cook', function(done) { - done('error!'); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.equal('error!', error); - assert.ok(!result); - assert.equal(undefined, obj.tofu); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - // Should never get called - assert.ok(false); - callback(null, o); - }, - obj, - args); - }); - - it('handles pre errors when no callback defined', function(done) { - hooks.pre('cook', function(done) { - done('error!'); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - - hooks.wrap( - 'cook', - function(o, callback) { - // Should never get called - assert.ok(false); - callback(null, o); - }, - obj, - args); - - setTimeout( - function() { - done(); - }, - 25); - }); - - it('handles errors in wrapped function', function(done) { - hooks.pre('cook', function(done) { - done(); - }); - - hooks.post('cook', function(obj) { - obj.tofu = 'no'; - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.equal('error!', error); - assert.ok(!result); - assert.equal(undefined, obj.tofu); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - callback('error!'); - }, - obj, - args); - }); - - it('handles errors in post', function(done) { - hooks.pre('cook', function(done) { - done(); - }); - - hooks.post('cook', function(obj, callback) { - obj.tofu = 'no'; - callback('error!'); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = [obj]; - args.push(function(error, result) { - assert.equal('error!', error); - assert.ok(!result); - assert.equal('no', obj.tofu); - done(); - }); - - hooks.wrap( - 'cook', - function(o, callback) { - callback(null, o); - }, - obj, - args); - }); - - it('works with no args', function(done) { - hooks.pre('cook', function(done) { - done(); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback(null); - }, - obj, - args); - - setTimeout( - function() { - assert.equal('no', obj.tofu); - done(); - }, - 25); - }); - - it('handles pre errors with no args', function(done) { - hooks.pre('cook', function(done) { - done('error!'); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback(null); - }, - obj, - args); - - setTimeout( - function() { - assert.equal(undefined, obj.tofu); - done(); - }, - 25); - }); - - it('handles wrapped function errors with no args', function(done) { - hooks.pre('cook', function(done) { - obj.waffles = false; - done(); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback(); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback('error!'); - }, - obj, - args); - - setTimeout( - function() { - assert.equal(false, obj.waffles); - assert.equal(undefined, obj.tofu); - done(); - }, - 25); - }); - - it('handles post errors with no args', function(done) { - hooks.pre('cook', function(done) { - obj.waffles = false; - done(); - }); - - hooks.post('cook', function(callback) { - obj.tofu = 'no'; - callback('error!'); - }); - - var obj = { bacon: 0, eggs: 0 }; - - var args = []; - - hooks.wrap( - 'cook', - function(callback) { - callback(); - }, - obj, - args); - - setTimeout( - function() { - assert.equal(false, obj.waffles); - assert.equal('no', obj.tofu); - done(); - }, - 25); - }); - - it('can use legacy post behavior', function(done) { - var called = 0; - hooks.post('cook', function(callback) { - ++called; - callback(); - }); - - var args = [function(error) { - assert.equal(called, 0); - - setTimeout(function() { - assert.equal(called, 1); - done(); - }, 0); - }]; - - hooks.wrap( - 'cook', - function(callback) { - callback(); - }, - null, - args, - true); - }); -}); \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/HISTORY.md b/Databases/node_modules/mongoose/node_modules/mongodb/HISTORY.md deleted file mode 100644 index 4d8fd758..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/HISTORY.md +++ /dev/null @@ -1,1218 +0,0 @@ -2.0.45 09-30-2015 ------------------ -* NODE-566 Fix issue with rewind on capped collections causing cursor state to be reset on connection loss. - -2.0.44 09-28-2015 ------------------ -* Bug fixes for APM upconverting of legacy INSERT/UPDATE/REMOVE wire protocol messages. -* NODE-562, fixed issue where a Replicaset MongoDB URI with a single seed and replSet name set would cause a single direct connection instead of topology discovery. -* Updated mongodb-core to 1.2.14. -* NODE-563 Introduced options.ignoreUndefined for db class and MongoClient db options, made serialize undefined to null default again but allowing for overrides on insert/update/delete operations. -* Use handleCallback if result is an error for count queries. (Issue #1298, https://github.com/agclever) -* Rewind cursor to correctly force reconnect on capped collections when first query comes back empty. -* NODE-571 added code 59 to legacy server errors when SCRAM-SHA-1 mechanism fails. -* NODE-572 Remove examples that use the second parameter to `find()`. - -2.0.43 09-14-2015 ------------------ -* Propagate timeout event correctly to db instances. -* Application Monitoring API (APM) implemented. -* NOT providing replSet name in MongoClient connection URI will force single server connection. Fixes issue where it was impossible to directly connect to a replicaset member server. -* Updated mongodb-core to 1.2.12. -* NODE-541 Initial Support "read committed" isolation level where "committed" means confimed by the voting majority of a replica set. -* GridStore doesn't share readPreference setting from connection string. (Issue #1295, https://github.com/zhangyaoxing) -* fixed forceServerObjectId calls (Issue #1292, https://github.com/d-mon-) -* Pass promise library through to DB function (Issue #1294, https://github.com/RovingCodeMonkey) - -2.0.42 08-18-2015 ------------------ -* Added test case to exercise all non-crud methods on mongos topologies, fixed numberOfConnectedServers on mongos topology instance. - -2.0.41 08-14-2015 ------------------ -* Added missing Mongos.prototype.parserType function. -* Updated mongodb-core to 1.2.10. - -2.0.40 07-14-2015 ------------------ -* Updated mongodb-core to 1.2.9 for 2.4 wire protocol error handler fix. -* NODE-525 Reset connectionTimeout after it's overwritten by tls.connect. -* NODE-518 connectTimeoutMS is doubled in 2.0.39. -* NODE-506 Ensures that errors from bulk unordered and ordered are instanceof Error (Issue #1282, https://github.com/owenallenaz). -* NODE-526 Unique index not throwing duplicate key error. -* NODE-528 Ignore undefined fields in Collection.find(). -* NODE-527 The API example for collection.createIndex shows Db.createIndex functionality. - -2.0.39 07-14-2015 ------------------ -* Updated mongodb-core to 1.2.6 for NODE-505. - -2.0.38 07-14-2015 ------------------ -* NODE-505 Query fails to find records that have a 'result' property with an array value. - -2.0.37 07-14-2015 ------------------ -* NODE-504 Collection * Default options when using promiseLibrary. -* NODE-500 Accidental repeat of hostname in seed list multiplies total connections persistently. -* Updated mongodb-core to 1.2.5 to fix NODE-492. - -2.0.36 07-07-2015 ------------------ -* Fully promisified allowing the use of ES6 generators and libraries like co. Also allows for BYOP (Bring your own promises). -* NODE-493 updated mongodb-core to 1.2.4 to ensure we cannot DDOS the mongod or mongos process on large connection pool sizes. - -2.0.35 06-17-2015 ------------------ -* Upgraded to mongodb-core 1.2.2 including removing warnings when C++ bson parser is not available and a fix for SCRAM authentication. - -2.0.34 06-17-2015 ------------------ -* Upgraded to mongodb-core 1.2.1 speeding up serialization and removing the need for the c++ bson extension. -* NODE-486 fixed issue related to limit and skip when calling toArray in 2.0 driver. -* NODE-483 throw error if capabilities of topology is queries before topology has performed connection setup. -* NODE-482 fixed issue where MongoClient.connect would incorrectly identify a replset seed list server as a non replicaset member. -* NODE-487 fixed issue where killcursor command was not being sent correctly on limit and skip queries. - -2.0.33 05-20-2015 ------------------ -* Bumped mongodb-core to 1.1.32. - -2.0.32 05-19-2015 ------------------ -* NODE-463 db.close immediately executes its callback. -* Don't only emit server close event once (Issue #1276, https://github.com/vkarpov15). -* NODE-464 Updated mongodb-core to 1.1.31 that uses a single socket connection to arbiters and hidden servers as well as emitting all event correctly. - -2.0.31 05-08-2015 ------------------ -* NODE-461 Tripping on error "no chunks found for file, possibly corrupt" when there is no error. - -2.0.30 05-07-2015 ------------------ -* NODE-460 fix; don't set authMechanism for user in db.authenticate() to avoid mongoose authentication issue. - -2.0.29 05-07-2015 ------------------ -* NODE-444 Possible memory leak, too many listeners added. -* NODE-459 Auth failure using Node 0.8.28, MongoDB 3.0.2 & mongodb-node-native 1.4.35. -* Bumped mongodb-core to 1.1.26. - -2.0.28 04-24-2015 ------------------ -* Bumped mongodb-core to 1.1.25 -* Added Cursor.prototype.setCursorOption to allow for setting node specific cursor options for tailable cursors. -* NODE-430 Cursor.count() opts argument masked by var opts = {} -* NODE-406 Implemented Cursor.prototype.map function tapping into MongoClient cursor transforms. -* NODE-438 replaceOne is not returning the result.ops property as described in the docs. -* NODE-433 _read, pipe and write all open gridstore automatically if not open. -* NODE-426 ensure drain event is emitted after write function returns, fixes intermittent issues in writing files to gridstore. -* NODE-440 GridStoreStream._read() doesn't check GridStore.read() error. -* Always use readPreference = primary for findAndModify command (ignore passed in read preferences) (Issue #1274, https://github.com/vkarpov15). -* Minor fix in GridStore.exists for dealing with regular expressions searches. - -2.0.27 04-07-2015 ------------------ -* NODE-410 Correctly handle issue with pause/resume in Node 0.10.x that causes exceptions when using the Node 0.12.0 style streams. - -2.0.26 04-07-2015 ------------------ -* Implements the Common Index specification Standard API at https://github.com/mongodb/specifications/blob/master/source/index-management.rst. -* NODE-408 Expose GridStore.currentChunk.chunkNumber. - -2.0.25 03-26-2015 ------------------ -* Upgraded mongodb-core to 1.1.21, making the C++ bson code an optional dependency to the bson module. - -2.0.24 03-24-2015 ------------------ -* NODE-395 Socket Not Closing, db.close called before full set finished initalizing leading to server connections in progress not being closed properly. -* Upgraded mongodb-core to 1.1.20. - -2.0.23 2015-03-21 ------------------ -* NODE-380 Correctly return MongoError from toError method. -* Fixed issue where addCursorFlag was not correctly setting the flag on the command for mongodb-core. -* NODE-388 Changed length from method to property on order.js/unordered.js bulk operations. -* Upgraded mongodb-core to 1.1.19. - -2.0.22 2015-03-16 ------------------ -* NODE-377, fixed issue where tags would correctly be checked on secondary and nearest to filter out eligible server candidates. -* Upgraded mongodb-core to 1.1.17. - -2.0.21 2015-03-06 ------------------ -* Upgraded mongodb-core to 1.1.16 making sslValidate default to true to force validation on connection unless overriden by the user. - -2.0.20 2015-03-04 ------------------ -* Updated mongodb-core 1.1.15 to relax pickserver method. - -2.0.19 2015-03-03 ------------------ -* NODE-376 Fixes issue * Unordered batch incorrectly tracks batch size when switching batch types (Issue #1261, https://github.com/meirgottlieb) -* NODE-379 Fixes bug in cursor.count() that causes the result to always be zero for dotted collection names (Issue #1262, https://github.com/vsivsi) -* Expose MongoError from mongodb-core (Issue #1260, https://github.com/tjconcept) - -2.0.18 2015-02-27 ------------------ -* Bumped mongodb-core 1.1.14 to ensure passives are correctly added as secondaries. - -2.0.17 2015-02-27 ------------------ -* NODE-336 Added length function to ordered and unordered bulk operations to be able know the amount of current operations in bulk. -* Bumped mongodb-core 1.1.13 to ensure passives are correctly added as secondaries. - -2.0.16 2015-02-16 ------------------ -* listCollection now returns filtered result correctly removing db name for 2.6 or earlier servers. -* Bumped mongodb-core 1.1.12 to correctly work for node 0.12.0 and io.js. -* Add ability to get collection name from cursor (Issue #1253, https://github.com/vkarpov15) - -2.0.15 2015-02-02 ------------------ -* Unified behavior of listCollections results so 3.0 and pre 3.0 return same type of results. -* Bumped mongodb-core to 1.1.11 to support per document tranforms in cursors as well as relaxing the setName requirement. -* NODE-360 Aggregation cursor and command correctly passing down the maxTimeMS property. -* Added ~1.0 mongodb-tools module for test running. -* Remove the required setName for replicaset connections, if not set it will pick the first setName returned. - -2.0.14 2015-01-21 ------------------ -* Fixed some MongoClient.connect options pass through issues and added test coverage. -* Bumped mongodb-core to 1.1.9 including fixes for io.js - -2.0.13 2015-01-09 ------------------ -* Bumped mongodb-core to 1.1.8. -* Optimized query path for performance, moving Object.defineProperty outside of constructors. - -2.0.12 2014-12-22 ------------------ -* Minor fixes to listCollections to ensure correct querying of a collection when using a string. - -2.0.11 2014-12-19 ------------------ -* listCollections filters out index namespaces on < 2.8 correctly -* Bumped mongo-client to 1.1.7 - -2.0.10 2014-12-18 ------------------ -* NODE-328 fixed db.open return when no callback available issue and added test. -* NODE-327 Refactored listCollections to return cursor to support 2.8. -* NODE-327 Added listIndexes method and refactored internal methods to use the new command helper. -* NODE-335 Cannot create index for nested objects fixed by relaxing key checking for createIndex helper. -* Enable setting of connectTimeoutMS (Issue #1235, https://github.com/vkarpov15) -* Bumped mongo-client to 1.1.6 - -2.0.9 2014-12-01 ----------------- -* Bumped mongodb-core to 1.1.3 fixing global leaked variables and introducing strict across all classes. -* All classes are now strict (Issue #1233) -* NODE-324 Refactored insert/update/remove and all other crud opts to rely on internal methods to avoid any recursion. -* Fixed recursion issues in debug logging due to JSON.stringify() -* Documentation fixes (Issue #1232, https://github.com/wsmoak) -* Fix writeConcern in Db.prototype.ensureIndex (Issue #1231, https://github.com/Qard) - -2.0.8 2014-11-28 ----------------- -* NODE-322 Finished up prototype refactoring of Db class. -* NODE-322 Exposed Cursor in index.js for New Relic. - -2.0.7 2014-11-20 ----------------- -* Bumped mongodb-core to 1.1.2 fixing a UTF8 encoding issue for collection names. -* NODE-318 collection.update error while setting a function with serializeFunctions option. -* Documentation fixes. - -2.0.6 2014-11-14 ----------------- -* Refactored code to be prototype based instead of privileged methods. -* Bumped mongodb-core to 1.1.1 to take advantage of the prototype based refactorings. -* Implemented missing aspects of the CRUD specification. -* Fixed documentation issues. -* Fixed global leak REFERENCE_BY_ID in gridfs grid_store (Issue #1225, https://github.com/j) -* Fix LearnBoost/mongoose#2313: don't let user accidentally clobber geoNear params (Issue #1223, https://github.com/vkarpov15) - -2.0.5 2014-10-29 ----------------- -* Minor fixes to documentation and generation of documentation. -* NODE-306 (No results in aggregation cursor when collection name contains a dot), Merged code for cursor and aggregation cursor. - -2.0.4 2014-10-23 ----------------- -* Allow for single replicaset seed list with no setName specified (Issue #1220, https://github.com/imaman) -* Made each rewind on each call allowing for re-using the cursor. -* Fixed issue where incorrect iterations would happen on each for extensive batchSizes. -* NODE-301 specifying maxTimeMS on find causes all fields to be omitted from result. - -2.0.3 2014-10-14 ----------------- -* NODE-297 Aggregate Broken for case of pipeline with no options. - -2.0.2 2014-10-08 ----------------- -* Bumped mongodb-core to 1.0.2. -* Fixed bson module dependency issue by relying on the mongodb-core one. -* Use findOne instead of find followed by nextObject (Issue #1216, https://github.com/sergeyksv) - -2.0.1 2014-10-07 ----------------- -* Dependency fix - -2.0.0 2014-10-07 ----------------- -* First release of 2.0 driver - -2.0.0-alpha2 2014-10-02 ------------------------ -* CRUD API (insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, bulkWrite, findOneAndDelete, findOneAndUpdate, findOneAndReplace) -* Cluster Management Spec compatible. - -2.0.0-alpha1 2014-09-08 ------------------------ -* Insert method allows only up 1000 pr batch for legacy as well as 2.6 mode -* Streaming behavior is 0.10.x or higher with backwards compatibility using readable-stream npm package -* Gridfs stream only available through .stream() method due to overlapping names on Gridstore object and streams in 0.10.x and higher of node -* remove third result on update and remove and return the whole result document instead (getting rid of the weird 3 result parameters) - * Might break some application -* Returns the actual mongodb-core result instead of just the number of records changed for insert/update/remove -* MongoClient only has the connect method (no ability instantiate with Server, ReplSet or similar) -* Removed Grid class -* GridStore only supports w+ for metadata updates, no appending to file as it's not thread safe and can cause corruption of the data - + seek will fail if attempt to use with w or w+ - + write will fail if attempted with w+ or r - + w+ only works for updating metadata on a file -* Cursor toArray and each resets and re-runs the cursor -* FindAndModify returns whole result document instead of just value -* Extend cursor to allow for setting all the options via methods instead of dealing with the current messed up find -* Removed db.dereference method -* Removed db.cursorInfo method -* Removed db.stats method -* Removed db.collectionNames not needed anymore as it's just a specialized case of listCollections -* Removed db.collectionInfo removed due to not being compatible with new storage engines in 2.8 as they need to use the listCollections command due to system collections not working for namespaces. -* Added db.listCollections to replace several methods above - -1.4.10 2014-09-04 ------------------ -* Fixed BSON and Kerberos compilation issues -* Bumped BSON to ~0.2 always installing latest BSON 0.2.x series -* Fixed Kerberos and bumped to 0.0.4 - -1.4.9 2014-08-26 ----------------- -* Check _bsonType for Binary (Issue #1202, https://github.com/mchapman) -* Remove duplicate Cursor constructor (Issue #1201, https://github.com/KenPowers) -* Added missing parameter in the documentation (Issue #1199, https://github.com/wpjunior) -* Documented third parameter on the update callback(Issue #1196, https://github.com/gabmontes) -* NODE-240 Operations on SSL connection hang on node 0.11.x -* NODE-235 writeResult is not being passed on when error occurs in insert -* NODE-229 Allow count to work with query hints -* NODE-233 collection.save() does not support fullResult -* NODE-244 Should parseError also emit a `disconnected` event? -* NODE-246 Cursors are inefficiently constructed and consequently cannot be promisified. -* NODE-248 Crash with X509 auth -* NODE-252 Uncaught Exception in Base.__executeAllServerSpecificErrorCallbacks -* Bumped BSON parser to 0.2.12 - - -1.4.8 2014-08-01 ----------------- -* NODE-205 correctly emit authenticate event -* NODE-210 ensure no undefined connection error when checking server state -* NODE-212 correctly inherit socketTimeoutMS from replicaset when HA process adds new servers or reconnects to existing ones -* NODE-220 don't throw error if ensureIndex errors out in Gridstore -* Updated bson to 0.2.11 to ensure correct toBSON behavior when returning non object in nested classes -* Fixed test running filters -* Wrap debug log in a call to format (Issue #1187, https://github.com/andyroyle) -* False option values should not trigger w:1 (Issue #1186, https://github.com/jsdevel) -* Fix aggregatestream.close(Issue #1194, https://github.com/jonathanong) -* Fixed parsing issue for w:0 in url parser when in connection string -* Modified collection.geoNear to support a geoJSON point or legacy coordinate pair (Issue #1198, https://github.com/mmacmillan) - -1.4.7 2014-06-18 ----------------- -* Make callbacks to be executed in right domain when server comes back up (Issue #1184, https://github.com/anton-kotenko) -* Fix issue where currentOp query against mongos would fail due to mongos passing through $readPreference field to mongod (CS-X) - -1.4.6 2014-06-12 ----------------- -* Added better support for MongoClient IP6 parsing (Issue #1181, https://github.com/micovery) -* Remove options check on index creation (Issue #1179, Issue #1183, https://github.com/jdesboeufs, https://github.com/rubenvereecken) -* Added missing type check before calling optional callback function (Issue #1180) - -1.4.5 2014-05-21 ----------------- -* Added fullResult flag to insert/update/remove which will pass raw result document back. Document contents will vary depending on the server version the driver is talking to. No attempt is made to coerce a joint response. -* Fix to avoid MongoClient.connect hanging during auth when secondaries building indexes pre 2.6. -* return the destination stream in GridStore.pipe (Issue #1176, https://github.com/iamdoron) - -1.4.4 2014-05-13 ----------------- -* Bumped BSON version to use the NaN 1.0 package, fixed strict comparison issue for ObjectID -* Removed leaking global variable (Issue #1174, https://github.com/dainis) -* MongoClient respects connectTimeoutMS for initial discovery process (NODE-185) -* Fix bug with return messages larger than 16MB but smaller than max BSON Message Size (NODE-184) - -1.4.3 2014-05-01 ----------------- -* Clone options for commands to avoid polluting original options passed from Mongoose (Issue #1171, https://github.com/vkarpov15) -* Made geoNear and geoHaystackSearch only clean out allowed options from command generation (Issue #1167) -* Fixed typo for allowDiskUse (Issue #1168, https://github.com/joaofranca) -* A 'mapReduce' function changed 'function' to instance '\' of 'Code' class (Issue #1165, https://github.com/exabugs) -* Made findAndModify set sort only when explicitly set (Issue #1163, https://github.com/sars) -* Rewriting a gridStore file by id should use a new filename if provided (Issue #1169, https://github.com/vsivsi) - -1.4.2 2014-04-15 ----------------- -* Fix for inheritance of readPreferences from MongoClient NODE-168/NODE-169 -* Merged in fix for ping strategy to avoid hitting non-pinged servers (Issue #1161, https://github.com/vaseker) -* Merged in fix for correct debug output for connection messages (Issue #1158, https://github.com/vaseker) -* Fixed global variable leak (Issue #1160, https://github.com/vaseker) - -1.4.1 2014-04-09 ----------------- -* Correctly emit joined event when primary change -* Add _id to documents correctly when using bulk operations - -1.4.0 2014-04-03 ----------------- -* All node exceptions will no longer be caught if on('error') is defined -* Added X509 auth support -* Fix for MongoClient connection timeout issue (NODE-97) -* Pass through error messages from parseError instead of just text (Issue #1125) -* Close db connection on error (Issue #1128, https://github.com/benighted) -* Fixed documentation generation -* Added aggregation cursor for 2.6 and emulated cursor for pre 2.6 (uses stream2) -* New Bulk API implementation using write commands for 2.6 and down converts for pre 2.6 -* Insert/Update/Remove using new write commands when available -* Added support for new roles based API's in 2.6 for addUser/removeUser -* Added bufferMaxEntries to start failing if the buffer hits the specified number of entries -* Upgraded BSON parser to version 0.2.7 to work with < 0.11.10 C++ API changes -* Support for OP_LOG_REPLAY flag (NODE-94) -* Fixes for SSL HA ping and discovery. -* Uses createIndexes if available for ensureIndex/createIndex -* Added parallelCollectionScan method to collection returning CommandCursor instances for cursors -* Made CommandCursor behave as Readable stream. -* Only Db honors readPreference settings, removed Server.js legacy readPreference settings due to user confusion. -* Reconnect event emitted by ReplSet/Mongos/Server after reconnect and before replaying of buffered operations. -* GridFS buildMongoObject returns error on illegal md5 (NODE-157, https://github.com/iantocristian) -* Default GridFS chunk size changed to (255 * 1024) bytes to optimize for collections defaulting to power of 2 sizes on 2.6. -* Refactored commands to all go through command function ensuring consistent command execution. -* Fixed issues where readPreferences where not correctly passed to mongos. -* Catch error == null and make err detection more prominent (NODE-130) -* Allow reads from arbiter for single server connection (NODE-117) -* Handle error coming back with no documents (NODE-130) -* Correctly use close parameter in Gridstore.write() (NODE-125) -* Throw an error on a bulk find with no selector (NODE-129, https://github.com/vkarpov15) -* Use a shallow copy of options in find() (NODE-124, https://github.com/vkarpov15) -* Fix statistical strategy (NODE-158, https://github.com/vkarpov15) -* GridFS off-by-one bug in lastChunkNumber() causes uncaught throw and data loss (Issue #1154, https://github.com/vsivsi) -* GridStore drops passed `aliases` option, always results in `null` value in GridFS files (Issue #1152, https://github.com/vsivsi) -* Remove superfluous connect object copying in index.js (Issue #1145, https://github.com/thomseddon) -* Do not return false when the connection buffer is still empty (Issue #1143, https://github.com/eknkc) -* Check ReadPreference object on ReplSet.canRead (Issue #1142, https://github.com/eknkc) -* Fix unpack error on _executeQueryCommand (Issue #1141, https://github.com/eknkc) -* Close db on failed connect so node can exit (Issue #1128, https://github.com/benighted) -* Fix global leak with _write_concern (Issue #1126, https://github.com/shanejonas) - -1.3.19 2013-08-21 ------------------ -* Correctly rethrowing errors after change from event emission to callbacks, compatibility with 0.10.X domains without breaking 0.8.X support. -* Small fix to return the entire findAndModify result as the third parameter (Issue #1068) -* No removal of "close" event handlers on server reconnect, emits "reconnect" event when reconnection happens. Reconnect Only applies for single server connections as of now as semantics for ReplSet and Mongos is not clear (Issue #1056) - -1.3.18 2013-08-10 ------------------ -* Fixed issue when throwing exceptions in MongoClient.connect/Db.open (Issue #1057) -* Fixed an issue where _events is not cleaned up correctly causing a slow steady memory leak. - -1.3.17 2013-08-07 ------------------ -* Ignore return commands that have no registered callback -* Made collection.count not use the db.command function -* Fix throw exception on ping command (Issue #1055) - -1.3.16 2013-08-02 ------------------ -* Fixes connection issue where lots of connections would happen if a server is in recovery mode during connection (Issue #1050, NODE-50, NODE-51) -* Bug in unlink mulit filename (Issue #1054) - -1.3.15 2013-08-01 ------------------ -* Memory leak issue due to node Issue #4390 where _events[id] is set to undefined instead of deleted leading to leaks in the Event Emitter over time - -1.3.14 2013-08-01 ------------------ -* Fixed issue with checkKeys where it would error on X.X - -1.3.13 2013-07-31 ------------------ -* Added override for checkKeys on insert/update (Warning will expose you to injection attacks) (Issue #1046) -* BSON size checking now done pre serialization (Issue #1037) -* Added isConnected returns false when no connection Pool exists (Issue #1043) -* Unified command handling to ensure same handling (Issue #1041, #1042) -* Correctly emit "open" and "fullsetup" across all Db's associated with Mongos, ReplSet or Server (Issue #1040) -* Correctly handles bug in authentication when attempting to connect to a recovering node in a replicaset. -* Correctly remove recovering servers from available servers in replicaset. Piggybacks on the ping command. -* Removed findAndModify chaining to be compliant with behavior in other official drivers and to fix a known mongos issue. -* Fixed issue with Kerberos authentication on Windows for re-authentication. -* Fixed Mongos failover behavior to correctly throw out old servers. -* Ensure stored queries/write ops are executed correctly after connection timeout -* Added promoteLongs option for to allow for overriding the promotion of Longs to Numbers and return the actual Long. - -1.3.12 2013-07-19 ------------------ -* Fixed issue where timeouts sometimes would behave wrongly (Issue #1032) -* Fixed bug with callback third parameter on some commands (Issue #1033) -* Fixed possible issue where killcursor command might leave hanging functions -* Fixed issue where Mongos was not correctly removing dead servers from the pool of eligable servers -* Throw error if dbName or collection name contains null character (at command level and at collection level) -* Updated bson parser to 0.2.1 with security fix and non-promotion of Long values to javascript Numbers (once a long always a long) - -1.3.11 2013-07-04 ------------------ -* Fixed errors on geoNear and geoSearch (Issue #1024, https://github.com/ebensing) -* Add driver version to export (Issue #1021, https://github.com/aheckmann) -* Add text to readpreference obedient commands (Issue #1019) -* Drivers should check the query failure bit even on getmore response (Issue #1018) -* Map reduce has incorrect expectations of 'inline' value for 'out' option (Issue #1016, https://github.com/rcotter) -* Support SASL PLAIN authentication (Issue #1009) -* Ability to use different Service Name on the driver for Kerberos Authentication (Issue #1008) -* Remove unnecessary octal literal to allow the code to run in strict mode (Issue #1005, https://github.com/jamesallardice) -* Proper handling of recovering nodes (when they go into recovery and when they return from recovery, Issue #1027) - -1.3.10 2013-06-17 ------------------ -* Guard against possible undefined in server::canCheckoutWriter (Issue #992, https://github.com/willyaranda) -* Fixed some duplicate test names (Issue #993, https://github.com/kawanet) -* Introduced write and read concerns for GridFS (Issue #996) -* Fixed commands not correctly respecting Collection level read preference (Issue #995, #999) -* Fixed issue with pool size on replicaset connections (Issue #1000) -* Execute all query commands on master switch (Issue #1002, https://github.com/fogaztuc) - -1.3.9 2013-06-05 ----------------- -* Fixed memory leak when findAndModify errors out on w>1 and chained callbacks not properly cleaned up. - -1.3.8 2013-05-31 ----------------- -* Fixed issue with socket death on windows where it emits error event instead of close event (Issue #987) -* Emit authenticate event on db after authenticate method has finished on db instance (Issue #984) -* Allows creation of MongoClient and do new MongoClient().connect(..). Emits open event when connection correct allowing for apps to react on event. - -1.3.7 2013-05-29 ----------------- -* After reconnect, tailable getMores go on inconsistent connections (Issue #981, #982, https://github.com/glasser) -* Updated Bson to 0.1.9 to fix ARM support (Issue #985) - -1.3.6 2013-05-21 ----------------- -* Fixed issue where single server reconnect attempt would throw due to missing options variable (Issue #979) -* Fixed issue where difference in ismaster server name and seed list caused connections issues, (Issue #976) - -1.3.5 2013-05-14 ----------------- -* Fixed issue where HA for replicaset would pick the same broken connection when attempting to ping the replicaset causing the replicaset to never recover. - -1.3.4 2013-05-14 ----------------- -* Fixed bug where options not correctly passed in for uri parser (Issue #973, https://github.com/supershabam) -* Fixed bug when passing a named index hint (Issue #974) - -1.3.3 2013-05-09 ----------------- -* Fixed auto-reconnect issue with single server instance. - -1.3.2 2013-05-08 ----------------- -* Fixes for an issue where replicaset would be pronounced dead when high priority primary caused double elections. - -1.3.1 2013-05-06 ----------------- -* Fix for replicaset consisting of primary/secondary/arbiter with priority applied failing to reconnect properly -* Applied auth before server instance is set as connected when single server connection -* Throw error if array of documents passed to save method - -1.3.0 2013-04-25 ----------------- -* Whole High availability handling for Replicaset, Server and Mongos connections refactored to ensure better handling of failover cases. -* Fixed issue where findAndModify would not correctly skip issuing of chained getLastError (Issue #941) -* Fixed throw error issue on errors with findAndModify during write out operation (Issue #939, https://github.com/autopulated) -* Gridstore.prototype.writeFile now returns gridstore object correctly (Issue #938) -* Kerberos support is now an optional module that allows for use of GSSAPI authentication using MongoDB Subscriber edition -* Fixed issue where cursor.toArray could blow the stack on node 0.10.X (#950) - -1.2.14 2013-03-14 ------------------ -* Refactored test suite to speed up running of replicaset tests -* Fix of async error handling when error happens in callback (Issue #909, https://github.com/medikoo) -* Corrected a slaveOk setting issue (Issue #906, #905) -* Fixed HA issue where ping's would not go to correct server on HA server connection failure. -* Uses setImmediate if on 0.10 otherwise nextTick for cursor stream -* Fixed race condition in Cursor stream (NODE-31) -* Fixed issues related to node 0.10 and process.nextTick now correctly using setImmediate where needed on node 0.10 -* Added support for maxMessageSizeBytes if available (DRIVERS-1) -* Added support for authSource (2.4) to MongoClient URL and db.authenticate method (DRIVER-69/NODE-34) -* Fixed issue in GridStore seek and GridStore read to correctly work on multiple seeks (Issue #895) - -1.2.13 2013-02-22 ------------------ -* Allow strategy 'none' for repliaset if no strategy wanted (will default to round robin selection of servers on a set readPreference) -* Fixed missing MongoErrors on some cursor methods (Issue #882) -* Correctly returning a null for the db instance on MongoClient.connect when auth fails (Issue #890) -* Added dropTarget option support for renameCollection/rename (Issue #891, help from https://github.com/jbottigliero) -* Fixed issue where connection using MongoClient.connect would fail if first server did not exist (Issue #885) - -1.2.12 2013-02-13 ------------------ -* Added limit/skip options to Collection.count (Issue #870) -* Added applySkipLimit option to Cursor.count (Issue #870) -* Enabled ping strategy as default for Replicaset if none specified (Issue #876) -* Should correctly pick nearest server for SECONDARY/SECONDARY_PREFERRED/NEAREST (Issue #878) - -1.2.11 2013-01-29 ------------------ -* Added fixes for handling type 2 binary due to PHP driver (Issue #864) -* Moved callBackStore to Base class to have single unified store (Issue #866) -* Ping strategy now reuses sockets unless they are closed by the server to avoid overhead - -1.2.10 2013-01-25 ------------------ -* Merged in SSL support for 2.4 supporting certificate validation and presenting certificates to the server. -* Only open a new HA socket when previous one dead (Issue #859, #857) -* Minor fixes - -1.2.9 2013-01-15 ----------------- -* Fixed bug in SSL support for MongoClient/Db.connect when discovering servers (Issue #849) -* Connection string with no db specified should default to admin db (Issue #848) -* Support port passed as string to Server class (Issue #844) -* Removed noOpen support for MongoClient/Db.connect as auto discovery of servers for Mongod/Mongos makes it not possible (Issue #842) -* Included toError wrapper code moved to utils.js file (Issue #839, #840) -* Rewrote cursor handling to avoid process.nextTick using trampoline instead to avoid stack overflow, speedup about 40% - -1.2.8 2013-01-07 ----------------- -* Accept function in a Map Reduce scope object not only a function string (Issue #826, https://github.com/aheckmann) -* Typo in db.authenticate caused a check (for provided connection) to return false, causing a connection AND onAll=true to be passed into __executeQueryCommand downstream (Issue #831, https://github.com/m4tty) -* Allow gridfs objects to use non ObjectID ids (Issue #825, https://github.com/nailgun) -* Removed the double wrap, by not passing an Error object to the wrap function (Issue #832, https://github.com/m4tty) -* Fix connection leak (gh-827) for HA replicaset health checks (Issue #833, https://github.com/aheckmann) -* Modified findOne to use nextObject instead of toArray avoiding a nextTick operation (Issue #836) -* Fixes for cursor stream to avoid multiple getmore issues when one in progress (Issue #818) -* Fixes .open replaying all backed up commands correctly if called after operations performed, (Issue #829 and #823) - -1.2.7 2012-12-23 ----------------- -* Rolled back batches as they hang in certain situations -* Fixes for NODE-25, keep reading from secondaries when primary goes down - -1.2.6 2012-12-21 ----------------- -* domain sockets shouldn't require a port arg (Issue #815, https://github.com/aheckmann) -* Cannot read property 'info' of null (Issue #809, https://github.com/thesmart) -* Cursor.each should work in batches (Issue #804, https://github.com/Swatinem) -* Cursor readPreference bug for non-supported read preferences (Issue #817) - -1.2.5 2012-12-12 ----------------- -* Fixed ssl regression, added more test coverage (Issue #800) -* Added better error reporting to the Db.connect if no valid serverConfig setup found (Issue #798) - -1.2.4 2012-12-11 ----------------- -* Fix to ensure authentication is correctly applied across all secondaries when using MongoClient. - -1.2.3 2012-12-10 ----------------- -* Fix for new replicaset members correctly authenticating when being added (Issue #791, https://github.com/m4tty) -* Fixed seek issue in gridstore when using stream (Issue #790) - -1.2.2 2012-12-03 ----------------- -* Fix for journal write concern not correctly being passed under some circumstances. -* Fixed correct behavior and re-auth for servers that get stepped down (Issue #779). - -1.2.1 2012-11-30 ----------------- -* Fix for double callback on insert with w:0 specified (Issue #783) -* Small cleanup of urlparser. - -1.2.0 2012-11-27 ----------------- -* Honor connectTimeoutMS option for replicasets (Issue #750, https://github.com/aheckmann) -* Fix ping strategy regression (Issue #738, https://github.com/aheckmann) -* Small cleanup of code (Issue #753, https://github.com/sokra/node-mongodb-native) -* Fixed index declaration using objects/arrays from other contexts (Issue #755, https://github.com/sokra/node-mongodb-native) -* Intermittent (and rare) null callback exception when using ReplicaSets (Issue #752) -* Force correct setting of read_secondary based on the read preference (Issue #741) -* If using read preferences with secondaries queries will not fail if primary is down (Issue #744) -* noOpen connection for Db.connect removed as not compatible with autodetection of Mongo type -* Mongos connection with auth not working (Issue #737) -* Use the connect method directly from the require. require('mongodb')("mongodb://localhost:27017/db") -* new MongoClient introduced as the point of connecting to MongoDB's instead of the Db - * open/close/db/connect methods implemented -* Implemented common URL connection format using MongoClient.connect allowing for simialar interface across all drivers. -* Fixed a bug with aggregation helper not properly accepting readPreference - -1.1.11 2012-10-10 ------------------ -* Removed strict mode and introduced normal handling of safe at DB level. - -1.1.10 2012-10-08 ------------------ -* fix Admin.serverStatus (Issue #723, https://github.com/Contra) -* logging on connection open/close(Issue #721, https://github.com/asiletto) -* more fixes for windows bson install (Issue #724) - -1.1.9 2012-10-05 ----------------- -* Updated bson to 0.1.5 to fix build problem on sunos/windows. - -1.1.8 2012-10-01 ----------------- -* Fixed db.eval to correctly handle system.js global javascript functions (Issue #709) -* Cleanup of non-closing connections (Issue #706) -* More cleanup of connections under replicaset (Issue #707, https://github.com/elbert3) -* Set keepalive on as default, override if not needed -* Cleanup of jsbon install to correctly build without install.js script (https://github.com/shtylman) -* Added domain socket support new Server("/tmp/mongodb.sock") style - -1.1.7 2012-09-10 ----------------- -* Protect against starting PingStrategy being called more than once (Issue #694, https://github.com/aheckmann) -* Make PingStrategy interval configurable (was 1 second, relaxed to 5) (Issue #693, https://github.com/aheckmann) -* Made PingStrategy api more consistant, callback to start/stop methods are optional (Issue #693, https://github.com/aheckmann) -* Proper stopping of strategy on replicaset stop -* Throw error when gridstore file is not found in read mode (Issue #702, https://github.com/jbrumwell) -* Cursor stream resume now using nextTick to avoid duplicated records (Issue #696) - -1.1.6 2012-09-01 ----------------- -* Fix for readPreference NEAREST for replicasets (Issue #693, https://github.com/aheckmann) -* Emit end correctly on stream cursor (Issue #692, https://github.com/Raynos) - -1.1.5 2012-08-29 ----------------- -* Fix for eval on replicaset Issue #684 -* Use helpful error msg when native parser not compiled (Issue #685, https://github.com/aheckmann) -* Arbiter connect hotfix (Issue #681, https://github.com/fengmk2) -* Upgraded bson parser to 0.1.2 using gyp, deprecated support for node 0.4.X -* Added name parameter to createIndex/ensureIndex to be able to override index names larger than 128 bytes -* Added exhaust option for find for feature completion (not recommended for normal use) -* Added tailableRetryInterval to find for tailable cursors to allow to control getMore retry time interval -* Fixes for read preferences when using MongoS to correctly handle no read preference set when iterating over a cursor (Issue #686) - -1.1.4 2012-08-12 ----------------- -* Added Mongos connection type with a fallback list for mongos proxies, supports ha (on by default) and will attempt to reconnect to failed proxies. -* Documents can now have a toBSON method that lets the user control the serialization behavior for documents being saved. -* Gridstore instance object now works as a readstream or writestream (thanks to code from Aaron heckmann (https://github.com/aheckmann/gridfs-stream)). -* Fix gridfs readstream (Issue #607, https://github.com/tedeh). -* Added disableDriverBSONSizeCheck property to Server.js for people who wish to push the inserts to the limit (Issue #609). -* Fixed bug where collection.group keyf given as Code is processed as a regular object (Issue #608, https://github.com/rrusso2007). -* Case mismatch between driver's ObjectID and mongo's ObjectId, allow both (Issue #618). -* Cleanup map reduce (Issue #614, https://github.com/aheckmann). -* Add proper error handling to gridfs (Issue #615, https://github.com/aheckmann). -* Ensure cursor is using same connection for all operations to avoid potential jump of servers when using replicasets. -* Date identification handled correctly in bson js parser when running in vm context. -* Documentation updates -* GridStore filename not set on read (Issue #621) -* Optimizations on the C++ bson parser to fix a potential memory leak and avoid non-needed calls -* Added support for awaitdata for tailable cursors (Issue #624) -* Implementing read preference setting at collection and cursor level - * collection.find().setReadPreference(Server.SECONDARY_PREFERRED) - * db.collection("some", {readPreference:Server.SECONDARY}) -* Replicaset now returns when the master is discovered on db.open and lets the rest of the connections happen asynchronous. - * ReplSet/ReplSetServers emits "fullsetup" when all servers have been connected to -* Prevent callback from executing more than once in getMore function (Issue #631, https://github.com/shankar0306) -* Corrupt bson messages now errors out to all callbacks and closes up connections correctly, Issue #634 -* Replica set member status update when primary changes bug (Issue #635, https://github.com/alinsilvian) -* Fixed auth to work better when multiple connections are involved. -* Default connection pool size increased to 5 connections. -* Fixes for the ReadStream class to work properly with 0.8 of Node.js -* Added explain function support to aggregation helper -* Added socketTimeoutMS and connectTimeoutMS to socket options for repl_set.js and server.js -* Fixed addUser to correctly handle changes in 2.2 for getLastError authentication required -* Added index to gridstore chunks on file_id (Issue #649, https://github.com/jacobbubu) -* Fixed Always emit db events (Issue #657) -* Close event not correctly resets DB openCalled variable to allow reconnect -* Added open event on connection established for replicaset, mongos and server -* Much faster BSON C++ parser thanks to Lucasfilm Singapore. -* Refactoring of replicaset connection logic to simplify the code. -* Add `options.connectArbiter` to decide connect arbiters or not (Issue #675) -* Minor optimization for findAndModify when not using j,w or fsync for safe - -1.0.2 2012-05-15 ----------------- -* Reconnect functionality for replicaset fix for mongodb 2.0.5 - -1.0.1 2012-05-12 ----------------- -* Passing back getLastError object as 3rd parameter on findAndModify command. -* Fixed a bunch of performance regressions in objectId and cursor. -* Fixed issue #600 allowing for single document delete to be passed in remove command. - -1.0.0 2012-04-25 ----------------- -* Fixes to handling of failover on server error -* Only emits error messages if there are error listeners to avoid uncaught events -* Server.isConnected using the server state variable not the connection pool state - -0.9.9.8 2012-04-12 ------------------- -* _id=0 is being turned into an ObjectID (Issue #551) -* fix for error in GridStore write method (Issue #559) -* Fix for reading a GridStore from arbitrary, non-chunk aligned offsets, added test (Issue #563, https://github.com/subroutine) -* Modified limitRequest to allow negative limits to pass through to Mongo, added test (Issue #561) -* Corrupt GridFS files when chunkSize < fileSize, fixed concurrency issue (Issue #555) -* Handle dead tailable cursors (Issue #568, https://github.com/aheckmann) -* Connection pools handles closing themselves down and clearing the state -* Check bson size of documents against maxBsonSize and throw client error instead of server error, (Issue #553) -* Returning update status document at the end of the callback for updates, (Issue #569) -* Refactor use of Arguments object to gain performance (Issue #574, https://github.com/AaronAsAChimp) - -0.9.9.7 2012-03-16 ------------------- -* Stats not returned from map reduce with inline results (Issue #542) -* Re-enable testing of whether or not the callback is called in the multi-chunk seek, fix small GridStore bug (Issue #543, https://github.com/pgebheim) -* Streaming large files from GridFS causes truncation (Issue #540) -* Make callback type checks agnostic to V8 context boundaries (Issue #545) -* Correctly throw error if an attempt is made to execute an insert/update/remove/createIndex/ensureIndex with safe enabled and no callback -* Db.open throws if the application attemps to call open again without calling close first - -0.9.9.6 2012-03-12 ------------------- -* BSON parser is externalized in it's own repository, currently using git master -* Fixes for Replicaset connectivity issue (Issue #537) -* Fixed issues with node 0.4.X vs 0.6.X (Issue #534) -* Removed SimpleEmitter and replaced with standard EventEmitter -* GridStore.seek fails to change chunks and call callback when in read mode (Issue #532) - -0.9.9.5 2012-03-07 ------------------- -* Merged in replSetGetStatus helper to admin class (Issue #515, https://github.com/mojodna) -* Merged in serverStatus helper to admin class (Issue #516, https://github.com/mojodna) -* Fixed memory leak in C++ bson parser (Issue #526) -* Fix empty MongoError "message" property (Issue #530, https://github.com/aheckmann) -* Cannot save files with the same file name to GridFS (Issue #531) - -0.9.9.4 2012-02-26 ------------------- -* bugfix for findAndModify: Error: corrupt bson message < 5 bytes long (Issue #519) - -0.9.9.3 2012-02-23 ------------------- -* document: save callback arguments are both undefined, (Issue #518) -* Native BSON parser install error with npm, (Issue #517) - -0.9.9.2 2012-02-17 ------------------- -* Improved detection of Buffers using Buffer.isBuffer instead of instanceof. -* Added wrap error around db.dropDatabase to catch all errors (Issue #512) -* Added aggregate helper to collection, only for MongoDB >= 2.1 - -0.9.9.1 2012-02-15 ------------------- -* Better handling of safe when using some commands such as createIndex, ensureIndex, addUser, removeUser, createCollection. -* Mapreduce now throws error if out parameter is not specified. - -0.9.9 2012-02-13 ----------------- -* Added createFromTime method on ObjectID to allow for queries against _id more easily using the timestamp. -* Db.close(true) now makes connection unusable as it's been force closed by app. -* Fixed mapReduce and group functions to correctly send slaveOk on queries. -* Fixes for find method to correctly work with find(query, fields, callback) (Issue #506). -* A fix for connection error handling when using the SSL on MongoDB. - -0.9.8-7 2012-02-06 ------------------- -* Simplified findOne to use the find command instead of the custom code (Issue #498). -* BSON JS parser not also checks for _bsonType variable in case BSON object is in weird scope (Issue #495). - -0.9.8-6 2012-02-04 ------------------- -* Removed the check for replicaset change code as it will never work with node.js. - -0.9.8-5 2012-02-02 ------------------- -* Added geoNear command to Collection. -* Added geoHaystackSearch command to Collection. -* Added indexes command to collection to retrieve the indexes on a Collection. -* Added stats command to collection to retrieve the statistics on a Collection. -* Added listDatabases command to admin object to allow retrieval of all available dbs. -* Changed createCreateIndexCommand to work better with options. -* Fixed dereference method on Db class to correctly dereference Db reference objects. -* Moved connect object onto Db class(Db.connect) as well as keeping backward compatibility. -* Removed writeBuffer method from gridstore, write handles switching automatically now. -* Changed readBuffer to read on Gridstore, Gridstore now only supports Binary Buffers no Strings anymore. -* Moved Long class to bson directory. - -0.9.8-4 2012-01-28 ------------------- -* Added reIndex command to collection and db level. -* Added support for $returnKey, $maxScan, $min, $max, $showDiskLoc, $comment to cursor and find/findOne methods. -* Added dropDups and v option to createIndex and ensureIndex. -* Added isCapped method to Collection. -* Added indexExists method to Collection. -* Added findAndRemove method to Collection. -* Fixed bug for replicaset connection when no active servers in the set. -* Fixed bug for replicaset connections when errors occur during connection. -* Merged in patch for BSON Number handling from Lee Salzman, did some small fixes and added test coverage. - -0.9.8-3 2012-01-21 ------------------- -* Workaround for issue with Object.defineProperty (Issue #484) -* ObjectID generation with date does not set rest of fields to zero (Issue #482) - -0.9.8-2 2012-01-20 ------------------- -* Fixed a missing this in the ReplSetServers constructor. - -0.9.8-1 2012-01-17 ------------------- -* FindAndModify bug fix for duplicate errors (Issue #481) - -0.9.8 2012-01-17 ----------------- -* Replicasets now correctly adjusts to live changes in the replicaset configuration on the servers, reconnecting correctly. - * Set the interval for checking for changes setting the replicaSetCheckInterval property when creating the ReplSetServers instance or on db.serverConfig.replicaSetCheckInterval. (default 1000 miliseconds) -* Fixes formattedOrderClause in collection.js to accept a plain hash as a parameter (Issue #469) https://github.com/tedeh -* Removed duplicate code for formattedOrderClause and moved to utils module -* Pass in poolSize for ReplSetServers to set default poolSize for new replicaset members -* Bug fix for BSON JS deserializer. Isolating the eval functions in separate functions to avoid V8 deoptimizations -* Correct handling of illegal BSON messages during deserialization -* Fixed Infinite loop when reading GridFs file with no chunks (Issue #471) -* Correctly update existing user password when using addUser (Issue #470) - -0.9.7.3-5 2012-01-04 --------------------- -* Fix for RegExp serialization for 0.4.X where typeof /regexp/ == 'function' vs in 0.6.X typeof /regexp/ == 'object' -* Don't allow keepAlive and setNoDelay for 0.4.X as it throws errors - -0.9.7.3-4 2012-01-04 --------------------- -* Chased down potential memory leak on findAndModify, Issue #467 (node.js removeAllListeners leaves the key in the _events object, node.js bug on eventlistener?, leads to extremely slow memory leak on listener object) -* Sanity checks for GridFS performance with benchmark added - -0.9.7.3-3 2012-01-04 --------------------- -* Bug fixes for performance issues going form 0.9.6.X to 0.9.7.X on linux -* BSON bug fixes for performance - -0.9.7.3-2 2012-01-02 --------------------- -* Fixed up documentation to reflect the preferred way of instantiating bson types -* GC bug fix for JS bson parser to avoid stop-and-go GC collection - -0.9.7.3-1 2012-01-02 --------------------- -* Fix to make db.bson_serializer and db.bson_deserializer work as it did previously - -0.9.7.3 2011-12-30 --------------------- -* Moved BSON_BINARY_SUBTYPE_DEFAULT from BSON object to Binary object and removed the BSON_BINARY_ prefixes -* Removed Native BSON types, C++ parser uses JS types (faster due to cost of crossing the JS-C++ barrier for each call) -* Added build fix for 0.4.X branch of Node.js where GetOwnPropertyNames is not defined in v8 -* Fix for wire protocol parser for corner situation where the message is larger than the maximum socket buffer in node.js (Issue #464, #461, #447) -* Connection pool status set to connected on poolReady, isConnected returns false on anything but connected status (Issue #455) - -0.9.7.2-5 2011-12-22 --------------------- -* Brand spanking new Streaming Cursor support Issue #458 (https://github.com/christkv/node-mongodb-native/pull/458) thanks to Mr Aaron Heckmann - -0.9.7.2-4 2011-12-21 --------------------- -* Refactoring of callback code to work around performance regression on linux -* Fixed group function to correctly use the command mode as default - -0.9.7.2-3 2011-12-18 --------------------- -* Fixed error handling for findAndModify while still working for mongodb 1.8.6 (Issue #450). -* Allow for force send query to primary, pass option (read:'primary') on find command. - * ``find({a:1}, {read:'primary'}).toArray(function(err, items) {});`` - -0.9.7.2-2 2011-12-16 --------------------- -* Fixes infinite streamRecords QueryFailure fix when using Mongos (Issue #442) - -0.9.7.2-1 2011-12-16 --------------------- -* ~10% perf improvement for ObjectId#toHexString (Issue #448, https://github.com/aheckmann) -* Only using process.nextTick on errors emitted on callbacks not on all parsing, reduces number of ticks in the driver -* Changed parsing off bson messages to use process.nextTick to do bson parsing in batches if the message is over 10K as to yield more time to the event look increasing concurrency on big mongoreply messages with multiple documents - -0.9.7.2 2011-12-15 ------------------- -* Added SSL support for future version of mongodb (VERY VERY EXPERIMENTAL) - * pass in the ssl:true option to the server or replicaset server config to enable - * a bug either in mongodb or node.js does not allow for more than 1 connection pr db instance (poolSize:1). -* Added getTimestamp() method to objectID that returns a date object -* Added finalize function to collection.group - * function group (keys, condition, initial, reduce, finalize, command, callback) -* Reaper no longer using setTimeout to handle reaping. Triggering is done in the general flow leading to predictable behavior. - * reaperInterval, set interval for reaper (default 10000 miliseconds) - * reaperTimeout, set timeout for calls (default 30000 miliseconds) - * reaper, enable/disable reaper (default false) -* Work around for issues with findAndModify during high concurrency load, insure that the behavior is the same across the 1.8.X branch and 2.X branch of MongoDb -* Reworked multiple db's sharing same connection pool to behave correctly on error, timeout and close -* EnsureIndex command can be executed without a callback (Issue #438) -* Eval function no accepts options including nolock (Issue #432) - * eval(code, parameters, options, callback) (where options = {nolock:true}) - -0.9.7.1-4 2011-11-27 --------------------- -* Replaced install.sh with install.js to install correctly on all supported os's - -0.9.7.1-3 2011-11-27 --------------------- -* Fixes incorrect scope for ensureIndex error wrapping (Issue #419) https://github.com/ritch - -0.9.7.1-2 2011-11-27 --------------------- -* Set statistical selection strategy as default for secondary choice. - -0.9.7.1-1 2011-11-27 --------------------- -* Better handling of single server reconnect (fixes some bugs) -* Better test coverage of single server failure -* Correct handling of callbacks on replicaset servers when firewall dropping packets, correct reconnect - -0.9.7.1 2011-11-24 ------------------- -* Better handling of dead server for single server instances -* FindOne and find treats selector == null as {}, Issue #403 -* Possible to pass in a strategy for the replicaset to pick secondary reader node - * parameter strategy - * ping (default), pings the servers and picks the one with the lowest ping time - * statistical, measures each request and pick the one with the lowest mean and std deviation -* Set replicaset read preference replicaset.setReadPreference() - * Server.READ_PRIMARY (use primary server for reads) - * Server.READ_SECONDARY (from a secondary server (uses the strategy set)) - * tags, {object of tags} -* Added replay of commands issued to a closed connection when the connection is re-established -* Fix isConnected and close on unopened connections. Issue #409, fix by (https://github.com/sethml) -* Moved reaper to db.open instead of constructor (Issue #406) -* Allows passing through of socket connection settings to Server or ReplSetServer under the option socketOptions - * timeout = set seconds before connection times out (default 0) - * noDelay = Disables the Nagle algorithm (default true) - * keepAlive = Set if keepAlive is used (default 0, which means no keepAlive, set higher than 0 for keepAlive) - * encoding = ['ascii', 'utf8', or 'base64'] (default null) -* Fixes for handling of errors during shutdown off a socket connection -* Correctly applies socket options including timeout -* Cleanup of test management code to close connections correctly -* Handle parser errors better, closing down the connection and emitting an error -* Correctly emit errors from server.js only wrapping errors that are strings - -0.9.7 2011-11-10 ----------------- -* Added priority setting to replicaset manager -* Added correct handling of passive servers in replicaset -* Reworked socket code for simpler clearer handling -* Correct handling of connections in test helpers -* Added control of retries on failure - * control with parameters retryMiliSeconds and numberOfRetries when creating a db instance -* Added reaper that will timeout and cleanup queries that never return - * control with parameters reaperInterval and reaperTimeout when creating a db instance -* Refactored test helper classes for replicaset tests -* Allows raw (no bson parser mode for insert, update, remove, find and findOne) - * control raw mode passing in option raw:true on the commands - * will return buffers with the binary bson objects -* Fixed memory leak in cursor.toArray -* Fixed bug in command creation for mongodb server with wrong scope of call -* Added db(dbName) method to db.js to allow for reuse of connections against other databases -* Serialization of functions in an object is off by default, override with parameter - * serializeFunctions [true/false] on db level, collection level or individual insert/update/findAndModify -* Added Long.fromString to c++ class and fixed minor bug in the code (Test case for $gt operator on 64-bit integers, Issue #394) -* FindOne and find now share same code execution and will work in the same manner, Issue #399 -* Fix for tailable cursors, Issue #384 -* Fix for Cursor rewind broken, Issue #389 -* Allow Gridstore.exist to query using regexp, Issue #387, fix by (https://github.com/kaij) -* Updated documentation on https://github.com/christkv/node-mongodb-native -* Fixed toJSON methods across all objects for BSON, Binary return Base64 Encoded data - -0.9.6-22 2011-10-15 -------------------- -* Fixed bug in js bson parser that could cause wrong object size on serialization, Issue #370 -* Fixed bug in findAndModify that did not throw error on replicaset timeout, Issue #373 - -0.9.6-21 2011-10-05 -------------------- -* Reworked reconnect code to work correctly -* Handling errors in different parts of the code to ensure that it does not lock the connection -* Consistent error handling for Object.createFromHexString for JS and C++ - -0.9.6-20 2011-10-04 -------------------- -* Reworked bson.js parser to get rid off Array.shift() due to it allocating new memory for each call. Speedup varies between 5-15% depending on doc -* Reworked bson.cc to throw error when trying to serialize js bson types -* Added MinKey, MaxKey and Double support for JS and C++ parser -* Reworked socket handling code to emit errors on unparsable messages -* Added logger option for Db class, lets you pass in a function in the shape - { - log : function(message, object) {}, - error : function(errorMessage, errorObject) {}, - debug : function(debugMessage, object) {}, - } - - Usage is new Db(new Server(..), {logger: loggerInstance}) - -0.9.6-19 2011-09-29 -------------------- -* Fixing compatibility issues between C++ bson parser and js parser -* Added Symbol support to C++ parser -* Fixed socket handling bug for seldom misaligned message from mongodb -* Correctly handles serialization of functions using the C++ bson parser - -0.9.6-18 2011-09-22 -------------------- -* Fixed bug in waitForConnection that would lead to 100% cpu usage, Issue #352 - -0.9.6-17 2011-09-21 -------------------- -* Fixed broken exception test causing bamboo to hang -* Handling correctly command+lastError when both return results as in findAndModify, Issue #351 - -0.9.6-16 2011-09-14 -------------------- -* Fixing a bunch of issues with compatibility with MongoDB 2.0.X branch. Some fairly big changes in behavior from 1.8.X to 2.0.X on the server. -* Error Connection MongoDB V2.0.0 with Auth=true, Issue #348 - -0.9.6-15 2011-09-09 -------------------- -* Fixed issue where pools would not be correctly cleaned up after an error, Issue #345 -* Fixed authentication issue with secondary servers in Replicaset, Issue #334 -* Duplicate replica-set servers when omitting port, Issue #341 -* Fixing findAndModify to correctly work with Replicasets ensuring proper error handling, Issue #336 -* Merged in code from (https://github.com/aheckmann) that checks for global variable leaks - -0.9.6-14 2011-09-05 -------------------- -* Minor fixes for error handling in cursor streaming (https://github.com/sethml), Issue #332 -* Minor doc fixes -* Some more cursor sort tests added, Issue #333 -* Fixes to work with 0.5.X branch -* Fix Db not removing reconnect listener from serverConfig, (https://github.com/sbrekken), Issue #337 -* Removed node_events.h includes (https://github.com/jannehietamaki), Issue #339 -* Implement correct safe/strict mode for findAndModify. - -0.9.6-13 2011-08-24 -------------------- -* Db names correctly error checked for illegal characters - -0.9.6-12 2011-08-24 -------------------- -* Nasty bug in GridFS if you changed the default chunk size -* Fixed error handling bug in findOne - -0.9.6-11 2011-08-23 -------------------- -* Timeout option not correctly making it to the cursor, Issue #320, Fix from (https://github.com/year2013) -* Fixes for memory leaks when using buffers and C++ parser -* Fixes to make tests pass on 0.5.X -* Cleanup of bson.js to remove duplicated code paths -* Fix for errors occurring in ensureIndex, Issue #326 -* Removing require.paths to make tests work with the 0.5.X branch - -0.9.6-10 2011-08-11 -------------------- -* Specific type Double for capped collections (https://github.com/mbostock), Issue #312 -* Decorating Errors with all all object info from Mongo (https://github.com/laurie71), Issue #308 -* Implementing fixes for mongodb 1.9.1 and higher to make tests pass -* Admin validateCollection now takes an options argument for you to pass in full option -* Implemented keepGoing parameter for mongodb 1.9.1 or higher, Issue #310 -* Added test for read_secondary count issue, merged in fix from (https://github.com/year2013), Issue #317 - -0.9.6-9 -------- -* Bug fix for bson parsing the key '':'' correctly without crashing - -0.9.6-8 -------- -* Changed to using node.js crypto library MD5 digest -* Connect method support documented mongodb: syntax by (https://github.com/sethml) -* Support Symbol type for BSON, serializes to it's own type Symbol, Issue #302, #288 -* Code object without scope serializing to correct BSON type -* Lot's of fixes to avoid double callbacks (https://github.com/aheckmann) Issue #304 -* Long deserializes as Number for values in the range -2^53 to 2^53, Issue #305 (https://github.com/sethml) -* Fixed C++ parser to reflect JS parser handling of long deserialization -* Bson small optimizations - -0.9.6-7 2011-07-13 ------------------- -* JS Bson deserialization bug #287 - -0.9.6-6 2011-07-12 ------------------- -* FindAndModify not returning error message as other methods Issue #277 -* Added test coverage for $push, $pushAll and $inc atomic operations -* Correct Error handling for non 12/24 bit ids on Pure JS ObjectID class Issue #276 -* Fixed terrible deserialization bug in js bson code #285 -* Fix by andrewjstone to avoid throwing errors when this.primary not defined - -0.9.6-5 2011-07-06 ------------------- -* Rewritten BSON js parser now faster than the C parser on my core2duo laptop -* Added option full to indexInformation to get all index info Issue #265 -* Passing in ObjectID for new Gridstore works correctly Issue #272 - -0.9.6-4 2011-07-01 ------------------- -* Added test and bug fix for insert/update/remove without callback supplied - -0.9.6-3 2011-07-01 ------------------- -* Added simple grid class called Grid with put, get, delete methods -* Fixed writeBuffer/readBuffer methods on GridStore so they work correctly -* Automatic handling of buffers when using write method on GridStore -* GridStore now accepts a ObjectID instead of file name for write and read methods -* GridStore.list accepts id option to return of file ids instead of filenames -* GridStore close method returns document for the file allowing user to reference _id field - -0.9.6-2 2011-06-30 ------------------- -* Fixes for reconnect logic for server object (replays auth correctly) -* More testcases for auth -* Fixes in error handling for replicaset -* Fixed bug with safe parameter that would fail to execute safe when passing w or wtimeout -* Fixed slaveOk bug for findOne method -* Implemented auth support for replicaset and test cases -* Fixed error when not passing in rs_name - -0.9.6-1 2011-06-25 ------------------- -* Fixes for test to run properly using c++ bson parser -* Fixes for dbref in native parser (correctly handles ref without db component) -* Connection fixes for replicasets to avoid runtime conditions in cygwin (https://github.com/vincentcr) -* Fixes for timestamp in js bson parser (distinct timestamp type now) - -0.9.6 2011-06-21 ----------------- -* Worked around npm version handling bug -* Race condition fix for cygwin (https://github.com/vincentcr) - -0.9.5-1 2011-06-21 ------------------- -* Extracted Timestamp as separate class for bson js parser to avoid instanceof problems -* Fixed driver strict mode issue - -0.9.5 2011-06-20 ----------------- -* Replicaset support (failover and reading from secondary servers) -* Removed ServerPair and ServerCluster -* Added connection pool functionality -* Fixed serious bug in C++ bson parser where bytes > 127 would generate 2 byte sequences -* Allows for forcing the server to assign ObjectID's using the option {forceServerObjectId: true} - -0.6.8 ------ -* Removed multiple message concept from bson -* Changed db.open(db) to be db.open(err, db) - -0.1 2010-01-30 --------------- -* Initial release support of driver using native node.js interface -* Supports gridfs specification -* Supports admin functionality diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/LICENSE b/Databases/node_modules/mongoose/node_modules/mongodb/LICENSE deleted file mode 100644 index ad410e11..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/Makefile b/Databases/node_modules/mongoose/node_modules/mongodb/Makefile deleted file mode 100644 index 36e12024..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -NODE = node -NPM = npm -JSDOC = jsdoc -name = all - -generate_docs: - # cp -R ./HISTORY.md ./docs/content/meta/release-notes.md - hugo -s docs/reference -d ../../public - $(JSDOC) -c conf.json -t docs/jsdoc-template/ -d ./public/api - cp -R ./public/api/scripts ./public/. - cp -R ./public/api/styles ./public/. diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/README.md deleted file mode 100644 index 28287139..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/README.md +++ /dev/null @@ -1,322 +0,0 @@ -[![NPM](https://nodei.co/npm/mongodb.png?downloads=true&downloadRank=true)](https://nodei.co/npm/mongodb/) [![NPM](https://nodei.co/npm-dl/mongodb.png?months=6&height=3)](https://nodei.co/npm/mongodb/) - -[![Build Status](https://secure.travis-ci.org/mongodb/node-mongodb-native.png)](http://travis-ci.org/mongodb/node-mongodb-native) - -[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/mongodb/node-mongodb-native?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - -# Description - -The MongoDB driver is the high level part of the 2.0 or higher MongoDB driver and is meant for end users. - -## MongoDB Node.JS Driver - -| what | where | -|---------------|------------------------------------------------| -| documentation | http://mongodb.github.io/node-mongodb-native/ | -| api-doc | http://mongodb.github.io/node-mongodb-native/2.0/api/ | -| source | https://github.com/mongodb/node-mongodb-native | -| mongodb | http://www.mongodb.org/ | - -### Blogs of Engineers involved in the driver -- Christian Kvalheim [@christkv](https://twitter.com/christkv) - -### Bugs / Feature Requests - -Think you’ve found a bug? Want to see a new feature in node-mongodb-native? Please open a -case in our issue management tool, JIRA: - -- Create an account and login . -- Navigate to the NODE project . -- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it. - -Bug reports in JIRA for all driver projects (i.e. NODE, PYTHON, CSHARP, JAVA) and the -Core Server (i.e. SERVER) project are **public**. - -### Questions and Bug Reports - - * mailing list: https://groups.google.com/forum/#!forum/node-mongodb-native - * jira: http://jira.mongodb.org/ - -### Change Log - -http://jira.mongodb.org/browse/NODE - -QuickStart -========== -The quick start guide will show you how to setup a simple application using node.js and MongoDB. Its scope is only how to set up the driver and perform the simple crud operations. For more in depth coverage we encourage reading the tutorials. - -Create the package.json file ----------------------------- -Let's create a directory where our application will live. In our case we will put this under our projects directory. - -``` -mkdir myproject -cd myproject -``` - -Enter the following command and answer the questions to create the initial structure for your new project - -``` -npm init -``` - -Next we need to edit the generated package.json file to add the dependency for the MongoDB driver. The package.json file below is just an example and your will look different depending on how you answered the questions after entering `npm init` - -``` -{ - "name": "myproject", - "version": "1.0.0", - "description": "My first project", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/christkv/myfirstproject.git" - }, - "dependencies": { - "mongodb": "~2.0" - }, - "author": "Christian Kvalheim", - "license": "Apache 2.0", - "bugs": { - "url": "https://github.com/christkv/myfirstproject/issues" - }, - "homepage": "https://github.com/christkv/myfirstproject" -} -``` - -Save the file and return to the shell or command prompt and use **NPM** to install all the dependencies. - -``` -npm install -``` - -You should see **NPM** download a lot of files. Once it's done you'll find all the downloaded packages under the **node_modules** directory. - -Booting up a MongoDB Server ---------------------------- -Let's boot up a MongoDB server instance. Download the right MongoDB version from [MongoDB](http://www.mongodb.org), open a new shell or command line and ensure the **mongod** command is in the shell or command line path. Now let's create a database directory (in our case under **/data**). - -``` -mongod --dbpath=/data --port 27017 -``` - -You should see the **mongod** process start up and print some status information. - -Connecting to MongoDB ---------------------- -Let's create a new **app.js** file that we will use to show the basic CRUD operations using the MongoDB driver. - -First let's add code to connect to the server and the database **myproject**. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - db.close(); -}); -``` - -Given that you booted up the **mongod** process earlier the application should connect successfully and print **Connected correctly to server** to the console. - -Let's Add some code to show the different CRUD operations available. - -Inserting a Document --------------------- -Let's create a function that will insert some documents for us. - -```js -var insertDocuments = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Insert some documents - collection.insert([ - {a : 1}, {a : 2}, {a : 3} - ], function(err, result) { - assert.equal(err, null); - assert.equal(3, result.result.n); - assert.equal(3, result.ops.length); - console.log("Inserted 3 documents into the document collection"); - callback(result); - }); -} -``` - -The insert command will return a results object that contains several fields that might be useful. - -* **result** Contains the result document from MongoDB -* **ops** Contains the documents inserted with added **_id** fields -* **connection** Contains the connection used to perform the insert - -Let's add call the **insertDocuments** command to the **MongoClient.connect** method callback. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - db.close(); - }); -}); -``` - -We can now run the update **app.js** file. - -``` -node app.js -``` - -You should see the following output after running the **app.js** file. - -``` -Connected correctly to server -Inserted 3 documents into the document collection -``` - -Updating a document -------------------- -Let's look at how to do a simple document update by adding a new field **b** to the document that has the field **a** set to **2**. - -```js -var updateDocument = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Update document where a is 2, set b equal to 1 - collection.update({ a : 2 } - , { $set: { b : 1 } }, function(err, result) { - assert.equal(err, null); - assert.equal(1, result.result.n); - console.log("Updated the document with the field a equal to 2"); - callback(result); - }); -} -``` - -The method will update the first document where the field **a** is equal to **2** by adding a new field **b** to the document set to **1**. Let's update the callback function from **MongoClient.connect** to include the update method. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - updateDocument(db, function() { - db.close(); - }); - }); -}); -``` - -Remove a document ------------------ -Next lets remove the document where the field **a** equals to **3**. - -```js -var removeDocument = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Insert some documents - collection.remove({ a : 3 }, function(err, result) { - assert.equal(err, null); - assert.equal(1, result.result.n); - console.log("Removed the document with the field a equal to 3"); - callback(result); - }); -} -``` - -This will remove the first document where the field **a** equals to **3**. Let's add the method to the **MongoClient.connect** callback function. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - updateDocument(db, function() { - removeDocument(db, function() { - db.close(); - }); - }); - }); -}); -``` - -Finally let's retrieve all the documents using a simple find. - -Find All Documents ------------------- -We will finish up the Quickstart CRUD methods by performing a simple query that returns all the documents matching the query. - -```js -var findDocuments = function(db, callback) { - // Get the documents collection - var collection = db.collection('documents'); - // Find some documents - collection.find({}).toArray(function(err, docs) { - assert.equal(err, null); - assert.equal(2, docs.length); - console.log("Found the following records"); - console.dir(docs); - callback(docs); - }); -} -``` - -This query will return all the documents in the **documents** collection. Since we removed a document the total documents returned is **2**. Finally let's add the findDocument method to the **MongoClient.connect** callback. - -```js -var MongoClient = require('mongodb').MongoClient - , assert = require('assert'); - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - insertDocuments(db, function() { - updateDocument(db, function() { - removeDocument(db, function() { - findDocuments(db, function() { - db.close(); - }); - }); - }); - }); -}); -``` - -This concludes the QuickStart of connecting and performing some Basic operations using the MongoDB Node.js driver. For more detailed information you can look at the tutorials covering more specific topics of interest. - -## Next Steps - - * [MongoDB Documentation](http://mongodb.org/) - * [Read about Schemas](http://learnmongodbthehardway.com/) - * [Star us on GitHub](https://github.com/mongodb/node-mongodb-native) diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/c.js b/Databases/node_modules/mongoose/node_modules/mongodb/c.js deleted file mode 100644 index 5b6bc1eb..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/c.js +++ /dev/null @@ -1,24 +0,0 @@ -var MongoClient = require('./').MongoClient; - -var index = 0; - -MongoClient.connect('mongodb://localhost:27017/test', function(err, db) { - setInterval(function() { - db = db.db("index" + index, {noListener:true}); - var collection = db.collection("index" + index); - collection.insert({a:index}) - }, 1); -}); - -// var Server = require('./').Server, -// Db = require('./').Db, -// ReadPreference = require('./').ReadPreference; -// -// new Db('test', new Server('localhost', 31001), {readPreference: ReadPreference.SECONDARY}).open(function(err, db) { -// -// db.collection('test').find().toArray(function(err, docs) { -// console.dir(err) -// console.dir(docs) -// db.close(); -// }); -// }); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/conf.json b/Databases/node_modules/mongoose/node_modules/mongodb/conf.json deleted file mode 100644 index 15f3021d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/conf.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "plugins": ["plugins/markdown", "docs/lib/jsdoc/examples_plugin.js"], - "source": { - "include": [ - "test/functional/operation_example_tests.js", - "test/functional/operation_promises_example_tests.js", - "test/functional/operation_generators_example_tests.js", - "test/functional/authentication_tests.js", - "lib/admin.js", - "lib/collection.js", - "lib/cursor.js", - "lib/aggregation_cursor.js", - "lib/command_cursor.js", - "lib/db.js", - "lib/mongo_client.js", - "lib/mongos.js", - "lib/read_preference.js", - "lib/replset.js", - "lib/server.js", - "lib/bulk/common.js", - "lib/bulk/ordered.js", - "lib/bulk/unordered.js", - "lib/gridfs/grid_store.js", - "node_modules/mongodb-core/lib/error.js", - "node_modules/mongodb-core/lib/connection/logger.js", - "node_modules/bson/lib/bson/binary.js", - "node_modules/bson/lib/bson/code.js", - "node_modules/bson/lib/bson/db_ref.js", - "node_modules/bson/lib/bson/double.js", - "node_modules/bson/lib/bson/long.js", - "node_modules/bson/lib/bson/objectid.js", - "node_modules/bson/lib/bson/symbol.js", - "node_modules/bson/lib/bson/timestamp.js", - "node_modules/bson/lib/bson/max_key.js", - "node_modules/bson/lib/bson/min_key.js" - ] - }, - "templates": { - "cleverLinks": true, - "monospaceLinks": true, - "default": { - "outputSourceFiles" : true - }, - "applicationName": "Node.js MongoDB Driver API", - "disqus": true, - "googleAnalytics": "UA-29229787-1", - "openGraph": { - "title": "", - "type": "website", - "image": "", - "site_name": "", - "url": "" - }, - "meta": { - "title": "", - "description": "", - "keyword": "" - }, - "linenums": true - }, - "markdown": { - "parser": "gfm", - "hardwrap": true, - "tags": ["examples"] - }, - "examples": { - "indent": 4 - } -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/index.js b/Databases/node_modules/mongoose/node_modules/mongodb/index.js deleted file mode 100644 index df24555a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/index.js +++ /dev/null @@ -1,47 +0,0 @@ -// Core module -var core = require('mongodb-core'), - Instrumentation = require('./lib/apm'); - -// Set up the connect function -var connect = require('./lib/mongo_client').connect; - -// Expose error class -connect.MongoError = core.MongoError; - -// Actual driver classes exported -connect.MongoClient = require('./lib/mongo_client'); -connect.Db = require('./lib/db'); -connect.Collection = require('./lib/collection'); -connect.Server = require('./lib/server'); -connect.ReplSet = require('./lib/replset'); -connect.Mongos = require('./lib/mongos'); -connect.ReadPreference = require('./lib/read_preference'); -connect.GridStore = require('./lib/gridfs/grid_store'); -connect.Chunk = require('./lib/gridfs/chunk'); -connect.Logger = core.Logger; -connect.Cursor = require('./lib/cursor'); - -// BSON types exported -connect.Binary = core.BSON.Binary; -connect.Code = core.BSON.Code; -connect.DBRef = core.BSON.DBRef; -connect.Double = core.BSON.Double; -connect.Long = core.BSON.Long; -connect.MinKey = core.BSON.MinKey; -connect.MaxKey = core.BSON.MaxKey; -connect.ObjectID = core.BSON.ObjectID; -connect.ObjectId = core.BSON.ObjectID; -connect.Symbol = core.BSON.Symbol; -connect.Timestamp = core.BSON.Timestamp; - -// Add connect method -connect.connect = connect; - -// Set up the instrumentation method -connect.instrument = function(options, callback) { - if(typeof options == 'function') callback = options, options = {}; - return new Instrumentation(core, options, callback); -} - -// Set our exports to be the connect function -module.exports = connect; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/admin.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/admin.js deleted file mode 100644 index 1f89512b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/admin.js +++ /dev/null @@ -1,581 +0,0 @@ -"use strict"; - -var toError = require('./utils').toError, - Define = require('./metadata'), - shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **Admin** class is an internal class that allows convenient access to - * the admin functionality and commands for MongoDB. - * - * **ADMIN Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Use the admin database for the operation - * var adminDb = db.admin(); - * - * // List all the available databases - * adminDb.listDatabases(function(err, dbs) { - * test.equal(null, err); - * test.ok(dbs.databases.length > 0); - * db.close(); - * }); - * }); - */ - -/** - * Create a new Admin instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @return {Admin} a collection instance. - */ -var Admin = function(db, topology, promiseLibrary) { - if(!(this instanceof Admin)) return new Admin(db, topology); - var self = this; - - // Internal state - this.s = { - db: db - , topology: topology - , promiseLibrary: promiseLibrary - } -} - -var define = Admin.define = new Define('Admin', Admin, false); - -/** - * The callback format for results - * @callback Admin~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result object if the command was executed successfully. - */ - -/** - * Execute a command - * @method - * @param {object} command The command hash - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxTimeMS=null] Number of milliseconds to wait before aborting the query. - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.command = function(command, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - - // Execute using callback - if(typeof callback == 'function') return this.s.db.executeDbAdminCommand(command, options, function(err, doc) { - return callback != null ? callback(err, doc) : null; - }); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand(command, options, function(err, doc) { - if(err) return reject(err); - resolve(doc); - }); - }); -} - -define.classMethod('command', {callback: true, promise:true}); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.buildInfo = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return this.serverInfo(callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.serverInfo(function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('buildInfo', {callback: true, promise:true}); - -/** - * Retrieve the server information for the current - * instance of the db client - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.serverInfo = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return this.s.db.executeDbAdminCommand({buildinfo:1}, function(err, doc) { - if(err != null) return callback(err, null); - callback(null, doc); - }); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand({buildinfo:1}, function(err, doc) { - if(err) return reject(err); - resolve(doc); - }); - }); -} - -define.classMethod('serverInfo', {callback: true, promise:true}); - -/** - * Retrieve this db's server status. - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.serverStatus = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return serverStatus(self, callback) - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - serverStatus(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var serverStatus = function(self, callback) { - self.s.db.executeDbAdminCommand({serverStatus: 1}, function(err, doc) { - if(err == null && doc.ok === 1) { - callback(null, doc); - } else { - if(err) return callback(err, false); - return callback(toError(doc), false); - } - }); -} - -define.classMethod('serverStatus', {callback: true, promise:true}); - -/** - * Retrieve the current profiling Level for MongoDB - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.profilingLevel = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return profilingLevel(self, callback) - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - profilingLevel(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var profilingLevel = function(self, callback) { - self.s.db.executeDbAdminCommand({profile:-1}, function(err, doc) { - doc = doc; - - if(err == null && doc.ok === 1) { - var was = doc.was; - if(was == 0) return callback(null, "off"); - if(was == 1) return callback(null, "slow_only"); - if(was == 2) return callback(null, "all"); - return callback(new Error("Error: illegal profiling level value " + was), null); - } else { - err != null ? callback(err, null) : callback(new Error("Error with profile command"), null); - } - }); -} - -define.classMethod('profilingLevel', {callback: true, promise:true}); - -/** - * Ping the MongoDB server and retrieve results - * - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.ping = function(options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - - // Execute using callback - if(typeof callback == 'function') return this.s.db.executeDbAdminCommand({ping: 1}, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand({ping: 1}, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('ping', {callback: true, promise:true}); - -/** - * Authenticate a user against the server. - * @method - * @param {string} username The username. - * @param {string} [password] The password. - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.authenticate = function(username, password, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options); - options.authdb = 'admin'; - - // Execute using callback - if(typeof callback == 'function') return this.s.db.authenticate(username, password, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.authenticate(username, password, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('authenticate', {callback: true, promise:true}); - -/** - * Logout user from server, fire off on all connections and remove all auth info - * @method - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.logout = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return this.s.db.logout({authdb: 'admin'}, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.logout({authdb: 'admin'}, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('logout', {callback: true, promise:true}); - -// Get write concern -var writeConcern = function(options, db) { - options = shallowClone(options); - - // If options already contain write concerns return it - if(options.w || options.wtimeout || options.j || options.fsync) { - return options; - } - - // Set db write concern if available - if(db.writeConcern) { - if(options.w) options.w = db.writeConcern.w; - if(options.wtimeout) options.wtimeout = db.writeConcern.wtimeout; - if(options.j) options.j = db.writeConcern.j; - if(options.fsync) options.fsync = db.writeConcern.fsync; - } - - // Return modified options - return options; -} - -/** - * Add a user to the database. - * @method - * @param {string} username The username. - * @param {string} password The password. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {object} [options.customData=null] Custom data associated with the user (only Mongodb 2.6 or higher) - * @param {object[]} [options.roles=null] Roles associated with the created user (only Mongodb 2.6 or higher) - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.addUser = function(username, password, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - // Get the options - options = writeConcern(options, self.s.db) - // Set the db name to admin - options.dbName = 'admin'; - - // Execute using callback - if(typeof callback == 'function') - return self.s.db.addUser(username, password, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.addUser(username, password, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('addUser', {callback: true, promise:true}); - -/** - * Remove a user from a database - * @method - * @param {string} username The username. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {Admin~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.removeUser = function(username, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - // Get the options - options = writeConcern(options, self.s.db) - // Set the db name - options.dbName = 'admin'; - - // Execute using callback - if(typeof callback == 'function') - return self.s.db.removeUser(username, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.removeUser(username, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('removeUser', {callback: true, promise:true}); - -/** - * Set the current profiling level of MongoDB - * - * @param {string} level The new profiling level (off, slow_only, all). - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.setProfilingLevel = function(level, callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return setProfilingLevel(self, level, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - setProfilingLevel(self, level, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var setProfilingLevel = function(self, level, callback) { - var command = {}; - var profile = 0; - - if(level == "off") { - profile = 0; - } else if(level == "slow_only") { - profile = 1; - } else if(level == "all") { - profile = 2; - } else { - return callback(new Error("Error: illegal profiling level value " + level)); - } - - // Set up the profile number - command['profile'] = profile; - - self.s.db.executeDbAdminCommand(command, function(err, doc) { - doc = doc; - - if(err == null && doc.ok === 1) - return callback(null, level); - return err != null ? callback(err, null) : callback(new Error("Error with profile command"), null); - }); -} - -define.classMethod('setProfilingLevel', {callback: true, promise:true}); - -/** - * Retrive the current profiling information for MongoDB - * - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.profilingInfo = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return profilingInfo(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - profilingInfo(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var profilingInfo = function(self, callback) { - try { - self.s.topology.cursor("admin.system.profile", { find: 'system.profile', query: {}}, {}).toArray(callback); - } catch (err) { - return callback(err, null); - } -} - -define.classMethod('profilingLevel', {callback: true, promise:true}); - -/** - * Validate an existing collection - * - * @param {string} collectionName The name of the collection to validate. - * @param {object} [options=null] Optional settings. - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.validateCollection = function(collectionName, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') - return validateCollection(self, collectionName, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - validateCollection(self, collectionName, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var validateCollection = function(self, collectionName, options, callback) { - var command = {validate: collectionName}; - var keys = Object.keys(options); - - // Decorate command with extra options - for(var i = 0; i < keys.length; i++) { - if(options.hasOwnProperty(keys[i])) { - command[keys[i]] = options[keys[i]]; - } - } - - self.s.db.command(command, function(err, doc) { - if(err != null) return callback(err, null); - - if(doc.ok === 0) - return callback(new Error("Error with validate command"), null); - if(doc.result != null && doc.result.constructor != String) - return callback(new Error("Error with validation data"), null); - if(doc.result != null && doc.result.match(/exception|corrupt/) != null) - return callback(new Error("Error: invalid collection " + collectionName), null); - if(doc.valid != null && !doc.valid) - return callback(new Error("Error: invalid collection " + collectionName), null); - - return callback(null, doc); - }); -} - -define.classMethod('validateCollection', {callback: true, promise:true}); - -/** - * List the available databases - * - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.listDatabases = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return self.s.db.executeDbAdminCommand({listDatabases:1}, {}, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.executeDbAdminCommand({listDatabases:1}, {}, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('listDatabases', {callback: true, promise:true}); - -/** - * Get ReplicaSet status - * - * @param {Admin~resultCallback} [callback] The command result callback. - * @return {Promise} returns Promise if no callback passed - */ -Admin.prototype.replSetGetStatus = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return replSetGetStatus(self, callback); - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - replSetGetStatus(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var replSetGetStatus = function(self, callback) { - self.s.db.executeDbAdminCommand({replSetGetStatus:1}, function(err, doc) { - if(err == null && doc.ok === 1) - return callback(null, doc); - if(err) return callback(err, false); - callback(toError(doc), false); - }); -} - -define.classMethod('replSetGetStatus', {callback: true, promise:true}); - -module.exports = Admin; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js deleted file mode 100644 index 3663229d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/aggregation_cursor.js +++ /dev/null @@ -1,432 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , toError = require('./utils').toError - , getSingleProperty = require('./utils').getSingleProperty - , formattedOrderClause = require('./utils').formattedOrderClause - , handleCallback = require('./utils').handleCallback - , Logger = require('mongodb-core').Logger - , EventEmitter = require('events').EventEmitter - , ReadPreference = require('./read_preference') - , MongoError = require('mongodb-core').MongoError - , Readable = require('stream').Readable || require('readable-stream').Readable - , Define = require('./metadata') - , CoreCursor = require('./cursor') - , Query = require('mongodb-core').Query - , CoreReadPreference = require('mongodb-core').ReadPreference; - -/** - * @fileOverview The **AggregationCursor** class is an internal class that embodies an aggregation cursor on MongoDB - * allowing for iteration over the results returned from the underlying query. It supports - * one by one document iteration, conversion to an array or can be iterated as a Node 0.10.X - * or higher stream - * - * **AGGREGATIONCURSOR Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('createIndexExample1'); - * // Insert a bunch of documents - * col.insert([{a:1, b:1} - * , {a:2, b:2}, {a:3, b:3} - * , {a:4, b:4}], {w:1}, function(err, result) { - * test.equal(null, err); - * // Show that duplicate records got dropped - * col.aggregation({}, {cursor: {}}).toArray(function(err, items) { - * test.equal(null, err); - * test.equal(4, items.length); - * db.close(); - * }); - * }); - * }); - */ - -/** - * Namespace provided by the browser. - * @external Readable - */ - -/** - * Creates a new Aggregation Cursor instance (INTERNAL TYPE, do not instantiate directly) - * @class AggregationCursor - * @extends external:Readable - * @fires AggregationCursor#data - * @fires AggregationCursor#end - * @fires AggregationCursor#close - * @fires AggregationCursor#readable - * @return {AggregationCursor} an AggregationCursor instance. - */ -var AggregationCursor = function(bson, ns, cmd, options, topology, topologyOptions) { - CoreCursor.apply(this, Array.prototype.slice.call(arguments, 0)); - var self = this; - var state = AggregationCursor.INIT; - var streamOptions = {}; - - // MaxTimeMS - var maxTimeMS = null; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set up - Readable.call(this, {objectMode: true}); - - // Internal state - this.s = { - // MaxTimeMS - maxTimeMS: maxTimeMS - // State - , state: state - // Stream options - , streamOptions: streamOptions - // BSON - , bson: bson - // Namespae - , ns: ns - // Command - , cmd: cmd - // Options - , options: options - // Topology - , topology: topology - // Topology Options - , topologyOptions: topologyOptions - // Promise library - , promiseLibrary: promiseLibrary - } -} - -/** - * AggregationCursor stream data event, fired for each document in the cursor. - * - * @event AggregationCursor#data - * @type {object} - */ - -/** - * AggregationCursor stream end event - * - * @event AggregationCursor#end - * @type {null} - */ - -/** - * AggregationCursor stream close event - * - * @event AggregationCursor#close - * @type {null} - */ - -/** - * AggregationCursor stream readable event - * - * @event AggregationCursor#readable - * @type {null} - */ - -// Inherit from Readable -inherits(AggregationCursor, Readable); - -// Set the methods to inherit from prototype -var methodsToInherit = ['_next', 'next', 'each', 'forEach', 'toArray' - , 'rewind', 'bufferedCount', 'readBufferedDocuments', 'close', 'isClosed', 'kill' - , '_find', '_getmore', '_killcursor', 'isDead', 'explain', 'isNotified']; - -// Extend the Cursor -for(var name in CoreCursor.prototype) { - AggregationCursor.prototype[name] = CoreCursor.prototype[name]; -} - -var define = AggregationCursor.define = new Define('AggregationCursor', AggregationCursor, true); - -/** - * Set the batch size for the cursor. - * @method - * @param {number} value The batchSize for the cursor. - * @throws {MongoError} - * @return {AggregationCursor} - */ -AggregationCursor.prototype.batchSize = function(value) { - if(this.s.state == AggregationCursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true }); - if(typeof value != 'number') throw MongoError.create({message: "batchSize requires an integer", drvier:true }); - if(this.s.cmd.cursor) this.s.cmd.cursor.batchSize = value; - this.setCursorBatchSize(value); - return this; -} - -define.classMethod('batchSize', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a geoNear stage to the aggregation pipeline - * @method - * @param {object} document The geoNear stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.geoNear = function(document) { - this.s.cmd.pipeline.push({$geoNear: document}); - return this; -} - -define.classMethod('geoNear', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a group stage to the aggregation pipeline - * @method - * @param {object} document The group stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.group = function(document) { - this.s.cmd.pipeline.push({$group: document}); - return this; -} - -define.classMethod('group', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a limit stage to the aggregation pipeline - * @method - * @param {number} value The state limit value. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.limit = function(value) { - this.s.cmd.pipeline.push({$limit: value}); - return this; -} - -define.classMethod('limit', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a match stage to the aggregation pipeline - * @method - * @param {object} document The match stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.match = function(document) { - this.s.cmd.pipeline.push({$match: document}); - return this; -} - -define.classMethod('match', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a maxTimeMS stage to the aggregation pipeline - * @method - * @param {number} value The state maxTimeMS value. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.maxTimeMS = function(value) { - if(this.s.topology.lastIsMaster().minWireVersion > 2) { - this.s.cmd.maxTimeMS = value; - } - return this; -} - -define.classMethod('maxTimeMS', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a out stage to the aggregation pipeline - * @method - * @param {number} destination The destination name. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.out = function(destination) { - this.s.cmd.pipeline.push({$out: destination}); - return this; -} - -define.classMethod('out', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a project stage to the aggregation pipeline - * @method - * @param {object} document The project stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.project = function(document) { - this.s.cmd.pipeline.push({$project: document}); - return this; -} - -define.classMethod('project', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a redact stage to the aggregation pipeline - * @method - * @param {object} document The redact stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.redact = function(document) { - this.s.cmd.pipeline.push({$redact: document}); - return this; -} - -define.classMethod('redact', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a skip stage to the aggregation pipeline - * @method - * @param {number} value The state skip value. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.skip = function(value) { - this.s.cmd.pipeline.push({$skip: value}); - return this; -} - -define.classMethod('skip', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a sort stage to the aggregation pipeline - * @method - * @param {object} document The sort stage document. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.sort = function(document) { - this.s.cmd.pipeline.push({$sort: document}); - return this; -} - -define.classMethod('sort', {callback: false, promise:false, returns: [AggregationCursor]}); - -/** - * Add a unwind stage to the aggregation pipeline - * @method - * @param {number} field The unwind field name. - * @return {AggregationCursor} - */ -AggregationCursor.prototype.unwind = function(field) { - this.s.cmd.pipeline.push({$unwind: field}); - return this; -} - -define.classMethod('unwind', {callback: false, promise:false, returns: [AggregationCursor]}); - -AggregationCursor.prototype.get = AggregationCursor.prototype.toArray; - -// Inherited methods -define.classMethod('toArray', {callback: true, promise:true}); -define.classMethod('each', {callback: true, promise:false}); -define.classMethod('forEach', {callback: true, promise:false}); -define.classMethod('next', {callback: true, promise:true}); -define.classMethod('close', {callback: true, promise:true}); -define.classMethod('isClosed', {callback: false, promise:false, returns: [Boolean]}); -define.classMethod('rewind', {callback: false, promise:false}); -define.classMethod('bufferedCount', {callback: false, promise:false, returns: [Number]}); -define.classMethod('readBufferedDocuments', {callback: false, promise:false, returns: [Array]}); - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @function AggregationCursor.prototype.next - * @param {AggregationCursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback AggregationCursor~toArrayResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object[]} documents All the documents the satisfy the cursor. - */ - -/** - * Returns an array of documents. The caller is responsible for making sure that there - * is enough memory to store the results. Note that the array only contain partial - * results when this cursor had been previouly accessed. In that case, - * cursor.rewind() can be used to reset the cursor. - * @method AggregationCursor.prototype.toArray - * @param {AggregationCursor~toArrayResultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback AggregationCursor~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {(object|null)} result The result object if the command was executed successfully. - */ - -/** - * Iterates over all the documents for this cursor. As with **{cursor.toArray}**, - * not all of the elements will be iterated if this cursor had been previouly accessed. - * In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike - * **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements - * at any given time if batch size is specified. Otherwise, the caller is responsible - * for making sure that the entire result can fit the memory. - * @method AggregationCursor.prototype.each - * @param {AggregationCursor~resultCallback} callback The result callback. - * @throws {MongoError} - * @return {null} - */ - -/** - * Close the cursor, sending a AggregationCursor command and emitting close. - * @method AggregationCursor.prototype.close - * @param {AggregationCursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ - -/** - * Is the cursor closed - * @method AggregationCursor.prototype.isClosed - * @return {boolean} - */ - -/** - * Execute the explain for the cursor - * @method AggregationCursor.prototype.explain - * @param {AggregationCursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ - -/** - * Clone the cursor - * @function AggregationCursor.prototype.clone - * @return {AggregationCursor} - */ - -/** - * Resets the cursor - * @function AggregationCursor.prototype.rewind - * @return {AggregationCursor} - */ - -/** - * The callback format for the forEach iterator method - * @callback AggregationCursor~iteratorCallback - * @param {Object} doc An emitted document for the iterator - */ - -/** - * The callback error format for the forEach iterator method - * @callback AggregationCursor~endCallback - * @param {MongoError} error An error instance representing the error during the execution. - */ - -/* - * Iterates over all the documents for this cursor using the iterator, callback pattern. - * @method AggregationCursor.prototype.forEach - * @param {AggregationCursor~iteratorCallback} iterator The iteration callback. - * @param {AggregationCursor~endCallback} callback The end callback. - * @throws {MongoError} - * @return {null} - */ - -AggregationCursor.INIT = 0; -AggregationCursor.OPEN = 1; -AggregationCursor.CLOSED = 2; - -module.exports = AggregationCursor; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/apm.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/apm.js deleted file mode 100644 index aba5b863..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/apm.js +++ /dev/null @@ -1,571 +0,0 @@ -var EventEmitter = require('events').EventEmitter, - inherits = require('util').inherits; - -// Get prototypes -var AggregationCursor = require('./aggregation_cursor'), - CommandCursor = require('./command_cursor'), - OrderedBulkOperation = require('./bulk/ordered').OrderedBulkOperation, - UnorderedBulkOperation = require('./bulk/unordered').UnorderedBulkOperation, - GridStore = require('./gridfs/grid_store'), - Server = require('./server'), - ReplSet = require('./replset'), - Mongos = require('./mongos'), - Cursor = require('./cursor'), - Collection = require('./collection'), - Db = require('./db'), - Admin = require('./admin'); - -var basicOperationIdGenerator = { - operationId: 1, - - next: function() { - return this.operationId++; - } -} - -var basicTimestampGenerator = { - current: function() { - return new Date().getTime(); - }, - - duration: function(start, end) { - return end - start; - } -} - -var senstiveCommands = ['authenticate', 'saslStart', 'saslContinue', 'getnonce', - 'createUser', 'updateUser', 'copydbgetnonce', 'copydbsaslstart', 'copydb']; - -var Instrumentation = function(core, options, callback) { - options = options || {}; - - // Optional id generators - var operationIdGenerator = options.operationIdGenerator || basicOperationIdGenerator; - // Optional timestamp generator - var timestampGenerator = options.timestampGenerator || basicTimestampGenerator; - // Extend with event emitter functionality - EventEmitter.call(this); - - // Contains all the instrumentation overloads - this.overloads = []; - - // --------------------------------------------------------- - // - // Instrument prototype - // - // --------------------------------------------------------- - - var instrumentPrototype = function(callback) { - var instrumentations = [] - - // Classes to support - var classes = [GridStore, OrderedBulkOperation, UnorderedBulkOperation, - CommandCursor, AggregationCursor, Cursor, Collection, Db]; - - // Add instrumentations to the available list - for(var i = 0; i < classes.length; i++) { - if(classes[i].define) { - instrumentations.push(classes[i].define.generate()); - } - } - - // Return the list of instrumentation points - callback(null, instrumentations); - } - - // Did the user want to instrument the prototype - if(typeof callback == 'function') { - instrumentPrototype(callback); - } - - // --------------------------------------------------------- - // - // Server - // - // --------------------------------------------------------- - - // Reference - var self = this; - // Names of methods we need to wrap - var methods = ['command', 'insert', 'update', 'remove']; - // Prototype - var proto = core.Server.prototype; - // Core server method we are going to wrap - methods.forEach(function(x) { - var func = proto[x]; - - // Add to overloaded methods - self.overloads.push({proto: proto, name:x, func:func}); - - // The actual prototype - proto[x] = function() { - var requestId = core.Query.nextRequestId(); - // Get the aruments - var args = Array.prototype.slice.call(arguments, 0); - var ns = args[0]; - var commandObj = args[1]; - var options = args[2] || {}; - var keys = Object.keys(commandObj); - var commandName = keys[0]; - var db = ns.split('.')[0]; - - // Do we have a legacy insert/update/remove command - if(x == 'insert' && !this.lastIsMaster().maxWireVersion) { - commandName = 'insert'; - // Get the collection - var col = ns.split('.'); - col.shift(); - col = col.join('.'); - - // Re-write the command - commandObj = { - insert: col, documents: commandObj - } - - if(options.writeConcern) commandObj.writeConcern = options.writeConcern; - commandObj.ordered = options.ordered != undefined ? options.ordered : true; - } else if(x == 'update' && !this.lastIsMaster().maxWireVersion) { - commandName = 'update'; - - // Get the collection - var col = ns.split('.'); - col.shift(); - col = col.join('.'); - - // Re-write the command - commandObj = { - update: col, updates: commandObj - } - - if(options.writeConcern) commandObj.writeConcern = options.writeConcern; - commandObj.ordered = options.ordered != undefined ? options.ordered : true; - } else if(x == 'remove' && !this.lastIsMaster().maxWireVersion) { - commandName = 'delete'; - - // Get the collection - var col = ns.split('.'); - col.shift(); - col = col.join('.'); - - // Re-write the command - commandObj = { - delete: col, deletes: commandObj - } - - if(options.writeConcern) commandObj.writeConcern = options.writeConcern; - commandObj.ordered = options.ordered != undefined ? options.ordered : true; - } else if(x == 'insert' || x == 'update' || x == 'remove' && this.lastIsMaster().maxWireVersion >= 2) { - // Skip the insert/update/remove commands as they are executed as actual write commands in 2.6 or higher - return func.apply(this, args); - } - - // Get the callback - var callback = args.pop(); - // Set current callback operation id from the current context or create - // a new one - var ourOpId = callback.operationId || operationIdGenerator.next(); - - // Get a connection reference for this server instance - var connection = this.s.pool.get() - - // Emit the start event for the command - var command = { - // Returns the command. - command: commandObj, - // Returns the database name. - databaseName: db, - // Returns the command name. - commandName: commandName, - // Returns the driver generated request id. - requestId: requestId, - // Returns the driver generated operation id. - // This is used to link events together such as bulk write operations. OPTIONAL. - operationId: ourOpId, - // Returns the connection id for the command. For languages that do not have this, - // this MUST return the driver equivalent which MUST include the server address and port. - // The name of this field is flexible to match the object that is returned from the driver. - connectionId: connection - }; - - // Filter out any sensitive commands - if(senstiveCommands.indexOf(commandName.toLowerCase())) { - command.commandObj = {}; - command.commandObj[commandName] = true; - } - - // Emit the started event - self.emit('started', command) - - // Start time - var startTime = timestampGenerator.current(); - - // Push our handler callback - args.push(function(err, r) { - var endTime = timestampGenerator.current(); - var command = { - duration: timestampGenerator.duration(startTime, endTime), - commandName: commandName, - requestId: requestId, - operationId: ourOpId, - connectionId: connection - }; - - // If we have an error - if(err || (r.result.ok == 0)) { - command.failure = err || r.result.writeErrors || r.result; - - // Filter out any sensitive commands - if(senstiveCommands.indexOf(commandName.toLowerCase())) { - command.failure = {}; - } - - self.emit('failed', command); - } else { - command.reply = r; - - // Filter out any sensitive commands - if(senstiveCommands.indexOf(commandName.toLowerCase())) { - command.reply = {}; - } - - self.emit('succeeded', command); - } - - // Return to caller - callback(err, r); - }); - - // Apply the call - func.apply(this, args); - } - }); - - // --------------------------------------------------------- - // - // Bulk Operations - // - // --------------------------------------------------------- - - // Inject ourselves into the Bulk methods - var methods = ['execute']; - var prototypes = [ - require('./bulk/ordered').Bulk.prototype, - require('./bulk/unordered').Bulk.prototype - ] - - prototypes.forEach(function(proto) { - // Core server method we are going to wrap - methods.forEach(function(x) { - var func = proto[x]; - - // Add to overloaded methods - self.overloads.push({proto: proto, name:x, func:func}); - - // The actual prototype - proto[x] = function() { - var bulk = this; - // Get the aruments - var args = Array.prototype.slice.call(arguments, 0); - // Set an operation Id on the bulk object - this.operationId = operationIdGenerator.next(); - - // Get the callback - var callback = args.pop(); - // If we have a callback use this - if(typeof callback == 'function') { - args.push(function(err, r) { - // Return to caller - callback(err, r); - }); - - // Apply the call - func.apply(this, args); - } else { - return func.apply(this, args); - } - } - }); - }); - - // --------------------------------------------------------- - // - // Cursor - // - // --------------------------------------------------------- - - // Inject ourselves into the Cursor methods - var methods = ['_find', '_getmore', '_killcursor']; - var prototypes = [ - require('./cursor').prototype, - require('./command_cursor').prototype, - require('./aggregation_cursor').prototype - ] - - // Command name translation - var commandTranslation = { - '_find': 'find', '_getmore': 'getMore', '_killcursor': 'killCursors', '_explain': 'explain' - } - - prototypes.forEach(function(proto) { - - // Core server method we are going to wrap - methods.forEach(function(x) { - var func = proto[x]; - - // Add to overloaded methods - self.overloads.push({proto: proto, name:x, func:func}); - - // The actual prototype - proto[x] = function() { - var cursor = this; - var requestId = core.Query.nextRequestId(); - var ourOpId = operationIdGenerator.next(); - var parts = this.ns.split('.'); - var db = parts[0]; - - // Get the collection - parts.shift(); - var collection = parts.join('.'); - - // Set the command - var command = this.query; - var cmd = this.s.cmd; - - // If we have a find method, set the operationId on the cursor - if(x == '_find') { - cursor.operationId = ourOpId; - } - - // Do we have a find command rewrite it - if(cmd.find) { - command = { - find: collection, filter: cmd.query - } - - if(cmd.sort) command.sort = cmd.sort; - if(cmd.fields) command.projection = cmd.fields; - if(cmd.limit && cmd.limit < 0) { - command.limit = Math.abs(cmd.limit); - command.singleBatch = true; - } else if(cmd.limit) { - command.limit = Math.abs(cmd.limit); - } - - // Options - if(cmd.skip) command.skip = cmd.skip; - if(cmd.hint) command.hint = cmd.hint; - if(cmd.batchSize) command.batchSize = cmd.batchSize; - if(cmd.returnKey) command.returnKey = cmd.returnKey; - if(cmd.comment) command.comment = cmd.comment; - if(cmd.min) command.min = cmd.min; - if(cmd.max) command.max = cmd.max; - if(cmd.maxScan) command.maxScan = cmd.maxScan; - if(cmd.readPreference) command['$readPreference'] = cmd.readPreference; - if(cmd.maxTimeMS) command.maxTimeMS = cmd.maxTimeMS; - - // Flags - if(cmd.awaitData) command.awaitData = cmd.awaitData; - if(cmd.snapshot) command.snapshot = cmd.snapshot; - if(cmd.tailable) command.tailable = cmd.tailable; - if(cmd.oplogReplay) command.oplogReplay = cmd.oplogReplay; - if(cmd.noCursorTimeout) command.noCursorTimeout = cmd.noCursorTimeout; - if(cmd.partial) command.partial = cmd.partial; - if(cmd.showDiskLoc) command.showRecordId = cmd.showDiskLoc; - - // Read Concern - if(cmd.readConcern) command.readConcern = cmd.readConcern; - - // Override method - if(cmd.explain) command.explain = cmd.explain; - if(cmd.exhaust) command.exhaust = cmd.exhaust; - - // If we have a explain flag - if(cmd.explain) { - // Create fake explain command - command = { - explain: command, - verbosity: 'allPlansExecution' - } - - // Set readConcern on the command if available - if(cmd.readConcern) command.readConcern = cmd.readConcern - - // Set up the _explain name for the command - x = '_explain'; - } - } else if(x == '_getmore') { - command = { - getMore: this.cursorState.cursorId, - collection: collection, - batchSize: cmd.batchSize - } - - if(cmd.maxTimeMS) command.maxTimeMS = cmd.maxTimeMS; - } else if(x == '_killcursors') { - command = { - killCursors: collection, - cursors: [this.cursorState.cursorId] - } - } else { - command = cmd; - } - - // Set up the connection - var connectionId = null; - - // Set local connection - if(this.connection) connectionId = this.connection; - if(!connectionId && this.server && this.server.getConnection) connectionId = this.server.getConnection(); - - // Get the command Name - var commandName = x == '_find' ? Object.keys(command)[0] : commandTranslation[x]; - - // Emit the start event for the command - var command = { - // Returns the command. - command: command, - // Returns the database name. - databaseName: db, - // Returns the command name. - commandName: commandName, - // Returns the driver generated request id. - requestId: requestId, - // Returns the driver generated operation id. - // This is used to link events together such as bulk write operations. OPTIONAL. - operationId: this.operationId, - // Returns the connection id for the command. For languages that do not have this, - // this MUST return the driver equivalent which MUST include the server address and port. - // The name of this field is flexible to match the object that is returned from the driver. - connectionId: connectionId - }; - - // Get the aruments - var args = Array.prototype.slice.call(arguments, 0); - - // Get the callback - var callback = args.pop(); - - // We do not have a callback but a Promise - if(typeof callback == 'function' || command.commandName == 'killCursors') { - var startTime = timestampGenerator.current(); - // Emit the started event - self.emit('started', command) - - // Emit succeeded event with killcursor if we have a legacy protocol - if(command.commandName == 'killCursors' - && this.server.lastIsMaster() - && this.server.lastIsMaster().maxWireVersion < 4) { - // Emit the succeeded command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: cursor.operationId, - connectionId: cursor.server.getConnection(), - reply: [{ok:1}] - }; - - // Emit the command - return self.emit('succeeded', command) - } - - // Add our callback handler - args.push(function(err, r) { - - if(err) { - // Command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: ourOpId, - connectionId: cursor.server.getConnection(), - failure: err }; - - // Emit the command - self.emit('failed', command) - } else { - // cursor id is zero, we can issue success command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: cursor.operationId, - connectionId: cursor.server.getConnection(), - reply: cursor.cursorState.documents - }; - - // Emit the command - self.emit('succeeded', command) - } - - // Return - if(!callback) return; - - // Return to caller - callback(err, r); - }); - - // Apply the call - func.apply(this, args); - } else { - // Assume promise, push back the missing value - args.push(callback); - // Get the promise - var promise = func.apply(this, args); - // Return a new promise - return new cursor.s.promiseLibrary(function(resolve, reject) { - var startTime = timestampGenerator.current(); - // Emit the started event - self.emit('started', command) - // Execute the function - promise.then(function(r) { - // cursor id is zero, we can issue success command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: cursor.operationId, - connectionId: cursor.server.getConnection(), - reply: cursor.cursorState.documents - }; - - // Emit the command - self.emit('succeeded', command) - }).catch(function(err) { - // Command - var command = { - duration: timestampGenerator.duration(startTime, timestampGenerator.current()), - commandName: commandName, - requestId: requestId, - operationId: ourOpId, - connectionId: cursor.server.getConnection(), - failure: err }; - - // Emit the command - self.emit('failed', command) - // reject the promise - reject(err); - }); - }); - } - } - }); - }); -} - -inherits(Instrumentation, EventEmitter); - -Instrumentation.prototype.uninstrument = function() { - for(var i = 0; i < this.overloads.length; i++) { - var obj = this.overloads[i]; - obj.proto[obj.name] = obj.func; - } - - // Remove all listeners - this.removeAllListeners('started'); - this.removeAllListeners('succeeded'); - this.removeAllListeners('failed'); -} - -module.exports = Instrumentation; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js deleted file mode 100644 index 7ec023e3..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/common.js +++ /dev/null @@ -1,393 +0,0 @@ -"use strict"; - -var utils = require('../utils'); - -// Error codes -var UNKNOWN_ERROR = 8; -var INVALID_BSON_ERROR = 22; -var WRITE_CONCERN_ERROR = 64; -var MULTIPLE_ERROR = 65; - -// Insert types -var INSERT = 1; -var UPDATE = 2; -var REMOVE = 3 - - -// Get write concern -var writeConcern = function(target, col, options) { - if(options.w != null || options.j != null || options.fsync != null) { - target.writeConcern = options; - } else if(col.writeConcern.w != null || col.writeConcern.j != null || col.writeConcern.fsync != null) { - target.writeConcern = col.writeConcern; - } - - return target -} - -/** - * Helper function to define properties - * @ignore - */ -var defineReadOnlyProperty = function(self, name, value) { - Object.defineProperty(self, name, { - enumerable: true - , get: function() { - return value; - } - }); -} - -/** - * Keeps the state of a unordered batch so we can rewrite the results - * correctly after command execution - * @ignore - */ -var Batch = function(batchType, originalZeroIndex) { - this.originalZeroIndex = originalZeroIndex; - this.currentIndex = 0; - this.originalIndexes = []; - this.batchType = batchType; - this.operations = []; - this.size = 0; - this.sizeBytes = 0; -} - -/** - * Wraps a legacy operation so we can correctly rewrite it's error - * @ignore - */ -var LegacyOp = function(batchType, operation, index) { - this.batchType = batchType; - this.index = index; - this.operation = operation; -} - -/** - * Create a new BulkWriteResult instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @property {boolean} ok Did bulk operation correctly execute - * @property {number} nInserted number of inserted documents - * @property {number} nUpdated number of documents updated logically - * @property {number} nUpserted Number of upserted documents - * @property {number} nModified Number of documents updated physically on disk - * @property {number} nRemoved Number of removed documents - * @return {BulkWriteResult} a BulkWriteResult instance - */ -var BulkWriteResult = function(bulkResult) { - defineReadOnlyProperty(this, "ok", bulkResult.ok); - defineReadOnlyProperty(this, "nInserted", bulkResult.nInserted); - defineReadOnlyProperty(this, "nUpserted", bulkResult.nUpserted); - defineReadOnlyProperty(this, "nMatched", bulkResult.nMatched); - defineReadOnlyProperty(this, "nModified", bulkResult.nModified); - defineReadOnlyProperty(this, "nRemoved", bulkResult.nRemoved); - - /** - * Return an array of inserted ids - * - * @return {object[]} - */ - this.getInsertedIds = function() { - return bulkResult.insertedIds; - } - - /** - * Return an array of upserted ids - * - * @return {object[]} - */ - this.getUpsertedIds = function() { - return bulkResult.upserted; - } - - /** - * Return the upserted id at position x - * - * @param {number} index the number of the upserted id to return, returns undefined if no result for passed in index - * @return {object} - */ - this.getUpsertedIdAt = function(index) { - return bulkResult.upserted[index]; - } - - /** - * Return raw internal result - * - * @return {object} - */ - this.getRawResponse = function() { - return bulkResult; - } - - /** - * Returns true if the bulk operation contains a write error - * - * @return {boolean} - */ - this.hasWriteErrors = function() { - return bulkResult.writeErrors.length > 0; - } - - /** - * Returns the number of write errors off the bulk operation - * - * @return {number} - */ - this.getWriteErrorCount = function() { - return bulkResult.writeErrors.length; - } - - /** - * Returns a specific write error object - * - * @return {WriteError} - */ - this.getWriteErrorAt = function(index) { - if(index < bulkResult.writeErrors.length) { - return bulkResult.writeErrors[index]; - } - return null; - } - - /** - * Retrieve all write errors - * - * @return {object[]} - */ - this.getWriteErrors = function() { - return bulkResult.writeErrors; - } - - /** - * Retrieve lastOp if available - * - * @return {object} - */ - this.getLastOp = function() { - return bulkResult.lastOp; - } - - /** - * Retrieve the write concern error if any - * - * @return {WriteConcernError} - */ - this.getWriteConcernError = function() { - if(bulkResult.writeConcernErrors.length == 0) { - return null; - } else if(bulkResult.writeConcernErrors.length == 1) { - // Return the error - return bulkResult.writeConcernErrors[0]; - } else { - - // Combine the errors - var errmsg = ""; - for(var i = 0; i < bulkResult.writeConcernErrors.length; i++) { - var err = bulkResult.writeConcernErrors[i]; - errmsg = errmsg + err.errmsg; - - // TODO: Something better - if(i == 0) errmsg = errmsg + " and "; - } - - return new WriteConcernError({ errmsg : errmsg, code : WRITE_CONCERN_ERROR }); - } - } - - this.toJSON = function() { - return bulkResult; - } - - this.toString = function() { - return "BulkWriteResult(" + this.toJSON(bulkResult) + ")"; - } - - this.isOk = function() { - return bulkResult.ok == 1; - } -} - -/** - * Create a new WriteConcernError instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @property {number} code Write concern error code. - * @property {string} errmsg Write concern error message. - * @return {WriteConcernError} a WriteConcernError instance - */ -var WriteConcernError = function(err) { - if(!(this instanceof WriteConcernError)) return new WriteConcernError(err); - - // Define properties - defineReadOnlyProperty(this, "code", err.code); - defineReadOnlyProperty(this, "errmsg", err.errmsg); - - this.toJSON = function() { - return {code: err.code, errmsg: err.errmsg}; - } - - this.toString = function() { - return "WriteConcernError(" + err.errmsg + ")"; - } -} - -/** - * Create a new WriteError instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @property {number} code Write concern error code. - * @property {number} index Write concern error original bulk operation index. - * @property {string} errmsg Write concern error message. - * @return {WriteConcernError} a WriteConcernError instance - */ -var WriteError = function(err) { - if(!(this instanceof WriteError)) return new WriteError(err); - - // Define properties - defineReadOnlyProperty(this, "code", err.code); - defineReadOnlyProperty(this, "index", err.index); - defineReadOnlyProperty(this, "errmsg", err.errmsg); - - // - // Define access methods - this.getOperation = function() { - return err.op; - } - - this.toJSON = function() { - return {code: err.code, index: err.index, errmsg: err.errmsg, op: err.op}; - } - - this.toString = function() { - return "WriteError(" + JSON.stringify(this.toJSON()) + ")"; - } -} - -/** - * Merges results into shared data structure - * @ignore - */ -var mergeBatchResults = function(ordered, batch, bulkResult, err, result) { - // If we have an error set the result to be the err object - if(err) { - result = err; - } else if(result && result.result) { - result = result.result; - } else if(result == null) { - return; - } - - // Do we have a top level error stop processing and return - if(result.ok == 0 && bulkResult.ok == 1) { - bulkResult.ok = 0; - // bulkResult.error = utils.toError(result); - var writeError = { - index: 0 - , code: result.code || 0 - , errmsg: result.message - , op: batch.operations[0] - }; - - bulkResult.writeErrors.push(new WriteError(writeError)); - return; - } else if(result.ok == 0 && bulkResult.ok == 0) { - return; - } - - // Add lastop if available - if(result.lastOp) { - bulkResult.lastOp = result.lastOp; - } - - // If we have an insert Batch type - if(batch.batchType == INSERT && result.n) { - bulkResult.nInserted = bulkResult.nInserted + result.n; - } - - // If we have an insert Batch type - if(batch.batchType == REMOVE && result.n) { - bulkResult.nRemoved = bulkResult.nRemoved + result.n; - } - - var nUpserted = 0; - - // We have an array of upserted values, we need to rewrite the indexes - if(Array.isArray(result.upserted)) { - nUpserted = result.upserted.length; - - for(var i = 0; i < result.upserted.length; i++) { - bulkResult.upserted.push({ - index: result.upserted[i].index + batch.originalZeroIndex - , _id: result.upserted[i]._id - }); - } - } else if(result.upserted) { - - nUpserted = 1; - - bulkResult.upserted.push({ - index: batch.originalZeroIndex - , _id: result.upserted - }); - } - - // If we have an update Batch type - if(batch.batchType == UPDATE && result.n) { - var nModified = result.nModified; - bulkResult.nUpserted = bulkResult.nUpserted + nUpserted; - bulkResult.nMatched = bulkResult.nMatched + (result.n - nUpserted); - - if(typeof nModified == 'number') { - bulkResult.nModified = bulkResult.nModified + nModified; - } else { - bulkResult.nModified = null; - } - } - - if(Array.isArray(result.writeErrors)) { - for(var i = 0; i < result.writeErrors.length; i++) { - - var writeError = { - index: batch.originalZeroIndex + result.writeErrors[i].index - , code: result.writeErrors[i].code - , errmsg: result.writeErrors[i].errmsg - , op: batch.operations[result.writeErrors[i].index] - }; - - bulkResult.writeErrors.push(new WriteError(writeError)); - } - } - - if(result.writeConcernError) { - bulkResult.writeConcernErrors.push(new WriteConcernError(result.writeConcernError)); - } -} - -// -// Clone the options -var cloneOptions = function(options) { - var clone = {}; - var keys = Object.keys(options); - for(var i = 0; i < keys.length; i++) { - clone[keys[i]] = options[keys[i]]; - } - - return clone; -} - -// Exports symbols -exports.BulkWriteResult = BulkWriteResult; -exports.WriteError = WriteError; -exports.Batch = Batch; -exports.LegacyOp = LegacyOp; -exports.mergeBatchResults = mergeBatchResults; -exports.cloneOptions = cloneOptions; -exports.writeConcern = writeConcern; -exports.INVALID_BSON_ERROR = INVALID_BSON_ERROR; -exports.WRITE_CONCERN_ERROR = WRITE_CONCERN_ERROR; -exports.MULTIPLE_ERROR = MULTIPLE_ERROR; -exports.UNKNOWN_ERROR = UNKNOWN_ERROR; -exports.INSERT = INSERT; -exports.UPDATE = UPDATE; -exports.REMOVE = REMOVE; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js deleted file mode 100644 index 319a0305..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/ordered.js +++ /dev/null @@ -1,532 +0,0 @@ -"use strict"; - -var common = require('./common') - , utils = require('../utils') - , toError = require('../utils').toError - , f = require('util').format - , shallowClone = utils.shallowClone - , WriteError = common.WriteError - , BulkWriteResult = common.BulkWriteResult - , LegacyOp = common.LegacyOp - , ObjectID = require('mongodb-core').BSON.ObjectID - , Define = require('../metadata') - , Batch = common.Batch - , mergeBatchResults = common.mergeBatchResults; - -/** - * Create a FindOperatorsOrdered instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @return {FindOperatorsOrdered} a FindOperatorsOrdered instance. - */ -var FindOperatorsOrdered = function(self) { - this.s = self.s; -} - -/** - * Add a single update document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.update = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: true - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a single update one document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.updateOne = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: false - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a replace one operation to the bulk operation - * - * @method - * @param {object} doc the new document to replace the existing one with - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.replaceOne = function(updateDocument) { - this.updateOne(updateDocument); -} - -/** - * Upsert modifier for update bulk operation - * - * @method - * @throws {MongoError} - * @return {FindOperatorsOrdered} - */ -FindOperatorsOrdered.prototype.upsert = function() { - this.s.currentOp.upsert = true; - return this; -} - -/** - * Add a remove one operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.deleteOne = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 1 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -// Backward compatibility -FindOperatorsOrdered.prototype.removeOne = FindOperatorsOrdered.prototype.deleteOne; - -/** - * Add a remove operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -FindOperatorsOrdered.prototype.delete = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 0 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -// Backward compatibility -FindOperatorsOrdered.prototype.remove = FindOperatorsOrdered.prototype.delete; - -// Add to internal list of documents -var addToOperationsList = function(_self, docType, document) { - // Get the bsonSize - var bsonSize = _self.s.bson.calculateObjectSize(document, false); - - // Throw error if the doc is bigger than the max BSON size - if(bsonSize >= _self.s.maxBatchSizeBytes) throw toError("document is larger than the maximum size " + _self.s.maxBatchSizeBytes); - // Create a new batch object if we don't have a current one - if(_self.s.currentBatch == null) _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - - // Check if we need to create a new batch - if(((_self.s.currentBatchSize + 1) >= _self.s.maxWriteBatchSize) - || ((_self.s.currentBatchSizeBytes + _self.s.currentBatchSizeBytes) >= _self.s.maxBatchSizeBytes) - || (_self.s.currentBatch.batchType != docType)) { - // Save the batch to the execution stack - _self.s.batches.push(_self.s.currentBatch); - - // Create a new batch - _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - - // Reset the current size trackers - _self.s.currentBatchSize = 0; - _self.s.currentBatchSizeBytes = 0; - } else { - // Update current batch size - _self.s.currentBatchSize = _self.s.currentBatchSize + 1; - _self.s.currentBatchSizeBytes = _self.s.currentBatchSizeBytes + bsonSize; - } - - if(docType == common.INSERT) { - _self.s.bulkResult.insertedIds.push({index: _self.s.currentIndex, _id: document._id}); - } - - // We have an array of documents - if(Array.isArray(document)) { - throw toError("operation passed in cannot be an Array"); - } else { - _self.s.currentBatch.originalIndexes.push(_self.s.currentIndex); - _self.s.currentBatch.operations.push(document) - _self.s.currentIndex = _self.s.currentIndex + 1; - } - - // Return self - return _self; -} - -/** - * Create a new OrderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @property {number} length Get the number of operations in the bulk. - * @return {OrderedBulkOperation} a OrderedBulkOperation instance. - */ -function OrderedBulkOperation(topology, collection, options) { - options = options == null ? {} : options; - // TODO Bring from driver information in isMaster - var self = this; - var executed = false; - - // Current item - var currentOp = null; - - // Handle to the bson serializer, used to calculate running sizes - var bson = topology.bson; - - // Namespace for the operation - var namespace = collection.collectionName; - - // Set max byte size - var maxBatchSizeBytes = topology.isMasterDoc.maxBsonObjectSize; - var maxWriteBatchSize = topology.isMasterDoc.maxWriteBatchSize || 1000; - - // Get the capabilities - var capabilities = topology.capabilities(); - - // Get the write concern - var writeConcern = common.writeConcern(shallowClone(options), collection, options); - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Current batch - var currentBatch = null; - var currentIndex = 0; - var currentBatchSize = 0; - var currentBatchSizeBytes = 0; - var batches = []; - - // Final results - var bulkResult = { - ok: 1 - , writeErrors: [] - , writeConcernErrors: [] - , insertedIds: [] - , nInserted: 0 - , nUpserted: 0 - , nMatched: 0 - , nModified: 0 - , nRemoved: 0 - , upserted: [] - }; - - // Internal state - this.s = { - // Final result - bulkResult: bulkResult - // Current batch state - , currentBatch: null - , currentIndex: 0 - , currentBatchSize: 0 - , currentBatchSizeBytes: 0 - , batches: [] - // Write concern - , writeConcern: writeConcern - // Capabilities - , capabilities: capabilities - // Max batch size options - , maxBatchSizeBytes: maxBatchSizeBytes - , maxWriteBatchSize: maxWriteBatchSize - // Namespace - , namespace: namespace - // BSON - , bson: bson - // Topology - , topology: topology - // Options - , options: options - // Current operation - , currentOp: currentOp - // Executed - , executed: executed - // Collection - , collection: collection - // Promise Library - , promiseLibrary: promiseLibrary - // Fundamental error - , err: null - // Bypass validation - , bypassDocumentValidation: typeof options.bypassDocumentValidation == 'boolean' ? options.bypassDocumentValidation : false - } -} - -var define = OrderedBulkOperation.define = new Define('OrderedBulkOperation', OrderedBulkOperation, false); - -OrderedBulkOperation.prototype.raw = function(op) { - var key = Object.keys(op)[0]; - - // Set up the force server object id - var forceServerObjectId = typeof this.s.options.forceServerObjectId == 'boolean' - ? this.s.options.forceServerObjectId : this.s.collection.s.db.options.forceServerObjectId; - - // Update operations - if((op.updateOne && op.updateOne.q) - || (op.updateMany && op.updateMany.q) - || (op.replaceOne && op.replaceOne.q)) { - op[key].multi = op.updateOne || op.replaceOne ? false : true; - return addToOperationsList(this, common.UPDATE, op[key]); - } - - // Crud spec update format - if(op.updateOne || op.updateMany || op.replaceOne) { - var multi = op.updateOne || op.replaceOne ? false : true; - var operation = {q: op[key].filter, u: op[key].update || op[key].replacement, multi: multi} - if(op[key].upsert) operation.upsert = true; - return addToOperationsList(this, common.UPDATE, operation); - } - - // Remove operations - if(op.removeOne || op.removeMany || (op.deleteOne && op.deleteOne.q) || op.deleteMany && op.deleteMany.q) { - op[key].limit = op.removeOne ? 1 : 0; - return addToOperationsList(this, common.REMOVE, op[key]); - } - - // Crud spec delete operations, less efficient - if(op.deleteOne || op.deleteMany) { - var limit = op.deleteOne ? 1 : 0; - var operation = {q: op[key].filter, limit: limit} - return addToOperationsList(this, common.REMOVE, operation); - } - - // Insert operations - if(op.insertOne && op.insertOne.document == null) { - if(forceServerObjectId !== true && op.insertOne._id == null) op.insertOne._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne); - } else if(op.insertOne && op.insertOne.document) { - if(forceServerObjectId !== true && op.insertOne.document._id == null) op.insertOne.document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne.document); - } - - if(op.insertMany) { - for(var i = 0; i < op.insertMany.length; i++) { - if(forceServerObjectId !== true && op.insertMany[i]._id == null) op.insertMany[i]._id = new ObjectID(); - addToOperationsList(this, common.INSERT, op.insertMany[i]); - } - - return; - } - - // No valid type of operation - throw toError("bulkWrite only supports insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, deleteOne, deleteMany"); -} - -/** - * Add a single insert document to the bulk operation - * - * @param {object} doc the document to insert - * @throws {MongoError} - * @return {OrderedBulkOperation} - */ -OrderedBulkOperation.prototype.insert = function(document) { - if(this.s.collection.s.db.options.forceServerObjectId !== true && document._id == null) document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, document); -} - -/** - * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne - * - * @method - * @param {object} selector The selector for the bulk operation. - * @throws {MongoError} - * @return {FindOperatorsOrdered} - */ -OrderedBulkOperation.prototype.find = function(selector) { - if (!selector) { - throw toError("Bulk find operation must specify a selector"); - } - - // Save a current selector - this.s.currentOp = { - selector: selector - } - - return new FindOperatorsOrdered(this); -} - -Object.defineProperty(OrderedBulkOperation.prototype, 'length', { - enumerable: true, - get: function() { - return this.s.currentIndex; - } -}); - -// -// Execute next write command in a chain -var executeCommands = function(self, callback) { - if(self.s.batches.length == 0) { - return callback(null, new BulkWriteResult(self.s.bulkResult)); - } - - // Ordered execution of the command - var batch = self.s.batches.shift(); - - var resultHandler = function(err, result) { - // Error is a driver related error not a bulk op error, terminate - if(err && err.driver || err && err.message) { - return callback(err); - } - - // If we have and error - if(err) err.ok = 0; - // Merge the results together - var mergeResult = mergeBatchResults(true, batch, self.s.bulkResult, err, result); - if(mergeResult != null) { - return callback(null, new BulkWriteResult(self.s.bulkResult)); - } - - // If we are ordered and have errors and they are - // not all replication errors terminate the operation - if(self.s.bulkResult.writeErrors.length > 0) { - return callback(toError(self.s.bulkResult.writeErrors[0]), new BulkWriteResult(self.s.bulkResult)); - } - - // Execute the next command in line - executeCommands(self, callback); - } - - var finalOptions = {ordered: true} - if(self.s.writeConcern != null) { - finalOptions.writeConcern = self.s.writeConcern; - } - - // Set an operationIf if provided - if(self.operationId) { - resultHandler.operationId = self.operationId; - } - - // Serialize functions - if(self.s.options.serializeFunctions) { - finalOptions.serializeFunctions = true - } - - // Serialize functions - if(self.s.options.ignoreUndefined) { - finalOptions.ignoreUndefined = true - } - - // Is the bypassDocumentValidation options specific - if(self.s.bypassDocumentValidation == true) { - finalOptions.bypassDocumentValidation = true; - } - - try { - if(batch.batchType == common.INSERT) { - self.s.topology.insert(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.UPDATE) { - self.s.topology.update(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.REMOVE) { - self.s.topology.remove(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } - } catch(err) { - // Force top level error - err.ok = 0; - // Merge top level error and return - callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, null)); - } -} - -/** - * The callback format for results - * @callback OrderedBulkOperation~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {BulkWriteResult} result The bulk write result. - */ - -/** - * Execute the ordered bulk operation - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {OrderedBulkOperation~resultCallback} [callback] The result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -OrderedBulkOperation.prototype.execute = function(_writeConcern, callback) { - var self = this; - if(this.s.executed) throw new toError("batch cannot be re-executed"); - if(typeof _writeConcern == 'function') { - callback = _writeConcern; - } else { - this.s.writeConcern = _writeConcern; - } - - // If we have current batch - if(this.s.currentBatch) this.s.batches.push(this.s.currentBatch); - - // If we have no operations in the bulk raise an error - if(this.s.batches.length == 0) { - throw toError("Invalid Operation, No operations in bulk"); - } - - // Execute using callback - if(typeof callback == 'function') { - return executeCommands(this, callback); - } - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - executeCommands(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('execute', {callback: true, promise:false}); - -/** - * Returns an unordered batch object - * @ignore - */ -var initializeOrderedBulkOp = function(topology, collection, options) { - return new OrderedBulkOperation(topology, collection, options); -} - -initializeOrderedBulkOp.OrderedBulkOperation = OrderedBulkOperation; -module.exports = initializeOrderedBulkOp; -module.exports.Bulk = OrderedBulkOperation; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js deleted file mode 100644 index ca45b962..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/bulk/unordered.js +++ /dev/null @@ -1,541 +0,0 @@ -"use strict"; - -var common = require('./common') - , utils = require('../utils') - , toError = require('../utils').toError - , f = require('util').format - , shallowClone = utils.shallowClone - , WriteError = common.WriteError - , BulkWriteResult = common.BulkWriteResult - , LegacyOp = common.LegacyOp - , ObjectID = require('mongodb-core').BSON.ObjectID - , Define = require('../metadata') - , Batch = common.Batch - , mergeBatchResults = common.mergeBatchResults; - -/** - * Create a FindOperatorsUnordered instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @property {number} length Get the number of operations in the bulk. - * @return {FindOperatorsUnordered} a FindOperatorsUnordered instance. - */ -var FindOperatorsUnordered = function(self) { - this.s = self.s; -} - -/** - * Add a single update document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.update = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: true - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a single update one document to the bulk operation - * - * @method - * @param {object} doc update operations - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.updateOne = function(updateDocument) { - // Perform upsert - var upsert = typeof this.s.currentOp.upsert == 'boolean' ? this.s.currentOp.upsert : false; - - // Establish the update command - var document = { - q: this.s.currentOp.selector - , u: updateDocument - , multi: false - , upsert: upsert - } - - // Clear out current Op - this.s.currentOp = null; - // Add the update document to the list - return addToOperationsList(this, common.UPDATE, document); -} - -/** - * Add a replace one operation to the bulk operation - * - * @method - * @param {object} doc the new document to replace the existing one with - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.replaceOne = function(updateDocument) { - this.updateOne(updateDocument); -} - -/** - * Upsert modifier for update bulk operation - * - * @method - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.upsert = function() { - this.s.currentOp.upsert = true; - return this; -} - -/** - * Add a remove one operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.removeOne = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 1 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -/** - * Add a remove operation to the bulk operation - * - * @method - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -FindOperatorsUnordered.prototype.remove = function() { - // Establish the update command - var document = { - q: this.s.currentOp.selector - , limit: 0 - } - - // Clear out current Op - this.s.currentOp = null; - // Add the remove document to the list - return addToOperationsList(this, common.REMOVE, document); -} - -// -// Add to the operations list -// -var addToOperationsList = function(_self, docType, document) { - // Get the bsonSize - var bsonSize = _self.s.bson.calculateObjectSize(document, false); - // Throw error if the doc is bigger than the max BSON size - if(bsonSize >= _self.s.maxBatchSizeBytes) throw toError("document is larger than the maximum size " + _self.s.maxBatchSizeBytes); - // Holds the current batch - _self.s.currentBatch = null; - // Get the right type of batch - if(docType == common.INSERT) { - _self.s.currentBatch = _self.s.currentInsertBatch; - } else if(docType == common.UPDATE) { - _self.s.currentBatch = _self.s.currentUpdateBatch; - } else if(docType == common.REMOVE) { - _self.s.currentBatch = _self.s.currentRemoveBatch; - } - - // Create a new batch object if we don't have a current one - if(_self.s.currentBatch == null) _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - - // Check if we need to create a new batch - if(((_self.s.currentBatch.size + 1) >= _self.s.maxWriteBatchSize) - || ((_self.s.currentBatch.sizeBytes + bsonSize) >= _self.s.maxBatchSizeBytes) - || (_self.s.currentBatch.batchType != docType)) { - // Save the batch to the execution stack - _self.s.batches.push(_self.s.currentBatch); - - // Create a new batch - _self.s.currentBatch = new Batch(docType, _self.s.currentIndex); - } - - // We have an array of documents - if(Array.isArray(document)) { - throw toError("operation passed in cannot be an Array"); - } else { - _self.s.currentBatch.operations.push(document); - _self.s.currentBatch.originalIndexes.push(_self.s.currentIndex); - _self.s.currentIndex = _self.s.currentIndex + 1; - } - - // Save back the current Batch to the right type - if(docType == common.INSERT) { - _self.s.currentInsertBatch = _self.s.currentBatch; - _self.s.bulkResult.insertedIds.push({index: _self.s.currentIndex, _id: document._id}); - } else if(docType == common.UPDATE) { - _self.s.currentUpdateBatch = _self.s.currentBatch; - } else if(docType == common.REMOVE) { - _self.s.currentRemoveBatch = _self.s.currentBatch; - } - - // Update current batch size - _self.s.currentBatch.size = _self.s.currentBatch.size + 1; - _self.s.currentBatch.sizeBytes = _self.s.currentBatch.sizeBytes + bsonSize; - - // Return self - return _self; -} - -/** - * Create a new UnorderedBulkOperation instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @return {UnorderedBulkOperation} a UnorderedBulkOperation instance. - */ -var UnorderedBulkOperation = function(topology, collection, options) { - options = options == null ? {} : options; - - // Contains reference to self - var self = this; - // Get the namesspace for the write operations - var namespace = collection.collectionName; - // Used to mark operation as executed - var executed = false; - - // Current item - // var currentBatch = null; - var currentOp = null; - var currentIndex = 0; - var batches = []; - - // The current Batches for the different operations - var currentInsertBatch = null; - var currentUpdateBatch = null; - var currentRemoveBatch = null; - - // Handle to the bson serializer, used to calculate running sizes - var bson = topology.bson; - - // Get the capabilities - var capabilities = topology.capabilities(); - - // Set max byte size - var maxBatchSizeBytes = topology.isMasterDoc.maxBsonObjectSize; - var maxWriteBatchSize = topology.isMasterDoc.maxWriteBatchSize || 1000; - - // Get the write concern - var writeConcern = common.writeConcern(shallowClone(options), collection, options); - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Final results - var bulkResult = { - ok: 1 - , writeErrors: [] - , writeConcernErrors: [] - , insertedIds: [] - , nInserted: 0 - , nUpserted: 0 - , nMatched: 0 - , nModified: 0 - , nRemoved: 0 - , upserted: [] - }; - - // Internal state - this.s = { - // Final result - bulkResult: bulkResult - // Current batch state - , currentInsertBatch: null - , currentUpdateBatch: null - , currentRemoveBatch: null - , currentBatch: null - , currentIndex: 0 - , batches: [] - // Write concern - , writeConcern: writeConcern - // Capabilities - , capabilities: capabilities - // Max batch size options - , maxBatchSizeBytes: maxBatchSizeBytes - , maxWriteBatchSize: maxWriteBatchSize - // Namespace - , namespace: namespace - // BSON - , bson: bson - // Topology - , topology: topology - // Options - , options: options - // Current operation - , currentOp: currentOp - // Executed - , executed: executed - // Collection - , collection: collection - // Promise Library - , promiseLibrary: promiseLibrary - // Bypass validation - , bypassDocumentValidation: typeof options.bypassDocumentValidation == 'boolean' ? options.bypassDocumentValidation : false - } -} - -var define = UnorderedBulkOperation.define = new Define('UnorderedBulkOperation', UnorderedBulkOperation, false); - -/** - * Add a single insert document to the bulk operation - * - * @param {object} doc the document to insert - * @throws {MongoError} - * @return {UnorderedBulkOperation} - */ -UnorderedBulkOperation.prototype.insert = function(document) { - if(this.s.collection.s.db.options.forceServerObjectId !== true && document._id == null) document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, document); -} - -/** - * Initiate a find operation for an update/updateOne/remove/removeOne/replaceOne - * - * @method - * @param {object} selector The selector for the bulk operation. - * @throws {MongoError} - * @return {FindOperatorsUnordered} - */ -UnorderedBulkOperation.prototype.find = function(selector) { - if (!selector) { - throw toError("Bulk find operation must specify a selector"); - } - - // Save a current selector - this.s.currentOp = { - selector: selector - } - - return new FindOperatorsUnordered(this); -} - -Object.defineProperty(UnorderedBulkOperation.prototype, 'length', { - enumerable: true, - get: function() { - return this.s.currentIndex; - } -}); - -UnorderedBulkOperation.prototype.raw = function(op) { - var key = Object.keys(op)[0]; - - // Set up the force server object id - var forceServerObjectId = typeof this.s.options.forceServerObjectId == 'boolean' - ? this.s.options.forceServerObjectId : this.s.collection.s.db.options.forceServerObjectId; - - // Update operations - if((op.updateOne && op.updateOne.q) - || (op.updateMany && op.updateMany.q) - || (op.replaceOne && op.replaceOne.q)) { - op[key].multi = op.updateOne || op.replaceOne ? false : true; - return addToOperationsList(this, common.UPDATE, op[key]); - } - - // Crud spec update format - if(op.updateOne || op.updateMany || op.replaceOne) { - var multi = op.updateOne || op.replaceOne ? false : true; - var operation = {q: op[key].filter, u: op[key].update || op[key].replacement, multi: multi} - if(op[key].upsert) operation.upsert = true; - return addToOperationsList(this, common.UPDATE, operation); - } - - // Remove operations - if(op.removeOne || op.removeMany || (op.deleteOne && op.deleteOne.q) || op.deleteMany && op.deleteMany.q) { - op[key].limit = op.removeOne ? 1 : 0; - return addToOperationsList(this, common.REMOVE, op[key]); - } - - // Crud spec delete operations, less efficient - if(op.deleteOne || op.deleteMany) { - var limit = op.deleteOne ? 1 : 0; - var operation = {q: op[key].filter, limit: limit} - return addToOperationsList(this, common.REMOVE, operation); - } - - // Insert operations - if(op.insertOne && op.insertOne.document == null) { - if(forceServerObjectId !== true && op.insertOne._id == null) op.insertOne._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne); - } else if(op.insertOne && op.insertOne.document) { - if(forceServerObjectId !== true && op.insertOne.document._id == null) op.insertOne.document._id = new ObjectID(); - return addToOperationsList(this, common.INSERT, op.insertOne.document); - } - - if(op.insertMany) { - for(var i = 0; i < op.insertMany.length; i++) { - if(forceServerObjectId !== true && op.insertMany[i]._id == null) op.insertMany[i]._id = new ObjectID(); - addToOperationsList(this, common.INSERT, op.insertMany[i]); - } - - return; - } - - // No valid type of operation - throw toError("bulkWrite only supports insertOne, insertMany, updateOne, updateMany, removeOne, removeMany, deleteOne, deleteMany"); -} - -// -// Execute the command -var executeBatch = function(self, batch, callback) { - var finalOptions = {ordered: false} - if(self.s.writeConcern != null) { - finalOptions.writeConcern = self.s.writeConcern; - } - - var resultHandler = function(err, result) { - // Error is a driver related error not a bulk op error, terminate - if(err && err.driver || err && err.message) { - return callback(err); - } - - // If we have and error - if(err) err.ok = 0; - callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, result)); - } - - // Set an operationIf if provided - if(self.operationId) { - resultHandler.operationId = self.operationId; - } - - // Serialize functions - if(self.s.options.serializeFunctions) { - finalOptions.serializeFunctions = true - } - - // Is the bypassDocumentValidation options specific - if(self.s.bypassDocumentValidation == true) { - finalOptions.bypassDocumentValidation = true; - } - - try { - if(batch.batchType == common.INSERT) { - self.s.topology.insert(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.UPDATE) { - self.s.topology.update(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } else if(batch.batchType == common.REMOVE) { - self.s.topology.remove(self.s.collection.namespace, batch.operations, finalOptions, resultHandler); - } - } catch(err) { - // Force top level error - err.ok = 0; - // Merge top level error and return - callback(null, mergeBatchResults(false, batch, self.s.bulkResult, err, null)); - } -} - -// -// Execute all the commands -var executeBatches = function(self, callback) { - var numberOfCommandsToExecute = self.s.batches.length; - var error = null; - // Execute over all the batches - for(var i = 0; i < self.s.batches.length; i++) { - executeBatch(self, self.s.batches[i], function(err, result) { - // Driver layer error capture it - if(err) error = err; - // Count down the number of commands left to execute - numberOfCommandsToExecute = numberOfCommandsToExecute - 1; - - // Execute - if(numberOfCommandsToExecute == 0) { - // Driver level error - if(error) return callback(error); - // Treat write errors - var error = self.s.bulkResult.writeErrors.length > 0 ? toError(self.s.bulkResult.writeErrors[0]) : null; - callback(error, new BulkWriteResult(self.s.bulkResult)); - } - }); - } -} - -/** - * The callback format for results - * @callback UnorderedBulkOperation~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {BulkWriteResult} result The bulk write result. - */ - -/** - * Execute the ordered bulk operation - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {UnorderedBulkOperation~resultCallback} [callback] The result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -UnorderedBulkOperation.prototype.execute = function(_writeConcern, callback) { - var self = this; - if(this.s.executed) throw toError("batch cannot be re-executed"); - if(typeof _writeConcern == 'function') { - callback = _writeConcern; - } else { - this.s.writeConcern = _writeConcern; - } - - // If we have current batch - if(this.s.currentInsertBatch) this.s.batches.push(this.s.currentInsertBatch); - if(this.s.currentUpdateBatch) this.s.batches.push(this.s.currentUpdateBatch); - if(this.s.currentRemoveBatch) this.s.batches.push(this.s.currentRemoveBatch); - - // If we have no operations in the bulk raise an error - if(this.s.batches.length == 0) { - throw toError("Invalid Operation, No operations in bulk"); - } - - // Execute using callback - if(typeof callback == 'function') return executeBatches(this, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - executeBatches(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('execute', {callback: true, promise:false}); - -/** - * Returns an unordered batch object - * @ignore - */ -var initializeUnorderedBulkOp = function(topology, collection, options) { - return new UnorderedBulkOperation(topology, collection, options); -} - -initializeUnorderedBulkOp.UnorderedBulkOperation = UnorderedBulkOperation; -module.exports = initializeUnorderedBulkOp; -module.exports.Bulk = UnorderedBulkOperation; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/collection.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/collection.js deleted file mode 100644 index 5ae1ebcc..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/collection.js +++ /dev/null @@ -1,3128 +0,0 @@ -"use strict"; - -var checkCollectionName = require('./utils').checkCollectionName - , ObjectID = require('mongodb-core').BSON.ObjectID - , Long = require('mongodb-core').BSON.Long - , Code = require('mongodb-core').BSON.Code - , f = require('util').format - , AggregationCursor = require('./aggregation_cursor') - , MongoError = require('mongodb-core').MongoError - , shallowClone = require('./utils').shallowClone - , isObject = require('./utils').isObject - , toError = require('./utils').toError - , normalizeHintField = require('./utils').normalizeHintField - , handleCallback = require('./utils').handleCallback - , decorateCommand = require('./utils').decorateCommand - , formattedOrderClause = require('./utils').formattedOrderClause - , ReadPreference = require('./read_preference') - , CoreReadPreference = require('mongodb-core').ReadPreference - , CommandCursor = require('./command_cursor') - , Define = require('./metadata') - , Cursor = require('./cursor') - , unordered = require('./bulk/unordered') - , ordered = require('./bulk/ordered'); - -/** - * @fileOverview The **Collection** class is an internal class that embodies a MongoDB collection - * allowing for insert/update/remove/find and other command operation on that MongoDB collection. - * - * **COLLECTION Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('createIndexExample1'); - * // Show that duplicate records got dropped - * col.find({}).toArray(function(err, items) { - * test.equal(null, err); - * test.equal(4, items.length); - * db.close(); - * }); - * }); - */ - -/** - * Create a new Collection instance (INTERNAL TYPE, do not instantiate directly) - * @class - * @property {string} collectionName Get the collection name. - * @property {string} namespace Get the full collection namespace. - * @property {object} writeConcern The current write concern values. - * @property {object} readConcern The current read concern values. - * @property {object} hint Get current index hint for collection. - * @return {Collection} a Collection instance. - */ -var Collection = function(db, topology, dbName, name, pkFactory, options) { - checkCollectionName(name); - var self = this; - // Unpack variables - var internalHint = null; - var opts = options != null && ('object' === typeof options) ? options : {}; - var slaveOk = options == null || options.slaveOk == null ? db.slaveOk : options.slaveOk; - var serializeFunctions = options == null || options.serializeFunctions == null ? db.serializeFunctions : options.serializeFunctions; - var raw = options == null || options.raw == null ? db.raw : options.raw; - var readPreference = null; - var collectionHint = null; - var namespace = f("%s.%s", dbName, name); - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Assign the right collection level readPreference - if(options && options.readPreference) { - readPreference = options.readPreference; - } else if(db.options.readPreference) { - readPreference = db.options.readPreference; - } - - // Set custom primary key factory if provided - pkFactory = pkFactory == null - ? ObjectID - : pkFactory; - - // Internal state - this.s = { - // Set custom primary key factory if provided - pkFactory: pkFactory - // Db - , db: db - // Topology - , topology: topology - // dbName - , dbName: dbName - // Options - , options: options - // Namespace - , namespace: namespace - // Read preference - , readPreference: readPreference - // Raw - , raw: raw - // SlaveOK - , slaveOk: slaveOk - // Serialize functions - , serializeFunctions: serializeFunctions - // internalHint - , internalHint: internalHint - // collectionHint - , collectionHint: collectionHint - // Name - , name: name - // Promise library - , promiseLibrary: promiseLibrary - // Read Concern - , readConcern: options.readConcern - } -} - -var define = Collection.define = new Define('Collection', Collection, false); - -Object.defineProperty(Collection.prototype, 'collectionName', { - enumerable: true, get: function() { return this.s.name; } -}); - -Object.defineProperty(Collection.prototype, 'namespace', { - enumerable: true, get: function() { return this.s.namespace; } -}); - -Object.defineProperty(Collection.prototype, 'readConcern', { - enumerable: true, get: function() { return this.s.readConcern || {level: 'local'}; } -}); - -Object.defineProperty(Collection.prototype, 'writeConcern', { - enumerable:true, - get: function() { - var ops = {}; - if(this.s.options.w != null) ops.w = this.s.options.w; - if(this.s.options.j != null) ops.j = this.s.options.j; - if(this.s.options.fsync != null) ops.fsync = this.s.options.fsync; - if(this.s.options.wtimeout != null) ops.wtimeout = this.s.options.wtimeout; - return ops; - } -}); - -/** - * @ignore - */ -Object.defineProperty(Collection.prototype, "hint", { - enumerable: true - , get: function () { return this.s.collectionHint; } - , set: function (v) { this.s.collectionHint = normalizeHintField(v); } -}); - -/** - * Creates a cursor for a query that can be used to iterate over results from MongoDB - * @method - * @param {object} query The cursor query object. - * @throws {MongoError} - * @return {Cursor} - */ -Collection.prototype.find = function() { - var options - , args = Array.prototype.slice.call(arguments, 0) - , has_callback = typeof args[args.length - 1] === 'function' - , has_weird_callback = typeof args[0] === 'function' - , callback = has_callback ? args.pop() : (has_weird_callback ? args.shift() : null) - , len = args.length - , selector = len >= 1 ? args[0] : {} - , fields = len >= 2 ? args[1] : undefined; - - if(len === 1 && has_weird_callback) { - // backwards compat for callback?, options case - selector = {}; - options = args[0]; - } - - if(len === 2 && fields !== undefined && !Array.isArray(fields)) { - var fieldKeys = Object.keys(fields); - var is_option = false; - - for(var i = 0; i < fieldKeys.length; i++) { - if(testForFields[fieldKeys[i]] != null) { - is_option = true; - break; - } - } - - if(is_option) { - options = fields; - fields = undefined; - } else { - options = {}; - } - } else if(len === 2 && Array.isArray(fields) && !Array.isArray(fields[0])) { - var newFields = {}; - // Rewrite the array - for(var i = 0; i < fields.length; i++) { - newFields[fields[i]] = 1; - } - // Set the fields - fields = newFields; - } - - if(3 === len) { - options = args[2]; - } - - // Ensure selector is not null - selector = selector == null ? {} : selector; - // Validate correctness off the selector - var object = selector; - if(Buffer.isBuffer(object)) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query selector raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - // Validate correctness of the field selector - var object = fields; - if(Buffer.isBuffer(object)) { - var object_size = object[0] | object[1] << 8 | object[2] << 16 | object[3] << 24; - if(object_size != object.length) { - var error = new Error("query fields raw message size does not match message header size [" + object.length + "] != [" + object_size + "]"); - error.name = 'MongoError'; - throw error; - } - } - - // Check special case where we are using an objectId - if(selector instanceof ObjectID || (selector != null && selector._bsontype == 'ObjectID')) { - selector = {_id:selector}; - } - - // If it's a serialized fields field we need to just let it through - // user be warned it better be good - if(options && options.fields && !(Buffer.isBuffer(options.fields))) { - fields = {}; - - if(Array.isArray(options.fields)) { - if(!options.fields.length) { - fields['_id'] = 1; - } else { - for (var i = 0, l = options.fields.length; i < l; i++) { - fields[options.fields[i]] = 1; - } - } - } else { - fields = options.fields; - } - } - - if (!options) options = {}; - - var newOptions = {}; - // Make a shallow copy of options - for (var key in options) { - newOptions[key] = options[key]; - } - - // Unpack options - newOptions.skip = len > 3 ? args[2] : options.skip ? options.skip : 0; - newOptions.limit = len > 3 ? args[3] : options.limit ? options.limit : 0; - newOptions.raw = options.raw != null && typeof options.raw === 'boolean' ? options.raw : this.s.raw; - newOptions.hint = options.hint != null ? normalizeHintField(options.hint) : this.s.collectionHint; - newOptions.timeout = len == 5 ? args[4] : typeof options.timeout === 'undefined' ? undefined : options.timeout; - // // If we have overridden slaveOk otherwise use the default db setting - newOptions.slaveOk = options.slaveOk != null ? options.slaveOk : this.s.db.slaveOk; - - // Add read preference if needed - newOptions = getReadPreference(this, newOptions, this.s.db, this); - // Set slave ok to true if read preference different from primary - if(newOptions.readPreference != null - && (newOptions.readPreference != 'primary' || newOptions.readPreference.mode != 'primary')) { - newOptions.slaveOk = true; - } - - // Ensure the query is an object - if(selector != null && typeof selector != 'object') { - throw MongoError.create({message: "query selector must be an object", driver:true }); - } - - // Build the find command - var findCommand = { - find: this.s.namespace - , limit: newOptions.limit - , skip: newOptions.skip - , query: selector - } - - // Ensure we use the right await data option - if(typeof newOptions.awaitdata == 'boolean') { - newOptions.awaitData = newOptions.awaitdata - }; - - // Translate to new command option noCursorTimeout - if(typeof newOptions.timeout == 'boolean') newOptions.noCursorTimeout = newOptions.timeout; - - // Merge in options to command - for(var name in newOptions) { - if(newOptions[name] != null) findCommand[name] = newOptions[name]; - } - - // Format the fields - var formatFields = function(fields) { - var object = {}; - if(Array.isArray(fields)) { - for(var i = 0; i < fields.length; i++) { - if(Array.isArray(fields[i])) { - object[fields[i][0]] = fields[i][1]; - } else { - object[fields[i][0]] = 1; - } - } - } else { - object = fields; - } - - return object; - } - - // Special treatment for the fields selector - if(fields) findCommand.fields = formatFields(fields); - - // Add db object to the new options - newOptions.db = this.s.db; - - // Add the promise library - newOptions.promiseLibrary = this.s.promiseLibrary; - - // Set raw if available at collection level - if(newOptions.raw == null && this.s.raw) newOptions.raw = this.s.raw; - - // Sort options - if(findCommand.sort) - findCommand.sort = formattedOrderClause(findCommand.sort); - - // Set the readConcern - if(this.s.readConcern) { - findCommand.readConcern = this.s.readConcern; - } - - // Create the cursor - if(typeof callback == 'function') return handleCallback(callback, null, this.s.topology.cursor(this.s.namespace, findCommand, newOptions)); - return this.s.topology.cursor(this.s.namespace, findCommand, newOptions); -} - -define.classMethod('find', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Inserts a single document into MongoDB. - * @method - * @param {object} doc Document to insert. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~insertOneWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.insertOne = function(doc, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - if(Array.isArray(doc)) return callback(MongoError.create({message: 'doc parameter must be an object', driver:true })); - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return insertOne(self, doc, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - insertOne(self, doc, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var insertOne = function(self, doc, options, callback) { - insertDocuments(self, [doc], options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - // Workaround for pre 2.6 servers - if(r == null) return callback(null, {result: {ok:1}}); - // Add values to top level to ensure crud spec compatibility - r.insertedCount = r.result.n; - r.insertedId = doc._id; - if(callback) callback(null, r); - }); -} - -var mapInserManyResults = function(docs, r) { - var ids = r.getInsertedIds(); - var keys = Object.keys(ids); - var finalIds = new Array(keys); - - for(var i = 0; i < keys.length; i++) { - if(ids[keys[i]]._id) { - finalIds[ids[keys[i]].index] = ids[keys[i]]._id; - } - } - - return { - result: {ok: 1, n: r.insertedCount}, - ops: docs, - insertedCount: r.insertedCount, - insertedIds: finalIds - } -} - -define.classMethod('insertOne', {callback: true, promise:true}); - -/** - * Inserts an array of documents into MongoDB. - * @method - * @param {object[]} docs Documents to insert. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {Collection~insertWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.insertMany = function(docs, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {ordered:true}; - if(!Array.isArray(docs)) return callback(MongoError.create({message: 'docs parameter must be an array of documents', driver:true })); - - // Get the write concern options - if(typeof options.checkKeys != 'boolean') { - options.checkKeys = true; - } - - // If keep going set unordered - options['serializeFunctions'] = options['serializeFunctions'] || self.s.serializeFunctions; - - // Set up the force server object id - var forceServerObjectId = typeof options.forceServerObjectId == 'boolean' - ? options.forceServerObjectId : self.s.db.options.forceServerObjectId; - - // Do we want to force the server to assign the _id key - if(forceServerObjectId !== true) { - // Add _id if not specified - for(var i = 0; i < docs.length; i++) { - if(docs[i]._id == null) docs[i]._id = self.s.pkFactory.createPk(); - } - } - - // Generate the bulk write operations - var operations = [{ - insertMany: docs - }]; - - // Execute using callback - if(typeof callback == 'function') return bulkWrite(self, operations, options, function(err, r) { - if(err) return callback(err, r); - callback(null, mapInserManyResults(docs, r)); - }); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - bulkWrite(self, operations, options, function(err, r) { - if(err) return reject(err); - resolve(mapInserManyResults(docs, r)); - }); - }); -} - -define.classMethod('insertMany', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~BulkWriteOpResult - * @property {number} insertedCount Number of documents inserted. - * @property {number} matchedCount Number of documents matched for update. - * @property {number} modifiedCount Number of documents modified. - * @property {number} deletedCount Number of documents deleted. - * @property {number} upsertedCount Number of documents upserted. - * @property {object} insertedIds Inserted document generated Id's, hash key is the index of the originating operation - * @property {object} upsertedIds Upserted document generated Id's, hash key is the index of the originating operation - * @property {object} result The command result object. - */ - -/** - * The callback format for inserts - * @callback Collection~bulkWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~BulkWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Perform a bulkWrite operation without a fluent API - * - * Legal operation types are - * - * { insertOne: { document: { a: 1 } } } - * - * { updateOne: { filter: {a:2}, update: {$set: {a:2}}, upsert:true } } - * - * { updateMany: { filter: {a:2}, update: {$set: {a:2}}, upsert:true } } - * - * { deleteOne: { filter: {c:1} } } - * - * { deleteMany: { filter: {c:1} } } - * - * { replaceOne: { filter: {c:3}, replacement: {c:4}, upsert:true}} - * - * @method - * @param {object[]} operations Bulk operations to perform. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.ordered=true] Execute write operation in ordered or unordered fashion. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~bulkWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.bulkWrite = function(operations, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {ordered:true}; - - if(!Array.isArray(operations)) { - throw MongoError.create({message: "operations must be an array of documents", driver:true }); - } - - // Execute using callback - if(typeof callback == 'function') return bulkWrite(self, operations, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - bulkWrite(self, operations, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var bulkWrite = function(self, operations, options, callback) { - // Add ignoreUndfined - if(self.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = self.s.options.ignoreUndefined; - } - - // Create the bulk operation - var bulk = options.ordered == true || options.ordered == null ? self.initializeOrderedBulkOp(options) : self.initializeUnorderedBulkOp(options); - - // for each op go through and add to the bulk - for(var i = 0; i < operations.length; i++) { - bulk.raw(operations[i]); - } - - // Final options for write concern - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - var writeCon = finalOptions.writeConcern ? finalOptions.writeConcern : {}; - - // Execute the bulk - bulk.execute(writeCon, function(err, r) { - // We have connection level error - if(!r && err) return callback(err, null); - // We have single error - if(r && r.hasWriteErrors() && r.getWriteErrorCount() == 1) { - return callback(toError(r.getWriteErrorAt(0)), r); - } - - // if(err) return callback(err); - r.insertedCount = r.nInserted; - r.matchedCount = r.nMatched; - r.modifiedCount = r.nModified || 0; - r.deletedCount = r.nRemoved; - r.upsertedCount = r.getUpsertedIds().length; - r.upsertedIds = {}; - r.insertedIds = {}; - - // Update the n - r.n = r.insertedCount; - - // Inserted documents - var inserted = r.getInsertedIds(); - // Map inserted ids - for(var i = 0; i < inserted.length; i++) { - r.insertedIds[inserted[i].index] = inserted[i]._id; - } - - // Upserted documents - var upserted = r.getUpsertedIds(); - // Map upserted ids - for(var i = 0; i < upserted.length; i++) { - r.upsertedIds[upserted[i].index] = upserted[i]._id; - } - - // Check if we have write errors - if(r.hasWriteErrors()) { - // Get all the errors - var errors = r.getWriteErrors(); - // Return the MongoError object - return callback(toError({ - message: 'write operation failed', code: errors[0].code, writeErrors: errors - }), r); - } - - // Check if we have a writeConcern error - if(r.getWriteConcernError()) { - // Return the MongoError object - return callback(toError(r.getWriteConcernError()), r); - } - - // Return the results - callback(null, r); - }); -} - -var insertDocuments = function(self, docs, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - // Ensure we are operating on an array op docs - docs = Array.isArray(docs) ? docs : [docs]; - - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - if(typeof finalOptions.checkKeys != 'boolean') finalOptions.checkKeys = true; - - // If keep going set unordered - if(finalOptions.keepGoing == true) finalOptions.ordered = false; - finalOptions['serializeFunctions'] = options['serializeFunctions'] || self.s.serializeFunctions; - - // Set up the force server object id - var forceServerObjectId = typeof options.forceServerObjectId == 'boolean' - ? options.forceServerObjectId : self.s.db.options.forceServerObjectId; - - // Add _id if not specified - if(forceServerObjectId !== true){ - for(var i = 0; i < docs.length; i++) { - if(docs[i]._id == null) docs[i]._id = self.s.pkFactory.createPk(); - } - } - - // File inserts - self.s.topology.insert(self.s.namespace, docs, finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err); - if(result == null) return handleCallback(callback, null, null); - if(result.result.code) return handleCallback(callback, toError(result.result)); - if(result.result.writeErrors) return handleCallback(callback, toError(result.result.writeErrors[0])); - // Add docs to the list - result.ops = docs; - // Return the results - handleCallback(callback, null, result); - }); -} - -define.classMethod('bulkWrite', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~WriteOpResult - * @property {object[]} ops All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany - * @property {object} connection The connection object used for the operation. - * @property {object} result The command result object. - */ - -/** - * The callback format for inserts - * @callback Collection~writeOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~WriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * @typedef {Object} Collection~insertWriteOpResult - * @property {Number} insertedCount The total amount of documents inserted. - * @property {object[]} ops All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany - * @property {ObjectId[]} insertedIds All the generated _id's for the inserted documents. - * @property {object} connection The connection object used for the operation. - * @property {object} result The raw command result object returned from MongoDB (content might vary by server version). - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents inserted. - */ - -/** - * @typedef {Object} Collection~insertOneWriteOpResult - * @property {Number} insertedCount The total amount of documents inserted. - * @property {object[]} ops All the documents inserted using insertOne/insertMany/replaceOne. Documents contain the _id field if forceServerObjectId == false for insertOne/insertMany - * @property {ObjectId} insertedId The driver generated ObjectId for the insert operation. - * @property {object} connection The connection object used for the operation. - * @property {object} result The raw command result object returned from MongoDB (content might vary by server version). - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents inserted. - */ - -/** - * The callback format for inserts - * @callback Collection~insertWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~insertWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * The callback format for inserts - * @callback Collection~insertOneWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~insertOneWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Inserts a single document or a an array of documents into MongoDB. - * @method - * @param {(object|object[])} docs Documents to insert. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~insertWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated Use insertOne, insertMany or bulkWrite - */ -Collection.prototype.insert = function(docs, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {ordered:false}; - docs = !Array.isArray(docs) ? [docs] : docs; - - if(options.keepGoing == true) { - options.ordered = false; - } - - return this.insertMany(docs, options, callback); -} - -define.classMethod('insert', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~updateWriteOpResult - * @property {Object} result The raw result returned from MongoDB, field will vary depending on server version. - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents scanned. - * @property {Number} result.nModified The total count of documents modified. - * @property {Object} connection The connection object used for the operation. - * @property {Number} matchedCount The number of documents that matched the filter. - * @property {Number} modifiedCount The number of documents that were modified. - * @property {Number} upsertedCount The number of documents upserted. - * @property {Object} upsertedId The upserted id. - * @property {ObjectId} upsertedId._id The upserted _id returned from the server. - */ - -/** - * The callback format for inserts - * @callback Collection~updateWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~updateWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Update a single document on MongoDB - * @method - * @param {object} filter The Filter used to select the document to update - * @param {object} update The update operations to be applied to the document - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~updateWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.updateOne = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options) - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return updateOne(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - updateOne(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var updateOne = function(self, filter, update, options, callback) { - // Set single document update - options.multi = false; - // Execute update - updateDocuments(self, filter, update, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.matchedCount = r.result.n; - r.modifiedCount = r.result.nModified != null ? r.result.nModified : r.result.n; - r.upsertedId = Array.isArray(r.result.upserted) && r.result.upserted.length > 0 ? r.result.upserted[0] : null; - r.upsertedCount = Array.isArray(r.result.upserted) && r.result.upserted.length ? r.result.upserted.length : 0; - if(callback) callback(null, r); - }); -} - -define.classMethod('updateOne', {callback: true, promise:true}); - -/** - * Replace a document on MongoDB - * @method - * @param {object} filter The Filter used to select the document to update - * @param {object} doc The Document that replaces the matching document - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~updateWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.replaceOne = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options) - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return replaceOne(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - replaceOne(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var replaceOne = function(self, filter, update, options, callback) { - // Set single document update - options.multi = false; - // Execute update - updateDocuments(self, filter, update, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.matchedCount = r.result.n; - r.modifiedCount = r.result.nModified != null ? r.result.nModified : r.result.n; - r.upsertedId = Array.isArray(r.result.upserted) && r.result.upserted.length > 0 ? r.result.upserted[0] : null; - r.upsertedCount = Array.isArray(r.result.upserted) && r.result.upserted.length ? r.result.upserted.length : 0; - r.ops = [update]; - if(callback) callback(null, r); - }); -} - -define.classMethod('replaceOne', {callback: true, promise:true}); - -/** - * Update multiple documents on MongoDB - * @method - * @param {object} filter The Filter used to select the document to update - * @param {object} update The update operations to be applied to the document - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~updateWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.updateMany = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = shallowClone(options) - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return updateMany(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - updateMany(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var updateMany = function(self, filter, update, options, callback) { - // Set single document update - options.multi = true; - // Execute update - updateDocuments(self, filter, update, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.matchedCount = r.result.n; - r.modifiedCount = r.result.nModified != null ? r.result.nModified : r.result.n; - r.upsertedId = Array.isArray(r.result.upserted) && r.result.upserted.length > 0 ? r.result.upserted[0] : null; - r.upsertedCount = Array.isArray(r.result.upserted) && r.result.upserted.length ? r.result.upserted.length : 0; - if(callback) callback(null, r); - }); -} - -define.classMethod('updateMany', {callback: true, promise:true}); - -var updateDocuments = function(self, selector, document, options, callback) { - if('function' === typeof options) callback = options, options = null; - if(options == null) options = {}; - if(!('function' === typeof callback)) callback = null; - - // If we are not providing a selector or document throw - if(selector == null || typeof selector != 'object') return callback(toError("selector must be a valid JavaScript object")); - if(document == null || typeof document != 'object') return callback(toError("document must be a valid JavaScript object")); - - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - - // Do we return the actual result document - // Either use override on the function, or go back to default on either the collection - // level or db - finalOptions['serializeFunctions'] = options['serializeFunctions'] || self.s.serializeFunctions; - - // Execute the operation - var op = {q: selector, u: document}; - if(options.upsert) op.upsert = true; - if(options.multi) op.multi = true; - - // Update options - self.s.topology.update(self.s.namespace, [op], finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - if(result == null) return handleCallback(callback, null, null); - if(result.result.code) return handleCallback(callback, toError(result.result)); - if(result.result.writeErrors) return handleCallback(callback, toError(result.result.writeErrors[0])); - // Return the results - handleCallback(callback, null, result); - }); -} - -/** - * Updates documents. - * @method - * @param {object} selector The selector for the update operation. - * @param {object} document The update document. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.upsert=false] Update operation is an upsert. - * @param {boolean} [options.multi=false] Update one/all documents with operation. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~writeOpCallback} [callback] The command result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - * @deprecated use updateOne, updateMany or bulkWrite - */ -Collection.prototype.update = function(selector, document, options, callback) { - var self = this; - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return updateDocuments(self, selector, document, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - updateDocuments(self, selector, document, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('update', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~deleteWriteOpResult - * @property {Object} result The raw result returned from MongoDB, field will vary depending on server version. - * @property {Number} result.ok Is 1 if the command executed correctly. - * @property {Number} result.n The total count of documents deleted. - * @property {Object} connection The connection object used for the operation. - * @property {Number} deletedCount The number of documents deleted. - */ - -/** - * The callback format for inserts - * @callback Collection~deleteWriteOpCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~deleteWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Delete a document on MongoDB - * @method - * @param {object} filter The Filter used to select the document to remove - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~deleteWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.deleteOne = function(filter, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - var options = shallowClone(options); - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return deleteOne(self, filter, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - deleteOne(self, filter, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var deleteOne = function(self, filter, options, callback) { - options.single = true; - removeDocuments(self, filter, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.deletedCount = r.result.n; - if(callback) callback(null, r); - }); -} - -define.classMethod('deleteOne', {callback: true, promise:true}); - -Collection.prototype.removeOne = Collection.prototype.deleteOne; - -define.classMethod('removeOne', {callback: true, promise:true}); - -/** - * Delete multiple documents on MongoDB - * @method - * @param {object} filter The Filter used to select the documents to remove - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~deleteWriteOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.deleteMany = function(filter, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - var options = shallowClone(options); - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return deleteMany(self, filter, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - deleteMany(self, filter, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var deleteMany = function(self, filter, options, callback) { - options.single = false; - removeDocuments(self, filter, options, function(err, r) { - if(callback == null) return; - if(err && callback) return callback(err); - if(r == null) return callback(null, {result: {ok:1}}); - r.deletedCount = r.result.n; - if(callback) callback(null, r); - }); -} - -var removeDocuments = function(self, selector, options, callback) { - if(typeof options == 'function') { - callback = options, options = {}; - } else if (typeof selector === 'function') { - callback = selector; - options = {}; - selector = {}; - } - - // Create an empty options object if the provided one is null - options = options || {}; - - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - - // If selector is null set empty - if(selector == null) selector = {}; - - // Build the op - var op = {q: selector, limit: 0}; - if(options.single) op.limit = 1; - - // Execute the remove - self.s.topology.remove(self.s.namespace, [op], finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - if(result == null) return handleCallback(callback, null, null); - if(result.result.code) return handleCallback(callback, toError(result.result)); - if(result.result.writeErrors) return handleCallback(callback, toError(result.result.writeErrors[0])); - // Return the results - handleCallback(callback, null, result); - }); -} - -define.classMethod('deleteMany', {callback: true, promise:true}); - -Collection.prototype.removeMany = Collection.prototype.deleteMany; - -define.classMethod('removeMany', {callback: true, promise:true}); - -/** - * Remove documents. - * @method - * @param {object} selector The selector for the update operation. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.single=false] Removes the first document found. - * @param {Collection~writeOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use deleteOne, deleteMany or bulkWrite - */ -Collection.prototype.remove = function(selector, options, callback) { - var self = this; - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return removeDocuments(self, selector, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - removeDocuments(self, selector, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('remove', {callback: true, promise:true}); - -/** - * Save a document. Simple full document replacement function. Not recommended for efficiency, use atomic - * operators and update instead for more efficient operations. - * @method - * @param {object} doc Document to save - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~writeOpCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use insertOne, insertMany, updateOne or updateMany - */ -Collection.prototype.save = function(doc, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Add ignoreUndfined - if(this.s.options.ignoreUndefined) { - options = shallowClone(options); - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute using callback - if(typeof callback == 'function') return save(self, doc, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - save(self, doc, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var save = function(self, doc, options, callback) { - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self.s.db, self, options); - // Establish if we need to perform an insert or update - if(doc._id != null) { - finalOptions.upsert = true; - return updateDocuments(self, {_id: doc._id}, doc, finalOptions, callback); - } - - // Insert the document - insertDocuments(self, [doc], options, function(err, r) { - if(callback == null) return; - if(doc == null) return handleCallback(callback, null, null); - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, r); - }); -} - -define.classMethod('save', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Collection~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result object if the command was executed successfully. - */ - -/** - * Fetches the first document that matches the query - * @method - * @param {object} query Query for find Operation - * @param {object} [options=null] Optional settings. - * @param {number} [options.limit=0] Sets the limit of documents returned in the query. - * @param {(array|object)} [options.sort=null] Set to sort the documents coming back from the query. Array of indexes, [['a', 1]] etc. - * @param {object} [options.fields=null] The fields to return in the query. Object of fields to include or exclude (not both), {'a':1} - * @param {number} [options.skip=0] Set to skip N documents ahead in your query (useful for pagination). - * @param {Object} [options.hint=null] Tell the query to use specific indexes in the query. Object of indexes to use, {'_id':1} - * @param {boolean} [options.explain=false] Explain the query instead of returning the data. - * @param {boolean} [options.snapshot=false] Snapshot query. - * @param {boolean} [options.timeout=false] Specify if the cursor can timeout. - * @param {boolean} [options.tailable=false] Specify if the cursor is tailable. - * @param {number} [options.batchSize=0] Set the batchSize for the getMoreCommand when iterating over the query results. - * @param {boolean} [options.returnKey=false] Only return the index key. - * @param {number} [options.maxScan=null] Limit the number of items to scan. - * @param {number} [options.min=null] Set index bounds. - * @param {number} [options.max=null] Set index bounds. - * @param {boolean} [options.showDiskLoc=false] Show disk location of results. - * @param {string} [options.comment=null] You can put a $comment field on a query to make looking in the profiler logs simpler. - * @param {boolean} [options.raw=false] Return all BSON documents as Raw Buffer documents. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {boolean} [options.partial=false] Specify if the cursor should return partial results when querying against a sharded system - * @param {number} [options.maxTimeMS=null] Number of miliseconds to wait before aborting the query. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use find().limit(1).next(function(err, doc){}) - */ -Collection.prototype.findOne = function() { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - var callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - - // Execute using callback - if(typeof callback == 'function') return findOne(self, args, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - findOne(self, args, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOne = function(self, args, callback) { - var cursor = self.find.apply(self, args).limit(-1).batchSize(1); - // Return the item - cursor.next(function(err, item) { - if(err != null) return handleCallback(callback, toError(err), null); - handleCallback(callback, null, item); - }); -} - -define.classMethod('findOne', {callback: true, promise:true}); - -/** - * The callback format for the collection method, must be used if strict is specified - * @callback Collection~collectionResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection} collection The collection instance. - */ - -/** - * Rename the collection. - * - * @method - * @param {string} newName New name of of the collection. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.dropTarget=false] Drop the target name collection if it previously exists. - * @param {Collection~collectionResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.rename = function(newName, opt, callback) { - var self = this; - if(typeof opt == 'function') callback = opt, opt = {}; - opt = opt || {}; - - // Execute using callback - if(typeof callback == 'function') return rename(self, newName, opt, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - rename(self, newName, opt, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var rename = function(self, newName, opt, callback) { - // Check the collection name - checkCollectionName(newName); - // Build the command - var renameCollection = f("%s.%s", self.s.dbName, self.s.name); - var toCollection = f("%s.%s", self.s.dbName, newName); - var dropTarget = typeof opt.dropTarget == 'boolean' ? opt.dropTarget : false; - var cmd = {'renameCollection':renameCollection, 'to':toCollection, 'dropTarget':dropTarget}; - - // Execute against admin - self.s.db.admin().command(cmd, opt, function(err, doc) { - if(err) return handleCallback(callback, err, null); - // We have an error - if(doc.errmsg) return handleCallback(callback, toError(doc), null); - try { - return handleCallback(callback, null, new Collection(self.s.db, self.s.topology, self.s.dbName, newName, self.s.pkFactory, self.s.options)); - } catch(err) { - return handleCallback(callback, toError(err), null); - } - }); -} - -define.classMethod('rename', {callback: true, promise:true}); - -/** - * Drop the collection from the database, removing it permanently. New accesses will create a new collection. - * - * @method - * @param {Collection~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.drop = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return self.s.db.dropCollection(self.s.name, callback); - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.s.db.dropCollection(self.s.name, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('drop', {callback: true, promise:true}); - -/** - * Returns the options of the collection. - * - * @method - * @param {Collection~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.options = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return options(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var options = function(self, callback) { - self.s.db.listCollections({name: self.s.name}).toArray(function(err, collections) { - if(err) return handleCallback(callback, err); - if(collections.length == 0) { - return handleCallback(callback, MongoError.create({message: f("collection %s not found", self.s.namespace), driver:true })); - } - - handleCallback(callback, err, collections[0].options || null); - }); -} - -define.classMethod('options', {callback: true, promise:true}); - -/** - * Returns if the collection is a capped collection - * - * @method - * @param {Collection~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.isCapped = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return isCapped(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - isCapped(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var isCapped = function(self, callback) { - self.options(function(err, document) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, document && document.capped); - }); -} - -define.classMethod('isCapped', {callback: true, promise:true}); - -/** - * Creates an index on the db and collection collection. - * @method - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.createIndex = function(fieldOrSpec, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - options = typeof callback === 'function' ? options : callback; - options = options == null ? {} : options; - - // Execute using callback - if(typeof callback == 'function') return createIndex(self, fieldOrSpec, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - createIndex(self, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var createIndex = function(self, fieldOrSpec, options, callback) { - self.s.db.createIndex(self.s.name, fieldOrSpec, options, callback); -} - -define.classMethod('createIndex', {callback: true, promise:true}); - -/** - * Creates multiple indexes in the collection, this method is only supported for - * MongoDB 2.6 or higher. Earlier version of MongoDB will throw a command not supported - * error. Index specifications are defined at http://docs.mongodb.org/manual/reference/command/createIndexes/. - * @method - * @param {array} indexSpecs An array of index specifications to be created - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.createIndexes = function(indexSpecs, callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return createIndexes(self, indexSpecs, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - createIndexes(self, indexSpecs, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var createIndexes = function(self, indexSpecs, callback) { - // Ensure we generate the correct name if the parameter is not set - for(var i = 0; i < indexSpecs.length; i++) { - if(indexSpecs[i].name == null) { - var keys = []; - - for(var name in indexSpecs[i].key) { - keys.push(f('%s_%s', name, indexSpecs[i].key[name])); - } - - // Set the name - indexSpecs[i].name = keys.join('_'); - } - } - - // Execute the index - self.s.db.command({ - createIndexes: self.s.name, indexes: indexSpecs - }, callback); -} - -define.classMethod('createIndexes', {callback: true, promise:true}); - -/** - * Drops an index from this collection. - * @method - * @param {string} indexName Name of the index to drop. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.dropIndex = function(indexName, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - // Run only against primary - options.readPreference = ReadPreference.PRIMARY; - - // Execute using callback - if(typeof callback == 'function') return dropIndex(self, indexName, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - dropIndex(self, indexName, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var dropIndex = function(self, indexName, options, callback) { - // Delete index command - var cmd = {'deleteIndexes':self.s.name, 'index':indexName}; - - // Execute command - self.s.db.command(cmd, options, function(err, result) { - if(typeof callback != 'function') return; - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result); - }); -} - -define.classMethod('dropIndex', {callback: true, promise:true}); - -/** - * Drops all indexes from this collection. - * @method - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.dropIndexes = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return dropIndexes(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - dropIndexes(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var dropIndexes = function(self, callback) { - self.dropIndex('*', function (err, result) { - if(err) return handleCallback(callback, err, false); - handleCallback(callback, null, true); - }); -} - -define.classMethod('dropIndexes', {callback: true, promise:true}); - -/** - * Drops all indexes from this collection. - * @method - * @deprecated use dropIndexes - * @param {Collection~resultCallback} callback The command result callback - * @return {Promise} returns Promise if no [callback] passed - */ -Collection.prototype.dropAllIndexes = Collection.prototype.dropIndexes; - -define.classMethod('dropAllIndexes', {callback: true, promise:true}); - -/** - * Reindex all indexes on the collection - * Warning: reIndex is a blocking operation (indexes are rebuilt in the foreground) and will be slow for large collections. - * @method - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.reIndex = function(options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return reIndex(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - reIndex(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var reIndex = function(self, options, callback) { - // Reindex - var cmd = {'reIndex':self.s.name}; - - // Execute the command - self.s.db.command(cmd, options, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.ok ? true : false); - }); -} - -define.classMethod('reIndex', {callback: true, promise:true}); - -/** - * Get the list of all indexes information for the collection. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {number} [options.batchSize=null] The batchSize for the returned command cursor or if pre 2.8 the systems batch collection - * @return {CommandCursor} - */ -Collection.prototype.listIndexes = function(options) { - options = options || {}; - // Clone the options - options = shallowClone(options); - // Set the CommandCursor constructor - options.cursorFactory = CommandCursor; - // Set the promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - // We have a list collections command - if(this.s.db.serverConfig.capabilities().hasListIndexesCommand) { - // Cursor options - var cursor = options.batchSize ? {batchSize: options.batchSize} : {} - // Build the command - var command = { listIndexes: this.s.name, cursor: cursor }; - // Execute the cursor - return this.s.topology.cursor(f('%s.$cmd', this.s.dbName), command, options); - } - - // Get the namespace - var ns = f('%s.system.indexes', this.s.dbName); - // Get the query - return this.s.topology.cursor(ns, {find: ns, query: {ns: this.s.namespace}}, options); -}; - -define.classMethod('listIndexes', {callback: false, promise:false, returns: [CommandCursor]}); - -/** - * Ensures that an index exists, if it does not it creates it - * @method - * @deprecated use createIndexes instead - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.ensureIndex = function(fieldOrSpec, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return ensureIndex(self, fieldOrSpec, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - ensureIndex(self, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var ensureIndex = function(self, fieldOrSpec, options, callback) { - self.s.db.ensureIndex(self.s.name, fieldOrSpec, options, callback); -} - -define.classMethod('ensureIndex', {callback: true, promise:true}); - -/** - * Checks if one or more indexes exist on the collection, fails on first non-existing index - * @method - * @param {(string|array)} indexes One or more index names to check. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.indexExists = function(indexes, callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') return indexExists(self, indexes, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexExists(self, indexes, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var indexExists = function(self, indexes, callback) { - self.indexInformation(function(err, indexInformation) { - // If we have an error return - if(err != null) return handleCallback(callback, err, null); - // Let's check for the index names - if(!Array.isArray(indexes)) return handleCallback(callback, null, indexInformation[indexes] != null); - // Check in list of indexes - for(var i = 0; i < indexes.length; i++) { - if(indexInformation[indexes[i]] == null) { - return handleCallback(callback, null, false); - } - } - - // All keys found return true - return handleCallback(callback, null, true); - }); -} - -define.classMethod('indexExists', {callback: true, promise:true}); - -/** - * Retrieves this collections index info. - * @method - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.full=false] Returns the full raw index information. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.indexInformation = function(options, callback) { - var self = this; - // Unpack calls - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return indexInformation(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexInformation(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var indexInformation = function(self, options, callback) { - self.s.db.indexInformation(self.s.name, options, callback); -} - -define.classMethod('indexInformation', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Collection~countCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {number} result The count of documents that matched the query. - */ - -/** - * Count number of matching documents in the db to a query. - * @method - * @param {object} query The query for the count. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.limit=null] The limit of documents to count. - * @param {boolean} [options.skip=null] The number of documents to skip for the count. - * @param {string} [options.hint=null] An index name hint for the query. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Collection~countCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.count = function(query, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - var queryOption = args.length ? args.shift() || {} : {}; - var optionsOption = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return count(self, queryOption, optionsOption, callback); - - // Check if query is empty - query = query || {}; - options = options || {}; - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - count(self, query, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var count = function(self, query, options, callback) { - var skip = options.skip; - var limit = options.limit; - var hint = options.hint; - var maxTimeMS = options.maxTimeMS; - - // Final query - var cmd = { - 'count': self.s.name, 'query': query - , 'fields': null - }; - - // Add limit and skip if defined - if(typeof skip == 'number') cmd.skip = skip; - if(typeof limit == 'number') cmd.limit = limit; - if(hint) options.hint = hint; - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - cmd.readConcern = self.s.readConcern; - } - - // Execute command - self.s.db.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.n); - }); -} - -define.classMethod('count', {callback: true, promise:true}); - -/** - * The distinct command returns returns a list of distinct values for the given key across a collection. - * @method - * @param {string} key Field of the document to find distinct values for. - * @param {object} query The query for filtering the set of documents to which we apply the distinct filter. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.distinct = function(key, query, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - var queryOption = args.length ? args.shift() || {} : {}; - var optionsOption = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return distinct(self, key, queryOption, optionsOption, callback); - - // Ensure the query and options are set - query = query || {}; - options = options || {}; - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - distinct(self, key, query, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var distinct = function(self, key, query, options, callback) { - // maxTimeMS option - var maxTimeMS = options.maxTimeMS; - - // Distinct command - var cmd = { - 'distinct': self.s.name, 'key': key, 'query': query - }; - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - cmd.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.values); - }); -} - -define.classMethod('distinct', {callback: true, promise:true}); - -/** - * Retrieve all the indexes on the collection. - * @method - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.indexes = function(callback) { - var self = this; - // Execute using callback - if(typeof callback == 'function') return indexes(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexes(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var indexes = function(self, callback) { - self.s.db.indexInformation(self.s.name, {full:true}, callback); -} - -define.classMethod('indexes', {callback: true, promise:true}); - -/** - * Get all the collection statistics. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {number} [options.scale=null] Divide the returned sizes by scale value. - * @param {Collection~resultCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.stats = function(options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return stats(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - stats(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var stats = function(self, options, callback) { - // Build command object - var commandObject = { - collStats:self.s.name - } - - // Check if we have the scale value - if(options['scale'] != null) commandObject['scale'] = options['scale']; - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Execute the command - self.s.db.command(commandObject, options, callback); -} - -define.classMethod('stats', {callback: true, promise:true}); - -/** - * @typedef {Object} Collection~findAndModifyWriteOpResult - * @property {object} value Document returned from findAndModify command. - * @property {object} lastErrorObject The raw lastErrorObject returned from the command. - * @property {Number} ok Is 1 if the command executed correctly. - */ - -/** - * The callback format for inserts - * @callback Collection~findAndModifyCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection~findAndModifyWriteOpResult} result The result object if the command was executed successfully. - */ - -/** - * Find a document and delete it in one atomic operation, requires a write lock for the duration of the operation. - * - * @method - * @param {object} filter Document selection filter. - * @param {object} [options=null] Optional settings. - * @param {object} [options.projection=null] Limits the fields to return for all matching documents. - * @param {object} [options.sort=null] Determines which document the operation modifies if the query selects multiple documents. - * @param {number} [options.maxTimeMS=null] The maximum amount of time to allow the query to run. - * @param {Collection~findAndModifyCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.findOneAndDelete = function(filter, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return findOneAndDelete(self, filter, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findOneAndDelete(self, filter, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOneAndDelete = function(self, filter, options, callback) { - // Final options - var finalOptions = shallowClone(options); - finalOptions['fields'] = options.projection; - finalOptions['remove'] = true; - // Execute find and Modify - self.findAndModify( - filter - , options.sort - , null - , finalOptions - , callback - ); -} - -define.classMethod('findOneAndDelete', {callback: true, promise:true}); - -/** - * Find a document and replace it in one atomic operation, requires a write lock for the duration of the operation. - * - * @method - * @param {object} filter Document selection filter. - * @param {object} replacement Document replacing the matching document. - * @param {object} [options=null] Optional settings. - * @param {object} [options.projection=null] Limits the fields to return for all matching documents. - * @param {object} [options.sort=null] Determines which document the operation modifies if the query selects multiple documents. - * @param {number} [options.maxTimeMS=null] The maximum amount of time to allow the query to run. - * @param {boolean} [options.upsert=false] Upsert the document if it does not exist. - * @param {boolean} [options.returnOriginal=true] When false, returns the updated document rather than the original. The default is true. - * @param {Collection~findAndModifyCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.findOneAndReplace = function(filter, replacement, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return findOneAndReplace(self, filter, replacement, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findOneAndReplace(self, filter, replacement, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOneAndReplace = function(self, filter, replacement, options, callback) { - // Final options - var finalOptions = shallowClone(options); - finalOptions['fields'] = options.projection; - finalOptions['update'] = true; - finalOptions['new'] = typeof options.returnOriginal == 'boolean' ? !options.returnOriginal : false; - finalOptions['upsert'] = typeof options.upsert == 'boolean' ? options.upsert : false; - - // Execute findAndModify - self.findAndModify( - filter - , options.sort - , replacement - , finalOptions - , callback - ); -} - -define.classMethod('findOneAndReplace', {callback: true, promise:true}); - -/** - * Find a document and update it in one atomic operation, requires a write lock for the duration of the operation. - * - * @method - * @param {object} filter Document selection filter. - * @param {object} update Update operations to be performed on the document - * @param {object} [options=null] Optional settings. - * @param {object} [options.projection=null] Limits the fields to return for all matching documents. - * @param {object} [options.sort=null] Determines which document the operation modifies if the query selects multiple documents. - * @param {number} [options.maxTimeMS=null] The maximum amount of time to allow the query to run. - * @param {boolean} [options.upsert=false] Upsert the document if it does not exist. - * @param {boolean} [options.returnOriginal=true] When false, returns the updated document rather than the original. The default is true. - * @param {Collection~findAndModifyCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.findOneAndUpdate = function(filter, update, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // Execute using callback - if(typeof callback == 'function') return findOneAndUpdate(self, filter, update, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findOneAndUpdate(self, filter, update, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findOneAndUpdate = function(self, filter, update, options, callback) { - // Final options - var finalOptions = shallowClone(options); - finalOptions['fields'] = options.projection; - finalOptions['update'] = true; - finalOptions['new'] = typeof options.returnOriginal == 'boolean' ? !options.returnOriginal : false; - finalOptions['upsert'] = typeof options.upsert == 'boolean' ? options.upsert : false; - - // Execute findAndModify - self.findAndModify( - filter - , options.sort - , update - , finalOptions - , callback - ); -} - -define.classMethod('findOneAndUpdate', {callback: true, promise:true}); - -/** - * Find and update a document. - * @method - * @param {object} query Query object to locate the object to modify. - * @param {array} sort If multiple docs match, choose the first one in the specified sort order as the object to manipulate. - * @param {object} doc The fields/vals to be updated. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.remove=false] Set to true to remove the object before returning. - * @param {boolean} [options.upsert=false] Perform an upsert operation. - * @param {boolean} [options.new=false] Set to true if you want to return the modified object rather than the original. Ignored for remove. - * @param {object} [options.fields=null] Object containing the field projection for the result returned from the operation. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use findOneAndUpdate, findOneAndReplace or findOneAndDelete instead - */ -Collection.prototype.findAndModify = function(query, sort, doc, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - sort = args.length ? args.shift() || [] : []; - doc = args.length ? args.shift() : null; - options = args.length ? args.shift() || {} : {}; - - // Clone options - var options = shallowClone(options); - // Force read preference primary - options.readPreference = ReadPreference.PRIMARY; - - // Execute using callback - if(typeof callback == 'function') return findAndModify(self, query, sort, doc, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - options = options || {}; - - findAndModify(self, query, sort, doc, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findAndModify = function(self, query, sort, doc, options, callback) { - // Create findAndModify command object - var queryObject = { - 'findandmodify': self.s.name - , 'query': query - }; - - sort = formattedOrderClause(sort); - if(sort) { - queryObject.sort = sort; - } - - queryObject.new = options.new ? true : false; - queryObject.remove = options.remove ? true : false; - queryObject.upsert = options.upsert ? true : false; - - if(options.fields) { - queryObject.fields = options.fields; - } - - if(doc && !options.remove) { - queryObject.update = doc; - } - - // Either use override on the function, or go back to default on either the collection - // level or db - if(options['serializeFunctions'] != null) { - options['serializeFunctions'] = options['serializeFunctions']; - } else { - options['serializeFunctions'] = self.s.serializeFunctions; - } - - // No check on the documents - options.checkKeys = false; - - // Get the write concern settings - var finalOptions = writeConcern(options, self.s.db, self, options); - - // Decorate the findAndModify command with the write Concern - if(finalOptions.writeConcern) { - queryObject.writeConcern = finalOptions.writeConcern; - } - - // Have we specified bypassDocumentValidation - if(typeof finalOptions.bypassDocumentValidation == 'boolean') { - queryObject.bypassDocumentValidation = finalOptions.bypassDocumentValidation; - } - - // Execute the command - self.s.db.command(queryObject - , options, function(err, result) { - if(err) return handleCallback(callback, err, null); - return handleCallback(callback, null, result); - }); -} - -define.classMethod('findAndModify', {callback: true, promise:true}); - -/** - * Find and remove a document. - * @method - * @param {object} query Query object to locate the object to modify. - * @param {array} sort If multiple docs match, choose the first one in the specified sort order as the object to manipulate. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - * @deprecated use findOneAndDelete instead - */ -Collection.prototype.findAndRemove = function(query, sort, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - sort = args.length ? args.shift() || [] : []; - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return findAndRemove(self, query, sort, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - findAndRemove(self, query, sort, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var findAndRemove = function(self, query, sort, options, callback) { - // Add the remove option - options['remove'] = true; - // Execute the callback - self.findAndModify(query, sort, null, options, callback); -} - -define.classMethod('findAndRemove', {callback: true, promise:true}); - -/** - * Execute an aggregation framework pipeline against the collection, needs MongoDB >= 2.2 - * @method - * @param {object} pipeline Array containing all the aggregation framework commands for the execution. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.cursor=null] Return the query as cursor, on 2.6 > it returns as a real cursor on pre 2.6 it returns as an emulated cursor. - * @param {number} [options.cursor.batchSize=null] The batchSize for the cursor - * @param {boolean} [options.explain=false] Explain returns the aggregation execution plan (requires mongodb 2.6 >). - * @param {boolean} [options.allowDiskUse=false] allowDiskUse lets the server know if it can use disk to store temporary results for the aggregation (requires mongodb 2.6 >). - * @param {number} [options.maxTimeMS=null] maxTimeMS specifies a cumulative time limit in milliseconds for processing operations on the cursor. MongoDB interrupts the operation at the earliest following interrupt point. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~resultCallback} callback The command result callback - * @return {(null|AggregationCursor)} - */ -Collection.prototype.aggregate = function(pipeline, options, callback) { - var self = this; - if(Array.isArray(pipeline)) { - // Set up callback if one is provided - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // If we have no options or callback we are doing - // a cursor based aggregation - if(options == null && callback == null) { - options = {}; - } - } else { - // Aggregation pipeline passed as arguments on the method - var args = Array.prototype.slice.call(arguments, 0); - // Get the callback - callback = args.pop(); - // Get the possible options object - var opts = args[args.length - 1]; - // If it contains any of the admissible options pop it of the args - options = opts && (opts.readPreference - || opts.explain || opts.cursor || opts.out - || opts.maxTimeMS || opts.allowDiskUse) ? args.pop() : {}; - // Left over arguments is the pipeline - pipeline = args; - } - - // If out was specified - if(typeof options.out == 'string') { - pipeline.push({$out: options.out}); - } - - // Build the command - var command = { aggregate : this.s.name, pipeline : pipeline}; - - // If we have bypassDocumentValidation set - if(typeof options.bypassDocumentValidation == 'boolean') { - command.bypassDocumentValidation = options.bypassDocumentValidation; - } - - // Do we have a readConcern specified - if(this.s.readConcern) { - command.readConcern = this.s.readConcern; - } - - // If we have allowDiskUse defined - if(options.allowDiskUse) command.allowDiskUse = options.allowDiskUse; - if(typeof options.maxTimeMS == 'number') command.maxTimeMS = options.maxTimeMS; - - // Ensure we have the right read preference inheritance - options = getReadPreference(this, options, this.s.db, this); - - // If explain has been specified add it - if(options.explain) command.explain = options.explain; - - // Validate that cursor options is valid - if(options.cursor != null && typeof options.cursor != 'object') { - throw toError('cursor options must be an object'); - } - - // promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - // Set the AggregationCursor constructor - options.cursorFactory = AggregationCursor; - if(typeof callback != 'function') { - if(this.s.topology.capabilities().hasAggregationCursor) { - options.cursor = options.cursor || { batchSize : 1000 }; - command.cursor = options.cursor; - } - - // Allow disk usage command - if(typeof options.allowDiskUse == 'boolean') command.allowDiskUse = options.allowDiskUse; - if(typeof options.maxTimeMS == 'number') command.maxTimeMS = options.maxTimeMS; - - // Execute the cursor - return this.s.topology.cursor(this.s.namespace, command, options); - } - - var cursor = null; - // We do not allow cursor - if(options.cursor) { - return this.s.topology.cursor(this.s.namespace, command, options); - } - - // Execute the command - this.s.db.command(command, options, function(err, result) { - if(err) { - handleCallback(callback, err); - } else if(result['err'] || result['errmsg']) { - handleCallback(callback, toError(result)); - } else if(typeof result == 'object' && result['serverPipeline']) { - handleCallback(callback, null, result['serverPipeline']); - } else if(typeof result == 'object' && result['stages']) { - handleCallback(callback, null, result['stages']); - } else { - handleCallback(callback, null, result.result); - } - }); -} - -define.classMethod('aggregate', {callback: true, promise:false}); - -/** - * The callback format for results - * @callback Collection~parallelCollectionScanCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Cursor[]} cursors A list of cursors returned allowing for parallel reading of collection. - */ - -/** - * Return N number of parallel cursors for a collection allowing parallel reading of entire collection. There are - * no ordering guarantees for returned results. - * @method - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.batchSize=null] Set the batchSize for the getMoreCommand when iterating over the query results. - * @param {number} [options.numCursors=1] The maximum number of parallel command cursors to return (the number of returned cursors will be in the range 1:numCursors) - * @param {boolean} [options.raw=false] Return all BSON documents as Raw Buffer documents. - * @param {Collection~parallelCollectionScanCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.parallelCollectionScan = function(options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {numCursors: 1}; - // Set number of cursors to 1 - options.numCursors = options.numCursors || 1; - options.batchSize = options.batchSize || 1000; - - // Ensure we have the right read preference inheritance - options = getReadPreference(this, options, this.s.db, this); - - // Add a promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - // Execute using callback - if(typeof callback == 'function') return parallelCollectionScan(self, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - parallelCollectionScan(self, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var parallelCollectionScan = function(self, options, callback) { - // Create command object - var commandObject = { - parallelCollectionScan: self.s.name - , numCursors: options.numCursors - } - - // Do we have a readConcern specified - if(self.s.readConcern) { - commandObject.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(commandObject, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - if(result == null) return handleCallback(callback, new Error("no result returned for parallelCollectionScan"), null); - - var cursors = []; - // Create command cursors for each item - for(var i = 0; i < result.cursors.length; i++) { - var rawId = result.cursors[i].cursor.id - // Convert cursorId to Long if needed - var cursorId = typeof rawId == 'number' ? Long.fromNumber(rawId) : rawId; - - // Command cursor options - var cmd = { - batchSize: options.batchSize - , cursorId: cursorId - , items: result.cursors[i].cursor.firstBatch - } - - // Add a command cursor - cursors.push(self.s.topology.cursor(self.s.namespace, cursorId, options)); - } - - handleCallback(callback, null, cursors); - }); -} - -define.classMethod('parallelCollectionScan', {callback: true, promise:true}); - -/** - * Execute the geoNear command to search for items in the collection - * - * @method - * @param {number} x Point to search on the x axis, ensure the indexes are ordered in the same order. - * @param {number} y Point to search on the y axis, ensure the indexes are ordered in the same order. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.num=null] Max number of results to return. - * @param {number} [options.minDistance=null] Include results starting at minDistance from a point (2.6 or higher) - * @param {number} [options.maxDistance=null] Include results up to maxDistance from the point. - * @param {number} [options.distanceMultiplier=null] Include a value to multiply the distances with allowing for range conversions. - * @param {object} [options.query=null] Filter the results by a query. - * @param {boolean} [options.spherical=false] Perform query using a spherical model. - * @param {boolean} [options.uniqueDocs=false] The closest location in a document to the center of the search region will always be returned MongoDB > 2.X. - * @param {boolean} [options.includeLocs=false] Include the location data fields in the top level of the results MongoDB > 2.X. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.geoNear = function(x, y, options, callback) { - var self = this; - var point = typeof(x) == 'object' && x - , args = Array.prototype.slice.call(arguments, point?1:2); - - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return geoNear(self, x, y, point, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - geoNear(self, x, y, point, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var geoNear = function(self, x, y, point, options, callback) { - // Build command object - var commandObject = { - geoNear:self.s.name, - near: point || [x, y] - } - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Exclude readPreference and existing options to prevent user from - // shooting themselves in the foot - var exclude = { - readPreference: true, - geoNear: true, - near: true - }; - - // Filter out any excluded objects - commandObject = decorateCommand(commandObject, options, exclude); - - // Do we have a readConcern specified - if(self.s.readConcern) { - commandObject.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(commandObject, options, function (err, res) { - if(err) return handleCallback(callback, err); - if(res.err || res.errmsg) return handleCallback(callback, toError(res)); - // should we only be returning res.results here? Not sure if the user - // should see the other return information - handleCallback(callback, null, res); - }); -} - -define.classMethod('geoNear', {callback: true, promise:true}); - -/** - * Execute a geo search using a geo haystack index on a collection. - * - * @method - * @param {number} x Point to search on the x axis, ensure the indexes are ordered in the same order. - * @param {number} y Point to search on the y axis, ensure the indexes are ordered in the same order. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxDistance=null] Include results up to maxDistance from the point. - * @param {object} [options.search=null] Filter the results by a query. - * @param {number} [options.limit=false] Max number of results to return. - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.geoHaystackSearch = function(x, y, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - options = args.length ? args.shift() || {} : {}; - - // Execute using callback - if(typeof callback == 'function') return geoHaystackSearch(self, x, y, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - geoHaystackSearch(self, x, y, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var geoHaystackSearch = function(self, x, y, options, callback) { - // Build command object - var commandObject = { - geoSearch: self.s.name, - near: [x, y] - } - - // Remove read preference from hash if it exists - commandObject = decorateCommand(commandObject, options, {readPreference: true}); - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - commandObject.readConcern = self.s.readConcern; - } - - // Execute the command - self.s.db.command(commandObject, options, function (err, res) { - if(err) return handleCallback(callback, err); - if(res.err || res.errmsg) handleCallback(callback, utils.toError(res)); - // should we only be returning res.results here? Not sure if the user - // should see the other return information - handleCallback(callback, null, res); - }); -} - -define.classMethod('geoHaystackSearch', {callback: true, promise:true}); - -/** - * Group function helper - * @ignore - */ -var groupFunction = function () { - var c = db[ns].find(condition); - var map = new Map(); - var reduce_function = reduce; - - while (c.hasNext()) { - var obj = c.next(); - var key = {}; - - for (var i = 0, len = keys.length; i < len; ++i) { - var k = keys[i]; - key[k] = obj[k]; - } - - var aggObj = map.get(key); - - if (aggObj == null) { - var newObj = Object.extend({}, key); - aggObj = Object.extend(newObj, initial); - map.put(key, aggObj); - } - - reduce_function(obj, aggObj); - } - - return { "result": map.values() }; -}.toString(); - -/** - * Run a group command across a collection - * - * @method - * @param {(object|array|function|code)} keys An object, array or function expressing the keys to group by. - * @param {object} condition An optional condition that must be true for a row to be considered. - * @param {object} initial Initial value of the aggregation counter object. - * @param {(function|Code)} reduce The reduce function aggregates (reduces) the objects iterated - * @param {(function|Code)} finalize An optional function to be run on each item in the result set just before the item is returned. - * @param {boolean} command Specify if you wish to run using the internal group command or using eval, default is true. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Collection~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.group = function(keys, condition, initial, reduce, finalize, command, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 3); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - // Fetch all commands - reduce = args.length ? args.shift() : null; - finalize = args.length ? args.shift() : null; - command = args.length ? args.shift() : null; - options = args.length ? args.shift() || {} : {}; - - // Make sure we are backward compatible - if(!(typeof finalize == 'function')) { - command = finalize; - finalize = null; - } - - if (!Array.isArray(keys) && keys instanceof Object && typeof(keys) !== 'function' && !(keys instanceof Code)) { - keys = Object.keys(keys); - } - - if(typeof reduce === 'function') { - reduce = reduce.toString(); - } - - if(typeof finalize === 'function') { - finalize = finalize.toString(); - } - - // Set up the command as default - command = command == null ? true : command; - - // Execute using callback - if(typeof callback == 'function') return group(self, keys, condition, initial, reduce, finalize, command, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - group(self, keys, condition, initial, reduce, finalize, command, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var group = function(self, keys, condition, initial, reduce, finalize, command, options, callback) { - // Execute using the command - if(command) { - var reduceFunction = reduce instanceof Code - ? reduce - : new Code(reduce); - - var selector = { - group: { - 'ns': self.s.name - , '$reduce': reduceFunction - , 'cond': condition - , 'initial': initial - , 'out': "inline" - } - }; - - // if finalize is defined - if(finalize != null) selector.group['finalize'] = finalize; - // Set up group selector - if ('function' === typeof keys || keys instanceof Code) { - selector.group.$keyf = keys instanceof Code - ? keys - : new Code(keys); - } else { - var hash = {}; - keys.forEach(function (key) { - hash[key] = 1; - }); - selector.group.key = hash; - } - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // Do we have a readConcern specified - if(self.s.readConcern) { - selector.readConcern = self.s.readConcern; - } - - // Execute command - self.s.db.command(selector, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.retval); - }); - } else { - // Create execution scope - var scope = reduce != null && reduce instanceof Code - ? reduce.scope - : {}; - - scope.ns = self.s.name; - scope.keys = keys; - scope.condition = condition; - scope.initial = initial; - - // Pass in the function text to execute within mongodb. - var groupfn = groupFunction.replace(/ reduce;/, reduce.toString() + ';'); - - self.s.db.eval(new Code(groupfn, scope), function (err, results) { - if (err) return handleCallback(callback, err, null); - handleCallback(callback, null, results.result || results); - }); - } -} - -define.classMethod('group', {callback: true, promise:true}); - -/** - * Functions that are passed as scope args must - * be converted to Code instances. - * @ignore - */ -function processScope (scope) { - if(!isObject(scope)) { - return scope; - } - - var keys = Object.keys(scope); - var i = keys.length; - var key; - var new_scope = {}; - - while (i--) { - key = keys[i]; - if ('function' == typeof scope[key]) { - new_scope[key] = new Code(String(scope[key])); - } else { - new_scope[key] = processScope(scope[key]); - } - } - - return new_scope; -} - -/** - * Run Map Reduce across a collection. Be aware that the inline option for out will return an array of results not a collection. - * - * @method - * @param {(function|string)} map The mapping function. - * @param {(function|string)} reduce The reduce function. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.out=null] Sets the output target for the map reduce job. *{inline:1} | {replace:'collectionName'} | {merge:'collectionName'} | {reduce:'collectionName'}* - * @param {object} [options.query=null] Query filter object. - * @param {object} [options.sort=null] Sorts the input objects using this key. Useful for optimization, like sorting by the emit key for fewer reduces. - * @param {number} [options.limit=null] Number of objects to return from collection. - * @param {boolean} [options.keeptemp=false] Keep temporary data. - * @param {(function|string)} [options.finalize=null] Finalize function. - * @param {object} [options.scope=null] Can pass in variables that can be access from map/reduce/finalize. - * @param {boolean} [options.jsMode=false] It is possible to make the execution stay in JS. Provided in MongoDB > 2.0.X. - * @param {boolean} [options.verbose=false] Provide statistics on job execution time. - * @param {boolean} [options.bypassDocumentValidation=false] Allow driver to bypass schema validation in MongoDB 3.2 or higher. - * @param {Collection~resultCallback} [callback] The command result callback - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Collection.prototype.mapReduce = function(map, reduce, options, callback) { - var self = this; - if('function' === typeof options) callback = options, options = {}; - // Out must allways be defined (make sure we don't break weirdly on pre 1.8+ servers) - if(null == options.out) { - throw new Error("the out option parameter must be defined, see mongodb docs for possible values"); - } - - if('function' === typeof map) { - map = map.toString(); - } - - if('function' === typeof reduce) { - reduce = reduce.toString(); - } - - if('function' === typeof options.finalize) { - options.finalize = options.finalize.toString(); - } - - // Execute using callback - if(typeof callback == 'function') return mapReduce(self, map, reduce, options, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - mapReduce(self, map, reduce, options, function(err, r, r1) { - if(err) return reject(err); - if(r instanceof Collection) return resolve(r); - resolve({results: r, stats: r1}); - }); - }); -} - -var mapReduce = function(self, map, reduce, options, callback) { - var mapCommandHash = { - mapreduce: self.s.name - , map: map - , reduce: reduce - }; - - // Add any other options passed in - for(var n in options) { - if('scope' == n) { - mapCommandHash[n] = processScope(options[n]); - } else { - mapCommandHash[n] = options[n]; - } - } - - // Ensure we have the right read preference inheritance - options = getReadPreference(self, options, self.s.db, self); - - // If we have a read preference and inline is not set as output fail hard - if((options.readPreference != false && options.readPreference != 'primary') - && options['out'] && (options['out'].inline != 1 && options['out'] != 'inline')) { - options.readPreference = 'primary'; - } - - // Is bypassDocumentValidation specified - if(typeof options.bypassDocumentValidation == 'boolean') { - mapCommandHash.bypassDocumentValidation = options.bypassDocumentValidation; - } - - // Do we have a readConcern specified - if(self.s.readConcern) { - mapCommandHash.readConcern = self.s.readConcern; - } - - // Execute command - self.s.db.command(mapCommandHash, {readPreference:options.readPreference}, function (err, result) { - if(err) return handleCallback(callback, err); - // Check if we have an error - if(1 != result.ok || result.err || result.errmsg) { - return handleCallback(callback, toError(result)); - } - - // Create statistics value - var stats = {}; - if(result.timeMillis) stats['processtime'] = result.timeMillis; - if(result.counts) stats['counts'] = result.counts; - if(result.timing) stats['timing'] = result.timing; - - // invoked with inline? - if(result.results) { - // If we wish for no verbosity - if(options['verbose'] == null || !options['verbose']) { - return handleCallback(callback, null, result.results); - } - - return handleCallback(callback, null, result.results, stats); - } - - // The returned collection - var collection = null; - - // If we have an object it's a different db - if(result.result != null && typeof result.result == 'object') { - var doc = result.result; - collection = self.s.db.db(doc.db).collection(doc.collection); - } else { - // Create a collection object that wraps the result collection - collection = self.s.db.collection(result.result) - } - - // If we wish for no verbosity - if(options['verbose'] == null || !options['verbose']) { - return handleCallback(callback, err, collection); - } - - // Return stats as third set of values - handleCallback(callback, err, collection, stats); - }); -} - -define.classMethod('mapReduce', {callback: true, promise:true}); - -/** - * Initiate a Out of order batch write operation. All operations will be buffered into insert/update/remove commands executed out of order. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @return {UnorderedBulkOperation} - */ -Collection.prototype.initializeUnorderedBulkOp = function(options) { - options = options || {}; - options.promiseLibrary = this.s.promiseLibrary; - return unordered(this.s.topology, this, options); -} - -define.classMethod('initializeUnorderedBulkOp', {callback: false, promise:false, returns: [ordered.UnorderedBulkOperation]}); - -/** - * Initiate an In order bulk write operation, operations will be serially executed in the order they are added, creating a new operation for each switch in types. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {OrderedBulkOperation} callback The command result callback - * @return {null} - */ -Collection.prototype.initializeOrderedBulkOp = function(options) { - options = options || {}; - options.promiseLibrary = this.s.promiseLibrary; - return ordered(this.s.topology, this, options); -} - -define.classMethod('initializeOrderedBulkOp', {callback: false, promise:false, returns: [ordered.OrderedBulkOperation]}); - -// Get write concern -var writeConcern = function(target, db, col, options) { - if(options.w != null || options.j != null || options.fsync != null) { - var opts = {}; - if(options.w != null) opts.w = options.w; - if(options.wtimeout != null) opts.wtimeout = options.wtimeout; - if(options.j != null) opts.j = options.j; - if(options.fsync != null) opts.fsync = options.fsync; - target.writeConcern = opts; - } else if(col.writeConcern.w != null || col.writeConcern.j != null || col.writeConcern.fsync != null) { - target.writeConcern = col.writeConcern; - } else if(db.writeConcern.w != null || db.writeConcern.j != null || db.writeConcern.fsync != null) { - target.writeConcern = db.writeConcern; - } - - return target -} - -// Figure out the read preference -var getReadPreference = function(self, options, db, coll) { - var r = null - if(options.readPreference) { - r = options.readPreference - } else if(self.s.readPreference) { - r = self.s.readPreference - } else if(db.readPreference) { - r = db.readPreference; - } - - if(r instanceof ReadPreference) { - options.readPreference = new CoreReadPreference(r.mode, r.tags); - } else if(typeof r == 'string') { - options.readPreference = new CoreReadPreference(r); - } - - return options; -} - -var testForFields = { - limit: 1, sort: 1, fields:1, skip: 1, hint: 1, explain: 1, snapshot: 1, timeout: 1, tailable: 1, tailableRetryInterval: 1 - , numberOfRetries: 1, awaitdata: 1, awaitData: 1, exhaust: 1, batchSize: 1, returnKey: 1, maxScan: 1, min: 1, max: 1, showDiskLoc: 1 - , comment: 1, raw: 1, readPreference: 1, partial: 1, read: 1, dbName: 1, oplogReplay: 1, connection: 1, maxTimeMS: 1, transforms: 1 -} - -module.exports = Collection; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js deleted file mode 100644 index 37df593b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/command_cursor.js +++ /dev/null @@ -1,296 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , toError = require('./utils').toError - , getSingleProperty = require('./utils').getSingleProperty - , formattedOrderClause = require('./utils').formattedOrderClause - , handleCallback = require('./utils').handleCallback - , Logger = require('mongodb-core').Logger - , EventEmitter = require('events').EventEmitter - , ReadPreference = require('./read_preference') - , MongoError = require('mongodb-core').MongoError - , Readable = require('stream').Readable || require('readable-stream').Readable - , Define = require('./metadata') - , CoreCursor = require('./cursor') - , Query = require('mongodb-core').Query - , CoreReadPreference = require('mongodb-core').ReadPreference; - -/** - * @fileOverview The **CommandCursor** class is an internal class that embodies a - * generalized cursor based on a MongoDB command allowing for iteration over the - * results returned. It supports one by one document iteration, conversion to an - * array or can be iterated as a Node 0.10.X or higher stream - * - * **CommandCursor Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('listCollectionsExample1'); - * // Insert a bunch of documents - * col.insert([{a:1, b:1} - * , {a:2, b:2}, {a:3, b:3} - * , {a:4, b:4}], {w:1}, function(err, result) { - * test.equal(null, err); - * - * // List the database collections available - * db.listCollections().toArray(function(err, items) { - * test.equal(null, err); - * db.close(); - * }); - * }); - * }); - */ - -/** - * Namespace provided by the browser. - * @external Readable - */ - -/** - * Creates a new Command Cursor instance (INTERNAL TYPE, do not instantiate directly) - * @class CommandCursor - * @extends external:Readable - * @fires CommandCursor#data - * @fires CommandCursor#end - * @fires CommandCursor#close - * @fires CommandCursor#readable - * @return {CommandCursor} an CommandCursor instance. - */ -var CommandCursor = function(bson, ns, cmd, options, topology, topologyOptions) { - CoreCursor.apply(this, Array.prototype.slice.call(arguments, 0)); - var self = this; - var state = CommandCursor.INIT; - var streamOptions = {}; - - // MaxTimeMS - var maxTimeMS = null; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set up - Readable.call(this, {objectMode: true}); - - // Internal state - this.s = { - // MaxTimeMS - maxTimeMS: maxTimeMS - // State - , state: state - // Stream options - , streamOptions: streamOptions - // BSON - , bson: bson - // Namespae - , ns: ns - // Command - , cmd: cmd - // Options - , options: options - // Topology - , topology: topology - // Topology Options - , topologyOptions: topologyOptions - // Promise library - , promiseLibrary: promiseLibrary - } -} - -/** - * CommandCursor stream data event, fired for each document in the cursor. - * - * @event CommandCursor#data - * @type {object} - */ - -/** - * CommandCursor stream end event - * - * @event CommandCursor#end - * @type {null} - */ - -/** - * CommandCursor stream close event - * - * @event CommandCursor#close - * @type {null} - */ - -/** - * CommandCursor stream readable event - * - * @event CommandCursor#readable - * @type {null} - */ - -// Inherit from Readable -inherits(CommandCursor, Readable); - -// Set the methods to inherit from prototype -var methodsToInherit = ['_next', 'next', 'each', 'forEach', 'toArray' - , 'rewind', 'bufferedCount', 'readBufferedDocuments', 'close', 'isClosed', 'kill' - , '_find', '_getmore', '_killcursor', 'isDead', 'explain', 'isNotified', 'isKilled']; - -// Only inherit the types we need -for(var i = 0; i < methodsToInherit.length; i++) { - CommandCursor.prototype[methodsToInherit[i]] = CoreCursor.prototype[methodsToInherit[i]]; -} - -var define = CommandCursor.define = new Define('CommandCursor', CommandCursor, true); - -/** - * Set the batch size for the cursor. - * @method - * @param {number} value The batchSize for the cursor. - * @throws {MongoError} - * @return {CommandCursor} - */ -CommandCursor.prototype.batchSize = function(value) { - if(this.s.state == CommandCursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "batchSize requires an integer", driver:true}); - if(this.s.cmd.cursor) this.s.cmd.cursor.batchSize = value; - this.setCursorBatchSize(value); - return this; -} - -define.classMethod('batchSize', {callback: false, promise:false, returns: [CommandCursor]}); - -/** - * Add a maxTimeMS stage to the aggregation pipeline - * @method - * @param {number} value The state maxTimeMS value. - * @return {CommandCursor} - */ -CommandCursor.prototype.maxTimeMS = function(value) { - if(this.s.topology.lastIsMaster().minWireVersion > 2) { - this.s.cmd.maxTimeMS = value; - } - return this; -} - -define.classMethod('maxTimeMS', {callback: false, promise:false, returns: [CommandCursor]}); - -CommandCursor.prototype.get = CommandCursor.prototype.toArray; - -define.classMethod('get', {callback: true, promise:false}); - -// Inherited methods -define.classMethod('toArray', {callback: true, promise:true}); -define.classMethod('each', {callback: true, promise:false}); -define.classMethod('forEach', {callback: true, promise:false}); -define.classMethod('next', {callback: true, promise:true}); -define.classMethod('close', {callback: true, promise:true}); -define.classMethod('isClosed', {callback: false, promise:false, returns: [Boolean]}); -define.classMethod('rewind', {callback: false, promise:false}); -define.classMethod('bufferedCount', {callback: false, promise:false, returns: [Number]}); -define.classMethod('readBufferedDocuments', {callback: false, promise:false, returns: [Array]}); - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @function CommandCursor.prototype.next - * @param {CommandCursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback CommandCursor~toArrayResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object[]} documents All the documents the satisfy the cursor. - */ - -/** - * Returns an array of documents. The caller is responsible for making sure that there - * is enough memory to store the results. Note that the array only contain partial - * results when this cursor had been previouly accessed. - * @method CommandCursor.prototype.toArray - * @param {CommandCursor~toArrayResultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ - -/** - * The callback format for results - * @callback CommandCursor~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {(object|null)} result The result object if the command was executed successfully. - */ - -/** - * Iterates over all the documents for this cursor. As with **{cursor.toArray}**, - * not all of the elements will be iterated if this cursor had been previouly accessed. - * In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike - * **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements - * at any given time if batch size is specified. Otherwise, the caller is responsible - * for making sure that the entire result can fit the memory. - * @method CommandCursor.prototype.each - * @param {CommandCursor~resultCallback} callback The result callback. - * @throws {MongoError} - * @return {null} - */ - -/** - * Close the cursor, sending a KillCursor command and emitting close. - * @method CommandCursor.prototype.close - * @param {CommandCursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ - -/** - * Is the cursor closed - * @method CommandCursor.prototype.isClosed - * @return {boolean} - */ - -/** - * Clone the cursor - * @function CommandCursor.prototype.clone - * @return {CommandCursor} - */ - -/** - * Resets the cursor - * @function CommandCursor.prototype.rewind - * @return {CommandCursor} - */ - -/** - * The callback format for the forEach iterator method - * @callback CommandCursor~iteratorCallback - * @param {Object} doc An emitted document for the iterator - */ - -/** - * The callback error format for the forEach iterator method - * @callback CommandCursor~endCallback - * @param {MongoError} error An error instance representing the error during the execution. - */ - -/* - * Iterates over all the documents for this cursor using the iterator, callback pattern. - * @method CommandCursor.prototype.forEach - * @param {CommandCursor~iteratorCallback} iterator The iteration callback. - * @param {CommandCursor~endCallback} callback The end callback. - * @throws {MongoError} - * @return {null} - */ - -CommandCursor.INIT = 0; -CommandCursor.OPEN = 1; -CommandCursor.CLOSED = 2; - -module.exports = CommandCursor; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/cursor.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/cursor.js deleted file mode 100644 index 1a446a8a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/cursor.js +++ /dev/null @@ -1,1149 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , toError = require('./utils').toError - , getSingleProperty = require('./utils').getSingleProperty - , formattedOrderClause = require('./utils').formattedOrderClause - , handleCallback = require('./utils').handleCallback - , Logger = require('mongodb-core').Logger - , EventEmitter = require('events').EventEmitter - , ReadPreference = require('./read_preference') - , MongoError = require('mongodb-core').MongoError - , Readable = require('stream').Readable || require('readable-stream').Readable - , Define = require('./metadata') - , CoreCursor = require('mongodb-core').Cursor - , Query = require('mongodb-core').Query - , CoreReadPreference = require('mongodb-core').ReadPreference; - -/** - * @fileOverview The **Cursor** class is an internal class that embodies a cursor on MongoDB - * allowing for iteration over the results returned from the underlying query. It supports - * one by one document iteration, conversion to an array or can be iterated as a Node 0.10.X - * or higher stream - * - * **CURSORS Cannot directly be instantiated** - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Create a collection we want to drop later - * var col = db.collection('createIndexExample1'); - * // Insert a bunch of documents - * col.insert([{a:1, b:1} - * , {a:2, b:2}, {a:3, b:3} - * , {a:4, b:4}], {w:1}, function(err, result) { - * test.equal(null, err); - * - * // Show that duplicate records got dropped - * col.find({}).toArray(function(err, items) { - * test.equal(null, err); - * test.equal(4, items.length); - * db.close(); - * }); - * }); - * }); - */ - -/** - * Namespace provided by the mongodb-core and node.js - * @external CoreCursor - * @external Readable - */ - -// Flags allowed for cursor -var flags = ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'exhaust', 'partial']; -var fields = ['numberOfRetries', 'tailableRetryInterval']; - -/** - * Creates a new Cursor instance (INTERNAL TYPE, do not instantiate directly) - * @class Cursor - * @extends external:CoreCursor - * @extends external:Readable - * @property {string} sortValue Cursor query sort setting. - * @property {boolean} timeout Is Cursor able to time out. - * @property {ReadPreference} readPreference Get cursor ReadPreference. - * @fires Cursor#data - * @fires Cursor#end - * @fires Cursor#close - * @fires Cursor#readable - * @return {Cursor} a Cursor instance. - * @example - * Cursor cursor options. - * - * collection.find({}).project({a:1}) // Create a projection of field a - * collection.find({}).skip(1).limit(10) // Skip 1 and limit 10 - * collection.find({}).batchSize(5) // Set batchSize on cursor to 5 - * collection.find({}).filter({a:1}) // Set query on the cursor - * collection.find({}).comment('add a comment') // Add a comment to the query, allowing to correlate queries - * collection.find({}).addCursorFlag('tailable', true) // Set cursor as tailable - * collection.find({}).addCursorFlag('oplogReplay', true) // Set cursor as oplogReplay - * collection.find({}).addCursorFlag('noCursorTimeout', true) // Set cursor as noCursorTimeout - * collection.find({}).addCursorFlag('awaitData', true) // Set cursor as awaitData - * collection.find({}).addCursorFlag('exhaust', true) // Set cursor as exhaust - * collection.find({}).addCursorFlag('partial', true) // Set cursor as partial - * collection.find({}).addQueryModifier('$orderby', {a:1}) // Set $orderby {a:1} - * collection.find({}).max(10) // Set the cursor maxScan - * collection.find({}).maxScan(10) // Set the cursor maxScan - * collection.find({}).maxTimeMS(1000) // Set the cursor maxTimeMS - * collection.find({}).min(100) // Set the cursor min - * collection.find({}).returnKey(10) // Set the cursor returnKey - * collection.find({}).setReadPreference(ReadPreference.PRIMARY) // Set the cursor readPreference - * collection.find({}).showRecordId(true) // Set the cursor showRecordId - * collection.find({}).snapshot(true) // Set the cursor snapshot - * collection.find({}).sort([['a', 1]]) // Sets the sort order of the cursor query - * collection.find({}).hint('a_1') // Set the cursor hint - * - * All options are chainable, so one can do the following. - * - * collection.find({}).maxTimeMS(1000).maxScan(100).skip(1).toArray(..) - */ -var Cursor = function(bson, ns, cmd, options, topology, topologyOptions) { - CoreCursor.apply(this, Array.prototype.slice.call(arguments, 0)); - var self = this; - var state = Cursor.INIT; - var streamOptions = {}; - - // Tailable cursor options - var numberOfRetries = options.numberOfRetries || 5; - var tailableRetryInterval = options.tailableRetryInterval || 500; - var currentNumberOfRetries = numberOfRetries; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set up - Readable.call(this, {objectMode: true}); - - // Internal cursor state - this.s = { - // Tailable cursor options - numberOfRetries: numberOfRetries - , tailableRetryInterval: tailableRetryInterval - , currentNumberOfRetries: currentNumberOfRetries - // State - , state: state - // Stream options - , streamOptions: streamOptions - // BSON - , bson: bson - // Namespace - , ns: ns - // Command - , cmd: cmd - // Options - , options: options - // Topology - , topology: topology - // Topology options - , topologyOptions: topologyOptions - // Promise library - , promiseLibrary: promiseLibrary - // Current doc - , currentDoc: null - } - - // Legacy fields - this.timeout = self.s.options.noCursorTimeout == true; - this.sortValue = self.s.cmd.sort; - this.readPreference = self.s.options.readPreference; -} - -/** - * Cursor stream data event, fired for each document in the cursor. - * - * @event Cursor#data - * @type {object} - */ - -/** - * Cursor stream end event - * - * @event Cursor#end - * @type {null} - */ - -/** - * Cursor stream close event - * - * @event Cursor#close - * @type {null} - */ - -/** - * Cursor stream readable event - * - * @event Cursor#readable - * @type {null} - */ - -// Inherit from Readable -inherits(Cursor, Readable); - -// Map core cursor _next method so we can apply mapping -CoreCursor.prototype._next = CoreCursor.prototype.next; - -for(var name in CoreCursor.prototype) { - Cursor.prototype[name] = CoreCursor.prototype[name]; -} - -var define = Cursor.define = new Define('Cursor', Cursor, true); - -/** - * Check if there is any document still available in the cursor - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.hasNext = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') { - if(self.s.currentDoc){ - return callback(null, true); - } else { - return nextObject(self, function(err, doc) { - if(!doc) return callback(null, false); - self.s.currentDoc = doc; - callback(null, true); - }); - } - } - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - if(self.s.currentDoc){ - resolve(true); - } else { - nextObject(self, function(err, doc) { - if(self.s.state == Cursor.CLOSED || self.isDead()) return resolve(false); - if(err) return reject(err); - if(!doc) return resolve(false); - self.s.currentDoc = doc; - resolve(true); - }); - } - }); -} - -define.classMethod('hasNext', {callback: true, promise:true}); - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.next = function(callback) { - var self = this; - - // Execute using callback - if(typeof callback == 'function') { - // Return the currentDoc if someone called hasNext first - if(self.s.currentDoc) { - var doc = self.s.currentDoc; - self.s.currentDoc = null; - return callback(null, doc); - } - - // Return the next object - return nextObject(self, callback) - }; - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - // Return the currentDoc if someone called hasNext first - if(self.s.currentDoc) { - var doc = self.s.currentDoc; - self.s.currentDoc = null; - return resolve(doc); - } - - nextObject(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('next', {callback: true, promise:true}); - -/** - * Set the cursor query - * @method - * @param {object} filter The filter object used for the cursor. - * @return {Cursor} - */ -Cursor.prototype.filter = function(filter) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.query = filter; - return this; -} - -define.classMethod('filter', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor maxScan - * @method - * @param {object} maxScan Constrains the query to only scan the specified number of documents when fulfilling the query - * @return {Cursor} - */ -Cursor.prototype.maxScan = function(maxScan) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.maxScan = maxScan; - return this; -} - -define.classMethod('maxScan', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor hint - * @method - * @param {object} hint If specified, then the query system will only consider plans using the hinted index. - * @return {Cursor} - */ -Cursor.prototype.hint = function(hint) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.hint = hint; - return this; -} - -define.classMethod('hint', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor min - * @method - * @param {object} min Specify a $min value to specify the inclusive lower bound for a specific index in order to constrain the results of find(). The $min specifies the lower bound for all keys of a specific index in order. - * @return {Cursor} - */ -Cursor.prototype.min = function(min) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.min = min; - return this; -} - -define.classMethod('min', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor max - * @method - * @param {object} max Specify a $max value to specify the exclusive upper bound for a specific index in order to constrain the results of find(). The $max specifies the upper bound for all keys of a specific index in order. - * @return {Cursor} - */ -Cursor.prototype.max = function(max) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.max = max; - return this; -} - -define.classMethod('max', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor returnKey - * @method - * @param {object} returnKey Only return the index field or fields for the results of the query. If $returnKey is set to true and the query does not use an index to perform the read operation, the returned documents will not contain any fields. Use one of the following forms: - * @return {Cursor} - */ -Cursor.prototype.returnKey = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.returnKey = value; - return this; -} - -define.classMethod('returnKey', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor showRecordId - * @method - * @param {object} showRecordId The $showDiskLoc option has now been deprecated and replaced with the showRecordId field. $showDiskLoc will still be accepted for OP_QUERY stye find. - * @return {Cursor} - */ -Cursor.prototype.showRecordId = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.showDiskLoc = value; - return this; -} - -define.classMethod('showRecordId', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the cursor snapshot - * @method - * @param {object} snapshot The $snapshot operator prevents the cursor from returning a document more than once because an intervening write operation results in a move of the document. - * @return {Cursor} - */ -Cursor.prototype.snapshot = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.snapshot = value; - return this; -} - -define.classMethod('snapshot', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set a node.js specific cursor option - * @method - * @param {string} field The cursor option to set ['numberOfRetries', 'tailableRetryInterval']. - * @param {object} value The field value. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.setCursorOption = function(field, value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(fields.indexOf(field) == -1) throw MongoError.create({message: f("option %s not a supported option %s", field, fields), driver:true }); - this.s[field] = value; - if(field == 'numberOfRetries') - this.s.currentNumberOfRetries = value; - return this; -} - -define.classMethod('setCursorOption', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Add a cursor flag to the cursor - * @method - * @param {string} flag The flag to set, must be one of following ['tailable', 'oplogReplay', 'noCursorTimeout', 'awaitData', 'exhaust', 'partial']. - * @param {boolean} value The flag boolean value. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.addCursorFlag = function(flag, value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(flags.indexOf(flag) == -1) throw MongoError.create({message: f("flag %s not a supported flag %s", flag, flags), driver:true }); - if(typeof value != 'boolean') throw MongoError.create({message: f("flag %s must be a boolean value", flag), driver:true}); - this.s.cmd[flag] = value; - return this; -} - -define.classMethod('addCursorFlag', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Add a query modifier to the cursor query - * @method - * @param {string} name The query modifier (must start with $, such as $orderby etc) - * @param {boolean} value The flag boolean value. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.addQueryModifier = function(name, value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(name[0] != '$') throw MongoError.create({message: f("%s is not a valid query modifier"), driver:true}); - // Strip of the $ - var field = name.substr(1); - // Set on the command - this.s.cmd[field] = value; - // Deal with the special case for sort - if(field == 'orderby') this.s.cmd.sort = this.s.cmd[field]; - return this; -} - -define.classMethod('addQueryModifier', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Add a comment to the cursor query allowing for tracking the comment in the log. - * @method - * @param {string} value The comment attached to this query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.comment = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.comment = value; - return this; -} - -define.classMethod('comment', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set a maxTimeMS on the cursor query, allowing for hard timeout limits on queries (Only supported on MongoDB 2.6 or higher) - * @method - * @param {number} value Number of milliseconds to wait before aborting the query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.maxTimeMS = function(value) { - if(typeof value != 'number') throw MongoError.create({message: "maxTimeMS must be a number", driver:true}); - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.maxTimeMS = value; - return this; -} - -define.classMethod('maxTimeMS', {callback: false, promise:false, returns: [Cursor]}); - -Cursor.prototype.maxTimeMs = Cursor.prototype.maxTimeMS; - -define.classMethod('maxTimeMs', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Sets a field projection for the query. - * @method - * @param {object} value The field projection object. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.project = function(value) { - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - this.s.cmd.fields = value; - return this; -} - -define.classMethod('project', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Sets the sort order of the cursor query. - * @method - * @param {(string|array|object)} keyOrList The key or keys set for the sort. - * @param {number} [direction] The direction of the sorting (1 or -1). - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.sort = function(keyOrList, direction) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support sorting", driver:true}); - if(this.s.state == Cursor.CLOSED || this.s.state == Cursor.OPEN || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - var order = keyOrList; - - if(direction != null) { - order = [[keyOrList, direction]]; - } - - this.s.cmd.sort = order; - this.sortValue = order; - return this; -} - -define.classMethod('sort', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the batch size for the cursor. - * @method - * @param {number} value The batchSize for the cursor. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.batchSize = function(value) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support batchSize", driver:true}); - if(this.s.state == Cursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "batchSize requires an integer", driver:true}); - this.s.cmd.batchSize = value; - this.setCursorBatchSize(value); - return this; -} - -define.classMethod('batchSize', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the limit for the cursor. - * @method - * @param {number} value The limit for the cursor query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.limit = function(value) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support limit", driver:true}); - if(this.s.state == Cursor.OPEN || this.s.state == Cursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "limit requires an integer", driver:true}); - this.s.cmd.limit = value; - // this.cursorLimit = value; - this.setCursorLimit(value); - return this; -} - -define.classMethod('limit', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Set the skip for the cursor. - * @method - * @param {number} value The skip for the cursor query. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.skip = function(value) { - if(this.s.options.tailable) throw MongoError.create({message: "Tailable cursor doesn't support skip", driver:true}); - if(this.s.state == Cursor.OPEN || this.s.state == Cursor.CLOSED || this.isDead()) throw MongoError.create({message: "Cursor is closed", driver:true}); - if(typeof value != 'number') throw MongoError.create({message: "skip requires an integer", driver:true}); - this.s.cmd.skip = value; - this.setCursorSkip(value); - return this; -} - -define.classMethod('skip', {callback: false, promise:false, returns: [Cursor]}); - -/** - * The callback format for results - * @callback Cursor~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {(object|null|boolean)} result The result object if the command was executed successfully. - */ - -/** - * Clone the cursor - * @function external:CoreCursor#clone - * @return {Cursor} - */ - -/** - * Resets the cursor - * @function external:CoreCursor#rewind - * @return {null} - */ - -/** - * Get the next available document from the cursor, returns null if no more documents are available. - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @throws {MongoError} - * @deprecated - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.nextObject = Cursor.prototype.next; - -var nextObject = function(self, callback) { - if(self.s.state == Cursor.CLOSED || self.isDead()) return handleCallback(callback, MongoError.create({message: "Cursor is closed", driver:true})); - if(self.s.state == Cursor.INIT && self.s.cmd.sort) { - try { - self.s.cmd.sort = formattedOrderClause(self.s.cmd.sort); - } catch(err) { - return handleCallback(callback, err); - } - } - - // Get the next object - self._next(function(err, doc) { - if(err && err.tailable && self.s.currentNumberOfRetries == 0) return callback(err); - if(err && err.tailable && self.s.currentNumberOfRetries > 0) { - self.s.currentNumberOfRetries = self.s.currentNumberOfRetries - 1; - - return setTimeout(function() { - // Rewind the cursor only when it has not actually read any documents yet - if(self.cursorState.currentLimit == 0) self.rewind(); - // Read the next document, forcing a re-issue of query if no cursorId exists - self.nextObject(callback); - }, self.s.tailableRetryInterval); - } - - self.s.state = Cursor.OPEN; - if(err) return handleCallback(callback, err); - handleCallback(callback, null, doc); - }); -} - -define.classMethod('nextObject', {callback: true, promise:true}); - -// Trampoline emptying the number of retrieved items -// without incurring a nextTick operation -var loop = function(self, callback) { - // No more items we are done - if(self.bufferedCount() == 0) return; - // Get the next document - self._next(callback); - // Loop - return loop; -} - -Cursor.prototype.next = Cursor.prototype.nextObject; - -define.classMethod('next', {callback: true, promise:true}); - -/** - * Iterates over all the documents for this cursor. As with **{cursor.toArray}**, - * not all of the elements will be iterated if this cursor had been previouly accessed. - * In that case, **{cursor.rewind}** can be used to reset the cursor. However, unlike - * **{cursor.toArray}**, the cursor will only hold a maximum of batch size elements - * at any given time if batch size is specified. Otherwise, the caller is responsible - * for making sure that the entire result can fit the memory. - * @method - * @deprecated - * @param {Cursor~resultCallback} callback The result callback. - * @throws {MongoError} - * @return {null} - */ -Cursor.prototype.each = function(callback) { - // Rewind cursor state - this.rewind(); - // Set current cursor to INIT - this.s.state = Cursor.INIT; - // Run the query - _each(this, callback); -}; - -define.classMethod('each', {callback: true, promise:false}); - -// Run the each loop -var _each = function(self, callback) { - if(!callback) throw MongoError.create({message: 'callback is mandatory', driver:true}); - if(self.isNotified()) return; - if(self.s.state == Cursor.CLOSED || self.isDead()) { - return handleCallback(callback, MongoError.create({message: "Cursor is closed", driver:true})); - } - - if(self.s.state == Cursor.INIT) self.s.state = Cursor.OPEN; - - // Define function to avoid global scope escape - var fn = null; - // Trampoline all the entries - if(self.bufferedCount() > 0) { - while(fn = loop(self, callback)) fn(self, callback); - _each(self, callback); - } else { - self.next(function(err, item) { - if(err) return handleCallback(callback, err); - if(item == null) { - self.s.state = Cursor.CLOSED; - return handleCallback(callback, null, null); - } - - if(handleCallback(callback, null, item) == false) return; - _each(self, callback); - }) - } -} - -/** - * The callback format for the forEach iterator method - * @callback Cursor~iteratorCallback - * @param {Object} doc An emitted document for the iterator - */ - -/** - * The callback error format for the forEach iterator method - * @callback Cursor~endCallback - * @param {MongoError} error An error instance representing the error during the execution. - */ - -/** - * Iterates over all the documents for this cursor using the iterator, callback pattern. - * @method - * @param {Cursor~iteratorCallback} iterator The iteration callback. - * @param {Cursor~endCallback} callback The end callback. - * @throws {MongoError} - * @return {null} - */ -Cursor.prototype.forEach = function(iterator, callback) { - this.each(function(err, doc){ - if(err) { callback(err); return false; } - if(doc != null) { iterator(doc); return true; } - if(doc == null && callback) { - var internalCallback = callback; - callback = null; - internalCallback(null); - return false; - } - }); -} - -define.classMethod('forEach', {callback: true, promise:false}); - -/** - * Set the ReadPreference for the cursor. - * @method - * @param {(string|ReadPreference)} readPreference The new read preference for the cursor. - * @throws {MongoError} - * @return {Cursor} - */ -Cursor.prototype.setReadPreference = function(r) { - if(this.s.state != Cursor.INIT) throw MongoError.create({message: 'cannot change cursor readPreference after cursor has been accessed', driver:true}); - if(r instanceof ReadPreference) { - this.s.options.readPreference = new CoreReadPreference(r.mode, r.tags); - } else { - this.s.options.readPreference = new CoreReadPreference(r); - } - - return this; -} - -define.classMethod('setReadPreference', {callback: false, promise:false, returns: [Cursor]}); - -/** - * The callback format for results - * @callback Cursor~toArrayResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object[]} documents All the documents the satisfy the cursor. - */ - -/** - * Returns an array of documents. The caller is responsible for making sure that there - * is enough memory to store the results. Note that the array only contain partial - * results when this cursor had been previouly accessed. In that case, - * cursor.rewind() can be used to reset the cursor. - * @method - * @param {Cursor~toArrayResultCallback} [callback] The result callback. - * @throws {MongoError} - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.toArray = function(callback) { - var self = this; - if(self.s.options.tailable) throw MongoError.create({message: 'Tailable cursor cannot be converted to array', driver:true}); - - // Execute using callback - if(typeof callback == 'function') return toArray(self, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - toArray(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -var toArray = function(self, callback) { - var items = []; - - // Reset cursor - self.rewind(); - self.s.state = Cursor.INIT; - - // Fetch all the documents - var fetchDocs = function() { - self._next(function(err, doc) { - if(err) return handleCallback(callback, err); - if(doc == null) { - self.s.state = Cursor.CLOSED; - return handleCallback(callback, null, items); - } - - // Add doc to items - items.push(doc) - - // Get all buffered objects - if(self.bufferedCount() > 0) { - var docs = self.readBufferedDocuments(self.bufferedCount()) - - // Transform the doc if transform method added - if(self.s.transforms && typeof self.s.transforms.doc == 'function') { - docs = docs.map(self.s.transforms.doc); - } - - items = items.concat(docs); - } - - // Attempt a fetch - fetchDocs(); - }) - } - - fetchDocs(); -} - -define.classMethod('toArray', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Cursor~countResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {number} count The count of documents. - */ - -/** - * Get the count of documents for this cursor - * @method - * @param {boolean} applySkipLimit Should the count command apply limit and skip settings on the cursor or in the passed in options. - * @param {object} [options=null] Optional settings. - * @param {number} [options.skip=null] The number of documents to skip. - * @param {number} [options.limit=null] The maximum amounts to count before aborting. - * @param {number} [options.maxTimeMS=null] Number of miliseconds to wait before aborting the query. - * @param {string} [options.hint=null] An index name hint for the query. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Cursor~countResultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.count = function(applySkipLimit, opts, callback) { - var self = this; - if(self.s.cmd.query == null) throw MongoError.create({message: "count can only be used with find command", driver:true}); - if(typeof opts == 'function') callback = opts, opts = {}; - opts = opts || {}; - - // Execute using callback - if(typeof callback == 'function') return count(self, applySkipLimit, opts, callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - count(self, applySkipLimit, opts, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var count = function(self, applySkipLimit, opts, callback) { - if(typeof applySkipLimit == 'function') { - callback = applySkipLimit; - applySkipLimit = true; - } - - if(applySkipLimit) { - if(typeof self.cursorSkip() == 'number') opts.skip = self.cursorSkip(); - if(typeof self.cursorLimit() == 'number') opts.limit = self.cursorLimit(); - } - - // Command - var delimiter = self.s.ns.indexOf('.'); - - var command = { - 'count': self.s.ns.substr(delimiter+1), 'query': self.s.cmd.query - } - - if(typeof opts.maxTimeMS == 'number') { - command.maxTimeMS = opts.maxTimeMS; - } else if(typeof self.s.maxTimeMS == 'number') { - command.maxTimeMS = self.s.maxTimeMS; - } - - // Get a server - var server = self.s.topology.getServer(opts); - // Get a connection - var connection = self.s.topology.getConnection(opts); - // Get the callbacks - var callbacks = server.getCallbacks(); - - // Merge in any options - if(opts.skip) command.skip = opts.skip; - if(opts.limit) command.limit = opts.limit; - if(self.s.options.hint) command.hint = self.s.options.hint; - - // Build Query object - var query = new Query(self.s.bson, f("%s.$cmd", self.s.ns.substr(0, delimiter)), command, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false - }); - - // Set up callback - callbacks.register(query.requestId, function(err, result) { - if(err) return handleCallback(callback, err); - if(result.documents.length == 1 - && (result.documents[0].errmsg - || result.documents[0].err - || result.documents[0]['$err'])) { - return handleCallback(callback, MongoError.create(result.documents[0])); - } - handleCallback(callback, null, result.documents[0].n); - }); - - // Write the initial command out - connection.write(query.toBin()); -} - -define.classMethod('count', {callback: true, promise:true}); - -/** - * Close the cursor, sending a KillCursor command and emitting close. - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.close = function(callback) { - this.s.state = Cursor.CLOSED; - // Kill the cursor - this.kill(); - // Emit the close event for the cursor - this.emit('close'); - // Callback if provided - if(typeof callback == 'function') return handleCallback(callback, null, this); - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - resolve(); - }); -} - -define.classMethod('close', {callback: true, promise:true}); - -/** - * Map all documents using the provided function - * @method - * @param {function} [transform] The mapping transformation method. - * @return {null} - */ -Cursor.prototype.map = function(transform) { - this.cursorState.transforms = { doc: transform }; - return this; -} - -define.classMethod('map', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Is the cursor closed - * @method - * @return {boolean} - */ -Cursor.prototype.isClosed = function() { - return this.isDead(); -} - -define.classMethod('isClosed', {callback: false, promise:false, returns: [Boolean]}); - -Cursor.prototype.destroy = function(err) { - this.pause(); - this.close(); - if(err) this.emit('error', err); -} - -define.classMethod('destroy', {callback: false, promise:false}); - -/** - * Return a modified Readable stream including a possible transform method. - * @method - * @param {object} [options=null] Optional settings. - * @param {function} [options.transform=null] A transformation method applied to each document emitted by the stream. - * @return {Cursor} - */ -Cursor.prototype.stream = function(options) { - this.s.streamOptions = options || {}; - return this; -} - -define.classMethod('stream', {callback: false, promise:false, returns: [Cursor]}); - -/** - * Execute the explain for the cursor - * @method - * @param {Cursor~resultCallback} [callback] The result callback. - * @return {Promise} returns Promise if no callback passed - */ -Cursor.prototype.explain = function(callback) { - var self = this; - this.s.cmd.explain = true; - - // Execute using callback - if(typeof callback == 'function') return this._next(callback); - - // Return a Promise - return new this.s.promiseLibrary(function(resolve, reject) { - self._next(function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('explain', {callback: true, promise:true}); - -Cursor.prototype._read = function(n) { - var self = this; - if(self.s.state == Cursor.CLOSED || self.isDead()) { - return self.push(null); - } - - // Get the next item - self.nextObject(function(err, result) { - if(err) { - if(!self.isDead()) self.close(); - if(self.listeners('error') && self.listeners('error').length > 0) { - self.emit('error', err); - } - - // Emit end event - self.emit('end'); - return self.emit('finish'); - } - - // If we provided a transformation method - if(typeof self.s.streamOptions.transform == 'function' && result != null) { - return self.push(self.s.streamOptions.transform(result)); - } - - // If we provided a map function - if(self.cursorState.transforms && typeof self.cursorState.transforms.doc == 'function' && result != null) { - return self.push(self.cursorState.transforms.doc(result)); - } - - // Return the result - self.push(result); - }); -} - -Object.defineProperty(Cursor.prototype, 'namespace', { - enumerable: true, - get: function() { - if (!this || !this.s) { - return null; - } - - // TODO: refactor this logic into core - var ns = this.s.ns || ''; - var firstDot = ns.indexOf('.'); - if (firstDot < 0) { - return { - database: this.s.ns, - collection: '' - }; - } - return { - database: ns.substr(0, firstDot), - collection: ns.substr(firstDot + 1) - }; - } -}); - -/** - * The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null. - * @function external:Readable#read - * @param {number} size Optional argument to specify how much data to read. - * @return {(String | Buffer | null)} - */ - -/** - * Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects. - * @function external:Readable#setEncoding - * @param {string} encoding The encoding to use. - * @return {null} - */ - -/** - * This method will cause the readable stream to resume emitting data events. - * @function external:Readable#resume - * @return {null} - */ - -/** - * This method will cause a stream in flowing-mode to stop emitting data events. Any data that becomes available will remain in the internal buffer. - * @function external:Readable#pause - * @return {null} - */ - -/** - * This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream. - * @function external:Readable#pipe - * @param {Writable} destination The destination for writing data - * @param {object} [options] Pipe options - * @return {null} - */ - -/** - * This method will remove the hooks set up for a previous pipe() call. - * @function external:Readable#unpipe - * @param {Writable} [destination] The destination for writing data - * @return {null} - */ - -/** - * This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party. - * @function external:Readable#unshift - * @param {(Buffer|string)} chunk Chunk of data to unshift onto the read queue. - * @return {null} - */ - -/** - * Versions of Node prior to v0.10 had streams that did not implement the entire Streams API as it is today. (See "Compatibility" below for more information.) - * @function external:Readable#wrap - * @param {Stream} stream An "old style" readable stream. - * @return {null} - */ - -Cursor.INIT = 0; -Cursor.OPEN = 1; -Cursor.CLOSED = 2; -Cursor.GET_MORE = 3; - -module.exports = Cursor; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/db.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/db.js deleted file mode 100644 index 6667297c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/db.js +++ /dev/null @@ -1,1731 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , getSingleProperty = require('./utils').getSingleProperty - , shallowClone = require('./utils').shallowClone - , parseIndexOptions = require('./utils').parseIndexOptions - , debugOptions = require('./utils').debugOptions - , CommandCursor = require('./command_cursor') - , handleCallback = require('./utils').handleCallback - , toError = require('./utils').toError - , ReadPreference = require('./read_preference') - , f = require('util').format - , Admin = require('./admin') - , Code = require('mongodb-core').BSON.Code - , CoreReadPreference = require('mongodb-core').ReadPreference - , MongoError = require('mongodb-core').MongoError - , ObjectID = require('mongodb-core').ObjectID - , Define = require('./metadata') - , Logger = require('mongodb-core').Logger - , Collection = require('./collection') - , crypto = require('crypto'); - -var debugFields = ['authSource', 'w', 'wtimeout', 'j', 'native_parser', 'forceServerObjectId' - , 'serializeFunctions', 'raw', 'promoteLongs', 'bufferMaxEntries', 'numberOfRetries', 'retryMiliSeconds' - , 'readPreference', 'pkFactory']; - -/** - * @fileOverview The **Db** class is a class that represents a MongoDB Database. - * - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Get an additional db - * var testDb = db.db('test'); - * db.close(); - * }); - */ - -/** - * Creates a new Db instance - * @class - * @param {string} databaseName The name of the database this instance represents. - * @param {(Server|ReplSet|Mongos)} topology The server topology for the database. - * @param {object} [options=null] Optional settings. - * @param {string} [options.authSource=null] If the database authentication is dependent on another databaseName. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.native_parser=true] Select C++ bson parser instead of JavaScript parser. - * @param {boolean} [options.forceServerObjectId=false] Force server to assign _id values instead of driver. - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {boolean} [options.raw=false] Return document results as raw BSON buffers. - * @param {boolean} [options.promoteLongs=true] Promotes Long values to number if they fit inside the 53 bits resolution. - * @param {number} [options.bufferMaxEntries=-1] Sets a cap on how many operations the driver will buffer up before giving up on getting a working connection, default is -1 which is unlimited. - * @param {number} [options.numberOfRetries=5] Number of times a tailable cursor will re-poll when it gets nothing back. - * @param {number} [options.retryMiliSeconds=500] Number of milliseconds between retries. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.pkFactory=null] A primary key factory object for generation of custom _id keys. - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {object} [options.readConcern=null] Specify a read concern for the collection. (only MongoDB 3.2 or higher supported) - * @param {object} [options.readConcern.level='local'] Specify a read concern level for the collection operations, one of [local|majority]. (only MongoDB 3.2 or higher supported) - * @property {(Server|ReplSet|Mongos)} serverConfig Get the current db topology. - * @property {number} bufferMaxEntries Current bufferMaxEntries value for the database - * @property {string} databaseName The name of the database this instance represents. - * @property {object} options The options associated with the db instance. - * @property {boolean} native_parser The current value of the parameter native_parser. - * @property {boolean} slaveOk The current slaveOk value for the db instance. - * @property {object} writeConcern The current write concern values. - * @fires Db#close - * @fires Db#authenticated - * @fires Db#reconnect - * @fires Db#error - * @fires Db#timeout - * @fires Db#parseError - * @fires Db#fullsetup - * @return {Db} a Db instance. - */ -var Db = function(databaseName, topology, options) { - options = options || {}; - if(!(this instanceof Db)) return new Db(databaseName, topology, options); - EventEmitter.call(this); - var self = this; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Ensure we put the promiseLib in the options - options.promiseLibrary = promiseLibrary; - - // var self = this; // Internal state of the db object - this.s = { - // Database name - databaseName: databaseName - // DbCache - , dbCache: {} - // Children db's - , children: [] - // Topology - , topology: topology - // Options - , options: options - // Logger instance - , logger: Logger('Db', options) - // Get the bson parser - , bson: topology ? topology.bson : null - // Authsource if any - , authSource: options.authSource - // Unpack read preference - , readPreference: options.readPreference - // Set buffermaxEntries - , bufferMaxEntries: typeof options.bufferMaxEntries == 'number' ? options.bufferMaxEntries : -1 - // Parent db (if chained) - , parentDb: options.parentDb || null - // Set up the primary key factory or fallback to ObjectID - , pkFactory: options.pkFactory || ObjectID - // Get native parser - , nativeParser: options.nativeParser || options.native_parser - // Promise library - , promiseLibrary: promiseLibrary - // No listener - , noListener: typeof options.noListener == 'boolean' ? options.noListener : false - // ReadConcern - , readConcern: options.readConcern - } - - // Ensure we have a valid db name - validateDatabaseName(self.s.databaseName); - - // If we have specified the type of parser - if(typeof self.s.nativeParser == 'boolean') { - if(self.s.nativeParser) { - topology.setBSONParserType("c++"); - } else { - topology.setBSONParserType("js"); - } - } - - // Add a read Only property - getSingleProperty(this, 'serverConfig', self.s.topology); - getSingleProperty(this, 'bufferMaxEntries', self.s.bufferMaxEntries); - getSingleProperty(this, 'databaseName', self.s.databaseName); - - // Last ismaster - Object.defineProperty(this, 'options', { - enumerable:true, - get: function() { return self.s.options; } - }); - - // Last ismaster - Object.defineProperty(this, 'native_parser', { - enumerable:true, - get: function() { return self.s.topology.parserType() == 'c++'; } - }); - - // Last ismaster - Object.defineProperty(this, 'slaveOk', { - enumerable:true, - get: function() { - if(self.s.options.readPreference != null - && (self.s.options.readPreference != 'primary' || self.s.options.readPreference.mode != 'primary')) { - return true; - } - return false; - } - }); - - Object.defineProperty(this, 'writeConcern', { - enumerable:true, - get: function() { - var ops = {}; - if(self.s.options.w != null) ops.w = self.s.options.w; - if(self.s.options.j != null) ops.j = self.s.options.j; - if(self.s.options.fsync != null) ops.fsync = self.s.options.fsync; - if(self.s.options.wtimeout != null) ops.wtimeout = self.s.options.wtimeout; - return ops; - } - }); - - // This is a child db, do not register any listeners - if(options.parentDb) return; - if(this.s.noListener) return; - - // Add listeners - topology.on('error', createListener(self, 'error', self)); - topology.on('timeout', createListener(self, 'timeout', self)); - topology.on('close', createListener(self, 'close', self)); - topology.on('parseError', createListener(self, 'parseError', self)); - topology.once('open', createListener(self, 'open', self)); - topology.once('fullsetup', createListener(self, 'fullsetup', self)); - topology.once('all', createListener(self, 'all', self)); - topology.on('reconnect', createListener(self, 'reconnect', self)); -} - -inherits(Db, EventEmitter); - -var define = Db.define = new Define('Db', Db, false); - -/** - * The callback format for the Db.open method - * @callback Db~openCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Db} db The Db instance if the open method was successful. - */ - -// Internal method -var open = function(self, callback) { - self.s.topology.connect(self, self.s.options, function(err, topology) { - if(callback == null) return; - var internalCallback = callback; - callback == null; - - if(err) { - self.close(); - return internalCallback(err); - } - - internalCallback(null, self); - }); -} - -/** - * Open the database - * @method - * @param {Db~openCallback} [callback] Callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.open = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return open(self, callback); - // Return promise - return new self.s.promiseLibrary(function(resolve, reject) { - open(self, function(err, db) { - if(err) return reject(err); - resolve(db); - }) - }); -} - -define.classMethod('open', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Db~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result object if the command was executed successfully. - */ - -var executeCommand = function(self, command, options, callback) { - var dbName = options.dbName || options.authdb || self.s.databaseName; - // If we have a readPreference set - if(options.readPreference == null && self.s.readPreference) { - options.readPreference = self.s.readPreference; - } - - // Convert the readPreference - if(options.readPreference && typeof options.readPreference == 'string') { - options.readPreference = new CoreReadPreference(options.readPreference); - } else if(options.readPreference instanceof ReadPreference) { - options.readPreference = new CoreReadPreference(options.readPreference.mode - , options.readPreference.tags); - } - - // Debug information - if(self.s.logger.isDebug()) self.s.logger.debug(f('executing command %s against %s with options [%s]' - , JSON.stringify(command), f('%s.$cmd', dbName), JSON.stringify(debugOptions(debugFields, options)))); - - // Execute command - self.s.topology.command(f('%s.$cmd', dbName), command, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.result); - }); -} - -/** - * Execute a command - * @method - * @param {object} command The command hash - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxTimeMS=null] Number of milliseconds to wait before aborting the query. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.command = function(command, options, callback) { - var self = this; - // Change the callback - if(typeof options == 'function') callback = options, options = {}; - // Clone the options - options = shallowClone(options); - - // Do we have a callback - if(typeof callback == 'function') return executeCommand(self, command, options, callback); - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - executeCommand(self, command, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('command', {callback: true, promise:true}); - -/** - * The callback format for results - * @callback Db~noResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {null} result Is not set to a value - */ - -/** - * Close the db and it's underlying connections - * @method - * @param {boolean} force Force close, emitting no events - * @param {Db~noResultCallback} [callback] The result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.close = function(force, callback) { - if(typeof force == 'function') callback = force, force = false; - this.s.topology.close(force); - var self = this; - - // Fire close event if any listeners - if(this.listeners('close').length > 0) { - this.emit('close'); - - // If it's the top level db emit close on all children - if(this.parentDb == null) { - // Fire close on all children - for(var i = 0; i < this.s.children.length; i++) { - this.s.children[i].emit('close'); - } - } - - // Remove listeners after emit - self.removeAllListeners('close'); - } - - // Close parent db if set - if(this.s.parentDb) this.s.parentDb.close(); - // Callback after next event loop tick - if(typeof callback == 'function') return process.nextTick(function() { - handleCallback(callback, null); - }) - - // Return dummy promise - return new this.s.promiseLibrary(function(resolve, reject) { - resolve(); - }); -} - -define.classMethod('close', {callback: true, promise:true}); - -/** - * Return the Admin db instance - * @method - * @return {Admin} return the new Admin db instance - */ -Db.prototype.admin = function() { - return new Admin(this, this.s.topology, this.s.promiseLibrary); -}; - -define.classMethod('admin', {callback: false, promise:false, returns: [Admin]}); - -/** - * The callback format for the collection method, must be used if strict is specified - * @callback Db~collectionResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection} collection The collection instance. - */ - -/** - * Fetch a specific collection (containing the actual collection information). If the application does not use strict mode you can - * can use it without a callback in the following way. var collection = db.collection('mycollection'); - * - * @method - * @param {string} name the collection name we wish to access. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.raw=false] Return document results as raw BSON buffers. - * @param {object} [options.pkFactory=null] A primary key factory object for generation of custom _id keys. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.strict=false] Returns an error if the collection does not exist - * @param {object} [options.readConcern=null] Specify a read concern for the collection. (only MongoDB 3.2 or higher supported) - * @param {object} [options.readConcern.level='local'] Specify a read concern level for the collection operations, one of [local|majority]. (only MongoDB 3.2 or higher supported) - * @param {Db~collectionResultCallback} callback The collection result callback - * @return {Collection} return the new Collection instance if not in strict mode - */ -Db.prototype.collection = function(name, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - options = shallowClone(options); - // Set the promise library - options.promiseLibrary = this.s.promiseLibrary; - - // If we have not set a collection level readConcern set the db level one - options.readConcern = options.readConcern || this.s.readConcern; - - // Do we have ignoreUndefined set - if(this.s.options.ignoreUndefined) { - options.ignoreUndefined = this.s.options.ignoreUndefined; - } - - // Execute - if(options == null || !options.strict) { - try { - var collection = new Collection(this, this.s.topology, this.s.databaseName, name, this.s.pkFactory, options); - if(callback) callback(null, collection); - return collection; - } catch(err) { - if(callback) return callback(err); - throw err; - } - } - - // Strict mode - if(typeof callback != 'function') { - throw toError(f("A callback is required in strict mode. While getting collection %s.", name)); - } - - // Strict mode - this.listCollections({name:name}).toArray(function(err, collections) { - if(err != null) return handleCallback(callback, err, null); - if(collections.length == 0) return handleCallback(callback, toError(f("Collection %s does not exist. Currently in strict mode.", name)), null); - - try { - return handleCallback(callback, null, new Collection(self, self.s.topology, self.s.databaseName, name, self.s.pkFactory, options)); - } catch(err) { - return handleCallback(callback, err, null); - } - }); -} - -define.classMethod('collection', {callback: true, promise:false, returns: [Collection]}); - -var createCollection = function(self, name, options, callback) { - // Get the write concern options - var finalOptions = writeConcern(shallowClone(options), self, options); - - // Check if we have the name - self.listCollections({name: name}).toArray(function(err, collections) { - if(err != null) return handleCallback(callback, err, null); - if(collections.length > 0 && finalOptions.strict) { - return handleCallback(callback, MongoError.create({message: f("Collection %s already exists. Currently in strict mode.", name), driver:true}), null); - } else if (collections.length > 0) { - try { return handleCallback(callback, null, new Collection(self, self.s.topology, self.s.databaseName, name, self.s.pkFactory, options)); } - catch(err) { return handleCallback(callback, err); } - } - - // Create collection command - var cmd = {'create':name}; - - // Add all optional parameters - for(var n in options) { - if(options[n] != null && typeof options[n] != 'function') - cmd[n] = options[n]; - } - - // Execute command - self.command(cmd, finalOptions, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, new Collection(self, self.s.topology, self.s.databaseName, name, self.s.pkFactory, options)); - }); - }); -} - -/** - * Creates a collection on a server pre-allocating space, need to create f.ex capped collections. - * - * @method - * @param {string} name the collection name we wish to access. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.raw=false] Return document results as raw BSON buffers. - * @param {object} [options.pkFactory=null] A primary key factory object for generation of custom _id keys. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object. - * @param {boolean} [options.strict=false] Returns an error if the collection does not exist - * @param {boolean} [options.capped=false] Create a capped collection. - * @param {number} [options.size=null] The size of the capped collection in bytes. - * @param {number} [options.max=null] The maximum number of documents in the capped collection. - * @param {boolean} [options.autoIndexId=true] Create an index on the _id field of the document, True by default on MongoDB 2.2 or higher off for version < 2.2. - * @param {Db~collectionResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.createCollection = function(name, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - name = args.length ? args.shift() : null; - options = args.length ? args.shift() || {} : {}; - - // Do we have a promisesLibrary - options.promiseLibrary = options.promiseLibrary || this.s.promiseLibrary; - - // Check if the callback is in fact a string - if(typeof callback == 'string') name = callback; - - // Execute the fallback callback - if(typeof callback == 'function') return createCollection(self, name, options, callback); - return new this.s.promiseLibrary(function(resolve, reject) { - createCollection(self, name, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -} - -define.classMethod('createCollection', {callback: true, promise:true}); - -/** - * Get all the db statistics. - * - * @method - * @param {object} [options=null] Optional settings. - * @param {number} [options.scale=null] Divide the returned sizes by scale value. - * @param {Db~resultCallback} [callback] The collection result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.stats = function(options, callback) { - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - // Build command object - var commandObject = { dbStats:true }; - // Check if we have the scale value - if(options['scale'] != null) commandObject['scale'] = options['scale']; - // Execute the command - return this.command(commandObject, options, callback); -} - -define.classMethod('stats', {callback: true, promise:true}); - -// Transformation methods for cursor results -var listCollectionsTranforms = function(databaseName) { - var matching = f('%s.', databaseName); - - return { - doc: function(doc) { - var index = doc.name.indexOf(matching); - // Remove database name if available - if(doc.name && index == 0) { - doc.name = doc.name.substr(index + matching.length); - } - - return doc; - } - } -} - -/** - * Get the list of all collection information for the specified db. - * - * @method - * @param {object} filter Query to filter collections by - * @param {object} [options=null] Optional settings. - * @param {number} [options.batchSize=null] The batchSize for the returned command cursor or if pre 2.8 the systems batch collection - * @return {CommandCursor} - */ -Db.prototype.listCollections = function(filter, options) { - filter = filter || {}; - options = options || {}; - - // Shallow clone the object - options = shallowClone(options); - // Set the promise library - options.promiseLibrary = this.s.promiseLibrary; - - // We have a list collections command - if(this.serverConfig.capabilities().hasListCollectionsCommand) { - // Cursor options - var cursor = options.batchSize ? {batchSize: options.batchSize} : {} - // Build the command - var command = { listCollections : true, filter: filter, cursor: cursor }; - // Set the AggregationCursor constructor - options.cursorFactory = CommandCursor; - // Filter out the correct field values - options.transforms = listCollectionsTranforms(this.s.databaseName); - // Execute the cursor - return this.s.topology.cursor(f('%s.$cmd', this.s.databaseName), command, options); - } - - // We cannot use the listCollectionsCommand - if(!this.serverConfig.capabilities().hasListCollectionsCommand) { - // If we have legacy mode and have not provided a full db name filter it - if(typeof filter.name == 'string' && !(new RegExp('^' + this.databaseName + '\\.').test(filter.name))) { - filter = shallowClone(filter); - filter.name = f('%s.%s', this.s.databaseName, filter.name); - } - } - - // No filter, filter by current database - if(filter == null) { - filter.name = f('/%s/', this.s.databaseName); - } - - // Rewrite the filter to use $and to filter out indexes - if(filter.name) { - filter = {$and: [{name: filter.name}, {name:/^((?!\$).)*$/}]}; - } else { - filter = {name:/^((?!\$).)*$/}; - } - - // Return options - var options = {transforms: listCollectionsTranforms(this.s.databaseName)} - // Get the cursor - var cursor = this.collection(Db.SYSTEM_NAMESPACE_COLLECTION).find(filter, options); - // Set the passed in batch size if one was provided - if(options.batchSize) cursor = cursor.batchSize(options.batchSize); - // We have a fallback mode using legacy systems collections - return cursor; -}; - -define.classMethod('listCollections', {callback: false, promise:false, returns: [CommandCursor]}); - -var evaluate = function(self, code, parameters, options, callback) { - var finalCode = code; - var finalParameters = []; - - // If not a code object translate to one - if(!(finalCode instanceof Code)) finalCode = new Code(finalCode); - // Ensure the parameters are correct - if(parameters != null && !Array.isArray(parameters) && typeof parameters !== 'function') { - finalParameters = [parameters]; - } else if(parameters != null && Array.isArray(parameters) && typeof parameters !== 'function') { - finalParameters = parameters; - } - - // Create execution selector - var cmd = {'$eval':finalCode, 'args':finalParameters}; - // Check if the nolock parameter is passed in - if(options['nolock']) { - cmd['nolock'] = options['nolock']; - } - - // Set primary read preference - options.readPreference = new CoreReadPreference(ReadPreference.PRIMARY); - - // Execute the command - self.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - if(result && result.ok == 1) return handleCallback(callback, null, result.retval); - if(result) return handleCallback(callback, MongoError.create({message: f("eval failed: %s", result.errmsg), driver:true}), null); - handleCallback(callback, err, result); - }); -} - -/** - * Evaluate JavaScript on the server - * - * @method - * @param {Code} code JavaScript to execute on server. - * @param {(object|array)} parameters The parameters for the call. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.nolock=false] Tell MongoDB not to block on the evaulation of the javascript. - * @param {Db~resultCallback} [callback] The results callback - * @deprecated Eval is deprecated on MongoDB 3.2 and forward - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.eval = function(code, parameters, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - parameters = args.length ? args.shift() : parameters; - options = args.length ? args.shift() || {} : {}; - - // Check if the callback is in fact a string - if(typeof callback == 'function') return evaluate(self, code, parameters, options, callback); - // Execute the command - return new this.s.promiseLibrary(function(resolve, reject) { - evaluate(self, code, parameters, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('eval', {callback: true, promise:true}); - -/** - * Rename a collection. - * - * @method - * @param {string} fromCollection Name of current collection to rename. - * @param {string} toCollection New name of of the collection. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.dropTarget=false] Drop the target name collection if it previously exists. - * @param {Db~collectionResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.renameCollection = function(fromCollection, toCollection, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - // Add return new collection - options.new_collection = true; - - // Check if the callback is in fact a string - if(typeof callback == 'function') { - return this.collection(fromCollection).rename(toCollection, options, callback); - } - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.collection(fromCollection).rename(toCollection, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('renameCollection', {callback: true, promise:true}); - -/** - * Drop a collection from the database, removing it permanently. New accesses will create a new collection. - * - * @method - * @param {string} name Name of collection to drop - * @param {Db~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.dropCollection = function(name, callback) { - var self = this; - - // Command to execute - var cmd = {'drop':name} - - // Check if the callback is in fact a string - if(typeof callback == 'function') return this.command(cmd, this.s.options, function(err, result) { - if(err) return handleCallback(callback, err); - if(result.ok) return handleCallback(callback, null, true); - handleCallback(callback, null, false); - }); - - // Execute the command - return new this.s.promiseLibrary(function(resolve, reject) { - // Execute command - self.command(cmd, self.s.options, function(err, result) { - if(err) return reject(err); - if(result.ok) return resolve(true); - resolve(false); - }); - }); -}; - -define.classMethod('dropCollection', {callback: true, promise:true}); - -/** - * Drop a database. - * - * @method - * @param {Db~resultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.dropDatabase = function(callback) { - var self = this; - // Drop database command - var cmd = {'dropDatabase':1}; - - // Check if the callback is in fact a string - if(typeof callback == 'function') return this.command(cmd, this.s.options, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.ok ? true : false); - }); - - // Execute the command - return new this.s.promiseLibrary(function(resolve, reject) { - // Execute command - self.command(cmd, self.s.options, function(err, result) { - if(err) return reject(err); - if(result.ok) return resolve(true); - resolve(false); - }); - }); -} - -define.classMethod('dropDatabase', {callback: true, promise:true}); - -/** - * The callback format for the collections method. - * @callback Db~collectionsResultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection[]} collections An array of all the collections objects for the db instance. - */ -var collections = function(self, callback) { - // Let's get the collection names - self.listCollections().toArray(function(err, documents) { - if(err != null) return handleCallback(callback, err, null); - // Filter collections removing any illegal ones - documents = documents.filter(function(doc) { - return doc.name.indexOf('$') == -1; - }); - - // Return the collection objects - handleCallback(callback, null, documents.map(function(d) { - return new Collection(self, self.s.topology, self.s.databaseName, d.name.replace(self.s.databaseName + ".", ''), self.s.pkFactory, self.s.options); - })); - }); -} - -/** - * Fetch all collections for the current db. - * - * @method - * @param {Db~collectionsResultCallback} [callback] The results callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.collections = function(callback) { - var self = this; - - // Return the callback - if(typeof callback == 'function') return collections(self, callback); - // Return the promise - return new self.s.promiseLibrary(function(resolve, reject) { - collections(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('collections', {callback: true, promise:true}); - -/** - * Runs a command on the database as admin. - * @method - * @param {object} command The command hash - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {number} [options.maxTimeMS=null] Number of milliseconds to wait before aborting the query. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.executeDbAdminCommand = function(selector, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - if(options.readPreference) { - options.readPreference = options.readPreference; - } - - // Return the callback - if(typeof callback == 'function') return self.s.topology.command('admin.$cmd', selector, options, function(err, result) { - if(err) return handleCallback(callback, err); - handleCallback(callback, null, result.result); - }); - - // Return promise - return new self.s.promiseLibrary(function(resolve, reject) { - self.s.topology.command('admin.$cmd', selector, options, function(err, result) { - if(err) return reject(err); - resolve(result.result); - }); - }); -}; - -define.classMethod('executeDbAdminCommand', {callback: true, promise:true}); - -/** - * Creates an index on the db and collection collection. - * @method - * @param {string} name Name of the collection to create the index on. - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.createIndex = function(name, fieldOrSpec, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - options = typeof callback === 'function' ? options : callback; - options = options == null ? {} : options; - // Shallow clone the options - options = shallowClone(options); - // Run only against primary - options.readPreference = ReadPreference.PRIMARY; - - // If we have a callback fallback - if(typeof callback == 'function') return createIndex(self, name, fieldOrSpec, options, callback); - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - createIndex(self, name, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var createIndex = function(self, name, fieldOrSpec, options, callback) { - // Get the write concern options - var finalOptions = writeConcern({}, self, options); - // Ensure we have a callback - if(finalOptions.writeConcern && typeof callback != 'function') { - throw MongoError.create({message: "Cannot use a writeConcern without a provided callback", driver:true}); - } - - // Attempt to run using createIndexes command - createIndexUsingCreateIndexes(self, name, fieldOrSpec, options, function(err, result) { - if(err == null) return handleCallback(callback, err, result); - // Create command - var doc = createCreateIndexCommand(self, name, fieldOrSpec, options); - // Set no key checking - finalOptions.checkKeys = false; - // Insert document - self.s.topology.insert(f("%s.%s", self.s.databaseName, Db.SYSTEM_INDEX_COLLECTION), doc, finalOptions, function(err, result) { - if(callback == null) return; - if(err) return handleCallback(callback, err); - if(result == null) return handleCallback(callback, null, null); - if(result.result.writeErrors) return handleCallback(callback, MongoError.create(result.result.writeErrors[0]), null); - handleCallback(callback, null, doc.name); - }); - }); -} - -define.classMethod('createIndex', {callback: true, promise:true}); - -/** - * Ensures that an index exists, if it does not it creates it - * @method - * @deprecated since version 2.0 - * @param {string} name The index name - * @param {(string|object)} fieldOrSpec Defines the index. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.unique=false] Creates an unique index. - * @param {boolean} [options.sparse=false] Creates a sparse index. - * @param {boolean} [options.background=false] Creates the index in the background, yielding whenever possible. - * @param {boolean} [options.dropDups=false] A unique index cannot be created on a key that has pre-existing duplicate values. If you would like to create the index anyway, keeping the first document the database indexes and deleting all subsequent documents that have duplicate value - * @param {number} [options.min=null] For geospatial indexes set the lower bound for the co-ordinates. - * @param {number} [options.max=null] For geospatial indexes set the high bound for the co-ordinates. - * @param {number} [options.v=null] Specify the format version of the indexes. - * @param {number} [options.expireAfterSeconds=null] Allows you to expire data on indexes applied to a data (MongoDB 2.2 or higher) - * @param {number} [options.name=null] Override the autogenerated index name (useful if the resulting name is larger than 128 bytes) - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.ensureIndex = function(name, fieldOrSpec, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // If we have a callback fallback - if(typeof callback == 'function') return ensureIndex(self, name, fieldOrSpec, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - ensureIndex(self, name, fieldOrSpec, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var ensureIndex = function(self, name, fieldOrSpec, options, callback) { - // Get the write concern options - var finalOptions = writeConcern({}, self, options); - // Create command - var selector = createCreateIndexCommand(self, name, fieldOrSpec, options); - var index_name = selector.name; - - // Default command options - var commandOptions = {}; - // Check if the index allready exists - self.indexInformation(name, finalOptions, function(err, indexInformation) { - if(err != null && err.code != 26) return handleCallback(callback, err, null); - // If the index does not exist, create it - if(indexInformation == null || !indexInformation[index_name]) { - self.createIndex(name, fieldOrSpec, options, callback); - } else { - if(typeof callback === 'function') return handleCallback(callback, null, index_name); - } - }); -} - -define.classMethod('ensureIndex', {callback: true, promise:true}); - -Db.prototype.addChild = function(db) { - if(this.s.parentDb) return this.s.parentDb.addChild(db); - this.s.children.push(db); -} - -/** - * Create a new Db instance sharing the current socket connections. Be aware that the new db instances are - * related in a parent-child relationship to the original instance so that events are correctly emitted on child - * db instances. Child db instances are cached so performing db('db1') twice will return the same instance. - * You can control these behaviors with the options noListener and returnNonCachedInstance. - * - * @method - * @param {string} name The name of the database we want to use. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.noListener=false] Do not make the db an event listener to the original connection. - * @param {boolean} [options.returnNonCachedInstance=false] Control if you want to return a cached instance or have a new one created - * @return {Db} - */ -Db.prototype.db = function(dbName, options) { - options = options || {}; - // Copy the options and add out internal override of the not shared flag - for(var key in this.options) { - options[key] = this.options[key]; - } - - // Do we have the db in the cache already - if(this.s.dbCache[dbName] && options.returnNonCachedInstance !== true) { - return this.s.dbCache[dbName]; - } - - // Add current db as parentDb - if(options.noListener == null || options.noListener == false) { - options.parentDb = this; - } - - // Add promiseLibrary - options.promiseLibrary = this.s.promiseLibrary; - - // Return the db object - var db = new Db(dbName, this.s.topology, options) - - // Add as child - if(options.noListener == null || options.noListener == false) { - this.addChild(db); - } - - // Add the db to the cache - this.s.dbCache[dbName] = db; - // Return the database - return db; -}; - -define.classMethod('db', {callback: false, promise:false, returns: [Db]}); - -var _executeAuthCreateUserCommand = function(self, username, password, options, callback) { - // Special case where there is no password ($external users) - if(typeof username == 'string' - && password != null && typeof password == 'object') { - options = password; - password = null; - } - - // Unpack all options - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // Error out if we digestPassword set - if(options.digestPassword != null) { - throw toError("The digestPassword option is not supported via add_user. Please use db.command('createUser', ...) instead for this option."); - } - - // Get additional values - var customData = options.customData != null ? options.customData : {}; - var roles = Array.isArray(options.roles) ? options.roles : []; - var maxTimeMS = typeof options.maxTimeMS == 'number' ? options.maxTimeMS : null; - - // If not roles defined print deprecated message - if(roles.length == 0) { - console.log("Creating a user without roles is deprecated in MongoDB >= 2.6"); - } - - // Get the error options - var commandOptions = {writeCommand:true}; - if(options['dbName']) commandOptions.dbName = options['dbName']; - - // Add maxTimeMS to options if set - if(maxTimeMS != null) commandOptions.maxTimeMS = maxTimeMS; - - // Check the db name and add roles if needed - if((self.databaseName.toLowerCase() == 'admin' || options.dbName == 'admin') && !Array.isArray(options.roles)) { - roles = ['root'] - } else if(!Array.isArray(options.roles)) { - roles = ['dbOwner'] - } - - // Build the command to execute - var command = { - createUser: username - , customData: customData - , roles: roles - , digestPassword:false - } - - // Apply write concern to command - command = writeConcern(command, self, options); - - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var userPassword = md5.digest('hex'); - - // No password - if(typeof password == 'string') { - command.pwd = userPassword; - } - - // Force write using primary - commandOptions.readPreference = CoreReadPreference.primary; - - // Execute the command - self.command(command, commandOptions, function(err, result) { - if(err && err.ok == 0 && err.code == undefined) return handleCallback(callback, {code: -5000}, null); - if(err) return handleCallback(callback, err, null); - handleCallback(callback, !result.ok ? toError(result) : null - , result.ok ? [{user: username, pwd: ''}] : null); - }) -} - -var addUser = function(self, username, password, options, callback) { - // Attempt to execute auth command - _executeAuthCreateUserCommand(self, username, password, options, function(err, r) { - // We need to perform the backward compatible insert operation - if(err && err.code == -5000) { - var finalOptions = writeConcern(shallowClone(options), self, options); - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var userPassword = md5.digest('hex'); - - // If we have another db set - var db = options.dbName ? self.db(options.dbName) : self; - - // Fetch a user collection - var collection = db.collection(Db.SYSTEM_USER_COLLECTION); - - // Check if we are inserting the first user - collection.count({}, function(err, count) { - // We got an error (f.ex not authorized) - if(err != null) return handleCallback(callback, err, null); - // Check if the user exists and update i - collection.find({user: username}, {dbName: options['dbName']}).toArray(function(err, documents) { - // We got an error (f.ex not authorized) - if(err != null) return handleCallback(callback, err, null); - // Add command keys - finalOptions.upsert = true; - - // We have a user, let's update the password or upsert if not - collection.update({user: username},{$set: {user: username, pwd: userPassword}}, finalOptions, function(err, results, full) { - if(count == 0 && err) return handleCallback(callback, null, [{user:username, pwd:userPassword}]); - if(err) return handleCallback(callback, err, null) - handleCallback(callback, null, [{user:username, pwd:userPassword}]); - }); - }); - }); - - return; - } - - if(err) return handleCallback(callback, err); - handleCallback(callback, err, r); - }); -} - -/** - * Add a user to the database. - * @method - * @param {string} username The username. - * @param {string} password The password. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {object} [options.customData=null] Custom data associated with the user (only Mongodb 2.6 or higher) - * @param {object[]} [options.roles=null] Roles associated with the created user (only Mongodb 2.6 or higher) - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.addUser = function(username, password, options, callback) { - // Unpack the parameters - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // If we have a callback fallback - if(typeof callback == 'function') return addUser(self, username, password, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - addUser(self, username, password, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('addUser', {callback: true, promise:true}); - -var _executeAuthRemoveUserCommand = function(self, username, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - // Get the error options - var commandOptions = {writeCommand:true}; - if(options['dbName']) commandOptions.dbName = options['dbName']; - - // Get additional values - var maxTimeMS = typeof options.maxTimeMS == 'number' ? options.maxTimeMS : null; - - // Add maxTimeMS to options if set - if(maxTimeMS != null) commandOptions.maxTimeMS = maxTimeMS; - - // Build the command to execute - var command = { - dropUser: username - } - - // Apply write concern to command - command = writeConcern(command, self, options); - - // Force write using primary - commandOptions.readPreference = CoreReadPreference.primary; - - // Execute the command - self.command(command, commandOptions, function(err, result) { - if(err && !err.ok && err.code == undefined) return handleCallback(callback, {code: -5000}); - if(err) return handleCallback(callback, err, null); - handleCallback(callback, null, result.ok ? true : false); - }) -} - -var removeUser = function(self, username, options, callback) { - // Attempt to execute command - _executeAuthRemoveUserCommand(self, username, options, function(err, result) { - if(err && err.code == -5000) { - var finalOptions = writeConcern(shallowClone(options), self, options); - // If we have another db set - var db = options.dbName ? self.db(options.dbName) : self; - - // Fetch a user collection - var collection = db.collection(Db.SYSTEM_USER_COLLECTION); - - // Locate the user - collection.findOne({user: username}, {}, function(err, user) { - if(user == null) return handleCallback(callback, err, false); - collection.remove({user: username}, finalOptions, function(err, result) { - handleCallback(callback, err, true); - }); - }); - - return; - } - - if(err) return handleCallback(callback, err); - handleCallback(callback, err, result); - }); -} - -define.classMethod('removeUser', {callback: true, promise:true}); - -/** - * Remove a user from a database - * @method - * @param {string} username The username. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.removeUser = function(username, options, callback) { - // Unpack the parameters - var self = this; - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // If we have a callback fallback - if(typeof callback == 'function') return removeUser(self, username, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - removeUser(self, username, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var authenticate = function(self, username, password, options, callback) { - // the default db to authenticate against is 'self' - // if authententicate is called from a retry context, it may be another one, like admin - var authdb = options.authdb ? options.authdb : options.dbName; - authdb = options.authSource ? options.authSource : authdb; - authdb = authdb ? authdb : self.databaseName; - - // Callback - var _callback = function(err, result) { - if(self.listeners('authenticated').length > 0) { - self.emit('authenticated', err, result); - } - - // Return to caller - handleCallback(callback, err, result); - } - - // authMechanism - var authMechanism = options.authMechanism || ''; - authMechanism = authMechanism.toUpperCase(); - - // If classic auth delegate to auth command - if(authMechanism == 'MONGODB-CR') { - self.s.topology.auth('mongocr', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'PLAIN') { - self.s.topology.auth('plain', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'MONGODB-X509') { - self.s.topology.auth('x509', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'SCRAM-SHA-1') { - self.s.topology.auth('scram-sha-1', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else if(authMechanism == 'GSSAPI') { - if(process.platform == 'win32') { - self.s.topology.auth('sspi', authdb, username, password, options, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else { - self.s.topology.auth('gssapi', authdb, username, password, options, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } - } else if(authMechanism == 'DEFAULT') { - self.s.topology.auth('default', authdb, username, password, function(err, result) { - if(err) return handleCallback(callback, err, false); - _callback(null, true); - }); - } else { - handleCallback(callback, MongoError.create({message: f("authentication mechanism %s not supported", options.authMechanism), driver:true})); - } -} - -/** - * Authenticate a user against the server. - * @method - * @param {string} username The username. - * @param {string} [password] The password. - * @param {object} [options=null] Optional settings. - * @param {string} [options.authMechanism=MONGODB-CR] The authentication mechanism to use, GSSAPI, MONGODB-CR, MONGODB-X509, PLAIN - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.authenticate = function(username, password, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - // Shallow copy the options - options = shallowClone(options); - - // Set default mechanism - if(!options.authMechanism) { - options.authMechanism = 'DEFAULT'; - } else if(options.authMechanism != 'GSSAPI' - && options.authMechanism != 'MONGODB-CR' - && options.authMechanism != 'MONGODB-X509' - && options.authMechanism != 'SCRAM-SHA-1' - && options.authMechanism != 'PLAIN') { - return handleCallback(callback, MongoError.create({message: "only GSSAPI, PLAIN, MONGODB-X509, SCRAM-SHA-1 or MONGODB-CR is supported by authMechanism", driver:true})); - } - - // If we have a callback fallback - if(typeof callback == 'function') return authenticate(self, username, password, options, function(err, r) { - // Support failed auth method - if(err && err.message && err.message.indexOf('saslStart') != -1) err.code = 59; - // Reject error - if(err) return callback(err, r); - callback(null, r); - }); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - authenticate(self, username, password, options, function(err, r) { - // Support failed auth method - if(err && err.message && err.message.indexOf('saslStart') != -1) err.code = 59; - // Reject error - if(err) return reject(err); - resolve(r); - }); - }); -}; - -define.classMethod('authenticate', {callback: true, promise:true}); - -/** - * Logout user from server, fire off on all connections and remove all auth info - * @method - * @param {object} [options=null] Optional settings. - * @param {string} [options.dbName=null] Logout against different database than current. - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.logout = function(options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() || {} : {}; - - // logout command - var cmd = {'logout':1}; - - // Add onAll to login to ensure all connection are logged out - options.onAll = true; - - // We authenticated against a different db use that - if(this.s.authSource) options.dbName = this.s.authSource; - - // Execute the command - if(typeof callback == 'function') return this.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err, false); - handleCallback(callback, null, true) - }); - - // Return promise - return new this.s.promiseLibrary(function(resolve, reject) { - self.command(cmd, options, function(err, result) { - if(err) return reject(err); - resolve(true); - }); - }); -} - -define.classMethod('logout', {callback: true, promise:true}); - -// Figure out the read preference -var getReadPreference = function(options, db) { - if(options.readPreference) return options; - if(db.readPreference) options.readPreference = db.readPreference; - return options; -} - -/** - * Retrieves this collections index info. - * @method - * @param {string} name The name of the collection. - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.full=false] Returns the full raw index information. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {Db~resultCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -Db.prototype.indexInformation = function(name, options, callback) { - var self = this; - if(typeof options == 'function') callback = options, options = {}; - options = options || {}; - - // If we have a callback fallback - if(typeof callback == 'function') return indexInformation(self, name, options, callback); - - // Return a promise - return new this.s.promiseLibrary(function(resolve, reject) { - indexInformation(self, name, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }); - }); -}; - -var indexInformation = function(self, name, options, callback) { - // If we specified full information - var full = options['full'] == null ? false : options['full']; - - // Process all the results from the index command and collection - var processResults = function(indexes) { - // Contains all the information - var info = {}; - // Process all the indexes - for(var i = 0; i < indexes.length; i++) { - var index = indexes[i]; - // Let's unpack the object - info[index.name] = []; - for(var name in index.key) { - info[index.name].push([name, index.key[name]]); - } - } - - return info; - } - - // Get the list of indexes of the specified collection - self.collection(name).listIndexes().toArray(function(err, indexes) { - if(err) return callback(toError(err)); - if(!Array.isArray(indexes)) return handleCallback(callback, null, []); - if(full) return handleCallback(callback, null, indexes); - handleCallback(callback, null, processResults(indexes)); - }); -} - -define.classMethod('indexInformation', {callback: true, promise:true}); - -var createCreateIndexCommand = function(db, name, fieldOrSpec, options) { - var indexParameters = parseIndexOptions(fieldOrSpec); - var fieldHash = indexParameters.fieldHash; - var keys = indexParameters.keys; - - // Generate the index name - var indexName = typeof options.name == 'string' ? options.name : indexParameters.name; - var selector = { - 'ns': db.databaseName + "." + name, 'key': fieldHash, 'name': indexName - } - - // Ensure we have a correct finalUnique - var finalUnique = options == null || 'object' === typeof options ? false : options; - // Set up options - options = options == null || typeof options == 'boolean' ? {} : options; - - // Add all the options - var keysToOmit = Object.keys(selector); - for(var optionName in options) { - if(keysToOmit.indexOf(optionName) == -1) { - selector[optionName] = options[optionName]; - } - } - - if(selector['unique'] == null) selector['unique'] = finalUnique; - - // Remove any write concern operations - var removeKeys = ['w', 'wtimeout', 'j', 'fsync', 'readPreference']; - for(var i = 0; i < removeKeys.length; i++) { - delete selector[removeKeys[i]]; - } - - // Return the command creation selector - return selector; -} - -var createIndexUsingCreateIndexes = function(self, name, fieldOrSpec, options, callback) { - // Build the index - var indexParameters = parseIndexOptions(fieldOrSpec); - // Generate the index name - var indexName = typeof options.name == 'string' ? options.name : indexParameters.name; - // Set up the index - var indexes = [{ name: indexName, key: indexParameters.fieldHash }]; - // merge all the options - var keysToOmit = Object.keys(indexes[0]); - for(var optionName in options) { - if(keysToOmit.indexOf(optionName) == -1) { - indexes[0][optionName] = options[optionName]; - } - - // Remove any write concern operations - var removeKeys = ['w', 'wtimeout', 'j', 'fsync', 'readPreference']; - for(var i = 0; i < removeKeys.length; i++) { - delete indexes[0][removeKeys[i]]; - } - } - - // Create command - var cmd = {createIndexes: name, indexes: indexes}; - - // Apply write concern to command - cmd = writeConcern(cmd, self, options); - - // Build the command - self.command(cmd, options, function(err, result) { - if(err) return handleCallback(callback, err, null); - if(result.ok == 0) return handleCallback(callback, toError(result), null); - // Return the indexName for backward compatibility - handleCallback(callback, null, indexName); - }); -} - -// Validate the database name -var validateDatabaseName = function(databaseName) { - if(typeof databaseName !== 'string') throw MongoError.create({message: "database name must be a string", driver:true}); - if(databaseName.length === 0) throw MongoError.create({message: "database name cannot be the empty string", driver:true}); - if(databaseName == '$external') return; - - var invalidChars = [" ", ".", "$", "/", "\\"]; - for(var i = 0; i < invalidChars.length; i++) { - if(databaseName.indexOf(invalidChars[i]) != -1) throw MongoError.create({message: "database names cannot contain the character '" + invalidChars[i] + "'", driver:true}); - } -} - -// Get write concern -var writeConcern = function(target, db, options) { - if(options.w != null || options.j != null || options.fsync != null) { - var opts = {}; - if(options.w) opts.w = options.w; - if(options.wtimeout) opts.wtimeout = options.wtimeout; - if(options.j) opts.j = options.j; - if(options.fsync) opts.fsync = options.fsync; - target.writeConcern = opts; - } else if(db.writeConcern.w != null || db.writeConcern.j != null || db.writeConcern.fsync != null) { - target.writeConcern = db.writeConcern; - } - - return target -} - -// Add listeners to topology -var createListener = function(self, e, object) { - var listener = function(err) { - if(e != 'error') { - object.emit(e, err, self); - - // Emit on all associated db's if available - for(var i = 0; i < self.s.children.length; i++) { - self.s.children[i].emit(e, err, self.s.children[i]); - } - } - } - return listener; -} - -/** - * Db close event - * - * Emitted after a socket closed against a single server or mongos proxy. - * - * @event Db#close - * @type {MongoError} - */ - -/** - * Db authenticated event - * - * Emitted after all server members in the topology (single server, replicaset or mongos) have successfully authenticated. - * - * @event Db#authenticated - * @type {object} - */ - -/** - * Db reconnect event - * - * * Server: Emitted when the driver has reconnected and re-authenticated. - * * ReplicaSet: N/A - * * Mongos: Emitted when the driver reconnects and re-authenticates successfully against a Mongos. - * - * @event Db#reconnect - * @type {object} - */ - -/** - * Db error event - * - * Emitted after an error occurred against a single server or mongos proxy. - * - * @event Db#error - * @type {MongoError} - */ - -/** - * Db timeout event - * - * Emitted after a socket timeout occurred against a single server or mongos proxy. - * - * @event Db#timeout - * @type {MongoError} - */ - -/** - * Db parseError event - * - * The parseError event is emitted if the driver detects illegal or corrupt BSON being received from the server. - * - * @event Db#parseError - * @type {MongoError} - */ - -/** - * Db fullsetup event, emitted when all servers in the topology have been connected to at start up time. - * - * * Server: Emitted when the driver has connected to the single server and has authenticated. - * * ReplSet: Emitted after the driver has attempted to connect to all replicaset members. - * * Mongos: Emitted after the driver has attempted to connect to all mongos proxies. - * - * @event Db#fullsetup - * @type {Db} - */ - -// Constants -Db.SYSTEM_NAMESPACE_COLLECTION = "system.namespaces"; -Db.SYSTEM_INDEX_COLLECTION = "system.indexes"; -Db.SYSTEM_PROFILE_COLLECTION = "system.profile"; -Db.SYSTEM_USER_COLLECTION = "system.users"; -Db.SYSTEM_COMMAND_COLLECTION = "$cmd"; -Db.SYSTEM_JS_COLLECTION = "system.js"; - -module.exports = Db; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js deleted file mode 100644 index d96095fb..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/chunk.js +++ /dev/null @@ -1,237 +0,0 @@ -"use strict"; - -var Binary = require('mongodb-core').BSON.Binary, - ObjectID = require('mongodb-core').BSON.ObjectID; - -/** - * Class for representing a single chunk in GridFS. - * - * @class - * - * @param file {GridStore} The {@link GridStore} object holding this chunk. - * @param mongoObject {object} The mongo object representation of this chunk. - * - * @throws Error when the type of data field for {@link mongoObject} is not - * supported. Currently supported types for data field are instances of - * {@link String}, {@link Array}, {@link Binary} and {@link Binary} - * from the bson module - * - * @see Chunk#buildMongoObject - */ -var Chunk = function(file, mongoObject, writeConcern) { - if(!(this instanceof Chunk)) return new Chunk(file, mongoObject); - - this.file = file; - var self = this; - var mongoObjectFinal = mongoObject == null ? {} : mongoObject; - this.writeConcern = writeConcern || {w:1}; - this.objectId = mongoObjectFinal._id == null ? new ObjectID() : mongoObjectFinal._id; - this.chunkNumber = mongoObjectFinal.n == null ? 0 : mongoObjectFinal.n; - this.data = new Binary(); - - if(mongoObjectFinal.data == null) { - } else if(typeof mongoObjectFinal.data == "string") { - var buffer = new Buffer(mongoObjectFinal.data.length); - buffer.write(mongoObjectFinal.data, 0, mongoObjectFinal.data.length, 'binary'); - this.data = new Binary(buffer); - } else if(Array.isArray(mongoObjectFinal.data)) { - var buffer = new Buffer(mongoObjectFinal.data.length); - var data = mongoObjectFinal.data.join(''); - buffer.write(data, 0, data.length, 'binary'); - this.data = new Binary(buffer); - } else if(mongoObjectFinal.data._bsontype === 'Binary') { - this.data = mongoObjectFinal.data; - } else if(Buffer.isBuffer(mongoObjectFinal.data)) { - } else { - throw Error("Illegal chunk format"); - } - - // Update position - this.internalPosition = 0; -}; - -/** - * Writes a data to this object and advance the read/write head. - * - * @param data {string} the data to write - * @param callback {function(*, GridStore)} This will be called after executing - * this method. The first parameter will contain null and the second one - * will contain a reference to this object. - */ -Chunk.prototype.write = function(data, callback) { - this.data.write(data, this.internalPosition, data.length, 'binary'); - this.internalPosition = this.data.length(); - if(callback != null) return callback(null, this); - return this; -}; - -/** - * Reads data and advances the read/write head. - * - * @param length {number} The length of data to read. - * - * @return {string} The data read if the given length will not exceed the end of - * the chunk. Returns an empty String otherwise. - */ -Chunk.prototype.read = function(length) { - // Default to full read if no index defined - length = length == null || length == 0 ? this.length() : length; - - if(this.length() - this.internalPosition + 1 >= length) { - var data = this.data.read(this.internalPosition, length); - this.internalPosition = this.internalPosition + length; - return data; - } else { - return ''; - } -}; - -Chunk.prototype.readSlice = function(length) { - if ((this.length() - this.internalPosition) >= length) { - var data = null; - if (this.data.buffer != null) { //Pure BSON - data = this.data.buffer.slice(this.internalPosition, this.internalPosition + length); - } else { //Native BSON - data = new Buffer(length); - length = this.data.readInto(data, this.internalPosition); - } - this.internalPosition = this.internalPosition + length; - return data; - } else { - return null; - } -}; - -/** - * Checks if the read/write head is at the end. - * - * @return {boolean} Whether the read/write head has reached the end of this - * chunk. - */ -Chunk.prototype.eof = function() { - return this.internalPosition == this.length() ? true : false; -}; - -/** - * Reads one character from the data of this chunk and advances the read/write - * head. - * - * @return {string} a single character data read if the the read/write head is - * not at the end of the chunk. Returns an empty String otherwise. - */ -Chunk.prototype.getc = function() { - return this.read(1); -}; - -/** - * Clears the contents of the data in this chunk and resets the read/write head - * to the initial position. - */ -Chunk.prototype.rewind = function() { - this.internalPosition = 0; - this.data = new Binary(); -}; - -/** - * Saves this chunk to the database. Also overwrites existing entries having the - * same id as this chunk. - * - * @param callback {function(*, GridStore)} This will be called after executing - * this method. The first parameter will contain null and the second one - * will contain a reference to this object. - */ -Chunk.prototype.save = function(options, callback) { - var self = this; - if(typeof options == 'function') { - callback = options; - options = {}; - } - - self.file.chunkCollection(function(err, collection) { - if(err) return callback(err); - - // Merge the options - var writeOptions = {}; - for(var name in options) writeOptions[name] = options[name]; - for(var name in self.writeConcern) writeOptions[name] = self.writeConcern[name]; - - // collection.remove({'_id':self.objectId}, self.writeConcern, function(err, result) { - collection.remove({'_id':self.objectId}, writeOptions, function(err, result) { - if(err) return callback(err); - - if(self.data.length() > 0) { - self.buildMongoObject(function(mongoObject) { - var options = {forceServerObjectId:true}; - for(var name in self.writeConcern) { - options[name] = self.writeConcern[name]; - } - - collection.insert(mongoObject, writeOptions, function(err, collection) { - callback(err, self); - }); - }); - } else { - callback(null, self); - } - }); - }); -}; - -/** - * Creates a mongoDB object representation of this chunk. - * - * @param callback {function(Object)} This will be called after executing this - * method. The object will be passed to the first parameter and will have - * the structure: - * - *
      
      - *        {
      - *          '_id' : , // {number} id for this chunk
      - *          'files_id' : , // {number} foreign key to the file collection
      - *          'n' : , // {number} chunk number
      - *          'data' : , // {bson#Binary} the chunk data itself
      - *        }
      - *        
      - * - * @see
      MongoDB GridFS Chunk Object Structure - */ -Chunk.prototype.buildMongoObject = function(callback) { - var mongoObject = { - 'files_id': this.file.fileId, - 'n': this.chunkNumber, - 'data': this.data}; - // If we are saving using a specific ObjectId - if(this.objectId != null) mongoObject._id = this.objectId; - - callback(mongoObject); -}; - -/** - * @return {number} the length of the data - */ -Chunk.prototype.length = function() { - return this.data.length(); -}; - -/** - * The position of the read/write head - * @name position - * @lends Chunk# - * @field - */ -Object.defineProperty(Chunk.prototype, "position", { enumerable: true - , get: function () { - return this.internalPosition; - } - , set: function(value) { - this.internalPosition = value; - } -}); - -/** - * The default chunk size - * @constant - */ -Chunk.DEFAULT_CHUNK_SIZE = 1024 * 255; - -module.exports = Chunk; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js deleted file mode 100644 index 62943bd6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/gridfs/grid_store.js +++ /dev/null @@ -1,1919 +0,0 @@ -"use strict"; - -/** - * @fileOverview GridFS is a tool for MongoDB to store files to the database. - * Because of the restrictions of the object size the database can hold, a - * facility to split a file into several chunks is needed. The {@link GridStore} - * class offers a simplified api to interact with files while managing the - * chunks of split files behind the scenes. More information about GridFS can be - * found here. - * - * @example - * var MongoClient = require('mongodb').MongoClient, - * GridStore = require('mongodb').GridStore, - * ObjectID = require('mongodb').ObjectID, - * test = require('assert'); - * - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * var gridStore = new GridStore(db, null, "w"); - * gridStore.open(function(err, gridStore) { - * gridStore.write("hello world!", function(err, gridStore) { - * gridStore.close(function(err, result) { - * - * // Let's read the file using object Id - * GridStore.read(db, result._id, function(err, data) { - * test.equal('hello world!', data); - * db.close(); - * test.done(); - * }); - * }); - * }); - * }); - * }); - */ -var Chunk = require('./chunk'), - ObjectID = require('mongodb-core').BSON.ObjectID, - ReadPreference = require('../read_preference'), - Buffer = require('buffer').Buffer, - Collection = require('../collection'), - fs = require('fs'), - timers = require('timers'), - f = require('util').format, - util = require('util'), - Define = require('../metadata'), - MongoError = require('mongodb-core').MongoError, - inherits = util.inherits, - Duplex = require('stream').Duplex || require('readable-stream').Duplex; - -var REFERENCE_BY_FILENAME = 0, - REFERENCE_BY_ID = 1; - -/** - * Namespace provided by the mongodb-core and node.js - * @external Duplex - */ - -/** - * Create a new GridStore instance - * - * Modes - * - **"r"** - read only. This is the default mode. - * - **"w"** - write in truncate mode. Existing data will be overwriten. - * - * @class - * @param {Db} db A database instance to interact with. - * @param {object} [id] optional unique id for this file - * @param {string} [filename] optional filename for this file, no unique constrain on the field - * @param {string} mode set the mode for this file. - * @param {object} [options=null] Optional settings. - * @param {(number|string)} [options.w=null] The write concern. - * @param {number} [options.wtimeout=null] The write concern timeout. - * @param {boolean} [options.j=false] Specify a journal write concern. - * @param {boolean} [options.fsync=false] Specify a file sync write concern. - * @param {string} [options.root=null] Root collection to use. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {string} [options.content_type=null] MIME type of the file. Defaults to **{GridStore.DEFAULT_CONTENT_TYPE}**. - * @param {number} [options.chunk_size=261120] Size for the chunk. Defaults to **{Chunk.DEFAULT_CHUNK_SIZE}**. - * @param {object} [options.metadata=null] Arbitrary data the user wants to store. - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @property {number} chunkSize Get the gridstore chunk size. - * @property {number} md5 The md5 checksum for this file. - * @property {number} chunkNumber The current chunk number the gridstore has materialized into memory - * @return {GridStore} a GridStore instance. - */ -var GridStore = function GridStore(db, id, filename, mode, options) { - if(!(this instanceof GridStore)) return new GridStore(db, id, filename, mode, options); - var self = this; - this.db = db; - - // Handle options - if(typeof options === 'undefined') options = {}; - // Handle mode - if(typeof mode === 'undefined') { - mode = filename; - filename = undefined; - } else if(typeof mode == 'object') { - options = mode; - mode = filename; - filename = undefined; - } - - if(id instanceof ObjectID) { - this.referenceBy = REFERENCE_BY_ID; - this.fileId = id; - this.filename = filename; - } else if(typeof filename == 'undefined') { - this.referenceBy = REFERENCE_BY_FILENAME; - this.filename = id; - if (mode.indexOf('w') != null) { - this.fileId = new ObjectID(); - } - } else { - this.referenceBy = REFERENCE_BY_ID; - this.fileId = id; - this.filename = filename; - } - - // Set up the rest - this.mode = mode == null ? "r" : mode; - this.options = options || {}; - - // Opened - this.isOpen = false; - - // Set the root if overridden - this.root = this.options['root'] == null ? GridStore.DEFAULT_ROOT_COLLECTION : this.options['root']; - this.position = 0; - this.readPreference = this.options.readPreference || db.options.readPreference || ReadPreference.PRIMARY; - this.writeConcern = _getWriteConcern(db, this.options); - // Set default chunk size - this.internalChunkSize = this.options['chunkSize'] == null ? Chunk.DEFAULT_CHUNK_SIZE : this.options['chunkSize']; - - // Get the promiseLibrary - var promiseLibrary = this.options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Set the promiseLibrary - this.promiseLibrary = promiseLibrary; - - Object.defineProperty(this, "chunkSize", { enumerable: true - , get: function () { - return this.internalChunkSize; - } - , set: function(value) { - if(!(this.mode[0] == "w" && this.position == 0 && this.uploadDate == null)) { - this.internalChunkSize = this.internalChunkSize; - } else { - this.internalChunkSize = value; - } - } - }); - - Object.defineProperty(this, "md5", { enumerable: true - , get: function () { - return this.internalMd5; - } - }); - - Object.defineProperty(this, "chunkNumber", { enumerable: true - , get: function () { - return this.currentChunk && this.currentChunk.chunkNumber ? this.currentChunk.chunkNumber : null; - } - }); -} - -var define = GridStore.define = new Define('Gridstore', GridStore, true); - -/** - * The callback format for the Gridstore.open method - * @callback GridStore~openCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {GridStore} gridStore The GridStore instance if the open method was successful. - */ - -/** - * Opens the file from the database and initialize this object. Also creates a - * new one if file does not exist. - * - * @method - * @param {GridStore~openCallback} [callback] this will be called after executing this method - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.open = function(callback) { - var self = this; - if( this.mode != "w" && this.mode != "w+" && this.mode != "r"){ - throw MongoError.create({message: "Illegal mode " + this.mode, driver:true}); - } - - // We provided a callback leg - if(typeof callback == 'function') return open(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - open(self, function(err, store) { - if(err) return reject(err); - resolve(store); - }) - }); -}; - -var open = function(self, callback) { - // Get the write concern - var writeConcern = _getWriteConcern(self.db, self.options); - - // If we are writing we need to ensure we have the right indexes for md5's - if((self.mode == "w" || self.mode == "w+")) { - // Get files collection - var collection = self.collection(); - // Put index on filename - collection.ensureIndex([['filename', 1]], writeConcern, function(err, index) { - // Get chunk collection - var chunkCollection = self.chunkCollection(); - // Ensure index on chunk collection - chunkCollection.ensureIndex([['files_id', 1], ['n', 1]], writeConcern, function(err, index) { - // Open the connection - _open(self, writeConcern, function(err, r) { - if(err) return callback(err); - self.isOpen = true; - callback(err, r); - }); - }); - }); - } else { - // Open the gridstore - _open(self, writeConcern, function(err, r) { - if(err) return callback(err); - self.isOpen = true; - callback(err, r); - }); - } -} - -// Push the definition for open -define.classMethod('open', {callback: true, promise:true}); - -/** - * Verify if the file is at EOF. - * - * @method - * @return {boolean} true if the read/write head is at the end of this file. - */ -GridStore.prototype.eof = function() { - return this.position == this.length ? true : false; -} - -define.classMethod('eof', {callback: false, promise:false, returns: [Boolean]}); - -/** - * The callback result format. - * @callback GridStore~resultCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {object} result The result from the callback. - */ - -/** - * Retrieves a single character from this file. - * - * @method - * @param {GridStore~resultCallback} [callback] this gets called after this method is executed. Passes null to the first parameter and the character read to the second or null to the second if the read/write head is at the end of the file. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.getc = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return eof(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - eof(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -var eof = function(self, callback) { - if(self.eof()) { - callback(null, null); - } else if(self.currentChunk.eof()) { - nthChunk(self, self.currentChunk.chunkNumber + 1, function(err, chunk) { - self.currentChunk = chunk; - self.position = self.position + 1; - callback(err, self.currentChunk.getc()); - }); - } else { - self.position = self.position + 1; - callback(null, self.currentChunk.getc()); - } -} - -define.classMethod('getc', {callback: true, promise:true}); - -/** - * Writes a string to the file with a newline character appended at the end if - * the given string does not have one. - * - * @method - * @param {string} string the string to write. - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.puts = function(string, callback) { - var self = this; - var finalString = string.match(/\n$/) == null ? string + "\n" : string; - // We provided a callback leg - if(typeof callback == 'function') return this.write(finalString, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - self.write(finalString, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -define.classMethod('puts', {callback: true, promise:true}); - -/** - * Return a modified Readable stream including a possible transform method. - * - * @method - * @return {GridStoreStream} - */ -GridStore.prototype.stream = function() { - return new GridStoreStream(this); -} - -define.classMethod('stream', {callback: false, promise:false, returns: [GridStoreStream]}); - -/** - * Writes some data. This method will work properly only if initialized with mode "w" or "w+". - * - * @method - * @param {(string|Buffer)} data the data to write. - * @param {boolean} [close] closes this file after writing if set to true. - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.write = function write(data, close, callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return _writeNormal(this, data, close, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - _writeNormal(self, data, close, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -define.classMethod('write', {callback: true, promise:true}); - -/** - * Handles the destroy part of a stream - * - * @method - * @result {null} - */ -GridStore.prototype.destroy = function destroy() { - // close and do not emit any more events. queued data is not sent. - if(!this.writable) return; - this.readable = false; - if(this.writable) { - this.writable = false; - this._q.length = 0; - this.emit('close'); - } -} - -define.classMethod('destroy', {callback: false, promise:false}); - -/** - * Stores a file from the file system to the GridFS database. - * - * @method - * @param {(string|Buffer|FileHandle)} file the file to store. - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.writeFile = function (file, callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return writeFile(self, file, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - writeFile(self, file, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var writeFile = function(self, file, callback) { - if (typeof file === 'string') { - fs.open(file, 'r', function (err, fd) { - if(err) return callback(err); - self.writeFile(fd, callback); - }); - return; - } - - self.open(function (err, self) { - if(err) return callback(err, self); - - fs.fstat(file, function (err, stats) { - if(err) return callback(err, self); - - var offset = 0; - var index = 0; - var numberOfChunksLeft = Math.min(stats.size / self.chunkSize); - - // Write a chunk - var writeChunk = function() { - fs.read(file, self.chunkSize, offset, 'binary', function(err, data, bytesRead) { - if(err) return callback(err, self); - - offset = offset + bytesRead; - - // Create a new chunk for the data - var chunk = new Chunk(self, {n:index++}, self.writeConcern); - chunk.write(data, function(err, chunk) { - if(err) return callback(err, self); - - chunk.save({}, function(err, result) { - if(err) return callback(err, self); - - self.position = self.position + data.length; - - // Point to current chunk - self.currentChunk = chunk; - - if(offset >= stats.size) { - fs.close(file); - self.close(function(err, result) { - if(err) return callback(err, self); - return callback(null, self); - }); - } else { - return process.nextTick(writeChunk); - } - }); - }); - }); - } - - // Process the first write - process.nextTick(writeChunk); - }); - }); -} - -define.classMethod('writeFile', {callback: true, promise:true}); - -/** - * Saves this file to the database. This will overwrite the old entry if it - * already exists. This will work properly only if mode was initialized to - * "w" or "w+". - * - * @method - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.close = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return close(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - close(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var close = function(self, callback) { - if(self.mode[0] == "w") { - // Set up options - var options = self.writeConcern; - - if(self.currentChunk != null && self.currentChunk.position > 0) { - self.currentChunk.save({}, function(err, chunk) { - if(err && typeof callback == 'function') return callback(err); - - self.collection(function(err, files) { - if(err && typeof callback == 'function') return callback(err); - - // Build the mongo object - if(self.uploadDate != null) { - files.remove({'_id':self.fileId}, self.writeConcern, function(err, collection) { - if(err && typeof callback == 'function') return callback(err); - - buildMongoObject(self, function(err, mongoObject) { - if(err) { - if(typeof callback == 'function') return callback(err); else throw err; - } - - files.save(mongoObject, options, function(err) { - if(typeof callback == 'function') - callback(err, mongoObject); - }); - }); - }); - } else { - self.uploadDate = new Date(); - buildMongoObject(self, function(err, mongoObject) { - if(err) { - if(typeof callback == 'function') return callback(err); else throw err; - } - - files.save(mongoObject, options, function(err) { - if(typeof callback == 'function') - callback(err, mongoObject); - }); - }); - } - }); - }); - } else { - self.collection(function(err, files) { - if(err && typeof callback == 'function') return callback(err); - - self.uploadDate = new Date(); - buildMongoObject(self, function(err, mongoObject) { - if(err) { - if(typeof callback == 'function') return callback(err); else throw err; - } - - files.save(mongoObject, options, function(err) { - if(typeof callback == 'function') - callback(err, mongoObject); - }); - }); - }); - } - } else if(self.mode[0] == "r") { - if(typeof callback == 'function') - callback(null, null); - } else { - if(typeof callback == 'function') - callback(MongoError.create({message: f("Illegal mode %s", self.mode), driver:true})); - } -} - -define.classMethod('close', {callback: true, promise:true}); - -/** - * The collection callback format. - * @callback GridStore~collectionCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Collection} collection The collection from the command execution. - */ - -/** - * Retrieve this file's chunks collection. - * - * @method - * @param {GridStore~collectionCallback} callback the command callback. - * @return {Collection} - */ -GridStore.prototype.chunkCollection = function(callback) { - if(typeof callback == 'function') - return this.db.collection((this.root + ".chunks"), callback); - return this.db.collection((this.root + ".chunks")); -}; - -define.classMethod('chunkCollection', {callback: true, promise:false, returns: [Collection]}); - -/** - * Deletes all the chunks of this file in the database. - * - * @method - * @param {GridStore~resultCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.unlink = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return unlink(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - unlink(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var unlink = function(self, callback) { - deleteChunks(self, function(err) { - if(err!==null) { - err.message = "at deleteChunks: " + err.message; - return callback(err); - } - - self.collection(function(err, collection) { - if(err!==null) { - err.message = "at collection: " + err.message; - return callback(err); - } - - collection.remove({'_id':self.fileId}, self.writeConcern, function(err) { - callback(err, self); - }); - }); - }); -} - -define.classMethod('unlink', {callback: true, promise:true}); - -/** - * Retrieves the file collection associated with this object. - * - * @method - * @param {GridStore~collectionCallback} callback the command callback. - * @return {Collection} - */ -GridStore.prototype.collection = function(callback) { - if(typeof callback == 'function') - this.db.collection(this.root + ".files", callback); - return this.db.collection(this.root + ".files"); -}; - -define.classMethod('collection', {callback: true, promise:false, returns: [Collection]}); - -/** - * The readlines callback format. - * @callback GridStore~readlinesCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {string[]} strings The array of strings returned. - */ - -/** - * Read the entire file as a list of strings splitting by the provided separator. - * - * @method - * @param {string} [separator] The character to be recognized as the newline separator. - * @param {GridStore~readlinesCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.readlines = function(separator, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - separator = args.length ? args.shift() : "\n"; - separator = separator || "\n"; - - // We provided a callback leg - if(typeof callback == 'function') return readlines(self, separator, callback); - - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - readlines(self, separator, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var readlines = function(self, separator, callback) { - self.read(function(err, data) { - if(err) return callback(err); - - var items = data.toString().split(separator); - items = items.length > 0 ? items.splice(0, items.length - 1) : []; - for(var i = 0; i < items.length; i++) { - items[i] = items[i] + separator; - } - - callback(null, items); - }); -} - -define.classMethod('readlines', {callback: true, promise:true}); - -/** - * Deletes all the chunks of this file in the database if mode was set to "w" or - * "w+" and resets the read/write head to the initial position. - * - * @method - * @param {GridStore~resultCallback} [callback] this will be called after executing this method. The first parameter will contain null and the second one will contain a reference to this object. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.rewind = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return rewind(self, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - rewind(self, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var rewind = function(self, callback) { - if(self.currentChunk.chunkNumber != 0) { - if(self.mode[0] == "w") { - deleteChunks(self, function(err, gridStore) { - if(err) return callback(err); - self.currentChunk = new Chunk(self, {'n': 0}, self.writeConcern); - self.position = 0; - callback(null, self); - }); - } else { - self.currentChunk(0, function(err, chunk) { - if(err) return callback(err); - self.currentChunk = chunk; - self.currentChunk.rewind(); - self.position = 0; - callback(null, self); - }); - } - } else { - self.currentChunk.rewind(); - self.position = 0; - callback(null, self); - } -} - -define.classMethod('rewind', {callback: true, promise:true}); - -/** - * The read callback format. - * @callback GridStore~readCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Buffer} data The data read from the GridStore object - */ - -/** - * Retrieves the contents of this file and advances the read/write head. Works with Buffers only. - * - * There are 3 signatures for this method: - * - * (callback) - * (length, callback) - * (length, buffer, callback) - * - * @method - * @param {number} [length] the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified. - * @param {(string|Buffer)} [buffer] a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method. - * @param {GridStore~readCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.read = function(length, buffer, callback) { - var self = this; - - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - length = args.length ? args.shift() : null; - buffer = args.length ? args.shift() : null; - // We provided a callback leg - if(typeof callback == 'function') return read(self, length, buffer, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - read(self, length, buffer, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -var read = function(self, length, buffer, callback) { - // The data is a c-terminated string and thus the length - 1 - var finalLength = length == null ? self.length - self.position : length; - var finalBuffer = buffer == null ? new Buffer(finalLength) : buffer; - // Add a index to buffer to keep track of writing position or apply current index - finalBuffer._index = buffer != null && buffer._index != null ? buffer._index : 0; - - if((self.currentChunk.length() - self.currentChunk.position + finalBuffer._index) >= finalLength) { - var slice = self.currentChunk.readSlice(finalLength - finalBuffer._index); - // Copy content to final buffer - slice.copy(finalBuffer, finalBuffer._index); - // Update internal position - self.position = self.position + finalBuffer.length; - // Check if we don't have a file at all - if(finalLength == 0 && finalBuffer.length == 0) return callback(MongoError.create({message: "File does not exist", driver:true}), null); - // Else return data - return callback(null, finalBuffer); - } - - // Read the next chunk - var slice = self.currentChunk.readSlice(self.currentChunk.length() - self.currentChunk.position); - // Copy content to final buffer - slice.copy(finalBuffer, finalBuffer._index); - // Update index position - finalBuffer._index += slice.length; - - // Load next chunk and read more - nthChunk(self, self.currentChunk.chunkNumber + 1, function(err, chunk) { - if(err) return callback(err); - - if(chunk.length() > 0) { - self.currentChunk = chunk; - self.read(length, finalBuffer, callback); - } else { - if(finalBuffer._index > 0) { - callback(null, finalBuffer) - } else { - callback(MongoError.create({message: "no chunks found for file, possibly corrupt", driver:true}), null); - } - } - }); -} - -define.classMethod('read', {callback: true, promise:true}); - -/** - * The tell callback format. - * @callback GridStore~tellCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {number} position The current read position in the GridStore. - */ - -/** - * Retrieves the position of the read/write head of this file. - * - * @method - * @param {number} [length] the number of characters to read. Reads all the characters from the read/write head to the EOF if not specified. - * @param {(string|Buffer)} [buffer] a string to hold temporary data. This is used for storing the string data read so far when recursively calling this method. - * @param {GridStore~tellCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.tell = function(callback) { - var self = this; - // We provided a callback leg - if(typeof callback == 'function') return callback(null, this.position); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - resolve(self.position); - }); -}; - -define.classMethod('tell', {callback: true, promise:true}); - -/** - * The tell callback format. - * @callback GridStore~gridStoreCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {GridStore} gridStore The gridStore. - */ - -/** - * Moves the read/write head to a new location. - * - * There are 3 signatures for this method - * - * Seek Location Modes - * - **GridStore.IO_SEEK_SET**, **(default)** set the position from the start of the file. - * - **GridStore.IO_SEEK_CUR**, set the position from the current position in the file. - * - **GridStore.IO_SEEK_END**, set the position from the end of the file. - * - * @method - * @param {number} [position] the position to seek to - * @param {number} [seekLocation] seek mode. Use one of the Seek Location modes. - * @param {GridStore~gridStoreCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.prototype.seek = function(position, seekLocation, callback) { - var self = this; - - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - seekLocation = args.length ? args.shift() : null; - - // We provided a callback leg - if(typeof callback == 'function') return seek(self, position, seekLocation, callback); - // Return promise - return new self.promiseLibrary(function(resolve, reject) { - seek(self, position, seekLocation, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -} - -var seek = function(self, position, seekLocation, callback) { - // Seek only supports read mode - if(self.mode != 'r') { - return callback(MongoError.create({message: "seek is only supported for mode r", driver:true})) - } - - var seekLocationFinal = seekLocation == null ? GridStore.IO_SEEK_SET : seekLocation; - var finalPosition = position; - var targetPosition = 0; - - // Calculate the position - if(seekLocationFinal == GridStore.IO_SEEK_CUR) { - targetPosition = self.position + finalPosition; - } else if(seekLocationFinal == GridStore.IO_SEEK_END) { - targetPosition = self.length + finalPosition; - } else { - targetPosition = finalPosition; - } - - // Get the chunk - var newChunkNumber = Math.floor(targetPosition/self.chunkSize); - var seekChunk = function() { - nthChunk(self, newChunkNumber, function(err, chunk) { - self.currentChunk = chunk; - self.position = targetPosition; - self.currentChunk.position = (self.position % self.chunkSize); - callback(err, self); - }); - }; - - seekChunk(); -} - -define.classMethod('seek', {callback: true, promise:true}); - -/** - * @ignore - */ -var _open = function(self, options, callback) { - var collection = self.collection(); - // Create the query - var query = self.referenceBy == REFERENCE_BY_ID ? {_id:self.fileId} : {filename:self.filename}; - query = null == self.fileId && self.filename == null ? null : query; - options.readPreference = self.readPreference; - - // Fetch the chunks - if(query != null) { - collection.findOne(query, options, function(err, doc) { - if(err) return error(err); - - // Check if the collection for the files exists otherwise prepare the new one - if(doc != null) { - self.fileId = doc._id; - // Prefer a new filename over the existing one if this is a write - self.filename = ((self.mode == 'r') || (self.filename == undefined)) ? doc.filename : self.filename; - self.contentType = doc.contentType; - self.internalChunkSize = doc.chunkSize; - self.uploadDate = doc.uploadDate; - self.aliases = doc.aliases; - self.length = doc.length; - self.metadata = doc.metadata; - self.internalMd5 = doc.md5; - } else if (self.mode != 'r') { - self.fileId = self.fileId == null ? new ObjectID() : self.fileId; - self.contentType = GridStore.DEFAULT_CONTENT_TYPE; - self.internalChunkSize = self.internalChunkSize == null ? Chunk.DEFAULT_CHUNK_SIZE : self.internalChunkSize; - self.length = 0; - } else { - self.length = 0; - var txtId = self.fileId instanceof ObjectID ? self.fileId.toHexString() : self.fileId; - return error(MongoError.create({message: f("file with id %s not opened for writing", (self.referenceBy == REFERENCE_BY_ID ? txtId : self.filename)), driver:true}), self); - } - - // Process the mode of the object - if(self.mode == "r") { - nthChunk(self, 0, options, function(err, chunk) { - if(err) return error(err); - self.currentChunk = chunk; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w") { - // Delete any existing chunks - deleteChunks(self, options, function(err, result) { - if(err) return error(err); - self.currentChunk = new Chunk(self, {'n':0}, self.writeConcern); - self.contentType = self.options['content_type'] == null ? self.contentType : self.options['content_type']; - self.internalChunkSize = self.options['chunk_size'] == null ? self.internalChunkSize : self.options['chunk_size']; - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w+") { - nthChunk(self, lastChunkNumber(self), options, function(err, chunk) { - if(err) return error(err); - // Set the current chunk - self.currentChunk = chunk == null ? new Chunk(self, {'n':0}, self.writeConcern) : chunk; - self.currentChunk.position = self.currentChunk.data.length(); - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = self.length; - callback(null, self); - }); - } - }); - } else { - // Write only mode - self.fileId = null == self.fileId ? new ObjectID() : self.fileId; - self.contentType = GridStore.DEFAULT_CONTENT_TYPE; - self.internalChunkSize = self.internalChunkSize == null ? Chunk.DEFAULT_CHUNK_SIZE : self.internalChunkSize; - self.length = 0; - - var collection2 = self.chunkCollection(); - // No file exists set up write mode - if(self.mode == "w") { - // Delete any existing chunks - deleteChunks(self, options, function(err, result) { - if(err) return error(err); - self.currentChunk = new Chunk(self, {'n':0}, self.writeConcern); - self.contentType = self.options['content_type'] == null ? self.contentType : self.options['content_type']; - self.internalChunkSize = self.options['chunk_size'] == null ? self.internalChunkSize : self.options['chunk_size']; - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = 0; - callback(null, self); - }); - } else if(self.mode == "w+") { - nthChunk(self, lastChunkNumber(self), options, function(err, chunk) { - if(err) return error(err); - // Set the current chunk - self.currentChunk = chunk == null ? new Chunk(self, {'n':0}, self.writeConcern) : chunk; - self.currentChunk.position = self.currentChunk.data.length(); - self.metadata = self.options['metadata'] == null ? self.metadata : self.options['metadata']; - self.aliases = self.options['aliases'] == null ? self.aliases : self.options['aliases']; - self.position = self.length; - callback(null, self); - }); - } - } - - // only pass error to callback once - function error (err) { - if(error.err) return; - callback(error.err = err); - } -}; - -/** - * @ignore - */ -var writeBuffer = function(self, buffer, close, callback) { - if(typeof close === "function") { callback = close; close = null; } - var finalClose = typeof close == 'boolean' ? close : false; - - if(self.mode != "w") { - callback(MongoError.create({message: f("file with id %s not opened for writing", (self.referenceBy == REFERENCE_BY_ID ? self.referenceBy : self.filename)), driver:true}), null); - } else { - if(self.currentChunk.position + buffer.length >= self.chunkSize) { - // Write out the current Chunk and then keep writing until we have less data left than a chunkSize left - // to a new chunk (recursively) - var previousChunkNumber = self.currentChunk.chunkNumber; - var leftOverDataSize = self.chunkSize - self.currentChunk.position; - var firstChunkData = buffer.slice(0, leftOverDataSize); - var leftOverData = buffer.slice(leftOverDataSize); - // A list of chunks to write out - var chunksToWrite = [self.currentChunk.write(firstChunkData)]; - // If we have more data left than the chunk size let's keep writing new chunks - while(leftOverData.length >= self.chunkSize) { - // Create a new chunk and write to it - var newChunk = new Chunk(self, {'n': (previousChunkNumber + 1)}, self.writeConcern); - var firstChunkData = leftOverData.slice(0, self.chunkSize); - leftOverData = leftOverData.slice(self.chunkSize); - // Update chunk number - previousChunkNumber = previousChunkNumber + 1; - // Write data - newChunk.write(firstChunkData); - // Push chunk to save list - chunksToWrite.push(newChunk); - } - - // Set current chunk with remaining data - self.currentChunk = new Chunk(self, {'n': (previousChunkNumber + 1)}, self.writeConcern); - // If we have left over data write it - if(leftOverData.length > 0) self.currentChunk.write(leftOverData); - - // Update the position for the gridstore - self.position = self.position + buffer.length; - // Total number of chunks to write - var numberOfChunksToWrite = chunksToWrite.length; - - for(var i = 0; i < chunksToWrite.length; i++) { - chunksToWrite[i].save({}, function(err, result) { - if(err) return callback(err); - - numberOfChunksToWrite = numberOfChunksToWrite - 1; - - if(numberOfChunksToWrite <= 0) { - // We care closing the file before returning - if(finalClose) { - return self.close(function(err, result) { - callback(err, self); - }); - } - - // Return normally - return callback(null, self); - } - }); - } - } else { - // Update the position for the gridstore - self.position = self.position + buffer.length; - // We have less data than the chunk size just write it and callback - self.currentChunk.write(buffer); - // We care closing the file before returning - if(finalClose) { - return self.close(function(err, result) { - callback(err, self); - }); - } - // Return normally - return callback(null, self); - } - } -}; - -/** - * Creates a mongoDB object representation of this object. - * - *
      
      - *        {
      - *          '_id' : , // {number} id for this file
      - *          'filename' : , // {string} name for this file
      - *          'contentType' : , // {string} mime type for this file
      - *          'length' : , // {number} size of this file?
      - *          'chunksize' : , // {number} chunk size used by this file
      - *          'uploadDate' : , // {Date}
      - *          'aliases' : , // {array of string}
      - *          'metadata' : , // {string}
      - *        }
      - *        
      - * - * @ignore - */ -var buildMongoObject = function(self, callback) { - // Calcuate the length - var mongoObject = { - '_id': self.fileId, - 'filename': self.filename, - 'contentType': self.contentType, - 'length': self.position ? self.position : 0, - 'chunkSize': self.chunkSize, - 'uploadDate': self.uploadDate, - 'aliases': self.aliases, - 'metadata': self.metadata - }; - - var md5Command = {filemd5:self.fileId, root:self.root}; - self.db.command(md5Command, function(err, results) { - if(err) return callback(err); - - mongoObject.md5 = results.md5; - callback(null, mongoObject); - }); -}; - -/** - * Gets the nth chunk of this file. - * @ignore - */ -var nthChunk = function(self, chunkNumber, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - options = options || self.writeConcern; - options.readPreference = self.readPreference; - // Get the nth chunk - self.chunkCollection().findOne({'files_id':self.fileId, 'n':chunkNumber}, options, function(err, chunk) { - if(err) return callback(err); - - var finalChunk = chunk == null ? {} : chunk; - callback(null, new Chunk(self, finalChunk, self.writeConcern)); - }); -}; - -/** - * @ignore - */ -var lastChunkNumber = function(self) { - return Math.floor((self.length ? self.length - 1 : 0)/self.chunkSize); -}; - -/** - * Deletes all the chunks of this file in the database. - * - * @ignore - */ -var deleteChunks = function(self, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - options = options || self.writeConcern; - - if(self.fileId != null) { - self.chunkCollection().remove({'files_id':self.fileId}, options, function(err, result) { - if(err) return callback(err, false); - callback(null, true); - }); - } else { - callback(null, true); - } -}; - -/** -* The collection to be used for holding the files and chunks collection. -* -* @classconstant DEFAULT_ROOT_COLLECTION -**/ -GridStore.DEFAULT_ROOT_COLLECTION = 'fs'; - -/** -* Default file mime type -* -* @classconstant DEFAULT_CONTENT_TYPE -**/ -GridStore.DEFAULT_CONTENT_TYPE = 'binary/octet-stream'; - -/** -* Seek mode where the given length is absolute. -* -* @classconstant IO_SEEK_SET -**/ -GridStore.IO_SEEK_SET = 0; - -/** -* Seek mode where the given length is an offset to the current read/write head. -* -* @classconstant IO_SEEK_CUR -**/ -GridStore.IO_SEEK_CUR = 1; - -/** -* Seek mode where the given length is an offset to the end of the file. -* -* @classconstant IO_SEEK_END -**/ -GridStore.IO_SEEK_END = 2; - -/** - * Checks if a file exists in the database. - * - * @method - * @static - * @param {Db} db the database to query. - * @param {string} name The name of the file to look for. - * @param {string} [rootCollection] The root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~resultCallback} [callback] result from exists. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.exist = function(db, fileIdObject, rootCollection, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - rootCollection = args.length ? args.shift() : null; - options = args.length ? args.shift() : {}; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return exists(db, fileIdObject, rootCollection, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - exists(db, fileIdObject, rootCollection, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var exists = function(db, fileIdObject, rootCollection, options, callback) { - // Establish read preference - var readPreference = options.readPreference || ReadPreference.PRIMARY; - // Fetch collection - var rootCollectionFinal = rootCollection != null ? rootCollection : GridStore.DEFAULT_ROOT_COLLECTION; - db.collection(rootCollectionFinal + ".files", function(err, collection) { - if(err) return callback(err); - - // Build query - var query = (typeof fileIdObject == 'string' || Object.prototype.toString.call(fileIdObject) == '[object RegExp]' ) - ? {'filename':fileIdObject} - : {'_id':fileIdObject}; // Attempt to locate file - - // We have a specific query - if(fileIdObject != null - && typeof fileIdObject == 'object' - && Object.prototype.toString.call(fileIdObject) != '[object RegExp]') { - query = fileIdObject; - } - - // Check if the entry exists - collection.findOne(query, {readPreference:readPreference}, function(err, item) { - if(err) return callback(err); - callback(null, item == null ? false : true); - }); - }); -} - -define.staticMethod('exist', {callback: true, promise:true}); - -/** - * Gets the list of files stored in the GridFS. - * - * @method - * @static - * @param {Db} db the database to query. - * @param {string} [rootCollection] The root collection that holds the files and chunks collection. Defaults to **{GridStore.DEFAULT_ROOT_COLLECTION}**. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~resultCallback} [callback] result from exists. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.list = function(db, rootCollection, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - rootCollection = args.length ? args.shift() : null; - options = args.length ? args.shift() : {}; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return list(db, rootCollection, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - list(db, rootCollection, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var list = function(db, rootCollection, options, callback) { - // Ensure we have correct values - if(rootCollection != null && typeof rootCollection == 'object') { - options = rootCollection; - rootCollection = null; - } - - // Establish read preference - var readPreference = options.readPreference || ReadPreference.PRIMARY; - // Check if we are returning by id not filename - var byId = options['id'] != null ? options['id'] : false; - // Fetch item - var rootCollectionFinal = rootCollection != null ? rootCollection : GridStore.DEFAULT_ROOT_COLLECTION; - var items = []; - db.collection((rootCollectionFinal + ".files"), function(err, collection) { - if(err) return callback(err); - - collection.find({}, {readPreference:readPreference}, function(err, cursor) { - if(err) return callback(err); - - cursor.each(function(err, item) { - if(item != null) { - items.push(byId ? item._id : item.filename); - } else { - callback(err, items); - } - }); - }); - }); -} - -define.staticMethod('list', {callback: true, promise:true}); - -/** - * Reads the contents of a file. - * - * This method has the following signatures - * - * (db, name, callback) - * (db, name, length, callback) - * (db, name, length, offset, callback) - * (db, name, length, offset, options, callback) - * - * @method - * @static - * @param {Db} db the database to query. - * @param {string} name The name of the file. - * @param {number} [length] The size of data to read. - * @param {number} [offset] The offset from the head of the file of which to start reading from. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~readCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ - -GridStore.read = function(db, name, length, offset, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - length = args.length ? args.shift() : null; - offset = args.length ? args.shift() : null; - options = args.length ? args.shift() : null; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options ? options.promiseLibrary : null; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return readStatic(db, name, length, offset, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - readStatic(db, name, length, offset, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var readStatic = function(db, name, length, offset, options, callback) { - new GridStore(db, name, "r", options).open(function(err, gridStore) { - if(err) return callback(err); - // Make sure we are not reading out of bounds - if(offset && offset >= gridStore.length) return callback("offset larger than size of file", null); - if(length && length > gridStore.length) return callback("length is larger than the size of the file", null); - if(offset && length && (offset + length) > gridStore.length) return callback("offset and length is larger than the size of the file", null); - - if(offset != null) { - gridStore.seek(offset, function(err, gridStore) { - if(err) return callback(err); - gridStore.read(length, callback); - }); - } else { - gridStore.read(length, callback); - } - }); -} - -define.staticMethod('read', {callback: true, promise:true}); - -/** - * Read the entire file as a list of strings splitting by the provided separator. - * - * @method - * @static - * @param {Db} db the database to query. - * @param {(String|object)} name the name of the file. - * @param {string} [separator] The character to be recognized as the newline separator. - * @param {object} [options=null] Optional settings. - * @param {(ReadPreference|string)} [options.readPreference=null] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST). - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~readlinesCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.readlines = function(db, name, separator, options, callback) { - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - separator = args.length ? args.shift() : null; - options = args.length ? args.shift() : null; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options ? options.promiseLibrary : null; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return readlinesStatic(db, name, separator, options, callback); - // Return promise - return new promiseLibrary(function(resolve, reject) { - readlinesStatic(db, name, separator, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var readlinesStatic = function(db, name, separator, options, callback) { - var finalSeperator = separator == null ? "\n" : separator; - new GridStore(db, name, "r", options).open(function(err, gridStore) { - if(err) return callback(err); - gridStore.readlines(finalSeperator, callback); - }); -} - -define.staticMethod('readlines', {callback: true, promise:true}); - -/** - * Deletes the chunks and metadata information of a file from GridFS. - * - * @method - * @static - * @param {Db} db The database to query. - * @param {(string|array)} names The name/names of the files to delete. - * @param {object} [options=null] Optional settings. - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {GridStore~resultCallback} [callback] the command callback. - * @return {Promise} returns Promise if no callback passed - */ -GridStore.unlink = function(db, names, options, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - options = args.length ? args.shift() : {}; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // We provided a callback leg - if(typeof callback == 'function') return unlinkStatic(self, db, names, options, callback); - - // Return promise - return new promiseLibrary(function(resolve, reject) { - unlinkStatic(self, db, names, options, function(err, r) { - if(err) return reject(err); - resolve(r); - }) - }); -}; - -var unlinkStatic = function(self, db, names, options, callback) { - // Get the write concern - var writeConcern = _getWriteConcern(db, options); - - // List of names - if(names.constructor == Array) { - var tc = 0; - for(var i = 0; i < names.length; i++) { - ++tc; - GridStore.unlink(db, names[i], options, function(result) { - if(--tc == 0) { - callback(null, self); - } - }); - } - } else { - new GridStore(db, names, "w", options).open(function(err, gridStore) { - if(err) return callback(err); - deleteChunks(gridStore, function(err, result) { - if(err) return callback(err); - gridStore.collection(function(err, collection) { - if(err) return callback(err); - collection.remove({'_id':gridStore.fileId}, writeConcern, function(err, result) { - callback(err, self); - }); - }); - }); - }); - } -} - -define.staticMethod('unlink', {callback: true, promise:true}); - -/** - * @ignore - */ -var _writeNormal = function(self, data, close, callback) { - // If we have a buffer write it using the writeBuffer method - if(Buffer.isBuffer(data)) { - return writeBuffer(self, data, close, callback); - } else { - return writeBuffer(self, new Buffer(data, 'binary'), close, callback); - } -} - -/** - * @ignore - */ -var _setWriteConcernHash = function(options) { - var finalOptions = {}; - if(options.w != null) finalOptions.w = options.w; - if(options.journal == true) finalOptions.j = options.journal; - if(options.j == true) finalOptions.j = options.j; - if(options.fsync == true) finalOptions.fsync = options.fsync; - if(options.wtimeout != null) finalOptions.wtimeout = options.wtimeout; - return finalOptions; -} - -/** - * @ignore - */ -var _getWriteConcern = function(self, options) { - // Final options - var finalOptions = {w:1}; - options = options || {}; - - // Local options verification - if(options.w != null || typeof options.j == 'boolean' || typeof options.journal == 'boolean' || typeof options.fsync == 'boolean') { - finalOptions = _setWriteConcernHash(options); - } else if(options.safe != null && typeof options.safe == 'object') { - finalOptions = _setWriteConcernHash(options.safe); - } else if(typeof options.safe == "boolean") { - finalOptions = {w: (options.safe ? 1 : 0)}; - } else if(self.options.w != null || typeof self.options.j == 'boolean' || typeof self.options.journal == 'boolean' || typeof self.options.fsync == 'boolean') { - finalOptions = _setWriteConcernHash(self.options); - } else if(self.safe && (self.safe.w != null || typeof self.safe.j == 'boolean' || typeof self.safe.journal == 'boolean' || typeof self.safe.fsync == 'boolean')) { - finalOptions = _setWriteConcernHash(self.safe); - } else if(typeof self.safe == "boolean") { - finalOptions = {w: (self.safe ? 1 : 0)}; - } - - // Ensure we don't have an invalid combination of write concerns - if(finalOptions.w < 1 - && (finalOptions.journal == true || finalOptions.j == true || finalOptions.fsync == true)) throw MongoError.create({message: "No acknowledgement using w < 1 cannot be combined with journal:true or fsync:true", driver:true}); - - // Return the options - return finalOptions; -} - -/** - * Create a new GridStoreStream instance (INTERNAL TYPE, do not instantiate directly) - * - * @class - * @extends external:Duplex - * @return {GridStoreStream} a GridStoreStream instance. - */ -var GridStoreStream = function(gs) { - var self = this; - // Initialize the duplex stream - Duplex.call(this); - - // Get the gridstore - this.gs = gs; - - // End called - this.endCalled = false; - - // If we have a seek - this.totalBytesToRead = this.gs.length - this.gs.position; - this.seekPosition = this.gs.position; -} - -// -// Inherit duplex -inherits(GridStoreStream, Duplex); - -GridStoreStream.prototype._pipe = GridStoreStream.prototype.pipe; - -// Set up override -GridStoreStream.prototype.pipe = function(destination) { - var self = this; - - // Only open gridstore if not already open - if(!self.gs.isOpen) { - self.gs.open(function(err) { - if(err) return self.emit('error', err); - self.totalBytesToRead = self.gs.length - self.gs.position; - self._pipe.apply(self, [destination]); - }); - } else { - self.totalBytesToRead = self.gs.length - self.gs.position; - self._pipe.apply(self, [destination]); - } -} - -// Called by stream -GridStoreStream.prototype._read = function(n) { - var self = this; - - var read = function() { - // Read data - self.gs.read(length, function(err, buffer) { - if(err && !self.endCalled) return self.emit('error', err); - - // Stream is closed - if(self.endCalled || buffer == null) return self.push(null); - // Remove bytes read - if(buffer.length <= self.totalBytesToRead) { - self.totalBytesToRead = self.totalBytesToRead - buffer.length; - self.push(buffer); - } else if(buffer.length > self.totalBytesToRead) { - self.totalBytesToRead = self.totalBytesToRead - buffer._index; - self.push(buffer.slice(0, buffer._index)); - } - - // Finished reading - if(self.totalBytesToRead <= 0) { - self.endCalled = true; - } - }); - } - - // Set read length - var length = self.gs.length < self.gs.chunkSize ? self.gs.length - self.seekPosition : self.gs.chunkSize; - if(!self.gs.isOpen) { - self.gs.open(function(err, gs) { - self.totalBytesToRead = self.gs.length - self.gs.position; - if(err) return self.emit('error', err); - read(); - }); - } else { - read(); - } -} - -GridStoreStream.prototype.destroy = function() { - this.pause(); - this.endCalled = true; - this.gs.close(); - this.emit('end'); -} - -GridStoreStream.prototype.write = function(chunk, encoding, callback) { - var self = this; - if(self.endCalled) return self.emit('error', MongoError.create({message: 'attempting to write to stream after end called', driver:true})) - // Do we have to open the gridstore - if(!self.gs.isOpen) { - self.gs.open(function() { - self.gs.isOpen = true; - self.gs.write(chunk, function() { - process.nextTick(function() { - self.emit('drain'); - }); - }); - }); - return false; - } else { - self.gs.write(chunk, function() { - self.emit('drain'); - }); - return true; - } -} - -GridStoreStream.prototype.end = function(chunk, encoding, callback) { - var self = this; - var args = Array.prototype.slice.call(arguments, 0); - callback = args.pop(); - if(typeof callback != 'function') args.push(callback); - chunk = args.length ? args.shift() : null; - encoding = args.length ? args.shift() : null; - self.endCalled = true; - - if(chunk) { - self.gs.write(chunk, function() { - self.gs.close(function() { - if(typeof callback == 'function') callback(); - self.emit('end') - }); - }); - } - - self.gs.close(function() { - if(typeof callback == 'function') callback(); - self.emit('end') - }); -} - -/** - * The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null. - * @function external:Duplex#read - * @param {number} size Optional argument to specify how much data to read. - * @return {(String | Buffer | null)} - */ - -/** - * Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects. - * @function external:Duplex#setEncoding - * @param {string} encoding The encoding to use. - * @return {null} - */ - -/** - * This method will cause the readable stream to resume emitting data events. - * @function external:Duplex#resume - * @return {null} - */ - -/** - * This method will cause a stream in flowing-mode to stop emitting data events. Any data that becomes available will remain in the internal buffer. - * @function external:Duplex#pause - * @return {null} - */ - -/** - * This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream. - * @function external:Duplex#pipe - * @param {Writable} destination The destination for writing data - * @param {object} [options] Pipe options - * @return {null} - */ - -/** - * This method will remove the hooks set up for a previous pipe() call. - * @function external:Duplex#unpipe - * @param {Writable} [destination] The destination for writing data - * @return {null} - */ - -/** - * This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party. - * @function external:Duplex#unshift - * @param {(Buffer|string)} chunk Chunk of data to unshift onto the read queue. - * @return {null} - */ - -/** - * Versions of Node prior to v0.10 had streams that did not implement the entire Streams API as it is today. (See "Compatibility" below for more information.) - * @function external:Duplex#wrap - * @param {Stream} stream An "old style" readable stream. - * @return {null} - */ - -/** - * This method writes some data to the underlying system, and calls the supplied callback once the data has been fully handled. - * @function external:Duplex#write - * @param {(string|Buffer)} chunk The data to write - * @param {string} encoding The encoding, if chunk is a String - * @param {function} callback Callback for when this chunk of data is flushed - * @return {boolean} - */ - -/** - * Call this method when no more data will be written to the stream. If supplied, the callback is attached as a listener on the finish event. - * @function external:Duplex#end - * @param {(string|Buffer)} chunk The data to write - * @param {string} encoding The encoding, if chunk is a String - * @param {function} callback Callback for when this chunk of data is flushed - * @return {null} - */ - -/** - * GridStoreStream stream data event, fired for each document in the cursor. - * - * @event GridStoreStream#data - * @type {object} - */ - -/** - * GridStoreStream stream end event - * - * @event GridStoreStream#end - * @type {null} - */ - -/** - * GridStoreStream stream close event - * - * @event GridStoreStream#close - * @type {null} - */ - -/** - * GridStoreStream stream readable event - * - * @event GridStoreStream#readable - * @type {null} - */ - -/** - * GridStoreStream stream drain event - * - * @event GridStoreStream#drain - * @type {null} - */ - -/** - * GridStoreStream stream finish event - * - * @event GridStoreStream#finish - * @type {null} - */ - -/** - * GridStoreStream stream pipe event - * - * @event GridStoreStream#pipe - * @type {null} - */ - -/** - * GridStoreStream stream unpipe event - * - * @event GridStoreStream#unpipe - * @type {null} - */ - -/** - * GridStoreStream stream error event - * - * @event GridStoreStream#error - * @type {null} - */ - -/** - * @ignore - */ -module.exports = GridStore; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/metadata.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/metadata.js deleted file mode 100644 index 7dae5624..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/metadata.js +++ /dev/null @@ -1,64 +0,0 @@ -var f = require('util').format; - -var Define = function(name, object, stream) { - this.name = name; - this.object = object; - this.stream = typeof stream == 'boolean' ? stream : false; - this.instrumentations = {}; -} - -Define.prototype.classMethod = function(name, options) { - var keys = Object.keys(options).sort(); - var key = generateKey(keys, options); - - // Add a list of instrumentations - if(this.instrumentations[key] == null) { - this.instrumentations[key] = { - methods: [], options: options - } - } - - // Push to list of method for this instrumentation - this.instrumentations[key].methods.push(name); -} - -var generateKey = function(keys, options) { - var parts = []; - for(var i = 0; i < keys.length; i++) { - parts.push(f('%s=%s', keys[i], options[keys[i]])); - } - - return parts.join(); -} - -Define.prototype.staticMethod = function(name, options) { - options.static = true; - var keys = Object.keys(options).sort(); - var key = generateKey(keys, options); - - // Add a list of instrumentations - if(this.instrumentations[key] == null) { - this.instrumentations[key] = { - methods: [], options: options - } - } - - // Push to list of method for this instrumentation - this.instrumentations[key].methods.push(name); -} - -Define.prototype.generate = function(keys, options) { - // Generate the return object - var object = { - name: this.name, obj: this.object, stream: this.stream, - instrumentations: [] - } - - for(var name in this.instrumentations) { - object.instrumentations.push(this.instrumentations[name]); - } - - return object; -} - -module.exports = Define; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js deleted file mode 100644 index 3ce2ad6b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/mongo_client.js +++ /dev/null @@ -1,463 +0,0 @@ -"use strict"; - -var parse = require('./url_parser') - , Server = require('./server') - , Mongos = require('./mongos') - , ReplSet = require('./replset') - , Define = require('./metadata') - , ReadPreference = require('./read_preference') - , Db = require('./db'); - -/** - * @fileOverview The **MongoClient** class is a class that allows for making Connections to MongoDB. - * - * @example - * var MongoClient = require('mongodb').MongoClient, - * test = require('assert'); - * // Connection url - * var url = 'mongodb://localhost:27017/test'; - * // Connect using MongoClient - * MongoClient.connect(url, function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new MongoClient instance - * @class - * @return {MongoClient} a MongoClient instance. - */ -function MongoClient() { - /** - * The callback format for results - * @callback MongoClient~connectCallback - * @param {MongoError} error An error instance representing the error during the execution. - * @param {Db} db The connected database. - */ - - /** - * Connect to MongoDB using a url as documented at - * - * docs.mongodb.org/manual/reference/connection-string/ - * - * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver - * - * @method - * @param {string} url The connection URI string - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.uri_decode_auth=false] Uri decode the user name and password for authentication - * @param {object} [options.db=null] A hash of options to set on the db object, see **Db constructor** - * @param {object} [options.server=null] A hash of options to set on the server objects, see **Server** constructor** - * @param {object} [options.replSet=null] A hash of options to set on the replSet object, see **ReplSet** constructor** - * @param {object} [options.mongos=null] A hash of options to set on the mongos object, see **Mongos** constructor** - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {MongoClient~connectCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ - this.connect = MongoClient.connect; -} - -var define = MongoClient.define = new Define('MongoClient', MongoClient, false); - -/** - * Connect to MongoDB using a url as documented at - * - * docs.mongodb.org/manual/reference/connection-string/ - * - * Note that for replicasets the replicaSet query parameter is required in the 2.0 driver - * - * @method - * @static - * @param {string} url The connection URI string - * @param {object} [options=null] Optional settings. - * @param {boolean} [options.uri_decode_auth=false] Uri decode the user name and password for authentication - * @param {object} [options.db=null] A hash of options to set on the db object, see **Db constructor** - * @param {object} [options.server=null] A hash of options to set on the server objects, see **Server** constructor** - * @param {object} [options.replSet=null] A hash of options to set on the replSet object, see **ReplSet** constructor** - * @param {object} [options.mongos=null] A hash of options to set on the mongos object, see **Mongos** constructor** - * @param {object} [options.promiseLibrary=null] A Promise library class the application wishes to use such as Bluebird, must be ES6 compatible - * @param {MongoClient~connectCallback} [callback] The command result callback - * @return {Promise} returns Promise if no callback passed - */ -MongoClient.connect = function(url, options, callback) { - var args = Array.prototype.slice.call(arguments, 1); - callback = typeof args[args.length - 1] == 'function' ? args.pop() : null; - options = args.length ? args.shift() : null; - options = options || {}; - - // Get the promiseLibrary - var promiseLibrary = options.promiseLibrary; - - // No promise library selected fall back - if(!promiseLibrary) { - promiseLibrary = typeof global.Promise == 'function' ? - global.Promise : require('es6-promise').Promise; - } - - // Return a promise - if(typeof callback != 'function') { - return new promiseLibrary(function(resolve, reject) { - connect(url, options, function(err, db) { - if(err) return reject(err); - resolve(db); - }); - }); - } - - // Fallback to callback based connect - connect(url, options, callback); -} - -define.staticMethod('connect', {callback: true, promise:true}); - -var connect = function(url, options, callback) { - var serverOptions = options.server || {}; - var mongosOptions = options.mongos || {}; - var replSetServersOptions = options.replSet || options.replSetServers || {}; - var dbOptions = options.db || {}; - - // If callback is null throw an exception - if(callback == null) - throw new Error("no callback function provided"); - - // Parse the string - var object = parse(url, options); - - // Merge in any options for db in options object - if(dbOptions) { - for(var name in dbOptions) object.db_options[name] = dbOptions[name]; - } - - // Added the url to the options - object.db_options.url = url; - - // Merge in any options for server in options object - if(serverOptions) { - for(var name in serverOptions) object.server_options[name] = serverOptions[name]; - } - - // Merge in any replicaset server options - if(replSetServersOptions) { - for(var name in replSetServersOptions) object.rs_options[name] = replSetServersOptions[name]; - } - - if(replSetServersOptions.ssl - || replSetServersOptions.sslValidate - || replSetServersOptions.sslCA - || replSetServersOptions.sslCert - || replSetServersOptions.sslKey - || replSetServersOptions.sslPass) { - object.server_options.ssl = replSetServersOptions.ssl; - object.server_options.sslValidate = replSetServersOptions.sslValidate; - object.server_options.sslCA = replSetServersOptions.sslCA; - object.server_options.sslCert = replSetServersOptions.sslCert; - object.server_options.sslKey = replSetServersOptions.sslKey; - object.server_options.sslPass = replSetServersOptions.sslPass; - } - - // Merge in any replicaset server options - if(mongosOptions) { - for(var name in mongosOptions) object.mongos_options[name] = mongosOptions[name]; - } - - if(typeof object.server_options.poolSize == 'number') { - if(!object.mongos_options.poolSize) object.mongos_options.poolSize = object.server_options.poolSize; - if(!object.rs_options.poolSize) object.rs_options.poolSize = object.server_options.poolSize; - } - - if(mongosOptions.ssl - || mongosOptions.sslValidate - || mongosOptions.sslCA - || mongosOptions.sslCert - || mongosOptions.sslKey - || mongosOptions.sslPass) { - object.server_options.ssl = mongosOptions.ssl; - object.server_options.sslValidate = mongosOptions.sslValidate; - object.server_options.sslCA = mongosOptions.sslCA; - object.server_options.sslCert = mongosOptions.sslCert; - object.server_options.sslKey = mongosOptions.sslKey; - object.server_options.sslPass = mongosOptions.sslPass; - } - - // Set the promise library - object.db_options.promiseLibrary = options.promiseLibrary; - - // We need to ensure that the list of servers are only either direct members or mongos - // they cannot be a mix of monogs and mongod's - var totalNumberOfServers = object.servers.length; - var totalNumberOfMongosServers = 0; - var totalNumberOfMongodServers = 0; - var serverConfig = null; - var errorServers = {}; - - // Failure modes - if(object.servers.length == 0) throw new Error("connection string must contain at least one seed host"); - - // If we have no db setting for the native parser try to set the c++ one first - object.db_options.native_parser = _setNativeParser(object.db_options); - // If no auto_reconnect is set, set it to true as default for single servers - if(typeof object.server_options.auto_reconnect != 'boolean') { - object.server_options.auto_reconnect = true; - } - - // If we have more than a server, it could be replicaset or mongos list - // need to verify that it's one or the other and fail if it's a mix - // Connect to all servers and run ismaster - for(var i = 0; i < object.servers.length; i++) { - // Set up socket options - var providedSocketOptions = object.server_options.socketOptions || {}; - - var _server_options = { - poolSize:1 - , socketOptions: { - connectTimeoutMS: providedSocketOptions.connectTimeoutMS || 30000 - , socketTimeoutMS: providedSocketOptions.socketTimeoutMS || 30000 - } - , auto_reconnect:false}; - - // Ensure we have ssl setup for the servers - if(object.server_options.ssl) { - _server_options.ssl = object.server_options.ssl; - _server_options.sslValidate = object.server_options.sslValidate; - _server_options.sslCA = object.server_options.sslCA; - _server_options.sslCert = object.server_options.sslCert; - _server_options.sslKey = object.server_options.sslKey; - _server_options.sslPass = object.server_options.sslPass; - } else if(object.rs_options.ssl) { - _server_options.ssl = object.rs_options.ssl; - _server_options.sslValidate = object.rs_options.sslValidate; - _server_options.sslCA = object.rs_options.sslCA; - _server_options.sslCert = object.rs_options.sslCert; - _server_options.sslKey = object.rs_options.sslKey; - _server_options.sslPass = object.rs_options.sslPass; - } - - // Error - var error = null; - // Set up the Server object - var _server = object.servers[i].domain_socket - ? new Server(object.servers[i].domain_socket, _server_options) - : new Server(object.servers[i].host, object.servers[i].port, _server_options); - - var connectFunction = function(__server) { - // Attempt connect - new Db(object.dbName, __server, {w:1, native_parser:false, promiseLibrary:options.promiseLibrary}).open(function(err, db) { - // Update number of servers - totalNumberOfServers = totalNumberOfServers - 1; - - // If no error do the correct checks - if(!err) { - // Close the connection - db.close(); - var isMasterDoc = db.serverConfig.isMasterDoc; - - // Check what type of server we have - if(isMasterDoc.setName) { - totalNumberOfMongodServers++; - } - - if(isMasterDoc.msg && isMasterDoc.msg == "isdbgrid") totalNumberOfMongosServers++; - } else { - error = err; - errorServers[__server.host + ":" + __server.port] = __server; - } - - if(totalNumberOfServers == 0) { - // Error out - if(totalNumberOfMongodServers == 0 && totalNumberOfMongosServers == 0 && error) { - return callback(error, null); - } - - // If we have a mix of mongod and mongos, throw an error - if(totalNumberOfMongosServers > 0 && totalNumberOfMongodServers > 0) { - if(db) db.close(); - return process.nextTick(function() { - try { - callback(new Error("cannot combine a list of replicaset seeds and mongos seeds")); - } catch (err) { - throw err - } - }) - } - - if(totalNumberOfMongodServers == 0 - && totalNumberOfMongosServers == 0 - && object.servers.length == 1 - && (!object.rs_options.replicaSet || !object.rs_options.rs_name)) { - - var obj = object.servers[0]; - serverConfig = obj.domain_socket ? - new Server(obj.domain_socket, object.server_options) - : new Server(obj.host, obj.port, object.server_options); - - } else if(totalNumberOfMongodServers > 0 - || totalNumberOfMongosServers > 0 - || object.rs_options.replicaSet || object.rs_options.rs_name) { - - var finalServers = object.servers - .filter(function(serverObj) { - return errorServers[serverObj.host + ":" + serverObj.port] == null; - }) - .map(function(serverObj) { - return new Server(serverObj.host, serverObj.port, object.server_options); - }); - - // Clean out any error servers - errorServers = {}; - - // Set up the final configuration - if(totalNumberOfMongodServers > 0) { - try { - - // If no replicaset name was provided, we wish to perform a - // direct connection - if(totalNumberOfMongodServers == 1 - && (!object.rs_options.replicaSet && !object.rs_options.rs_name)) { - serverConfig = finalServers[0]; - } else if(totalNumberOfMongodServers == 1) { - object.rs_options.replicaSet = object.rs_options.replicaSet || object.rs_options.rs_name; - serverConfig = new ReplSet(finalServers, object.rs_options); - } else { - serverConfig = new ReplSet(finalServers, object.rs_options); - } - - } catch(err) { - return callback(err, null); - } - } else { - serverConfig = new Mongos(finalServers, object.mongos_options); - } - } - - if(serverConfig == null) { - return process.nextTick(function() { - try { - callback(new Error("Could not locate any valid servers in initial seed list")); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } - - // Ensure no firing of open event before we are ready - serverConfig.emitOpen = false; - // Set up all options etc and connect to the database - _finishConnecting(serverConfig, object, options, callback) - } - }); - } - - // Wrap the context of the call - connectFunction(_server); - } -} - -var _setNativeParser = function(db_options) { - if(typeof db_options.native_parser == 'boolean') return db_options.native_parser; - - try { - require('mongodb-core').BSON.BSONNative.BSON; - return true; - } catch(err) { - return false; - } -} - -var _finishConnecting = function(serverConfig, object, options, callback) { - // If we have a readPreference passed in by the db options - if(typeof object.db_options.readPreference == 'string') { - object.db_options.readPreference = new ReadPreference(object.db_options.readPreference); - } else if(typeof object.db_options.read_preference == 'string') { - object.db_options.readPreference = new ReadPreference(object.db_options.read_preference); - } - - // Do we have readPreference tags - if(object.db_options.readPreference && object.db_options.readPreferenceTags) { - object.db_options.readPreference.tags = object.db_options.readPreferenceTags; - } else if(object.db_options.readPreference && object.db_options.read_preference_tags) { - object.db_options.readPreference.tags = object.db_options.read_preference_tags; - } - - // Get the socketTimeoutMS - var socketTimeoutMS = object.server_options.socketOptions.socketTimeoutMS || 0; - - // If we have a replset, override with replicaset socket timeout option if available - if(serverConfig instanceof ReplSet) { - socketTimeoutMS = object.rs_options.socketOptions.socketTimeoutMS || socketTimeoutMS; - } - - // Set socketTimeout to the same as the connectTimeoutMS or 30 sec - serverConfig.connectTimeoutMS = serverConfig.connectTimeoutMS || 30000; - serverConfig.socketTimeoutMS = serverConfig.connectTimeoutMS; - - // Set up the db options - var db = new Db(object.dbName, serverConfig, object.db_options); - // Open the db - db.open(function(err, db){ - - if(err) { - return process.nextTick(function() { - try { - callback(err, null); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } - - // Reset the socket timeout - serverConfig.socketTimeoutMS = socketTimeoutMS || 0; - - // Return object - if(err == null && object.auth){ - // What db to authenticate against - var authentication_db = db; - if(object.db_options && object.db_options.authSource) { - authentication_db = db.db(object.db_options.authSource); - } - - // Build options object - var options = {}; - if(object.db_options.authMechanism) options.authMechanism = object.db_options.authMechanism; - if(object.db_options.gssapiServiceName) options.gssapiServiceName = object.db_options.gssapiServiceName; - - // Authenticate - authentication_db.authenticate(object.auth.user, object.auth.password, options, function(err, success){ - if(success){ - process.nextTick(function() { - try { - callback(null, db); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } else { - if(db) db.close(); - process.nextTick(function() { - try { - callback(err ? err : new Error('Could not authenticate user ' + object.auth[0]), null); - } catch (err) { - if(db) db.close(); - throw err - } - }); - } - }); - } else { - process.nextTick(function() { - try { - callback(err, db); - } catch (err) { - if(db) db.close(); - throw err - } - }) - } - }); -} - -module.exports = MongoClient diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/mongos.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/mongos.js deleted file mode 100644 index 6087d767..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/mongos.js +++ /dev/null @@ -1,491 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , f = require('util').format - , ServerCapabilities = require('./topology_base').ServerCapabilities - , MongoCR = require('mongodb-core').MongoCR - , CMongos = require('mongodb-core').Mongos - , Cursor = require('./cursor') - , AggregationCursor = require('./aggregation_cursor') - , CommandCursor = require('./command_cursor') - , Define = require('./metadata') - , Server = require('./server') - , Store = require('./topology_base').Store - , shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **Mongos** class is a class that represents a Mongos Proxy topology and is - * used to construct connections. - * - * **Mongos Should not be used, use MongoClient.connect** - * @example - * var Db = require('mongodb').Db, - * Mongos = require('mongodb').Mongos, - * Server = require('mongodb').Server, - * test = require('assert'); - * // Connect using Mongos - * var server = new Server('localhost', 27017); - * var db = new Db('test', new Mongos([server])); - * db.open(function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new Mongos instance - * @class - * @deprecated - * @param {Server[]} servers A seedlist of servers participating in the replicaset. - * @param {object} [options=null] Optional settings. - * @param {booelan} [options.ha=true] Turn on high availability monitoring. - * @param {number} [options.haInterval=5000] Time between each replicaset status check. - * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. - * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support) - * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {object} [options.socketOptions=null] Socket options - * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option. - * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start. - * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting - * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting - * @fires Mongos#connect - * @fires Mongos#ha - * @fires Mongos#joined - * @fires Mongos#left - * @fires Mongos#fullsetup - * @fires Mongos#open - * @fires Mongos#close - * @fires Mongos#error - * @fires Mongos#timeout - * @fires Mongos#parseError - * @return {Mongos} a Mongos instance. - */ -var Mongos = function(servers, options) { - if(!(this instanceof Mongos)) return new Mongos(servers, options); - options = options || {}; - var self = this; - - // Ensure all the instances are Server - for(var i = 0; i < servers.length; i++) { - if(!(servers[i] instanceof Server)) { - throw MongoError.create({message: "all seed list instances must be of the Server type", driver:true}); - } - } - - // Store option defaults - var storeOptions = { - force: false - , bufferMaxEntries: -1 - } - - // Shared global store - var store = options.store || new Store(self, storeOptions); - - // Set up event emitter - EventEmitter.call(this); - - // Debug tag - var tag = options.tag; - - // Build seed list - var seedlist = servers.map(function(x) { - return {host: x.host, port: x.port} - }); - - // Final options - var finalOptions = shallowClone(options); - - // Default values - finalOptions.size = typeof options.poolSize == 'number' ? options.poolSize : 5; - finalOptions.reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true; - finalOptions.emitError = typeof options.emitError == 'boolean' ? options.emitError : true; - finalOptions.cursorFactory = Cursor; - - // Add the store - finalOptions.disconnectHandler = store; - - // Ensure we change the sslCA option to ca if available - if(options.sslCA) finalOptions.ca = options.sslCA; - if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate; - if(options.sslKey) finalOptions.key = options.sslKey; - if(options.sslCert) finalOptions.cert = options.sslCert; - if(options.sslPass) finalOptions.passphrase = options.sslPass; - - // Socket options passed down - if(options.socketOptions) { - if(options.socketOptions.connectTimeoutMS) { - this.connectTimeoutMS = options.socketOptions.connectTimeoutMS; - finalOptions.connectionTimeout = options.socketOptions.connectTimeoutMS; - } - if(options.socketOptions.socketTimeoutMS) - finalOptions.socketTimeout = options.socketOptions.socketTimeoutMS; - } - - // Are we running in debug mode - var debug = typeof options.debug == 'boolean' ? options.debug : false; - if(debug) { - finalOptions.debug = debug; - } - - // Map keep alive setting - if(options.socketOptions && typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAlive = true; - if(typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAliveInitialDelay = options.socketOptions.keepAlive; - } - } - - // Connection timeout - if(options.socketOptions && typeof options.socketOptions.connectionTimeout == 'number') { - finalOptions.connectionTimeout = options.socketOptions.connectionTimeout; - } - - // Socket timeout - if(options.socketOptions && typeof options.socketOptions.socketTimeout == 'number') { - finalOptions.socketTimeout = options.socketOptions.socketTimeout; - } - - // noDelay - if(options.socketOptions && typeof options.socketOptions.noDelay == 'boolean') { - finalOptions.noDelay = options.socketOptions.noDelay; - } - - if(typeof options.secondaryAcceptableLatencyMS == 'number') { - finalOptions.acceptableLatency = options.secondaryAcceptableLatencyMS; - } - - // Add the non connection store - finalOptions.disconnectHandler = store; - - // Create the Mongos - var mongos = new CMongos(seedlist, finalOptions) - // Server capabilities - var sCapabilities = null; - // Add auth prbufferMaxEntriesoviders - mongos.addAuthProvider('mongocr', new MongoCR()); - - // Internal state - this.s = { - // Create the Mongos - mongos: mongos - // Server capabilities - , sCapabilities: sCapabilities - // Debug turned on - , debug: debug - // Store option defaults - , storeOptions: storeOptions - // Cloned options - , clonedOptions: finalOptions - // Actual store of callbacks - , store: store - // Options - , options: options - } - - - // Last ismaster - Object.defineProperty(this, 'isMasterDoc', { - enumerable:true, get: function() { return self.s.mongos.lastIsMaster(); } - }); - - // Last ismaster - Object.defineProperty(this, 'numberOfConnectedServers', { - enumerable:true, get: function() { - return self.s.mongos.s.mongosState.connectedServers().length; - } - }); - - // BSON property - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - return self.s.mongos.bson; - } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return self.s.mongos.haInterval; } - }); -} - -/** - * @ignore - */ -inherits(Mongos, EventEmitter); - -var define = Mongos.define = new Define('Mongos', Mongos, false); - -// Connect -Mongos.prototype.connect = function(db, _options, callback) { - var self = this; - if('function' === typeof _options) callback = _options, _options = {}; - if(_options == null) _options = {}; - if(!('function' === typeof callback)) callback = null; - self.s.options = _options; - - // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; - - // Error handler - var connectErrorHandler = function(event) { - return function(err) { - // Remove all event handlers - var events = ['timeout', 'error', 'close']; - events.forEach(function(e) { - self.removeListener(e, connectErrorHandler); - }); - - self.s.mongos.removeListener('connect', connectErrorHandler); - - // Try to callback - try { - callback(err); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - } - - // Actual handler - var errorHandler = function(event) { - return function(err) { - if(event != 'error') { - self.emit(event, err); - } - } - } - - // Error handler - var reconnectHandler = function(err) { - self.emit('reconnect'); - self.s.store.execute(); - } - - // Connect handler - var connectHandler = function() { - // Clear out all the current handlers left over - ["timeout", "error", "close"].forEach(function(e) { - self.s.mongos.removeAllListeners(e); - }); - - // Set up listeners - self.s.mongos.once('timeout', errorHandler('timeout')); - self.s.mongos.once('error', errorHandler('error')); - self.s.mongos.once('close', errorHandler('close')); - - // relay the event - var relay = function(event) { - return function(t, server) { - self.emit(event, t, server); - } - } - - // Set up serverConfig listeners - self.s.mongos.on('joined', relay('joined')); - self.s.mongos.on('left', relay('left')); - self.s.mongos.on('fullsetup', relay('fullsetup')); - - // Emit open event - self.emit('open', null, self); - - // Return correctly - try { - callback(null, self); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - - // Set up listeners - self.s.mongos.once('timeout', connectErrorHandler('timeout')); - self.s.mongos.once('error', connectErrorHandler('error')); - self.s.mongos.once('close', connectErrorHandler('close')); - self.s.mongos.once('connect', connectHandler); - // Reconnect server - self.s.mongos.on('reconnect', reconnectHandler); - - // Start connection - self.s.mongos.connect(_options); -} - -Mongos.prototype.parserType = function() { - return this.s.mongos.parserType(); -} - -define.classMethod('parserType', {callback: false, promise:false, returns: [String]}); - -// Server capabilities -Mongos.prototype.capabilities = function() { - if(this.s.sCapabilities) return this.s.sCapabilities; - if(this.s.mongos.lastIsMaster() == null) throw MongoError.create({message: 'cannot establish topology capabilities as driver is still in process of connecting', driver:true}); - this.s.sCapabilities = new ServerCapabilities(this.s.mongos.lastIsMaster()); - return this.s.sCapabilities; -} - -define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]}); - -// Command -Mongos.prototype.command = function(ns, cmd, options, callback) { - this.s.mongos.command(ns, cmd, options, callback); -} - -define.classMethod('command', {callback: true, promise:false}); - -// Insert -Mongos.prototype.insert = function(ns, ops, options, callback) { - this.s.mongos.insert(ns, ops, options, function(e, m) { - callback(e, m) - }); -} - -define.classMethod('insert', {callback: true, promise:false}); - -// Update -Mongos.prototype.update = function(ns, ops, options, callback) { - this.s.mongos.update(ns, ops, options, callback); -} - -define.classMethod('update', {callback: true, promise:false}); - -// Remove -Mongos.prototype.remove = function(ns, ops, options, callback) { - this.s.mongos.remove(ns, ops, options, callback); -} - -define.classMethod('remove', {callback: true, promise:false}); - -// IsConnected -Mongos.prototype.isConnected = function() { - return this.s.mongos.isConnected(); -} - -define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]}); - -// Insert -Mongos.prototype.cursor = function(ns, cmd, options) { - options.disconnectHandler = this.s.store; - return this.s.mongos.cursor(ns, cmd, options); -} - -define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]}); - -Mongos.prototype.setBSONParserType = function(type) { - return this.s.mongos.setBSONParserType(type); -} - -Mongos.prototype.lastIsMaster = function() { - return this.s.mongos.lastIsMaster(); -} - -Mongos.prototype.close = function(forceClosed) { - this.s.mongos.destroy(); - // We need to wash out all stored processes - if(forceClosed == true) { - this.s.storeOptions.force = forceClosed; - this.s.store.flush(); - } -} - -define.classMethod('close', {callback: false, promise:false}); - -Mongos.prototype.auth = function() { - var args = Array.prototype.slice.call(arguments, 0); - this.s.mongos.auth.apply(this.s.mongos, args); -} - -define.classMethod('auth', {callback: true, promise:false}); - -/** - * All raw connections - * @method - * @return {array} - */ -Mongos.prototype.connections = function() { - return this.s.mongos.connections(); -} - -define.classMethod('connections', {callback: false, promise:false, returns:[Array]}); - -/** - * A mongos connect event, used to verify that the connection is up and running - * - * @event Mongos#connect - * @type {Mongos} - */ - -/** - * The mongos high availability event - * - * @event Mongos#ha - * @type {function} - * @param {string} type The stage in the high availability event (start|end) - * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only - * @param {number} data.id The id for this high availability request - * @param {object} data.state An object containing the information about the current replicaset - */ - -/** - * A server member left the mongos set - * - * @event Mongos#left - * @type {function} - * @param {string} type The type of member that left (primary|secondary|arbiter) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the mongos set - * - * @event Mongos#joined - * @type {function} - * @param {string} type The type of member that joined (primary|secondary|arbiter) - * @param {Server} server The server object that joined - */ - -/** - * Mongos fullsetup event, emitted when all proxies in the topology have been connected to. - * - * @event Mongos#fullsetup - * @type {Mongos} - */ - -/** - * Mongos open event, emitted when mongos can start processing commands. - * - * @event Mongos#open - * @type {Mongos} - */ - -/** - * Mongos close event - * - * @event Mongos#close - * @type {object} - */ - -/** - * Mongos error event, emitted if there is an error listener. - * - * @event Mongos#error - * @type {MongoError} - */ - -/** - * Mongos timeout event - * - * @event Mongos#timeout - * @type {object} - */ - -/** - * Mongos parseError event - * - * @event Mongos#parseError - * @type {object} - */ - -module.exports = Mongos; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js deleted file mode 100644 index 73b253ae..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/read_preference.js +++ /dev/null @@ -1,104 +0,0 @@ -"use strict"; - -/** - * @fileOverview The **ReadPreference** class is a class that represents a MongoDB ReadPreference and is - * used to construct connections. - * - * @example - * var Db = require('mongodb').Db, - * ReplSet = require('mongodb').ReplSet, - * Server = require('mongodb').Server, - * ReadPreference = require('mongodb').ReadPreference, - * test = require('assert'); - * // Connect using ReplSet - * var server = new Server('localhost', 27017); - * var db = new Db('test', new ReplSet([server])); - * db.open(function(err, db) { - * test.equal(null, err); - * // Perform a read - * var cursor = db.collection('t').find({}); - * cursor.setReadPreference(ReadPreference.PRIMARY); - * cursor.toArray(function(err, docs) { - * test.equal(null, err); - * db.close(); - * }); - * }); - */ - -/** - * Creates a new ReadPreference instance - * - * Read Preferences - * - **ReadPreference.PRIMARY**, Read from primary only. All operations produce an error (throw an exception where applicable) if primary is unavailable. Cannot be combined with tags (This is the default.). - * - **ReadPreference.PRIMARY_PREFERRED**, Read from primary if available, otherwise a secondary. - * - **ReadPreference.SECONDARY**, Read from secondary if available, otherwise error. - * - **ReadPreference.SECONDARY_PREFERRED**, Read from a secondary if available, otherwise read from the primary. - * - **ReadPreference.NEAREST**, All modes read from among the nearest candidates, but unlike other modes, NEAREST will include both the primary and all secondaries in the random selection. - * - * @class - * @param {string} mode The ReadPreference mode as listed above. - * @param {object} tags An object representing read preference tags. - * @property {string} mode The ReadPreference mode. - * @property {object} tags The ReadPreference tags. - * @return {ReadPreference} a ReadPreference instance. - */ -var ReadPreference = function(mode, tags) { - if(!(this instanceof ReadPreference)) - return new ReadPreference(mode, tags); - this._type = 'ReadPreference'; - this.mode = mode; - this.tags = tags; -} - -/** - * Validate if a mode is legal - * - * @method - * @param {string} mode The string representing the read preference mode. - * @return {boolean} - */ -ReadPreference.isValid = function(_mode) { - return (_mode == ReadPreference.PRIMARY || _mode == ReadPreference.PRIMARY_PREFERRED - || _mode == ReadPreference.SECONDARY || _mode == ReadPreference.SECONDARY_PREFERRED - || _mode == ReadPreference.NEAREST - || _mode == true || _mode == false || _mode == null); -} - -/** - * Validate if a mode is legal - * - * @method - * @param {string} mode The string representing the read preference mode. - * @return {boolean} - */ -ReadPreference.prototype.isValid = function(mode) { - var _mode = typeof mode == 'string' ? mode : this.mode; - return ReadPreference.isValid(_mode); -} - -/** - * @ignore - */ -ReadPreference.prototype.toObject = function() { - var object = {mode:this.mode}; - - if(this.tags != null) { - object['tags'] = this.tags; - } - - return object; -} - -/** - * @ignore - */ -ReadPreference.PRIMARY = 'primary'; -ReadPreference.PRIMARY_PREFERRED = 'primaryPreferred'; -ReadPreference.SECONDARY = 'secondary'; -ReadPreference.SECONDARY_PREFERRED = 'secondaryPreferred'; -ReadPreference.NEAREST = 'nearest' - -/** - * @ignore - */ -module.exports = ReadPreference; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/replset.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/replset.js deleted file mode 100644 index 8a71b421..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/replset.js +++ /dev/null @@ -1,555 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , f = require('util').format - , Server = require('./server') - , Mongos = require('./mongos') - , Cursor = require('./cursor') - , AggregationCursor = require('./aggregation_cursor') - , CommandCursor = require('./command_cursor') - , ReadPreference = require('./read_preference') - , MongoCR = require('mongodb-core').MongoCR - , MongoError = require('mongodb-core').MongoError - , ServerCapabilities = require('./topology_base').ServerCapabilities - , Store = require('./topology_base').Store - , Define = require('./metadata') - , CServer = require('mongodb-core').Server - , CReplSet = require('mongodb-core').ReplSet - , CoreReadPreference = require('mongodb-core').ReadPreference - , shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **ReplSet** class is a class that represents a Replicaset topology and is - * used to construct connections. - * - * **ReplSet Should not be used, use MongoClient.connect** - * @example - * var Db = require('mongodb').Db, - * ReplSet = require('mongodb').ReplSet, - * Server = require('mongodb').Server, - * test = require('assert'); - * // Connect using ReplSet - * var server = new Server('localhost', 27017); - * var db = new Db('test', new ReplSet([server])); - * db.open(function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new ReplSet instance - * @class - * @deprecated - * @param {Server[]} servers A seedlist of servers participating in the replicaset. - * @param {object} [options=null] Optional settings. - * @param {booelan} [options.ha=true] Turn on high availability monitoring. - * @param {number} [options.haInterval=5000] Time between each replicaset status check. - * @param {string} options.replicaSet The name of the replicaset to connect to. - * @param {number} [options.secondaryAcceptableLatencyMS=15] Sets the range of servers to pick when using NEAREST (lowest ping ms + the latency fence, ex: range of 1 to (1 + 15) ms) - * @param {boolean} [options.connectWithNoPrimary=false] Sets if the driver should connect even if no primary is available - * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. - * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support) - * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {object} [options.socketOptions=null] Socket options - * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option. - * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start. - * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting - * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting - * @fires ReplSet#connect - * @fires ReplSet#ha - * @fires ReplSet#joined - * @fires ReplSet#left - * @fires ReplSet#fullsetup - * @fires ReplSet#open - * @fires ReplSet#close - * @fires ReplSet#error - * @fires ReplSet#timeout - * @fires ReplSet#parseError - * @return {ReplSet} a ReplSet instance. - */ -var ReplSet = function(servers, options) { - if(!(this instanceof ReplSet)) return new ReplSet(servers, options); - options = options || {}; - var self = this; - - // Ensure all the instances are Server - for(var i = 0; i < servers.length; i++) { - if(!(servers[i] instanceof Server)) { - throw MongoError.create({message: "all seed list instances must be of the Server type", driver:true}); - } - } - - // Store option defaults - var storeOptions = { - force: false - , bufferMaxEntries: -1 - } - - // Shared global store - var store = options.store || new Store(self, storeOptions); - - // Set up event emitter - EventEmitter.call(this); - - // Debug tag - var tag = options.tag; - - // Build seed list - var seedlist = servers.map(function(x) { - return {host: x.host, port: x.port} - }); - - // Final options - var finalOptions = shallowClone(options); - - // Default values - finalOptions.size = typeof options.poolSize == 'number' ? options.poolSize : 5; - finalOptions.reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true; - finalOptions.emitError = typeof options.emitError == 'boolean' ? options.emitError : true; - finalOptions.cursorFactory = Cursor; - - // Add the store - finalOptions.disconnectHandler = store; - - // Socket options passed down - if(options.socketOptions) { - if(options.socketOptions.connectTimeoutMS) { - this.connectTimeoutMS = options.socketOptions.connectTimeoutMS; - finalOptions.connectionTimeout = options.socketOptions.connectTimeoutMS; - } - - if(options.socketOptions.socketTimeoutMS) { - finalOptions.socketTimeout = options.socketOptions.socketTimeoutMS; - } - } - - // Get the name - var replicaSet = options.replicaSet || options.rs_name; - - // Set up options - finalOptions.setName = replicaSet; - - // Are we running in debug mode - var debug = typeof options.debug == 'boolean' ? options.debug : false; - if(debug) { - finalOptions.debug = debug; - } - - // Map keep alive setting - if(options.socketOptions && typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAlive = true; - if(typeof options.socketOptions.keepAlive == 'number') { - finalOptions.keepAliveInitialDelay = options.socketOptions.keepAlive; - } - } - - // Connection timeout - if(options.socketOptions && typeof options.socketOptions.connectionTimeout == 'number') { - finalOptions.connectionTimeout = options.socketOptions.connectionTimeout; - } - - // Socket timeout - if(options.socketOptions && typeof options.socketOptions.socketTimeout == 'number') { - finalOptions.socketTimeout = options.socketOptions.socketTimeout; - } - - // noDelay - if(options.socketOptions && typeof options.socketOptions.noDelay == 'boolean') { - finalOptions.noDelay = options.socketOptions.noDelay; - } - - if(typeof options.secondaryAcceptableLatencyMS == 'number') { - finalOptions.acceptableLatency = options.secondaryAcceptableLatencyMS; - } - - if(options.connectWithNoPrimary == true) { - finalOptions.secondaryOnlyConnectionAllowed = true; - } - - // Add the non connection store - finalOptions.disconnectHandler = store; - - // Translate the options - if(options.sslCA) finalOptions.ca = options.sslCA; - if(typeof options.sslValidate == 'boolean') finalOptions.rejectUnauthorized = options.sslValidate; - if(options.sslKey) finalOptions.key = options.sslKey; - if(options.sslCert) finalOptions.cert = options.sslCert; - if(options.sslPass) finalOptions.passphrase = options.sslPass; - - // Create the ReplSet - var replset = new CReplSet(seedlist, finalOptions) - // Server capabilities - var sCapabilities = null; - // Add auth prbufferMaxEntriesoviders - replset.addAuthProvider('mongocr', new MongoCR()); - - // Listen to reconnect event - replset.on('reconnect', function() { - self.emit('reconnect'); - store.execute(); - }); - - // Internal state - this.s = { - // Replicaset - replset: replset - // Server capabilities - , sCapabilities: null - // Debug tag - , tag: options.tag - // Store options - , storeOptions: storeOptions - // Cloned options - , clonedOptions: finalOptions - // Store - , store: store - // Options - , options: options - } - - // Debug - if(debug) { - // Last ismaster - Object.defineProperty(this, 'replset', { - enumerable:true, get: function() { return replset; } - }); - } - - // Last ismaster - Object.defineProperty(this, 'isMasterDoc', { - enumerable:true, get: function() { return replset.lastIsMaster(); } - }); - - // BSON property - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - return replset.bson; - } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return replset.haInterval; } - }); -} - -/** - * @ignore - */ -inherits(ReplSet, EventEmitter); - -var define = ReplSet.define = new Define('ReplSet', ReplSet, false); - -// Ensure the right read Preference object -var translateReadPreference = function(options) { - if(typeof options.readPreference == 'string') { - options.readPreference = new CoreReadPreference(options.readPreference); - } else if(options.readPreference instanceof ReadPreference) { - options.readPreference = new CoreReadPreference(options.readPreference.mode - , options.readPreference.tags); - } - - return options; -} - -ReplSet.prototype.parserType = function() { - return this.s.replset.parserType(); -} - -define.classMethod('parserType', {callback: false, promise:false, returns: [String]}); - -// Connect method -ReplSet.prototype.connect = function(db, _options, callback) { - var self = this; - if('function' === typeof _options) callback = _options, _options = {}; - if(_options == null) _options = {}; - if(!('function' === typeof callback)) callback = null; - self.s.options = _options; - - // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; - - // Actual handler - var errorHandler = function(event) { - return function(err) { - if(event != 'error') { - self.emit(event, err); - } - } - } - - // Connect handler - var connectHandler = function() { - // Clear out all the current handlers left over - ["timeout", "error", "close"].forEach(function(e) { - self.s.replset.removeAllListeners(e); - }); - - // Set up listeners - self.s.replset.once('timeout', errorHandler('timeout')); - self.s.replset.once('error', errorHandler('error')); - self.s.replset.once('close', errorHandler('close')); - - // relay the event - var relay = function(event) { - return function(t, server) { - self.emit(event, t, server); - } - } - - // Replset events relay - var replsetRelay = function(event) { - return function(t, server) { - self.emit(event, t, server.lastIsMaster(), server); - } - } - - // Relay ha - var relayHa = function(t, state) { - self.emit('ha', t, state); - - if(t == 'start') { - self.emit('ha_connect', t, state); - } else if(t == 'end') { - self.emit('ha_ismaster', t, state); - } - } - - // Set up serverConfig listeners - self.s.replset.on('joined', replsetRelay('joined')); - self.s.replset.on('left', relay('left')); - self.s.replset.on('ping', relay('ping')); - self.s.replset.on('ha', relayHa); - - self.s.replset.on('fullsetup', function(topology) { - self.emit('fullsetup', null, self); - }); - - self.s.replset.on('all', function(topology) { - self.emit('all', null, self); - }); - - // Emit open event - self.emit('open', null, self); - - // Return correctly - try { - callback(null, self); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - - // Error handler - var connectErrorHandler = function(event) { - return function(err) { - ['timeout', 'error', 'close'].forEach(function(e) { - self.s.replset.removeListener(e, connectErrorHandler); - }); - - self.s.replset.removeListener('connect', connectErrorHandler); - // Destroy the replset - self.s.replset.destroy(); - - // Try to callback - try { - callback(err); - } catch(err) { - if(!self.s.replset.isConnected()) - process.nextTick(function() { throw err; }) - } - } - } - - // Set up listeners - self.s.replset.once('timeout', connectErrorHandler('timeout')); - self.s.replset.once('error', connectErrorHandler('error')); - self.s.replset.once('close', connectErrorHandler('close')); - self.s.replset.once('connect', connectHandler); - - // Start connection - self.s.replset.connect(_options); -} - -// Server capabilities -ReplSet.prototype.capabilities = function() { - if(this.s.sCapabilities) return this.s.sCapabilities; - if(this.s.replset.lastIsMaster() == null) throw MongoError.create({message: 'cannot establish topology capabilities as driver is still in process of connecting', driver:true}); - this.s.sCapabilities = new ServerCapabilities(this.s.replset.lastIsMaster()); - return this.s.sCapabilities; -} - -define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]}); - -// Command -ReplSet.prototype.command = function(ns, cmd, options, callback) { - options = translateReadPreference(options); - this.s.replset.command(ns, cmd, options, callback); -} - -define.classMethod('command', {callback: true, promise:false}); - -// Insert -ReplSet.prototype.insert = function(ns, ops, options, callback) { - this.s.replset.insert(ns, ops, options, callback); -} - -define.classMethod('insert', {callback: true, promise:false}); - -// Update -ReplSet.prototype.update = function(ns, ops, options, callback) { - this.s.replset.update(ns, ops, options, callback); -} - -define.classMethod('update', {callback: true, promise:false}); - -// Remove -ReplSet.prototype.remove = function(ns, ops, options, callback) { - this.s.replset.remove(ns, ops, options, callback); -} - -define.classMethod('remove', {callback: true, promise:false}); - -// IsConnected -ReplSet.prototype.isConnected = function() { - return this.s.replset.isConnected(); -} - -define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]}); - -ReplSet.prototype.setBSONParserType = function(type) { - return this.s.replset.setBSONParserType(type); -} - -// Insert -ReplSet.prototype.cursor = function(ns, cmd, options) { - options = translateReadPreference(options); - options.disconnectHandler = this.s.store; - return this.s.replset.cursor(ns, cmd, options); -} - -define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]}); - -ReplSet.prototype.lastIsMaster = function() { - return this.s.replset.lastIsMaster(); -} - -ReplSet.prototype.close = function(forceClosed) { - var self = this; - this.s.replset.destroy(); - // We need to wash out all stored processes - if(forceClosed == true) { - this.s.storeOptions.force = forceClosed; - this.s.store.flush(); - } - - var events = ['timeout', 'error', 'close', 'joined', 'left']; - events.forEach(function(e) { - self.removeAllListeners(e); - }); -} - -define.classMethod('close', {callback: false, promise:false}); - -ReplSet.prototype.auth = function() { - var args = Array.prototype.slice.call(arguments, 0); - this.s.replset.auth.apply(this.s.replset, args); -} - -define.classMethod('auth', {callback: true, promise:false}); - -/** - * All raw connections - * @method - * @return {array} - */ -ReplSet.prototype.connections = function() { - return this.s.replset.connections(); -} - -define.classMethod('connections', {callback: false, promise:false, returns:[Array]}); - -/** - * A replset connect event, used to verify that the connection is up and running - * - * @event ReplSet#connect - * @type {ReplSet} - */ - -/** - * The replset high availability event - * - * @event ReplSet#ha - * @type {function} - * @param {string} type The stage in the high availability event (start|end) - * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only - * @param {number} data.id The id for this high availability request - * @param {object} data.state An object containing the information about the current replicaset - */ - -/** - * A server member left the replicaset - * - * @event ReplSet#left - * @type {function} - * @param {string} type The type of member that left (primary|secondary|arbiter) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the replicaset - * - * @event ReplSet#joined - * @type {function} - * @param {string} type The type of member that joined (primary|secondary|arbiter) - * @param {Server} server The server object that joined - */ - -/** - * ReplSet open event, emitted when replicaset can start processing commands. - * - * @event ReplSet#open - * @type {Replset} - */ - -/** - * ReplSet fullsetup event, emitted when all servers in the topology have been connected to. - * - * @event ReplSet#fullsetup - * @type {Replset} - */ - -/** - * ReplSet close event - * - * @event ReplSet#close - * @type {object} - */ - -/** - * ReplSet error event, emitted if there is an error listener. - * - * @event ReplSet#error - * @type {MongoError} - */ - -/** - * ReplSet timeout event - * - * @event ReplSet#timeout - * @type {object} - */ - -/** - * ReplSet parseError event - * - * @event ReplSet#parseError - * @type {object} - */ - -module.exports = ReplSet; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/server.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/server.js deleted file mode 100644 index eff77713..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/server.js +++ /dev/null @@ -1,437 +0,0 @@ -"use strict"; - -var EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , CServer = require('mongodb-core').Server - , Cursor = require('./cursor') - , AggregationCursor = require('./aggregation_cursor') - , CommandCursor = require('./command_cursor') - , f = require('util').format - , ServerCapabilities = require('./topology_base').ServerCapabilities - , Store = require('./topology_base').Store - , Define = require('./metadata') - , MongoError = require('mongodb-core').MongoError - , shallowClone = require('./utils').shallowClone; - -/** - * @fileOverview The **Server** class is a class that represents a single server topology and is - * used to construct connections. - * - * **Server Should not be used, use MongoClient.connect** - * @example - * var Db = require('mongodb').Db, - * Server = require('mongodb').Server, - * test = require('assert'); - * // Connect using single Server - * var db = new Db('test', new Server('localhost', 27017);); - * db.open(function(err, db) { - * // Get an additional db - * db.close(); - * }); - */ - -/** - * Creates a new Server instance - * @class - * @deprecated - * @param {string} host The host for the server, can be either an IP4, IP6 or domain socket style host. - * @param {number} [port] The server port if IP4. - * @param {object} [options=null] Optional settings. - * @param {number} [options.poolSize=5] Number of connections in the connection pool for each server instance, set to 5 as default for legacy reasons. - * @param {boolean} [options.ssl=false] Use ssl connection (needs to have a mongod server with ssl support) - * @param {object} [options.sslValidate=true] Validate mongod server certificate against ca (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {array} [options.sslCA=null] Array of valid certificates either as Buffers or Strings (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslCert=null] String or buffer containing the certificate we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslKey=null] String or buffer containing the certificate private key we wish to present (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {(Buffer|string)} [options.sslPass=null] String or buffer containing the certificate password (needs to have a mongod server with ssl support, 2.4 or higher) - * @param {object} [options.socketOptions=null] Socket options - * @param {boolean} [options.socketOptions.autoReconnect=false] Reconnect on error. - * @param {boolean} [options.socketOptions.noDelay=true] TCP Socket NoDelay option. - * @param {number} [options.socketOptions.keepAlive=0] TCP KeepAlive on the socket with a X ms delay before start. - * @param {number} [options.socketOptions.connectTimeoutMS=0] TCP Connection timeout setting - * @param {number} [options.socketOptions.socketTimeoutMS=0] TCP Socket timeout setting - * @param {number} [options.reconnectTries=30] Server attempt to reconnect #times - * @param {number} [options.reconnectInterval=1000] Server will wait # milliseconds between retries - * @fires Server#connect - * @fires Server#close - * @fires Server#error - * @fires Server#timeout - * @fires Server#parseError - * @fires Server#reconnect - * @return {Server} a Server instance. - */ -var Server = function(host, port, options) { - options = options || {}; - if(!(this instanceof Server)) return new Server(host, port, options); - EventEmitter.call(this); - var self = this; - - // Store option defaults - var storeOptions = { - force: false - , bufferMaxEntries: -1 - } - - // Shared global store - var store = options.store || new Store(self, storeOptions); - - // Detect if we have a socket connection - if(host.indexOf('\/') != -1) { - if(port != null && typeof port == 'object') { - options = port; - port = null; - } - } else if(port == null) { - throw MongoError.create({message: 'port must be specified', driver:true}); - } - - // Clone options - var clonedOptions = shallowClone(options); - clonedOptions.host = host; - clonedOptions.port = port; - - // Reconnect - var reconnect = typeof options.auto_reconnect == 'boolean' ? options.auto_reconnect : true; - reconnect = typeof options.autoReconnect == 'boolean' ? options.autoReconnect : reconnect; - var emitError = typeof options.emitError == 'boolean' ? options.emitError : true; - var poolSize = typeof options.poolSize == 'number' ? options.poolSize : 5; - - // Socket options passed down - if(options.socketOptions) { - if(options.socketOptions.connectTimeoutMS) { - this.connectTimeoutMS = options.socketOptions.connectTimeoutMS; - clonedOptions.connectionTimeout = options.socketOptions.connectTimeoutMS; - } - - if(options.socketOptions.socketTimeoutMS) { - clonedOptions.socketTimeout = options.socketOptions.socketTimeoutMS; - } - - if(typeof options.socketOptions.keepAlive == 'number') { - clonedOptions.keepAliveInitialDelay = options.socketOptions.keepAlive; - clonedOptions.keepAlive = true; - } - - if(typeof options.socketOptions.noDelay == 'boolean') { - clonedOptions.noDelay = options.socketOptions.noDelay; - } - } - - // Add the cursor factory function - clonedOptions.cursorFactory = Cursor; - clonedOptions.reconnect = reconnect; - clonedOptions.emitError = emitError; - clonedOptions.size = poolSize; - - // Translate the options - if(clonedOptions.sslCA) clonedOptions.ca = clonedOptions.sslCA; - if(typeof clonedOptions.sslValidate == 'boolean') clonedOptions.rejectUnauthorized = clonedOptions.sslValidate; - if(clonedOptions.sslKey) clonedOptions.key = clonedOptions.sslKey; - if(clonedOptions.sslCert) clonedOptions.cert = clonedOptions.sslCert; - if(clonedOptions.sslPass) clonedOptions.passphrase = clonedOptions.sslPass; - - // Add the non connection store - clonedOptions.disconnectHandler = store; - - // Create an instance of a server instance from mongodb-core - var server = new CServer(clonedOptions); - // Server capabilities - var sCapabilities = null; - - // Define the internal properties - this.s = { - // Create an instance of a server instance from mongodb-core - server: server - // Server capabilities - , sCapabilities: null - // Cloned options - , clonedOptions: clonedOptions - // Reconnect - , reconnect: reconnect - // Emit error - , emitError: emitError - // Pool size - , poolSize: poolSize - // Store Options - , storeOptions: storeOptions - // Store - , store: store - // Host - , host: host - // Port - , port: port - // Options - , options: options - } - - // BSON property - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - return self.s.server.bson; - } - }); - - // Last ismaster - Object.defineProperty(this, 'isMasterDoc', { - enumerable:true, get: function() { - return self.s.server.lastIsMaster(); - } - }); - - // Last ismaster - Object.defineProperty(this, 'poolSize', { - enumerable:true, get: function() { return self.s.server.connections().length; } - }); - - Object.defineProperty(this, 'autoReconnect', { - enumerable:true, get: function() { return self.s.reconnect; } - }); - - Object.defineProperty(this, 'host', { - enumerable:true, get: function() { return self.s.host; } - }); - - Object.defineProperty(this, 'port', { - enumerable:true, get: function() { return self.s.port; } - }); -} - -inherits(Server, EventEmitter); - -var define = Server.define = new Define('Server', Server, false); - -Server.prototype.parserType = function() { - return this.s.server.parserType(); -} - -define.classMethod('parserType', {callback: false, promise:false, returns: [String]}); - -// Connect -Server.prototype.connect = function(db, _options, callback) { - var self = this; - if('function' === typeof _options) callback = _options, _options = {}; - if(_options == null) _options = {}; - if(!('function' === typeof callback)) callback = null; - self.s.options = _options; - - // Update bufferMaxEntries - self.s.storeOptions.bufferMaxEntries = db.bufferMaxEntries; - - // Error handler - var connectErrorHandler = function(event) { - return function(err) { - // Remove all event handlers - var events = ['timeout', 'error', 'close']; - events.forEach(function(e) { - self.s.server.removeListener(e, connectHandlers[e]); - }); - - self.s.server.removeListener('connect', connectErrorHandler); - - // Try to callback - try { - callback(err); - } catch(err) { - process.nextTick(function() { throw err; }) - } - } - } - - // Actual handler - var errorHandler = function(event) { - return function(err) { - if(event != 'error') { - self.emit(event, err); - } - } - } - - // Error handler - var reconnectHandler = function(err) { - self.emit('reconnect', self); - self.s.store.execute(); - } - - // Destroy called on topology, perform cleanup - var destroyHandler = function() { - self.s.store.flush(); - } - - // Connect handler - var connectHandler = function() { - // Clear out all the current handlers left over - ["timeout", "error", "close"].forEach(function(e) { - self.s.server.removeAllListeners(e); - }); - - // Set up listeners - self.s.server.once('timeout', errorHandler('timeout')); - self.s.server.once('error', errorHandler('error')); - self.s.server.on('close', errorHandler('close')); - // Only called on destroy - self.s.server.once('destroy', destroyHandler); - - // Emit open event - self.emit('open', null, self); - - // Return correctly - try { - callback(null, self); - } catch(err) { - console.log(err.stack) - process.nextTick(function() { throw err; }) - } - } - - // Set up listeners - var connectHandlers = { - timeout: connectErrorHandler('timeout'), - error: connectErrorHandler('error'), - close: connectErrorHandler('close') - }; - - // Add the event handlers - self.s.server.once('timeout', connectHandlers.timeout); - self.s.server.once('error', connectHandlers.error); - self.s.server.once('close', connectHandlers.close); - self.s.server.once('connect', connectHandler); - // Reconnect server - self.s.server.on('reconnect', reconnectHandler); - - // Start connection - self.s.server.connect(_options); -} - -// Server capabilities -Server.prototype.capabilities = function() { - if(this.s.sCapabilities) return this.s.sCapabilities; - if(this.s.server.lastIsMaster() == null) throw MongoError.create({message: 'cannot establish topology capabilities as driver is still in process of connecting', driver:true}); - this.s.sCapabilities = new ServerCapabilities(this.s.server.lastIsMaster()); - return this.s.sCapabilities; -} - -define.classMethod('capabilities', {callback: false, promise:false, returns: [ServerCapabilities]}); - -// Command -Server.prototype.command = function(ns, cmd, options, callback) { - this.s.server.command(ns, cmd, options, callback); -} - -define.classMethod('command', {callback: true, promise:false}); - -// Insert -Server.prototype.insert = function(ns, ops, options, callback) { - this.s.server.insert(ns, ops, options, callback); -} - -define.classMethod('insert', {callback: true, promise:false}); - -// Update -Server.prototype.update = function(ns, ops, options, callback) { - this.s.server.update(ns, ops, options, callback); -} - -define.classMethod('update', {callback: true, promise:false}); - -// Remove -Server.prototype.remove = function(ns, ops, options, callback) { - this.s.server.remove(ns, ops, options, callback); -} - -define.classMethod('remove', {callback: true, promise:false}); - -// IsConnected -Server.prototype.isConnected = function() { - return this.s.server.isConnected(); -} - -define.classMethod('isConnected', {callback: false, promise:false, returns: [Boolean]}); - -// Insert -Server.prototype.cursor = function(ns, cmd, options) { - options.disconnectHandler = this.s.store; - return this.s.server.cursor(ns, cmd, options); -} - -define.classMethod('cursor', {callback: false, promise:false, returns: [Cursor, AggregationCursor, CommandCursor]}); - -Server.prototype.setBSONParserType = function(type) { - return this.s.server.setBSONParserType(type); -} - -Server.prototype.lastIsMaster = function() { - return this.s.server.lastIsMaster(); -} - -Server.prototype.close = function(forceClosed) { - this.s.server.destroy(); - // We need to wash out all stored processes - if(forceClosed == true) { - this.s.storeOptions.force = forceClosed; - this.s.store.flush(); - } -} - -define.classMethod('close', {callback: false, promise:false}); - -Server.prototype.auth = function() { - var args = Array.prototype.slice.call(arguments, 0); - this.s.server.auth.apply(this.s.server, args); -} - -define.classMethod('auth', {callback: true, promise:false}); - -/** - * All raw connections - * @method - * @return {array} - */ -Server.prototype.connections = function() { - return this.s.server.connections(); -} - -define.classMethod('connections', {callback: false, promise:false, returns:[Array]}); - -/** - * Server connect event - * - * @event Server#connect - * @type {object} - */ - -/** - * Server close event - * - * @event Server#close - * @type {object} - */ - -/** - * Server reconnect event - * - * @event Server#reconnect - * @type {object} - */ - -/** - * Server error event - * - * @event Server#error - * @type {MongoError} - */ - -/** - * Server timeout event - * - * @event Server#timeout - * @type {object} - */ - -/** - * Server parseError event - * - * @event Server#parseError - * @type {object} - */ - -module.exports = Server; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js deleted file mode 100644 index 000f7ece..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/topology_base.js +++ /dev/null @@ -1,152 +0,0 @@ -"use strict"; - -var MongoError = require('mongodb-core').MongoError - , f = require('util').format; - -// The store of ops -var Store = function(topology, storeOptions) { - var self = this; - var storedOps = []; - storeOptions = storeOptions || {force:false, bufferMaxEntries: -1} - - // Internal state - this.s = { - storedOps: storedOps - , storeOptions: storeOptions - , topology: topology - } - - Object.defineProperty(this, 'length', { - enumerable:true, get: function() { return self.s.storedOps.length; } - }); -} - -Store.prototype.add = function(opType, ns, ops, options, callback) { - if(this.s.storeOptions.force) { - return callback(MongoError.create({message: "db closed by application", driver:true})); - } - - if(this.s.storeOptions.bufferMaxEntries == 0) { - return callback(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - if(this.s.storeOptions.bufferMaxEntries > 0 && this.s.storedOps.length > this.s.storeOptions.bufferMaxEntries) { - while(this.s.storedOps.length > 0) { - var op = this.s.storedOps.shift(); - op.c(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - return; - } - - this.s.storedOps.push({t: opType, n: ns, o: ops, op: options, c: callback}) -} - -Store.prototype.addObjectAndMethod = function(opType, object, method, params, callback) { - if(this.s.storeOptions.force) { - return callback(MongoError.create({message: "db closed by application", driver:true })); - } - - if(this.s.storeOptions.bufferMaxEntries == 0) { - return callback(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - if(this.s.storeOptions.bufferMaxEntries > 0 && this.s.storedOps.length > this.s.storeOptions.bufferMaxEntries) { - while(this.s.storedOps.length > 0) { - var op = this.s.storedOps.shift(); - op.c(MongoError.create({message: f("no connection available for operation and number of stored operation > %s", this.s.storeOptions.bufferMaxEntries), driver:true })); - } - - return; - } - - this.s.storedOps.push({t: opType, m: method, o: object, p: params, c: callback}) -} - -Store.prototype.flush = function() { - while(this.s.storedOps.length > 0) { - this.s.storedOps.shift().c(MongoError.create({message: f("no connection available for operation"), driver:true })); - } -} - -Store.prototype.execute = function() { - // Get current ops - var ops = this.s.storedOps; - // Reset the ops - this.s.storedOps = []; - - // Execute all the stored ops - while(ops.length > 0) { - var op = ops.shift(); - - if(op.t == 'cursor') { - op.o[op.m].apply(op.o, op.p); - } else { - this.s.topology[op.t](op.n, op.o, op.op, op.c); - } - } -} - -Store.prototype.all = function() { - return this.s.storedOps; -} - -// Server capabilities -var ServerCapabilities = function(ismaster) { - var setup_get_property = function(object, name, value) { - Object.defineProperty(object, name, { - enumerable: true - , get: function () { return value; } - }); - } - - // Capabilities - var aggregationCursor = false; - var writeCommands = false; - var textSearch = false; - var authCommands = false; - var listCollections = false; - var listIndexes = false; - var maxNumberOfDocsInBatch = ismaster.maxWriteBatchSize || 1000; - - if(ismaster.minWireVersion >= 0) { - textSearch = true; - } - - if(ismaster.maxWireVersion >= 1) { - aggregationCursor = true; - authCommands = true; - } - - if(ismaster.maxWireVersion >= 2) { - writeCommands = true; - } - - if(ismaster.maxWireVersion >= 3) { - listCollections = true; - listIndexes = true; - } - - // If no min or max wire version set to 0 - if(ismaster.minWireVersion == null) { - ismaster.minWireVersion = 0; - } - - if(ismaster.maxWireVersion == null) { - ismaster.maxWireVersion = 0; - } - - // Map up read only parameters - setup_get_property(this, "hasAggregationCursor", aggregationCursor); - setup_get_property(this, "hasWriteCommands", writeCommands); - setup_get_property(this, "hasTextSearch", textSearch); - setup_get_property(this, "hasAuthCommands", authCommands); - setup_get_property(this, "hasListCollectionsCommand", listCollections); - setup_get_property(this, "hasListIndexesCommand", listIndexes); - setup_get_property(this, "minWireVersion", ismaster.minWireVersion); - setup_get_property(this, "maxWireVersion", ismaster.maxWireVersion); - setup_get_property(this, "maxNumberOfDocsInBatch", maxNumberOfDocsInBatch); -} - -exports.Store = Store; -exports.ServerCapabilities = ServerCapabilities; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js deleted file mode 100644 index eccc1e00..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/url_parser.js +++ /dev/null @@ -1,295 +0,0 @@ -"use strict"; - -var ReadPreference = require('./read_preference'); - -module.exports = function(url, options) { - // Ensure we have a default options object if none set - options = options || {}; - // Variables - var connection_part = ''; - var auth_part = ''; - var query_string_part = ''; - var dbName = 'admin'; - - // Must start with mongodb - if(url.indexOf("mongodb://") != 0) - throw Error("URL must be in the format mongodb://user:pass@host:port/dbname"); - // If we have a ? mark cut the query elements off - if(url.indexOf("?") != -1) { - query_string_part = url.substr(url.indexOf("?") + 1); - connection_part = url.substring("mongodb://".length, url.indexOf("?")) - } else { - connection_part = url.substring("mongodb://".length); - } - - // Check if we have auth params - if(connection_part.indexOf("@") != -1) { - auth_part = connection_part.split("@")[0]; - connection_part = connection_part.split("@")[1]; - } - - // Check if the connection string has a db - if(connection_part.indexOf(".sock") != -1) { - if(connection_part.indexOf(".sock/") != -1) { - dbName = connection_part.split(".sock/")[1]; - connection_part = connection_part.split("/", connection_part.indexOf(".sock") + ".sock".length); - } - } else if(connection_part.indexOf("/") != -1) { - dbName = connection_part.split("/")[1]; - connection_part = connection_part.split("/")[0]; - } - - // Result object - var object = {}; - - // Pick apart the authentication part of the string - var authPart = auth_part || ''; - var auth = authPart.split(':', 2); - - // Decode the URI components - auth[0] = decodeURIComponent(auth[0]); - if(auth[1]){ - auth[1] = decodeURIComponent(auth[1]); - } - - // Add auth to final object if we have 2 elements - if(auth.length == 2) object.auth = {user: auth[0], password: auth[1]}; - - // Variables used for temporary storage - var hostPart; - var urlOptions; - var servers; - var serverOptions = {socketOptions: {}}; - var dbOptions = {read_preference_tags: []}; - var replSetServersOptions = {socketOptions: {}}; - // Add server options to final object - object.server_options = serverOptions; - object.db_options = dbOptions; - object.rs_options = replSetServersOptions; - object.mongos_options = {}; - - // Let's check if we are using a domain socket - if(url.match(/\.sock/)) { - // Split out the socket part - var domainSocket = url.substring( - url.indexOf("mongodb://") + "mongodb://".length - , url.lastIndexOf(".sock") + ".sock".length); - // Clean out any auth stuff if any - if(domainSocket.indexOf("@") != -1) domainSocket = domainSocket.split("@")[1]; - servers = [{domain_socket: domainSocket}]; - } else { - // Split up the db - hostPart = connection_part; - // Deduplicate servers - var deduplicatedServers = {}; - - // Parse all server results - servers = hostPart.split(',').map(function(h) { - var _host, _port, ipv6match; - //check if it matches [IPv6]:port, where the port number is optional - if ((ipv6match = /\[([^\]]+)\](?:\:(.+))?/.exec(h))) { - _host = ipv6match[1]; - _port = parseInt(ipv6match[2], 10) || 27017; - } else { - //otherwise assume it's IPv4, or plain hostname - var hostPort = h.split(':', 2); - _host = hostPort[0] || 'localhost'; - _port = hostPort[1] != null ? parseInt(hostPort[1], 10) : 27017; - // Check for localhost?safe=true style case - if(_host.indexOf("?") != -1) _host = _host.split(/\?/)[0]; - } - - // No entry returned for duplicate servr - if(deduplicatedServers[_host + "_" + _port]) return null; - deduplicatedServers[_host + "_" + _port] = 1; - - // Return the mapped object - return {host: _host, port: _port}; - }).filter(function(x) { - return x != null; - }); - } - - // Get the db name - object.dbName = dbName || 'admin'; - // Split up all the options - urlOptions = (query_string_part || '').split(/[&;]/); - // Ugh, we have to figure out which options go to which constructor manually. - urlOptions.forEach(function(opt) { - if(!opt) return; - var splitOpt = opt.split('='), name = splitOpt[0], value = splitOpt[1]; - // Options implementations - switch(name) { - case 'slaveOk': - case 'slave_ok': - serverOptions.slave_ok = (value == 'true'); - dbOptions.slaveOk = (value == 'true'); - break; - case 'maxPoolSize': - case 'poolSize': - serverOptions.poolSize = parseInt(value, 10); - replSetServersOptions.poolSize = parseInt(value, 10); - break; - case 'autoReconnect': - case 'auto_reconnect': - serverOptions.auto_reconnect = (value == 'true'); - break; - case 'minPoolSize': - throw new Error("minPoolSize not supported"); - case 'maxIdleTimeMS': - throw new Error("maxIdleTimeMS not supported"); - case 'waitQueueMultiple': - throw new Error("waitQueueMultiple not supported"); - case 'waitQueueTimeoutMS': - throw new Error("waitQueueTimeoutMS not supported"); - case 'uuidRepresentation': - throw new Error("uuidRepresentation not supported"); - case 'ssl': - if(value == 'prefer') { - serverOptions.ssl = value; - replSetServersOptions.ssl = value; - break; - } - serverOptions.ssl = (value == 'true'); - replSetServersOptions.ssl = (value == 'true'); - break; - case 'replicaSet': - case 'rs_name': - replSetServersOptions.rs_name = value; - break; - case 'reconnectWait': - replSetServersOptions.reconnectWait = parseInt(value, 10); - break; - case 'retries': - replSetServersOptions.retries = parseInt(value, 10); - break; - case 'readSecondary': - case 'read_secondary': - replSetServersOptions.read_secondary = (value == 'true'); - break; - case 'fsync': - dbOptions.fsync = (value == 'true'); - break; - case 'journal': - dbOptions.j = (value == 'true'); - break; - case 'safe': - dbOptions.safe = (value == 'true'); - break; - case 'nativeParser': - case 'native_parser': - dbOptions.native_parser = (value == 'true'); - break; - case 'readConcernLevel': - dbOptions.readConcern = {level: value}; - break; - case 'connectTimeoutMS': - serverOptions.socketOptions.connectTimeoutMS = parseInt(value, 10); - replSetServersOptions.socketOptions.connectTimeoutMS = parseInt(value, 10); - break; - case 'socketTimeoutMS': - serverOptions.socketOptions.socketTimeoutMS = parseInt(value, 10); - replSetServersOptions.socketOptions.socketTimeoutMS = parseInt(value, 10); - break; - case 'w': - dbOptions.w = parseInt(value, 10); - if(isNaN(dbOptions.w)) dbOptions.w = value; - break; - case 'authSource': - dbOptions.authSource = value; - break; - case 'gssapiServiceName': - dbOptions.gssapiServiceName = value; - break; - case 'authMechanism': - if(value == 'GSSAPI') { - // If no password provided decode only the principal - if(object.auth == null) { - var urlDecodeAuthPart = decodeURIComponent(authPart); - if(urlDecodeAuthPart.indexOf("@") == -1) throw new Error("GSSAPI requires a provided principal"); - object.auth = {user: urlDecodeAuthPart, password: null}; - } else { - object.auth.user = decodeURIComponent(object.auth.user); - } - } else if(value == 'MONGODB-X509') { - object.auth = {user: decodeURIComponent(authPart)}; - } - - // Only support GSSAPI or MONGODB-CR for now - if(value != 'GSSAPI' - && value != 'MONGODB-X509' - && value != 'MONGODB-CR' - && value != 'DEFAULT' - && value != 'SCRAM-SHA-1' - && value != 'PLAIN') - throw new Error("only DEFAULT, GSSAPI, PLAIN, MONGODB-X509, SCRAM-SHA-1 or MONGODB-CR is supported by authMechanism"); - - // Authentication mechanism - dbOptions.authMechanism = value; - break; - case 'authMechanismProperties': - // Split up into key, value pairs - var values = value.split(','); - var o = {}; - // For each value split into key, value - values.forEach(function(x) { - var v = x.split(':'); - o[v[0]] = v[1]; - }); - - // Set all authMechanismProperties - dbOptions.authMechanismProperties = o; - // Set the service name value - if(typeof o.SERVICE_NAME == 'string') dbOptions.gssapiServiceName = o.SERVICE_NAME; - break; - case 'wtimeoutMS': - dbOptions.wtimeout = parseInt(value, 10); - break; - case 'readPreference': - if(!ReadPreference.isValid(value)) throw new Error("readPreference must be either primary/primaryPreferred/secondary/secondaryPreferred/nearest"); - dbOptions.read_preference = value; - break; - case 'readPreferenceTags': - // Decode the value - value = decodeURIComponent(value); - // Contains the tag object - var tagObject = {}; - if(value == null || value == '') { - dbOptions.read_preference_tags.push(tagObject); - break; - } - - // Split up the tags - var tags = value.split(/\,/); - for(var i = 0; i < tags.length; i++) { - var parts = tags[i].trim().split(/\:/); - tagObject[parts[0]] = parts[1]; - } - - // Set the preferences tags - dbOptions.read_preference_tags.push(tagObject); - break; - default: - break; - } - }); - - // No tags: should be null (not []) - if(dbOptions.read_preference_tags.length === 0) { - dbOptions.read_preference_tags = null; - } - - // Validate if there are an invalid write concern combinations - if((dbOptions.w == -1 || dbOptions.w == 0) && ( - dbOptions.journal == true - || dbOptions.fsync == true - || dbOptions.safe == true)) throw new Error("w set to -1 or 0 cannot be combined with safe/w/journal/fsync") - - // If no read preference set it to primary - if(!dbOptions.read_preference) dbOptions.read_preference = 'primary'; - - // Add servers to result - object.servers = servers; - // Returned parsed object - return object; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/lib/utils.js b/Databases/node_modules/mongoose/node_modules/mongodb/lib/utils.js deleted file mode 100644 index cb20e67a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/lib/utils.js +++ /dev/null @@ -1,234 +0,0 @@ -"use strict"; - -var MongoError = require('mongodb-core').MongoError, - f = require('util').format; - -var shallowClone = function(obj) { - var copy = {}; - for(var name in obj) copy[name] = obj[name]; - return copy; -} - -// Set simple property -var getSingleProperty = function(obj, name, value) { - Object.defineProperty(obj, name, { - enumerable:true, - get: function() { - return value - } - }); -} - -var formatSortValue = exports.formatSortValue = function(sortDirection) { - var value = ("" + sortDirection).toLowerCase(); - - switch (value) { - case 'ascending': - case 'asc': - case '1': - return 1; - case 'descending': - case 'desc': - case '-1': - return -1; - default: - throw new Error("Illegal sort clause, must be of the form " - + "[['field1', '(ascending|descending)'], " - + "['field2', '(ascending|descending)']]"); - } -}; - -var formattedOrderClause = exports.formattedOrderClause = function(sortValue) { - var orderBy = {}; - if(sortValue == null) return null; - if (Array.isArray(sortValue)) { - if(sortValue.length === 0) { - return null; - } - - for(var i = 0; i < sortValue.length; i++) { - if(sortValue[i].constructor == String) { - orderBy[sortValue[i]] = 1; - } else { - orderBy[sortValue[i][0]] = formatSortValue(sortValue[i][1]); - } - } - } else if(sortValue != null && typeof sortValue == 'object') { - orderBy = sortValue; - } else if (typeof sortValue == 'string') { - orderBy[sortValue] = 1; - } else { - throw new Error("Illegal sort clause, must be of the form " + - "[['field1', '(ascending|descending)'], ['field2', '(ascending|descending)']]"); - } - - return orderBy; -}; - -var checkCollectionName = function checkCollectionName (collectionName) { - if('string' !== typeof collectionName) { - throw Error("collection name must be a String"); - } - - if(!collectionName || collectionName.indexOf('..') != -1) { - throw Error("collection names cannot be empty"); - } - - if(collectionName.indexOf('$') != -1 && - collectionName.match(/((^\$cmd)|(oplog\.\$main))/) == null) { - throw Error("collection names must not contain '$'"); - } - - if(collectionName.match(/^\.|\.$/) != null) { - throw Error("collection names must not start or end with '.'"); - } - - // Validate that we are not passing 0x00 in the colletion name - if(!!~collectionName.indexOf("\x00")) { - throw new Error("collection names cannot contain a null character"); - } -}; - -var handleCallback = function(callback, err, value1, value2) { - try { - if(callback == null) return; - if(value2) return callback(err, value1, value2); - return callback(err, value1); - } catch(err) { - process.nextTick(function() { throw err; }); - return false; - } - - return true; -} - -/** - * Wrap a Mongo error document in an Error instance - * @ignore - * @api private - */ -var toError = function(error) { - if (error instanceof Error) return error; - - var msg = error.err || error.errmsg || error.errMessage || error; - var e = MongoError.create({message: msg, driver:true}); - - // Get all object keys - var keys = typeof error == 'object' - ? Object.keys(error) - : []; - - for(var i = 0; i < keys.length; i++) { - e[keys[i]] = error[keys[i]]; - } - - return e; -} - -/** - * @ignore - */ -var normalizeHintField = function normalizeHintField(hint) { - var finalHint = null; - - if(typeof hint == 'string') { - finalHint = hint; - } else if(Array.isArray(hint)) { - finalHint = {}; - - hint.forEach(function(param) { - finalHint[param] = 1; - }); - } else if(hint != null && typeof hint == 'object') { - finalHint = {}; - for (var name in hint) { - finalHint[name] = hint[name]; - } - } - - return finalHint; -}; - -/** - * Create index name based on field spec - * - * @ignore - * @api private - */ -var parseIndexOptions = function(fieldOrSpec) { - var fieldHash = {}; - var indexes = []; - var keys; - - // Get all the fields accordingly - if('string' == typeof fieldOrSpec) { - // 'type' - indexes.push(fieldOrSpec + '_' + 1); - fieldHash[fieldOrSpec] = 1; - } else if(Array.isArray(fieldOrSpec)) { - fieldOrSpec.forEach(function(f) { - if('string' == typeof f) { - // [{location:'2d'}, 'type'] - indexes.push(f + '_' + 1); - fieldHash[f] = 1; - } else if(Array.isArray(f)) { - // [['location', '2d'],['type', 1]] - indexes.push(f[0] + '_' + (f[1] || 1)); - fieldHash[f[0]] = f[1] || 1; - } else if(isObject(f)) { - // [{location:'2d'}, {type:1}] - keys = Object.keys(f); - keys.forEach(function(k) { - indexes.push(k + '_' + f[k]); - fieldHash[k] = f[k]; - }); - } else { - // undefined (ignore) - } - }); - } else if(isObject(fieldOrSpec)) { - // {location:'2d', type:1} - keys = Object.keys(fieldOrSpec); - keys.forEach(function(key) { - indexes.push(key + '_' + fieldOrSpec[key]); - fieldHash[key] = fieldOrSpec[key]; - }); - } - - return { - name: indexes.join("_"), keys: keys, fieldHash: fieldHash - } -} - -var isObject = exports.isObject = function (arg) { - return '[object Object]' == toString.call(arg) -} - -var debugOptions = function(debugFields, options) { - var finaloptions = {}; - debugFields.forEach(function(n) { - finaloptions[n] = options[n]; - }); - - return finaloptions; -} - -var decorateCommand = function(command, options, exclude) { - for(var name in options) { - if(exclude[name] == null) command[name] = options[name]; - } - - return command; -} - -exports.shallowClone = shallowClone; -exports.getSingleProperty = getSingleProperty; -exports.checkCollectionName = checkCollectionName; -exports.toError = toError; -exports.formattedOrderClause = formattedOrderClause; -exports.parseIndexOptions = parseIndexOptions; -exports.normalizeHintField = normalizeHintField; -exports.handleCallback = handleCallback; -exports.decorateCommand = decorateCommand; -exports.isObject = isObject; -exports.debugOptions = debugOptions; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/load.js b/Databases/node_modules/mongoose/node_modules/mongodb/load.js deleted file mode 100644 index 01b570e9..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/load.js +++ /dev/null @@ -1,32 +0,0 @@ -var MongoClient = require('./').MongoClient; - -MongoClient.connect('mongodb://localhost:27017/test', function(err, db) { - var col = db.collection('test'); - col.ensureIndex({dt:-1}, function() { - var docs = []; - for(var i = 0; i < 100; i++) { - docs.push({a:i, dt:i, ot:i}); - } - console.log("------------------------------- 0") - - col.insertMany(docs, function() { - // Start firing finds - - for(var i = 0; i < 100; i++) { - setInterval(function() { - col.find({}, {_id: 0, ot:0}).limit(2).sort({dt:-1}).toArray(function(err) { - console.log("-------------------------------- 1") - }); - }, 10) - } - - // while(true) { - // - // // console.log("------------------------------- 1") - // col.find({}, {_id: 0, ot:0}).limit(2).sort({dt:-1}).toArray(function(err) { - // console.log("-------------------------------- 1") - // }); - // } - }); - }); -}); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md deleted file mode 100644 index e06b4967..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/CHANGELOG.md +++ /dev/null @@ -1,9 +0,0 @@ -# Master - -# 2.0.0 - -* re-sync with RSVP. Many large performance improvements and bugfixes. - -# 1.0.0 - -* first subset of RSVP diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE deleted file mode 100644 index 954ec599..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors - -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/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md deleted file mode 100644 index ca8678e2..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/README.md +++ /dev/null @@ -1,61 +0,0 @@ -# ES6-Promise (subset of [rsvp.js](https://github.com/tildeio/rsvp.js)) - -This is a polyfill of the [ES6 Promise](http://people.mozilla.org/~jorendorff/es6-draft.html#sec-promise-constructor). The implementation is a subset of [rsvp.js](https://github.com/tildeio/rsvp.js), if you're wanting extra features and more debugging options, check out the [full library](https://github.com/tildeio/rsvp.js). - -For API details and how to use promises, see the JavaScript Promises HTML5Rocks article. - -## Downloads - -* [es6-promise](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise.js) -* [es6-promise-min](https://raw.githubusercontent.com/jakearchibald/es6-promise/master/dist/es6-promise-min.js) - -## Node.js - -To install: - -```sh -npm install es6-promise -``` - -To use: - -```js -var Promise = require('es6-promise').Promise; -``` - -## Usage in IE<9 - -`catch` is a reserved word in IE<9, meaning `promise.catch(func)` throws a syntax error. To work around this, you can use a string to access the property as shown in the following example. - -However, please remember that such technique is already provided by most common minifiers, making the resulting code safe for old browsers and production: - -```js -promise['catch'](function(err) { - // ... -}); -``` - -Or use `.then` instead: - -```js -promise.then(undefined, function(err) { - // ... -}); -``` - -## Auto-polyfill - -To polyfill the global environment (either in Node or in the browser via CommonJS) use the following code snippet: - -```js -require('es6-promise').polyfill(); -``` - -Notice that we don't assign the result of `polyfill()` to any variable. The `polyfill()` method will patch the global environment (in this case to the `Promise` name) when called. - -## Building & Testing - -* `npm run build` to build -* `npm test` to run tests -* `npm start` to run a build watcher, and webserver to test -* `npm run test:server` for a testem test runner and watching builder diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js deleted file mode 100644 index 308f3acb..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.js +++ /dev/null @@ -1,957 +0,0 @@ -/*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE - * @version 2.1.1 - */ - -(function() { - "use strict"; - function lib$es6$promise$utils$$objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); - } - - function lib$es6$promise$utils$$isFunction(x) { - return typeof x === 'function'; - } - - function lib$es6$promise$utils$$isMaybeThenable(x) { - return typeof x === 'object' && x !== null; - } - - var lib$es6$promise$utils$$_isArray; - if (!Array.isArray) { - lib$es6$promise$utils$$_isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; - } else { - lib$es6$promise$utils$$_isArray = Array.isArray; - } - - var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; - var lib$es6$promise$asap$$len = 0; - var lib$es6$promise$asap$$toString = {}.toString; - var lib$es6$promise$asap$$vertxNext; - function lib$es6$promise$asap$$asap(callback, arg) { - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; - lib$es6$promise$asap$$len += 2; - if (lib$es6$promise$asap$$len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - lib$es6$promise$asap$$scheduleFlush(); - } - } - - var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; - - var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; - var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; - var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; - var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - - // test for web worker but not in IE10 - var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - - // node - function lib$es6$promise$asap$$useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(lib$es6$promise$asap$$flush); - }; - } - - // vertx - function lib$es6$promise$asap$$useVertxTimer() { - return function() { - lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); - }; - } - - function lib$es6$promise$asap$$useMutationObserver() { - var iterations = 0; - var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; - } - - // web worker - function lib$es6$promise$asap$$useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = lib$es6$promise$asap$$flush; - return function () { - channel.port2.postMessage(0); - }; - } - - function lib$es6$promise$asap$$useSetTimeout() { - return function() { - setTimeout(lib$es6$promise$asap$$flush, 1); - }; - } - - var lib$es6$promise$asap$$queue = new Array(1000); - function lib$es6$promise$asap$$flush() { - for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { - var callback = lib$es6$promise$asap$$queue[i]; - var arg = lib$es6$promise$asap$$queue[i+1]; - - callback(arg); - - lib$es6$promise$asap$$queue[i] = undefined; - lib$es6$promise$asap$$queue[i+1] = undefined; - } - - lib$es6$promise$asap$$len = 0; - } - - function lib$es6$promise$asap$$attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; - return lib$es6$promise$asap$$useVertxTimer(); - } catch(e) { - return lib$es6$promise$asap$$useSetTimeout(); - } - } - - var lib$es6$promise$asap$$scheduleFlush; - // Decide what async method to use to triggering processing of queued callbacks: - if (lib$es6$promise$asap$$isNode) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); - } else if (lib$es6$promise$asap$$BrowserMutationObserver) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); - } else if (lib$es6$promise$asap$$isWorker) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); - } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); - } else { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); - } - - function lib$es6$promise$$internal$$noop() {} - - var lib$es6$promise$$internal$$PENDING = void 0; - var lib$es6$promise$$internal$$FULFILLED = 1; - var lib$es6$promise$$internal$$REJECTED = 2; - - var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); - } - - function lib$es6$promise$$internal$$cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); - } - - function lib$es6$promise$$internal$$getThen(promise) { - try { - return promise.then; - } catch(error) { - lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; - return lib$es6$promise$$internal$$GET_THEN_ERROR; - } - } - - function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } - } - - function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { - lib$es6$promise$asap$$default(function(promise) { - var sealed = false; - var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - lib$es6$promise$$internal$$resolve(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - lib$es6$promise$$internal$$reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - lib$es6$promise$$internal$$reject(promise, error); - } - }, promise); - } - - function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { - if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, thenable._result); - } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, thenable._result); - } else { - lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { - lib$es6$promise$$internal$$resolve(promise, value); - }, function(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } - } - - function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); - } else { - var then = lib$es6$promise$$internal$$getThen(maybeThenable); - - if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); - } else if (then === undefined) { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } else if (lib$es6$promise$utils$$isFunction(then)) { - lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); - } else { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } - } - } - - function lib$es6$promise$$internal$$resolve(promise, value) { - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); - } else if (lib$es6$promise$utils$$objectOrFunction(value)) { - lib$es6$promise$$internal$$handleMaybeThenable(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - } - - function lib$es6$promise$$internal$$publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - lib$es6$promise$$internal$$publish(promise); - } - - function lib$es6$promise$$internal$$fulfill(promise, value) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - - promise._result = value; - promise._state = lib$es6$promise$$internal$$FULFILLED; - - if (promise._subscribers.length !== 0) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); - } - } - - function lib$es6$promise$$internal$$reject(promise, reason) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - promise._state = lib$es6$promise$$internal$$REJECTED; - promise._result = reason; - - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); - } - - function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; - subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; - - if (length === 0 && parent._state) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); - } - } - - function lib$es6$promise$$internal$$publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; - } - - function lib$es6$promise$$internal$$ErrorObject() { - this.error = null; - } - - var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; - return lib$es6$promise$$internal$$TRY_CATCH_ERROR; - } - } - - function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { - var hasCallback = lib$es6$promise$utils$$isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = lib$es6$promise$$internal$$tryCatch(callback, detail); - - if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== lib$es6$promise$$internal$$PENDING) { - // noop - } else if (hasCallback && succeeded) { - lib$es6$promise$$internal$$resolve(promise, value); - } else if (failed) { - lib$es6$promise$$internal$$reject(promise, error); - } else if (settled === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, value); - } else if (settled === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } - } - - function lib$es6$promise$$internal$$initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - lib$es6$promise$$internal$$resolve(promise, value); - }, function rejectPromise(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } catch(e) { - lib$es6$promise$$internal$$reject(promise, e); - } - } - - function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } - } - } else { - lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); - } - } - - lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { - return lib$es6$promise$utils$$isArray(input); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { - this._result = new Array(this.length); - }; - - var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; - - lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (lib$es6$promise$utils$$isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === lib$es6$promise$$internal$$PENDING) { - enumerator._remaining--; - - if (state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(promise, enumerator._result); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { - enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); - }); - }; - function lib$es6$promise$promise$all$$all(entries) { - return new lib$es6$promise$enumerator$$default(this, entries).promise; - } - var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; - function lib$es6$promise$promise$race$$race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (!lib$es6$promise$utils$$isArray(entries)) { - lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - lib$es6$promise$$internal$$resolve(promise, value); - } - - function onRejection(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - } - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; - } - var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; - function lib$es6$promise$promise$resolve$$resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$resolve(promise, object); - return promise; - } - var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; - function lib$es6$promise$promise$reject$$reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$reject(promise, reason); - return promise; - } - var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; - - var lib$es6$promise$promise$$counter = 0; - - function lib$es6$promise$promise$$needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - function lib$es6$promise$promise$$needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; - /** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor - */ - function lib$es6$promise$promise$$Promise(resolver) { - this._id = lib$es6$promise$promise$$counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (lib$es6$promise$$internal$$noop !== resolver) { - if (!lib$es6$promise$utils$$isFunction(resolver)) { - lib$es6$promise$promise$$needsResolver(); - } - - if (!(this instanceof lib$es6$promise$promise$$Promise)) { - lib$es6$promise$promise$$needsNew(); - } - - lib$es6$promise$$internal$$initializePromise(this, resolver); - } - } - - lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; - lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; - lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; - lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; - - lib$es6$promise$promise$$Promise.prototype = { - constructor: lib$es6$promise$promise$$Promise, - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(lib$es6$promise$$internal$$noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - lib$es6$promise$asap$$default(function(){ - lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); - }); - } else { - lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - function lib$es6$promise$polyfill$$polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = lib$es6$promise$promise$$default; - } - var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; - - var lib$es6$promise$umd$$ES6Promise = { - 'Promise': lib$es6$promise$promise$$default, - 'polyfill': lib$es6$promise$polyfill$$default - }; - - /* global define:true module:true window: true */ - if (typeof define === 'function' && define['amd']) { - define(function() { return lib$es6$promise$umd$$ES6Promise; }); - } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = lib$es6$promise$umd$$ES6Promise; - } else if (typeof this !== 'undefined') { - this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; - } - - lib$es6$promise$polyfill$$default(); -}).call(this); - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js deleted file mode 100644 index 0552e12e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/es6-promise.min.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * @overview es6-promise - a tiny implementation of Promises/A+. - * @copyright Copyright (c) 2014 Yehuda Katz, Tom Dale, Stefan Penner and contributors (Conversion to ES6 API by Jake Archibald) - * @license Licensed under MIT license - * See https://raw.githubusercontent.com/jakearchibald/es6-promise/master/LICENSE - * @version 2.1.1 - */ - -(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;i -// -// 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 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. - -// when used in node, this will actually load the util module we depend on -// versus loading the builtin util module as happens otherwise -// this is a bug in node module loading as far as I am concerned -var util = require('util/'); - -var pSlice = Array.prototype.slice; -var hasOwn = Object.prototype.hasOwnProperty; - -// 1. The assert module provides functions that throw -// AssertionError's when particular conditions are not met. The -// assert module must conform to the following interface. - -var assert = module.exports = ok; - -// 2. The AssertionError is defined in assert. -// new assert.AssertionError({ message: message, -// actual: actual, -// expected: expected }) - -assert.AssertionError = function AssertionError(options) { - this.name = 'AssertionError'; - this.actual = options.actual; - this.expected = options.expected; - this.operator = options.operator; - if (options.message) { - this.message = options.message; - this.generatedMessage = false; - } else { - this.message = getMessage(this); - this.generatedMessage = true; - } - var stackStartFunction = options.stackStartFunction || fail; - - if (Error.captureStackTrace) { - Error.captureStackTrace(this, stackStartFunction); - } - else { - // non v8 browsers so we can have a stacktrace - var err = new Error(); - if (err.stack) { - var out = err.stack; - - // try to strip useless frames - var fn_name = stackStartFunction.name; - var idx = out.indexOf('\n' + fn_name); - if (idx >= 0) { - // once we have located the function frame - // we need to strip out everything before it (and its line) - var next_line = out.indexOf('\n', idx + 1); - out = out.substring(next_line + 1); - } - - this.stack = out; - } - } -}; - -// assert.AssertionError instanceof Error -util.inherits(assert.AssertionError, Error); - -function replacer(key, value) { - if (util.isUndefined(value)) { - return '' + value; - } - if (util.isNumber(value) && (isNaN(value) || !isFinite(value))) { - return value.toString(); - } - if (util.isFunction(value) || util.isRegExp(value)) { - return value.toString(); - } - return value; -} - -function truncate(s, n) { - if (util.isString(s)) { - return s.length < n ? s : s.slice(0, n); - } else { - return s; - } -} - -function getMessage(self) { - return truncate(JSON.stringify(self.actual, replacer), 128) + ' ' + - self.operator + ' ' + - truncate(JSON.stringify(self.expected, replacer), 128); -} - -// At present only the three keys mentioned above are used and -// understood by the spec. Implementations or sub modules can pass -// other keys to the AssertionError's constructor - they will be -// ignored. - -// 3. All of the following functions must throw an AssertionError -// when a corresponding condition is not met, with a message that -// may be undefined if not provided. All assertion methods provide -// both the actual and expected values to the assertion error for -// display purposes. - -function fail(actual, expected, message, operator, stackStartFunction) { - throw new assert.AssertionError({ - message: message, - actual: actual, - expected: expected, - operator: operator, - stackStartFunction: stackStartFunction - }); -} - -// EXTENSION! allows for well behaved errors defined elsewhere. -assert.fail = fail; - -// 4. Pure assertion tests whether a value is truthy, as determined -// by !!guard. -// assert.ok(guard, message_opt); -// This statement is equivalent to assert.equal(true, !!guard, -// message_opt);. To test strictly for the value true, use -// assert.strictEqual(true, guard, message_opt);. - -function ok(value, message) { - if (!value) fail(value, true, message, '==', assert.ok); -} -assert.ok = ok; - -// 5. The equality assertion tests shallow, coercive equality with -// ==. -// assert.equal(actual, expected, message_opt); - -assert.equal = function equal(actual, expected, message) { - if (actual != expected) fail(actual, expected, message, '==', assert.equal); -}; - -// 6. The non-equality assertion tests for whether two objects are not equal -// with != assert.notEqual(actual, expected, message_opt); - -assert.notEqual = function notEqual(actual, expected, message) { - if (actual == expected) { - fail(actual, expected, message, '!=', assert.notEqual); - } -}; - -// 7. The equivalence assertion tests a deep equality relation. -// assert.deepEqual(actual, expected, message_opt); - -assert.deepEqual = function deepEqual(actual, expected, message) { - if (!_deepEqual(actual, expected)) { - fail(actual, expected, message, 'deepEqual', assert.deepEqual); - } -}; - -function _deepEqual(actual, expected) { - // 7.1. All identical values are equivalent, as determined by ===. - if (actual === expected) { - return true; - - } else if (util.isBuffer(actual) && util.isBuffer(expected)) { - if (actual.length != expected.length) return false; - - for (var i = 0; i < actual.length; i++) { - if (actual[i] !== expected[i]) return false; - } - - return true; - - // 7.2. If the expected value is a Date object, the actual value is - // equivalent if it is also a Date object that refers to the same time. - } else if (util.isDate(actual) && util.isDate(expected)) { - return actual.getTime() === expected.getTime(); - - // 7.3 If the expected value is a RegExp object, the actual value is - // equivalent if it is also a RegExp object with the same source and - // properties (`global`, `multiline`, `lastIndex`, `ignoreCase`). - } else if (util.isRegExp(actual) && util.isRegExp(expected)) { - return actual.source === expected.source && - actual.global === expected.global && - actual.multiline === expected.multiline && - actual.lastIndex === expected.lastIndex && - actual.ignoreCase === expected.ignoreCase; - - // 7.4. Other pairs that do not both pass typeof value == 'object', - // equivalence is determined by ==. - } else if (!util.isObject(actual) && !util.isObject(expected)) { - return actual == expected; - - // 7.5 For all other Object pairs, including Array objects, equivalence is - // determined by having the same number of owned properties (as verified - // with Object.prototype.hasOwnProperty.call), the same set of keys - // (although not necessarily the same order), equivalent values for every - // corresponding key, and an identical 'prototype' property. Note: this - // accounts for both named and indexed properties on Arrays. - } else { - return objEquiv(actual, expected); - } -} - -function isArguments(object) { - return Object.prototype.toString.call(object) == '[object Arguments]'; -} - -function objEquiv(a, b) { - if (util.isNullOrUndefined(a) || util.isNullOrUndefined(b)) - return false; - // an identical 'prototype' property. - if (a.prototype !== b.prototype) return false; - //~~~I've managed to break Object.keys through screwy arguments passing. - // Converting to array solves the problem. - if (isArguments(a)) { - if (!isArguments(b)) { - return false; - } - a = pSlice.call(a); - b = pSlice.call(b); - return _deepEqual(a, b); - } - try { - var ka = objectKeys(a), - kb = objectKeys(b), - key, i; - } catch (e) {//happens when one is a string literal and the other isn't - return false; - } - // having the same number of owned properties (keys incorporates - // hasOwnProperty) - if (ka.length != kb.length) - return false; - //the same set of keys (although not necessarily the same order), - ka.sort(); - kb.sort(); - //~~~cheap key test - for (i = ka.length - 1; i >= 0; i--) { - if (ka[i] != kb[i]) - return false; - } - //equivalent values for every corresponding key, and - //~~~possibly expensive deep test - for (i = ka.length - 1; i >= 0; i--) { - key = ka[i]; - if (!_deepEqual(a[key], b[key])) return false; - } - return true; -} - -// 8. The non-equivalence assertion tests for any deep inequality. -// assert.notDeepEqual(actual, expected, message_opt); - -assert.notDeepEqual = function notDeepEqual(actual, expected, message) { - if (_deepEqual(actual, expected)) { - fail(actual, expected, message, 'notDeepEqual', assert.notDeepEqual); - } -}; - -// 9. The strict equality assertion tests strict equality, as determined by ===. -// assert.strictEqual(actual, expected, message_opt); - -assert.strictEqual = function strictEqual(actual, expected, message) { - if (actual !== expected) { - fail(actual, expected, message, '===', assert.strictEqual); - } -}; - -// 10. The strict non-equality assertion tests for strict inequality, as -// determined by !==. assert.notStrictEqual(actual, expected, message_opt); - -assert.notStrictEqual = function notStrictEqual(actual, expected, message) { - if (actual === expected) { - fail(actual, expected, message, '!==', assert.notStrictEqual); - } -}; - -function expectedException(actual, expected) { - if (!actual || !expected) { - return false; - } - - if (Object.prototype.toString.call(expected) == '[object RegExp]') { - return expected.test(actual); - } else if (actual instanceof expected) { - return true; - } else if (expected.call({}, actual) === true) { - return true; - } - - return false; -} - -function _throws(shouldThrow, block, expected, message) { - var actual; - - if (util.isString(expected)) { - message = expected; - expected = null; - } - - try { - block(); - } catch (e) { - actual = e; - } - - message = (expected && expected.name ? ' (' + expected.name + ').' : '.') + - (message ? ' ' + message : '.'); - - if (shouldThrow && !actual) { - fail(actual, expected, 'Missing expected exception' + message); - } - - if (!shouldThrow && expectedException(actual, expected)) { - fail(actual, expected, 'Got unwanted exception' + message); - } - - if ((shouldThrow && actual && expected && - !expectedException(actual, expected)) || (!shouldThrow && actual)) { - throw actual; - } -} - -// 11. Expected to throw an error: -// assert.throws(block, Error_opt, message_opt); - -assert.throws = function(block, /*optional*/error, /*optional*/message) { - _throws.apply(this, [true].concat(pSlice.call(arguments))); -}; - -// EXTENSION! This is annoying to write outside this module. -assert.doesNotThrow = function(block, /*optional*/message) { - _throws.apply(this, [false].concat(pSlice.call(arguments))); -}; - -assert.ifError = function(err) { if (err) {throw err;}}; - -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) { - if (hasOwn.call(obj, key)) keys.push(key); - } - return keys; -}; - -},{"util/":6}],3:[function(require,module,exports){ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} - -},{}],4:[function(require,module,exports){ -// shim for using process in browser - -var process = module.exports = {}; - -process.nextTick = (function () { - var canSetImmediate = typeof window !== 'undefined' - && window.setImmediate; - var canMutationObserver = typeof window !== 'undefined' - && window.MutationObserver; - var canPost = typeof window !== 'undefined' - && window.postMessage && window.addEventListener - ; - - if (canSetImmediate) { - return function (f) { return window.setImmediate(f) }; - } - - var queue = []; - - if (canMutationObserver) { - var hiddenDiv = document.createElement("div"); - var observer = new MutationObserver(function () { - var queueList = queue.slice(); - queue.length = 0; - queueList.forEach(function (fn) { - fn(); - }); - }); - - observer.observe(hiddenDiv, { attributes: true }); - - return function nextTick(fn) { - if (!queue.length) { - hiddenDiv.setAttribute('yes', 'no'); - } - queue.push(fn); - }; - } - - if (canPost) { - window.addEventListener('message', function (ev) { - var source = ev.source; - if ((source === window || source === null) && ev.data === 'process-tick') { - ev.stopPropagation(); - if (queue.length > 0) { - var fn = queue.shift(); - fn(); - } - } - }, true); - - return function nextTick(fn) { - queue.push(fn); - window.postMessage('process-tick', '*'); - }; - } - - return function nextTick(fn) { - setTimeout(fn, 0); - }; -})(); - -process.title = 'browser'; -process.browser = true; -process.env = {}; -process.argv = []; - -function noop() {} - -process.on = noop; -process.addListener = noop; -process.once = noop; -process.off = noop; -process.removeListener = noop; -process.removeAllListeners = noop; -process.emit = noop; - -process.binding = function (name) { - throw new Error('process.binding is not supported'); -}; - -// TODO(shtylman) -process.cwd = function () { return '/' }; -process.chdir = function (dir) { - throw new Error('process.chdir is not supported'); -}; - -},{}],5:[function(require,module,exports){ -module.exports = function isBuffer(arg) { - return arg && typeof arg === 'object' - && typeof arg.copy === 'function' - && typeof arg.fill === 'function' - && typeof arg.readUInt8 === 'function'; -} -},{}],6:[function(require,module,exports){ -(function (process,global){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var formatRegExp = /%[sdj%]/g; -exports.format = function(f) { - if (!isString(f)) { - var objects = []; - for (var i = 0; i < arguments.length; i++) { - objects.push(inspect(arguments[i])); - } - return objects.join(' '); - } - - var i = 1; - var args = arguments; - var len = args.length; - var str = String(f).replace(formatRegExp, function(x) { - if (x === '%%') return '%'; - if (i >= len) return x; - switch (x) { - case '%s': return String(args[i++]); - case '%d': return Number(args[i++]); - case '%j': - try { - return JSON.stringify(args[i++]); - } catch (_) { - return '[Circular]'; - } - default: - return x; - } - }); - for (var x = args[i]; i < len; x = args[++i]) { - if (isNull(x) || !isObject(x)) { - str += ' ' + x; - } else { - str += ' ' + inspect(x); - } - } - return str; -}; - - -// Mark that a method should not be used. -// Returns a modified function which warns once by default. -// If --no-deprecation is set, then it is a no-op. -exports.deprecate = function(fn, msg) { - // Allow for deprecating things in the process of starting up. - if (isUndefined(global.process)) { - return function() { - return exports.deprecate(fn, msg).apply(this, arguments); - }; - } - - if (process.noDeprecation === true) { - return fn; - } - - var warned = false; - function deprecated() { - if (!warned) { - if (process.throwDeprecation) { - throw new Error(msg); - } else if (process.traceDeprecation) { - console.trace(msg); - } else { - console.error(msg); - } - warned = true; - } - return fn.apply(this, arguments); - } - - return deprecated; -}; - - -var debugs = {}; -var debugEnviron; -exports.debuglog = function(set) { - if (isUndefined(debugEnviron)) - debugEnviron = process.env.NODE_DEBUG || ''; - set = set.toUpperCase(); - if (!debugs[set]) { - if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { - var pid = process.pid; - debugs[set] = function() { - var msg = exports.format.apply(exports, arguments); - console.error('%s %d: %s', set, pid, msg); - }; - } else { - debugs[set] = function() {}; - } - } - return debugs[set]; -}; - - -/** - * Echos the value of a value. Trys to print the value out - * in the best way possible given the different types. - * - * @param {Object} obj The object to print out. - * @param {Object} opts Optional options object that alters the output. - */ -/* legacy: obj, showHidden, depth, colors*/ -function inspect(obj, opts) { - // default options - var ctx = { - seen: [], - stylize: stylizeNoColor - }; - // legacy... - if (arguments.length >= 3) ctx.depth = arguments[2]; - if (arguments.length >= 4) ctx.colors = arguments[3]; - if (isBoolean(opts)) { - // legacy... - ctx.showHidden = opts; - } else if (opts) { - // got an "options" object - exports._extend(ctx, opts); - } - // set default options - if (isUndefined(ctx.showHidden)) ctx.showHidden = false; - if (isUndefined(ctx.depth)) ctx.depth = 2; - if (isUndefined(ctx.colors)) ctx.colors = false; - if (isUndefined(ctx.customInspect)) ctx.customInspect = true; - if (ctx.colors) ctx.stylize = stylizeWithColor; - return formatValue(ctx, obj, ctx.depth); -} -exports.inspect = inspect; - - -// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics -inspect.colors = { - 'bold' : [1, 22], - 'italic' : [3, 23], - 'underline' : [4, 24], - 'inverse' : [7, 27], - 'white' : [37, 39], - 'grey' : [90, 39], - 'black' : [30, 39], - 'blue' : [34, 39], - 'cyan' : [36, 39], - 'green' : [32, 39], - 'magenta' : [35, 39], - 'red' : [31, 39], - 'yellow' : [33, 39] -}; - -// Don't use 'blue' not visible on cmd.exe -inspect.styles = { - 'special': 'cyan', - 'number': 'yellow', - 'boolean': 'yellow', - 'undefined': 'grey', - 'null': 'bold', - 'string': 'green', - 'date': 'magenta', - // "name": intentionally not styling - 'regexp': 'red' -}; - - -function stylizeWithColor(str, styleType) { - var style = inspect.styles[styleType]; - - if (style) { - return '\u001b[' + inspect.colors[style][0] + 'm' + str + - '\u001b[' + inspect.colors[style][1] + 'm'; - } else { - return str; - } -} - - -function stylizeNoColor(str, styleType) { - return str; -} - - -function arrayToHash(array) { - var hash = {}; - - array.forEach(function(val, idx) { - hash[val] = true; - }); - - return hash; -} - - -function formatValue(ctx, value, recurseTimes) { - // Provide a hook for user-specified inspect functions. - // Check that value is an object with an inspect function on it - if (ctx.customInspect && - value && - isFunction(value.inspect) && - // Filter out the util module, it's inspect function is special - value.inspect !== exports.inspect && - // Also filter out any prototype objects using the circular check. - !(value.constructor && value.constructor.prototype === value)) { - var ret = value.inspect(recurseTimes, ctx); - if (!isString(ret)) { - ret = formatValue(ctx, ret, recurseTimes); - } - return ret; - } - - // Primitive types cannot have properties - var primitive = formatPrimitive(ctx, value); - if (primitive) { - return primitive; - } - - // Look up the keys of the object. - var keys = Object.keys(value); - var visibleKeys = arrayToHash(keys); - - if (ctx.showHidden) { - keys = Object.getOwnPropertyNames(value); - } - - // IE doesn't make error fields non-enumerable - // http://msdn.microsoft.com/en-us/library/ie/dww52sbt(v=vs.94).aspx - if (isError(value) - && (keys.indexOf('message') >= 0 || keys.indexOf('description') >= 0)) { - return formatError(value); - } - - // Some type of object without properties can be shortcutted. - if (keys.length === 0) { - if (isFunction(value)) { - var name = value.name ? ': ' + value.name : ''; - return ctx.stylize('[Function' + name + ']', 'special'); - } - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } - if (isDate(value)) { - return ctx.stylize(Date.prototype.toString.call(value), 'date'); - } - if (isError(value)) { - return formatError(value); - } - } - - var base = '', array = false, braces = ['{', '}']; - - // Make Array say that they are Array - if (isArray(value)) { - array = true; - braces = ['[', ']']; - } - - // Make functions say that they are functions - if (isFunction(value)) { - var n = value.name ? ': ' + value.name : ''; - base = ' [Function' + n + ']'; - } - - // Make RegExps say that they are RegExps - if (isRegExp(value)) { - base = ' ' + RegExp.prototype.toString.call(value); - } - - // Make dates with properties first say the date - if (isDate(value)) { - base = ' ' + Date.prototype.toUTCString.call(value); - } - - // Make error with message first say the error - if (isError(value)) { - base = ' ' + formatError(value); - } - - if (keys.length === 0 && (!array || value.length == 0)) { - return braces[0] + base + braces[1]; - } - - if (recurseTimes < 0) { - if (isRegExp(value)) { - return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); - } else { - return ctx.stylize('[Object]', 'special'); - } - } - - ctx.seen.push(value); - - var output; - if (array) { - output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); - } else { - output = keys.map(function(key) { - return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); - }); - } - - ctx.seen.pop(); - - return reduceToSingleString(output, base, braces); -} - - -function formatPrimitive(ctx, value) { - if (isUndefined(value)) - return ctx.stylize('undefined', 'undefined'); - if (isString(value)) { - var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') - .replace(/'/g, "\\'") - .replace(/\\"/g, '"') + '\''; - return ctx.stylize(simple, 'string'); - } - if (isNumber(value)) - return ctx.stylize('' + value, 'number'); - if (isBoolean(value)) - return ctx.stylize('' + value, 'boolean'); - // For some reason typeof null is "object", so special case here. - if (isNull(value)) - return ctx.stylize('null', 'null'); -} - - -function formatError(value) { - return '[' + Error.prototype.toString.call(value) + ']'; -} - - -function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { - var output = []; - for (var i = 0, l = value.length; i < l; ++i) { - if (hasOwnProperty(value, String(i))) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - String(i), true)); - } else { - output.push(''); - } - } - keys.forEach(function(key) { - if (!key.match(/^\d+$/)) { - output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, - key, true)); - } - }); - return output; -} - - -function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { - var name, str, desc; - desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; - if (desc.get) { - if (desc.set) { - str = ctx.stylize('[Getter/Setter]', 'special'); - } else { - str = ctx.stylize('[Getter]', 'special'); - } - } else { - if (desc.set) { - str = ctx.stylize('[Setter]', 'special'); - } - } - if (!hasOwnProperty(visibleKeys, key)) { - name = '[' + key + ']'; - } - if (!str) { - if (ctx.seen.indexOf(desc.value) < 0) { - if (isNull(recurseTimes)) { - str = formatValue(ctx, desc.value, null); - } else { - str = formatValue(ctx, desc.value, recurseTimes - 1); - } - if (str.indexOf('\n') > -1) { - if (array) { - str = str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n').substr(2); - } else { - str = '\n' + str.split('\n').map(function(line) { - return ' ' + line; - }).join('\n'); - } - } - } else { - str = ctx.stylize('[Circular]', 'special'); - } - } - if (isUndefined(name)) { - if (array && key.match(/^\d+$/)) { - return str; - } - name = JSON.stringify('' + key); - if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { - name = name.substr(1, name.length - 2); - name = ctx.stylize(name, 'name'); - } else { - name = name.replace(/'/g, "\\'") - .replace(/\\"/g, '"') - .replace(/(^"|"$)/g, "'"); - name = ctx.stylize(name, 'string'); - } - } - - return name + ': ' + str; -} - - -function reduceToSingleString(output, base, braces) { - var numLinesEst = 0; - var length = output.reduce(function(prev, cur) { - numLinesEst++; - if (cur.indexOf('\n') >= 0) numLinesEst++; - return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; - }, 0); - - if (length > 60) { - return braces[0] + - (base === '' ? '' : base + '\n ') + - ' ' + - output.join(',\n ') + - ' ' + - braces[1]; - } - - return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; -} - - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -exports.isBuffer = require('./support/isBuffer'); - -function objectToString(o) { - return Object.prototype.toString.call(o); -} - - -function pad(n) { - return n < 10 ? '0' + n.toString(10) : n.toString(10); -} - - -var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', - 'Oct', 'Nov', 'Dec']; - -// 26 Feb 16:19:34 -function timestamp() { - var d = new Date(); - var time = [pad(d.getHours()), - pad(d.getMinutes()), - pad(d.getSeconds())].join(':'); - return [d.getDate(), months[d.getMonth()], time].join(' '); -} - - -// log is just a thin wrapper to console.log that prepends a timestamp -exports.log = function() { - console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); -}; - - -/** - * Inherit the prototype methods from one constructor into another. - * - * The Function.prototype.inherits from lang.js rewritten as a standalone - * function (not on Function.prototype). NOTE: If this file is to be loaded - * during bootstrapping this function needs to be rewritten using some native - * functions as prototype setup using normal JavaScript does not work as - * expected during bootstrapping (see mirror.js in r114903). - * - * @param {function} ctor Constructor function which needs to inherit the - * prototype. - * @param {function} superCtor Constructor function to inherit prototype from. - */ -exports.inherits = require('inherits'); - -exports._extend = function(origin, add) { - // Don't do anything if add isn't an object - if (!add || !isObject(add)) return origin; - - var keys = Object.keys(add); - var i = keys.length; - while (i--) { - origin[keys[i]] = add[keys[i]]; - } - return origin; -}; - -function hasOwnProperty(obj, prop) { - return Object.prototype.hasOwnProperty.call(obj, prop); -} - -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./support/isBuffer":5,"_process":4,"inherits":3}],7:[function(require,module,exports){ -require("./tests/2.1.2"); -require("./tests/2.1.3"); -require("./tests/2.2.1"); -require("./tests/2.2.2"); -require("./tests/2.2.3"); -require("./tests/2.2.4"); -require("./tests/2.2.5"); -require("./tests/2.2.6"); -require("./tests/2.2.7"); -require("./tests/2.3.1"); -require("./tests/2.3.2"); -require("./tests/2.3.3"); -require("./tests/2.3.4"); - -},{"./tests/2.1.2":8,"./tests/2.1.3":9,"./tests/2.2.1":10,"./tests/2.2.2":11,"./tests/2.2.3":12,"./tests/2.2.4":13,"./tests/2.2.5":14,"./tests/2.2.6":15,"./tests/2.2.7":16,"./tests/2.3.1":17,"./tests/2.3.2":18,"./tests/2.3.3":19,"./tests/2.3.4":20}],8:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; - -var adapter = global.adapter; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.1.2.1: When fulfilled, a promise: must not transition to any other state.", function () { - testFulfilled(dummy, function (promise, done) { - var onFulfilledCalled = false; - - promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - setTimeout(done, 100); - }); - - specify("trying to fulfill then immediately reject", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - d.resolve(dummy); - d.reject(dummy); - setTimeout(done, 100); - }); - - specify("trying to fulfill then reject, delayed", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - setTimeout(function () { - d.resolve(dummy); - d.reject(dummy); - }, 50); - setTimeout(done, 100); - }); - - specify("trying to fulfill immediately then reject delayed", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }, function onRejected() { - assert.strictEqual(onFulfilledCalled, false); - done(); - }); - - d.resolve(dummy); - setTimeout(function () { - d.reject(dummy); - }, 50); - setTimeout(done, 100); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],9:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testRejected = require("./helpers/testThreeCases").testRejected; - -var adapter = global.adapter; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.1.3.1: When rejected, a promise: must not transition to any other state.", function () { - testRejected(dummy, function (promise, done) { - var onRejectedCalled = false; - - promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - setTimeout(done, 100); - }); - - specify("trying to reject then immediately fulfill", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - d.reject(dummy); - d.resolve(dummy); - setTimeout(done, 100); - }); - - specify("trying to reject then fulfill, delayed", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - setTimeout(function () { - d.reject(dummy); - d.resolve(dummy); - }, 50); - setTimeout(done, 100); - }); - - specify("trying to reject immediately then fulfill delayed", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(onRejectedCalled, false); - done(); - }, function onRejected() { - onRejectedCalled = true; - }); - - d.reject(dummy); - setTimeout(function () { - d.resolve(dummy); - }, 50); - setTimeout(done, 100); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],10:[function(require,module,exports){ -(function (global){ -"use strict"; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.2.1: Both `onFulfilled` and `onRejected` are optional arguments.", function () { - describe("2.2.1.1: If `onFulfilled` is not a function, it must be ignored.", function () { - describe("applied to a directly-rejected promise", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onFulfilled` is " + stringRepresentation, function (done) { - rejected(dummy).then(nonFunction, function () { - done(); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - - describe("applied to a promise rejected and then chained off of", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onFulfilled` is " + stringRepresentation, function (done) { - rejected(dummy).then(function () { }, undefined).then(nonFunction, function () { - done(); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - }); - - describe("2.2.1.2: If `onRejected` is not a function, it must be ignored.", function () { - describe("applied to a directly-fulfilled promise", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onRejected` is " + stringRepresentation, function (done) { - resolved(dummy).then(function () { - done(); - }, nonFunction); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - - describe("applied to a promise fulfilled and then chained off of", function () { - function testNonFunction(nonFunction, stringRepresentation) { - specify("`onFulfilled` is " + stringRepresentation, function (done) { - resolved(dummy).then(undefined, function () { }).then(function () { - done(); - }, nonFunction); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],11:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality - -describe("2.2.2: If `onFulfilled` is a function,", function () { - describe("2.2.2.1: it must be called after `promise` is fulfilled, with `promise`’s fulfillment value as its " + - "first argument.", function () { - testFulfilled(sentinel, function (promise, done) { - promise.then(function onFulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("2.2.2.2: it must not be called before `promise` is fulfilled", function () { - specify("fulfilled after a delay", function (done) { - var d = deferred(); - var isFulfilled = false; - - d.promise.then(function onFulfilled() { - assert.strictEqual(isFulfilled, true); - done(); - }); - - setTimeout(function () { - d.resolve(dummy); - isFulfilled = true; - }, 50); - }); - - specify("never fulfilled", function (done) { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - done(); - }); - - setTimeout(function () { - assert.strictEqual(onFulfilledCalled, false); - done(); - }, 150); - }); - }); - - describe("2.2.2.3: it must not be called more than once.", function () { - specify("already-fulfilled", function (done) { - var timesCalled = 0; - - resolved(dummy).then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - }); - - specify("trying to fulfill a pending promise more than once, immediately", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.resolve(dummy); - d.resolve(dummy); - }); - - specify("trying to fulfill a pending promise more than once, delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - setTimeout(function () { - d.resolve(dummy); - d.resolve(dummy); - }, 50); - }); - - specify("trying to fulfill a pending promise more than once, immediately then delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.resolve(dummy); - setTimeout(function () { - d.resolve(dummy); - }, 50); - }); - - specify("when multiple `then` calls are made, spaced apart in time", function (done) { - var d = deferred(); - var timesCalled = [0, 0, 0]; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[0], 1); - }); - - setTimeout(function () { - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[1], 1); - }); - }, 50); - - setTimeout(function () { - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[2], 1); - done(); - }); - }, 100); - - setTimeout(function () { - d.resolve(dummy); - }, 150); - }); - - specify("when `then` is interleaved with fulfillment", function (done) { - var d = deferred(); - var timesCalled = [0, 0]; - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[0], 1); - }); - - d.resolve(dummy); - - d.promise.then(function onFulfilled() { - assert.strictEqual(++timesCalled[1], 1); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],12:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testRejected = require("./helpers/testThreeCases").testRejected; - -var adapter = global.adapter; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality - -describe("2.2.3: If `onRejected` is a function,", function () { - describe("2.2.3.1: it must be called after `promise` is rejected, with `promise`’s rejection reason as its " + - "first argument.", function () { - testRejected(sentinel, function (promise, done) { - promise.then(null, function onRejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("2.2.3.2: it must not be called before `promise` is rejected", function () { - specify("rejected after a delay", function (done) { - var d = deferred(); - var isRejected = false; - - d.promise.then(null, function onRejected() { - assert.strictEqual(isRejected, true); - done(); - }); - - setTimeout(function () { - d.reject(dummy); - isRejected = true; - }, 50); - }); - - specify("never rejected", function (done) { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(null, function onRejected() { - onRejectedCalled = true; - done(); - }); - - setTimeout(function () { - assert.strictEqual(onRejectedCalled, false); - done(); - }, 150); - }); - }); - - describe("2.2.3.3: it must not be called more than once.", function () { - specify("already-rejected", function (done) { - var timesCalled = 0; - - rejected(dummy).then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - }); - - specify("trying to reject a pending promise more than once, immediately", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.reject(dummy); - d.reject(dummy); - }); - - specify("trying to reject a pending promise more than once, delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - setTimeout(function () { - d.reject(dummy); - d.reject(dummy); - }, 50); - }); - - specify("trying to reject a pending promise more than once, immediately then delayed", function (done) { - var d = deferred(); - var timesCalled = 0; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled, 1); - done(); - }); - - d.reject(dummy); - setTimeout(function () { - d.reject(dummy); - }, 50); - }); - - specify("when multiple `then` calls are made, spaced apart in time", function (done) { - var d = deferred(); - var timesCalled = [0, 0, 0]; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[0], 1); - }); - - setTimeout(function () { - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[1], 1); - }); - }, 50); - - setTimeout(function () { - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[2], 1); - done(); - }); - }, 100); - - setTimeout(function () { - d.reject(dummy); - }, 150); - }); - - specify("when `then` is interleaved with rejection", function (done) { - var d = deferred(); - var timesCalled = [0, 0]; - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[0], 1); - }); - - d.reject(dummy); - - d.promise.then(null, function onRejected() { - assert.strictEqual(++timesCalled[1], 1); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],13:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.2.4: `onFulfilled` or `onRejected` must not be called until the execution context stack contains only " + - "platform code.", function () { - describe("`then` returns before the promise becomes fulfilled or rejected", function () { - testFulfilled(dummy, function (promise, done) { - var thenHasReturned = false; - - promise.then(function onFulfilled() { - assert.strictEqual(thenHasReturned, true); - done(); - }); - - thenHasReturned = true; - }); - testRejected(dummy, function (promise, done) { - var thenHasReturned = false; - - promise.then(null, function onRejected() { - assert.strictEqual(thenHasReturned, true); - done(); - }); - - thenHasReturned = true; - }); - }); - - describe("Clean-stack execution ordering tests (fulfillment case)", function () { - specify("when `onFulfilled` is added immediately before the promise is fulfilled", - function () { - var d = deferred(); - var onFulfilledCalled = false; - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }); - - d.resolve(dummy); - - assert.strictEqual(onFulfilledCalled, false); - }); - - specify("when `onFulfilled` is added immediately after the promise is fulfilled", - function () { - var d = deferred(); - var onFulfilledCalled = false; - - d.resolve(dummy); - - d.promise.then(function onFulfilled() { - onFulfilledCalled = true; - }); - - assert.strictEqual(onFulfilledCalled, false); - }); - - specify("when one `onFulfilled` is added inside another `onFulfilled`", function (done) { - var promise = resolved(); - var firstOnFulfilledFinished = false; - - promise.then(function () { - promise.then(function () { - assert.strictEqual(firstOnFulfilledFinished, true); - done(); - }); - firstOnFulfilledFinished = true; - }); - }); - - specify("when `onFulfilled` is added inside an `onRejected`", function (done) { - var promise = rejected(); - var promise2 = resolved(); - var firstOnRejectedFinished = false; - - promise.then(null, function () { - promise2.then(function () { - assert.strictEqual(firstOnRejectedFinished, true); - done(); - }); - firstOnRejectedFinished = true; - }); - }); - - specify("when the promise is fulfilled asynchronously", function (done) { - var d = deferred(); - var firstStackFinished = false; - - setTimeout(function () { - d.resolve(dummy); - firstStackFinished = true; - }, 0); - - d.promise.then(function () { - assert.strictEqual(firstStackFinished, true); - done(); - }); - }); - }); - - describe("Clean-stack execution ordering tests (rejection case)", function () { - specify("when `onRejected` is added immediately before the promise is rejected", - function () { - var d = deferred(); - var onRejectedCalled = false; - - d.promise.then(null, function onRejected() { - onRejectedCalled = true; - }); - - d.reject(dummy); - - assert.strictEqual(onRejectedCalled, false); - }); - - specify("when `onRejected` is added immediately after the promise is rejected", - function () { - var d = deferred(); - var onRejectedCalled = false; - - d.reject(dummy); - - d.promise.then(null, function onRejected() { - onRejectedCalled = true; - }); - - assert.strictEqual(onRejectedCalled, false); - }); - - specify("when `onRejected` is added inside an `onFulfilled`", function (done) { - var promise = resolved(); - var promise2 = rejected(); - var firstOnFulfilledFinished = false; - - promise.then(function () { - promise2.then(null, function () { - assert.strictEqual(firstOnFulfilledFinished, true); - done(); - }); - firstOnFulfilledFinished = true; - }); - }); - - specify("when one `onRejected` is added inside another `onRejected`", function (done) { - var promise = rejected(); - var firstOnRejectedFinished = false; - - promise.then(null, function () { - promise.then(null, function () { - assert.strictEqual(firstOnRejectedFinished, true); - done(); - }); - firstOnRejectedFinished = true; - }); - }); - - specify("when the promise is rejected asynchronously", function (done) { - var d = deferred(); - var firstStackFinished = false; - - setTimeout(function () { - d.reject(dummy); - firstStackFinished = true; - }, 0); - - d.promise.then(null, function () { - assert.strictEqual(firstStackFinished, true); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/testThreeCases":22,"assert":2}],14:[function(require,module,exports){ -(function (global){ -/*jshint strict: false */ - -var assert = require("assert"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -function impimentsUseStrictCorrectly() { - "use strict"; - function test() { - /*jshint validthis:true */ - return !this; - } - return test(); -} -describe("2.2.5 `onFulfilled` and `onRejected` must be called as functions (i.e. with no `this` value).", function () { - if (impimentsUseStrictCorrectly()) { - describe("strict mode", function () { - specify("fulfilled", function (done) { - resolved(dummy).then(function onFulfilled() { - "use strict"; - - assert.strictEqual(this, undefined); - done(); - }); - }); - - specify("rejected", function (done) { - rejected(dummy).then(null, function onRejected() { - "use strict"; - - assert.strictEqual(this, undefined); - done(); - }); - }); - }); - } - describe("sloppy mode", function () { - specify("fulfilled", function (done) { - resolved(dummy).then(function onFulfilled() { - assert.strictEqual(this, global); - done(); - }); - }); - - specify("rejected", function (done) { - rejected(dummy).then(null, function onRejected() { - assert.strictEqual(this, global); - done(); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],15:[function(require,module,exports){ -"use strict"; - -var assert = require("assert"); -var sinon = require("sinon"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var other = { other: "other" }; // a value we don't want to be strict equal to -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality -var sentinel2 = { sentinel2: "sentinel2" }; -var sentinel3 = { sentinel3: "sentinel3" }; - -function callbackAggregator(times, ultimateCallback) { - var soFar = 0; - return function () { - if (++soFar === times) { - ultimateCallback(); - } - }; -} - -describe("2.2.6: `then` may be called multiple times on the same promise.", function () { - describe("2.2.6.1: If/when `promise` is fulfilled, all respective `onFulfilled` callbacks must execute in the " + - "order of their originating calls to `then`.", function () { - describe("multiple boring fulfillment handlers", function () { - testFulfilled(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().returns(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(handler1, spy); - promise.then(handler2, spy); - promise.then(handler3, spy); - - promise.then(function (value) { - assert.strictEqual(value, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("multiple fulfillment handlers, one of which throws", function () { - testFulfilled(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().throws(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(handler1, spy); - promise.then(handler2, spy); - promise.then(handler3, spy); - - promise.then(function (value) { - assert.strictEqual(value, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("results in multiple branching chains with their own fulfillment values", function () { - testFulfilled(dummy, function (promise, done) { - var semiDone = callbackAggregator(3, done); - - promise.then(function () { - return sentinel; - }).then(function (value) { - assert.strictEqual(value, sentinel); - semiDone(); - }); - - promise.then(function () { - throw sentinel2; - }).then(null, function (reason) { - assert.strictEqual(reason, sentinel2); - semiDone(); - }); - - promise.then(function () { - return sentinel3; - }).then(function (value) { - assert.strictEqual(value, sentinel3); - semiDone(); - }); - }); - }); - - describe("`onFulfilled` handlers are called in the original order", function () { - testFulfilled(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(handler1); - promise.then(handler2); - promise.then(handler3); - - promise.then(function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }); - }); - - describe("even when one handler is added inside another handler", function () { - testFulfilled(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(function () { - handler1(); - promise.then(handler3); - }); - promise.then(handler2); - - promise.then(function () { - // Give implementations a bit of extra time to flush their internal queue, if necessary. - setTimeout(function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }, 15); - }); - }); - }); - }); - }); - - describe("2.2.6.2: If/when `promise` is rejected, all respective `onRejected` callbacks must execute in the " + - "order of their originating calls to `then`.", function () { - describe("multiple boring rejection handlers", function () { - testRejected(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().returns(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(spy, handler1); - promise.then(spy, handler2); - promise.then(spy, handler3); - - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("multiple rejection handlers, one of which throws", function () { - testRejected(sentinel, function (promise, done) { - var handler1 = sinon.stub().returns(other); - var handler2 = sinon.stub().throws(other); - var handler3 = sinon.stub().returns(other); - - var spy = sinon.spy(); - promise.then(spy, handler1); - promise.then(spy, handler2); - promise.then(spy, handler3); - - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - - sinon.assert.calledWith(handler1, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler2, sinon.match.same(sentinel)); - sinon.assert.calledWith(handler3, sinon.match.same(sentinel)); - sinon.assert.notCalled(spy); - - done(); - }); - }); - }); - - describe("results in multiple branching chains with their own fulfillment values", function () { - testRejected(sentinel, function (promise, done) { - var semiDone = callbackAggregator(3, done); - - promise.then(null, function () { - return sentinel; - }).then(function (value) { - assert.strictEqual(value, sentinel); - semiDone(); - }); - - promise.then(null, function () { - throw sentinel2; - }).then(null, function (reason) { - assert.strictEqual(reason, sentinel2); - semiDone(); - }); - - promise.then(null, function () { - return sentinel3; - }).then(function (value) { - assert.strictEqual(value, sentinel3); - semiDone(); - }); - }); - }); - - describe("`onRejected` handlers are called in the original order", function () { - testRejected(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(null, handler1); - promise.then(null, handler2); - promise.then(null, handler3); - - promise.then(null, function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }); - }); - - describe("even when one handler is added inside another handler", function () { - testRejected(dummy, function (promise, done) { - var handler1 = sinon.spy(function handler1() {}); - var handler2 = sinon.spy(function handler2() {}); - var handler3 = sinon.spy(function handler3() {}); - - promise.then(null, function () { - handler1(); - promise.then(null, handler3); - }); - promise.then(null, handler2); - - promise.then(null, function () { - // Give implementations a bit of extra time to flush their internal queue, if necessary. - setTimeout(function () { - sinon.assert.callOrder(handler1, handler2, handler3); - done(); - }, 15); - }); - }); - }); - }); - }); -}); - -},{"./helpers/testThreeCases":22,"assert":2,"sinon":24}],16:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; -var reasons = require("./helpers/reasons"); - -var adapter = global.adapter; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality -var other = { other: "other" }; // a value we don't want to be strict equal to - -describe("2.2.7: `then` must return a promise: `promise2 = promise1.then(onFulfilled, onRejected)`", function () { - specify("is a promise", function () { - var promise1 = deferred().promise; - var promise2 = promise1.then(); - - assert(typeof promise2 === "object" || typeof promise2 === "function"); - assert.notStrictEqual(promise2, null); - assert.strictEqual(typeof promise2.then, "function"); - }); - - describe("2.2.7.1: If either `onFulfilled` or `onRejected` returns a value `x`, run the Promise Resolution " + - "Procedure `[[Resolve]](promise2, x)`", function () { - specify("see separate 3.3 tests", function () { }); - }); - - describe("2.2.7.2: If either `onFulfilled` or `onRejected` throws an exception `e`, `promise2` must be rejected " + - "with `e` as the reason.", function () { - function testReason(expectedReason, stringRepresentation) { - describe("The reason is " + stringRepresentation, function () { - testFulfilled(dummy, function (promise1, done) { - var promise2 = promise1.then(function onFulfilled() { - throw expectedReason; - }); - - promise2.then(null, function onPromise2Rejected(actualReason) { - assert.strictEqual(actualReason, expectedReason); - done(); - }); - }); - testRejected(dummy, function (promise1, done) { - var promise2 = promise1.then(null, function onRejected() { - throw expectedReason; - }); - - promise2.then(null, function onPromise2Rejected(actualReason) { - assert.strictEqual(actualReason, expectedReason); - done(); - }); - }); - }); - } - - Object.keys(reasons).forEach(function (stringRepresentation) { - testReason(reasons[stringRepresentation], stringRepresentation); - }); - }); - - describe("2.2.7.3: If `onFulfilled` is not a function and `promise1` is fulfilled, `promise2` must be fulfilled " + - "with the same value.", function () { - - function testNonFunction(nonFunction, stringRepresentation) { - describe("`onFulfilled` is " + stringRepresentation, function () { - testFulfilled(sentinel, function (promise1, done) { - var promise2 = promise1.then(nonFunction); - - promise2.then(function onPromise2Fulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - testNonFunction([function () { return other; }], "an array containing a function"); - }); - - describe("2.2.7.4: If `onRejected` is not a function and `promise1` is rejected, `promise2` must be rejected " + - "with the same reason.", function () { - - function testNonFunction(nonFunction, stringRepresentation) { - describe("`onRejected` is " + stringRepresentation, function () { - testRejected(sentinel, function (promise1, done) { - var promise2 = promise1.then(null, nonFunction); - - promise2.then(null, function onPromise2Rejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - } - - testNonFunction(undefined, "`undefined`"); - testNonFunction(null, "`null`"); - testNonFunction(false, "`false`"); - testNonFunction(5, "`5`"); - testNonFunction({}, "an object"); - testNonFunction([function () { return other; }], "an array containing a function"); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/reasons":21,"./helpers/testThreeCases":22,"assert":2}],17:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.3.1: If `promise` and `x` refer to the same object, reject `promise` with a `TypeError' as the reason.", - function () { - specify("via return from a fulfilled promise", function (done) { - var promise = resolved(dummy).then(function () { - return promise; - }); - - promise.then(null, function (reason) { - assert(reason instanceof TypeError); - done(); - }); - }); - - specify("via return from a rejected promise", function (done) { - var promise = rejected(dummy).then(null, function () { - return promise; - }); - - promise.then(null, function (reason) { - assert(reason instanceof TypeError); - done(); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],18:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality - -function testPromiseResolution(xFactory, test) { - specify("via return from a fulfilled promise", function (done) { - var promise = resolved(dummy).then(function onBasePromiseFulfilled() { - return xFactory(); - }); - - test(promise, done); - }); - - specify("via return from a rejected promise", function (done) { - var promise = rejected(dummy).then(null, function onBasePromiseRejected() { - return xFactory(); - }); - - test(promise, done); - }); -} - -describe("2.3.2: If `x` is a promise, adopt its state", function () { - describe("2.3.2.1: If `x` is pending, `promise` must remain pending until `x` is fulfilled or rejected.", - function () { - function xFactory() { - return deferred().promise; - } - - testPromiseResolution(xFactory, function (promise, done) { - var wasFulfilled = false; - var wasRejected = false; - - promise.then( - function onPromiseFulfilled() { - wasFulfilled = true; - }, - function onPromiseRejected() { - wasRejected = true; - } - ); - - setTimeout(function () { - assert.strictEqual(wasFulfilled, false); - assert.strictEqual(wasRejected, false); - done(); - }, 100); - }); - }); - - describe("2.3.2.2: If/when `x` is fulfilled, fulfill `promise` with the same value.", function () { - describe("`x` is already-fulfilled", function () { - function xFactory() { - return resolved(sentinel); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function onPromiseFulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`x` is eventually-fulfilled", function () { - var d = null; - - function xFactory() { - d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - return d.promise; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function onPromiseFulfilled(value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - }); - - describe("2.3.2.3: If/when `x` is rejected, reject `promise` with the same reason.", function () { - describe("`x` is already-rejected", function () { - function xFactory() { - return rejected(sentinel); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function onPromiseRejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`x` is eventually-rejected", function () { - var d = null; - - function xFactory() { - d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - return d.promise; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function onPromiseRejected(reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],19:[function(require,module,exports){ -(function (global){ -"use strict"; - -var assert = require("assert"); -var thenables = require("./helpers/thenables"); -var reasons = require("./helpers/reasons"); - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it -var sentinel = { sentinel: "sentinel" }; // a sentinel fulfillment value to test for with strict equality -var other = { other: "other" }; // a value we don't want to be strict equal to -var sentinelArray = [sentinel]; // a sentinel fulfillment value to test when we need an array - -function testPromiseResolution(xFactory, test) { - specify("via return from a fulfilled promise", function (done) { - var promise = resolved(dummy).then(function onBasePromiseFulfilled() { - return xFactory(); - }); - - test(promise, done); - }); - - specify("via return from a rejected promise", function (done) { - var promise = rejected(dummy).then(null, function onBasePromiseRejected() { - return xFactory(); - }); - - test(promise, done); - }); -} - -function testCallingResolvePromise(yFactory, stringRepresentation, test) { - describe("`y` is " + stringRepresentation, function () { - describe("`then` calls `resolvePromise` synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(yFactory()); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - - describe("`then` calls `resolvePromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - setTimeout(function () { - resolvePromise(yFactory()); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - }); -} - -function testCallingRejectPromise(r, stringRepresentation, test) { - describe("`r` is " + stringRepresentation, function () { - describe("`then` calls `rejectPromise` synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(r); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - - describe("`then` calls `rejectPromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(r); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, test); - }); - }); -} - -function testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, fulfillmentValue) { - testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) { - promise.then(function onPromiseFulfilled(value) { - assert.strictEqual(value, fulfillmentValue); - done(); - }); - }); -} - -function testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, rejectionReason) { - testCallingResolvePromise(yFactory, stringRepresentation, function (promise, done) { - promise.then(null, function onPromiseRejected(reason) { - assert.strictEqual(reason, rejectionReason); - done(); - }); - }); -} - -function testCallingRejectPromiseRejectsWith(reason, stringRepresentation) { - testCallingRejectPromise(reason, stringRepresentation, function (promise, done) { - promise.then(null, function onPromiseRejected(rejectionReason) { - assert.strictEqual(rejectionReason, reason); - done(); - }); - }); -} - -describe("2.3.3: Otherwise, if `x` is an object or function,", function () { - describe("2.3.3.1: Let `then` be `x.then`", function () { - describe("`x` is an object with null prototype", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - return Object.create(null, { - then: { - get: function () { - ++numberOfTimesThenWasRetrieved; - return function thenMethodForX(onFulfilled) { - onFulfilled(); - }; - } - } - }); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - assert.strictEqual(numberOfTimesThenWasRetrieved, 1); - done(); - }); - }); - }); - - describe("`x` is an object with normal Object.prototype", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - return Object.create(Object.prototype, { - then: { - get: function () { - ++numberOfTimesThenWasRetrieved; - return function thenMethodForX(onFulfilled) { - onFulfilled(); - }; - } - } - }); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - assert.strictEqual(numberOfTimesThenWasRetrieved, 1); - done(); - }); - }); - }); - - describe("`x` is a function", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - function x() { } - - Object.defineProperty(x, "then", { - get: function () { - ++numberOfTimesThenWasRetrieved; - return function thenMethodForX(onFulfilled) { - onFulfilled(); - }; - } - }); - - return x; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - assert.strictEqual(numberOfTimesThenWasRetrieved, 1); - done(); - }); - }); - }); - }); - - describe("2.3.3.2: If retrieving the property `x.then` results in a thrown exception `e`, reject `promise` with " + - "`e` as the reason.", function () { - function testRejectionViaThrowingGetter(e, stringRepresentation) { - function xFactory() { - return Object.create(Object.prototype, { - then: { - get: function () { - throw e; - } - } - }); - } - - describe("`e` is " + stringRepresentation, function () { - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, e); - done(); - }); - }); - }); - } - - Object.keys(reasons).forEach(function (stringRepresentation) { - testRejectionViaThrowingGetter(reasons[stringRepresentation], stringRepresentation); - }); - }); - - describe("2.3.3.3: If `then` is a function, call it with `x` as `this`, first argument `resolvePromise`, and " + - "second argument `rejectPromise`", function () { - describe("Calls with `x` as `this` and two function arguments", function () { - function xFactory() { - var x = { - then: function (onFulfilled, onRejected) { - assert.strictEqual(this, x); - assert.strictEqual(typeof onFulfilled, "function"); - assert.strictEqual(typeof onRejected, "function"); - onFulfilled(); - } - }; - return x; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - done(); - }); - }); - }); - - describe("Uses the original value of `then`", function () { - var numberOfTimesThenWasRetrieved = null; - - beforeEach(function () { - numberOfTimesThenWasRetrieved = 0; - }); - - function xFactory() { - return Object.create(Object.prototype, { - then: { - get: function () { - if (numberOfTimesThenWasRetrieved === 0) { - return function (onFulfilled) { - onFulfilled(); - }; - } - return null; - } - } - }); - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function () { - done(); - }); - }); - }); - - describe("2.3.3.3.1: If/when `resolvePromise` is called with value `y`, run `[[Resolve]](promise, y)`", - function () { - describe("`y` is not a thenable", function () { - testCallingResolvePromiseFulfillsWith(function () { return undefined; }, "`undefined`", undefined); - testCallingResolvePromiseFulfillsWith(function () { return null; }, "`null`", null); - testCallingResolvePromiseFulfillsWith(function () { return false; }, "`false`", false); - testCallingResolvePromiseFulfillsWith(function () { return 5; }, "`5`", 5); - testCallingResolvePromiseFulfillsWith(function () { return sentinel; }, "an object", sentinel); - testCallingResolvePromiseFulfillsWith(function () { return sentinelArray; }, "an array", sentinelArray); - }); - - describe("`y` is a thenable", function () { - Object.keys(thenables.fulfilled).forEach(function (stringRepresentation) { - function yFactory() { - return thenables.fulfilled[stringRepresentation](sentinel); - } - - testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel); - }); - - Object.keys(thenables.rejected).forEach(function (stringRepresentation) { - function yFactory() { - return thenables.rejected[stringRepresentation](sentinel); - } - - testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel); - }); - }); - - describe("`y` is a thenable for a thenable", function () { - Object.keys(thenables.fulfilled).forEach(function (outerStringRepresentation) { - var outerThenableFactory = thenables.fulfilled[outerStringRepresentation]; - - Object.keys(thenables.fulfilled).forEach(function (innerStringRepresentation) { - var innerThenableFactory = thenables.fulfilled[innerStringRepresentation]; - - var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation; - - function yFactory() { - return outerThenableFactory(innerThenableFactory(sentinel)); - } - - testCallingResolvePromiseFulfillsWith(yFactory, stringRepresentation, sentinel); - }); - - Object.keys(thenables.rejected).forEach(function (innerStringRepresentation) { - var innerThenableFactory = thenables.rejected[innerStringRepresentation]; - - var stringRepresentation = outerStringRepresentation + " for " + innerStringRepresentation; - - function yFactory() { - return outerThenableFactory(innerThenableFactory(sentinel)); - } - - testCallingResolvePromiseRejectsWith(yFactory, stringRepresentation, sentinel); - }); - }); - }); - }); - - describe("2.3.3.3.2: If/when `rejectPromise` is called with reason `r`, reject `promise` with `r`", - function () { - Object.keys(reasons).forEach(function (stringRepresentation) { - testCallingRejectPromiseRejectsWith(reasons[stringRepresentation], stringRepresentation); - }); - }); - - describe("2.3.3.3.3: If both `resolvePromise` and `rejectPromise` are called, or multiple calls to the same " + - "argument are made, the first call takes precedence, and any further calls are ignored.", - function () { - describe("calling `resolvePromise` then `rejectPromise`, both synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(sentinel); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` synchronously then `rejectPromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(sentinel); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` then `rejectPromise`, both asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - resolvePromise(sentinel); - }, 0); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling " + - "`rejectPromise`, both synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(d.promise); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling " + - "`rejectPromise`, both synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(d.promise); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` then `resolvePromise`, both synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` synchronously then `resolvePromise` asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` then `resolvePromise`, both asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(sentinel); - }, 0); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` twice synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(sentinel); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` twice, first synchronously then asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(sentinel); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` twice, both times asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise) { - setTimeout(function () { - resolvePromise(sentinel); - }, 0); - - setTimeout(function () { - resolvePromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-fulfilled promise, then calling it again, both " + - "times synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("calling `resolvePromise` with an asynchronously-rejected promise, then calling it again, both " + - "times synchronously", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - resolvePromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` twice synchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - rejectPromise(other); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` twice, first synchronously then asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("calling `rejectPromise` twice, both times asynchronously", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(sentinel); - }, 0); - - setTimeout(function () { - rejectPromise(other); - }, 0); - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("saving and abusing `resolvePromise` and `rejectPromise`", function () { - var savedResolvePromise, savedRejectPromise; - - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - savedResolvePromise = resolvePromise; - savedRejectPromise = rejectPromise; - } - }; - } - - beforeEach(function () { - savedResolvePromise = null; - savedRejectPromise = null; - }); - - testPromiseResolution(xFactory, function (promise, done) { - var timesFulfilled = 0; - var timesRejected = 0; - - promise.then( - function () { - ++timesFulfilled; - }, - function () { - ++timesRejected; - } - ); - - if (savedResolvePromise && savedRejectPromise) { - savedResolvePromise(dummy); - savedResolvePromise(dummy); - savedRejectPromise(dummy); - savedRejectPromise(dummy); - } - - setTimeout(function () { - savedResolvePromise(dummy); - savedResolvePromise(dummy); - savedRejectPromise(dummy); - savedRejectPromise(dummy); - }, 50); - - setTimeout(function () { - assert.strictEqual(timesFulfilled, 1); - assert.strictEqual(timesRejected, 0); - done(); - }, 100); - }); - }); - }); - - describe("2.3.3.3.4: If calling `then` throws an exception `e`,", function () { - describe("2.3.3.3.4.1: If `resolvePromise` or `rejectPromise` have been called, ignore it.", function () { - describe("`resolvePromise` was called with a non-thenable", function () { - function xFactory() { - return { - then: function (resolvePromise) { - resolvePromise(sentinel); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` was called with an asynchronously-fulfilled promise", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.resolve(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` was called with an asynchronously-rejected promise", function () { - function xFactory() { - var d = deferred(); - setTimeout(function () { - d.reject(sentinel); - }, 50); - - return { - then: function (resolvePromise) { - resolvePromise(d.promise); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`rejectPromise` was called", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` then `rejectPromise` were called", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - resolvePromise(sentinel); - rejectPromise(other); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, sentinel); - done(); - }); - }); - }); - - describe("`rejectPromise` then `resolvePromise` were called", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - rejectPromise(sentinel); - resolvePromise(other); - throw other; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - }); - - describe("2.3.3.3.4.2: Otherwise, reject `promise` with `e` as the reason.", function () { - describe("straightforward case", function () { - function xFactory() { - return { - then: function () { - throw sentinel; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`resolvePromise` is called asynchronously before the `throw`", function () { - function xFactory() { - return { - then: function (resolvePromise) { - setTimeout(function () { - resolvePromise(other); - }, 0); - throw sentinel; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - - describe("`rejectPromise` is called asynchronously before the `throw`", function () { - function xFactory() { - return { - then: function (resolvePromise, rejectPromise) { - setTimeout(function () { - rejectPromise(other); - }, 0); - throw sentinel; - } - }; - } - - testPromiseResolution(xFactory, function (promise, done) { - promise.then(null, function (reason) { - assert.strictEqual(reason, sentinel); - done(); - }); - }); - }); - }); - }); - }); - - describe("2.3.3.4: If `then` is not a function, fulfill promise with `x`", function () { - function testFulfillViaNonFunction(then, stringRepresentation) { - var x = null; - - beforeEach(function () { - x = { then: then }; - }); - - function xFactory() { - return x; - } - - describe("`then` is " + stringRepresentation, function () { - testPromiseResolution(xFactory, function (promise, done) { - promise.then(function (value) { - assert.strictEqual(value, x); - done(); - }); - }); - }); - } - - testFulfillViaNonFunction(5, "`5`"); - testFulfillViaNonFunction({}, "an object"); - testFulfillViaNonFunction([function () { }], "an array containing a function"); - testFulfillViaNonFunction(/a-b/i, "a regular expression"); - testFulfillViaNonFunction(Object.create(Function.prototype), "an object inheriting from `Function.prototype`"); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./helpers/reasons":21,"./helpers/thenables":23,"assert":2}],20:[function(require,module,exports){ -"use strict"; - -var assert = require("assert"); -var testFulfilled = require("./helpers/testThreeCases").testFulfilled; -var testRejected = require("./helpers/testThreeCases").testRejected; - -var dummy = { dummy: "dummy" }; // we fulfill or reject with this when we don't intend to test against it - -describe("2.3.4: If `x` is not an object or function, fulfill `promise` with `x`", function () { - function testValue(expectedValue, stringRepresentation, beforeEachHook, afterEachHook) { - describe("The value is " + stringRepresentation, function () { - if (typeof beforeEachHook === "function") { - beforeEach(beforeEachHook); - } - if (typeof afterEachHook === "function") { - afterEach(afterEachHook); - } - - testFulfilled(dummy, function (promise1, done) { - var promise2 = promise1.then(function onFulfilled() { - return expectedValue; - }); - - promise2.then(function onPromise2Fulfilled(actualValue) { - assert.strictEqual(actualValue, expectedValue); - done(); - }); - }); - testRejected(dummy, function (promise1, done) { - var promise2 = promise1.then(null, function onRejected() { - return expectedValue; - }); - - promise2.then(function onPromise2Fulfilled(actualValue) { - assert.strictEqual(actualValue, expectedValue); - done(); - }); - }); - }); - } - - testValue(undefined, "`undefined`"); - testValue(null, "`null`"); - testValue(false, "`false`"); - testValue(true, "`true`"); - testValue(0, "`0`"); - - testValue( - true, - "`true` with `Boolean.prototype` modified to have a `then` method", - function () { - Boolean.prototype.then = function () {}; - }, - function () { - delete Boolean.prototype.then; - } - ); - - testValue( - 1, - "`1` with `Number.prototype` modified to have a `then` method", - function () { - Number.prototype.then = function () {}; - }, - function () { - delete Number.prototype.then; - } - ); -}); - -},{"./helpers/testThreeCases":22,"assert":2}],21:[function(require,module,exports){ -(function (global){ -"use strict"; - -// This module exports some valid rejection reason factories, keyed by human-readable versions of their names. - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; - -var dummy = { dummy: "dummy" }; - -exports["`undefined`"] = function () { - return undefined; -}; - -exports["`null`"] = function () { - return null; -}; - -exports["`false`"] = function () { - return false; -}; - -exports["`0`"] = function () { - return 0; -}; - -exports["an error"] = function () { - return new Error(); -}; - -exports["an error without a stack"] = function () { - var error = new Error(); - delete error.stack; - - return error; -}; - -exports["a date"] = function () { - return new Date(); -}; - -exports["an object"] = function () { - return {}; -}; - -exports["an always-pending thenable"] = function () { - return { then: function () { } }; -}; - -exports["a fulfilled promise"] = function () { - return resolved(dummy); -}; - -exports["a rejected promise"] = function () { - return rejected(dummy); -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],22:[function(require,module,exports){ -(function (global){ -"use strict"; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -exports.testFulfilled = function (value, test) { - specify("already-fulfilled", function (done) { - test(resolved(value), done); - }); - - specify("immediately-fulfilled", function (done) { - var d = deferred(); - test(d.promise, done); - d.resolve(value); - }); - - specify("eventually-fulfilled", function (done) { - var d = deferred(); - test(d.promise, done); - setTimeout(function () { - d.resolve(value); - }, 50); - }); -}; - -exports.testRejected = function (reason, test) { - specify("already-rejected", function (done) { - test(rejected(reason), done); - }); - - specify("immediately-rejected", function (done) { - var d = deferred(); - test(d.promise, done); - d.reject(reason); - }); - - specify("eventually-rejected", function (done) { - var d = deferred(); - test(d.promise, done); - setTimeout(function () { - d.reject(reason); - }, 50); - }); -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],23:[function(require,module,exports){ -(function (global){ -"use strict"; - -var adapter = global.adapter; -var resolved = adapter.resolved; -var rejected = adapter.rejected; -var deferred = adapter.deferred; - -var other = { other: "other" }; // a value we don't want to be strict equal to - -exports.fulfilled = { - "a synchronously-fulfilled custom thenable": function (value) { - return { - then: function (onFulfilled) { - onFulfilled(value); - } - }; - }, - - "an asynchronously-fulfilled custom thenable": function (value) { - return { - then: function (onFulfilled) { - setTimeout(function () { - onFulfilled(value); - }, 0); - } - }; - }, - - "a synchronously-fulfilled one-time thenable": function (value) { - var numberOfTimesThenRetrieved = 0; - return Object.create(null, { - then: { - get: function () { - if (numberOfTimesThenRetrieved === 0) { - ++numberOfTimesThenRetrieved; - return function (onFulfilled) { - onFulfilled(value); - }; - } - return null; - } - } - }); - }, - - "a thenable that tries to fulfill twice": function (value) { - return { - then: function (onFulfilled) { - onFulfilled(value); - onFulfilled(other); - } - }; - }, - - "a thenable that fulfills but then throws": function (value) { - return { - then: function (onFulfilled) { - onFulfilled(value); - throw other; - } - }; - }, - - "an already-fulfilled promise": function (value) { - return resolved(value); - }, - - "an eventually-fulfilled promise": function (value) { - var d = deferred(); - setTimeout(function () { - d.resolve(value); - }, 50); - return d.promise; - } -}; - -exports.rejected = { - "a synchronously-rejected custom thenable": function (reason) { - return { - then: function (onFulfilled, onRejected) { - onRejected(reason); - } - }; - }, - - "an asynchronously-rejected custom thenable": function (reason) { - return { - then: function (onFulfilled, onRejected) { - setTimeout(function () { - onRejected(reason); - }, 0); - } - }; - }, - - "a synchronously-rejected one-time thenable": function (reason) { - var numberOfTimesThenRetrieved = 0; - return Object.create(null, { - then: { - get: function () { - if (numberOfTimesThenRetrieved === 0) { - ++numberOfTimesThenRetrieved; - return function (onFulfilled, onRejected) { - onRejected(reason); - }; - } - return null; - } - } - }); - }, - - "a thenable that immediately throws in `then`": function (reason) { - return { - then: function () { - throw reason; - } - }; - }, - - "an object with a throwing `then` accessor": function (reason) { - return Object.create(null, { - then: { - get: function () { - throw reason; - } - } - }); - }, - - "an already-rejected promise": function (reason) { - return rejected(reason); - }, - - "an eventually-rejected promise": function (reason) { - var d = deferred(); - setTimeout(function () { - d.reject(reason); - }, 50); - return d.promise; - } -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],24:[function(require,module,exports){ -/** - * Sinon core utilities. For internal use only. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -var sinon = (function () { - var sinon; - var isNode = typeof module !== "undefined" && module.exports && typeof require === "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - sinon = module.exports = require("./sinon/util/core"); - require("./sinon/extend"); - require("./sinon/typeOf"); - require("./sinon/times_in_words"); - require("./sinon/spy"); - require("./sinon/call"); - require("./sinon/behavior"); - require("./sinon/stub"); - require("./sinon/mock"); - require("./sinon/collection"); - require("./sinon/assert"); - require("./sinon/sandbox"); - require("./sinon/test"); - require("./sinon/test_case"); - require("./sinon/match"); - require("./sinon/format"); - require("./sinon/log_error"); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - sinon = module.exports; - } else { - sinon = {}; - } - - return sinon; -}()); - -},{"./sinon/assert":25,"./sinon/behavior":26,"./sinon/call":27,"./sinon/collection":28,"./sinon/extend":29,"./sinon/format":30,"./sinon/log_error":31,"./sinon/match":32,"./sinon/mock":33,"./sinon/sandbox":34,"./sinon/spy":35,"./sinon/stub":36,"./sinon/test":37,"./sinon/test_case":38,"./sinon/times_in_words":39,"./sinon/typeOf":40,"./sinon/util/core":41}],25:[function(require,module,exports){ -(function (global){ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Assertions matching the test spy retrieval interface. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon, global) { - var slice = Array.prototype.slice; - - function makeApi(sinon) { - var assert; - - function verifyIsStub() { - var method; - - for (var i = 0, l = arguments.length; i < l; ++i) { - method = arguments[i]; - - if (!method) { - assert.fail("fake is not a spy"); - } - - if (method.proxy) { - verifyIsStub(method.proxy); - } else { - if (typeof method != "function") { - assert.fail(method + " is not a function"); - } - - if (typeof method.getCall != "function") { - assert.fail(method + " is not stubbed"); - } - } - - } - } - - function failAssertion(object, msg) { - object = object || global; - var failMethod = object.fail || assert.fail; - failMethod.call(object, msg); - } - - function mirrorPropAsAssertion(name, method, message) { - if (arguments.length == 2) { - message = method; - method = name; - } - - assert[name] = function (fake) { - verifyIsStub(fake); - - var args = slice.call(arguments, 1); - var failed = false; - - if (typeof method == "function") { - failed = !method(fake); - } else { - failed = typeof fake[method] == "function" ? - !fake[method].apply(fake, args) : !fake[method]; - } - - if (failed) { - failAssertion(this, (fake.printf || fake.proxy.printf).apply(fake, [message].concat(args))); - } else { - assert.pass(name); - } - }; - } - - function exposedName(prefix, prop) { - return !prefix || /^fail/.test(prop) ? prop : - prefix + prop.slice(0, 1).toUpperCase() + prop.slice(1); - } - - assert = { - failException: "AssertError", - - fail: function fail(message) { - var error = new Error(message); - error.name = this.failException || assert.failException; - - throw error; - }, - - pass: function pass(assertion) {}, - - callOrder: function assertCallOrder() { - verifyIsStub.apply(null, arguments); - var expected = "", actual = ""; - - if (!sinon.calledInOrder(arguments)) { - try { - expected = [].join.call(arguments, ", "); - var calls = slice.call(arguments); - var i = calls.length; - while (i) { - if (!calls[--i].called) { - calls.splice(i, 1); - } - } - actual = sinon.orderByFirstCall(calls).join(", "); - } catch (e) { - // If this fails, we'll just fall back to the blank string - } - - failAssertion(this, "expected " + expected + " to be " + - "called in order but were called as " + actual); - } else { - assert.pass("callOrder"); - } - }, - - callCount: function assertCallCount(method, count) { - verifyIsStub(method); - - if (method.callCount != count) { - var msg = "expected %n to be called " + sinon.timesInWords(count) + - " but was called %c%C"; - failAssertion(this, method.printf(msg)); - } else { - assert.pass("callCount"); - } - }, - - expose: function expose(target, options) { - if (!target) { - throw new TypeError("target is null or undefined"); - } - - var o = options || {}; - var prefix = typeof o.prefix == "undefined" && "assert" || o.prefix; - var includeFail = typeof o.includeFail == "undefined" || !!o.includeFail; - - for (var method in this) { - if (method != "expose" && (includeFail || !/^(fail)/.test(method))) { - target[exposedName(prefix, method)] = this[method]; - } - } - - return target; - }, - - match: function match(actual, expectation) { - var matcher = sinon.match(expectation); - if (matcher.test(actual)) { - assert.pass("match"); - } else { - var formatted = [ - "expected value to match", - " expected = " + sinon.format(expectation), - " actual = " + sinon.format(actual) - ] - failAssertion(this, formatted.join("\n")); - } - } - }; - - mirrorPropAsAssertion("called", "expected %n to have been called at least once but was never called"); - mirrorPropAsAssertion("notCalled", function (spy) { return !spy.called; }, - "expected %n to not have been called but was called %c%C"); - mirrorPropAsAssertion("calledOnce", "expected %n to be called once but was called %c%C"); - mirrorPropAsAssertion("calledTwice", "expected %n to be called twice but was called %c%C"); - mirrorPropAsAssertion("calledThrice", "expected %n to be called thrice but was called %c%C"); - mirrorPropAsAssertion("calledOn", "expected %n to be called with %1 as this but was called with %t"); - mirrorPropAsAssertion("alwaysCalledOn", "expected %n to always be called with %1 as this but was called with %t"); - mirrorPropAsAssertion("calledWithNew", "expected %n to be called with new"); - mirrorPropAsAssertion("alwaysCalledWithNew", "expected %n to always be called with new"); - mirrorPropAsAssertion("calledWith", "expected %n to be called with arguments %*%C"); - mirrorPropAsAssertion("calledWithMatch", "expected %n to be called with match %*%C"); - mirrorPropAsAssertion("alwaysCalledWith", "expected %n to always be called with arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithMatch", "expected %n to always be called with match %*%C"); - mirrorPropAsAssertion("calledWithExactly", "expected %n to be called with exact arguments %*%C"); - mirrorPropAsAssertion("alwaysCalledWithExactly", "expected %n to always be called with exact arguments %*%C"); - mirrorPropAsAssertion("neverCalledWith", "expected %n to never be called with arguments %*%C"); - mirrorPropAsAssertion("neverCalledWithMatch", "expected %n to never be called with match %*%C"); - mirrorPropAsAssertion("threw", "%n did not throw exception%C"); - mirrorPropAsAssertion("alwaysThrew", "%n did not always throw exception%C"); - - sinon.assert = assert; - return assert; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } - -}(typeof sinon == "object" && sinon || null, typeof window != "undefined" ? window : (typeof self != "undefined") ? self : global)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./format":30,"./match":32,"./util/core":41}],26:[function(require,module,exports){ -(function (process){ -/** - * @depend util/core.js - * @depend extend.js - */ -/** - * Stub behavior - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Tim Fischbach (mail@timfischbach.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - var slice = Array.prototype.slice; - var join = Array.prototype.join; - var useLeftMostCallback = -1; - var useRightMostCallback = -2; - - var nextTick = (function () { - if (typeof process === "object" && typeof process.nextTick === "function") { - return process.nextTick; - } else if (typeof setImmediate === "function") { - return setImmediate; - } else { - return function (callback) { - setTimeout(callback, 0); - }; - } - })(); - - function throwsException(error, message) { - if (typeof error == "string") { - this.exception = new Error(message || ""); - this.exception.name = error; - } else if (!error) { - this.exception = new Error("Error"); - } else { - this.exception = error; - } - - return this; - } - - function getCallback(behavior, args) { - var callArgAt = behavior.callArgAt; - - if (callArgAt >= 0) { - return args[callArgAt]; - } - - var argumentList; - - if (callArgAt === useLeftMostCallback) { - argumentList = args; - } - - if (callArgAt === useRightMostCallback) { - argumentList = slice.call(args).reverse(); - } - - var callArgProp = behavior.callArgProp; - - for (var i = 0, l = argumentList.length; i < l; ++i) { - if (!callArgProp && typeof argumentList[i] == "function") { - return argumentList[i]; - } - - if (callArgProp && argumentList[i] && - typeof argumentList[i][callArgProp] == "function") { - return argumentList[i][callArgProp]; - } - } - - return null; - } - - function makeApi(sinon) { - function getCallbackError(behavior, func, args) { - if (behavior.callArgAt < 0) { - var msg; - - if (behavior.callArgProp) { - msg = sinon.functionName(behavior.stub) + - " expected to yield to '" + behavior.callArgProp + - "', but no object with such a property was passed."; - } else { - msg = sinon.functionName(behavior.stub) + - " expected to yield, but no callback was passed."; - } - - if (args.length > 0) { - msg += " Received [" + join.call(args, ", ") + "]"; - } - - return msg; - } - - return "argument at index " + behavior.callArgAt + " is not a function: " + func; - } - - function callCallback(behavior, args) { - if (typeof behavior.callArgAt == "number") { - var func = getCallback(behavior, args); - - if (typeof func != "function") { - throw new TypeError(getCallbackError(behavior, func, args)); - } - - if (behavior.callbackAsync) { - nextTick(function () { - func.apply(behavior.callbackContext, behavior.callbackArguments); - }); - } else { - func.apply(behavior.callbackContext, behavior.callbackArguments); - } - } - } - - var proto = { - create: function create(stub) { - var behavior = sinon.extend({}, sinon.behavior); - delete behavior.create; - behavior.stub = stub; - - return behavior; - }, - - isPresent: function isPresent() { - return (typeof this.callArgAt == "number" || - this.exception || - typeof this.returnArgAt == "number" || - this.returnThis || - this.returnValueDefined); - }, - - invoke: function invoke(context, args) { - callCallback(this, args); - - if (this.exception) { - throw this.exception; - } else if (typeof this.returnArgAt == "number") { - return args[this.returnArgAt]; - } else if (this.returnThis) { - return context; - } - - return this.returnValue; - }, - - onCall: function onCall(index) { - return this.stub.onCall(index); - }, - - onFirstCall: function onFirstCall() { - return this.stub.onFirstCall(); - }, - - onSecondCall: function onSecondCall() { - return this.stub.onSecondCall(); - }, - - onThirdCall: function onThirdCall() { - return this.stub.onThirdCall(); - }, - - withArgs: function withArgs(/* arguments */) { - throw new Error("Defining a stub by invoking \"stub.onCall(...).withArgs(...)\" is not supported. " + - "Use \"stub.withArgs(...).onCall(...)\" to define sequential behavior for calls with certain arguments."); - }, - - callsArg: function callsArg(pos) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOn: function callsArgOn(pos, context) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = []; - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgWith: function callsArgWith(pos) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - callsArgOnWith: function callsArgWith(pos, context) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = pos; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yields: function () { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsRight: function () { - this.callArgAt = useRightMostCallback; - this.callbackArguments = slice.call(arguments, 0); - this.callbackContext = undefined; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsOn: function (context) { - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = context; - this.callArgProp = undefined; - this.callbackAsync = false; - - return this; - }, - - yieldsTo: function (prop) { - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 1); - this.callbackContext = undefined; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - yieldsToOn: function (prop, context) { - if (typeof context != "object") { - throw new TypeError("argument context is not an object"); - } - - this.callArgAt = useLeftMostCallback; - this.callbackArguments = slice.call(arguments, 2); - this.callbackContext = context; - this.callArgProp = prop; - this.callbackAsync = false; - - return this; - }, - - throws: throwsException, - throwsException: throwsException, - - returns: function returns(value) { - this.returnValue = value; - this.returnValueDefined = true; - - return this; - }, - - returnsArg: function returnsArg(pos) { - if (typeof pos != "number") { - throw new TypeError("argument index is not number"); - } - - this.returnArgAt = pos; - - return this; - }, - - returnsThis: function returnsThis() { - this.returnThis = true; - - return this; - } - }; - - // create asynchronous versions of callsArg* and yields* methods - for (var method in proto) { - // need to avoid creating anotherasync versions of the newly added async methods - if (proto.hasOwnProperty(method) && - method.match(/^(callsArg|yields)/) && - !method.match(/Async/)) { - proto[method + "Async"] = (function (syncFnName) { - return function () { - var result = this[syncFnName].apply(this, arguments); - this.callbackAsync = true; - return result; - }; - })(method); - } - } - - sinon.behavior = proto; - return proto; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -}).call(this,require('_process')) -},{"./extend":29,"./util/core":41,"_process":4}],27:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend match.js - * @depend format.js - */ -/** - * Spy calls - * - * @author Christian Johansen (christian@cjohansen.no) - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - * Copyright (c) 2013 Maximilian Antoni - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - function throwYieldError(proxy, text, args) { - var msg = sinon.functionName(proxy) + text; - if (args.length) { - msg += " Received [" + slice.call(args).join(", ") + "]"; - } - throw new Error(msg); - } - - var slice = Array.prototype.slice; - - var callProto = { - calledOn: function calledOn(thisValue) { - if (sinon.match && sinon.match.isMatcher(thisValue)) { - return thisValue.test(this.thisValue); - } - return this.thisValue === thisValue; - }, - - calledWith: function calledWith() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - if (!sinon.deepEqual(arguments[i], this.args[i])) { - return false; - } - } - - return true; - }, - - calledWithMatch: function calledWithMatch() { - var l = arguments.length; - if (l > this.args.length) { - return false; - } - for (var i = 0; i < l; i += 1) { - var actual = this.args[i]; - var expectation = arguments[i]; - if (!sinon.match || !sinon.match(expectation).test(actual)) { - return false; - } - } - return true; - }, - - calledWithExactly: function calledWithExactly() { - return arguments.length == this.args.length && - this.calledWith.apply(this, arguments); - }, - - notCalledWith: function notCalledWith() { - return !this.calledWith.apply(this, arguments); - }, - - notCalledWithMatch: function notCalledWithMatch() { - return !this.calledWithMatch.apply(this, arguments); - }, - - returned: function returned(value) { - return sinon.deepEqual(value, this.returnValue); - }, - - threw: function threw(error) { - if (typeof error === "undefined" || !this.exception) { - return !!this.exception; - } - - return this.exception === error || this.exception.name === error; - }, - - calledWithNew: function calledWithNew() { - return this.proxy.prototype && this.thisValue instanceof this.proxy; - }, - - calledBefore: function (other) { - return this.callId < other.callId; - }, - - calledAfter: function (other) { - return this.callId > other.callId; - }, - - callArg: function (pos) { - this.args[pos](); - }, - - callArgOn: function (pos, thisValue) { - this.args[pos].apply(thisValue); - }, - - callArgWith: function (pos) { - this.callArgOnWith.apply(this, [pos, null].concat(slice.call(arguments, 1))); - }, - - callArgOnWith: function (pos, thisValue) { - var args = slice.call(arguments, 2); - this.args[pos].apply(thisValue, args); - }, - - yield: function () { - this.yieldOn.apply(this, [null].concat(slice.call(arguments, 0))); - }, - - yieldOn: function (thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (typeof args[i] === "function") { - args[i].apply(thisValue, slice.call(arguments, 1)); - return; - } - } - throwYieldError(this.proxy, " cannot yield since no callback was passed.", args); - }, - - yieldTo: function (prop) { - this.yieldToOn.apply(this, [prop, null].concat(slice.call(arguments, 1))); - }, - - yieldToOn: function (prop, thisValue) { - var args = this.args; - for (var i = 0, l = args.length; i < l; ++i) { - if (args[i] && typeof args[i][prop] === "function") { - args[i][prop].apply(thisValue, slice.call(arguments, 2)); - return; - } - } - throwYieldError(this.proxy, " cannot yield to '" + prop + - "' since no callback was passed.", args); - }, - - toString: function () { - var callStr = this.proxy.toString() + "("; - var args = []; - - for (var i = 0, l = this.args.length; i < l; ++i) { - args.push(sinon.format(this.args[i])); - } - - callStr = callStr + args.join(", ") + ")"; - - if (typeof this.returnValue != "undefined") { - callStr += " => " + sinon.format(this.returnValue); - } - - if (this.exception) { - callStr += " !" + this.exception.name; - - if (this.exception.message) { - callStr += "(" + this.exception.message + ")"; - } - } - - return callStr; - } - }; - - callProto.invokeCallback = callProto.yield; - - function createSpyCall(spy, thisValue, args, returnValue, exception, id) { - if (typeof id !== "number") { - throw new TypeError("Call id is not a number"); - } - var proxyCall = sinon.create(callProto); - proxyCall.proxy = spy; - proxyCall.thisValue = thisValue; - proxyCall.args = args; - proxyCall.returnValue = returnValue; - proxyCall.exception = exception; - proxyCall.callId = id; - - return proxyCall; - } - createSpyCall.toString = callProto.toString; // used by mocks - - sinon.spyCall = createSpyCall; - return createSpyCall; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./match"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./format":30,"./match":32,"./util/core":41}],28:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend spy.js - * @depend stub.js - * @depend mock.js - */ -/** - * Collections of stubs, spies and mocks. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - var push = [].push; - var hasOwnProperty = Object.prototype.hasOwnProperty; - - function getFakes(fakeCollection) { - if (!fakeCollection.fakes) { - fakeCollection.fakes = []; - } - - return fakeCollection.fakes; - } - - function each(fakeCollection, method) { - var fakes = getFakes(fakeCollection); - - for (var i = 0, l = fakes.length; i < l; i += 1) { - if (typeof fakes[i][method] == "function") { - fakes[i][method](); - } - } - } - - function compact(fakeCollection) { - var fakes = getFakes(fakeCollection); - var i = 0; - while (i < fakes.length) { - fakes.splice(i, 1); - } - } - - function makeApi(sinon) { - var collection = { - verify: function resolve() { - each(this, "verify"); - }, - - restore: function restore() { - each(this, "restore"); - compact(this); - }, - - reset: function restore() { - each(this, "reset"); - }, - - verifyAndRestore: function verifyAndRestore() { - var exception; - - try { - this.verify(); - } catch (e) { - exception = e; - } - - this.restore(); - - if (exception) { - throw exception; - } - }, - - add: function add(fake) { - push.call(getFakes(this), fake); - return fake; - }, - - spy: function spy() { - return this.add(sinon.spy.apply(sinon, arguments)); - }, - - stub: function stub(object, property, value) { - if (property) { - var original = object[property]; - - if (typeof original != "function") { - if (!hasOwnProperty.call(object, property)) { - throw new TypeError("Cannot stub non-existent own property " + property); - } - - object[property] = value; - - return this.add({ - restore: function () { - object[property] = original; - } - }); - } - } - if (!property && !!object && typeof object == "object") { - var stubbedObj = sinon.stub.apply(sinon, arguments); - - for (var prop in stubbedObj) { - if (typeof stubbedObj[prop] === "function") { - this.add(stubbedObj[prop]); - } - } - - return stubbedObj; - } - - return this.add(sinon.stub.apply(sinon, arguments)); - }, - - mock: function mock() { - return this.add(sinon.mock.apply(sinon, arguments)); - }, - - inject: function inject(obj) { - var col = this; - - obj.spy = function () { - return col.spy.apply(col, arguments); - }; - - obj.stub = function () { - return col.stub.apply(col, arguments); - }; - - obj.mock = function () { - return col.mock.apply(col, arguments); - }; - - return obj; - } - }; - - sinon.collection = collection; - return collection; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./mock"); - require("./spy"); - require("./stub"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./mock":33,"./spy":35,"./stub":36,"./util/core":41}],29:[function(require,module,exports){ -/** - * @depend util/core.js - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - - // Adapted from https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug - var hasDontEnumBug = (function () { - var obj = { - constructor: function () { - return "0"; - }, - toString: function () { - return "1"; - }, - valueOf: function () { - return "2"; - }, - toLocaleString: function () { - return "3"; - }, - prototype: function () { - return "4"; - }, - isPrototypeOf: function () { - return "5"; - }, - propertyIsEnumerable: function () { - return "6"; - }, - hasOwnProperty: function () { - return "7"; - }, - length: function () { - return "8"; - }, - unique: function () { - return "9" - } - }; - - var result = []; - for (var prop in obj) { - result.push(obj[prop]()); - } - return result.join("") !== "0123456789"; - })(); - - /* Public: Extend target in place with all (own) properties from sources in-order. Thus, last source will - * override properties in previous sources. - * - * target - The Object to extend - * sources - Objects to copy properties from. - * - * Returns the extended target - */ - function extend(target /*, sources */) { - var sources = Array.prototype.slice.call(arguments, 1), - source, i, prop; - - for (i = 0; i < sources.length; i++) { - source = sources[i]; - - for (prop in source) { - if (source.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - - // Make sure we copy (own) toString method even when in JScript with DontEnum bug - // See https://developer.mozilla.org/en/docs/ECMAScript_DontEnum_attribute#JScript_DontEnum_Bug - if (hasDontEnumBug && source.hasOwnProperty("toString") && source.toString !== target.toString) { - target.toString = source.toString; - } - } - - return target; - }; - - sinon.extend = extend; - return sinon.extend; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./util/core":41}],30:[function(require,module,exports){ -/** - * @depend util/core.js - */ -/** - * Format functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -(function (sinon, formatio) { - function makeApi(sinon) { - function valueFormatter(value) { - return "" + value; - } - - function getFormatioFormatter() { - var formatter = formatio.configure({ - quoteStrings: false, - limitChildrenCount: 250 - }); - - function format() { - return formatter.ascii.apply(formatter, arguments); - }; - - return format; - } - - function getNodeFormatter(value) { - function format(value) { - return typeof value == "object" && value.toString === Object.prototype.toString ? util.inspect(value) : value; - }; - - try { - var util = require("util"); - } catch (e) { - /* Node, but no util module - would be very old, but better safe than sorry */ - } - - return util ? format : valueFormatter; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function", - formatter; - - if (isNode) { - try { - formatio = require("formatio"); - } catch (e) {} - } - - if (formatio) { - formatter = getFormatioFormatter() - } else if (isNode) { - formatter = getNodeFormatter(); - } else { - formatter = valueFormatter; - } - - sinon.format = formatter; - return sinon.format; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}( - (typeof sinon == "object" && sinon || null), - (typeof formatio == "object" && formatio) -)); - -},{"./util/core":41,"formatio":48,"util":6}],31:[function(require,module,exports){ -/** - * @depend util/core.js - */ -/** - * Logs errors - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -(function (sinon) { - // cache a reference to setTimeout, so that our reference won't be stubbed out - // when using fake timers and errors will still get logged - // https://github.com/cjohansen/Sinon.JS/issues/381 - var realSetTimeout = setTimeout; - - function makeApi(sinon) { - - function log() {} - - function logError(label, err) { - var msg = label + " threw exception: "; - - sinon.log(msg + "[" + err.name + "] " + err.message); - - if (err.stack) { - sinon.log(err.stack); - } - - logError.setTimeout(function () { - err.message = msg + err.message; - throw err; - }, 0); - }; - - // wrap realSetTimeout with something we can stub in tests - logError.setTimeout = function (func, timeout) { - realSetTimeout(func, timeout); - } - - var exports = {}; - exports.log = sinon.log = log; - exports.logError = sinon.logError = logError; - - return exports; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./util/core":41}],32:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend typeOf.js - */ -/*jslint eqeqeq: false, onevar: false, plusplus: false*/ -/*global module, require, sinon*/ -/** - * Match functions - * - * @author Maximilian Antoni (mail@maxantoni.de) - * @license BSD - * - * Copyright (c) 2012 Maximilian Antoni - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - function assertType(value, type, name) { - var actual = sinon.typeOf(value); - if (actual !== type) { - throw new TypeError("Expected type of " + name + " to be " + - type + ", but was " + actual); - } - } - - var matcher = { - toString: function () { - return this.message; - } - }; - - function isMatcher(object) { - return matcher.isPrototypeOf(object); - } - - function matchObject(expectation, actual) { - if (actual === null || actual === undefined) { - return false; - } - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - var exp = expectation[key]; - var act = actual[key]; - if (match.isMatcher(exp)) { - if (!exp.test(act)) { - return false; - } - } else if (sinon.typeOf(exp) === "object") { - if (!matchObject(exp, act)) { - return false; - } - } else if (!sinon.deepEqual(exp, act)) { - return false; - } - } - } - return true; - } - - matcher.or = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var or = sinon.create(matcher); - or.test = function (actual) { - return m1.test(actual) || m2.test(actual); - }; - or.message = m1.message + ".or(" + m2.message + ")"; - return or; - }; - - matcher.and = function (m2) { - if (!arguments.length) { - throw new TypeError("Matcher expected"); - } else if (!isMatcher(m2)) { - m2 = match(m2); - } - var m1 = this; - var and = sinon.create(matcher); - and.test = function (actual) { - return m1.test(actual) && m2.test(actual); - }; - and.message = m1.message + ".and(" + m2.message + ")"; - return and; - }; - - var match = function (expectation, message) { - var m = sinon.create(matcher); - var type = sinon.typeOf(expectation); - switch (type) { - case "object": - if (typeof expectation.test === "function") { - m.test = function (actual) { - return expectation.test(actual) === true; - }; - m.message = "match(" + sinon.functionName(expectation.test) + ")"; - return m; - } - var str = []; - for (var key in expectation) { - if (expectation.hasOwnProperty(key)) { - str.push(key + ": " + expectation[key]); - } - } - m.test = function (actual) { - return matchObject(expectation, actual); - }; - m.message = "match(" + str.join(", ") + ")"; - break; - case "number": - m.test = function (actual) { - return expectation == actual; - }; - break; - case "string": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return actual.indexOf(expectation) !== -1; - }; - m.message = "match(\"" + expectation + "\")"; - break; - case "regexp": - m.test = function (actual) { - if (typeof actual !== "string") { - return false; - } - return expectation.test(actual); - }; - break; - case "function": - m.test = expectation; - if (message) { - m.message = message; - } else { - m.message = "match(" + sinon.functionName(expectation) + ")"; - } - break; - default: - m.test = function (actual) { - return sinon.deepEqual(expectation, actual); - }; - } - if (!m.message) { - m.message = "match(" + expectation + ")"; - } - return m; - }; - - match.isMatcher = isMatcher; - - match.any = match(function () { - return true; - }, "any"); - - match.defined = match(function (actual) { - return actual !== null && actual !== undefined; - }, "defined"); - - match.truthy = match(function (actual) { - return !!actual; - }, "truthy"); - - match.falsy = match(function (actual) { - return !actual; - }, "falsy"); - - match.same = function (expectation) { - return match(function (actual) { - return expectation === actual; - }, "same(" + expectation + ")"); - }; - - match.typeOf = function (type) { - assertType(type, "string", "type"); - return match(function (actual) { - return sinon.typeOf(actual) === type; - }, "typeOf(\"" + type + "\")"); - }; - - match.instanceOf = function (type) { - assertType(type, "function", "type"); - return match(function (actual) { - return actual instanceof type; - }, "instanceOf(" + sinon.functionName(type) + ")"); - }; - - function createPropertyMatcher(propertyTest, messagePrefix) { - return function (property, value) { - assertType(property, "string", "property"); - var onlyProperty = arguments.length === 1; - var message = messagePrefix + "(\"" + property + "\""; - if (!onlyProperty) { - message += ", " + value; - } - message += ")"; - return match(function (actual) { - if (actual === undefined || actual === null || - !propertyTest(actual, property)) { - return false; - } - return onlyProperty || sinon.deepEqual(value, actual[property]); - }, message); - }; - } - - match.has = createPropertyMatcher(function (actual, property) { - if (typeof actual === "object") { - return property in actual; - } - return actual[property] !== undefined; - }, "has"); - - match.hasOwn = createPropertyMatcher(function (actual, property) { - return actual.hasOwnProperty(property); - }, "hasOwn"); - - match.bool = match.typeOf("boolean"); - match.number = match.typeOf("number"); - match.string = match.typeOf("string"); - match.object = match.typeOf("object"); - match.func = match.typeOf("function"); - match.array = match.typeOf("array"); - match.regexp = match.typeOf("regexp"); - match.date = match.typeOf("date"); - - sinon.match = match; - return match; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./typeOf"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./typeOf":40,"./util/core":41}],33:[function(require,module,exports){ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend call.js - * @depend extend.js - * @depend match.js - * @depend spy.js - * @depend stub.js - * @depend format.js - */ -/** - * Mock functions. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - var push = [].push; - var match = sinon.match; - - function mock(object) { - if (!object) { - return sinon.expectation.create("Anonymous mock"); - } - - return mock.create(object); - } - - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - - sinon.extend(mock, { - create: function create(object) { - if (!object) { - throw new TypeError("object is null"); - } - - var mockObject = sinon.extend({}, mock); - mockObject.object = object; - delete mockObject.create; - - return mockObject; - }, - - expects: function expects(method) { - if (!method) { - throw new TypeError("method is falsy"); - } - - if (!this.expectations) { - this.expectations = {}; - this.proxies = []; - } - - if (!this.expectations[method]) { - this.expectations[method] = []; - var mockObject = this; - - sinon.wrapMethod(this.object, method, function () { - return mockObject.invokeMethod(method, this, arguments); - }); - - push.call(this.proxies, method); - } - - var expectation = sinon.expectation.create(method); - push.call(this.expectations[method], expectation); - - return expectation; - }, - - restore: function restore() { - var object = this.object; - - each(this.proxies, function (proxy) { - if (typeof object[proxy].restore == "function") { - object[proxy].restore(); - } - }); - }, - - verify: function verify() { - var expectations = this.expectations || {}; - var messages = [], met = []; - - each(this.proxies, function (proxy) { - each(expectations[proxy], function (expectation) { - if (!expectation.met()) { - push.call(messages, expectation.toString()); - } else { - push.call(met, expectation.toString()); - } - }); - }); - - this.restore(); - - if (messages.length > 0) { - sinon.expectation.fail(messages.concat(met).join("\n")); - } else if (met.length > 0) { - sinon.expectation.pass(messages.concat(met).join("\n")); - } - - return true; - }, - - invokeMethod: function invokeMethod(method, thisValue, args) { - var expectations = this.expectations && this.expectations[method]; - var length = expectations && expectations.length || 0, i; - - for (i = 0; i < length; i += 1) { - if (!expectations[i].met() && - expectations[i].allowsCall(thisValue, args)) { - return expectations[i].apply(thisValue, args); - } - } - - var messages = [], available, exhausted = 0; - - for (i = 0; i < length; i += 1) { - if (expectations[i].allowsCall(thisValue, args)) { - available = available || expectations[i]; - } else { - exhausted += 1; - } - push.call(messages, " " + expectations[i].toString()); - } - - if (exhausted === 0) { - return available.apply(thisValue, args); - } - - messages.unshift("Unexpected call: " + sinon.spyCall.toString.call({ - proxy: method, - args: args - })); - - sinon.expectation.fail(messages.join("\n")); - } - }); - - var times = sinon.timesInWords; - var slice = Array.prototype.slice; - - function callCountInWords(callCount) { - if (callCount == 0) { - return "never called"; - } else { - return "called " + times(callCount); - } - } - - function expectedCallCountInWords(expectation) { - var min = expectation.minCalls; - var max = expectation.maxCalls; - - if (typeof min == "number" && typeof max == "number") { - var str = times(min); - - if (min != max) { - str = "at least " + str + " and at most " + times(max); - } - - return str; - } - - if (typeof min == "number") { - return "at least " + times(min); - } - - return "at most " + times(max); - } - - function receivedMinCalls(expectation) { - var hasMinLimit = typeof expectation.minCalls == "number"; - return !hasMinLimit || expectation.callCount >= expectation.minCalls; - } - - function receivedMaxCalls(expectation) { - if (typeof expectation.maxCalls != "number") { - return false; - } - - return expectation.callCount == expectation.maxCalls; - } - - function verifyMatcher(possibleMatcher, arg) { - if (match && match.isMatcher(possibleMatcher)) { - return possibleMatcher.test(arg); - } else { - return true; - } - } - - sinon.expectation = { - minCalls: 1, - maxCalls: 1, - - create: function create(methodName) { - var expectation = sinon.extend(sinon.stub.create(), sinon.expectation); - delete expectation.create; - expectation.method = methodName; - - return expectation; - }, - - invoke: function invoke(func, thisValue, args) { - this.verifyCallAllowed(thisValue, args); - - return sinon.spy.invoke.apply(this, arguments); - }, - - atLeast: function atLeast(num) { - if (typeof num != "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.maxCalls = null; - this.limitsSet = true; - } - - this.minCalls = num; - - return this; - }, - - atMost: function atMost(num) { - if (typeof num != "number") { - throw new TypeError("'" + num + "' is not number"); - } - - if (!this.limitsSet) { - this.minCalls = null; - this.limitsSet = true; - } - - this.maxCalls = num; - - return this; - }, - - never: function never() { - return this.exactly(0); - }, - - once: function once() { - return this.exactly(1); - }, - - twice: function twice() { - return this.exactly(2); - }, - - thrice: function thrice() { - return this.exactly(3); - }, - - exactly: function exactly(num) { - if (typeof num != "number") { - throw new TypeError("'" + num + "' is not a number"); - } - - this.atLeast(num); - return this.atMost(num); - }, - - met: function met() { - return !this.failed && receivedMinCalls(this); - }, - - verifyCallAllowed: function verifyCallAllowed(thisValue, args) { - if (receivedMaxCalls(this)) { - this.failed = true; - sinon.expectation.fail(this.method + " already called " + times(this.maxCalls)); - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - sinon.expectation.fail(this.method + " called with " + thisValue + " as thisValue, expected " + - this.expectedThis); - } - - if (!("expectedArguments" in this)) { - return; - } - - if (!args) { - sinon.expectation.fail(this.method + " received no arguments, expected " + - sinon.format(this.expectedArguments)); - } - - if (args.length < this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too few arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - if (this.expectsExactArgCount && - args.length != this.expectedArguments.length) { - sinon.expectation.fail(this.method + " received too many arguments (" + sinon.format(args) + - "), expected " + sinon.format(this.expectedArguments)); - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", didn't match " + this.expectedArguments.toString()); - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - sinon.expectation.fail(this.method + " received wrong arguments " + sinon.format(args) + - ", expected " + sinon.format(this.expectedArguments)); - } - } - }, - - allowsCall: function allowsCall(thisValue, args) { - if (this.met() && receivedMaxCalls(this)) { - return false; - } - - if ("expectedThis" in this && this.expectedThis !== thisValue) { - return false; - } - - if (!("expectedArguments" in this)) { - return true; - } - - args = args || []; - - if (args.length < this.expectedArguments.length) { - return false; - } - - if (this.expectsExactArgCount && - args.length != this.expectedArguments.length) { - return false; - } - - for (var i = 0, l = this.expectedArguments.length; i < l; i += 1) { - if (!verifyMatcher(this.expectedArguments[i], args[i])) { - return false; - } - - if (!sinon.deepEqual(this.expectedArguments[i], args[i])) { - return false; - } - } - - return true; - }, - - withArgs: function withArgs() { - this.expectedArguments = slice.call(arguments); - return this; - }, - - withExactArgs: function withExactArgs() { - this.withArgs.apply(this, arguments); - this.expectsExactArgCount = true; - return this; - }, - - on: function on(thisValue) { - this.expectedThis = thisValue; - return this; - }, - - toString: function () { - var args = (this.expectedArguments || []).slice(); - - if (!this.expectsExactArgCount) { - push.call(args, "[...]"); - } - - var callStr = sinon.spyCall.toString.call({ - proxy: this.method || "anonymous mock expectation", - args: args - }); - - var message = callStr.replace(", [...", "[, ...") + " " + - expectedCallCountInWords(this); - - if (this.met()) { - return "Expectation met: " + message; - } - - return "Expected " + message + " (" + - callCountInWords(this.callCount) + ")"; - }, - - verify: function verify() { - if (!this.met()) { - sinon.expectation.fail(this.toString()); - } else { - sinon.expectation.pass(this.toString()); - } - - return true; - }, - - pass: function pass(message) { - sinon.assert.pass(message); - }, - - fail: function fail(message) { - var exception = new Error(message); - exception.name = "ExpectationError"; - - throw exception; - } - }; - - sinon.mock = mock; - return mock; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./times_in_words"); - require("./call"); - require("./extend"); - require("./match"); - require("./spy"); - require("./stub"); - require("./format"); - - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./call":27,"./extend":29,"./format":30,"./match":32,"./spy":35,"./stub":36,"./times_in_words":39,"./util/core":41}],34:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend extend.js - * @depend collection.js - * @depend util/fake_timers.js - * @depend util/fake_server_with_clock.js - */ -/** - * Manages fake collections as well as fake utilities such as Sinon's - * timers and fake XHR implementation in one convenient object. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function () { - function makeApi(sinon) { - var push = [].push; - - function exposeValue(sandbox, config, key, value) { - if (!value) { - return; - } - - if (config.injectInto && !(key in config.injectInto)) { - config.injectInto[key] = value; - sandbox.injectedKeys.push(key); - } else { - push.call(sandbox.args, value); - } - } - - function prepareSandboxFromConfig(config) { - var sandbox = sinon.create(sinon.sandbox); - - if (config.useFakeServer) { - if (typeof config.useFakeServer == "object") { - sandbox.serverPrototype = config.useFakeServer; - } - - sandbox.useFakeServer(); - } - - if (config.useFakeTimers) { - if (typeof config.useFakeTimers == "object") { - sandbox.useFakeTimers.apply(sandbox, config.useFakeTimers); - } else { - sandbox.useFakeTimers(); - } - } - - return sandbox; - } - - sinon.sandbox = sinon.extend(sinon.create(sinon.collection), { - useFakeTimers: function useFakeTimers() { - this.clock = sinon.useFakeTimers.apply(sinon, arguments); - - return this.add(this.clock); - }, - - serverPrototype: sinon.fakeServer, - - useFakeServer: function useFakeServer() { - var proto = this.serverPrototype || sinon.fakeServer; - - if (!proto || !proto.create) { - return null; - } - - this.server = proto.create(); - return this.add(this.server); - }, - - inject: function (obj) { - sinon.collection.inject.call(this, obj); - - if (this.clock) { - obj.clock = this.clock; - } - - if (this.server) { - obj.server = this.server; - obj.requests = this.server.requests; - } - - obj.match = sinon.match; - - return obj; - }, - - restore: function () { - sinon.collection.restore.apply(this, arguments); - this.restoreContext(); - }, - - restoreContext: function () { - if (this.injectedKeys) { - for (var i = 0, j = this.injectedKeys.length; i < j; i++) { - delete this.injectInto[this.injectedKeys[i]]; - } - this.injectedKeys = []; - } - }, - - create: function (config) { - if (!config) { - return sinon.create(sinon.sandbox); - } - - var sandbox = prepareSandboxFromConfig(config); - sandbox.args = sandbox.args || []; - sandbox.injectedKeys = []; - sandbox.injectInto = config.injectInto; - var prop, value, exposed = sandbox.inject({}); - - if (config.properties) { - for (var i = 0, l = config.properties.length; i < l; i++) { - prop = config.properties[i]; - value = exposed[prop] || prop == "sandbox" && sandbox; - exposeValue(sandbox, config, prop, value); - } - } else { - exposeValue(sandbox, config, "sandbox", value); - } - - return sandbox; - }, - - match: sinon.match - }); - - sinon.sandbox.useFakeXMLHttpRequest = sinon.sandbox.useFakeServer; - - return sinon.sandbox; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./extend"); - require("./util/fake_server_with_clock"); - require("./util/fake_timers"); - require("./collection"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}()); - -},{"./collection":28,"./extend":29,"./util/core":41,"./util/fake_server_with_clock":44,"./util/fake_timers":45}],35:[function(require,module,exports){ -/** - * @depend times_in_words.js - * @depend util/core.js - * @depend extend.js - * @depend call.js - * @depend format.js - */ -/** - * Spy functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - - function makeApi(sinon) { - var push = Array.prototype.push; - var slice = Array.prototype.slice; - var callId = 0; - - function spy(object, property, types) { - if (!property && typeof object == "function") { - return spy.create(object); - } - - if (!object && !property) { - return spy.create(function () { }); - } - - if (types) { - var methodDesc = sinon.getPropertyDescriptor(object, property); - for (var i = 0; i < types.length; i++) { - methodDesc[types[i]] = spy.create(methodDesc[types[i]]); - } - return sinon.wrapMethod(object, property, methodDesc); - } else { - var method = object[property]; - return sinon.wrapMethod(object, property, spy.create(method)); - } - } - - function matchingFake(fakes, args, strict) { - if (!fakes) { - return; - } - - for (var i = 0, l = fakes.length; i < l; i++) { - if (fakes[i].matches(args, strict)) { - return fakes[i]; - } - } - } - - function incrementCallCount() { - this.called = true; - this.callCount += 1; - this.notCalled = false; - this.calledOnce = this.callCount == 1; - this.calledTwice = this.callCount == 2; - this.calledThrice = this.callCount == 3; - } - - function createCallProperties() { - this.firstCall = this.getCall(0); - this.secondCall = this.getCall(1); - this.thirdCall = this.getCall(2); - this.lastCall = this.getCall(this.callCount - 1); - } - - var vars = "a,b,c,d,e,f,g,h,i,j,k,l"; - function createProxy(func, proxyLength) { - // Retain the function length: - var p; - if (proxyLength) { - eval("p = (function proxy(" + vars.substring(0, proxyLength * 2 - 1) + - ") { return p.invoke(func, this, slice.call(arguments)); });"); - } else { - p = function proxy() { - return p.invoke(func, this, slice.call(arguments)); - }; - } - return p; - } - - var uuid = 0; - - // Public API - var spyApi = { - reset: function () { - if (this.invoking) { - var err = new Error("Cannot reset Sinon function while invoking it. " + - "Move the call to .reset outside of the callback."); - err.name = "InvalidResetException"; - throw err; - } - - this.called = false; - this.notCalled = true; - this.calledOnce = false; - this.calledTwice = false; - this.calledThrice = false; - this.callCount = 0; - this.firstCall = null; - this.secondCall = null; - this.thirdCall = null; - this.lastCall = null; - this.args = []; - this.returnValues = []; - this.thisValues = []; - this.exceptions = []; - this.callIds = []; - if (this.fakes) { - for (var i = 0; i < this.fakes.length; i++) { - this.fakes[i].reset(); - } - } - - return this; - }, - - create: function create(func, spyLength) { - var name; - - if (typeof func != "function") { - func = function () { }; - } else { - name = sinon.functionName(func); - } - - if (!spyLength) { - spyLength = func.length; - } - - var proxy = createProxy(func, spyLength); - - sinon.extend(proxy, spy); - delete proxy.create; - sinon.extend(proxy, func); - - proxy.reset(); - proxy.prototype = func.prototype; - proxy.displayName = name || "spy"; - proxy.toString = sinon.functionToString; - proxy.instantiateFake = sinon.spy.create; - proxy.id = "spy#" + uuid++; - - return proxy; - }, - - invoke: function invoke(func, thisValue, args) { - var matching = matchingFake(this.fakes, args); - var exception, returnValue; - - incrementCallCount.call(this); - push.call(this.thisValues, thisValue); - push.call(this.args, args); - push.call(this.callIds, callId++); - - // Make call properties available from within the spied function: - createCallProperties.call(this); - - try { - this.invoking = true; - - if (matching) { - returnValue = matching.invoke(func, thisValue, args); - } else { - returnValue = (this.func || func).apply(thisValue, args); - } - - var thisCall = this.getCall(this.callCount - 1); - if (thisCall.calledWithNew() && typeof returnValue !== "object") { - returnValue = thisValue; - } - } catch (e) { - exception = e; - } finally { - delete this.invoking; - } - - push.call(this.exceptions, exception); - push.call(this.returnValues, returnValue); - - // Make return value and exception available in the calls: - createCallProperties.call(this); - - if (exception !== undefined) { - throw exception; - } - - return returnValue; - }, - - named: function named(name) { - this.displayName = name; - return this; - }, - - getCall: function getCall(i) { - if (i < 0 || i >= this.callCount) { - return null; - } - - return sinon.spyCall(this, this.thisValues[i], this.args[i], - this.returnValues[i], this.exceptions[i], - this.callIds[i]); - }, - - getCalls: function () { - var calls = []; - var i; - - for (i = 0; i < this.callCount; i++) { - calls.push(this.getCall(i)); - } - - return calls; - }, - - calledBefore: function calledBefore(spyFn) { - if (!this.called) { - return false; - } - - if (!spyFn.called) { - return true; - } - - return this.callIds[0] < spyFn.callIds[spyFn.callIds.length - 1]; - }, - - calledAfter: function calledAfter(spyFn) { - if (!this.called || !spyFn.called) { - return false; - } - - return this.callIds[this.callCount - 1] > spyFn.callIds[spyFn.callCount - 1]; - }, - - withArgs: function () { - var args = slice.call(arguments); - - if (this.fakes) { - var match = matchingFake(this.fakes, args, true); - - if (match) { - return match; - } - } else { - this.fakes = []; - } - - var original = this; - var fake = this.instantiateFake(); - fake.matchingAguments = args; - fake.parent = this; - push.call(this.fakes, fake); - - fake.withArgs = function () { - return original.withArgs.apply(original, arguments); - }; - - for (var i = 0; i < this.args.length; i++) { - if (fake.matches(this.args[i])) { - incrementCallCount.call(fake); - push.call(fake.thisValues, this.thisValues[i]); - push.call(fake.args, this.args[i]); - push.call(fake.returnValues, this.returnValues[i]); - push.call(fake.exceptions, this.exceptions[i]); - push.call(fake.callIds, this.callIds[i]); - } - } - createCallProperties.call(fake); - - return fake; - }, - - matches: function (args, strict) { - var margs = this.matchingAguments; - - if (margs.length <= args.length && - sinon.deepEqual(margs, args.slice(0, margs.length))) { - return !strict || margs.length == args.length; - } - }, - - printf: function (format) { - var spy = this; - var args = slice.call(arguments, 1); - var formatter; - - return (format || "").replace(/%(.)/g, function (match, specifyer) { - formatter = spyApi.formatters[specifyer]; - - if (typeof formatter == "function") { - return formatter.call(null, spy, args); - } else if (!isNaN(parseInt(specifyer, 10))) { - return sinon.format(args[specifyer - 1]); - } - - return "%" + specifyer; - }); - } - }; - - function delegateToCalls(method, matchAny, actual, notCalled) { - spyApi[method] = function () { - if (!this.called) { - if (notCalled) { - return notCalled.apply(this, arguments); - } - return false; - } - - var currentCall; - var matches = 0; - - for (var i = 0, l = this.callCount; i < l; i += 1) { - currentCall = this.getCall(i); - - if (currentCall[actual || method].apply(currentCall, arguments)) { - matches += 1; - - if (matchAny) { - return true; - } - } - } - - return matches === this.callCount; - }; - } - - delegateToCalls("calledOn", true); - delegateToCalls("alwaysCalledOn", false, "calledOn"); - delegateToCalls("calledWith", true); - delegateToCalls("calledWithMatch", true); - delegateToCalls("alwaysCalledWith", false, "calledWith"); - delegateToCalls("alwaysCalledWithMatch", false, "calledWithMatch"); - delegateToCalls("calledWithExactly", true); - delegateToCalls("alwaysCalledWithExactly", false, "calledWithExactly"); - delegateToCalls("neverCalledWith", false, "notCalledWith", - function () { return true; }); - delegateToCalls("neverCalledWithMatch", false, "notCalledWithMatch", - function () { return true; }); - delegateToCalls("threw", true); - delegateToCalls("alwaysThrew", false, "threw"); - delegateToCalls("returned", true); - delegateToCalls("alwaysReturned", false, "returned"); - delegateToCalls("calledWithNew", true); - delegateToCalls("alwaysCalledWithNew", false, "calledWithNew"); - delegateToCalls("callArg", false, "callArgWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgWith = spyApi.callArg; - delegateToCalls("callArgOn", false, "callArgOnWith", function () { - throw new Error(this.toString() + " cannot call arg since it was not yet invoked."); - }); - spyApi.callArgOnWith = spyApi.callArgOn; - delegateToCalls("yield", false, "yield", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - // "invokeCallback" is an alias for "yield" since "yield" is invalid in strict mode. - spyApi.invokeCallback = spyApi.yield; - delegateToCalls("yieldOn", false, "yieldOn", function () { - throw new Error(this.toString() + " cannot yield since it was not yet invoked."); - }); - delegateToCalls("yieldTo", false, "yieldTo", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - delegateToCalls("yieldToOn", false, "yieldToOn", function (property) { - throw new Error(this.toString() + " cannot yield to '" + property + - "' since it was not yet invoked."); - }); - - spyApi.formatters = { - c: function (spy) { - return sinon.timesInWords(spy.callCount); - }, - - n: function (spy) { - return spy.toString(); - }, - - C: function (spy) { - var calls = []; - - for (var i = 0, l = spy.callCount; i < l; ++i) { - var stringifiedCall = " " + spy.getCall(i).toString(); - if (/\n/.test(calls[i - 1])) { - stringifiedCall = "\n" + stringifiedCall; - } - push.call(calls, stringifiedCall); - } - - return calls.length > 0 ? "\n" + calls.join("\n") : ""; - }, - - t: function (spy) { - var objects = []; - - for (var i = 0, l = spy.callCount; i < l; ++i) { - push.call(objects, sinon.format(spy.thisValues[i])); - } - - return objects.join(", "); - }, - - "*": function (spy, args) { - var formatted = []; - - for (var i = 0, l = args.length; i < l; ++i) { - push.call(formatted, sinon.format(args[i])); - } - - return formatted.join(", "); - } - }; - - sinon.extend(spy, spyApi); - - spy.spyCall = sinon.spyCall; - sinon.spy = spy; - - return spy; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./call"); - require("./extend"); - require("./times_in_words"); - require("./format"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./call":27,"./extend":29,"./format":30,"./times_in_words":39,"./util/core":41}],36:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend extend.js - * @depend spy.js - * @depend behavior.js - */ -/** - * Stub functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - function stub(object, property, func) { - if (!!func && typeof func != "function" && typeof func != "object") { - throw new TypeError("Custom stub should be a function or a property descriptor"); - } - - var wrapper; - - if (func) { - if (typeof func == "function") { - wrapper = sinon.spy && sinon.spy.create ? sinon.spy.create(func) : func; - } else { - wrapper = func; - if (sinon.spy && sinon.spy.create) { - var types = sinon.objectKeys(wrapper); - for (var i = 0; i < types.length; i++) { - wrapper[types[i]] = sinon.spy.create(wrapper[types[i]]); - } - } - } - } else { - var stubLength = 0; - if (typeof object == "object" && typeof object[property] == "function") { - stubLength = object[property].length; - } - wrapper = stub.create(stubLength); - } - - if (!object && typeof property === "undefined") { - return sinon.stub.create(); - } - - if (typeof property === "undefined" && typeof object == "object") { - for (var prop in object) { - if (typeof object[prop] === "function") { - stub(object, prop); - } - } - - return object; - } - - return sinon.wrapMethod(object, property, wrapper); - } - - function getDefaultBehavior(stub) { - return stub.defaultBehavior || getParentBehaviour(stub) || sinon.behavior.create(stub); - } - - function getParentBehaviour(stub) { - return (stub.parent && getCurrentBehavior(stub.parent)); - } - - function getCurrentBehavior(stub) { - var behavior = stub.behaviors[stub.callCount - 1]; - return behavior && behavior.isPresent() ? behavior : getDefaultBehavior(stub); - } - - var uuid = 0; - - var proto = { - create: function create(stubLength) { - var functionStub = function () { - return getCurrentBehavior(functionStub).invoke(this, arguments); - }; - - functionStub.id = "stub#" + uuid++; - var orig = functionStub; - functionStub = sinon.spy.create(functionStub, stubLength); - functionStub.func = orig; - - sinon.extend(functionStub, stub); - functionStub.instantiateFake = sinon.stub.create; - functionStub.displayName = "stub"; - functionStub.toString = sinon.functionToString; - - functionStub.defaultBehavior = null; - functionStub.behaviors = []; - - return functionStub; - }, - - resetBehavior: function () { - var i; - - this.defaultBehavior = null; - this.behaviors = []; - - delete this.returnValue; - delete this.returnArgAt; - this.returnThis = false; - - if (this.fakes) { - for (i = 0; i < this.fakes.length; i++) { - this.fakes[i].resetBehavior(); - } - } - }, - - onCall: function onCall(index) { - if (!this.behaviors[index]) { - this.behaviors[index] = sinon.behavior.create(this); - } - - return this.behaviors[index]; - }, - - onFirstCall: function onFirstCall() { - return this.onCall(0); - }, - - onSecondCall: function onSecondCall() { - return this.onCall(1); - }, - - onThirdCall: function onThirdCall() { - return this.onCall(2); - } - }; - - for (var method in sinon.behavior) { - if (sinon.behavior.hasOwnProperty(method) && - !proto.hasOwnProperty(method) && - method != "create" && - method != "withArgs" && - method != "invoke") { - proto[method] = (function (behaviorMethod) { - return function () { - this.defaultBehavior = this.defaultBehavior || sinon.behavior.create(this); - this.defaultBehavior[behaviorMethod].apply(this.defaultBehavior, arguments); - return this; - }; - }(method)); - } - } - - sinon.extend(stub, proto); - sinon.stub = stub; - - return stub; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./behavior"); - require("./spy"); - require("./extend"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./behavior":26,"./extend":29,"./spy":35,"./util/core":41}],37:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend sandbox.js - */ -/** - * Test function, sandboxes fakes - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - var slice = Array.prototype.slice; - - function test(callback) { - var type = typeof callback; - - if (type != "function") { - throw new TypeError("sinon.test needs to wrap a test function, got " + type); - } - - function sinonSandboxedTest() { - var config = sinon.getConfig(sinon.config); - config.injectInto = config.injectIntoThis && this || config.injectInto; - var sandbox = sinon.sandbox.create(config); - var args = slice.call(arguments); - var oldDone = args.length && args[args.length - 1]; - var exception, result; - - if (typeof oldDone == "function") { - args[args.length - 1] = function sinonDone(result) { - if (result) { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - oldDone(result); - }; - } - - try { - result = callback.apply(this, args.concat(sandbox.args)); - } catch (e) { - exception = e; - } - - if (typeof oldDone != "function") { - if (typeof exception !== "undefined") { - sandbox.restore(); - throw exception; - } else { - sandbox.verifyAndRestore(); - } - } - - return result; - } - - if (callback.length) { - return function sinonAsyncSandboxedTest(callback) { - return sinonSandboxedTest.apply(this, arguments); - }; - } - - return sinonSandboxedTest; - } - - test.config = { - injectIntoThis: true, - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeTimers: true, - useFakeServer: true - }; - - sinon.test = test; - return test; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./sandbox"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (sinon) { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./sandbox":34,"./util/core":41}],38:[function(require,module,exports){ -/** - * @depend util/core.js - * @depend test.js - */ -/** - * Test case, sandboxes all test functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - function createTest(property, setUp, tearDown) { - return function () { - if (setUp) { - setUp.apply(this, arguments); - } - - var exception, result; - - try { - result = property.apply(this, arguments); - } catch (e) { - exception = e; - } - - if (tearDown) { - tearDown.apply(this, arguments); - } - - if (exception) { - throw exception; - } - - return result; - }; - } - - function makeApi(sinon) { - function testCase(tests, prefix) { - /*jsl:ignore*/ - if (!tests || typeof tests != "object") { - throw new TypeError("sinon.testCase needs an object with test functions"); - } - /*jsl:end*/ - - prefix = prefix || "test"; - var rPrefix = new RegExp("^" + prefix); - var methods = {}, testName, property, method; - var setUp = tests.setUp; - var tearDown = tests.tearDown; - - for (testName in tests) { - if (tests.hasOwnProperty(testName)) { - property = tests[testName]; - - if (/^(setUp|tearDown)$/.test(testName)) { - continue; - } - - if (typeof property == "function" && rPrefix.test(testName)) { - method = property; - - if (setUp || tearDown) { - method = createTest(property, setUp, tearDown); - } - - methods[testName] = sinon.test(method); - } else { - methods[testName] = tests[testName]; - } - } - } - - return methods; - } - - sinon.testCase = testCase; - return testCase; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - require("./test"); - module.exports = makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./test":37,"./util/core":41}],39:[function(require,module,exports){ -/** - * @depend util/core.js - */ -"use strict"; - -(function (sinon) { - function makeApi(sinon) { - - function timesInWords(count) { - switch (count) { - case 1: - return "once"; - case 2: - return "twice"; - case 3: - return "thrice"; - default: - return (count || 0) + " times"; - } - } - - sinon.timesInWords = timesInWords; - return sinon.timesInWords; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{"./util/core":41}],40:[function(require,module,exports){ -/** - * @depend util/core.js - */ -/** - * Format functions - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -(function (sinon, formatio) { - function makeApi(sinon) { - function typeOf(value) { - if (value === null) { - return "null"; - } else if (value === undefined) { - return "undefined"; - } - var string = Object.prototype.toString.call(value); - return string.substring(8, string.length - 1).toLowerCase(); - }; - - sinon.typeOf = typeOf; - return sinon.typeOf; - } - - function loadDependencies(require, exports, module) { - var sinon = require("./util/core"); - module.exports = makeApi(sinon); - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}( - (typeof sinon == "object" && sinon || null), - (typeof formatio == "object" && formatio) -)); - -},{"./util/core":41}],41:[function(require,module,exports){ -/** - * @depend ../../sinon.js - */ -/** - * Sinon core utilities. For internal use only. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (sinon) { - var div = typeof document != "undefined" && document.createElement("div"); - var hasOwn = Object.prototype.hasOwnProperty; - - function isDOMNode(obj) { - var success = false; - - try { - obj.appendChild(div); - success = div.parentNode == obj; - } catch (e) { - return false; - } finally { - try { - obj.removeChild(div); - } catch (e) { - // Remove failed, not much we can do about that - } - } - - return success; - } - - function isElement(obj) { - return div && obj && obj.nodeType === 1 && isDOMNode(obj); - } - - function isFunction(obj) { - return typeof obj === "function" || !!(obj && obj.constructor && obj.call && obj.apply); - } - - function isReallyNaN(val) { - return typeof val === "number" && isNaN(val); - } - - function mirrorProperties(target, source) { - for (var prop in source) { - if (!hasOwn.call(target, prop)) { - target[prop] = source[prop]; - } - } - } - - function isRestorable(obj) { - return typeof obj === "function" && typeof obj.restore === "function" && obj.restore.sinon; - } - - // Cheap way to detect if we have ES5 support. - var hasES5Support = "keys" in Object; - - function makeApi(sinon) { - sinon.wrapMethod = function wrapMethod(object, property, method) { - if (!object) { - throw new TypeError("Should wrap property of object"); - } - - if (typeof method != "function" && typeof method != "object") { - throw new TypeError("Method wrapper should be a function or a property descriptor"); - } - - function checkWrappedMethod(wrappedMethod) { - if (!isFunction(wrappedMethod)) { - error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + - property + " as function"); - } else if (wrappedMethod.restore && wrappedMethod.restore.sinon) { - error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } else if (wrappedMethod.calledBefore) { - var verb = !!wrappedMethod.returns ? "stubbed" : "spied on"; - error = new TypeError("Attempted to wrap " + property + " which is already " + verb); - } - - if (error) { - if (wrappedMethod && wrappedMethod.stackTrace) { - error.stack += "\n--------------\n" + wrappedMethod.stackTrace; - } - throw error; - } - } - - var error, wrappedMethod; - - // IE 8 does not support hasOwnProperty on the window object and Firefox has a problem - // when using hasOwn.call on objects from other frames. - var owned = object.hasOwnProperty ? object.hasOwnProperty(property) : hasOwn.call(object, property); - - if (hasES5Support) { - var methodDesc = (typeof method == "function") ? {value: method} : method, - wrappedMethodDesc = sinon.getPropertyDescriptor(object, property), - i; - - if (!wrappedMethodDesc) { - error = new TypeError("Attempted to wrap " + (typeof wrappedMethod) + " property " + - property + " as function"); - } else if (wrappedMethodDesc.restore && wrappedMethodDesc.restore.sinon) { - error = new TypeError("Attempted to wrap " + property + " which is already wrapped"); - } - if (error) { - if (wrappedMethodDesc && wrappedMethodDesc.stackTrace) { - error.stack += "\n--------------\n" + wrappedMethodDesc.stackTrace; - } - throw error; - } - - var types = sinon.objectKeys(methodDesc); - for (i = 0; i < types.length; i++) { - wrappedMethod = wrappedMethodDesc[types[i]]; - checkWrappedMethod(wrappedMethod); - } - - mirrorProperties(methodDesc, wrappedMethodDesc); - for (i = 0; i < types.length; i++) { - mirrorProperties(methodDesc[types[i]], wrappedMethodDesc[types[i]]); - } - Object.defineProperty(object, property, methodDesc); - } else { - wrappedMethod = object[property]; - checkWrappedMethod(wrappedMethod); - object[property] = method; - method.displayName = property; - } - - method.displayName = property; - - // Set up a stack trace which can be used later to find what line of - // code the original method was created on. - method.stackTrace = (new Error("Stack Trace for original")).stack; - - method.restore = function () { - // For prototype properties try to reset by delete first. - // If this fails (ex: localStorage on mobile safari) then force a reset - // via direct assignment. - if (!owned) { - try { - delete object[property]; - } catch (e) {} - // For native code functions `delete` fails without throwing an error - // on Chrome < 43, PhantomJS, etc. - // Use strict equality comparison to check failures then force a reset - // via direct assignment. - if (object[property] === method) { - object[property] = wrappedMethod; - } - } else if (hasES5Support) { - Object.defineProperty(object, property, wrappedMethodDesc); - } - - if (!hasES5Support && object[property] === method) { - object[property] = wrappedMethod; - } - }; - - method.restore.sinon = true; - - if (!hasES5Support) { - mirrorProperties(method, wrappedMethod); - } - - return method; - }; - - sinon.create = function create(proto) { - var F = function () {}; - F.prototype = proto; - return new F(); - }; - - sinon.deepEqual = function deepEqual(a, b) { - if (sinon.match && sinon.match.isMatcher(a)) { - return a.test(b); - } - - if (typeof a != "object" || typeof b != "object") { - if (isReallyNaN(a) && isReallyNaN(b)) { - return true; - } else { - return a === b; - } - } - - if (isElement(a) || isElement(b)) { - return a === b; - } - - if (a === b) { - return true; - } - - if ((a === null && b !== null) || (a !== null && b === null)) { - return false; - } - - if (a instanceof RegExp && b instanceof RegExp) { - return (a.source === b.source) && (a.global === b.global) && - (a.ignoreCase === b.ignoreCase) && (a.multiline === b.multiline); - } - - var aString = Object.prototype.toString.call(a); - if (aString != Object.prototype.toString.call(b)) { - return false; - } - - if (aString == "[object Date]") { - return a.valueOf() === b.valueOf(); - } - - var prop, aLength = 0, bLength = 0; - - if (aString == "[object Array]" && a.length !== b.length) { - return false; - } - - for (prop in a) { - aLength += 1; - - if (!(prop in b)) { - return false; - } - - if (!deepEqual(a[prop], b[prop])) { - return false; - } - } - - for (prop in b) { - bLength += 1; - } - - return aLength == bLength; - }; - - sinon.functionName = function functionName(func) { - var name = func.displayName || func.name; - - // Use function decomposition as a last resort to get function - // name. Does not rely on function decomposition to work - if it - // doesn't debugging will be slightly less informative - // (i.e. toString will say 'spy' rather than 'myFunc'). - if (!name) { - var matches = func.toString().match(/function ([^\s\(]+)/); - name = matches && matches[1]; - } - - return name; - }; - - sinon.functionToString = function toString() { - if (this.getCall && this.callCount) { - var thisValue, prop, i = this.callCount; - - while (i--) { - thisValue = this.getCall(i).thisValue; - - for (prop in thisValue) { - if (thisValue[prop] === this) { - return prop; - } - } - } - } - - return this.displayName || "sinon fake"; - }; - - sinon.objectKeys = function objectKeys(obj) { - if (obj !== Object(obj)) { - throw new TypeError("sinon.objectKeys called on a non-object"); - } - - var keys = []; - var key; - for (key in obj) { - if (hasOwn.call(obj, key)) { - keys.push(key); - } - } - - return keys; - }; - - sinon.getPropertyDescriptor = function getPropertyDescriptor(object, property) { - var proto = object, descriptor; - while (proto && !(descriptor = Object.getOwnPropertyDescriptor(proto, property))) { - proto = Object.getPrototypeOf(proto); - } - return descriptor; - } - - sinon.getConfig = function (custom) { - var config = {}; - custom = custom || {}; - var defaults = sinon.defaultConfig; - - for (var prop in defaults) { - if (defaults.hasOwnProperty(prop)) { - config[prop] = custom.hasOwnProperty(prop) ? custom[prop] : defaults[prop]; - } - } - - return config; - }; - - sinon.defaultConfig = { - injectIntoThis: true, - injectInto: null, - properties: ["spy", "stub", "mock", "clock", "server", "requests"], - useFakeTimers: true, - useFakeServer: true - }; - - sinon.timesInWords = function timesInWords(count) { - return count == 1 && "once" || - count == 2 && "twice" || - count == 3 && "thrice" || - (count || 0) + " times"; - }; - - sinon.calledInOrder = function (spies) { - for (var i = 1, l = spies.length; i < l; i++) { - if (!spies[i - 1].calledBefore(spies[i]) || !spies[i].called) { - return false; - } - } - - return true; - }; - - sinon.orderByFirstCall = function (spies) { - return spies.sort(function (a, b) { - // uuid, won't ever be equal - var aCall = a.getCall(0); - var bCall = b.getCall(0); - var aId = aCall && aCall.callId || -1; - var bId = bCall && bCall.callId || -1; - - return aId < bId ? -1 : 1; - }); - }; - - sinon.createStubInstance = function (constructor) { - if (typeof constructor !== "function") { - throw new TypeError("The constructor should be a function."); - } - return sinon.stub(sinon.create(constructor.prototype)); - }; - - sinon.restore = function (object) { - if (object !== null && typeof object === "object") { - for (var prop in object) { - if (isRestorable(object[prop])) { - object[prop].restore(); - } - } - } else if (isRestorable(object)) { - object.restore(); - } - }; - - return sinon; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports) { - makeApi(exports); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports); - } else if (!sinon) { - return; - } else { - makeApi(sinon); - } -}(typeof sinon == "object" && sinon || null)); - -},{}],42:[function(require,module,exports){ -/** - * Minimal Event interface implementation - * - * Original implementation by Sven Fuchs: https://gist.github.com/995028 - * Modifications and tests by Christian Johansen. - * - * @author Sven Fuchs (svenfuchs@artweb-design.de) - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2011 Sven Fuchs, Christian Johansen - */ -"use strict"; - -if (typeof sinon == "undefined") { - this.sinon = {}; -} - -(function () { - var push = [].push; - - function makeApi(sinon) { - sinon.Event = function Event(type, bubbles, cancelable, target) { - this.initEvent(type, bubbles, cancelable, target); - }; - - sinon.Event.prototype = { - initEvent: function (type, bubbles, cancelable, target) { - this.type = type; - this.bubbles = bubbles; - this.cancelable = cancelable; - this.target = target; - }, - - stopPropagation: function () {}, - - preventDefault: function () { - this.defaultPrevented = true; - } - }; - - sinon.ProgressEvent = function ProgressEvent(type, progressEventRaw, target) { - this.initEvent(type, false, false, target); - this.loaded = progressEventRaw.loaded || null; - this.total = progressEventRaw.total || null; - this.lengthComputable = !!progressEventRaw.total; - }; - - sinon.ProgressEvent.prototype = new sinon.Event(); - - sinon.ProgressEvent.prototype.constructor = sinon.ProgressEvent; - - sinon.CustomEvent = function CustomEvent(type, customData, target) { - this.initEvent(type, false, false, target); - this.detail = customData.detail || null; - }; - - sinon.CustomEvent.prototype = new sinon.Event(); - - sinon.CustomEvent.prototype.constructor = sinon.CustomEvent; - - sinon.EventTarget = { - addEventListener: function addEventListener(event, listener) { - this.eventListeners = this.eventListeners || {}; - this.eventListeners[event] = this.eventListeners[event] || []; - push.call(this.eventListeners[event], listener); - }, - - removeEventListener: function removeEventListener(event, listener) { - var listeners = this.eventListeners && this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] == listener) { - return listeners.splice(i, 1); - } - } - }, - - dispatchEvent: function dispatchEvent(event) { - var type = event.type; - var listeners = this.eventListeners && this.eventListeners[type] || []; - - for (var i = 0; i < listeners.length; i++) { - if (typeof listeners[i] == "function") { - listeners[i].call(this, event); - } else { - listeners[i].handleEvent(event); - } - } - - return !!event.defaultPrevented; - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); - } -}()); - -},{"./core":41}],43:[function(require,module,exports){ -/** - * @depend fake_xdomain_request.js - * @depend fake_xml_http_request.js - * @depend ../format.js - * @depend ../log_error.js - */ -/** - * The Sinon "server" mimics a web server that receives requests from - * sinon.FakeXMLHttpRequest and provides an API to respond to those requests, - * both synchronously and asynchronously. To respond synchronuously, canned - * answers have to be provided upfront. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -if (typeof sinon == "undefined") { - var sinon = {}; -} - -(function () { - var push = [].push; - function F() {} - - function create(proto) { - F.prototype = proto; - return new F(); - } - - function responseArray(handler) { - var response = handler; - - if (Object.prototype.toString.call(handler) != "[object Array]") { - response = [200, {}, handler]; - } - - if (typeof response[2] != "string") { - throw new TypeError("Fake server response body should be string, but was " + - typeof response[2]); - } - - return response; - } - - var wloc = typeof window !== "undefined" ? window.location : {}; - var rCurrLoc = new RegExp("^" + wloc.protocol + "//" + wloc.host); - - function matchOne(response, reqMethod, reqUrl) { - var rmeth = response.method; - var matchMethod = !rmeth || rmeth.toLowerCase() == reqMethod.toLowerCase(); - var url = response.url; - var matchUrl = !url || url == reqUrl || (typeof url.test == "function" && url.test(reqUrl)); - - return matchMethod && matchUrl; - } - - function match(response, request) { - var requestUrl = request.url; - - if (!/^https?:\/\//.test(requestUrl) || rCurrLoc.test(requestUrl)) { - requestUrl = requestUrl.replace(rCurrLoc, ""); - } - - if (matchOne(response, this.getHTTPMethod(request), requestUrl)) { - if (typeof response.response == "function") { - var ru = response.url; - var args = [request].concat(ru && typeof ru.exec == "function" ? ru.exec(requestUrl).slice(1) : []); - return response.response.apply(response, args); - } - - return true; - } - - return false; - } - - function makeApi(sinon) { - sinon.fakeServer = { - create: function () { - var server = create(this); - if (!sinon.xhr.supportsCORS) { - this.xhr = sinon.useFakeXDomainRequest(); - } else { - this.xhr = sinon.useFakeXMLHttpRequest(); - } - server.requests = []; - - this.xhr.onCreate = function (xhrObj) { - server.addRequest(xhrObj); - }; - - return server; - }, - - addRequest: function addRequest(xhrObj) { - var server = this; - push.call(this.requests, xhrObj); - - xhrObj.onSend = function () { - server.handleRequest(this); - - if (server.respondImmediately) { - server.respond(); - } else if (server.autoRespond && !server.responding) { - setTimeout(function () { - server.responding = false; - server.respond(); - }, server.autoRespondAfter || 10); - - server.responding = true; - } - }; - }, - - getHTTPMethod: function getHTTPMethod(request) { - if (this.fakeHTTPMethods && /post/i.test(request.method)) { - var matches = (request.requestBody || "").match(/_method=([^\b;]+)/); - return !!matches ? matches[1] : request.method; - } - - return request.method; - }, - - handleRequest: function handleRequest(xhr) { - if (xhr.async) { - if (!this.queue) { - this.queue = []; - } - - push.call(this.queue, xhr); - } else { - this.processRequest(xhr); - } - }, - - log: function log(response, request) { - var str; - - str = "Request:\n" + sinon.format(request) + "\n\n"; - str += "Response:\n" + sinon.format(response) + "\n\n"; - - sinon.log(str); - }, - - respondWith: function respondWith(method, url, body) { - if (arguments.length == 1 && typeof method != "function") { - this.response = responseArray(method); - return; - } - - if (!this.responses) { this.responses = []; } - - if (arguments.length == 1) { - body = method; - url = method = null; - } - - if (arguments.length == 2) { - body = url; - url = method; - method = null; - } - - push.call(this.responses, { - method: method, - url: url, - response: typeof body == "function" ? body : responseArray(body) - }); - }, - - respond: function respond() { - if (arguments.length > 0) { - this.respondWith.apply(this, arguments); - } - - var queue = this.queue || []; - var requests = queue.splice(0, queue.length); - var request; - - while (request = requests.shift()) { - this.processRequest(request); - } - }, - - processRequest: function processRequest(request) { - try { - if (request.aborted) { - return; - } - - var response = this.response || [404, {}, ""]; - - if (this.responses) { - for (var l = this.responses.length, i = l - 1; i >= 0; i--) { - if (match.call(this, this.responses[i], request)) { - response = this.responses[i].response; - break; - } - } - } - - if (request.readyState != 4) { - this.log(response, request); - - request.respond(response[0], response[1], response[2]); - } - } catch (e) { - sinon.logError("Fake server request processing", e); - } - }, - - restore: function restore() { - return this.xhr.restore && this.xhr.restore.apply(this.xhr, arguments); - } - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("./fake_xdomain_request"); - require("./fake_xml_http_request"); - require("../format"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else { - makeApi(sinon); - } -}()); - -},{"../format":30,"./core":41,"./fake_xdomain_request":46,"./fake_xml_http_request":47}],44:[function(require,module,exports){ -/** - * @depend fake_server.js - * @depend fake_timers.js - */ -/** - * Add-on for sinon.fakeServer that automatically handles a fake timer along with - * the FakeXMLHttpRequest. The direct inspiration for this add-on is jQuery - * 1.3.x, which does not use xhr object's onreadystatehandler at all - instead, - * it polls the object for completion with setInterval. Dispite the direct - * motivation, there is nothing jQuery-specific in this file, so it can be used - * in any environment where the ajax implementation depends on setInterval or - * setTimeout. - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function () { - function makeApi(sinon) { - function Server() {} - Server.prototype = sinon.fakeServer; - - sinon.fakeServerWithClock = new Server(); - - sinon.fakeServerWithClock.addRequest = function addRequest(xhr) { - if (xhr.async) { - if (typeof setTimeout.clock == "object") { - this.clock = setTimeout.clock; - } else { - this.clock = sinon.useFakeTimers(); - this.resetClock = true; - } - - if (!this.longestTimeout) { - var clockSetTimeout = this.clock.setTimeout; - var clockSetInterval = this.clock.setInterval; - var server = this; - - this.clock.setTimeout = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetTimeout.apply(this, arguments); - }; - - this.clock.setInterval = function (fn, timeout) { - server.longestTimeout = Math.max(timeout, server.longestTimeout || 0); - - return clockSetInterval.apply(this, arguments); - }; - } - } - - return sinon.fakeServer.addRequest.call(this, xhr); - }; - - sinon.fakeServerWithClock.respond = function respond() { - var returnVal = sinon.fakeServer.respond.apply(this, arguments); - - if (this.clock) { - this.clock.tick(this.longestTimeout || 0); - this.longestTimeout = 0; - - if (this.resetClock) { - this.clock.restore(); - this.resetClock = false; - } - } - - return returnVal; - }; - - sinon.fakeServerWithClock.restore = function restore() { - if (this.clock) { - this.clock.restore(); - } - - return sinon.fakeServer.restore.apply(this, arguments); - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require) { - var sinon = require("./core"); - require("./fake_server"); - require("./fake_timers"); - makeApi(sinon); - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require); - } else { - makeApi(sinon); - } -}()); - -},{"./core":41,"./fake_server":43,"./fake_timers":45}],45:[function(require,module,exports){ -(function (global){ -/*global lolex */ - -/** - * Fake timer API - * setTimeout - * setInterval - * clearTimeout - * clearInterval - * tick - * reset - * Date - * - * Inspired by jsUnitMockTimeOut from JsUnit - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -if (typeof sinon == "undefined") { - var sinon = {}; -} - -(function (global) { - function makeApi(sinon, lol) { - var llx = typeof lolex !== "undefined" ? lolex : lol; - - sinon.useFakeTimers = function () { - var now, methods = Array.prototype.slice.call(arguments); - - if (typeof methods[0] === "string") { - now = 0; - } else { - now = methods.shift(); - } - - var clock = llx.install(now || 0, methods); - clock.restore = clock.uninstall; - return clock; - }; - - sinon.clock = { - create: function (now) { - return llx.createClock(now); - } - }; - - sinon.timers = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), - clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate : undefined), - setInterval: setInterval, - clearInterval: clearInterval, - Date: Date - }; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, epxorts, module, lolex) { - var sinon = require("./core"); - makeApi(sinon, lolex); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module, require("lolex")); - } else { - makeApi(sinon); - } -}(typeof global != "undefined" && typeof global !== "function" ? global : this)); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./core":41,"lolex":50}],46:[function(require,module,exports){ -/** - * @depend core.js - * @depend ../extend.js - * @depend event.js - * @depend ../log_error.js - */ -/** - * Fake XDomainRequest object - */ -"use strict"; - -if (typeof sinon == "undefined") { - this.sinon = {}; -} - -// wrapper for global -(function (global) { - var xdr = { XDomainRequest: global.XDomainRequest }; - xdr.GlobalXDomainRequest = global.XDomainRequest; - xdr.supportsXDR = typeof xdr.GlobalXDomainRequest != "undefined"; - xdr.workingXDR = xdr.supportsXDR ? xdr.GlobalXDomainRequest : false; - - function makeApi(sinon) { - sinon.xdr = xdr; - - function FakeXDomainRequest() { - this.readyState = FakeXDomainRequest.UNSENT; - this.requestBody = null; - this.requestHeaders = {}; - this.status = 0; - this.timeout = null; - - if (typeof FakeXDomainRequest.onCreate == "function") { - FakeXDomainRequest.onCreate(this); - } - } - - function verifyState(xdr) { - if (xdr.readyState !== FakeXDomainRequest.OPENED) { - throw new Error("INVALID_STATE_ERR"); - } - - if (xdr.sendFlag) { - throw new Error("INVALID_STATE_ERR"); - } - } - - function verifyRequestSent(xdr) { - if (xdr.readyState == FakeXDomainRequest.UNSENT) { - throw new Error("Request not sent"); - } - if (xdr.readyState == FakeXDomainRequest.DONE) { - throw new Error("Request done"); - } - } - - function verifyResponseBodyType(body) { - if (typeof body != "string") { - var error = new Error("Attempted to respond to fake XDomainRequest with " + - body + ", which is not a string."); - error.name = "InvalidBodyException"; - throw error; - } - } - - sinon.extend(FakeXDomainRequest.prototype, sinon.EventTarget, { - open: function open(method, url) { - this.method = method; - this.url = url; - - this.responseText = null; - this.sendFlag = false; - - this.readyStateChange(FakeXDomainRequest.OPENED); - }, - - readyStateChange: function readyStateChange(state) { - this.readyState = state; - var eventName = ""; - switch (this.readyState) { - case FakeXDomainRequest.UNSENT: - break; - case FakeXDomainRequest.OPENED: - break; - case FakeXDomainRequest.LOADING: - if (this.sendFlag) { - //raise the progress event - eventName = "onprogress"; - } - break; - case FakeXDomainRequest.DONE: - if (this.isTimeout) { - eventName = "ontimeout" - } else if (this.errorFlag || (this.status < 200 || this.status > 299)) { - eventName = "onerror"; - } else { - eventName = "onload" - } - break; - } - - // raising event (if defined) - if (eventName) { - if (typeof this[eventName] == "function") { - try { - this[eventName](); - } catch (e) { - sinon.logError("Fake XHR " + eventName + " handler", e); - } - } - } - }, - - send: function send(data) { - verifyState(this); - - if (!/^(get|head)$/i.test(this.method)) { - this.requestBody = data; - } - this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; - - this.errorFlag = false; - this.sendFlag = true; - this.readyStateChange(FakeXDomainRequest.OPENED); - - if (typeof this.onSend == "function") { - this.onSend(this); - } - }, - - abort: function abort() { - this.aborted = true; - this.responseText = null; - this.errorFlag = true; - - if (this.readyState > sinon.FakeXDomainRequest.UNSENT && this.sendFlag) { - this.readyStateChange(sinon.FakeXDomainRequest.DONE); - this.sendFlag = false; - } - }, - - setResponseBody: function setResponseBody(body) { - verifyRequestSent(this); - verifyResponseBodyType(body); - - var chunkSize = this.chunkSize || 10; - var index = 0; - this.responseText = ""; - - do { - this.readyStateChange(FakeXDomainRequest.LOADING); - this.responseText += body.substring(index, index + chunkSize); - index += chunkSize; - } while (index < body.length); - - this.readyStateChange(FakeXDomainRequest.DONE); - }, - - respond: function respond(status, contentType, body) { - // content-type ignored, since XDomainRequest does not carry this - // we keep the same syntax for respond(...) as for FakeXMLHttpRequest to ease - // test integration across browsers - this.status = typeof status == "number" ? status : 200; - this.setResponseBody(body || ""); - }, - - simulatetimeout: function simulatetimeout() { - this.status = 0; - this.isTimeout = true; - // Access to this should actually throw an error - this.responseText = undefined; - this.readyStateChange(FakeXDomainRequest.DONE); - } - }); - - sinon.extend(FakeXDomainRequest, { - UNSENT: 0, - OPENED: 1, - LOADING: 3, - DONE: 4 - }); - - sinon.useFakeXDomainRequest = function useFakeXDomainRequest() { - sinon.FakeXDomainRequest.restore = function restore(keepOnCreate) { - if (xdr.supportsXDR) { - global.XDomainRequest = xdr.GlobalXDomainRequest; - } - - delete sinon.FakeXDomainRequest.restore; - - if (keepOnCreate !== true) { - delete sinon.FakeXDomainRequest.onCreate; - } - }; - if (xdr.supportsXDR) { - global.XDomainRequest = sinon.FakeXDomainRequest; - } - return sinon.FakeXDomainRequest; - }; - - sinon.FakeXDomainRequest = FakeXDomainRequest; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("../extend"); - require("./event"); - require("../log_error"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else { - makeApi(sinon); - } -})(this); - -},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],47:[function(require,module,exports){ -(function (global){ -/** - * @depend core.js - * @depend ../extend.js - * @depend event.js - * @depend ../log_error.js - */ -/** - * Fake XMLHttpRequest object - * - * @author Christian Johansen (christian@cjohansen.no) - * @license BSD - * - * Copyright (c) 2010-2013 Christian Johansen - */ -"use strict"; - -(function (global) { - - var supportsProgress = typeof ProgressEvent !== "undefined"; - var supportsCustomEvent = typeof CustomEvent !== "undefined"; - var sinonXhr = { XMLHttpRequest: global.XMLHttpRequest }; - sinonXhr.GlobalXMLHttpRequest = global.XMLHttpRequest; - sinonXhr.GlobalActiveXObject = global.ActiveXObject; - sinonXhr.supportsActiveX = typeof sinonXhr.GlobalActiveXObject != "undefined"; - sinonXhr.supportsXHR = typeof sinonXhr.GlobalXMLHttpRequest != "undefined"; - sinonXhr.workingXHR = sinonXhr.supportsXHR ? sinonXhr.GlobalXMLHttpRequest : sinonXhr.supportsActiveX - ? function () { return new sinonXhr.GlobalActiveXObject("MSXML2.XMLHTTP.3.0") } : false; - sinonXhr.supportsCORS = sinonXhr.supportsXHR && "withCredentials" in (new sinonXhr.GlobalXMLHttpRequest()); - - /*jsl:ignore*/ - var unsafeHeaders = { - "Accept-Charset": true, - "Accept-Encoding": true, - Connection: true, - "Content-Length": true, - Cookie: true, - Cookie2: true, - "Content-Transfer-Encoding": true, - Date: true, - Expect: true, - Host: true, - "Keep-Alive": true, - Referer: true, - TE: true, - Trailer: true, - "Transfer-Encoding": true, - Upgrade: true, - "User-Agent": true, - Via: true - }; - /*jsl:end*/ - - function FakeXMLHttpRequest() { - this.readyState = FakeXMLHttpRequest.UNSENT; - this.requestHeaders = {}; - this.requestBody = null; - this.status = 0; - this.statusText = ""; - this.upload = new UploadProgress(); - if (sinonXhr.supportsCORS) { - this.withCredentials = false; - } - - var xhr = this; - var events = ["loadstart", "load", "abort", "loadend"]; - - function addEventListener(eventName) { - xhr.addEventListener(eventName, function (event) { - var listener = xhr["on" + eventName]; - - if (listener && typeof listener == "function") { - listener.call(this, event); - } - }); - } - - for (var i = events.length - 1; i >= 0; i--) { - addEventListener(events[i]); - } - - if (typeof FakeXMLHttpRequest.onCreate == "function") { - FakeXMLHttpRequest.onCreate(this); - } - } - - // An upload object is created for each - // FakeXMLHttpRequest and allows upload - // events to be simulated using uploadProgress - // and uploadError. - function UploadProgress() { - this.eventListeners = { - progress: [], - load: [], - abort: [], - error: [] - } - } - - UploadProgress.prototype.addEventListener = function addEventListener(event, listener) { - this.eventListeners[event].push(listener); - }; - - UploadProgress.prototype.removeEventListener = function removeEventListener(event, listener) { - var listeners = this.eventListeners[event] || []; - - for (var i = 0, l = listeners.length; i < l; ++i) { - if (listeners[i] == listener) { - return listeners.splice(i, 1); - } - } - }; - - UploadProgress.prototype.dispatchEvent = function dispatchEvent(event) { - var listeners = this.eventListeners[event.type] || []; - - for (var i = 0, listener; (listener = listeners[i]) != null; i++) { - listener(event); - } - }; - - function verifyState(xhr) { - if (xhr.readyState !== FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR"); - } - - if (xhr.sendFlag) { - throw new Error("INVALID_STATE_ERR"); - } - } - - function getHeader(headers, header) { - header = header.toLowerCase(); - - for (var h in headers) { - if (h.toLowerCase() == header) { - return h; - } - } - - return null; - } - - // filtering to enable a white-list version of Sinon FakeXhr, - // where whitelisted requests are passed through to real XHR - function each(collection, callback) { - if (!collection) { - return; - } - - for (var i = 0, l = collection.length; i < l; i += 1) { - callback(collection[i]); - } - } - function some(collection, callback) { - for (var index = 0; index < collection.length; index++) { - if (callback(collection[index]) === true) { - return true; - } - } - return false; - } - // largest arity in XHR is 5 - XHR#open - var apply = function (obj, method, args) { - switch (args.length) { - case 0: return obj[method](); - case 1: return obj[method](args[0]); - case 2: return obj[method](args[0], args[1]); - case 3: return obj[method](args[0], args[1], args[2]); - case 4: return obj[method](args[0], args[1], args[2], args[3]); - case 5: return obj[method](args[0], args[1], args[2], args[3], args[4]); - } - }; - - FakeXMLHttpRequest.filters = []; - FakeXMLHttpRequest.addFilter = function addFilter(fn) { - this.filters.push(fn) - }; - var IE6Re = /MSIE 6/; - FakeXMLHttpRequest.defake = function defake(fakeXhr, xhrArgs) { - var xhr = new sinonXhr.workingXHR(); - each([ - "open", - "setRequestHeader", - "send", - "abort", - "getResponseHeader", - "getAllResponseHeaders", - "addEventListener", - "overrideMimeType", - "removeEventListener" - ], function (method) { - fakeXhr[method] = function () { - return apply(xhr, method, arguments); - }; - }); - - var copyAttrs = function (args) { - each(args, function (attr) { - try { - fakeXhr[attr] = xhr[attr] - } catch (e) { - if (!IE6Re.test(navigator.userAgent)) { - throw e; - } - } - }); - }; - - var stateChange = function stateChange() { - fakeXhr.readyState = xhr.readyState; - if (xhr.readyState >= FakeXMLHttpRequest.HEADERS_RECEIVED) { - copyAttrs(["status", "statusText"]); - } - if (xhr.readyState >= FakeXMLHttpRequest.LOADING) { - copyAttrs(["responseText", "response"]); - } - if (xhr.readyState === FakeXMLHttpRequest.DONE) { - copyAttrs(["responseXML"]); - } - if (fakeXhr.onreadystatechange) { - fakeXhr.onreadystatechange.call(fakeXhr, { target: fakeXhr }); - } - }; - - if (xhr.addEventListener) { - for (var event in fakeXhr.eventListeners) { - if (fakeXhr.eventListeners.hasOwnProperty(event)) { - each(fakeXhr.eventListeners[event], function (handler) { - xhr.addEventListener(event, handler); - }); - } - } - xhr.addEventListener("readystatechange", stateChange); - } else { - xhr.onreadystatechange = stateChange; - } - apply(xhr, "open", xhrArgs); - }; - FakeXMLHttpRequest.useFilters = false; - - function verifyRequestOpened(xhr) { - if (xhr.readyState != FakeXMLHttpRequest.OPENED) { - throw new Error("INVALID_STATE_ERR - " + xhr.readyState); - } - } - - function verifyRequestSent(xhr) { - if (xhr.readyState == FakeXMLHttpRequest.DONE) { - throw new Error("Request done"); - } - } - - function verifyHeadersReceived(xhr) { - if (xhr.async && xhr.readyState != FakeXMLHttpRequest.HEADERS_RECEIVED) { - throw new Error("No headers received"); - } - } - - function verifyResponseBodyType(body) { - if (typeof body != "string") { - var error = new Error("Attempted to respond to fake XMLHttpRequest with " + - body + ", which is not a string."); - error.name = "InvalidBodyException"; - throw error; - } - } - - FakeXMLHttpRequest.parseXML = function parseXML(text) { - var xmlDoc; - - if (typeof DOMParser != "undefined") { - var parser = new DOMParser(); - xmlDoc = parser.parseFromString(text, "text/xml"); - } else { - xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); - xmlDoc.async = "false"; - xmlDoc.loadXML(text); - } - - return xmlDoc; - }; - - FakeXMLHttpRequest.statusCodes = { - 100: "Continue", - 101: "Switching Protocols", - 200: "OK", - 201: "Created", - 202: "Accepted", - 203: "Non-Authoritative Information", - 204: "No Content", - 205: "Reset Content", - 206: "Partial Content", - 207: "Multi-Status", - 300: "Multiple Choice", - 301: "Moved Permanently", - 302: "Found", - 303: "See Other", - 304: "Not Modified", - 305: "Use Proxy", - 307: "Temporary Redirect", - 400: "Bad Request", - 401: "Unauthorized", - 402: "Payment Required", - 403: "Forbidden", - 404: "Not Found", - 405: "Method Not Allowed", - 406: "Not Acceptable", - 407: "Proxy Authentication Required", - 408: "Request Timeout", - 409: "Conflict", - 410: "Gone", - 411: "Length Required", - 412: "Precondition Failed", - 413: "Request Entity Too Large", - 414: "Request-URI Too Long", - 415: "Unsupported Media Type", - 416: "Requested Range Not Satisfiable", - 417: "Expectation Failed", - 422: "Unprocessable Entity", - 500: "Internal Server Error", - 501: "Not Implemented", - 502: "Bad Gateway", - 503: "Service Unavailable", - 504: "Gateway Timeout", - 505: "HTTP Version Not Supported" - }; - - function makeApi(sinon) { - sinon.xhr = sinonXhr; - - sinon.extend(FakeXMLHttpRequest.prototype, sinon.EventTarget, { - async: true, - - open: function open(method, url, async, username, password) { - this.method = method; - this.url = url; - this.async = typeof async == "boolean" ? async : true; - this.username = username; - this.password = password; - this.responseText = null; - this.responseXML = null; - this.requestHeaders = {}; - this.sendFlag = false; - - if (FakeXMLHttpRequest.useFilters === true) { - var xhrArgs = arguments; - var defake = some(FakeXMLHttpRequest.filters, function (filter) { - return filter.apply(this, xhrArgs) - }); - if (defake) { - return FakeXMLHttpRequest.defake(this, arguments); - } - } - this.readyStateChange(FakeXMLHttpRequest.OPENED); - }, - - readyStateChange: function readyStateChange(state) { - this.readyState = state; - - if (typeof this.onreadystatechange == "function") { - try { - this.onreadystatechange(); - } catch (e) { - sinon.logError("Fake XHR onreadystatechange handler", e); - } - } - - this.dispatchEvent(new sinon.Event("readystatechange")); - - switch (this.readyState) { - case FakeXMLHttpRequest.DONE: - this.dispatchEvent(new sinon.Event("load", false, false, this)); - this.dispatchEvent(new sinon.Event("loadend", false, false, this)); - this.upload.dispatchEvent(new sinon.Event("load", false, false, this)); - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - this.dispatchEvent(new sinon.ProgressEvent("progress", {loaded: 100, total: 100})); - } - break; - } - }, - - setRequestHeader: function setRequestHeader(header, value) { - verifyState(this); - - if (unsafeHeaders[header] || /^(Sec-|Proxy-)/.test(header)) { - throw new Error("Refused to set unsafe header \"" + header + "\""); - } - - if (this.requestHeaders[header]) { - this.requestHeaders[header] += "," + value; - } else { - this.requestHeaders[header] = value; - } - }, - - // Helps testing - setResponseHeaders: function setResponseHeaders(headers) { - verifyRequestOpened(this); - this.responseHeaders = {}; - - for (var header in headers) { - if (headers.hasOwnProperty(header)) { - this.responseHeaders[header] = headers[header]; - } - } - - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.HEADERS_RECEIVED); - } else { - this.readyState = FakeXMLHttpRequest.HEADERS_RECEIVED; - } - }, - - // Currently treats ALL data as a DOMString (i.e. no Document) - send: function send(data) { - verifyState(this); - - if (!/^(get|head)$/i.test(this.method)) { - var contentType = getHeader(this.requestHeaders, "Content-Type"); - if (this.requestHeaders[contentType]) { - var value = this.requestHeaders[contentType].split(";"); - this.requestHeaders[contentType] = value[0] + ";charset=utf-8"; - } else if (!(data instanceof FormData)) { - this.requestHeaders["Content-Type"] = "text/plain;charset=utf-8"; - } - - this.requestBody = data; - } - - this.errorFlag = false; - this.sendFlag = this.async; - this.readyStateChange(FakeXMLHttpRequest.OPENED); - - if (typeof this.onSend == "function") { - this.onSend(this); - } - - this.dispatchEvent(new sinon.Event("loadstart", false, false, this)); - }, - - abort: function abort() { - this.aborted = true; - this.responseText = null; - this.errorFlag = true; - this.requestHeaders = {}; - - if (this.readyState > FakeXMLHttpRequest.UNSENT && this.sendFlag) { - this.readyStateChange(FakeXMLHttpRequest.DONE); - this.sendFlag = false; - } - - this.readyState = FakeXMLHttpRequest.UNSENT; - - this.dispatchEvent(new sinon.Event("abort", false, false, this)); - - this.upload.dispatchEvent(new sinon.Event("abort", false, false, this)); - - if (typeof this.onerror === "function") { - this.onerror(); - } - }, - - getResponseHeader: function getResponseHeader(header) { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return null; - } - - if (/^Set-Cookie2?$/i.test(header)) { - return null; - } - - header = getHeader(this.responseHeaders, header); - - return this.responseHeaders[header] || null; - }, - - getAllResponseHeaders: function getAllResponseHeaders() { - if (this.readyState < FakeXMLHttpRequest.HEADERS_RECEIVED) { - return ""; - } - - var headers = ""; - - for (var header in this.responseHeaders) { - if (this.responseHeaders.hasOwnProperty(header) && - !/^Set-Cookie2?$/i.test(header)) { - headers += header + ": " + this.responseHeaders[header] + "\r\n"; - } - } - - return headers; - }, - - setResponseBody: function setResponseBody(body) { - verifyRequestSent(this); - verifyHeadersReceived(this); - verifyResponseBodyType(body); - - var chunkSize = this.chunkSize || 10; - var index = 0; - this.responseText = ""; - - do { - if (this.async) { - this.readyStateChange(FakeXMLHttpRequest.LOADING); - } - - this.responseText += body.substring(index, index + chunkSize); - index += chunkSize; - } while (index < body.length); - - var type = this.getResponseHeader("Content-Type"); - - if (this.responseText && - (!type || /(text\/xml)|(application\/xml)|(\+xml)/.test(type))) { - try { - this.responseXML = FakeXMLHttpRequest.parseXML(this.responseText); - } catch (e) { - // Unable to parse XML - no biggie - } - } - - this.readyStateChange(FakeXMLHttpRequest.DONE); - }, - - respond: function respond(status, headers, body) { - this.status = typeof status == "number" ? status : 200; - this.statusText = FakeXMLHttpRequest.statusCodes[this.status]; - this.setResponseHeaders(headers || {}); - this.setResponseBody(body || ""); - }, - - uploadProgress: function uploadProgress(progressEventRaw) { - if (supportsProgress) { - this.upload.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - downloadProgress: function downloadProgress(progressEventRaw) { - if (supportsProgress) { - this.dispatchEvent(new sinon.ProgressEvent("progress", progressEventRaw)); - } - }, - - uploadError: function uploadError(error) { - if (supportsCustomEvent) { - this.upload.dispatchEvent(new sinon.CustomEvent("error", {detail: error})); - } - } - }); - - sinon.extend(FakeXMLHttpRequest, { - UNSENT: 0, - OPENED: 1, - HEADERS_RECEIVED: 2, - LOADING: 3, - DONE: 4 - }); - - sinon.useFakeXMLHttpRequest = function () { - FakeXMLHttpRequest.restore = function restore(keepOnCreate) { - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = sinonXhr.GlobalXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = sinonXhr.GlobalActiveXObject; - } - - delete FakeXMLHttpRequest.restore; - - if (keepOnCreate !== true) { - delete FakeXMLHttpRequest.onCreate; - } - }; - if (sinonXhr.supportsXHR) { - global.XMLHttpRequest = FakeXMLHttpRequest; - } - - if (sinonXhr.supportsActiveX) { - global.ActiveXObject = function ActiveXObject(objId) { - if (objId == "Microsoft.XMLHTTP" || /^Msxml2\.XMLHTTP/i.test(objId)) { - - return new FakeXMLHttpRequest(); - } - - return new sinonXhr.GlobalActiveXObject(objId); - }; - } - - return FakeXMLHttpRequest; - }; - - sinon.FakeXMLHttpRequest = FakeXMLHttpRequest; - } - - var isNode = typeof module !== "undefined" && module.exports && typeof require == "function"; - var isAMD = typeof define === "function" && typeof define.amd === "object" && define.amd; - - function loadDependencies(require, exports, module) { - var sinon = require("./core"); - require("../extend"); - require("./event"); - require("../log_error"); - makeApi(sinon); - module.exports = sinon; - } - - if (isAMD) { - define(loadDependencies); - } else if (isNode) { - loadDependencies(require, module.exports, module); - } else if (typeof sinon === "undefined") { - return; - } else { - makeApi(sinon); - } - -})(typeof global !== "undefined" ? global : this); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"../extend":29,"../log_error":31,"./core":41,"./event":42}],48:[function(require,module,exports){ -(function (global){ -((typeof define === "function" && define.amd && function (m) { - define("formatio", ["samsam"], m); -}) || (typeof module === "object" && function (m) { - module.exports = m(require("samsam")); -}) || function (m) { this.formatio = m(this.samsam); } -)(function (samsam) { - "use strict"; - - var formatio = { - excludeConstructors: ["Object", /^.$/], - quoteStrings: true, - limitChildrenCount: 0 - }; - - var hasOwn = Object.prototype.hasOwnProperty; - - var specialObjects = []; - if (typeof global !== "undefined") { - specialObjects.push({ object: global, value: "[object global]" }); - } - if (typeof document !== "undefined") { - specialObjects.push({ - object: document, - value: "[object HTMLDocument]" - }); - } - if (typeof window !== "undefined") { - specialObjects.push({ object: window, value: "[object Window]" }); - } - - function functionName(func) { - if (!func) { return ""; } - if (func.displayName) { return func.displayName; } - if (func.name) { return func.name; } - var matches = func.toString().match(/function\s+([^\(]+)/m); - return (matches && matches[1]) || ""; - } - - function constructorName(f, object) { - var name = functionName(object && object.constructor); - var excludes = f.excludeConstructors || - formatio.excludeConstructors || []; - - var i, l; - for (i = 0, l = excludes.length; i < l; ++i) { - if (typeof excludes[i] === "string" && excludes[i] === name) { - return ""; - } else if (excludes[i].test && excludes[i].test(name)) { - return ""; - } - } - - return name; - } - - function isCircular(object, objects) { - if (typeof object !== "object") { return false; } - var i, l; - for (i = 0, l = objects.length; i < l; ++i) { - if (objects[i] === object) { return true; } - } - return false; - } - - function ascii(f, object, processed, indent) { - if (typeof object === "string") { - var qs = f.quoteStrings; - var quote = typeof qs !== "boolean" || qs; - return processed || quote ? '"' + object + '"' : object; - } - - if (typeof object === "function" && !(object instanceof RegExp)) { - return ascii.func(object); - } - - processed = processed || []; - - if (isCircular(object, processed)) { return "[Circular]"; } - - if (Object.prototype.toString.call(object) === "[object Array]") { - return ascii.array.call(f, object, processed); - } - - if (!object) { return String((1/object) === -Infinity ? "-0" : object); } - if (samsam.isElement(object)) { return ascii.element(object); } - - if (typeof object.toString === "function" && - object.toString !== Object.prototype.toString) { - return object.toString(); - } - - var i, l; - for (i = 0, l = specialObjects.length; i < l; i++) { - if (object === specialObjects[i].object) { - return specialObjects[i].value; - } - } - - return ascii.object.call(f, object, processed, indent); - } - - ascii.func = function (func) { - return "function " + functionName(func) + "() {}"; - }; - - ascii.array = function (array, processed) { - processed = processed || []; - processed.push(array); - var pieces = []; - var i, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, array.length) : array.length; - - for (i = 0; i < l; ++i) { - pieces.push(ascii(this, array[i], processed)); - } - - if(l < array.length) - pieces.push("[... " + (array.length - l) + " more elements]"); - - return "[" + pieces.join(", ") + "]"; - }; - - ascii.object = function (object, processed, indent) { - processed = processed || []; - processed.push(object); - indent = indent || 0; - var pieces = [], properties = samsam.keys(object).sort(); - var length = 3; - var prop, str, obj, i, k, l; - l = (this.limitChildrenCount > 0) ? - Math.min(this.limitChildrenCount, properties.length) : properties.length; - - for (i = 0; i < l; ++i) { - prop = properties[i]; - obj = object[prop]; - - if (isCircular(obj, processed)) { - str = "[Circular]"; - } else { - str = ascii(this, obj, processed, indent + 2); - } - - str = (/\s/.test(prop) ? '"' + prop + '"' : prop) + ": " + str; - length += str.length; - pieces.push(str); - } - - var cons = constructorName(this, object); - var prefix = cons ? "[" + cons + "] " : ""; - var is = ""; - for (i = 0, k = indent; i < k; ++i) { is += " "; } - - if(l < properties.length) - pieces.push("[... " + (properties.length - l) + " more elements]"); - - if (length + indent > 80) { - return prefix + "{\n " + is + pieces.join(",\n " + is) + "\n" + - is + "}"; - } - return prefix + "{ " + pieces.join(", ") + " }"; - }; - - ascii.element = function (element) { - var tagName = element.tagName.toLowerCase(); - var attrs = element.attributes, attr, pairs = [], attrName, i, l, val; - - for (i = 0, l = attrs.length; i < l; ++i) { - attr = attrs.item(i); - attrName = attr.nodeName.toLowerCase().replace("html:", ""); - val = attr.nodeValue; - if (attrName !== "contenteditable" || val !== "inherit") { - if (!!val) { pairs.push(attrName + "=\"" + val + "\""); } - } - } - - var formatted = "<" + tagName + (pairs.length > 0 ? " " : ""); - var content = element.innerHTML; - - if (content.length > 20) { - content = content.substr(0, 20) + "[...]"; - } - - var res = formatted + pairs.join(" ") + ">" + content + - ""; - - return res.replace(/ contentEditable="inherit"/, ""); - }; - - function Formatio(options) { - for (var opt in options) { - this[opt] = options[opt]; - } - } - - Formatio.prototype = { - functionName: functionName, - - configure: function (options) { - return new Formatio(options); - }, - - constructorName: function (object) { - return constructorName(this, object); - }, - - ascii: function (object, processed, indent) { - return ascii(this, object, processed, indent); - } - }; - - return Formatio.prototype; -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"samsam":49}],49:[function(require,module,exports){ -((typeof define === "function" && define.amd && function (m) { define("samsam", m); }) || - (typeof module === "object" && - function (m) { module.exports = m(); }) || // Node - function (m) { this.samsam = m(); } // Browser globals -)(function () { - var o = Object.prototype; - var div = typeof document !== "undefined" && document.createElement("div"); - - function isNaN(value) { - // Unlike global isNaN, this avoids type coercion - // typeof check avoids IE host object issues, hat tip to - // lodash - var val = value; // JsLint thinks value !== value is "weird" - return typeof value === "number" && value !== val; - } - - function getClass(value) { - // Returns the internal [[Class]] by calling Object.prototype.toString - // with the provided value as this. Return value is a string, naming the - // internal class, e.g. "Array" - return o.toString.call(value).split(/[ \]]/)[1]; - } - - /** - * @name samsam.isArguments - * @param Object object - * - * Returns ``true`` if ``object`` is an ``arguments`` object, - * ``false`` otherwise. - */ - function isArguments(object) { - if (getClass(object) === 'Arguments') { return true; } - if (typeof object !== "object" || typeof object.length !== "number" || - getClass(object) === "Array") { - return false; - } - if (typeof object.callee == "function") { return true; } - try { - object[object.length] = 6; - delete object[object.length]; - } catch (e) { - return true; - } - return false; - } - - /** - * @name samsam.isElement - * @param Object object - * - * Returns ``true`` if ``object`` is a DOM element node. Unlike - * Underscore.js/lodash, this function will return ``false`` if ``object`` - * is an *element-like* object, i.e. a regular object with a ``nodeType`` - * property that holds the value ``1``. - */ - function isElement(object) { - if (!object || object.nodeType !== 1 || !div) { return false; } - try { - object.appendChild(div); - object.removeChild(div); - } catch (e) { - return false; - } - return true; - } - - /** - * @name samsam.keys - * @param Object object - * - * Return an array of own property names. - */ - function keys(object) { - var ks = [], prop; - for (prop in object) { - if (o.hasOwnProperty.call(object, prop)) { ks.push(prop); } - } - return ks; - } - - /** - * @name samsam.isDate - * @param Object value - * - * Returns true if the object is a ``Date``, or *date-like*. Duck typing - * of date objects work by checking that the object has a ``getTime`` - * function whose return value equals the return value from the object's - * ``valueOf``. - */ - function isDate(value) { - return typeof value.getTime == "function" && - value.getTime() == value.valueOf(); - } - - /** - * @name samsam.isNegZero - * @param Object value - * - * Returns ``true`` if ``value`` is ``-0``. - */ - function isNegZero(value) { - return value === 0 && 1 / value === -Infinity; - } - - /** - * @name samsam.equal - * @param Object obj1 - * @param Object obj2 - * - * Returns ``true`` if two objects are strictly equal. Compared to - * ``===`` there are two exceptions: - * - * - NaN is considered equal to NaN - * - -0 and +0 are not considered equal - */ - function identical(obj1, obj2) { - if (obj1 === obj2 || (isNaN(obj1) && isNaN(obj2))) { - return obj1 !== 0 || isNegZero(obj1) === isNegZero(obj2); - } - } - - - /** - * @name samsam.deepEqual - * @param Object obj1 - * @param Object obj2 - * - * Deep equal comparison. Two values are "deep equal" if: - * - * - They are equal, according to samsam.identical - * - They are both date objects representing the same time - * - They are both arrays containing elements that are all deepEqual - * - They are objects with the same set of properties, and each property - * in ``obj1`` is deepEqual to the corresponding property in ``obj2`` - * - * Supports cyclic objects. - */ - function deepEqualCyclic(obj1, obj2) { - - // used for cyclic comparison - // contain already visited objects - var objects1 = [], - objects2 = [], - // contain pathes (position in the object structure) - // of the already visited objects - // indexes same as in objects arrays - paths1 = [], - paths2 = [], - // contains combinations of already compared objects - // in the manner: { "$1['ref']$2['ref']": true } - compared = {}; - - /** - * used to check, if the value of a property is an object - * (cyclic logic is only needed for objects) - * only needed for cyclic logic - */ - function isObject(value) { - - if (typeof value === 'object' && value !== null && - !(value instanceof Boolean) && - !(value instanceof Date) && - !(value instanceof Number) && - !(value instanceof RegExp) && - !(value instanceof String)) { - - return true; - } - - return false; - } - - /** - * returns the index of the given object in the - * given objects array, -1 if not contained - * only needed for cyclic logic - */ - function getIndex(objects, obj) { - - var i; - for (i = 0; i < objects.length; i++) { - if (objects[i] === obj) { - return i; - } - } - - return -1; - } - - // does the recursion for the deep equal check - return (function deepEqual(obj1, obj2, path1, path2) { - var type1 = typeof obj1; - var type2 = typeof obj2; - - // == null also matches undefined - if (obj1 === obj2 || - isNaN(obj1) || isNaN(obj2) || - obj1 == null || obj2 == null || - type1 !== "object" || type2 !== "object") { - - return identical(obj1, obj2); - } - - // Elements are only equal if identical(expected, actual) - if (isElement(obj1) || isElement(obj2)) { return false; } - - var isDate1 = isDate(obj1), isDate2 = isDate(obj2); - if (isDate1 || isDate2) { - if (!isDate1 || !isDate2 || obj1.getTime() !== obj2.getTime()) { - return false; - } - } - - if (obj1 instanceof RegExp && obj2 instanceof RegExp) { - if (obj1.toString() !== obj2.toString()) { return false; } - } - - var class1 = getClass(obj1); - var class2 = getClass(obj2); - var keys1 = keys(obj1); - var keys2 = keys(obj2); - - if (isArguments(obj1) || isArguments(obj2)) { - if (obj1.length !== obj2.length) { return false; } - } else { - if (type1 !== type2 || class1 !== class2 || - keys1.length !== keys2.length) { - return false; - } - } - - var key, i, l, - // following vars are used for the cyclic logic - value1, value2, - isObject1, isObject2, - index1, index2, - newPath1, newPath2; - - for (i = 0, l = keys1.length; i < l; i++) { - key = keys1[i]; - if (!o.hasOwnProperty.call(obj2, key)) { - return false; - } - - // Start of the cyclic logic - - value1 = obj1[key]; - value2 = obj2[key]; - - isObject1 = isObject(value1); - isObject2 = isObject(value2); - - // determine, if the objects were already visited - // (it's faster to check for isObject first, than to - // get -1 from getIndex for non objects) - index1 = isObject1 ? getIndex(objects1, value1) : -1; - index2 = isObject2 ? getIndex(objects2, value2) : -1; - - // determine the new pathes of the objects - // - for non cyclic objects the current path will be extended - // by current property name - // - for cyclic objects the stored path is taken - newPath1 = index1 !== -1 - ? paths1[index1] - : path1 + '[' + JSON.stringify(key) + ']'; - newPath2 = index2 !== -1 - ? paths2[index2] - : path2 + '[' + JSON.stringify(key) + ']'; - - // stop recursion if current objects are already compared - if (compared[newPath1 + newPath2]) { - return true; - } - - // remember the current objects and their pathes - if (index1 === -1 && isObject1) { - objects1.push(value1); - paths1.push(newPath1); - } - if (index2 === -1 && isObject2) { - objects2.push(value2); - paths2.push(newPath2); - } - - // remember that the current objects are already compared - if (isObject1 && isObject2) { - compared[newPath1 + newPath2] = true; - } - - // End of cyclic logic - - // neither value1 nor value2 is a cycle - // continue with next level - if (!deepEqual(value1, value2, newPath1, newPath2)) { - return false; - } - } - - return true; - - }(obj1, obj2, '$1', '$2')); - } - - var match; - - function arrayContains(array, subset) { - if (subset.length === 0) { return true; } - var i, l, j, k; - for (i = 0, l = array.length; i < l; ++i) { - if (match(array[i], subset[0])) { - for (j = 0, k = subset.length; j < k; ++j) { - if (!match(array[i + j], subset[j])) { return false; } - } - return true; - } - } - return false; - } - - /** - * @name samsam.match - * @param Object object - * @param Object matcher - * - * Compare arbitrary value ``object`` with matcher. - */ - match = function match(object, matcher) { - if (matcher && typeof matcher.test === "function") { - return matcher.test(object); - } - - if (typeof matcher === "function") { - return matcher(object) === true; - } - - if (typeof matcher === "string") { - matcher = matcher.toLowerCase(); - var notNull = typeof object === "string" || !!object; - return notNull && - (String(object)).toLowerCase().indexOf(matcher) >= 0; - } - - if (typeof matcher === "number") { - return matcher === object; - } - - if (typeof matcher === "boolean") { - return matcher === object; - } - - if (typeof(matcher) === "undefined") { - return typeof(object) === "undefined"; - } - - if (matcher === null) { - return object === null; - } - - if (getClass(object) === "Array" && getClass(matcher) === "Array") { - return arrayContains(object, matcher); - } - - if (matcher && typeof matcher === "object") { - if (matcher === object) { - return true; - } - var prop; - for (prop in matcher) { - var value = object[prop]; - if (typeof value === "undefined" && - typeof object.getAttribute === "function") { - value = object.getAttribute(prop); - } - if (matcher[prop] === null || typeof matcher[prop] === 'undefined') { - if (value !== matcher[prop]) { - return false; - } - } else if (typeof value === "undefined" || !match(value, matcher[prop])) { - return false; - } - } - return true; - } - - throw new Error("Matcher was not a string, a number, a " + - "function, a boolean or an object"); - }; - - return { - isArguments: isArguments, - isElement: isElement, - isDate: isDate, - isNegZero: isNegZero, - identical: identical, - deepEqual: deepEqualCyclic, - match: match, - keys: keys - }; -}); - -},{}],50:[function(require,module,exports){ -(function (global){ -/*jslint eqeqeq: false, plusplus: false, evil: true, onevar: false, browser: true, forin: false*/ -/*global global*/ -/** - * @author Christian Johansen (christian@cjohansen.no) and contributors - * @license BSD - * - * Copyright (c) 2010-2014 Christian Johansen - */ -"use strict"; - -// node expects setTimeout/setInterval to return a fn object w/ .ref()/.unref() -// browsers, a number. -// see https://github.com/cjohansen/Sinon.JS/pull/436 -var timeoutResult = setTimeout(function() {}, 0); -var addTimerReturnsObject = typeof timeoutResult === "object"; -clearTimeout(timeoutResult); - -var NativeDate = Date; -var id = 1; - -/** - * Parse strings like "01:10:00" (meaning 1 hour, 10 minutes, 0 seconds) into - * number of milliseconds. This is used to support human-readable strings passed - * to clock.tick() - */ -function parseTime(str) { - if (!str) { - return 0; - } - - var strings = str.split(":"); - var l = strings.length, i = l; - var ms = 0, parsed; - - if (l > 3 || !/^(\d\d:){0,2}\d\d?$/.test(str)) { - throw new Error("tick only understands numbers and 'h:m:s'"); - } - - while (i--) { - parsed = parseInt(strings[i], 10); - - if (parsed >= 60) { - throw new Error("Invalid time " + str); - } - - ms += parsed * Math.pow(60, (l - i - 1)); - } - - return ms * 1000; -} - -/** - * Used to grok the `now` parameter to createClock. - */ -function getEpoch(epoch) { - if (!epoch) { return 0; } - if (typeof epoch.getTime === "function") { return epoch.getTime(); } - if (typeof epoch === "number") { return epoch; } - throw new TypeError("now should be milliseconds since UNIX epoch"); -} - -function inRange(from, to, timer) { - return timer && timer.callAt >= from && timer.callAt <= to; -} - -function mirrorDateProperties(target, source) { - if (source.now) { - target.now = function now() { - return target.clock.now; - }; - } else { - delete target.now; - } - - if (source.toSource) { - target.toSource = function toSource() { - return source.toSource(); - }; - } else { - delete target.toSource; - } - - target.toString = function toString() { - return source.toString(); - }; - - target.prototype = source.prototype; - target.parse = source.parse; - target.UTC = source.UTC; - target.prototype.toUTCString = source.prototype.toUTCString; - - for (var prop in source) { - if (source.hasOwnProperty(prop)) { - target[prop] = source[prop]; - } - } - - return target; -} - -function createDate() { - function ClockDate(year, month, date, hour, minute, second, ms) { - // Defensive and verbose to avoid potential harm in passing - // explicit undefined when user does not pass argument - switch (arguments.length) { - case 0: - return new NativeDate(ClockDate.clock.now); - case 1: - return new NativeDate(year); - case 2: - return new NativeDate(year, month); - case 3: - return new NativeDate(year, month, date); - case 4: - return new NativeDate(year, month, date, hour); - case 5: - return new NativeDate(year, month, date, hour, minute); - case 6: - return new NativeDate(year, month, date, hour, minute, second); - default: - return new NativeDate(year, month, date, hour, minute, second, ms); - } - } - - return mirrorDateProperties(ClockDate, NativeDate); -} - -function addTimer(clock, timer) { - if (typeof timer.func === "undefined") { - throw new Error("Callback must be provided to timer calls"); - } - - if (!clock.timers) { - clock.timers = {}; - } - - timer.id = id++; - timer.createdAt = clock.now; - timer.callAt = clock.now + (timer.delay || 0); - - clock.timers[timer.id] = timer; - - if (addTimerReturnsObject) { - return { - id: timer.id, - ref: function() {}, - unref: function() {} - }; - } - else { - return timer.id; - } -} - -function firstTimerInRange(clock, from, to) { - var timers = clock.timers, timer = null; - - for (var id in timers) { - if (!inRange(from, to, timers[id])) { - continue; - } - - if (!timer || ~compareTimers(timer, timers[id])) { - timer = timers[id]; - } - } - - return timer; -} - -function compareTimers(a, b) { - // Sort first by absolute timing - if (a.callAt < b.callAt) { - return -1; - } - if (a.callAt > b.callAt) { - return 1; - } - - // Sort next by immediate, immediate timers take precedence - if (a.immediate && !b.immediate) { - return -1; - } - if (!a.immediate && b.immediate) { - return 1; - } - - // Sort next by creation time, earlier-created timers take precedence - if (a.createdAt < b.createdAt) { - return -1; - } - if (a.createdAt > b.createdAt) { - return 1; - } - - // Sort next by id, lower-id timers take precedence - if (a.id < b.id) { - return -1; - } - if (a.id > b.id) { - return 1; - } - - // As timer ids are unique, no fallback `0` is necessary -} - -function callTimer(clock, timer) { - if (typeof timer.interval == "number") { - clock.timers[timer.id].callAt += timer.interval; - } else { - delete clock.timers[timer.id]; - } - - try { - if (typeof timer.func == "function") { - timer.func.apply(null, timer.args); - } else { - eval(timer.func); - } - } catch (e) { - var exception = e; - } - - if (!clock.timers[timer.id]) { - if (exception) { - throw exception; - } - return; - } - - if (exception) { - throw exception; - } -} - -function uninstall(clock, target) { - var method; - - for (var i = 0, l = clock.methods.length; i < l; i++) { - method = clock.methods[i]; - - if (target[method].hadOwnProperty) { - target[method] = clock["_" + method]; - } else { - try { - delete target[method]; - } catch (e) {} - } - } - - // Prevent multiple executions which will completely remove these props - clock.methods = []; -} - -function hijackMethod(target, method, clock) { - clock[method].hadOwnProperty = Object.prototype.hasOwnProperty.call(target, method); - clock["_" + method] = target[method]; - - if (method == "Date") { - var date = mirrorDateProperties(clock[method], target[method]); - target[method] = date; - } else { - target[method] = function () { - return clock[method].apply(clock, arguments); - }; - - for (var prop in clock[method]) { - if (clock[method].hasOwnProperty(prop)) { - target[method][prop] = clock[method][prop]; - } - } - } - - target[method].clock = clock; -} - -var timers = { - setTimeout: setTimeout, - clearTimeout: clearTimeout, - setImmediate: (typeof setImmediate !== "undefined" ? setImmediate : undefined), - clearImmediate: (typeof clearImmediate !== "undefined" ? clearImmediate: undefined), - setInterval: setInterval, - clearInterval: clearInterval, - Date: Date -}; - -var keys = Object.keys || function (obj) { - var ks = []; - for (var key in obj) { - ks.push(key); - } - return ks; -}; - -exports.timers = timers; - -var createClock = exports.createClock = function (now) { - var clock = { - now: getEpoch(now), - timeouts: {}, - Date: createDate() - }; - - clock.Date.clock = clock; - - clock.setTimeout = function setTimeout(func, timeout) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout - }); - }; - - clock.clearTimeout = function clearTimeout(timerId) { - if (!timerId) { - // null appears to be allowed in most browsers, and appears to be - // relied upon by some libraries, like Bootstrap carousel - return; - } - if (!clock.timers) { - clock.timers = []; - } - // in Node, timerId is an object with .ref()/.unref(), and - // its .id field is the actual timer id. - if (typeof timerId === "object") { - timerId = timerId.id - } - if (timerId in clock.timers) { - delete clock.timers[timerId]; - } - }; - - clock.setInterval = function setInterval(func, timeout) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 2), - delay: timeout, - interval: timeout - }); - }; - - clock.clearInterval = function clearInterval(timerId) { - clock.clearTimeout(timerId); - }; - - clock.setImmediate = function setImmediate(func) { - return addTimer(clock, { - func: func, - args: Array.prototype.slice.call(arguments, 1), - immediate: true - }); - }; - - clock.clearImmediate = function clearImmediate(timerId) { - clock.clearTimeout(timerId); - }; - - clock.tick = function tick(ms) { - ms = typeof ms == "number" ? ms : parseTime(ms); - var tickFrom = clock.now, tickTo = clock.now + ms, previous = clock.now; - var timer = firstTimerInRange(clock, tickFrom, tickTo); - - var firstException; - while (timer && tickFrom <= tickTo) { - if (clock.timers[timer.id]) { - tickFrom = clock.now = timer.callAt; - try { - callTimer(clock, timer); - } catch (e) { - firstException = firstException || e; - } - } - - timer = firstTimerInRange(clock, previous, tickTo); - previous = tickFrom; - } - - clock.now = tickTo; - - if (firstException) { - throw firstException; - } - - return clock.now; - }; - - clock.reset = function reset() { - clock.timers = {}; - }; - - return clock; -}; - -exports.install = function install(target, now, toFake) { - if (typeof target === "number") { - toFake = now; - now = target; - target = null; - } - - if (!target) { - target = global; - } - - var clock = createClock(now); - - clock.uninstall = function () { - uninstall(clock, target); - }; - - clock.methods = toFake || []; - - if (clock.methods.length === 0) { - clock.methods = keys(timers); - } - - for (var i = 0, l = clock.methods.length; i < l; i++) { - hijackMethod(target, clock.methods[i], clock); - } - - return clock; -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],51:[function(require,module,exports){ -(function (process,global){ -(function() { - "use strict"; - function lib$es6$promise$utils$$objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); - } - - function lib$es6$promise$utils$$isFunction(x) { - return typeof x === 'function'; - } - - function lib$es6$promise$utils$$isMaybeThenable(x) { - return typeof x === 'object' && x !== null; - } - - var lib$es6$promise$utils$$_isArray; - if (!Array.isArray) { - lib$es6$promise$utils$$_isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; - } else { - lib$es6$promise$utils$$_isArray = Array.isArray; - } - - var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; - var lib$es6$promise$asap$$len = 0; - var lib$es6$promise$asap$$toString = {}.toString; - var lib$es6$promise$asap$$vertxNext; - function lib$es6$promise$asap$$asap(callback, arg) { - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; - lib$es6$promise$asap$$len += 2; - if (lib$es6$promise$asap$$len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - lib$es6$promise$asap$$scheduleFlush(); - } - } - - var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; - - var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; - var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; - var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; - var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - - // test for web worker but not in IE10 - var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - - // node - function lib$es6$promise$asap$$useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(lib$es6$promise$asap$$flush); - }; - } - - // vertx - function lib$es6$promise$asap$$useVertxTimer() { - return function() { - lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); - }; - } - - function lib$es6$promise$asap$$useMutationObserver() { - var iterations = 0; - var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; - } - - // web worker - function lib$es6$promise$asap$$useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = lib$es6$promise$asap$$flush; - return function () { - channel.port2.postMessage(0); - }; - } - - function lib$es6$promise$asap$$useSetTimeout() { - return function() { - setTimeout(lib$es6$promise$asap$$flush, 1); - }; - } - - var lib$es6$promise$asap$$queue = new Array(1000); - function lib$es6$promise$asap$$flush() { - for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { - var callback = lib$es6$promise$asap$$queue[i]; - var arg = lib$es6$promise$asap$$queue[i+1]; - - callback(arg); - - lib$es6$promise$asap$$queue[i] = undefined; - lib$es6$promise$asap$$queue[i+1] = undefined; - } - - lib$es6$promise$asap$$len = 0; - } - - function lib$es6$promise$asap$$attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; - return lib$es6$promise$asap$$useVertxTimer(); - } catch(e) { - return lib$es6$promise$asap$$useSetTimeout(); - } - } - - var lib$es6$promise$asap$$scheduleFlush; - // Decide what async method to use to triggering processing of queued callbacks: - if (lib$es6$promise$asap$$isNode) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); - } else if (lib$es6$promise$asap$$BrowserMutationObserver) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); - } else if (lib$es6$promise$asap$$isWorker) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); - } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); - } else { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); - } - - function lib$es6$promise$$internal$$noop() {} - - var lib$es6$promise$$internal$$PENDING = void 0; - var lib$es6$promise$$internal$$FULFILLED = 1; - var lib$es6$promise$$internal$$REJECTED = 2; - - var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); - } - - function lib$es6$promise$$internal$$cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); - } - - function lib$es6$promise$$internal$$getThen(promise) { - try { - return promise.then; - } catch(error) { - lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; - return lib$es6$promise$$internal$$GET_THEN_ERROR; - } - } - - function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } - } - - function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { - lib$es6$promise$asap$$default(function(promise) { - var sealed = false; - var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - lib$es6$promise$$internal$$resolve(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - lib$es6$promise$$internal$$reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - lib$es6$promise$$internal$$reject(promise, error); - } - }, promise); - } - - function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { - if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, thenable._result); - } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, thenable._result); - } else { - lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { - lib$es6$promise$$internal$$resolve(promise, value); - }, function(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } - } - - function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); - } else { - var then = lib$es6$promise$$internal$$getThen(maybeThenable); - - if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); - } else if (then === undefined) { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } else if (lib$es6$promise$utils$$isFunction(then)) { - lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); - } else { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } - } - } - - function lib$es6$promise$$internal$$resolve(promise, value) { - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); - } else if (lib$es6$promise$utils$$objectOrFunction(value)) { - lib$es6$promise$$internal$$handleMaybeThenable(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - } - - function lib$es6$promise$$internal$$publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - lib$es6$promise$$internal$$publish(promise); - } - - function lib$es6$promise$$internal$$fulfill(promise, value) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - - promise._result = value; - promise._state = lib$es6$promise$$internal$$FULFILLED; - - if (promise._subscribers.length !== 0) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); - } - } - - function lib$es6$promise$$internal$$reject(promise, reason) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - promise._state = lib$es6$promise$$internal$$REJECTED; - promise._result = reason; - - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); - } - - function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; - subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; - - if (length === 0 && parent._state) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); - } - } - - function lib$es6$promise$$internal$$publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; - } - - function lib$es6$promise$$internal$$ErrorObject() { - this.error = null; - } - - var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; - return lib$es6$promise$$internal$$TRY_CATCH_ERROR; - } - } - - function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { - var hasCallback = lib$es6$promise$utils$$isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = lib$es6$promise$$internal$$tryCatch(callback, detail); - - if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== lib$es6$promise$$internal$$PENDING) { - // noop - } else if (hasCallback && succeeded) { - lib$es6$promise$$internal$$resolve(promise, value); - } else if (failed) { - lib$es6$promise$$internal$$reject(promise, error); - } else if (settled === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, value); - } else if (settled === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } - } - - function lib$es6$promise$$internal$$initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - lib$es6$promise$$internal$$resolve(promise, value); - }, function rejectPromise(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } catch(e) { - lib$es6$promise$$internal$$reject(promise, e); - } - } - - function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } - } - } else { - lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); - } - } - - lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { - return lib$es6$promise$utils$$isArray(input); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { - this._result = new Array(this.length); - }; - - var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; - - lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (lib$es6$promise$utils$$isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === lib$es6$promise$$internal$$PENDING) { - enumerator._remaining--; - - if (state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(promise, enumerator._result); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { - enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); - }); - }; - function lib$es6$promise$promise$all$$all(entries) { - return new lib$es6$promise$enumerator$$default(this, entries).promise; - } - var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; - function lib$es6$promise$promise$race$$race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (!lib$es6$promise$utils$$isArray(entries)) { - lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - lib$es6$promise$$internal$$resolve(promise, value); - } - - function onRejection(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - } - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; - } - var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; - function lib$es6$promise$promise$resolve$$resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$resolve(promise, object); - return promise; - } - var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; - function lib$es6$promise$promise$reject$$reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$reject(promise, reason); - return promise; - } - var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; - - var lib$es6$promise$promise$$counter = 0; - - function lib$es6$promise$promise$$needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - function lib$es6$promise$promise$$needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; - /** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor - */ - function lib$es6$promise$promise$$Promise(resolver) { - this._id = lib$es6$promise$promise$$counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (lib$es6$promise$$internal$$noop !== resolver) { - if (!lib$es6$promise$utils$$isFunction(resolver)) { - lib$es6$promise$promise$$needsResolver(); - } - - if (!(this instanceof lib$es6$promise$promise$$Promise)) { - lib$es6$promise$promise$$needsNew(); - } - - lib$es6$promise$$internal$$initializePromise(this, resolver); - } - } - - lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; - lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; - lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; - lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; - - lib$es6$promise$promise$$Promise.prototype = { - constructor: lib$es6$promise$promise$$Promise, - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(lib$es6$promise$$internal$$noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - lib$es6$promise$asap$$default(function(){ - lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); - }); - } else { - lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - function lib$es6$promise$polyfill$$polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = lib$es6$promise$promise$$default; - } - var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; - - var lib$es6$promise$umd$$ES6Promise = { - 'Promise': lib$es6$promise$promise$$default, - 'polyfill': lib$es6$promise$polyfill$$default - }; - - /* global define:true module:true window: true */ - if (typeof define === 'function' && define['amd']) { - define(function() { return lib$es6$promise$umd$$ES6Promise; }); - } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = lib$es6$promise$umd$$ES6Promise; - } else if (typeof this !== 'undefined') { - this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; - } - - lib$es6$promise$polyfill$$default(); -}).call(this); - -//# sourceMappingURL=es6-promise.js.map -}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"_process":4}],52:[function(require,module,exports){ -(function (global){ -/*global describe, specify, it, assert */ - -if (typeof Object.getPrototypeOf !== "function") { - Object.getPrototypeOf = "".__proto__ === String.prototype - ? function (object) { - return object.__proto__; - } - : function (object) { - // May break if the constructor has been tampered with - return object.constructor.prototype; - }; -} - -function keysOf(object) { - var results = []; - - for (var key in object) { - if (object.hasOwnProperty(key)) { - results.push(key); - } - } - - return results; -} - -var g = typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : this; -var Promise = g.adapter.Promise; -var assert = require('assert'); - -function objectEquals(obj1, obj2) { - for (var i in obj1) { - if (obj1.hasOwnProperty(i)) { - if (!obj2.hasOwnProperty(i)) return false; - if (obj1[i] != obj2[i]) return false; - } - } - for (var i in obj2) { - if (obj2.hasOwnProperty(i)) { - if (!obj1.hasOwnProperty(i)) return false; - if (obj1[i] != obj2[i]) return false; - } - } - return true; -} - -describe("extensions", function() { - describe("Promise constructor", function() { - it('should exist and have length 1', function() { - assert(Promise); - assert.equal(Promise.length, 1); - }); - - it('should fulfill if `resolve` is called with a value', function(done) { - var promise = new Promise(function(resolve) { resolve('value'); }); - - promise.then(function(value) { - assert.equal(value, 'value'); - done(); - }); - }); - - it('should reject if `reject` is called with a reason', function(done) { - var promise = new Promise(function(resolve, reject) { reject('reason'); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'reason'); - done(); - }); - }); - - it('should be a constructor', function() { - var promise = new Promise(function() {}); - - assert.equal(Object.getPrototypeOf(promise), Promise.prototype, '[[Prototype]] equals Promise.prototype'); - assert.equal(promise.constructor, Promise, 'constructor property of instances is set correctly'); - assert.equal(Promise.prototype.constructor, Promise, 'constructor property of prototype is set correctly'); - }); - - it('should NOT work without `new`', function() { - assert.throws(function(){ - Promise(function(resolve) { resolve('value'); }); - }, TypeError) - }); - - it('should throw a `TypeError` if not given a function', function() { - assert.throws(function () { - new Promise(); - }, TypeError); - - assert.throws(function () { - new Promise({}); - }, TypeError); - - assert.throws(function () { - new Promise('boo!'); - }, TypeError); - }); - - it('should reject on resolver exception', function(done) { - new Promise(function() { - throw 'error'; - }).then(null, function(e) { - assert.equal(e, 'error'); - done(); - }); - }); - - it('should not resolve multiple times', function(done) { - var resolver, rejector, fulfilled = 0, rejected = 0; - var thenable = { - then: function(resolve, reject) { - resolver = resolve; - rejector = reject; - } - }; - - var promise = new Promise(function(resolve) { - resolve(1); - }); - - promise.then(function(value){ - return thenable; - }).then(function(value){ - fulfilled++; - }, function(reason) { - rejected++; - }); - - setTimeout(function() { - resolver(1); - resolver(1); - rejector(1); - rejector(1); - - setTimeout(function() { - assert.equal(fulfilled, 1); - assert.equal(rejected, 0); - done(); - }, 20); - }, 20); - - }); - - describe('assimilation', function() { - it('should assimilate if `resolve` is called with a fulfilled promise', function(done) { - var originalPromise = new Promise(function(resolve) { resolve('original value'); }); - var promise = new Promise(function(resolve) { resolve(originalPromise); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate if `resolve` is called with a rejected promise', function(done) { - var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); - var promise = new Promise(function(resolve) { resolve(originalPromise); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - - it('should assimilate if `resolve` is called with a fulfilled thenable', function(done) { - var originalThenable = { - then: function (onFulfilled) { - setTimeout(function() { onFulfilled('original value'); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(originalThenable); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate if `resolve` is called with a rejected thenable', function(done) { - var originalThenable = { - then: function (onFulfilled, onRejected) { - setTimeout(function() { onRejected('original reason'); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(originalThenable); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - - - it('should assimilate two levels deep, for fulfillment of self fulfilling promises', function(done) { - var originalPromise, promise; - originalPromise = new Promise(function(resolve) { - setTimeout(function() { - resolve(originalPromise); - }, 0) - }); - - promise = new Promise(function(resolve) { - setTimeout(function() { - resolve(originalPromise); - }, 0); - }); - - promise.then(function(value) { - assert(false); - done(); - })['catch'](function(reason) { - assert.equal(reason.message, "You cannot resolve a promise with itself"); - assert(reason instanceof TypeError); - done(); - }); - }); - - it('should assimilate two levels deep, for fulfillment', function(done) { - var originalPromise = new Promise(function(resolve) { resolve('original value'); }); - var nextPromise = new Promise(function(resolve) { resolve(originalPromise); }); - var promise = new Promise(function(resolve) { resolve(nextPromise); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate two levels deep, for rejection', function(done) { - var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); - var nextPromise = new Promise(function(resolve) { resolve(originalPromise); }); - var promise = new Promise(function(resolve) { resolve(nextPromise); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - - it('should assimilate three levels deep, mixing thenables and promises (fulfilled case)', function(done) { - var originalPromise = new Promise(function(resolve) { resolve('original value'); }); - var intermediateThenable = { - then: function (onFulfilled) { - setTimeout(function() { onFulfilled(originalPromise); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(intermediateThenable); }); - - promise.then(function(value) { - assert.equal(value, 'original value'); - done(); - }); - }); - - it('should assimilate three levels deep, mixing thenables and promises (rejected case)', function(done) { - var originalPromise = new Promise(function(resolve, reject) { reject('original reason'); }); - var intermediateThenable = { - then: function (onFulfilled) { - setTimeout(function() { onFulfilled(originalPromise); }, 0); - } - }; - var promise = new Promise(function(resolve) { resolve(intermediateThenable); }); - - promise.then(function() { - assert(false); - done(); - }, function(reason) { - assert.equal(reason, 'original reason'); - done(); - }); - }); - }); - }); - - describe("Promise.all", function() { - testAll(function(){ - return Promise.all.apply(Promise, arguments); - }); - }); - - function testAll(all) { - it('should exist', function() { - assert(all); - }); - - it('throws when not passed an array', function(done) { - var nothing = assertRejection(all()); - var string = assertRejection(all('')); - var object = assertRejection(all({})); - - Promise.all([ - nothing, - string, - object - ]).then(function(){ done(); }); - }); - - specify('fulfilled only after all of the other promises are fulfilled', function(done) { - var firstResolved, secondResolved, firstResolver, secondResolver; - - var first = new Promise(function(resolve) { - firstResolver = resolve; - }); - first.then(function() { - firstResolved = true; - }); - - var second = new Promise(function(resolve) { - secondResolver = resolve; - }); - second.then(function() { - secondResolved = true; - }); - - setTimeout(function() { - firstResolver(true); - }, 0); - - setTimeout(function() { - secondResolver(true); - }, 0); - - all([first, second]).then(function() { - assert(firstResolved); - assert(secondResolved); - done(); - }); - }); - - specify('rejected as soon as a promise is rejected', function(done) { - var firstResolver, secondResolver; - - var first = new Promise(function(resolve, reject) { - firstResolver = { resolve: resolve, reject: reject }; - }); - - var second = new Promise(function(resolve, reject) { - secondResolver = { resolve: resolve, reject: reject }; - }); - - setTimeout(function() { - firstResolver.reject({}); - }, 0); - - var firstWasRejected, secondCompleted; - - first['catch'](function(){ - firstWasRejected = true; - }); - - second.then(function(){ - secondCompleted = true; - }, function() { - secondCompleted = true; - }); - - all([first, second]).then(function() { - assert(false); - }, function() { - assert(firstWasRejected); - assert(!secondCompleted); - done(); - }); - }); - - specify('passes the resolved values of each promise to the callback in the correct order', function(done) { - var firstResolver, secondResolver, thirdResolver; - - var first = new Promise(function(resolve, reject) { - firstResolver = { resolve: resolve, reject: reject }; - }); - - var second = new Promise(function(resolve, reject) { - secondResolver = { resolve: resolve, reject: reject }; - }); - - var third = new Promise(function(resolve, reject) { - thirdResolver = { resolve: resolve, reject: reject }; - }); - - thirdResolver.resolve(3); - firstResolver.resolve(1); - secondResolver.resolve(2); - - all([first, second, third]).then(function(results) { - assert(results.length === 3); - assert(results[0] === 1); - assert(results[1] === 2); - assert(results[2] === 3); - done(); - }); - }); - - specify('resolves an empty array passed to all()', function(done) { - all([]).then(function(results) { - assert(results.length === 0); - done(); - }); - }); - - specify('works with null', function(done) { - all([null]).then(function(results) { - assert.equal(results[0], null); - done(); - }); - }); - - specify('works with a mix of promises and thenables and non-promises', function(done) { - var promise = new Promise(function(resolve) { resolve(1); }); - var syncThenable = { then: function (onFulfilled) { onFulfilled(2); } }; - var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } }; - var nonPromise = 4; - - all([promise, syncThenable, asyncThenable, nonPromise]).then(function(results) { - assert(objectEquals(results, [1, 2, 3, 4])); - done(); - })['catch'](done); - }); - } - - describe("reject", function(){ - specify("it should exist", function(){ - assert(Promise.reject); - }); - - describe('it rejects', function(){ - var reason = 'the reason', - promise = Promise.reject(reason); - - promise.then(function(){ - assert(false, 'should not fulfill'); - }, function(actualReason){ - assert.equal(reason, actualReason); - }); - }); - }); - - function assertRejection(promise) { - return promise.then(function(){ - assert(false, 'expected rejection, but got fulfillment'); - }, function(reason){ - assert(reason instanceof Error); - }); - } - - describe('race', function() { - it("should exist", function() { - assert(Promise.race); - }); - - it("throws when not passed an array", function(done) { - var nothing = assertRejection(Promise.race()); - var string = assertRejection(Promise.race('')); - var object = assertRejection(Promise.race({})); - - Promise.all([ - nothing, - string, - object - ]).then(function(){ done(); }); - }); - - specify('fulfilled after one of the other promises are fulfilled', function(done) { - var firstResolved, secondResolved, firstResolver, secondResolver; - - var first = new Promise(function(resolve) { - firstResolver = resolve; - }); - first.then(function() { - firstResolved = true; - }); - - var second = new Promise(function(resolve) { - secondResolver = resolve; - }); - second.then(function() { - secondResolved = true; - }); - - setTimeout(function() { - firstResolver(true); - }, 100); - - setTimeout(function() { - secondResolver(true); - }, 0); - - Promise.race([first, second]).then(function() { - assert(secondResolved); - assert.equal(firstResolved, undefined); - done(); - }); - }); - - specify('the race begins on nextTurn and prioritized by array entry', function(done) { - var firstResolver, secondResolver, nonPromise = 5; - - var first = new Promise(function(resolve, reject) { - resolve(true); - }); - - var second = new Promise(function(resolve, reject) { - resolve(false); - }); - - Promise.race([first, second, nonPromise]).then(function(value) { - assert.equal(value, true); - done(); - }); - }); - - specify('rejected as soon as a promise is rejected', function(done) { - var firstResolver, secondResolver; - - var first = new Promise(function(resolve, reject) { - firstResolver = { resolve: resolve, reject: reject }; - }); - - var second = new Promise(function(resolve, reject) { - secondResolver = { resolve: resolve, reject: reject }; - }); - - setTimeout(function() { - firstResolver.reject({}); - }, 0); - - var firstWasRejected, secondCompleted; - - first['catch'](function(){ - firstWasRejected = true; - }); - - second.then(function(){ - secondCompleted = true; - }, function() { - secondCompleted = true; - }); - - Promise.race([first, second]).then(function() { - assert(false); - }, function() { - assert(firstWasRejected); - assert(!secondCompleted); - done(); - }); - }); - - specify('resolves an empty array to forever pending Promise', function(done) { - var foreverPendingPromise = Promise.race([]), - wasSettled = false; - - foreverPendingPromise.then(function() { - wasSettled = true; - }, function() { - wasSettled = true; - }); - - setTimeout(function() { - assert(!wasSettled); - done(); - }, 100); - }); - - specify('works with a mix of promises and thenables', function(done) { - var promise = new Promise(function(resolve) { setTimeout(function() { resolve(1); }, 10); }), - syncThenable = { then: function (onFulfilled) { onFulfilled(2); } }; - - Promise.race([promise, syncThenable]).then(function(result) { - assert(result, 2); - done(); - }); - }); - - specify('works with a mix of thenables and non-promises', function (done) { - var asyncThenable = { then: function (onFulfilled) { setTimeout(function() { onFulfilled(3); }, 0); } }, - nonPromise = 4; - - Promise.race([asyncThenable, nonPromise]).then(function(result) { - assert(result, 4); - done(); - }); - }); - }); - - describe("resolve", function(){ - specify("it should exist", function(){ - assert(Promise.resolve); - }); - - describe("1. If x is a promise, adopt its state ", function(){ - specify("1.1 If x is pending, promise must remain pending until x is fulfilled or rejected.", function(done){ - var expectedValue, resolver, thenable, wrapped; - - expectedValue = 'the value'; - thenable = { - then: function(resolve, reject){ - resolver = resolve; - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(value){ - assert(value === expectedValue); - done(); - }); - - setTimeout(function(){ - resolver(expectedValue); - }, 10); - }); - - specify("1.2 If/when x is fulfilled, fulfill promise with the same value.", function(done){ - var expectedValue, thenable, wrapped; - - expectedValue = 'the value'; - thenable = { - then: function(resolve, reject){ - resolve(expectedValue); - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(value){ - assert(value === expectedValue); - done(); - }) - }); - - specify("1.3 If/when x is rejected, reject promise with the same reason.", function(done){ - var expectedError, thenable, wrapped; - - expectedError = new Error(); - thenable = { - then: function(resolve, reject){ - reject(expectedError); - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - assert(error === expectedError); - done(); - }); - }); - }); - - describe("2. Otherwise, if x is an object or function,", function(){ - specify("2.1 Let then x.then", function(done){ - var accessCount, resolver, wrapped, thenable; - - accessCount = 0; - thenable = { }; - - // we likely don't need to test this, if the browser doesn't support it - if (typeof Object.defineProperty !== "function") { done(); return; } - - Object.defineProperty(thenable, 'then', { - get: function(){ - accessCount++; - - if (accessCount > 1) { - throw new Error(); - } - - return function(){ }; - } - }); - - assert(accessCount === 0); - - wrapped = Promise.resolve(thenable); - - assert(accessCount === 1); - - done(); - }); - - specify("2.2 If retrieving the property x.then results in a thrown exception e, reject promise with e as the reason.", function(done){ - var wrapped, thenable, expectedError; - - expectedError = new Error(); - thenable = { }; - - // we likely don't need to test this, if the browser doesn't support it - if (typeof Object.defineProperty !== "function") { done(); return; } - - Object.defineProperty(thenable, 'then', { - get: function(){ - throw expectedError; - } - }); - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - assert(error === expectedError, 'incorrect exception was thrown'); - done(); - }); - }); - - describe('2.3. If then is a function, call it with x as this, first argument resolvePromise, and second argument rejectPromise, where', function(){ - specify('2.3.1 If/when resolvePromise is called with a value y, run Resolve(promise, y)', function(done){ - var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis; - - thenable = { - then: function(resolve, reject){ - calledThis = this; - resolver = resolve; - rejector = reject; - } - }; - - expectedSuccess = 'success'; - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - assert(calledThis === thenable, 'this must be the thenable'); - assert(success === expectedSuccess, 'rejected promise with x'); - done(); - }); - - setTimeout(function() { - resolver(expectedSuccess); - }, 20); - }); - - specify('2.3.2 If/when rejectPromise is called with a reason r, reject promise with r.', function(done){ - var expectedError, resolver, rejector, thenable, wrapped, calledThis; - - thenable = { - then: function(resolve, reject){ - calledThis = this; - resolver = resolve; - rejector = reject; - } - }; - - expectedError = new Error(); - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - assert(error === expectedError, 'rejected promise with x'); - done(); - }); - - setTimeout(function() { - rejector(expectedError); - }, 20); - }); - - specify("2.3.3 If both resolvePromise and rejectPromise are called, or multiple calls to the same argument are made, the first call takes precedence, and any further calls are ignored", function(done){ - var expectedError, expectedSuccess, resolver, rejector, thenable, wrapped, calledThis, - calledRejected, calledResolved; - - calledRejected = 0; - calledResolved = 0; - - thenable = { - then: function(resolve, reject){ - calledThis = this; - resolver = resolve; - rejector = reject; - } - }; - - expectedError = new Error(); - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(){ - calledResolved++; - }, function(error){ - calledRejected++; - assert(calledResolved === 0, 'never resolved'); - assert(calledRejected === 1, 'rejected only once'); - assert(error === expectedError, 'rejected promise with x'); - }); - - setTimeout(function() { - rejector(expectedError); - rejector(expectedError); - - rejector('foo'); - - resolver('bar'); - resolver('baz'); - }, 20); - - setTimeout(function(){ - assert(calledRejected === 1, 'only rejected once'); - assert(calledResolved === 0, 'never resolved'); - done(); - }, 50); - }); - - describe("2.3.4 If calling then throws an exception e", function(){ - specify("2.3.4.1 If resolvePromise or rejectPromise have been called, ignore it.", function(done){ - var expectedSuccess, resolver, rejector, thenable, wrapped, calledThis, - calledRejected, calledResolved; - - expectedSuccess = 'success'; - - thenable = { - then: function(resolve, reject){ - resolve(expectedSuccess); - throw expectedError; - } - }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - assert(success === expectedSuccess, 'resolved not errored'); - done(); - }); - }); - - specify("2.3.4.2 Otherwise, reject promise with e as the reason.", function(done) { - var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount; - - expectedError = new Error(); - callCount = 0; - - thenable = { then: function() { throw expectedError; } }; - - wrapped = Promise.resolve(thenable); - - wrapped.then(null, function(error){ - callCount++; - assert(expectedError === error, 'expected the correct error to be rejected'); - done(); - }); - - assert(callCount === 0, 'expected async, was sync'); - }); - }); - }); - - specify("2.4 If then is not a function, fulfill promise with x", function(done){ - var expectedError, resolver, rejector, thenable, wrapped, calledThis, callCount; - - thenable = { then: 3 }; - callCount = 0; - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - callCount++; - assert(thenable === success, 'fulfilled promise with x'); - done(); - }); - - assert(callCount === 0, 'expected async, was sync'); - }); - }); - - describe("3. If x is not an object or function, ", function(){ - specify("fulfill promise with x.", function(done){ - var thenable, callCount, wrapped; - - thenable = null; - callCount = 0; - wrapped = Promise.resolve(thenable); - - wrapped.then(function(success){ - callCount++; - assert(success === thenable, 'fulfilled promise with x'); - done(); - }, function(a){ - assert(false, 'should not also reject'); - }); - - assert(callCount === 0, 'expected async, was sync'); - }); - }); - }); - - if (typeof Worker !== 'undefined') { - describe('web worker', function () { - it('should work', function (done) { - this.timeout(2000); - var worker = new Worker('worker.js'); - worker.addEventListener('error', function(reason) { - done(new Error("Test failed:" + reason)); - }); - worker.addEventListener('message', function (e) { - worker.terminate(); - assert.equal(e.data, 'pong'); - done(); - }); - worker.postMessage('ping'); - }); - }); - } -}); - -// thanks to @wizardwerdna for the test case -> https://github.com/tildeio/rsvp.js/issues/66 -// Only run these tests in node (phantomjs cannot handle them) -if (typeof module !== 'undefined' && module.exports) { - - describe("using reduce to sum integers using promises", function(){ - it("should build the promise pipeline without error", function(){ - var array, iters, pZero, i; - - array = []; - iters = 1000; - - for (i=1; i<=iters; i++) { - array.push(i); - } - - pZero = Promise.resolve(0); - - array.reduce(function(promise, nextVal) { - return promise.then(function(currentVal) { - return Promise.resolve(currentVal + nextVal); - }); - }, pZero); - }); - - it("should get correct answer without blowing the nextTick stack", function(done){ - var pZero, array, iters, result, i; - - pZero = Promise.resolve(0); - - array = []; - iters = 1000; - - for (i=1; i<=iters; i++) { - array.push(i); - } - - result = array.reduce(function(promise, nextVal) { - return promise.then(function(currentVal) { - return Promise.resolve(currentVal + nextVal); - }); - }, pZero); - - result.then(function(value){ - assert.equal(value, (iters*(iters+1)/2)); - done(); - }); - }); - }); -} - -// Kudos to @Octane at https://github.com/getify/native-promise-only/issues/5 for this, and @getify for pinging me. -describe("Thenables should not be able to run code during assimilation", function () { - specify("resolving to a thenable", function () { - var thenCalled = false; - var thenable = { - then: function () { - thenCalled = true; - } - }; - - Promise.resolve(thenable); - assert.strictEqual(thenCalled, false); - }); - - specify("resolving to an evil promise", function () { - var thenCalled = false; - var evilPromise = Promise.resolve(); - evilPromise.then = function () { - thenCalled = true; - }; - - Promise.resolve(evilPromise); - assert.strictEqual(thenCalled, false); - }); -}); - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"assert":2}],53:[function(require,module,exports){ -(function (global){ -var assert = require('assert'); -var g = typeof window !== 'undefined' ? - window : typeof global !== 'undefined' ? global : this; - -var Promise = g.ES6Promise || require('./es6-promise').Promise; - -function defer() { - var deferred = {}; - - deferred.promise = new Promise(function(resolve, reject) { - deferred.resolve = resolve; - deferred.reject = reject; - }); - - return deferred; -} -var resolve = Promise.resolve; -var reject = Promise.reject; - - -module.exports = g.adapter = { - resolved: function(a) { return Promise.resolve(a); }, - rejected: function(a) { return Promise.reject(a); }, - deferred: defer, - Promise: Promise -}; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{"./es6-promise":51,"assert":2}]},{},[1]); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js deleted file mode 100644 index 5b096d6e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.js +++ /dev/null @@ -1,950 +0,0 @@ -(function() { - "use strict"; - function lib$es6$promise$utils$$objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); - } - - function lib$es6$promise$utils$$isFunction(x) { - return typeof x === 'function'; - } - - function lib$es6$promise$utils$$isMaybeThenable(x) { - return typeof x === 'object' && x !== null; - } - - var lib$es6$promise$utils$$_isArray; - if (!Array.isArray) { - lib$es6$promise$utils$$_isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; - } else { - lib$es6$promise$utils$$_isArray = Array.isArray; - } - - var lib$es6$promise$utils$$isArray = lib$es6$promise$utils$$_isArray; - var lib$es6$promise$asap$$len = 0; - var lib$es6$promise$asap$$toString = {}.toString; - var lib$es6$promise$asap$$vertxNext; - function lib$es6$promise$asap$$asap(callback, arg) { - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len] = callback; - lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len + 1] = arg; - lib$es6$promise$asap$$len += 2; - if (lib$es6$promise$asap$$len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - lib$es6$promise$asap$$scheduleFlush(); - } - } - - var lib$es6$promise$asap$$default = lib$es6$promise$asap$$asap; - - var lib$es6$promise$asap$$browserWindow = (typeof window !== 'undefined') ? window : undefined; - var lib$es6$promise$asap$$browserGlobal = lib$es6$promise$asap$$browserWindow || {}; - var lib$es6$promise$asap$$BrowserMutationObserver = lib$es6$promise$asap$$browserGlobal.MutationObserver || lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver; - var lib$es6$promise$asap$$isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - - // test for web worker but not in IE10 - var lib$es6$promise$asap$$isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - - // node - function lib$es6$promise$asap$$useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(lib$es6$promise$asap$$flush); - }; - } - - // vertx - function lib$es6$promise$asap$$useVertxTimer() { - return function() { - lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush); - }; - } - - function lib$es6$promise$asap$$useMutationObserver() { - var iterations = 0; - var observer = new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; - } - - // web worker - function lib$es6$promise$asap$$useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = lib$es6$promise$asap$$flush; - return function () { - channel.port2.postMessage(0); - }; - } - - function lib$es6$promise$asap$$useSetTimeout() { - return function() { - setTimeout(lib$es6$promise$asap$$flush, 1); - }; - } - - var lib$es6$promise$asap$$queue = new Array(1000); - function lib$es6$promise$asap$$flush() { - for (var i = 0; i < lib$es6$promise$asap$$len; i+=2) { - var callback = lib$es6$promise$asap$$queue[i]; - var arg = lib$es6$promise$asap$$queue[i+1]; - - callback(arg); - - lib$es6$promise$asap$$queue[i] = undefined; - lib$es6$promise$asap$$queue[i+1] = undefined; - } - - lib$es6$promise$asap$$len = 0; - } - - function lib$es6$promise$asap$$attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - lib$es6$promise$asap$$vertxNext = vertx.runOnLoop || vertx.runOnContext; - return lib$es6$promise$asap$$useVertxTimer(); - } catch(e) { - return lib$es6$promise$asap$$useSetTimeout(); - } - } - - var lib$es6$promise$asap$$scheduleFlush; - // Decide what async method to use to triggering processing of queued callbacks: - if (lib$es6$promise$asap$$isNode) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useNextTick(); - } else if (lib$es6$promise$asap$$BrowserMutationObserver) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMutationObserver(); - } else if (lib$es6$promise$asap$$isWorker) { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useMessageChannel(); - } else if (lib$es6$promise$asap$$browserWindow === undefined && typeof require === 'function') { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$attemptVertex(); - } else { - lib$es6$promise$asap$$scheduleFlush = lib$es6$promise$asap$$useSetTimeout(); - } - - function lib$es6$promise$$internal$$noop() {} - - var lib$es6$promise$$internal$$PENDING = void 0; - var lib$es6$promise$$internal$$FULFILLED = 1; - var lib$es6$promise$$internal$$REJECTED = 2; - - var lib$es6$promise$$internal$$GET_THEN_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); - } - - function lib$es6$promise$$internal$$cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); - } - - function lib$es6$promise$$internal$$getThen(promise) { - try { - return promise.then; - } catch(error) { - lib$es6$promise$$internal$$GET_THEN_ERROR.error = error; - return lib$es6$promise$$internal$$GET_THEN_ERROR; - } - } - - function lib$es6$promise$$internal$$tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } - } - - function lib$es6$promise$$internal$$handleForeignThenable(promise, thenable, then) { - lib$es6$promise$asap$$default(function(promise) { - var sealed = false; - var error = lib$es6$promise$$internal$$tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - lib$es6$promise$$internal$$resolve(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - lib$es6$promise$$internal$$reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - lib$es6$promise$$internal$$reject(promise, error); - } - }, promise); - } - - function lib$es6$promise$$internal$$handleOwnThenable(promise, thenable) { - if (thenable._state === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, thenable._result); - } else if (thenable._state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, thenable._result); - } else { - lib$es6$promise$$internal$$subscribe(thenable, undefined, function(value) { - lib$es6$promise$$internal$$resolve(promise, value); - }, function(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } - } - - function lib$es6$promise$$internal$$handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - lib$es6$promise$$internal$$handleOwnThenable(promise, maybeThenable); - } else { - var then = lib$es6$promise$$internal$$getThen(maybeThenable); - - if (then === lib$es6$promise$$internal$$GET_THEN_ERROR) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$GET_THEN_ERROR.error); - } else if (then === undefined) { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } else if (lib$es6$promise$utils$$isFunction(then)) { - lib$es6$promise$$internal$$handleForeignThenable(promise, maybeThenable, then); - } else { - lib$es6$promise$$internal$$fulfill(promise, maybeThenable); - } - } - } - - function lib$es6$promise$$internal$$resolve(promise, value) { - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$selfFullfillment()); - } else if (lib$es6$promise$utils$$objectOrFunction(value)) { - lib$es6$promise$$internal$$handleMaybeThenable(promise, value); - } else { - lib$es6$promise$$internal$$fulfill(promise, value); - } - } - - function lib$es6$promise$$internal$$publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - lib$es6$promise$$internal$$publish(promise); - } - - function lib$es6$promise$$internal$$fulfill(promise, value) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - - promise._result = value; - promise._state = lib$es6$promise$$internal$$FULFILLED; - - if (promise._subscribers.length !== 0) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, promise); - } - } - - function lib$es6$promise$$internal$$reject(promise, reason) { - if (promise._state !== lib$es6$promise$$internal$$PENDING) { return; } - promise._state = lib$es6$promise$$internal$$REJECTED; - promise._result = reason; - - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publishRejection, promise); - } - - function lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + lib$es6$promise$$internal$$FULFILLED] = onFulfillment; - subscribers[length + lib$es6$promise$$internal$$REJECTED] = onRejection; - - if (length === 0 && parent._state) { - lib$es6$promise$asap$$default(lib$es6$promise$$internal$$publish, parent); - } - } - - function lib$es6$promise$$internal$$publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - lib$es6$promise$$internal$$invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; - } - - function lib$es6$promise$$internal$$ErrorObject() { - this.error = null; - } - - var lib$es6$promise$$internal$$TRY_CATCH_ERROR = new lib$es6$promise$$internal$$ErrorObject(); - - function lib$es6$promise$$internal$$tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - lib$es6$promise$$internal$$TRY_CATCH_ERROR.error = e; - return lib$es6$promise$$internal$$TRY_CATCH_ERROR; - } - } - - function lib$es6$promise$$internal$$invokeCallback(settled, promise, callback, detail) { - var hasCallback = lib$es6$promise$utils$$isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = lib$es6$promise$$internal$$tryCatch(callback, detail); - - if (value === lib$es6$promise$$internal$$TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - lib$es6$promise$$internal$$reject(promise, lib$es6$promise$$internal$$cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== lib$es6$promise$$internal$$PENDING) { - // noop - } else if (hasCallback && succeeded) { - lib$es6$promise$$internal$$resolve(promise, value); - } else if (failed) { - lib$es6$promise$$internal$$reject(promise, error); - } else if (settled === lib$es6$promise$$internal$$FULFILLED) { - lib$es6$promise$$internal$$fulfill(promise, value); - } else if (settled === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } - } - - function lib$es6$promise$$internal$$initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - lib$es6$promise$$internal$$resolve(promise, value); - }, function rejectPromise(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - }); - } catch(e) { - lib$es6$promise$$internal$$reject(promise, e); - } - } - - function lib$es6$promise$enumerator$$Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(enumerator.promise, enumerator._result); - } - } - } else { - lib$es6$promise$$internal$$reject(enumerator.promise, enumerator._validationError()); - } - } - - lib$es6$promise$enumerator$$Enumerator.prototype._validateInput = function(input) { - return lib$es6$promise$utils$$isArray(input); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._init = function() { - this._result = new Array(this.length); - }; - - var lib$es6$promise$enumerator$$default = lib$es6$promise$enumerator$$Enumerator; - - lib$es6$promise$enumerator$$Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (lib$es6$promise$utils$$isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== lib$es6$promise$$internal$$PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === lib$es6$promise$$internal$$PENDING) { - enumerator._remaining--; - - if (state === lib$es6$promise$$internal$$REJECTED) { - lib$es6$promise$$internal$$reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - lib$es6$promise$$internal$$fulfill(promise, enumerator._result); - } - }; - - lib$es6$promise$enumerator$$Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - lib$es6$promise$$internal$$subscribe(promise, undefined, function(value) { - enumerator._settledAt(lib$es6$promise$$internal$$FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(lib$es6$promise$$internal$$REJECTED, i, reason); - }); - }; - function lib$es6$promise$promise$all$$all(entries) { - return new lib$es6$promise$enumerator$$default(this, entries).promise; - } - var lib$es6$promise$promise$all$$default = lib$es6$promise$promise$all$$all; - function lib$es6$promise$promise$race$$race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - - if (!lib$es6$promise$utils$$isArray(entries)) { - lib$es6$promise$$internal$$reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - lib$es6$promise$$internal$$resolve(promise, value); - } - - function onRejection(reason) { - lib$es6$promise$$internal$$reject(promise, reason); - } - - for (var i = 0; promise._state === lib$es6$promise$$internal$$PENDING && i < length; i++) { - lib$es6$promise$$internal$$subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; - } - var lib$es6$promise$promise$race$$default = lib$es6$promise$promise$race$$race; - function lib$es6$promise$promise$resolve$$resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$resolve(promise, object); - return promise; - } - var lib$es6$promise$promise$resolve$$default = lib$es6$promise$promise$resolve$$resolve; - function lib$es6$promise$promise$reject$$reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(lib$es6$promise$$internal$$noop); - lib$es6$promise$$internal$$reject(promise, reason); - return promise; - } - var lib$es6$promise$promise$reject$$default = lib$es6$promise$promise$reject$$reject; - - var lib$es6$promise$promise$$counter = 0; - - function lib$es6$promise$promise$$needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); - } - - function lib$es6$promise$promise$$needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); - } - - var lib$es6$promise$promise$$default = lib$es6$promise$promise$$Promise; - /** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor - */ - function lib$es6$promise$promise$$Promise(resolver) { - this._id = lib$es6$promise$promise$$counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (lib$es6$promise$$internal$$noop !== resolver) { - if (!lib$es6$promise$utils$$isFunction(resolver)) { - lib$es6$promise$promise$$needsResolver(); - } - - if (!(this instanceof lib$es6$promise$promise$$Promise)) { - lib$es6$promise$promise$$needsNew(); - } - - lib$es6$promise$$internal$$initializePromise(this, resolver); - } - } - - lib$es6$promise$promise$$Promise.all = lib$es6$promise$promise$all$$default; - lib$es6$promise$promise$$Promise.race = lib$es6$promise$promise$race$$default; - lib$es6$promise$promise$$Promise.resolve = lib$es6$promise$promise$resolve$$default; - lib$es6$promise$promise$$Promise.reject = lib$es6$promise$promise$reject$$default; - - lib$es6$promise$promise$$Promise.prototype = { - constructor: lib$es6$promise$promise$$Promise, - - /** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} - */ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === lib$es6$promise$$internal$$FULFILLED && !onFulfillment || state === lib$es6$promise$$internal$$REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(lib$es6$promise$$internal$$noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - lib$es6$promise$asap$$default(function(){ - lib$es6$promise$$internal$$invokeCallback(state, child, callback, result); - }); - } else { - lib$es6$promise$$internal$$subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - - /** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} - */ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } - }; - function lib$es6$promise$polyfill$$polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = lib$es6$promise$promise$$default; - } - var lib$es6$promise$polyfill$$default = lib$es6$promise$polyfill$$polyfill; - - var lib$es6$promise$umd$$ES6Promise = { - 'Promise': lib$es6$promise$promise$$default, - 'polyfill': lib$es6$promise$polyfill$$default - }; - - /* global define:true module:true window: true */ - if (typeof define === 'function' && define['amd']) { - define(function() { return lib$es6$promise$umd$$ES6Promise; }); - } else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = lib$es6$promise$umd$$ES6Promise; - } else if (typeof this !== 'undefined') { - this['ES6Promise'] = lib$es6$promise$umd$$ES6Promise; - } - - lib$es6$promise$polyfill$$default(); -}).call(this); - -//# sourceMappingURL=es6-promise.js.map \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js deleted file mode 100644 index 34a1f52b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/es6-promise.min.js +++ /dev/null @@ -1 +0,0 @@ -(function(){"use strict";function lib$es6$promise$utils$$objectOrFunction(x){return typeof x==="function"||typeof x==="object"&&x!==null}function lib$es6$promise$utils$$isFunction(x){return typeof x==="function"}function lib$es6$promise$utils$$isMaybeThenable(x){return typeof x==="object"&&x!==null}var lib$es6$promise$utils$$_isArray;if(!Array.isArray){lib$es6$promise$utils$$_isArray=function(x){return Object.prototype.toString.call(x)==="[object Array]"}}else{lib$es6$promise$utils$$_isArray=Array.isArray}var lib$es6$promise$utils$$isArray=lib$es6$promise$utils$$_isArray;var lib$es6$promise$asap$$len=0;var lib$es6$promise$asap$$toString={}.toString;var lib$es6$promise$asap$$vertxNext;function lib$es6$promise$asap$$asap(callback,arg){lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len]=callback;lib$es6$promise$asap$$queue[lib$es6$promise$asap$$len+1]=arg;lib$es6$promise$asap$$len+=2;if(lib$es6$promise$asap$$len===2){lib$es6$promise$asap$$scheduleFlush()}}var lib$es6$promise$asap$$default=lib$es6$promise$asap$$asap;var lib$es6$promise$asap$$browserWindow=typeof window!=="undefined"?window:undefined;var lib$es6$promise$asap$$browserGlobal=lib$es6$promise$asap$$browserWindow||{};var lib$es6$promise$asap$$BrowserMutationObserver=lib$es6$promise$asap$$browserGlobal.MutationObserver||lib$es6$promise$asap$$browserGlobal.WebKitMutationObserver;var lib$es6$promise$asap$$isNode=typeof process!=="undefined"&&{}.toString.call(process)==="[object process]";var lib$es6$promise$asap$$isWorker=typeof Uint8ClampedArray!=="undefined"&&typeof importScripts!=="undefined"&&typeof MessageChannel!=="undefined";function lib$es6$promise$asap$$useNextTick(){var nextTick=process.nextTick;var version=process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/);if(Array.isArray(version)&&version[1]==="0"&&version[2]==="10"){nextTick=setImmediate}return function(){nextTick(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useVertxTimer(){return function(){lib$es6$promise$asap$$vertxNext(lib$es6$promise$asap$$flush)}}function lib$es6$promise$asap$$useMutationObserver(){var iterations=0;var observer=new lib$es6$promise$asap$$BrowserMutationObserver(lib$es6$promise$asap$$flush);var node=document.createTextNode("");observer.observe(node,{characterData:true});return function(){node.data=iterations=++iterations%2}}function lib$es6$promise$asap$$useMessageChannel(){var channel=new MessageChannel;channel.port1.onmessage=lib$es6$promise$asap$$flush;return function(){channel.port2.postMessage(0)}}function lib$es6$promise$asap$$useSetTimeout(){return function(){setTimeout(lib$es6$promise$asap$$flush,1)}}var lib$es6$promise$asap$$queue=new Array(1e3);function lib$es6$promise$asap$$flush(){for(var i=0;i - - - rsvp.js Tests - - - -
      - - - - - - - - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js deleted file mode 100644 index 4817c9e7..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/json3.js +++ /dev/null @@ -1,902 +0,0 @@ -/*! JSON v3.3.2 | http://bestiejs.github.io/json3 | Copyright 2012-2014, Kit Cambridge | http://kit.mit-license.org */ -;(function () { - // Detect the `define` function exposed by asynchronous module loaders. The - // strict `define` check is necessary for compatibility with `r.js`. - var isLoader = typeof define === "function" && define.amd; - - // A set of types used to distinguish objects from primitives. - var objectTypes = { - "function": true, - "object": true - }; - - // Detect the `exports` object exposed by CommonJS implementations. - var freeExports = objectTypes[typeof exports] && exports && !exports.nodeType && exports; - - // Use the `global` object exposed by Node (including Browserify via - // `insert-module-globals`), Narwhal, and Ringo as the default context, - // and the `window` object in browsers. Rhino exports a `global` function - // instead. - var root = objectTypes[typeof window] && window || this, - freeGlobal = freeExports && objectTypes[typeof module] && module && !module.nodeType && typeof global == "object" && global; - - if (freeGlobal && (freeGlobal["global"] === freeGlobal || freeGlobal["window"] === freeGlobal || freeGlobal["self"] === freeGlobal)) { - root = freeGlobal; - } - - // Public: Initializes JSON 3 using the given `context` object, attaching the - // `stringify` and `parse` functions to the specified `exports` object. - function runInContext(context, exports) { - context || (context = root["Object"]()); - exports || (exports = root["Object"]()); - - // Native constructor aliases. - var Number = context["Number"] || root["Number"], - String = context["String"] || root["String"], - Object = context["Object"] || root["Object"], - Date = context["Date"] || root["Date"], - SyntaxError = context["SyntaxError"] || root["SyntaxError"], - TypeError = context["TypeError"] || root["TypeError"], - Math = context["Math"] || root["Math"], - nativeJSON = context["JSON"] || root["JSON"]; - - // Delegate to the native `stringify` and `parse` implementations. - if (typeof nativeJSON == "object" && nativeJSON) { - exports.stringify = nativeJSON.stringify; - exports.parse = nativeJSON.parse; - } - - // Convenience aliases. - var objectProto = Object.prototype, - getClass = objectProto.toString, - isProperty, forEach, undef; - - // Test the `Date#getUTC*` methods. Based on work by @Yaffle. - var isExtended = new Date(-3509827334573292); - try { - // The `getUTCFullYear`, `Month`, and `Date` methods return nonsensical - // results for certain dates in Opera >= 10.53. - isExtended = isExtended.getUTCFullYear() == -109252 && isExtended.getUTCMonth() === 0 && isExtended.getUTCDate() === 1 && - // Safari < 2.0.2 stores the internal millisecond time value correctly, - // but clips the values returned by the date methods to the range of - // signed 32-bit integers ([-2 ** 31, 2 ** 31 - 1]). - isExtended.getUTCHours() == 10 && isExtended.getUTCMinutes() == 37 && isExtended.getUTCSeconds() == 6 && isExtended.getUTCMilliseconds() == 708; - } catch (exception) {} - - // Internal: Determines whether the native `JSON.stringify` and `parse` - // implementations are spec-compliant. Based on work by Ken Snyder. - function has(name) { - if (has[name] !== undef) { - // Return cached feature test result. - return has[name]; - } - var isSupported; - if (name == "bug-string-char-index") { - // IE <= 7 doesn't support accessing string characters using square - // bracket notation. IE 8 only supports this for primitives. - isSupported = "a"[0] != "a"; - } else if (name == "json") { - // Indicates whether both `JSON.stringify` and `JSON.parse` are - // supported. - isSupported = has("json-stringify") && has("json-parse"); - } else { - var value, serialized = '{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'; - // Test `JSON.stringify`. - if (name == "json-stringify") { - var stringify = exports.stringify, stringifySupported = typeof stringify == "function" && isExtended; - if (stringifySupported) { - // A test function object with a custom `toJSON` method. - (value = function () { - return 1; - }).toJSON = value; - try { - stringifySupported = - // Firefox 3.1b1 and b2 serialize string, number, and boolean - // primitives as object literals. - stringify(0) === "0" && - // FF 3.1b1, b2, and JSON 2 serialize wrapped primitives as object - // literals. - stringify(new Number()) === "0" && - stringify(new String()) == '""' && - // FF 3.1b1, 2 throw an error if the value is `null`, `undefined`, or - // does not define a canonical JSON representation (this applies to - // objects with `toJSON` properties as well, *unless* they are nested - // within an object or array). - stringify(getClass) === undef && - // IE 8 serializes `undefined` as `"undefined"`. Safari <= 5.1.7 and - // FF 3.1b3 pass this test. - stringify(undef) === undef && - // Safari <= 5.1.7 and FF 3.1b3 throw `Error`s and `TypeError`s, - // respectively, if the value is omitted entirely. - stringify() === undef && - // FF 3.1b1, 2 throw an error if the given value is not a number, - // string, array, object, Boolean, or `null` literal. This applies to - // objects with custom `toJSON` methods as well, unless they are nested - // inside object or array literals. YUI 3.0.0b1 ignores custom `toJSON` - // methods entirely. - stringify(value) === "1" && - stringify([value]) == "[1]" && - // Prototype <= 1.6.1 serializes `[undefined]` as `"[]"` instead of - // `"[null]"`. - stringify([undef]) == "[null]" && - // YUI 3.0.0b1 fails to serialize `null` literals. - stringify(null) == "null" && - // FF 3.1b1, 2 halts serialization if an array contains a function: - // `[1, true, getClass, 1]` serializes as "[1,true,],". FF 3.1b3 - // elides non-JSON values from objects and arrays, unless they - // define custom `toJSON` methods. - stringify([undef, getClass, null]) == "[null,null,null]" && - // Simple serialization test. FF 3.1b1 uses Unicode escape sequences - // where character escape codes are expected (e.g., `\b` => `\u0008`). - stringify({ "a": [value, true, false, null, "\x00\b\n\f\r\t"] }) == serialized && - // FF 3.1b1 and b2 ignore the `filter` and `width` arguments. - stringify(null, value) === "1" && - stringify([1, 2], null, 1) == "[\n 1,\n 2\n]" && - // JSON 2, Prototype <= 1.7, and older WebKit builds incorrectly - // serialize extended years. - stringify(new Date(-8.64e15)) == '"-271821-04-20T00:00:00.000Z"' && - // The milliseconds are optional in ES 5, but required in 5.1. - stringify(new Date(8.64e15)) == '"+275760-09-13T00:00:00.000Z"' && - // Firefox <= 11.0 incorrectly serializes years prior to 0 as negative - // four-digit years instead of six-digit years. Credits: @Yaffle. - stringify(new Date(-621987552e5)) == '"-000001-01-01T00:00:00.000Z"' && - // Safari <= 5.1.5 and Opera >= 10.53 incorrectly serialize millisecond - // values less than 1000. Credits: @Yaffle. - stringify(new Date(-1)) == '"1969-12-31T23:59:59.999Z"'; - } catch (exception) { - stringifySupported = false; - } - } - isSupported = stringifySupported; - } - // Test `JSON.parse`. - if (name == "json-parse") { - var parse = exports.parse; - if (typeof parse == "function") { - try { - // FF 3.1b1, b2 will throw an exception if a bare literal is provided. - // Conforming implementations should also coerce the initial argument to - // a string prior to parsing. - if (parse("0") === 0 && !parse(false)) { - // Simple parsing test. - value = parse(serialized); - var parseSupported = value["a"].length == 5 && value["a"][0] === 1; - if (parseSupported) { - try { - // Safari <= 5.1.2 and FF 3.1b1 allow unescaped tabs in strings. - parseSupported = !parse('"\t"'); - } catch (exception) {} - if (parseSupported) { - try { - // FF 4.0 and 4.0.1 allow leading `+` signs and leading - // decimal points. FF 4.0, 4.0.1, and IE 9-10 also allow - // certain octal literals. - parseSupported = parse("01") !== 1; - } catch (exception) {} - } - if (parseSupported) { - try { - // FF 4.0, 4.0.1, and Rhino 1.7R3-R4 allow trailing decimal - // points. These environments, along with FF 3.1b1 and 2, - // also allow trailing commas in JSON objects and arrays. - parseSupported = parse("1.") !== 1; - } catch (exception) {} - } - } - } - } catch (exception) { - parseSupported = false; - } - } - isSupported = parseSupported; - } - } - return has[name] = !!isSupported; - } - - if (!has("json")) { - // Common `[[Class]]` name aliases. - var functionClass = "[object Function]", - dateClass = "[object Date]", - numberClass = "[object Number]", - stringClass = "[object String]", - arrayClass = "[object Array]", - booleanClass = "[object Boolean]"; - - // Detect incomplete support for accessing string characters by index. - var charIndexBuggy = has("bug-string-char-index"); - - // Define additional utility methods if the `Date` methods are buggy. - if (!isExtended) { - var floor = Math.floor; - // A mapping between the months of the year and the number of days between - // January 1st and the first of the respective month. - var Months = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]; - // Internal: Calculates the number of days between the Unix epoch and the - // first day of the given month. - var getDay = function (year, month) { - return Months[month] + 365 * (year - 1970) + floor((year - 1969 + (month = +(month > 1))) / 4) - floor((year - 1901 + month) / 100) + floor((year - 1601 + month) / 400); - }; - } - - // Internal: Determines if a property is a direct property of the given - // object. Delegates to the native `Object#hasOwnProperty` method. - if (!(isProperty = objectProto.hasOwnProperty)) { - isProperty = function (property) { - var members = {}, constructor; - if ((members.__proto__ = null, members.__proto__ = { - // The *proto* property cannot be set multiple times in recent - // versions of Firefox and SeaMonkey. - "toString": 1 - }, members).toString != getClass) { - // Safari <= 2.0.3 doesn't implement `Object#hasOwnProperty`, but - // supports the mutable *proto* property. - isProperty = function (property) { - // Capture and break the object's prototype chain (see section 8.6.2 - // of the ES 5.1 spec). The parenthesized expression prevents an - // unsafe transformation by the Closure Compiler. - var original = this.__proto__, result = property in (this.__proto__ = null, this); - // Restore the original prototype chain. - this.__proto__ = original; - return result; - }; - } else { - // Capture a reference to the top-level `Object` constructor. - constructor = members.constructor; - // Use the `constructor` property to simulate `Object#hasOwnProperty` in - // other environments. - isProperty = function (property) { - var parent = (this.constructor || constructor).prototype; - return property in this && !(property in parent && this[property] === parent[property]); - }; - } - members = null; - return isProperty.call(this, property); - }; - } - - // Internal: Normalizes the `for...in` iteration algorithm across - // environments. Each enumerated key is yielded to a `callback` function. - forEach = function (object, callback) { - var size = 0, Properties, members, property; - - // Tests for bugs in the current environment's `for...in` algorithm. The - // `valueOf` property inherits the non-enumerable flag from - // `Object.prototype` in older versions of IE, Netscape, and Mozilla. - (Properties = function () { - this.valueOf = 0; - }).prototype.valueOf = 0; - - // Iterate over a new instance of the `Properties` class. - members = new Properties(); - for (property in members) { - // Ignore all properties inherited from `Object.prototype`. - if (isProperty.call(members, property)) { - size++; - } - } - Properties = members = null; - - // Normalize the iteration algorithm. - if (!size) { - // A list of non-enumerable properties inherited from `Object.prototype`. - members = ["valueOf", "toString", "toLocaleString", "propertyIsEnumerable", "isPrototypeOf", "hasOwnProperty", "constructor"]; - // IE <= 8, Mozilla 1.0, and Netscape 6.2 ignore shadowed non-enumerable - // properties. - forEach = function (object, callback) { - var isFunction = getClass.call(object) == functionClass, property, length; - var hasProperty = !isFunction && typeof object.constructor != "function" && objectTypes[typeof object.hasOwnProperty] && object.hasOwnProperty || isProperty; - for (property in object) { - // Gecko <= 1.0 enumerates the `prototype` property of functions under - // certain conditions; IE does not. - if (!(isFunction && property == "prototype") && hasProperty.call(object, property)) { - callback(property); - } - } - // Manually invoke the callback for each non-enumerable property. - for (length = members.length; property = members[--length]; hasProperty.call(object, property) && callback(property)); - }; - } else if (size == 2) { - // Safari <= 2.0.4 enumerates shadowed properties twice. - forEach = function (object, callback) { - // Create a set of iterated properties. - var members = {}, isFunction = getClass.call(object) == functionClass, property; - for (property in object) { - // Store each property name to prevent double enumeration. The - // `prototype` property of functions is not enumerated due to cross- - // environment inconsistencies. - if (!(isFunction && property == "prototype") && !isProperty.call(members, property) && (members[property] = 1) && isProperty.call(object, property)) { - callback(property); - } - } - }; - } else { - // No bugs detected; use the standard `for...in` algorithm. - forEach = function (object, callback) { - var isFunction = getClass.call(object) == functionClass, property, isConstructor; - for (property in object) { - if (!(isFunction && property == "prototype") && isProperty.call(object, property) && !(isConstructor = property === "constructor")) { - callback(property); - } - } - // Manually invoke the callback for the `constructor` property due to - // cross-environment inconsistencies. - if (isConstructor || isProperty.call(object, (property = "constructor"))) { - callback(property); - } - }; - } - return forEach(object, callback); - }; - - // Public: Serializes a JavaScript `value` as a JSON string. The optional - // `filter` argument may specify either a function that alters how object and - // array members are serialized, or an array of strings and numbers that - // indicates which properties should be serialized. The optional `width` - // argument may be either a string or number that specifies the indentation - // level of the output. - if (!has("json-stringify")) { - // Internal: A map of control characters and their escaped equivalents. - var Escapes = { - 92: "\\\\", - 34: '\\"', - 8: "\\b", - 12: "\\f", - 10: "\\n", - 13: "\\r", - 9: "\\t" - }; - - // Internal: Converts `value` into a zero-padded string such that its - // length is at least equal to `width`. The `width` must be <= 6. - var leadingZeroes = "000000"; - var toPaddedString = function (width, value) { - // The `|| 0` expression is necessary to work around a bug in - // Opera <= 7.54u2 where `0 == -0`, but `String(-0) !== "0"`. - return (leadingZeroes + (value || 0)).slice(-width); - }; - - // Internal: Double-quotes a string `value`, replacing all ASCII control - // characters (characters with code unit values between 0 and 31) with - // their escaped equivalents. This is an implementation of the - // `Quote(value)` operation defined in ES 5.1 section 15.12.3. - var unicodePrefix = "\\u00"; - var quote = function (value) { - var result = '"', index = 0, length = value.length, useCharIndex = !charIndexBuggy || length > 10; - var symbols = useCharIndex && (charIndexBuggy ? value.split("") : value); - for (; index < length; index++) { - var charCode = value.charCodeAt(index); - // If the character is a control character, append its Unicode or - // shorthand escape sequence; otherwise, append the character as-is. - switch (charCode) { - case 8: case 9: case 10: case 12: case 13: case 34: case 92: - result += Escapes[charCode]; - break; - default: - if (charCode < 32) { - result += unicodePrefix + toPaddedString(2, charCode.toString(16)); - break; - } - result += useCharIndex ? symbols[index] : value.charAt(index); - } - } - return result + '"'; - }; - - // Internal: Recursively serializes an object. Implements the - // `Str(key, holder)`, `JO(value)`, and `JA(value)` operations. - var serialize = function (property, object, callback, properties, whitespace, indentation, stack) { - var value, className, year, month, date, time, hours, minutes, seconds, milliseconds, results, element, index, length, prefix, result; - try { - // Necessary for host object support. - value = object[property]; - } catch (exception) {} - if (typeof value == "object" && value) { - className = getClass.call(value); - if (className == dateClass && !isProperty.call(value, "toJSON")) { - if (value > -1 / 0 && value < 1 / 0) { - // Dates are serialized according to the `Date#toJSON` method - // specified in ES 5.1 section 15.9.5.44. See section 15.9.1.15 - // for the ISO 8601 date time string format. - if (getDay) { - // Manually compute the year, month, date, hours, minutes, - // seconds, and milliseconds if the `getUTC*` methods are - // buggy. Adapted from @Yaffle's `date-shim` project. - date = floor(value / 864e5); - for (year = floor(date / 365.2425) + 1970 - 1; getDay(year + 1, 0) <= date; year++); - for (month = floor((date - getDay(year, 0)) / 30.42); getDay(year, month + 1) <= date; month++); - date = 1 + date - getDay(year, month); - // The `time` value specifies the time within the day (see ES - // 5.1 section 15.9.1.2). The formula `(A % B + B) % B` is used - // to compute `A modulo B`, as the `%` operator does not - // correspond to the `modulo` operation for negative numbers. - time = (value % 864e5 + 864e5) % 864e5; - // The hours, minutes, seconds, and milliseconds are obtained by - // decomposing the time within the day. See section 15.9.1.10. - hours = floor(time / 36e5) % 24; - minutes = floor(time / 6e4) % 60; - seconds = floor(time / 1e3) % 60; - milliseconds = time % 1e3; - } else { - year = value.getUTCFullYear(); - month = value.getUTCMonth(); - date = value.getUTCDate(); - hours = value.getUTCHours(); - minutes = value.getUTCMinutes(); - seconds = value.getUTCSeconds(); - milliseconds = value.getUTCMilliseconds(); - } - // Serialize extended years correctly. - value = (year <= 0 || year >= 1e4 ? (year < 0 ? "-" : "+") + toPaddedString(6, year < 0 ? -year : year) : toPaddedString(4, year)) + - "-" + toPaddedString(2, month + 1) + "-" + toPaddedString(2, date) + - // Months, dates, hours, minutes, and seconds should have two - // digits; milliseconds should have three. - "T" + toPaddedString(2, hours) + ":" + toPaddedString(2, minutes) + ":" + toPaddedString(2, seconds) + - // Milliseconds are optional in ES 5.0, but required in 5.1. - "." + toPaddedString(3, milliseconds) + "Z"; - } else { - value = null; - } - } else if (typeof value.toJSON == "function" && ((className != numberClass && className != stringClass && className != arrayClass) || isProperty.call(value, "toJSON"))) { - // Prototype <= 1.6.1 adds non-standard `toJSON` methods to the - // `Number`, `String`, `Date`, and `Array` prototypes. JSON 3 - // ignores all `toJSON` methods on these objects unless they are - // defined directly on an instance. - value = value.toJSON(property); - } - } - if (callback) { - // If a replacement function was provided, call it to obtain the value - // for serialization. - value = callback.call(object, property, value); - } - if (value === null) { - return "null"; - } - className = getClass.call(value); - if (className == booleanClass) { - // Booleans are represented literally. - return "" + value; - } else if (className == numberClass) { - // JSON numbers must be finite. `Infinity` and `NaN` are serialized as - // `"null"`. - return value > -1 / 0 && value < 1 / 0 ? "" + value : "null"; - } else if (className == stringClass) { - // Strings are double-quoted and escaped. - return quote("" + value); - } - // Recursively serialize objects and arrays. - if (typeof value == "object") { - // Check for cyclic structures. This is a linear search; performance - // is inversely proportional to the number of unique nested objects. - for (length = stack.length; length--;) { - if (stack[length] === value) { - // Cyclic structures cannot be serialized by `JSON.stringify`. - throw TypeError(); - } - } - // Add the object to the stack of traversed objects. - stack.push(value); - results = []; - // Save the current indentation level and indent one additional level. - prefix = indentation; - indentation += whitespace; - if (className == arrayClass) { - // Recursively serialize array elements. - for (index = 0, length = value.length; index < length; index++) { - element = serialize(index, value, callback, properties, whitespace, indentation, stack); - results.push(element === undef ? "null" : element); - } - result = results.length ? (whitespace ? "[\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "]" : ("[" + results.join(",") + "]")) : "[]"; - } else { - // Recursively serialize object members. Members are selected from - // either a user-specified list of property names, or the object - // itself. - forEach(properties || value, function (property) { - var element = serialize(property, value, callback, properties, whitespace, indentation, stack); - if (element !== undef) { - // According to ES 5.1 section 15.12.3: "If `gap` {whitespace} - // is not the empty string, let `member` {quote(property) + ":"} - // be the concatenation of `member` and the `space` character." - // The "`space` character" refers to the literal space - // character, not the `space` {width} argument provided to - // `JSON.stringify`. - results.push(quote(property) + ":" + (whitespace ? " " : "") + element); - } - }); - result = results.length ? (whitespace ? "{\n" + indentation + results.join(",\n" + indentation) + "\n" + prefix + "}" : ("{" + results.join(",") + "}")) : "{}"; - } - // Remove the object from the traversed object stack. - stack.pop(); - return result; - } - }; - - // Public: `JSON.stringify`. See ES 5.1 section 15.12.3. - exports.stringify = function (source, filter, width) { - var whitespace, callback, properties, className; - if (objectTypes[typeof filter] && filter) { - if ((className = getClass.call(filter)) == functionClass) { - callback = filter; - } else if (className == arrayClass) { - // Convert the property names array into a makeshift set. - properties = {}; - for (var index = 0, length = filter.length, value; index < length; value = filter[index++], ((className = getClass.call(value)), className == stringClass || className == numberClass) && (properties[value] = 1)); - } - } - if (width) { - if ((className = getClass.call(width)) == numberClass) { - // Convert the `width` to an integer and create a string containing - // `width` number of space characters. - if ((width -= width % 1) > 0) { - for (whitespace = "", width > 10 && (width = 10); whitespace.length < width; whitespace += " "); - } - } else if (className == stringClass) { - whitespace = width.length <= 10 ? width : width.slice(0, 10); - } - } - // Opera <= 7.54u2 discards the values associated with empty string keys - // (`""`) only if they are used directly within an object member list - // (e.g., `!("" in { "": 1})`). - return serialize("", (value = {}, value[""] = source, value), callback, properties, whitespace, "", []); - }; - } - - // Public: Parses a JSON source string. - if (!has("json-parse")) { - var fromCharCode = String.fromCharCode; - - // Internal: A map of escaped control characters and their unescaped - // equivalents. - var Unescapes = { - 92: "\\", - 34: '"', - 47: "/", - 98: "\b", - 116: "\t", - 110: "\n", - 102: "\f", - 114: "\r" - }; - - // Internal: Stores the parser state. - var Index, Source; - - // Internal: Resets the parser state and throws a `SyntaxError`. - var abort = function () { - Index = Source = null; - throw SyntaxError(); - }; - - // Internal: Returns the next token, or `"$"` if the parser has reached - // the end of the source string. A token may be a string, number, `null` - // literal, or Boolean literal. - var lex = function () { - var source = Source, length = source.length, value, begin, position, isSigned, charCode; - while (Index < length) { - charCode = source.charCodeAt(Index); - switch (charCode) { - case 9: case 10: case 13: case 32: - // Skip whitespace tokens, including tabs, carriage returns, line - // feeds, and space characters. - Index++; - break; - case 123: case 125: case 91: case 93: case 58: case 44: - // Parse a punctuator token (`{`, `}`, `[`, `]`, `:`, or `,`) at - // the current position. - value = charIndexBuggy ? source.charAt(Index) : source[Index]; - Index++; - return value; - case 34: - // `"` delimits a JSON string; advance to the next character and - // begin parsing the string. String tokens are prefixed with the - // sentinel `@` character to distinguish them from punctuators and - // end-of-string tokens. - for (value = "@", Index++; Index < length;) { - charCode = source.charCodeAt(Index); - if (charCode < 32) { - // Unescaped ASCII control characters (those with a code unit - // less than the space character) are not permitted. - abort(); - } else if (charCode == 92) { - // A reverse solidus (`\`) marks the beginning of an escaped - // control character (including `"`, `\`, and `/`) or Unicode - // escape sequence. - charCode = source.charCodeAt(++Index); - switch (charCode) { - case 92: case 34: case 47: case 98: case 116: case 110: case 102: case 114: - // Revive escaped control characters. - value += Unescapes[charCode]; - Index++; - break; - case 117: - // `\u` marks the beginning of a Unicode escape sequence. - // Advance to the first character and validate the - // four-digit code point. - begin = ++Index; - for (position = Index + 4; Index < position; Index++) { - charCode = source.charCodeAt(Index); - // A valid sequence comprises four hexdigits (case- - // insensitive) that form a single hexadecimal value. - if (!(charCode >= 48 && charCode <= 57 || charCode >= 97 && charCode <= 102 || charCode >= 65 && charCode <= 70)) { - // Invalid Unicode escape sequence. - abort(); - } - } - // Revive the escaped character. - value += fromCharCode("0x" + source.slice(begin, Index)); - break; - default: - // Invalid escape sequence. - abort(); - } - } else { - if (charCode == 34) { - // An unescaped double-quote character marks the end of the - // string. - break; - } - charCode = source.charCodeAt(Index); - begin = Index; - // Optimize for the common case where a string is valid. - while (charCode >= 32 && charCode != 92 && charCode != 34) { - charCode = source.charCodeAt(++Index); - } - // Append the string as-is. - value += source.slice(begin, Index); - } - } - if (source.charCodeAt(Index) == 34) { - // Advance to the next character and return the revived string. - Index++; - return value; - } - // Unterminated string. - abort(); - default: - // Parse numbers and literals. - begin = Index; - // Advance past the negative sign, if one is specified. - if (charCode == 45) { - isSigned = true; - charCode = source.charCodeAt(++Index); - } - // Parse an integer or floating-point value. - if (charCode >= 48 && charCode <= 57) { - // Leading zeroes are interpreted as octal literals. - if (charCode == 48 && ((charCode = source.charCodeAt(Index + 1)), charCode >= 48 && charCode <= 57)) { - // Illegal octal literal. - abort(); - } - isSigned = false; - // Parse the integer component. - for (; Index < length && ((charCode = source.charCodeAt(Index)), charCode >= 48 && charCode <= 57); Index++); - // Floats cannot contain a leading decimal point; however, this - // case is already accounted for by the parser. - if (source.charCodeAt(Index) == 46) { - position = ++Index; - // Parse the decimal component. - for (; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); - if (position == Index) { - // Illegal trailing decimal. - abort(); - } - Index = position; - } - // Parse exponents. The `e` denoting the exponent is - // case-insensitive. - charCode = source.charCodeAt(Index); - if (charCode == 101 || charCode == 69) { - charCode = source.charCodeAt(++Index); - // Skip past the sign following the exponent, if one is - // specified. - if (charCode == 43 || charCode == 45) { - Index++; - } - // Parse the exponential component. - for (position = Index; position < length && ((charCode = source.charCodeAt(position)), charCode >= 48 && charCode <= 57); position++); - if (position == Index) { - // Illegal empty exponent. - abort(); - } - Index = position; - } - // Coerce the parsed value to a JavaScript number. - return +source.slice(begin, Index); - } - // A negative sign may only precede numbers. - if (isSigned) { - abort(); - } - // `true`, `false`, and `null` literals. - if (source.slice(Index, Index + 4) == "true") { - Index += 4; - return true; - } else if (source.slice(Index, Index + 5) == "false") { - Index += 5; - return false; - } else if (source.slice(Index, Index + 4) == "null") { - Index += 4; - return null; - } - // Unrecognized token. - abort(); - } - } - // Return the sentinel `$` character if the parser has reached the end - // of the source string. - return "$"; - }; - - // Internal: Parses a JSON `value` token. - var get = function (value) { - var results, hasMembers; - if (value == "$") { - // Unexpected end of input. - abort(); - } - if (typeof value == "string") { - if ((charIndexBuggy ? value.charAt(0) : value[0]) == "@") { - // Remove the sentinel `@` character. - return value.slice(1); - } - // Parse object and array literals. - if (value == "[") { - // Parses a JSON array, returning a new JavaScript array. - results = []; - for (;; hasMembers || (hasMembers = true)) { - value = lex(); - // A closing square bracket marks the end of the array literal. - if (value == "]") { - break; - } - // If the array literal contains elements, the current token - // should be a comma separating the previous element from the - // next. - if (hasMembers) { - if (value == ",") { - value = lex(); - if (value == "]") { - // Unexpected trailing `,` in array literal. - abort(); - } - } else { - // A `,` must separate each array element. - abort(); - } - } - // Elisions and leading commas are not permitted. - if (value == ",") { - abort(); - } - results.push(get(value)); - } - return results; - } else if (value == "{") { - // Parses a JSON object, returning a new JavaScript object. - results = {}; - for (;; hasMembers || (hasMembers = true)) { - value = lex(); - // A closing curly brace marks the end of the object literal. - if (value == "}") { - break; - } - // If the object literal contains members, the current token - // should be a comma separator. - if (hasMembers) { - if (value == ",") { - value = lex(); - if (value == "}") { - // Unexpected trailing `,` in object literal. - abort(); - } - } else { - // A `,` must separate each object member. - abort(); - } - } - // Leading commas are not permitted, object property names must be - // double-quoted strings, and a `:` must separate each property - // name and value. - if (value == "," || typeof value != "string" || (charIndexBuggy ? value.charAt(0) : value[0]) != "@" || lex() != ":") { - abort(); - } - results[value.slice(1)] = get(lex()); - } - return results; - } - // Unexpected token encountered. - abort(); - } - return value; - }; - - // Internal: Updates a traversed object member. - var update = function (source, property, callback) { - var element = walk(source, property, callback); - if (element === undef) { - delete source[property]; - } else { - source[property] = element; - } - }; - - // Internal: Recursively traverses a parsed JSON object, invoking the - // `callback` function for each value. This is an implementation of the - // `Walk(holder, name)` operation defined in ES 5.1 section 15.12.2. - var walk = function (source, property, callback) { - var value = source[property], length; - if (typeof value == "object" && value) { - // `forEach` can't be used to traverse an array in Opera <= 8.54 - // because its `Object#hasOwnProperty` implementation returns `false` - // for array indices (e.g., `![1, 2, 3].hasOwnProperty("0")`). - if (getClass.call(value) == arrayClass) { - for (length = value.length; length--;) { - update(value, length, callback); - } - } else { - forEach(value, function (property) { - update(value, property, callback); - }); - } - } - return callback.call(source, property, value); - }; - - // Public: `JSON.parse`. See ES 5.1 section 15.12.2. - exports.parse = function (source, callback) { - var result, value; - Index = 0; - Source = "" + source; - result = get(lex()); - // If a JSON string contains multiple tokens, it is invalid. - if (lex() != "$") { - abort(); - } - // Reset the parser state. - Index = Source = null; - return callback && getClass.call(callback) == functionClass ? walk((value = {}, value[""] = result, value), "", callback) : result; - }; - } - } - - exports["runInContext"] = runInContext; - return exports; - } - - if (freeExports && !isLoader) { - // Export for CommonJS environments. - runInContext(root, freeExports); - } else { - // Export for web browsers and JavaScript engines. - var nativeJSON = root.JSON, - previousJSON = root["JSON3"], - isRestored = false; - - var JSON3 = runInContext(root, (root["JSON3"] = { - // Public: Restores the original value of the global `JSON` object and - // returns a reference to the `JSON3` object. - "noConflict": function () { - if (!isRestored) { - isRestored = true; - root.JSON = nativeJSON; - root["JSON3"] = previousJSON; - nativeJSON = previousJSON = null; - } - return JSON3; - } - })); - - root.JSON = { - "parse": JSON3.parse, - "stringify": JSON3.stringify - }; - } - - // Export for asynchronous module loaders. - if (isLoader) { - define(function () { - return JSON3; - }); - } -}).call(this); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css deleted file mode 100644 index 42b9798f..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.css +++ /dev/null @@ -1,270 +0,0 @@ -@charset "utf-8"; - -body { - margin:0; -} - -#mocha { - font: 20px/1.5 "Helvetica Neue", Helvetica, Arial, sans-serif; - margin: 60px 50px; -} - -#mocha ul, -#mocha li { - margin: 0; - padding: 0; -} - -#mocha ul { - list-style: none; -} - -#mocha h1, -#mocha h2 { - margin: 0; -} - -#mocha h1 { - margin-top: 15px; - font-size: 1em; - font-weight: 200; -} - -#mocha h1 a { - text-decoration: none; - color: inherit; -} - -#mocha h1 a:hover { - text-decoration: underline; -} - -#mocha .suite .suite h1 { - margin-top: 0; - font-size: .8em; -} - -#mocha .hidden { - display: none; -} - -#mocha h2 { - font-size: 12px; - font-weight: normal; - cursor: pointer; -} - -#mocha .suite { - margin-left: 15px; -} - -#mocha .test { - margin-left: 15px; - overflow: hidden; -} - -#mocha .test.pending:hover h2::after { - content: '(pending)'; - font-family: arial, sans-serif; -} - -#mocha .test.pass.medium .duration { - background: #c09853; -} - -#mocha .test.pass.slow .duration { - background: #b94a48; -} - -#mocha .test.pass::before { - content: '✓'; - font-size: 12px; - display: block; - float: left; - margin-right: 5px; - color: #00d6b2; -} - -#mocha .test.pass .duration { - font-size: 9px; - margin-left: 5px; - padding: 2px 5px; - color: #fff; - -webkit-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - -moz-box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - box-shadow: inset 0 1px 1px rgba(0,0,0,.2); - -webkit-border-radius: 5px; - -moz-border-radius: 5px; - -ms-border-radius: 5px; - -o-border-radius: 5px; - border-radius: 5px; -} - -#mocha .test.pass.fast .duration { - display: none; -} - -#mocha .test.pending { - color: #0b97c4; -} - -#mocha .test.pending::before { - content: '◦'; - color: #0b97c4; -} - -#mocha .test.fail { - color: #c00; -} - -#mocha .test.fail pre { - color: black; -} - -#mocha .test.fail::before { - content: '✖'; - font-size: 12px; - display: block; - float: left; - margin-right: 5px; - color: #c00; -} - -#mocha .test pre.error { - color: #c00; - max-height: 300px; - overflow: auto; -} - -/** - * (1): approximate for browsers not supporting calc - * (2): 42 = 2*15 + 2*10 + 2*1 (padding + margin + border) - * ^^ seriously - */ -#mocha .test pre { - display: block; - float: left; - clear: left; - font: 12px/1.5 monaco, monospace; - margin: 5px; - padding: 15px; - border: 1px solid #eee; - max-width: 85%; /*(1)*/ - max-width: calc(100% - 42px); /*(2)*/ - word-wrap: break-word; - border-bottom-color: #ddd; - -webkit-border-radius: 3px; - -webkit-box-shadow: 0 1px 3px #eee; - -moz-border-radius: 3px; - -moz-box-shadow: 0 1px 3px #eee; - border-radius: 3px; -} - -#mocha .test h2 { - position: relative; -} - -#mocha .test a.replay { - position: absolute; - top: 3px; - right: 0; - text-decoration: none; - vertical-align: middle; - display: block; - width: 15px; - height: 15px; - line-height: 15px; - text-align: center; - background: #eee; - font-size: 15px; - -moz-border-radius: 15px; - border-radius: 15px; - -webkit-transition: opacity 200ms; - -moz-transition: opacity 200ms; - transition: opacity 200ms; - opacity: 0.3; - color: #888; -} - -#mocha .test:hover a.replay { - opacity: 1; -} - -#mocha-report.pass .test.fail { - display: none; -} - -#mocha-report.fail .test.pass { - display: none; -} - -#mocha-report.pending .test.pass, -#mocha-report.pending .test.fail { - display: none; -} -#mocha-report.pending .test.pass.pending { - display: block; -} - -#mocha-error { - color: #c00; - font-size: 1.5em; - font-weight: 100; - letter-spacing: 1px; -} - -#mocha-stats { - position: fixed; - top: 15px; - right: 10px; - font-size: 12px; - margin: 0; - color: #888; - z-index: 1; -} - -#mocha-stats .progress { - float: right; - padding-top: 0; -} - -#mocha-stats em { - color: black; -} - -#mocha-stats a { - text-decoration: none; - color: inherit; -} - -#mocha-stats a:hover { - border-bottom: 1px solid #eee; -} - -#mocha-stats li { - display: inline-block; - margin: 0 5px; - list-style: none; - padding-top: 11px; -} - -#mocha-stats canvas { - width: 40px; - height: 40px; -} - -#mocha code .comment { color: #ddd; } -#mocha code .init { color: #2f6fad; } -#mocha code .string { color: #5890ad; } -#mocha code .keyword { color: #8a6343; } -#mocha code .number { color: #2f6fad; } - -@media screen and (max-device-width: 480px) { - #mocha { - margin: 60px 0px; - } - - #mocha #stats { - position: absolute; - } -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js deleted file mode 100644 index e8bee79b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/mocha.js +++ /dev/null @@ -1,6095 +0,0 @@ -;(function(){ - -// CommonJS require() - -function require(p){ - var path = require.resolve(p) - , mod = require.modules[path]; - if (!mod) throw new Error('failed to require "' + p + '"'); - if (!mod.exports) { - mod.exports = {}; - mod.call(mod.exports, mod, mod.exports, require.relative(path)); - } - return mod.exports; - } - -require.modules = {}; - -require.resolve = function (path){ - var orig = path - , reg = path + '.js' - , index = path + '/index.js'; - return require.modules[reg] && reg - || require.modules[index] && index - || orig; - }; - -require.register = function (path, fn){ - require.modules[path] = fn; - }; - -require.relative = function (parent) { - return function(p){ - if ('.' != p.charAt(0)) return require(p); - - var path = parent.split('/') - , segs = p.split('/'); - path.pop(); - - for (var i = 0; i < segs.length; i++) { - var seg = segs[i]; - if ('..' == seg) path.pop(); - else if ('.' != seg) path.push(seg); - } - - return require(path.join('/')); - }; - }; - - -require.register("browser/debug.js", function(module, exports, require){ - -module.exports = function(type){ - return function(){ - } -}; - -}); // module: browser/debug.js - -require.register("browser/diff.js", function(module, exports, require){ -/* See LICENSE file for terms of use */ - -/* - * Text diff implementation. - * - * This library supports the following APIS: - * JsDiff.diffChars: Character by character diff - * JsDiff.diffWords: Word (as defined by \b regex) diff which ignores whitespace - * JsDiff.diffLines: Line based diff - * - * JsDiff.diffCss: Diff targeted at CSS content - * - * These methods are based on the implementation proposed in - * "An O(ND) Difference Algorithm and its Variations" (Myers, 1986). - * http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.4.6927 - */ -var JsDiff = (function() { - /*jshint maxparams: 5*/ - function clonePath(path) { - return { newPos: path.newPos, components: path.components.slice(0) }; - } - function removeEmpty(array) { - var ret = []; - for (var i = 0; i < array.length; i++) { - if (array[i]) { - ret.push(array[i]); - } - } - return ret; - } - function escapeHTML(s) { - var n = s; - n = n.replace(/&/g, '&'); - n = n.replace(//g, '>'); - n = n.replace(/"/g, '"'); - - return n; - } - - var Diff = function(ignoreWhitespace) { - this.ignoreWhitespace = ignoreWhitespace; - }; - Diff.prototype = { - diff: function(oldString, newString) { - // Handle the identity case (this is due to unrolling editLength == 0 - if (newString === oldString) { - return [{ value: newString }]; - } - if (!newString) { - return [{ value: oldString, removed: true }]; - } - if (!oldString) { - return [{ value: newString, added: true }]; - } - - newString = this.tokenize(newString); - oldString = this.tokenize(oldString); - - var newLen = newString.length, oldLen = oldString.length; - var maxEditLength = newLen + oldLen; - var bestPath = [{ newPos: -1, components: [] }]; - - // Seed editLength = 0 - var oldPos = this.extractCommon(bestPath[0], newString, oldString, 0); - if (bestPath[0].newPos+1 >= newLen && oldPos+1 >= oldLen) { - return bestPath[0].components; - } - - for (var editLength = 1; editLength <= maxEditLength; editLength++) { - for (var diagonalPath = -1*editLength; diagonalPath <= editLength; diagonalPath+=2) { - var basePath; - var addPath = bestPath[diagonalPath-1], - removePath = bestPath[diagonalPath+1]; - oldPos = (removePath ? removePath.newPos : 0) - diagonalPath; - if (addPath) { - // No one else is going to attempt to use this value, clear it - bestPath[diagonalPath-1] = undefined; - } - - var canAdd = addPath && addPath.newPos+1 < newLen; - var canRemove = removePath && 0 <= oldPos && oldPos < oldLen; - if (!canAdd && !canRemove) { - bestPath[diagonalPath] = undefined; - continue; - } - - // Select the diagonal that we want to branch from. We select the prior - // path whose position in the new string is the farthest from the origin - // and does not pass the bounds of the diff graph - if (!canAdd || (canRemove && addPath.newPos < removePath.newPos)) { - basePath = clonePath(removePath); - this.pushComponent(basePath.components, oldString[oldPos], undefined, true); - } else { - basePath = clonePath(addPath); - basePath.newPos++; - this.pushComponent(basePath.components, newString[basePath.newPos], true, undefined); - } - - var oldPos = this.extractCommon(basePath, newString, oldString, diagonalPath); - - if (basePath.newPos+1 >= newLen && oldPos+1 >= oldLen) { - return basePath.components; - } else { - bestPath[diagonalPath] = basePath; - } - } - } - }, - - pushComponent: function(components, value, added, removed) { - var last = components[components.length-1]; - if (last && last.added === added && last.removed === removed) { - // We need to clone here as the component clone operation is just - // as shallow array clone - components[components.length-1] = - {value: this.join(last.value, value), added: added, removed: removed }; - } else { - components.push({value: value, added: added, removed: removed }); - } - }, - extractCommon: function(basePath, newString, oldString, diagonalPath) { - var newLen = newString.length, - oldLen = oldString.length, - newPos = basePath.newPos, - oldPos = newPos - diagonalPath; - while (newPos+1 < newLen && oldPos+1 < oldLen && this.equals(newString[newPos+1], oldString[oldPos+1])) { - newPos++; - oldPos++; - - this.pushComponent(basePath.components, newString[newPos], undefined, undefined); - } - basePath.newPos = newPos; - return oldPos; - }, - - equals: function(left, right) { - var reWhitespace = /\S/; - if (this.ignoreWhitespace && !reWhitespace.test(left) && !reWhitespace.test(right)) { - return true; - } else { - return left === right; - } - }, - join: function(left, right) { - return left + right; - }, - tokenize: function(value) { - return value; - } - }; - - var CharDiff = new Diff(); - - var WordDiff = new Diff(true); - var WordWithSpaceDiff = new Diff(); - WordDiff.tokenize = WordWithSpaceDiff.tokenize = function(value) { - return removeEmpty(value.split(/(\s+|\b)/)); - }; - - var CssDiff = new Diff(true); - CssDiff.tokenize = function(value) { - return removeEmpty(value.split(/([{}:;,]|\s+)/)); - }; - - var LineDiff = new Diff(); - LineDiff.tokenize = function(value) { - var retLines = [], - lines = value.split(/^/m); - - for(var i = 0; i < lines.length; i++) { - var line = lines[i], - lastLine = lines[i - 1]; - - // Merge lines that may contain windows new lines - if (line == '\n' && lastLine && lastLine[lastLine.length - 1] === '\r') { - retLines[retLines.length - 1] += '\n'; - } else if (line) { - retLines.push(line); - } - } - - return retLines; - }; - - return { - Diff: Diff, - - diffChars: function(oldStr, newStr) { return CharDiff.diff(oldStr, newStr); }, - diffWords: function(oldStr, newStr) { return WordDiff.diff(oldStr, newStr); }, - diffWordsWithSpace: function(oldStr, newStr) { return WordWithSpaceDiff.diff(oldStr, newStr); }, - diffLines: function(oldStr, newStr) { return LineDiff.diff(oldStr, newStr); }, - - diffCss: function(oldStr, newStr) { return CssDiff.diff(oldStr, newStr); }, - - createPatch: function(fileName, oldStr, newStr, oldHeader, newHeader) { - var ret = []; - - ret.push('Index: ' + fileName); - ret.push('==================================================================='); - ret.push('--- ' + fileName + (typeof oldHeader === 'undefined' ? '' : '\t' + oldHeader)); - ret.push('+++ ' + fileName + (typeof newHeader === 'undefined' ? '' : '\t' + newHeader)); - - var diff = LineDiff.diff(oldStr, newStr); - if (!diff[diff.length-1].value) { - diff.pop(); // Remove trailing newline add - } - diff.push({value: '', lines: []}); // Append an empty value to make cleanup easier - - function contextLines(lines) { - return lines.map(function(entry) { return ' ' + entry; }); - } - function eofNL(curRange, i, current) { - var last = diff[diff.length-2], - isLast = i === diff.length-2, - isLastOfType = i === diff.length-3 && (current.added !== last.added || current.removed !== last.removed); - - // Figure out if this is the last line for the given file and missing NL - if (!/\n$/.test(current.value) && (isLast || isLastOfType)) { - curRange.push('\\ No newline at end of file'); - } - } - - var oldRangeStart = 0, newRangeStart = 0, curRange = [], - oldLine = 1, newLine = 1; - for (var i = 0; i < diff.length; i++) { - var current = diff[i], - lines = current.lines || current.value.replace(/\n$/, '').split('\n'); - current.lines = lines; - - if (current.added || current.removed) { - if (!oldRangeStart) { - var prev = diff[i-1]; - oldRangeStart = oldLine; - newRangeStart = newLine; - - if (prev) { - curRange = contextLines(prev.lines.slice(-4)); - oldRangeStart -= curRange.length; - newRangeStart -= curRange.length; - } - } - curRange.push.apply(curRange, lines.map(function(entry) { return (current.added?'+':'-') + entry; })); - eofNL(curRange, i, current); - - if (current.added) { - newLine += lines.length; - } else { - oldLine += lines.length; - } - } else { - if (oldRangeStart) { - // Close out any changes that have been output (or join overlapping) - if (lines.length <= 8 && i < diff.length-2) { - // Overlapping - curRange.push.apply(curRange, contextLines(lines)); - } else { - // end the range and output - var contextSize = Math.min(lines.length, 4); - ret.push( - '@@ -' + oldRangeStart + ',' + (oldLine-oldRangeStart+contextSize) - + ' +' + newRangeStart + ',' + (newLine-newRangeStart+contextSize) - + ' @@'); - ret.push.apply(ret, curRange); - ret.push.apply(ret, contextLines(lines.slice(0, contextSize))); - if (lines.length <= 4) { - eofNL(ret, i, current); - } - - oldRangeStart = 0; newRangeStart = 0; curRange = []; - } - } - oldLine += lines.length; - newLine += lines.length; - } - } - - return ret.join('\n') + '\n'; - }, - - applyPatch: function(oldStr, uniDiff) { - var diffstr = uniDiff.split('\n'); - var diff = []; - var remEOFNL = false, - addEOFNL = false; - - for (var i = (diffstr[0][0]==='I'?4:0); i < diffstr.length; i++) { - if(diffstr[i][0] === '@') { - var meh = diffstr[i].split(/@@ -(\d+),(\d+) \+(\d+),(\d+) @@/); - diff.unshift({ - start:meh[3], - oldlength:meh[2], - oldlines:[], - newlength:meh[4], - newlines:[] - }); - } else if(diffstr[i][0] === '+') { - diff[0].newlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === '-') { - diff[0].oldlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === ' ') { - diff[0].newlines.push(diffstr[i].substr(1)); - diff[0].oldlines.push(diffstr[i].substr(1)); - } else if(diffstr[i][0] === '\\') { - if (diffstr[i-1][0] === '+') { - remEOFNL = true; - } else if(diffstr[i-1][0] === '-') { - addEOFNL = true; - } - } - } - - var str = oldStr.split('\n'); - for (var i = diff.length - 1; i >= 0; i--) { - var d = diff[i]; - for (var j = 0; j < d.oldlength; j++) { - if(str[d.start-1+j] !== d.oldlines[j]) { - return false; - } - } - Array.prototype.splice.apply(str,[d.start-1,+d.oldlength].concat(d.newlines)); - } - - if (remEOFNL) { - while (!str[str.length-1]) { - str.pop(); - } - } else if (addEOFNL) { - str.push(''); - } - return str.join('\n'); - }, - - convertChangesToXML: function(changes){ - var ret = []; - for ( var i = 0; i < changes.length; i++) { - var change = changes[i]; - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - - ret.push(escapeHTML(change.value)); - - if (change.added) { - ret.push(''); - } else if (change.removed) { - ret.push(''); - } - } - return ret.join(''); - }, - - // See: http://code.google.com/p/google-diff-match-patch/wiki/API - convertChangesToDMP: function(changes){ - var ret = [], change; - for ( var i = 0; i < changes.length; i++) { - change = changes[i]; - ret.push([(change.added ? 1 : change.removed ? -1 : 0), change.value]); - } - return ret; - } - }; -})(); - -if (typeof module !== 'undefined') { - module.exports = JsDiff; -} - -}); // module: browser/diff.js - -require.register("browser/escape-string-regexp.js", function(module, exports, require){ -'use strict'; - -var matchOperatorsRe = /[|\\{}()[\]^$+*?.]/g; - -module.exports = function (str) { - if (typeof str !== 'string') { - throw new TypeError('Expected a string'); - } - - return str.replace(matchOperatorsRe, '\\$&'); -}; - -}); // module: browser/escape-string-regexp.js - -require.register("browser/events.js", function(module, exports, require){ - -/** - * Module exports. - */ - -exports.EventEmitter = EventEmitter; - -/** - * Check if `obj` is an array. - */ - -function isArray(obj) { - return '[object Array]' == {}.toString.call(obj); -} - -/** - * Event emitter constructor. - * - * @api public - */ - -function EventEmitter(){}; - -/** - * Adds a listener. - * - * @api public - */ - -EventEmitter.prototype.on = function (name, fn) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = fn; - } else if (isArray(this.$events[name])) { - this.$events[name].push(fn); - } else { - this.$events[name] = [this.$events[name], fn]; - } - - return this; -}; - -EventEmitter.prototype.addListener = EventEmitter.prototype.on; - -/** - * Adds a volatile listener. - * - * @api public - */ - -EventEmitter.prototype.once = function (name, fn) { - var self = this; - - function on () { - self.removeListener(name, on); - fn.apply(this, arguments); - }; - - on.listener = fn; - this.on(name, on); - - return this; -}; - -/** - * Removes a listener. - * - * @api public - */ - -EventEmitter.prototype.removeListener = function (name, fn) { - if (this.$events && this.$events[name]) { - var list = this.$events[name]; - - if (isArray(list)) { - var pos = -1; - - for (var i = 0, l = list.length; i < l; i++) { - if (list[i] === fn || (list[i].listener && list[i].listener === fn)) { - pos = i; - break; - } - } - - if (pos < 0) { - return this; - } - - list.splice(pos, 1); - - if (!list.length) { - delete this.$events[name]; - } - } else if (list === fn || (list.listener && list.listener === fn)) { - delete this.$events[name]; - } - } - - return this; -}; - -/** - * Removes all listeners for an event. - * - * @api public - */ - -EventEmitter.prototype.removeAllListeners = function (name) { - if (name === undefined) { - this.$events = {}; - return this; - } - - if (this.$events && this.$events[name]) { - this.$events[name] = null; - } - - return this; -}; - -/** - * Gets all listeners for a certain event. - * - * @api public - */ - -EventEmitter.prototype.listeners = function (name) { - if (!this.$events) { - this.$events = {}; - } - - if (!this.$events[name]) { - this.$events[name] = []; - } - - if (!isArray(this.$events[name])) { - this.$events[name] = [this.$events[name]]; - } - - return this.$events[name]; -}; - -/** - * Emits an event. - * - * @api public - */ - -EventEmitter.prototype.emit = function (name) { - if (!this.$events) { - return false; - } - - var handler = this.$events[name]; - - if (!handler) { - return false; - } - - var args = [].slice.call(arguments, 1); - - if ('function' == typeof handler) { - handler.apply(this, args); - } else if (isArray(handler)) { - var listeners = handler.slice(); - - for (var i = 0, l = listeners.length; i < l; i++) { - listeners[i].apply(this, args); - } - } else { - return false; - } - - return true; -}; -}); // module: browser/events.js - -require.register("browser/fs.js", function(module, exports, require){ - -}); // module: browser/fs.js - -require.register("browser/glob.js", function(module, exports, require){ - -}); // module: browser/glob.js - -require.register("browser/path.js", function(module, exports, require){ - -}); // module: browser/path.js - -require.register("browser/progress.js", function(module, exports, require){ -/** - * Expose `Progress`. - */ - -module.exports = Progress; - -/** - * Initialize a new `Progress` indicator. - */ - -function Progress() { - this.percent = 0; - this.size(0); - this.fontSize(11); - this.font('helvetica, arial, sans-serif'); -} - -/** - * Set progress size to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.size = function(n){ - this._size = n; - return this; -}; - -/** - * Set text to `str`. - * - * @param {String} str - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.text = function(str){ - this._text = str; - return this; -}; - -/** - * Set font size to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - * @api public - */ - -Progress.prototype.fontSize = function(n){ - this._fontSize = n; - return this; -}; - -/** - * Set font `family`. - * - * @param {String} family - * @return {Progress} for chaining - */ - -Progress.prototype.font = function(family){ - this._font = family; - return this; -}; - -/** - * Update percentage to `n`. - * - * @param {Number} n - * @return {Progress} for chaining - */ - -Progress.prototype.update = function(n){ - this.percent = n; - return this; -}; - -/** - * Draw on `ctx`. - * - * @param {CanvasRenderingContext2d} ctx - * @return {Progress} for chaining - */ - -Progress.prototype.draw = function(ctx){ - try { - var percent = Math.min(this.percent, 100) - , size = this._size - , half = size / 2 - , x = half - , y = half - , rad = half - 1 - , fontSize = this._fontSize; - - ctx.font = fontSize + 'px ' + this._font; - - var angle = Math.PI * 2 * (percent / 100); - ctx.clearRect(0, 0, size, size); - - // outer circle - ctx.strokeStyle = '#9f9f9f'; - ctx.beginPath(); - ctx.arc(x, y, rad, 0, angle, false); - ctx.stroke(); - - // inner circle - ctx.strokeStyle = '#eee'; - ctx.beginPath(); - ctx.arc(x, y, rad - 1, 0, angle, true); - ctx.stroke(); - - // text - var text = this._text || (percent | 0) + '%' - , w = ctx.measureText(text).width; - - ctx.fillText( - text - , x - w / 2 + 1 - , y + fontSize / 2 - 1); - } catch (ex) {} //don't fail if we can't render progress - return this; -}; - -}); // module: browser/progress.js - -require.register("browser/tty.js", function(module, exports, require){ - -exports.isatty = function(){ - return true; -}; - -exports.getWindowSize = function(){ - if ('innerHeight' in global) { - return [global.innerHeight, global.innerWidth]; - } else { - // In a Web Worker, the DOM Window is not available. - return [640, 480]; - } -}; - -}); // module: browser/tty.js - -require.register("context.js", function(module, exports, require){ - -/** - * Expose `Context`. - */ - -module.exports = Context; - -/** - * Initialize a new `Context`. - * - * @api private - */ - -function Context(){} - -/** - * Set or get the context `Runnable` to `runnable`. - * - * @param {Runnable} runnable - * @return {Context} - * @api private - */ - -Context.prototype.runnable = function(runnable){ - if (0 == arguments.length) return this._runnable; - this.test = this._runnable = runnable; - return this; -}; - -/** - * Set test timeout `ms`. - * - * @param {Number} ms - * @return {Context} self - * @api private - */ - -Context.prototype.timeout = function(ms){ - if (arguments.length === 0) return this.runnable().timeout(); - this.runnable().timeout(ms); - return this; -}; - -/** - * Set test timeout `enabled`. - * - * @param {Boolean} enabled - * @return {Context} self - * @api private - */ - -Context.prototype.enableTimeouts = function (enabled) { - this.runnable().enableTimeouts(enabled); - return this; -}; - - -/** - * Set test slowness threshold `ms`. - * - * @param {Number} ms - * @return {Context} self - * @api private - */ - -Context.prototype.slow = function(ms){ - this.runnable().slow(ms); - return this; -}; - -/** - * Inspect the context void of `._runnable`. - * - * @return {String} - * @api private - */ - -Context.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_runnable' == key) return; - if ('test' == key) return; - return val; - }, 2); -}; - -}); // module: context.js - -require.register("hook.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); - -/** - * Expose `Hook`. - */ - -module.exports = Hook; - -/** - * Initialize a new `Hook` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Hook(title, fn) { - Runnable.call(this, title, fn); - this.type = 'hook'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -function F(){}; -F.prototype = Runnable.prototype; -Hook.prototype = new F; -Hook.prototype.constructor = Hook; - - -/** - * Get or set the test `err`. - * - * @param {Error} err - * @return {Error} - * @api public - */ - -Hook.prototype.error = function(err){ - if (0 == arguments.length) { - var err = this._error; - this._error = null; - return err; - } - - this._error = err; -}; - -}); // module: hook.js - -require.register("interfaces/bdd.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test') - , utils = require('../utils') - , escapeRe = require('browser/escape-string-regexp'); - -/** - * BDD-style interface: - * - * describe('Array', function(){ - * describe('#indexOf()', function(){ - * it('should return -1 when not present', function(){ - * - * }); - * - * it('should return the index when present', function(){ - * - * }); - * }); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Describe a "suite" with the given `title` - * and callback `fn` containing nested suites - * and/or tests. - */ - - context.describe = context.context = function(title, fn){ - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; - - /** - * Pending describe. - */ - - context.xdescribe = - context.xcontext = - context.describe.skip = function(title, fn){ - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** - * Exclusive suite. - */ - - context.describe.only = function(title, fn){ - var suite = context.describe(title, fn); - mocha.grep(suite.fullTitle()); - return suite; - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.it = context.specify = function(title, fn){ - var suite = suites[0]; - if (suite.pending) fn = null; - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.it.only = function(title, fn){ - var test = context.it(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - return test; - }; - - /** - * Pending test case. - */ - - context.xit = - context.xspecify = - context.it.skip = function(title){ - context.it(title); - }; - }); -}; - -}); // module: interfaces/bdd.js - -require.register("interfaces/exports.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test'); - -/** - * TDD-style interface: - * - * exports.Array = { - * '#indexOf()': { - * 'should return -1 when the value is not present': function(){ - * - * }, - * - * 'should return the correct index when the value is present': function(){ - * - * } - * } - * }; - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('require', visit); - - function visit(obj, file) { - var suite; - for (var key in obj) { - if ('function' == typeof obj[key]) { - var fn = obj[key]; - switch (key) { - case 'before': - suites[0].beforeAll(fn); - break; - case 'after': - suites[0].afterAll(fn); - break; - case 'beforeEach': - suites[0].beforeEach(fn); - break; - case 'afterEach': - suites[0].afterEach(fn); - break; - default: - var test = new Test(key, fn); - test.file = file; - suites[0].addTest(test); - } - } else { - suite = Suite.create(suites[0], key); - suites.unshift(suite); - visit(obj[key]); - suites.shift(); - } - } - } -}; - -}); // module: interfaces/exports.js - -require.register("interfaces/index.js", function(module, exports, require){ - -exports.bdd = require('./bdd'); -exports.tdd = require('./tdd'); -exports.qunit = require('./qunit'); -exports.exports = require('./exports'); - -}); // module: interfaces/index.js - -require.register("interfaces/qunit.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test') - , escapeRe = require('browser/escape-string-regexp') - , utils = require('../utils'); - -/** - * QUnit-style interface: - * - * suite('Array'); - * - * test('#length', function(){ - * var arr = [1,2,3]; - * ok(arr.length == 3); - * }); - * - * test('#indexOf()', function(){ - * var arr = [1,2,3]; - * ok(arr.indexOf(1) == 0); - * ok(arr.indexOf(2) == 1); - * ok(arr.indexOf(3) == 2); - * }); - * - * suite('String'); - * - * test('#length', function(){ - * ok('foo'.length == 3); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before running tests. - */ - - context.before = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after running tests. - */ - - context.after = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Execute before each test case. - */ - - context.beforeEach = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.afterEach = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Describe a "suite" with the given `title`. - */ - - context.suite = function(title){ - if (suites.length > 1) suites.shift(); - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - return suite; - }; - - /** - * Exclusive test-case. - */ - - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn){ - var test = new Test(title, fn); - test.file = file; - suites[0].addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - /** - * Pending test case. - */ - - context.test.skip = function(title){ - context.test(title); - }; - }); -}; - -}); // module: interfaces/qunit.js - -require.register("interfaces/tdd.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Suite = require('../suite') - , Test = require('../test') - , escapeRe = require('browser/escape-string-regexp') - , utils = require('../utils'); - -/** - * TDD-style interface: - * - * suite('Array', function(){ - * suite('#indexOf()', function(){ - * suiteSetup(function(){ - * - * }); - * - * test('should return -1 when not present', function(){ - * - * }); - * - * test('should return the index when present', function(){ - * - * }); - * - * suiteTeardown(function(){ - * - * }); - * }); - * }); - * - */ - -module.exports = function(suite){ - var suites = [suite]; - - suite.on('pre-require', function(context, file, mocha){ - - /** - * Execute before each test case. - */ - - context.setup = function(name, fn){ - suites[0].beforeEach(name, fn); - }; - - /** - * Execute after each test case. - */ - - context.teardown = function(name, fn){ - suites[0].afterEach(name, fn); - }; - - /** - * Execute before the suite. - */ - - context.suiteSetup = function(name, fn){ - suites[0].beforeAll(name, fn); - }; - - /** - * Execute after the suite. - */ - - context.suiteTeardown = function(name, fn){ - suites[0].afterAll(name, fn); - }; - - /** - * Describe a "suite" with the given `title` - * and callback `fn` containing nested suites - * and/or tests. - */ - - context.suite = function(title, fn){ - var suite = Suite.create(suites[0], title); - suite.file = file; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - return suite; - }; - - /** - * Pending suite. - */ - context.suite.skip = function(title, fn) { - var suite = Suite.create(suites[0], title); - suite.pending = true; - suites.unshift(suite); - fn.call(suite); - suites.shift(); - }; - - /** - * Exclusive test-case. - */ - - context.suite.only = function(title, fn){ - var suite = context.suite(title, fn); - mocha.grep(suite.fullTitle()); - }; - - /** - * Describe a specification or test-case - * with the given `title` and callback `fn` - * acting as a thunk. - */ - - context.test = function(title, fn){ - var suite = suites[0]; - if (suite.pending) fn = null; - var test = new Test(title, fn); - test.file = file; - suite.addTest(test); - return test; - }; - - /** - * Exclusive test-case. - */ - - context.test.only = function(title, fn){ - var test = context.test(title, fn); - var reString = '^' + escapeRe(test.fullTitle()) + '$'; - mocha.grep(new RegExp(reString)); - }; - - /** - * Pending test case. - */ - - context.test.skip = function(title){ - context.test(title); - }; - }); -}; - -}); // module: interfaces/tdd.js - -require.register("mocha.js", function(module, exports, require){ -/*! - * mocha - * Copyright(c) 2011 TJ Holowaychuk - * MIT Licensed - */ - -/** - * Module dependencies. - */ - -var path = require('browser/path') - , escapeRe = require('browser/escape-string-regexp') - , utils = require('./utils'); - -/** - * Expose `Mocha`. - */ - -exports = module.exports = Mocha; - -/** - * To require local UIs and reporters when running in node. - */ - -if (typeof process !== 'undefined' && typeof process.cwd === 'function') { - var join = path.join - , cwd = process.cwd(); - module.paths.push(cwd, join(cwd, 'node_modules')); -} - -/** - * Expose internals. - */ - -exports.utils = utils; -exports.interfaces = require('./interfaces'); -exports.reporters = require('./reporters'); -exports.Runnable = require('./runnable'); -exports.Context = require('./context'); -exports.Runner = require('./runner'); -exports.Suite = require('./suite'); -exports.Hook = require('./hook'); -exports.Test = require('./test'); - -/** - * Return image `name` path. - * - * @param {String} name - * @return {String} - * @api private - */ - -function image(name) { - return __dirname + '/../images/' + name + '.png'; -} - -/** - * Setup mocha with `options`. - * - * Options: - * - * - `ui` name "bdd", "tdd", "exports" etc - * - `reporter` reporter instance, defaults to `mocha.reporters.spec` - * - `globals` array of accepted globals - * - `timeout` timeout in milliseconds - * - `bail` bail on the first test failure - * - `slow` milliseconds to wait before considering a test slow - * - `ignoreLeaks` ignore global leaks - * - `grep` string or regexp to filter tests with - * - * @param {Object} options - * @api public - */ - -function Mocha(options) { - options = options || {}; - this.files = []; - this.options = options; - this.grep(options.grep); - this.suite = new exports.Suite('', new exports.Context); - this.ui(options.ui); - this.bail(options.bail); - this.reporter(options.reporter); - if (null != options.timeout) this.timeout(options.timeout); - this.useColors(options.useColors) - if (options.enableTimeouts !== null) this.enableTimeouts(options.enableTimeouts); - if (options.slow) this.slow(options.slow); - - this.suite.on('pre-require', function (context) { - exports.afterEach = context.afterEach || context.teardown; - exports.after = context.after || context.suiteTeardown; - exports.beforeEach = context.beforeEach || context.setup; - exports.before = context.before || context.suiteSetup; - exports.describe = context.describe || context.suite; - exports.it = context.it || context.test; - exports.setup = context.setup || context.beforeEach; - exports.suiteSetup = context.suiteSetup || context.before; - exports.suiteTeardown = context.suiteTeardown || context.after; - exports.suite = context.suite || context.describe; - exports.teardown = context.teardown || context.afterEach; - exports.test = context.test || context.it; - }); -} - -/** - * Enable or disable bailing on the first failure. - * - * @param {Boolean} [bail] - * @api public - */ - -Mocha.prototype.bail = function(bail){ - if (0 == arguments.length) bail = true; - this.suite.bail(bail); - return this; -}; - -/** - * Add test `file`. - * - * @param {String} file - * @api public - */ - -Mocha.prototype.addFile = function(file){ - this.files.push(file); - return this; -}; - -/** - * Set reporter to `reporter`, defaults to "spec". - * - * @param {String|Function} reporter name or constructor - * @api public - */ - -Mocha.prototype.reporter = function(reporter){ - if ('function' == typeof reporter) { - this._reporter = reporter; - } else { - reporter = reporter || 'spec'; - var _reporter; - try { _reporter = require('./reporters/' + reporter); } catch (err) {}; - if (!_reporter) try { _reporter = require(reporter); } catch (err) {}; - if (!_reporter && reporter === 'teamcity') - console.warn('The Teamcity reporter was moved to a package named ' + - 'mocha-teamcity-reporter ' + - '(https://npmjs.org/package/mocha-teamcity-reporter).'); - if (!_reporter) throw new Error('invalid reporter "' + reporter + '"'); - this._reporter = _reporter; - } - return this; -}; - -/** - * Set test UI `name`, defaults to "bdd". - * - * @param {String} bdd - * @api public - */ - -Mocha.prototype.ui = function(name){ - name = name || 'bdd'; - this._ui = exports.interfaces[name]; - if (!this._ui) try { this._ui = require(name); } catch (err) {}; - if (!this._ui) throw new Error('invalid interface "' + name + '"'); - this._ui = this._ui(this.suite); - return this; -}; - -/** - * Load registered files. - * - * @api private - */ - -Mocha.prototype.loadFiles = function(fn){ - var self = this; - var suite = this.suite; - var pending = this.files.length; - this.files.forEach(function(file){ - file = path.resolve(file); - suite.emit('pre-require', global, file, self); - suite.emit('require', require(file), file, self); - suite.emit('post-require', global, file, self); - --pending || (fn && fn()); - }); -}; - -/** - * Enable growl support. - * - * @api private - */ - -Mocha.prototype._growl = function(runner, reporter) { - var notify = require('growl'); - - runner.on('end', function(){ - var stats = reporter.stats; - if (stats.failures) { - var msg = stats.failures + ' of ' + runner.total + ' tests failed'; - notify(msg, { name: 'mocha', title: 'Failed', image: image('error') }); - } else { - notify(stats.passes + ' tests passed in ' + stats.duration + 'ms', { - name: 'mocha' - , title: 'Passed' - , image: image('ok') - }); - } - }); -}; - -/** - * Add regexp to grep, if `re` is a string it is escaped. - * - * @param {RegExp|String} re - * @return {Mocha} - * @api public - */ - -Mocha.prototype.grep = function(re){ - this.options.grep = 'string' == typeof re - ? new RegExp(escapeRe(re)) - : re; - return this; -}; - -/** - * Invert `.grep()` matches. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.invert = function(){ - this.options.invert = true; - return this; -}; - -/** - * Ignore global leaks. - * - * @param {Boolean} ignore - * @return {Mocha} - * @api public - */ - -Mocha.prototype.ignoreLeaks = function(ignore){ - this.options.ignoreLeaks = !!ignore; - return this; -}; - -/** - * Enable global leak checking. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.checkLeaks = function(){ - this.options.ignoreLeaks = false; - return this; -}; - -/** - * Enable growl support. - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.growl = function(){ - this.options.growl = true; - return this; -}; - -/** - * Ignore `globals` array or string. - * - * @param {Array|String} globals - * @return {Mocha} - * @api public - */ - -Mocha.prototype.globals = function(globals){ - this.options.globals = (this.options.globals || []).concat(globals); - return this; -}; - -/** - * Emit color output. - * - * @param {Boolean} colors - * @return {Mocha} - * @api public - */ - -Mocha.prototype.useColors = function(colors){ - this.options.useColors = arguments.length && colors != undefined - ? colors - : true; - return this; -}; - -/** - * Use inline diffs rather than +/-. - * - * @param {Boolean} inlineDiffs - * @return {Mocha} - * @api public - */ - -Mocha.prototype.useInlineDiffs = function(inlineDiffs) { - this.options.useInlineDiffs = arguments.length && inlineDiffs != undefined - ? inlineDiffs - : false; - return this; -}; - -/** - * Set the timeout in milliseconds. - * - * @param {Number} timeout - * @return {Mocha} - * @api public - */ - -Mocha.prototype.timeout = function(timeout){ - this.suite.timeout(timeout); - return this; -}; - -/** - * Set slowness threshold in milliseconds. - * - * @param {Number} slow - * @return {Mocha} - * @api public - */ - -Mocha.prototype.slow = function(slow){ - this.suite.slow(slow); - return this; -}; - -/** - * Enable timeouts. - * - * @param {Boolean} enabled - * @return {Mocha} - * @api public - */ - -Mocha.prototype.enableTimeouts = function(enabled) { - this.suite.enableTimeouts(arguments.length && enabled !== undefined - ? enabled - : true); - return this -}; - -/** - * Makes all tests async (accepting a callback) - * - * @return {Mocha} - * @api public - */ - -Mocha.prototype.asyncOnly = function(){ - this.options.asyncOnly = true; - return this; -}; - -/** - * Disable syntax highlighting (in browser). - * @returns {Mocha} - * @api public - */ -Mocha.prototype.noHighlighting = function() { - this.options.noHighlighting = true; - return this; -}; - -/** - * Run tests and invoke `fn()` when complete. - * - * @param {Function} fn - * @return {Runner} - * @api public - */ - -Mocha.prototype.run = function(fn){ - if (this.files.length) this.loadFiles(); - var suite = this.suite; - var options = this.options; - options.files = this.files; - var runner = new exports.Runner(suite); - var reporter = new this._reporter(runner, options); - runner.ignoreLeaks = false !== options.ignoreLeaks; - runner.asyncOnly = options.asyncOnly; - if (options.grep) runner.grep(options.grep, options.invert); - if (options.globals) runner.globals(options.globals); - if (options.growl) this._growl(runner, reporter); - exports.reporters.Base.useColors = options.useColors; - exports.reporters.Base.inlineDiffs = options.useInlineDiffs; - return runner.run(fn); -}; - -}); // module: mocha.js - -require.register("ms.js", function(module, exports, require){ -/** - * 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'] ? longFormat(val) : shortFormat(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 shortFormat(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 longFormat(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'; -} - -}); // module: ms.js - -require.register("reporters/base.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var tty = require('browser/tty') - , diff = require('browser/diff') - , ms = require('../ms') - , utils = require('../utils'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Check if both stdio streams are associated with a tty. - */ - -var isatty = tty.isatty(1) && tty.isatty(2); - -/** - * Expose `Base`. - */ - -exports = module.exports = Base; - -/** - * Enable coloring by default. - */ - -exports.useColors = isatty || (process.env.MOCHA_COLORS !== undefined); - -/** - * Inline diffs instead of +/- - */ - -exports.inlineDiffs = false; - -/** - * Default color map. - */ - -exports.colors = { - 'pass': 90 - , 'fail': 31 - , 'bright pass': 92 - , 'bright fail': 91 - , 'bright yellow': 93 - , 'pending': 36 - , 'suite': 0 - , 'error title': 0 - , 'error message': 31 - , 'error stack': 90 - , 'checkmark': 32 - , 'fast': 90 - , 'medium': 33 - , 'slow': 31 - , 'green': 32 - , 'light': 90 - , 'diff gutter': 90 - , 'diff added': 42 - , 'diff removed': 41 -}; - -/** - * Default symbol map. - */ - -exports.symbols = { - ok: '✓', - err: '✖', - dot: '․' -}; - -// With node.js on Windows: use symbols available in terminal default fonts -if ('win32' == process.platform) { - exports.symbols.ok = '\u221A'; - exports.symbols.err = '\u00D7'; - exports.symbols.dot = '.'; -} - -/** - * Color `str` with the given `type`, - * allowing colors to be disabled, - * as well as user-defined color - * schemes. - * - * @param {String} type - * @param {String} str - * @return {String} - * @api private - */ - -var color = exports.color = function(type, str) { - if (!exports.useColors) return str; - return '\u001b[' + exports.colors[type] + 'm' + str + '\u001b[0m'; -}; - -/** - * Expose term window size, with some - * defaults for when stderr is not a tty. - */ - -exports.window = { - width: isatty - ? process.stdout.getWindowSize - ? process.stdout.getWindowSize(1)[0] - : tty.getWindowSize()[1] - : 75 -}; - -/** - * Expose some basic cursor interactions - * that are common among reporters. - */ - -exports.cursor = { - hide: function(){ - isatty && process.stdout.write('\u001b[?25l'); - }, - - show: function(){ - isatty && process.stdout.write('\u001b[?25h'); - }, - - deleteLine: function(){ - isatty && process.stdout.write('\u001b[2K'); - }, - - beginningOfLine: function(){ - isatty && process.stdout.write('\u001b[0G'); - }, - - CR: function(){ - if (isatty) { - exports.cursor.deleteLine(); - exports.cursor.beginningOfLine(); - } else { - process.stdout.write('\r'); - } - } -}; - -/** - * Outut the given `failures` as a list. - * - * @param {Array} failures - * @api public - */ - -exports.list = function(failures){ - console.error(); - failures.forEach(function(test, i){ - // format - var fmt = color('error title', ' %s) %s:\n') - + color('error message', ' %s') - + color('error stack', '\n%s\n'); - - // msg - var err = test.err - , message = err.message || '' - , stack = err.stack || message - , index = stack.indexOf(message) + message.length - , msg = stack.slice(0, index) - , actual = err.actual - , expected = err.expected - , escape = true; - - // uncaught - if (err.uncaught) { - msg = 'Uncaught ' + msg; - } - - // explicitly show diff - if (err.showDiff && sameType(actual, expected)) { - escape = false; - err.actual = actual = utils.stringify(actual); - err.expected = expected = utils.stringify(expected); - } - - // actual / expected diff - if (err.showDiff && 'string' == typeof actual && 'string' == typeof expected) { - fmt = color('error title', ' %s) %s:\n%s') + color('error stack', '\n%s\n'); - var match = message.match(/^([^:]+): expected/); - msg = '\n ' + color('error message', match ? match[1] : msg); - - if (exports.inlineDiffs) { - msg += inlineDiff(err, escape); - } else { - msg += unifiedDiff(err, escape); - } - } - - // indent stack trace without msg - stack = stack.slice(index ? index + 1 : index) - .replace(/^/gm, ' '); - - console.error(fmt, (i + 1), test.fullTitle(), msg, stack); - }); -}; - -/** - * Initialize a new `Base` reporter. - * - * All other reporters generally - * inherit from this reporter, providing - * stats such as test duration, number - * of tests passed / failed etc. - * - * @param {Runner} runner - * @api public - */ - -function Base(runner) { - var self = this - , stats = this.stats = { suites: 0, tests: 0, passes: 0, pending: 0, failures: 0 } - , failures = this.failures = []; - - if (!runner) return; - this.runner = runner; - - runner.stats = stats; - - runner.on('start', function(){ - stats.start = new Date; - }); - - runner.on('suite', function(suite){ - stats.suites = stats.suites || 0; - suite.root || stats.suites++; - }); - - runner.on('test end', function(test){ - stats.tests = stats.tests || 0; - stats.tests++; - }); - - runner.on('pass', function(test){ - stats.passes = stats.passes || 0; - - var medium = test.slow() / 2; - test.speed = test.duration > test.slow() - ? 'slow' - : test.duration > medium - ? 'medium' - : 'fast'; - - stats.passes++; - }); - - runner.on('fail', function(test, err){ - stats.failures = stats.failures || 0; - stats.failures++; - test.err = err; - failures.push(test); - }); - - runner.on('end', function(){ - stats.end = new Date; - stats.duration = new Date - stats.start; - }); - - runner.on('pending', function(){ - stats.pending++; - }); -} - -/** - * Output common epilogue used by many of - * the bundled reporters. - * - * @api public - */ - -Base.prototype.epilogue = function(){ - var stats = this.stats; - var tests; - var fmt; - - console.log(); - - // passes - fmt = color('bright pass', ' ') - + color('green', ' %d passing') - + color('light', ' (%s)'); - - console.log(fmt, - stats.passes || 0, - ms(stats.duration)); - - // pending - if (stats.pending) { - fmt = color('pending', ' ') - + color('pending', ' %d pending'); - - console.log(fmt, stats.pending); - } - - // failures - if (stats.failures) { - fmt = color('fail', ' %d failing'); - - console.error(fmt, - stats.failures); - - Base.list(this.failures); - console.error(); - } - - console.log(); -}; - -/** - * Pad the given `str` to `len`. - * - * @param {String} str - * @param {String} len - * @return {String} - * @api private - */ - -function pad(str, len) { - str = String(str); - return Array(len - str.length + 1).join(' ') + str; -} - - -/** - * Returns an inline diff between 2 strings with coloured ANSI output - * - * @param {Error} Error with actual/expected - * @return {String} Diff - * @api private - */ - -function inlineDiff(err, escape) { - var msg = errorDiff(err, 'WordsWithSpace', escape); - - // linenos - var lines = msg.split('\n'); - if (lines.length > 4) { - var width = String(lines.length).length; - msg = lines.map(function(str, i){ - return pad(++i, width) + ' |' + ' ' + str; - }).join('\n'); - } - - // legend - msg = '\n' - + color('diff removed', 'actual') - + ' ' - + color('diff added', 'expected') - + '\n\n' - + msg - + '\n'; - - // indent - msg = msg.replace(/^/gm, ' '); - return msg; -} - -/** - * Returns a unified diff between 2 strings - * - * @param {Error} Error with actual/expected - * @return {String} Diff - * @api private - */ - -function unifiedDiff(err, escape) { - var indent = ' '; - function cleanUp(line) { - if (escape) { - line = escapeInvisibles(line); - } - if (line[0] === '+') return indent + colorLines('diff added', line); - if (line[0] === '-') return indent + colorLines('diff removed', line); - if (line.match(/\@\@/)) return null; - if (line.match(/\\ No newline/)) return null; - else return indent + line; - } - function notBlank(line) { - return line != null; - } - msg = diff.createPatch('string', err.actual, err.expected); - var lines = msg.split('\n').splice(4); - return '\n ' - + colorLines('diff added', '+ expected') + ' ' - + colorLines('diff removed', '- actual') - + '\n\n' - + lines.map(cleanUp).filter(notBlank).join('\n'); -} - -/** - * Return a character diff for `err`. - * - * @param {Error} err - * @return {String} - * @api private - */ - -function errorDiff(err, type, escape) { - var actual = escape ? escapeInvisibles(err.actual) : err.actual; - var expected = escape ? escapeInvisibles(err.expected) : err.expected; - return diff['diff' + type](actual, expected).map(function(str){ - if (str.added) return colorLines('diff added', str.value); - if (str.removed) return colorLines('diff removed', str.value); - return str.value; - }).join(''); -} - -/** - * Returns a string with all invisible characters in plain text - * - * @param {String} line - * @return {String} - * @api private - */ -function escapeInvisibles(line) { - return line.replace(/\t/g, '') - .replace(/\r/g, '') - .replace(/\n/g, '\n'); -} - -/** - * Color lines for `str`, using the color `name`. - * - * @param {String} name - * @param {String} str - * @return {String} - * @api private - */ - -function colorLines(name, str) { - return str.split('\n').map(function(str){ - return color(name, str); - }).join('\n'); -} - -/** - * Check that a / b have the same type. - * - * @param {Object} a - * @param {Object} b - * @return {Boolean} - * @api private - */ - -function sameType(a, b) { - a = Object.prototype.toString.call(a); - b = Object.prototype.toString.call(b); - return a == b; -} - -}); // module: reporters/base.js - -require.register("reporters/doc.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils'); - -/** - * Expose `Doc`. - */ - -exports = module.exports = Doc; - -/** - * Initialize a new `Doc` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Doc(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , indents = 2; - - function indent() { - return Array(indents).join(' '); - } - - runner.on('suite', function(suite){ - if (suite.root) return; - ++indents; - console.log('%s
      ', indent()); - ++indents; - console.log('%s

      %s

      ', indent(), utils.escape(suite.title)); - console.log('%s
      ', indent()); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - console.log('%s
      ', indent()); - --indents; - console.log('%s
      ', indent()); - --indents; - }); - - runner.on('pass', function(test){ - console.log('%s
      %s
      ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
      %s
      ', indent(), code); - }); - - runner.on('fail', function(test, err){ - console.log('%s
      %s
      ', indent(), utils.escape(test.title)); - var code = utils.escape(utils.clean(test.fn.toString())); - console.log('%s
      %s
      ', indent(), code); - console.log('%s
      %s
      ', indent(), utils.escape(err)); - }); -} - -}); // module: reporters/doc.js - -require.register("reporters/dot.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = Dot; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function Dot(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , n = -1; - - runner.on('start', function(){ - process.stdout.write('\n '); - }); - - runner.on('pending', function(test){ - if (++n % width == 0) process.stdout.write('\n '); - process.stdout.write(color('pending', Base.symbols.dot)); - }); - - runner.on('pass', function(test){ - if (++n % width == 0) process.stdout.write('\n '); - if ('slow' == test.speed) { - process.stdout.write(color('bright yellow', Base.symbols.dot)); - } else { - process.stdout.write(color(test.speed, Base.symbols.dot)); - } - }); - - runner.on('fail', function(test, err){ - if (++n % width == 0) process.stdout.write('\n '); - process.stdout.write(color('fail', Base.symbols.dot)); - }); - - runner.on('end', function(){ - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Dot.prototype = new F; -Dot.prototype.constructor = Dot; - - -}); // module: reporters/dot.js - -require.register("reporters/html-cov.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var JSONCov = require('./json-cov') - , fs = require('browser/fs'); - -/** - * Expose `HTMLCov`. - */ - -exports = module.exports = HTMLCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @param {Runner} runner - * @api public - */ - -function HTMLCov(runner) { - var jade = require('jade') - , file = __dirname + '/templates/coverage.jade' - , str = fs.readFileSync(file, 'utf8') - , fn = jade.compile(str, { filename: file }) - , self = this; - - JSONCov.call(this, runner, false); - - runner.on('end', function(){ - process.stdout.write(fn({ - cov: self.cov - , coverageClass: coverageClass - })); - }); -} - -/** - * Return coverage class for `n`. - * - * @return {String} - * @api private - */ - -function coverageClass(n) { - if (n >= 75) return 'high'; - if (n >= 50) return 'medium'; - if (n >= 25) return 'low'; - return 'terrible'; -} -}); // module: reporters/html-cov.js - -require.register("reporters/html.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils') - , Progress = require('../browser/progress') - , escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Expose `HTML`. - */ - -exports = module.exports = HTML; - -/** - * Stats template. - */ - -var statsTemplate = ''; - -/** - * Initialize a new `HTML` reporter. - * - * @param {Runner} runner - * @api public - */ - -function HTML(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total - , stat = fragment(statsTemplate) - , items = stat.getElementsByTagName('li') - , passes = items[1].getElementsByTagName('em')[0] - , passesLink = items[1].getElementsByTagName('a')[0] - , failures = items[2].getElementsByTagName('em')[0] - , failuresLink = items[2].getElementsByTagName('a')[0] - , duration = items[3].getElementsByTagName('em')[0] - , canvas = stat.getElementsByTagName('canvas')[0] - , report = fragment('
        ') - , stack = [report] - , progress - , ctx - , root = document.getElementById('mocha'); - - if (canvas.getContext) { - var ratio = window.devicePixelRatio || 1; - canvas.style.width = canvas.width; - canvas.style.height = canvas.height; - canvas.width *= ratio; - canvas.height *= ratio; - ctx = canvas.getContext('2d'); - ctx.scale(ratio, ratio); - progress = new Progress; - } - - if (!root) return error('#mocha div missing, add it to your document'); - - // pass toggle - on(passesLink, 'click', function(){ - unhide(); - var name = /pass/.test(report.className) ? '' : ' pass'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) hideSuitesWithout('test pass'); - }); - - // failure toggle - on(failuresLink, 'click', function(){ - unhide(); - var name = /fail/.test(report.className) ? '' : ' fail'; - report.className = report.className.replace(/fail|pass/g, '') + name; - if (report.className.trim()) hideSuitesWithout('test fail'); - }); - - root.appendChild(stat); - root.appendChild(report); - - if (progress) progress.size(40); - - runner.on('suite', function(suite){ - if (suite.root) return; - - // suite - var url = self.suiteURL(suite); - var el = fragment('
      • %s

      • ', url, escape(suite.title)); - - // container - stack[0].appendChild(el); - stack.unshift(document.createElement('ul')); - el.appendChild(stack[0]); - }); - - runner.on('suite end', function(suite){ - if (suite.root) return; - stack.shift(); - }); - - runner.on('fail', function(test, err){ - if ('hook' == test.type) runner.emit('test end', test); - }); - - runner.on('test end', function(test){ - // TODO: add to stats - var percent = stats.tests / this.total * 100 | 0; - if (progress) progress.update(percent).draw(ctx); - - // update stats - var ms = new Date - stats.start; - text(passes, stats.passes); - text(failures, stats.failures); - text(duration, (ms / 1000).toFixed(2)); - - // test - if ('passed' == test.state) { - var url = self.testURL(test); - var el = fragment('
      • %e%ems

      • ', test.speed, test.title, test.duration, url); - } else if (test.pending) { - var el = fragment('
      • %e

      • ', test.title); - } else { - var el = fragment('
      • %e

      • ', test.title, encodeURIComponent(test.fullTitle())); - var str = test.err.stack || test.err.toString(); - - // FF / Opera do not add the message - if (!~str.indexOf(test.err.message)) { - str = test.err.message + '\n' + str; - } - - // <=IE7 stringifies to [Object Error]. Since it can be overloaded, we - // check for the result of the stringifying. - if ('[object Error]' == str) str = test.err.message; - - // Safari doesn't give you a stack. Let's at least provide a source line. - if (!test.err.stack && test.err.sourceURL && test.err.line !== undefined) { - str += "\n(" + test.err.sourceURL + ":" + test.err.line + ")"; - } - - el.appendChild(fragment('
        %e
        ', str)); - } - - // toggle code - // TODO: defer - if (!test.pending) { - var h2 = el.getElementsByTagName('h2')[0]; - - on(h2, 'click', function(){ - pre.style.display = 'none' == pre.style.display - ? 'block' - : 'none'; - }); - - var pre = fragment('
        %e
        ', utils.clean(test.fn.toString())); - el.appendChild(pre); - pre.style.display = 'none'; - } - - // Don't call .appendChild if #mocha-report was already .shift()'ed off the stack. - if (stack[0]) stack[0].appendChild(el); - }); -} - -/** - * Provide suite URL - * - * @param {Object} [suite] - */ - -HTML.prototype.suiteURL = function(suite){ - return '?grep=' + encodeURIComponent(suite.fullTitle()); -}; - -/** - * Provide test URL - * - * @param {Object} [test] - */ - -HTML.prototype.testURL = function(test){ - return '?grep=' + encodeURIComponent(test.fullTitle()); -}; - -/** - * Display error `msg`. - */ - -function error(msg) { - document.body.appendChild(fragment('
        %s
        ', msg)); -} - -/** - * Return a DOM fragment from `html`. - */ - -function fragment(html) { - var args = arguments - , div = document.createElement('div') - , i = 1; - - div.innerHTML = html.replace(/%([se])/g, function(_, type){ - switch (type) { - case 's': return String(args[i++]); - case 'e': return escape(args[i++]); - } - }); - - return div.firstChild; -} - -/** - * Check for suites that do not have elements - * with `classname`, and hide them. - */ - -function hideSuitesWithout(classname) { - var suites = document.getElementsByClassName('suite'); - for (var i = 0; i < suites.length; i++) { - var els = suites[i].getElementsByClassName(classname); - if (0 == els.length) suites[i].className += ' hidden'; - } -} - -/** - * Unhide .hidden suites. - */ - -function unhide() { - var els = document.getElementsByClassName('suite hidden'); - for (var i = 0; i < els.length; ++i) { - els[i].className = els[i].className.replace('suite hidden', 'suite'); - } -} - -/** - * Set `el` text to `str`. - */ - -function text(el, str) { - if (el.textContent) { - el.textContent = str; - } else { - el.innerText = str; - } -} - -/** - * Listen on `event` with callback `fn`. - */ - -function on(el, event, fn) { - if (el.addEventListener) { - el.addEventListener(event, fn, false); - } else { - el.attachEvent('on' + event, fn); - } -} - -}); // module: reporters/html.js - -require.register("reporters/index.js", function(module, exports, require){ - -exports.Base = require('./base'); -exports.Dot = require('./dot'); -exports.Doc = require('./doc'); -exports.TAP = require('./tap'); -exports.JSON = require('./json'); -exports.HTML = require('./html'); -exports.List = require('./list'); -exports.Min = require('./min'); -exports.Spec = require('./spec'); -exports.Nyan = require('./nyan'); -exports.XUnit = require('./xunit'); -exports.Markdown = require('./markdown'); -exports.Progress = require('./progress'); -exports.Landing = require('./landing'); -exports.JSONCov = require('./json-cov'); -exports.HTMLCov = require('./html-cov'); -exports.JSONStream = require('./json-stream'); - -}); // module: reporters/index.js - -require.register("reporters/json-cov.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `JSONCov`. - */ - -exports = module.exports = JSONCov; - -/** - * Initialize a new `JsCoverage` reporter. - * - * @param {Runner} runner - * @param {Boolean} output - * @api public - */ - -function JSONCov(runner, output) { - var self = this - , output = 1 == arguments.length ? true : output; - - Base.call(this, runner); - - var tests = [] - , failures = [] - , passes = []; - - runner.on('test end', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - passes.push(test); - }); - - runner.on('fail', function(test){ - failures.push(test); - }); - - runner.on('end', function(){ - var cov = global._$jscoverage || {}; - var result = self.cov = map(cov); - result.stats = self.stats; - result.tests = tests.map(clean); - result.failures = failures.map(clean); - result.passes = passes.map(clean); - if (!output) return; - process.stdout.write(JSON.stringify(result, null, 2 )); - }); -} - -/** - * Map jscoverage data to a JSON structure - * suitable for reporting. - * - * @param {Object} cov - * @return {Object} - * @api private - */ - -function map(cov) { - var ret = { - instrumentation: 'node-jscoverage' - , sloc: 0 - , hits: 0 - , misses: 0 - , coverage: 0 - , files: [] - }; - - for (var filename in cov) { - var data = coverage(filename, cov[filename]); - ret.files.push(data); - ret.hits += data.hits; - ret.misses += data.misses; - ret.sloc += data.sloc; - } - - ret.files.sort(function(a, b) { - return a.filename.localeCompare(b.filename); - }); - - if (ret.sloc > 0) { - ret.coverage = (ret.hits / ret.sloc) * 100; - } - - return ret; -} - -/** - * Map jscoverage data for a single source file - * to a JSON structure suitable for reporting. - * - * @param {String} filename name of the source file - * @param {Object} data jscoverage coverage data - * @return {Object} - * @api private - */ - -function coverage(filename, data) { - var ret = { - filename: filename, - coverage: 0, - hits: 0, - misses: 0, - sloc: 0, - source: {} - }; - - data.source.forEach(function(line, num){ - num++; - - if (data[num] === 0) { - ret.misses++; - ret.sloc++; - } else if (data[num] !== undefined) { - ret.hits++; - ret.sloc++; - } - - ret.source[num] = { - source: line - , coverage: data[num] === undefined - ? '' - : data[num] - }; - }); - - ret.coverage = ret.hits / ret.sloc * 100; - - return ret; -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} - -}); // module: reporters/json-cov.js - -require.register("reporters/json-stream.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function List(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , total = runner.total; - - runner.on('start', function(){ - console.log(JSON.stringify(['start', { total: total }])); - }); - - runner.on('pass', function(test){ - console.log(JSON.stringify(['pass', clean(test)])); - }); - - runner.on('fail', function(test, err){ - console.log(JSON.stringify(['fail', clean(test)])); - }); - - runner.on('end', function(){ - process.stdout.write(JSON.stringify(['end', self.stats])); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title - , fullTitle: test.fullTitle() - , duration: test.duration - } -} -}); // module: reporters/json-stream.js - -require.register("reporters/json.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `JSON`. - */ - -exports = module.exports = JSONReporter; - -/** - * Initialize a new `JSON` reporter. - * - * @param {Runner} runner - * @api public - */ - -function JSONReporter(runner) { - var self = this; - Base.call(this, runner); - - var tests = [] - , pending = [] - , failures = [] - , passes = []; - - runner.on('test end', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - passes.push(test); - }); - - runner.on('fail', function(test){ - failures.push(test); - }); - - runner.on('pending', function(test){ - pending.push(test); - }); - - runner.on('end', function(){ - var obj = { - stats: self.stats, - tests: tests.map(clean), - pending: pending.map(clean), - failures: failures.map(clean), - passes: passes.map(clean) - }; - - runner.testResults = obj; - - process.stdout.write(JSON.stringify(obj, null, 2)); - }); -} - -/** - * Return a plain-object representation of `test` - * free of cyclic properties etc. - * - * @param {Object} test - * @return {Object} - * @api private - */ - -function clean(test) { - return { - title: test.title, - fullTitle: test.fullTitle(), - duration: test.duration, - err: errorJSON(test.err || {}) - } -} - -/** - * Transform `error` into a JSON object. - * @param {Error} err - * @return {Object} - */ - -function errorJSON(err) { - var res = {}; - Object.getOwnPropertyNames(err).forEach(function(key) { - res[key] = err[key]; - }, err); - return res; -} - -}); // module: reporters/json.js - -require.register("reporters/landing.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Landing`. - */ - -exports = module.exports = Landing; - -/** - * Airplane color. - */ - -Base.colors.plane = 0; - -/** - * Airplane crash color. - */ - -Base.colors['plane crash'] = 31; - -/** - * Runway color. - */ - -Base.colors.runway = 90; - -/** - * Initialize a new `Landing` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Landing(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , total = runner.total - , stream = process.stdout - , plane = color('plane', '✈') - , crashed = -1 - , n = 0; - - function runway() { - var buf = Array(width).join('-'); - return ' ' + color('runway', buf); - } - - runner.on('start', function(){ - stream.write('\n '); - cursor.hide(); - }); - - runner.on('test end', function(test){ - // check if the plane crashed - var col = -1 == crashed - ? width * ++n / total | 0 - : crashed; - - // show the crash - if ('failed' == test.state) { - plane = color('plane crash', '✈'); - crashed = col; - } - - // render landing strip - stream.write('\u001b[4F\n\n'); - stream.write(runway()); - stream.write('\n '); - stream.write(color('runway', Array(col).join('⋅'))); - stream.write(plane) - stream.write(color('runway', Array(width - col).join('⋅') + '\n')); - stream.write(runway()); - stream.write('\u001b[0m'); - }); - - runner.on('end', function(){ - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Landing.prototype = new F; -Landing.prototype.constructor = Landing; - -}); // module: reporters/landing.js - -require.register("reporters/list.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `List`. - */ - -exports = module.exports = List; - -/** - * Initialize a new `List` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function List(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , n = 0; - - runner.on('start', function(){ - console.log(); - }); - - runner.on('test', function(test){ - process.stdout.write(color('pass', ' ' + test.fullTitle() + ': ')); - }); - - runner.on('pending', function(test){ - var fmt = color('checkmark', ' -') - + color('pending', ' %s'); - console.log(fmt, test.fullTitle()); - }); - - runner.on('pass', function(test){ - var fmt = color('checkmark', ' '+Base.symbols.dot) - + color('pass', ' %s: ') - + color(test.speed, '%dms'); - cursor.CR(); - console.log(fmt, test.fullTitle(), test.duration); - }); - - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(color('fail', ' %d) %s'), ++n, test.fullTitle()); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -List.prototype = new F; -List.prototype.constructor = List; - - -}); // module: reporters/list.js - -require.register("reporters/markdown.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils'); - -/** - * Expose `Markdown`. - */ - -exports = module.exports = Markdown; - -/** - * Initialize a new `Markdown` reporter. - * - * @param {Runner} runner - * @api public - */ - -function Markdown(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , level = 0 - , buf = ''; - - function title(str) { - return Array(level).join('#') + ' ' + str; - } - - function indent() { - return Array(level).join(' '); - } - - function mapTOC(suite, obj) { - var ret = obj; - obj = obj[suite.title] = obj[suite.title] || { suite: suite }; - suite.suites.forEach(function(suite){ - mapTOC(suite, obj); - }); - return ret; - } - - function stringifyTOC(obj, level) { - ++level; - var buf = ''; - var link; - for (var key in obj) { - if ('suite' == key) continue; - if (key) link = ' - [' + key + '](#' + utils.slug(obj[key].suite.fullTitle()) + ')\n'; - if (key) buf += Array(level).join(' ') + link; - buf += stringifyTOC(obj[key], level); - } - --level; - return buf; - } - - function generateTOC(suite) { - var obj = mapTOC(suite, {}); - return stringifyTOC(obj, 0); - } - - generateTOC(runner.suite); - - runner.on('suite', function(suite){ - ++level; - var slug = utils.slug(suite.fullTitle()); - buf += '' + '\n'; - buf += title(suite.title) + '\n'; - }); - - runner.on('suite end', function(suite){ - --level; - }); - - runner.on('pass', function(test){ - var code = utils.clean(test.fn.toString()); - buf += test.title + '.\n'; - buf += '\n```js\n'; - buf += code + '\n'; - buf += '```\n\n'; - }); - - runner.on('end', function(){ - process.stdout.write('# TOC\n'); - process.stdout.write(generateTOC(runner.suite)); - process.stdout.write(buf); - }); -} -}); // module: reporters/markdown.js - -require.register("reporters/min.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base'); - -/** - * Expose `Min`. - */ - -exports = module.exports = Min; - -/** - * Initialize a new `Min` minimal test reporter (best used with --watch). - * - * @param {Runner} runner - * @api public - */ - -function Min(runner) { - Base.call(this, runner); - - runner.on('start', function(){ - // clear screen - process.stdout.write('\u001b[2J'); - // set cursor position - process.stdout.write('\u001b[1;3H'); - }); - - runner.on('end', this.epilogue.bind(this)); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Min.prototype = new F; -Min.prototype.constructor = Min; - - -}); // module: reporters/min.js - -require.register("reporters/nyan.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var Base = require('./base') - , color = Base.color; - -/** - * Expose `Dot`. - */ - -exports = module.exports = NyanCat; - -/** - * Initialize a new `Dot` matrix test reporter. - * - * @param {Runner} runner - * @api public - */ - -function NyanCat(runner) { - Base.call(this, runner); - var self = this - , stats = this.stats - , width = Base.window.width * .75 | 0 - , rainbowColors = this.rainbowColors = self.generateColors() - , colorIndex = this.colorIndex = 0 - , numerOfLines = this.numberOfLines = 4 - , trajectories = this.trajectories = [[], [], [], []] - , nyanCatWidth = this.nyanCatWidth = 11 - , trajectoryWidthMax = this.trajectoryWidthMax = (width - nyanCatWidth) - , scoreboardWidth = this.scoreboardWidth = 5 - , tick = this.tick = 0 - , n = 0; - - runner.on('start', function(){ - Base.cursor.hide(); - self.draw(); - }); - - runner.on('pending', function(test){ - self.draw(); - }); - - runner.on('pass', function(test){ - self.draw(); - }); - - runner.on('fail', function(test, err){ - self.draw(); - }); - - runner.on('end', function(){ - Base.cursor.show(); - for (var i = 0; i < self.numberOfLines; i++) write('\n'); - self.epilogue(); - }); -} - -/** - * Draw the nyan cat - * - * @api private - */ - -NyanCat.prototype.draw = function(){ - this.appendRainbow(); - this.drawScoreboard(); - this.drawRainbow(); - this.drawNyanCat(); - this.tick = !this.tick; -}; - -/** - * Draw the "scoreboard" showing the number - * of passes, failures and pending tests. - * - * @api private - */ - -NyanCat.prototype.drawScoreboard = function(){ - var stats = this.stats; - var colors = Base.colors; - - function draw(color, n) { - write(' '); - write('\u001b[' + color + 'm' + n + '\u001b[0m'); - write('\n'); - } - - draw(colors.green, stats.passes); - draw(colors.fail, stats.failures); - draw(colors.pending, stats.pending); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Append the rainbow. - * - * @api private - */ - -NyanCat.prototype.appendRainbow = function(){ - var segment = this.tick ? '_' : '-'; - var rainbowified = this.rainbowify(segment); - - for (var index = 0; index < this.numberOfLines; index++) { - var trajectory = this.trajectories[index]; - if (trajectory.length >= this.trajectoryWidthMax) trajectory.shift(); - trajectory.push(rainbowified); - } -}; - -/** - * Draw the rainbow. - * - * @api private - */ - -NyanCat.prototype.drawRainbow = function(){ - var self = this; - - this.trajectories.forEach(function(line, index) { - write('\u001b[' + self.scoreboardWidth + 'C'); - write(line.join('')); - write('\n'); - }); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw the nyan cat - * - * @api private - */ - -NyanCat.prototype.drawNyanCat = function() { - var self = this; - var startWidth = this.scoreboardWidth + this.trajectories[0].length; - var color = '\u001b[' + startWidth + 'C'; - var padding = ''; - - write(color); - write('_,------,'); - write('\n'); - - write(color); - padding = self.tick ? ' ' : ' '; - write('_|' + padding + '/\\_/\\ '); - write('\n'); - - write(color); - padding = self.tick ? '_' : '__'; - var tail = self.tick ? '~' : '^'; - var face; - write(tail + '|' + padding + this.face() + ' '); - write('\n'); - - write(color); - padding = self.tick ? ' ' : ' '; - write(padding + '"" "" '); - write('\n'); - - this.cursorUp(this.numberOfLines); -}; - -/** - * Draw nyan cat face. - * - * @return {String} - * @api private - */ - -NyanCat.prototype.face = function() { - var stats = this.stats; - if (stats.failures) { - return '( x .x)'; - } else if (stats.pending) { - return '( o .o)'; - } else if(stats.passes) { - return '( ^ .^)'; - } else { - return '( - .-)'; - } -}; - -/** - * Move cursor up `n`. - * - * @param {Number} n - * @api private - */ - -NyanCat.prototype.cursorUp = function(n) { - write('\u001b[' + n + 'A'); -}; - -/** - * Move cursor down `n`. - * - * @param {Number} n - * @api private - */ - -NyanCat.prototype.cursorDown = function(n) { - write('\u001b[' + n + 'B'); -}; - -/** - * Generate rainbow colors. - * - * @return {Array} - * @api private - */ - -NyanCat.prototype.generateColors = function(){ - var colors = []; - - for (var i = 0; i < (6 * 7); i++) { - var pi3 = Math.floor(Math.PI / 3); - var n = (i * (1.0 / 6)); - var r = Math.floor(3 * Math.sin(n) + 3); - var g = Math.floor(3 * Math.sin(n + 2 * pi3) + 3); - var b = Math.floor(3 * Math.sin(n + 4 * pi3) + 3); - colors.push(36 * r + 6 * g + b + 16); - } - - return colors; -}; - -/** - * Apply rainbow to the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -NyanCat.prototype.rainbowify = function(str){ - var color = this.rainbowColors[this.colorIndex % this.rainbowColors.length]; - this.colorIndex += 1; - return '\u001b[38;5;' + color + 'm' + str + '\u001b[0m'; -}; - -/** - * Stdout helper. - */ - -function write(string) { - process.stdout.write(string); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -NyanCat.prototype = new F; -NyanCat.prototype.constructor = NyanCat; - - -}); // module: reporters/nyan.js - -require.register("reporters/progress.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Progress`. - */ - -exports = module.exports = Progress; - -/** - * General progress bar color. - */ - -Base.colors.progress = 90; - -/** - * Initialize a new `Progress` bar test reporter. - * - * @param {Runner} runner - * @param {Object} options - * @api public - */ - -function Progress(runner, options) { - Base.call(this, runner); - - var self = this - , options = options || {} - , stats = this.stats - , width = Base.window.width * .50 | 0 - , total = runner.total - , complete = 0 - , max = Math.max - , lastN = -1; - - // default chars - options.open = options.open || '['; - options.complete = options.complete || '▬'; - options.incomplete = options.incomplete || Base.symbols.dot; - options.close = options.close || ']'; - options.verbose = false; - - // tests started - runner.on('start', function(){ - console.log(); - cursor.hide(); - }); - - // tests complete - runner.on('test end', function(){ - complete++; - var incomplete = total - complete - , percent = complete / total - , n = width * percent | 0 - , i = width - n; - - if (lastN === n && !options.verbose) { - // Don't re-render the line if it hasn't changed - return; - } - lastN = n; - - cursor.CR(); - process.stdout.write('\u001b[J'); - process.stdout.write(color('progress', ' ' + options.open)); - process.stdout.write(Array(n).join(options.complete)); - process.stdout.write(Array(i).join(options.incomplete)); - process.stdout.write(color('progress', options.close)); - if (options.verbose) { - process.stdout.write(color('progress', ' ' + complete + ' of ' + total)); - } - }); - - // tests are complete, output some stats - // and the failures if any - runner.on('end', function(){ - cursor.show(); - console.log(); - self.epilogue(); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Progress.prototype = new F; -Progress.prototype.constructor = Progress; - - -}); // module: reporters/progress.js - -require.register("reporters/spec.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `Spec`. - */ - -exports = module.exports = Spec; - -/** - * Initialize a new `Spec` test reporter. - * - * @param {Runner} runner - * @api public - */ - -function Spec(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , indents = 0 - , n = 0; - - function indent() { - return Array(indents).join(' ') - } - - runner.on('start', function(){ - console.log(); - }); - - runner.on('suite', function(suite){ - ++indents; - console.log(color('suite', '%s%s'), indent(), suite.title); - }); - - runner.on('suite end', function(suite){ - --indents; - if (1 == indents) console.log(); - }); - - runner.on('pending', function(test){ - var fmt = indent() + color('pending', ' - %s'); - console.log(fmt, test.title); - }); - - runner.on('pass', function(test){ - if ('fast' == test.speed) { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s '); - cursor.CR(); - console.log(fmt, test.title); - } else { - var fmt = indent() - + color('checkmark', ' ' + Base.symbols.ok) - + color('pass', ' %s ') - + color(test.speed, '(%dms)'); - cursor.CR(); - console.log(fmt, test.title, test.duration); - } - }); - - runner.on('fail', function(test, err){ - cursor.CR(); - console.log(indent() + color('fail', ' %d) %s'), ++n, test.title); - }); - - runner.on('end', self.epilogue.bind(self)); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -Spec.prototype = new F; -Spec.prototype.constructor = Spec; - - -}); // module: reporters/spec.js - -require.register("reporters/tap.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , cursor = Base.cursor - , color = Base.color; - -/** - * Expose `TAP`. - */ - -exports = module.exports = TAP; - -/** - * Initialize a new `TAP` reporter. - * - * @param {Runner} runner - * @api public - */ - -function TAP(runner) { - Base.call(this, runner); - - var self = this - , stats = this.stats - , n = 1 - , passes = 0 - , failures = 0; - - runner.on('start', function(){ - var total = runner.grepTotal(runner.suite); - console.log('%d..%d', 1, total); - }); - - runner.on('test end', function(){ - ++n; - }); - - runner.on('pending', function(test){ - console.log('ok %d %s # SKIP -', n, title(test)); - }); - - runner.on('pass', function(test){ - passes++; - console.log('ok %d %s', n, title(test)); - }); - - runner.on('fail', function(test, err){ - failures++; - console.log('not ok %d %s', n, title(test)); - if (err.stack) console.log(err.stack.replace(/^/gm, ' ')); - }); - - runner.on('end', function(){ - console.log('# tests ' + (passes + failures)); - console.log('# pass ' + passes); - console.log('# fail ' + failures); - }); -} - -/** - * Return a TAP-safe title of `test` - * - * @param {Object} test - * @return {String} - * @api private - */ - -function title(test) { - return test.fullTitle().replace(/#/g, ''); -} - -}); // module: reporters/tap.js - -require.register("reporters/xunit.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Base = require('./base') - , utils = require('../utils') - , escape = utils.escape; - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Expose `XUnit`. - */ - -exports = module.exports = XUnit; - -/** - * Initialize a new `XUnit` reporter. - * - * @param {Runner} runner - * @api public - */ - -function XUnit(runner) { - Base.call(this, runner); - var stats = this.stats - , tests = [] - , self = this; - - runner.on('pending', function(test){ - tests.push(test); - }); - - runner.on('pass', function(test){ - tests.push(test); - }); - - runner.on('fail', function(test){ - tests.push(test); - }); - - runner.on('end', function(){ - console.log(tag('testsuite', { - name: 'Mocha Tests' - , tests: stats.tests - , failures: stats.failures - , errors: stats.failures - , skipped: stats.tests - stats.failures - stats.passes - , timestamp: (new Date).toUTCString() - , time: (stats.duration / 1000) || 0 - }, false)); - - tests.forEach(test); - console.log(''); - }); -} - -/** - * Inherit from `Base.prototype`. - */ - -function F(){}; -F.prototype = Base.prototype; -XUnit.prototype = new F; -XUnit.prototype.constructor = XUnit; - - -/** - * Output tag for the given `test.` - */ - -function test(test) { - var attrs = { - classname: test.parent.fullTitle() - , name: test.title - , time: (test.duration / 1000) || 0 - }; - - if ('failed' == test.state) { - var err = test.err; - console.log(tag('testcase', attrs, false, tag('failure', {}, false, cdata(escape(err.message) + "\n" + err.stack)))); - } else if (test.pending) { - console.log(tag('testcase', attrs, false, tag('skipped', {}, true))); - } else { - console.log(tag('testcase', attrs, true) ); - } -} - -/** - * HTML tag helper. - */ - -function tag(name, attrs, close, content) { - var end = close ? '/>' : '>' - , pairs = [] - , tag; - - for (var key in attrs) { - pairs.push(key + '="' + escape(attrs[key]) + '"'); - } - - tag = '<' + name + (pairs.length ? ' ' + pairs.join(' ') : '') + end; - if (content) tag += content + ''; -} - -}); // module: reporters/xunit.js - -require.register("runnable.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runnable') - , milliseconds = require('./ms'); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date - , setTimeout = global.setTimeout - , setInterval = global.setInterval - , clearTimeout = global.clearTimeout - , clearInterval = global.clearInterval; - -/** - * Object#toString(). - */ - -var toString = Object.prototype.toString; - -/** - * Expose `Runnable`. - */ - -module.exports = Runnable; - -/** - * Initialize a new `Runnable` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Runnable(title, fn) { - this.title = title; - this.fn = fn; - this.async = fn && fn.length; - this.sync = ! this.async; - this._timeout = 2000; - this._slow = 75; - this._enableTimeouts = true; - this.timedOut = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -function F(){}; -F.prototype = EventEmitter.prototype; -Runnable.prototype = new F; -Runnable.prototype.constructor = Runnable; - - -/** - * Set & get timeout `ms`. - * - * @param {Number|String} ms - * @return {Runnable|Number} ms or self - * @api private - */ - -Runnable.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if (ms === 0) this._enableTimeouts = false; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = ms; - if (this.timer) this.resetTimeout(); - return this; -}; - -/** - * Set & get slow `ms`. - * - * @param {Number|String} ms - * @return {Runnable|Number} ms or self - * @api private - */ - -Runnable.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._slow = ms; - return this; -}; - -/** - * Set and & get timeout `enabled`. - * - * @param {Boolean} enabled - * @return {Runnable|Boolean} enabled or self - * @api private - */ - -Runnable.prototype.enableTimeouts = function(enabled){ - if (arguments.length === 0) return this._enableTimeouts; - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Return the full title generated by recursively - * concatenating the parent's full title. - * - * @return {String} - * @api public - */ - -Runnable.prototype.fullTitle = function(){ - return this.parent.fullTitle() + ' ' + this.title; -}; - -/** - * Clear the timeout. - * - * @api private - */ - -Runnable.prototype.clearTimeout = function(){ - clearTimeout(this.timer); -}; - -/** - * Inspect the runnable void of private properties. - * - * @return {String} - * @api private - */ - -Runnable.prototype.inspect = function(){ - return JSON.stringify(this, function(key, val){ - if ('_' == key[0]) return; - if ('parent' == key) return '#'; - if ('ctx' == key) return '#'; - return val; - }, 2); -}; - -/** - * Reset the timeout. - * - * @api private - */ - -Runnable.prototype.resetTimeout = function(){ - var self = this; - var ms = this.timeout() || 1e9; - - if (!this._enableTimeouts) return; - this.clearTimeout(); - this.timer = setTimeout(function(){ - if (!self._enableTimeouts) return; - self.callback(new Error('timeout of ' + ms + 'ms exceeded')); - self.timedOut = true; - }, ms); -}; - -/** - * Whitelist these globals for this test run - * - * @api private - */ -Runnable.prototype.globals = function(arr){ - var self = this; - this._allowedGlobals = arr; -}; - -/** - * Run the test and invoke `fn(err)`. - * - * @param {Function} fn - * @api private - */ - -Runnable.prototype.run = function(fn){ - var self = this - , start = new Date - , ctx = this.ctx - , finished - , emitted; - - // Some times the ctx exists but it is not runnable - if (ctx && ctx.runnable) ctx.runnable(this); - - // called multiple times - function multiple(err) { - if (emitted) return; - emitted = true; - self.emit('error', err || new Error('done() called multiple times')); - } - - // finished - function done(err) { - var ms = self.timeout(); - if (self.timedOut) return; - if (finished) return multiple(err); - self.clearTimeout(); - self.duration = new Date - start; - finished = true; - if (!err && self.duration > ms && self._enableTimeouts) err = new Error('timeout of ' + ms + 'ms exceeded'); - fn(err); - } - - // for .resetTimeout() - this.callback = done; - - // explicit async with `done` argument - if (this.async) { - this.resetTimeout(); - - try { - this.fn.call(ctx, function(err){ - if (err instanceof Error || toString.call(err) === "[object Error]") return done(err); - if (null != err) { - if (Object.prototype.toString.call(err) === '[object Object]') { - return done(new Error('done() invoked with non-Error: ' + JSON.stringify(err))); - } else { - return done(new Error('done() invoked with non-Error: ' + err)); - } - } - done(); - }); - } catch (err) { - done(err); - } - return; - } - - if (this.asyncOnly) { - return done(new Error('--async-only option in use without declaring `done()`')); - } - - // sync or promise-returning - try { - if (this.pending) { - done(); - } else { - callFn(this.fn); - } - } catch (err) { - done(err); - } - - function callFn(fn) { - var result = fn.call(ctx); - if (result && typeof result.then === 'function') { - self.resetTimeout(); - result - .then(function() { - done() - }, - function(reason) { - done(reason || new Error('Promise rejected with no or falsy reason')) - }); - } else { - done(); - } - } -}; - -}); // module: runnable.js - -require.register("runner.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:runner') - , Test = require('./test') - , utils = require('./utils') - , filter = utils.filter - , keys = utils.keys; - -/** - * Non-enumerable globals. - */ - -var globals = [ - 'setTimeout', - 'clearTimeout', - 'setInterval', - 'clearInterval', - 'XMLHttpRequest', - 'Date' -]; - -/** - * Expose `Runner`. - */ - -module.exports = Runner; - -/** - * Initialize a `Runner` for the given `suite`. - * - * Events: - * - * - `start` execution started - * - `end` execution complete - * - `suite` (suite) test suite execution started - * - `suite end` (suite) all tests (and sub-suites) have finished - * - `test` (test) test execution started - * - `test end` (test) test completed - * - `hook` (hook) hook execution started - * - `hook end` (hook) hook complete - * - `pass` (test) test passed - * - `fail` (test, err) test failed - * - `pending` (test) test pending - * - * @api public - */ - -function Runner(suite) { - var self = this; - this._globals = []; - this._abort = false; - this.suite = suite; - this.total = suite.total(); - this.failures = 0; - this.on('test end', function(test){ self.checkGlobals(test); }); - this.on('hook end', function(hook){ self.checkGlobals(hook); }); - this.grep(/.*/); - this.globals(this.globalProps().concat(extraGlobals())); -} - -/** - * Wrapper for setImmediate, process.nextTick, or browser polyfill. - * - * @param {Function} fn - * @api private - */ - -Runner.immediately = global.setImmediate || process.nextTick; - -/** - * Inherit from `EventEmitter.prototype`. - */ - -function F(){}; -F.prototype = EventEmitter.prototype; -Runner.prototype = new F; -Runner.prototype.constructor = Runner; - - -/** - * Run tests with full titles matching `re`. Updates runner.total - * with number of tests matched. - * - * @param {RegExp} re - * @param {Boolean} invert - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.grep = function(re, invert){ - debug('grep %s', re); - this._grep = re; - this._invert = invert; - this.total = this.grepTotal(this.suite); - return this; -}; - -/** - * Returns the number of tests matching the grep search for the - * given suite. - * - * @param {Suite} suite - * @return {Number} - * @api public - */ - -Runner.prototype.grepTotal = function(suite) { - var self = this; - var total = 0; - - suite.eachTest(function(test){ - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (match) total++; - }); - - return total; -}; - -/** - * Return a list of global properties. - * - * @return {Array} - * @api private - */ - -Runner.prototype.globalProps = function() { - var props = utils.keys(global); - - // non-enumerables - for (var i = 0; i < globals.length; ++i) { - if (~utils.indexOf(props, globals[i])) continue; - props.push(globals[i]); - } - - return props; -}; - -/** - * Allow the given `arr` of globals. - * - * @param {Array} arr - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.globals = function(arr){ - if (0 == arguments.length) return this._globals; - debug('globals %j', arr); - this._globals = this._globals.concat(arr); - return this; -}; - -/** - * Check for global variable leaks. - * - * @api private - */ - -Runner.prototype.checkGlobals = function(test){ - if (this.ignoreLeaks) return; - var ok = this._globals; - - var globals = this.globalProps(); - var leaks; - - if (test) { - ok = ok.concat(test._allowedGlobals || []); - } - - if(this.prevGlobalsLength == globals.length) return; - this.prevGlobalsLength = globals.length; - - leaks = filterLeaks(ok, globals); - this._globals = this._globals.concat(leaks); - - if (leaks.length > 1) { - this.fail(test, new Error('global leaks detected: ' + leaks.join(', ') + '')); - } else if (leaks.length) { - this.fail(test, new Error('global leak detected: ' + leaks[0])); - } -}; - -/** - * Fail the given `test`. - * - * @param {Test} test - * @param {Error} err - * @api private - */ - -Runner.prototype.fail = function(test, err){ - ++this.failures; - test.state = 'failed'; - - if ('string' == typeof err) { - err = new Error('the string "' + err + '" was thrown, throw an Error :)'); - } - - this.emit('fail', test, err); -}; - -/** - * Fail the given `hook` with `err`. - * - * Hook failures work in the following pattern: - * - If bail, then exit - * - Failed `before` hook skips all tests in a suite and subsuites, - * but jumps to corresponding `after` hook - * - Failed `before each` hook skips remaining tests in a - * suite and jumps to corresponding `after each` hook, - * which is run only once - * - Failed `after` hook does not alter - * execution order - * - Failed `after each` hook skips remaining tests in a - * suite and subsuites, but executes other `after each` - * hooks - * - * @param {Hook} hook - * @param {Error} err - * @api private - */ - -Runner.prototype.failHook = function(hook, err){ - this.fail(hook, err); - if (this.suite.bail()) { - this.emit('end'); - } -}; - -/** - * Run hook `name` callbacks and then invoke `fn()`. - * - * @param {String} name - * @param {Function} function - * @api private - */ - -Runner.prototype.hook = function(name, fn){ - var suite = this.suite - , hooks = suite['_' + name] - , self = this - , timer; - - function next(i) { - var hook = hooks[i]; - if (!hook) return fn(); - if (self.failures && suite.bail()) return fn(); - self.currentRunnable = hook; - - hook.ctx.currentTest = self.test; - - self.emit('hook', hook); - - hook.on('error', function(err){ - self.failHook(hook, err); - }); - - hook.run(function(err){ - hook.removeAllListeners('error'); - var testError = hook.error(); - if (testError) self.fail(self.test, testError); - if (err) { - self.failHook(hook, err); - - // stop executing hooks, notify callee of hook err - return fn(err); - } - self.emit('hook end', hook); - delete hook.ctx.currentTest; - next(++i); - }); - } - - Runner.immediately(function(){ - next(0); - }); -}; - -/** - * Run hook `name` for the given array of `suites` - * in order, and callback `fn(err, errSuite)`. - * - * @param {String} name - * @param {Array} suites - * @param {Function} fn - * @api private - */ - -Runner.prototype.hooks = function(name, suites, fn){ - var self = this - , orig = this.suite; - - function next(suite) { - self.suite = suite; - - if (!suite) { - self.suite = orig; - return fn(); - } - - self.hook(name, function(err){ - if (err) { - var errSuite = self.suite; - self.suite = orig; - return fn(err, errSuite); - } - - next(suites.pop()); - }); - } - - next(suites.pop()); -}; - -/** - * Run hooks from the top level down. - * - * @param {String} name - * @param {Function} fn - * @api private - */ - -Runner.prototype.hookUp = function(name, fn){ - var suites = [this.suite].concat(this.parents()).reverse(); - this.hooks(name, suites, fn); -}; - -/** - * Run hooks from the bottom up. - * - * @param {String} name - * @param {Function} fn - * @api private - */ - -Runner.prototype.hookDown = function(name, fn){ - var suites = [this.suite].concat(this.parents()); - this.hooks(name, suites, fn); -}; - -/** - * Return an array of parent Suites from - * closest to furthest. - * - * @return {Array} - * @api private - */ - -Runner.prototype.parents = function(){ - var suite = this.suite - , suites = []; - while (suite = suite.parent) suites.push(suite); - return suites; -}; - -/** - * Run the current test and callback `fn(err)`. - * - * @param {Function} fn - * @api private - */ - -Runner.prototype.runTest = function(fn){ - var test = this.test - , self = this; - - if (this.asyncOnly) test.asyncOnly = true; - - try { - test.on('error', function(err){ - self.fail(test, err); - }); - test.run(fn); - } catch (err) { - fn(err); - } -}; - -/** - * Run tests in the given `suite` and invoke - * the callback `fn()` when complete. - * - * @param {Suite} suite - * @param {Function} fn - * @api private - */ - -Runner.prototype.runTests = function(suite, fn){ - var self = this - , tests = suite.tests.slice() - , test; - - - function hookErr(err, errSuite, after) { - // before/after Each hook for errSuite failed: - var orig = self.suite; - - // for failed 'after each' hook start from errSuite parent, - // otherwise start from errSuite itself - self.suite = after ? errSuite.parent : errSuite; - - if (self.suite) { - // call hookUp afterEach - self.hookUp('afterEach', function(err2, errSuite2) { - self.suite = orig; - // some hooks may fail even now - if (err2) return hookErr(err2, errSuite2, true); - // report error suite - fn(errSuite); - }); - } else { - // there is no need calling other 'after each' hooks - self.suite = orig; - fn(errSuite); - } - } - - function next(err, errSuite) { - // if we bail after first err - if (self.failures && suite._bail) return fn(); - - if (self._abort) return fn(); - - if (err) return hookErr(err, errSuite, true); - - // next test - test = tests.shift(); - - // all done - if (!test) return fn(); - - // grep - var match = self._grep.test(test.fullTitle()); - if (self._invert) match = !match; - if (!match) return next(); - - // pending - if (test.pending) { - self.emit('pending', test); - self.emit('test end', test); - return next(); - } - - // execute test and hook(s) - self.emit('test', self.test = test); - self.hookDown('beforeEach', function(err, errSuite){ - - if (err) return hookErr(err, errSuite, false); - - self.currentRunnable = self.test; - self.runTest(function(err){ - test = self.test; - - if (err) { - self.fail(test, err); - self.emit('test end', test); - return self.hookUp('afterEach', next); - } - - test.state = 'passed'; - self.emit('pass', test); - self.emit('test end', test); - self.hookUp('afterEach', next); - }); - }); - } - - this.next = next; - next(); -}; - -/** - * Run the given `suite` and invoke the - * callback `fn()` when complete. - * - * @param {Suite} suite - * @param {Function} fn - * @api private - */ - -Runner.prototype.runSuite = function(suite, fn){ - var total = this.grepTotal(suite) - , self = this - , i = 0; - - debug('run suite %s', suite.fullTitle()); - - if (!total) return fn(); - - this.emit('suite', this.suite = suite); - - function next(errSuite) { - if (errSuite) { - // current suite failed on a hook from errSuite - if (errSuite == suite) { - // if errSuite is current suite - // continue to the next sibling suite - return done(); - } else { - // errSuite is among the parents of current suite - // stop execution of errSuite and all sub-suites - return done(errSuite); - } - } - - if (self._abort) return done(); - - var curr = suite.suites[i++]; - if (!curr) return done(); - self.runSuite(curr, next); - } - - function done(errSuite) { - self.suite = suite; - self.hook('afterAll', function(){ - self.emit('suite end', suite); - fn(errSuite); - }); - } - - this.hook('beforeAll', function(err){ - if (err) return done(); - self.runTests(suite, next); - }); -}; - -/** - * Handle uncaught exceptions. - * - * @param {Error} err - * @api private - */ - -Runner.prototype.uncaught = function(err){ - if (err) { - debug('uncaught exception %s', err !== function () { - return this; - }.call(err) ? err : ( err.message || err )); - } else { - debug('uncaught undefined exception'); - err = new Error('Caught undefined error, did you throw without specifying what?'); - } - err.uncaught = true; - - var runnable = this.currentRunnable; - if (!runnable) return; - - var wasAlreadyDone = runnable.state; - this.fail(runnable, err); - - runnable.clearTimeout(); - - if (wasAlreadyDone) return; - - // recover from test - if ('test' == runnable.type) { - this.emit('test end', runnable); - this.hookUp('afterEach', this.next); - return; - } - - // bail on hooks - this.emit('end'); -}; - -/** - * Run the root suite and invoke `fn(failures)` - * on completion. - * - * @param {Function} fn - * @return {Runner} for chaining - * @api public - */ - -Runner.prototype.run = function(fn){ - var self = this - , fn = fn || function(){}; - - function uncaught(err){ - self.uncaught(err); - } - - debug('start'); - - // callback - this.on('end', function(){ - debug('end'); - process.removeListener('uncaughtException', uncaught); - fn(self.failures); - }); - - // run suites - this.emit('start'); - this.runSuite(this.suite, function(){ - debug('finished running'); - self.emit('end'); - }); - - // uncaught exception - process.on('uncaughtException', uncaught); - - return this; -}; - -/** - * Cleanly abort execution - * - * @return {Runner} for chaining - * @api public - */ -Runner.prototype.abort = function(){ - debug('aborting'); - this._abort = true; -}; - -/** - * Filter leaks with the given globals flagged as `ok`. - * - * @param {Array} ok - * @param {Array} globals - * @return {Array} - * @api private - */ - -function filterLeaks(ok, globals) { - return filter(globals, function(key){ - // Firefox and Chrome exposes iframes as index inside the window object - if (/^d+/.test(key)) return false; - - // in firefox - // if runner runs in an iframe, this iframe's window.getInterface method not init at first - // it is assigned in some seconds - if (global.navigator && /^getInterface/.test(key)) return false; - - // an iframe could be approached by window[iframeIndex] - // in ie6,7,8 and opera, iframeIndex is enumerable, this could cause leak - if (global.navigator && /^\d+/.test(key)) return false; - - // Opera and IE expose global variables for HTML element IDs (issue #243) - if (/^mocha-/.test(key)) return false; - - var matched = filter(ok, function(ok){ - if (~ok.indexOf('*')) return 0 == key.indexOf(ok.split('*')[0]); - return key == ok; - }); - return matched.length == 0 && (!global.navigator || 'onerror' !== key); - }); -} - -/** - * Array of globals dependent on the environment. - * - * @return {Array} - * @api private - */ - - function extraGlobals() { - if (typeof(process) === 'object' && - typeof(process.version) === 'string') { - - var nodeVersion = process.version.split('.').reduce(function(a, v) { - return a << 8 | v; - }); - - // 'errno' was renamed to process._errno in v0.9.11. - - if (nodeVersion < 0x00090B) { - return ['errno']; - } - } - - return []; - } - -}); // module: runner.js - -require.register("suite.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var EventEmitter = require('browser/events').EventEmitter - , debug = require('browser/debug')('mocha:suite') - , milliseconds = require('./ms') - , utils = require('./utils') - , Hook = require('./hook'); - -/** - * Expose `Suite`. - */ - -exports = module.exports = Suite; - -/** - * Create a new `Suite` with the given `title` - * and parent `Suite`. When a suite with the - * same title is already present, that suite - * is returned to provide nicer reporter - * and more flexible meta-testing. - * - * @param {Suite} parent - * @param {String} title - * @return {Suite} - * @api public - */ - -exports.create = function(parent, title){ - var suite = new Suite(title, parent.ctx); - suite.parent = parent; - if (parent.pending) suite.pending = true; - title = suite.fullTitle(); - parent.addSuite(suite); - return suite; -}; - -/** - * Initialize a new `Suite` with the given - * `title` and `ctx`. - * - * @param {String} title - * @param {Context} ctx - * @api private - */ - -function Suite(title, parentContext) { - this.title = title; - var context = function() {}; - context.prototype = parentContext; - this.ctx = new context(); - this.suites = []; - this.tests = []; - this.pending = false; - this._beforeEach = []; - this._beforeAll = []; - this._afterEach = []; - this._afterAll = []; - this.root = !title; - this._timeout = 2000; - this._enableTimeouts = true; - this._slow = 75; - this._bail = false; -} - -/** - * Inherit from `EventEmitter.prototype`. - */ - -function F(){}; -F.prototype = EventEmitter.prototype; -Suite.prototype = new F; -Suite.prototype.constructor = Suite; - - -/** - * Return a clone of this `Suite`. - * - * @return {Suite} - * @api private - */ - -Suite.prototype.clone = function(){ - var suite = new Suite(this.title); - debug('clone'); - suite.ctx = this.ctx; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - return suite; -}; - -/** - * Set timeout `ms` or short-hand such as "2s". - * - * @param {Number|String} ms - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.timeout = function(ms){ - if (0 == arguments.length) return this._timeout; - if (ms === 0) this._enableTimeouts = false; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('timeout %d', ms); - this._timeout = parseInt(ms, 10); - return this; -}; - -/** - * Set timeout `enabled`. - * - * @param {Boolean} enabled - * @return {Suite|Boolean} self or enabled - * @api private - */ - -Suite.prototype.enableTimeouts = function(enabled){ - if (arguments.length === 0) return this._enableTimeouts; - debug('enableTimeouts %s', enabled); - this._enableTimeouts = enabled; - return this; -}; - -/** - * Set slow `ms` or short-hand such as "2s". - * - * @param {Number|String} ms - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.slow = function(ms){ - if (0 === arguments.length) return this._slow; - if ('string' == typeof ms) ms = milliseconds(ms); - debug('slow %d', ms); - this._slow = ms; - return this; -}; - -/** - * Sets whether to bail after first error. - * - * @parma {Boolean} bail - * @return {Suite|Number} for chaining - * @api private - */ - -Suite.prototype.bail = function(bail){ - if (0 == arguments.length) return this._bail; - debug('bail %s', bail); - this._bail = bail; - return this; -}; - -/** - * Run `fn(test[, done])` before running tests. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.beforeAll = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"before all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeAll.push(hook); - this.emit('beforeAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after running tests. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.afterAll = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"after all" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterAll.push(hook); - this.emit('afterAll', hook); - return this; -}; - -/** - * Run `fn(test[, done])` before each test case. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.beforeEach = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"before each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._beforeEach.push(hook); - this.emit('beforeEach', hook); - return this; -}; - -/** - * Run `fn(test[, done])` after each test case. - * - * @param {Function} fn - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.afterEach = function(title, fn){ - if (this.pending) return this; - if ('function' === typeof title) { - fn = title; - title = fn.name; - } - title = '"after each" hook' + (title ? ': ' + title : ''); - - var hook = new Hook(title, fn); - hook.parent = this; - hook.timeout(this.timeout()); - hook.enableTimeouts(this.enableTimeouts()); - hook.slow(this.slow()); - hook.ctx = this.ctx; - this._afterEach.push(hook); - this.emit('afterEach', hook); - return this; -}; - -/** - * Add a test `suite`. - * - * @param {Suite} suite - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.addSuite = function(suite){ - suite.parent = this; - suite.timeout(this.timeout()); - suite.enableTimeouts(this.enableTimeouts()); - suite.slow(this.slow()); - suite.bail(this.bail()); - this.suites.push(suite); - this.emit('suite', suite); - return this; -}; - -/** - * Add a `test` to this suite. - * - * @param {Test} test - * @return {Suite} for chaining - * @api private - */ - -Suite.prototype.addTest = function(test){ - test.parent = this; - test.timeout(this.timeout()); - test.enableTimeouts(this.enableTimeouts()); - test.slow(this.slow()); - test.ctx = this.ctx; - this.tests.push(test); - this.emit('test', test); - return this; -}; - -/** - * Return the full title generated by recursively - * concatenating the parent's full title. - * - * @return {String} - * @api public - */ - -Suite.prototype.fullTitle = function(){ - if (this.parent) { - var full = this.parent.fullTitle(); - if (full) return full + ' ' + this.title; - } - return this.title; -}; - -/** - * Return the total number of tests. - * - * @return {Number} - * @api public - */ - -Suite.prototype.total = function(){ - return utils.reduce(this.suites, function(sum, suite){ - return sum + suite.total(); - }, 0) + this.tests.length; -}; - -/** - * Iterates through each suite recursively to find - * all tests. Applies a function in the format - * `fn(test)`. - * - * @param {Function} fn - * @return {Suite} - * @api private - */ - -Suite.prototype.eachTest = function(fn){ - utils.forEach(this.tests, fn); - utils.forEach(this.suites, function(suite){ - suite.eachTest(fn); - }); - return this; -}; - -}); // module: suite.js - -require.register("test.js", function(module, exports, require){ - -/** - * Module dependencies. - */ - -var Runnable = require('./runnable'); - -/** - * Expose `Test`. - */ - -module.exports = Test; - -/** - * Initialize a new `Test` with the given `title` and callback `fn`. - * - * @param {String} title - * @param {Function} fn - * @api private - */ - -function Test(title, fn) { - Runnable.call(this, title, fn); - this.pending = !fn; - this.type = 'test'; -} - -/** - * Inherit from `Runnable.prototype`. - */ - -function F(){}; -F.prototype = Runnable.prototype; -Test.prototype = new F; -Test.prototype.constructor = Test; - - -}); // module: test.js - -require.register("utils.js", function(module, exports, require){ -/** - * Module dependencies. - */ - -var fs = require('browser/fs') - , path = require('browser/path') - , basename = path.basename - , exists = fs.existsSync || path.existsSync - , glob = require('browser/glob') - , join = path.join - , debug = require('browser/debug')('mocha:watch'); - -/** - * Ignored directories. - */ - -var ignore = ['node_modules', '.git']; - -/** - * Escape special characters in the given string of html. - * - * @param {String} html - * @return {String} - * @api private - */ - -exports.escape = function(html){ - return String(html) - .replace(/&/g, '&') - .replace(/"/g, '"') - .replace(//g, '>'); -}; - -/** - * Array#forEach (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} scope - * @api private - */ - -exports.forEach = function(arr, fn, scope){ - for (var i = 0, l = arr.length; i < l; i++) - fn.call(scope, arr[i], i); -}; - -/** - * Array#map (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} scope - * @api private - */ - -exports.map = function(arr, fn, scope){ - var result = []; - for (var i = 0, l = arr.length; i < l; i++) - result.push(fn.call(scope, arr[i], i)); - return result; -}; - -/** - * Array#indexOf (<=IE8) - * - * @parma {Array} arr - * @param {Object} obj to find index of - * @param {Number} start - * @api private - */ - -exports.indexOf = function(arr, obj, start){ - for (var i = start || 0, l = arr.length; i < l; i++) { - if (arr[i] === obj) - return i; - } - return -1; -}; - -/** - * Array#reduce (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @param {Object} initial value - * @api private - */ - -exports.reduce = function(arr, fn, val){ - var rval = val; - - for (var i = 0, l = arr.length; i < l; i++) { - rval = fn(rval, arr[i], i, arr); - } - - return rval; -}; - -/** - * Array#filter (<=IE8) - * - * @param {Array} array - * @param {Function} fn - * @api private - */ - -exports.filter = function(arr, fn){ - var ret = []; - - for (var i = 0, l = arr.length; i < l; i++) { - var val = arr[i]; - if (fn(val, i, arr)) ret.push(val); - } - - return ret; -}; - -/** - * Object.keys (<=IE8) - * - * @param {Object} obj - * @return {Array} keys - * @api private - */ - -exports.keys = Object.keys || function(obj) { - var keys = [] - , has = Object.prototype.hasOwnProperty // for `window` on <=IE8 - - for (var key in obj) { - if (has.call(obj, key)) { - keys.push(key); - } - } - - return keys; -}; - -/** - * Watch the given `files` for changes - * and invoke `fn(file)` on modification. - * - * @param {Array} files - * @param {Function} fn - * @api private - */ - -exports.watch = function(files, fn){ - var options = { interval: 100 }; - files.forEach(function(file){ - debug('file %s', file); - fs.watchFile(file, options, function(curr, prev){ - if (prev.mtime < curr.mtime) fn(file); - }); - }); -}; - -/** - * Ignored files. - */ - -function ignored(path){ - return !~ignore.indexOf(path); -} - -/** - * Lookup files in the given `dir`. - * - * @return {Array} - * @api private - */ - -exports.files = function(dir, ext, ret){ - ret = ret || []; - ext = ext || ['js']; - - var re = new RegExp('\\.(' + ext.join('|') + ')$'); - - fs.readdirSync(dir) - .filter(ignored) - .forEach(function(path){ - path = join(dir, path); - if (fs.statSync(path).isDirectory()) { - exports.files(path, ext, ret); - } else if (path.match(re)) { - ret.push(path); - } - }); - - return ret; -}; - -/** - * Compute a slug from the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.slug = function(str){ - return str - .toLowerCase() - .replace(/ +/g, '-') - .replace(/[^-\w]/g, ''); -}; - -/** - * Strip the function definition from `str`, - * and re-indent for pre whitespace. - */ - -exports.clean = function(str) { - str = str - .replace(/\r\n?|[\n\u2028\u2029]/g, "\n").replace(/^\uFEFF/, '') - .replace(/^function *\(.*\) *{|\(.*\) *=> *{?/, '') - .replace(/\s+\}$/, ''); - - var spaces = str.match(/^\n?( *)/)[1].length - , tabs = str.match(/^\n?(\t*)/)[1].length - , re = new RegExp('^\n?' + (tabs ? '\t' : ' ') + '{' + (tabs ? tabs : spaces) + '}', 'gm'); - - str = str.replace(re, ''); - - return exports.trim(str); -}; - -/** - * Trim the given `str`. - * - * @param {String} str - * @return {String} - * @api private - */ - -exports.trim = function(str){ - return str.replace(/^\s+|\s+$/g, ''); -}; - -/** - * Parse the given `qs`. - * - * @param {String} qs - * @return {Object} - * @api private - */ - -exports.parseQuery = function(qs){ - return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair){ - var i = pair.indexOf('=') - , key = pair.slice(0, i) - , val = pair.slice(++i); - - obj[key] = decodeURIComponent(val); - return obj; - }, {}); -}; - -/** - * Highlight the given string of `js`. - * - * @param {String} js - * @return {String} - * @api private - */ - -function highlight(js) { - return js - .replace(//g, '>') - .replace(/\/\/(.*)/gm, '//$1') - .replace(/('.*?')/gm, '$1') - .replace(/(\d+\.\d+)/gm, '$1') - .replace(/(\d+)/gm, '$1') - .replace(/\bnew[ \t]+(\w+)/gm, 'new $1') - .replace(/\b(function|new|throw|return|var|if|else)\b/gm, '$1') -} - -/** - * Highlight the contents of tag `name`. - * - * @param {String} name - * @api private - */ - -exports.highlightTags = function(name) { - var code = document.getElementById('mocha').getElementsByTagName(name); - for (var i = 0, len = code.length; i < len; ++i) { - code[i].innerHTML = highlight(code[i].innerHTML); - } -}; - - -/** - * Stringify `obj`. - * - * @param {Object} obj - * @return {String} - * @api private - */ - -exports.stringify = function(obj) { - if (obj instanceof RegExp) return obj.toString(); - return JSON.stringify(exports.canonicalize(obj), null, 2).replace(/,(\n|$)/g, '$1'); -}; - -/** - * Return a new object that has the keys in sorted order. - * @param {Object} obj - * @param {Array} [stack] - * @return {Object} - * @api private - */ - -exports.canonicalize = function(obj, stack) { - stack = stack || []; - - if (exports.indexOf(stack, obj) !== -1) return '[Circular]'; - - var canonicalizedObj; - - if ({}.toString.call(obj) === '[object Array]') { - stack.push(obj); - canonicalizedObj = exports.map(obj, function (item) { - return exports.canonicalize(item, stack); - }); - stack.pop(); - } else if (typeof obj === 'object' && obj !== null) { - stack.push(obj); - canonicalizedObj = {}; - exports.forEach(exports.keys(obj).sort(), function (key) { - canonicalizedObj[key] = exports.canonicalize(obj[key], stack); - }); - stack.pop(); - } else { - canonicalizedObj = obj; - } - - return canonicalizedObj; - }; - -/** - * Lookup file names at the given `path`. - */ -exports.lookupFiles = function lookupFiles(path, extensions, recursive) { - var files = []; - var re = new RegExp('\\.(' + extensions.join('|') + ')$'); - - if (!exists(path)) { - if (exists(path + '.js')) { - path += '.js'; - } else { - files = glob.sync(path); - if (!files.length) throw new Error("cannot resolve path (or pattern) '" + path + "'"); - return files; - } - } - - try { - var stat = fs.statSync(path); - if (stat.isFile()) return path; - } - catch (ignored) { - return; - } - - fs.readdirSync(path).forEach(function(file){ - file = join(path, file); - try { - var stat = fs.statSync(file); - if (stat.isDirectory()) { - if (recursive) { - files = files.concat(lookupFiles(file, extensions, recursive)); - } - return; - } - } - catch (ignored) { - return; - } - if (!stat.isFile() || !re.test(file) || basename(file)[0] === '.') return; - files.push(file); - }); - - return files; -}; - -}); // module: utils.js -// The global object is "self" in Web Workers. -var global = (function() { return this; })(); - -/** - * Save timer references to avoid Sinon interfering (see GH-237). - */ - -var Date = global.Date; -var setTimeout = global.setTimeout; -var setInterval = global.setInterval; -var clearTimeout = global.clearTimeout; -var clearInterval = global.clearInterval; - -/** - * Node shims. - * - * These are meant only to allow - * mocha.js to run untouched, not - * to allow running node code in - * the browser. - */ - -var process = {}; -process.exit = function(status){}; -process.stdout = {}; - -var uncaughtExceptionHandlers = []; - -var originalOnerrorHandler = global.onerror; - -/** - * Remove uncaughtException listener. - * Revert to original onerror handler if previously defined. - */ - -process.removeListener = function(e, fn){ - if ('uncaughtException' == e) { - if (originalOnerrorHandler) { - global.onerror = originalOnerrorHandler; - } else { - global.onerror = function() {}; - } - var i = Mocha.utils.indexOf(uncaughtExceptionHandlers, fn); - if (i != -1) { uncaughtExceptionHandlers.splice(i, 1); } - } -}; - -/** - * Implements uncaughtException listener. - */ - -process.on = function(e, fn){ - if ('uncaughtException' == e) { - global.onerror = function(err, url, line){ - fn(new Error(err + ' (' + url + ':' + line + ')')); - return true; - }; - uncaughtExceptionHandlers.push(fn); - } -}; - -/** - * Expose mocha. - */ - -var Mocha = global.Mocha = require('mocha'), - mocha = global.mocha = new Mocha({ reporter: 'html' }); - -// The BDD UI is registered by default, but no UI will be functional in the -// browser without an explicit call to the overridden `mocha.ui` (see below). -// Ensure that this default UI does not expose its methods to the global scope. -mocha.suite.removeAllListeners('pre-require'); - -var immediateQueue = [] - , immediateTimeout; - -function timeslice() { - var immediateStart = new Date().getTime(); - while (immediateQueue.length && (new Date().getTime() - immediateStart) < 100) { - immediateQueue.shift()(); - } - if (immediateQueue.length) { - immediateTimeout = setTimeout(timeslice, 0); - } else { - immediateTimeout = null; - } -} - -/** - * High-performance override of Runner.immediately. - */ - -Mocha.Runner.immediately = function(callback) { - immediateQueue.push(callback); - if (!immediateTimeout) { - immediateTimeout = setTimeout(timeslice, 0); - } -}; - -/** - * Function to allow assertion libraries to throw errors directly into mocha. - * This is useful when running tests in a browser because window.onerror will - * only receive the 'message' attribute of the Error. - */ -mocha.throwError = function(err) { - Mocha.utils.forEach(uncaughtExceptionHandlers, function (fn) { - fn(err); - }); - throw err; -}; - -/** - * Override ui to ensure that the ui functions are initialized. - * Normally this would happen in Mocha.prototype.loadFiles. - */ - -mocha.ui = function(ui){ - Mocha.prototype.ui.call(this, ui); - this.suite.emit('pre-require', global, null, this); - return this; -}; - -/** - * Setup mocha with the given setting options. - */ - -mocha.setup = function(opts){ - if ('string' == typeof opts) opts = { ui: opts }; - for (var opt in opts) this[opt](opts[opt]); - return this; -}; - -/** - * Run mocha, returning the Runner. - */ - -mocha.run = function(fn){ - var options = mocha.options; - mocha.globals('location'); - - var query = Mocha.utils.parseQuery(global.location.search || ''); - if (query.grep) mocha.grep(query.grep); - if (query.invert) mocha.invert(); - - return Mocha.prototype.run.call(mocha, function(err){ - // The DOM Document is not available in Web Workers. - var document = global.document; - if (document && document.getElementById('mocha') && options.noHighlighting !== true) { - Mocha.utils.highlightTags('code'); - } - if (fn) fn(err); - }); -}; - -/** - * Expose the process shim. - */ - -Mocha.process = process; -})(); \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js deleted file mode 100644 index 7ad9f8a2..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/dist/test/worker.js +++ /dev/null @@ -1,16 +0,0 @@ -importScripts('es6-promise.js'); -new ES6Promise.Promise(function(resolve, reject) { - self.onmessage = function (e) { - if (e.data === 'ping') { - resolve('pong'); - } else { - reject(new Error('wrong message')); - } - }; -}).then(function (result) { - self.postMessage(result); -}, function (err){ - setTimeout(function () { - throw err; - }); -}); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js deleted file mode 100644 index 5984f705..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise.umd.js +++ /dev/null @@ -1,18 +0,0 @@ -import Promise from './es6-promise/promise'; -import polyfill from './es6-promise/polyfill'; - -var ES6Promise = { - 'Promise': Promise, - 'polyfill': polyfill -}; - -/* global define:true module:true window: true */ -if (typeof define === 'function' && define['amd']) { - define(function() { return ES6Promise; }); -} else if (typeof module !== 'undefined' && module['exports']) { - module['exports'] = ES6Promise; -} else if (typeof this !== 'undefined') { - this['ES6Promise'] = ES6Promise; -} - -polyfill(); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js deleted file mode 100644 index daee2c38..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/-internal.js +++ /dev/null @@ -1,250 +0,0 @@ -import { - objectOrFunction, - isFunction -} from './utils'; - -import asap from './asap'; - -function noop() {} - -var PENDING = void 0; -var FULFILLED = 1; -var REJECTED = 2; - -var GET_THEN_ERROR = new ErrorObject(); - -function selfFullfillment() { - return new TypeError("You cannot resolve a promise with itself"); -} - -function cannotReturnOwn() { - return new TypeError('A promises callback cannot return that same promise.'); -} - -function getThen(promise) { - try { - return promise.then; - } catch(error) { - GET_THEN_ERROR.error = error; - return GET_THEN_ERROR; - } -} - -function tryThen(then, value, fulfillmentHandler, rejectionHandler) { - try { - then.call(value, fulfillmentHandler, rejectionHandler); - } catch(e) { - return e; - } -} - -function handleForeignThenable(promise, thenable, then) { - asap(function(promise) { - var sealed = false; - var error = tryThen(then, thenable, function(value) { - if (sealed) { return; } - sealed = true; - if (thenable !== value) { - resolve(promise, value); - } else { - fulfill(promise, value); - } - }, function(reason) { - if (sealed) { return; } - sealed = true; - - reject(promise, reason); - }, 'Settle: ' + (promise._label || ' unknown promise')); - - if (!sealed && error) { - sealed = true; - reject(promise, error); - } - }, promise); -} - -function handleOwnThenable(promise, thenable) { - if (thenable._state === FULFILLED) { - fulfill(promise, thenable._result); - } else if (thenable._state === REJECTED) { - reject(promise, thenable._result); - } else { - subscribe(thenable, undefined, function(value) { - resolve(promise, value); - }, function(reason) { - reject(promise, reason); - }); - } -} - -function handleMaybeThenable(promise, maybeThenable) { - if (maybeThenable.constructor === promise.constructor) { - handleOwnThenable(promise, maybeThenable); - } else { - var then = getThen(maybeThenable); - - if (then === GET_THEN_ERROR) { - reject(promise, GET_THEN_ERROR.error); - } else if (then === undefined) { - fulfill(promise, maybeThenable); - } else if (isFunction(then)) { - handleForeignThenable(promise, maybeThenable, then); - } else { - fulfill(promise, maybeThenable); - } - } -} - -function resolve(promise, value) { - if (promise === value) { - reject(promise, selfFullfillment()); - } else if (objectOrFunction(value)) { - handleMaybeThenable(promise, value); - } else { - fulfill(promise, value); - } -} - -function publishRejection(promise) { - if (promise._onerror) { - promise._onerror(promise._result); - } - - publish(promise); -} - -function fulfill(promise, value) { - if (promise._state !== PENDING) { return; } - - promise._result = value; - promise._state = FULFILLED; - - if (promise._subscribers.length !== 0) { - asap(publish, promise); - } -} - -function reject(promise, reason) { - if (promise._state !== PENDING) { return; } - promise._state = REJECTED; - promise._result = reason; - - asap(publishRejection, promise); -} - -function subscribe(parent, child, onFulfillment, onRejection) { - var subscribers = parent._subscribers; - var length = subscribers.length; - - parent._onerror = null; - - subscribers[length] = child; - subscribers[length + FULFILLED] = onFulfillment; - subscribers[length + REJECTED] = onRejection; - - if (length === 0 && parent._state) { - asap(publish, parent); - } -} - -function publish(promise) { - var subscribers = promise._subscribers; - var settled = promise._state; - - if (subscribers.length === 0) { return; } - - var child, callback, detail = promise._result; - - for (var i = 0; i < subscribers.length; i += 3) { - child = subscribers[i]; - callback = subscribers[i + settled]; - - if (child) { - invokeCallback(settled, child, callback, detail); - } else { - callback(detail); - } - } - - promise._subscribers.length = 0; -} - -function ErrorObject() { - this.error = null; -} - -var TRY_CATCH_ERROR = new ErrorObject(); - -function tryCatch(callback, detail) { - try { - return callback(detail); - } catch(e) { - TRY_CATCH_ERROR.error = e; - return TRY_CATCH_ERROR; - } -} - -function invokeCallback(settled, promise, callback, detail) { - var hasCallback = isFunction(callback), - value, error, succeeded, failed; - - if (hasCallback) { - value = tryCatch(callback, detail); - - if (value === TRY_CATCH_ERROR) { - failed = true; - error = value.error; - value = null; - } else { - succeeded = true; - } - - if (promise === value) { - reject(promise, cannotReturnOwn()); - return; - } - - } else { - value = detail; - succeeded = true; - } - - if (promise._state !== PENDING) { - // noop - } else if (hasCallback && succeeded) { - resolve(promise, value); - } else if (failed) { - reject(promise, error); - } else if (settled === FULFILLED) { - fulfill(promise, value); - } else if (settled === REJECTED) { - reject(promise, value); - } -} - -function initializePromise(promise, resolver) { - try { - resolver(function resolvePromise(value){ - resolve(promise, value); - }, function rejectPromise(reason) { - reject(promise, reason); - }); - } catch(e) { - reject(promise, e); - } -} - -export { - noop, - resolve, - reject, - fulfill, - subscribe, - publish, - publishRejection, - initializePromise, - invokeCallback, - FULFILLED, - REJECTED, - PENDING -}; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js deleted file mode 100644 index 4f7dcee2..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/asap.js +++ /dev/null @@ -1,111 +0,0 @@ -var len = 0; -var toString = {}.toString; -var vertxNext; -export default function asap(callback, arg) { - queue[len] = callback; - queue[len + 1] = arg; - len += 2; - if (len === 2) { - // If len is 2, that means that we need to schedule an async flush. - // If additional callbacks are queued before the queue is flushed, they - // will be processed by this flush that we are scheduling. - scheduleFlush(); - } -} - -var browserWindow = (typeof window !== 'undefined') ? window : undefined; -var browserGlobal = browserWindow || {}; -var BrowserMutationObserver = browserGlobal.MutationObserver || browserGlobal.WebKitMutationObserver; -var isNode = typeof process !== 'undefined' && {}.toString.call(process) === '[object process]'; - -// test for web worker but not in IE10 -var isWorker = typeof Uint8ClampedArray !== 'undefined' && - typeof importScripts !== 'undefined' && - typeof MessageChannel !== 'undefined'; - -// node -function useNextTick() { - var nextTick = process.nextTick; - // node version 0.10.x displays a deprecation warning when nextTick is used recursively - // setImmediate should be used instead instead - var version = process.versions.node.match(/^(?:(\d+)\.)?(?:(\d+)\.)?(\*|\d+)$/); - if (Array.isArray(version) && version[1] === '0' && version[2] === '10') { - nextTick = setImmediate; - } - return function() { - nextTick(flush); - }; -} - -// vertx -function useVertxTimer() { - return function() { - vertxNext(flush); - }; -} - -function useMutationObserver() { - var iterations = 0; - var observer = new BrowserMutationObserver(flush); - var node = document.createTextNode(''); - observer.observe(node, { characterData: true }); - - return function() { - node.data = (iterations = ++iterations % 2); - }; -} - -// web worker -function useMessageChannel() { - var channel = new MessageChannel(); - channel.port1.onmessage = flush; - return function () { - channel.port2.postMessage(0); - }; -} - -function useSetTimeout() { - return function() { - setTimeout(flush, 1); - }; -} - -var queue = new Array(1000); -function flush() { - for (var i = 0; i < len; i+=2) { - var callback = queue[i]; - var arg = queue[i+1]; - - callback(arg); - - queue[i] = undefined; - queue[i+1] = undefined; - } - - len = 0; -} - -function attemptVertex() { - try { - var r = require; - var vertx = r('vertx'); - vertxNext = vertx.runOnLoop || vertx.runOnContext; - return useVertxTimer(); - } catch(e) { - return useSetTimeout(); - } -} - -var scheduleFlush; -// Decide what async method to use to triggering processing of queued callbacks: -if (isNode) { - scheduleFlush = useNextTick(); -} else if (BrowserMutationObserver) { - scheduleFlush = useMutationObserver(); -} else if (isWorker) { - scheduleFlush = useMessageChannel(); -} else if (browserWindow === undefined && typeof require === 'function') { - scheduleFlush = attemptVertex(); -} else { - scheduleFlush = useSetTimeout(); -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js deleted file mode 100644 index 03fdf8c1..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/enumerator.js +++ /dev/null @@ -1,113 +0,0 @@ -import { - isArray, - isMaybeThenable -} from './utils'; - -import { - noop, - reject, - fulfill, - subscribe, - FULFILLED, - REJECTED, - PENDING -} from './-internal'; - -function Enumerator(Constructor, input) { - var enumerator = this; - - enumerator._instanceConstructor = Constructor; - enumerator.promise = new Constructor(noop); - - if (enumerator._validateInput(input)) { - enumerator._input = input; - enumerator.length = input.length; - enumerator._remaining = input.length; - - enumerator._init(); - - if (enumerator.length === 0) { - fulfill(enumerator.promise, enumerator._result); - } else { - enumerator.length = enumerator.length || 0; - enumerator._enumerate(); - if (enumerator._remaining === 0) { - fulfill(enumerator.promise, enumerator._result); - } - } - } else { - reject(enumerator.promise, enumerator._validationError()); - } -} - -Enumerator.prototype._validateInput = function(input) { - return isArray(input); -}; - -Enumerator.prototype._validationError = function() { - return new Error('Array Methods must be provided an Array'); -}; - -Enumerator.prototype._init = function() { - this._result = new Array(this.length); -}; - -export default Enumerator; - -Enumerator.prototype._enumerate = function() { - var enumerator = this; - - var length = enumerator.length; - var promise = enumerator.promise; - var input = enumerator._input; - - for (var i = 0; promise._state === PENDING && i < length; i++) { - enumerator._eachEntry(input[i], i); - } -}; - -Enumerator.prototype._eachEntry = function(entry, i) { - var enumerator = this; - var c = enumerator._instanceConstructor; - - if (isMaybeThenable(entry)) { - if (entry.constructor === c && entry._state !== PENDING) { - entry._onerror = null; - enumerator._settledAt(entry._state, i, entry._result); - } else { - enumerator._willSettleAt(c.resolve(entry), i); - } - } else { - enumerator._remaining--; - enumerator._result[i] = entry; - } -}; - -Enumerator.prototype._settledAt = function(state, i, value) { - var enumerator = this; - var promise = enumerator.promise; - - if (promise._state === PENDING) { - enumerator._remaining--; - - if (state === REJECTED) { - reject(promise, value); - } else { - enumerator._result[i] = value; - } - } - - if (enumerator._remaining === 0) { - fulfill(promise, enumerator._result); - } -}; - -Enumerator.prototype._willSettleAt = function(promise, i) { - var enumerator = this; - - subscribe(promise, undefined, function(value) { - enumerator._settledAt(FULFILLED, i, value); - }, function(reason) { - enumerator._settledAt(REJECTED, i, reason); - }); -}; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js deleted file mode 100644 index 6696dfc6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/polyfill.js +++ /dev/null @@ -1,26 +0,0 @@ -/*global self*/ -import Promise from './promise'; - -export default function polyfill() { - var local; - - if (typeof global !== 'undefined') { - local = global; - } else if (typeof self !== 'undefined') { - local = self; - } else { - try { - local = Function('return this')(); - } catch (e) { - throw new Error('polyfill failed because global object is unavailable in this environment'); - } - } - - var P = local.Promise; - - if (P && Object.prototype.toString.call(P.resolve()) === '[object Promise]' && !P.cast) { - return; - } - - local.Promise = Promise; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js deleted file mode 100644 index 78fe2ca0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise.js +++ /dev/null @@ -1,408 +0,0 @@ -import { - isFunction -} from './utils'; - -import { - noop, - subscribe, - initializePromise, - invokeCallback, - FULFILLED, - REJECTED -} from './-internal'; - -import asap from './asap'; - -import all from './promise/all'; -import race from './promise/race'; -import Resolve from './promise/resolve'; -import Reject from './promise/reject'; - -var counter = 0; - -function needsResolver() { - throw new TypeError('You must pass a resolver function as the first argument to the promise constructor'); -} - -function needsNew() { - throw new TypeError("Failed to construct 'Promise': Please use the 'new' operator, this object constructor cannot be called as a function."); -} - -export default Promise; -/** - Promise objects represent the eventual result of an asynchronous operation. The - primary way of interacting with a promise is through its `then` method, which - registers callbacks to receive either a promise’s eventual value or the reason - why the promise cannot be fulfilled. - - Terminology - ----------- - - - `promise` is an object or function with a `then` method whose behavior conforms to this specification. - - `thenable` is an object or function that defines a `then` method. - - `value` is any legal JavaScript value (including undefined, a thenable, or a promise). - - `exception` is a value that is thrown using the throw statement. - - `reason` is a value that indicates why a promise was rejected. - - `settled` the final resting state of a promise, fulfilled or rejected. - - A promise can be in one of three states: pending, fulfilled, or rejected. - - Promises that are fulfilled have a fulfillment value and are in the fulfilled - state. Promises that are rejected have a rejection reason and are in the - rejected state. A fulfillment value is never a thenable. - - Promises can also be said to *resolve* a value. If this value is also a - promise, then the original promise's settled state will match the value's - settled state. So a promise that *resolves* a promise that rejects will - itself reject, and a promise that *resolves* a promise that fulfills will - itself fulfill. - - - Basic Usage: - ------------ - - ```js - var promise = new Promise(function(resolve, reject) { - // on success - resolve(value); - - // on failure - reject(reason); - }); - - promise.then(function(value) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Advanced Usage: - --------------- - - Promises shine when abstracting away asynchronous interactions such as - `XMLHttpRequest`s. - - ```js - function getJSON(url) { - return new Promise(function(resolve, reject){ - var xhr = new XMLHttpRequest(); - - xhr.open('GET', url); - xhr.onreadystatechange = handler; - xhr.responseType = 'json'; - xhr.setRequestHeader('Accept', 'application/json'); - xhr.send(); - - function handler() { - if (this.readyState === this.DONE) { - if (this.status === 200) { - resolve(this.response); - } else { - reject(new Error('getJSON: `' + url + '` failed with status: [' + this.status + ']')); - } - } - }; - }); - } - - getJSON('/posts.json').then(function(json) { - // on fulfillment - }, function(reason) { - // on rejection - }); - ``` - - Unlike callbacks, promises are great composable primitives. - - ```js - Promise.all([ - getJSON('/posts'), - getJSON('/comments') - ]).then(function(values){ - values[0] // => postsJSON - values[1] // => commentsJSON - - return values; - }); - ``` - - @class Promise - @param {function} resolver - Useful for tooling. - @constructor -*/ -function Promise(resolver) { - this._id = counter++; - this._state = undefined; - this._result = undefined; - this._subscribers = []; - - if (noop !== resolver) { - if (!isFunction(resolver)) { - needsResolver(); - } - - if (!(this instanceof Promise)) { - needsNew(); - } - - initializePromise(this, resolver); - } -} - -Promise.all = all; -Promise.race = race; -Promise.resolve = Resolve; -Promise.reject = Reject; - -Promise.prototype = { - constructor: Promise, - -/** - The primary way of interacting with a promise is through its `then` method, - which registers callbacks to receive either a promise's eventual value or the - reason why the promise cannot be fulfilled. - - ```js - findUser().then(function(user){ - // user is available - }, function(reason){ - // user is unavailable, and you are given the reason why - }); - ``` - - Chaining - -------- - - The return value of `then` is itself a promise. This second, 'downstream' - promise is resolved with the return value of the first promise's fulfillment - or rejection handler, or rejected if the handler throws an exception. - - ```js - findUser().then(function (user) { - return user.name; - }, function (reason) { - return 'default name'; - }).then(function (userName) { - // If `findUser` fulfilled, `userName` will be the user's name, otherwise it - // will be `'default name'` - }); - - findUser().then(function (user) { - throw new Error('Found user, but still unhappy'); - }, function (reason) { - throw new Error('`findUser` rejected and we're unhappy'); - }).then(function (value) { - // never reached - }, function (reason) { - // if `findUser` fulfilled, `reason` will be 'Found user, but still unhappy'. - // If `findUser` rejected, `reason` will be '`findUser` rejected and we're unhappy'. - }); - ``` - If the downstream promise does not specify a rejection handler, rejection reasons will be propagated further downstream. - - ```js - findUser().then(function (user) { - throw new PedagogicalException('Upstream error'); - }).then(function (value) { - // never reached - }).then(function (value) { - // never reached - }, function (reason) { - // The `PedgagocialException` is propagated all the way down to here - }); - ``` - - Assimilation - ------------ - - Sometimes the value you want to propagate to a downstream promise can only be - retrieved asynchronously. This can be achieved by returning a promise in the - fulfillment or rejection handler. The downstream promise will then be pending - until the returned promise is settled. This is called *assimilation*. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // The user's comments are now available - }); - ``` - - If the assimliated promise rejects, then the downstream promise will also reject. - - ```js - findUser().then(function (user) { - return findCommentsByAuthor(user); - }).then(function (comments) { - // If `findCommentsByAuthor` fulfills, we'll have the value here - }, function (reason) { - // If `findCommentsByAuthor` rejects, we'll have the reason here - }); - ``` - - Simple Example - -------------- - - Synchronous Example - - ```javascript - var result; - - try { - result = findResult(); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - findResult(function(result, err){ - if (err) { - // failure - } else { - // success - } - }); - ``` - - Promise Example; - - ```javascript - findResult().then(function(result){ - // success - }, function(reason){ - // failure - }); - ``` - - Advanced Example - -------------- - - Synchronous Example - - ```javascript - var author, books; - - try { - author = findAuthor(); - books = findBooksByAuthor(author); - // success - } catch(reason) { - // failure - } - ``` - - Errback Example - - ```js - - function foundBooks(books) { - - } - - function failure(reason) { - - } - - findAuthor(function(author, err){ - if (err) { - failure(err); - // failure - } else { - try { - findBoooksByAuthor(author, function(books, err) { - if (err) { - failure(err); - } else { - try { - foundBooks(books); - } catch(reason) { - failure(reason); - } - } - }); - } catch(error) { - failure(err); - } - // success - } - }); - ``` - - Promise Example; - - ```javascript - findAuthor(). - then(findBooksByAuthor). - then(function(books){ - // found books - }).catch(function(reason){ - // something went wrong - }); - ``` - - @method then - @param {Function} onFulfilled - @param {Function} onRejected - Useful for tooling. - @return {Promise} -*/ - then: function(onFulfillment, onRejection) { - var parent = this; - var state = parent._state; - - if (state === FULFILLED && !onFulfillment || state === REJECTED && !onRejection) { - return this; - } - - var child = new this.constructor(noop); - var result = parent._result; - - if (state) { - var callback = arguments[state - 1]; - asap(function(){ - invokeCallback(state, child, callback, result); - }); - } else { - subscribe(parent, child, onFulfillment, onRejection); - } - - return child; - }, - -/** - `catch` is simply sugar for `then(undefined, onRejection)` which makes it the same - as the catch block of a try/catch statement. - - ```js - function findAuthor(){ - throw new Error('couldn't find that author'); - } - - // synchronous - try { - findAuthor(); - } catch(reason) { - // something went wrong - } - - // async with promises - findAuthor().catch(function(reason){ - // something went wrong - }); - ``` - - @method catch - @param {Function} onRejection - Useful for tooling. - @return {Promise} -*/ - 'catch': function(onRejection) { - return this.then(null, onRejection); - } -}; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js deleted file mode 100644 index 03033f0d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/all.js +++ /dev/null @@ -1,52 +0,0 @@ -import Enumerator from '../enumerator'; - -/** - `Promise.all` accepts an array of promises, and returns a new promise which - is fulfilled with an array of fulfillment values for the passed promises, or - rejected with the reason of the first passed promise to be rejected. It casts all - elements of the passed iterable to promises as it runs this algorithm. - - Example: - - ```javascript - var promise1 = resolve(1); - var promise2 = resolve(2); - var promise3 = resolve(3); - var promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // The array here would be [ 1, 2, 3 ]; - }); - ``` - - If any of the `promises` given to `all` are rejected, the first promise - that is rejected will be given as an argument to the returned promises's - rejection handler. For example: - - Example: - - ```javascript - var promise1 = resolve(1); - var promise2 = reject(new Error("2")); - var promise3 = reject(new Error("3")); - var promises = [ promise1, promise2, promise3 ]; - - Promise.all(promises).then(function(array){ - // Code here never runs because there are rejected promises! - }, function(error) { - // error.message === "2" - }); - ``` - - @method all - @static - @param {Array} entries array of promises - @param {String} label optional string for labeling the promise. - Useful for tooling. - @return {Promise} promise that is fulfilled when all `promises` have been - fulfilled, or rejected if any of them become rejected. - @static -*/ -export default function all(entries) { - return new Enumerator(this, entries).promise; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js deleted file mode 100644 index 0d7ff133..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/race.js +++ /dev/null @@ -1,104 +0,0 @@ -import { - isArray -} from "../utils"; - -import { - noop, - resolve, - reject, - subscribe, - PENDING -} from '../-internal'; - -/** - `Promise.race` returns a new promise which is settled in the same way as the - first passed promise to settle. - - Example: - - ```javascript - var promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - var promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 2'); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // result === 'promise 2' because it was resolved before promise1 - // was resolved. - }); - ``` - - `Promise.race` is deterministic in that only the state of the first - settled promise matters. For example, even if other promises given to the - `promises` array argument are resolved, but the first settled promise has - become rejected before the other promises became fulfilled, the returned - promise will become rejected: - - ```javascript - var promise1 = new Promise(function(resolve, reject){ - setTimeout(function(){ - resolve('promise 1'); - }, 200); - }); - - var promise2 = new Promise(function(resolve, reject){ - setTimeout(function(){ - reject(new Error('promise 2')); - }, 100); - }); - - Promise.race([promise1, promise2]).then(function(result){ - // Code here never runs - }, function(reason){ - // reason.message === 'promise 2' because promise 2 became rejected before - // promise 1 became fulfilled - }); - ``` - - An example real-world use case is implementing timeouts: - - ```javascript - Promise.race([ajax('foo.json'), timeout(5000)]) - ``` - - @method race - @static - @param {Array} promises array of promises to observe - Useful for tooling. - @return {Promise} a promise which settles in the same way as the first passed - promise to settle. -*/ -export default function race(entries) { - /*jshint validthis:true */ - var Constructor = this; - - var promise = new Constructor(noop); - - if (!isArray(entries)) { - reject(promise, new TypeError('You must pass an array to race.')); - return promise; - } - - var length = entries.length; - - function onFulfillment(value) { - resolve(promise, value); - } - - function onRejection(reason) { - reject(promise, reason); - } - - for (var i = 0; promise._state === PENDING && i < length; i++) { - subscribe(Constructor.resolve(entries[i]), undefined, onFulfillment, onRejection); - } - - return promise; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js deleted file mode 100644 index 63b86cba..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/reject.js +++ /dev/null @@ -1,46 +0,0 @@ -import { - noop, - reject as _reject -} from '../-internal'; - -/** - `Promise.reject` returns a promise rejected with the passed `reason`. - It is shorthand for the following: - - ```javascript - var promise = new Promise(function(resolve, reject){ - reject(new Error('WHOOPS')); - }); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = Promise.reject(new Error('WHOOPS')); - - promise.then(function(value){ - // Code here doesn't run because the promise is rejected! - }, function(reason){ - // reason.message === 'WHOOPS' - }); - ``` - - @method reject - @static - @param {Any} reason value that the returned promise will be rejected with. - Useful for tooling. - @return {Promise} a promise rejected with the given `reason`. -*/ -export default function reject(reason) { - /*jshint validthis:true */ - var Constructor = this; - var promise = new Constructor(noop); - _reject(promise, reason); - return promise; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js deleted file mode 100644 index 201a545d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/promise/resolve.js +++ /dev/null @@ -1,48 +0,0 @@ -import { - noop, - resolve as _resolve -} from '../-internal'; - -/** - `Promise.resolve` returns a promise that will become resolved with the - passed `value`. It is shorthand for the following: - - ```javascript - var promise = new Promise(function(resolve, reject){ - resolve(1); - }); - - promise.then(function(value){ - // value === 1 - }); - ``` - - Instead of writing the above, your code now simply becomes the following: - - ```javascript - var promise = Promise.resolve(1); - - promise.then(function(value){ - // value === 1 - }); - ``` - - @method resolve - @static - @param {Any} value value that the returned promise will be resolved with - Useful for tooling. - @return {Promise} a promise that will become fulfilled with the given - `value` -*/ -export default function resolve(object) { - /*jshint validthis:true */ - var Constructor = this; - - if (object && typeof object === 'object' && object.constructor === Constructor) { - return object; - } - - var promise = new Constructor(noop); - _resolve(promise, object); - return promise; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js deleted file mode 100644 index 31ec6f9c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/lib/es6-promise/utils.js +++ /dev/null @@ -1,22 +0,0 @@ -export function objectOrFunction(x) { - return typeof x === 'function' || (typeof x === 'object' && x !== null); -} - -export function isFunction(x) { - return typeof x === 'function'; -} - -export function isMaybeThenable(x) { - return typeof x === 'object' && x !== null; -} - -var _isArray; -if (!Array.isArray) { - _isArray = function (x) { - return Object.prototype.toString.call(x) === '[object Array]'; - }; -} else { - _isArray = Array.isArray; -} - -export var isArray = _isArray; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json deleted file mode 100644 index 6fc9a802..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/es6-promise/package.json +++ /dev/null @@ -1,88 +0,0 @@ -{ - "name": "es6-promise", - "namespace": "es6-promise", - "version": "2.1.1", - "description": "A lightweight library that provides tools for organizing asynchronous code", - "main": "dist/es6-promise.js", - "directories": { - "lib": "lib" - }, - "files": [ - "dist", - "lib" - ], - "devDependencies": { - "bower": "^1.3.9", - "brfs": "0.0.8", - "broccoli-es3-safe-recast": "0.0.8", - "broccoli-es6-module-transpiler": "^0.5.0", - "broccoli-jshint": "^0.5.1", - "broccoli-merge-trees": "^0.1.4", - "broccoli-replace": "^0.2.0", - "broccoli-stew": "0.0.6", - "broccoli-uglify-js": "^0.1.3", - "broccoli-watchify": "^0.2.0", - "ember-cli": "^0.2.2", - "ember-publisher": "0.0.7", - "git-repo-version": "0.0.2", - "json3": "^3.3.2", - "minimatch": "^2.0.1", - "mocha": "^1.20.1", - "promises-aplus-tests-phantom": "^2.1.0-revise", - "release-it": "0.0.10" - }, - "scripts": { - "build": "ember build", - "start": "ember s", - "test": "ember test", - "test:server": "ember test --server", - "test:node": "ember build && mocha ./dist/test/browserify", - "lint": "jshint lib", - "prepublish": "ember build --environment production", - "dry-run-release": "ember build --environment production && release-it --dry-run --non-interactive" - }, - "repository": { - "type": "git", - "url": "git://github.com/jakearchibald/ES6-Promises.git" - }, - "bugs": { - "url": "https://github.com/jakearchibald/ES6-Promises/issues" - }, - "browser": { - "vertx": false - }, - "keywords": [ - "promises", - "futures" - ], - "author": { - "name": "Yehuda Katz, Tom Dale, Stefan Penner and contributors", - "url": "Conversion to ES6 API by Jake Archibald" - }, - "license": "MIT", - "spm": { - "main": "dist/es6-promise.js" - }, - "gitHead": "02cf697c50856f0cd3785f425a2cf819af0e521c", - "homepage": "https://github.com/jakearchibald/ES6-Promises", - "_id": "es6-promise@2.1.1", - "_shasum": "03e8f3c7297928e5478d6ab1d0643251507bdedd", - "_from": "es6-promise@2.1.1", - "_npmVersion": "2.5.1", - "_nodeVersion": "0.12.1", - "_npmUser": { - "name": "jaffathecake", - "email": "jaffathecake@gmail.com" - }, - "maintainers": [ - { - "name": "jaffathecake", - "email": "jaffathecake@gmail.com" - } - ], - "dist": { - "shasum": "03e8f3c7297928e5478d6ab1d0643251507bdedd", - "tarball": "http://registry.npmjs.org/es6-promise/-/es6-promise-2.1.1.tgz" - }, - "_resolved": "https://registry.npmjs.org/es6-promise/-/es6-promise-2.1.1.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md deleted file mode 100644 index a21da872..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/HISTORY.md +++ /dev/null @@ -1,246 +0,0 @@ -1.2.14 09-28-2015 ------------------ -- NODE-547 only emit error if there are any listeners. -- Fixed APM issue with issuing readConcern. - -1.2.13 09-18-2015 ------------------ -- Added BSON serializer ignoreUndefined option for insert/update/remove/command/cursor. - -1.2.12 09-08-2015 ------------------ -- NODE-541 Added initial support for readConcern. - -1.2.11 08-31-2015 ------------------ -- NODE-535 If connectWithNoPrimary is true then primary-only connection is not allowed. -- NODE-534 Passive secondaries are not allowed for secondaryOnlyConnectionAllowed. -- Fixed filtering bug for logging (Issue 30, https://github.com/christkv/mongodb-core/issues/30). - -1.2.10 08-14-2015 ------------------ -- Added missing Mongos.prototype.parserType function. - -1.2.9 08-05-2015 ----------------- -- NODE-525 Reset connectionTimeout after it's overwritten by tls.connect. -- NODE-518 connectTimeoutMS is doubled in 2.0.39. - -1.2.8 07-24-2015 ------------------ -- Minor fix to handle 2.4.x errors better by correctly return driver layer issues. - -1.2.7 07-16-2015 ------------------ -- Refactoring to allow to tap into find/getmore/killcursor in cursors for APM monitoring in driver. - -1.2.6 07-14-2015 ------------------ -- NODE-505 Query fails to find records that have a 'result' property with an array value. - -1.2.5 07-14-2015 ------------------ -- NODE-492 correctly handle hanging replicaset monitoring connections when server is unavailable due to network partitions or firewalls dropping packets, configureable using the connectionTimeoutMS setting. - -1.2.4 07-07-2015 ------------------ -- NODE-493 staggering the socket connections to avoid overwhelming the mongod process. - -1.2.3 06-26-2015 ------------------ -- Minor bug fixes. - -1.2.2 06-22-2015 ------------------ -- Fix issue with SCRAM authentication causing authentication to return true on failed authentication (Issue 26, https://github.com/cglass17). - -1.2.1 06-17-2015 ------------------ -- Ensure serializeFunctions passed down correctly to wire protocol. - -1.2.0 06-17-2015 ------------------ -- Switching to using the 0.4.x pure JS serializer, removing dependency on C++ parser. -- Refactoring wire protocol messages to avoid expensive size calculations of documents in favor of writing out an array of buffers to the sockets. -- NODE-486 fixed issue related to limit and skip when calling toArray in 2.0 driver. -- NODE-483 throw error if capabilities of topology is queries before topology has performed connection setup. -- NODE-487 fixed issue where killcursor command was not being sent correctly on limit and skip queries. - -1.1.33 05-31-2015 ------------------ -- NODE-478 Work around authentication race condition in mongos authentication due to multi step authentication methods like SCRAM. - -1.1.32 05-20-2015 ------------------ -- After reconnect, it updates the allowable reconnect retries to the option settings (Issue #23, https://github.com/owenallenaz) - -1.1.31 05-19-2015 ------------------ -- Minor fixes for issues with re-authentication of mongos. - -1.1.30 05-18-2015 ------------------ -- Correctly emit 'all' event when primary + all secondaries have connected. - -1.1.29 05-17-2015 ------------------ -- NODE-464 Only use a single socket against arbiters and hidden servers. -- Ensure we filter out hidden servers from any server queries. - -1.1.28 05-12-2015 ------------------ -- Fixed buffer compare for electionId for < node 12.0.2 - -1.1.27 05-12-2015 ------------------ -- NODE-455 Update SDAM specification support to cover electionId and Mongos load balancing. - -1.1.26 05-06-2015 ------------------ -- NODE-456 Allow mongodb-core to pipeline commands (ex findAndModify+GLE) along the same connection and handle the returned results. -- Fixes to make mongodb-core work for node 0.8.x when using scram and setImmediate. - -1.1.25 04-24-2015 ------------------ -- Handle lack of callback in crud operations when returning error on application closed. - -1.1.24 04-22-2015 ------------------ -- Error out when topology has been destroyed either by connection retries being exhausted or destroy called on topology. - -1.1.23 04-15-2015 ------------------ -- Standardizing mongoErrors and its API (Issue #14) -- Creating a new connection is slow because of 100ms setTimeout() (Issue #17, https://github.com/vkarpov15) -- remove mkdirp and rimraf dependencies (Issue #12) -- Updated default value of param options.rejectUnauthorized to match documentation (Issue #16) -- ISSUE: NODE-417 Resolution. Improving behavior of thrown errors (Issue #14, https://github.com/owenallenaz) -- Fix cursor hanging when next() called on exhausted cursor (Issue #18, https://github.com/vkarpov15) - -1.1.22 04-10-2015 ------------------ -- Minor refactorings in cursor code to make extending the cursor simpler. -- NODE-417 Resolution. Improving behavior of thrown errors using Error.captureStackTrace. - -1.1.21 03-26-2015 ------------------ -- Updated bson module to 0.3.0 that extracted the c++ parser into bson-ext and made it an optional dependency. - -1.1.20 03-24-2015 ------------------ -- NODE-395 Socket Not Closing, db.close called before full set finished initalizing leading to server connections in progress not being closed properly. - -1.1.19 03-21-2015 ------------------ -- Made kerberos module ~0.0 to allow for quicker releases due to io.js of kerberos module. - -1.1.18 03-17-2015 ------------------ -- Added support for minHeartbeatFrequencyMS on server reconnect according to the SDAM specification. - -1.1.17 03-16-2015 ------------------ -- NODE-377, fixed issue where tags would correctly be checked on secondary and nearest to filter out eligible server candidates. - -1.1.16 03-06-2015 ------------------ -- rejectUnauthorized parameter is set to true for ssl certificates by default instead of false. - -1.1.15 03-04-2015 ------------------ -- Removed check for type in replset pickserver function. - -1.1.14 02-26-2015 ------------------ -- NODE-374 correctly adding passive secondaries to the list of eligable servers for reads - -1.1.13 02-24-2015 ------------------ -- NODE-365 mongoDB native node.js driver infinite reconnect attempts (fixed issue around handling of retry attempts) - -1.1.12 02-16-2015 ------------------ -- Fixed cursor transforms for buffered document reads from cursor. - -1.1.11 02-02-2015 ------------------ -- Remove the required setName for replicaset connections, if not set it will pick the first setName returned. - -1.1.10 31-01-2015 ------------------ -- Added tranforms.doc option to cursor to allow for pr. document transformations. - -1.1.9 21-01-2015 ----------------- -- Updated BSON dependency to 0.2.18 to fix issues with io.js and node. -- Updated Kerberos dependency to 0.0.8 to fix issues with io.js and node. -- Don't treat findOne() as a command cursor. -- Refactored out state changes into methods to simplify read the next method. - -1.1.8 09-12-2015 ----------------- -- Stripped out Object.defineProperty for performance reasons -- Applied more performance optimizations. -- properties cursorBatchSize, cursorSkip, cursorLimit are not methods setCursorBatchSize/cursorBatchSize, setCursorSkip/cursorSkip, setCursorLimit/cursorLimit - -1.1.7 18-12-2014 ----------------- -- Use ns variable for getMore commands for command cursors to work properly with cursor version of listCollections and listIndexes. - -1.1.6 18-12-2014 ----------------- -- Server manager fixed to support 2.2.X servers for travis test matrix. - -1.1.5 17-12-2014 ----------------- -- Fall back to errmsg when creating MongoError for command errors - -1.1.4 17-12-2014 ----------------- -- Added transform method support for cursor (initially just for initial query results) to support listCollections/listIndexes in 2.8. -- Fixed variable leak in scram. -- Fixed server manager to deal better with killing processes. -- Bumped bson to 0.2.16. - -1.1.3 01-12-2014 ----------------- -- Fixed error handling issue with nonce generation in mongocr. -- Fixed issues with restarting servers when using ssl. -- Using strict for all classes. -- Cleaned up any escaping global variables. - -1.1.2 20-11-2014 ----------------- -- Correctly encoding UTF8 collection names on wire protocol messages. -- Added emitClose parameter to topology destroy methods to allow users to specify that they wish the topology to emit the close event to any listeners. - -1.1.1 14-11-2014 ----------------- -- Refactored code to use prototype instead of privileged methods. -- Fixed issue with auth where a runtime condition could leave replicaset members without proper authentication. -- Several deopt optimizations for v8 to improve performance and reduce GC pauses. - -1.0.5 29-10-2014 ----------------- -- Fixed issue with wrong namespace being created for command cursors. - -1.0.4 24-10-2014 ----------------- -- switched from using shift for the cursor due to bad slowdown on big batchSizes as shift causes entire array to be copied on each call. - -1.0.3 21-10-2014 ----------------- -- fixed error issuing problem on cursor.next when iterating over a huge dataset with a very small batchSize. - -1.0.2 07-10-2014 ----------------- -- fullsetup is now defined as a primary and secondary being available allowing for all read preferences to be satisfied. -- fixed issue with replset_state logging. - -1.0.1 07-10-2014 ----------------- -- Dependency issue solved - -1.0.0 07-10-2014 ----------------- -- Initial release of mongodb-core diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE deleted file mode 100644 index ad410e11..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ -Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "{}" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright {yyyy} {name of copyright owner} - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile deleted file mode 100644 index 36e12024..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -NODE = node -NPM = npm -JSDOC = jsdoc -name = all - -generate_docs: - # cp -R ./HISTORY.md ./docs/content/meta/release-notes.md - hugo -s docs/reference -d ../../public - $(JSDOC) -c conf.json -t docs/jsdoc-template/ -d ./public/api - cp -R ./public/api/scripts ./public/. - cp -R ./public/api/styles ./public/. diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md deleted file mode 100644 index 1c9e4c84..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/README.md +++ /dev/null @@ -1,225 +0,0 @@ -# Description - -The MongoDB Core driver is the low level part of the 2.0 or higher MongoDB driver and is meant for library developers not end users. It does not contain any abstractions or helpers outside of the basic management of MongoDB topology connections, CRUD operations and authentication. - -## MongoDB Node.JS Core Driver - -| what | where | -|---------------|------------------------------------------------| -| documentation | http://mongodb.github.io/node-mongodb-native/ | -| apidoc | http://mongodb.github.io/node-mongodb-native/ | -| source | https://github.com/christkv/mongodb-core | -| mongodb | http://www.mongodb.org/ | - -### Blogs of Engineers involved in the driver -- Christian Kvalheim [@christkv](https://twitter.com/christkv) - -### Bugs / Feature Requests - -Think you’ve found a bug? Want to see a new feature in node-mongodb-native? Please open a -case in our issue management tool, JIRA: - -- Create an account and login . -- Navigate to the NODE project . -- Click **Create Issue** - Please provide as much information as possible about the issue type and how to reproduce it. - -Bug reports in JIRA for all driver projects (i.e. NODE, PYTHON, CSHARP, JAVA) and the -Core Server (i.e. SERVER) project are **public**. - -### Questions and Bug Reports - - * mailing list: https://groups.google.com/forum/#!forum/node-mongodb-native - * jira: http://jira.mongodb.org/ - -### Change Log - -http://jira.mongodb.org/browse/NODE - -# QuickStart - -The quick start guide will show you how to set up a simple application using Core driver and MongoDB. It scope is only how to set up the driver and perform the simple crud operations. For more inn depth coverage we encourage reading the tutorials. - -## Create the package.json file - -Let's create a directory where our application will live. In our case we will put this under our projects directory. - -``` -mkdir myproject -cd myproject -``` - -Create a **package.json** using your favorite text editor and fill it in. - -```json -{ - "name": "myproject", - "version": "1.0.0", - "description": "My first project", - "main": "index.js", - "repository": { - "type": "git", - "url": "git://github.com/christkv/myfirstproject.git" - }, - "dependencies": { - "mongodb-core": "~1.0" - }, - "author": "Christian Kvalheim", - "license": "Apache 2.0", - "bugs": { - "url": "https://github.com/christkv/myfirstproject/issues" - }, - "homepage": "https://github.com/christkv/myfirstproject" -} -``` - -Save the file and return to the shell or command prompt and use **NPM** to install all the dependencies. - -``` -npm install -``` - -You should see **NPM** download a lot of files. Once it's done you'll find all the downloaded packages under the **node_modules** directory. - -Booting up a MongoDB Server ---------------------------- -Let's boot up a MongoDB server instance. Download the right MongoDB version from [MongoDB](http://www.mongodb.org), open a new shell or command line and ensure the **mongod** command is in the shell or command line path. Now let's create a database directory (in our case under **/data**). - -``` -mongod --dbpath=/data --port 27017 -``` - -You should see the **mongod** process start up and print some status information. - -## Connecting to MongoDB - -Let's create a new **app.js** file that we will use to show the basic CRUD operations using the MongoDB driver. - -First let's add code to connect to the server. Notice that there is no concept of a database here and we use the topology directly to perform the connection. - -```js -var Server = require('mongodb-core').Server - , assert = require('assert'); - -// Set up server connection -var server = new Server({ - host: 'localhost' - , port: 27017 - , reconnect: true - , reconnectInterval: 50 -}); - -// Add event listeners -server.on('connect', function(_server) { - console.log('connected'); - test.done(); -}); - -server.on('close', function() { - console.log('closed'); -}); - -server.on('reconnect', function() { - console.log('reconnect'); -}); - -// Start connection -server.connect(); -``` - -To connect to a replicaset we would use the `ReplSet` class and for a set of Mongos proxies we use the `Mongos` class. Each topology class offer the same CRUD operations and you operate on the topology directly. Let's look at an example exercising all the different available CRUD operations. - -```js -var Server = require('mongodb-core').Server - , assert = require('assert'); - -// Set up server connection -var server = new Server({ - host: 'localhost' - , port: 27017 - , reconnect: true - , reconnectInterval: 50 -}); - -// Add event listeners -server.on('connect', function(_server) { - console.log('connected'); - - // Execute the ismaster command - _server.command('system.$cmd', {ismaster: true}, function(err, result) { - - // Perform a document insert - _server.insert('myproject.inserts1', [{a:1}, {a:2}], { - writeConcern: {w:1}, ordered:true - }, function(err, results) { - assert.equal(null, err); - assert.equal(2, results.result.n); - - // Perform a document update - _server.update('myproject.inserts1', [{ - q: {a: 1}, u: {'$set': {b:1}} - }], { - writeConcern: {w:1}, ordered:true - }, function(err, results) { - assert.equal(null, err); - assert.equal(1, results.result.n); - - // Remove a document - _server.remove('myproject.inserts1', [{ - q: {a: 1}, limit: 1 - }], { - writeConcern: {w:1}, ordered:true - }, function(err, results) { - assert.equal(null, err); - assert.equal(1, results.result.n); - - // Get a document - var cursor = _server.cursor('integration_tests.inserts_example4', { - find: 'integration_tests.example4' - , query: {a:1} - }); - - // Get the first document - cursor.next(function(err, doc) { - assert.equal(null, err); - assert.equal(2, doc.a); - - // Execute the ismaster command - _server.command("system.$cmd" - , {ismaster: true}, function(err, result) { - assert.equal(null, err) - _server.destroy(); - }); - }); - }); - }); - - test.done(); - }); -}); - -server.on('close', function() { - console.log('closed'); -}); - -server.on('reconnect', function() { - console.log('reconnect'); -}); - -// Start connection -server.connect(); -``` - -The core driver does not contain any helpers or abstractions only the core crud operations. These consist of the following commands. - -* `insert`, Insert takes an array of 1 or more documents to be inserted against the topology and allows you to specify a write concern and if you wish to execute the inserts in order or out of order. -* `update`, Update takes an array of 1 or more update commands to be executed against the server topology and also allows you to specify a write concern and if you wish to execute the updates in order or out of order. -* `remove`, Remove takes an array of 1 or more remove commands to be executed against the server topology and also allows you to specify a write concern and if you wish to execute the removes in order or out of order. -* `cursor`, Returns you a cursor for either the 'virtual' `find` command, a command that returns a cursor id or a plain cursor id. Read the cursor tutorial for more inn depth coverage. -* `command`, Executes a command against MongoDB and returns the result. -* `auth`, Authenticates the current topology using a supported authentication scheme. - -The Core Driver is a building block for library builders and is not meant for usage by end users as it lacks a lot of features the end user might need such as automatic buffering of operations when a primary is changing in a replicaset or the db and collections abstraction. - -## Next steps - -The next step is to get more in depth information about how the different aspects of the core driver works and how to leverage them to extend the functionality of the cursors. Please view the tutorials for more detailed information. diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md deleted file mode 100644 index fe03ea0f..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/TESTING.md +++ /dev/null @@ -1,18 +0,0 @@ -Testing setup -============= - -Single Server -------------- -mongod --dbpath=./db - -Replicaset ----------- -mongo --nodb -var x = new ReplSetTest({"useHostName":"false", "nodes" : {node0 : {}, node1 : {}, node2 : {}}}) -x.startSet(); -var config = x.getReplSetConfig() -x.initiate(config); - -Mongos ------- -var s = new ShardingTest( "auth1", 1 , 0 , 2 , {rs: true, noChunkSize : true}); \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json deleted file mode 100644 index c5eca926..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/conf.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "plugins": ["plugins/markdown", "docs/lib/jsdoc/examples_plugin.js"], - "source": { - "include": [ - "test/tests/functional/operation_example_tests.js", - "lib/topologies/mongos.js", - "lib/topologies/command_result.js", - "lib/topologies/read_preference.js", - "lib/topologies/replset.js", - "lib/topologies/server.js", - "lib/topologies/session.js", - "lib/topologies/replset_state.js", - "lib/connection/logger.js", - "lib/connection/connection.js", - "lib/cursor.js", - "lib/error.js", - "node_modules/bson/lib/bson/binary.js", - "node_modules/bson/lib/bson/code.js", - "node_modules/bson/lib/bson/db_ref.js", - "node_modules/bson/lib/bson/double.js", - "node_modules/bson/lib/bson/long.js", - "node_modules/bson/lib/bson/objectid.js", - "node_modules/bson/lib/bson/symbol.js", - "node_modules/bson/lib/bson/timestamp.js", - "node_modules/bson/lib/bson/max_key.js", - "node_modules/bson/lib/bson/min_key.js" - ] - }, - "templates": { - "cleverLinks": true, - "monospaceLinks": true, - "default": { - "outputSourceFiles" : true - }, - "applicationName": "Node.js MongoDB Driver API", - "disqus": true, - "googleAnalytics": "UA-29229787-1", - "openGraph": { - "title": "", - "type": "website", - "image": "", - "site_name": "", - "url": "" - }, - "meta": { - "title": "", - "description": "", - "keyword": "" - }, - "linenums": true - }, - "markdown": { - "parser": "gfm", - "hardwrap": true, - "tags": ["examples"] - }, - "examples": { - "indent": 4 - } -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js deleted file mode 100644 index 8f108604..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/index.js +++ /dev/null @@ -1,18 +0,0 @@ -module.exports = { - MongoError: require('./lib/error') - , Server: require('./lib/topologies/server') - , ReplSet: require('./lib/topologies/replset') - , Mongos: require('./lib/topologies/mongos') - , Logger: require('./lib/connection/logger') - , Cursor: require('./lib/cursor') - , ReadPreference: require('./lib/topologies/read_preference') - , BSON: require('bson') - // Raw operations - , Query: require('./lib/connection/commands').Query - // Auth mechanisms - , MongoCR: require('./lib/auth/mongocr') - , X509: require('./lib/auth/x509') - , Plain: require('./lib/auth/plain') - , GSSAPI: require('./lib/auth/gssapi') - , ScramSHA1: require('./lib/auth/scram') -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js deleted file mode 100644 index c442b9b0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/gssapi.js +++ /dev/null @@ -1,244 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password, options) { - this.db = db; - this.username = username; - this.password = password; - this.options = options; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -// Kerberos class -var Kerberos = null; -var MongoAuthProcess = null; - -// Try to grab the Kerberos class -try { - Kerberos = require('kerberos').Kerberos - // Authentication process for Mongo - MongoAuthProcess = require('kerberos').processes.MongoAuthProcess -} catch(err) {} - -/** - * Creates a new GSSAPI authentication mechanism - * @class - * @return {GSSAPI} A cursor instance - */ -var GSSAPI = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -GSSAPI.prototype.auth = function(server, pool, db, username, password, options, callback) { - var self = this; - // We don't have the Kerberos library - if(Kerberos == null) return callback(new Error("Kerberos library is not installed")); - var gssapiServiceName = options['gssapiServiceName'] || 'mongodb'; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Start Auth process for a connection - GSSAPIInitialize(db, username, password, db, gssapiServiceName, server, connection, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password, options)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -// -// Initialize step -var GSSAPIInitialize = function(db, username, password, authdb, gssapiServiceName, server, connection, callback) { - // Create authenticator - var mongo_auth_process = new MongoAuthProcess(connection.host, connection.port, gssapiServiceName); - - // Perform initialization - mongo_auth_process.init(username, password, function(err, context) { - if(err) return callback(err, false); - - // Perform the first step - mongo_auth_process.transition('', function(err, payload) { - if(err) return callback(err, false); - - // Call the next db step - MongoDBGSSAPIFirstStep(mongo_auth_process, payload, db, username, password, authdb, server, connection, callback); - }); - }); -} - -// -// Perform first step against mongodb -var MongoDBGSSAPIFirstStep = function(mongo_auth_process, payload, db, username, password, authdb, server, connection, callback) { - // Build the sasl start command - var command = { - saslStart: 1 - , mechanism: 'GSSAPI' - , payload: payload - , autoAuthorize: 1 - }; - - // Execute first sasl step - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - // Execute mongodb transition - mongo_auth_process.transition(r.result.payload, function(err, payload) { - if(err) return callback(err, false); - - // MongoDB API Second Step - MongoDBGSSAPISecondStep(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback); - }); - }); -} - -// -// Perform first step against mongodb -var MongoDBGSSAPISecondStep = function(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback) { - // Build Authentication command to send to MongoDB - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - // Call next transition for kerberos - mongo_auth_process.transition(doc.payload, function(err, payload) { - if(err) return callback(err, false); - - // Call the last and third step - MongoDBGSSAPIThirdStep(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback); - }); - }); -} - -var MongoDBGSSAPIThirdStep = function(mongo_auth_process, payload, doc, db, username, password, authdb, server, connection, callback) { - // Build final command - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - mongo_auth_process.transition(null, function(err, payload) { - if(err) return callback(err, null); - callback(null, r); - }); - }); -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -GSSAPI.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, this.authStore[i].options, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = GSSAPI; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js deleted file mode 100644 index d0e9f59b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/mongocr.js +++ /dev/null @@ -1,160 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new MongoCR authentication mechanism - * @class - * @return {MongoCR} A cursor instance - */ -var MongoCR = function() { - this.authStore = []; -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -MongoCR.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var executeMongoCR = function(connection) { - // Let's start the process - server.command(f("%s.$cmd", db) - , { getnonce: 1 } - , { connection: connection }, function(err, r) { - var nonce = null; - var key = null; - - // Adjust the number of connections left - // Get nonce - if(err == null) { - nonce = r.result.nonce; - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - var hash_password = md5.digest('hex'); - // Final key - md5 = crypto.createHash('md5'); - md5.update(nonce + username + hash_password); - key = md5.digest('hex'); - } - - // Execute command - server.command(f("%s.$cmd", db) - , { authenticate: 1, user: username, nonce: nonce, key:key} - , { connection: connection }, function(err, r) { - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - }); - } - - // Get the connection - executeMongoCR(connections.shift()); - } -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -MongoCR.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = MongoCR; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js deleted file mode 100644 index 31ce8722..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/plain.js +++ /dev/null @@ -1,150 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , Binary = require('bson').Binary - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new Plain authentication mechanism - * @class - * @return {Plain} A cursor instance - */ -var Plain = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -Plain.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Create payload - var payload = new Binary(f("\x00%s\x00%s", username, password)); - - // Let's start the sasl process - var command = { - saslStart: 1 - , mechanism: 'PLAIN' - , payload: payload - , autoAuthorize: 1 - }; - - // Let's start the process - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -Plain.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = Plain; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js deleted file mode 100644 index fe96637b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/scram.js +++ /dev/null @@ -1,317 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , Binary = require('bson').Binary - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new ScramSHA1 authentication mechanism - * @class - * @return {ScramSHA1} A cursor instance - */ -var ScramSHA1 = function() { - this.authStore = []; -} - -var parsePayload = function(payload) { - var dict = {}; - var parts = payload.split(','); - - for(var i = 0; i < parts.length; i++) { - var valueParts = parts[i].split('='); - dict[valueParts[0]] = valueParts[1]; - } - - return dict; -} - -var passwordDigest = function(username, password) { - if(typeof username != 'string') throw new MongoError("username must be a string"); - if(typeof password != 'string') throw new MongoError("password must be a string"); - if(password.length == 0) throw new MongoError("password cannot be empty"); - // Use node md5 generator - var md5 = crypto.createHash('md5'); - // Generate keys used for authentication - md5.update(username + ":mongo:" + password); - return md5.digest('hex'); -} - -// XOR two buffers -var xor = function(a, b) { - if (!Buffer.isBuffer(a)) a = new Buffer(a) - if (!Buffer.isBuffer(b)) b = new Buffer(b) - var res = [] - if (a.length > b.length) { - for (var i = 0; i < b.length; i++) { - res.push(a[i] ^ b[i]) - } - } else { - for (var i = 0; i < a.length; i++) { - res.push(a[i] ^ b[i]) - } - } - return new Buffer(res); -} - -// Create a final digest -var hi = function(data, salt, iterations) { - // Create digest - var digest = function(msg) { - var hmac = crypto.createHmac('sha1', data); - hmac.update(msg); - return new Buffer(hmac.digest('base64'), 'base64'); - } - - // Create variables - salt = Buffer.concat([salt, new Buffer('\x00\x00\x00\x01')]) - var ui = digest(salt); - var u1 = ui; - - for(var i = 0; i < iterations - 1; i++) { - u1 = digest(u1); - ui = xor(ui, u1); - } - - return ui; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -ScramSHA1.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var executeScram = function(connection) { - // Clean up the user - username = username.replace('=', "=3D").replace(',', '=2C'); - - // Create a random nonce - var nonce = crypto.randomBytes(24).toString('base64'); - // var nonce = 'MsQUY9iw0T9fx2MUEz6LZPwGuhVvWAhc' - var firstBare = f("n=%s,r=%s", username, nonce); - - // Build command structure - var cmd = { - saslStart: 1 - , mechanism: 'SCRAM-SHA-1' - , payload: new Binary(f("n,,%s", firstBare)) - , autoAuthorize: 1 - } - - // Handle the error - var handleError = function(err, r) { - if(err) { - numberOfValidConnections = numberOfValidConnections - 1; - errorObject = err; return false; - } else if(r.result['$err']) { - errorObject = r.result; return false; - } else if(r.result['errmsg']) { - errorObject = r.result; return false; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - return true - } - - // Finish up - var finish = function(_count, _numberOfValidConnections) { - if(_count == 0 && _numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - return callback(null, true); - } else if(_count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using scram")); - return callback(errorObject, false); - } - } - - var handleEnd = function(_err, _r) { - // Handle any error - handleError(_err, _r) - // Adjust the number of connections - count = count - 1; - // Execute the finish - finish(count, numberOfValidConnections); - } - - // Execute start sasl command - server.command(f("%s.$cmd", db) - , cmd, { connection: connection }, function(err, r) { - - // Do we have an error, handle it - if(handleError(err, r) == false) { - count = count - 1; - - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - return callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using scram")); - return callback(errorObject, false); - } - - return; - } - - // Get the dictionary - var dict = parsePayload(r.result.payload.value()) - - // Unpack dictionary - var iterations = parseInt(dict.i, 10); - var salt = dict.s; - var rnonce = dict.r; - - // Set up start of proof - var withoutProof = f("c=biws,r=%s", rnonce); - var passwordDig = passwordDigest(username, password); - var saltedPassword = hi(passwordDig - , new Buffer(salt, 'base64') - , iterations); - - // Create the client key - var hmac = crypto.createHmac('sha1', saltedPassword); - hmac.update(new Buffer("Client Key")); - var clientKey = new Buffer(hmac.digest('base64'), 'base64'); - - // Create the stored key - var hash = crypto.createHash('sha1'); - hash.update(clientKey); - var storedKey = new Buffer(hash.digest('base64'), 'base64'); - - // Create the authentication message - var authMsg = [firstBare, r.result.payload.value().toString('base64'), withoutProof].join(','); - - // Create client signature - var hmac = crypto.createHmac('sha1', storedKey); - hmac.update(new Buffer(authMsg)); - var clientSig = new Buffer(hmac.digest('base64'), 'base64'); - - // Create client proof - var clientProof = f("p=%s", new Buffer(xor(clientKey, clientSig)).toString('base64')); - - // Create client final - var clientFinal = [withoutProof, clientProof].join(','); - - // Generate server key - var hmac = crypto.createHmac('sha1', saltedPassword); - hmac.update(new Buffer('Server Key')) - var serverKey = new Buffer(hmac.digest('base64'), 'base64'); - - // Generate server signature - var hmac = crypto.createHmac('sha1', serverKey); - hmac.update(new Buffer(authMsg)) - var serverSig = new Buffer(hmac.digest('base64'), 'base64'); - - // - // Create continue message - var cmd = { - saslContinue: 1 - , conversationId: r.result.conversationId - , payload: new Binary(new Buffer(clientFinal)) - } - - // - // Execute sasl continue - server.command(f("%s.$cmd", db) - , cmd, { connection: connection }, function(err, r) { - if(r && r.result.done == false) { - var cmd = { - saslContinue: 1 - , conversationId: r.result.conversationId - , payload: new Buffer(0) - } - - server.command(f("%s.$cmd", db) - , cmd, { connection: connection }, function(err, r) { - handleEnd(err, r); - }); - } else { - handleEnd(err, r); - } - }); - }); - } - - // Get the connection - executeScram(connections.shift()); - } -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -ScramSHA1.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - - -module.exports = ScramSHA1; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js deleted file mode 100644 index 177ede57..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/sspi.js +++ /dev/null @@ -1,234 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password, options) { - this.db = db; - this.username = username; - this.password = password; - this.options = options; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -// Kerberos class -var Kerberos = null; -var MongoAuthProcess = null; - -// Try to grab the Kerberos class -try { - Kerberos = require('kerberos').Kerberos - // Authentication process for Mongo - MongoAuthProcess = require('kerberos').processes.MongoAuthProcess -} catch(err) {} - -/** - * Creates a new SSPI authentication mechanism - * @class - * @return {SSPI} A cursor instance - */ -var SSPI = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -SSPI.prototype.auth = function(server, pool, db, username, password, options, callback) { - var self = this; - // We don't have the Kerberos library - if(Kerberos == null) return callback(new Error("Kerberos library is not installed")); - var gssapiServiceName = options['gssapiServiceName'] || 'mongodb'; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Start Auth process for a connection - SSIPAuthenticate(username, password, gssapiServiceName, server, connection, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r && typeof r == 'object' && r.result['$err']) { - errorObject = r.result; - } else if(r && typeof r == 'object' && r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password, options)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -var SSIPAuthenticate = function(username, password, gssapiServiceName, server, connection, callback) { - // Build Authentication command to send to MongoDB - var command = { - saslStart: 1 - , mechanism: 'GSSAPI' - , payload: '' - , autoAuthorize: 1 - }; - - // Create authenticator - var mongo_auth_process = new MongoAuthProcess(connection.host, connection.port, gssapiServiceName); - - // Execute first sasl step - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - mongo_auth_process.init(username, password, function(err) { - if(err) return callback(err); - - mongo_auth_process.transition(doc.payload, function(err, payload) { - if(err) return callback(err); - - // Perform the next step against mongod - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - mongo_auth_process.transition(doc.payload, function(err, payload) { - if(err) return callback(err); - - // Perform the next step against mongod - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - mongo_auth_process.transition(doc.payload, function(err, payload) { - // Perform the next step against mongod - var command = { - saslContinue: 1 - , conversationId: doc.conversationId - , payload: payload - }; - - // Execute the command - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - if(err) return callback(err, false); - var doc = r.result; - - if(doc.done) return callback(null, true); - callback(new Error("Authentication failed"), false); - }); - }); - }); - }); - }); - }); - }); - }); -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -SSPI.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, this.authStore[i].options, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = SSPI; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js deleted file mode 100644 index 641990e4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/auth/x509.js +++ /dev/null @@ -1,145 +0,0 @@ -"use strict"; - -var f = require('util').format - , crypto = require('crypto') - , MongoError = require('../error'); - -var AuthSession = function(db, username, password) { - this.db = db; - this.username = username; - this.password = password; -} - -AuthSession.prototype.equal = function(session) { - return session.db == this.db - && session.username == this.username - && session.password == this.password; -} - -/** - * Creates a new X509 authentication mechanism - * @class - * @return {X509} A cursor instance - */ -var X509 = function() { - this.authStore = []; -} - -/** - * Authenticate - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {string} db Name of the database - * @param {string} username Username - * @param {string} password Password - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -X509.prototype.auth = function(server, pool, db, username, password, callback) { - var self = this; - // Get all the connections - var connections = pool.getAll(); - // Total connections - var count = connections.length; - if(count == 0) return callback(null, null); - - // Valid connections - var numberOfValidConnections = 0; - var credentialsValid = false; - var errorObject = null; - - // For each connection we need to authenticate - while(connections.length > 0) { - // Execute MongoCR - var execute = function(connection) { - // Let's start the sasl process - var command = { - authenticate: 1 - , mechanism: 'MONGODB-X509' - , user: username - }; - - // Let's start the process - server.command("$external.$cmd" - , command - , { connection: connection }, function(err, r) { - // Adjust count - count = count - 1; - - // If we have an error - if(err) { - errorObject = err; - } else if(r.result['$err']) { - errorObject = r.result; - } else if(r.result['errmsg']) { - errorObject = r.result; - } else { - credentialsValid = true; - numberOfValidConnections = numberOfValidConnections + 1; - } - - // We have authenticated all connections - if(count == 0 && numberOfValidConnections > 0) { - // Store the auth details - addAuthSession(self.authStore, new AuthSession(db, username, password)); - // Return correct authentication - callback(null, true); - } else if(count == 0) { - if(errorObject == null) errorObject = new MongoError(f("failed to authenticate using mongocr")); - callback(errorObject, false); - } - }); - } - - // Get the connection - execute(connections.shift()); - } -} - -// Add to store only if it does not exist -var addAuthSession = function(authStore, session) { - var found = false; - - for(var i = 0; i < authStore.length; i++) { - if(authStore[i].equal(session)) { - found = true; - break; - } - } - - if(!found) authStore.push(session); -} - -/** - * Re authenticate pool - * @method - * @param {{Server}|{ReplSet}|{Mongos}} server Topology the authentication method is being called on - * @param {Pool} pool Connection pool for this topology - * @param {authResultCallback} callback The callback to return the result from the authentication - * @return {object} - */ -X509.prototype.reauthenticate = function(server, pool, callback) { - var count = this.authStore.length; - if(count == 0) return callback(null, null); - // Iterate over all the auth details stored - for(var i = 0; i < this.authStore.length; i++) { - this.auth(server, pool, this.authStore[i].db, this.authStore[i].username, this.authStore[i].password, function(err, r) { - count = count - 1; - // Done re-authenticating - if(count == 0) { - callback(null, null); - } - }); - } -} - -/** - * This is a result from a authentication strategy - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {boolean} result The result of the authentication process - */ - -module.exports = X509; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js deleted file mode 100644 index 05023b4a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/commands.js +++ /dev/null @@ -1,519 +0,0 @@ -"use strict"; - -var f = require('util').format - , Long = require('bson').Long - , setProperty = require('./utils').setProperty - , getProperty = require('./utils').getProperty - , getSingleProperty = require('./utils').getSingleProperty; - -// Incrementing request id -var _requestId = 0; - -// Wire command operation ids -var OP_QUERY = 2004; -var OP_GETMORE = 2005; -var OP_KILL_CURSORS = 2007; - -// Query flags -var OPTS_NONE = 0; -var OPTS_TAILABLE_CURSOR = 2; -var OPTS_SLAVE = 4; -var OPTS_OPLOG_REPLAY = 8; -var OPTS_NO_CURSOR_TIMEOUT = 16; -var OPTS_AWAIT_DATA = 32; -var OPTS_EXHAUST = 64; -var OPTS_PARTIAL = 128; - -// Response flags -var CURSOR_NOT_FOUND = 0; -var QUERY_FAILURE = 2; -var SHARD_CONFIG_STALE = 4; -var AWAIT_CAPABLE = 8; - -/************************************************************** - * QUERY - **************************************************************/ -var Query = function(bson, ns, query, options) { - var self = this; - // Basic options needed to be passed in - if(ns == null) throw new Error("ns must be specified for query"); - if(query == null) throw new Error("query must be specified for query"); - - // Validate that we are not passing 0x00 in the colletion name - if(!!~ns.indexOf("\x00")) { - throw new Error("namespace cannot contain a null character"); - } - - // Basic options - this.bson = bson; - this.ns = ns; - this.query = query; - - // Ensure empty options - this.options = options || {}; - - // Additional options - this.numberToSkip = options.numberToSkip || 0; - this.numberToReturn = options.numberToReturn || 0; - this.returnFieldSelector = options.returnFieldSelector || null; - this.requestId = _requestId++; - - // Serialization option - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.maxBsonSize = options.maxBsonSize || 1024 * 1024 * 16; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : true; - this.batchSize = self.numberToReturn; - - // Flags - this.tailable = false; - this.slaveOk = false; - this.oplogReply = false; - this.noCursorTimeout = false; - this.awaitData = false; - this.exhaust = false; - this.partial = false; -} - -// -// Assign a new request Id -Query.prototype.incRequestId = function() { - this.requestId = _requestId++; -} - -// -// Assign a new request Id -Query.nextRequestId = function() { - return _requestId + 1; -} - -// -// Uses a single allocated buffer for the process, avoiding multiple memory allocations -Query.prototype.toBin = function() { - var self = this; - var buffers = []; - var projection = null; - - // Set up the flags - var flags = 0; - if(this.tailable) flags |= OPTS_TAILABLE_CURSOR; - if(this.slaveOk) flags |= OPTS_SLAVE; - if(this.oplogReply) flags |= OPTS_OPLOG_REPLAY; - if(this.noCursorTimeout) flags |= OPTS_NO_CURSOR_TIMEOUT; - if(this.awaitData) flags |= OPTS_AWAIT_DATA; - if(this.exhaust) flags |= OPTS_EXHAUST; - if(this.partial) flags |= OPTS_PARTIAL; - - // If batchSize is different to self.numberToReturn - if(self.batchSize != self.numberToReturn) self.numberToReturn = self.batchSize; - - // Allocate write protocol header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // Flags - + Buffer.byteLength(self.ns) + 1 // namespace - + 4 // numberToSkip - + 4 // numberToReturn - ); - - // Add header to buffers - buffers.push(header); - - // Serialize the query - var query = self.bson.serialize(this.query - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - - // Add query document - buffers.push(query); - - if(self.returnFieldSelector && Object.keys(self.returnFieldSelector).length > 0) { - // Serialize the projection document - projection = self.bson.serialize(this.returnFieldSelector, this.checkKeys, true, this.serializeFunctions, this.ignoreUndefined); - // Add projection document - buffers.push(projection); - } - - // Total message size - var totalLength = header.length + query.length + (projection ? projection.length : 0); - - // Set up the index - var index = 4; - - // Write total document length - header[3] = (totalLength >> 24) & 0xff; - header[2] = (totalLength >> 16) & 0xff; - header[1] = (totalLength >> 8) & 0xff; - header[0] = (totalLength) & 0xff; - - // Write header information requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // Write header information responseTo - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Write header information OP_QUERY - header[index + 3] = (OP_QUERY >> 24) & 0xff; - header[index + 2] = (OP_QUERY >> 16) & 0xff; - header[index + 1] = (OP_QUERY >> 8) & 0xff; - header[index] = (OP_QUERY) & 0xff; - index = index + 4; - - // Write header information flags - header[index + 3] = (flags >> 24) & 0xff; - header[index + 2] = (flags >> 16) & 0xff; - header[index + 1] = (flags >> 8) & 0xff; - header[index] = (flags) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Write header information flags numberToSkip - header[index + 3] = (this.numberToSkip >> 24) & 0xff; - header[index + 2] = (this.numberToSkip >> 16) & 0xff; - header[index + 1] = (this.numberToSkip >> 8) & 0xff; - header[index] = (this.numberToSkip) & 0xff; - index = index + 4; - - // Write header information flags numberToReturn - header[index + 3] = (this.numberToReturn >> 24) & 0xff; - header[index + 2] = (this.numberToReturn >> 16) & 0xff; - header[index + 1] = (this.numberToReturn >> 8) & 0xff; - header[index] = (this.numberToReturn) & 0xff; - index = index + 4; - - // Return the buffers - return buffers; -} - -Query.getRequestId = function() { - return ++_requestId; -} - -/************************************************************** - * GETMORE - **************************************************************/ -var GetMore = function(bson, ns, cursorId, opts) { - opts = opts || {}; - this.numberToReturn = opts.numberToReturn || 0; - this.requestId = _requestId++; - this.bson = bson; - this.ns = ns; - this.cursorId = cursorId; -} - -// -// Uses a single allocated buffer for the process, avoiding multiple memory allocations -GetMore.prototype.toBin = function() { - var length = 4 + Buffer.byteLength(this.ns) + 1 + 4 + 8 + (4 * 4); - // Create command buffer - var index = 0; - // Allocate buffer - var _buffer = new Buffer(length); - - // Write header information - // index = write32bit(index, _buffer, length); - _buffer[index + 3] = (length >> 24) & 0xff; - _buffer[index + 2] = (length >> 16) & 0xff; - _buffer[index + 1] = (length >> 8) & 0xff; - _buffer[index] = (length) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, requestId); - _buffer[index + 3] = (this.requestId >> 24) & 0xff; - _buffer[index + 2] = (this.requestId >> 16) & 0xff; - _buffer[index + 1] = (this.requestId >> 8) & 0xff; - _buffer[index] = (this.requestId) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, OP_GETMORE); - _buffer[index + 3] = (OP_GETMORE >> 24) & 0xff; - _buffer[index + 2] = (OP_GETMORE >> 16) & 0xff; - _buffer[index + 1] = (OP_GETMORE >> 8) & 0xff; - _buffer[index] = (OP_GETMORE) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // Write collection name - index = index + _buffer.write(this.ns, index, 'utf8') + 1; - _buffer[index - 1] = 0; - - // Write batch size - // index = write32bit(index, _buffer, numberToReturn); - _buffer[index + 3] = (this.numberToReturn >> 24) & 0xff; - _buffer[index + 2] = (this.numberToReturn >> 16) & 0xff; - _buffer[index + 1] = (this.numberToReturn >> 8) & 0xff; - _buffer[index] = (this.numberToReturn) & 0xff; - index = index + 4; - - // Write cursor id - // index = write32bit(index, _buffer, cursorId.getLowBits()); - _buffer[index + 3] = (this.cursorId.getLowBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorId.getLowBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorId.getLowBits() >> 8) & 0xff; - _buffer[index] = (this.cursorId.getLowBits()) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, cursorId.getHighBits()); - _buffer[index + 3] = (this.cursorId.getHighBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorId.getHighBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorId.getHighBits() >> 8) & 0xff; - _buffer[index] = (this.cursorId.getHighBits()) & 0xff; - index = index + 4; - - // Return buffer - return _buffer; -} - -/************************************************************** - * KILLCURSOR - **************************************************************/ -var KillCursor = function(bson, cursorIds) { - this.requestId = _requestId++; - this.cursorIds = cursorIds; -} - -// -// Uses a single allocated buffer for the process, avoiding multiple memory allocations -KillCursor.prototype.toBin = function() { - var length = 4 + 4 + (4 * 4) + (this.cursorIds.length * 8); - - // Create command buffer - var index = 0; - var _buffer = new Buffer(length); - - // Write header information - // index = write32bit(index, _buffer, length); - _buffer[index + 3] = (length >> 24) & 0xff; - _buffer[index + 2] = (length >> 16) & 0xff; - _buffer[index + 1] = (length >> 8) & 0xff; - _buffer[index] = (length) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, requestId); - _buffer[index + 3] = (this.requestId >> 24) & 0xff; - _buffer[index + 2] = (this.requestId >> 16) & 0xff; - _buffer[index + 1] = (this.requestId >> 8) & 0xff; - _buffer[index] = (this.requestId) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, OP_KILL_CURSORS); - _buffer[index + 3] = (OP_KILL_CURSORS >> 24) & 0xff; - _buffer[index + 2] = (OP_KILL_CURSORS >> 16) & 0xff; - _buffer[index + 1] = (OP_KILL_CURSORS >> 8) & 0xff; - _buffer[index] = (OP_KILL_CURSORS) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, 0); - _buffer[index + 3] = (0 >> 24) & 0xff; - _buffer[index + 2] = (0 >> 16) & 0xff; - _buffer[index + 1] = (0 >> 8) & 0xff; - _buffer[index] = (0) & 0xff; - index = index + 4; - - // Write batch size - // index = write32bit(index, _buffer, this.cursorIds.length); - _buffer[index + 3] = (this.cursorIds.length >> 24) & 0xff; - _buffer[index + 2] = (this.cursorIds.length >> 16) & 0xff; - _buffer[index + 1] = (this.cursorIds.length >> 8) & 0xff; - _buffer[index] = (this.cursorIds.length) & 0xff; - index = index + 4; - - // Write all the cursor ids into the array - for(var i = 0; i < this.cursorIds.length; i++) { - // Write cursor id - // index = write32bit(index, _buffer, cursorIds[i].getLowBits()); - _buffer[index + 3] = (this.cursorIds[i].getLowBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorIds[i].getLowBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorIds[i].getLowBits() >> 8) & 0xff; - _buffer[index] = (this.cursorIds[i].getLowBits()) & 0xff; - index = index + 4; - - // index = write32bit(index, _buffer, cursorIds[i].getHighBits()); - _buffer[index + 3] = (this.cursorIds[i].getHighBits() >> 24) & 0xff; - _buffer[index + 2] = (this.cursorIds[i].getHighBits() >> 16) & 0xff; - _buffer[index + 1] = (this.cursorIds[i].getHighBits() >> 8) & 0xff; - _buffer[index] = (this.cursorIds[i].getHighBits()) & 0xff; - index = index + 4; - } - - // Return buffer - return _buffer; -} - -var Response = function(bson, data, opts) { - opts = opts || {promoteLongs: true}; - this.parsed = false; - - // - // Parse Header - // - this.index = 0; - this.raw = data; - this.data = data; - this.bson = bson; - this.opts = opts; - - // Read the message length - this.length = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Fetch the request id for this reply - this.requestId = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Fetch the id of the request that triggered the response - this.responseTo = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Skip op-code field - this.index = this.index + 4; - - // Unpack flags - this.responseFlags = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Unpack the cursor - var lowBits = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - var highBits = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - // Create long object - this.cursorId = new Long(lowBits, highBits); - - // Unpack the starting from - this.startingFrom = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Unpack the number of objects returned - this.numberReturned = data[this.index] | data[this.index + 1] << 8 | data[this.index + 2] << 16 | data[this.index + 3] << 24; - this.index = this.index + 4; - - // Preallocate document array - this.documents = new Array(this.numberReturned); - - // Flag values - this.cursorNotFound = (this.responseFlags & CURSOR_NOT_FOUND) != 0; - this.queryFailure = (this.responseFlags & QUERY_FAILURE) != 0; - this.shardConfigStale = (this.responseFlags & SHARD_CONFIG_STALE) != 0; - this.awaitCapable = (this.responseFlags & AWAIT_CAPABLE) != 0; - this.promoteLongs = typeof opts.promoteLongs == 'boolean' ? opts.promoteLongs : true; -} - -Response.prototype.isParsed = function() { - return this.parsed; -} - -// Validation buffers -var firstBatch = new Buffer('firstBatch', 'utf8'); -var nextBatch = new Buffer('nextBatch', 'utf8'); -var cursorId = new Buffer('id', 'utf8').toString('hex'); - -var documentBuffers = { - firstBatch: firstBatch.toString('hex'), - nextBatch: nextBatch.toString('hex') -}; - -Response.prototype.parse = function(options) { - // Don't parse again if not needed - if(this.parsed) return; - options = options || {}; - - // Allow the return of raw documents instead of parsing - var raw = options.raw || false; - var documentsReturnedIn = options.documentsReturnedIn || null; - - // - // Single document and documentsReturnedIn set - // - if(this.numberReturned == 1 && documentsReturnedIn != null && raw) { - // Calculate the bson size - var bsonSize = this.data[this.index] | this.data[this.index + 1] << 8 | this.data[this.index + 2] << 16 | this.data[this.index + 3] << 24; - // Slice out the buffer containing the command result document - var document = this.data.slice(this.index, this.index + bsonSize); - // Set up field we wish to keep as raw - var fieldsAsRaw = {} - fieldsAsRaw[documentsReturnedIn] = true; - // Set up the options - var _options = {promoteLongs: this.opts.promoteLongs, fieldsAsRaw: fieldsAsRaw}; - - // Deserialize but keep the array of documents in non-parsed form - var doc = this.bson.deserialize(document, _options); - - // Get the documents - this.documents = doc.cursor[documentsReturnedIn]; - this.numberReturned = this.documents.length; - // Ensure we have a Long valie cursor id - this.cursorId = typeof doc.cursor.id == 'number' - ? Long.fromNumber(doc.cursor.id) - : doc.cursor.id; - - // Adjust the index - this.index = this.index + bsonSize; - - // Set as parsed - this.parsed = true - return; - } - - // - // Parse Body - // - for(var i = 0; i < this.numberReturned; i++) { - var bsonSize = this.data[this.index] | this.data[this.index + 1] << 8 | this.data[this.index + 2] << 16 | this.data[this.index + 3] << 24; - // Parse options - var _options = {promoteLongs: this.opts.promoteLongs}; - - // If we have raw results specified slice the return document - if(raw) { - this.documents[i] = this.data.slice(this.index, this.index + bsonSize); - } else { - this.documents[i] = this.bson.deserialize(this.data.slice(this.index, this.index + bsonSize), _options); - } - - // Adjust the index - this.index = this.index + bsonSize; - } - - // Set parsed - this.parsed = true; -} - -module.exports = { - Query: Query - , GetMore: GetMore - , Response: Response - , KillCursor: KillCursor -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js deleted file mode 100644 index 217e58af..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js +++ /dev/null @@ -1,462 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , EventEmitter = require('events').EventEmitter - , net = require('net') - , tls = require('tls') - , f = require('util').format - , getSingleProperty = require('./utils').getSingleProperty - , debugOptions = require('./utils').debugOptions - , Response = require('./commands').Response - , MongoError = require('../error') - , Logger = require('./logger'); - -var _id = 0; -var debugFields = ['host', 'port', 'size', 'keepAlive', 'keepAliveInitialDelay', 'noDelay' - , 'connectionTimeout', 'socketTimeout', 'singleBufferSerializtion', 'ssl', 'ca', 'cert' - , 'rejectUnauthorized', 'promoteLongs']; - -/** - * Creates a new Connection instance - * @class - * @param {string} options.host The server host - * @param {number} options.port The server port - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @fires Connection#connect - * @fires Connection#close - * @fires Connection#error - * @fires Connection#timeout - * @fires Connection#parseError - * @return {Connection} A cursor instance - */ -var Connection = function(options) { - // Add event listener - EventEmitter.call(this); - // Set empty if no options passed - this.options = options || {}; - // Identification information - this.id = _id++; - // Logger instance - this.logger = Logger('Connection', options); - // No bson parser passed in - if(!options.bson) throw new Error("must pass in valid bson parser"); - // Get bson parser - this.bson = options.bson; - // Grouping tag used for debugging purposes - this.tag = options.tag; - // Message handler - this.messageHandler = options.messageHandler; - - // Max BSON message size - this.maxBsonMessageSize = options.maxBsonMessageSize || (1024 * 1024 * 16 * 4); - // Debug information - if(this.logger.isDebug()) this.logger.debug(f('creating connection %s with options [%s]', this.id, JSON.stringify(debugOptions(debugFields, options)))); - - // Default options - this.port = options.port || 27017; - this.host = options.host || 'localhost'; - this.keepAlive = typeof options.keepAlive == 'boolean' ? options.keepAlive : true; - this.keepAliveInitialDelay = options.keepAliveInitialDelay || 0; - this.noDelay = typeof options.noDelay == 'boolean' ? options.noDelay : true; - this.connectionTimeout = options.connectionTimeout || 0; - this.socketTimeout = options.socketTimeout || 0; - - // If connection was destroyed - this.destroyed = false; - - // Check if we have a domain socket - this.domainSocket = this.host.indexOf('\/') != -1; - - // Serialize commands using function - this.singleBufferSerializtion = typeof options.singleBufferSerializtion == 'boolean' ? options.singleBufferSerializtion : true; - this.serializationFunction = this.singleBufferSerializtion ? 'toBinUnified' : 'toBin'; - - // SSL options - this.ca = options.ca || null; - this.cert = options.cert || null; - this.key = options.key || null; - this.passphrase = options.passphrase || null; - this.ssl = typeof options.ssl == 'boolean' ? options.ssl : false; - this.rejectUnauthorized = typeof options.rejectUnauthorized == 'boolean' ? options.rejectUnauthorized : true - - // If ssl not enabled - if(!this.ssl) this.rejectUnauthorized = false; - - // Response options - this.responseOptions = { - promoteLongs: typeof options.promoteLongs == 'boolean' ? options.promoteLongs : true - } - - // Flushing - this.flushing = false; - this.queue = []; - - // Internal state - this.connection = null; - this.writeStream = null; -} - -inherits(Connection, EventEmitter); - -// -// Connection handlers -var errorHandler = function(self) { - return function(err) { - // Debug information - if(self.logger.isDebug()) self.logger.debug(f('connection %s for [%s:%s] errored out with [%s]', self.id, self.host, self.port, JSON.stringify(err))); - // Emit the error - if(self.listeners('error').length > 0) self.emit("error", MongoError.create(err), self); - } -} - -var timeoutHandler = function(self) { - return function() { - // Debug information - if(self.logger.isDebug()) self.logger.debug(f('connection %s for [%s:%s] timed out', self.id, self.host, self.port)); - // Emit timeout error - self.emit("timeout" - , MongoError.create(f("connection %s to %s:%s timed out", self.id, self.host, self.port)) - , self); - } -} - -var closeHandler = function(self) { - return function(hadError) { - // Debug information - if(self.logger.isDebug()) self.logger.debug(f('connection %s with for [%s:%s] closed', self.id, self.host, self.port)); - // Emit close event - if(!hadError) { - self.emit("close" - , MongoError.create(f("connection %s to %s:%s closed", self.id, self.host, self.port)) - , self); - } - } -} - -var dataHandler = function(self) { - return function(data) { - // Parse until we are done with the data - while(data.length > 0) { - // If we still have bytes to read on the current message - if(self.bytesRead > 0 && self.sizeOfMessage > 0) { - // Calculate the amount of remaining bytes - var remainingBytesToRead = self.sizeOfMessage - self.bytesRead; - // Check if the current chunk contains the rest of the message - if(remainingBytesToRead > data.length) { - // Copy the new data into the exiting buffer (should have been allocated when we know the message size) - data.copy(self.buffer, self.bytesRead); - // Adjust the number of bytes read so it point to the correct index in the buffer - self.bytesRead = self.bytesRead + data.length; - - // Reset state of buffer - data = new Buffer(0); - } else { - // Copy the missing part of the data into our current buffer - data.copy(self.buffer, self.bytesRead, 0, remainingBytesToRead); - // Slice the overflow into a new buffer that we will then re-parse - data = data.slice(remainingBytesToRead); - - // Emit current complete message - try { - var emitBuffer = self.buffer; - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Emit the buffer - self.messageHandler(new Response(self.bson, emitBuffer, self.responseOptions), self); - } catch(err) { - var errorObject = {err:"socketHandler", trace:err, bin:self.buffer, parseState:{ - sizeOfMessage:self.sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - } - } - } else { - // Stub buffer is kept in case we don't get enough bytes to determine the - // size of the message (< 4 bytes) - if(self.stubBuffer != null && self.stubBuffer.length > 0) { - // If we have enough bytes to determine the message size let's do it - if(self.stubBuffer.length + data.length > 4) { - // Prepad the data - var newData = new Buffer(self.stubBuffer.length + data.length); - self.stubBuffer.copy(newData, 0); - data.copy(newData, self.stubBuffer.length); - // Reassign for parsing - data = newData; - - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - - } else { - - // Add the the bytes to the stub buffer - var newStubBuffer = new Buffer(self.stubBuffer.length + data.length); - // Copy existing stub buffer - self.stubBuffer.copy(newStubBuffer, 0); - // Copy missing part of the data - data.copy(newStubBuffer, self.stubBuffer.length); - // Exit parsing loop - data = new Buffer(0); - } - } else { - if(data.length > 4) { - // Retrieve the message size - // var sizeOfMessage = data.readUInt32LE(0); - var sizeOfMessage = data[0] | data[1] << 8 | data[2] << 16 | data[3] << 24; - // If we have a negative sizeOfMessage emit error and return - if(sizeOfMessage < 0 || sizeOfMessage > self.maxBsonMessageSize) { - var errorObject = {err:"socketHandler", trace:'', bin:self.buffer, parseState:{ - sizeOfMessage: sizeOfMessage, - bytesRead: self.bytesRead, - stubBuffer: self.stubBuffer}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - return; - } - - // Ensure that the size of message is larger than 0 and less than the max allowed - if(sizeOfMessage > 4 && sizeOfMessage < self.maxBsonMessageSize && sizeOfMessage > data.length) { - self.buffer = new Buffer(sizeOfMessage); - // Copy all the data into the buffer - data.copy(self.buffer, 0); - // Update bytes read - self.bytesRead = data.length; - // Update sizeOfMessage - self.sizeOfMessage = sizeOfMessage; - // Ensure stub buffer is null - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - - } else if(sizeOfMessage > 4 && sizeOfMessage < self.maxBsonMessageSize && sizeOfMessage == data.length) { - try { - var emitBuffer = data; - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - // Emit the message - self.messageHandler(new Response(self.bson, emitBuffer, self.responseOptions), self); - } catch (err) { - var errorObject = {err:"socketHandler", trace:err, bin:self.buffer, parseState:{ - sizeOfMessage:self.sizeOfMessage, - bytesRead:self.bytesRead, - stubBuffer:self.stubBuffer}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - } - } else if(sizeOfMessage <= 4 || sizeOfMessage > self.maxBsonMessageSize) { - var errorObject = {err:"socketHandler", trace:null, bin:data, parseState:{ - sizeOfMessage:sizeOfMessage, - bytesRead:0, - buffer:null, - stubBuffer:null}}; - // We got a parse Error fire it off then keep going - self.emit("parseError", errorObject, self); - - // Clear out the state of the parser - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Exit parsing loop - data = new Buffer(0); - } else { - var emitBuffer = data.slice(0, sizeOfMessage); - // Reset state of buffer - self.buffer = null; - self.sizeOfMessage = 0; - self.bytesRead = 0; - self.stubBuffer = null; - // Copy rest of message - data = data.slice(sizeOfMessage); - // Emit the message - self.messageHandler(new Response(self.bson, emitBuffer, self.responseOptions), self); - } - } else { - // Create a buffer that contains the space for the non-complete message - self.stubBuffer = new Buffer(data.length) - // Copy the data to the stub buffer - data.copy(self.stubBuffer, 0); - // Exit parsing loop - data = new Buffer(0); - } - } - } - } - } -} - -/** - * Connect - * @method - */ -Connection.prototype.connect = function(_options) { - var self = this; - _options = _options || {}; - // Check if we are overriding the promoteLongs - if(typeof _options.promoteLongs == 'boolean') { - self.responseOptions.promoteLongs = _options.promoteLongs; - } - - // Create new connection instance - self.connection = self.domainSocket - ? net.createConnection(self.host) - : net.createConnection(self.port, self.host); - - // Set the options for the connection - self.connection.setKeepAlive(self.keepAlive, self.keepAliveInitialDelay); - self.connection.setTimeout(self.connectionTimeout); - self.connection.setNoDelay(self.noDelay); - - // If we have ssl enabled - if(self.ssl) { - var sslOptions = { - socket: self.connection - , rejectUnauthorized: self.rejectUnauthorized - } - - if(self.ca) sslOptions.ca = self.ca; - if(self.cert) sslOptions.cert = self.cert; - if(self.key) sslOptions.key = self.key; - if(self.passphrase) sslOptions.passphrase = self.passphrase; - - // Attempt SSL connection - self.connection = tls.connect(self.port, self.host, sslOptions, function() { - // Error on auth or skip - if(self.connection.authorizationError && self.rejectUnauthorized) { - return self.emit("error", self.connection.authorizationError, self, {ssl:true}); - } - - // Set socket timeout instead of connection timeout - self.connection.setTimeout(self.socketTimeout); - // We are done emit connect - self.emit('connect', self); - }); - self.connection.setTimeout(self.connectionTimeout); - } else { - self.connection.on('connect', function() { - // Set socket timeout instead of connection timeout - self.connection.setTimeout(self.socketTimeout); - // Emit connect event - self.emit('connect', self); - }); - } - - // Add handlers for events - self.connection.once('error', errorHandler(self)); - self.connection.once('timeout', timeoutHandler(self)); - self.connection.once('close', closeHandler(self)); - self.connection.on('data', dataHandler(self)); -} - -/** - * Destroy connection - * @method - */ -Connection.prototype.destroy = function() { - if(this.connection) this.connection.destroy(); - this.destroyed = true; -} - -/** - * Write to connection - * @method - * @param {Command} command Command to write out need to implement toBin and toBinUnified - */ -Connection.prototype.write = function(buffer) { - // Debug log - if(this.logger.isDebug()) this.logger.debug(f('writing buffer [%s] to %s:%s', buffer.toString('hex'), this.host, this.port)); - // Write out the command - if(!Array.isArray(buffer)) return this.connection.write(buffer, 'binary'); - // Iterate over all buffers and write them in order to the socket - for(var i = 0; i < buffer.length; i++) this.connection.write(buffer[i], 'binary'); -} - -/** - * Return id of connection as a string - * @method - * @return {string} - */ -Connection.prototype.toString = function() { - return "" + this.id; -} - -/** - * Return json object of connection - * @method - * @return {object} - */ -Connection.prototype.toJSON = function() { - return {id: this.id, host: this.host, port: this.port}; -} - -/** - * Is the connection connected - * @method - * @return {boolean} - */ -Connection.prototype.isConnected = function() { - if(this.destroyed) return false; - return !this.connection.destroyed && this.connection.writable; -} - -/** - * A server connect event, used to verify that the connection is up and running - * - * @event Connection#connect - * @type {Connection} - */ - -/** - * The server connection closed, all pool connections closed - * - * @event Connection#close - * @type {Connection} - */ - -/** - * The server connection caused an error, all pool connections closed - * - * @event Connection#error - * @type {Connection} - */ - -/** - * The server connection timed out, all pool connections closed - * - * @event Connection#timeout - * @type {Connection} - */ - -/** - * The driver experienced an invalid message, all pool connections closed - * - * @event Connection#parseError - * @type {Connection} - */ - -module.exports = Connection; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js deleted file mode 100644 index 69c6f93b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/logger.js +++ /dev/null @@ -1,196 +0,0 @@ -"use strict"; - -var f = require('util').format - , MongoError = require('../error'); - -// Filters for classes -var classFilters = {}; -var filteredClasses = {}; -var level = null; -// Save the process id -var pid = process.pid; -// current logger -var currentLogger = null; - -/** - * Creates a new Logger instance - * @class - * @param {string} className The Class name associated with the logging instance - * @param {object} [options=null] Optional settings. - * @param {Function} [options.logger=null] Custom logger function; - * @param {string} [options.loggerLevel=error] Override default global log level. - * @return {Logger} a Logger instance. - */ -var Logger = function(className, options) { - if(!(this instanceof Logger)) return new Logger(className, options); - options = options || {}; - - // Current reference - var self = this; - this.className = className; - - // Current logger - if(currentLogger == null && options.logger) { - currentLogger = options.logger; - } else if(currentLogger == null) { - currentLogger = console.log; - } - - // Set level of logging, default is error - if(level == null) { - level = options.loggerLevel || 'error'; - } - - // Add all class names - if(filteredClasses[this.className] == null) classFilters[this.className] = true; -} - -/** - * Log a message at the debug level - * @method - * @param {string} message The message to log - * @param {object} object additional meta data to log - * @return {null} - */ -Logger.prototype.debug = function(message, object) { - if(this.isDebug() - && ((Object.keys(filteredClasses).length > 0 && filteredClasses[this.className]) - || (Object.keys(filteredClasses).length == 0 && classFilters[this.className]))) { - var dateTime = new Date().getTime(); - var msg = f("[%s-%s:%s] %s %s", 'DEBUG', this.className, pid, dateTime, message); - var state = { - type: 'debug', message: message, className: this.className, pid: pid, date: dateTime - }; - if(object) state.meta = object; - currentLogger(msg, state); - } -} - -/** - * Log a message at the info level - * @method - * @param {string} message The message to log - * @param {object} object additional meta data to log - * @return {null} - */ -Logger.prototype.info = function(message, object) { - if(this.isInfo() - && ((Object.keys(filteredClasses).length > 0 && filteredClasses[this.className]) - || (Object.keys(filteredClasses).length == 0 && classFilters[this.className]))) { - var dateTime = new Date().getTime(); - var msg = f("[%s-%s:%s] %s %s", 'INFO', this.className, pid, dateTime, message); - var state = { - type: 'info', message: message, className: this.className, pid: pid, date: dateTime - }; - if(object) state.meta = object; - currentLogger(msg, state); - } -}, - -/** - * Log a message at the error level - * @method - * @param {string} message The message to log - * @param {object} object additional meta data to log - * @return {null} - */ -Logger.prototype.error = function(message, object) { - if(this.isError() - && ((Object.keys(filteredClasses).length > 0 && filteredClasses[this.className]) - || (Object.keys(filteredClasses).length == 0 && classFilters[this.className]))) { - var dateTime = new Date().getTime(); - var msg = f("[%s-%s:%s] %s %s", 'ERROR', this.className, pid, dateTime, message); - var state = { - type: 'error', message: message, className: this.className, pid: pid, date: dateTime - }; - if(object) state.meta = object; - currentLogger(msg, state); - } -}, - -/** - * Is the logger set at info level - * @method - * @return {boolean} - */ -Logger.prototype.isInfo = function() { - return level == 'info' || level == 'debug'; -}, - -/** - * Is the logger set at error level - * @method - * @return {boolean} - */ -Logger.prototype.isError = function() { - return level == 'error' || level == 'info' || level == 'debug'; -}, - -/** - * Is the logger set at debug level - * @method - * @return {boolean} - */ -Logger.prototype.isDebug = function() { - return level == 'debug'; -} - -/** - * Resets the logger to default settings, error and no filtered classes - * @method - * @return {null} - */ -Logger.reset = function() { - level = 'error'; - filteredClasses = {}; -} - -/** - * Get the current logger function - * @method - * @return {function} - */ -Logger.currentLogger = function() { - return currentLogger; -} - -/** - * Set the current logger function - * @method - * @param {function} logger Logger function. - * @return {null} - */ -Logger.setCurrentLogger = function(logger) { - if(typeof logger != 'function') throw new MongoError("current logger must be a function"); - currentLogger = logger; -} - -/** - * Set what classes to log. - * @method - * @param {string} type The type of filter (currently only class) - * @param {string[]} values The filters to apply - * @return {null} - */ -Logger.filter = function(type, values) { - if(type == 'class' && Array.isArray(values)) { - filteredClasses = {}; - - values.forEach(function(x) { - filteredClasses[x] = true; - }); - } -} - -/** - * Set the current log level - * @method - * @param {string} level Set current log level (debug, info, error) - * @return {null} - */ -Logger.setLevel = function(_level) { - if(_level != 'info' && _level != 'error' && _level != 'debug') throw new Error(f("%s is an illegal logging level", _level)); - level = _level; -} - -module.exports = Logger; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js deleted file mode 100644 index dd13707f..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js +++ /dev/null @@ -1,275 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , EventEmitter = require('events').EventEmitter - , Connection = require('./connection') - , Query = require('./commands').Query - , Logger = require('./logger') - , f = require('util').format; - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -var _id = 0; - -/** - * Creates a new Pool instance - * @class - * @param {string} options.host The server host - * @param {number} options.port The server port - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passPhrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=false] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @fires Pool#connect - * @fires Pool#close - * @fires Pool#error - * @fires Pool#timeout - * @fires Pool#parseError - * @return {Pool} A cursor instance - */ -var Pool = function(options) { - var self = this; - // Add event listener - EventEmitter.call(this); - // Set empty if no options passed - this.options = options || {}; - this.size = typeof options.size == 'number' ? options.size : 5; - // Message handler - this.messageHandler = options.messageHandler; - // No bson parser passed in - if(!options.bson) throw new Error("must pass in valid bson parser"); - // Contains all connections - this.connections = []; - this.state = DISCONNECTED; - // Round robin index - this.index = 0; - this.dead = false; - // Logger instance - this.logger = Logger('Pool', options); - // Pool id - this.id = _id++; - // Grouping tag used for debugging purposes - this.tag = options.tag; -} - -inherits(Pool, EventEmitter); - -var errorHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] errored out [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('error', err, self); - } - } -} - -var timeoutHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] timed out [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('timeout', err, self); - } - } -} - -var closeHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] closed [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('close', err, self); - } - } -} - -var parseErrorHandler = function(self) { - return function(err, connection) { - if(self.logger.isDebug()) self.logger.debug(f('pool [%s] errored out [%s] with connection [%s]', this.dead, JSON.stringify(err), JSON.stringify(connection))); - if(!self.dead) { - self.state = DISCONNECTED; - self.dead = true; - self.destroy(); - self.emit('parseError', err, self); - } - } -} - -var connectHandler = function(self) { - return function(connection) { - self.connections.push(connection); - // We have connected to all servers - if(self.connections.length == self.size) { - self.state = CONNECTED; - // Done connecting - self.emit("connect", self); - } - } -} - -/** - * Destroy pool - * @method - */ -Pool.prototype.destroy = function() { - this.state = DESTROYED; - // Set dead - this.dead = true; - // Destroy all the connections - this.connections.forEach(function(c) { - // Destroy all event emitters - ["close", "message", "error", "timeout", "parseError", "connect"].forEach(function(e) { - c.removeAllListeners(e); - }); - - // Destroy the connection - c.destroy(); - }); -} - -var execute = null; - -try { - execute = setImmediate; -} catch(err) { - execute = process.nextTick; -} - -/** - * Connect pool - * @method - */ -Pool.prototype.connect = function(_options) { - var self = this; - // Set to connecting - this.state = CONNECTING - // No dead - this.dead = false; - - // Ensure we allow for a little time to setup connections - var wait = 1; - - // Connect all sockets - for(var i = 0; i < this.size; i++) { - setTimeout(function() { - execute(function() { - self.options.messageHandler = self.messageHandler; - var connection = new Connection(self.options); - - // Add all handlers - connection.once('close', closeHandler(self)); - connection.once('error', errorHandler(self)); - connection.once('timeout', timeoutHandler(self)); - connection.once('parseError', parseErrorHandler(self)); - connection.on('connect', connectHandler(self)); - - // Start connection - connection.connect(_options); - }); - }, wait); - - // wait for 1 miliseconds before attempting to connect, spacing out connections - wait = wait + 1; - } -} - -/** - * Get a pool connection (round-robin) - * @method - * @return {Connection} - */ -Pool.prototype.get = function() { - // if(this.dead) return null; - var connection = this.connections[this.index++]; - this.index = this.index % this.connections.length; - return connection; -} - -/** - * Get all pool connections - * @method - * @return {array} - */ -Pool.prototype.getAll = function() { - return this.connections.slice(0); -} - -/** - * Is the pool connected - * @method - * @return {boolean} - */ -Pool.prototype.isConnected = function() { - for(var i = 0; i < this.connections.length; i++) { - if(!this.connections[i].isConnected()) return false; - } - - return this.state == CONNECTED; -} - -/** - * Was the pool destroyed - * @method - * @return {boolean} - */ -Pool.prototype.isDestroyed = function() { - return this.state == DESTROYED; -} - - -/** - * A server connect event, used to verify that the connection is up and running - * - * @event Pool#connect - * @type {Pool} - */ - -/** - * The server connection closed, all pool connections closed - * - * @event Pool#close - * @type {Pool} - */ - -/** - * The server connection caused an error, all pool connections closed - * - * @event Pool#error - * @type {Pool} - */ - -/** - * The server connection timed out, all pool connections closed - * - * @event Pool#timeout - * @type {Pool} - */ - -/** - * The driver experienced an invalid message, all pool connections closed - * - * @event Pool#parseError - * @type {Pool} - */ - -module.exports = Pool; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js deleted file mode 100644 index 7f0b89da..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/connection/utils.js +++ /dev/null @@ -1,77 +0,0 @@ -"use strict"; - -// Set property function -var setProperty = function(obj, prop, flag, values) { - Object.defineProperty(obj, prop.name, { - enumerable:true, - set: function(value) { - if(typeof value != 'boolean') throw new Error(f("%s required a boolean", prop.name)); - // Flip the bit to 1 - if(value == true) values.flags |= flag; - // Flip the bit to 0 if it's set, otherwise ignore - if(value == false && (values.flags & flag) == flag) values.flags ^= flag; - prop.value = value; - } - , get: function() { return prop.value; } - }); -} - -// Set property function -var getProperty = function(obj, propName, fieldName, values, func) { - Object.defineProperty(obj, propName, { - enumerable:true, - get: function() { - // Not parsed yet, parse it - if(values[fieldName] == null && obj.isParsed && !obj.isParsed()) { - obj.parse(); - } - - // Do we have a post processing function - if(typeof func == 'function') return func(values[fieldName]); - // Return raw value - return values[fieldName]; - } - }); -} - -// Set simple property -var getSingleProperty = function(obj, name, value) { - Object.defineProperty(obj, name, { - enumerable:true, - get: function() { - return value - } - }); -} - -// Shallow copy -var copy = function(fObj, tObj) { - tObj = tObj || {}; - for(var name in fObj) tObj[name] = fObj[name]; - return tObj; -} - -var debugOptions = function(debugFields, options) { - var finaloptions = {}; - debugFields.forEach(function(n) { - finaloptions[n] = options[n]; - }); - - return finaloptions; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) return callback; - return domain.bind(callback); -} - -exports.setProperty = setProperty; -exports.getProperty = getProperty; -exports.getSingleProperty = getSingleProperty; -exports.copy = copy; -exports.bindToCurrentDomain = bindToCurrentDomain; -exports.debugOptions = debugOptions; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js deleted file mode 100644 index ab828181..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/cursor.js +++ /dev/null @@ -1,756 +0,0 @@ -"use strict"; - -var Long = require('bson').Long - , Logger = require('./connection/logger') - , MongoError = require('./error') - , f = require('util').format; - -/** - * This is a cursor results callback - * - * @callback resultCallback - * @param {error} error An error object. Set to null if no error present - * @param {object} document - */ - -/** - * @fileOverview The **Cursor** class is an internal class that embodies a cursor on MongoDB - * allowing for iteration over the results returned from the underlying query. - * - * **CURSORS Cannot directly be instantiated** - * @example - * var Server = require('mongodb-core').Server - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new Server({host: 'localhost', port: 27017}); - * // Wait for the connection event - * server.on('connect', function(server) { - * assert.equal(null, err); - * - * // Execute the write - * var cursor = _server.cursor('integration_tests.inserts_example4', { - * find: 'integration_tests.example4' - * , query: {a:1} - * }, { - * readPreference: new ReadPreference('secondary'); - * }); - * - * // Get the first document - * cursor.next(function(err, doc) { - * assert.equal(null, err); - * server.destroy(); - * }); - * }); - * - * // Start connecting - * server.connect(); - */ - -/** - * Creates a new Cursor, not to be used directly - * @class - * @param {object} bson An instance of the BSON parser - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|Long} cmd The selector (can be a command or a cursorId) - * @param {object} [options=null] Optional settings. - * @param {object} [options.batchSize=1000] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {object} [options.transforms=null] Transform methods for the cursor results - * @param {function} [options.transforms.query] Transform the value returned from the initial query - * @param {function} [options.transforms.doc] Transform each document returned from Cursor.prototype.next - * @param {object} topology The server topology instance. - * @param {object} topologyOptions The server topology options. - * @return {Cursor} A cursor instance - * @property {number} cursorBatchSize The current cursorBatchSize for the cursor - * @property {number} cursorLimit The current cursorLimit for the cursor - * @property {number} cursorSkip The current cursorSkip for the cursor - */ -var Cursor = function(bson, ns, cmd, options, topology, topologyOptions) { - options = options || {}; - // Cursor reference - var self = this; - // Initial query - var query = null; - - // Cursor connection - this.connection = null; - // Cursor server - this.server = null; - - // Do we have a not connected handler - this.disconnectHandler = options.disconnectHandler; - - // Set local values - this.bson = bson; - this.ns = ns; - this.cmd = cmd; - this.options = options; - this.topology = topology; - - // All internal state - this.cursorState = { - cursorId: null - , cmd: cmd - , documents: options.documents || [] - , cursorIndex: 0 - , dead: false - , killed: false - , init: false - , notified: false - , limit: options.limit || cmd.limit || 0 - , skip: options.skip || cmd.skip || 0 - , batchSize: options.batchSize || cmd.batchSize || 1000 - , currentLimit: 0 - // Result field name if not a cursor (contains the array of results) - , transforms: options.transforms - } - - // Callback controller - this.callbacks = null; - - // Logger - this.logger = Logger('Cursor', options); - - // - // Did we pass in a cursor id - if(typeof cmd == 'number') { - this.cursorState.cursorId = Long.fromNumber(cmd); - } else if(cmd instanceof Long) { - this.cursorState.cursorId = cmd; - } -} - -Cursor.prototype.setCursorBatchSize = function(value) { - this.cursorState.batchSize = value; -} - -Cursor.prototype.cursorBatchSize = function() { - return this.cursorState.batchSize; -} - -Cursor.prototype.setCursorLimit = function(value) { - this.cursorState.limit = value; -} - -Cursor.prototype.cursorLimit = function() { - return this.cursorState.limit; -} - -Cursor.prototype.setCursorSkip = function(value) { - this.cursorState.skip = value; -} - -Cursor.prototype.cursorSkip = function() { - return this.cursorState.skip; -} - -// // -// // Execute getMore command -// var execGetMore = function(self, callback) { -// } - -// -// Execute the first query -var execInitialQuery = function(self, query, cmd, options, cursorState, connection, logger, callbacks, callback) { - if(logger.isDebug()) { - logger.debug(f("issue initial query [%s] with flags [%s]" - , JSON.stringify(cmd) - , JSON.stringify(query))); - } - - var queryCallback = function(err, result) { - if(err) return callback(err); - - if(result.queryFailure) { - return callback(MongoError.create(result.documents[0]), null); - } - - // Check if we have a command cursor - if(Array.isArray(result.documents) && result.documents.length == 1 - && (!cmd.find || (cmd.find && cmd.virtual == false)) - && (result.documents[0].cursor != 'string' - || result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || Array.isArray(result.documents[0].result)) - ) { - - // We have a an error document return the error - if(result.documents[0]['$err'] - || result.documents[0]['errmsg']) { - return callback(MongoError.create(result.documents[0]), null); - } - - // We have a cursor document - if(result.documents[0].cursor != null - && typeof result.documents[0].cursor != 'string') { - var id = result.documents[0].cursor.id; - // If we have a namespace change set the new namespace for getmores - if(result.documents[0].cursor.ns) { - self.ns = result.documents[0].cursor.ns; - } - // Promote id to long if needed - cursorState.cursorId = typeof id == 'number' ? Long.fromNumber(id) : id; - // If we have a firstBatch set it - if(Array.isArray(result.documents[0].cursor.firstBatch)) { - cursorState.documents = result.documents[0].cursor.firstBatch;//.reverse(); - } - - // Return after processing command cursor - return callback(null, null); - } - - if(Array.isArray(result.documents[0].result)) { - cursorState.documents = result.documents[0].result; - cursorState.cursorId = Long.ZERO; - return callback(null, null); - } - } - - // Otherwise fall back to regular find path - cursorState.cursorId = result.cursorId; - cursorState.documents = result.documents; - - // Transform the results with passed in transformation method if provided - if(cursorState.transforms && typeof cursorState.transforms.query == 'function') { - cursorState.documents = cursorState.transforms.query(result); - } - - // Return callback - callback(null, null); - } - - // If we have a raw query decorate the function - if(options.raw || cmd.raw) { - queryCallback.raw = options.raw || cmd.raw; - } - - // Do we have documentsReturnedIn set on the query - if(typeof query.documentsReturnedIn == 'string') { - queryCallback.documentsReturnedIn = query.documentsReturnedIn; - } - - // Set up callback - callbacks.register(query.requestId, queryCallback); - - // Write the initial command out - connection.write(query.toBin()); -} - -// -// Handle callback (including any exceptions thrown) -var handleCallback = function(callback, err, result) { - try { - callback(err, result); - } catch(err) { - process.nextTick(function() { - throw err; - }); - } -} - - -// Internal methods -Cursor.prototype._find = function(callback) { - var self = this; - // execInitialQuery(self, self.query, self.cmd, self.options, self.cursorState, self.connection, self.logger, self.callbacks, function(err, r) { - if(self.logger.isDebug()) { - self.logger.debug(f("issue initial query [%s] with flags [%s]" - , JSON.stringify(self.cmd) - , JSON.stringify(self.query))); - } - - var queryCallback = function(err, result) { - if(err) return callback(err); - - if(result.queryFailure) { - return callback(MongoError.create(result.documents[0]), null); - } - - // Check if we have a command cursor - if(Array.isArray(result.documents) && result.documents.length == 1 - && (!self.cmd.find || (self.cmd.find && self.cmd.virtual == false)) - && (result.documents[0].cursor != 'string' - || result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || Array.isArray(result.documents[0].result)) - ) { - - // We have a an error document return the error - if(result.documents[0]['$err'] - || result.documents[0]['errmsg']) { - return callback(MongoError.create(result.documents[0]), null); - } - - // We have a cursor document - if(result.documents[0].cursor != null - && typeof result.documents[0].cursor != 'string') { - var id = result.documents[0].cursor.id; - // If we have a namespace change set the new namespace for getmores - if(result.documents[0].cursor.ns) { - self.ns = result.documents[0].cursor.ns; - } - // Promote id to long if needed - self.cursorState.cursorId = typeof id == 'number' ? Long.fromNumber(id) : id; - // If we have a firstBatch set it - if(Array.isArray(result.documents[0].cursor.firstBatch)) { - self.cursorState.documents = result.documents[0].cursor.firstBatch;//.reverse(); - } - - // Return after processing command cursor - return callback(null, null); - } - - if(Array.isArray(result.documents[0].result)) { - self.cursorState.documents = result.documents[0].result; - self.cursorState.cursorId = Long.ZERO; - return callback(null, null); - } - } - - // Otherwise fall back to regular find path - self.cursorState.cursorId = result.cursorId; - self.cursorState.documents = result.documents; - - // Transform the results with passed in transformation method if provided - if(self.cursorState.transforms && typeof self.cursorState.transforms.query == 'function') { - self.cursorState.documents = self.cursorState.transforms.query(result); - } - - // Return callback - callback(null, null); - } - // console.log("------------------------- 2") - - // If we have a raw query decorate the function - if(self.options.raw || self.cmd.raw) { - queryCallback.raw = self.options.raw || self.cmd.raw; - } - // console.log("------------------------- 3") - - // Do we have documentsReturnedIn set on the query - if(typeof self.query.documentsReturnedIn == 'string') { - queryCallback.documentsReturnedIn = self.query.documentsReturnedIn; - } - // console.log("------------------------- 4") - - // Set up callback - self.callbacks.register(self.query.requestId, queryCallback); - - // Write the initial command out - self.connection.write(self.query.toBin()); -// console.log("------------------------- 5") -} - -Cursor.prototype._getmore = function(callback) { - if(this.logger.isDebug()) this.logger.debug(f("schedule getMore call for query [%s]", JSON.stringify(this.query))) - // Determine if it's a raw query - var raw = this.options.raw || this.cmd.raw; - // We have a wire protocol handler - this.server.wireProtocolHandler.getMore(this.bson, this.ns, this.cursorState, this.cursorState.batchSize, raw, this.connection, this.callbacks, this.options, callback); -} - -Cursor.prototype._killcursor = function(callback) { - // Set cursor to dead - this.cursorState.dead = true; - this.cursorState.killed = true; - // Remove documents - this.cursorState.documents = []; - - // If no cursor id just return - if(this.cursorState.cursorId == null || this.cursorState.cursorId.isZero() || this.cursorState.init == false) { - if(callback) callback(null, null); - return; - } - - // Execute command - this.server.wireProtocolHandler.killCursor(this.bson, this.ns, this.cursorState.cursorId, this.connection, this.callbacks, callback); -} - -/** - * Clone the cursor - * @method - * @return {Cursor} - */ -Cursor.prototype.clone = function() { - return this.topology.cursor(this.ns, this.cmd, this.options); -} - -/** - * Checks if the cursor is dead - * @method - * @return {boolean} A boolean signifying if the cursor is dead or not - */ -Cursor.prototype.isDead = function() { - return this.cursorState.dead == true; -} - -/** - * Checks if the cursor was killed by the application - * @method - * @return {boolean} A boolean signifying if the cursor was killed by the application - */ -Cursor.prototype.isKilled = function() { - return this.cursorState.killed == true; -} - -/** - * Checks if the cursor notified it's caller about it's death - * @method - * @return {boolean} A boolean signifying if the cursor notified the callback - */ -Cursor.prototype.isNotified = function() { - return this.cursorState.notified == true; -} - -/** - * Returns current buffered documents length - * @method - * @return {number} The number of items in the buffered documents - */ -Cursor.prototype.bufferedCount = function() { - return this.cursorState.documents.length - this.cursorState.cursorIndex; -} - -/** - * Returns current buffered documents - * @method - * @return {Array} An array of buffered documents - */ -Cursor.prototype.readBufferedDocuments = function(number) { - var unreadDocumentsLength = this.cursorState.documents.length - this.cursorState.cursorIndex; - var length = number < unreadDocumentsLength ? number : unreadDocumentsLength; - var elements = this.cursorState.documents.slice(this.cursorState.cursorIndex, this.cursorState.cursorIndex + length); - - // Transform the doc with passed in transformation method if provided - if(this.cursorState.transforms && typeof this.cursorState.transforms.doc == 'function') { - // Transform all the elements - for(var i = 0; i < elements.length; i++) { - elements[i] = this.cursorState.transforms.doc(elements[i]); - } - } - - // Ensure we do not return any more documents than the limit imposed - // Just return the number of elements up to the limit - if(this.cursorState.limit > 0 && (this.cursorState.currentLimit + elements.length) > this.cursorState.limit) { - elements = elements.slice(0, (this.cursorState.limit - this.cursorState.currentLimit)); - this.kill(); - } - - // Adjust current limit - this.cursorState.currentLimit = this.cursorState.currentLimit + elements.length; - this.cursorState.cursorIndex = this.cursorState.cursorIndex + elements.length; - - // Return elements - return elements; -} - -/** - * Kill the cursor - * @method - * @param {resultCallback} callback A callback function - */ -Cursor.prototype.kill = function(callback) { - this._killcursor(callback); -} - -/** - * Resets the cursor - * @method - * @return {null} - */ -Cursor.prototype.rewind = function() { - if(this.cursorState.init) { - if(!this.cursorState.dead) { - this.kill(); - } - - this.cursorState.currentLimit = 0; - this.cursorState.init = false; - this.cursorState.dead = false; - this.cursorState.killed = false; - this.cursorState.notified = false; - this.cursorState.documents = []; - this.cursorState.cursorId = null; - this.cursorState.cursorIndex = 0; - } -} - -/** - * Validate if the connection is dead and return error - */ -var isConnectionDead = function(self, callback) { - if(self.connection - && !self.connection.isConnected()) { - self.cursorState.notified = true; - self.cursorState.killed = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - callback(MongoError.create(f('connection to host %s:%s was destroyed', self.connection.host, self.connection.port))) - return true; - } - - return false; -} - -/** - * Validate if the cursor is dead but was not explicitly killed by user - */ -var isCursorDeadButNotkilled = function(self, callback) { - // Cursor is dead but not marked killed, return null - if(self.cursorState.dead && !self.cursorState.killed) { - self.cursorState.notified = true; - self.cursorState.killed = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); - return true; - } - - return false; -} - -/** - * Validate if the cursor is dead and was killed by user - */ -var isCursorDeadAndKilled = function(self, callback) { - if(self.cursorState.dead && self.cursorState.killed) { - handleCallback(callback, MongoError.create("cursor is dead")); - return true; - } - - return false; -} - -/** - * Validate if the cursor was killed by the user - */ -var isCursorKilled = function(self, callback) { - if(self.cursorState.killed) { - self.cursorState.notified = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); - return true; - } - - return false; -} - -/** - * Mark cursor as being dead and notified - */ -var setCursorDeadAndNotified = function(self, callback) { - self.cursorState.dead = true; - self.cursorState.notified = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); -} - -/** - * Mark cursor as being notified - */ -var setCursorNotified = function(self, callback) { - self.cursorState.notified = true; - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - handleCallback(callback, null, null); -} - -var nextFunction = function(self, callback) { - // We have notified about it - if(self.cursorState.notified) { - return callback(new Error('cursor is exhausted')); - } - - // Cursor is killed return null - if(isCursorKilled(self, callback)) return; - - // Cursor is dead but not marked killed, return null - if(isCursorDeadButNotkilled(self, callback)) return; - - // We have a dead and killed cursor, attempting to call next should error - if(isCursorDeadAndKilled(self, callback)) return; - - // We have just started the cursor - if(!self.cursorState.init) { - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.topology.isConnected(self.options) && self.disconnectHandler != null) { - return self.disconnectHandler.addObjectAndMethod('cursor', self, 'next', [callback], callback); - } - - try { - // Get a server - self.server = self.topology.getServer(self.options); - // Get a connection - self.connection = self.server.getConnection(); - // Get the callbacks - self.callbacks = self.server.getCallbacks(); - } catch(err) { - return callback(err); - } - - // Set as init - self.cursorState.init = true; - - try { - // Get the right wire protocol command - self.query = self.server.wireProtocolHandler.command(self.bson, self.ns, self.cmd, self.cursorState, self.topology, self.options); - } catch(err) { - return callback(err); - } - } - - // Process exhaust messages - var processExhaustMessages = function(err, result) { - if(err) { - self.cursorState.dead = true; - self.callbacks.unregister(self.query.requestId); - return callback(err); - } - - // Concatenate all the documents - self.cursorState.documents = self.cursorState.documents.concat(result.documents); - - // If we have no documents left - if(Long.ZERO.equals(result.cursorId)) { - self.cursorState.cursorId = Long.ZERO; - self.callbacks.unregister(self.query.requestId); - return nextFunction(self, callback); - } - - // Set up next listener - self.callbacks.register(result.requestId, processExhaustMessages) - - // Initial result - if(self.cursorState.cursorId == null) { - self.cursorState.cursorId = result.cursorId; - nextFunction(self, callback); - } - } - - // If we have exhaust - if(self.cmd.exhaust && self.cursorState.cursorId == null) { - // Handle all the exhaust responses - self.callbacks.register(self.query.requestId, processExhaustMessages); - // Write the initial command out - return self.connection.write(self.query.toBin()); - } else if(self.cmd.exhaust && self.cursorState.cursorIndex < self.cursorState.documents.length) { - return handleCallback(callback, null, self.cursorState.documents[self.cursorState.cursorIndex++]); - } else if(self.cmd.exhaust && Long.ZERO.equals(self.cursorState.cursorId)) { - self.callbacks.unregister(self.query.requestId); - return setCursorNotified(self, callback); - } else if(self.cmd.exhaust) { - return setTimeout(function() { - if(Long.ZERO.equals(self.cursorState.cursorId)) return; - nextFunction(self, callback); - }, 1); - } - - // If we don't have a cursorId execute the first query - if(self.cursorState.cursorId == null) { - // Check if connection is dead and return if not possible to - // execute the query against the db - if(isConnectionDead(self, callback)) return; - - // Check if topology is destroyed - if(self.topology.isDestroyed()) return callback(new MongoError(f('connection destroyed, not possible to instantiate cursor'))); - - // query, cmd, options, cursorState, callback - self._find(function(err, r) { - if(err) return handleCallback(callback, err, null); - if(self.cursorState.documents.length == 0 && !self.cmd.tailable && !self.cmd.awaitData) { - return setCursorNotified(self, callback); - } - - nextFunction(self, callback); - }); - } else if(self.cursorState.limit > 0 && self.cursorState.currentLimit >= self.cursorState.limit) { - // Ensure we kill the cursor on the server - self.kill(); - // Set cursor in dead and notified state - return setCursorDeadAndNotified(self, callback); - } else if(self.cursorState.cursorIndex == self.cursorState.documents.length - && !Long.ZERO.equals(self.cursorState.cursorId)) { - // Ensure an empty cursor state - self.cursorState.documents = []; - self.cursorState.cursorIndex = 0; - - // Check if topology is destroyed - if(self.topology.isDestroyed()) return callback(new MongoError(f('connection destroyed, not possible to instantiate cursor'))); - - // Check if connection is dead and return if not possible to - // execute a getmore on this connection - if(isConnectionDead(self, callback)) return; - - // Execute the next get more - self._getmore(function(err, doc) { - if(err) return handleCallback(callback, err); - if(self.cursorState.documents.length == 0 - && Long.ZERO.equals(self.cursorState.cursorId)) { - self.cursorState.dead = true; - } - - // Tailable cursor getMore result, notify owner about it - // No attempt is made here to retry, this is left to the user of the - // core module to handle to keep core simple - if(self.cursorState.documents.length == 0 && self.cmd.tailable) { - return handleCallback(callback, MongoError.create({ - message: "No more documents in tailed cursor" - , tailable: self.cmd.tailable - , awaitData: self.cmd.awaitData - })); - } - - if(self.cursorState.limit > 0 && self.cursorState.currentLimit >= self.cursorState.limit) { - return setCursorDeadAndNotified(self, callback); - } - - nextFunction(self, callback); - }); - } else if(self.cursorState.documents.length == self.cursorState.cursorIndex - && self.cmd.tailable) { - return handleCallback(callback, MongoError.create({ - message: "No more documents in tailed cursor" - , tailable: self.cmd.tailable - , awaitData: self.cmd.awaitData - })); - } else if(self.cursorState.documents.length == self.cursorState.cursorIndex - && Long.ZERO.equals(self.cursorState.cursorId)) { - setCursorDeadAndNotified(self, callback); - } else { - if(self.cursorState.limit > 0 && self.cursorState.currentLimit >= self.cursorState.limit) { - // Ensure we kill the cursor on the server - self.kill(); - // Set cursor in dead and notified state - return setCursorDeadAndNotified(self, callback); - } - - // Increment the current cursor limit - self.cursorState.currentLimit += 1; - - // Get the document - var doc = self.cursorState.documents[self.cursorState.cursorIndex++]; - - // Transform the doc with passed in transformation method if provided - if(self.cursorState.transforms && typeof self.cursorState.transforms.doc == 'function') { - doc = self.cursorState.transforms.doc(doc); - } - - // Return the document - handleCallback(callback, null, doc); - } -} - -/** - * Retrieve the next document from the cursor - * @method - * @param {resultCallback} callback A callback function - */ -Cursor.prototype.next = function(callback) { - nextFunction(this, callback); -} - -module.exports = Cursor; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js deleted file mode 100644 index 4e17ef3d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/error.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; - -/** - * Creates a new MongoError - * @class - * @augments Error - * @param {string} message The error message - * @return {MongoError} A MongoError instance - */ -function MongoError(message) { - this.name = 'MongoError'; - this.message = message; - Error.captureStackTrace(this, MongoError); -} - -/** - * Creates a new MongoError object - * @method - * @param {object} options The error options - * @return {MongoError} A MongoError instance - */ -MongoError.create = function(options) { - var err = null; - - if(options instanceof Error) { - err = new MongoError(options.message); - err.stack = options.stack; - } else if(typeof options == 'string') { - err = new MongoError(options); - } else { - err = new MongoError(options.message || options.errmsg || options.$err || "n/a"); - // Other options - for(var name in options) { - err[name] = options[name]; - } - } - - return err; -} - -// Extend JavaScript error -MongoError.prototype = new Error; - -module.exports = MongoError; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js deleted file mode 100644 index dcceda4b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/tools/smoke_plugin.js +++ /dev/null @@ -1,59 +0,0 @@ -var fs = require('fs'); - -/* Note: because this plugin uses process.on('uncaughtException'), only one - * of these can exist at any given time. This plugin and anything else that - * uses process.on('uncaughtException') will conflict. */ -exports.attachToRunner = function(runner, outputFile) { - var smokeOutput = { results : [] }; - var runningTests = {}; - - var integraPlugin = { - beforeTest: function(test, callback) { - test.startTime = Date.now(); - runningTests[test.name] = test; - callback(); - }, - afterTest: function(test, callback) { - smokeOutput.results.push({ - status: test.status, - start: test.startTime, - end: Date.now(), - test_file: test.name, - exit_code: 0, - url: "" - }); - delete runningTests[test.name]; - callback(); - }, - beforeExit: function(obj, callback) { - fs.writeFile(outputFile, JSON.stringify(smokeOutput), function() { - callback(); - }); - } - }; - - // In case of exception, make sure we write file - process.on('uncaughtException', function(err) { - // Mark all currently running tests as failed - for (var testName in runningTests) { - smokeOutput.results.push({ - status: "fail", - start: runningTests[testName].startTime, - end: Date.now(), - test_file: testName, - exit_code: 0, - url: "" - }); - } - - // write file - fs.writeFileSync(outputFile, JSON.stringify(smokeOutput)); - - // Standard NodeJS uncaught exception handler - console.error(err.stack); - process.exit(1); - }); - - runner.plugin(integraPlugin); - return integraPlugin; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js deleted file mode 100644 index ff7bf1b0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/command_result.js +++ /dev/null @@ -1,37 +0,0 @@ -"use strict"; - -var setProperty = require('../connection/utils').setProperty - , getProperty = require('../connection/utils').getProperty - , getSingleProperty = require('../connection/utils').getSingleProperty; - -/** - * Creates a new CommandResult instance - * @class - * @param {object} result CommandResult object - * @param {Connection} connection A connection instance associated with this result - * @return {CommandResult} A cursor instance - */ -var CommandResult = function(result, connection) { - this.result = result; - this.connection = connection; -} - -/** - * Convert CommandResult to JSON - * @method - * @return {object} - */ -CommandResult.prototype.toJSON = function() { - return this.result; -} - -/** - * Convert CommandResult to String representation - * @method - * @return {string} - */ -CommandResult.prototype.toString = function() { - return JSON.stringify(this.toJSON()); -} - -module.exports = CommandResult; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js deleted file mode 100644 index c54514a4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/mongos.js +++ /dev/null @@ -1,1000 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , b = require('bson') - , bindToCurrentDomain = require('../connection/utils').bindToCurrentDomain - , EventEmitter = require('events').EventEmitter - , BasicCursor = require('../cursor') - , BSON = require('bson').native().BSON - , BasicCursor = require('../cursor') - , Server = require('./server') - , Logger = require('../connection/logger') - , ReadPreference = require('./read_preference') - , Session = require('./session') - , MongoError = require('../error'); - -/** - * @fileOverview The **Mongos** class is a class that represents a Mongos Proxy topology and is - * used to construct connections. - * - * @example - * var Mongos = require('mongodb-core').Mongos - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new Mongos([{host: 'localhost', port: 30000}]); - * // Wait for the connection event - * server.on('connect', function(server) { - * server.destroy(); - * }); - * - * // Start connecting - * server.connect(); - */ - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -// All bson types -var bsonTypes = [b.Long, b.ObjectID, b.Binary, b.Code, b.DBRef, b.Symbol, b.Double, b.Timestamp, b.MaxKey, b.MinKey]; -// BSON parser -var bsonInstance = null; - -// Instance id -var mongosId = 0; - -// -// Clone the options -var cloneOptions = function(options) { - var opts = {}; - for(var name in options) { - opts[name] = options[name]; - } - return opts; -} - -var State = function(readPreferenceStrategies) { - // Internal state - this.s = { - connectedServers: [] - , disconnectedServers: [] - , readPreferenceStrategies: readPreferenceStrategies - } -} - -// -// A Mongos connected -State.prototype.connected = function(server) { - // Locate in disconnected servers and remove - this.s.disconnectedServers = this.s.disconnectedServers.filter(function(s) { - return !s.equals(server); - }); - - var found = false; - // Check if the server exists - this.s.connectedServers.forEach(function(s) { - if(s.equals(server)) found = true; - }); - - // Add to disconnected list if it does not already exist - if(!found) this.s.connectedServers.push(server); -} - -// -// A Mongos disconnected -State.prototype.disconnected = function(server) { - // Locate in disconnected servers and remove - this.s.connectedServers = this.s.connectedServers.filter(function(s) { - return !s.equals(server); - }); - - var found = false; - // Check if the server exists - this.s.disconnectedServers.forEach(function(s) { - if(s.equals(server)) found = true; - }); - - // Add to disconnected list if it does not already exist - if(!found) this.s.disconnectedServers.push(server); -} - -// -// Return the list of disconnected servers -State.prototype.disconnectedServers = function() { - return this.s.disconnectedServers.slice(0); -} - -// -// Get connectedServers -State.prototype.connectedServers = function() { - return this.s.connectedServers.slice(0) -} - -// -// Get all servers -State.prototype.getAll = function() { - return this.s.connectedServers.slice(0).concat(this.s.disconnectedServers); -} - -// -// Get all connections -State.prototype.getAllConnections = function() { - var connections = []; - this.s.connectedServers.forEach(function(e) { - connections = connections.concat(e.connections()); - }); - return connections; -} - -// -// Destroy the state -State.prototype.destroy = function() { - // Destroy any connected servers - while(this.s.connectedServers.length > 0) { - var server = this.s.connectedServers.shift(); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Server destroy - server.destroy(); - // Add to list of disconnected servers - this.s.disconnectedServers.push(server); - } -} - -// -// Are we connected -State.prototype.isConnected = function() { - return this.s.connectedServers.length > 0; -} - -// -// Pick a server -State.prototype.pickServer = function(readPreference) { - readPreference = readPreference || ReadPreference.primary; - - // Do we have a custom readPreference strategy, use it - if(this.s.readPreferenceStrategies != null && this.s.readPreferenceStrategies[readPreference] != null) { - return this.s.readPreferenceStrategies[readPreference].pickServer(connectedServers, readPreference); - } - - // No valid connections - if(this.s.connectedServers.length == 0) throw new MongoError("no mongos proxy available"); - // Pick first one - return this.s.connectedServers[0]; -} - -/** - * Creates a new Mongos instance - * @class - * @param {array} seedlist A list of seeds for the replicaset - * @param {number} [options.reconnectTries=30] Reconnect retries for HA if no servers available - * @param {number} [options.haInterval=5000] The High availability period for replicaset inquiry - * @param {boolean} [options.emitError=false] Server will emit errors events - * @param {Cursor} [options.cursorFactory=Cursor] The cursor factory class used for all query cursors - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=1000] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @return {Mongos} A cursor instance - * @fires Mongos#connect - * @fires Mongos#joined - * @fires Mongos#left - */ -var Mongos = function(seedlist, options) { - var self = this; - options = options || {}; - - // Add event listener - EventEmitter.call(this); - - // Validate seedlist - if(!Array.isArray(seedlist)) throw new MongoError("seedlist must be an array"); - // Validate list - if(seedlist.length == 0) throw new MongoError("seedlist must contain at least one entry"); - // Validate entries - seedlist.forEach(function(e) { - if(typeof e.host != 'string' || typeof e.port != 'number') - throw new MongoError("seedlist entry must contain a host and port"); - }); - - // BSON Parser, ensure we have a single instance - bsonInstance = bsonInstance == null ? new BSON(bsonTypes) : bsonInstance; - // Pick the right bson parser - var bson = options.bson ? options.bson : bsonInstance; - // Add bson parser to options - options.bson = bson; - - // The Mongos state - this.s = { - // Seed list for sharding passed in - seedlist: seedlist - // Passed in options - , options: options - // Logger - , logger: Logger('Mongos', options) - // Reconnect tries - , reconnectTries: options.reconnectTries || 30 - // Ha interval - , haInterval: options.haInterval || 5000 - // Have omitted fullsetup - , fullsetup: false - // Cursor factory - , Cursor: options.cursorFactory || BasicCursor - // Current credentials used for auth - , credentials: [] - // BSON Parser - , bsonInstance: bsonInstance - , bson: bson - // Default state - , state: DISCONNECTED - // Swallow or emit errors - , emitError: typeof options.emitError == 'boolean' ? options.emitError : false - // Contains any alternate strategies for picking - , readPreferenceStrategies: {} - // Auth providers - , authProviders: {} - // Unique instance id - , id: mongosId++ - // Authentication in progress - , authInProgress: false - // Servers added while auth in progress - , authInProgressServers: [] - // Current retries left - , retriesLeft: options.reconnectTries || 30 - // Do we have a not connected handler - , disconnectHandler: options.disconnectHandler - } - - // Set up the connection timeout for the options - options.connectionTimeout = options.connectionTimeout || 1000; - - // Create a new state for the mongos - this.s.mongosState = new State(this.s.readPreferenceStrategies); - - // BSON property (find a server and pass it along) - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - var servers = self.s.mongosState.getAll(); - return servers.length > 0 ? servers[0].bson : null; - } - }); - - Object.defineProperty(this, 'id', { - enumerable:true, get: function() { return self.s.id; } - }); - - Object.defineProperty(this, 'type', { - enumerable:true, get: function() { return 'mongos'; } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return self.s.haInterval; } - }); - - Object.defineProperty(this, 'state', { - enumerable:true, get: function() { return self.s.mongosState; } - }); -} - -inherits(Mongos, EventEmitter); - -/** - * Name of BSON parser currently used - * @method - * @return {string} - */ -Mongos.prototype.parserType = function() { - if(this.s.bson.serialize.toString().indexOf('[native code]') != -1) - return 'c++'; - return 'js'; -} - -/** - * Execute a command - * @method - * @param {string} type Type of BSON parser to use (c++ or js) - */ -Mongos.prototype.setBSONParserType = function(type) { - var nBSON = null; - - if(type == 'c++') { - nBSON = require('bson').native().BSON; - } else if(type == 'js') { - nBSON = require('bson').pure().BSON; - } else { - throw new MongoError(f("% parser not supported", type)); - } - - this.s.options.bson = new nBSON(bsonTypes); -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -Mongos.prototype.lastIsMaster = function() { - var connectedServers = this.s.mongosState.connectedServers(); - if(connectedServers.length > 0) return connectedServers[0].lastIsMaster(); - return null; -} - -/** - * Initiate server connect - * @method - */ -Mongos.prototype.connect = function(_options) { - var self = this; - // Start replicaset inquiry process - setTimeout(mongosInquirer(self, self.s), self.s.haInterval); - // Additional options - if(_options) for(var name in _options) self.s.options[name] = _options[name]; - // For all entries in the seedlist build a server instance - self.s.seedlist.forEach(function(e) { - // Clone options - var opts = cloneOptions(self.s.options); - // Add host and port - opts.host = e.host; - opts.port = e.port; - opts.reconnect = false; - opts.readPreferenceStrategies = self.s.readPreferenceStrategies; - // Share the auth store - opts.authProviders = self.s.authProviders; - // Don't emit errors - opts.emitError = true; - // Create a new Server - self.s.mongosState.disconnected(new Server(opts)); - }); - - // Get the disconnected servers - var servers = self.s.mongosState.disconnectedServers(); - - // Attempt to connect to all the servers - while(servers.length > 0) { - // Get the server - var server = servers.shift(); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect', 'message', 'parseError'].forEach(function(e) { - server.removeAllListeners(e); - }); - - // Set up the event handlers - server.once('error', errorHandlerTemp(self, self.s, server)); - server.once('close', errorHandlerTemp(self, self.s, server)); - server.once('timeout', errorHandlerTemp(self, self.s, server)); - server.once('parseError', errorHandlerTemp(self, self.s, server)); - server.once('connect', connectHandler(self, self.s, 'connect')); - - if(self.s.logger.isInfo()) self.s.logger.info(f('connecting to server %s', server.name)); - // Attempt to connect - server.connect(); - } -} - -/** - * Destroy the server connection - * @method - */ -Mongos.prototype.destroy = function(emitClose) { - this.s.state = DESTROYED; - // Emit close - if(emitClose && self.listeners('close').length > 0) self.emit('close', self); - // Destroy the state - this.s.mongosState.destroy(); -} - -/** - * Figure out if the server is connected - * @method - * @return {boolean} - */ -Mongos.prototype.isConnected = function() { - return this.s.mongosState.isConnected(); -} - -/** - * Figure out if the server instance was destroyed by calling destroy - * @method - * @return {boolean} - */ -Mongos.prototype.isDestroyed = function() { - return this.s.state == DESTROYED; -} - -// -// Operations -// - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.insert = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('insert', ns, ops, options, callback); - } - - executeWriteOperation(this.s, 'insert', ns, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.update = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('update', ns, ops, options, callback); - } - - executeWriteOperation(this.s, 'update', ns, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.remove = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('remove', ns, ops, options, callback); - } - - executeWriteOperation(this.s, 'remove', ns, ops, options, callback); -} - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Connection} [options.connection] Specify connection object to execute command against - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.command = function(ns, cmd, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - var self = this; - - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('command', ns, cmd, options, callback); - } - - var server = null; - // Ensure we have no options - options = options || {}; - - // We need to execute the command on all servers - if(options.onAll) { - var servers = self.s.mongosState.getAll(); - var count = servers.length; - var cmdErr = null; - - for(var i = 0; i < servers.length; i++) { - servers[i].command(ns, cmd, options, function(err, r) { - count = count - 1; - // Finished executing command - if(count == 0) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(state, ns); - // Return the error - callback(err, r); - } - }); - } - - return; - } - - - try { - // Get a primary - server = self.s.mongosState.pickServer(options.writeConcern ? ReadPreference.primary : options.readPreference); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no mongos found")); - server.command(ns, cmd, options, function(err, r) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(self.s, ns); - callback(err, r); - }); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Mongos.prototype.cursor = function(ns, cmd, cursorOptions) { - cursorOptions = cursorOptions || {}; - var FinalCursor = cursorOptions.cursorFactory || this.s.Cursor; - return new FinalCursor(this.s.bson, ns, cmd, cursorOptions, this, this.s.options); -} - -/** - * Authenticate using a specified mechanism - * @method - * @param {string} mechanism The Auth mechanism we are invoking - * @param {string} db The db we are invoking the mechanism against - * @param {...object} param Parameters for the specific mechanism - * @param {authResultCallback} callback A callback function - */ -Mongos.prototype.auth = function(mechanism, db) { - var allArgs = Array.prototype.slice.call(arguments, 0).slice(0); - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - var callback = args.pop(); - - // If we don't have the mechanism fail - if(this.s.authProviders[mechanism] == null && mechanism != 'default') - throw new MongoError(f("auth provider %s does not exist", mechanism)); - - // Authenticate against all the servers - var servers = this.s.mongosState.connectedServers().slice(0); - var count = servers.length; - // Correct authentication - var authenticated = true; - var authErr = null; - // Set auth in progress - this.s.authInProgress = true; - - // Authenticate against all servers - while(servers.length > 0) { - var server = servers.shift(); - // Arguments without a callback - var argsWithoutCallback = [mechanism, db].concat(args.slice(0)); - // Create arguments - var finalArguments = argsWithoutCallback.concat([function(err, r) { - count = count - 1; - if(err) authErr = err; - if(!r) authenticated = false; - - // We are done - if(count == 0) { - // We have more servers that are not authenticated, let's authenticate - if(self.s.authInProgressServers.length > 0) { - self.s.authInProgressServers = []; - return self.auth.apply(self, [mechanism, db].concat(args).concat([callback])); - } - - // Auth is done - self.s.authInProgress = false; - // Add successful credentials - if(authErr == null) addCredentials(self.s, db, argsWithoutCallback); - // Return the auth error - if(authErr) return callback(authErr, false); - // Successfully authenticated session - callback(null, new Session({}, self)); - } - }]); - - // Execute the auth - server.auth.apply(server, finalArguments); - } -} - -// -// Plugin methods -// - -/** - * Add custom read preference strategy - * @method - * @param {string} name Name of the read preference strategy - * @param {object} strategy Strategy object instance - */ -Mongos.prototype.addReadPreferenceStrategy = function(name, strategy) { - if(this.s.readPreferenceStrategies == null) this.s.readPreferenceStrategies = {}; - this.s.readPreferenceStrategies[name] = strategy; -} - -/** - * Add custom authentication mechanism - * @method - * @param {string} name Name of the authentication mechanism - * @param {object} provider Authentication object instance - */ -Mongos.prototype.addAuthProvider = function(name, provider) { - this.s.authProviders[name] = provider; -} - -/** - * Get connection - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Connection} - */ -Mongos.prototype.getConnection = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - var server = this.s.mongosState.pickServer(options.readPreference); - if(server == null) return null; - // Return connection - return server.getConnection(); -} - -/** - * Get server - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Server} - */ -Mongos.prototype.getServer = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - return this.s.mongosState.pickServer(options.readPreference); -} - -/** - * All raw connections - * @method - * @return {Connection[]} - */ -Mongos.prototype.connections = function() { - return this.s.mongosState.getAllConnections(); -} - -// -// Inquires about state changes -// -var mongosInquirer = function(self, state) { - return function() { - if(state.state == DESTROYED) return - if(state.state == CONNECTED) state.retriesLeft = state.reconnectTries; - - // If we have a disconnected site - if(state.state == DISCONNECTED && state.retriesLeft == 0) { - self.destroy(); - return self.emit('error', new MongoError(f('failed to reconnect after %s', state.reconnectTries))); - } else if(state == DISCONNECTED) { - state.retriesLeft = state.retriesLeft - 1; - } - - // If we have a primary and a disconnect handler, execute - // buffered operations - if(state.mongosState.isConnected() && state.disconnectHandler) { - state.disconnectHandler.execute(); - } - - // Log the information - if(state.logger.isDebug()) state.logger.debug(f('mongos ha proceess running')); - - // Let's query any disconnected proxies - var disconnectedServers = state.mongosState.disconnectedServers(); - if(disconnectedServers.length == 0) return setTimeout(mongosInquirer(self, state), state.haInterval); - - // Count of connections waiting to be connected - var connectionCount = disconnectedServers.length; - if(state.logger.isDebug()) state.logger.debug(f('mongos ha proceess found %d disconnected proxies', connectionCount)); - - // Let's attempt to reconnect - while(disconnectedServers.length > 0) { - var server = disconnectedServers.shift(); - if(state.logger.isDebug()) state.logger.debug(f('attempting to connect to server %s', server.name)); - - // Remove any listeners - ['error', 'close', 'timeout', 'connect', 'message', 'parseError'].forEach(function(e) { - server.removeAllListeners(e); - }); - - // Set up the event handlers - server.once('error', errorHandlerTemp(self, state, server)); - server.once('close', errorHandlerTemp(self, state, server)); - server.once('timeout', errorHandlerTemp(self, state, server)); - server.once('connect', connectHandler(self, state, 'ha')); - // Start connect - server.connect(); - } - - // Let's keep monitoring but wait for possible timeout to happen - return setTimeout(mongosInquirer(self, state), state.options.connectionTimeout + state.haInterval); - } -} - -// -// Error handler for initial connect -var errorHandlerTemp = function(self, state, server) { - return function(err, server) { - // Log the information - if(state.logger.isInfo()) state.logger.info(f('server %s disconnected with error %s', server.name, JSON.stringify(err))); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Signal disconnect of server - state.mongosState.disconnected(server); - } -} - -// -// Handlers -var errorHandler = function(self, state) { - return function(err, server) { - if(state.logger.isInfo()) state.logger.info(f('server %s errored out with %s', server.name, JSON.stringify(err))); - state.mongosState.disconnected(server); - // No more servers left emit close - if(state.mongosState.connectedServers().length == 0) { - state.state = DISCONNECTED; - } - - // Signal server left - self.emit('left', 'mongos', server); - if(state.emitError) self.emit('error', err, server); - } -} - -var timeoutHandler = function(self, state) { - return function(err, server) { - if(state.logger.isInfo()) state.logger.info(f('server %s timed out', server.name)); - state.mongosState.disconnected(server); - - // No more servers emit close event if no entries left - if(state.mongosState.connectedServers().length == 0) { - state.state = DISCONNECTED; - } - - // Signal server left - self.emit('left', 'mongos', server); - } -} - -var closeHandler = function(self, state) { - return function(err, server) { - if(state.logger.isInfo()) state.logger.info(f('server %s closed', server.name)); - state.mongosState.disconnected(server); - - // No more servers left emit close - if(state.mongosState.connectedServers().length == 0) { - state.state = DISCONNECTED; - } - - // Signal server left - self.emit('left', 'mongos', server); - } -} - -// Connect handler -var connectHandler = function(self, state, e) { - return function(server) { - if(state.logger.isInfo()) state.logger.info(f('connected to %s', server.name)); - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect', 'message', 'parseError'].forEach(function(e) { - server.removeAllListeners(e); - }); - - // finish processing the server - var processNewServer = function(_server) { - // Add the server handling code - if(_server.isConnected()) { - _server.once('error', errorHandler(self, state)); - _server.once('close', closeHandler(self, state)); - _server.once('timeout', timeoutHandler(self, state)); - _server.once('parseError', timeoutHandler(self, state)); - } - - // Emit joined event - self.emit('joined', 'mongos', _server); - - // Add to list connected servers - state.mongosState.connected(_server); - - // Do we have a reconnect event - if('ha' == e && state.mongosState.connectedServers().length == 1) { - self.emit('reconnect', _server); - } - - // Full setup - if(state.mongosState.disconnectedServers().length == 0 && - state.mongosState.connectedServers().length > 0 && - !state.fullsetup) { - state.fullsetup = true; - self.emit('fullsetup'); - } - - // all connected - if(state.mongosState.disconnectedServers().length == 0 && - state.mongosState.connectedServers().length == state.seedlist.length && - !state.all) { - state.all = true; - self.emit('all'); - } - - // Set connected - if(state.state == DISCONNECTED) { - state.state = CONNECTED; - self.emit('connect', self); - } - } - - // Is there an authentication process ongoing - if(state.authInProgress) { - state.authInProgressServers.push(server); - } - - // No credentials just process server - if(state.credentials.length == 0) return processNewServer(server); - - // Do we have credentials, let's apply them all - var count = state.credentials.length; - // Apply the credentials - for(var i = 0; i < state.credentials.length; i++) { - server.auth.apply(server, state.credentials[i].concat([function(err, r) { - count = count - 1; - if(count == 0) processNewServer(server); - }])); - } - } -} - -// -// Add server to the list if it does not exist -var addToListIfNotExist = function(list, server) { - var found = false; - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Check if the server already exists - for(var i = 0; i < list.length; i++) { - if(list[i].equals(server)) found = true; - } - - if(!found) { - list.push(server); - } -} - -// Add the new credential for a db, removing the old -// credential from the cache -var addCredentials = function(state, db, argsWithoutCallback) { - // Remove any credentials for the db - clearCredentials(state, db + ".dummy"); - // Add new credentials to list - state.credentials.push(argsWithoutCallback); -} - -// Clear out credentials for a namespace -var clearCredentials = function(state, ns) { - var db = ns.split('.')[0]; - var filteredCredentials = []; - - // Filter out all credentials for the db the user is logging out off - for(var i = 0; i < state.credentials.length; i++) { - if(state.credentials[i][1] != db) filteredCredentials.push(state.credentials[i]); - } - - // Set new list of credentials - state.credentials = filteredCredentials; -} - -var processReadPreference = function(cmd, options) { - options = options || {} - // No read preference specified - if(options.readPreference == null) return cmd; -} - -// -// Execute write operation -var executeWriteOperation = function(state, op, ns, ops, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - var server = null; - // Ensure we have no options - options = options || {}; - try { - // Get a primary - server = state.mongosState.pickServer(); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no mongos found")); - // Execute the command - server[op](ns, ops, options, callback); -} - -/** - * A mongos connect event, used to verify that the connection is up and running - * - * @event Mongos#connect - * @type {Mongos} - */ - -/** - * A server member left the mongos list - * - * @event Mongos#left - * @type {Mongos} - * @param {string} type The type of member that left (mongos) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the mongos list - * - * @event Mongos#joined - * @type {Mongos} - * @param {string} type The type of member that left (mongos) - * @param {Server} server The server object that joined - */ - -module.exports = Mongos; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js deleted file mode 100644 index 913ca1b8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/read_preference.js +++ /dev/null @@ -1,106 +0,0 @@ -"use strict"; - -var needSlaveOk = ['primaryPreferred', 'secondary', 'secondaryPreferred', 'nearest']; - -/** - * @fileOverview The **ReadPreference** class is a class that represents a MongoDB ReadPreference and is - * used to construct connections. - * - * @example - * var ReplSet = require('mongodb-core').ReplSet - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new ReplSet([{host: 'localhost', port: 30000}], {setName: 'rs'}); - * // Wait for the connection event - * server.on('connect', function(server) { - * var cursor = server.cursor('db.test' - * , {find: 'db.test', query: {}} - * , {readPreference: new ReadPreference('secondary')}); - * cursor.next(function(err, doc) { - * server.destroy(); - * }); - * }); - * - * // Start connecting - * server.connect(); - */ - -/** - * Creates a new Pool instance - * @class - * @param {string} preference A string describing the preference (primary|primaryPreferred|secondary|secondaryPreferred|nearest) - * @param {object} tags The tags object - * @param {object} [options] Additional read preference options - * @property {string} preference The preference string (primary|primaryPreferred|secondary|secondaryPreferred|nearest) - * @property {object} tags The tags object - * @property {object} options Additional read preference options - * @return {ReadPreference} - */ -var ReadPreference = function(preference, tags, options) { - this.preference = preference; - this.tags = tags; - this.options = options; -} - -/** - * This needs slaveOk bit set - * @method - * @return {boolean} - */ -ReadPreference.prototype.slaveOk = function() { - return needSlaveOk.indexOf(this.preference) != -1; -} - -/** - * Are the two read preference equal - * @method - * @return {boolean} - */ -ReadPreference.prototype.equals = function(readPreference) { - return readPreference.preference == this.preference; -} - -/** - * Return JSON representation - * @method - * @return {Object} - */ -ReadPreference.prototype.toJSON = function() { - var readPreference = {mode: this.preference}; - if(Array.isArray(this.tags)) readPreference.tags = this.tags; - return readPreference; -} - -/** - * Primary read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.primary = new ReadPreference('primary'); -/** - * Primary Preferred read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.primaryPreferred = new ReadPreference('primaryPreferred'); -/** - * Secondary read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.secondary = new ReadPreference('secondary'); -/** - * Secondary Preferred read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.secondaryPreferred = new ReadPreference('secondaryPreferred'); -/** - * Nearest read preference - * @method - * @return {ReadPreference} - */ -ReadPreference.nearest = new ReadPreference('nearest'); - -module.exports = ReadPreference; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js deleted file mode 100644 index 011c8fe6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset.js +++ /dev/null @@ -1,1333 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , b = require('bson') - , bindToCurrentDomain = require('../connection/utils').bindToCurrentDomain - , debugOptions = require('../connection/utils').debugOptions - , EventEmitter = require('events').EventEmitter - , Server = require('./server') - , ReadPreference = require('./read_preference') - , MongoError = require('../error') - , Ping = require('./strategies/ping') - , Session = require('./session') - , BasicCursor = require('../cursor') - , BSON = require('bson').native().BSON - , State = require('./replset_state') - , Logger = require('../connection/logger'); - -/** - * @fileOverview The **ReplSet** class is a class that represents a Replicaset topology and is - * used to construct connecctions. - * - * @example - * var ReplSet = require('mongodb-core').ReplSet - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new ReplSet([{host: 'localhost', port: 30000}], {setName: 'rs'}); - * // Wait for the connection event - * server.on('connect', function(server) { - * server.destroy(); - * }); - * - * // Start connecting - * server.connect(); - */ - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -// -// ReplSet instance id -var replSetId = 1; - -// -// Clone the options -var cloneOptions = function(options) { - var opts = {}; - for(var name in options) { - opts[name] = options[name]; - } - return opts; -} - -// All bson types -var bsonTypes = [b.Long, b.ObjectID, b.Binary, b.Code, b.DBRef, b.Symbol, b.Double, b.Timestamp, b.MaxKey, b.MinKey]; -// BSON parser -var bsonInstance = null; - -/** - * Creates a new Replset instance - * @class - * @param {array} seedlist A list of seeds for the replicaset - * @param {boolean} options.setName The Replicaset set name - * @param {boolean} [options.secondaryOnlyConnectionAllowed=false] Allow connection to a secondary only replicaset - * @param {number} [options.haInterval=5000] The High availability period for replicaset inquiry - * @param {boolean} [options.emitError=false] Server will emit errors events - * @param {Cursor} [options.cursorFactory=Cursor] The cursor factory class used for all query cursors - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.singleBufferSerializtion=true] Serialize into single buffer, trade of peak memory for serialization speed - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @param {number} [options.pingInterval=5000] Ping interval to check the response time to the different servers - * @param {number} [options.acceptableLatency=250] Acceptable latency for selecting a server for reading (in milliseconds) - * @return {ReplSet} A cursor instance - * @fires ReplSet#connect - * @fires ReplSet#ha - * @fires ReplSet#joined - * @fires ReplSet#left - */ -var ReplSet = function(seedlist, options) { - var self = this; - options = options || {}; - - // Validate seedlist - if(!Array.isArray(seedlist)) throw new MongoError("seedlist must be an array"); - // Validate list - if(seedlist.length == 0) throw new MongoError("seedlist must contain at least one entry"); - // Validate entries - seedlist.forEach(function(e) { - if(typeof e.host != 'string' || typeof e.port != 'number') - throw new MongoError("seedlist entry must contain a host and port"); - }); - - // Add event listener - EventEmitter.call(this); - - // Set the bson instance - bsonInstance = bsonInstance == null ? new BSON(bsonTypes) : bsonInstance; - - // Internal state hash for the object - this.s = { - options: options - // Logger instance - , logger: Logger('ReplSet', options) - // Uniquely identify the replicaset instance - , id: replSetId++ - // Index - , index: 0 - // Ha Index - , haId: 0 - // Current credentials used for auth - , credentials: [] - // Factory overrides - , Cursor: options.cursorFactory || BasicCursor - // BSON Parser, ensure we have a single instance - , bsonInstance: bsonInstance - // Pick the right bson parser - , bson: options.bson ? options.bson : bsonInstance - // Special replicaset options - , secondaryOnlyConnectionAllowed: typeof options.secondaryOnlyConnectionAllowed == 'boolean' - ? options.secondaryOnlyConnectionAllowed : false - , haInterval: options.haInterval || 10000 - // Are we running in debug mode - , debug: typeof options.debug == 'boolean' ? options.debug : false - // The replicaset name - , setName: options.setName - // Swallow or emit errors - , emitError: typeof options.emitError == 'boolean' ? options.emitError : false - // Grouping tag used for debugging purposes - , tag: options.tag - // Do we have a not connected handler - , disconnectHandler: options.disconnectHandler - // Currently connecting servers - , connectingServers: {} - // Contains any alternate strategies for picking - , readPreferenceStrategies: {} - // Auth providers - , authProviders: {} - // All the servers - , disconnectedServers: [] - // Initial connection servers - , initialConnectionServers: [] - // High availability process running - , highAvailabilityProcessRunning: false - // Full setup - , fullsetup: false - // All servers accounted for (used for testing) - , all: false - // Seedlist - , seedlist: seedlist - // Authentication in progress - , authInProgress: false - // Servers added while auth in progress - , authInProgressServers: [] - // Minimum heartbeat frequency used if we detect a server close - , minHeartbeatFrequencyMS: 500 - } - - // Add bson parser to options - options.bson = this.s.bson; - // Set up the connection timeout for the options - options.connectionTimeout = options.connectionTimeout || 10000; - - // Replicaset state - var replState = new State(this, { - id: this.s.id, setName: this.s.setName - , connectingServers: this.s.connectingServers - , secondaryOnlyConnectionAllowed: this.s.secondaryOnlyConnectionAllowed - }); - - // Add Replicaset state to our internal state - this.s.replState = replState; - - // BSON property (find a server and pass it along) - Object.defineProperty(this, 'bson', { - enumerable: true, get: function() { - var servers = self.s.replState.getAll(); - return servers.length > 0 ? servers[0].bson : null; - } - }); - - Object.defineProperty(this, 'id', { - enumerable:true, get: function() { return self.s.id; } - }); - - Object.defineProperty(this, 'haInterval', { - enumerable:true, get: function() { return self.s.haInterval; } - }); - - Object.defineProperty(this, 'state', { - enumerable:true, get: function() { return self.s.replState; } - }); - - // - // Debug options - if(self.s.debug) { - // Add access to the read Preference Strategies - Object.defineProperty(this, 'readPreferenceStrategies', { - enumerable: true, get: function() { return self.s.readPreferenceStrategies; } - }); - } - - Object.defineProperty(this, 'type', { - enumerable:true, get: function() { return 'replset'; } - }); - - // Add the ping strategy for nearest - this.addReadPreferenceStrategy('nearest', new Ping(options)); -} - -inherits(ReplSet, EventEmitter); - -// -// Plugin methods -// - -/** - * Add custom read preference strategy - * @method - * @param {string} name Name of the read preference strategy - * @param {object} strategy Strategy object instance - */ -ReplSet.prototype.addReadPreferenceStrategy = function(name, func) { - this.s.readPreferenceStrategies[name] = func; -} - -/** - * Add custom authentication mechanism - * @method - * @param {string} name Name of the authentication mechanism - * @param {object} provider Authentication object instance - */ -ReplSet.prototype.addAuthProvider = function(name, provider) { - if(this.s.authProviders == null) this.s.authProviders = {}; - this.s.authProviders[name] = provider; -} - -/** - * Name of BSON parser currently used - * @method - * @return {string} - */ -ReplSet.prototype.parserType = function() { - if(this.s.bson.serialize.toString().indexOf('[native code]') != -1) - return 'c++'; - return 'js'; -} - -/** - * Execute a command - * @method - * @param {string} type Type of BSON parser to use (c++ or js) - */ -ReplSet.prototype.setBSONParserType = function(type) { - var nBSON = null; - - if(type == 'c++') { - nBSON = require('bson').native().BSON; - } else if(type == 'js') { - nBSON = require('bson').pure().BSON; - } else { - throw new MongoError(f("% parser not supported", type)); - } - - this.s.options.bson = new nBSON(bsonTypes); -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -ReplSet.prototype.lastIsMaster = function() { - return this.s.replState.lastIsMaster(); -} - -/** - * Get connection - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Connection} - */ -ReplSet.prototype.getConnection = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - var server = pickServer(this, this.s, options.readPreference); - if(server == null) return null; - // Return connection - return server.getConnection(); -} - -/** - * All raw connections - * @method - * @return {Connection[]} - */ -ReplSet.prototype.connections = function() { - return this.s.replState.getAllConnections(); -} - -/** - * Get server - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Server} - */ -ReplSet.prototype.getServer = function(options) { - // Ensure we have no options - options = options || {}; - // Pick the right server based on readPreference - return pickServer(this, this.s, options.readPreference); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.cursor = function(ns, cmd, cursorOptions) { - cursorOptions = cursorOptions || {}; - var FinalCursor = cursorOptions.cursorFactory || this.s.Cursor; - return new FinalCursor(this.s.bson, ns, cmd, cursorOptions, this, this.s.options); -} - -// -// Execute write operation -var executeWriteOperation = function(self, op, ns, ops, options, callback) { - if(typeof options == 'function') { - callback = options; - options = {}; - } - - var server = null; - // Ensure we have no options - options = options || {}; - // Get a primary - try { - server = pickServer(self, self.s, ReadPreference.primary); - if(self.s.debug) self.emit('pickedServer', ReadPreference.primary, server); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no server found")); - - // Handler - var handler = function(err, r) { - // We have a no master error, immediately refresh the view of the replicaset - if(notMasterError(r) || notMasterError(err)) replicasetInquirer(self, self.s, true)(); - // Return the result - callback(err, r); - } - - // Add operationId if existing - if(callback.operationId) handler.operationId = callback.operationId; - // Execute the command - server[op](ns, ops, options, handler); -} - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Connection} [options.connection] Specify connection object to execute command against - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.command = function(ns, cmd, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - - var server = null; - var self = this; - // Ensure we have no options - options = options || {}; - - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected(options) && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('command', ns, cmd, options, callback); - } - - // We need to execute the command on all servers - if(options.onAll) { - var servers = this.s.replState.getAll(); - var count = servers.length; - var cmdErr = null; - - for(var i = 0; i < servers.length; i++) { - servers[i].command(ns, cmd, options, function(err, r) { - count = count - 1; - // Finished executing command - if(count == 0) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(self.s, ns); - // We have a no master error, immediately refresh the view of the replicaset - if(notMasterError(r) || notMasterError(err)) replicasetInquirer(self, self.s, true)(); - // Return the error - callback(err, r); - } - }); - } - - return; - } - - // Pick the right server based on readPreference - try { - server = pickServer(self, self.s, options.writeConcern ? ReadPreference.primary : options.readPreference); - if(self.s.debug) self.emit('pickedServer', options.writeConcern ? ReadPreference.primary : options.readPreference, server); - } catch(err) { - return callback(err); - } - - // No server returned we had an error - if(server == null) return callback(new MongoError("no server found")); - // Execute the command - server.command(ns, cmd, options, function(err, r) { - // Was it a logout command clear any credentials - if(cmd.logout) clearCredentials(self.s, ns); - // We have a no master error, immediately refresh the view of the replicaset - if(notMasterError(r) || notMasterError(err)) { - replicasetInquirer(self, self.s, true)(); - } - // Return the error - callback(err, r); - }); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.remove = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('remove', ns, ops, options, callback); - } - - executeWriteOperation(this, 'remove', ns, ops, options, callback); -} - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.insert = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('insert', ns, ops, options, callback); - } - - executeWriteOperation(this, 'insert', ns, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -ReplSet.prototype.update = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - if(this.s.replState.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!this.isConnected() && this.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return this.s.disconnectHandler.add('update', ns, ops, options, callback); - } - - executeWriteOperation(this, 'update', ns, ops, options, callback); -} - -/** - * Authenticate using a specified mechanism - * @method - * @param {string} mechanism The Auth mechanism we are invoking - * @param {string} db The db we are invoking the mechanism against - * @param {...object} param Parameters for the specific mechanism - * @param {authResultCallback} callback A callback function - */ -ReplSet.prototype.auth = function(mechanism, db) { - var allArgs = Array.prototype.slice.call(arguments, 0).slice(0); - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - var callback = args.pop(); - - // If we don't have the mechanism fail - if(this.s.authProviders[mechanism] == null && mechanism != 'default') - throw new MongoError(f("auth provider %s does not exist", mechanism)); - - // Authenticate against all the servers - var servers = this.s.replState.getAll().slice(0); - var count = servers.length; - // Correct authentication - var authenticated = true; - var authErr = null; - // Set auth in progress - this.s.authInProgress = true; - - // Authenticate against all servers - while(servers.length > 0) { - var server = servers.shift(); - - // Arguments without a callback - var argsWithoutCallback = [mechanism, db].concat(args.slice(0)); - // Create arguments - var finalArguments = argsWithoutCallback.concat([function(err, r) { - count = count - 1; - if(err) authErr = err; - if(!r) authenticated = false; - - // We are done - if(count == 0) { - // We have more servers that are not authenticated, let's authenticate - if(self.s.authInProgressServers.length > 0) { - self.s.authInProgressServers = []; - return self.auth.apply(self, [mechanism, db].concat(args).concat([callback])); - } - - // Auth is done - self.s.authInProgress = false; - // Add successful credentials - if(authErr == null) addCredentials(self.s, db, argsWithoutCallback); - // Return the auth error - if(authErr) return callback(authErr, false); - // Successfully authenticated session - callback(null, new Session({}, self)); - } - }]); - - // Execute the auth - server.auth.apply(server, finalArguments); - } -} - -ReplSet.prototype.state = function() { - return this.s.replState.state; -} - -/** - * Ensure single socket connections to arbiters and hidden servers - * @method - */ -var handleIsmaster = function(self) { - return function(ismaster, _server) { - if(ismaster.arbiterOnly) { - _server.s.options.size = 1; - } else if(ismaster.hidden) { - _server.s.options.size = 1; - } - } -} - -/** - * Initiate server connect - * @method - */ -ReplSet.prototype.connect = function(_options) { - var self = this; - // Start replicaset inquiry process - setTimeout(replicasetInquirer(this, this.s, false), this.s.haInterval); - // Additional options - if(_options) for(var name in _options) this.s.options[name] = _options[name]; - - // Set the state as connecting - this.s.replState.state = CONNECTING; - - // No fullsetup reached - this.s.fullsetup = false; - - // For all entries in the seedlist build a server instance - this.s.seedlist.forEach(function(e) { - // Clone options - var opts = cloneOptions(self.s.options); - // Add host and port - opts.host = e.host; - opts.port = e.port; - opts.reconnect = false; - opts.readPreferenceStrategies = self.s.readPreferenceStrategies; - opts.emitError = true; - if(self.s.tag) opts.tag = self.s.tag; - // Share the auth store - opts.authProviders = self.s.authProviders; - // Create a new Server - var server = new Server(opts); - // Handle the ismaster - server.on('ismaster', handleIsmaster(self)); - // Add to list of disconnected servers - self.s.disconnectedServers.push(server); - // Add to list of inflight Connections - self.s.initialConnectionServers.push(server); - }); - - // Attempt to connect to all the servers - while(this.s.disconnectedServers.length > 0) { - // Get the server - var server = this.s.disconnectedServers.shift(); - - // Set up the event handlers - server.once('error', errorHandlerTemp(this, this.s, 'error')); - server.once('close', errorHandlerTemp(this, this.s, 'close')); - server.once('timeout', errorHandlerTemp(this, this.s, 'timeout')); - server.once('connect', connectHandler(this, this.s)); - - // Attempt to connect - server.connect(); - } -} - -/** - * Figure out if the server is connected - * @method - * @return {boolean} - */ -ReplSet.prototype.isConnected = function(options) { - options = options || {}; - // If we specified a read preference check if we are connected to something - // than can satisfy this - if(options.readPreference - && options.readPreference.equals(ReadPreference.secondary)) - return this.s.replState.isSecondaryConnected(); - - if(options.readPreference - && options.readPreference.equals(ReadPreference.primary)) - return this.s.replState.isSecondaryConnected() || this.s.replState.isPrimaryConnected(); - - if(this.s.secondaryOnlyConnectionAllowed - && this.s.replState.isSecondaryConnected()) return true; - return this.s.replState.isPrimaryConnected(); -} - -/** - * Figure out if the replicaset instance was destroyed by calling destroy - * @method - * @return {boolean} - */ -ReplSet.prototype.isDestroyed = function() { - return this.s.replState.state == DESTROYED; -} - -/** - * Destroy the server connection - * @method - */ -ReplSet.prototype.destroy = function(emitClose) { - var self = this; - if(this.s.logger.isInfo()) this.s.logger.info(f('[%s] destroyed', this.s.id)); - this.s.replState.state = DESTROYED; - - // Emit close - if(emitClose && self.listeners('close').length > 0) self.emit('close', self); - - // Destroy state - this.s.replState.destroy(); - - // Clear out any listeners - var events = ['timeout', 'error', 'close', 'joined', 'left']; - events.forEach(function(e) { - self.removeAllListeners(e); - }); -} - -/** - * A replset connect event, used to verify that the connection is up and running - * - * @event ReplSet#connect - * @type {ReplSet} - */ - -/** - * The replset high availability event - * - * @event ReplSet#ha - * @type {function} - * @param {string} type The stage in the high availability event (start|end) - * @param {boolean} data.norepeat This is a repeating high availability process or a single execution only - * @param {number} data.id The id for this high availability request - * @param {object} data.state An object containing the information about the current replicaset - */ - -/** - * A server member left the replicaset - * - * @event ReplSet#left - * @type {function} - * @param {string} type The type of member that left (primary|secondary|arbiter) - * @param {Server} server The server object that left - */ - -/** - * A server member joined the replicaset - * - * @event ReplSet#joined - * @type {function} - * @param {string} type The type of member that joined (primary|secondary|arbiter) - * @param {Server} server The server object that joined - */ - -// -// Inquires about state changes -// - -// Add the new credential for a db, removing the old -// credential from the cache -var addCredentials = function(s, db, argsWithoutCallback) { - // Remove any credentials for the db - clearCredentials(s, db + ".dummy"); - // Add new credentials to list - s.credentials.push(argsWithoutCallback); -} - -// Clear out credentials for a namespace -var clearCredentials = function(s, ns) { - var db = ns.split('.')[0]; - var filteredCredentials = []; - - // Filter out all credentials for the db the user is logging out off - for(var i = 0; i < s.credentials.length; i++) { - if(s.credentials[i][1] != db) filteredCredentials.push(s.credentials[i]); - } - - // Set new list of credentials - s.credentials = filteredCredentials; -} - -// -// Filter serves by tags -var filterByTags = function(readPreference, servers) { - if(readPreference.tags == null) return servers; - var filteredServers = []; - var tags = readPreference.tags; - - // Iterate over all the servers - for(var i = 0; i < servers.length; i++) { - var serverTag = servers[i].lastIsMaster().tags || {}; - // Did we find the a matching server - var found = true; - // Check if the server is valid - for(var name in tags) { - if(serverTag[name] != tags[name]) found = false; - } - - // Add to candidate list - if(found) filteredServers.push(servers[i]); - } - - // Returned filtered servers - return filteredServers; -} - -// -// Pick a server based on readPreference -var pickServer = function(self, s, readPreference) { - // If no read Preference set to primary by default - readPreference = readPreference || ReadPreference.primary; - - // Do we have a custom readPreference strategy, use it - if(s.readPreferenceStrategies != null && s.readPreferenceStrategies[readPreference.preference] != null) { - if(s.readPreferenceStrategies[readPreference.preference] == null) throw new MongoError(f("cannot locate read preference handler for %s", readPreference.preference)); - var server = s.readPreferenceStrategies[readPreference.preference].pickServer(s.replState, readPreference); - if(s.debug) self.emit('pickedServer', readPreference, server); - return server; - } - - // Filter out any hidden secondaries - var secondaries = s.replState.secondaries.filter(function(server) { - if(server.lastIsMaster().hidden) return false; - return true; - }); - - // Check if we can satisfy and of the basic read Preferences - if(readPreference.equals(ReadPreference.secondary) - && secondaries.length == 0) - throw new MongoError("no secondary server available"); - - if(readPreference.equals(ReadPreference.secondaryPreferred) - && secondaries.length == 0 - && s.replState.primary == null) - throw new MongoError("no secondary or primary server available"); - - if(readPreference.equals(ReadPreference.primary) - && s.replState.primary == null) - throw new MongoError("no primary server available"); - - // Secondary - if(readPreference.equals(ReadPreference.secondary)) { - s.index = (s.index + 1) % secondaries.length; - return secondaries[s.index]; - } - - // Secondary preferred - if(readPreference.equals(ReadPreference.secondaryPreferred)) { - if(secondaries.length > 0) { - // Apply tags if present - var servers = filterByTags(readPreference, secondaries); - // If have a matching server pick one otherwise fall through to primary - if(servers.length > 0) { - s.index = (s.index + 1) % servers.length; - return servers[s.index]; - } - } - - return s.replState.primary; - } - - // Primary preferred - if(readPreference.equals(ReadPreference.primaryPreferred)) { - if(s.replState.primary) return s.replState.primary; - - if(secondaries.length > 0) { - // Apply tags if present - var servers = filterByTags(readPreference, secondaries); - // If have a matching server pick one otherwise fall through to primary - if(servers.length > 0) { - s.index = (s.index + 1) % servers.length; - return servers[s.index]; - } - - // Throw error a we have not valid secondary or primary servers - throw new MongoError("no secondary or primary server available"); - } - } - - // Return the primary - return s.replState.primary; -} - -var replicasetInquirer = function(self, state, norepeat) { - return function() { - if(state.replState.state == DESTROYED) return - // Process already running don't rerun - if(state.highAvailabilityProcessRunning) return; - // Started processes - state.highAvailabilityProcessRunning = true; - if(state.logger.isInfo()) state.logger.info(f('[%s] monitoring process running %s', state.id, JSON.stringify(state.replState))); - - // Unique HA id to identify the current look running - var localHaId = state.haId++; - - // Clean out any failed connection attempts - state.connectingServers = {}; - - // Controls if we are doing a single inquiry or repeating - norepeat = typeof norepeat == 'boolean' ? norepeat : false; - - // If we have a primary and a disconnect handler, execute - // buffered operations - if(state.replState.isPrimaryConnected() && state.replState.isSecondaryConnected() && state.disconnectHandler) { - state.disconnectHandler.execute(); - } - - // Emit replicasetInquirer - self.emit('ha', 'start', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - - // Let's process all the disconnected servers - while(state.disconnectedServers.length > 0) { - // Get the first disconnected server - var server = state.disconnectedServers.shift(); - if(state.logger.isInfo()) state.logger.info(f('[%s] monitoring attempting to connect to %s', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - // Set up the event handlers - server.once('error', errorHandlerTemp(self, state, 'error')); - server.once('close', errorHandlerTemp(self, state, 'close')); - server.once('timeout', errorHandlerTemp(self, state, 'timeout')); - server.once('connect', connectHandler(self, state)); - // Attempt to connect - server.connect(); - } - - // Cleanup state (removed disconnected servers) - state.replState.clean(); - - // We need to query all servers - var servers = state.replState.getAll(); - var serversLeft = servers.length; - - // If no servers and we are not destroyed keep pinging - if(servers.length == 0 && state.replState.state == CONNECTED) { - // Emit ha process end - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunning - state.highAvailabilityProcessRunning = false; - // Restart ha process - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - - // - // ismaster for Master server - var primaryIsMaster = null; - - // Kill the server connection if it hangs - var timeoutServer = function(_server) { - return setTimeout(function() { - if(_server.isConnected()) { - _server.connections()[0].connection.destroy(); - } - }, self.s.options.connectionTimeout); - } - - // - // Inspect a specific servers ismaster - var inspectServer = function(server) { - if(state.replState.state == DESTROYED) return; - // Did we get a server - if(server && server.isConnected()) { - // Get the timeout id - var timeoutId = timeoutServer(server); - // Execute ismaster - server.command('system.$cmd', {ismaster:true}, function(err, r) { - // Clear out the timeoutServer - clearTimeout(timeoutId); - // If the state was destroyed - if(state.replState.state == DESTROYED) return; - // Count down the number of servers left - serversLeft = serversLeft - 1; - // If we have an error but still outstanding server request return - if(err && serversLeft > 0) return; - // We had an error and have no more servers to inspect, schedule a new check - if(err && serversLeft == 0) { - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunnfing - state.highAvailabilityProcessRunning = false; - // Return the replicasetInquirer - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - - // Let all the read Preferences do things to the servers - var rPreferencesCount = Object.keys(state.readPreferenceStrategies).length; - - // Handle the primary - var ismaster = r.result; - if(state.logger.isDebug()) state.logger.debug(f('[%s] monitoring process ismaster %s', state.id, JSON.stringify(ismaster))); - - // Update the replicaset state - state.replState.update(ismaster, server); - - // Add any new servers - if(err == null && ismaster.ismaster && Array.isArray(ismaster.hosts)) { - // Hosts to process - var hosts = ismaster.hosts; - // Add arbiters to list of hosts if we have any - if(Array.isArray(ismaster.arbiters)) hosts = hosts.concat(ismaster.arbiters); - if(Array.isArray(ismaster.passives)) hosts = hosts.concat(ismaster.passives); - // Process all the hsots - processHosts(self, state, hosts); - } - - // No read Preferences strategies - if(rPreferencesCount == 0) { - // Don't schedule a new inquiry - if(serversLeft > 0) return; - // Emit ha process end - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunning - state.highAvailabilityProcessRunning = false; - // Let's keep monitoring - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - - // No servers left to query, execute read preference strategies - if(serversLeft == 0) { - // Go over all the read preferences - for(var name in state.readPreferenceStrategies) { - state.readPreferenceStrategies[name].ha(self, state.replState, function() { - rPreferencesCount = rPreferencesCount - 1; - - if(rPreferencesCount == 0) { - // Add any new servers in primary ismaster - if(err == null - && ismaster.ismaster - && Array.isArray(ismaster.hosts)) { - processHosts(self, state, ismaster.hosts); - } - - // Emit ha process end - self.emit('ha', 'end', {norepeat: norepeat, id: localHaId, state: state.replState ? state.replState.toJSON() : {}}); - // Ended highAvailabilityProcessRunning - state.highAvailabilityProcessRunning = false; - // Let's keep monitoring - if(!norepeat) setTimeout(replicasetInquirer(self, state, false), state.haInterval); - return; - } - }); - } - } - }); - } - } - - // Call ismaster on all servers - for(var i = 0; i < servers.length; i++) { - inspectServer(servers[i]); - } - - // If no more initial servers and new scheduled servers to connect - if(state.replState.secondaries.length >= 1 && state.replState.primary != null && !state.fullsetup) { - state.fullsetup = true; - self.emit('fullsetup', self); - } - - // If all servers are accounted for and we have not sent the all event - if(state.replState.primary != null && self.lastIsMaster() - && Array.isArray(self.lastIsMaster().hosts) && !state.all) { - var length = 1 + state.replState.secondaries.length; - // If we have all secondaries + primary - if(length == self.lastIsMaster().hosts.length + 1) { - state.all = true; - self.emit('all', self); - } - } - } -} - -// Error handler for initial connect -var errorHandlerTemp = function(self, state, event) { - return function(err, server) { - // Log the information - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s disconnected', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - // Filter out any connection servers - state.initialConnectionServers = state.initialConnectionServers.filter(function(_server) { - return server.name != _server.name; - }); - - // Connection is destroyed, ignore - if(state.replState.state == DESTROYED) return; - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Push to list of disconnected servers - addToListIfNotExist(state.disconnectedServers, server); - - // End connection operation if we have no legal replicaset state - if(state.initialConnectionServers == 0 && state.replState.state == CONNECTING) { - if((state.secondaryOnlyConnectionAllowed && !state.replState.isSecondaryConnected() && !state.replState.isPrimaryConnected()) - || (!state.secondaryOnlyConnectionAllowed && !state.replState.isPrimaryConnected())) { - if(state.logger.isInfo()) state.logger.info(f('[%s] no valid seed servers in list', state.id)); - - if(self.listeners('error').length > 0) - return self.emit('error', new MongoError('no valid seed servers in list')); - } - } - - // If the number of disconnected servers is equal to - // the number of seed servers we cannot connect - if(state.disconnectedServers.length == state.seedlist.length && state.replState.state == CONNECTING) { - if(state.emitError && self.listeners('error').length > 0) { - if(state.logger.isInfo()) state.logger.info(f('[%s] no valid seed servers in list', state.id)); - - if(self.listeners('error').length > 0) - self.emit('error', new MongoError('no valid seed servers in list')); - } - } - } -} - -// Connect handler -var connectHandler = function(self, state) { - return function(server) { - if(state.logger.isInfo()) state.logger.info(f('[%s] connected to %s', state.id, server.name)); - // Destroyed connection - if(state.replState.state == DESTROYED) { - server.destroy(false, false); - return; - } - - // Filter out any connection servers - state.initialConnectionServers = state.initialConnectionServers.filter(function(_server) { - return server.name != _server.name; - }); - - // Process the new server - var processNewServer = function() { - // Discover any additional servers - var ismaster = server.lastIsMaster(); - - var events = ['error', 'close', 'timeout', 'connect', 'message']; - // Remove any non used handlers - events.forEach(function(e) { - server.removeAllListeners(e); - }) - - // Clean up - delete state.connectingServers[server.name]; - // Update the replicaset state, destroy if not added - if(!state.replState.update(ismaster, server)) { - return server.destroy(); - } - - // Add the server handling code - if(server.isConnected()) { - server.on('error', errorHandler(self, state)); - server.on('close', closeHandler(self, state)); - server.on('timeout', timeoutHandler(self, state)); - } - - // Hosts to process - var hosts = ismaster.hosts; - // Add arbiters to list of hosts if we have any - if(Array.isArray(ismaster.arbiters)) hosts = hosts.concat(ismaster.arbiters); - if(Array.isArray(ismaster.passives)) hosts = hosts.concat(ismaster.passives); - - // Add any new servers - processHosts(self, state, hosts); - - // If have the server instance already destroy it - if(state.initialConnectionServers.length == 0 && Object.keys(state.connectingServers).length == 0 - && !state.replState.isPrimaryConnected() && !state.secondaryOnlyConnectionAllowed && state.replState.state == CONNECTING) { - if(state.logger.isInfo()) state.logger.info(f('[%s] no primary found in replicaset', state.id)); - self.emit('error', new MongoError("no primary found in replicaset")); - return self.destroy(); - } - - // If no more initial servers and new scheduled servers to connect - if(state.replState.secondaries.length >= 1 && state.replState.primary != null && !state.fullsetup) { - state.fullsetup = true; - self.emit('fullsetup', self); - } - } - - // Save up new members to be authenticated against - if(self.s.authInProgress) { - self.s.authInProgressServers.push(server); - } - - // No credentials just process server - if(state.credentials.length == 0) return processNewServer(); - // Do we have credentials, let's apply them all - var count = state.credentials.length; - // Apply the credentials - for(var i = 0; i < state.credentials.length; i++) { - server.auth.apply(server, state.credentials[i].concat([function(err, r) { - count = count - 1; - if(count == 0) processNewServer(); - }])); - } - } -} - -// -// Detect if we need to add new servers -var processHosts = function(self, state, hosts) { - if(state.replState.state == DESTROYED) return; - if(Array.isArray(hosts)) { - // Check any hosts exposed by ismaster - for(var i = 0; i < hosts.length; i++) { - // If not found we need to create a new connection - if(!state.replState.contains(hosts[i])) { - if(state.connectingServers[hosts[i]] == null && !inInitialConnectingServers(self, state, hosts[i])) { - if(state.logger.isInfo()) state.logger.info(f('[%s] scheduled server %s for connection', state.id, hosts[i])); - // Make sure we know what is trying to connect - state.connectingServers[hosts[i]] = hosts[i]; - // Connect the server - connectToServer(self, state, hosts[i].split(':')[0], parseInt(hosts[i].split(':')[1], 10)); - } - } - } - } -} - -var inInitialConnectingServers = function(self, state, address) { - for(var i = 0; i < state.initialConnectionServers.length; i++) { - if(state.initialConnectionServers[i].name == address) return true; - } - return false; -} - -// Connect to a new server -var connectToServer = function(self, state, host, port) { - var opts = cloneOptions(state.options); - opts.host = host; - opts.port = port; - opts.reconnect = false; - opts.readPreferenceStrategies = state.readPreferenceStrategies; - if(state.tag) opts.tag = state.tag; - // Share the auth store - opts.authProviders = state.authProviders; - opts.emitError = true; - // Create a new server instance - var server = new Server(opts); - // Handle the ismaster - server.on('ismaster', handleIsmaster(self)); - // Set up the event handlers - server.once('error', errorHandlerTemp(self, state, 'error')); - server.once('close', errorHandlerTemp(self, state, 'close')); - server.once('timeout', errorHandlerTemp(self, state, 'timeout')); - server.once('connect', connectHandler(self, state)); - // Attempt to connect - server.connect(); -} - -// -// Add server to the list if it does not exist -var addToListIfNotExist = function(list, server) { - var found = false; - - // Remove any non used handlers - ['error', 'close', 'timeout', 'connect'].forEach(function(e) { - server.removeAllListeners(e); - }) - - // Check if the server already exists - for(var i = 0; i < list.length; i++) { - if(list[i].equals(server)) found = true; - } - - if(!found) { - list.push(server); - } - - return found; -} - -var errorHandler = function(self, state) { - return function(err, server) { - if(state.replState.state == DESTROYED) return; - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s errored out with %s', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name, JSON.stringify(err))); - var found = addToListIfNotExist(state.disconnectedServers, server); - if(!found) self.emit('left', state.replState.remove(server), server); - if(found && state.emitError && self.listeners('error').length > 0) self.emit('error', err, server); - - // Fire off a detection of missing server using minHeartbeatFrequencyMS - setTimeout(function() { - replicasetInquirer(self, self.s, true)(); - }, self.s.minHeartbeatFrequencyMS); - } -} - -var timeoutHandler = function(self, state) { - return function(err, server) { - if(state.replState.state == DESTROYED) return; - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s timed out', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - var found = addToListIfNotExist(state.disconnectedServers, server); - if(!found) self.emit('left', state.replState.remove(server), server); - - // Fire off a detection of missing server using minHeartbeatFrequencyMS - setTimeout(function() { - replicasetInquirer(self, self.s, true)(); - }, self.s.minHeartbeatFrequencyMS); - } -} - -var closeHandler = function(self, state) { - return function(err, server) { - if(state.replState.state == DESTROYED) return; - if(state.logger.isInfo()) state.logger.info(f('[%s] server %s closed', state.id, server.lastIsMaster() ? server.lastIsMaster().me : server.name)); - var found = addToListIfNotExist(state.disconnectedServers, server); - if(!found) self.emit('left', state.replState.remove(server), server); - - // Fire off a detection of missing server using minHeartbeatFrequencyMS - setTimeout(function() { - replicasetInquirer(self, self.s, true)(); - }, self.s.minHeartbeatFrequencyMS); - } -} - -// -// Validate if a non-master or recovering error -var notMasterError = function(r) { - // Get result of any - var result = r && r.result ? r.result : r; - - // Explore if we have a not master error - if(result && (result.err == 'not master' - || result.errmsg == 'not master' || (result['$err'] && result['$err'].indexOf('not master or secondary') != -1) - || (result['$err'] && result['$err'].indexOf("not master and slaveOk=false") != -1) - || result.errmsg == 'node is recovering')) { - return true; - } - - return false; -} - -module.exports = ReplSet; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js deleted file mode 100644 index 951a0432..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/replset_state.js +++ /dev/null @@ -1,483 +0,0 @@ -"use strict"; - -var Logger = require('../connection/logger') - , f = require('util').format - , ObjectId = require('bson').ObjectId - , MongoError = require('../error'); - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -/** - * Creates a new Replicaset State object - * @class - * @property {object} primary Primary property - * @property {array} secondaries List of secondaries - * @property {array} arbiters List of arbiters - * @return {State} A cursor instance - */ -var State = function(replSet, options) { - this.replSet = replSet; - this.options = options; - this.secondaries = []; - this.arbiters = []; - this.passives = []; - this.primary = null; - // Initial state is disconnected - this.state = DISCONNECTED; - // Current electionId - this.electionId = null; - // Get a logger instance - this.logger = Logger('ReplSet', options); - // Unpacked options - this.id = options.id; - this.setName = options.setName; - this.connectingServers = options.connectingServers; - this.secondaryOnlyConnectionAllowed = options.secondaryOnlyConnectionAllowed; -} - -/** - * Is there a secondary connected - * @method - * @return {boolean} - */ -State.prototype.isSecondaryConnected = function() { - for(var i = 0; i < this.secondaries.length; i++) { - if(this.secondaries[i].isConnected()) return true; - } - - return false; -} - -/** - * Is there a primary connection - * @method - * @return {boolean} - */ -State.prototype.isPrimaryConnected = function() { - return this.primary != null && this.primary.isConnected(); -} - -/** - * Is the given address the primary - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.isPrimary = function(address) { - if(this.primary == null) return false; - return this.primary && this.primary.equals(address); -} - -/** - * Is the given address a secondary - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.isSecondary = function(address) { - // Check if the server is a secondary at the moment - for(var i = 0; i < this.secondaries.length; i++) { - if(this.secondaries[i].equals(address)) { - return true; - } - } - - return false; -} - -/** - * Is the given address a secondary - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.isPassive = function(address) { - // Check if the server is a secondary at the moment - for(var i = 0; i < this.passives.length; i++) { - if(this.passives[i].equals(address)) { - return true; - } - } - - return false; -} - -/** - * Does the replicaset contain this server - * @method - * @param {string} address Server address - * @return {boolean} - */ -State.prototype.contains = function(address) { - if(this.primary && this.primary.equals(address)) return true; - for(var i = 0; i < this.secondaries.length; i++) { - if(this.secondaries[i].equals(address)) return true; - } - - for(var i = 0; i < this.arbiters.length; i++) { - if(this.arbiters[i].equals(address)) return true; - } - - for(var i = 0; i < this.passives.length; i++) { - if(this.passives[i].equals(address)) return true; - } - - return false; -} - -/** - * Clean out all dead connections - * @method - */ -State.prototype.clean = function() { - if(this.primary != null && !this.primary.isConnected()) { - this.primary = null; - } - - // Filter out disconnected servers - this.secondaries = this.secondaries.filter(function(s) { - return s.isConnected(); - }); - - // Filter out disconnected servers - this.arbiters = this.arbiters.filter(function(s) { - return s.isConnected(); - }); -} - -/** - * Destroy state - * @method - */ -State.prototype.destroy = function() { - this.state = DESTROYED; - if(this.primary) this.primary.destroy(); - this.secondaries.forEach(function(s) { - s.destroy(); - }); -} - -/** - * Remove server from state - * @method - * @param {Server} Server to remove - * @return {string} Returns type of server removed (primary|secondary) - */ -State.prototype.remove = function(server) { - if(this.primary && this.primary.equals(server)) { - this.primary = null; - } - - var length = this.arbiters.length; - // Filter out the server from the arbiters - this.arbiters = this.arbiters.filter(function(s) { - return !s.equals(server); - }); - if(this.arbiters.length < length) return 'arbiter'; - - var length = this.passives.length; - // Filter out the server from the passives - this.passives = this.passives.filter(function(s) { - return !s.equals(server); - }); - - // We have removed a passive - if(this.passives.length < length) { - // Ensure we removed it from the list of secondaries as well if it exists - this.secondaries = this.secondaries.filter(function(s) { - return !s.equals(server); - }); - } - - // Filter out the server from the secondaries - this.secondaries = this.secondaries.filter(function(s) { - return !s.equals(server); - }); - - // Get the isMaster - var isMaster = server.lastIsMaster(); - // Return primary if the server was primary - if(isMaster.ismaster) return 'primary'; - if(isMaster.secondary) return 'secondary'; - if(isMaster.passive) return 'passive'; - return 'arbiter'; -} - -/** - * Get the server by name - * @method - * @param {string} address Server address - * @return {Server} - */ -State.prototype.get = function(server) { - var found = false; - // All servers to search - var servers = this.primary ? [this.primary] : []; - servers = servers.concat(this.secondaries); - // Locate the server - for(var i = 0; i < servers.length; i++) { - if(servers[i].equals(server)) { - return servers[i]; - } - } -} - -/** - * Get all the servers in the set - * @method - * @return {array} - */ -State.prototype.getAll = function() { - var servers = []; - if(this.primary) servers.push(this.primary); - return servers.concat(this.secondaries); -} - -/** - * All raw connections - * @method - * @return {array} - */ -State.prototype.getAllConnections = function() { - var connections = []; - if(this.primary) connections = connections.concat(this.primary.connections()); - this.secondaries.forEach(function(s) { - connections = connections.concat(s.connections()); - }) - - return connections; -} - -/** - * Return JSON object - * @method - * @return {object} - */ -State.prototype.toJSON = function() { - return { - primary: this.primary ? this.primary.lastIsMaster().me : null - , secondaries: this.secondaries.map(function(s) { - return s.lastIsMaster().me - }) - } -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -State.prototype.lastIsMaster = function() { - if(this.primary) return this.primary.lastIsMaster(); - if(this.secondaries.length > 0) return this.secondaries[0].lastIsMaster(); - return {}; -} - -/** - * Promote server to primary - * @method - * @param {Server} server Server we wish to promote - */ -State.prototype.promotePrimary = function(server) { - var currentServer = this.get(server); - // Server does not exist in the state, add it as new primary - if(currentServer == null) { - this.primary = server; - return; - } - - // We found a server, make it primary and remove it from the secondaries - // Remove the server first - this.remove(currentServer); - // Set as primary - this.primary = currentServer; -} - -var add = function(list, server) { - // Check if the server is a secondary at the moment - for(var i = 0; i < list.length; i++) { - if(list[i].equals(server)) return false; - } - - list.push(server); - return true; -} - -/** - * Add server to list of secondaries - * @method - * @param {Server} server Server we wish to add - */ -State.prototype.addSecondary = function(server) { - return add(this.secondaries, server); -} - -/** - * Add server to list of arbiters - * @method - * @param {Server} server Server we wish to add - */ -State.prototype.addArbiter = function(server) { - return add(this.arbiters, server); -} - -/** - * Add server to list of passives - * @method - * @param {Server} server Server we wish to add - */ -State.prototype.addPassive = function(server) { - return add(this.passives, server); -} - -var compareObjectIds = function(id1, id2) { - var a = new Buffer(id1.toHexString(), 'hex'); - var b = new Buffer(id2.toHexString(), 'hex'); - - if(a === b) { - return 0; - } - - if(typeof Buffer.compare === 'function') { - return Buffer.compare(a, b); - } - - var x = a.length; - var y = b.length; - var len = Math.min(x, y); - - for (var i = 0; i < len; i++) { - if (a[i] !== b[i]) { - break; - } - } - - if (i !== len) { - x = a[i]; - y = b[i]; - } - - return x < y ? -1 : y < x ? 1 : 0; -} - -/** - * Update the state given a specific ismaster result - * @method - * @param {object} ismaster IsMaster result - * @param {Server} server IsMaster Server source - */ -State.prototype.update = function(ismaster, server) { - var self = this; - // Not in a known connection valid state - if(!ismaster.ismaster && !ismaster.secondary && !ismaster.arbiterOnly) { - // Remove the state - var result = self.remove(server); - if(self.state == CONNECTED) { - if(self.logger.isInfo()) self.logger.info(f('[%s] removing %s from set', self.id, ismaster.me)); - self.replSet.emit('left', self.remove(server), server); - } - - return false; - } - - // Set the setName if it's not set from the first server - if(self.setName == null && ismaster.setName) { - if(self.logger.isInfo()) self.logger.info(f('[%s] setting setName to %s', self.id, ismaster.setName)); - self.setName = ismaster.setName; - } - - // Check if the replicaset name matches the provided one - if(ismaster.setName && self.setName != ismaster.setName) { - if(self.logger.isError()) self.logger.error(f('[%s] server in replset %s is not part of the specified setName %s', self.id, ismaster.setName, self.setName)); - self.remove(server); - self.replSet.emit('error', new MongoError("provided setName for Replicaset Connection does not match setName found in server seedlist")); - return false; - } - - // Log information - if(self.logger.isInfo()) self.logger.info(f('[%s] updating replicaset state %s', self.id, JSON.stringify(this))); - - // It's a master set it - if(ismaster.ismaster && self.setName == ismaster.setName && !self.isPrimary(ismaster.me)) { - // Check if the electionId is not null - if(ismaster.electionId instanceof ObjectId && self.electionId instanceof ObjectId) { - if(compareObjectIds(self.electionId, ismaster.electionId) == -1) { - self.electionId = ismaster.electionId; - } else if(compareObjectIds(self.electionId, ismaster.electionId) == 0) { - self.electionId = ismaster.electionId; - } else { - return false; - } - } - - // Initial electionId - if(ismaster.electionId instanceof ObjectId && self.electionId == null) { - self.electionId = ismaster.electionId; - } - - // Promote to primary - self.promotePrimary(server); - // Log change of primary - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to primary', self.id, ismaster.me)); - // Emit primary - self.replSet.emit('joined', 'primary', this.primary); - - // We are connected - if(self.state == CONNECTING) { - self.state = CONNECTED; - self.replSet.emit('connect', self.replSet); - } else { - self.state = CONNECTED; - self.replSet.emit('reconnect', server); - } - } else if(!ismaster.ismaster && self.setName == ismaster.setName - && ismaster.arbiterOnly) { - if(self.addArbiter(server)) { - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to arbiter', self.id, ismaster.me)); - self.replSet.emit('joined', 'arbiter', server); - return true; - }; - - return false; - } else if(!ismaster.ismaster && self.setName == ismaster.setName - && ismaster.secondary && ismaster.passive) { - if(self.addPassive(server) && self.addSecondary(server)) { - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to passive', self.id, ismaster.me)); - self.replSet.emit('joined', 'passive', server); - - // If we have secondaryOnlyConnectionAllowed and just a passive it's - // still a valid connection - if(self.secondaryOnlyConnectionAllowed && self.state == CONNECTING) { - self.state = CONNECTED; - self.replSet.emit('connect', self.replSet); - } - - return true; - }; - - return false; - } else if(!ismaster.ismaster && self.setName == ismaster.setName - && ismaster.secondary) { - if(self.addSecondary(server)) { - if(self.logger.isInfo()) self.logger.info(f('[%s] promoting %s to secondary', self.id, ismaster.me)); - self.replSet.emit('joined', 'secondary', server); - - if(self.secondaryOnlyConnectionAllowed && self.state == CONNECTING) { - self.state = CONNECTED; - self.replSet.emit('connect', self.replSet); - } - - return true; - }; - - return false; - } - - // Return update applied - return true; -} - -module.exports = State; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js deleted file mode 100644 index 0fae9eaa..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js +++ /dev/null @@ -1,1230 +0,0 @@ - "use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , bindToCurrentDomain = require('../connection/utils').bindToCurrentDomain - , EventEmitter = require('events').EventEmitter - , Pool = require('../connection/pool') - , b = require('bson') - , Query = require('../connection/commands').Query - , MongoError = require('../error') - , ReadPreference = require('./read_preference') - , BasicCursor = require('../cursor') - , CommandResult = require('./command_result') - , getSingleProperty = require('../connection/utils').getSingleProperty - , getProperty = require('../connection/utils').getProperty - , debugOptions = require('../connection/utils').debugOptions - , BSON = require('bson').native().BSON - , PreTwoSixWireProtocolSupport = require('../wireprotocol/2_4_support') - , TwoSixWireProtocolSupport = require('../wireprotocol/2_6_support') - , ThreeTwoWireProtocolSupport = require('../wireprotocol/3_2_support') - , Session = require('./session') - , Logger = require('../connection/logger') - , MongoCR = require('../auth/mongocr') - , X509 = require('../auth/x509') - , Plain = require('../auth/plain') - , GSSAPI = require('../auth/gssapi') - , SSPI = require('../auth/sspi') - , ScramSHA1 = require('../auth/scram'); - -/** - * @fileOverview The **Server** class is a class that represents a single server topology and is - * used to construct connections. - * - * @example - * var Server = require('mongodb-core').Server - * , ReadPreference = require('mongodb-core').ReadPreference - * , assert = require('assert'); - * - * var server = new Server({host: 'localhost', port: 27017}); - * // Wait for the connection event - * server.on('connect', function(server) { - * server.destroy(); - * }); - * - * // Start connecting - * server.connect(); - */ - -// All bson types -var bsonTypes = [b.Long, b.ObjectID, b.Binary, b.Code, b.DBRef, b.Symbol, b.Double, b.Timestamp, b.MaxKey, b.MinKey]; -// BSON parser -var bsonInstance = null; -// Server instance id -var serverId = 0; -// Callbacks instance id -var callbackId = 0; - -// Single store for all callbacks -var Callbacks = function() { - // EventEmitter.call(this); - var self = this; - // Callbacks - this.callbacks = {}; - // Set the callbacks id - this.id = callbackId++; - // Set the type to server - this.type = 'server'; -} - -// -// Clone the options -var cloneOptions = function(options) { - var opts = {}; - for(var name in options) { - opts[name] = options[name]; - } - return opts; -} - -// -// Flush all callbacks -Callbacks.prototype.flush = function(err) { - for(var id in this.callbacks) { - if(!isNaN(parseInt(id, 10))) { - var callback = this.callbacks[id]; - delete this.callbacks[id]; - callback(err, null); - } - } -} - -Callbacks.prototype.emit = function(id, err, value) { - var callback = this.callbacks[id]; - delete this.callbacks[id]; - callback(err, value); -} - -Callbacks.prototype.raw = function(id) { - if(this.callbacks[id] == null) return false; - return this.callbacks[id].raw == true ? true : false -} - -Callbacks.prototype.documentsReturnedIn = function(id) { - if(this.callbacks[id] == null) return false; - return typeof this.callbacks[id].documentsReturnedIn == 'string' ? this.callbacks[id].documentsReturnedIn : null; -} - -Callbacks.prototype.unregister = function(id) { - delete this.callbacks[id]; -} - -Callbacks.prototype.register = function(id, callback) { - this.callbacks[id] = bindToCurrentDomain(callback); -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) return callback; - return domain.bind(callback); -} - -var DISCONNECTED = 'disconnected'; -var CONNECTING = 'connecting'; -var CONNECTED = 'connected'; -var DESTROYED = 'destroyed'; - -// Supports server -var supportsServer = function(_s) { - return _s.ismaster && typeof _s.ismaster.minWireVersion == 'number'; -} - -// -// createWireProtocolHandler -var createWireProtocolHandler = function(result) { - // 3.2 wire protocol handler - if(result && result.maxWireVersion >= 4) { - return new ThreeTwoWireProtocolSupport(new TwoSixWireProtocolSupport()); - } - - // 2.6 wire protocol handler - if(result && result.maxWireVersion >= 2) { - return new TwoSixWireProtocolSupport(); - } - - // 2.4 or earlier wire protocol handler - return new PreTwoSixWireProtocolSupport(); -} - -// -// Reconnect server -var reconnectServer = function(self, state) { - // If the current reconnect retries is 0 stop attempting to reconnect - if(state.currentReconnectRetry == 0) { - return self.destroy(true, true); - } - - // Adjust the number of retries - state.currentReconnectRetry = state.currentReconnectRetry - 1; - - // Set status to connecting - state.state = CONNECTING; - // Create a new Pool - state.pool = new Pool(state.options); - // error handler - var reconnectErrorHandler = function(err) { - state.state = DISCONNECTED; - // Destroy the pool - state.pool.destroy(); - // Adjust the number of retries - state.currentReconnectRetry = state.currentReconnectRetry - 1; - // No more retries - if(state.currentReconnectRetry <= 0) { - self.state = DESTROYED; - self.emit('error', f('failed to connect to %s:%s after %s retries', state.options.host, state.options.port, state.reconnectTries)); - } else { - setTimeout(function() { - reconnectServer(self, state); - }, state.reconnectInterval); - } - } - - // - // Attempt to connect - state.pool.once('connect', function() { - // Reset retries - state.currentReconnectRetry = state.reconnectTries; - - // Remove any non used handlers - var events = ['error', 'close', 'timeout', 'parseError']; - events.forEach(function(e) { - state.pool.removeAllListeners(e); - }); - - // Set connected state - state.state = CONNECTED; - - // Add proper handlers - state.pool.once('error', reconnectErrorHandler); - state.pool.once('close', closeHandler(self, state)); - state.pool.once('timeout', timeoutHandler(self, state)); - state.pool.once('parseError', fatalErrorHandler(self, state)); - - // We need to ensure we have re-authenticated - var keys = Object.keys(state.authProviders); - if(keys.length == 0) return self.emit('reconnect', self); - - // Execute all providers - var count = keys.length; - // Iterate over keys - for(var i = 0; i < keys.length; i++) { - state.authProviders[keys[i]].reauthenticate(self, state.pool, function(err, r) { - count = count - 1; - // We are done, emit reconnect event - if(count == 0) { - return self.emit('reconnect', self); - } - }); - } - }); - - // - // Handle connection failure - state.pool.once('error', errorHandler(self, state)); - state.pool.once('close', errorHandler(self, state)); - state.pool.once('timeout', errorHandler(self, state)); - state.pool.once('parseError', errorHandler(self, state)); - - // Connect pool - state.pool.connect(); -} - -// -// Handlers -var messageHandler = function(self, state) { - return function(response, connection) { - try { - // Parse the message - response.parse({raw: state.callbacks.raw(response.responseTo), documentsReturnedIn: state.callbacks.documentsReturnedIn(response.responseTo)}); - if(state.logger.isDebug()) state.logger.debug(f('message [%s] received from %s', response.raw.toString('hex'), self.name)); - state.callbacks.emit(response.responseTo, null, response); - } catch (err) { - state.callbacks.flush(new MongoError(err)); - self.destroy(); - } - } -} - -var errorHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'error', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s errored out with %s', self.name, JSON.stringify(err))); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s received an error %s", self.name, JSON.stringify(err)))); - // Destroy all connections - self.destroy(); - // Emit error event - if(state.emitError && self.listeners('error').length > 0) self.emit('error', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - } -} - -var fatalErrorHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'error', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s errored out with %s', self.name, JSON.stringify(err))); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s received an error %s", self.name, JSON.stringify(err)))); - // Emit error event - if(self.listeners('error').length > 0) self.emit('error', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - // Destroy all connections - self.destroy(); - } -} - -var timeoutHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'timeout', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s timed out', self.name)); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s timed out", self.name))); - // Emit error event - self.emit('timeout', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - // Destroy all connections - self.destroy(); - } -} - -var closeHandler = function(self, state) { - return function(err, connection) { - if(state.state == DISCONNECTED || state.state == DESTROYED) return; - // Set disconnected state - state.state = DISCONNECTED; - - if(state.readPreferenceStrategies != null) notifyStrategies(self, self.s, 'close', [self]); - if(state.logger.isInfo()) state.logger.info(f('server %s closed', self.name)); - // Flush out all the callbacks - if(state.callbacks) state.callbacks.flush(new MongoError(f("server %s sockets closed", self.name))); - // Emit error event - self.emit('close', err, self); - // If we specified the driver to reconnect perform it - if(state.reconnect) setTimeout(function() { - // state.currentReconnectRetry = state.reconnectTries, - reconnectServer(self, state) - }, state.reconnectInterval); - // Destroy all connections - self.destroy(); - } -} - -var connectHandler = function(self, state) { - // Apply all stored authentications - var applyAuthentications = function(callback) { - // We need to ensure we have re-authenticated - var keys = Object.keys(state.authProviders); - if(keys.length == 0) return callback(null, null); - - // Execute all providers - var count = keys.length; - // Iterate over keys - for(var i = 0; i < keys.length; i++) { - state.authProviders[keys[i]].reauthenticate(self, state.pool, function(err, r) { - count = count - 1; - // We are done, emit reconnect event - if(count == 0) { - return callback(null, null); - } - }); - } - } - - return function(connection) { - // Apply any applyAuthentications - applyAuthentications(function() { - - // Execute an ismaster - self.command('system.$cmd', {ismaster:true}, function(err, r) { - if(err) { - state.state = DISCONNECTED; - return self.emit('close', err, self); - } - - // Set the current ismaster - if(!err) { - state.ismaster = r.result; - } - - // Emit the ismaster - self.emit('ismaster', r.result, self); - - // Determine the wire protocol handler - state.wireProtocolHandler = createWireProtocolHandler(state.ismaster); - - // Set the wireProtocolHandler - state.options.wireProtocolHandler = state.wireProtocolHandler; - - // Log the ismaster if available - if(state.logger.isInfo()) state.logger.info(f('server %s connected with ismaster [%s]', self.name, JSON.stringify(r.result))); - - // Validate if we it's a server we can connect to - if(!supportsServer(state) && state.wireProtocolHandler == null) { - state.state = DISCONNECTED - return self.emit('error', new MongoError("non supported server version"), self); - } - - // Set the details - if(state.ismaster && state.ismaster.me) state.serverDetails.name = state.ismaster.me; - - // No read preference strategies just emit connect - if(state.readPreferenceStrategies == null) { - state.state = CONNECTED; - return self.emit('connect', self); - } - - // Signal connect to all readPreferences - notifyStrategies(self, self.s, 'connect', [self], function(err, result) { - state.state = CONNECTED; - return self.emit('connect', self); - }); - }); - }); - } -} - -var slaveOk = function(r) { - if(r) return r.slaveOk() - return false; -} - -// -// Execute readPreference Strategies -var notifyStrategies = function(self, state, op, params, callback) { - if(typeof callback != 'function') { - // Notify query start to any read Preference strategies - for(var name in state.readPreferenceStrategies) { - if(state.readPreferenceStrategies[name][op]) { - var strat = state.readPreferenceStrategies[name]; - strat[op].apply(strat, params); - } - } - // Finish up - return; - } - - // Execute the async callbacks - var nPreferences = Object.keys(state.readPreferenceStrategies).length; - if(nPreferences == 0) return callback(null, null); - for(var name in state.readPreferenceStrategies) { - if(state.readPreferenceStrategies[name][op]) { - var strat = state.readPreferenceStrategies[name]; - // Add a callback to params - var cParams = params.slice(0); - cParams.push(function(err, r) { - nPreferences = nPreferences - 1; - if(nPreferences == 0) { - callback(null, null); - } - }) - // Execute the readPreference - strat[op].apply(strat, cParams); - } - } -} - -var debugFields = ['reconnect', 'reconnectTries', 'reconnectInterval', 'emitError', 'cursorFactory', 'host' - , 'port', 'size', 'keepAlive', 'keepAliveInitialDelay', 'noDelay', 'connectionTimeout' - , 'socketTimeout', 'singleBufferSerializtion', 'ssl', 'ca', 'cert', 'key', 'rejectUnauthorized', 'promoteLongs']; - -/** - * Creates a new Server instance - * @class - * @param {boolean} [options.reconnect=true] Server will attempt to reconnect on loss of connection - * @param {number} [options.reconnectTries=30] Server attempt to reconnect #times - * @param {number} [options.reconnectInterval=1000] Server will wait # milliseconds between retries - * @param {boolean} [options.emitError=false] Server will emit errors events - * @param {Cursor} [options.cursorFactory=Cursor] The cursor factory class used for all query cursors - * @param {string} options.host The server host - * @param {number} options.port The server port - * @param {number} [options.size=5] Server connection pool size - * @param {boolean} [options.keepAlive=true] TCP Connection keep alive enabled - * @param {number} [options.keepAliveInitialDelay=0] Initial delay before TCP keep alive enabled - * @param {boolean} [options.noDelay=true] TCP Connection no delay - * @param {number} [options.connectionTimeout=0] TCP Connection timeout setting - * @param {number} [options.socketTimeout=0] TCP Socket timeout setting - * @param {boolean} [options.ssl=false] Use SSL for connection - * @param {Buffer} [options.ca] SSL Certificate store binary buffer - * @param {Buffer} [options.cert] SSL Certificate binary buffer - * @param {Buffer} [options.key] SSL Key file binary buffer - * @param {string} [options.passphrase] SSL Certificate pass phrase - * @param {boolean} [options.rejectUnauthorized=true] Reject unauthorized server certificates - * @param {boolean} [options.promoteLongs=true] Convert Long values from the db into Numbers if they fit into 53 bits - * @return {Server} A cursor instance - * @fires Server#connect - * @fires Server#close - * @fires Server#error - * @fires Server#timeout - * @fires Server#parseError - * @fires Server#reconnect - */ -var Server = function(options) { - var self = this; - - // Add event listener - EventEmitter.call(this); - - // BSON Parser, ensure we have a single instance - if(bsonInstance == null) { - bsonInstance = new BSON(bsonTypes); - } - - // Reconnect retries - var reconnectTries = options.reconnectTries || 30; - - // Keeps all the internal state of the server - this.s = { - // Options - options: options - // Contains all the callbacks - , callbacks: new Callbacks() - // Logger - , logger: Logger('Server', options) - // Server state - , state: DISCONNECTED - // Reconnect option - , reconnect: typeof options.reconnect == 'boolean' ? options.reconnect : true - , reconnectTries: reconnectTries - , reconnectInterval: options.reconnectInterval || 1000 - // Swallow or emit errors - , emitError: typeof options.emitError == 'boolean' ? options.emitError : false - // Current state - , currentReconnectRetry: reconnectTries - // Contains the ismaster - , ismaster: null - // Contains any alternate strategies for picking - , readPreferenceStrategies: options.readPreferenceStrategies - // Auth providers - , authProviders: options.authProviders || {} - // Server instance id - , id: serverId++ - // Grouping tag used for debugging purposes - , tag: options.tag - // Do we have a not connected handler - , disconnectHandler: options.disconnectHandler - // wireProtocolHandler methods - , wireProtocolHandler: options.wireProtocolHandler || new PreTwoSixWireProtocolSupport() - // Factory overrides - , Cursor: options.cursorFactory || BasicCursor - // BSON Parser, ensure we have a single instance - , bsonInstance: bsonInstance - // Pick the right bson parser - , bson: options.bson ? options.bson : bsonInstance - // Internal connection pool - , pool: null - // Server details - , serverDetails: { - host: options.host - , port: options.port - , name: options.port ? f("%s:%s", options.host, options.port) : options.host - } - } - - // Reference state - var s = this.s; - - // Add bson parser to options - options.bson = s.bson; - - // Set error properties - getProperty(this, 'name', 'name', s.serverDetails, {}); - getProperty(this, 'bson', 'bson', s.options, {}); - getProperty(this, 'wireProtocolHandler', 'wireProtocolHandler', s.options, {}); - getSingleProperty(this, 'id', s.id); - - // Add auth providers - this.addAuthProvider('mongocr', new MongoCR()); - this.addAuthProvider('x509', new X509()); - this.addAuthProvider('plain', new Plain()); - this.addAuthProvider('gssapi', new GSSAPI()); - this.addAuthProvider('sspi', new SSPI()); - this.addAuthProvider('scram-sha-1', new ScramSHA1()); -} - -inherits(Server, EventEmitter); - -/** - * Execute a command - * @method - * @param {string} type Type of BSON parser to use (c++ or js) - */ -Server.prototype.setBSONParserType = function(type) { - var nBSON = null; - - if(type == 'c++') { - nBSON = require('bson').native().BSON; - } else if(type == 'js') { - nBSON = require('bson').pure().BSON; - } else { - throw new MongoError(f("% parser not supported", type)); - } - - this.s.options.bson = new nBSON(bsonTypes); -} - -/** - * Returns the last known ismaster document for this server - * @method - * @return {object} - */ -Server.prototype.lastIsMaster = function() { - return this.s.ismaster; -} - -/** - * Initiate server connect - * @method - */ -Server.prototype.connect = function(_options) { - var self = this; - // Set server specific settings - _options = _options || {} - // Set the promotion - if(typeof _options.promoteLongs == 'boolean') { - self.s.options.promoteLongs = _options.promoteLongs; - } - - // Destroy existing pool - if(self.s.pool) { - self.s.pool.destroy(); - self.s.pool = null; - } - - // Set the state to connection - self.s.state = CONNECTING; - // Create a new connection pool - if(!self.s.pool) { - self.s.options.messageHandler = messageHandler(self, self.s); - self.s.pool = new Pool(self.s.options); - } - - // Add all the event handlers - self.s.pool.once('timeout', timeoutHandler(self, self.s)); - self.s.pool.once('close', closeHandler(self, self.s)); - self.s.pool.once('error', errorHandler(self, self.s)); - self.s.pool.once('connect', connectHandler(self, self.s)); - self.s.pool.once('parseError', fatalErrorHandler(self, self.s)); - - // Connect the pool - self.s.pool.connect(); -} - -/** - * Destroy the server connection - * @method - */ -Server.prototype.destroy = function(emitClose, emitDestroy) { - var self = this; - if(self.s.logger.isDebug()) self.s.logger.debug(f('destroy called on server %s', self.name)); - // Emit close - if(emitClose && self.listeners('close').length > 0) self.emit('close', self); - - // Emit destroy event - if(emitDestroy) self.emit('destroy', self); - // Set state as destroyed - self.s.state = DESTROYED; - // Close the pool - self.s.pool.destroy(); - // Flush out all the callbacks - if(self.s.callbacks) self.s.callbacks.flush(new MongoError(f("server %s sockets closed", self.name))); -} - -/** - * Figure out if the server is connected - * @method - * @return {boolean} - */ -Server.prototype.isConnected = function() { - var self = this; - if(self.s.pool) return self.s.pool.isConnected(); - return false; -} - -/** - * Figure out if the server instance was destroyed by calling destroy - * @method - * @return {boolean} - */ -Server.prototype.isDestroyed = function() { - return this.s.state == DESTROYED; -} - -var executeSingleOperation = function(self, ns, cmd, queryOptions, options, onAll, callback) { - // Create a query instance - var query = new Query(self.s.bson, ns, cmd, queryOptions); - - // Set slave OK - query.slaveOk = slaveOk(options.readPreference); - - // Notify query start to any read Preference strategies - if(self.s.readPreferenceStrategies != null) - notifyStrategies(self, self.s, 'startOperation', [self, query, new Date()]); - - // Get a connection (either passed or from the pool) - var connection = options.connection || self.s.pool.get(); - - // Double check if we have a valid connection - if(!connection.isConnected()) { - return callback(new MongoError(f("no connection available to server %s", self.name))); - } - - // Print cmd and execution connection if in debug mode for logging - if(self.s.logger.isDebug()) { - var json = connection.toJSON(); - self.s.logger.debug(f('cmd [%s] about to be executed on connection with id %s at %s:%s', JSON.stringify(cmd), json.id, json.host, json.port)); - } - - // Execute multiple queries - if(onAll) { - var connections = self.s.pool.getAll(); - var total = connections.length; - // We have an error - var error = null; - // Execute on all connections - for(var i = 0; i < connections.length; i++) { - try { - query.incRequestId(); - connections[i].write(query.toBin()); - } catch(err) { - total = total - 1; - if(total == 0) return callback(MongoError.create(err)); - } - - // Register the callback - self.s.callbacks.register(query.requestId, function(err, result) { - if(err) error = err; - total = total - 1; - - // Done - if(total == 0) { - // Notify end of command - notifyStrategies(self, self.s, 'endOperation', [self, error, result, new Date()]); - if(error) return callback(MongoError.create(error)); - // Execute callback, catch and rethrow if needed - try { callback(null, new CommandResult(result.documents[0], connections)); } - catch(err) { process.nextTick(function() { throw err}); } - } - }); - } - - return; - } - - // Execute a single command query - try { - connection.write(query.toBin()); - } catch(err) { - return callback(MongoError.create(err)); - } - - // Register the callback - self.s.callbacks.register(query.requestId, function(err, result) { - // Notify end of command - notifyStrategies(self, self.s, 'endOperation', [self, err, result, new Date()]); - if(err) return callback(err); - if(result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || result.documents[0]['err'] - || result.documents[0]['code']) return callback(MongoError.create(result.documents[0])); - // Execute callback, catch and rethrow if needed - try { callback(null, new CommandResult(result.documents[0], connection)); } - catch(err) { process.nextTick(function() { throw err}); } - }); -} - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Connection} [options.connection] Specify connection object to execute command against - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.command = function(ns, cmd, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Ensure we have no options - options = options || {}; - // Do we have a read Preference it need to be of type ReadPreference - if(options.readPreference && !(options.readPreference instanceof ReadPreference)) { - throw new Error("readPreference must be an instance of ReadPreference"); - } - - // Debug log - if(self.s.logger.isDebug()) self.s.logger.debug(f('executing command [%s] against %s', JSON.stringify({ - ns: ns, cmd: cmd, options: debugOptions(debugFields, options) - }), self.name)); - - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('command', ns, cmd, options, callback); - } - - // If we have no connection error - if(!self.s.pool.isConnected()) return callback(new MongoError(f("no connection available to server %s", self.name))); - - // Execute on all connections - var onAll = typeof options.onAll == 'boolean' ? options.onAll : false; - - // Check keys - var checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys: false; - - // Serialize function - var serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - - // Ignore undefined values - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - - // Query options - var queryOptions = { - numberToSkip: 0, numberToReturn: -1, checkKeys: checkKeys - }; - - // Set up the serialize functions and ignore undefined - if(serializeFunctions) queryOptions.serializeFunctions = serializeFunctions; - if(ignoreUndefined) queryOptions.ignoreUndefined = ignoreUndefined; - - // Single operation execution - if(!Array.isArray(cmd)) { - return executeSingleOperation(self, ns, cmd, queryOptions, options, onAll, callback); - } - - // Build commands for each of the instances - var queries = new Array(cmd.length); - for(var i = 0; i < cmd.length; i++) { - queries[i] = new Query(self.s.bson, ns, cmd[i], queryOptions); - queries[i].slaveOk = slaveOk(options.readPreference); - } - - // Notify query start to any read Preference strategies - if(self.s.readPreferenceStrategies != null) - notifyStrategies(self, self.s, 'startOperation', [self, queries, new Date()]); - - // Get a connection (either passed or from the pool) - var connection = options.connection || self.s.pool.get(); - - // Double check if we have a valid connection - if(!connection.isConnected()) { - return callback(new MongoError(f("no connection available to server %s", self.name))); - } - - // Print cmd and execution connection if in debug mode for logging - if(self.s.logger.isDebug()) { - var json = connection.toJSON(); - self.s.logger.debug(f('cmd [%s] about to be executed on connection with id %s at %s:%s', JSON.stringify(queries), json.id, json.host, json.port)); - } - - // Canceled operations - var canceled = false; - // Number of operations left - var operationsLeft = queries.length; - // Results - var results = []; - - // We need to nest the callbacks - for(var i = 0; i < queries.length; i++) { - // Get the query object - var query = queries[i]; - - // Execute a single command query - try { - connection.write(query.toBin()); - } catch(err) { - return callback(MongoError.create(err)); - } - - // Register the callback - self.s.callbacks.register(query.requestId, function(err, result) { - // If it's canceled ignore the operation - if(canceled) return; - // Update the current index - operationsLeft = operationsLeft - 1; - - // If we have an error cancel the operation - if(err) { - canceled = true; - return callback(err); - } - - // Return the result - if(result.documents[0]['$err'] - || result.documents[0]['errmsg'] - || result.documents[0]['err'] - || result.documents[0]['code']) { - - // Set to canceled - canceled = true; - // Return the error - return callback(MongoError.create(result.documents[0])); - } - - // Push results - results.push(result.documents[0]); - - // We are done, return the result - if(operationsLeft == 0) { - // Notify end of command - notifyStrategies(self, self.s, 'endOperation', [self, err, result, new Date()]); - - // Turn into command results - var commandResults = new Array(results.length); - for(var i = 0; i < results.length; i++) { - commandResults[i] = new CommandResult(results[i], connection); - } - - // Execute callback, catch and rethrow if needed - try { callback(null, commandResults); } - catch(err) { process.nextTick(function() { throw err}); } - } - }); - } -} - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.insert = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('insert', ns, ops, options, callback); - } - - // Setup the docs as an array - ops = Array.isArray(ops) ? ops : [ops]; - // Execute write - return self.s.wireProtocolHandler.insert(self, self.s.ismaster, ns, self.s.bson, self.s.pool, self.s.callbacks, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.update = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('update', ns, ops, options, callback); - } - - // Setup the docs as an array - ops = Array.isArray(ops) ? ops : [ops]; - // Execute write - return self.s.wireProtocolHandler.update(self, self.s.ismaster, ns, self.s.bson, self.s.pool, self.s.callbacks, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.remove = function(ns, ops, options, callback) { - if(typeof options == 'function') callback = options, options = {}; - var self = this; - if(this.s.state == DESTROYED) return callback(new MongoError(f('topology was destroyed'))); - // Topology is not connected, save the call in the provided store to be - // Executed at some point when the handler deems it's reconnected - if(!self.isConnected() && self.s.disconnectHandler != null) { - callback = bindToCurrentDomain(callback); - return self.s.disconnectHandler.add('remove', ns, ops, options, callback); - } - - // Setup the docs as an array - ops = Array.isArray(ops) ? ops : [ops]; - // Execute write - return self.s.wireProtocolHandler.remove(self, self.s.ismaster, ns, self.s.bson, self.s.pool, self.s.callbacks, ops, options, callback); -} - -/** - * Authenticate using a specified mechanism - * @method - * @param {string} mechanism The Auth mechanism we are invoking - * @param {string} db The db we are invoking the mechanism against - * @param {...object} param Parameters for the specific mechanism - * @param {authResultCallback} callback A callback function - */ -Server.prototype.auth = function(mechanism, db) { - var self = this; - var args = Array.prototype.slice.call(arguments, 2); - var callback = args.pop(); - - // If we don't have the mechanism fail - if(self.s.authProviders[mechanism] == null && mechanism != 'default') - throw new MongoError(f("auth provider %s does not exist", mechanism)); - - // If we have the default mechanism we pick mechanism based on the wire - // protocol max version. If it's >= 3 then scram-sha1 otherwise mongodb-cr - if(mechanism == 'default' && self.s.ismaster && self.s.ismaster.maxWireVersion >= 3) { - mechanism = 'scram-sha-1'; - } else if(mechanism == 'default') { - mechanism = 'mongocr'; - } - - // Actual arguments - var finalArguments = [self, self.s.pool, db].concat(args.slice(0)).concat([function(err, r) { - if(err) return callback(err); - if(!r) return callback(new MongoError('could not authenticate')); - callback(null, new Session({}, self)); - }]); - - // Let's invoke the auth mechanism - self.s.authProviders[mechanism].auth.apply(self.s.authProviders[mechanism], finalArguments); -} - -// -// Plugin methods -// - -/** - * Add custom read preference strategy - * @method - * @param {string} name Name of the read preference strategy - * @param {object} strategy Strategy object instance - */ -Server.prototype.addReadPreferenceStrategy = function(name, strategy) { - var self = this; - if(self.s.readPreferenceStrategies == null) self.s.readPreferenceStrategies = {}; - self.s.readPreferenceStrategies[name] = strategy; -} - -/** - * Add custom authentication mechanism - * @method - * @param {string} name Name of the authentication mechanism - * @param {object} provider Authentication object instance - */ -Server.prototype.addAuthProvider = function(name, provider) { - var self = this; - self.s.authProviders[name] = provider; -} - -/** - * Compare two server instances - * @method - * @param {Server} server Server to compare equality against - * @return {boolean} - */ -Server.prototype.equals = function(server) { - if(typeof server == 'string') return server == this.name; - return server.name == this.name; -} - -/** - * All raw connections - * @method - * @return {Connection[]} - */ -Server.prototype.connections = function() { - return this.s.pool.getAll(); -} - -/** - * Get server - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Server} - */ -Server.prototype.getServer = function(options) { - return this; -} - -/** - * Get connection - * @method - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @return {Connection} - */ -Server.prototype.getConnection = function(options) { - return this.s.pool.get(); -} - -/** - * Get callbacks object - * @method - * @return {Callbacks} - */ -Server.prototype.getCallbacks = function() { - return this.s.callbacks; -} - -/** - * Name of BSON parser currently used - * @method - * @return {string} - */ -Server.prototype.parserType = function() { - var s = this.s; - if(s.options.bson.serialize.toString().indexOf('[native code]') != -1) - return 'c++'; - return 'js'; -} - -// // Command -// { -// find: ns -// , query: -// , limit: -// , fields: -// , skip: -// , hint: -// , explain: -// , snapshot: -// , batchSize: -// , returnKey: -// , maxScan: -// , min: -// , max: -// , showDiskLoc: -// , comment: -// , maxTimeMS: -// , raw: -// , readPreference: -// , tailable: -// , oplogReplay: -// , noCursorTimeout: -// , awaitdata: -// , exhaust: -// , partial: -// } - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {ReadPreference} [options.readPreference] Specify read preference if command supports it - * @param {Boolean} [options.serializeFunctions=false] Specify if functions on an object should be serialized. - * @param {Boolean} [options.ignoreUndefined=false] Specify if the BSON serializer should ignore undefined fields. - * @param {opResultCallback} callback A callback function - */ -Server.prototype.cursor = function(ns, cmd, cursorOptions) { - var s = this.s; - cursorOptions = cursorOptions || {}; - // Set up final cursor type - var FinalCursor = cursorOptions.cursorFactory || s.Cursor; - // Return the cursor - return new FinalCursor(s.bson, ns, cmd, cursorOptions, this, s.options); -} - -/** - * A server connect event, used to verify that the connection is up and running - * - * @event Server#connect - * @type {Server} - */ - -/** - * The server connection closed, all pool connections closed - * - * @event Server#close - * @type {Server} - */ - -/** - * The server connection caused an error, all pool connections closed - * - * @event Server#error - * @type {Server} - */ - -/** - * The server connection timed out, all pool connections closed - * - * @event Server#timeout - * @type {Server} - */ - -/** - * The driver experienced an invalid message, all pool connections closed - * - * @event Server#parseError - * @type {Server} - */ - -/** - * The server reestablished the connection - * - * @event Server#reconnect - * @type {Server} - */ - -/** - * This is an insert result callback - * - * @callback opResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {CommandResult} command result - */ - -/** - * This is an authentication result callback - * - * @callback authResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {Session} an authenticated session - */ - -module.exports = Server; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js deleted file mode 100644 index 032c3c5e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/session.js +++ /dev/null @@ -1,93 +0,0 @@ -"use strict"; - -var inherits = require('util').inherits - , f = require('util').format - , EventEmitter = require('events').EventEmitter; - -/** - * Creates a new Authentication Session - * @class - * @param {object} [options] Options for the session - * @param {{Server}|{ReplSet}|{Mongos}} topology The topology instance underpinning the session - */ -var Session = function(options, topology) { - this.options = options; - this.topology = topology; - - // Add event listener - EventEmitter.call(this); -} - -inherits(Session, EventEmitter); - -/** - * Execute a command - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {object} cmd The command hash - * @param {object} [options.readPreference] Specify read preference if command supports it - * @param {object} [options.connection] Specify connection object to execute command against - * @param {opResultCallback} callback A callback function - */ -Session.prototype.command = function(ns, cmd, options, callback) { - this.topology.command(ns, cmd, options, callback); -} - -/** - * Insert one or more documents - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of documents to insert - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {opResultCallback} callback A callback function - */ -Session.prototype.insert = function(ns, ops, options, callback) { - this.topology.insert(ns, ops, options, callback); -} - -/** - * Perform one or more update operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of updates - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {opResultCallback} callback A callback function - */ -Session.prototype.update = function(ns, ops, options, callback) { - this.topology.update(ns, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {array} ops An array of removes - * @param {boolean} [options.ordered=true] Execute in order or out of order - * @param {object} [options.writeConcern={}] Write concern for the operation - * @param {opResultCallback} callback A callback function - */ -Session.prototype.remove = function(ns, ops, options, callback) { - this.topology.remove(ns, ops, options, callback); -} - -/** - * Perform one or more remove operations - * @method - * @param {string} ns The MongoDB fully qualified namespace (ex: db1.collection1) - * @param {{object}|{Long}} cmd Can be either a command returning a cursor or a cursorId - * @param {object} [options.batchSize=0] Batchsize for the operation - * @param {array} [options.documents=[]] Initial documents list for cursor - * @param {boolean} [options.tailable=false] Tailable flag set - * @param {boolean} [options.oplogReply=false] oplogReply flag set - * @param {boolean} [options.awaitdata=false] awaitdata flag set - * @param {boolean} [options.exhaust=false] exhaust flag set - * @param {boolean} [options.partial=false] partial flag set - * @param {opResultCallback} callback A callback function - */ -Session.prototype.cursor = function(ns, cmd, options) { - return this.topology.cursor(ns, cmd, options); -} - -module.exports = Session; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js deleted file mode 100644 index 3a7b460c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/strategies/ping.js +++ /dev/null @@ -1,276 +0,0 @@ -"use strict"; - -var Logger = require('../../connection/logger') - , EventEmitter = require('events').EventEmitter - , inherits = require('util').inherits - , f = require('util').format; - -/** - * Creates a new Ping read preference strategy instance - * @class - * @param {number} [options.pingInterval=5000] Ping interval to check the response time to the different servers - * @param {number} [options.acceptableLatency=250] Acceptable latency for selecting a server for reading (in milliseconds) - * @return {Ping} A cursor instance - */ -var Ping = function(options) { - // Add event listener - EventEmitter.call(this); - - // Contains the ping state - this.s = { - // Contains all the ping data - pings: {} - // Set no options if none provided - , options: options || {} - // Logger - , logger: Logger('Ping', options) - // Ping interval - , pingInterval: options.pingInterval || 10000 - , acceptableLatency: options.acceptableLatency || 15 - // Debug options - , debug: typeof options.debug == 'boolean' ? options.debug : false - // Index - , index: 0 - // Current ping time - , lastPing: null - - } - - // Log the options set - if(this.s.logger.isDebug()) this.s.logger.debug(f('ping strategy interval [%s], acceptableLatency [%s]', this.s.pingInterval, this.s.acceptableLatency)); - - // If we have enabled debug - if(this.s.debug) { - // Add access to the read Preference Strategies - Object.defineProperty(this, 'data', { - enumerable: true, get: function() { return this.s.pings; } - }); - } -} - -inherits(Ping, EventEmitter); - -/** - * @ignore - */ -var filterByTags = function(readPreference, servers) { - if(readPreference.tags == null) return servers; - var filteredServers = []; - var tags = readPreference.tags; - - // Iterate over all the servers - for(var i = 0; i < servers.length; i++) { - var serverTag = servers[i].lastIsMaster().tags || {}; - // Did we find the a matching server - var found = true; - // Check if the server is valid - for(var name in tags) { - if(serverTag[name] != tags[name]) found = false; - } - - // Add to candidate list - if(found) filteredServers.push(servers[i]); - } - - // Returned filtered servers - return filteredServers; -} - -/** - * Pick a server - * @method - * @param {State} set The current replicaset state object - * @param {ReadPreference} readPreference The current readPreference object - * @param {readPreferenceResultCallback} callback The callback to return the result from the function - * @return {object} - */ -Ping.prototype.pickServer = function(set, readPreference) { - var self = this; - // Only get primary and secondaries as seeds - var seeds = {}; - var servers = []; - if(set.primary) { - servers.push(set.primary); - } - - for(var i = 0; i < set.secondaries.length; i++) { - servers.push(set.secondaries[i]); - } - - // Filter by tags - servers = filterByTags(readPreference, servers); - - // Transform the list - var serverList = []; - // for(var name in seeds) { - for(var i = 0; i < servers.length; i++) { - serverList.push({name: servers[i].name, time: self.s.pings[servers[i].name] || 0}); - } - - // Sort by time - serverList.sort(function(a, b) { - return a.time > b.time; - }); - - // Locate lowest time (picked servers are lowest time + acceptable Latency margin) - var lowest = serverList.length > 0 ? serverList[0].time : 0; - - // Filter by latency - serverList = serverList.filter(function(s) { - return s.time <= lowest + self.s.acceptableLatency; - }); - - // No servers, default to primary - if(serverList.length == 0 && set.primary) { - if(self.s.logger.isInfo()) self.s.logger.info(f('picked primary server [%s]', set.primary.name)); - return set.primary; - } else if(serverList.length == 0) { - return null - } - - // We picked first server - if(self.s.logger.isInfo()) self.s.logger.info(f('picked server [%s] with ping latency [%s]', serverList[0].name, serverList[0].time)); - - // Add to the index - self.s.index = self.s.index + 1; - // Select the index - self.s.index = self.s.index % serverList.length; - // Return the first server of the sorted and filtered list - return set.get(serverList[self.s.index].name); -} - -/** - * Start of an operation - * @method - * @param {Server} server The server the operation is running against - * @param {object} query The operation running - * @param {Date} date The start time of the operation - * @return {object} - */ -Ping.prototype.startOperation = function(server, query, date) { -} - -/** - * End of an operation - * @method - * @param {Server} server The server the operation is running against - * @param {error} err An error from the operation - * @param {object} result The result from the operation - * @param {Date} date The start time of the operation - * @return {object} - */ -Ping.prototype.endOperation = function(server, err, result, date) { -} - -/** - * High availability process running - * @method - * @param {State} set The current replicaset state object - * @param {resultCallback} callback The callback to return the result from the function - * @return {object} - */ -Ping.prototype.ha = function(topology, state, callback) { - var self = this; - var servers = state.getAll(); - var count = servers.length; - - // No servers return - if(servers.length == 0) return callback(null, null); - - // Return if we have not yet reached the ping interval - if(self.s.lastPing != null) { - var diff = new Date().getTime() - self.s.lastPing.getTime(); - if(diff < self.s.pingInterval) return callback(null, null); - } - - // Execute operation - var operation = function(_server) { - var start = new Date(); - // Execute ping against server - _server.command('system.$cmd', {ismaster:1}, function(err, r) { - count = count - 1; - var time = new Date().getTime() - start.getTime(); - self.s.pings[_server.name] = time; - // Log info for debug - if(self.s.logger.isDebug()) self.s.logger.debug(f('ha latency for server [%s] is [%s] ms', _server.name, time)); - // We are done with all the servers - if(count == 0) { - // Emit ping event - topology.emit('ping', err, r ? r.result : null); - // Update the last ping time - self.s.lastPing = new Date(); - // Return - callback(null, null); - } - }); - } - - // Let's ping all servers - while(servers.length > 0) { - operation(servers.shift()); - } -} - -var removeServer = function(self, server) { - delete self.s.pings[server.name]; -} - -/** - * Server connection closed - * @method - * @param {Server} server The server that closed - */ -Ping.prototype.close = function(server) { - removeServer(this, server); -} - -/** - * Server connection errored out - * @method - * @param {Server} server The server that errored out - */ -Ping.prototype.error = function(server) { - removeServer(this, server); -} - -/** - * Server connection timeout - * @method - * @param {Server} server The server that timed out - */ -Ping.prototype.timeout = function(server) { - removeServer(this, server); -} - -/** - * Server connection happened - * @method - * @param {Server} server The server that connected - * @param {resultCallback} callback The callback to return the result from the function - */ -Ping.prototype.connect = function(server, callback) { - var self = this; - // Get the command start date - var start = new Date(); - // Execute ping against server - server.command('system.$cmd', {ismaster:1}, function(err, r) { - var time = new Date().getTime() - start.getTime(); - self.s.pings[server.name] = time; - // Log info for debug - if(self.s.logger.isDebug()) self.s.logger.debug(f('connect latency for server [%s] is [%s] ms', server.name, time)); - // Set last ping - self.s.lastPing = new Date(); - // Done, return - callback(null, null); - }); -} - -/** - * This is a result from a readPreference strategy - * - * @callback readPreferenceResultCallback - * @param {error} error An error object. Set to null if no error present - * @param {Server} server The server picked by the strategy - */ - -module.exports = Ping; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js deleted file mode 100644 index e2e6a67a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_4_support.js +++ /dev/null @@ -1,559 +0,0 @@ -"use strict"; - -var Insert = require('./commands').Insert - , Update = require('./commands').Update - , Remove = require('./commands').Remove - , Query = require('../connection/commands').Query - , copy = require('../connection/utils').copy - , KillCursor = require('../connection/commands').KillCursor - , GetMore = require('../connection/commands').GetMore - , Query = require('../connection/commands').Query - , ReadPreference = require('../topologies/read_preference') - , f = require('util').format - , CommandResult = require('../topologies/command_result') - , MongoError = require('../error') - , Long = require('bson').Long; - -// Write concern fields -var writeConcernFields = ['w', 'wtimeout', 'j', 'fsync']; - -var WireProtocol = function() {} - -// -// Needs to support legacy mass insert as well as ordered/unordered legacy -// emulation -// -WireProtocol.prototype.insert = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - options = options || {}; - // Default is ordered execution - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - var legacy = typeof options.legacy == 'boolean' ? options.legacy : false; - ops = Array.isArray(ops) ? ops :[ops]; - - // If we have more than a 1000 ops fails - if(ops.length > 1000) return callback(new MongoError("exceeded maximum write batch size of 1000")); - - // Write concern - var writeConcern = options.writeConcern || {w:1}; - - // We are unordered - if(!ordered || writeConcern.w == 0) { - return executeUnordered('insert', Insert, ismaster, ns, bson, pool, callbacks, ops, options, callback); - } - - return executeOrdered('insert', Insert, ismaster, ns, bson, pool, callbacks, ops, options, callback); -} - -WireProtocol.prototype.update = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - options = options || {}; - // Default is ordered execution - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - ops = Array.isArray(ops) ? ops :[ops]; - - // Write concern - var writeConcern = options.writeConcern || {w:1}; - - // We are unordered - if(!ordered || writeConcern.w == 0) { - return executeUnordered('update', Update, ismaster, ns, bson, pool, callbacks, ops, options, callback); - } - - return executeOrdered('update', Update, ismaster, ns, bson, pool, callbacks, ops, options, callback); -} - -WireProtocol.prototype.remove = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - options = options || {}; - // Default is ordered execution - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - ops = Array.isArray(ops) ? ops :[ops]; - - // Write concern - var writeConcern = options.writeConcern || {w:1}; - - // We are unordered - if(!ordered || writeConcern.w == 0) { - return executeUnordered('remove', Remove, ismaster, ns, bson, pool, callbacks, ops, options, callback); - } - - return executeOrdered('remove', Remove, ismaster, ns, bson, pool, callbacks, ops, options, callback); -} - -WireProtocol.prototype.killCursor = function(bson, ns, cursorId, connection, callbacks, callback) { - // Create a kill cursor command - var killCursor = new KillCursor(bson, [cursorId]); - // Execute the kill cursor command - if(connection && connection.isConnected()) connection.write(killCursor.toBin()); - // Set cursor to 0 - cursorId = Long.ZERO; - // Return to caller - if(callback) callback(null, null); -} - -WireProtocol.prototype.getMore = function(bson, ns, cursorState, batchSize, raw, connection, callbacks, options, callback) { - // Create getMore command - var getMore = new GetMore(bson, ns, cursorState.cursorId, {numberToReturn: batchSize}); - - // Query callback - var queryCallback = function(err, r) { - if(err) return callback(err); - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - return callback(new MongoError("cursor killed or timed out"), null); - } - - // Ensure we have a Long valie cursor id - var cursorId = typeof r.cursorId == 'number' - ? Long.fromNumber(r.cursorId) - : r.cursorId; - - // Set all the values - cursorState.documents = r.documents; - cursorState.cursorId = cursorId; - - // Return - callback(null); - } - - // If we have a raw query decorate the function - if(raw) { - queryCallback.raw = raw; - } - - // Register a callback - callbacks.register(getMore.requestId, queryCallback); - // Write out the getMore command - connection.write(getMore.toBin()); -} - -WireProtocol.prototype.command = function(bson, ns, cmd, cursorState, topology, options) { - // Establish type of command - if(cmd.find) { - return setupClassicFind(bson, ns, cmd, cursorState, topology, options) - } else if(cursorState.cursorId != null) { - } else if(cmd) { - return setupCommand(bson, ns, cmd, cursorState, topology, options); - } else { - throw new MongoError(f("command %s does not return a cursor", JSON.stringify(cmd))); - } -} - -// -// Execute a find command -var setupClassicFind = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Ensure we have at least some options - options = options || {}; - // Set the optional batchSize - cursorState.batchSize = cmd.batchSize || cursorState.batchSize; - var numberToReturn = 0; - - // Unpack the limit and batchSize values - if(cursorState.limit == 0) { - numberToReturn = cursorState.batchSize; - } else if(cursorState.limit < 0 || cursorState.limit < cursorState.batchSize || (cursorState.limit > 0 && cursorState.batchSize == 0)) { - numberToReturn = cursorState.limit; - } else { - numberToReturn = cursorState.batchSize; - } - - var numberToSkip = cursorState.skip || 0; - // Build actual find command - var findCmd = {}; - // Using special modifier - var usesSpecialModifier = false; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' && readPreference) { - findCmd['$readPreference'] = readPreference.toJSON(); - usesSpecialModifier = true; - } - - // Add special modifiers to the query - if(cmd.sort) findCmd['orderby'] = cmd.sort, usesSpecialModifier = true; - if(cmd.hint) findCmd['$hint'] = cmd.hint, usesSpecialModifier = true; - if(cmd.snapshot) findCmd['$snapshot'] = cmd.snapshot, usesSpecialModifier = true; - if(cmd.returnKey) findCmd['$returnKey'] = cmd.returnKey, usesSpecialModifier = true; - if(cmd.maxScan) findCmd['$maxScan'] = cmd.maxScan, usesSpecialModifier = true; - if(cmd.min) findCmd['$min'] = cmd.min, usesSpecialModifier = true; - if(cmd.max) findCmd['$max'] = cmd.max, usesSpecialModifier = true; - if(cmd.showDiskLoc) findCmd['$showDiskLoc'] = cmd.showDiskLoc, usesSpecialModifier = true; - if(cmd.comment) findCmd['$comment'] = cmd.comment, usesSpecialModifier = true; - if(cmd.maxTimeMS) findCmd['$maxTimeMS'] = cmd.maxTimeMS, usesSpecialModifier = true; - - // If we have explain, return a single document and close cursor - if(cmd.explain) { - numberToReturn = -1; - usesSpecialModifier = true; - findCmd['$explain'] = true; - } - - // If we have a special modifier - if(usesSpecialModifier) { - findCmd['$query'] = cmd.query; - } else { - findCmd = cmd.query; - } - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server find command does not support a readConcern level of %s', cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) { - cmd = copy(cmd); - delete cmd['readConcern']; - } - - // Set up the serialize and ignoreUndefined fields - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Build Query object - var query = new Query(bson, ns, findCmd, { - numberToSkip: numberToSkip, numberToReturn: numberToReturn - , checkKeys: false, returnFieldSelector: cmd.fields - , serializeFunctions: serializeFunctions, ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Set up the option bits for wire protocol - if(typeof cmd.tailable == 'boolean') query.tailable = cmd.tailable; - if(typeof cmd.oplogReplay == 'boolean') query.oplogReplay = cmd.oplogReplay; - if(typeof cmd.noCursorTimeout == 'boolean') query.noCursorTimeout = cmd.noCursorTimeout; - if(typeof cmd.awaitData == 'boolean') query.awaitData = cmd.awaitData; - if(typeof cmd.exhaust == 'boolean') query.exhaust = cmd.exhaust; - if(typeof cmd.partial == 'boolean') query.partial = cmd.partial; - // Return the query - return query; -} - -// -// Set up a command cursor -var setupCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Set empty options object - options = options || {} - - // Final query - var finalCmd = {}; - for(var name in cmd) { - finalCmd[name] = cmd[name]; - } - - // Build command namespace - var parts = ns.split(/\./); - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' && readPreference) { - finalCmd['$readPreference'] = readPreference.toJSON(); - } - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server %s command does not support a readConcern level of %s', JSON.stringify(cmd), cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) delete cmd['readConcern']; - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - - // Set up the serialize and ignoreUndefined fields - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Build Query object - var query = new Query(bson, f('%s.$cmd', parts.shift()), finalCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) { - return callback; - } else { - return domain.bind(callback); - } -} - -var hasWriteConcern = function(writeConcern) { - if(writeConcern.w - || writeConcern.wtimeout - || writeConcern.j == true - || writeConcern.fsync == true - || Object.keys(writeConcern).length == 0) { - return true; - } - return false; -} - -var cloneWriteConcern = function(writeConcern) { - var wc = {}; - if(writeConcern.w != null) wc.w = writeConcern.w; - if(writeConcern.wtimeout != null) wc.wtimeout = writeConcern.wtimeout; - if(writeConcern.j != null) wc.j = writeConcern.j; - if(writeConcern.fsync != null) wc.fsync = writeConcern.fsync; - return wc; -} - -// -// Aggregate up all the results -// -var aggregateWriteOperationResults = function(opType, ops, results, connection) { - var finalResult = { ok: 1, n: 0 } - - // Map all the results coming back - for(var i = 0; i < results.length; i++) { - var result = results[i]; - var op = ops[i]; - - if((result.upserted || (result.updatedExisting == false)) && finalResult.upserted == null) { - finalResult.upserted = []; - } - - // Push the upserted document to the list of upserted values - if(result.upserted) { - finalResult.upserted.push({index: i, _id: result.upserted}); - } - - // We have an upsert where we passed in a _id - if(result.updatedExisting == false && result.n == 1 && result.upserted == null) { - finalResult.upserted.push({index: i, _id: op.q._id}); - } - - // We have an insert command - if(result.ok == 1 && opType == 'insert' && result.err == null) { - finalResult.n = finalResult.n + 1; - } - - // We have a command error - if(result != null && result.ok == 0 || result.err || result.errmsg) { - if(result.ok == 0) finalResult.ok = 0; - finalResult.code = result.code; - finalResult.errmsg = result.errmsg || result.err || result.errMsg; - - // Check if we have a write error - if(result.code == 11000 - || result.code == 11001 - || result.code == 12582 - || result.code == 16544 - || result.code == 16538 - || result.code == 16542 - || result.code == 14 - || result.code == 13511) { - if(finalResult.writeErrors == null) finalResult.writeErrors = []; - finalResult.writeErrors.push({ - index: i - , code: result.code - , errmsg: result.errmsg || result.err || result.errMsg - }); - } else { - finalResult.writeConcernError = { - code: result.code - , errmsg: result.errmsg || result.err || result.errMsg - } - } - } else if(typeof result.n == 'number') { - finalResult.n += result.n; - } else { - finalResult.n += 1; - } - - // Result as expected - if(result != null && result.lastOp) finalResult.lastOp = result.lastOp; - } - - // Return finalResult aggregated results - return new CommandResult(finalResult, connection); -} - -// -// Execute all inserts in an ordered manner -// -var executeOrdered = function(opType ,command, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - var _ops = ops.slice(0); - // Bind to current domain - callback = bindToCurrentDomain(callback); - // Collect all the getLastErrors - var getLastErrors = []; - - // Execute an operation - var executeOp = function(list, _callback) { - // Get a pool connection - var connection = pool.get(); - // No more items in the list - if(list.length == 0) return _callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - - // Get the first operation - var doc = list.shift(); - - // Create an insert command - var op = new command(Query.getRequestId(), ismaster, bson, ns, [doc], options); - // Write concern - var optionWriteConcern = options.writeConcern || {w:1}; - // Final write concern - var writeConcern = cloneWriteConcern(optionWriteConcern); - - // Get the db name - var db = ns.split('.').shift(); - - // Error out if no connection available - if(connection == null) - return _callback(new MongoError("no connection available")); - - try { - // Execute the insert - connection.write(op.toBin()); - - // If write concern 0 don't fire getLastError - if(hasWriteConcern(writeConcern)) { - var getLastErrorCmd = {getlasterror: 1}; - // Merge all the fields - for(var i = 0; i < writeConcernFields.length; i++) { - if(writeConcern[writeConcernFields[i]] != null) - getLastErrorCmd[writeConcernFields[i]] = writeConcern[writeConcernFields[i]]; - } - - // Create a getLastError command - var getLastErrorOp = new Query(bson, f("%s.$cmd", db), getLastErrorCmd, {numberToReturn: -1}); - // Write the lastError message - connection.write(getLastErrorOp.toBin()); - // Register the callback - callbacks.register(getLastErrorOp.requestId, function(err, result) { - if(err) return callback(err); - // Get the document - var doc = result.documents[0]; - // Save the getLastError document - getLastErrors.push(doc); - // If we have an error terminate - if(doc.ok == 0 || doc.err || doc.errmsg) return callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - // Execute the next op in the list - executeOp(list, callback); - }); - } - } catch(err) { - if(typeof err == 'string') err = new MongoError(err); - // We have a serialization error, rewrite as a write error to have same behavior as modern - // write commands - getLastErrors.push({ ok: 1, errmsg: err.message, code: 14 }); - // Return due to an error - return callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - } - } - - // Execute the operations - executeOp(_ops, callback); -} - -var executeUnordered = function(opType, command, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - // Bind to current domain - callback = bindToCurrentDomain(callback); - // Total operations to write - var totalOps = ops.length; - // Collect all the getLastErrors - var getLastErrors = []; - // Write concern - var optionWriteConcern = options.writeConcern || {w:1}; - // Final write concern - var writeConcern = cloneWriteConcern(optionWriteConcern); - // Driver level error - var error; - - // Execute all the operations - for(var i = 0; i < ops.length; i++) { - // Create an insert command - var op = new command(Query.getRequestId(), ismaster, bson, ns, [ops[i]], options); - // Get db name - var db = ns.split('.').shift(); - - // Get a pool connection - var connection = pool.get(); - - // Error out if no connection available - if(connection == null) - return _callback(new MongoError("no connection available")); - - try { - // Execute the insert - connection.write(op.toBin()); - // If write concern 0 don't fire getLastError - if(hasWriteConcern(writeConcern)) { - var getLastErrorCmd = {getlasterror: 1}; - // Merge all the fields - for(var j = 0; j < writeConcernFields.length; j++) { - if(writeConcern[writeConcernFields[j]] != null) - getLastErrorCmd[writeConcernFields[j]] = writeConcern[writeConcernFields[j]]; - } - - // Create a getLastError command - var getLastErrorOp = new Query(bson, f("%s.$cmd", db), getLastErrorCmd, {numberToReturn: -1}); - // Write the lastError message - connection.write(getLastErrorOp.toBin()); - - // Give the result from getLastError the right index - var callbackOp = function(_index) { - return function(err, result) { - if(err) error = err; - // Update the number of operations executed - totalOps = totalOps - 1; - // Save the getLastError document - if(!err) getLastErrors[_index] = result.documents[0]; - // Check if we are done - if(totalOps == 0) { - if(error) return callback(error); - callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - } - } - } - - // Register the callback - callbacks.register(getLastErrorOp.requestId, callbackOp(i)); - } - } catch(err) { - if(typeof err == 'string') err = new MongoError(err); - // Update the number of operations executed - totalOps = totalOps - 1; - // We have a serialization error, rewrite as a write error to have same behavior as modern - // write commands - getLastErrors[i] = { ok: 1, errmsg: err.message, code: 14 }; - // Check if we are done - if(totalOps == 0) { - callback(null, aggregateWriteOperationResults(opType, ops, getLastErrors, connection)); - } - } - } - - // Empty w:0 return - if(writeConcern - && writeConcern.w == 0 && callback) { - callback(null, null); - } -} - -module.exports = WireProtocol; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js deleted file mode 100644 index b1d1d462..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/2_6_support.js +++ /dev/null @@ -1,291 +0,0 @@ -"use strict"; - -var Insert = require('./commands').Insert - , Update = require('./commands').Update - , Remove = require('./commands').Remove - , Query = require('../connection/commands').Query - , copy = require('../connection/utils').copy - , KillCursor = require('../connection/commands').KillCursor - , GetMore = require('../connection/commands').GetMore - , Query = require('../connection/commands').Query - , ReadPreference = require('../topologies/read_preference') - , f = require('util').format - , CommandResult = require('../topologies/command_result') - , MongoError = require('../error') - , Long = require('bson').Long; - -var WireProtocol = function() {} - -// -// Execute a write operation -var executeWrite = function(topology, type, opsField, ns, ops, options, callback) { - if(ops.length == 0) throw new MongoError("insert must contain at least one document"); - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // Split the ns up to get db and collection - var p = ns.split("."); - var d = p.shift(); - // Options - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - var writeConcern = options.writeConcern || {}; - // return skeleton - var writeCommand = {}; - writeCommand[type] = p.join('.'); - writeCommand[opsField] = ops; - writeCommand.ordered = ordered; - writeCommand.writeConcern = writeConcern; - - // Options object - var opts = {}; - if(type == 'insert') opts.checkKeys = true; - // Ensure we support serialization of functions - if(options.serializeFunctions) opts.serializeFunctions = options.serializeFunctions; - if(options.ignoreUndefined) opts.ignoreUndefined = options.ignoreUndefined; - // Execute command - topology.command(f("%s.$cmd", d), writeCommand, opts, callback); -} - -// -// Needs to support legacy mass insert as well as ordered/unordered legacy -// emulation -// -WireProtocol.prototype.insert = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'insert', 'documents', ns, ops, options, callback); -} - -WireProtocol.prototype.update = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'update', 'updates', ns, ops, options, callback); -} - -WireProtocol.prototype.remove = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'delete', 'deletes', ns, ops, options, callback); -} - -WireProtocol.prototype.killCursor = function(bson, ns, cursorId, connection, callbacks, callback) { - // Create a kill cursor command - var killCursor = new KillCursor(bson, [cursorId]); - // Execute the kill cursor command - if(connection && connection.isConnected()) connection.write(killCursor.toBin()); - // Set cursor to 0 - cursorId = Long.ZERO; - // Return to caller - if(callback) callback(null, null); -} - -WireProtocol.prototype.getMore = function(bson, ns, cursorState, batchSize, raw, connection, callbacks, options, callback) { - // Create getMore command - var getMore = new GetMore(bson, ns, cursorState.cursorId, {numberToReturn: batchSize}); - - // Query callback - var queryCallback = function(err, r) { - if(err) return callback(err); - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - return callback(new MongoError("cursor killed or timed out"), null); - } - - // Ensure we have a Long valie cursor id - var cursorId = typeof r.cursorId == 'number' - ? Long.fromNumber(r.cursorId) - : r.cursorId; - - // Set all the values - cursorState.documents = r.documents; - cursorState.cursorId = cursorId; - - // Return - callback(null); - } - - // If we have a raw query decorate the function - if(raw) { - queryCallback.raw = raw; - } - - // Register a callback - callbacks.register(getMore.requestId, queryCallback); - // Write out the getMore command - connection.write(getMore.toBin()); -} - -WireProtocol.prototype.command = function(bson, ns, cmd, cursorState, topology, options) { - // Establish type of command - if(cmd.find) { - return setupClassicFind(bson, ns, cmd, cursorState, topology, options) - } else if(cursorState.cursorId != null) { - } else if(cmd) { - return setupCommand(bson, ns, cmd, cursorState, topology, options); - } else { - throw new MongoError(f("command %s does not return a cursor", JSON.stringify(cmd))); - } -} - -// -// Execute a find command -var setupClassicFind = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Ensure we have at least some options - options = options || {}; - // Set the optional batchSize - cursorState.batchSize = cmd.batchSize || cursorState.batchSize; - var numberToReturn = 0; - - // Unpack the limit and batchSize values - if(cursorState.limit == 0) { - numberToReturn = cursorState.batchSize; - } else if(cursorState.limit < 0 || cursorState.limit < cursorState.batchSize || (cursorState.limit > 0 && cursorState.batchSize == 0)) { - numberToReturn = cursorState.limit; - } else { - numberToReturn = cursorState.batchSize; - } - - var numberToSkip = cursorState.skip || 0; - // Build actual find command - var findCmd = {}; - // Using special modifier - var usesSpecialModifier = false; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' && readPreference) { - findCmd['$readPreference'] = readPreference.toJSON(); - usesSpecialModifier = true; - } - - // Add special modifiers to the query - if(cmd.sort) findCmd['orderby'] = cmd.sort, usesSpecialModifier = true; - if(cmd.hint) findCmd['$hint'] = cmd.hint, usesSpecialModifier = true; - if(cmd.snapshot) findCmd['$snapshot'] = cmd.snapshot, usesSpecialModifier = true; - if(cmd.returnKey) findCmd['$returnKey'] = cmd.returnKey, usesSpecialModifier = true; - if(cmd.maxScan) findCmd['$maxScan'] = cmd.maxScan, usesSpecialModifier = true; - if(cmd.min) findCmd['$min'] = cmd.min, usesSpecialModifier = true; - if(cmd.max) findCmd['$max'] = cmd.max, usesSpecialModifier = true; - if(cmd.showDiskLoc) findCmd['$showDiskLoc'] = cmd.showDiskLoc, usesSpecialModifier = true; - if(cmd.comment) findCmd['$comment'] = cmd.comment, usesSpecialModifier = true; - if(cmd.maxTimeMS) findCmd['$maxTimeMS'] = cmd.maxTimeMS, usesSpecialModifier = true; - - // If we have explain, return a single document and close cursor - if(cmd.explain) { - numberToReturn = -1; - usesSpecialModifier = true; - findCmd['$explain'] = true; - } - - // If we have a special modifier - if(usesSpecialModifier) { - findCmd['$query'] = cmd.query; - } else { - findCmd = cmd.query; - } - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server find command does not support a readConcern level of %s', cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) { - cmd = copy(cmd); - delete cmd['readConcern']; - } - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Build Query object - var query = new Query(bson, ns, findCmd, { - numberToSkip: numberToSkip, numberToReturn: numberToReturn - , checkKeys: false, returnFieldSelector: cmd.fields - , serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Set up the option bits for wire protocol - if(typeof cmd.tailable == 'boolean') query.tailable = cmd.tailable; - if(typeof cmd.oplogReplay == 'boolean') query.oplogReplay = cmd.oplogReplay; - if(typeof cmd.noCursorTimeout == 'boolean') query.noCursorTimeout = cmd.noCursorTimeout; - if(typeof cmd.awaitData == 'boolean') query.awaitData = cmd.awaitData; - if(typeof cmd.exhaust == 'boolean') query.exhaust = cmd.exhaust; - if(typeof cmd.partial == 'boolean') query.partial = cmd.partial; - // Return the query - return query; -} - -// -// Set up a command cursor -var setupCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Set empty options object - options = options || {} - - // Final query - var finalCmd = {}; - for(var name in cmd) { - finalCmd[name] = cmd[name]; - } - - // Build command namespace - var parts = ns.split(/\./); - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' && readPreference) { - finalCmd['$readPreference'] = readPreference.toJSON(); - } - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Throw on majority readConcern passed in - if(cmd.readConcern && cmd.readConcern.level != 'local') { - throw new MongoError(f('server %s command does not support a readConcern level of %s', JSON.stringify(cmd), cmd.readConcern.level)); - } - - // Remove readConcern, ensure no failing commands - if(cmd.readConcern) delete cmd['readConcern']; - - // Build Query object - var query = new Query(bson, f('%s.$cmd', parts.shift()), finalCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) { - return callback; - } else { - return domain.bind(callback); - } -} - -module.exports = WireProtocol; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js deleted file mode 100644 index c5e61aa1..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js +++ /dev/null @@ -1,494 +0,0 @@ -"use strict"; - -var Insert = require('./commands').Insert - , Update = require('./commands').Update - , Remove = require('./commands').Remove - , Query = require('../connection/commands').Query - , copy = require('../connection/utils').copy - , KillCursor = require('../connection/commands').KillCursor - , GetMore = require('../connection/commands').GetMore - , Query = require('../connection/commands').Query - , ReadPreference = require('../topologies/read_preference') - , f = require('util').format - , CommandResult = require('../topologies/command_result') - , MongoError = require('../error') - , Long = require('bson').Long; - -var WireProtocol = function(legacyWireProtocol) { - this.legacyWireProtocol = legacyWireProtocol; -} - -// -// Execute a write operation -var executeWrite = function(topology, type, opsField, ns, ops, options, callback) { - if(ops.length == 0) throw new MongoError("insert must contain at least one document"); - if(typeof options == 'function') { - callback = options; - options = {}; - } - - // Split the ns up to get db and collection - var p = ns.split("."); - var d = p.shift(); - // Options - var ordered = typeof options.ordered == 'boolean' ? options.ordered : true; - var writeConcern = options.writeConcern || {}; - // return skeleton - var writeCommand = {}; - writeCommand[type] = p.join('.'); - writeCommand[opsField] = ops; - writeCommand.ordered = ordered; - writeCommand.writeConcern = writeConcern; - - // Do we have bypassDocumentValidation set, then enable it on the write command - if(typeof options.bypassDocumentValidation == 'boolean') { - writeCommand.bypassDocumentValidation = options.bypassDocumentValidation; - } - - // Options object - var opts = {}; - if(type == 'insert') opts.checkKeys = true; - // Ensure we support serialization of functions - if(options.serializeFunctions) opts.serializeFunctions = options.serializeFunctions; - if(options.ignoreUndefined) opts.ignoreUndefined = options.ignoreUndefined; - // Execute command - topology.command(f("%s.$cmd", d), writeCommand, opts, callback); -} - -// -// Needs to support legacy mass insert as well as ordered/unordered legacy -// emulation -// -WireProtocol.prototype.insert = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'insert', 'documents', ns, ops, options, callback); -} - -WireProtocol.prototype.update = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'update', 'updates', ns, ops, options, callback); -} - -WireProtocol.prototype.remove = function(topology, ismaster, ns, bson, pool, callbacks, ops, options, callback) { - executeWrite(topology, 'delete', 'deletes', ns, ops, options, callback); -} - -WireProtocol.prototype.killCursor = function(bson, ns, cursorId, connection, callbacks, callback) { - // Build command namespace - var parts = ns.split(/\./); - // Command namespace - var commandns = f('%s.$cmd', parts.shift()); - // Create getMore command - var killcursorCmd = { - killCursors: parts.join('.'), - cursors: [cursorId] - } - - // Build Query object - var query = new Query(bson, commandns, killcursorCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, returnFieldSelector: null - }); - - // Set query flags - query.slaveOk = true; - - // Execute the kill cursor command - if(connection && connection.isConnected()) { - connection.write(query.toBin()); - } - - // Kill cursor callback - var killCursorCallback = function(err, r) { - if(err) { - if(typeof callback != 'function') return; - return callback(err); - } - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - if(typeof callback != 'function') return; - return callback(new MongoError("cursor killed or timed out"), null); - } - - if(!Array.isArray(r.documents) || r.documents.length == 0) { - if(typeof callback != 'function') return; - return callback(new MongoError(f('invalid getMore result returned for cursor id %s', cursorState.cursorId))); - } - - // Return the result - if(typeof callback == 'function') { - callback(null, r.documents[0]); - } - } - - // Register a callback - callbacks.register(query.requestId, killCursorCallback); -} - -WireProtocol.prototype.getMore = function(bson, ns, cursorState, batchSize, raw, connection, callbacks, options, callback) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - // Build command namespace - var parts = ns.split(/\./); - // Command namespace - var commandns = f('%s.$cmd', parts.shift()); - - // Check if we have an maxTimeMS set - var maxTimeMS = typeof cursorState.cmd.maxTimeMS == 'number' ? cursorState.cmd.maxTimeMS : 3000; - - // Create getMore command - var getMoreCmd = { - getMore: cursorState.cursorId, - collection: parts.join('.'), - batchSize: batchSize, - maxTimeMS: maxTimeMS - } - - // Build Query object - var query = new Query(bson, commandns, getMoreCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, returnFieldSelector: null - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Query callback - var queryCallback = function(err, r) { - if(err) return callback(err); - - // If we have a timed out query or a cursor that was killed - if((r.responseFlags & (1 << 0)) != 0) { - return callback(new MongoError("cursor killed or timed out"), null); - } - - if(!Array.isArray(r.documents) || r.documents.length == 0) - return callback(new MongoError(f('invalid getMore result returned for cursor id %s', cursorState.cursorId))); - - // Raw, return all the extracted documents - if(raw) { - cursorState.documents = r.documents; - cursorState.cursorId = r.cursorId; - return callback(null, r.documents); - } - - // Ensure we have a Long valie cursor id - var cursorId = typeof r.documents[0].cursor.id == 'number' - ? Long.fromNumber(r.documents[0].cursor.id) - : r.documents[0].cursor.id; - - // Set all the values - cursorState.documents = r.documents[0].cursor.nextBatch; - cursorState.cursorId = cursorId; - - // Return the result - callback(null, r.documents[0]); - } - - // If we have a raw query decorate the function - if(raw) { - queryCallback.raw = raw; - } - - // Add the result field needed - queryCallback.documentsReturnedIn = 'nextBatch'; - - // Register a callback - callbacks.register(query.requestId, queryCallback); - // Write out the getMore command - connection.write(query.toBin()); -} - -WireProtocol.prototype.command = function(bson, ns, cmd, cursorState, topology, options) { - // Establish type of command - if(cmd.find) { - if(cmd.exhaust) { - return this.legacyWireProtocol.command(bson, ns, cmd, cursorState, topology, options); - } - - // Create the find command - var query = executeFindCommand(bson, ns, cmd, cursorState, topology, options) - // Mark the cmd as virtual - cmd.virtual = false; - // Signal the documents are in the firstBatch value - query.documentsReturnedIn = 'firstBatch'; - // Return the query - return query; - } else if(cursorState.cursorId != null) { - } else if(cmd) { - return setupCommand(bson, ns, cmd, cursorState, topology, options); - } else { - throw new MongoError(f("command %s does not return a cursor", JSON.stringify(cmd))); - } -} - -// // Command -// { -// find: ns -// , query: -// , limit: -// , fields: -// , skip: -// , hint: -// , explain: -// , snapshot: -// , batchSize: -// , returnKey: -// , maxScan: -// , min: -// , max: -// , showDiskLoc: -// , comment: -// , maxTimeMS: -// , raw: -// , readPreference: -// , tailable: -// , oplogReplay: -// , noCursorTimeout: -// , awaitdata: -// , exhaust: -// , partial: -// } - -// FIND/GETMORE SPEC -// { -// “find”: , -// “filter”: { ... }, -// “sort”: { ... }, -// “projection”: { ... }, -// “hint”: { ... }, -// “skip”: , -// “limit”: , -// “batchSize”: , -// “singleBatch”: , -// “comment”: , -// “maxScan”: , -// “maxTimeMS”: , -// “max”: { ... }, -// “min”: { ... }, -// “returnKey”: , -// “showRecordId”: , -// “snapshot”: , -// “tailable”: , -// “oplogReplay”: , -// “noCursorTimeout”: , -// “awaitData”: , -// “partial”: , -// “$readPreference”: { ... } -// } - -// -// Execute a find command -var executeFindCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Ensure we have at least some options - options = options || {}; - // Set the optional batchSize - cursorState.batchSize = cmd.batchSize || cursorState.batchSize; - - // Build command namespace - var parts = ns.split(/\./); - // Command namespace - var commandns = f('%s.$cmd', parts.shift()); - - // Build actual find command - var findCmd = { - find: parts.join('.') - }; - - // I we provided a filter - if(cmd.query) findCmd.filter = cmd.query; - - // Sort value - var sortValue = cmd.sort; - - // Handle issue of sort being an Array - if(Array.isArray(sortValue)) { - var sortObject = {}; - - if(sortValue.length > 0 && !Array.isArray(sortValue[0])) { - var sortDirection = sortValue[1]; - // Translate the sort order text - if(sortDirection == 'asc') { - sortDirection = 1; - } else if(sortDirection == 'desc') { - sortDirection = -1; - } - - // Set the sort order - sortObject[sortValue[0]] = sortDirection; - } else { - for(var i = 0; i < sortValue.length; i++) { - var sortDirection = sortValue[i][1]; - // Translate the sort order text - if(sortDirection == 'asc') { - sortDirection = 1; - } else if(sortDirection == 'desc') { - sortDirection = -1; - } - - // Set the sort order - sortObject[sortValue[i][0]] = sortDirection; - } - } - - sortValue = sortObject; - }; - - // Add sort to command - if(cmd.sort) findCmd.sort = sortValue; - // Add a projection to the command - if(cmd.fields) findCmd.projection = cmd.fields; - // Add a hint to the command - if(cmd.hint) findCmd.hint = cmd.hint; - // Add a skip - if(cmd.skip) findCmd.skip = cmd.skip; - // Add a limit - if(cmd.limit) findCmd.limit = cmd.limit; - // Add a batchSize - if(cmd.batchSize) findCmd.batchSize = cmd.batchSize; - - // Check if we wish to have a singleBatch - if(cmd.limit < 0) { - findCmd.limit = Math.abs(cmd.limit); - findCmd.singleBatch = true; - } - - // If we have comment set - if(cmd.comment) findCmd.comment = cmd.comment; - - // If we have maxScan - if(cmd.maxScan) findCmd.maxScan = cmd.maxScan; - - // If we have maxTimeMS set - if(cmd.maxTimeMS) findCmd.maxTimeMS = cmd.maxTimeMS; - - // If we have min - if(cmd.min) findCmd.min = cmd.min; - - // If we have max - if(cmd.max) findCmd.max = cmd.max; - - // If we have returnKey set - if(cmd.returnKey) findCmd.returnKey = cmd.returnKey; - - // If we have showDiskLoc set - if(cmd.showDiskLoc) findCmd.showRecordId = cmd.showDiskLoc; - - // If we have snapshot set - if(cmd.snapshot) findCmd.snapshot = cmd.snapshot; - - // If we have tailable set - if(cmd.tailable) findCmd.tailable = cmd.tailable; - - // If we have oplogReplay set - if(cmd.oplogReplay) findCmd.oplogReplay = cmd.oplogReplay; - - // If we have noCursorTimeout set - if(cmd.noCursorTimeout) findCmd.noCursorTimeout = cmd.noCursorTimeout; - - // If we have awaitData set - if(cmd.awaitData) findCmd.awaitData = cmd.awaitData; - if(cmd.awaitdata) findCmd.awaitData = cmd.awaitdata; - - // If we have partial set - if(cmd.partial) findCmd.partial = cmd.partial; - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' && readPreference) { - findCmd['$readPreference'] = readPreference.toJSON(); - } - - // If we have explain, we need to rewrite the find command - // to wrap it in the explain command - if(cmd.explain) { - findCmd = { - explain: findCmd - } - } - - // Did we provide a readConcern - if(cmd.readConcern) findCmd.readConcern = cmd.readConcern; - - // Set up the serialize and ignoreUndefined fields - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Build Query object - var query = new Query(bson, commandns, findCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, returnFieldSelector: null - , serializeFunctions: serializeFunctions, ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -// -// Set up a command cursor -var setupCommand = function(bson, ns, cmd, cursorState, topology, options) { - var readPreference = options.readPreference || new ReadPreference('primary'); - if(typeof readPreference == 'string') readPreference = new ReadPreference(readPreference); - if(!(readPreference instanceof ReadPreference)) throw new MongoError('readPreference must be a ReadPreference instance'); - - // Set empty options object - options = options || {} - - // Final query - var finalCmd = {}; - for(var name in cmd) { - finalCmd[name] = cmd[name]; - } - - // Build command namespace - var parts = ns.split(/\./); - - // We have a Mongos topology, check if we need to add a readPreference - if(topology.type == 'mongos' && readPreference) { - finalCmd['$readPreference'] = readPreference.toJSON(); - } - - // Serialize functions - var serializeFunctions = typeof options.serializeFunctions == 'boolean' - ? options.serializeFunctions : false; - - // Set up the serialize and ignoreUndefined fields - var ignoreUndefined = typeof options.ignoreUndefined == 'boolean' - ? options.ignoreUndefined : false; - - // Build Query object - var query = new Query(bson, f('%s.$cmd', parts.shift()), finalCmd, { - numberToSkip: 0, numberToReturn: -1 - , checkKeys: false, serializeFunctions: serializeFunctions - , ignoreUndefined: ignoreUndefined - }); - - // Set query flags - query.slaveOk = readPreference.slaveOk(); - - // Return the query - return query; -} - -/** - * @ignore - */ -var bindToCurrentDomain = function(callback) { - var domain = process.domain; - if(domain == null || callback == null) { - return callback; - } else { - return domain.bind(callback); - } -} - -module.exports = WireProtocol; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js deleted file mode 100644 index 9c665ee8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/lib/wireprotocol/commands.js +++ /dev/null @@ -1,357 +0,0 @@ -"use strict"; - -var MongoError = require('../error'); - -// Wire command operation ids -var OP_UPDATE = 2001; -var OP_INSERT = 2002; -var OP_DELETE = 2006; - -var Insert = function(requestId, ismaster, bson, ns, documents, options) { - // Basic options needed to be passed in - if(ns == null) throw new MongoError("ns must be specified for query"); - if(!Array.isArray(documents) || documents.length == 0) throw new MongoError("documents array must contain at least one document to insert"); - - // Validate that we are not passing 0x00 in the colletion name - if(!!~ns.indexOf("\x00")) { - throw new MongoError("namespace cannot contain a null character"); - } - - // Set internal - this.requestId = requestId; - this.bson = bson; - this.ns = ns; - this.documents = documents; - this.ismaster = ismaster; - - // Ensure empty options - options = options || {}; - - // Unpack options - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : true; - this.continueOnError = typeof options.continueOnError == 'boolean' ? options.continueOnError : false; - // Set flags - this.flags = this.continueOnError ? 1 : 0; -} - -// To Binary -Insert.prototype.toBin = function() { - // Contains all the buffers to be written - var buffers = []; - - // Header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // Flags - + Buffer.byteLength(this.ns) + 1 // namespace - ); - - // Add header to buffers - buffers.push(header); - - // Total length of the message - var totalLength = header.length; - - // Serialize all the documents - for(var i = 0; i < this.documents.length; i++) { - var buffer = this.bson.serialize(this.documents[i] - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - - // Document is larger than maxBsonObjectSize, terminate serialization - if(buffer.length > this.ismaster.maxBsonObjectSize) { - throw new MongoError("Document exceeds maximum allowed bson size of " + this.ismaster.maxBsonObjectSize + " bytes"); - } - - // Add to total length of wire protocol message - totalLength = totalLength + buffer.length; - // Add to buffer - buffers.push(buffer); - } - - // Command is larger than maxMessageSizeBytes terminate serialization - if(totalLength > this.ismaster.maxMessageSizeBytes) { - throw new MongoError("Command exceeds maximum message size of " + this.ismaster.maxMessageSizeBytes + " bytes"); - } - - // Add all the metadata - var index = 0; - - // Write header length - header[index + 3] = (totalLength >> 24) & 0xff; - header[index + 2] = (totalLength >> 16) & 0xff; - header[index + 1] = (totalLength >> 8) & 0xff; - header[index] = (totalLength) & 0xff; - index = index + 4; - - // Write header requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // No flags - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Operation - header[index + 3] = (OP_INSERT >> 24) & 0xff; - header[index + 2] = (OP_INSERT >> 16) & 0xff; - header[index + 1] = (OP_INSERT >> 8) & 0xff; - header[index] = (OP_INSERT) & 0xff; - index = index + 4; - - // Flags - header[index + 3] = (this.flags >> 24) & 0xff; - header[index + 2] = (this.flags >> 16) & 0xff; - header[index + 1] = (this.flags >> 8) & 0xff; - header[index] = (this.flags) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Return the buffers - return buffers; -} - -var Update = function(requestId, ismaster, bson, ns, update, options) { - // Basic options needed to be passed in - if(ns == null) throw new MongoError("ns must be specified for query"); - - // Ensure empty options - options = options || {}; - - // Set internal - this.requestId = requestId; - this.bson = bson; - this.ns = ns; - this.ismaster = ismaster; - - // Unpack options - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false; - - // Unpack the update document - this.upsert = typeof update[0].upsert == 'boolean' ? update[0].upsert : false; - this.multi = typeof update[0].multi == 'boolean' ? update[0].multi : false; - this.q = update[0].q; - this.u = update[0].u; - - // Create flag value - this.flags = this.upsert ? 1 : 0; - this.flags = this.multi ? this.flags | 2 : this.flags; -} - -// To Binary -Update.prototype.toBin = function() { - // Contains all the buffers to be written - var buffers = []; - - // Header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // ZERO - + Buffer.byteLength(this.ns) + 1 // namespace - + 4 // Flags - ); - - // Add header to buffers - buffers.push(header); - - // Total length of the message - var totalLength = header.length; - - // Serialize the selector - var selector = this.bson.serialize(this.q - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - buffers.push(selector); - totalLength = totalLength + selector.length; - - // Serialize the update - var update = this.bson.serialize(this.u - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - buffers.push(update); - totalLength = totalLength + update.length; - - // Index in header buffer - var index = 0; - - // Write header length - header[index + 3] = (totalLength >> 24) & 0xff; - header[index + 2] = (totalLength >> 16) & 0xff; - header[index + 1] = (totalLength >> 8) & 0xff; - header[index] = (totalLength) & 0xff; - index = index + 4; - - // Write header requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // No flags - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Operation - header[index + 3] = (OP_UPDATE >> 24) & 0xff; - header[index + 2] = (OP_UPDATE >> 16) & 0xff; - header[index + 1] = (OP_UPDATE >> 8) & 0xff; - header[index] = (OP_UPDATE) & 0xff; - index = index + 4; - - // Write ZERO - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Flags - header[index + 3] = (this.flags >> 24) & 0xff; - header[index + 2] = (this.flags >> 16) & 0xff; - header[index + 1] = (this.flags >> 8) & 0xff; - header[index] = (this.flags) & 0xff; - index = index + 4; - - // Return the buffers - return buffers; -} - -var Remove = function(requestId, ismaster, bson, ns, remove, options) { - // Basic options needed to be passed in - if(ns == null) throw new MongoError("ns must be specified for query"); - - // Ensure empty options - options = options || {}; - - // Set internal - this.requestId = requestId; - this.bson = bson; - this.ns = ns; - this.ismaster = ismaster; - - // Unpack options - this.serializeFunctions = typeof options.serializeFunctions == 'boolean' ? options.serializeFunctions : false; - this.ignoreUndefined = typeof options.ignoreUndefined == 'boolean' ? options.ignoreUndefined : false; - this.checkKeys = typeof options.checkKeys == 'boolean' ? options.checkKeys : false; - - // Unpack the update document - this.limit = typeof remove[0].limit == 'number' ? remove[0].limit : 1; - this.q = remove[0].q; - - // Create flag value - this.flags = this.limit == 1 ? 1 : 0; -} - -// To Binary -Remove.prototype.toBin = function() { - // Contains all the buffers to be written - var buffers = []; - - // Header buffer - var header = new Buffer( - 4 * 4 // Header - + 4 // ZERO - + Buffer.byteLength(this.ns) + 1 // namespace - + 4 // Flags - ); - - // Add header to buffers - buffers.push(header); - - // Total length of the message - var totalLength = header.length; - - // Serialize the selector - var selector = this.bson.serialize(this.q - , this.checkKeys - , true - , this.serializeFunctions - , 0, this.ignoreUndefined); - buffers.push(selector); - totalLength = totalLength + selector.length; - - // Index in header buffer - var index = 0; - - // Write header length - header[index + 3] = (totalLength >> 24) & 0xff; - header[index + 2] = (totalLength >> 16) & 0xff; - header[index + 1] = (totalLength >> 8) & 0xff; - header[index] = (totalLength) & 0xff; - index = index + 4; - - // Write header requestId - header[index + 3] = (this.requestId >> 24) & 0xff; - header[index + 2] = (this.requestId >> 16) & 0xff; - header[index + 1] = (this.requestId >> 8) & 0xff; - header[index] = (this.requestId) & 0xff; - index = index + 4; - - // No flags - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Operation - header[index + 3] = (OP_DELETE >> 24) & 0xff; - header[index + 2] = (OP_DELETE >> 16) & 0xff; - header[index + 1] = (OP_DELETE >> 8) & 0xff; - header[index] = (OP_DELETE) & 0xff; - index = index + 4; - - // Write ZERO - header[index + 3] = (0 >> 24) & 0xff; - header[index + 2] = (0 >> 16) & 0xff; - header[index + 1] = (0 >> 8) & 0xff; - header[index] = (0) & 0xff; - index = index + 4; - - // Write collection name - index = index + header.write(this.ns, index, 'utf8') + 1; - header[index - 1] = 0; - - // Write ZERO - header[index + 3] = (this.flags >> 24) & 0xff; - header[index + 2] = (this.flags >> 16) & 0xff; - header[index + 1] = (this.flags >> 8) & 0xff; - header[index] = (this.flags) & 0xff; - index = index + 4; - - // Return the buffers - return buffers; -} - -module.exports = { - Insert: Insert - , Update: Update - , Remove: Remove -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml deleted file mode 100644 index b0fb9f4d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/.travis.yml +++ /dev/null @@ -1,20 +0,0 @@ -language: node_js -node_js: - - "0.8" - - "0.10" - - "0.12" - - "iojs-v1.8.4" - - "iojs-v2.5.0" - - "iojs-v3.3.0" - - "4" -addons: - apt: - sources: - - ubuntu-toolchain-r-test - packages: - - g++-4.8 -before_install: - - '[ "${TRAVIS_NODE_VERSION}" != "0.8" ] || npm install -g npm@1.4.28' - - if [[ $TRAVIS_OS_NAME == "linux" ]]; then export CXX=g++-4.8; fi - - $CXX --version - - npm explore npm -g -- npm install node-gyp@latest \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE deleted file mode 100644 index 261eeb9e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/LICENSE +++ /dev/null @@ -1,201 +0,0 @@ - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md deleted file mode 100644 index 7428b0d0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/README.md +++ /dev/null @@ -1,4 +0,0 @@ -kerberos -======== - -Kerberos library for node.js \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp deleted file mode 100644 index 6655299c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/binding.gyp +++ /dev/null @@ -1,46 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'kerberos', - 'cflags!': [ '-fno-exceptions' ], - 'cflags_cc!': [ '-fno-exceptions' ], - 'include_dirs': [ '> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c -o $@ $< - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = rm -rf "$@" && cp -af "$<" "$@" - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS) - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -o $@ -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,kerberos.target.mk)))),) - include kerberos.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/home/ubuntu/workspace/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/config.gypi -I/home/ubuntu/.nvm/v0.10.35/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/ubuntu/.node-gyp/0.10.35/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/ubuntu/.node-gyp/0.10.35" "-Dmodule_root_dir=/home/ubuntu/workspace/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos" binding.gyp -Makefile: $(srcdir)/../../../../../../../../../../.nvm/v0.10.35/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../../.node-gyp/0.10.35/common.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d deleted file mode 100644 index e06bd939..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/base64.o.d +++ /dev/null @@ -1,4 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/base64.o := cc '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/base64.o.d.raw -c -o Release/obj.target/kerberos/lib/base64.o ../lib/base64.c -Release/obj.target/kerberos/lib/base64.o: ../lib/base64.c ../lib/base64.h -../lib/base64.c: -../lib/base64.h: diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d deleted file mode 100644 index 8cbc346a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d +++ /dev/null @@ -1,63 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/kerberos.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -fno-rtti -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/kerberos.o.d.raw -c -o Release/obj.target/kerberos/lib/kerberos.o ../lib/kerberos.cc -Release/obj.target/kerberos/lib/kerberos.o: ../lib/kerberos.cc \ - ../lib/kerberos.h /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /usr/include/mit-krb5/gssapi/gssapi.h \ - /usr/include/mit-krb5/gssapi/gssapi_generic.h \ - /usr/include/mit-krb5/gssapi/gssapi_krb5.h \ - /usr/include/mit-krb5/gssapi/gssapi_ext.h /usr/include/mit-krb5/krb5.h \ - /usr/include/mit-krb5/krb5/krb5.h ../node_modules/nan/nan.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_version.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_pre_12_inl.h \ - ../node_modules/nan/nan_maybe_pre_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_pre_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_pre_12_inl.h \ - ../node_modules/nan/nan_persistent_pre_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h \ - ../lib/kerberosgss.h ../lib/worker.h ../lib/kerberos_context.h -../lib/kerberos.cc: -../lib/kerberos.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/usr/include/mit-krb5/gssapi/gssapi.h: -/usr/include/mit-krb5/gssapi/gssapi_generic.h: -/usr/include/mit-krb5/gssapi/gssapi_krb5.h: -/usr/include/mit-krb5/gssapi/gssapi_ext.h: -/usr/include/mit-krb5/krb5.h: -/usr/include/mit-krb5/krb5/krb5.h: -../node_modules/nan/nan.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_version.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_pre_12_inl.h: -../node_modules/nan/nan_maybe_pre_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_pre_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_pre_12_inl.h: -../node_modules/nan/nan_persistent_pre_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: -../lib/kerberosgss.h: -../lib/worker.h: -../lib/kerberos_context.h: diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d deleted file mode 100644 index 8144d1b0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d +++ /dev/null @@ -1,62 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/kerberos_context.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -fno-rtti -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/kerberos_context.o.d.raw -c -o Release/obj.target/kerberos/lib/kerberos_context.o ../lib/kerberos_context.cc -Release/obj.target/kerberos/lib/kerberos_context.o: \ - ../lib/kerberos_context.cc ../lib/kerberos_context.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /usr/include/mit-krb5/gssapi/gssapi.h \ - /usr/include/mit-krb5/gssapi/gssapi_generic.h \ - /usr/include/mit-krb5/gssapi/gssapi_krb5.h \ - /usr/include/mit-krb5/gssapi/gssapi_ext.h /usr/include/mit-krb5/krb5.h \ - /usr/include/mit-krb5/krb5/krb5.h ../node_modules/nan/nan.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_version.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_pre_12_inl.h \ - ../node_modules/nan/nan_maybe_pre_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_pre_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_pre_12_inl.h \ - ../node_modules/nan/nan_persistent_pre_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h \ - ../lib/kerberosgss.h -../lib/kerberos_context.cc: -../lib/kerberos_context.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/usr/include/mit-krb5/gssapi/gssapi.h: -/usr/include/mit-krb5/gssapi/gssapi_generic.h: -/usr/include/mit-krb5/gssapi/gssapi_krb5.h: -/usr/include/mit-krb5/gssapi/gssapi_ext.h: -/usr/include/mit-krb5/krb5.h: -/usr/include/mit-krb5/krb5/krb5.h: -../node_modules/nan/nan.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_version.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_pre_12_inl.h: -../node_modules/nan/nan_maybe_pre_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_pre_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_pre_12_inl.h: -../node_modules/nan/nan_persistent_pre_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: -../lib/kerberosgss.h: diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d deleted file mode 100644 index 1eecdc99..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d +++ /dev/null @@ -1,16 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/kerberosgss.o := cc '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/kerberosgss.o.d.raw -c -o Release/obj.target/kerberos/lib/kerberosgss.o ../lib/kerberosgss.c -Release/obj.target/kerberos/lib/kerberosgss.o: ../lib/kerberosgss.c \ - ../lib/kerberosgss.h /usr/include/mit-krb5/gssapi/gssapi.h \ - /usr/include/mit-krb5/gssapi/gssapi_generic.h \ - /usr/include/mit-krb5/gssapi/gssapi_krb5.h \ - /usr/include/mit-krb5/gssapi/gssapi_ext.h /usr/include/mit-krb5/krb5.h \ - /usr/include/mit-krb5/krb5/krb5.h ../lib/base64.h -../lib/kerberosgss.c: -../lib/kerberosgss.h: -/usr/include/mit-krb5/gssapi/gssapi.h: -/usr/include/mit-krb5/gssapi/gssapi_generic.h: -/usr/include/mit-krb5/gssapi/gssapi_krb5.h: -/usr/include/mit-krb5/gssapi/gssapi_ext.h: -/usr/include/mit-krb5/krb5.h: -/usr/include/mit-krb5/krb5/krb5.h: -../lib/base64.h: diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d deleted file mode 100644 index 8fe448ed..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/.deps/Release/obj.target/kerberos/lib/worker.o.d +++ /dev/null @@ -1,49 +0,0 @@ -cmd_Release/obj.target/kerberos/lib/worker.o := g++ '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DBUILDING_NODE_EXTENSION' -I/home/ubuntu/.node-gyp/0.10.35/src -I/home/ubuntu/.node-gyp/0.10.35/deps/uv/include -I/home/ubuntu/.node-gyp/0.10.35/deps/v8/include -I../node_modules/nan -I/usr/include/mit-krb5 -fPIC -Wall -Wextra -Wno-unused-parameter -pthread -m64 -O2 -fno-strict-aliasing -fno-tree-vrp -fno-tree-sink -fno-omit-frame-pointer -fno-rtti -MMD -MF ./Release/.deps/Release/obj.target/kerberos/lib/worker.o.d.raw -c -o Release/obj.target/kerberos/lib/worker.o ../lib/worker.cc -Release/obj.target/kerberos/lib/worker.o: ../lib/worker.cc \ - ../lib/worker.h /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h \ - /home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h \ - ../node_modules/nan/nan.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h \ - /home/ubuntu/.node-gyp/0.10.35/src/node_version.h \ - ../node_modules/nan/nan_callbacks.h \ - ../node_modules/nan/nan_callbacks_pre_12_inl.h \ - ../node_modules/nan/nan_maybe_pre_43_inl.h \ - ../node_modules/nan/nan_converters.h \ - ../node_modules/nan/nan_converters_pre_43_inl.h \ - ../node_modules/nan/nan_new.h \ - ../node_modules/nan/nan_implementation_pre_12_inl.h \ - ../node_modules/nan/nan_persistent_pre_12_inl.h \ - ../node_modules/nan/nan_weak.h ../node_modules/nan/nan_object_wrap.h -../lib/worker.cc: -../lib/worker.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-unix.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/ngx-queue.h: -/home/ubuntu/.node-gyp/0.10.35/deps/uv/include/uv-private/uv-linux.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8.h: -/home/ubuntu/.node-gyp/0.10.35/deps/v8/include/v8stdint.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -/home/ubuntu/.node-gyp/0.10.35/src/node.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_object_wrap.h: -../node_modules/nan/nan.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_buffer.h: -/home/ubuntu/.node-gyp/0.10.35/src/node_version.h: -../node_modules/nan/nan_callbacks.h: -../node_modules/nan/nan_callbacks_pre_12_inl.h: -../node_modules/nan/nan_maybe_pre_43_inl.h: -../node_modules/nan/nan_converters.h: -../node_modules/nan/nan_converters_pre_43_inl.h: -../node_modules/nan/nan_new.h: -../node_modules/nan/nan_implementation_pre_12_inl.h: -../node_modules/nan/nan_persistent_pre_12_inl.h: -../node_modules/nan/nan_weak.h: -../node_modules/nan/nan_object_wrap.h: diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/linker.lock b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/linker.lock deleted file mode 100644 index e69de29b..00000000 diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/base64.o b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/base64.o deleted file mode 100644 index b7308d88d55a579f8473f8a8e5f4f048459a753b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3600 zcmbVO>u(fQ6u+}OeLtq9g@OgUJOzQJTM7cUu+#3g11^+47Dds`c00AD?QYqfN&$f- z(`q-kgfAw>KfzBX#>Nm+cZ(^cpOhF;6QgMq%i{wW6R|?qb7t;sr_*ghJju+x=XZYR zG3Va7GZ)>S1`Ed#CLGyM<~4>A@-Sn5?$oAEQb_WMSBm}KD#iYl)Cbwqh+ihd31yWO z`$f~f!dTi&sEDFjito~f*iV|tkaG6|WA)bR`{Fr&Fj!wF$%4Wtp(Cl)D|6s}wXe<@yzVLGo0qa~vHz$&RpUQ(}H z6Zb6Y)B$0%v}~mLi7?vw)Fq78&nBmMF)_`nQ^QcP{UWkzzn0VeGd0M<5=?_{8_WV||WI8mY7& zQp`QAckQx!`tIaxDuwGOwjI=)i>J3f`q~?2m5_;~5 z7a$wkK2|bxOBgBwP@TCbyk89y=pxN43ZvD<&gg7P7%E4DFxJXxv;xpv!WdsBMjwN5 z7K4G&qR!MRWg6o?K%T&@x@b)q5PsGP=d5Z92`R`lsS$41M{A0K@Fi&O*m&}e1(ur^ zlQX<0ew=gVeD54_h$_DU($*?x#pJI%MEAs-En_K=(}hytPf-}Fb|hyluAB+y$SF=| zLz)x7l;WqX;ui^|=D4BWVu+9l>91+tS+3Z)m|MCR)=Be{VvqEG3_pYxFIX>6?8m#` z0Lb>cC-&{#gh8KxjeLXO08g=SozpJhd2n>Mv^2Hsvu%vzlEZReD164|@9hl*{7QEy zXzTQM_sSg@Y$?I|pHcP$??Cmg-7oFgyYJ`Ah3!AsRxOLlh`;JOS)lSVW*44Y*4UN*lL$7!aA89(; z+|t_SJ@)Er$6xoi2Rh`=x4XJe_Vo4zL;a`15oO?=(}QQuqO)Gd)*Xa2*4OW|ZT7Yg z1eF0>wSAAhYP)0afTlXO=m0!?DQy6EwuNwmMO=A)R`ylcd@BK8O>Gj6VqwvHmimHB zQMGOZbq}@m1D8l>J5-R__<_}>^43Bw7oxcHI&l#5NF`9ZC_jmO7OPI@`zb%7yXj1O zI9ZzuMM64u8qHVezWe!C(MD#YI5SNz1@9*GcpID`t)9d-v(i9HbN>yv{(4Tcoi z-gv~jJ)-ynJwU)Ha+j|&?C+Clb^m{`fh#_mc1jq+IO+V7)d0e@XrW5VLFY{vs#3lV zMlm=DsyNL?1q9a#WfNS8o6?Y^89*`!4W}z`$2G;6X8N=GJHQuXR>5Ty=C8fE1_R5_ zMkm;CZZUAQDQ!y9gxgFy?osr|y=Igo_1|a&Vb1chvDttbsdv&XN*Zn_#mx0jQ~!^Q zL1E6;kHLPJq)T;E`;fpsphR5%9JrW2TmNFf%xi}(QTl(efYXzs|DGb&Gj1oHo}0>u2ubde&;34EVELELM`W2*mSX znV~;y|7-=^eDSK`eY n>z2TK=pln=xjb+neC>pCeDzZArL%{AN~g)clTCd8rYD4eIjk zGMBH~({IzQ>GJ1>T65E}m+z3J{JQ0b_jkwtK!2x>K8{;RMTPVN{~7uIp*;_dXe{k{ zkVbV&?X`(dq|`5?u|h4gjsur++;*|e_iYpMAyE!I&I7?_^yRJQzUUjj!qrG0zv1%b zZE!W_I%xZv=<-R8F5f1XZ|n|g`<#})xcoOzSI&Et`lrj^MUVNqE$J@b zPSG`TuA~qZj8D|Bx=HgIHl);F(9+UES_7kLJ2|D>P!4xBCkD?qOduY(h=sTm-{#0c z!0}Q=tH$v=C}L5$GT!9)UlGwrY73gaD_ARGH5p1)j^CW`+oCfT`1XoC!k+)r|NpIj znt1*Z?Rzngu!6>?9n{n0K%>Foy6KBogJa3xwRTM{9T_S0qiBS={A=dY!8(#}G4-$Q z)RP4AuMxr5w=G3prg_nphPt-$vmAzR?{)D|>8oK4DgUz9q;kZHrk zXDOwWM|M`)(mFAoKdyvaqXhMD5FD0mTSaFV3wwN?aaB`lGtm!WpN8 z6&m4;MlLMUAKSS?*hbn9daM26P0;lWZvDkmM>Kru?U3&u+>^px^#Faw)$pOWtq9b+ zS_&zjnuKrK@+y_4B5jVFVy%cdf=07Fud`n<&*ztxyBOOz$)^-OiRdJa(ofY;q@1ecskEq{kqBAwqkO;!&RV?-? zW_+S~tE^|ldf9K#RCSV$=8Y~HFXYk9lbb^J6|xpy7s!%@eJSfZo<5;=KEuNlG$xi=C2eXxhBC?_qFsYoxY7v(|8yw1mlAA!urQZ zOUP9+w9`6#;tw=AZ<|xgWsLC6N*LiQpE|-fqaxoYuB1s~!~T{QI$BHuGQU5WgG(lgUHg3h6+P)Hd{Af&>fA7*;Y$wTDir&uqnY|5 zxk{Fl@5?g+pHO5}{ZmyiZ*E{VhtJ^pSn=(F93dNYL|{Ed>6C7?ZV&LB6N<+zffcMk z$FH#Qw^!t;<=Thw2Z;v@`U4$AS^ZKQQx6bQp$f{na5Qd)^PxJz8hTGN2TXk`7}uMl z!chG~>oIeDi2a%41C0<`@%T2?eL~Il-Om#r>b{mkPR55$J^kmW)*Yk>F)Wt5VP%4k z;`y-s;u33H-RD&9;h2>Aadfio5J}x4q|TS)kuSrvZ7JeHNL|3)oYF9gdO%%GS6fPh zi}v#URL~z%>kipc=6`SFg0AII)J3!%ueo{%ArY-8KHQ?B5s7GHQ|cQCuH*Y$rs%RY zrG5{ogkbie%C7s5UUgapvxSu16wK6m(>ETX)O5rg%AE*%@c#dinG`JlV1oj=KbFg?xng2He zfkpI3-e-YzW#9_Z9X3HE5fF--0#&RBh2Laho*d*j2{|+(*dJ|*kXJ#?(Wiu{^8{!N zT*pxjXP7#26VOj=GABoG8qjnr!JJZA-ny)y#*U#b*bkLSkKa!#e zttRFl7Ng`^wf<7ex>M=axn6*<(AOf|)2(%N3$J0P$d!HKV=*ZWNgT^I?mLA8NZoZ^ zjFkEe66ev8=WNMYOOgh!nN#XFQ;`HeQjz69yh1qw!@yygcXq^@umWSl{r;Ze?_+}YvAMfTrLQ=7L>Niwh(yCq_=*+Q0 z*h6vYAjTt#PcA&xWpKarQ-`KVMz+wm6K~V~Vg0=n_nnV~2YC5$4G&a#u|&&{HNxR= zdBP$ig@{-$1)ih$5*lBodS$h)Ugxr|Fh3u&-QL?nHuFs@H5JjKF>GO0N|s}oz4h`? zZE4-IS2Ru7rC~~a7S#4l5sw9_rWGvR{f;*0+FYUJLg7_Usr`!fotolviZx zCX77&a(As)WDbkza*Bw8S~+V3qfFFmnPz{K5@4>;4h)mp)BHr!e`&s%W1er~c($Nr zzx2MEZ-$uWn-o6guX6Q#vs-p+G2e8Gm~Se@eA9{Mn=fg3O*2gg0v0n(dzyq?zAgp6 zsbbA8E_*0P55g**)g7d<|DY&PtfDDc{iGWXgGtp9C!Xg-S;2|tIBqyB`1oiOPs``W zKk+1n+4nO|Jh1-zCfdByU50WRr=c!Q^UfMEmT`R3df3gfO*rrD(eus+mh(*8}V z&O3*wKwb}DB#o@+a1*rinB#Uz{mf7Vrarev_!)vL&o|>B0v~a{scBt(V7`IS=klH0 zi|bP0>(eWNwqp6tcLwMJ{!?B}`_+Xl4T-=$0$wcBG&D+}Qh=XrKH3>JIUMoQM$9bwo}pZ_ zH9r+4yX6d2;M*grsBh3U(-gnC`J3?XGx7eJy#D#|7rFkSIR9rcAH}BBFIU$;lcUW? z9=hp)*FOXJ80VvGkxO3xToExJ-9x(74H+8NeN+j-yI5k)bfmsV_tj|v6#cL6b-IGx zCf0?z3#x%bb=XDI99?5YyBkLL+OMaxYNjjj)rdPpVz#4HAOE5nCS;@im z)V+kn_0(1LbH$3Il|*S*DaKj=DGQyob(+jjq1?t z_5(DDgysB9On>4QI^7Mf4CSP|!SWj_URJD!N%G$`HNiYCzW*5{oG$v8>W?(x?_wVY z`!lV72FlJ;&)tyk6TXJWIE9(l6$QS*z4)eMaD5S*(ojm;RVWfSt^*YUK+iZ@;N0%5 z#!36Ij+lWDsD@2wPe_ccUMA}=r{eR%$6;VJIZ9q<2FK+%IWDFAH1k_irQ`yV2NAE!cs5pFp7&5PvZJU=+no&6z~ft~j|(BVwB;M5 zG=RmWZCgGWb}RL4BI^=pq?o?#qWOI!ouYfDp>?#pj#TmGr(LsVlTk;U%WoA{|CDRi zzV9AwE^q$p@z3SE$Yr6m#?LjEi*=Z6URu9@E8_t5E4W`eG#D>*e-rWaMZ$Q$l)6OV zU5F!mk0EdY=MBbJyq^7vM8&-SnaER1wc~i(i#lMie^WfJmW8YS-m3d)H59tT;@A={ z@|bUenb-N|&=VF-^d$#h3cSgG-imUXxV~rzc{1XQ8;hH3*4G#O{LcTyCmI|-Jw7>% zl=}aF<5TjEqs6D+zx{vlNqx`rfANVUa+D}`T=D7We!lR(zJ9uKG_7zVuMNEgt-FTn z#M51HeiZX?^YY;Q2UkI}9#yL%x_08{h16G8`jN-#eyuC_KAu*aV5N7B(iyhWdyj7) zz)J5CaXSH4dWj;JTPw16_QEvBYbK6uw}?yFN7`_Q-9(YADKs6M9%!li^zSiA1z3K{>JeK>9=W2 z|MW#P96K#V!v_YPp2`x~&vHuS+#j8rGAnUS9JRWfL8X-^kG~ z1!VTH-(d2Czmv4Q%a==*(5+YToUx7%^aBAI8o4y_@Guui4-kt|gFlar`Vet~c%Yqr z%hBZ8o-69@Y-xTlx<}6@OQnTT9X>#xj?%PY-(S=3pSUCEjG><%@gv2f=?74kaKQAf zttGB2tJ_HwxsJ|rc-D^9qs-+Ozj6xUP4Yo^eY3Ce+@9NMu)H1gRpCd(*F4y~60#tN5j=7xU{@uOe#oJWany*zC3OS8ckc=yhB1i_|TD!>?F3zj(4l z{a950`o7`A>WlSnKXshJc{4b{`o+}le2o@4`Ukywo_F1}g=hb;U)Bxf$zIOM`M%hm z&C5tpP+px--<8N2cyd$oE|}1p_ck@}Z{8(xNr9&3^>}_CpWhvJ{=p-k4_r^f4@Ev} z{-*gOse$iTifJ}*u}SC?epsTG)-Fc#yHHx-ER)>lY>(0=G&Kd1Od?UsrQ)AFlEdWtHCdWyVL zd!K1^FQ0gor`St0Z(4Z6VO>tCL zmh^Fykdvl(Djkzci>8oF*(8!HCKpdED!$q=xw@>F9nIxg>gmItCY41cWu8fnNuE;A z6xlix%gfmZeMn<96}QZIwsTJ=ze1}Mte#pJ1Q#6z2(K_r4G_o zR#hU}*vh2;rae|ZVm}2dQ(jg&(@{}gRaG*v)Z>^j)l+8WsFEs&r>uyiCWZSMdT}2| zc?G+psMJwBm72#>HYMmx_E2P#$$rpxNIo?%`Mz{miKlc@Zh18ia4{CySV~ZcgA6Gv zr?KQH7K4F0N0qmztk}bH;BUy%$KjpoaZvZFF7-MlSC&r`$6-Til&7kKItUHR$z+Km z?3^4*P&w`>4$)Jh*UHKc(Q_l6U{yaJ2~^Or)Q|1$JE_P^!$%Gq3&S#a=wJ{shFiI6#DUDPjC~`DgKKpHk}Q&rozfrsmYp8OGcM#ud3H>aaUX-Elnt164+w^9m zUGhdbyNO=7CjBIxM$fNAdz54W6)&_$Kg~CX#A$PT(F2Cm=JLjrYQ5_4_R%(<9=ttd zGG5*9QJxawEiEyf`nwI|ffyS-`M)y8Wf=Fip`wVVcBbuV$u466ZO8q3th76ob$;6F zcw<)QmN;W+jGcBLjp_bmyzypCXWHKz)8mnN|5fES8SP&#~UrS6aE%&+#YME{rh8?KN?Fao{hD? zM#jaSVHor6-S3Dup0}TF82_@f*xb0;q~xJ^5?ddCieY@md$%UgA9A!WMp`f@i7faw zQCslOM7Cg8B3baQ%`i6E?T;iH+wIN=l8iZVCoE4g?vJz6{=;$1pW({99A|$c(fB%! zEVv`S`%8(&+V~p7*qC6yFUfc`CA(`x9QH<@fePiXvYoQofs$=+B+}hpc%b z=1kf-$NqehaenfqL}S!Gvi#3&>?@LtciUtxN;2-Wb^Lph@s!O@`_J2$ueVW-*KPLK zlgKwz_#?61UraLo6g$>1p0l&qtM&rJSR7~HmuNf|m;7F$u_w+)S`WtCe@rxL6O#Wy zRZX~wY>c)@0;{dG3xud=!C*zA8xGUjq?JrmpgwIt&&v11JG z9wfGd&3!D+em|KKmwXGkO`H2~Vea-M}LDar>_GihR?UElPRf$f+*w04Rv3+;( zpQn@Py^eoXmOiB{eI|u0^|d!fy+s;U*zEsoPj1ZoYkT9M?SuzYjQO#4+P@=~`C{%@ zPsZBkr5L-}(mD3-_q8{c+xa`6{c-kNQjCLf$^U6@ER27NYn@EPlK+`tJQwo=seHv|-%g{%mbodxsE<8iPJ(eytey6k#xj43 zYw%*MeOH3<1=nDqz55#p#>@6g3}aawi>;3H8pi5)`-TK#Lwxen3C8<8G#+E~*YKYY z5~!VP+tS|c{O5nytaZv;3)_*mYUvt9dTVVv_SO^a$XnwLF<;5!{FONS z-gd?}JkIZm@BVH(iYXUR+)iMz6$uk5nzyxYOf(*8o4h>HSl^c3HTpgKZhkxZvyA_& z=0AVpKcBQC_rAitmOR^@Bfi6aPaEUBugDT2wYENl`q}9V$$^7!KEb#tCiR~kjXPuV z2<(dK8t7@8o%SEKbt1`iwys+`8t>Z%Z|X>~ zA@%u=#w)SiiR_8({7^^ZFon>L#%w!F-f!=^w4<@wKKQ|oMnhccZ5@q!0rE)V5j{p2`u?xLf3aY z7zYvtzum#u+%|P<2jl&=-HFt;>%6Liac?_2?JsM`k}tRG`fLZ|y>^42>0m5POkLW+ zSe@9N$gafBi%5T>o%U}|V#&Lcy4=>mSeZ2V)(*zuq|}=`7>km-6Iqko`P)?EFUfY= z|0tOy|DD|BpQ%P;`@vtQ8XvSz{Up`c-@ZGMJ5xHplWIJhVyFF=Q_dpEgDEGym1-;{W^Q zJKyH7eB~;eZj8A6;{9H<-j-j+=`W%_b8Q#z+)%es!s>trbOq%tDRzwconvHC**WK2 zDDI{3?Sga8kyk&xr)QmWP66H0C>_juQeeoLj>~71c&9qXIL>wGTNSzTjs`^(NYl$p zCPk{|0xT3mUfxyqS*W2KIJxR>fKXQ$yiFvG9amIZ?HSU?!MT5Trb)9roL*Att)|P? z=mm@|qnkl=i^w`1Isd4m++cZ+a`L931`QCKyK6QQ}Z*~5mjkbBQt~z_0 zi`$W!eD({=zREI`Lb88Ijtj~bhRJ>_MU5rA6?#eb{6^a!=EaiUB9?Wr-k$VvkS{o0 z!+*>+)JRd5a~*>m+gYLHLUxkRf_8@LL^HE-pOWoC`?Bou$?R)Bx7y+ym+`JT$Il)F zZO*B)dD-0IiQ{>bM-_DNd0Gr|qFeA`vThd2Nff^Asbn57$+WpZ)_)jp&X=zQcAmX1uFcD= z?*gg|*PGVxBJl-(nEd(kY(wi}Z_s74Y^{)_?;(ys_Ni9L?reo@tZJuYu_3(`vhUIr zBd1CHNBfN0-`oc52k9t^|0dZf?5u*sYk0$bg=PB)rygB4on&__dtWA7!rEfkt+x5G zjrKpxi>r&bt!=~lhm(Hp)AN*mm&q0``!RJctPh?)-!?*ZgnVhQu=8CdyAt()>}4!V zohFOU&sF{PHf+lJa1K|ZtzOtWlO*kfTYxe|G0S08kHR9qSm8Bjwv-tXJ2zn5ixiK z#sAgpdv=?MQ4aDKrxgAp`o{3&xM5Ns+xV)|SKroTqw44R^WrX~j-HUfT8AYHonEE0 zTTmy@n{~FaB*JxAq|Tqt=S3YZ3f93$tC~5@TQrfj-b%Ths`n~ArA2At%dRxOQ*ES8 ztg12uNONB{GLx1*&h*gAEq`Rj^epFqVd~4BF`j7^rA1y(-pJAJjI&3Um*tjM%;aw) zLOI6Jmpk67{LvZiyu7@j8F|xT{p>FzI9u2h>suFH{%l+~S5T|MeGDmu5h*ldox@1aOk+-^%TZ?KTE*tWBH%fa_ z?YK=dOQuzvJ*=qMOJAPmk8$T^ReDH4ncJH;Cf$wopeq4ds#hpfLf?eCiz+LNxamY= zs}rK#$z?>Tca0gR`d6qe^DG2|wKSc_!=V>bYfMgayQkFDxGU&lgTL}B@y>KlPdCzv z%co7F?`VxQ`jX0%HhkpRzGQOo)hfSds(W%JeaC2|O{pxWYWz&;cNE9OI@qKyTOD(J z;WUswm(oXth2YjIznJSt9`ny=MgBsP<%IcpU45+OUm|jc=bzb%{1c+&zpNGcr$)&i zTn~XBEC1;R#`-rwKJ5pq{54U^zpWMdYop|UqZRq*M#+CuEAn$)Ibr=@rDI)hy|t?U zT_SgQ{<0lhlWDQqo;OVGs7-44q0yC&wJmt6_Y!$DccR?#_~CEPbbY!= zZ17yj<*Vg{qK2`{RIWb3vY2@8XPxH!yH$Q&p3Y-FcG3w^f3<$oayoyU25M`r|9q97 z|5p>H&sF(Pnhe&5dV4=*;(c@eyIfM+-%J(L_Urt-7Uq4ko!$bOUzs5f=&z}o##6+i zwciSxEMbGn$?eDY6ma|JO2? z{{^vV<=2j&6O@L^P4KU|{JnH0TKW6!vS1xYxO}d&x%>_!7Ongps(f)>6D&Ql{`@}4 zXys3hljZMMdAWT01}CC?w?+9CBW1=(D!<;C>wlR=`Iqqj+MtB>=QXUk{x_)dP0eq- ztIA)Z*1SR){gGPr5v_?;etshzrrL4x=xFxyPvE2ZZ$}jSd0lR{e}zT)`&Iek`WXx} z`;W(WwDMgEbb``jDlfNRclwyif5)Qyii>5&qm}=rMfv-ql;0yt`CnU|F9_kuC{c7l8zHx|6cSl*Pq|p#FFOtWn4m#(&=&&{A(`%V#*)Q|0`7a6I4zv z{|x$=%P*(=?TMShtkGMQujQ4RV19jkl|}if?IP>X_rbM3?U(CR{b>`HvQ_zyN;ScA zj^Li$;rkpcVlyk?#Tun_xe5Mt1oz}l9p#JWzuwCJ2}+***M~l4`}u!aL@Pi07|Vak zqWrm0%1?_@K7ZdX%2#&kO|2@ww+3qKFde^PQT{$vzDvn-{n?l1`tR1|(-zZXs(dZ4 z&zX<;_4v{JpU&@lq@?=^m(ObionP}d)NxtT+|Dah`8?(@Nv$#u^F);&WqAKRmEX*D ze$5>!zp47hPL+R!DgJBwb^flDKU)1=s{Z@v9uX(5{{Z^v{JQ>p?M5mhl3sT@O()Iv z^Rd}>R#xkkD$~W+g7oYR9hT6?Tt3|%idy~(pUhu*qTK4g=JGW+Z&@zZ_@>3o`Pe2_ z(vfFu@@`hd30uUfON!W{T>0`Ey$$JiC@q<4%j;z36HJ^BZAM2$LmPTbNXRc%XrbCx zE1sHnF1BXXN%|s;7`w`f>iV1*1VI z&xJ}pTgmqfog)3eg(JCJtK=7}GisSGj%>kiZ`4WJd_eNt?&)ffI#f9mUqLF zO{~bmkT|f(yUbxHzEb)Z^9^K5dR^b1{KECkPLh13+!$%Zxg95{W4ykziItE#0UMiG zp#Y#=zOUT|czA!{6-8vSL4U)uHZg-Ek^44-XV%DMiTg(kjV@Q%h> z6sG+HO1{Y?|AXSIO`M-A=63neq=z5#WByMQ=VuX_e{bTQ6i+t!^S6q3GjWIF{CW#a zrz@Uk;{3=PmwSncXDEJ^iDxO!*SDDXCF!ikgpFLq`5GCMOY!ihdgzrOiVs6!+8?F3 zc|=~Uc#TQ^3dN_Gc#+^{E9vOKxX-^FPJ@o4qE#)2=k;A<@SUJKrf>cjTzI7QmQ&x~=ZQhY*BdCbp) zaaymqqmMl1XT3Nj(WMvb*^n-eHNRBx3F=agpV8vt$*tk(OAU!q3y^Nqwiz!|-MSZX2POq~7f7$*Iz z@317%IEkj;#XQPo!B`9ViNrg={fFMN7$f+i1b%6P`?7+J4EMC63U}Dg&iO?Qg##`w zucVhMM9Pc~zN`UdoLS*I_&p7HJ|jK+y!>$oN|-h9Z#2Tr4-D5JUJemmK$;jS5VTPW zm~4!AQj4EfORJ!#zS0Jg8}yTcp(nY9I`gLIIS0Dkg`@JujJec3Z0yL~G5Hscbh}AB zLfZgY<$Py<{WP5V!3sTPH^$A6;RT;p>+c>QOQA>9qyf&1s1_WjPD`UBt=3N-wjzss z3b7R#TKPnxrDoxBex9!&BU3-Vsh@M?-b4?~<&C<4Jv}g|a!NHnELW8$I(Q}y0*l@g zK2oCgps1tC)XT^=EKI&vC8Dcl^otaV95Uf1NmUWUCfMmiuW$()HNo?;N~Xad*(3UK z3F5KQV1IQ&f3<3z;RP3-pHtv=S5;4R=esGgh}X+-6iO?|rKcAQatHDsr`UDUGqbdx zA^v8Hzx~AD{^IWd@s}Q?B^mMOZ1Gnp$PfxL1kVr(GK7K*p&&yj$PfxLM6L{>CPU=S z6nQg6-b|4GQc{62RE=o|LL@;q$=s7zy@Ke$Q zxAF+KL9u6RzXf0ab%cVIuQP|1(EEL=JksGuke5G02sv9kDsS-sd6c%{wTN+~$HQff zRd>(G%$@2fzS=WsxQE{91#dvgE8+THK*nd~)kv;>3m`@~@quH><&*hkR>8r>eJV>< zu;f|~{RY8P>7mymSyq-NvXZh%ZhG?(&A~?0huNjIVWT)#gagqB&SsnGwOnGz2Q8L{ zo;{|V&St8RLPCS!2r88d0~5 zYTL}w9D1qHt1GE{c!PzUtxgV5L&RJi%93{#o7azD=;qAe zSfW>TVi^*0RywRh_*Wm~zjSw&UJ8;6ODNVU9Q28HYtZn4uA-{kqUtGAm5s98e#7Vo zJ*C06${WS*3g*%N3j)>AGAEUIsI94!dnzl-%H5^v-F*DoJ!)&iQ$sJ*bGs|(jdR|~ z?&7Ie8`J3bn0H66PAJ zrL*6dsg>n3LUj-Cp<&`2IwYWI2?H_2o$2{ix@g%6Lg%Pc%Rv%4q58iweXMtKRsp@( z%{!G&7E3QtT{*Lo8F+DJiPyt&d4XM#-=T6VX#X+nM*m|u0i ze4Sv(ak3Sh8R|r+)=_Mbmj-;L(pnqX`!WtWv#7aE@6wajgk&5{! z4x?A%h2;v(KhpfH{3?uc5sSWz^kVUL#cKZjmfNd;tEXBu@>gFR(WqO}52JX3Izpp{ z+G$|e5Rw;Rt@Tn!Tljz!mr|`9kRe@JVU~$&$m2ImE0f*vCo0pml**2$Uj=KKD<|kN zoCl~Sy{o;^f1ep{1C8MZMct?%w z)?#X-$vw<96liI(D4`z+UQ1n_>lj>B;6$m%Nknoedo$xUJ25wFga zqnAoD%R8OyFg@(F*5DFTlqJ0zY6|B7a~XLh;eH64c(~MvAMHxT!z{8-s0-bEv4(Vk@P!EQ}792=0z{eNr5wb=8P`K z%R6tmcV>kr!m2DyqO1}_Ca6V{yWdb+^HBZCO-EQW1{YXoQ~i!wwctQKa_Cl*O4hLQ z%3=@cHMuL;^haFL_TvRnc+ZCwB6s|V3FVjvjeAm6xqGU($v_LZ;+i5i-8kUYoW8ZC zUOlYtyZ2RF{`zPdedxdGh@`)NWnKoHWjLAT=SnO%%5PGfzar>QAFcmQkS_=R74Qn+ z2Q2td^*xhWf0^QJ=QW^*|Jg4m=BWP;3;wBv{*LN957tvjA6+jeaMXXE1s`s~p9Wq9 z`nLl|{e9JQ32cuS@iu zfTKObfTKO5fulW_14nzN07rXfS@1c)(Vl04qdo5cUj*ajL*Taq{~Y)oz`q5K_4)xg z*2|VanJIDn96%o(2T~Ph|D!z);CF(2CUC4*7Vx`3J|8&7u`$5;S$b`c8#wyE9QZvT zUjzJJ;I+W-1AYf^wEqd6{2O^~C%tG^B=#FW)2aF2fuo*%z_Gsjfn$9S0)G(n zC#dI0xZK6S`vAv!Ie}xloDUrB9045dyaYJfSpgjN%mR+>H5WLxR}*k-uVuioUM~X2 zayJ6U_WB!eY_BhYqn?An(GU8OY;(LyXh)4fi8;1cC*X_eobD$l178As0PqFC3xK2l zOMv6N{}pi5e*ie@IShO*l-o9u4k(%H+tq^i0FLFR1IKddwSH0cj|aYtB(&eI2L2Fm ze!i6x+xakkw0xc79QV!!ejCU?0(=$lM}fZy{4wAk0LOLaCl>s7NtBrq+llg-inEZ2vxxNBesvlW~;T54X@q*SC-2 ztY;wb0U(d_)DYk}Zw>?gBy-)o1<*4U z_=~{#d0|dG%`BvkwsSi065uz3p4GtVHT@!Sz0eQ00-p`?i-Dtmo&=8b-3!3cKd%DE zcKIvtIZ*Dm7QAh$FkiGU+S%QLJ1uyz;^z1>734Ag&_B-=$t+)MA%6>SwDW%8=%0sy z<9xaTILfaEj`RKo;HYN@aFpK(9Od@_$8!H=!M_KNdJ;N>+6(oh0!R5g;MhM46leeQ zI}LRI9|!UnSFZ$)adk3qjH_k9(avSS(Viz1XM6aOaBUC0#a|>IUue%Oz|o#9z|o#h zfWHj-OX)duPOSfF`si|R1-=IOBfwVxe;xR8;QX9BC)WQAeYF11fTNzc6IfcxucWP( z?*$y~DFKep-hBTs-HoJXDoj(&I%IL5tKfun!k z0gm&?N5IiP`+;M-v;fC>q(kRWd!aoS0Z02UQJlv${}e;_=ZPS{2>4aNZwFop9LIG% zaI|v)aI|xY1z%~wH(GH1T?Ho|*Qh_|Hv&iSQ5L+&g8LOW&yP(Yzm$s7{=CmZeu;(r zlfcpb)fRfzf;^V{C*TXfp7(&`e6$-l_QQR^QT|`RQUCYAQ9ka(kpEGCd*CSF6*$WG z0FLtMz)?O6ILhY%M|u9e3n%VB$Zr9T<7k26+#k-Rk8bySK_17^GT^s^{FA_O96bjd z?fDw`9iYe7g$^jO{cGu??U?`^=a)NxW4v7f9P9f$@KvCH8*q$Qdw`>!gTOIP+D{^- zl-T~~>7(sW29AFCjRkiA$9nx9_zR$a0`M1sPf^@FkCXw&dE{Eqvl{f=3>^J12RM%R zyMUvAmI1#T^e+dF{@DN=+vU%|F+K-?qdkX#uY+dhY*9*)2H^^hTF{h9qC6-U4kM@58@biGD0M7<~lH%OYrvpC~ zj&ux<4c;&h3li;soG0F1iB8anS=f z+T#X}@uv#-TCnGJ;1~x^R2_`%#CiWr;8@=@;HyCYdBA4@zXCYwxdu4K!&$(e2R(Cu zqaSXy;CBPZdOZaE1-TqcT!4;{fXnNEpQxP{ea^*8lpJ2`v&@GKNo^Lw#((fH-h|)z@G;G z7;yB%YT)RH^@^MQ@EXXYAKn6ves~`^`k@*0<2<+@_69LLLK3x16SuT`Aw#CB`|`K4h00+3Gwei!ibfIkR48~Ed(e>(8x zAdl;rmp~rl)kferFTVjC<=+L4@*e|7`2cW~KL8x%4+BT}#GX`1O5A^NU2y_%ly?9} z{k?&sd?s+zKL|L==L1Lm7g_LIfMY*jpg8xR9Qx>felN&lKVJqM`}vc=v7bK&9PRuX zIK~rOFEWBsEPZf2GZr|;feFAd4pacgIIsvf#(`D9QN9H@t}8m6F3c2mqCbBFd=-gk zf1Uvx=jEZmQO~8oF@8<~{ygX}2abN8VZm<#j`f-c`~}dz5jd`wUR9jq|3Z-eGw>4N zAA+9M!1n-0KkNfO8{`iGNB{8ubLYhU2iHp}z|lY5fn&R*1D`{>bUR)I9POD59M?-T zfusBi;J6;x037|WU2*d`eGBAqoW2hn$LYtwah!e&9LM8f#m)13YH#+k^fUUuD{!3O zy}+NQeA=IP0Y^VP1|0qHjN)cLyae*-hmF9|53d17KkNpM)XMCcemhu6*t?H z0rF_iVBlzv3-qLc-!24x9`JF%vw=?l{nLSaKpxj=6(EmsvIh8E&{GE-<^8}>{tnwu&DHsH9vdJ{P6`3N}b`5ZXP{|h+k{~kEX$Mqp6QsQ|E_2&V< zh0f{mSfDuftMh@619^-;R|3cQGa2}kpr;Ht+S3FaDfo9$c)@@VHvz|qc) zz|qckfn%KfNb$B*rwvfA{UDEV@_XPICx6?QGE?Gqd73`j|K|Y5az_Hk_39$v7{~qy z9M@fc2af*y1o$ej=U>2Q0Z-*%L5b~0J-vXVA2NYIPkD5G2LW#co@>EJ0LOY=0{jKg z(+C{blZzDRcEt7My}(OA&!eCR*OSixM?b6rj`4OY@G{W9130cHKLn2c`4Tv`%MZYD zo;~R-DvT1h7uu5s9M_XWfuo*Ffuo)h3;rr_^v|Ca=kbf{ocBQ<$M46$ar_2=BZs4eY32>BO4jkoQ0FLsX z0muIKh2rM<;sD5Fe>)5u`&*nd)Lz)%+5<;B(}Az2th!%i14lcDD{i*)B9KQrF9nWv z76C^)y})sPxlwWRyw(KrWnllkz;RxC8Tiv6{{e6;_bcEyul36a`FRECxf(de{~Lg# zKW_$(^V&k-7(Z74M?G7CqaWS@j`P}wz_CBIK2h(*uL*u@Q;Bnp!_;c27qIn{}wpv{{cA4pU_{J z6>%NZ6*$VD4jk=C1CH_ofulV+z)^lAaFibh9OWB;V}F~cIQNI4;I}(Kei85ofZq=M z5#ZS0mIFsScK}}xdUgXxJNGKicIJWnHz1F89s+(l$j1zz14_JJLOVMFzk|-{{&TA0 z=6Nk0=qDR8V;mEv5lVNmW3AdmHG0FL!)1djDu0vzMdyTG4@az6!*b~Y={ zb`A&me}g>Q`6F<&(|$H(reyYiPvCdZdF}r!;5fhE0(?2h-wym4;12`G^}sgZD?$D} z;3%KUL6Z{O{~Ud^ou>guznuYm7071+$9ZZjaMW`ZaO`h2z@G>GwZL)Q&9&gS0mpjX z5Bvqt|2FU!fxoY~dHt{(IIbVQ06nWg&$qzQ4~Kwbe{MIBGE?GqLH~3Hj_U^paP$wo z;9DftgYA+79OwOufTKN=f#dq&df=#M0dUl_#DcH1;9mhpzx`Wr9>2J*XaRW~zwzgU z{D9*(1vti;u8OmMZX!J{93a0GcpnRSr-l4b;MiUT7JLkFoPVzXj`QOb;HbYGILcoS z9OdhQqx=HkD1SF_lz#*`$}b0w@@s&j{AS=N|0Zzs&tHI}{FjPz`=&uVehd6O;NJt! z25uij2b6exO{b6UC+!qx{kRV74Dwj7Q-GtLnTm7#c@^|e2YHNdHvxYQz%g#@0FLARBgNUynV{!$kiQoA*TAm>o;;WiD4FBc$-uGP^Ay+Zc!kVv3a`$;~?j|6#~FD?cC7m%L{9Q|Jb{0)$w4IJhDz_DHK1&;PF1CH(TgyP&T zPe8fPf;_g%Cg9jEJAq@n>;aDL@)dAwmjl563ikY{IQ#z(z}xZ7Zc5xw(Epu*@1%3O z|MUX>KJawl9{|q+j&=?Qj_q=E7j`I1yu^lf3j_p_k9NTfK;@pm#=%f2>1;}GN)&j?NyaPD4;}YQ5 zj!ywc|EvOz?YKs9ZpQ+!^Hq??c6c)H@;j$7!X{gVdr*p5ShV>^xkj_v3Mj_r6AaP&_laBRn!igP=T1UqMg zJhtNk;Mk5!fMYv81svOP6>zk3GjMFjKLW>g{1`aOe-0em@c?ja$HTy}9qs3nQz&se zzC<70j>(F1|G{=V1vs{2CU9)WA;7U6^MRv(E&`72c!}a|$es(qP7laqJ5~V4cB}=C z?dS)N?YIy)+PM@sw#yU1u^ra}NBK>_u^rzAj_vpXaBRnq73X%`3jPUzJhtN@;Mk5S zeA9;#w>!4uZ-HYw_5zOn=?fg&v7h2?NPi)HbbreMd2Gi5;Mk5=0LONm0vy}195~u} zBXDe&*}$J+bwBXGf&9b3(atTv@qWvDz)}A1!0~>?KY*kBAq$?!UxrbN zr4P!VWWj%L!3SFK3oQ5*7W^6uev<{i+k!uC!Pi*uH!S$a7W^9v-gcO9XM{id0)LZ4 z^tecf3CULgf6Rhk${mmrw-?I4Z^19M3GoQ|gBJY9#OU(NlcMuMP_K_jMAwV$ceUy5^`O-woccgtzEI*1qns;MJiS^DTgH7AMw&`uhti`DohL^5-jV z*8f}JH6TA+agHZ5f%Dpf6YIH_K3czrAtmjHALOA?s-PgkKimd8-f- z=U~;Z&H|413;>SyWGimA=M>;K(!MTN>u32{z>Af#wY);JjO?8cnYQnX$a?H$RxAQ|ZI$Dc~%h9xt%*JaCrRV|XX< zo>El&ja7bS9ld~Se=|QF_!S_}=bBWx9^hQAjwwyRS-wyOyr)cjvEn;TJUdAi9;@1i zb@0bXmOL3amusm0nhl)g9UY{6K5&-5Ny&SGv-||rsc!(z@+qQl!_fVO5Bal06i)XB zP4erM{1?C(P3TE~DE%8atC*_Vskdr>t>2+Kq7yjFpQQXX2{`B3kWPOnO#{yIE0p|V z;KCktLGU`A5*cMww_pEF7eZQZXXYSma zLdBl5=j?a5^L_XE-tT?i?|t9z=icvzJH7tK{JcCvr#xe+k-5{TVYp{x%F9G?nNeZP z7qpYGVCR#Klw|4@h@9S{NO?J z#=4v8HrCx-7ua~9bjC8nOzpTpvL6~P9lCLBZ0xw7e#n^89#lVD*C!r1aj#&QJODhC zZ;1NR8M{aoVZXX{Y!~IV3V&+0FV!&X{Z+%^S?_DjOLu=+D*gfoit3-#-j{qy&}T>= zAd)O2?l)5|Gr4h}IZRi|Ad8Kf!}V;rmjx?Z%N-#v){Xs?IzU$OzDzwZQ`2=+3?8g7 zldmb;P%Ne6f%-o~_rG-aN-_=k<9Mqy5ye}!{W{owYnX_o*qKShPbPHU;m}!TrY_43 zoyV-b-bb?k_Q5`zt8URD5TUb6fbbhVl#@0&9&`P=SvyS`UB#o1f zpS1lFe|_Sw91Sxf$FH!D7*)bFbIeo`xyc-Qy>#~_6e{FH;SCDbdwxp>;y_S?Eq;^d zl&&VLxOwnwBKK5qtlsbfDK#dV`cgN|n(j*;GE<+*M6qXd)zEL_B^h(LXjYjc;z5s- zmJ3e3n3q^@CXblkJ$9**ka&b*a8!%cff8S1rfTI)@+DnKIZ4f^Amt}^ofwpMTruVu z-L-SVQ0dT8Qq@c?FFsyP1vRcbr%pU)4o{*k8|HAe%&z6^`OE1?aFwi+2em+d@;3q+ zvCeOD);e4EHUHnfmi5EIz73Z6oyPYNzg-x=Ez@O$y&B(arf#8N9*f66S`6#)DC2m0 zI*!wl5?|yYGns}=Es0CqC)QKj@ZNCR;axfuq!>QVKXQDVsZ5-ouj71DR-8Zm=f*jY zqjBbsk6?eAfc}#9pYwm${-)fcwVQ{V#6IhAQ;C?Yl1B-dE{cbn+#;9TxQz!K=BE$7 zGl$4{eJl~v7_GasqKcwe{8GIozQIE!=HRVmM(NOZh*r}n*m0 znf$gvx7yj7g)o!YK0{#XrPEA_wN=NPnS4>~meSS3*Pi$8*cfdyb*v;`(tIh;G?SYZ z)mE8(Sg_8_khGV;nA+#hKUh%Btl1o>wyck`hg;{-jv{$EDa0-}y+2B}P6L zbJc!Ct!M-PF*xzDKc2p={3(9cHhifivv_4wkH$lNr3lw_T&Ki{^1MQG zD@CsiPyL8{mk3vQ%2eyV8nM1)!K@RHiJ`2YiRBOK7VdJU>N1)*F>USp}^K?S0Wr5xF!;e@D+$|+8pYP2e!w8{pG#XF?m0KsV@=_ z#UjCQV_zuTRUb`6;&bM@m%1yA{!nb7Zy+9Gpxigm916x7Lcw_NoVmv3vN56Ft^M(x zj993h@b#hK79x*@x(5P63hOg}sl31TS`sUP-e9CF912+EItW=AifszTq676&>dTHe zaUbZ9Mg~GgVt~80HDtttv7S&|6uUyZ*^0x~Ow~!SFzRu(LNrJ1E<^nAdK4 z_aU6^K;i}xDvHGWvCR7$@y4cf_uW(_80{WS1XA@SwA?HjJeD^!nyfF0XTQ%8Z*OuJ zX8F!Xyppk3H>^e2S8o}=db6$;`$>!bars_pu)ZWuy?U~jabubZ6?9Ve_#sSnUxLx=CA(+D`$)Xt zZePutB~hLI{!8uU&ieZ{Z41t`RtNEw#o-fl_v>F@ByQp@# zVSFiX`mTIqe;(~J-pMPZ;urEsKGmLA9WabX@?3Z48_(pKhVhWXFRG$e_vcL`(tpgG zX>B!a=0o&A_wBq(NArz0^N7mRPMqD^Ns6% zM@>oBsZ$A=-*6(&*iME2VlISs%%glk;d8~tq9uDujJxv6#)_%Gy#$QqZT>^C@mBsk zDnH=be6-jYDws>5t=M>|kjn=PH~&+y@l4S*RQ`R@g|8GFsbXUIcg4){AQ#ig zOo^8fG$Y8(v)(w-cE5;;wMiwt#EoS2NH1RE7%)fKC)h=G_k9G#b zOSmMfm(I;J6{UfAFy7bcZo4{{NqdARO$Rpa8@Knxd);mBYu%Q4a$}YR#os|qnzrkM z;qazl=N2KSCA~NZo!14!iO|w{Zf@b>gyM~=d^F4l{w*FP+nVJIp4D=A#Oc$CBO=tr?kksWv!97 zqb%>@iNz%&G*m7joG(ryFzY6leKx;-Qc)cd5XQ^f60W4g=Mjde-#CeBx$b(#C|T>~ z5Ed6ThQZIEvK{jsbj8mh-c1uWa^{^t1DC4z(#5HPf6_V(x&lm8H^E?j2f2>YBm4t2 z`74>ooY2VGa!GrVX()B^572foP1A&kVk`La3sg>jik9tUDq3;O1ANIax1 z)c3GJ|AbF-#(mZ{&%33?FFaEG5VyEk`=x?zW-&tPLgHD#1?+dy34# z;{0b6(|JUq{o%H@X}ZTXT(GBbuqgj|CSOT9F#YG4FQr@=_qdw4fk`c%lLDB2zo4e~ z4_5vS!>&CA=3rs|pzfmJf9wqDrz`v2>d60Y=I$&oTi)`nU_5A)ZyFdd1W+E>&|F1Rou?u*Q~R1Lx7B)T8WWMucwaQq7TVe$rj4+- zxiwI^usIs3kM{2jZVHDoE!twizW9KzwKCxKdK)Ue+l=y9lqIn)p7Pr4TMyl8g~}6= zaNm|tcqd|Moia0Sb$f&+e!)21)P}5z=J!8I99=%L9R)9XkU2=oF>LyuSF(z_tpbyfeCWD?R-f<&kJS zRNmCwKA&{$+@jitdIQ}tesC)9iA72Ovykq{H;gGZe3mJU$0w(9x+>`s;|Fr5_9oGA z!uGUVJ?-`_qIGurrZZ@-=VO%La0cx=Y~=IYb-MlUwQ0Zh4BBhwqW=CfXurcoe$N@S z-(}Oj)uz3hFrHq;9)@zAMpU7^Od~S4+#3ANg|;bD);7w!ezk$(_&bL#ZI9`SnCEAf zucm8-(hDN1AXTH5f;1hkJqvC>89}%)!6y(i4C&JsA|dn zW0kc2+JA=#V_k|Yj9Zj^v4^F4ovij7r3yRwz5KR=(k|6emVYi?R{3ucW+%Uli77S6 zEd6Vh{~M~YlYi_c*+h>+md{V5R{2v%xSjkCC132hB`fi3l|PXh+sW@xkC7);Tb9q? zJ6Yui9OUZv78VbJL~yY5b?up8gqD`*kS!U*$?j zZYXo{SE{|s!oaNrR9NWUmiu2&dpr9bv$5Y5)Yhv1M3T!YTIF|~ru<@RZztdEkcz5I z?4PbA$SQwO7#@ zBMq0otp!*rbUO{lReQ>^(x__xnkBHc{+c*S4ejhd+94^XtM=UgPtv8^YxQ_dvWO53 zA5bp}hAfI%_2+vFiD>U;VU&(ckoh%~Ev3sU{}Y7S$v;^m+clQTT>o0-YuuVMU4ilT zm=))Hm)J?=*0_v`xuBpI@9=Z#Tw>&O0Dy`Ykl~nKObT?5^S4W^;Mw#m6#X*g zm|0Nm5-TnMROI(1%zv+f{ZQ>Pc!kVOF0pcD)O04*1n2)xYryalgQ_>&gAN#W01@Kp*w zV8L4z{(TF6gTnvSf(I0CfsHPO^WFzjpTgBPHC+`^xHpZ+!hpi(TkstU-)_NgS9rGt z|BS#PSXKSM3B1rkEpJ_h{RxDNBGfLqC=%_G%XX&aII&wn7lM@^o6rZ;o=r5p-+wouNfZs~^Oqf5r6#vf?emTr16$*dSf&N9pr^5QE z`MmCczoYPe#dn6vCs8Qa>3<&KGhsg0&o}c3zdV1oYMt39m=1hC?SSugz`x;uzv_UW zLm_LY|Ah{CIpJ)#lVTjpa|-UvgAVjBIN-l`z>8?8*y(eb13u3I?{L6(5YGCyP&{(t za~4j2RQNvfGbdiZIc=nuQA}S!`f}3vVTJFbcATnYX1q!G<*(Cu%WRgTMT|>RW&dtb zUrhx%o0l=ssyM)^Xj)~8CDqlpHOcbnIuqbhA<)>~T;Jwf z-5dzmajTKvD)@2^F6cz2Ex<=M)#6JCUvq19phile(;BJ3B3lLiOqPy1=XOyaQk_8) zd0=%04bJfJ%8|1;I;!g1+V8LQw1(pJZJ$06<4;ZK6iA$lrH$+f)U?K9eUTnAaxPc6@8*Y?`J%F}#DuJ!JaA8xBp8ie+Q zdpxH2cDl7Q+8^>%(pS#(jfaH14zW*ba$lq?ur@S6Q#Fk-o9_keOzNp=OMg}^XY=e? zw*uA{n!efPl@%>9QY#kUsh100QfSes$V9&~l(ML&Hp`CU1NF4!6it<|1ZS0}!Rf2?vuxNL(Vhk5cJa0R$1kZ}eUATeORCqCNltHVt*;%PLoLE29l6$x zj*MLLar&Dg;vU()H9LMQt7#Xe;?ftfM5UZ^?B&`=N@WG@*6HJ`L}xr23&iy&TuNr{ z$6X%YXKBr4^ohwsLmm$e1s`z?@{D6I(^KK250~igBxrULBfLgVCt}#@71XO&EYAWt zP3zCggb~w|lciGZQL~I92Y7m5TIg-mB?qLZLOHIrFg=6RkO#74c>8Ge&2%DX>d7^u zWZdY`jQ6Gi*y(y(s{*`nCIbZ)wf6Nyg7HKwL_2I}H`Qn#XtQNzotzK$JeAa;`Y`Q; zn&}fQ{(KMmlG)BX3tLE&a6B5{*&oW4mSb>|rMLf%qFTr@vb*WAKw7DX4Dt1#Fp=d! z!b{tr)`euLnt-o$0excFS{Lxr-iMlcs-#T*i=J3C%z{0vwOBgp;`GF_DIvaGlu|tl zwTd>@R$)-v7>#v?s5h2gq%{^!vlT;2V%I=4&@0wey6M~z4A7#wqc2WR)cOR9U!VBt z`hflg(fTR8)z^@1TAqV_nz>&}6fZqUoehoP4 z$$uuoiTj0mPFC+otoHE$j`mpwINE0u;HalQ$7TN5-^YO-@q>UPpYH>X{Vh=MJ+1o7 zbERDW%5x%#qyC)^e6|3NcKaOQsORH=W4{hL;6Dc(`5Xlt`+F{TloDrrhNR=R5^(+m zN#o6c-wb#s;3zi+INIlL0q0LVH2<#w-U0YG0Y^K$1b7hWe+2j@z)RJ8VRk>Ct}daA z)A@j3LHAmpO97t+_-uuD1~~fVe!$T$Uj-cf@*LpkmlAcZ!~H_POai=v>a<@j0v!EvCE)0n3c%40+ZAs0 z%N>BDUxoljzuXJ_(Jx;BdhWWO#~uZG)aR>!qhJ0(;hgn=9g5DO8%k`q&2(w|OaZ(X z@Cv}uzh1z%0DUXqD**2R9Q_zkIP2K}^xJ^m3;3OYHv;}J;41)s3UHMB&kEOm)OPqO z;ONJn1CD^P1swT*0Qi+aUqt7IoY-H;e+uAhs7~|05O9o#D!_5P zELJ$%e=G2526`MX>i~}c{mp5d$!gDHg)@H~cT<5L^|=UewDT&!(a!A-_y)i~O|rEgHv=96JO(&_`=IG}DxCe; z2l!n;&(C$5{yxAHfIkNKHo%_-9OudXfTMjz0pAXMegHW3>n93l`(Fk0zW{n%FOCDg z1L)rdd?(=V1OM587t%R3Cyoc?e=*?bM>pW;uL{7iU$uavzphg_`>TsC?UyE?M}Msc z9Q`!}_$|Ok{|}zs;n0HC#kIY%uqPzgr0KQt`%m??kJO^^pdVU~pjj+lYM?3J?;l%iS zy0o6RGf2s*=WYq-@YjB^^1mPG*;bnW-zeP5|I0ux_Py%jCv zV}}#txc@(2pb|H!toiU7$4T3BiHa+h#mU;=8VL&=^;xEHt3KREPK^8L(sDI_#&O>0 zq!wV zOqCgDf9Z6SDrlTzofAJJaAJItD9N9%s50X^#u$1T@F}Xy**k!r3%HvVr^I~t(#dbZ z`&C64@bfe=FT-4u*>vJW>n4ZTBr>89R`up)`0cZNp3Tpaa*8u0D z{;vEe;7tFhqMxV+Dp&KRzc-&}!B6tQq*M(!^Vu&@I=ca!`RMP&Lx3~=_Y}Q8Z_;x0 Sci;C}=-*WI-vS)R`~Lz3D*!|Q diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberosgss.o b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/build/Release/obj.target/kerberos/lib/kerberosgss.o deleted file mode 100644 index 2f1b25f42ff835318e876d934b929af55526cbdd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 16448 zcmb_i4Rn;%nf^i&hyqU5b!#lPOl$BYZjBj0z@ODjl7VmP1UQ5gwiYMDWFk2vlQ=&t zh^b*SQ~5efn>~wN+MeS^_jsDRxaG8KPhkBSH4-@L9#-8hTRe)kMMkLqB5G~+dGF86 zJ74nkbh~@;oBQ48zW4pR?|tw6ZoJzUSUIb#%+RIGxXCECG-?=Q3ySYe;dBw?25h8W`~x)DU7?9s8}eu}R;fL@frJ>6~f#MqQ~k2z#6aK4DZ8`~223 zu2c(PGvgZ#WGiW$-}>)>_4Yv`J46E>r?)_M@KH0nX*^(UsR~%NwMw@@_?ucwpp*WS?9%YZS9W@V`?fHgrFm>nYNr37XHwjd~ymUV11J_M zvVD)HbFTE~q3xOPnc2T0ZwaOH5Bz>=ssz{%V1(wM=BnM?b@n`HQ<#fKR$#Pg-PEP8tG~x%LoFrh#B$4t6RK^@o3ed zRhaVA2oD`xerqBz05wR0-#X5f2v~0gtTzOqh}2@ZBPbIK0#;|$Bn_J~cTJFY#FTA% z+O-htK)4oi&%=#UR7Sj?IqF*2r29q3nZGU0ulBd!`dxcr%@t)M*tOcG^>o6c&5(+k zR!h}nIq4&bh9{~_>$p;?+qJM2PGeJk=E-h3zgUToX1xf3jiwc=HYb~_V2xo;Qh1_j zu2HpH*1nUf7ILI8%XiYuh}CCiZ>ch~$&+Sw@a2FNIc;XD1&LffR~N031K~;kq)1AL z`bKEW<2}>%vQ8;dbL*+o74X@;y_^(^D7d@5y>5E_00XH{#E&`&K$nkNL&Oh z&w5@ktyd)d@XjhDG2hI_VZz{9#balUnVw3_m#xVb>5a@zcL^$dGlOxL6pX98m11K^ z_)f=%@3_|U_)K&n9ya)`DVZ{%`ukXk`@q7?-0e0eeWQZgq;E{s2UI;S>Vnq($yIKN zoJd?Sbc5kaKSU`r>l^iF*1*(FdyxbW_%ds%eV!bx#MW9`W0?Ea+B$j(SY5S{*IFx# z4_Kd=R%Zp{qe`N&JL@EGdwtMB<2Q? zCe@Z=W(LQ|ua$yPTl$IAUg!2f#F)^SbsvV}dyS9;ketbKc?4 z%98g7vdMk^%yOUSD4BJX)TJFqm?iaAS_iE6paA?yLZl5MTwUomi9GAeLDD{O5JWj5 zGOec&X1j%&g4TM=A`=`exroffj4Rw81 zL;gNNh5RtXoSimHbowet%}htm%-&gs-C7!lQ&XumfJPD=qAAUwzo9#xoQ&MFBN%Uv#t~v8yHUt(rE5N8xcNVx&)U7>b5 zm)roWaz4+mz48D<0cc^A3;~4oIh~3B)7)6GF$6irA zLK-6y0$G7081V0ffVH$%`xN2OX=VgnX+->pd@%f&Fp_dzAt+#vD}~$vOWKZfnM>vg zcOf2J=_d)@H9>A=!7-A_k~TAi#seSl&=@J~Gmnt%T16N|Mw(&a3uR*dL9zOWAdy^3 zYAUB7U9ph44)O4Z;$``?coA%-uUDM@{nlqXdY;9xqsg4a^g{fkw@TG2PkY6F1Kh3f zI#oBSdIi-@yYB!CuPHI#F;yR@S}1`88L&%kS3ouQ2HhBaKenL`MzGJ37z$A}h zjl*d;z8o((z9eqSv`yIEfBMSzneWA?AF2GZRNn>^OpCGQ);s zRn&S9k~0p%orQ@L8;mPmi4GP&;N&*5?bx&B{-&o{QC|vb6$dlUn=7>d6kcqBByYO9 zbYA3Mxdq=%eaFdTINrfo)i!yrA&!Q2HkCoGszCOZn&Rm|?XriINxsXl8GDCM&Jv!N z+NL&R^i0k@`Yv;>+NrQlO`nBP5W+cy{HV2~2}$>Zd;U56$o+Jt@tq}tt_3aMf$}c_ z5a;Fp_4#plXSF<2Ru|8d!#isvR>Lv3#4xGFvu9n&DYFhUg;lz_TiA+vKu2`ZKb zXwBlrGd&Ix{}1O=`~JHfJHZOE-lfH3P=Tv<})O`Pyst)gT8?IC*zB+Ik#fh{p zhfu2a91U1+>hCZSEQyW9a|%vj>YPC7x-j{k6WD`u*f-upY|pUyE-4ogzrDCX=|g)Y zfbHC${ifU%=oEttSSJpLlQK(WTI!k)S2SX^U;6WIqHXy_O@NeZRY6>d3#6&OCg(jV|$e@&v# zJLz+8MDZT>)#Ap(hpvHZw#GJJ8xEsYWsV1<{aul*kr-Ol=J@7FtUn&yxDl-yY=ZK5 z4cWW@4klR2x@^aoI8l70G)rCz9{_qCw+vd@RGtPLCSO+iq;wtn@4e+VD+B~?r-yKROwgk;XcO)b6gu6RtT2(Qa#P9T2x4Ur|+*fhjY3PUKe!^_s{IxE(uGAFi1q z(j4SsI^d0&*|q~_ro9F!mcG^~%ho`EQQS^IZ8uF7`#{PM z!jJMiFo?)`PmGjKiDckGbuTMNz$x)Jxl;zU+!B`mNk*xainWZqG=_*Uv8J`_v8?b} zlCLLa*ixM_N)pxjq=B%=&$a1)=5^n?b!*mL?_LzY&}fVF^~ZL&L%qHI;ZUNdKkDud z_4G!%j79OfMe%wAR1H_fjoah#U{Bvbe=HG*9mSE!=-q6co3a6A&*7KsI+@c@l;>hFPDXY3c*ED;nQn`yl2SI(WzU-di6SN&4{ zs+N}P-E|$ClhH)dy|iIP!{Vzw*Cj>MQ!fEh66F$E8D)2_Gs?DCmo1n#r)mUAiW24J zs?Vg_dr|ebX0^9!yl$Cm7{srw?Sy_f!m5me&f>R*(wXy@Jv(qEu_%twd`MSI+Vi+f_tMdgSm>IYmF3ws}u^ z>u|-aj8tGNRXz-;1<5-^hk_Mfq=!wjb`q62w-dj_w}$jYxfpwHk?(iQzbXxcee;FV zE#OP^rlOB>`wISO9iB7m$r8P{EBYlk&=mNul>YPWnT-METZMq;xke*M#uWV%oWAut z<=G0~p32tY*|Xl1R?d2e>XmcJ)|b_o3%E{X>xoiZan~fuEwfQ+AC~C;I1PX%C=Kx) zeTmR!)QOm^x9GQ6q&L(ca!CU%KciuDJZ?0^`l&(Wo(4~8bA@gi4dMR2KCCyRA=;ma zG^|?PadkWq3U37gF^y~qcE>1l{hx~)9LODHDlbi{vGsEtHH_-grm+C+3L8evwO32< z*q_OIJ}Qz^C7WVB(d(6X2&b^(<)3YGbsy34La|0X|J3mwj3u6n@$jPMzt2IuYx%lv zQkZ@G=%sStI$0Hdwf%bh8Z};pT!BtI==mZd-t7M0pvKdh;N^L7vNH_&HsD3e)paL2 z^*g6~PmSjoz1wM%3bX5fUX5?Gb!huF-vPYL6hH2pC52lFr1-fIj~=hpqwuoNJ&mlR zz(l!QR)t@?{?xXqC}_7VR6{P1^+l*CR_*esdnWl?>g2fBY{uE;ORDL=L|0+FEAB(> zz2(zpK~j{@s0rz3Q$jH;H!AI{@wa>ON13r!^@#lp@0TfDJ4@_az$m_men2@v>`}m$ z;wdxc7za>O`GTyBX4Hg_sJ6yQ9^nHD*Y3Yf;nYt>)6;wTw5(+qy}*f2BN3oz`aAJX zc(p)__-=(OxX@4Sa?sCI$_*71w$5@9p{3yWM02{If2i=>&1u^T}<`z5o#Sf zx{vDlAe{;Sq65Cj0l&%tU+#e4oSu*oep^10l(7$|F#2uzXMKxEuKlAr+|~6 zPpZ5j=g%-+b)Y}xfPdnEUx=hm{Ew;B_hU6_b--uR=Vk|dtpnbn_z$V2EzZS|5p$rw z#{vJL1HRt@KjeTPalnrOCqIluLx3kOMyKfbVs{f8v1WfRjGew85c>ZvfPI4tUxD{|5*BUmWm99Pq~-@E09$1NY40h8b544PkMu z5sAh6V@5yj8)8BEF7H1Q+f_3d>`q3*!C=GkYnLxESnImQthKChId3gq%3DjW?! z%d+LmjD|onVILCX({{2%n6RP&^Xcob2w7#Ed>Yc3a6{;pE#R3F+iu zUnCw6-5wzkiC9;1z!3f2u}H*5Fzx1t-@IUKZzL+FHA9l#`DvuQW!LN~DbggP{54HqXuMc*#`_=_ld)s_}#6_WW2)mvv za52}kuW$CY`&xrw_cedZbZ(C76lYCO58Wd=l8b9R5n*IU;l5QM1ECm#SIn-uAzilA z2>15KBQhq#;b1Hh@9*7KY!j27P;bwjMW_pZaf$WsU|~!PC)_g->SY+e{GH*3HW}^h ziEcH(NiIxsozRhA&Po6m$wEciY*6U?l?u|JxYNTewkYZ|Rp9mL)A%AHMj?9oJCeqi z5Qu_pTHIA?yjh@;>wT2)28J)h zxr_?&p{pD%_eO==`K)F5HH>}>!#V#SI`AK7^jy#97|!{hWPIq#M(g<-Mo-`U8h_V; z{+t8-e~<%E?DoFQ@J94&{*^d)P$7D{o6`6t4CnK8gTjd&*MAkG=lb93K;P*=zl-7Y zjj8qddxmp;{)yoftD1hC;dD2k@fQ_t*Z(-9=lU-q$DmNP43Fm1sBro+U(Rro(XU|m zZ4Br7e@o${58W|o{#l08ozs3iRDQ;A?*B&_f3E*ohF_2In!mn^q3#kQ|1eP7|EKi#ov`ca0HKLdEEJj?iSf1YPJ_vf5>avbTyC-pugXm!N?{{JB007|!)+S2)Ghm+)x*4>EdwZu~i; zU%==eV>nHnj>FRo|1zWhl;QkbBtD)&NBZ-8@&)>+Mj^ZjkJfV;!?{2G4CnEDJHx-h z`0QYK9m9thzKP-YD4hIu1;a-f&h2`T@!@tIV)$*0&$EnAEyG`6IQd!o;eCd4x#t;w zF1PY?7>q*xT!KgQSbeM z?Nj|4*MCQ!u;KdeWFOdY{r9cQ%VdYBTjs|F>@Qnr#nDcNoXy%3Tb zlg1k!!UymXNc27Q#zYe@^jZ@<-|S4g40DBFvUAS)&d1Hl~Rma=<}J` z@>nDED(f=MUvsO0SMwQv5!9Po(X#$)+@|cah6-89VUK_z`UdIig+Wl#CLQN3eul_o z^B4%FNOZ<@M~jpZ5~^0*^=lxqmL-Y#afH=+E=c|=Nz89aTZs=!(WHJiZjc`}PnthT zxnlm<{lb(77znl)yMu0L$Ytt(UN$-|Q_(;6Snq$1ILxo&NEP@hi^^H>i-TYdvg9aFk;Z# zf~~I|;RoUwWbC6%7$(j%|0&{4^KZ%XyNhBm=<~;1M^wc1vfqbCNNHHc6=NNyodhqN z(TZ8eZfz7`F?4ktme>Ikul~wWpJg~%XDH-cZ2jupzDT_OHlP~L_2t+)ZIA@K*`_)V zC2x}i#G6iXkv>y>k9gF{k_6Oxwn#VeY+F3kyi#HA;;ekOA50WpGIyppH' to 'Local' - Local info[2] = { Nan::Null(), result}; - ^~~~~~ -/Users/christkv/.node-gyp/0.10.35/deps/v8/include/v8.h:269:26: note: candidate constructor (the implicit copy constructor) not viable: cannot bind base class object of type 'Handle' to derived class reference 'const v8::Local &' for 1st argument -template class Local : public Handle { - ^ -/Users/christkv/.node-gyp/0.10.35/deps/v8/include/v8.h:272:29: note: candidate template ignored: could not match 'Local' against 'Handle' - template inline Local(Local that) - ^ -/Users/christkv/.node-gyp/0.10.35/deps/v8/include/v8.h:281:29: note: candidate template ignored: could not match 'S *' against 'Handle' - template inline Local(S* that) : Handle(that) { } - ^ -1 error generated. -make: *** [Release/obj.target/kerberos/lib/kerberos.o] Error 1 -gyp ERR! build error -gyp ERR! stack Error: `make` failed with exit code: 2 -gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23) -gyp ERR! stack at ChildProcess.emit (events.js:98:17) -gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12) -gyp ERR! System Darwin 14.3.0 -gyp ERR! command "node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" -gyp ERR! cwd /Users/christkv/coding/projects/kerberos -gyp ERR! node -v v0.10.35 -gyp ERR! node-gyp -v v1.0.1 -gyp ERR! not ok diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js deleted file mode 100644 index b8c85327..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/index.js +++ /dev/null @@ -1,6 +0,0 @@ -// Get the Kerberos library -module.exports = require('./lib/kerberos'); -// Set up the auth processes -module.exports['processes'] = { - MongoAuthProcess: require('./lib/auth_processes/mongodb').MongoAuthProcess -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js deleted file mode 100644 index f1e9231a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/auth_processes/mongodb.js +++ /dev/null @@ -1,281 +0,0 @@ -var format = require('util').format; - -var MongoAuthProcess = function(host, port, service_name) { - // Check what system we are on - if(process.platform == 'win32') { - this._processor = new Win32MongoProcessor(host, port, service_name); - } else { - this._processor = new UnixMongoProcessor(host, port, service_name); - } -} - -MongoAuthProcess.prototype.init = function(username, password, callback) { - this._processor.init(username, password, callback); -} - -MongoAuthProcess.prototype.transition = function(payload, callback) { - this._processor.transition(payload, callback); -} - -/******************************************************************* - * - * Win32 SSIP Processor for MongoDB - * - *******************************************************************/ -var Win32MongoProcessor = function(host, port, service_name) { - this.host = host; - this.port = port - // SSIP classes - this.ssip = require("../kerberos").SSIP; - // Set up first transition - this._transition = Win32MongoProcessor.first_transition(this); - // Set up service name - service_name = service_name || "mongodb"; - // Set up target - this.target = format("%s/%s", service_name, host); - // Number of retries - this.retries = 10; -} - -Win32MongoProcessor.prototype.init = function(username, password, callback) { - var self = this; - // Save the values used later - this.username = username; - this.password = password; - // Aquire credentials - this.ssip.SecurityCredentials.aquire_kerberos(username, password, function(err, security_credentials) { - if(err) return callback(err); - // Save credentials - self.security_credentials = security_credentials; - // Callback with success - callback(null); - }); -} - -Win32MongoProcessor.prototype.transition = function(payload, callback) { - if(this._transition == null) return callback(new Error("Transition finished")); - this._transition(payload, callback); -} - -Win32MongoProcessor.first_transition = function(self) { - return function(payload, callback) { - self.ssip.SecurityContext.initialize( - self.security_credentials, - self.target, - payload, function(err, security_context) { - if(err) return callback(err); - - // If no context try again until we have no more retries - if(!security_context.hasContext) { - if(self.retries == 0) return callback(new Error("Failed to initialize security context")); - // Update the number of retries - self.retries = self.retries - 1; - // Set next transition - return self.transition(payload, callback); - } - - // Set next transition - self._transition = Win32MongoProcessor.second_transition(self); - self.security_context = security_context; - // Return the payload - callback(null, security_context.payload); - }); - } -} - -Win32MongoProcessor.second_transition = function(self) { - return function(payload, callback) { - // Perform a step - self.security_context.initialize(self.target, payload, function(err, security_context) { - if(err) return callback(err); - - // If no context try again until we have no more retries - if(!security_context.hasContext) { - if(self.retries == 0) return callback(new Error("Failed to initialize security context")); - // Update the number of retries - self.retries = self.retries - 1; - // Set next transition - self._transition = Win32MongoProcessor.first_transition(self); - // Retry - return self.transition(payload, callback); - } - - // Set next transition - self._transition = Win32MongoProcessor.third_transition(self); - // Return the payload - callback(null, security_context.payload); - }); - } -} - -Win32MongoProcessor.third_transition = function(self) { - return function(payload, callback) { - var messageLength = 0; - // Get the raw bytes - var encryptedBytes = new Buffer(payload, 'base64'); - var encryptedMessage = new Buffer(messageLength); - // Copy first byte - encryptedBytes.copy(encryptedMessage, 0, 0, messageLength); - // Set up trailer - var securityTrailerLength = encryptedBytes.length - messageLength; - var securityTrailer = new Buffer(securityTrailerLength); - // Copy the bytes - encryptedBytes.copy(securityTrailer, 0, messageLength, securityTrailerLength); - - // Types used - var SecurityBuffer = self.ssip.SecurityBuffer; - var SecurityBufferDescriptor = self.ssip.SecurityBufferDescriptor; - - // Set up security buffers - var buffers = [ - new SecurityBuffer(SecurityBuffer.DATA, encryptedBytes) - , new SecurityBuffer(SecurityBuffer.STREAM, securityTrailer) - ]; - - // Set up the descriptor - var descriptor = new SecurityBufferDescriptor(buffers); - - // Decrypt the data - self.security_context.decryptMessage(descriptor, function(err, security_context) { - if(err) return callback(err); - - var length = 4; - if(self.username != null) { - length += self.username.length; - } - - var bytesReceivedFromServer = new Buffer(length); - bytesReceivedFromServer[0] = 0x01; // NO_PROTECTION - bytesReceivedFromServer[1] = 0x00; // NO_PROTECTION - bytesReceivedFromServer[2] = 0x00; // NO_PROTECTION - bytesReceivedFromServer[3] = 0x00; // NO_PROTECTION - - if(self.username != null) { - var authorization_id_bytes = new Buffer(self.username, 'utf8'); - authorization_id_bytes.copy(bytesReceivedFromServer, 4, 0); - } - - self.security_context.queryContextAttributes(0x00, function(err, sizes) { - if(err) return callback(err); - - var buffers = [ - new SecurityBuffer(SecurityBuffer.TOKEN, new Buffer(sizes.securityTrailer)) - , new SecurityBuffer(SecurityBuffer.DATA, bytesReceivedFromServer) - , new SecurityBuffer(SecurityBuffer.PADDING, new Buffer(sizes.blockSize)) - ] - - var descriptor = new SecurityBufferDescriptor(buffers); - - self.security_context.encryptMessage(descriptor, 0x80000001, function(err, security_context) { - if(err) return callback(err); - callback(null, security_context.payload); - }); - }); - }); - } -} - -/******************************************************************* - * - * UNIX MIT Kerberos processor - * - *******************************************************************/ -var UnixMongoProcessor = function(host, port, service_name) { - this.host = host; - this.port = port - // SSIP classes - this.Kerberos = require("../kerberos").Kerberos; - this.kerberos = new this.Kerberos(); - service_name = service_name || "mongodb"; - // Set up first transition - this._transition = UnixMongoProcessor.first_transition(this); - // Set up target - this.target = format("%s@%s", service_name, host); - // Number of retries - this.retries = 10; -} - -UnixMongoProcessor.prototype.init = function(username, password, callback) { - var self = this; - this.username = username; - this.password = password; - // Call client initiate - this.kerberos.authGSSClientInit( - self.target - , this.Kerberos.GSS_C_MUTUAL_FLAG, function(err, context) { - self.context = context; - // Return the context - callback(null, context); - }); -} - -UnixMongoProcessor.prototype.transition = function(payload, callback) { - if(this._transition == null) return callback(new Error("Transition finished")); - this._transition(payload, callback); -} - -UnixMongoProcessor.first_transition = function(self) { - return function(payload, callback) { - self.kerberos.authGSSClientStep(self.context, '', function(err, result) { - if(err) return callback(err); - // Set up the next step - self._transition = UnixMongoProcessor.second_transition(self); - // Return the payload - callback(null, self.context.response); - }) - } -} - -UnixMongoProcessor.second_transition = function(self) { - return function(payload, callback) { - self.kerberos.authGSSClientStep(self.context, payload, function(err, result) { - if(err && self.retries == 0) return callback(err); - // Attempt to re-establish a context - if(err) { - // Adjust the number of retries - self.retries = self.retries - 1; - // Call same step again - return self.transition(payload, callback); - } - - // Set up the next step - self._transition = UnixMongoProcessor.third_transition(self); - // Return the payload - callback(null, self.context.response || ''); - }); - } -} - -UnixMongoProcessor.third_transition = function(self) { - return function(payload, callback) { - // GSS Client Unwrap - self.kerberos.authGSSClientUnwrap(self.context, payload, function(err, result) { - if(err) return callback(err, false); - - // Wrap the response - self.kerberos.authGSSClientWrap(self.context, self.context.response, self.username, function(err, result) { - if(err) return callback(err, false); - // Set up the next step - self._transition = UnixMongoProcessor.fourth_transition(self); - // Return the payload - callback(null, self.context.response); - }); - }); - } -} - -UnixMongoProcessor.fourth_transition = function(self) { - return function(payload, callback) { - // Clean up context - self.kerberos.authGSSClientClean(self.context, function(err, result) { - if(err) return callback(err, false); - // Set the transition to null - self._transition = null; - // Callback with valid authentication - callback(null, true); - }); - } -} - -// Set the process -exports.MongoAuthProcess = MongoAuthProcess; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c deleted file mode 100644 index aca0a61c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.c +++ /dev/null @@ -1,134 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#include "base64.h" - -#include -#include -#include -#include - -void die2(const char *message) { - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -// base64 tables -static char basis_64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static signed char index_64[128] = -{ - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, - 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, - 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, - -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, - 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 -}; -#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) - -// base64_encode : base64 encode -// -// value : data to encode -// vlen : length of data -// (result) : new char[] - c-str of result -char *base64_encode(const unsigned char *value, int vlen) -{ - char *result = (char *)malloc((vlen * 4) / 3 + 5); - if(result == NULL) die2("Memory allocation failed"); - char *out = result; - while (vlen >= 3) - { - *out++ = basis_64[value[0] >> 2]; - *out++ = basis_64[((value[0] << 4) & 0x30) | (value[1] >> 4)]; - *out++ = basis_64[((value[1] << 2) & 0x3C) | (value[2] >> 6)]; - *out++ = basis_64[value[2] & 0x3F]; - value += 3; - vlen -= 3; - } - if (vlen > 0) - { - *out++ = basis_64[value[0] >> 2]; - unsigned char oval = (value[0] << 4) & 0x30; - if (vlen > 1) oval |= value[1] >> 4; - *out++ = basis_64[oval]; - *out++ = (vlen < 2) ? '=' : basis_64[(value[1] << 2) & 0x3C]; - *out++ = '='; - } - *out = '\0'; - - return result; -} - -// base64_decode : base64 decode -// -// value : c-str to decode -// rlen : length of decoded result -// (result) : new unsigned char[] - decoded result -unsigned char *base64_decode(const char *value, int *rlen) -{ - *rlen = 0; - int c1, c2, c3, c4; - - int vlen = strlen(value); - unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1); - if(result == NULL) die2("Memory allocation failed"); - unsigned char *out = result; - - while (1) - { - if (value[0]==0) - return result; - c1 = value[0]; - if (CHAR64(c1) == -1) - goto base64_decode_error;; - c2 = value[1]; - if (CHAR64(c2) == -1) - goto base64_decode_error;; - c3 = value[2]; - if ((c3 != '=') && (CHAR64(c3) == -1)) - goto base64_decode_error;; - c4 = value[3]; - if ((c4 != '=') && (CHAR64(c4) == -1)) - goto base64_decode_error;; - - value += 4; - *out++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4); - *rlen += 1; - if (c3 != '=') - { - *out++ = ((CHAR64(c2) << 4) & 0xf0) | (CHAR64(c3) >> 2); - *rlen += 1; - if (c4 != '=') - { - *out++ = ((CHAR64(c3) << 6) & 0xc0) | CHAR64(c4); - *rlen += 1; - } - } - } - -base64_decode_error: - *result = 0; - *rlen = 0; - return result; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h deleted file mode 100644 index 9152e6a3..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/base64.h +++ /dev/null @@ -1,22 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ -#ifndef BASE64_H -#define BASE64_H - -char *base64_encode(const unsigned char *value, int vlen); -unsigned char *base64_decode(const char *value, int *rlen); - -#endif \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc deleted file mode 100644 index 5b25d74b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.cc +++ /dev/null @@ -1,893 +0,0 @@ -#include "kerberos.h" -#include -#include -#include "worker.h" -#include "kerberos_context.h" - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) -#endif - -void die(const char *message) { - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -// Call structs -typedef struct AuthGSSClientCall { - uint32_t flags; - char *uri; -} AuthGSSClientCall; - -typedef struct AuthGSSClientStepCall { - KerberosContext *context; - char *challenge; -} AuthGSSClientStepCall; - -typedef struct AuthGSSClientUnwrapCall { - KerberosContext *context; - char *challenge; -} AuthGSSClientUnwrapCall; - -typedef struct AuthGSSClientWrapCall { - KerberosContext *context; - char *challenge; - char *user_name; -} AuthGSSClientWrapCall; - -typedef struct AuthGSSClientCleanCall { - KerberosContext *context; -} AuthGSSClientCleanCall; - -typedef struct AuthGSSServerInitCall { - char *service; - bool constrained_delegation; - char *username; -} AuthGSSServerInitCall; - -typedef struct AuthGSSServerCleanCall { - KerberosContext *context; -} AuthGSSServerCleanCall; - -typedef struct AuthGSSServerStepCall { - KerberosContext *context; - char *auth_data; -} AuthGSSServerStepCall; - -Kerberos::Kerberos() : Nan::ObjectWrap() { -} - -Nan::Persistent Kerberos::constructor_template; - -void Kerberos::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("Kerberos").ToLocalChecked()); - - // Set up method for the Kerberos instance - Nan::SetPrototypeMethod(t, "authGSSClientInit", AuthGSSClientInit); - Nan::SetPrototypeMethod(t, "authGSSClientStep", AuthGSSClientStep); - Nan::SetPrototypeMethod(t, "authGSSClientUnwrap", AuthGSSClientUnwrap); - Nan::SetPrototypeMethod(t, "authGSSClientWrap", AuthGSSClientWrap); - Nan::SetPrototypeMethod(t, "authGSSClientClean", AuthGSSClientClean); - Nan::SetPrototypeMethod(t, "authGSSServerInit", AuthGSSServerInit); - Nan::SetPrototypeMethod(t, "authGSSServerClean", AuthGSSServerClean); - Nan::SetPrototypeMethod(t, "authGSSServerStep", AuthGSSServerStep); - - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("Kerberos").ToLocalChecked(), t->GetFunction()); -} - -NAN_METHOD(Kerberos::New) { - // Create a Kerberos instance - Kerberos *kerberos = new Kerberos(); - // Return the kerberos object - kerberos->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientInit -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientInit(Worker *worker) { - gss_client_state *state; - gss_client_response *response; - - // Allocate state - state = (gss_client_state *)malloc(sizeof(gss_client_state)); - if(state == NULL) die("Memory allocation failed"); - - // Unpack the parameter data struct - AuthGSSClientCall *call = (AuthGSSClientCall *)worker->parameters; - // Start the kerberos client - response = authenticate_gss_client_init(call->uri, call->flags, state); - - // Release the parameter struct memory - free(call->uri); - free(call); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - free(state); - } else { - worker->return_value = state; - } - - // Free structure - free(response); -} - -static Local _map_authGSSClientInit(Worker *worker) { - KerberosContext *context = KerberosContext::New(); - context->state = (gss_client_state *)worker->return_value; - return context->handle(); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientInit) { - // Ensure valid call - if(info.Length() != 3) return Nan::ThrowError("Requires a service string uri, integer flags and a callback function"); - if(info.Length() == 3 && (!info[0]->IsString() || !info[1]->IsInt32() || !info[2]->IsFunction())) - return Nan::ThrowError("Requires a service string uri, integer flags and a callback function"); - - Local service = info[0]->ToString(); - // Convert uri string to c-string - char *service_str = (char *)calloc(service->Utf8Length() + 1, sizeof(char)); - if(service_str == NULL) die("Memory allocation failed"); - - // Write v8 string to c-string - service->WriteUtf8(service_str); - - // Allocate a structure - AuthGSSClientCall *call = (AuthGSSClientCall *)calloc(1, sizeof(AuthGSSClientCall)); - if(call == NULL) die("Memory allocation failed"); - call->flags =info[1]->ToInt32()->Uint32Value(); - call->uri = service_str; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[2]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientInit; - worker->mapper = _map_authGSSClientInit; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientStep -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientStep(Worker *worker) { - gss_client_state *state; - gss_client_response *response; - char *challenge; - - // Unpack the parameter data struct - AuthGSSClientStepCall *call = (AuthGSSClientStepCall *)worker->parameters; - // Get the state - state = call->context->state; - challenge = call->challenge; - - // Check what kind of challenge we have - if(call->challenge == NULL) { - challenge = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_client_step(state, challenge); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->challenge != NULL) free(call->challenge); - free(call); - free(response); -} - -static Local _map_authGSSClientStep(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientStep) { - // Ensure valid call - if(info.Length() != 2 && info.Length() != 3) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 2 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 3 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - - // Challenge string - char *challenge_str = NULL; - // Let's unpack the parameters - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - int callbackArg = 1; - - // If we have a challenge string - if(info.Length() == 3) { - // Unpack the challenge string - Local challenge = info[1]->ToString(); - // Convert uri string to c-string - challenge_str = (char *)calloc(challenge->Utf8Length() + 1, sizeof(char)); - if(challenge_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - challenge->WriteUtf8(challenge_str); - - callbackArg = 2; - } - - // Allocate a structure - AuthGSSClientStepCall *call = (AuthGSSClientStepCall *)calloc(1, sizeof(AuthGSSClientStepCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->challenge = challenge_str; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[callbackArg]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientStep; - worker->mapper = _map_authGSSClientStep; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientUnwrap -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientUnwrap(Worker *worker) { - gss_client_response *response; - char *challenge; - - // Unpack the parameter data struct - AuthGSSClientUnwrapCall *call = (AuthGSSClientUnwrapCall *)worker->parameters; - challenge = call->challenge; - - // Check what kind of challenge we have - if(call->challenge == NULL) { - challenge = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_client_unwrap(call->context->state, challenge); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->challenge != NULL) free(call->challenge); - free(call); - free(response); -} - -static Local _map_authGSSClientUnwrap(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientUnwrap) { - // Ensure valid call - if(info.Length() != 2 && info.Length() != 3) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 2 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - if(info.Length() == 3 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsFunction())) return Nan::ThrowError("Requires a GSS context, optional challenge string and callback function"); - - // Challenge string - char *challenge_str = NULL; - // Let's unpack the parameters - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - // If we have a challenge string - if(info.Length() == 3) { - // Unpack the challenge string - Local challenge = info[1]->ToString(); - // Convert uri string to c-string - challenge_str = (char *)calloc(challenge->Utf8Length() + 1, sizeof(char)); - if(challenge_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - challenge->WriteUtf8(challenge_str); - } - - // Allocate a structure - AuthGSSClientUnwrapCall *call = (AuthGSSClientUnwrapCall *)calloc(1, sizeof(AuthGSSClientUnwrapCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->challenge = challenge_str; - - // Unpack the callback - Local callbackHandle = info.Length() == 3 ? Local::Cast(info[2]) : Local::Cast(info[1]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientUnwrap; - worker->mapper = _map_authGSSClientUnwrap; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientWrap -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientWrap(Worker *worker) { - gss_client_response *response; - char *user_name = NULL; - - // Unpack the parameter data struct - AuthGSSClientWrapCall *call = (AuthGSSClientWrapCall *)worker->parameters; - user_name = call->user_name; - - // Check what kind of challenge we have - if(call->user_name == NULL) { - user_name = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_client_wrap(call->context->state, call->challenge, user_name); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->challenge != NULL) free(call->challenge); - if(call->user_name != NULL) free(call->user_name); - free(call); - free(response); -} - -static Local _map_authGSSClientWrap(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientWrap) { - // Ensure valid call - if(info.Length() != 3 && info.Length() != 4) return Nan::ThrowError("Requires a GSS context, the result from the authGSSClientResponse after authGSSClientUnwrap, optional user name and callback function"); - if(info.Length() == 3 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsFunction())) return Nan::ThrowError("Requires a GSS context, the result from the authGSSClientResponse after authGSSClientUnwrap, optional user name and callback function"); - if(info.Length() == 4 && (!KerberosContext::HasInstance(info[0]) || !info[1]->IsString() || !info[2]->IsString() || !info[3]->IsFunction())) return Nan::ThrowError("Requires a GSS context, the result from the authGSSClientResponse after authGSSClientUnwrap, optional user name and callback function"); - - // Challenge string - char *challenge_str = NULL; - char *user_name_str = NULL; - - // Let's unpack the kerberos context - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - // Unpack the challenge string - Local challenge = info[1]->ToString(); - // Convert uri string to c-string - challenge_str = (char *)calloc(challenge->Utf8Length() + 1, sizeof(char)); - if(challenge_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - challenge->WriteUtf8(challenge_str); - - // If we have a user string - if(info.Length() == 4) { - // Unpack user name - Local user_name = info[2]->ToString(); - // Convert uri string to c-string - user_name_str = (char *)calloc(user_name->Utf8Length() + 1, sizeof(char)); - if(user_name_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - user_name->WriteUtf8(user_name_str); - } - - // Allocate a structure - AuthGSSClientWrapCall *call = (AuthGSSClientWrapCall *)calloc(1, sizeof(AuthGSSClientWrapCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->challenge = challenge_str; - call->user_name = user_name_str; - - // Unpack the callback - Local callbackHandle = info.Length() == 4 ? Local::Cast(info[3]) : Local::Cast(info[2]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientWrap; - worker->mapper = _map_authGSSClientWrap; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientClean -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSClientClean(Worker *worker) { - gss_client_response *response; - - // Unpack the parameter data struct - AuthGSSClientCleanCall *call = (AuthGSSClientCleanCall *)worker->parameters; - - // Perform authentication step - response = authenticate_gss_client_clean(call->context->state); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - free(call); - free(response); -} - -static Local _map_authGSSClientClean(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSClientClean) { - // Ensure valid call - if(info.Length() != 2) return Nan::ThrowError("Requires a GSS context and callback function"); - if(!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction()) return Nan::ThrowError("Requires a GSS context and callback function"); - - // Let's unpack the kerberos context - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsClientInstance()) { - return Nan::ThrowError("GSS context is not a client instance"); - } - - // Allocate a structure - AuthGSSClientCleanCall *call = (AuthGSSClientCleanCall *)calloc(1, sizeof(AuthGSSClientCleanCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[1]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSClientClean; - worker->mapper = _map_authGSSClientClean; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSServerInit -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSServerInit(Worker *worker) { - gss_server_state *state; - gss_client_response *response; - - // Allocate state - state = (gss_server_state *)malloc(sizeof(gss_server_state)); - if(state == NULL) die("Memory allocation failed"); - - // Unpack the parameter data struct - AuthGSSServerInitCall *call = (AuthGSSServerInitCall *)worker->parameters; - // Start the kerberos service - response = authenticate_gss_server_init(call->service, call->constrained_delegation, call->username, state); - - // Release the parameter struct memory - free(call->service); - free(call->username); - free(call); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - free(state); - } else { - worker->return_value = state; - } - - // Free structure - free(response); -} - -static Local _map_authGSSServerInit(Worker *worker) { - KerberosContext *context = KerberosContext::New(); - context->server_state = (gss_server_state *)worker->return_value; - return context->handle(); -} - -// Server Initialize method -NAN_METHOD(Kerberos::AuthGSSServerInit) { - // Ensure valid call - if(info.Length() != 4) return Nan::ThrowError("Requires a service string, constrained delegation boolean, a username string (or NULL) for S4U2Self protocol transition and a callback function"); - - if(!info[0]->IsString() || - !info[1]->IsBoolean() || - !(info[2]->IsString() || info[2]->IsNull()) || - !info[3]->IsFunction() - ) return Nan::ThrowError("Requires a service string, constrained delegation boolean, a username string (or NULL) for S4U2Self protocol transition and a callback function"); - - if (!info[1]->BooleanValue() && !info[2]->IsNull()) return Nan::ThrowError("S4U2Self only possible when constrained delegation is enabled"); - - // Allocate a structure - AuthGSSServerInitCall *call = (AuthGSSServerInitCall *)calloc(1, sizeof(AuthGSSServerInitCall)); - if(call == NULL) die("Memory allocation failed"); - - Local service = info[0]->ToString(); - // Convert service string to c-string - char *service_str = (char *)calloc(service->Utf8Length() + 1, sizeof(char)); - if(service_str == NULL) die("Memory allocation failed"); - - // Write v8 string to c-string - service->WriteUtf8(service_str); - - call->service = service_str; - - call->constrained_delegation = info[1]->BooleanValue(); - - if (info[2]->IsNull()) - { - call->username = NULL; - } - else - { - Local tmpString = info[2]->ToString(); - - char *tmpCstr = (char *)calloc(tmpString->Utf8Length() + 1, sizeof(char)); - if(tmpCstr == NULL) die("Memory allocation failed"); - - tmpString->WriteUtf8(tmpCstr); - - call->username = tmpCstr; - } - - // Unpack the callback - Local callbackHandle = Local::Cast(info[3]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSServerInit; - worker->mapper = _map_authGSSServerInit; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSServerClean -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSServerClean(Worker *worker) { - gss_client_response *response; - - // Unpack the parameter data struct - AuthGSSServerCleanCall *call = (AuthGSSServerCleanCall *)worker->parameters; - - // Perform authentication step - response = authenticate_gss_server_clean(call->context->server_state); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - free(call); - free(response); -} - -static Local _map_authGSSServerClean(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSServerClean) { - // // Ensure valid call - if(info.Length() != 2) return Nan::ThrowError("Requires a GSS context and callback function"); - if(!KerberosContext::HasInstance(info[0]) || !info[1]->IsFunction()) return Nan::ThrowError("Requires a GSS context and callback function"); - - // Let's unpack the kerberos context - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsServerInstance()) { - return Nan::ThrowError("GSS context is not a server instance"); - } - - // Allocate a structure - AuthGSSServerCleanCall *call = (AuthGSSServerCleanCall *)calloc(1, sizeof(AuthGSSServerCleanCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[1]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSServerClean; - worker->mapper = _map_authGSSServerClean; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSServerStep -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authGSSServerStep(Worker *worker) { - gss_server_state *state; - gss_client_response *response; - char *auth_data; - - // Unpack the parameter data struct - AuthGSSServerStepCall *call = (AuthGSSServerStepCall *)worker->parameters; - // Get the state - state = call->context->server_state; - auth_data = call->auth_data; - - // Check if we got auth_data or not - if(call->auth_data == NULL) { - auth_data = (char *)""; - } - - // Perform authentication step - response = authenticate_gss_server_step(state, auth_data); - - // If we have an error mark worker as having had an error - if(response->return_code == AUTH_GSS_ERROR) { - worker->error = TRUE; - worker->error_code = response->return_code; - worker->error_message = response->message; - } else { - worker->return_code = response->return_code; - } - - // Free up structure - if(call->auth_data != NULL) free(call->auth_data); - free(call); - free(response); -} - -static Local _map_authGSSServerStep(Worker *worker) { - Nan::HandleScope scope; - // Return the return code - return Nan::New(worker->return_code); -} - -// Initialize method -NAN_METHOD(Kerberos::AuthGSSServerStep) { - // Ensure valid call - if(info.Length() != 3) return Nan::ThrowError("Requires a GSS context, auth-data string and callback function"); - if(!KerberosContext::HasInstance(info[0])) return Nan::ThrowError("1st arg must be a GSS context"); - if (!info[1]->IsString()) return Nan::ThrowError("2nd arg must be auth-data string"); - if (!info[2]->IsFunction()) return Nan::ThrowError("3rd arg must be a callback function"); - - // Auth-data string - char *auth_data_str = NULL; - // Let's unpack the parameters - Local object = info[0]->ToObject(); - KerberosContext *kerberos_context = KerberosContext::Unwrap(object); - - if (!kerberos_context->IsServerInstance()) { - return Nan::ThrowError("GSS context is not a server instance"); - } - - // Unpack the auth_data string - Local auth_data = info[1]->ToString(); - // Convert uri string to c-string - auth_data_str = (char *)calloc(auth_data->Utf8Length() + 1, sizeof(char)); - if(auth_data_str == NULL) die("Memory allocation failed"); - // Write v8 string to c-string - auth_data->WriteUtf8(auth_data_str); - - // Allocate a structure - AuthGSSServerStepCall *call = (AuthGSSServerStepCall *)calloc(1, sizeof(AuthGSSServerStepCall)); - if(call == NULL) die("Memory allocation failed"); - call->context = kerberos_context; - call->auth_data = auth_data_str; - - // Unpack the callback - Local callbackHandle = Local::Cast(info[2]); - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authGSSServerStep; - worker->mapper = _map_authGSSServerStep; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Kerberos::Process, (uv_after_work_cb)Kerberos::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// UV Lib callbacks -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void Kerberos::Process(uv_work_t* work_req) { - // Grab the worker - Worker *worker = static_cast(work_req->data); - // Execute the worker code - worker->execute(worker); -} - -void Kerberos::After(uv_work_t* work_req) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Get the worker reference - Worker *worker = static_cast(work_req->data); - - // If we have an error - if(worker->error) { - Local err = v8::Exception::Error(Nan::New(worker->error_message).ToLocalChecked()); - Local obj = err->ToObject(); - obj->Set(Nan::New("code").ToLocalChecked(), Nan::New(worker->error_code)); - Local info[2] = { err, Nan::Null() }; - // Execute the error - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } else { - // // Map the data - Local result = worker->mapper(worker); - // Set up the callback with a null first - #if defined(V8_MAJOR_VERSION) && (V8_MAJOR_VERSION > 4 || \ - (V8_MAJOR_VERSION == 4 && defined(V8_MINOR_VERSION) && V8_MINOR_VERSION >= 3)) - Local info[2] = { Nan::Null(), result}; - #else - Local info[2] = { Nan::Null(), Nan::New(result)}; - #endif - - // Wrap the callback function call in a TryCatch so that we can call - // node's FatalException afterwards. This makes it possible to catch - // the exception from JavaScript land using the - // process.on('uncaughtException') event. - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } - - // Clean up the memory - delete worker->callback; - delete worker; -} - -// Exporting function -NAN_MODULE_INIT(init) { - Kerberos::Initialize(target); - KerberosContext::Initialize(target); -} - -NODE_MODULE(kerberos, init); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h deleted file mode 100644 index beafa4d8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.h +++ /dev/null @@ -1,50 +0,0 @@ -#ifndef KERBEROS_H -#define KERBEROS_H - -#include -#include -#include -#include - -#include "nan.h" -#include -#include - -extern "C" { - #include "kerberosgss.h" -} - -using namespace v8; -using namespace node; - -class Kerberos : public Nan::ObjectWrap { - -public: - Kerberos(); - ~Kerberos() {}; - - // Constructor used for creating new Kerberos objects from C++ - static Nan::Persistent constructor_template; - - // Initialize function for the object - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - - // Method available - static NAN_METHOD(AuthGSSClientInit); - static NAN_METHOD(AuthGSSClientStep); - static NAN_METHOD(AuthGSSClientUnwrap); - static NAN_METHOD(AuthGSSClientWrap); - static NAN_METHOD(AuthGSSClientClean); - static NAN_METHOD(AuthGSSServerInit); - static NAN_METHOD(AuthGSSServerClean); - static NAN_METHOD(AuthGSSServerStep); - -private: - static NAN_METHOD(New); - // Handles the uv calls - static void Process(uv_work_t* work_req); - // Called after work is done - static void After(uv_work_t* work_req); -}; - -#endif diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js deleted file mode 100644 index c7bae583..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos.js +++ /dev/null @@ -1,164 +0,0 @@ -var kerberos = require('../build/Release/kerberos') - , KerberosNative = kerberos.Kerberos; - -var Kerberos = function() { - this._native_kerberos = new KerberosNative(); -} - -// callback takes two arguments, an error string if defined and a new context -// uri should be given as service@host. Services are not always defined -// in a straightforward way. Use 'HTTP' for SPNEGO / Negotiate authentication. -Kerberos.prototype.authGSSClientInit = function(uri, flags, callback) { - return this._native_kerberos.authGSSClientInit(uri, flags, callback); -} - -// This will obtain credentials using a credentials cache. To override the default -// location (posible /tmp/krb5cc_nnnnnn, where nnnn is your numeric uid) use -// the environment variable KRB5CNAME. -// The credentials (suitable for using in an 'Authenticate: ' header, when prefixed -// with 'Negotiate ') will be available as context.response inside the callback -// if no error is indicated. -// callback takes one argument, an error string if defined -Kerberos.prototype.authGSSClientStep = function(context, challenge, callback) { - if(typeof challenge == 'function') { - callback = challenge; - challenge = ''; - } - - return this._native_kerberos.authGSSClientStep(context, challenge, callback); -} - -Kerberos.prototype.authGSSClientUnwrap = function(context, challenge, callback) { - if(typeof challenge == 'function') { - callback = challenge; - challenge = ''; - } - - return this._native_kerberos.authGSSClientUnwrap(context, challenge, callback); -} - -Kerberos.prototype.authGSSClientWrap = function(context, challenge, user_name, callback) { - if(typeof user_name == 'function') { - callback = user_name; - user_name = ''; - } - - return this._native_kerberos.authGSSClientWrap(context, challenge, user_name, callback); -} - -// free memory used by a context created using authGSSClientInit. -// callback takes one argument, an error string if defined. -Kerberos.prototype.authGSSClientClean = function(context, callback) { - return this._native_kerberos.authGSSClientClean(context, callback); -} - -// The server will obtain credentials using a keytab. To override the -// default location (probably /etc/krb5.keytab) set the KRB5_KTNAME -// environment variable. -// The service name should be in the form service, or service@host.name -// e.g. for HTTP, use "HTTP" or "HTTP@my.host.name". See gss_import_name -// for GSS_C_NT_HOSTBASED_SERVICE. -// -// a boolean turns on "constrained_delegation". this enables acquisition of S4U2Proxy -// credentials which will be stored in a credentials cache during the authGSSServerStep -// method. this parameter is optional. -// -// when "constrained_delegation" is enabled, a username can (optionally) be provided and -// S4U2Self protocol transition will be initiated. In this case, we will not -// require any "auth" data during the authGSSServerStep. This parameter is optional -// but constrained_delegation MUST be enabled for this to work. When S4U2Self is -// used, the username will be assumed to have been already authenticated, and no -// actual authentication will be performed. This is basically a way to "bootstrap" -// kerberos credentials (which can then be delegated with S4U2Proxy) for a user -// authenticated externally. -// -// callback takes two arguments, an error string if defined and a new context -// -Kerberos.prototype.authGSSServerInit = function(service, constrained_delegation, username, callback) { - if(typeof(constrained_delegation) === 'function') { - callback = constrained_delegation; - constrained_delegation = false; - username = null; - } - - if (typeof(constrained_delegation) === 'string') { - throw new Error("S4U2Self protocol transation is not possible without enabling constrained delegation"); - } - - if (typeof(username) === 'function') { - callback = username; - username = null; - } - - constrained_delegation = !!constrained_delegation; - - return this._native_kerberos.authGSSServerInit(service, constrained_delegation, username, callback); -}; - -//callback takes one argument, an error string if defined. -Kerberos.prototype.authGSSServerClean = function(context, callback) { - return this._native_kerberos.authGSSServerClean(context, callback); -}; - -// authData should be the base64 encoded authentication data obtained -// from client, e.g., in the Authorization header (without the leading -// "Negotiate " string) during SPNEGO authentication. The authenticated user -// is available in context.username after successful authentication. -// callback takes one argument, an error string if defined. -// -// Note: when S4U2Self protocol transition was requested in the authGSSServerInit -// no actual authentication will be performed and authData will be ignored. -// -Kerberos.prototype.authGSSServerStep = function(context, authData, callback) { - return this._native_kerberos.authGSSServerStep(context, authData, callback); -}; - -Kerberos.prototype.acquireAlternateCredentials = function(user_name, password, domain) { - return this._native_kerberos.acquireAlternateCredentials(user_name, password, domain); -} - -Kerberos.prototype.prepareOutboundPackage = function(principal, inputdata) { - return this._native_kerberos.prepareOutboundPackage(principal, inputdata); -} - -Kerberos.prototype.decryptMessage = function(challenge) { - return this._native_kerberos.decryptMessage(challenge); -} - -Kerberos.prototype.encryptMessage = function(challenge) { - return this._native_kerberos.encryptMessage(challenge); -} - -Kerberos.prototype.queryContextAttribute = function(attribute) { - if(typeof attribute != 'number' && attribute != 0x00) throw new Error("Attribute not supported"); - return this._native_kerberos.queryContextAttribute(attribute); -} - -// Some useful result codes -Kerberos.AUTH_GSS_CONTINUE = 0; -Kerberos.AUTH_GSS_COMPLETE = 1; - -// Some useful gss flags -Kerberos.GSS_C_DELEG_FLAG = 1; -Kerberos.GSS_C_MUTUAL_FLAG = 2; -Kerberos.GSS_C_REPLAY_FLAG = 4; -Kerberos.GSS_C_SEQUENCE_FLAG = 8; -Kerberos.GSS_C_CONF_FLAG = 16; -Kerberos.GSS_C_INTEG_FLAG = 32; -Kerberos.GSS_C_ANON_FLAG = 64; -Kerberos.GSS_C_PROT_READY_FLAG = 128; -Kerberos.GSS_C_TRANS_FLAG = 256; - -// Export Kerberos class -exports.Kerberos = Kerberos; - -// If we have SSPI (windows) -if(kerberos.SecurityCredentials) { - // Put all SSPI classes in it's own namespace - exports.SSIP = { - SecurityCredentials: require('./win32/wrappers/security_credentials').SecurityCredentials - , SecurityContext: require('./win32/wrappers/security_context').SecurityContext - , SecurityBuffer: require('./win32/wrappers/security_buffer').SecurityBuffer - , SecurityBufferDescriptor: require('./win32/wrappers/security_buffer_descriptor').SecurityBufferDescriptor - } -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc deleted file mode 100644 index bf241185..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.cc +++ /dev/null @@ -1,134 +0,0 @@ -#include "kerberos_context.h" - -Nan::Persistent KerberosContext::constructor_template; - -KerberosContext::KerberosContext() : Nan::ObjectWrap() { - state = NULL; - server_state = NULL; -} - -KerberosContext::~KerberosContext() { -} - -KerberosContext* KerberosContext::New() { - Nan::HandleScope scope; - Local obj = Nan::New(constructor_template)->GetFunction()->NewInstance(); - KerberosContext *kerberos_context = Nan::ObjectWrap::Unwrap(obj); - return kerberos_context; -} - -NAN_METHOD(KerberosContext::New) { - // Create code object - KerberosContext *kerberos_context = new KerberosContext(); - // Wrap it - kerberos_context->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -void KerberosContext::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(static_cast(New)); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("KerberosContext").ToLocalChecked()); - - // Get prototype - Local proto = t->PrototypeTemplate(); - - // Getter for the response - Nan::SetAccessor(proto, Nan::New("response").ToLocalChecked(), KerberosContext::ResponseGetter); - - // Getter for the username - Nan::SetAccessor(proto, Nan::New("username").ToLocalChecked(), KerberosContext::UsernameGetter); - - // Getter for the targetname - server side only - Nan::SetAccessor(proto, Nan::New("targetname").ToLocalChecked(), KerberosContext::TargetnameGetter); - - Nan::SetAccessor(proto, Nan::New("delegatedCredentialsCache").ToLocalChecked(), KerberosContext::DelegatedCredentialsCacheGetter); - - // Set persistent - constructor_template.Reset(t); - // NanAssignPersistent(constructor_template, t); - - // Set the symbol - target->ForceSet(Nan::New("KerberosContext").ToLocalChecked(), t->GetFunction()); -} - - -// Response Setter / Getter -NAN_GETTER(KerberosContext::ResponseGetter) { - gss_client_state *client_state; - gss_server_state *server_state; - - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - // Response could come from client or server state... - client_state = context->state; - server_state = context->server_state; - - // If client state is in use, take response from there, otherwise from server - char *response = client_state != NULL ? client_state->response : - server_state != NULL ? server_state->response : NULL; - - if(response == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - // Return the response - info.GetReturnValue().Set(Nan::New(response).ToLocalChecked()); - } -} - -// username Getter -NAN_GETTER(KerberosContext::UsernameGetter) { - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - gss_client_state *client_state = context->state; - gss_server_state *server_state = context->server_state; - - // If client state is in use, take response from there, otherwise from server - char *username = client_state != NULL ? client_state->username : - server_state != NULL ? server_state->username : NULL; - - if(username == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - info.GetReturnValue().Set(Nan::New(username).ToLocalChecked()); - } -} - -// targetname Getter - server side only -NAN_GETTER(KerberosContext::TargetnameGetter) { - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - gss_server_state *server_state = context->server_state; - - char *targetname = server_state != NULL ? server_state->targetname : NULL; - - if(targetname == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - info.GetReturnValue().Set(Nan::New(targetname).ToLocalChecked()); - } -} - -// targetname Getter - server side only -NAN_GETTER(KerberosContext::DelegatedCredentialsCacheGetter) { - // Unpack the object - KerberosContext *context = Nan::ObjectWrap::Unwrap(info.This()); - - gss_server_state *server_state = context->server_state; - - char *delegated_credentials_cache = server_state != NULL ? server_state->delegated_credentials_cache : NULL; - - if(delegated_credentials_cache == NULL) { - info.GetReturnValue().Set(Nan::Null()); - } else { - info.GetReturnValue().Set(Nan::New(delegated_credentials_cache).ToLocalChecked()); - } -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h deleted file mode 100644 index 23eb5778..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberos_context.h +++ /dev/null @@ -1,64 +0,0 @@ -#ifndef KERBEROS_CONTEXT_H -#define KERBEROS_CONTEXT_H - -#include -#include -#include -#include - -#include "nan.h" -#include -#include - -extern "C" { - #include "kerberosgss.h" -} - -using namespace v8; -using namespace node; - -class KerberosContext : public Nan::ObjectWrap { - -public: - KerberosContext(); - ~KerberosContext(); - - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - inline bool IsClientInstance() { - return state != NULL; - } - - inline bool IsServerInstance() { - return server_state != NULL; - } - - // Constructor used for creating new Kerberos objects from C++ - static Nan::Persistent constructor_template; - - // Initialize function for the object - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - - // Public constructor - static KerberosContext* New(); - - // Handle to the kerberos client context - gss_client_state *state; - - // Handle to the kerberos server context - gss_server_state *server_state; - -private: - static NAN_METHOD(New); - // In either client state or server state - static NAN_GETTER(ResponseGetter); - static NAN_GETTER(UsernameGetter); - // Only in the "server_state" - static NAN_GETTER(TargetnameGetter); - static NAN_GETTER(DelegatedCredentialsCacheGetter); -}; -#endif diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c deleted file mode 100644 index 2fbca00c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.c +++ /dev/null @@ -1,931 +0,0 @@ -/** - * Copyright (c) 2006-2010 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * - **/ -/* - * S4U2Proxy implementation - * Copyright (C) 2015 David Mansfield - * Code inspired by mod_auth_kerb. - */ - -#include "kerberosgss.h" - -#include "base64.h" - -#include -#include -#include -#include -#include -#include -#include -#include - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - -void die1(const char *message) { - if(errno) { - perror(message); - } else { - printf("ERROR: %s\n", message); - } - - exit(1); -} - -static gss_client_response *gss_error(const char *func, const char *op, OM_uint32 err_maj, OM_uint32 err_min); -static gss_client_response *other_error(const char *fmt, ...); -static gss_client_response *krb5_ctx_error(krb5_context context, krb5_error_code problem); - -static gss_client_response *store_gss_creds(gss_server_state *state); -static gss_client_response *create_krb5_ccache(gss_server_state *state, krb5_context context, krb5_principal princ, krb5_ccache *ccache); - -/* -char* server_principal_details(const char* service, const char* hostname) -{ - char match[1024]; - int match_len = 0; - char* result = NULL; - - int code; - krb5_context kcontext; - krb5_keytab kt = NULL; - krb5_kt_cursor cursor = NULL; - krb5_keytab_entry entry; - char* pname = NULL; - - // Generate the principal prefix we want to match - snprintf(match, 1024, "%s/%s@", service, hostname); - match_len = strlen(match); - - code = krb5_init_context(&kcontext); - if (code) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot initialize Kerberos5 context", code)); - return NULL; - } - - if ((code = krb5_kt_default(kcontext, &kt))) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot get default keytab", code)); - goto end; - } - - if ((code = krb5_kt_start_seq_get(kcontext, kt, &cursor))) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot get sequence cursor from keytab", code)); - goto end; - } - - while ((code = krb5_kt_next_entry(kcontext, kt, &entry, &cursor)) == 0) - { - if ((code = krb5_unparse_name(kcontext, entry.principal, &pname))) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Cannot parse principal name from keytab", code)); - goto end; - } - - if (strncmp(pname, match, match_len) == 0) - { - result = malloc(strlen(pname) + 1); - strcpy(result, pname); - krb5_free_unparsed_name(kcontext, pname); - krb5_free_keytab_entry_contents(kcontext, &entry); - break; - } - - krb5_free_unparsed_name(kcontext, pname); - krb5_free_keytab_entry_contents(kcontext, &entry); - } - - if (result == NULL) - { - PyErr_SetObject(KrbException_class, Py_BuildValue("((s:i))", - "Principal not found in keytab", -1)); - } - -end: - if (cursor) - krb5_kt_end_seq_get(kcontext, kt, &cursor); - if (kt) - krb5_kt_close(kcontext, kt); - krb5_free_context(kcontext); - - return result; -} -*/ -gss_client_response *authenticate_gss_client_init(const char* service, long int gss_flags, gss_client_state* state) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; - gss_client_response *response = NULL; - int ret = AUTH_GSS_COMPLETE; - - state->server_name = GSS_C_NO_NAME; - state->context = GSS_C_NO_CONTEXT; - state->gss_flags = gss_flags; - state->username = NULL; - state->response = NULL; - - // Import server name first - name_token.length = strlen(service); - name_token.value = (char *)service; - - maj_stat = gss_import_name(&min_stat, &name_token, gss_krb5_nt_service_name, &state->server_name); - - if (GSS_ERROR(maj_stat)) { - response = gss_error(__func__, "gss_import_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - -end: - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - return response; -} - -gss_client_response *authenticate_gss_client_clean(gss_client_state *state) { - OM_uint32 min_stat; - int ret = AUTH_GSS_COMPLETE; - gss_client_response *response = NULL; - - if(state->context != GSS_C_NO_CONTEXT) - gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); - - if(state->server_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &state->server_name); - - if(state->username != NULL) { - free(state->username); - state->username = NULL; - } - - if (state->response != NULL) { - free(state->response); - state->response = NULL; - } - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - return response; -} - -gss_client_response *authenticate_gss_client_step(gss_client_state* state, const char* challenge) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_CONTINUE; - gss_client_response *response = NULL; - - // Always clear out the old response - if (state->response != NULL) { - free(state->response); - state->response = NULL; - } - - // If there is a challenge (data from the server) we need to give it to GSS - if (challenge && *challenge) { - int len; - input_token.value = base64_decode(challenge, &len); - input_token.length = len; - } - - // Do GSSAPI step - maj_stat = gss_init_sec_context(&min_stat, - GSS_C_NO_CREDENTIAL, - &state->context, - state->server_name, - GSS_C_NO_OID, - (OM_uint32)state->gss_flags, - 0, - GSS_C_NO_CHANNEL_BINDINGS, - &input_token, - NULL, - &output_token, - NULL, - NULL); - - if ((maj_stat != GSS_S_COMPLETE) && (maj_stat != GSS_S_CONTINUE_NEEDED)) { - response = gss_error(__func__, "gss_init_sec_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - ret = (maj_stat == GSS_S_COMPLETE) ? AUTH_GSS_COMPLETE : AUTH_GSS_CONTINUE; - // Grab the client response to send back to the server - if(output_token.length) { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); - maj_stat = gss_release_buffer(&min_stat, &output_token); - } - - // Try to get the user name if we have completed all GSS operations - if (ret == AUTH_GSS_COMPLETE) { - gss_name_t gssuser = GSS_C_NO_NAME; - maj_stat = gss_inquire_context(&min_stat, state->context, &gssuser, NULL, NULL, NULL, NULL, NULL, NULL); - - if(GSS_ERROR(maj_stat)) { - response = gss_error(__func__, "gss_inquire_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - gss_buffer_desc name_token; - name_token.length = 0; - maj_stat = gss_display_name(&min_stat, gssuser, &name_token, NULL); - - if(GSS_ERROR(maj_stat)) { - if(name_token.value) - gss_release_buffer(&min_stat, &name_token); - gss_release_name(&min_stat, &gssuser); - - response = gss_error(__func__, "gss_display_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } else { - state->username = (char *)malloc(name_token.length + 1); - if(state->username == NULL) die1("Memory allocation failed"); - strncpy(state->username, (char*) name_token.value, name_token.length); - state->username[name_token.length] = 0; - gss_release_buffer(&min_stat, &name_token); - gss_release_name(&min_stat, &gssuser); - } - } - -end: - if(output_token.value) - gss_release_buffer(&min_stat, &output_token); - if(input_token.value) - free(input_token.value); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_client_unwrap(gss_client_state *state, const char *challenge) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - gss_client_response *response = NULL; - int ret = AUTH_GSS_CONTINUE; - - // Always clear out the old response - if(state->response != NULL) { - free(state->response); - state->response = NULL; - } - - // If there is a challenge (data from the server) we need to give it to GSS - if(challenge && *challenge) { - int len; - input_token.value = base64_decode(challenge, &len); - input_token.length = len; - } - - // Do GSSAPI step - maj_stat = gss_unwrap(&min_stat, - state->context, - &input_token, - &output_token, - NULL, - NULL); - - if(maj_stat != GSS_S_COMPLETE) { - response = gss_error(__func__, "gss_unwrap", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } else { - ret = AUTH_GSS_COMPLETE; - } - - // Grab the client response - if(output_token.length) { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); - gss_release_buffer(&min_stat, &output_token); - } -end: - if(output_token.value) - gss_release_buffer(&min_stat, &output_token); - if(input_token.value) - free(input_token.value); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user) { - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_CONTINUE; - gss_client_response *response = NULL; - char buf[4096], server_conf_flags; - unsigned long buf_size; - - // Always clear out the old response - if(state->response != NULL) { - free(state->response); - state->response = NULL; - } - - if(challenge && *challenge) { - int len; - input_token.value = base64_decode(challenge, &len); - input_token.length = len; - } - - if(user) { - // get bufsize - server_conf_flags = ((char*) input_token.value)[0]; - ((char*) input_token.value)[0] = 0; - buf_size = ntohl(*((long *) input_token.value)); - free(input_token.value); -#ifdef PRINTFS - printf("User: %s, %c%c%c\n", user, - server_conf_flags & GSS_AUTH_P_NONE ? 'N' : '-', - server_conf_flags & GSS_AUTH_P_INTEGRITY ? 'I' : '-', - server_conf_flags & GSS_AUTH_P_PRIVACY ? 'P' : '-'); - printf("Maximum GSS token size is %ld\n", buf_size); -#endif - - // agree to terms (hack!) - buf_size = htonl(buf_size); // not relevant without integrity/privacy - memcpy(buf, &buf_size, 4); - buf[0] = GSS_AUTH_P_NONE; - // server decides if principal can log in as user - strncpy(buf + 4, user, sizeof(buf) - 4); - input_token.value = buf; - input_token.length = 4 + strlen(user); - } - - // Do GSSAPI wrap - maj_stat = gss_wrap(&min_stat, - state->context, - 0, - GSS_C_QOP_DEFAULT, - &input_token, - NULL, - &output_token); - - if (maj_stat != GSS_S_COMPLETE) { - response = gss_error(__func__, "gss_wrap", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } else - ret = AUTH_GSS_COMPLETE; - // Grab the client response to send back to the server - if (output_token.length) { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length);; - gss_release_buffer(&min_stat, &output_token); - } -end: - if (output_token.value) - gss_release_buffer(&min_stat, &output_token); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_server_init(const char *service, bool constrained_delegation, const char *username, gss_server_state *state) -{ - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc name_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_COMPLETE; - gss_client_response *response = NULL; - gss_cred_usage_t usage = GSS_C_ACCEPT; - - state->context = GSS_C_NO_CONTEXT; - state->server_name = GSS_C_NO_NAME; - state->client_name = GSS_C_NO_NAME; - state->server_creds = GSS_C_NO_CREDENTIAL; - state->client_creds = GSS_C_NO_CREDENTIAL; - state->username = NULL; - state->targetname = NULL; - state->response = NULL; - state->constrained_delegation = constrained_delegation; - state->delegated_credentials_cache = NULL; - - // Server name may be empty which means we aren't going to create our own creds - size_t service_len = strlen(service); - if (service_len != 0) - { - // Import server name first - name_token.length = strlen(service); - name_token.value = (char *)service; - - maj_stat = gss_import_name(&min_stat, &name_token, GSS_C_NT_HOSTBASED_SERVICE, &state->server_name); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_import_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - if (state->constrained_delegation) - { - usage = GSS_C_BOTH; - } - - // Get credentials - maj_stat = gss_acquire_cred(&min_stat, state->server_name, GSS_C_INDEFINITE, - GSS_C_NO_OID_SET, usage, &state->server_creds, NULL, NULL); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_acquire_cred", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - } - - // If a username was passed, perform the S4U2Self protocol transition to acquire - // a credentials from that user as if we had done gss_accept_sec_context. - // In this scenario, the passed username is assumed to be already authenticated - // by some external mechanism, and we are here to "bootstrap" some gss credentials. - // In authenticate_gss_server_step we will bypass the actual authentication step. - if (username != NULL) - { - gss_name_t gss_username; - - name_token.length = strlen(username); - name_token.value = (char *)username; - - maj_stat = gss_import_name(&min_stat, &name_token, GSS_C_NT_USER_NAME, &gss_username); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_import_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - maj_stat = gss_acquire_cred_impersonate_name(&min_stat, - state->server_creds, - gss_username, - GSS_C_INDEFINITE, - GSS_C_NO_OID_SET, - GSS_C_INITIATE, - &state->client_creds, - NULL, - NULL); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_acquire_cred_impersonate_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - } - - gss_release_name(&min_stat, &gss_username); - - if (response != NULL) - { - goto end; - } - - // because the username MAY be a "local" username, - // we want get the canonical name from the acquired creds. - maj_stat = gss_inquire_cred(&min_stat, state->client_creds, &state->client_name, NULL, NULL, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_inquire_cred", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - } - -end: - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_server_clean(gss_server_state *state) -{ - OM_uint32 min_stat; - int ret = AUTH_GSS_COMPLETE; - gss_client_response *response = NULL; - - if (state->context != GSS_C_NO_CONTEXT) - gss_delete_sec_context(&min_stat, &state->context, GSS_C_NO_BUFFER); - if (state->server_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &state->server_name); - if (state->client_name != GSS_C_NO_NAME) - gss_release_name(&min_stat, &state->client_name); - if (state->server_creds != GSS_C_NO_CREDENTIAL) - gss_release_cred(&min_stat, &state->server_creds); - if (state->client_creds != GSS_C_NO_CREDENTIAL) - gss_release_cred(&min_stat, &state->client_creds); - if (state->username != NULL) - { - free(state->username); - state->username = NULL; - } - if (state->targetname != NULL) - { - free(state->targetname); - state->targetname = NULL; - } - if (state->response != NULL) - { - free(state->response); - state->response = NULL; - } - if (state->delegated_credentials_cache) - { - // TODO: what about actually destroying the cache? It can't be done now as - // the whole point is having it around for the lifetime of the "session" - free(state->delegated_credentials_cache); - } - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -gss_client_response *authenticate_gss_server_step(gss_server_state *state, const char *auth_data) -{ - OM_uint32 maj_stat; - OM_uint32 min_stat; - gss_buffer_desc input_token = GSS_C_EMPTY_BUFFER; - gss_buffer_desc output_token = GSS_C_EMPTY_BUFFER; - int ret = AUTH_GSS_CONTINUE; - gss_client_response *response = NULL; - - // Always clear out the old response - if (state->response != NULL) - { - free(state->response); - state->response = NULL; - } - - // we don't need to check the authentication token if S4U2Self protocol - // transition was done, because we already have the client credentials. - if (state->client_creds == GSS_C_NO_CREDENTIAL) - { - if (auth_data && *auth_data) - { - int len; - input_token.value = base64_decode(auth_data, &len); - input_token.length = len; - } - else - { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->message = strdup("No auth_data value in request from client"); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - maj_stat = gss_accept_sec_context(&min_stat, - &state->context, - state->server_creds, - &input_token, - GSS_C_NO_CHANNEL_BINDINGS, - &state->client_name, - NULL, - &output_token, - NULL, - NULL, - &state->client_creds); - - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_accept_sec_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - // Grab the server response to send back to the client - if (output_token.length) - { - state->response = base64_encode((const unsigned char *)output_token.value, output_token.length); - maj_stat = gss_release_buffer(&min_stat, &output_token); - } - } - - // Get the user name - maj_stat = gss_display_name(&min_stat, state->client_name, &output_token, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_display_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - state->username = (char *)malloc(output_token.length + 1); - strncpy(state->username, (char*) output_token.value, output_token.length); - state->username[output_token.length] = 0; - - // Get the target name if no server creds were supplied - if (state->server_creds == GSS_C_NO_CREDENTIAL) - { - gss_name_t target_name = GSS_C_NO_NAME; - maj_stat = gss_inquire_context(&min_stat, state->context, NULL, &target_name, NULL, NULL, NULL, NULL, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_inquire_context", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - maj_stat = gss_display_name(&min_stat, target_name, &output_token, NULL); - if (GSS_ERROR(maj_stat)) - { - response = gss_error(__func__, "gss_display_name", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - state->targetname = (char *)malloc(output_token.length + 1); - strncpy(state->targetname, (char*) output_token.value, output_token.length); - state->targetname[output_token.length] = 0; - } - - if (state->constrained_delegation && state->client_creds != GSS_C_NO_CREDENTIAL) - { - if ((response = store_gss_creds(state)) != NULL) - { - goto end; - } - } - - ret = AUTH_GSS_COMPLETE; - -end: - if (output_token.length) - gss_release_buffer(&min_stat, &output_token); - if (input_token.value) - free(input_token.value); - - if(response == NULL) { - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->return_code = ret; - } - - // Return the response - return response; -} - -static gss_client_response *store_gss_creds(gss_server_state *state) -{ - OM_uint32 maj_stat, min_stat; - krb5_principal princ = NULL; - krb5_ccache ccache = NULL; - krb5_error_code problem; - krb5_context context; - gss_client_response *response = NULL; - - problem = krb5_init_context(&context); - if (problem) { - response = other_error("No auth_data value in request from client"); - return response; - } - - problem = krb5_parse_name(context, state->username, &princ); - if (problem) { - response = krb5_ctx_error(context, problem); - goto end; - } - - if ((response = create_krb5_ccache(state, context, princ, &ccache))) - { - goto end; - } - - maj_stat = gss_krb5_copy_ccache(&min_stat, state->client_creds, ccache); - if (GSS_ERROR(maj_stat)) { - response = gss_error(__func__, "gss_krb5_copy_ccache", maj_stat, min_stat); - response->return_code = AUTH_GSS_ERROR; - goto end; - } - - krb5_cc_close(context, ccache); - ccache = NULL; - - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - // TODO: something other than AUTH_GSS_COMPLETE? - response->return_code = AUTH_GSS_COMPLETE; - - end: - if (princ) - krb5_free_principal(context, princ); - if (ccache) - krb5_cc_destroy(context, ccache); - krb5_free_context(context); - - return response; -} - -static gss_client_response *create_krb5_ccache(gss_server_state *state, krb5_context kcontext, krb5_principal princ, krb5_ccache *ccache) -{ - char *ccname = NULL; - int fd; - krb5_error_code problem; - krb5_ccache tmp_ccache = NULL; - gss_client_response *error = NULL; - - // TODO: mod_auth_kerb used a temp file under /run/httpd/krbcache. what can we do? - ccname = strdup("FILE:/tmp/krb5cc_nodekerberos_XXXXXX"); - if (!ccname) die1("Memory allocation failed"); - - fd = mkstemp(ccname + strlen("FILE:")); - if (fd < 0) { - error = other_error("mkstemp() failed: %s", strerror(errno)); - goto end; - } - - close(fd); - - problem = krb5_cc_resolve(kcontext, ccname, &tmp_ccache); - if (problem) { - error = krb5_ctx_error(kcontext, problem); - goto end; - } - - problem = krb5_cc_initialize(kcontext, tmp_ccache, princ); - if (problem) { - error = krb5_ctx_error(kcontext, problem); - goto end; - } - - state->delegated_credentials_cache = strdup(ccname); - - // TODO: how/when to cleanup the creds cache file? - // TODO: how to expose the credentials expiration time? - - *ccache = tmp_ccache; - tmp_ccache = NULL; - - end: - if (tmp_ccache) - krb5_cc_destroy(kcontext, tmp_ccache); - - if (ccname && error) - unlink(ccname); - - if (ccname) - free(ccname); - - return error; -} - - -gss_client_response *gss_error(const char *func, const char *op, OM_uint32 err_maj, OM_uint32 err_min) { - OM_uint32 maj_stat, min_stat; - OM_uint32 msg_ctx = 0; - gss_buffer_desc status_string; - - gss_client_response *response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - - char *message = NULL; - message = calloc(1024, 1); - if(message == NULL) die1("Memory allocation failed"); - - response->message = message; - - int nleft = 1024; - int n; - - n = snprintf(message, nleft, "%s(%s)", func, op); - message += n; - nleft -= n; - - do { - maj_stat = gss_display_status (&min_stat, - err_maj, - GSS_C_GSS_CODE, - GSS_C_NO_OID, - &msg_ctx, - &status_string); - if(GSS_ERROR(maj_stat)) - break; - - n = snprintf(message, nleft, ": %.*s", - (int)status_string.length, (char*)status_string.value); - message += n; - nleft -= n; - - gss_release_buffer(&min_stat, &status_string); - - maj_stat = gss_display_status (&min_stat, - err_min, - GSS_C_MECH_CODE, - GSS_C_NULL_OID, - &msg_ctx, - &status_string); - if(!GSS_ERROR(maj_stat)) { - n = snprintf(message, nleft, ": %.*s", - (int)status_string.length, (char*)status_string.value); - message += n; - nleft -= n; - - gss_release_buffer(&min_stat, &status_string); - } - } while (!GSS_ERROR(maj_stat) && msg_ctx != 0); - - return response; -} - -static gss_client_response *krb5_ctx_error(krb5_context context, krb5_error_code problem) -{ - gss_client_response *response = NULL; - const char *error_text = krb5_get_error_message(context, problem); - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->message = strdup(error_text); - // TODO: something other than AUTH_GSS_ERROR? AUTH_KRB5_ERROR ? - response->return_code = AUTH_GSS_ERROR; - krb5_free_error_message(context, error_text); - return response; -} - -static gss_client_response *other_error(const char *fmt, ...) -{ - size_t needed; - char *msg; - gss_client_response *response = NULL; - va_list ap, aps; - - va_start(ap, fmt); - - va_copy(aps, ap); - needed = snprintf(NULL, 0, fmt, aps); - va_end(aps); - - msg = malloc(needed); - if (!msg) die1("Memory allocation failed"); - - vsnprintf(msg, needed, fmt, ap); - va_end(ap); - - response = calloc(1, sizeof(gss_client_response)); - if(response == NULL) die1("Memory allocation failed"); - response->message = msg; - - // TODO: something other than AUTH_GSS_ERROR? - response->return_code = AUTH_GSS_ERROR; - - return response; -} - - -#pragma clang diagnostic pop - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h deleted file mode 100644 index fa7e3111..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/kerberosgss.h +++ /dev/null @@ -1,73 +0,0 @@ -/** - * Copyright (c) 2006-2009 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ -#ifndef KERBEROS_GSS_H -#define KERBEROS_GSS_H - -#include - -#include -#include -#include - -#define krb5_get_err_text(context,code) error_message(code) - -#define AUTH_GSS_ERROR -1 -#define AUTH_GSS_COMPLETE 1 -#define AUTH_GSS_CONTINUE 0 - -#define GSS_AUTH_P_NONE 1 -#define GSS_AUTH_P_INTEGRITY 2 -#define GSS_AUTH_P_PRIVACY 4 - -typedef struct { - int return_code; - char *message; -} gss_client_response; - -typedef struct { - gss_ctx_id_t context; - gss_name_t server_name; - long int gss_flags; - char* username; - char* response; -} gss_client_state; - -typedef struct { - gss_ctx_id_t context; - gss_name_t server_name; - gss_name_t client_name; - gss_cred_id_t server_creds; - gss_cred_id_t client_creds; - char* username; - char* targetname; - char* response; - bool constrained_delegation; - char* delegated_credentials_cache; -} gss_server_state; - -// char* server_principal_details(const char* service, const char* hostname); - -gss_client_response *authenticate_gss_client_init(const char* service, long int gss_flags, gss_client_state* state); -gss_client_response *authenticate_gss_client_clean(gss_client_state *state); -gss_client_response *authenticate_gss_client_step(gss_client_state *state, const char *challenge); -gss_client_response *authenticate_gss_client_unwrap(gss_client_state* state, const char* challenge); -gss_client_response *authenticate_gss_client_wrap(gss_client_state* state, const char* challenge, const char* user); - -gss_client_response *authenticate_gss_server_init(const char* service, bool constrained_delegation, const char *username, gss_server_state* state); -gss_client_response *authenticate_gss_server_clean(gss_server_state *state); -gss_client_response *authenticate_gss_server_step(gss_server_state *state, const char *challenge); - -#endif diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js deleted file mode 100644 index d9120fba..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/sspi.js +++ /dev/null @@ -1,15 +0,0 @@ -// Load the native SSPI classes -var kerberos = require('../build/Release/kerberos') - , Kerberos = kerberos.Kerberos - , SecurityBuffer = require('./win32/wrappers/security_buffer').SecurityBuffer - , SecurityBufferDescriptor = require('./win32/wrappers/security_buffer_descriptor').SecurityBufferDescriptor - , SecurityCredentials = require('./win32/wrappers/security_credentials').SecurityCredentials - , SecurityContext = require('./win32/wrappers/security_context').SecurityContext; -var SSPI = function() { -} - -exports.SSPI = SSPI; -exports.SecurityBuffer = SecurityBuffer; -exports.SecurityBufferDescriptor = SecurityBufferDescriptor; -exports.SecurityCredentials = SecurityCredentials; -exports.SecurityContext = SecurityContext; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c deleted file mode 100644 index 502a021c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.c +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -#include "base64.h" - -#include -#include - -// base64 tables -static char basis_64[] = - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; -static signed char index_64[128] = -{ - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,-1, - -1,-1,-1,-1, -1,-1,-1,-1, -1,-1,-1,62, -1,-1,-1,63, - 52,53,54,55, 56,57,58,59, 60,61,-1,-1, -1,-1,-1,-1, - -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10, 11,12,13,14, - 15,16,17,18, 19,20,21,22, 23,24,25,-1, -1,-1,-1,-1, - -1,26,27,28, 29,30,31,32, 33,34,35,36, 37,38,39,40, - 41,42,43,44, 45,46,47,48, 49,50,51,-1, -1,-1,-1,-1 -}; -#define CHAR64(c) (((c) < 0 || (c) > 127) ? -1 : index_64[(c)]) - -// base64_encode : base64 encode -// -// value : data to encode -// vlen : length of data -// (result) : new char[] - c-str of result -char *base64_encode(const unsigned char *value, int vlen) -{ - char *result = (char *)malloc((vlen * 4) / 3 + 5); - char *out = result; - unsigned char oval; - - while (vlen >= 3) - { - *out++ = basis_64[value[0] >> 2]; - *out++ = basis_64[((value[0] << 4) & 0x30) | (value[1] >> 4)]; - *out++ = basis_64[((value[1] << 2) & 0x3C) | (value[2] >> 6)]; - *out++ = basis_64[value[2] & 0x3F]; - value += 3; - vlen -= 3; - } - if (vlen > 0) - { - *out++ = basis_64[value[0] >> 2]; - oval = (value[0] << 4) & 0x30; - if (vlen > 1) oval |= value[1] >> 4; - *out++ = basis_64[oval]; - *out++ = (vlen < 2) ? '=' : basis_64[(value[1] << 2) & 0x3C]; - *out++ = '='; - } - *out = '\0'; - - return result; -} - -// base64_decode : base64 decode -// -// value : c-str to decode -// rlen : length of decoded result -// (result) : new unsigned char[] - decoded result -unsigned char *base64_decode(const char *value, int *rlen) -{ - int c1, c2, c3, c4; - int vlen = (int)strlen(value); - unsigned char *result =(unsigned char *)malloc((vlen * 3) / 4 + 1); - unsigned char *out = result; - *rlen = 0; - - while (1) - { - if (value[0]==0) - return result; - c1 = value[0]; - if (CHAR64(c1) == -1) - goto base64_decode_error;; - c2 = value[1]; - if (CHAR64(c2) == -1) - goto base64_decode_error;; - c3 = value[2]; - if ((c3 != '=') && (CHAR64(c3) == -1)) - goto base64_decode_error;; - c4 = value[3]; - if ((c4 != '=') && (CHAR64(c4) == -1)) - goto base64_decode_error;; - - value += 4; - *out++ = (CHAR64(c1) << 2) | (CHAR64(c2) >> 4); - *rlen += 1; - if (c3 != '=') - { - *out++ = ((CHAR64(c2) << 4) & 0xf0) | (CHAR64(c3) >> 2); - *rlen += 1; - if (c4 != '=') - { - *out++ = ((CHAR64(c3) << 6) & 0xc0) | CHAR64(c4); - *rlen += 1; - } - } - } - -base64_decode_error: - *result = 0; - *rlen = 0; - return result; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h deleted file mode 100644 index f0e1f061..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/base64.h +++ /dev/null @@ -1,18 +0,0 @@ -/** - * Copyright (c) 2006-2008 Apple Inc. All rights reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - **/ - -char *base64_encode(const unsigned char *value, int vlen); -unsigned char *base64_decode(const char *value, int *rlen); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc deleted file mode 100644 index c7b583f5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.cc +++ /dev/null @@ -1,51 +0,0 @@ -#include "kerberos.h" -#include -#include -#include "base64.h" -#include "wrappers/security_buffer.h" -#include "wrappers/security_buffer_descriptor.h" -#include "wrappers/security_context.h" -#include "wrappers/security_credentials.h" - -Nan::Persistent Kerberos::constructor_template; - -Kerberos::Kerberos() : Nan::ObjectWrap() { -} - -void Kerberos::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("Kerberos").ToLocalChecked()); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - Nan::Set(target, Nan::New("Kerberos").ToLocalChecked(), t->GetFunction()); -} - -NAN_METHOD(Kerberos::New) { - // Load the security.dll library - load_library(); - // Create a Kerberos instance - Kerberos *kerberos = new Kerberos(); - // Return the kerberos object - kerberos->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -// Exporting function -NAN_MODULE_INIT(init) { - Kerberos::Initialize(target); - SecurityContext::Initialize(target); - SecurityBuffer::Initialize(target); - SecurityBufferDescriptor::Initialize(target); - SecurityCredentials::Initialize(target); -} - -NODE_MODULE(kerberos, init); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h deleted file mode 100644 index 0fd27604..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos.h +++ /dev/null @@ -1,60 +0,0 @@ -#ifndef KERBEROS_H -#define KERBEROS_H - -#include -#include -#include -#include "nan.h" - -extern "C" { - #include "kerberos_sspi.h" - #include "base64.h" -} - -using namespace v8; -using namespace node; - -class Kerberos : public Nan::ObjectWrap { - -public: - Kerberos(); - ~Kerberos() {}; - - // Constructor used for creating new Kerberos objects from C++ - static Nan::Persistent constructor_template; - - // Initialize function for the object - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - - // Method available - static NAN_METHOD(AcquireAlternateCredentials); - static NAN_METHOD(PrepareOutboundPackage); - static NAN_METHOD(DecryptMessage); - static NAN_METHOD(EncryptMessage); - static NAN_METHOD(QueryContextAttributes); - -private: - static NAN_METHOD(New); - - // Pointer to context object - SEC_WINNT_AUTH_IDENTITY m_Identity; - // credentials - CredHandle m_Credentials; - // Expiry time for ticket - TimeStamp Expiration; - // package info - SecPkgInfo m_PkgInfo; - // context - CtxtHandle m_Context; - // Do we have a context - bool m_HaveContext; - // Attributes - DWORD CtxtAttr; - - // Handles the uv calls - static void Process(uv_work_t* work_req); - // Called after work is done - static void After(uv_work_t* work_req); -}; - -#endif \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c deleted file mode 100644 index d75c9ab0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.c +++ /dev/null @@ -1,244 +0,0 @@ -#include "kerberos_sspi.h" -#include -#include - -static HINSTANCE _sspi_security_dll = NULL; -static HINSTANCE _sspi_secur32_dll = NULL; - -/** - * Encrypt A Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_EncryptMessage(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo) { - // Create function pointer instance - encryptMessage_fn pfn_encryptMessage = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - // Map function to library method - pfn_encryptMessage = (encryptMessage_fn)GetProcAddress(_sspi_security_dll, "EncryptMessage"); - // Check if the we managed to map function pointer - if(!pfn_encryptMessage) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_encryptMessage)(phContext, fQOP, pMessage, MessageSeqNo); -} - -/** - * Acquire Credentials - */ -SECURITY_STATUS SEC_ENTRY _sspi_AcquireCredentialsHandle( - LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse, - void * pvLogonId, void * pAuthData, SEC_GET_KEY_FN pGetKeyFn, void * pvGetKeyArgument, - PCredHandle phCredential, PTimeStamp ptsExpiry -) { - SECURITY_STATUS status; - // Create function pointer instance - acquireCredentialsHandle_fn pfn_acquireCredentialsHandle = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - // Map function - #ifdef _UNICODE - pfn_acquireCredentialsHandle = (acquireCredentialsHandle_fn)GetProcAddress(_sspi_security_dll, "AcquireCredentialsHandleW"); - #else - pfn_acquireCredentialsHandle = (acquireCredentialsHandle_fn)GetProcAddress(_sspi_security_dll, "AcquireCredentialsHandleA"); - #endif - - // Check if the we managed to map function pointer - if(!pfn_acquireCredentialsHandle) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Status - status = (*pfn_acquireCredentialsHandle)(pszPrincipal, pszPackage, fCredentialUse, - pvLogonId, pAuthData, pGetKeyFn, pvGetKeyArgument, phCredential, ptsExpiry - ); - - // Call the function - return status; -} - -/** - * Delete Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_DeleteSecurityContext(PCtxtHandle phContext) { - // Create function pointer instance - deleteSecurityContext_fn pfn_deleteSecurityContext = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - // Map function - pfn_deleteSecurityContext = (deleteSecurityContext_fn)GetProcAddress(_sspi_security_dll, "DeleteSecurityContext"); - - // Check if the we managed to map function pointer - if(!pfn_deleteSecurityContext) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_deleteSecurityContext)(phContext); -} - -/** - * Decrypt Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, unsigned long MessageSeqNo, unsigned long pfQOP) { - // Create function pointer instance - decryptMessage_fn pfn_decryptMessage = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - // Map function - pfn_decryptMessage = (decryptMessage_fn)GetProcAddress(_sspi_security_dll, "DecryptMessage"); - - // Check if the we managed to map function pointer - if(!pfn_decryptMessage) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_decryptMessage)(phContext, pMessage, MessageSeqNo, pfQOP); -} - -/** - * Initialize Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_initializeSecurityContext( - PCredHandle phCredential, PCtxtHandle phContext, - LPSTR pszTargetName, unsigned long fContextReq, - unsigned long Reserved1, unsigned long TargetDataRep, - PSecBufferDesc pInput, unsigned long Reserved2, - PCtxtHandle phNewContext, PSecBufferDesc pOutput, - unsigned long * pfContextAttr, PTimeStamp ptsExpiry -) { - SECURITY_STATUS status; - // Create function pointer instance - initializeSecurityContext_fn pfn_initializeSecurityContext = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - // Map function - #ifdef _UNICODE - pfn_initializeSecurityContext = (initializeSecurityContext_fn)GetProcAddress(_sspi_security_dll, "InitializeSecurityContextW"); - #else - pfn_initializeSecurityContext = (initializeSecurityContext_fn)GetProcAddress(_sspi_security_dll, "InitializeSecurityContextA"); - #endif - - // Check if the we managed to map function pointer - if(!pfn_initializeSecurityContext) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Execute intialize context - status = (*pfn_initializeSecurityContext)( - phCredential, phContext, pszTargetName, fContextReq, - Reserved1, TargetDataRep, pInput, Reserved2, - phNewContext, pOutput, pfContextAttr, ptsExpiry - ); - - // Call the function - return status; -} -/** - * Query Context Attributes - */ -SECURITY_STATUS SEC_ENTRY _sspi_QueryContextAttributes( - PCtxtHandle phContext, unsigned long ulAttribute, void * pBuffer -) { - // Create function pointer instance - queryContextAttributes_fn pfn_queryContextAttributes = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return -1; - - #ifdef _UNICODE - pfn_queryContextAttributes = (queryContextAttributes_fn)GetProcAddress(_sspi_security_dll, "QueryContextAttributesW"); - #else - pfn_queryContextAttributes = (queryContextAttributes_fn)GetProcAddress(_sspi_security_dll, "QueryContextAttributesA"); - #endif - - // Check if the we managed to map function pointer - if(!pfn_queryContextAttributes) { - printf("GetProcAddress failed.\n"); - return -2; - } - - // Call the function - return (*pfn_queryContextAttributes)( - phContext, ulAttribute, pBuffer - ); -} - -/** - * InitSecurityInterface - */ -PSecurityFunctionTable _ssip_InitSecurityInterface() { - INIT_SECURITY_INTERFACE InitSecurityInterface; - PSecurityFunctionTable pSecurityInterface = NULL; - - // Return error if library not loaded - if(_sspi_security_dll == NULL) return NULL; - - #ifdef _UNICODE - // Get the address of the InitSecurityInterface function. - InitSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress ( - _sspi_secur32_dll, - TEXT("InitSecurityInterfaceW")); - #else - // Get the address of the InitSecurityInterface function. - InitSecurityInterface = (INIT_SECURITY_INTERFACE) GetProcAddress ( - _sspi_secur32_dll, - TEXT("InitSecurityInterfaceA")); - #endif - - if(!InitSecurityInterface) { - printf (TEXT("Failed in getting the function address, Error: %x"), GetLastError ()); - return NULL; - } - - // Use InitSecurityInterface to get the function table. - pSecurityInterface = (*InitSecurityInterface)(); - - if(!pSecurityInterface) { - printf (TEXT("Failed in getting the function table, Error: %x"), GetLastError ()); - return NULL; - } - - return pSecurityInterface; -} - -/** - * Load security.dll dynamically - */ -int load_library() { - DWORD err; - // Load the library - _sspi_security_dll = LoadLibrary("security.dll"); - - // Check if the library loaded - if(_sspi_security_dll == NULL) { - err = GetLastError(); - return err; - } - - // Load the library - _sspi_secur32_dll = LoadLibrary("secur32.dll"); - - // Check if the library loaded - if(_sspi_secur32_dll == NULL) { - err = GetLastError(); - return err; - } - - return 0; -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h deleted file mode 100644 index a3008dc5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/kerberos_sspi.h +++ /dev/null @@ -1,106 +0,0 @@ -#ifndef SSPI_C_H -#define SSPI_C_H - -#define SECURITY_WIN32 1 - -#include -#include - -/** - * Encrypt A Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_EncryptMessage(PCtxtHandle phContext, unsigned long fQOP, PSecBufferDesc pMessage, unsigned long MessageSeqNo); - -typedef DWORD (WINAPI *encryptMessage_fn)(PCtxtHandle phContext, ULONG fQOP, PSecBufferDesc pMessage, ULONG MessageSeqNo); - -/** - * Acquire Credentials - */ -SECURITY_STATUS SEC_ENTRY _sspi_AcquireCredentialsHandle( - LPSTR pszPrincipal, // Name of principal - LPSTR pszPackage, // Name of package - unsigned long fCredentialUse, // Flags indicating use - void * pvLogonId, // Pointer to logon ID - void * pAuthData, // Package specific data - SEC_GET_KEY_FN pGetKeyFn, // Pointer to GetKey() func - void * pvGetKeyArgument, // Value to pass to GetKey() - PCredHandle phCredential, // (out) Cred Handle - PTimeStamp ptsExpiry // (out) Lifetime (optional) -); - -typedef DWORD (WINAPI *acquireCredentialsHandle_fn)( - LPSTR pszPrincipal, LPSTR pszPackage, unsigned long fCredentialUse, - void * pvLogonId, void * pAuthData, SEC_GET_KEY_FN pGetKeyFn, void * pvGetKeyArgument, - PCredHandle phCredential, PTimeStamp ptsExpiry - ); - -/** - * Delete Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_DeleteSecurityContext( - PCtxtHandle phContext // Context to delete -); - -typedef DWORD (WINAPI *deleteSecurityContext_fn)(PCtxtHandle phContext); - -/** - * Decrypt Message - */ -SECURITY_STATUS SEC_ENTRY _sspi_DecryptMessage( - PCtxtHandle phContext, - PSecBufferDesc pMessage, - unsigned long MessageSeqNo, - unsigned long pfQOP -); - -typedef DWORD (WINAPI *decryptMessage_fn)( - PCtxtHandle phContext, PSecBufferDesc pMessage, unsigned long MessageSeqNo, unsigned long pfQOP); - -/** - * Initialize Security Context - */ -SECURITY_STATUS SEC_ENTRY _sspi_initializeSecurityContext( - PCredHandle phCredential, // Cred to base context - PCtxtHandle phContext, // Existing context (OPT) - LPSTR pszTargetName, // Name of target - unsigned long fContextReq, // Context Requirements - unsigned long Reserved1, // Reserved, MBZ - unsigned long TargetDataRep, // Data rep of target - PSecBufferDesc pInput, // Input Buffers - unsigned long Reserved2, // Reserved, MBZ - PCtxtHandle phNewContext, // (out) New Context handle - PSecBufferDesc pOutput, // (inout) Output Buffers - unsigned long * pfContextAttr, // (out) Context attrs - PTimeStamp ptsExpiry // (out) Life span (OPT) -); - -typedef DWORD (WINAPI *initializeSecurityContext_fn)( - PCredHandle phCredential, PCtxtHandle phContext, LPSTR pszTargetName, unsigned long fContextReq, - unsigned long Reserved1, unsigned long TargetDataRep, PSecBufferDesc pInput, unsigned long Reserved2, - PCtxtHandle phNewContext, PSecBufferDesc pOutput, unsigned long * pfContextAttr, PTimeStamp ptsExpiry); - -/** - * Query Context Attributes - */ -SECURITY_STATUS SEC_ENTRY _sspi_QueryContextAttributes( - PCtxtHandle phContext, // Context to query - unsigned long ulAttribute, // Attribute to query - void * pBuffer // Buffer for attributes -); - -typedef DWORD (WINAPI *queryContextAttributes_fn)( - PCtxtHandle phContext, unsigned long ulAttribute, void * pBuffer); - -/** - * InitSecurityInterface - */ -PSecurityFunctionTable _ssip_InitSecurityInterface(); - -typedef DWORD (WINAPI *initSecurityInterface_fn) (); - -/** - * Load security.dll dynamically - */ -int load_library(); - -#endif \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc deleted file mode 100644 index e7a472f6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "worker.h" - -Worker::Worker() { -} - -Worker::~Worker() { -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h deleted file mode 100644 index c2ccb6b5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/worker.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef WORKER_H_ -#define WORKER_H_ - -#include -#include -#include -#include - -using namespace node; -using namespace v8; - -class Worker { - public: - Worker(); - virtual ~Worker(); - - // libuv's request struct. - uv_work_t request; - // Callback - Nan::Callback *callback; - // Parameters - void *parameters; - // Results - void *return_value; - // Did we raise an error - bool error; - // The error message - char *error_message; - // Error code if not message - int error_code; - // Any return code - int return_code; - // Method we are going to fire - void (*execute)(Worker *worker); - Local (*mapper)(Worker *worker); -}; - -#endif // WORKER_H_ diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc deleted file mode 100644 index fdf8e491..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.cc +++ /dev/null @@ -1,101 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "security_buffer.h" - -using namespace node; - -Nan::Persistent SecurityBuffer::constructor_template; - -SecurityBuffer::SecurityBuffer(uint32_t security_type, size_t size) : Nan::ObjectWrap() { - this->size = size; - this->data = calloc(size, sizeof(char)); - this->security_type = security_type; - // Set up the data in the sec_buffer - this->sec_buffer.BufferType = security_type; - this->sec_buffer.cbBuffer = (unsigned long)size; - this->sec_buffer.pvBuffer = this->data; -} - -SecurityBuffer::SecurityBuffer(uint32_t security_type, size_t size, void *data) : Nan::ObjectWrap() { - this->size = size; - this->data = data; - this->security_type = security_type; - // Set up the data in the sec_buffer - this->sec_buffer.BufferType = security_type; - this->sec_buffer.cbBuffer = (unsigned long)size; - this->sec_buffer.pvBuffer = this->data; -} - -SecurityBuffer::~SecurityBuffer() { - free(this->data); -} - -NAN_METHOD(SecurityBuffer::New) { - SecurityBuffer *security_obj; - - if(info.Length() != 2) - return Nan::ThrowError("Two parameters needed integer buffer type and [32 bit integer/Buffer] required"); - - if(!info[0]->IsInt32()) - return Nan::ThrowError("Two parameters needed integer buffer type and [32 bit integer/Buffer] required"); - - if(!info[1]->IsInt32() && !Buffer::HasInstance(info[1])) - return Nan::ThrowError("Two parameters needed integer buffer type and [32 bit integer/Buffer] required"); - - // Unpack buffer type - uint32_t buffer_type = info[0]->ToUint32()->Value(); - - // If we have an integer - if(info[1]->IsInt32()) { - security_obj = new SecurityBuffer(buffer_type, info[1]->ToUint32()->Value()); - } else { - // Get the length of the Buffer - size_t length = Buffer::Length(info[1]->ToObject()); - // Allocate space for the internal void data pointer - void *data = calloc(length, sizeof(char)); - // Write the data to out of V8 heap space - memcpy(data, Buffer::Data(info[1]->ToObject()), length); - // Create new SecurityBuffer - security_obj = new SecurityBuffer(buffer_type, length, data); - } - - // Wrap it - security_obj->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -NAN_METHOD(SecurityBuffer::ToBuffer) { - // Unpack the Security Buffer object - SecurityBuffer *security_obj = Nan::ObjectWrap::Unwrap(info.This()); - // Create a Buffer - Local buffer = Nan::CopyBuffer((char *)security_obj->data, (uint32_t)security_obj->size).ToLocalChecked(); - // Return the buffer - info.GetReturnValue().Set(buffer); -} - -void SecurityBuffer::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityBuffer").ToLocalChecked()); - - // Class methods - Nan::SetPrototypeMethod(t, "toBuffer", ToBuffer); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityBuffer").ToLocalChecked(), t->GetFunction()); -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h deleted file mode 100644 index 0c97d564..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.h +++ /dev/null @@ -1,48 +0,0 @@ -#ifndef SECURITY_BUFFER_H -#define SECURITY_BUFFER_H - -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include -#include -#include -#include - -using namespace v8; -using namespace node; - -class SecurityBuffer : public Nan::ObjectWrap { - public: - SecurityBuffer(uint32_t security_type, size_t size); - SecurityBuffer(uint32_t security_type, size_t size, void *data); - ~SecurityBuffer(); - - // Internal values - void *data; - size_t size; - uint32_t security_type; - SecBuffer sec_buffer; - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(ToBuffer); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - private: - static NAN_METHOD(New); -}; - -#endif \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js deleted file mode 100644 index 4996163c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer.js +++ /dev/null @@ -1,12 +0,0 @@ -var SecurityBufferNative = require('../../../build/Release/kerberos').SecurityBuffer; - -// Add some attributes -SecurityBufferNative.VERSION = 0; -SecurityBufferNative.EMPTY = 0; -SecurityBufferNative.DATA = 1; -SecurityBufferNative.TOKEN = 2; -SecurityBufferNative.PADDING = 9; -SecurityBufferNative.STREAM = 10; - -// Export the modified class -exports.SecurityBuffer = SecurityBufferNative; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc deleted file mode 100644 index fce0d81c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.cc +++ /dev/null @@ -1,182 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include "security_buffer_descriptor.h" -#include "security_buffer.h" - -Nan::Persistent SecurityBufferDescriptor::constructor_template; - -SecurityBufferDescriptor::SecurityBufferDescriptor() : Nan::ObjectWrap() { -} - -SecurityBufferDescriptor::SecurityBufferDescriptor(const Nan::Persistent& arrayObjectPersistent) : Nan::ObjectWrap() { - SecurityBuffer *security_obj = NULL; - // Get the Local value - Local arrayObject = Nan::New(arrayObjectPersistent); - - // Safe reference to array - this->arrayObject = arrayObject; - - // Unpack the array and ensure we have a valid descriptor - this->secBufferDesc.cBuffers = arrayObject->Length(); - this->secBufferDesc.ulVersion = SECBUFFER_VERSION; - - if(arrayObject->Length() == 1) { - // Unwrap the buffer - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(0)->ToObject()); - // Assign the buffer - this->secBufferDesc.pBuffers = &security_obj->sec_buffer; - } else { - this->secBufferDesc.pBuffers = new SecBuffer[arrayObject->Length()]; - this->secBufferDesc.cBuffers = arrayObject->Length(); - - // Assign the buffers - for(uint32_t i = 0; i < arrayObject->Length(); i++) { - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(i)->ToObject()); - this->secBufferDesc.pBuffers[i].BufferType = security_obj->sec_buffer.BufferType; - this->secBufferDesc.pBuffers[i].pvBuffer = security_obj->sec_buffer.pvBuffer; - this->secBufferDesc.pBuffers[i].cbBuffer = security_obj->sec_buffer.cbBuffer; - } - } -} - -SecurityBufferDescriptor::~SecurityBufferDescriptor() { -} - -size_t SecurityBufferDescriptor::bufferSize() { - SecurityBuffer *security_obj = NULL; - - if(this->secBufferDesc.cBuffers == 1) { - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(0)->ToObject()); - return security_obj->size; - } else { - int bytesToAllocate = 0; - - for(unsigned int i = 0; i < this->secBufferDesc.cBuffers; i++) { - bytesToAllocate += this->secBufferDesc.pBuffers[i].cbBuffer; - } - - // Return total size - return bytesToAllocate; - } -} - -char *SecurityBufferDescriptor::toBuffer() { - SecurityBuffer *security_obj = NULL; - char *data = NULL; - - if(this->secBufferDesc.cBuffers == 1) { - security_obj = Nan::ObjectWrap::Unwrap(arrayObject->Get(0)->ToObject()); - data = (char *)malloc(security_obj->size * sizeof(char)); - memcpy(data, security_obj->data, security_obj->size); - } else { - size_t bytesToAllocate = this->bufferSize(); - char *data = (char *)calloc(bytesToAllocate, sizeof(char)); - int offset = 0; - - for(unsigned int i = 0; i < this->secBufferDesc.cBuffers; i++) { - memcpy((data + offset), this->secBufferDesc.pBuffers[i].pvBuffer, this->secBufferDesc.pBuffers[i].cbBuffer); - offset +=this->secBufferDesc.pBuffers[i].cbBuffer; - } - - // Return the data - return data; - } - - return data; -} - -NAN_METHOD(SecurityBufferDescriptor::New) { - SecurityBufferDescriptor *security_obj; - Nan::Persistent arrayObject; - - if(info.Length() != 1) - return Nan::ThrowError("There must be 1 argument passed in where the first argument is a [int32 or an Array of SecurityBuffers]"); - - if(!info[0]->IsInt32() && !info[0]->IsArray()) - return Nan::ThrowError("There must be 1 argument passed in where the first argument is a [int32 or an Array of SecurityBuffers]"); - - if(info[0]->IsArray()) { - Local array = Local::Cast(info[0]); - // Iterate over all items and ensure we the right type - for(uint32_t i = 0; i < array->Length(); i++) { - if(!SecurityBuffer::HasInstance(array->Get(i))) { - return Nan::ThrowError("There must be 1 argument passed in where the first argument is a [int32 or an Array of SecurityBuffers]"); - } - } - } - - // We have a single integer - if(info[0]->IsInt32()) { - // Create new SecurityBuffer instance - Local argv[] = {Nan::New(0x02), info[0]}; - Local security_buffer = Nan::New(SecurityBuffer::constructor_template)->GetFunction()->NewInstance(2, argv); - // Create a new array - Local array = Nan::New(1); - // Set the first value - array->Set(0, security_buffer); - - // Create persistent handle - Nan::Persistent persistenHandler; - persistenHandler.Reset(array); - - // Create descriptor - security_obj = new SecurityBufferDescriptor(persistenHandler); - } else { - // Create a persistent handler - Nan::Persistent persistenHandler; - persistenHandler.Reset(Local::Cast(info[0])); - // Create a descriptor - security_obj = new SecurityBufferDescriptor(persistenHandler); - } - - // Wrap it - security_obj->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -NAN_METHOD(SecurityBufferDescriptor::ToBuffer) { - // Unpack the Security Buffer object - SecurityBufferDescriptor *security_obj = Nan::ObjectWrap::Unwrap(info.This()); - - // Get the buffer - char *buffer_data = security_obj->toBuffer(); - size_t buffer_size = security_obj->bufferSize(); - - // Create a Buffer - Local buffer = Nan::CopyBuffer(buffer_data, (uint32_t)buffer_size).ToLocalChecked(); - - // Return the buffer - info.GetReturnValue().Set(buffer); -} - -void SecurityBufferDescriptor::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityBufferDescriptor").ToLocalChecked()); - - // Class methods - Nan::SetPrototypeMethod(t, "toBuffer", ToBuffer); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityBufferDescriptor").ToLocalChecked(), t->GetFunction()); -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h deleted file mode 100644 index dc28f7e1..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.h +++ /dev/null @@ -1,46 +0,0 @@ -#ifndef SECURITY_BUFFER_DESCRIPTOR_H -#define SECURITY_BUFFER_DESCRIPTOR_H - -#include -#include -#include - -#include -#include -#include -#include - -using namespace v8; -using namespace node; - -class SecurityBufferDescriptor : public Nan::ObjectWrap { - public: - Local arrayObject; - SecBufferDesc secBufferDesc; - - SecurityBufferDescriptor(); - SecurityBufferDescriptor(const Nan::Persistent& arrayObjectPersistent); - ~SecurityBufferDescriptor(); - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - char *toBuffer(); - size_t bufferSize(); - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(ToBuffer); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - private: - static NAN_METHOD(New); -}; - -#endif \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js deleted file mode 100644 index 9421392e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_buffer_descriptor.js +++ /dev/null @@ -1,3 +0,0 @@ -var SecurityBufferDescriptorNative = require('../../../build/Release/kerberos').SecurityBufferDescriptor; -// Export the modified class -exports.SecurityBufferDescriptor = SecurityBufferDescriptorNative; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc deleted file mode 100644 index 5d7ad549..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.cc +++ /dev/null @@ -1,856 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "security_context.h" -#include "security_buffer_descriptor.h" - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) -#endif - -static LPSTR DisplaySECError(DWORD ErrCode); - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// UV Lib callbacks -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void Process(uv_work_t* work_req) { - // Grab the worker - Worker *worker = static_cast(work_req->data); - // Execute the worker code - worker->execute(worker); -} - -static void After(uv_work_t* work_req) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Get the worker reference - Worker *worker = static_cast(work_req->data); - - // If we have an error - if(worker->error) { - Local err = v8::Exception::Error(Nan::New(worker->error_message).ToLocalChecked()); - Local obj = err->ToObject(); - obj->Set(Nan::New("code").ToLocalChecked(), Nan::New(worker->error_code)); - Local info[2] = { err, Nan::Null() }; - // Execute the error - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } else { - // // Map the data - Local result = worker->mapper(worker); - // Set up the callback with a null first - Local info[2] = { Nan::Null(), result}; - // Wrap the callback function call in a TryCatch so that we can call - // node's FatalException afterwards. This makes it possible to catch - // the exception from JavaScript land using the - // process.on('uncaughtException') event. - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } - - // Clean up the memory - delete worker->callback; - delete worker; -} - -Nan::Persistent SecurityContext::constructor_template; - -SecurityContext::SecurityContext() : Nan::ObjectWrap() { -} - -SecurityContext::~SecurityContext() { - if(this->hasContext) { - _sspi_DeleteSecurityContext(&this->m_Context); - } -} - -NAN_METHOD(SecurityContext::New) { - PSecurityFunctionTable pSecurityInterface = NULL; - DWORD dwNumOfPkgs; - SECURITY_STATUS status; - - // Create code object - SecurityContext *security_obj = new SecurityContext(); - // Get security table interface - pSecurityInterface = _ssip_InitSecurityInterface(); - // Call the security interface - status = (*pSecurityInterface->EnumerateSecurityPackages)( - &dwNumOfPkgs, - &security_obj->m_PkgInfo); - if(status != SEC_E_OK) { - printf(TEXT("Failed in retrieving security packages, Error: %x"), GetLastError()); - return Nan::ThrowError("Failed in retrieving security packages"); - } - - // Wrap it - security_obj->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -// -// Async InitializeContext -// -typedef struct SecurityContextStaticInitializeCall { - char *service_principal_name_str; - char *decoded_input_str; - int decoded_input_str_length; - SecurityContext *context; -} SecurityContextStaticInitializeCall; - -static void _initializeContext(Worker *worker) { - // Status of operation - SECURITY_STATUS status; - BYTE *out_bound_data_str = NULL; - SecurityContextStaticInitializeCall *call = (SecurityContextStaticInitializeCall *)worker->parameters; - - // Structures used for c calls - SecBufferDesc ibd, obd; - SecBuffer ib, ob; - - // - // Prepare data structure for returned data from SSPI - ob.BufferType = SECBUFFER_TOKEN; - ob.cbBuffer = call->context->m_PkgInfo->cbMaxToken; - // Allocate space for return data - out_bound_data_str = new BYTE[ob.cbBuffer + sizeof(DWORD)]; - ob.pvBuffer = out_bound_data_str; - // prepare buffer description - obd.cBuffers = 1; - obd.ulVersion = SECBUFFER_VERSION; - obd.pBuffers = &ob; - - // - // Prepare the data we are passing to the SSPI method - if(call->decoded_input_str_length > 0) { - ib.BufferType = SECBUFFER_TOKEN; - ib.cbBuffer = call->decoded_input_str_length; - ib.pvBuffer = call->decoded_input_str; - // prepare buffer description - ibd.cBuffers = 1; - ibd.ulVersion = SECBUFFER_VERSION; - ibd.pBuffers = &ib; - } - - // Perform initialization step - status = _sspi_initializeSecurityContext( - &call->context->security_credentials->m_Credentials - , NULL - , const_cast(call->service_principal_name_str) - , 0x02 // MUTUAL - , 0 - , 0 // Network - , call->decoded_input_str_length > 0 ? &ibd : NULL - , 0 - , &call->context->m_Context - , &obd - , &call->context->CtxtAttr - , &call->context->Expiration - ); - - // If we have a ok or continue let's prepare the result - if(status == SEC_E_OK - || status == SEC_I_COMPLETE_NEEDED - || status == SEC_I_CONTINUE_NEEDED - || status == SEC_I_COMPLETE_AND_CONTINUE - ) { - call->context->hasContext = true; - call->context->payload = base64_encode((const unsigned char *)ob.pvBuffer, ob.cbBuffer); - - // Set the context - worker->return_code = status; - worker->return_value = call->context; - } else if(status == SEC_E_INSUFFICIENT_MEMORY) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INSUFFICIENT_MEMORY There is not enough memory available to complete the requested action."; - } else if(status == SEC_E_INTERNAL_ERROR) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INTERNAL_ERROR An error occurred that did not map to an SSPI error code."; - } else if(status == SEC_E_INVALID_HANDLE) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INVALID_HANDLE The handle passed to the function is not valid."; - } else if(status == SEC_E_INVALID_TOKEN) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_INVALID_TOKEN The error is due to a malformed input token, such as a token corrupted in transit, a token of incorrect size, or a token passed into the wrong security package. Passing a token to the wrong package can happen if the client and server did not negotiate the proper security package."; - } else if(status == SEC_E_LOGON_DENIED) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_LOGON_DENIED The logon failed."; - } else if(status == SEC_E_NO_AUTHENTICATING_AUTHORITY) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_NO_AUTHENTICATING_AUTHORITY No authority could be contacted for authentication. The domain name of the authenticating party could be wrong, the domain could be unreachable, or there might have been a trust relationship failure."; - } else if(status == SEC_E_NO_CREDENTIALS) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_NO_CREDENTIALS No credentials are available in the security package."; - } else if(status == SEC_E_TARGET_UNKNOWN) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_TARGET_UNKNOWN The target was not recognized."; - } else if(status == SEC_E_UNSUPPORTED_FUNCTION) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_UNSUPPORTED_FUNCTION A context attribute flag that is not valid (ISC_REQ_DELEGATE or ISC_REQ_PROMPT_FOR_CREDS) was specified in the fContextReq parameter."; - } else if(status == SEC_E_WRONG_PRINCIPAL) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = "SEC_E_WRONG_PRINCIPAL The principal that received the authentication request is not the same as the one passed into the pszTargetName parameter. This indicates a failure in mutual authentication."; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } - - // Clean up data - if(call->decoded_input_str != NULL) free(call->decoded_input_str); - if(call->service_principal_name_str != NULL) free(call->service_principal_name_str); -} - -static Local _map_initializeContext(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::InitializeContext) { - char *service_principal_name_str = NULL, *input_str = NULL, *decoded_input_str = NULL; - int decoded_input_str_length = NULL; - // Store reference to security credentials - SecurityCredentials *security_credentials = NULL; - - // We need 3 parameters - if(info.Length() != 4) - return Nan::ThrowError("Initialize must be called with [credential:SecurityCredential, servicePrincipalName:string, input:string, callback:function]"); - - // First parameter must be an instance of SecurityCredentials - if(!SecurityCredentials::HasInstance(info[0])) - return Nan::ThrowError("First parameter for Initialize must be an instance of SecurityCredentials"); - - // Second parameter must be a string - if(!info[1]->IsString()) - return Nan::ThrowError("Second parameter for Initialize must be a string"); - - // Third parameter must be a base64 encoded string - if(!info[2]->IsString()) - return Nan::ThrowError("Second parameter for Initialize must be a string"); - - // Third parameter must be a callback - if(!info[3]->IsFunction()) - return Nan::ThrowError("Third parameter for Initialize must be a callback function"); - - // Let's unpack the values - Local service_principal_name = info[1]->ToString(); - service_principal_name_str = (char *)calloc(service_principal_name->Utf8Length() + 1, sizeof(char)); - service_principal_name->WriteUtf8(service_principal_name_str); - - // Unpack the user name - Local input = info[2]->ToString(); - - if(input->Utf8Length() > 0) { - input_str = (char *)calloc(input->Utf8Length() + 1, sizeof(char)); - input->WriteUtf8(input_str); - - // Now let's get the base64 decoded string - decoded_input_str = (char *)base64_decode(input_str, &decoded_input_str_length); - // Free original allocation - free(input_str); - } - - // Unpack the Security credentials - security_credentials = Nan::ObjectWrap::Unwrap(info[0]->ToObject()); - // Create Security context instance - Local security_context_value = Nan::New(constructor_template)->GetFunction()->NewInstance(); - // Unwrap the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(security_context_value); - // Add a reference to the security_credentials - security_context->security_credentials = security_credentials; - - // Build the call function - SecurityContextStaticInitializeCall *call = (SecurityContextStaticInitializeCall *)calloc(1, sizeof(SecurityContextStaticInitializeCall)); - call->context = security_context; - call->decoded_input_str = decoded_input_str; - call->decoded_input_str_length = decoded_input_str_length; - call->service_principal_name_str = service_principal_name_str; - - // Callback - Local callback = Local::Cast(info[3]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _initializeContext; - worker->mapper = _map_initializeContext; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -NAN_GETTER(SecurityContext::PayloadGetter) { - // Unpack the context object - SecurityContext *context = Nan::ObjectWrap::Unwrap(info.This()); - // Return the low bits - info.GetReturnValue().Set(Nan::New(context->payload).ToLocalChecked()); -} - -NAN_GETTER(SecurityContext::HasContextGetter) { - // Unpack the context object - SecurityContext *context = Nan::ObjectWrap::Unwrap(info.This()); - // Return the low bits - info.GetReturnValue().Set(Nan::New(context->hasContext)); -} - -// -// Async InitializeContextStep -// -typedef struct SecurityContextStepStaticInitializeCall { - char *service_principal_name_str; - char *decoded_input_str; - int decoded_input_str_length; - SecurityContext *context; -} SecurityContextStepStaticInitializeCall; - -static void _initializeContextStep(Worker *worker) { - // Outbound data array - BYTE *out_bound_data_str = NULL; - // Status of operation - SECURITY_STATUS status; - // Unpack data - SecurityContextStepStaticInitializeCall *call = (SecurityContextStepStaticInitializeCall *)worker->parameters; - SecurityContext *context = call->context; - // Structures used for c calls - SecBufferDesc ibd, obd; - SecBuffer ib, ob; - - // - // Prepare data structure for returned data from SSPI - ob.BufferType = SECBUFFER_TOKEN; - ob.cbBuffer = context->m_PkgInfo->cbMaxToken; - // Allocate space for return data - out_bound_data_str = new BYTE[ob.cbBuffer + sizeof(DWORD)]; - ob.pvBuffer = out_bound_data_str; - // prepare buffer description - obd.cBuffers = 1; - obd.ulVersion = SECBUFFER_VERSION; - obd.pBuffers = &ob; - - // - // Prepare the data we are passing to the SSPI method - if(call->decoded_input_str_length > 0) { - ib.BufferType = SECBUFFER_TOKEN; - ib.cbBuffer = call->decoded_input_str_length; - ib.pvBuffer = call->decoded_input_str; - // prepare buffer description - ibd.cBuffers = 1; - ibd.ulVersion = SECBUFFER_VERSION; - ibd.pBuffers = &ib; - } - - // Perform initialization step - status = _sspi_initializeSecurityContext( - &context->security_credentials->m_Credentials - , context->hasContext == true ? &context->m_Context : NULL - , const_cast(call->service_principal_name_str) - , 0x02 // MUTUAL - , 0 - , 0 // Network - , call->decoded_input_str_length ? &ibd : NULL - , 0 - , &context->m_Context - , &obd - , &context->CtxtAttr - , &context->Expiration - ); - - // If we have a ok or continue let's prepare the result - if(status == SEC_E_OK - || status == SEC_I_COMPLETE_NEEDED - || status == SEC_I_CONTINUE_NEEDED - || status == SEC_I_COMPLETE_AND_CONTINUE - ) { - // Set the new payload - if(context->payload != NULL) free(context->payload); - context->payload = base64_encode((const unsigned char *)ob.pvBuffer, ob.cbBuffer); - worker->return_code = status; - worker->return_value = context; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } - - // Clean up data - if(call->decoded_input_str != NULL) free(call->decoded_input_str); - if(call->service_principal_name_str != NULL) free(call->service_principal_name_str); -} - -static Local _map_initializeContextStep(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::InitalizeStep) { - char *service_principal_name_str = NULL, *input_str = NULL, *decoded_input_str = NULL; - int decoded_input_str_length = NULL; - - // We need 3 parameters - if(info.Length() != 3) - return Nan::ThrowError("Initialize must be called with [servicePrincipalName:string, input:string, callback:function]"); - - // Second parameter must be a string - if(!info[0]->IsString()) - return Nan::ThrowError("First parameter for Initialize must be a string"); - - // Third parameter must be a base64 encoded string - if(!info[1]->IsString()) - return Nan::ThrowError("Second parameter for Initialize must be a string"); - - // Third parameter must be a base64 encoded string - if(!info[2]->IsFunction()) - return Nan::ThrowError("Third parameter for Initialize must be a callback function"); - - // Let's unpack the values - Local service_principal_name = info[0]->ToString(); - service_principal_name_str = (char *)calloc(service_principal_name->Utf8Length() + 1, sizeof(char)); - service_principal_name->WriteUtf8(service_principal_name_str); - - // Unpack the user name - Local input = info[1]->ToString(); - - if(input->Utf8Length() > 0) { - input_str = (char *)calloc(input->Utf8Length() + 1, sizeof(char)); - input->WriteUtf8(input_str); - // Now let's get the base64 decoded string - decoded_input_str = (char *)base64_decode(input_str, &decoded_input_str_length); - // Free input string - free(input_str); - } - - // Unwrap the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - - // Create call structure - SecurityContextStepStaticInitializeCall *call = (SecurityContextStepStaticInitializeCall *)calloc(1, sizeof(SecurityContextStepStaticInitializeCall)); - call->context = security_context; - call->decoded_input_str = decoded_input_str; - call->decoded_input_str_length = decoded_input_str_length; - call->service_principal_name_str = service_principal_name_str; - - // Callback - Local callback = Local::Cast(info[2]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _initializeContextStep; - worker->mapper = _map_initializeContextStep; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// -// Async EncryptMessage -// -typedef struct SecurityContextEncryptMessageCall { - SecurityContext *context; - SecurityBufferDescriptor *descriptor; - unsigned long flags; -} SecurityContextEncryptMessageCall; - -static void _encryptMessage(Worker *worker) { - SECURITY_STATUS status; - // Unpack call - SecurityContextEncryptMessageCall *call = (SecurityContextEncryptMessageCall *)worker->parameters; - // Unpack the security context - SecurityContext *context = call->context; - SecurityBufferDescriptor *descriptor = call->descriptor; - - // Let's execute encryption - status = _sspi_EncryptMessage( - &context->m_Context - , call->flags - , &descriptor->secBufferDesc - , 0 - ); - - // We've got ok - if(status == SEC_E_OK) { - int bytesToAllocate = (int)descriptor->bufferSize(); - // Free up existing payload - if(context->payload != NULL) free(context->payload); - // Save the payload - context->payload = base64_encode((unsigned char *)descriptor->toBuffer(), bytesToAllocate); - // Set result - worker->return_code = status; - worker->return_value = context; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } -} - -static Local _map_encryptMessage(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::EncryptMessage) { - if(info.Length() != 3) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - if(!SecurityBufferDescriptor::HasInstance(info[0])) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - if(!info[1]->IsUint32()) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - if(!info[2]->IsFunction()) - return Nan::ThrowError("EncryptMessage takes an instance of SecurityBufferDescriptor, an integer flag and a callback function"); - - // Unpack the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - - // Unpack the descriptor - SecurityBufferDescriptor *descriptor = Nan::ObjectWrap::Unwrap(info[0]->ToObject()); - - // Create call structure - SecurityContextEncryptMessageCall *call = (SecurityContextEncryptMessageCall *)calloc(1, sizeof(SecurityContextEncryptMessageCall)); - call->context = security_context; - call->descriptor = descriptor; - call->flags = (unsigned long)info[1]->ToInteger()->Value(); - - // Callback - Local callback = Local::Cast(info[2]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _encryptMessage; - worker->mapper = _map_encryptMessage; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// -// Async DecryptMessage -// -typedef struct SecurityContextDecryptMessageCall { - SecurityContext *context; - SecurityBufferDescriptor *descriptor; -} SecurityContextDecryptMessageCall; - -static void _decryptMessage(Worker *worker) { - unsigned long quality = 0; - SECURITY_STATUS status; - - // Unpack parameters - SecurityContextDecryptMessageCall *call = (SecurityContextDecryptMessageCall *)worker->parameters; - SecurityContext *context = call->context; - SecurityBufferDescriptor *descriptor = call->descriptor; - - // Let's execute encryption - status = _sspi_DecryptMessage( - &context->m_Context - , &descriptor->secBufferDesc - , 0 - , (unsigned long)&quality - ); - - // We've got ok - if(status == SEC_E_OK) { - int bytesToAllocate = (int)descriptor->bufferSize(); - // Free up existing payload - if(context->payload != NULL) free(context->payload); - // Save the payload - context->payload = base64_encode((unsigned char *)descriptor->toBuffer(), bytesToAllocate); - // Set return values - worker->return_code = status; - worker->return_value = context; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } -} - -static Local _map_decryptMessage(Worker *worker) { - // Unwrap the security context - SecurityContext *context = (SecurityContext *)worker->return_value; - // Return the value - return context->handle(); -} - -NAN_METHOD(SecurityContext::DecryptMessage) { - if(info.Length() != 2) - return Nan::ThrowError("DecryptMessage takes an instance of SecurityBufferDescriptor and a callback function"); - if(!SecurityBufferDescriptor::HasInstance(info[0])) - return Nan::ThrowError("DecryptMessage takes an instance of SecurityBufferDescriptor and a callback function"); - if(!info[1]->IsFunction()) - return Nan::ThrowError("DecryptMessage takes an instance of SecurityBufferDescriptor and a callback function"); - - // Unpack the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - // Unpack the descriptor - SecurityBufferDescriptor *descriptor = Nan::ObjectWrap::Unwrap(info[0]->ToObject()); - // Create call structure - SecurityContextDecryptMessageCall *call = (SecurityContextDecryptMessageCall *)calloc(1, sizeof(SecurityContextDecryptMessageCall)); - call->context = security_context; - call->descriptor = descriptor; - - // Callback - Local callback = Local::Cast(info[1]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _decryptMessage; - worker->mapper = _map_decryptMessage; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -// -// Async QueryContextAttributes -// -typedef struct SecurityContextQueryContextAttributesCall { - SecurityContext *context; - uint32_t attribute; -} SecurityContextQueryContextAttributesCall; - -static void _queryContextAttributes(Worker *worker) { - SECURITY_STATUS status; - - // Cast to data structure - SecurityContextQueryContextAttributesCall *call = (SecurityContextQueryContextAttributesCall *)worker->parameters; - - // Allocate some space - SecPkgContext_Sizes *sizes = (SecPkgContext_Sizes *)calloc(1, sizeof(SecPkgContext_Sizes)); - // Let's grab the query context attribute - status = _sspi_QueryContextAttributes( - &call->context->m_Context, - call->attribute, - sizes - ); - - if(status == SEC_E_OK) { - worker->return_code = status; - worker->return_value = sizes; - } else { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } -} - -static Local _map_queryContextAttributes(Worker *worker) { - // Cast to data structure - SecurityContextQueryContextAttributesCall *call = (SecurityContextQueryContextAttributesCall *)worker->parameters; - // Unpack the attribute - uint32_t attribute = call->attribute; - - // Convert data - if(attribute == SECPKG_ATTR_SIZES) { - SecPkgContext_Sizes *sizes = (SecPkgContext_Sizes *)worker->return_value; - // Create object - Local value = Nan::New(); - value->Set(Nan::New("maxToken").ToLocalChecked(), Nan::New(uint32_t(sizes->cbMaxToken))); - value->Set(Nan::New("maxSignature").ToLocalChecked(), Nan::New(uint32_t(sizes->cbMaxSignature))); - value->Set(Nan::New("blockSize").ToLocalChecked(), Nan::New(uint32_t(sizes->cbBlockSize))); - value->Set(Nan::New("securityTrailer").ToLocalChecked(), Nan::New(uint32_t(sizes->cbSecurityTrailer))); - return value; - } - - // Return the value - return Nan::Null(); -} - -NAN_METHOD(SecurityContext::QueryContextAttributes) { - if(info.Length() != 2) - return Nan::ThrowError("QueryContextAttributes method takes a an integer Attribute specifier and a callback function"); - if(!info[0]->IsInt32()) - return Nan::ThrowError("QueryContextAttributes method takes a an integer Attribute specifier and a callback function"); - if(!info[1]->IsFunction()) - return Nan::ThrowError("QueryContextAttributes method takes a an integer Attribute specifier and a callback function"); - - // Unpack the security context - SecurityContext *security_context = Nan::ObjectWrap::Unwrap(info.This()); - - // Unpack the int value - uint32_t attribute = info[0]->ToInt32()->Value(); - - // Check that we have a supported attribute - if(attribute != SECPKG_ATTR_SIZES) - return Nan::ThrowError("QueryContextAttributes only supports the SECPKG_ATTR_SIZES attribute"); - - // Create call structure - SecurityContextQueryContextAttributesCall *call = (SecurityContextQueryContextAttributesCall *)calloc(1, sizeof(SecurityContextQueryContextAttributesCall)); - call->attribute = attribute; - call->context = security_context; - - // Callback - Local callback = Local::Cast(info[1]); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = new Nan::Callback(callback); - worker->parameters = call; - worker->execute = _queryContextAttributes; - worker->mapper = _map_queryContextAttributes; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, Process, (uv_after_work_cb)After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -void SecurityContext::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(static_cast(SecurityContext::New)); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityContext").ToLocalChecked()); - - // Class methods - Nan::SetMethod(t, "initialize", SecurityContext::InitializeContext); - - // Set up method for the instance - Nan::SetPrototypeMethod(t, "initialize", SecurityContext::InitalizeStep); - Nan::SetPrototypeMethod(t, "decryptMessage", SecurityContext::DecryptMessage); - Nan::SetPrototypeMethod(t, "queryContextAttributes", SecurityContext::QueryContextAttributes); - Nan::SetPrototypeMethod(t, "encryptMessage", SecurityContext::EncryptMessage); - - // Get prototype - Local proto = t->PrototypeTemplate(); - - // Getter for the response - Nan::SetAccessor(proto, Nan::New("payload").ToLocalChecked(), SecurityContext::PayloadGetter); - Nan::SetAccessor(proto, Nan::New("hasContext").ToLocalChecked(), SecurityContext::HasContextGetter); - - // Set persistent - SecurityContext::constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityContext").ToLocalChecked(), t->GetFunction()); -} - -static LPSTR DisplaySECError(DWORD ErrCode) { - LPSTR pszName = NULL; // WinError.h - - switch(ErrCode) { - case SEC_E_BUFFER_TOO_SMALL: - pszName = "SEC_E_BUFFER_TOO_SMALL - The message buffer is too small. Used with the Digest SSP."; - break; - - case SEC_E_CRYPTO_SYSTEM_INVALID: - pszName = "SEC_E_CRYPTO_SYSTEM_INVALID - The cipher chosen for the security context is not supported. Used with the Digest SSP."; - break; - case SEC_E_INCOMPLETE_MESSAGE: - pszName = "SEC_E_INCOMPLETE_MESSAGE - The data in the input buffer is incomplete. The application needs to read more data from the server and call DecryptMessageSync (General) again."; - break; - - case SEC_E_INVALID_HANDLE: - pszName = "SEC_E_INVALID_HANDLE - A context handle that is not valid was specified in the phContext parameter. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_INVALID_TOKEN: - pszName = "SEC_E_INVALID_TOKEN - The buffers are of the wrong type or no buffer of type SECBUFFER_DATA was found. Used with the Schannel SSP."; - break; - - case SEC_E_MESSAGE_ALTERED: - pszName = "SEC_E_MESSAGE_ALTERED - The message has been altered. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_OUT_OF_SEQUENCE: - pszName = "SEC_E_OUT_OF_SEQUENCE - The message was not received in the correct sequence."; - break; - - case SEC_E_QOP_NOT_SUPPORTED: - pszName = "SEC_E_QOP_NOT_SUPPORTED - Neither confidentiality nor integrity are supported by the security context. Used with the Digest SSP."; - break; - - case SEC_I_CONTEXT_EXPIRED: - pszName = "SEC_I_CONTEXT_EXPIRED - The message sender has finished using the connection and has initiated a shutdown."; - break; - - case SEC_I_RENEGOTIATE: - pszName = "SEC_I_RENEGOTIATE - The remote party requires a new handshake sequence or the application has just initiated a shutdown."; - break; - - case SEC_E_ENCRYPT_FAILURE: - pszName = "SEC_E_ENCRYPT_FAILURE - The specified data could not be encrypted."; - break; - - case SEC_E_DECRYPT_FAILURE: - pszName = "SEC_E_DECRYPT_FAILURE - The specified data could not be decrypted."; - break; - case -1: - pszName = "Failed to load security.dll library"; - break; - } - - return pszName; -} - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h deleted file mode 100644 index 1d9387d6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.h +++ /dev/null @@ -1,74 +0,0 @@ -#ifndef SECURITY_CONTEXT_H -#define SECURITY_CONTEXT_H - -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include -#include -#include -#include -#include "security_credentials.h" -#include "../worker.h" -#include - -extern "C" { - #include "../kerberos_sspi.h" - #include "../base64.h" -} - -using namespace v8; -using namespace node; - -class SecurityContext : public Nan::ObjectWrap { - public: - SecurityContext(); - ~SecurityContext(); - - // Security info package - PSecPkgInfo m_PkgInfo; - // Do we have a context - bool hasContext; - // Reference to security credentials - SecurityCredentials *security_credentials; - // Security context - CtxtHandle m_Context; - // Attributes - DWORD CtxtAttr; - // Expiry time for ticket - TimeStamp Expiration; - // Payload - char *payload; - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(InitializeContext); - static NAN_METHOD(InitalizeStep); - static NAN_METHOD(DecryptMessage); - static NAN_METHOD(QueryContextAttributes); - static NAN_METHOD(EncryptMessage); - - // Payload getter - static NAN_GETTER(PayloadGetter); - // hasContext getter - static NAN_GETTER(HasContextGetter); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - // private: - // Create a new instance - static NAN_METHOD(New); -}; - -#endif diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js deleted file mode 100644 index ef04e927..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_context.js +++ /dev/null @@ -1,3 +0,0 @@ -var SecurityContextNative = require('../../../build/Release/kerberos').SecurityContext; -// Export the modified class -exports.SecurityContext = SecurityContextNative; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc deleted file mode 100644 index 732af3f8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.cc +++ /dev/null @@ -1,348 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "security_credentials.h" - -#ifndef ARRAY_SIZE -# define ARRAY_SIZE(a) (sizeof((a)) / sizeof((a)[0])) -#endif - -static LPSTR DisplaySECError(DWORD ErrCode); - -Nan::Persistent SecurityCredentials::constructor_template; - -SecurityCredentials::SecurityCredentials() : Nan::ObjectWrap() { -} - -SecurityCredentials::~SecurityCredentials() { -} - -NAN_METHOD(SecurityCredentials::New) { - // Create security credentials instance - SecurityCredentials *security_credentials = new SecurityCredentials(); - // Wrap it - security_credentials->Wrap(info.This()); - // Return the object - info.GetReturnValue().Set(info.This()); -} - -// Call structs -typedef struct SecurityCredentialCall { - char *package_str; - char *username_str; - char *password_str; - char *domain_str; - SecurityCredentials *credentials; -} SecurityCredentialCall; - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// authGSSClientInit -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -static void _authSSPIAquire(Worker *worker) { - // Status of operation - SECURITY_STATUS status; - - // Unpack data - SecurityCredentialCall *call = (SecurityCredentialCall *)worker->parameters; - - // // Unwrap the credentials - // SecurityCredentials *security_credentials = (SecurityCredentials *)call->credentials; - SecurityCredentials *security_credentials = new SecurityCredentials(); - - // If we have domain string - if(call->domain_str != NULL) { - security_credentials->m_Identity.Domain = USTR(_tcsdup(call->domain_str)); - security_credentials->m_Identity.DomainLength = (unsigned long)_tcslen(call->domain_str); - } else { - security_credentials->m_Identity.Domain = NULL; - security_credentials->m_Identity.DomainLength = 0; - } - - // Set up the user - security_credentials->m_Identity.User = USTR(_tcsdup(call->username_str)); - security_credentials->m_Identity.UserLength = (unsigned long)_tcslen(call->username_str); - - // If we have a password string - if(call->password_str != NULL) { - // Set up the password - security_credentials->m_Identity.Password = USTR(_tcsdup(call->password_str)); - security_credentials->m_Identity.PasswordLength = (unsigned long)_tcslen(call->password_str); - } - - #ifdef _UNICODE - security_credentials->m_Identity.Flags = SEC_WINNT_AUTH_IDENTITY_UNICODE; - #else - security_credentials->m_Identity.Flags = SEC_WINNT_AUTH_IDENTITY_ANSI; - #endif - - // Attempt to acquire credentials - status = _sspi_AcquireCredentialsHandle( - NULL, - call->package_str, - SECPKG_CRED_OUTBOUND, - NULL, - call->password_str != NULL ? &security_credentials->m_Identity : NULL, - NULL, NULL, - &security_credentials->m_Credentials, - &security_credentials->Expiration - ); - - // We have an error - if(status != SEC_E_OK) { - worker->error = TRUE; - worker->error_code = status; - worker->error_message = DisplaySECError(status); - } else { - worker->return_code = status; - worker->return_value = security_credentials; - } - - // Free up parameter structure - if(call->package_str != NULL) free(call->package_str); - if(call->domain_str != NULL) free(call->domain_str); - if(call->password_str != NULL) free(call->password_str); - if(call->username_str != NULL) free(call->username_str); - free(call); -} - -static Local _map_authSSPIAquire(Worker *worker) { - return Nan::Null(); -} - -NAN_METHOD(SecurityCredentials::Aquire) { - char *package_str = NULL, *username_str = NULL, *password_str = NULL, *domain_str = NULL; - // Unpack the variables - if(info.Length() != 2 && info.Length() != 3 && info.Length() != 4 && info.Length() != 5) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(!info[0]->IsString()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(!info[1]->IsString()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(info.Length() == 3 && (!info[2]->IsString() && !info[2]->IsFunction())) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(info.Length() == 4 && (!info[3]->IsString() && !info[3]->IsUndefined() && !info[3]->IsNull()) && !info[3]->IsFunction()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - if(info.Length() == 5 && !info[4]->IsFunction()) - return Nan::ThrowError("Aquire must be called with either [package:string, username:string, [password:string, domain:string], callback:function]"); - - Local callbackHandle; - - // Figure out which parameter is the callback - if(info.Length() == 5) { - callbackHandle = Local::Cast(info[4]); - } else if(info.Length() == 4) { - callbackHandle = Local::Cast(info[3]); - } else if(info.Length() == 3) { - callbackHandle = Local::Cast(info[2]); - } - - // Unpack the package - Local package = info[0]->ToString(); - package_str = (char *)calloc(package->Utf8Length() + 1, sizeof(char)); - package->WriteUtf8(package_str); - - // Unpack the user name - Local username = info[1]->ToString(); - username_str = (char *)calloc(username->Utf8Length() + 1, sizeof(char)); - username->WriteUtf8(username_str); - - // If we have a password - if(info.Length() == 3 || info.Length() == 4 || info.Length() == 5) { - Local password = info[2]->ToString(); - password_str = (char *)calloc(password->Utf8Length() + 1, sizeof(char)); - password->WriteUtf8(password_str); - } - - // If we have a domain - if((info.Length() == 4 || info.Length() == 5) && info[3]->IsString()) { - Local domain = info[3]->ToString(); - domain_str = (char *)calloc(domain->Utf8Length() + 1, sizeof(char)); - domain->WriteUtf8(domain_str); - } - - // Allocate call structure - SecurityCredentialCall *call = (SecurityCredentialCall *)calloc(1, sizeof(SecurityCredentialCall)); - call->domain_str = domain_str; - call->package_str = package_str; - call->password_str = password_str; - call->username_str = username_str; - - // Unpack the callback - Nan::Callback *callback = new Nan::Callback(callbackHandle); - - // Let's allocate some space - Worker *worker = new Worker(); - worker->error = false; - worker->request.data = worker; - worker->callback = callback; - worker->parameters = call; - worker->execute = _authSSPIAquire; - worker->mapper = _map_authSSPIAquire; - - // Schedule the worker with lib_uv - uv_queue_work(uv_default_loop(), &worker->request, SecurityCredentials::Process, (uv_after_work_cb)SecurityCredentials::After); - - // Return no value as it's callback based - info.GetReturnValue().Set(Nan::Undefined()); -} - -void SecurityCredentials::Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Define a new function template - Local t = Nan::New(New); - t->InstanceTemplate()->SetInternalFieldCount(1); - t->SetClassName(Nan::New("SecurityCredentials").ToLocalChecked()); - - // Class methods - Nan::SetMethod(t, "aquire", Aquire); - - // Set persistent - constructor_template.Reset(t); - - // Set the symbol - target->ForceSet(Nan::New("SecurityCredentials").ToLocalChecked(), t->GetFunction()); - - // Attempt to load the security.dll library - load_library(); -} - -static LPSTR DisplaySECError(DWORD ErrCode) { - LPSTR pszName = NULL; // WinError.h - - switch(ErrCode) { - case SEC_E_BUFFER_TOO_SMALL: - pszName = "SEC_E_BUFFER_TOO_SMALL - The message buffer is too small. Used with the Digest SSP."; - break; - - case SEC_E_CRYPTO_SYSTEM_INVALID: - pszName = "SEC_E_CRYPTO_SYSTEM_INVALID - The cipher chosen for the security context is not supported. Used with the Digest SSP."; - break; - case SEC_E_INCOMPLETE_MESSAGE: - pszName = "SEC_E_INCOMPLETE_MESSAGE - The data in the input buffer is incomplete. The application needs to read more data from the server and call DecryptMessage (General) again."; - break; - - case SEC_E_INVALID_HANDLE: - pszName = "SEC_E_INVALID_HANDLE - A context handle that is not valid was specified in the phContext parameter. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_INVALID_TOKEN: - pszName = "SEC_E_INVALID_TOKEN - The buffers are of the wrong type or no buffer of type SECBUFFER_DATA was found. Used with the Schannel SSP."; - break; - - case SEC_E_MESSAGE_ALTERED: - pszName = "SEC_E_MESSAGE_ALTERED - The message has been altered. Used with the Digest and Schannel SSPs."; - break; - - case SEC_E_OUT_OF_SEQUENCE: - pszName = "SEC_E_OUT_OF_SEQUENCE - The message was not received in the correct sequence."; - break; - - case SEC_E_QOP_NOT_SUPPORTED: - pszName = "SEC_E_QOP_NOT_SUPPORTED - Neither confidentiality nor integrity are supported by the security context. Used with the Digest SSP."; - break; - - case SEC_I_CONTEXT_EXPIRED: - pszName = "SEC_I_CONTEXT_EXPIRED - The message sender has finished using the connection and has initiated a shutdown."; - break; - - case SEC_I_RENEGOTIATE: - pszName = "SEC_I_RENEGOTIATE - The remote party requires a new handshake sequence or the application has just initiated a shutdown."; - break; - - case SEC_E_ENCRYPT_FAILURE: - pszName = "SEC_E_ENCRYPT_FAILURE - The specified data could not be encrypted."; - break; - - case SEC_E_DECRYPT_FAILURE: - pszName = "SEC_E_DECRYPT_FAILURE - The specified data could not be decrypted."; - break; - case -1: - pszName = "Failed to load security.dll library"; - break; - - } - - return pszName; -} - -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -// UV Lib callbacks -// +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void SecurityCredentials::Process(uv_work_t* work_req) { - // Grab the worker - Worker *worker = static_cast(work_req->data); - // Execute the worker code - worker->execute(worker); -} - -void SecurityCredentials::After(uv_work_t* work_req) { - // Grab the scope of the call from Node - Nan::HandleScope scope; - - // Get the worker reference - Worker *worker = static_cast(work_req->data); - - // If we have an error - if(worker->error) { - Local err = v8::Exception::Error(Nan::New(worker->error_message).ToLocalChecked()); - Local obj = err->ToObject(); - obj->Set(Nan::New("code").ToLocalChecked(), Nan::New(worker->error_code)); - Local info[2] = { err, Nan::Null() }; - // Execute the error - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } else { - SecurityCredentials *return_value = (SecurityCredentials *)worker->return_value; - // Create a new instance - Local result = Nan::New(constructor_template)->GetFunction()->NewInstance(); - // Unwrap the credentials - SecurityCredentials *security_credentials = Nan::ObjectWrap::Unwrap(result); - // Set the values - security_credentials->m_Identity = return_value->m_Identity; - security_credentials->m_Credentials = return_value->m_Credentials; - security_credentials->Expiration = return_value->Expiration; - // Set up the callback with a null first - Local info[2] = { Nan::Null(), result}; - // Wrap the callback function call in a TryCatch so that we can call - // node's FatalException afterwards. This makes it possible to catch - // the exception from JavaScript land using the - // process.on('uncaughtException') event. - Nan::TryCatch try_catch; - - // Call the callback - worker->callback->Call(ARRAY_SIZE(info), info); - - // If we have an exception handle it as a fatalexception - if (try_catch.HasCaught()) { - Nan::FatalException(try_catch); - } - } - - // Clean up the memory - delete worker->callback; - delete worker; -} - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h deleted file mode 100644 index 71751a0f..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.h +++ /dev/null @@ -1,68 +0,0 @@ -#ifndef SECURITY_CREDENTIALS_H -#define SECURITY_CREDENTIALS_H - -#include -#include -#include - -#define SECURITY_WIN32 1 - -#include -#include -#include -#include -#include -#include "../worker.h" -#include - -extern "C" { - #include "../kerberos_sspi.h" -} - -// SEC_WINNT_AUTH_IDENTITY makes it unusually hard -// to compile for both Unicode and ansi, so I use this macro: -#ifdef _UNICODE -#define USTR(str) (str) -#else -#define USTR(str) ((unsigned char*)(str)) -#endif - -using namespace v8; -using namespace node; - -class SecurityCredentials : public Nan::ObjectWrap { - public: - SecurityCredentials(); - ~SecurityCredentials(); - - // Pointer to context object - SEC_WINNT_AUTH_IDENTITY m_Identity; - // credentials - CredHandle m_Credentials; - // Expiry time for ticket - TimeStamp Expiration; - - // Has instance check - static inline bool HasInstance(Local val) { - if (!val->IsObject()) return false; - Local obj = val->ToObject(); - return Nan::New(constructor_template)->HasInstance(obj); - }; - - // Functions available from V8 - static void Initialize(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE target); - static NAN_METHOD(Aquire); - - // Constructor used for creating new Long objects from C++ - static Nan::Persistent constructor_template; - - private: - // Create a new instance - static NAN_METHOD(New); - // Handles the uv calls - static void Process(uv_work_t* work_req); - // Called after work is done - static void After(uv_work_t* work_req); -}; - -#endif \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js deleted file mode 100644 index 4215c927..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/win32/wrappers/security_credentials.js +++ /dev/null @@ -1,22 +0,0 @@ -var SecurityCredentialsNative = require('../../../build/Release/kerberos').SecurityCredentials; - -// Add simple kebros helper -SecurityCredentialsNative.aquire_kerberos = function(username, password, domain, callback) { - if(typeof password == 'function') { - callback = password; - password = null; - } else if(typeof domain == 'function') { - callback = domain; - domain = null; - } - - // We are going to use the async version - if(typeof callback == 'function') { - return SecurityCredentialsNative.aquire('Kerberos', username, password, domain, callback); - } else { - return SecurityCredentialsNative.aquireSync('Kerberos', username, password, domain); - } -} - -// Export the modified class -exports.SecurityCredentials = SecurityCredentialsNative; \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc deleted file mode 100644 index e7a472f6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.cc +++ /dev/null @@ -1,7 +0,0 @@ -#include "worker.h" - -Worker::Worker() { -} - -Worker::~Worker() { -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h deleted file mode 100644 index 1b0dced5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/lib/worker.h +++ /dev/null @@ -1,38 +0,0 @@ -#ifndef WORKER_H_ -#define WORKER_H_ - -#include -#include -#include -#include - -using namespace node; -using namespace v8; - -class Worker { - public: - Worker(); - virtual ~Worker(); - - // libuv's request struct. - uv_work_t request; - // Callback - Nan::Callback *callback; - // Parameters - void *parameters; - // Results - void *return_value; - // Did we raise an error - bool error; - // The error message - char *error_message; - // Error code if not message - int error_code; - // Any return code - int return_code; - // Method we are going to fire - void (*execute)(Worker *worker); - Local (*mapper)(Worker *worker); -}; - -#endif // WORKER_H_ diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc deleted file mode 100644 index 47971da6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/.dntrc +++ /dev/null @@ -1,30 +0,0 @@ -## DNT config file -## see https://github.com/rvagg/dnt - -NODE_VERSIONS="\ - master \ - v0.11.13 \ - v0.10.30 \ - v0.10.29 \ - v0.10.28 \ - v0.10.26 \ - v0.10.25 \ - v0.10.24 \ - v0.10.23 \ - v0.10.22 \ - v0.10.21 \ - v0.10.20 \ - v0.10.19 \ - v0.8.28 \ - v0.8.27 \ - v0.8.26 \ - v0.8.24 \ -" -OUTPUT_PREFIX="nan-" -TEST_CMD=" \ - cd /dnt/ && \ - npm install && \ - node_modules/.bin/node-gyp --nodedir /usr/src/node/ rebuild --directory test && \ - node_modules/.bin/tap --gc test/js/*-test.js \ -" - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md deleted file mode 100644 index 457e7c44..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/CHANGELOG.md +++ /dev/null @@ -1,374 +0,0 @@ -# NAN ChangeLog - -**Version 2.0.9: current Node 4.0.0, Node 12: 0.12.7, Node 10: 0.10.40, iojs: 3.2.0** - -### 2.0.9 Sep 8 2015 - - - Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7 - -### 2.0.8 Aug 28 2015 - - - Work around duplicate linking bug in clang 11902da - -### 2.0.7 Aug 26 2015 - - - Build: Repackage - -### 2.0.6 Aug 26 2015 - - - Bugfix: Properly handle null callback in FunctionTemplate factory 6e99cb1 - - Bugfix: Remove unused static std::map instances 525bddc - - Bugfix: Make better use of maybe versions of APIs bfba85b - - Bugfix: Fix shadowing issues with handle in ObjectWrap 0a9072d - -### 2.0.5 Aug 10 2015 - - - Bugfix: Reimplement weak callback in ObjectWrap 98d38c1 - - Bugfix: Make sure callback classes are not assignable, copyable or movable 81f9b1d - -### 2.0.4 Aug 6 2015 - - - Build: Repackage - -### 2.0.3 Aug 6 2015 - - - Bugfix: Don't use clang++ / g++ syntax extension. 231450e - -### 2.0.2 Aug 6 2015 - - - Build: Repackage - -### 2.0.1 Aug 6 2015 - - - Bugfix: Add workaround for missing REPLACE_INVALID_UTF8 60d6687 - - Bugfix: Reimplement ObjectWrap from scratch to prevent memory leaks 6484601 - - Bugfix: Fix Persistent leak in FunctionCallbackInfo and PropertyCallbackInfo 641ef5f - - Bugfix: Add missing overload for Nan::NewInstance that takes argc/argv 29450ed - -### 2.0.0 Jul 31 2015 - - - Change: Renamed identifiers with leading underscores b5932b4 - - Change: Replaced NanObjectWrapHandle with class NanObjectWrap 464f1e1 - - Change: Replace NanScope and NanEscpableScope macros with classes 47751c4 - - Change: Rename NanNewBufferHandle to NanNewBuffer 6745f99 - - Change: Rename NanBufferUse to NanNewBuffer 3e8b0a5 - - Change: Rename NanNewBuffer to NanCopyBuffer d6af78d - - Change: Remove Nan prefix from all names 72d1f67 - - Change: Update Buffer API for new upstream changes d5d3291 - - Change: Rename Scope and EscapableScope to HandleScope and EscapableHandleScope 21a7a6a - - Change: Get rid of Handles e6c0daf - - Feature: Support io.js 3 with V8 4.4 - - Feature: Introduce NanPersistent 7fed696 - - Feature: Introduce NanGlobal 4408da1 - - Feature: Added NanTryCatch 10f1ca4 - - Feature: Update for V8 v4.3 4b6404a - - Feature: Introduce NanNewOneByteString c543d32 - - Feature: Introduce namespace Nan 67ed1b1 - - Removal: Remove NanLocker and NanUnlocker dd6e401 - - Removal: Remove string converters, except NanUtf8String, which now follows the node implementation b5d00a9 - - Removal: Remove NanReturn* macros d90a25c - - Removal: Remove HasInstance e8f84fe - - -### 1.9.0 Jul 31 2015 - - - Feature: Added `NanFatalException` 81d4a2c - - Feature: Added more error types 4265f06 - - Feature: Added dereference and function call operators to NanCallback c4b2ed0 - - Feature: Added indexed GetFromPersistent and SaveToPersistent edd510c - - Feature: Added more overloads of SaveToPersistent and GetFromPersistent 8b1cef6 - - Feature: Added NanErrnoException dd87d9e - - Correctness: Prevent assign, copy, and move for classes that do not support it 1f55c59, 4b808cb, c96d9b2, fba4a29, 3357130 - - Deprecation: Deprecate `NanGetPointerSafe` and `NanSetPointerSafe` 81d4a2c - - Deprecation: Deprecate `NanBooleanOptionValue` and `NanUInt32OptionValue` 0ad254b - -### 1.8.4 Apr 26 2015 - - - Build: Repackage - -### 1.8.3 Apr 26 2015 - - - Bugfix: Include missing header 1af8648 - -### 1.8.2 Apr 23 2015 - - - Build: Repackage - -### 1.8.1 Apr 23 2015 - - - Bugfix: NanObjectWrapHandle should take a pointer 155f1d3 - -### 1.8.0 Apr 23 2015 - - - Feature: Allow primitives with NanReturnValue 2e4475e - - Feature: Added comparison operators to NanCallback 55b075e - - Feature: Backport thread local storage 15bb7fa - - Removal: Remove support for signatures with arguments 8a2069d - - Correcteness: Replaced NanObjectWrapHandle macro with function 0bc6d59 - -### 1.7.0 Feb 28 2015 - - - Feature: Made NanCallback::Call accept optional target 8d54da7 - - Feature: Support atom-shell 0.21 0b7f1bb - -### 1.6.2 Feb 6 2015 - - - Bugfix: NanEncode: fix argument type for node::Encode on io.js 2be8639 - -### 1.6.1 Jan 23 2015 - - - Build: version bump - -### 1.5.3 Jan 23 2015 - - - Build: repackage - -### 1.6.0 Jan 23 2015 - - - Deprecated `NanNewContextHandle` in favor of `NanNew` 49259af - - Support utility functions moved in newer v8 versions (Node 0.11.15, io.js 1.0) a0aa179 - - Added `NanEncode`, `NanDecodeBytes` and `NanDecodeWrite` 75e6fb9 - -### 1.5.2 Jan 23 2015 - - - Bugfix: Fix non-inline definition build error with clang++ 21d96a1, 60fadd4 - - Bugfix: Readded missing String constructors 18d828f - - Bugfix: Add overload handling NanNew(..) 5ef813b - - Bugfix: Fix uv_work_cb versioning 997e4ae - - Bugfix: Add function factory and test 4eca89c - - Bugfix: Add object template factory and test cdcb951 - - Correctness: Lifted an io.js related typedef c9490be - - Correctness: Make explicit downcasts of String lengths 00074e6 - - Windows: Limit the scope of disabled warning C4530 83d7deb - -### 1.5.1 Jan 15 2015 - - - Build: version bump - -### 1.4.3 Jan 15 2015 - - - Build: version bump - -### 1.4.2 Jan 15 2015 - - - Feature: Support io.js 0dbc5e8 - -### 1.5.0 Jan 14 2015 - - - Feature: Support io.js b003843 - - Correctness: Improved NanNew internals 9cd4f6a - - Feature: Implement progress to NanAsyncWorker 8d6a160 - -### 1.4.1 Nov 8 2014 - - - Bugfix: Handle DEBUG definition correctly - - Bugfix: Accept int as Boolean - -### 1.4.0 Nov 1 2014 - - - Feature: Added NAN_GC_CALLBACK 6a5c245 - - Performance: Removed unnecessary local handle creation 18a7243, 41fe2f8 - - Correctness: Added constness to references in NanHasInstance 02c61cd - - Warnings: Fixed spurious warnings from -Wundef and -Wshadow, 541b122, 99d8cb6 - - Windoze: Shut Visual Studio up when compiling 8d558c1 - - License: Switch to plain MIT from custom hacked MIT license 11de983 - - Build: Added test target to Makefile e232e46 - - Performance: Removed superfluous scope in NanAsyncWorker f4b7821 - - Sugar/Feature: Added NanReturnThis() and NanReturnHolder() shorthands 237a5ff, d697208 - - Feature: Added suitable overload of NanNew for v8::Integer::NewFromUnsigned b27b450 - -### 1.3.0 Aug 2 2014 - - - Added NanNew(std::string) - - Added NanNew(std::string&) - - Added NanAsciiString helper class - - Added NanUtf8String helper class - - Added NanUcs2String helper class - - Deprecated NanRawString() - - Deprecated NanCString() - - Added NanGetIsolateData(v8::Isolate *isolate) - - Added NanMakeCallback(v8::Handle target, v8::Handle func, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, v8::Handle symbol, int argc, v8::Handle* argv) - - Added NanMakeCallback(v8::Handle target, const char* method, int argc, v8::Handle* argv) - - Added NanSetTemplate(v8::Handle templ, v8::Handle name , v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetPrototypeTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - - Added NanSetInstanceTemplate(v8::Local templ, const char *name, v8::Handle value) - - Added NanSetInstanceTemplate(v8::Local templ, v8::Handle name, v8::Handle value, v8::PropertyAttribute attributes) - -### 1.2.0 Jun 5 2014 - - - Add NanSetPrototypeTemplate - - Changed NAN_WEAK_CALLBACK internals, switched _NanWeakCallbackData to class, - introduced _NanWeakCallbackDispatcher - - Removed -Wno-unused-local-typedefs from test builds - - Made test builds Windows compatible ('Sleep()') - -### 1.1.2 May 28 2014 - - - Release to fix more stuff-ups in 1.1.1 - -### 1.1.1 May 28 2014 - - - Release to fix version mismatch in nan.h and lack of changelog entry for 1.1.0 - -### 1.1.0 May 25 2014 - - - Remove nan_isolate, use v8::Isolate::GetCurrent() internally instead - - Additional explicit overloads for NanNew(): (char*,int), (uint8_t*[,int]), - (uint16_t*[,int), double, int, unsigned int, bool, v8::String::ExternalStringResource*, - v8::String::ExternalAsciiStringResource* - - Deprecate NanSymbol() - - Added SetErrorMessage() and ErrorMessage() to NanAsyncWorker - -### 1.0.0 May 4 2014 - - - Heavy API changes for V8 3.25 / Node 0.11.13 - - Use cpplint.py - - Removed NanInitPersistent - - Removed NanPersistentToLocal - - Removed NanFromV8String - - Removed NanMakeWeak - - Removed NanNewLocal - - Removed NAN_WEAK_CALLBACK_OBJECT - - Removed NAN_WEAK_CALLBACK_DATA - - Introduce NanNew, replaces NanNewLocal, NanPersistentToLocal, adds many overloaded typed versions - - Introduce NanUndefined, NanNull, NanTrue and NanFalse - - Introduce NanEscapableScope and NanEscapeScope - - Introduce NanMakeWeakPersistent (requires a special callback to work on both old and new node) - - Introduce NanMakeCallback for node::MakeCallback - - Introduce NanSetTemplate - - Introduce NanGetCurrentContext - - Introduce NanCompileScript and NanRunScript - - Introduce NanAdjustExternalMemory - - Introduce NanAddGCEpilogueCallback, NanAddGCPrologueCallback, NanRemoveGCEpilogueCallback, NanRemoveGCPrologueCallback - - Introduce NanGetHeapStatistics - - Rename NanAsyncWorker#SavePersistent() to SaveToPersistent() - -### 0.8.0 Jan 9 2014 - - - NanDispose -> NanDisposePersistent, deprecate NanDispose - - Extract _NAN_*_RETURN_TYPE, pull up NAN_*() - -### 0.7.1 Jan 9 2014 - - - Fixes to work against debug builds of Node - - Safer NanPersistentToLocal (avoid reinterpret_cast) - - Speed up common NanRawString case by only extracting flattened string when necessary - -### 0.7.0 Dec 17 2013 - - - New no-arg form of NanCallback() constructor. - - NanCallback#Call takes Handle rather than Local - - Removed deprecated NanCallback#Run method, use NanCallback#Call instead - - Split off _NAN_*_ARGS_TYPE from _NAN_*_ARGS - - Restore (unofficial) Node 0.6 compatibility at NanCallback#Call() - - Introduce NanRawString() for char* (or appropriate void*) from v8::String - (replacement for NanFromV8String) - - Introduce NanCString() for null-terminated char* from v8::String - -### 0.6.0 Nov 21 2013 - - - Introduce NanNewLocal(v8::Handle value) for use in place of - v8::Local::New(...) since v8 started requiring isolate in Node 0.11.9 - -### 0.5.2 Nov 16 2013 - - - Convert SavePersistent and GetFromPersistent in NanAsyncWorker from protected and public - -### 0.5.1 Nov 12 2013 - - - Use node::MakeCallback() instead of direct v8::Function::Call() - -### 0.5.0 Nov 11 2013 - - - Added @TooTallNate as collaborator - - New, much simpler, "include_dirs" for binding.gyp - - Added full range of NAN_INDEX_* macros to match NAN_PROPERTY_* macros - -### 0.4.4 Nov 2 2013 - - - Isolate argument from v8::Persistent::MakeWeak removed for 0.11.8+ - -### 0.4.3 Nov 2 2013 - - - Include node_object_wrap.h, removed from node.h for Node 0.11.8. - -### 0.4.2 Nov 2 2013 - - - Handle deprecation of v8::Persistent::Dispose(v8::Isolate* isolate)) for - Node 0.11.8 release. - -### 0.4.1 Sep 16 2013 - - - Added explicit `#include ` as it was removed from node.h for v0.11.8 - -### 0.4.0 Sep 2 2013 - - - Added NAN_INLINE and NAN_DEPRECATED and made use of them - - Added NanError, NanTypeError and NanRangeError - - Cleaned up code - -### 0.3.2 Aug 30 2013 - - - Fix missing scope declaration in GetFromPersistent() and SaveToPersistent - in NanAsyncWorker - -### 0.3.1 Aug 20 2013 - - - fix "not all control paths return a value" compile warning on some platforms - -### 0.3.0 Aug 19 2013 - - - Made NAN work with NPM - - Lots of fixes to NanFromV8String, pulling in features from new Node core - - Changed node::encoding to Nan::Encoding in NanFromV8String to unify the API - - Added optional error number argument for NanThrowError() - - Added NanInitPersistent() - - Added NanReturnNull() and NanReturnEmptyString() - - Added NanLocker and NanUnlocker - - Added missing scopes - - Made sure to clear disposed Persistent handles - - Changed NanAsyncWorker to allocate error messages on the heap - - Changed NanThrowError(Local) to NanThrowError(Handle) - - Fixed leak in NanAsyncWorker when errmsg is used - -### 0.2.2 Aug 5 2013 - - - Fixed usage of undefined variable with node::BASE64 in NanFromV8String() - -### 0.2.1 Aug 5 2013 - - - Fixed 0.8 breakage, node::BUFFER encoding type not available in 0.8 for - NanFromV8String() - -### 0.2.0 Aug 5 2013 - - - Added NAN_PROPERTY_GETTER, NAN_PROPERTY_SETTER, NAN_PROPERTY_ENUMERATOR, - NAN_PROPERTY_DELETER, NAN_PROPERTY_QUERY - - Extracted _NAN_METHOD_ARGS, _NAN_GETTER_ARGS, _NAN_SETTER_ARGS, - _NAN_PROPERTY_GETTER_ARGS, _NAN_PROPERTY_SETTER_ARGS, - _NAN_PROPERTY_ENUMERATOR_ARGS, _NAN_PROPERTY_DELETER_ARGS, - _NAN_PROPERTY_QUERY_ARGS - - Added NanGetInternalFieldPointer, NanSetInternalFieldPointer - - Added NAN_WEAK_CALLBACK, NAN_WEAK_CALLBACK_OBJECT, - NAN_WEAK_CALLBACK_DATA, NanMakeWeak - - Renamed THROW_ERROR to _NAN_THROW_ERROR - - Added NanNewBufferHandle(char*, size_t, node::smalloc::FreeCallback, void*) - - Added NanBufferUse(char*, uint32_t) - - Added NanNewContextHandle(v8::ExtensionConfiguration*, - v8::Handle, v8::Handle) - - Fixed broken NanCallback#GetFunction() - - Added optional encoding and size arguments to NanFromV8String() - - Added NanGetPointerSafe() and NanSetPointerSafe() - - Added initial test suite (to be expanded) - - Allow NanUInt32OptionValue to convert any Number object - -### 0.1.0 Jul 21 2013 - - - Added `NAN_GETTER`, `NAN_SETTER` - - Added `NanThrowError` with single Local argument - - Added `NanNewBufferHandle` with single uint32_t argument - - Added `NanHasInstance(Persistent&, Handle)` - - Added `Local NanCallback#GetFunction()` - - Added `NanCallback#Call(int, Local[])` - - Deprecated `NanCallback#Run(int, Local[])` in favour of Call diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md deleted file mode 100644 index 77666cdf..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/LICENSE.md +++ /dev/null @@ -1,13 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright (c) 2015 NAN contributors ------------------------------------ - -*NAN contributors listed at * - -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/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md deleted file mode 100644 index db3daec9..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/README.md +++ /dev/null @@ -1,367 +0,0 @@ -Native Abstractions for Node.js -=============================== - -**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10 and 0.12 as well as io.js.** - -***Current version: 2.0.9*** - -*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)* - -[![NPM](https://nodei.co/npm/nan.png?downloads=true&downloadRank=true)](https://nodei.co/npm/nan/) [![NPM](https://nodei.co/npm-dl/nan.png?months=6&height=3)](https://nodei.co/npm/nan/) - -[![Build Status](https://api.travis-ci.org/nodejs/nan.svg?branch=master)](http://travis-ci.org/nodejs/nan) -[![Build status](https://ci.appveyor.com/api/projects/status/kh73pbm9dsju7fgh)](https://ci.appveyor.com/project/RodVagg/nan) - -Thanks to the crazy changes in V8 (and some in Node core), keeping native addons compiling happily across versions, particularly 0.10 to 0.12, is a minor nightmare. The goal of this project is to store all logic necessary to develop native Node.js addons without having to inspect `NODE_MODULE_VERSION` and get yourself into a macro-tangle. - -This project also contains some helper utilities that make addon development a bit more pleasant. - - * **[News & Updates](#news)** - * **[Usage](#usage)** - * **[Example](#example)** - * **[API](#api)** - * **[Tests](#tests)** - * **[Governance & Contributing](#governance)** - - -## News & Updates - - -## Usage - -Simply add **NAN** as a dependency in the *package.json* of your Node addon: - -``` bash -$ npm install --save nan -``` - -Pull in the path to **NAN** in your *binding.gyp* so that you can use `#include ` in your *.cpp* files: - -``` python -"include_dirs" : [ - "` when compiling your addon. - - -## Example - -Just getting started with Nan? Refer to a [quick-start **Nan** Boilerplate](https://github.com/fcanas/node-native-boilerplate) for a ready-to-go project that utilizes basic Nan functionality. - -For a simpler example, see the **[async pi estimation example](https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate)** in the examples directory for full code and an explanation of what this Monte Carlo Pi estimation example does. Below are just some parts of the full example that illustrate the use of **NAN**. - -For another example, see **[nan-example-eol](https://github.com/CodeCharmLtd/nan-example-eol)**. It shows newline detection implemented as a native addon. - - -## API - -Additional to the NAN documentation below, please consult: - -* [The V8 Getting Started Guide](https://developers.google.com/v8/get_started) -* [The V8 Embedders Guide](https://developers.google.com/v8/embed) -* [V8 API Documentation](http://v8docs.nodesource.com/) - - - -### JavaScript-accessible methods - -A _template_ is a blueprint for JavaScript functions and objects in a context. You can use a template to wrap C++ functions and data structures within JavaScript objects so that they can be manipulated from JavaScript. See the V8 Embedders Guide section on [Templates](https://developers.google.com/v8/embed#templates) for further information. - -In order to expose functionality to JavaScript via a template, you must provide it to V8 in a form that it understands. Across the versions of V8 supported by NAN, JavaScript-accessible method signatures vary widely, NAN fully abstracts method declaration and provides you with an interface that is similar to the most recent V8 API but is backward-compatible with older versions that still use the now-deceased `v8::Argument` type. - -* **Method argument types** - - Nan::FunctionCallbackInfo - - Nan::PropertyCallbackInfo - - Nan::ReturnValue -* **Method declarations** - - Method declaration - - Getter declaration - - Setter declaration - - Property getter declaration - - Property setter declaration - - Property enumerator declaration - - Property deleter declaration - - Property query declaration - - Index getter declaration - - Index setter declaration - - Index enumerator declaration - - Index deleter declaration - - Index query declaration -* Method and template helpers - - Nan::SetMethod() - - Nan::SetNamedPropertyHandler() - - Nan::SetIndexedPropertyHandler() - - Nan::SetPrototypeMethod() - - Nan::SetTemplate() - - Nan::SetPrototypeTemplate() - - Nan::SetInstanceTemplate() - -### Scopes - -A _local handle_ is a pointer to an object. All V8 objects are accessed using handles, they are necessary because of the way the V8 garbage collector works. - -A handle scope can be thought of as a container for any number of handles. When you've finished with your handles, instead of deleting each one individually you can simply delete their scope. - -The creation of `HandleScope` objects is different across the supported versions of V8. Therefore, NAN provides its own implementations that can be used safely across these. - - - Nan::HandleScope - - Nan::EscapableHandleScope - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - -### Persistent references - -An object reference that is independent of any `HandleScope` is a _persistent_ reference. Where a `Local` handle only lives as long as the `HandleScope` in which it was allocated, a `Persistent` handle remains valid until it is explicitly disposed. - -Due to the evolution of the V8 API, it is necessary for NAN to provide a wrapper implementation of the `Persistent` classes to supply compatibility across the V8 versions supported. - - - Nan::PersistentBase & v8::PersistentBase - - Nan::NonCopyablePersistentTraits & v8::NonCopyablePersistentTraits - - Nan::CopyablePersistentTraits & v8::CopyablePersistentTraits - - Nan::Persistent - - Nan::Global - - Nan::WeakCallbackInfo - - Nan::WeakCallbackType - -Also see the V8 Embedders Guide section on [Handles and Garbage Collection](https://developers.google.com/v8/embed#handles). - -### New - -NAN provides a `Nan::New()` helper for the creation of new JavaScript objects in a way that's compatible across the supported versions of V8. - - - Nan::New() - - Nan::Undefined() - - Nan::Null() - - Nan::True() - - Nan::False() - - Nan::EmptyString() - - -### Converters - -NAN contains functions that convert `v8::Value`s to other `v8::Value` types and native types. Since type conversion is not guaranteed to succeed, they return `Nan::Maybe` types. These converters can be used in place of `value->ToX()` and `value->XValue()` (where `X` is one of the types, e.g. `Boolean`) in a way that provides a consistent interface across V8 versions. Newer versions of V8 use the new `v8::Maybe` and `v8::MaybeLocal` types for these conversions, older versions don't have this functionality so it is provided by NAN. - - - Nan::To() - -### Maybe Types - -The `Nan::MaybeLocal` and `Nan::Maybe` types are monads that encapsulate `v8::Local` handles that _may be empty_. - -* **Maybe Types** - - Nan::MaybeLocal - - Nan::Maybe - - Nan::Nothing - - Nan::Just -* **Maybe Helpers** - - Nan::ToDetailString() - - Nan::ToArrayIndex() - - Nan::Equals() - - Nan::NewInstance() - - Nan::GetFunction() - - Nan::Set() - - Nan::ForceSet() - - Nan::Get() - - Nan::GetPropertyAttributes() - - Nan::Has() - - Nan::Delete() - - Nan::GetPropertyNames() - - Nan::GetOwnPropertyNames() - - Nan::SetPrototype() - - Nan::ObjectProtoToString() - - Nan::HasOwnProperty() - - Nan::HasRealNamedProperty() - - Nan::HasRealIndexedProperty() - - Nan::HasRealNamedCallbackProperty() - - Nan::GetRealNamedPropertyInPrototypeChain() - - Nan::GetRealNamedProperty() - - Nan::CallAsFunction() - - Nan::CallAsConstructor() - - Nan::GetSourceLine() - - Nan::GetLineNumber() - - Nan::GetStartColumn() - - Nan::GetEndColumn() - - Nan::CloneElementAt() - -### Script - -NAN provides a `v8::Script` helpers as the API has changed over the supported versions of V8. - - - Nan::CompileScript() - - Nan::RunScript() - - -### Errors - -NAN includes helpers for creating, throwing and catching Errors as much of this functionality varies across the supported versions of V8 and must be abstracted. - -Note that an Error object is simply a specialized form of `v8::Value`. - -Also consult the V8 Embedders Guide section on [Exceptions](https://developers.google.com/v8/embed#exceptions) for more information. - - - Nan::Error() - - Nan::RangeError() - - Nan::ReferenceError() - - Nan::SyntaxError() - - Nan::TypeError() - - Nan::ThrowError() - - Nan::ThrowRangeError() - - Nan::ThrowReferenceError() - - Nan::ThrowSyntaxError() - - Nan::ThrowTypeError() - - Nan::FatalException() - - Nan::ErrnoException() - - Nan::TryCatch - - -### Buffers - -NAN's `node::Buffer` helpers exist as the API has changed across supported Node versions. Use these methods to ensure compatibility. - - - Nan::NewBuffer() - - Nan::CopyBuffer() - - Nan::FreeCallback() - -### Nan::Callback - -`Nan::Callback` makes it easier to use `v8::Function` handles as callbacks. A class that wraps a `v8::Function` handle, protecting it from garbage collection and making it particularly useful for storage and use across asynchronous execution. - - - Nan::Callback - -### Asynchronous work helpers - -`Nan::AsyncWorker` and `Nan::AsyncProgressWorker` are helper classes that make working with asynchronous code easier. - - - Nan::AsyncWorker - - Nan::AsyncProgressWorker - - Nan::AsyncQueueWorker - -### Strings & Bytes - -Miscellaneous string & byte encoding and decoding functionality provided for compatibility across supported versions of V8 and Node. Implemented by NAN to ensure that all encoding types are supported, even for older versions of Node where they are missing. - - - Nan::Encoding - - Nan::Encode() - - Nan::DecodeBytes() - - Nan::DecodeWrite() - - -### V8 internals - -The hooks to access V8 internals—including GC and statistics—are different across the supported versions of V8, therefore NAN provides its own hooks that call the appropriate V8 methods. - - - NAN_GC_CALLBACK() - - Nan::AddGCEpilogueCallback() - - Nan::RemoveGCEpilogueCallback() - - Nan::AddGCPrologueCallback() - - Nan::RemoveGCPrologueCallback() - - Nan::GetHeapStatistics() - - Nan::SetCounterFunction() - - Nan::SetCreateHistogramFunction() - - Nan::SetAddHistogramSampleFunction() - - Nan::IdleNotification() - - Nan::LowMemoryNotification() - - Nan::ContextDisposedNotification() - - Nan::GetInternalFieldPointer() - - Nan::SetInternalFieldPointer() - - Nan::AdjustExternalMemory() - - -### Miscellaneous V8 Helpers - - - Nan::Utf8String - - Nan::GetCurrentContext() - - Nan::SetIsolateData() - - Nan::GetIsolateData() - - -### Miscellaneous Node Helpers - - - Nan::MakeCallback() - - Nan::ObjectWrap - - NAN_MODULE_INIT() - - Nan::Export() - - - - - -### Tests - -To run the NAN tests do: - -``` sh -npm install -npm run-script rebuild-tests -npm test -``` - -Or just: - -``` sh -npm install -make test -``` - - -## Governance & Contributing - -NAN is governed by the [io.js](https://iojs.org/) Addon API Working Group - -### Addon API Working Group (WG) - -The NAN project is jointly governed by a Working Group which is responsible for high-level guidance of the project. - -Members of the WG are also known as Collaborators, there is no distinction between the two, unlike other io.js projects. - -The WG has final authority over this project including: - -* Technical direction -* Project governance and process (including this policy) -* Contribution policy -* GitHub repository hosting -* Maintaining the list of additional Collaborators - -For the current list of WG members, see the project [README.md](./README.md#collaborators). - -Individuals making significant and valuable contributions are made members of the WG and given commit-access to the project. These individuals are identified by the WG and their addition to the WG is discussed via GitHub and requires unanimous consensus amongst those WG members participating in the discussion with a quorum of 50% of WG members required for acceptance of the vote. - -_Note:_ If you make a significant contribution and are not considered for commit-access log an issue or contact a WG member directly. - -For the current list of WG members / Collaborators, see the project [README.md](./README.md#collaborators). - -### Consensus Seeking Process - -The WG follows a [Consensus Seeking](http://en.wikipedia.org/wiki/Consensus-seeking_decision-making) decision making model. - -Modifications of the contents of the NAN repository are made on a collaborative basis. Anybody with a GitHub account may propose a modification via pull request and it will be considered by the WG. All pull requests must be reviewed and accepted by a WG member with sufficient expertise who is able to take full responsibility for the change. In the case of pull requests proposed by an existing WG member, an additional WG member is required for sign-off. Consensus should be sought if additional WG members participate and there is disagreement around a particular modification. - -If a change proposal cannot reach a consensus, a WG member can call for a vote amongst the members of the WG. Simple majority wins. - -### Developer's Certificate of Origin 1.0 - -By making a contribution to this project, I certify that: - -* (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or -* (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or -* (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. - - -### WG Members / Collaborators - - - - - - - - - -
        Rod VaggGitHub/rvaggTwitter/@rvagg
        Benjamin ByholmGitHub/kkoopa-
        Trevor NorrisGitHub/trevnorrisTwitter/@trevnorris
        Nathan RajlichGitHub/TooTallNateTwitter/@TooTallNate
        Brett LawsonGitHub/brett19Twitter/@brett19x
        Ben NoordhuisGitHub/bnoordhuisTwitter/@bnoordhuis
        David SiegelGitHub/agnat-
        - -## Licence & copyright - -Copyright (c) 2015 NAN WG Members / Collaborators (listed above). - -Native Abstractions for Node.js is licensed under an MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details. diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml deleted file mode 100644 index 1378d310..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/appveyor.yml +++ /dev/null @@ -1,38 +0,0 @@ -# http://www.appveyor.com/docs/appveyor-yml - -# Test against these versions of Io.js and Node.js. -environment: - matrix: - # node.js - - nodejs_version: "0.8" - - nodejs_version: "0.10" - - nodejs_version: "0.12" - # io.js - - nodejs_version: "1" - - nodejs_version: "2" - - nodejs_version: "3" - -# Install scripts. (runs after repo cloning) -install: - # Get the latest stable version of Node 0.STABLE.latest - - ps: if($env:nodejs_version -eq "0.8") {Install-Product node $env:nodejs_version} - - ps: if($env:nodejs_version -ne "0.8") {Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version)} - - IF %nodejs_version% LSS 1 npm -g install npm - - IF %nodejs_version% LSS 1 set PATH=%APPDATA%\npm;%PATH% - # Typical npm stuff. - - npm install - - IF %nodejs_version% EQU 0.8 (node node_modules\node-gyp\bin\node-gyp.js rebuild --msvs_version=2013 --directory test) ELSE (npm run rebuild-tests) - -# Post-install test scripts. -test_script: - # Output useful info for debugging. - - node --version - - npm --version - # run tests - - IF %nodejs_version% LSS 1 (npm test) ELSE (iojs node_modules\tap\bin\tap.js --gc test/js/*-test.js) - -# Don't actually build. -build: off - -# Set build version format here instead of in the admin panel. -version: "{build}" diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh deleted file mode 100755 index 75a975af..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/doc/.build.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/usr/bin/env bash - -files=" \ - methods.md \ - scopes.md \ - persistent.md \ - new.md \ - converters.md \ - maybe_types.md \ - script.md \ - errors.md \ - buffers.md \ - callback.md \ - asyncworker.md \ - string_bytes.md \ - v8_internals.md \ - v8_misc.md \ - node_misc.md \ -" - -__dirname=$(dirname "${BASH_SOURCE[0]}") -head=$(perl -e 'while (<>) { if (!$en){print;} if ($_=~/ NanNew("foo").ToLocalChecked() */ - if (arguments[groups[3][0]] === 'NanNew') { - return [arguments[0], '.ToLocalChecked()'].join(''); - } - - /* insert warning for removed functions as comment on new line above */ - switch (arguments[groups[4][0]]) { - case 'GetIndexedPropertiesExternalArrayData': - case 'GetIndexedPropertiesExternalArrayDataLength': - case 'GetIndexedPropertiesExternalArrayDataType': - case 'GetIndexedPropertiesPixelData': - case 'GetIndexedPropertiesPixelDataLength': - case 'HasIndexedPropertiesInExternalArrayData': - case 'HasIndexedPropertiesInPixelData': - case 'SetIndexedPropertiesToExternalArrayData': - case 'SetIndexedPropertiesToPixelData': - return arguments[groups[4][0] - 1] ? arguments[0] : [warning1, arguments[0]].join(''); - default: - } - - /* remove unnecessary NanScope() */ - switch (arguments[groups[5][0]]) { - case 'NAN_GETTER': - case 'NAN_METHOD': - case 'NAN_SETTER': - case 'NAN_INDEX_DELETER': - case 'NAN_INDEX_ENUMERATOR': - case 'NAN_INDEX_GETTER': - case 'NAN_INDEX_QUERY': - case 'NAN_INDEX_SETTER': - case 'NAN_PROPERTY_DELETER': - case 'NAN_PROPERTY_ENUMERATOR': - case 'NAN_PROPERTY_GETTER': - case 'NAN_PROPERTY_QUERY': - case 'NAN_PROPERTY_SETTER': - return arguments[groups[5][0] - 1]; - default: - } - - /* Value converstion */ - switch (arguments[groups[6][0]]) { - case 'Boolean': - case 'Int32': - case 'Integer': - case 'Number': - case 'Object': - case 'String': - case 'Uint32': - return [arguments[groups[6][0] - 2], 'NanTo(', arguments[groups[6][0] - 1]].join(''); - default: - } - - /* other value conversion */ - switch (arguments[groups[7][0]]) { - case 'BooleanValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Int32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'IntegerValue': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - case 'Uint32Value': - return [arguments[groups[7][0] - 2], 'NanTo(', arguments[groups[7][0] - 1]].join(''); - default: - } - - /* NAN_WEAK_CALLBACK */ - if (arguments[groups[8][0]] === 'NAN_WEAK_CALLBACK') { - return ['template\nvoid ', - arguments[groups[8][0] + 1], '(const NanWeakCallbackInfo &data)'].join(''); - } - - /* use methods on NAN classes instead */ - switch (arguments[groups[9][0]]) { - case 'NanDisposePersistent': - return [arguments[groups[9][0] + 1], '.Reset('].join(''); - case 'NanObjectWrapHandle': - return [arguments[groups[9][0] + 1], '->handle('].join(''); - default: - } - - /* use method on NanPersistent instead */ - if (arguments[groups[10][0]] === 'NanMakeWeakPersistent') { - return arguments[groups[10][0] + 1] + '.SetWeak('; - } - - /* These return Maybes, the upper ones take no arguments */ - switch (arguments[groups[11][0]]) { - case 'GetEndColumn': - case 'GetFunction': - case 'GetLineNumber': - case 'GetOwnPropertyNames': - case 'GetPropertyNames': - case 'GetSourceLine': - case 'GetStartColumn': - case 'NewInstance': - case 'ObjectProtoToString': - case 'ToArrayIndex': - case 'ToDetailString': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1]].join(''); - case 'CallAsConstructor': - case 'CallAsFunction': - case 'CloneElementAt': - case 'Delete': - case 'ForceSet': - case 'Get': - case 'GetPropertyAttributes': - case 'GetRealNamedProperty': - case 'GetRealNamedPropertyInPrototypeChain': - case 'Has': - case 'HasOwnProperty': - case 'HasRealIndexedProperty': - case 'HasRealNamedCallbackProperty': - case 'HasRealNamedProperty': - case 'Set': - case 'SetAccessor': - case 'SetIndexedPropertyHandler': - case 'SetNamedPropertyHandler': - case 'SetPrototype': - return [arguments[groups[11][0] - 2], 'Nan', arguments[groups[11][0]], '(', arguments[groups[11][0] - 1], ', '].join(''); - default: - } - - /* Automatic ToLocalChecked(), take it or leave it */ - switch (arguments[groups[12][0]]) { - case 'Date': - case 'String': - case 'RegExp': - return ['NanNew', arguments[groups[12][0] - 1], arguments[groups[12][0] + 1], '.ToLocalChecked()'].join(''); - default: - } - - /* NanEquals is now required for uniformity */ - if (arguments[groups[13][0]] === 'Equals') { - return [arguments[groups[13][0] - 1], 'NanEquals(', arguments[groups[13][0] - 1], ', ', arguments[groups[13][0] + 1]].join(''); - } - - /* use method on replacement class instead */ - if (arguments[groups[14][0]] === 'NanAssignPersistent') { - return [arguments[groups[14][0] + 1], '.Reset('].join(''); - } - - /* args --> info */ - if (arguments[groups[15][0]] === 'args') { - return [arguments[groups[15][0] - 1], 'info', arguments[groups[15][0] + 1]].join(''); - } - - /* ObjectWrap --> NanObjectWrap */ - if (arguments[groups[16][0]] === 'ObjectWrap') { - return [arguments[groups[16][0] - 1], 'NanObjectWrap', arguments[groups[16][0] + 1]].join(''); - } - - /* Persistent --> NanPersistent */ - if (arguments[groups[17][0]] === 'Persistent') { - return [arguments[groups[17][0] - 1], 'NanPersistent', arguments[groups[17][0] + 1]].join(''); - } - - /* This should not happen. A switch is probably missing a case if it does. */ - throw 'Unhandled match: ' + arguments[0]; -} - -/* reads a file, runs replacement and writes it back */ -function processFile(file) { - fs.readFile(file, {encoding: 'utf8'}, function (err, data) { - if (err) { - throw err; - } - - /* run replacement twice, might need more runs */ - fs.writeFile(file, data.replace(master, replace).replace(master, replace), function (err) { - if (err) { - throw err; - } - }); - }); -} - -/* process file names from command line and process the identified files */ -for (i = 2, length = process.argv.length; i < length; i++) { - glob(process.argv[i], function (err, matches) { - if (err) { - throw err; - } - matches.forEach(processFile); - }); -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md deleted file mode 100644 index 7f07e4b8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/README.md +++ /dev/null @@ -1,14 +0,0 @@ -1to2 naively converts source code files from NAN 1 to NAN 2. There will be erroneous conversions, -false positives and missed opportunities. The input files are rewritten in place. Make sure that -you have backups. You will have to manually review the changes afterwards and do some touchups. - -```sh -$ tools/1to2.js - - Usage: 1to2 [options] - - Options: - - -h, --help output usage information - -V, --version output the version number -``` diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json deleted file mode 100644 index 2dcdd789..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/node_modules/nan/tools/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "1to2", - "version": "1.0.0", - "description": "NAN 1 -> 2 Migration Script", - "main": "1to2.js", - "repository": { - "type": "git", - "url": "git://github.com/nodejs/nan.git" - }, - "contributors": [ - "Benjamin Byholm (https://github.com/kkoopa/)", - "Mathias Küsel (https://github.com/mathiask88/)" - ], - "dependencies": { - "glob": "~5.0.10", - "commander": "~2.8.1" - }, - "license": "MIT" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json deleted file mode 100644 index a81e9bbe..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "kerberos", - "version": "0.0.15", - "description": "Kerberos library for Node.js", - "main": "index.js", - "repository": { - "type": "git", - "url": "https://github.com/christkv/kerberos.git" - }, - "keywords": [ - "kerberos", - "security", - "authentication" - ], - "dependencies": { - "nan": "~2.0" - }, - "devDependencies": { - "nodeunit": "latest" - }, - "scripts": { - "install": "(node-gyp rebuild) || (exit 0)", - "test": "nodeunit ./test" - }, - "author": { - "name": "Christian Amor Kvalheim" - }, - "license": "Apache 2.0", - "gitHead": "035be2e4619d7f3d7ea5103da1f60a6045ef8d7c", - "bugs": { - "url": "https://github.com/christkv/kerberos/issues" - }, - "homepage": "https://github.com/christkv/kerberos", - "_id": "kerberos@0.0.15", - "_shasum": "c7dd5a2d311ce79c308c2670a9187d9bf745ed52", - "_from": "kerberos@~0.0", - "_npmVersion": "2.14.4", - "_nodeVersion": "4.1.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "c7dd5a2d311ce79c308c2670a9187d9bf745ed52", - "tarball": "http://registry.npmjs.org/kerberos/-/kerberos-0.0.15.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/kerberos/-/kerberos-0.0.15.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js deleted file mode 100644 index a06c5fdf..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_tests.js +++ /dev/null @@ -1,34 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Simple initialize of Kerberos object'] = function(test) { - var Kerberos = require('../lib/kerberos.js').Kerberos; - var kerberos = new Kerberos(); - // console.dir(kerberos) - - // Initiate kerberos client - kerberos.authGSSClientInit('mongodb@kdc.10gen.me', Kerberos.GSS_C_MUTUAL_FLAG, function(err, context) { - console.log("===================================== authGSSClientInit") - test.equal(null, err); - test.ok(context != null && typeof context == 'object'); - // console.log("===================================== authGSSClientInit") - console.dir(err) - console.dir(context) - // console.dir(typeof result) - - // Perform the first step - kerberos.authGSSClientStep(context, function(err, result) { - console.log("===================================== authGSSClientStep") - console.dir(err) - console.dir(result) - console.dir(context) - - test.done(); - }); - }); -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js deleted file mode 100644 index c8509db8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/kerberos_win32_test.js +++ /dev/null @@ -1,15 +0,0 @@ -if (/^win/.test(process.platform)) { - -exports['Simple initialize of Kerberos win32 object'] = function(test) { - var KerberosNative = require('../build/Release/kerberos').Kerberos; - // console.dir(KerberosNative) - var kerberos = new KerberosNative(); - console.log("=========================================== 0") - console.dir(kerberos.acquireAlternateCredentials("dev1@10GEN.ME", "a")); - console.log("=========================================== 1") - console.dir(kerberos.prepareOutboundPackage("mongodb/kdc.10gen.com")); - console.log("=========================================== 2") - test.done(); -} - -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js deleted file mode 100644 index 3531b6bc..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_descriptor_tests.js +++ /dev/null @@ -1,41 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Initialize a security Buffer Descriptor'] = function(test) { - var SecurityBufferDescriptor = require('../../lib/sspi.js').SecurityBufferDescriptor - SecurityBuffer = require('../../lib/sspi.js').SecurityBuffer; - - // Create descriptor with single Buffer - var securityDescriptor = new SecurityBufferDescriptor(100); - try { - // Fail to work due to no valid Security Buffer - securityDescriptor = new SecurityBufferDescriptor(["hello"]); - test.ok(false); - } catch(err){} - - // Should Correctly construct SecurityBuffer - var buffer = new SecurityBuffer(SecurityBuffer.DATA, 100); - securityDescriptor = new SecurityBufferDescriptor([buffer]); - // Should correctly return a buffer - var result = securityDescriptor.toBuffer(); - test.equal(100, result.length); - - // Should Correctly construct SecurityBuffer - var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - securityDescriptor = new SecurityBufferDescriptor([buffer]); - var result = securityDescriptor.toBuffer(); - test.equal("hello world", result.toString()); - - // Test passing in more than one Buffer - var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - var buffer2 = new SecurityBuffer(SecurityBuffer.STREAM, new Buffer("adam and eve")); - securityDescriptor = new SecurityBufferDescriptor([buffer, buffer2]); - var result = securityDescriptor.toBuffer(); - test.equal("hello worldadam and eve", result.toString()); - test.done(); -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js deleted file mode 100644 index b52b9598..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_buffer_tests.js +++ /dev/null @@ -1,22 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Initialize a security Buffer'] = function(test) { - var SecurityBuffer = require('../../lib/sspi.js').SecurityBuffer; - // Create empty buffer - var securityBuffer = new SecurityBuffer(SecurityBuffer.DATA, 100); - var buffer = securityBuffer.toBuffer(); - test.equal(100, buffer.length); - - // Access data passed in - var allocated_buffer = new Buffer(256); - securityBuffer = new SecurityBuffer(SecurityBuffer.DATA, allocated_buffer); - buffer = securityBuffer.toBuffer(); - test.deepEqual(allocated_buffer, buffer); - test.done(); -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js deleted file mode 100644 index 77581800..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/node_modules/kerberos/test/win32/security_credentials_tests.js +++ /dev/null @@ -1,55 +0,0 @@ -exports.setUp = function(callback) { - callback(); -} - -exports.tearDown = function(callback) { - callback(); -} - -exports['Initialize a set of security credentials'] = function(test) { - var SecurityCredentials = require('../../lib/sspi.js').SecurityCredentials; - - // Aquire some credentials - try { - var credentials = SecurityCredentials.aquire('Kerberos', 'dev1@10GEN.ME', 'a'); - } catch(err) { - console.dir(err) - test.ok(false); - } - - - - // console.dir(SecurityCredentials); - - // var SecurityBufferDescriptor = require('../../lib/sspi.js').SecurityBufferDescriptor - // SecurityBuffer = require('../../lib/sspi.js').SecurityBuffer; - - // // Create descriptor with single Buffer - // var securityDescriptor = new SecurityBufferDescriptor(100); - // try { - // // Fail to work due to no valid Security Buffer - // securityDescriptor = new SecurityBufferDescriptor(["hello"]); - // test.ok(false); - // } catch(err){} - - // // Should Correctly construct SecurityBuffer - // var buffer = new SecurityBuffer(SecurityBuffer.DATA, 100); - // securityDescriptor = new SecurityBufferDescriptor([buffer]); - // // Should correctly return a buffer - // var result = securityDescriptor.toBuffer(); - // test.equal(100, result.length); - - // // Should Correctly construct SecurityBuffer - // var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - // securityDescriptor = new SecurityBufferDescriptor([buffer]); - // var result = securityDescriptor.toBuffer(); - // test.equal("hello world", result.toString()); - - // // Test passing in more than one Buffer - // var buffer = new SecurityBuffer(SecurityBuffer.DATA, new Buffer("hello world")); - // var buffer2 = new SecurityBuffer(SecurityBuffer.STREAM, new Buffer("adam and eve")); - // securityDescriptor = new SecurityBufferDescriptor([buffer, buffer2]); - // var result = securityDescriptor.toBuffer(); - // test.equal("hello worldadam and eve", result.toString()); - test.done(); -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json deleted file mode 100644 index f690f67a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "mongodb-core", - "version": "1.2.14", - "description": "Core MongoDB driver functionality, no bells and whistles and meant for integration not end applications", - "main": "index.js", - "scripts": { - "test": "node test/runner.js -t functional" - }, - "repository": { - "type": "git", - "url": "git://github.com/christkv/mongodb-core.git" - }, - "keywords": [ - "mongodb", - "core" - ], - "dependencies": { - "bson": "~0.4", - "kerberos": "~0.0" - }, - "devDependencies": { - "integra": "0.1.8", - "optimist": "latest", - "jsdoc": "3.3.0-alpha8", - "semver": "4.1.0", - "gleak": "0.5.0", - "mongodb-tools": "~1.0", - "mkdirp": "0.5.0", - "rimraf": "2.2.6", - "mongodb-version-manager": "^0.7.1", - "co": "4.5.4" - }, - "optionalDependencies": { - "kerberos": "~0.0" - }, - "author": { - "name": "Christian Kvalheim" - }, - "license": "Apache 2.0", - "bugs": { - "url": "https://github.com/christkv/mongodb-core/issues" - }, - "homepage": "https://github.com/christkv/mongodb-core", - "gitHead": "ea4e6c9fe93e4ace4cbffb816d47ee282c1cd844", - "_id": "mongodb-core@1.2.14", - "_shasum": "0f1393778b71f1e2b86228fd160ec9ad5a8cd9a3", - "_from": "mongodb-core@1.2.14", - "_npmVersion": "2.14.4", - "_nodeVersion": "4.1.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "0f1393778b71f1e2b86228fd160ec9ad5a8cd9a3", - "tarball": "http://registry.npmjs.org/mongodb-core/-/mongodb-core-1.2.14.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/mongodb-core/-/mongodb-core-1.2.14.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat deleted file mode 100644 index 25ccf0b6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/mongodb-core/simple_2_document_limit_toArray.dat +++ /dev/null @@ -1,11000 +0,0 @@ -1 2 -2 1 -3 0 -4 0 -5 1 -6 0 -7 0 -8 0 -9 0 -10 1 -11 0 -12 0 -13 0 -14 1 -15 0 -16 0 -17 0 -18 1 -19 0 -20 0 -21 0 -22 1 -23 0 -24 0 -25 0 -26 0 -27 1 -28 0 -29 0 -30 0 -31 1 -32 0 -33 0 -34 0 -35 0 -36 0 -37 1 -38 0 -39 0 -40 0 -41 0 -42 0 -43 1 -44 0 -45 0 -46 0 -47 0 -48 0 -49 0 -50 0 -51 0 -52 0 -53 0 -54 0 -55 0 -56 0 -57 0 -58 0 -59 1 -60 0 -61 2 -62 0 -63 0 -64 1 -65 0 -66 0 -67 0 -68 1 -69 0 -70 0 -71 0 -72 0 -73 1 -74 0 -75 0 -76 0 -77 0 -78 0 -79 1 -80 0 -81 0 -82 0 -83 0 -84 0 -85 0 -86 1 -87 0 -88 0 -89 0 -90 0 -91 0 -92 0 -93 1 -94 0 -95 0 -96 0 -97 0 -98 0 -99 0 -100 0 -101 1 -102 0 -103 0 -104 0 -105 0 -106 0 -107 0 -108 1 -109 0 -110 0 -111 0 -112 0 -113 0 -114 0 -115 1 -116 0 -117 0 -118 0 -119 1 -120 0 -121 0 -122 0 -123 0 -124 0 -125 0 -126 1 -127 0 -128 1 -129 0 -130 0 -131 0 -132 1 -133 1 -134 0 -135 0 -136 0 -137 1 -138 0 -139 0 -140 0 -141 0 -142 0 -143 0 -144 1 -145 0 -146 0 -147 0 -148 0 -149 0 -150 0 -151 0 -152 0 -153 1 -154 0 -155 0 -156 0 -157 0 -158 0 -159 0 -160 0 -161 0 -162 0 -163 0 -164 0 -165 0 -166 0 -167 0 -168 0 -169 0 -170 1 -171 0 -172 0 -173 0 -174 0 -175 0 -176 0 -177 0 -178 1 -179 0 -180 0 -181 0 -182 0 -183 0 -184 0 -185 0 -186 1 -187 0 -188 0 -189 0 -190 0 -191 0 -192 1 -193 0 -194 0 -195 0 -196 1 -197 0 -198 0 -199 0 -200 1 -201 0 -202 0 -203 0 -204 0 -205 0 -206 0 -207 1 -208 0 -209 0 -210 0 -211 0 -212 0 -213 0 -214 0 -215 1 -216 0 -217 0 -218 0 -219 0 -220 0 -221 0 -222 0 -223 1 -224 0 -225 0 -226 0 -227 0 -228 0 -229 0 -230 1 -231 0 -232 0 -233 0 -234 0 -235 0 -236 0 -237 1 -238 0 -239 0 -240 0 -241 0 -242 0 -243 0 -244 0 -245 1 -246 0 -247 0 -248 0 -249 0 -250 0 -251 0 -252 0 -253 0 -254 1 -255 0 -256 0 -257 0 -258 0 -259 1 -260 0 -261 0 -262 0 -263 0 -264 0 -265 1 -266 0 -267 0 -268 0 -269 0 -270 0 -271 0 -272 1 -273 0 -274 0 -275 0 -276 0 -277 0 -278 0 -279 0 -280 0 -281 1 -282 0 -283 1 -284 0 -285 0 -286 1 -287 0 -288 0 -289 0 -290 0 -291 1 -292 0 -293 0 -294 0 -295 0 -296 1 -297 0 -298 0 -299 0 -300 0 -301 0 -302 0 -303 1 -304 0 -305 0 -306 0 -307 0 -308 0 -309 1 -310 0 -311 0 -312 0 -313 0 -314 0 -315 0 -316 1 -317 0 -318 0 -319 0 -320 0 -321 0 -322 0 -323 0 -324 0 -325 1 -326 0 -327 0 -328 0 -329 0 -330 0 -331 0 -332 0 -333 0 -334 1 -335 0 -336 0 -337 0 -338 0 -339 0 -340 0 -341 0 -342 0 -343 1 -344 0 -345 0 -346 0 -347 0 -348 0 -349 0 -350 0 -351 0 -352 1 -353 0 -354 0 -355 0 -356 0 -357 0 -358 0 -359 0 -360 0 -361 1 -362 0 -363 0 -364 0 -365 0 -366 0 -367 0 -368 0 -369 1 -370 0 -371 0 -372 0 -373 0 -374 0 -375 0 -376 0 -377 1 -378 0 -379 0 -380 0 -381 0 -382 0 -383 0 -384 0 -385 1 -386 0 -387 0 -388 0 -389 0 -390 1 -391 0 -392 0 -393 0 -394 0 -395 0 -396 0 -397 0 -398 0 -399 0 -400 0 -401 0 -402 1 -403 0 -404 0 -405 0 -406 0 -407 0 -408 0 -409 0 -410 1 -411 0 -412 0 -413 0 -414 0 -415 0 -416 0 -417 0 -418 0 -419 1 -420 0 -421 0 -422 0 -423 0 -424 0 -425 0 -426 0 -427 1 -428 0 -429 0 -430 0 -431 0 -432 0 -433 0 -434 0 -435 1 -436 0 -437 0 -438 0 -439 0 -440 0 -441 0 -442 0 -443 1 -444 0 -445 0 -446 0 -447 0 -448 0 -449 0 -450 1 -451 0 -452 0 -453 0 -454 0 -455 0 -456 1 -457 0 -458 0 -459 0 -460 0 -461 0 -462 0 -463 0 -464 1 -465 0 -466 0 -467 0 -468 0 -469 0 -470 0 -471 0 -472 0 -473 1 -474 0 -475 0 -476 0 -477 0 -478 0 -479 0 -480 0 -481 1 -482 0 -483 0 -484 0 -485 0 -486 0 -487 0 -488 0 -489 0 -490 1 -491 0 -492 0 -493 0 -494 0 -495 0 -496 0 -497 0 -498 0 -499 0 -500 0 -501 0 -502 0 -503 0 -504 1 -505 0 -506 0 -507 0 -508 0 -509 0 -510 0 -511 0 -512 1 -513 0 -514 0 -515 0 -516 0 -517 0 -518 0 -519 4 -520 0 -521 1 -522 0 -523 0 -524 0 -525 1 -526 0 -527 0 -528 0 -529 0 -530 1 -531 0 -532 0 -533 0 -534 1 -535 0 -536 0 -537 0 -538 0 -539 1 -540 0 -541 0 -542 0 -543 0 -544 0 -545 1 -546 0 -547 0 -548 0 -549 0 -550 0 -551 1 -552 0 -553 0 -554 0 -555 0 -556 0 -557 0 -558 0 -559 1 -560 0 -561 0 -562 0 -563 0 -564 0 -565 0 -566 0 -567 1 -568 0 -569 0 -570 0 -571 0 -572 0 -573 0 -574 0 -575 0 -576 1 -577 0 -578 0 -579 0 -580 0 -581 0 -582 0 -583 0 -584 0 -585 0 -586 0 -587 0 -588 0 -589 0 -590 0 -591 0 -592 0 -593 1 -594 0 -595 0 -596 0 -597 0 -598 0 -599 0 -600 0 -601 0 -602 1 -603 0 -604 0 -605 0 -606 0 -607 0 -608 0 -609 0 -610 0 -611 1 -612 0 -613 0 -614 0 -615 0 -616 0 -617 0 -618 0 -619 0 -620 1 -621 0 -622 0 -623 0 -624 0 -625 0 -626 0 -627 0 -628 0 -629 1 -630 0 -631 0 -632 0 -633 0 -634 0 -635 0 -636 0 -637 0 -638 0 -639 1 -640 0 -641 0 -642 0 -643 0 -644 0 -645 0 -646 1 -647 0 -648 0 -649 0 -650 0 -651 0 -652 1 -653 1 -654 0 -655 0 -656 1 -657 0 -658 1 -659 0 -660 0 -661 0 -662 0 -663 0 -664 1 -665 0 -666 0 -667 0 -668 0 -669 0 -670 0 -671 0 -672 0 -673 0 -674 0 -675 0 -676 0 -677 1 -678 0 -679 0 -680 0 -681 0 -682 0 -683 0 -684 0 -685 0 -686 1 -687 0 -688 0 -689 0 -690 0 -691 0 -692 0 -693 0 -694 0 -695 1 -696 0 -697 0 -698 0 -699 0 -700 0 -701 0 -702 0 -703 1 -704 0 -705 0 -706 0 -707 0 -708 0 -709 0 -710 0 -711 0 -712 1 -713 0 -714 0 -715 0 -716 0 -717 0 -718 0 -719 0 -720 1 -721 0 -722 0 -723 0 -724 0 -725 0 -726 0 -727 0 -728 1 -729 0 -730 0 -731 0 -732 0 -733 0 -734 0 -735 0 -736 0 -737 1 -738 0 -739 0 -740 0 -741 0 -742 0 -743 0 -744 0 -745 1 -746 0 -747 0 -748 0 -749 0 -750 0 -751 0 -752 0 -753 1 -754 0 -755 0 -756 0 -757 0 -758 0 -759 0 -760 0 -761 1 -762 0 -763 0 -764 0 -765 0 -766 0 -767 0 -768 1 -769 0 -770 0 -771 0 -772 0 -773 0 -774 0 -775 0 -776 0 -777 1 -778 0 -779 0 -780 0 -781 0 -782 0 -783 0 -784 0 -785 0 -786 1 -787 0 -788 0 -789 0 -790 0 -791 0 -792 1 -793 0 -794 0 -795 0 -796 0 -797 0 -798 0 -799 0 -800 0 -801 1 -802 0 -803 0 -804 0 -805 0 -806 0 -807 0 -808 0 -809 0 -810 0 -811 0 -812 0 -813 0 -814 0 -815 0 -816 0 -817 0 -818 0 -819 0 -820 1 -821 0 -822 0 -823 0 -824 0 -825 0 -826 0 -827 0 -828 0 -829 1 -830 0 -831 0 -832 0 -833 0 -834 0 -835 0 -836 0 -837 1 -838 0 -839 0 -840 0 -841 0 -842 0 -843 0 -844 0 -845 0 -846 1 -847 0 -848 0 -849 0 -850 0 -851 0 -852 0 -853 0 -854 0 -855 2 -856 0 -857 0 -858 0 -859 0 -860 0 -861 0 -862 1 -863 0 -864 0 -865 0 -866 0 -867 0 -868 0 -869 0 -870 0 -871 1 -872 0 -873 0 -874 0 -875 0 -876 0 -877 0 -878 1 -879 0 -880 0 -881 0 -882 0 -883 0 -884 0 -885 0 -886 0 -887 0 -888 0 -889 0 -890 0 -891 0 -892 0 -893 0 -894 0 -895 0 -896 1 -897 0 -898 0 -899 0 -900 0 -901 0 -902 0 -903 0 -904 0 -905 0 -906 1 -907 0 -908 0 -909 0 -910 0 -911 0 -912 0 -913 0 -914 0 -915 1 -916 0 -917 0 -918 0 -919 0 -920 0 -921 0 -922 1 -923 0 -924 0 -925 0 -926 0 -927 0 -928 0 -929 0 -930 1 -931 0 -932 0 -933 0 -934 0 -935 0 -936 0 -937 0 -938 0 -939 1 -940 0 -941 0 -942 0 -943 0 -944 0 -945 0 -946 0 -947 0 -948 0 -949 1 -950 0 -951 0 -952 0 -953 0 -954 0 -955 0 -956 0 -957 0 -958 1 -959 0 -960 0 -961 0 -962 0 -963 0 -964 0 -965 0 -966 0 -967 0 -968 1 -969 0 -970 0 -971 0 -972 0 -973 0 -974 0 -975 0 -976 0 -977 0 -978 1 -979 0 -980 0 -981 0 -982 0 -983 0 -984 0 -985 0 -986 0 -987 0 -988 1 -989 0 -990 0 -991 0 -992 0 -993 0 -994 0 -995 0 -996 0 -997 1 -998 0 -999 0 -1000 0 -1001 0 -1002 0 -1003 0 -1004 0 -1005 1 -1006 0 -1007 0 -1008 0 -1009 0 -1010 0 -1011 0 -1012 1 -1013 0 -1014 0 -1015 0 -1016 0 -1017 0 -1018 0 -1019 0 -1020 0 -1021 0 -1022 0 -1023 0 -1024 0 -1025 0 -1026 0 -1027 0 -1028 0 -1029 0 -1030 0 -1031 1 -1032 0 -1033 0 -1034 0 -1035 0 -1036 0 -1037 0 -1038 0 -1039 0 -1040 0 -1041 0 -1042 1 -1043 0 -1044 0 -1045 0 -1046 0 -1047 0 -1048 0 -1049 0 -1050 1 -1051 0 -1052 0 -1053 0 -1054 0 -1055 0 -1056 0 -1057 1 -1058 0 -1059 0 -1060 0 -1061 0 -1062 0 -1063 0 -1064 0 -1065 0 -1066 0 -1067 1 -1068 0 -1069 0 -1070 0 -1071 0 -1072 0 -1073 0 -1074 0 -1075 0 -1076 0 -1077 1 -1078 0 -1079 0 -1080 0 -1081 0 -1082 0 -1083 0 -1084 0 -1085 0 -1086 0 -1087 1 -1088 0 -1089 0 -1090 0 -1091 0 -1092 0 -1093 0 -1094 1 -1095 0 -1096 0 -1097 0 -1098 0 -1099 0 -1100 0 -1101 0 -1102 1 -1103 0 -1104 0 -1105 0 -1106 0 -1107 0 -1108 0 -1109 0 -1110 0 -1111 1 -1112 0 -1113 0 -1114 0 -1115 0 -1116 0 -1117 0 -1118 0 -1119 0 -1120 1 -1121 0 -1122 0 -1123 0 -1124 0 -1125 0 -1126 0 -1127 0 -1128 0 -1129 0 -1130 1 -1131 0 -1132 0 -1133 0 -1134 0 -1135 0 -1136 0 -1137 0 -1138 0 -1139 0 -1140 1 -1141 0 -1142 0 -1143 0 -1144 0 -1145 0 -1146 0 -1147 0 -1148 0 -1149 0 -1150 0 -1151 1 -1152 0 -1153 0 -1154 0 -1155 0 -1156 0 -1157 0 -1158 0 -1159 0 -1160 1 -1161 0 -1162 0 -1163 0 -1164 0 -1165 0 -1166 0 -1167 1 -1168 0 -1169 0 -1170 0 -1171 0 -1172 0 -1173 0 -1174 0 -1175 0 -1176 1 -1177 0 -1178 0 -1179 0 -1180 0 -1181 0 -1182 1 -1183 0 -1184 0 -1185 0 -1186 0 -1187 0 -1188 0 -1189 0 -1190 1 -1191 0 -1192 0 -1193 0 -1194 0 -1195 0 -1196 0 -1197 0 -1198 1 -1199 0 -1200 0 -1201 0 -1202 0 -1203 0 -1204 0 -1205 0 -1206 1 -1207 0 -1208 0 -1209 0 -1210 0 -1211 0 -1212 0 -1213 0 -1214 0 -1215 0 -1216 1 -1217 0 -1218 0 -1219 0 -1220 0 -1221 0 -1222 0 -1223 0 -1224 0 -1225 0 -1226 1 -1227 0 -1228 0 -1229 0 -1230 0 -1231 0 -1232 0 -1233 0 -1234 0 -1235 0 -1236 0 -1237 0 -1238 0 -1239 1 -1240 0 -1241 0 -1242 0 -1243 0 -1244 0 -1245 0 -1246 0 -1247 0 -1248 1 -1249 0 -1250 0 -1251 0 -1252 0 -1253 0 -1254 0 -1255 0 -1256 0 -1257 1 -1258 0 -1259 0 -1260 0 -1261 0 -1262 0 -1263 0 -1264 0 -1265 0 -1266 1 -1267 0 -1268 0 -1269 0 -1270 0 -1271 0 -1272 0 -1273 0 -1274 0 -1275 1 -1276 0 -1277 0 -1278 0 -1279 0 -1280 0 -1281 0 -1282 0 -1283 0 -1284 0 -1285 0 -1286 0 -1287 0 -1288 0 -1289 0 -1290 0 -1291 0 -1292 0 -1293 1 -1294 0 -1295 0 -1296 0 -1297 0 -1298 0 -1299 0 -1300 0 -1301 0 -1302 0 -1303 0 -1304 0 -1305 0 -1306 0 -1307 0 -1308 0 -1309 0 -1310 1 -1311 0 -1312 0 -1313 0 -1314 0 -1315 0 -1316 0 -1317 0 -1318 1 -1319 0 -1320 0 -1321 0 -1322 0 -1323 0 -1324 0 -1325 0 -1326 0 -1327 1 -1328 0 -1329 0 -1330 0 -1331 0 -1332 0 -1333 0 -1334 0 -1335 0 -1336 1 -1337 0 -1338 0 -1339 0 -1340 0 -1341 0 -1342 0 -1343 0 -1344 0 -1345 0 -1346 1 -1347 0 -1348 0 -1349 0 -1350 0 -1351 0 -1352 0 -1353 0 -1354 0 -1355 0 -1356 1 -1357 0 -1358 0 -1359 0 -1360 0 -1361 0 -1362 0 -1363 0 -1364 0 -1365 1 -1366 0 -1367 0 -1368 0 -1369 0 -1370 0 -1371 0 -1372 0 -1373 1 -1374 0 -1375 0 -1376 0 -1377 0 -1378 0 -1379 0 -1380 0 -1381 0 -1382 0 -1383 1 -1384 0 -1385 0 -1386 0 -1387 0 -1388 0 -1389 0 -1390 0 -1391 0 -1392 1 -1393 0 -1394 0 -1395 0 -1396 0 -1397 0 -1398 0 -1399 0 -1400 1 -1401 0 -1402 0 -1403 0 -1404 0 -1405 0 -1406 0 -1407 0 -1408 0 -1409 0 -1410 1 -1411 0 -1412 0 -1413 0 -1414 0 -1415 0 -1416 0 -1417 0 -1418 0 -1419 0 -1420 1 -1421 0 -1422 0 -1423 0 -1424 0 -1425 0 -1426 0 -1427 0 -1428 0 -1429 0 -1430 0 -1431 1 -1432 0 -1433 0 -1434 0 -1435 0 -1436 0 -1437 0 -1438 0 -1439 0 -1440 0 -1441 1 -1442 0 -1443 0 -1444 0 -1445 0 -1446 0 -1447 2 -1448 0 -1449 0 -1450 0 -1451 0 -1452 0 -1453 0 -1454 0 -1455 1 -1456 0 -1457 0 -1458 0 -1459 0 -1460 0 -1461 0 -1462 0 -1463 0 -1464 0 -1465 1 -1466 0 -1467 0 -1468 0 -1469 0 -1470 0 -1471 0 -1472 0 -1473 0 -1474 0 -1475 1 -1476 0 -1477 0 -1478 0 -1479 0 -1480 0 -1481 0 -1482 0 -1483 0 -1484 0 -1485 1 -1486 0 -1487 0 -1488 0 -1489 0 -1490 0 -1491 0 -1492 0 -1493 0 -1494 1 -1495 0 -1496 0 -1497 0 -1498 0 -1499 0 -1500 0 -1501 0 -1502 0 -1503 1 -1504 0 -1505 0 -1506 0 -1507 0 -1508 0 -1509 0 -1510 0 -1511 0 -1512 0 -1513 0 -1514 0 -1515 0 -1516 0 -1517 0 -1518 0 -1519 0 -1520 1 -1521 0 -1522 0 -1523 0 -1524 0 -1525 0 -1526 0 -1527 0 -1528 0 -1529 1 -1530 0 -1531 0 -1532 0 -1533 0 -1534 0 -1535 0 -1536 0 -1537 0 -1538 0 -1539 1 -1540 0 -1541 0 -1542 0 -1543 0 -1544 0 -1545 0 -1546 0 -1547 0 -1548 1 -1549 0 -1550 0 -1551 0 -1552 0 -1553 0 -1554 0 -1555 0 -1556 0 -1557 1 -1558 0 -1559 0 -1560 0 -1561 0 -1562 0 -1563 0 -1564 0 -1565 0 -1566 0 -1567 1 -1568 0 -1569 0 -1570 0 -1571 0 -1572 0 -1573 0 -1574 0 -1575 1 -1576 0 -1577 0 -1578 0 -1579 0 -1580 0 -1581 0 -1582 0 -1583 0 -1584 1 -1585 0 -1586 0 -1587 0 -1588 0 -1589 0 -1590 0 -1591 0 -1592 0 -1593 1 -1594 0 -1595 0 -1596 0 -1597 0 -1598 0 -1599 0 -1600 0 -1601 0 -1602 1 -1603 0 -1604 0 -1605 0 -1606 0 -1607 0 -1608 0 -1609 0 -1610 0 -1611 1 -1612 0 -1613 0 -1614 0 -1615 0 -1616 0 -1617 0 -1618 0 -1619 0 -1620 0 -1621 1 -1622 0 -1623 0 -1624 0 -1625 0 -1626 0 -1627 0 -1628 0 -1629 0 -1630 0 -1631 1 -1632 0 -1633 0 -1634 0 -1635 0 -1636 0 -1637 0 -1638 0 -1639 0 -1640 1 -1641 0 -1642 0 -1643 0 -1644 0 -1645 0 -1646 0 -1647 0 -1648 0 -1649 0 -1650 1 -1651 0 -1652 0 -1653 0 -1654 0 -1655 0 -1656 0 -1657 0 -1658 0 -1659 0 -1660 1 -1661 0 -1662 0 -1663 0 -1664 0 -1665 0 -1666 0 -1667 0 -1668 0 -1669 0 -1670 1 -1671 0 -1672 0 -1673 0 -1674 0 -1675 0 -1676 0 -1677 0 -1678 0 -1679 0 -1680 1 -1681 0 -1682 0 -1683 0 -1684 0 -1685 0 -1686 0 -1687 0 -1688 0 -1689 0 -1690 1 -1691 0 -1692 0 -1693 0 -1694 0 -1695 0 -1696 0 -1697 0 -1698 0 -1699 0 -1700 0 -1701 1 -1702 0 -1703 0 -1704 0 -1705 0 -1706 0 -1707 0 -1708 1 -1709 0 -1710 0 -1711 0 -1712 0 -1713 0 -1714 0 -1715 0 -1716 1 -1717 0 -1718 0 -1719 0 -1720 0 -1721 0 -1722 0 -1723 0 -1724 0 -1725 0 -1726 0 -1727 0 -1728 0 -1729 0 -1730 0 -1731 0 -1732 0 -1733 0 -1734 1 -1735 0 -1736 0 -1737 0 -1738 0 -1739 0 -1740 0 -1741 0 -1742 0 -1743 1 -1744 0 -1745 0 -1746 0 -1747 0 -1748 0 -1749 0 -1750 0 -1751 0 -1752 0 -1753 1 -1754 0 -1755 0 -1756 0 -1757 0 -1758 0 -1759 0 -1760 0 -1761 0 -1762 0 -1763 1 -1764 0 -1765 0 -1766 0 -1767 0 -1768 0 -1769 0 -1770 0 -1771 0 -1772 0 -1773 1 -1774 0 -1775 0 -1776 0 -1777 0 -1778 0 -1779 0 -1780 0 -1781 0 -1782 0 -1783 1 -1784 0 -1785 0 -1786 0 -1787 0 -1788 0 -1789 0 -1790 0 -1791 0 -1792 0 -1793 1 -1794 0 -1795 0 -1796 0 -1797 0 -1798 0 -1799 0 -1800 0 -1801 0 -1802 0 -1803 1 -1804 0 -1805 0 -1806 0 -1807 0 -1808 0 -1809 0 -1810 0 -1811 0 -1812 0 -1813 1 -1814 0 -1815 0 -1816 0 -1817 0 -1818 0 -1819 0 -1820 0 -1821 0 -1822 1 -1823 0 -1824 0 -1825 0 -1826 0 -1827 0 -1828 0 -1829 1 -1830 0 -1831 0 -1832 0 -1833 0 -1834 0 -1835 0 -1836 0 -1837 0 -1838 0 -1839 1 -1840 0 -1841 0 -1842 0 -1843 0 -1844 0 -1845 0 -1846 0 -1847 0 -1848 0 -1849 1 -1850 0 -1851 0 -1852 0 -1853 0 -1854 0 -1855 0 -1856 0 -1857 0 -1858 0 -1859 1 -1860 0 -1861 0 -1862 0 -1863 0 -1864 0 -1865 0 -1866 0 -1867 0 -1868 0 -1869 1 -1870 0 -1871 0 -1872 0 -1873 0 -1874 0 -1875 0 -1876 0 -1877 0 -1878 0 -1879 1 -1880 0 -1881 0 -1882 0 -1883 0 -1884 0 -1885 0 -1886 0 -1887 0 -1888 0 -1889 1 -1890 0 -1891 0 -1892 0 -1893 0 -1894 0 -1895 0 -1896 0 -1897 0 -1898 0 -1899 0 -1900 0 -1901 0 -1902 0 -1903 0 -1904 0 -1905 0 -1906 0 -1907 0 -1908 0 -1909 0 -1910 1 -1911 0 -1912 0 -1913 0 -1914 0 -1915 0 -1916 0 -1917 0 -1918 0 -1919 0 -1920 0 -1921 0 -1922 0 -1923 0 -1924 0 -1925 0 -1926 0 -1927 0 -1928 0 -1929 0 -1930 1 -1931 0 -1932 0 -1933 0 -1934 0 -1935 0 -1936 0 -1937 0 -1938 0 -1939 1 -1940 0 -1941 0 -1942 0 -1943 0 -1944 0 -1945 0 -1946 0 -1947 0 -1948 0 -1949 1 -1950 0 -1951 0 -1952 0 -1953 0 -1954 0 -1955 0 -1956 0 -1957 0 -1958 1 -1959 0 -1960 0 -1961 0 -1962 0 -1963 0 -1964 0 -1965 0 -1966 0 -1967 0 -1968 1 -1969 0 -1970 0 -1971 0 -1972 0 -1973 0 -1974 0 -1975 0 -1976 0 -1977 0 -1978 1 -1979 0 -1980 0 -1981 0 -1982 0 -1983 0 -1984 0 -1985 0 -1986 0 -1987 0 -1988 1 -1989 0 -1990 0 -1991 0 -1992 0 -1993 0 -1994 0 -1995 0 -1996 1 -1997 0 -1998 0 -1999 0 -2000 0 -2001 0 -2002 0 -2003 0 -2004 1 -2005 0 -2006 0 -2007 0 -2008 0 -2009 0 -2010 0 -2011 0 -2012 0 -2013 0 -2014 1 -2015 0 -2016 0 -2017 0 -2018 0 -2019 0 -2020 0 -2021 0 -2022 0 -2023 0 -2024 1 -2025 0 -2026 0 -2027 0 -2028 0 -2029 0 -2030 0 -2031 0 -2032 0 -2033 1 -2034 0 -2035 0 -2036 0 -2037 0 -2038 0 -2039 0 -2040 0 -2041 2 -2042 0 -2043 0 -2044 0 -2045 0 -2046 0 -2047 0 -2048 0 -2049 1 -2050 0 -2051 0 -2052 0 -2053 0 -2054 0 -2055 0 -2056 0 -2057 0 -2058 0 -2059 0 -2060 0 -2061 0 -2062 0 -2063 0 -2064 0 -2065 0 -2066 0 -2067 1 -2068 0 -2069 0 -2070 0 -2071 0 -2072 0 -2073 0 -2074 0 -2075 0 -2076 1 -2077 0 -2078 0 -2079 0 -2080 0 -2081 0 -2082 0 -2083 0 -2084 0 -2085 0 -2086 1 -2087 0 -2088 0 -2089 0 -2090 0 -2091 0 -2092 0 -2093 0 -2094 0 -2095 0 -2096 1 -2097 0 -2098 0 -2099 0 -2100 0 -2101 0 -2102 0 -2103 0 -2104 0 -2105 1 -2106 0 -2107 0 -2108 0 -2109 0 -2110 0 -2111 0 -2112 0 -2113 0 -2114 0 -2115 0 -2116 1 -2117 0 -2118 0 -2119 0 -2120 0 -2121 0 -2122 0 -2123 0 -2124 0 -2125 1 -2126 0 -2127 0 -2128 0 -2129 0 -2130 0 -2131 0 -2132 0 -2133 1 -2134 0 -2135 0 -2136 0 -2137 0 -2138 0 -2139 0 -2140 0 -2141 1 -2142 0 -2143 0 -2144 0 -2145 0 -2146 0 -2147 0 -2148 0 -2149 0 -2150 1 -2151 0 -2152 0 -2153 0 -2154 0 -2155 0 -2156 0 -2157 0 -2158 0 -2159 1 -2160 0 -2161 0 -2162 0 -2163 0 -2164 0 -2165 0 -2166 0 -2167 0 -2168 0 -2169 1 -2170 0 -2171 0 -2172 0 -2173 0 -2174 0 -2175 0 -2176 0 -2177 1 -2178 0 -2179 0 -2180 0 -2181 0 -2182 0 -2183 0 -2184 0 -2185 0 -2186 0 -2187 1 -2188 0 -2189 0 -2190 0 -2191 0 -2192 0 -2193 0 -2194 0 -2195 0 -2196 1 -2197 0 -2198 0 -2199 0 -2200 0 -2201 0 -2202 0 -2203 0 -2204 1 -2205 0 -2206 0 -2207 0 -2208 0 -2209 0 -2210 0 -2211 0 -2212 0 -2213 0 -2214 1 -2215 0 -2216 0 -2217 0 -2218 0 -2219 0 -2220 0 -2221 0 -2222 0 -2223 0 -2224 1 -2225 0 -2226 0 -2227 0 -2228 0 -2229 0 -2230 0 -2231 0 -2232 0 -2233 1 -2234 0 -2235 0 -2236 0 -2237 0 -2238 0 -2239 0 -2240 0 -2241 0 -2242 1 -2243 0 -2244 0 -2245 0 -2246 0 -2247 0 -2248 0 -2249 0 -2250 1 -2251 0 -2252 0 -2253 0 -2254 0 -2255 0 -2256 0 -2257 0 -2258 0 -2259 0 -2260 1 -2261 0 -2262 0 -2263 0 -2264 0 -2265 0 -2266 0 -2267 0 -2268 0 -2269 0 -2270 1 -2271 0 -2272 0 -2273 0 -2274 0 -2275 0 -2276 0 -2277 0 -2278 0 -2279 0 -2280 1 -2281 0 -2282 0 -2283 0 -2284 0 -2285 0 -2286 0 -2287 0 -2288 0 -2289 0 -2290 1 -2291 0 -2292 0 -2293 0 -2294 0 -2295 0 -2296 0 -2297 0 -2298 1 -2299 0 -2300 0 -2301 0 -2302 0 -2303 0 -2304 0 -2305 0 -2306 1 -2307 0 -2308 0 -2309 0 -2310 0 -2311 0 -2312 0 -2313 0 -2314 0 -2315 1 -2316 0 -2317 0 -2318 0 -2319 0 -2320 0 -2321 0 -2322 0 -2323 0 -2324 0 -2325 1 -2326 0 -2327 0 -2328 0 -2329 0 -2330 0 -2331 0 -2332 0 -2333 0 -2334 0 -2335 1 -2336 0 -2337 0 -2338 0 -2339 0 -2340 0 -2341 0 -2342 0 -2343 0 -2344 0 -2345 1 -2346 0 -2347 0 -2348 0 -2349 0 -2350 0 -2351 0 -2352 0 -2353 1 -2354 0 -2355 0 -2356 0 -2357 0 -2358 0 -2359 0 -2360 0 -2361 1 -2362 0 -2363 0 -2364 0 -2365 0 -2366 0 -2367 0 -2368 0 -2369 0 -2370 0 -2371 1 -2372 0 -2373 0 -2374 0 -2375 0 -2376 0 -2377 0 -2378 0 -2379 0 -2380 0 -2381 1 -2382 0 -2383 0 -2384 0 -2385 0 -2386 0 -2387 0 -2388 0 -2389 0 -2390 1 -2391 0 -2392 0 -2393 0 -2394 0 -2395 0 -2396 0 -2397 0 -2398 0 -2399 0 -2400 0 -2401 0 -2402 0 -2403 0 -2404 0 -2405 0 -2406 0 -2407 0 -2408 0 -2409 0 -2410 0 -2411 1 -2412 0 -2413 0 -2414 0 -2415 0 -2416 0 -2417 0 -2418 0 -2419 0 -2420 0 -2421 1 -2422 0 -2423 0 -2424 0 -2425 0 -2426 0 -2427 0 -2428 0 -2429 0 -2430 0 -2431 0 -2432 0 -2433 0 -2434 0 -2435 0 -2436 0 -2437 0 -2438 0 -2439 0 -2440 1 -2441 0 -2442 0 -2443 0 -2444 0 -2445 0 -2446 0 -2447 0 -2448 0 -2449 0 -2450 0 -2451 1 -2452 0 -2453 0 -2454 0 -2455 0 -2456 0 -2457 0 -2458 0 -2459 0 -2460 0 -2461 1 -2462 0 -2463 0 -2464 0 -2465 0 -2466 0 -2467 0 -2468 0 -2469 1 -2470 0 -2471 0 -2472 0 -2473 0 -2474 0 -2475 0 -2476 0 -2477 1 -2478 0 -2479 0 -2480 0 -2481 0 -2482 0 -2483 0 -2484 0 -2485 0 -2486 1 -2487 0 -2488 0 -2489 0 -2490 0 -2491 0 -2492 0 -2493 0 -2494 0 -2495 0 -2496 1 -2497 0 -2498 0 -2499 0 -2500 0 -2501 0 -2502 0 -2503 0 -2504 0 -2505 0 -2506 1 -2507 0 -2508 0 -2509 0 -2510 0 -2511 0 -2512 0 -2513 0 -2514 0 -2515 0 -2516 1 -2517 0 -2518 0 -2519 0 -2520 0 -2521 0 -2522 0 -2523 0 -2524 0 -2525 0 -2526 0 -2527 1 -2528 0 -2529 0 -2530 0 -2531 0 -2532 0 -2533 0 -2534 0 -2535 0 -2536 0 -2537 1 -2538 0 -2539 0 -2540 0 -2541 0 -2542 0 -2543 0 -2544 0 -2545 0 -2546 0 -2547 0 -2548 0 -2549 0 -2550 0 -2551 0 -2552 0 -2553 0 -2554 0 -2555 0 -2556 0 -2557 1 -2558 0 -2559 0 -2560 0 -2561 0 -2562 0 -2563 0 -2564 0 -2565 0 -2566 1 -2567 0 -2568 0 -2569 0 -2570 0 -2571 0 -2572 0 -2573 0 -2574 0 -2575 1 -2576 0 -2577 0 -2578 0 -2579 0 -2580 0 -2581 0 -2582 0 -2583 0 -2584 1 -2585 0 -2586 0 -2587 0 -2588 0 -2589 0 -2590 0 -2591 0 -2592 0 -2593 0 -2594 0 -2595 1 -2596 0 -2597 0 -2598 0 -2599 0 -2600 0 -2601 0 -2602 0 -2603 0 -2604 0 -2605 1 -2606 0 -2607 0 -2608 0 -2609 0 -2610 0 -2611 0 -2612 0 -2613 0 -2614 0 -2615 0 -2616 0 -2617 0 -2618 0 -2619 0 -2620 0 -2621 0 -2622 0 -2623 0 -2624 0 -2625 1 -2626 0 -2627 0 -2628 0 -2629 0 -2630 0 -2631 0 -2632 0 -2633 0 -2634 0 -2635 1 -2636 0 -2637 0 -2638 0 -2639 1 -2640 0 -2641 0 -2642 0 -2643 1 -2644 0 -2645 0 -2646 0 -2647 0 -2648 0 -2649 0 -2650 0 -2651 0 -2652 0 -2653 1 -2654 0 -2655 0 -2656 0 -2657 0 -2658 0 -2659 0 -2660 0 -2661 0 -2662 0 -2663 1 -2664 0 -2665 0 -2666 0 -2667 0 -2668 0 -2669 0 -2670 0 -2671 1 -2672 0 -2673 0 -2674 0 -2675 0 -2676 0 -2677 0 -2678 0 -2679 1 -2680 0 -2681 0 -2682 0 -2683 0 -2684 0 -2685 0 -2686 0 -2687 0 -2688 0 -2689 1 -2690 0 -2691 0 -2692 0 -2693 0 -2694 0 -2695 0 -2696 0 -2697 0 -2698 0 -2699 1 -2700 0 -2701 0 -2702 0 -2703 0 -2704 0 -2705 0 -2706 0 -2707 0 -2708 0 -2709 1 -2710 0 -2711 0 -2712 0 -2713 0 -2714 0 -2715 0 -2716 1 -2717 0 -2718 0 -2719 0 -2720 0 -2721 0 -2722 0 -2723 0 -2724 1 -2725 0 -2726 0 -2727 0 -2728 0 -2729 0 -2730 0 -2731 0 -2732 0 -2733 0 -2734 1 -2735 0 -2736 0 -2737 0 -2738 0 -2739 0 -2740 0 -2741 0 -2742 0 -2743 0 -2744 1 -2745 0 -2746 0 -2747 0 -2748 0 -2749 0 -2750 0 -2751 0 -2752 0 -2753 1 -2754 0 -2755 0 -2756 0 -2757 0 -2758 0 -2759 0 -2760 0 -2761 0 -2762 0 -2763 1 -2764 0 -2765 0 -2766 0 -2767 0 -2768 0 -2769 0 -2770 0 -2771 0 -2772 0 -2773 1 -2774 0 -2775 0 -2776 0 -2777 0 -2778 0 -2779 0 -2780 0 -2781 0 -2782 0 -2783 1 -2784 0 -2785 0 -2786 0 -2787 0 -2788 0 -2789 0 -2790 0 -2791 0 -2792 1 -2793 0 -2794 0 -2795 0 -2796 0 -2797 0 -2798 0 -2799 0 -2800 0 -2801 0 -2802 0 -2803 0 -2804 0 -2805 0 -2806 0 -2807 0 -2808 0 -2809 0 -2810 0 -2811 0 -2812 0 -2813 0 -2814 0 -2815 0 -2816 0 -2817 0 -2818 0 -2819 0 -2820 0 -2821 1 -2822 0 -2823 0 -2824 0 -2825 0 -2826 0 -2827 0 -2828 0 -2829 0 -2830 0 -2831 1 -2832 0 -2833 0 -2834 0 -2835 0 -2836 0 -2837 0 -2838 0 -2839 0 -2840 0 -2841 1 -2842 0 -2843 0 -2844 0 -2845 0 -2846 0 -2847 0 -2848 0 -2849 0 -2850 0 -2851 1 -2852 0 -2853 0 -2854 0 -2855 0 -2856 0 -2857 0 -2858 0 -2859 0 -2860 0 -2861 1 -2862 0 -2863 0 -2864 0 -2865 0 -2866 0 -2867 0 -2868 0 -2869 0 -2870 0 -2871 1 -2872 0 -2873 0 -2874 0 -2875 0 -2876 0 -2877 0 -2878 0 -2879 0 -2880 1 -2881 0 -2882 0 -2883 0 -2884 0 -2885 0 -2886 0 -2887 0 -2888 1 -2889 0 -2890 0 -2891 0 -2892 0 -2893 0 -2894 0 -2895 0 -2896 0 -2897 1 -2898 0 -2899 0 -2900 0 -2901 0 -2902 0 -2903 0 -2904 0 -2905 0 -2906 1 -2907 0 -2908 0 -2909 0 -2910 0 -2911 0 -2912 0 -2913 0 -2914 1 -2915 0 -2916 0 -2917 0 -2918 0 -2919 0 -2920 0 -2921 0 -2922 1 -2923 0 -2924 0 -2925 0 -2926 0 -2927 0 -2928 0 -2929 0 -2930 0 -2931 0 -2932 0 -2933 0 -2934 0 -2935 0 -2936 0 -2937 0 -2938 1 -2939 0 -2940 0 -2941 0 -2942 0 -2943 0 -2944 0 -2945 0 -2946 0 -2947 0 -2948 0 -2949 1 -2950 0 -2951 0 -2952 0 -2953 0 -2954 0 -2955 0 -2956 0 -2957 0 -2958 0 -2959 1 -2960 0 -2961 0 -2962 0 -2963 0 -2964 0 -2965 0 -2966 0 -2967 0 -2968 1 -2969 0 -2970 0 -2971 0 -2972 0 -2973 0 -2974 0 -2975 0 -2976 0 -2977 1 -2978 0 -2979 0 -2980 0 -2981 0 -2982 0 -2983 0 -2984 0 -2985 0 -2986 0 -2987 1 -2988 0 -2989 0 -2990 0 -2991 0 -2992 0 -2993 0 -2994 0 -2995 0 -2996 0 -2997 1 -2998 0 -2999 0 -3000 0 -3001 0 -3002 0 -3003 0 -3004 0 -3005 0 -3006 0 -3007 0 -3008 0 -3009 0 -3010 0 -3011 0 -3012 0 -3013 0 -3014 0 -3015 1 -3016 0 -3017 0 -3018 0 -3019 0 -3020 0 -3021 0 -3022 0 -3023 0 -3024 0 -3025 1 -3026 0 -3027 0 -3028 0 -3029 0 -3030 0 -3031 0 -3032 0 -3033 0 -3034 1 -3035 0 -3036 0 -3037 0 -3038 0 -3039 0 -3040 0 -3041 0 -3042 1 -3043 0 -3044 0 -3045 0 -3046 0 -3047 0 -3048 0 -3049 0 -3050 0 -3051 0 -3052 1 -3053 0 -3054 0 -3055 0 -3056 0 -3057 0 -3058 0 -3059 0 -3060 0 -3061 0 -3062 1 -3063 0 -3064 0 -3065 0 -3066 0 -3067 0 -3068 0 -3069 0 -3070 0 -3071 0 -3072 1 -3073 0 -3074 0 -3075 0 -3076 0 -3077 0 -3078 0 -3079 0 -3080 0 -3081 0 -3082 1 -3083 0 -3084 0 -3085 0 -3086 0 -3087 0 -3088 0 -3089 0 -3090 0 -3091 0 -3092 1 -3093 0 -3094 0 -3095 0 -3096 0 -3097 0 -3098 0 -3099 0 -3100 0 -3101 0 -3102 1 -3103 0 -3104 0 -3105 0 -3106 0 -3107 0 -3108 0 -3109 0 -3110 0 -3111 0 -3112 1 -3113 0 -3114 0 -3115 0 -3116 0 -3117 0 -3118 0 -3119 0 -3120 1 -3121 0 -3122 0 -3123 0 -3124 0 -3125 0 -3126 0 -3127 0 -3128 0 -3129 1 -3130 0 -3131 0 -3132 0 -3133 0 -3134 0 -3135 0 -3136 0 -3137 0 -3138 0 -3139 1 -3140 0 -3141 0 -3142 0 -3143 0 -3144 0 -3145 0 -3146 0 -3147 0 -3148 0 -3149 1 -3150 0 -3151 0 -3152 0 -3153 0 -3154 0 -3155 0 -3156 0 -3157 1 -3158 0 -3159 0 -3160 0 -3161 0 -3162 0 -3163 0 -3164 0 -3165 1 -3166 0 -3167 0 -3168 0 -3169 0 -3170 0 -3171 0 -3172 0 -3173 0 -3174 0 -3175 1 -3176 0 -3177 0 -3178 0 -3179 0 -3180 0 -3181 0 -3182 0 -3183 0 -3184 0 -3185 1 -3186 0 -3187 0 -3188 0 -3189 0 -3190 0 -3191 0 -3192 0 -3193 0 -3194 0 -3195 0 -3196 1 -3197 0 -3198 0 -3199 0 -3200 0 -3201 0 -3202 0 -3203 0 -3204 0 -3205 0 -3206 0 -3207 1 -3208 0 -3209 0 -3210 0 -3211 0 -3212 0 -3213 0 -3214 0 -3215 1 -3216 0 -3217 0 -3218 0 -3219 0 -3220 0 -3221 0 -3222 0 -3223 1 -3224 0 -3225 0 -3226 0 -3227 0 -3228 0 -3229 0 -3230 0 -3231 0 -3232 1 -3233 0 -3234 1 -3235 0 -3236 0 -3237 0 -3238 0 -3239 1 -3240 0 -3241 0 -3242 0 -3243 0 -3244 0 -3245 0 -3246 0 -3247 0 -3248 1 -3249 0 -3250 0 -3251 0 -3252 0 -3253 0 -3254 0 -3255 0 -3256 0 -3257 0 -3258 1 -3259 0 -3260 0 -3261 0 -3262 0 -3263 0 -3264 0 -3265 0 -3266 0 -3267 0 -3268 0 -3269 1 -3270 0 -3271 0 -3272 0 -3273 0 -3274 0 -3275 0 -3276 0 -3277 0 -3278 1 -3279 0 -3280 0 -3281 0 -3282 0 -3283 0 -3284 0 -3285 0 -3286 0 -3287 1 -3288 0 -3289 0 -3290 0 -3291 0 -3292 0 -3293 0 -3294 0 -3295 0 -3296 0 -3297 1 -3298 0 -3299 0 -3300 0 -3301 0 -3302 0 -3303 0 -3304 0 -3305 0 -3306 0 -3307 1 -3308 0 -3309 0 -3310 0 -3311 0 -3312 0 -3313 0 -3314 0 -3315 0 -3316 0 -3317 1 -3318 0 -3319 0 -3320 0 -3321 0 -3322 0 -3323 0 -3324 0 -3325 1 -3326 0 -3327 0 -3328 0 -3329 0 -3330 0 -3331 0 -3332 0 -3333 0 -3334 0 -3335 1 -3336 0 -3337 0 -3338 0 -3339 0 -3340 0 -3341 0 -3342 0 -3343 0 -3344 1 -3345 0 -3346 0 -3347 0 -3348 0 -3349 0 -3350 0 -3351 0 -3352 0 -3353 0 -3354 1 -3355 0 -3356 0 -3357 0 -3358 0 -3359 0 -3360 0 -3361 0 -3362 0 -3363 0 -3364 0 -3365 1 -3366 0 -3367 0 -3368 0 -3369 0 -3370 0 -3371 0 -3372 0 -3373 0 -3374 0 -3375 1 -3376 0 -3377 0 -3378 0 -3379 0 -3380 0 -3381 0 -3382 0 -3383 0 -3384 0 -3385 0 -3386 1 -3387 0 -3388 0 -3389 0 -3390 0 -3391 0 -3392 0 -3393 0 -3394 0 -3395 0 -3396 0 -3397 1 -3398 0 -3399 0 -3400 0 -3401 0 -3402 0 -3403 0 -3404 0 -3405 0 -3406 0 -3407 1 -3408 0 -3409 0 -3410 0 -3411 0 -3412 0 -3413 0 -3414 0 -3415 0 -3416 0 -3417 1 -3418 0 -3419 0 -3420 0 -3421 0 -3422 0 -3423 0 -3424 0 -3425 0 -3426 0 -3427 0 -3428 1 -3429 0 -3430 0 -3431 0 -3432 0 -3433 0 -3434 0 -3435 0 -3436 0 -3437 1 -3438 0 -3439 0 -3440 0 -3441 0 -3442 0 -3443 0 -3444 0 -3445 1 -3446 0 -3447 0 -3448 0 -3449 0 -3450 0 -3451 0 -3452 0 -3453 0 -3454 1 -3455 0 -3456 0 -3457 0 -3458 0 -3459 0 -3460 0 -3461 0 -3462 0 -3463 0 -3464 1 -3465 0 -3466 0 -3467 0 -3468 0 -3469 0 -3470 0 -3471 0 -3472 0 -3473 0 -3474 1 -3475 0 -3476 0 -3477 0 -3478 0 -3479 0 -3480 0 -3481 0 -3482 0 -3483 0 -3484 1 -3485 0 -3486 0 -3487 0 -3488 0 -3489 0 -3490 0 -3491 0 -3492 0 -3493 0 -3494 1 -3495 0 -3496 0 -3497 0 -3498 0 -3499 0 -3500 0 -3501 0 -3502 0 -3503 0 -3504 1 -3505 0 -3506 0 -3507 0 -3508 0 -3509 0 -3510 0 -3511 0 -3512 0 -3513 0 -3514 1 -3515 0 -3516 0 -3517 0 -3518 0 -3519 0 -3520 0 -3521 0 -3522 0 -3523 0 -3524 1 -3525 0 -3526 0 -3527 0 -3528 0 -3529 0 -3530 0 -3531 0 -3532 0 -3533 1 -3534 0 -3535 0 -3536 0 -3537 0 -3538 0 -3539 0 -3540 0 -3541 0 -3542 0 -3543 0 -3544 0 -3545 0 -3546 0 -3547 0 -3548 0 -3549 0 -3550 0 -3551 1 -3552 0 -3553 0 -3554 0 -3555 0 -3556 0 -3557 0 -3558 0 -3559 0 -3560 0 -3561 1 -3562 0 -3563 0 -3564 0 -3565 0 -3566 0 -3567 0 -3568 0 -3569 0 -3570 1 -3571 0 -3572 0 -3573 0 -3574 0 -3575 0 -3576 0 -3577 0 -3578 0 -3579 0 -3580 1 -3581 0 -3582 0 -3583 0 -3584 0 -3585 0 -3586 0 -3587 0 -3588 0 -3589 0 -3590 1 -3591 0 -3592 0 -3593 0 -3594 0 -3595 0 -3596 0 -3597 0 -3598 0 -3599 1 -3600 0 -3601 0 -3602 0 -3603 0 -3604 0 -3605 0 -3606 0 -3607 0 -3608 0 -3609 1 -3610 0 -3611 0 -3612 0 -3613 0 -3614 0 -3615 0 -3616 0 -3617 0 -3618 0 -3619 0 -3620 1 -3621 0 -3622 0 -3623 0 -3624 0 -3625 0 -3626 0 -3627 0 -3628 0 -3629 0 -3630 1 -3631 0 -3632 0 -3633 0 -3634 0 -3635 0 -3636 0 -3637 0 -3638 0 -3639 1 -3640 0 -3641 0 -3642 0 -3643 0 -3644 0 -3645 1 -3646 0 -3647 0 -3648 0 -3649 0 -3650 0 -3651 1 -3652 0 -3653 0 -3654 0 -3655 0 -3656 0 -3657 0 -3658 1 -3659 0 -3660 0 -3661 0 -3662 0 -3663 0 -3664 0 -3665 0 -3666 1 -3667 0 -3668 0 -3669 0 -3670 0 -3671 0 -3672 0 -3673 0 -3674 0 -3675 0 -3676 1 -3677 0 -3678 0 -3679 0 -3680 0 -3681 0 -3682 0 -3683 0 -3684 0 -3685 1 -3686 0 -3687 0 -3688 0 -3689 0 -3690 0 -3691 0 -3692 0 -3693 0 -3694 0 -3695 1 -3696 0 -3697 0 -3698 0 -3699 0 -3700 0 -3701 0 -3702 0 -3703 0 -3704 0 -3705 0 -3706 1 -3707 0 -3708 0 -3709 0 -3710 0 -3711 0 -3712 0 -3713 0 -3714 0 -3715 0 -3716 1 -3717 0 -3718 0 -3719 0 -3720 0 -3721 0 -3722 0 -3723 0 -3724 0 -3725 0 -3726 0 -3727 0 -3728 0 -3729 0 -3730 0 -3731 0 -3732 0 -3733 0 -3734 0 -3735 0 -3736 1 -3737 0 -3738 0 -3739 0 -3740 0 -3741 0 -3742 0 -3743 0 -3744 0 -3745 0 -3746 1 -3747 0 -3748 0 -3749 0 -3750 0 -3751 0 -3752 0 -3753 0 -3754 0 -3755 0 -3756 1 -3757 0 -3758 0 -3759 0 -3760 0 -3761 0 -3762 0 -3763 1 -3764 0 -3765 0 -3766 0 -3767 0 -3768 0 -3769 0 -3770 0 -3771 1 -3772 0 -3773 0 -3774 0 -3775 0 -3776 0 -3777 0 -3778 1 -3779 0 -3780 0 -3781 0 -3782 0 -3783 0 -3784 0 -3785 0 -3786 0 -3787 0 -3788 0 -3789 0 -3790 0 -3791 0 -3792 0 -3793 0 -3794 0 -3795 0 -3796 0 -3797 1 -3798 0 -3799 0 -3800 0 -3801 0 -3802 0 -3803 0 -3804 0 -3805 0 -3806 1 -3807 0 -3808 0 -3809 0 -3810 0 -3811 0 -3812 0 -3813 0 -3814 0 -3815 0 -3816 0 -3817 1 -3818 0 -3819 0 -3820 0 -3821 0 -3822 0 -3823 0 -3824 0 -3825 0 -3826 0 -3827 1 -3828 0 -3829 1 -3830 0 -3831 0 -3832 0 -3833 0 -3834 1 -3835 0 -3836 0 -3837 0 -3838 0 -3839 0 -3840 0 -3841 0 -3842 0 -3843 0 -3844 0 -3845 1 -3846 0 -3847 0 -3848 0 -3849 0 -3850 0 -3851 0 -3852 0 -3853 0 -3854 0 -3855 1 -3856 0 -3857 0 -3858 0 -3859 0 -3860 0 -3861 0 -3862 0 -3863 1 -3864 0 -3865 0 -3866 0 -3867 0 -3868 0 -3869 0 -3870 0 -3871 0 -3872 0 -3873 1 -3874 0 -3875 0 -3876 0 -3877 0 -3878 0 -3879 0 -3880 0 -3881 0 -3882 0 -3883 1 -3884 0 -3885 0 -3886 0 -3887 0 -3888 0 -3889 0 -3890 0 -3891 0 -3892 0 -3893 0 -3894 1 -3895 0 -3896 0 -3897 0 -3898 0 -3899 0 -3900 0 -3901 0 -3902 0 -3903 0 -3904 0 -3905 1 -3906 0 -3907 0 -3908 0 -3909 0 -3910 0 -3911 0 -3912 0 -3913 0 -3914 1 -3915 0 -3916 0 -3917 0 -3918 0 -3919 0 -3920 0 -3921 0 -3922 0 -3923 0 -3924 0 -3925 1 -3926 0 -3927 0 -3928 0 -3929 0 -3930 0 -3931 0 -3932 0 -3933 0 -3934 1 -3935 0 -3936 0 -3937 0 -3938 0 -3939 0 -3940 0 -3941 0 -3942 0 -3943 0 -3944 0 -3945 1 -3946 0 -3947 0 -3948 0 -3949 0 -3950 0 -3951 0 -3952 0 -3953 0 -3954 0 -3955 1 -3956 0 -3957 0 -3958 0 -3959 0 -3960 0 -3961 0 -3962 0 -3963 0 -3964 0 -3965 0 -3966 1 -3967 0 -3968 0 -3969 0 -3970 0 -3971 0 -3972 0 -3973 0 -3974 0 -3975 1 -3976 0 -3977 0 -3978 0 -3979 0 -3980 0 -3981 0 -3982 0 -3983 0 -3984 1 -3985 0 -3986 0 -3987 0 -3988 0 -3989 0 -3990 0 -3991 0 -3992 0 -3993 0 -3994 1 -3995 0 -3996 0 -3997 0 -3998 0 -3999 0 -4000 0 -4001 0 -4002 0 -4003 0 -4004 0 -4005 0 -4006 0 -4007 0 -4008 0 -4009 0 -4010 0 -4011 0 -4012 0 -4013 0 -4014 1 -4015 0 -4016 0 -4017 0 -4018 0 -4019 0 -4020 0 -4021 0 -4022 0 -4023 0 -4024 1 -4025 0 -4026 0 -4027 0 -4028 0 -4029 0 -4030 0 -4031 0 -4032 0 -4033 0 -4034 0 -4035 1 -4036 0 -4037 0 -4038 0 -4039 0 -4040 0 -4041 0 -4042 0 -4043 0 -4044 0 -4045 1 -4046 0 -4047 0 -4048 0 -4049 0 -4050 0 -4051 0 -4052 0 -4053 0 -4054 0 -4055 0 -4056 1 -4057 0 -4058 0 -4059 0 -4060 0 -4061 0 -4062 0 -4063 0 -4064 0 -4065 0 -4066 1 -4067 0 -4068 0 -4069 0 -4070 0 -4071 0 -4072 0 -4073 0 -4074 1 -4075 0 -4076 0 -4077 0 -4078 0 -4079 0 -4080 0 -4081 0 -4082 0 -4083 0 -4084 1 -4085 0 -4086 0 -4087 0 -4088 0 -4089 0 -4090 0 -4091 0 -4092 0 -4093 1 -4094 0 -4095 0 -4096 0 -4097 0 -4098 0 -4099 0 -4100 0 -4101 0 -4102 1 -4103 0 -4104 0 -4105 0 -4106 0 -4107 0 -4108 0 -4109 0 -4110 0 -4111 0 -4112 1 -4113 0 -4114 0 -4115 0 -4116 0 -4117 0 -4118 0 -4119 0 -4120 0 -4121 0 -4122 1 -4123 0 -4124 0 -4125 0 -4126 0 -4127 0 -4128 0 -4129 0 -4130 0 -4131 0 -4132 0 -4133 1 -4134 0 -4135 0 -4136 0 -4137 0 -4138 0 -4139 0 -4140 0 -4141 0 -4142 0 -4143 0 -4144 1 -4145 0 -4146 0 -4147 0 -4148 0 -4149 0 -4150 0 -4151 0 -4152 0 -4153 0 -4154 1 -4155 0 -4156 0 -4157 0 -4158 0 -4159 0 -4160 0 -4161 0 -4162 0 -4163 0 -4164 0 -4165 1 -4166 0 -4167 0 -4168 0 -4169 0 -4170 0 -4171 0 -4172 0 -4173 0 -4174 0 -4175 0 -4176 1 -4177 0 -4178 0 -4179 0 -4180 0 -4181 0 -4182 0 -4183 0 -4184 0 -4185 1 -4186 0 -4187 0 -4188 0 -4189 0 -4190 0 -4191 0 -4192 0 -4193 0 -4194 0 -4195 1 -4196 0 -4197 0 -4198 0 -4199 0 -4200 0 -4201 0 -4202 0 -4203 0 -4204 0 -4205 0 -4206 0 -4207 0 -4208 0 -4209 0 -4210 0 -4211 0 -4212 1 -4213 0 -4214 0 -4215 0 -4216 0 -4217 0 -4218 0 -4219 0 -4220 0 -4221 1 -4222 0 -4223 0 -4224 0 -4225 0 -4226 0 -4227 0 -4228 0 -4229 0 -4230 1 -4231 0 -4232 0 -4233 0 -4234 0 -4235 0 -4236 0 -4237 0 -4238 0 -4239 1 -4240 0 -4241 0 -4242 0 -4243 0 -4244 0 -4245 0 -4246 0 -4247 0 -4248 0 -4249 1 -4250 0 -4251 0 -4252 0 -4253 0 -4254 0 -4255 0 -4256 0 -4257 0 -4258 1 -4259 0 -4260 0 -4261 0 -4262 0 -4263 0 -4264 0 -4265 0 -4266 0 -4267 0 -4268 1 -4269 0 -4270 0 -4271 0 -4272 0 -4273 0 -4274 0 -4275 0 -4276 0 -4277 0 -4278 1 -4279 0 -4280 0 -4281 0 -4282 0 -4283 0 -4284 0 -4285 0 -4286 0 -4287 0 -4288 0 -4289 1 -4290 0 -4291 0 -4292 0 -4293 0 -4294 0 -4295 0 -4296 0 -4297 0 -4298 0 -4299 1 -4300 0 -4301 0 -4302 0 -4303 0 -4304 0 -4305 0 -4306 0 -4307 0 -4308 0 -4309 1 -4310 0 -4311 0 -4312 0 -4313 0 -4314 0 -4315 0 -4316 0 -4317 0 -4318 1 -4319 0 -4320 0 -4321 0 -4322 0 -4323 0 -4324 0 -4325 0 -4326 0 -4327 1 -4328 0 -4329 0 -4330 0 -4331 0 -4332 0 -4333 0 -4334 0 -4335 0 -4336 0 -4337 1 -4338 0 -4339 0 -4340 0 -4341 0 -4342 0 -4343 0 -4344 0 -4345 0 -4346 0 -4347 1 -4348 0 -4349 0 -4350 0 -4351 0 -4352 0 -4353 0 -4354 0 -4355 1 -4356 0 -4357 0 -4358 0 -4359 0 -4360 0 -4361 0 -4362 0 -4363 0 -4364 0 -4365 0 -4366 0 -4367 0 -4368 0 -4369 0 -4370 0 -4371 0 -4372 0 -4373 0 -4374 1 -4375 0 -4376 0 -4377 0 -4378 0 -4379 0 -4380 0 -4381 0 -4382 0 -4383 0 -4384 1 -4385 0 -4386 0 -4387 0 -4388 0 -4389 0 -4390 0 -4391 0 -4392 0 -4393 1 -4394 0 -4395 0 -4396 0 -4397 0 -4398 0 -4399 0 -4400 0 -4401 0 -4402 0 -4403 1 -4404 0 -4405 0 -4406 0 -4407 0 -4408 0 -4409 0 -4410 0 -4411 0 -4412 1 -4413 0 -4414 0 -4415 0 -4416 0 -4417 0 -4418 0 -4419 0 -4420 0 -4421 0 -4422 0 -4423 1 -4424 0 -4425 0 -4426 0 -4427 0 -4428 0 -4429 0 -4430 2 -4431 0 -4432 0 -4433 0 -4434 0 -4435 0 -4436 0 -4437 1 -4438 0 -4439 0 -4440 0 -4441 0 -4442 0 -4443 0 -4444 0 -4445 1 -4446 0 -4447 0 -4448 0 -4449 0 -4450 0 -4451 0 -4452 0 -4453 0 -4454 1 -4455 0 -4456 0 -4457 0 -4458 0 -4459 0 -4460 0 -4461 0 -4462 1 -4463 0 -4464 0 -4465 0 -4466 0 -4467 0 -4468 0 -4469 0 -4470 0 -4471 1 -4472 0 -4473 0 -4474 0 -4475 0 -4476 0 -4477 0 -4478 0 -4479 0 -4480 1 -4481 0 -4482 0 -4483 0 -4484 0 -4485 0 -4486 0 -4487 0 -4488 1 -4489 0 -4490 0 -4491 0 -4492 0 -4493 0 -4494 0 -4495 0 -4496 0 -4497 1 -4498 0 -4499 0 -4500 0 -4501 0 -4502 0 -4503 0 -4504 0 -4505 1 -4506 0 -4507 0 -4508 0 -4509 0 -4510 0 -4511 0 -4512 0 -4513 1 -4514 0 -4515 0 -4516 0 -4517 0 -4518 0 -4519 0 -4520 1 -4521 0 -4522 0 -4523 0 -4524 0 -4525 0 -4526 0 -4527 0 -4528 0 -4529 1 -4530 0 -4531 0 -4532 0 -4533 0 -4534 0 -4535 0 -4536 0 -4537 0 -4538 1 -4539 0 -4540 0 -4541 0 -4542 0 -4543 0 -4544 0 -4545 0 -4546 1 -4547 0 -4548 0 -4549 0 -4550 0 -4551 0 -4552 1 -4553 0 -4554 0 -4555 0 -4556 0 -4557 0 -4558 0 -4559 1 -4560 0 -4561 0 -4562 0 -4563 0 -4564 0 -4565 0 -4566 0 -4567 1 -4568 0 -4569 0 -4570 0 -4571 0 -4572 0 -4573 0 -4574 0 -4575 1 -4576 0 -4577 0 -4578 0 -4579 0 -4580 0 -4581 0 -4582 0 -4583 1 -4584 0 -4585 0 -4586 0 -4587 0 -4588 0 -4589 0 -4590 0 -4591 1 -4592 0 -4593 0 -4594 0 -4595 0 -4596 0 -4597 0 -4598 0 -4599 0 -4600 1 -4601 0 -4602 0 -4603 0 -4604 0 -4605 0 -4606 0 -4607 1 -4608 0 -4609 0 -4610 0 -4611 0 -4612 0 -4613 0 -4614 0 -4615 0 -4616 1 -4617 0 -4618 0 -4619 0 -4620 0 -4621 0 -4622 0 -4623 0 -4624 0 -4625 1 -4626 0 -4627 0 -4628 0 -4629 0 -4630 0 -4631 0 -4632 0 -4633 0 -4634 1 -4635 0 -4636 0 -4637 0 -4638 0 -4639 0 -4640 0 -4641 0 -4642 0 -4643 0 -4644 0 -4645 0 -4646 0 -4647 0 -4648 0 -4649 0 -4650 0 -4651 0 -4652 1 -4653 0 -4654 0 -4655 0 -4656 0 -4657 0 -4658 0 -4659 0 -4660 0 -4661 1 -4662 0 -4663 0 -4664 0 -4665 1 -4666 0 -4667 0 -4668 0 -4669 0 -4670 0 -4671 0 -4672 1 -4673 0 -4674 0 -4675 0 -4676 0 -4677 0 -4678 1 -4679 0 -4680 0 -4681 0 -4682 0 -4683 0 -4684 0 -4685 0 -4686 1 -4687 0 -4688 0 -4689 0 -4690 0 -4691 0 -4692 0 -4693 0 -4694 1 -4695 0 -4696 0 -4697 0 -4698 0 -4699 0 -4700 0 -4701 0 -4702 1 -4703 0 -4704 0 -4705 0 -4706 0 -4707 0 -4708 0 -4709 1 -4710 0 -4711 0 -4712 0 -4713 0 -4714 0 -4715 0 -4716 0 -4717 1 -4718 0 -4719 0 -4720 0 -4721 0 -4722 0 -4723 0 -4724 0 -4725 1 -4726 0 -4727 0 -4728 0 -4729 0 -4730 0 -4731 0 -4732 0 -4733 0 -4734 1 -4735 0 -4736 0 -4737 0 -4738 0 -4739 0 -4740 0 -4741 0 -4742 0 -4743 0 -4744 1 -4745 0 -4746 0 -4747 0 -4748 0 -4749 0 -4750 0 -4751 0 -4752 1 -4753 0 -4754 0 -4755 0 -4756 0 -4757 0 -4758 0 -4759 0 -4760 1 -4761 0 -4762 0 -4763 0 -4764 0 -4765 0 -4766 0 -4767 0 -4768 0 -4769 1 -4770 0 -4771 0 -4772 0 -4773 0 -4774 0 -4775 0 -4776 0 -4777 0 -4778 1 -4779 0 -4780 0 -4781 0 -4782 0 -4783 0 -4784 0 -4785 0 -4786 1 -4787 0 -4788 0 -4789 0 -4790 0 -4791 0 -4792 0 -4793 0 -4794 0 -4795 0 -4796 1 -4797 0 -4798 0 -4799 0 -4800 0 -4801 0 -4802 0 -4803 0 -4804 1 -4805 0 -4806 0 -4807 0 -4808 0 -4809 0 -4810 0 -4811 0 -4812 0 -4813 1 -4814 0 -4815 0 -4816 0 -4817 0 -4818 0 -4819 0 -4820 0 -4821 0 -4822 1 -4823 0 -4824 0 -4825 0 -4826 0 -4827 0 -4828 0 -4829 0 -4830 0 -4831 1 -4832 0 -4833 0 -4834 0 -4835 0 -4836 0 -4837 0 -4838 0 -4839 0 -4840 0 -4841 0 -4842 0 -4843 0 -4844 0 -4845 0 -4846 0 -4847 0 -4848 0 -4849 0 -4850 0 -4851 0 -4852 0 -4853 0 -4854 0 -4855 0 -4856 0 -4857 0 -4858 0 -4859 0 -4860 0 -4861 0 -4862 0 -4863 0 -4864 0 -4865 1 -4866 0 -4867 0 -4868 0 -4869 0 -4870 0 -4871 0 -4872 1 -4873 0 -4874 0 -4875 0 -4876 0 -4877 0 -4878 0 -4879 0 -4880 1 -4881 0 -4882 0 -4883 0 -4884 0 -4885 0 -4886 0 -4887 0 -4888 0 -4889 0 -4890 1 -4891 0 -4892 0 -4893 0 -4894 0 -4895 0 -4896 0 -4897 0 -4898 1 -4899 0 -4900 0 -4901 0 -4902 0 -4903 0 -4904 0 -4905 1 -4906 0 -4907 0 -4908 0 -4909 0 -4910 0 -4911 0 -4912 0 -4913 1 -4914 0 -4915 0 -4916 0 -4917 0 -4918 0 -4919 0 -4920 0 -4921 0 -4922 0 -4923 1 -4924 0 -4925 0 -4926 0 -4927 0 -4928 0 -4929 0 -4930 0 -4931 0 -4932 0 -4933 1 -4934 0 -4935 0 -4936 0 -4937 0 -4938 0 -4939 0 -4940 0 -4941 0 -4942 0 -4943 0 -4944 0 -4945 0 -4946 0 -4947 0 -4948 1 -4949 0 -4950 0 -4951 0 -4952 0 -4953 0 -4954 0 -4955 0 -4956 1 -4957 0 -4958 0 -4959 0 -4960 0 -4961 0 -4962 0 -4963 0 -4964 1 -4965 0 -4966 0 -4967 0 -4968 0 -4969 0 -4970 0 -4971 0 -4972 1 -4973 0 -4974 0 -4975 0 -4976 0 -4977 0 -4978 0 -4979 1 -4980 0 -4981 0 -4982 0 -4983 0 -4984 0 -4985 0 -4986 0 -4987 1 -4988 0 -4989 0 -4990 0 -4991 0 -4992 0 -4993 0 -4994 1 -4995 0 -4996 0 -4997 0 -4998 0 -4999 0 -5000 0 -5001 0 -5002 0 -5003 1 -5004 0 -5005 0 -5006 0 -5007 0 -5008 0 -5009 0 -5010 0 -5011 0 -5012 1 -5013 0 -5014 0 -5015 0 -5016 0 -5017 0 -5018 0 -5019 0 -5020 1 -5021 0 -5022 0 -5023 0 -5024 0 -5025 0 -5026 0 -5027 0 -5028 0 -5029 1 -5030 0 -5031 0 -5032 0 -5033 0 -5034 0 -5035 0 -5036 0 -5037 1 -5038 0 -5039 0 -5040 0 -5041 0 -5042 0 -5043 0 -5044 0 -5045 1 -5046 0 -5047 0 -5048 0 -5049 0 -5050 0 -5051 0 -5052 0 -5053 1 -5054 0 -5055 0 -5056 0 -5057 0 -5058 0 -5059 0 -5060 0 -5061 0 -5062 1 -5063 0 -5064 0 -5065 0 -5066 0 -5067 0 -5068 0 -5069 0 -5070 0 -5071 0 -5072 0 -5073 0 -5074 0 -5075 0 -5076 0 -5077 0 -5078 0 -5079 1 -5080 0 -5081 0 -5082 0 -5083 0 -5084 0 -5085 0 -5086 1 -5087 0 -5088 0 -5089 0 -5090 0 -5091 0 -5092 0 -5093 0 -5094 1 -5095 0 -5096 0 -5097 0 -5098 0 -5099 0 -5100 0 -5101 0 -5102 0 -5103 1 -5104 0 -5105 0 -5106 0 -5107 0 -5108 0 -5109 0 -5110 1 -5111 0 -5112 0 -5113 0 -5114 0 -5115 0 -5116 0 -5117 0 -5118 1 -5119 0 -5120 0 -5121 0 -5122 0 -5123 0 -5124 0 -5125 0 -5126 0 -5127 1 -5128 0 -5129 0 -5130 0 -5131 0 -5132 0 -5133 0 -5134 1 -5135 0 -5136 0 -5137 0 -5138 0 -5139 0 -5140 0 -5141 1 -5142 0 -5143 0 -5144 0 -5145 0 -5146 0 -5147 0 -5148 0 -5149 1 -5150 0 -5151 0 -5152 0 -5153 0 -5154 0 -5155 0 -5156 0 -5157 0 -5158 1 -5159 0 -5160 0 -5161 0 -5162 0 -5163 0 -5164 0 -5165 0 -5166 0 -5167 1 -5168 0 -5169 0 -5170 0 -5171 0 -5172 0 -5173 0 -5174 0 -5175 1 -5176 0 -5177 0 -5178 0 -5179 0 -5180 0 -5181 0 -5182 1 -5183 0 -5184 0 -5185 0 -5186 0 -5187 0 -5188 0 -5189 0 -5190 1 -5191 0 -5192 0 -5193 0 -5194 0 -5195 0 -5196 0 -5197 0 -5198 0 -5199 1 -5200 0 -5201 0 -5202 0 -5203 0 -5204 0 -5205 0 -5206 0 -5207 0 -5208 1 -5209 0 -5210 0 -5211 0 -5212 0 -5213 0 -5214 0 -5215 0 -5216 0 -5217 0 -5218 1 -5219 0 -5220 0 -5221 0 -5222 0 -5223 0 -5224 0 -5225 0 -5226 1 -5227 0 -5228 0 -5229 0 -5230 0 -5231 0 -5232 0 -5233 0 -5234 1 -5235 0 -5236 0 -5237 0 -5238 0 -5239 0 -5240 0 -5241 0 -5242 1 -5243 0 -5244 0 -5245 0 -5246 0 -5247 0 -5248 0 -5249 0 -5250 0 -5251 1 -5252 0 -5253 0 -5254 0 -5255 0 -5256 0 -5257 0 -5258 0 -5259 0 -5260 0 -5261 0 -5262 0 -5263 0 -5264 0 -5265 0 -5266 0 -5267 0 -5268 1 -5269 0 -5270 0 -5271 0 -5272 0 -5273 0 -5274 0 -5275 0 -5276 1 -5277 0 -5278 0 -5279 0 -5280 0 -5281 0 -5282 0 -5283 1 -5284 0 -5285 0 -5286 0 -5287 0 -5288 0 -5289 0 -5290 0 -5291 0 -5292 0 -5293 1 -5294 0 -5295 0 -5296 0 -5297 0 -5298 0 -5299 0 -5300 0 -5301 1 -5302 0 -5303 0 -5304 0 -5305 0 -5306 0 -5307 0 -5308 0 -5309 0 -5310 1 -5311 0 -5312 0 -5313 0 -5314 0 -5315 0 -5316 0 -5317 0 -5318 1 -5319 0 -5320 0 -5321 0 -5322 0 -5323 0 -5324 0 -5325 1 -5326 0 -5327 0 -5328 0 -5329 0 -5330 0 -5331 0 -5332 0 -5333 0 -5334 0 -5335 0 -5336 0 -5337 0 -5338 0 -5339 0 -5340 0 -5341 0 -5342 1 -5343 0 -5344 0 -5345 0 -5346 0 -5347 0 -5348 0 -5349 1 -5350 0 -5351 0 -5352 0 -5353 0 -5354 0 -5355 0 -5356 0 -5357 0 -5358 1 -5359 0 -5360 0 -5361 0 -5362 0 -5363 0 -5364 0 -5365 0 -5366 1 -5367 0 -5368 0 -5369 0 -5370 0 -5371 0 -5372 0 -5373 1 -5374 0 -5375 0 -5376 0 -5377 0 -5378 0 -5379 0 -5380 0 -5381 1 -5382 0 -5383 0 -5384 0 -5385 0 -5386 0 -5387 0 -5388 0 -5389 0 -5390 1 -5391 0 -5392 0 -5393 0 -5394 0 -5395 0 -5396 0 -5397 0 -5398 1 -5399 0 -5400 0 -5401 0 -5402 0 -5403 0 -5404 0 -5405 0 -5406 1 -5407 0 -5408 0 -5409 0 -5410 0 -5411 0 -5412 0 -5413 0 -5414 1 -5415 0 -5416 0 -5417 0 -5418 0 -5419 0 -5420 0 -5421 0 -5422 1 -5423 0 -5424 0 -5425 0 -5426 0 -5427 0 -5428 0 -5429 0 -5430 0 -5431 0 -5432 0 -5433 0 -5434 0 -5435 0 -5436 0 -5437 0 -5438 1 -5439 0 -5440 0 -5441 0 -5442 0 -5443 0 -5444 0 -5445 0 -5446 0 -5447 1 -5448 0 -5449 0 -5450 0 -5451 0 -5452 0 -5453 0 -5454 0 -5455 0 -5456 1 -5457 0 -5458 0 -5459 0 -5460 0 -5461 0 -5462 0 -5463 0 -5464 1 -5465 0 -5466 0 -5467 0 -5468 0 -5469 0 -5470 0 -5471 0 -5472 1 -5473 0 -5474 0 -5475 0 -5476 0 -5477 0 -5478 0 -5479 0 -5480 0 -5481 1 -5482 0 -5483 0 -5484 0 -5485 0 -5486 0 -5487 0 -5488 0 -5489 1 -5490 0 -5491 0 -5492 0 -5493 0 -5494 0 -5495 0 -5496 0 -5497 0 -5498 1 -5499 0 -5500 0 -5501 0 -5502 0 -5503 0 -5504 0 -5505 0 -5506 1 -5507 0 -5508 0 -5509 0 -5510 0 -5511 0 -5512 0 -5513 0 -5514 1 -5515 0 -5516 0 -5517 0 -5518 0 -5519 0 -5520 0 -5521 0 -5522 0 -5523 1 -5524 0 -5525 0 -5526 0 -5527 0 -5528 0 -5529 0 -5530 0 -5531 1 -5532 0 -5533 0 -5534 0 -5535 0 -5536 0 -5537 0 -5538 0 -5539 0 -5540 1 -5541 0 -5542 0 -5543 0 -5544 0 -5545 0 -5546 0 -5547 0 -5548 0 -5549 1 -5550 0 -5551 0 -5552 0 -5553 0 -5554 0 -5555 0 -5556 0 -5557 0 -5558 0 -5559 0 -5560 0 -5561 0 -5562 0 -5563 0 -5564 0 -5565 1 -5566 0 -5567 0 -5568 0 -5569 0 -5570 0 -5571 1 -5572 0 -5573 0 -5574 0 -5575 0 -5576 0 -5577 0 -5578 0 -5579 1 -5580 0 -5581 0 -5582 0 -5583 0 -5584 0 -5585 0 -5586 0 -5587 0 -5588 1 -5589 0 -5590 0 -5591 0 -5592 0 -5593 0 -5594 0 -5595 0 -5596 1 -5597 0 -5598 0 -5599 0 -5600 0 -5601 0 -5602 0 -5603 0 -5604 0 -5605 0 -5606 1 -5607 0 -5608 0 -5609 0 -5610 0 -5611 0 -5612 0 -5613 0 -5614 1 -5615 0 -5616 0 -5617 0 -5618 0 -5619 0 -5620 0 -5621 0 -5622 1 -5623 0 -5624 0 -5625 0 -5626 0 -5627 0 -5628 0 -5629 0 -5630 0 -5631 0 -5632 0 -5633 0 -5634 0 -5635 0 -5636 0 -5637 0 -5638 1 -5639 0 -5640 0 -5641 0 -5642 0 -5643 0 -5644 0 -5645 0 -5646 0 -5647 1 -5648 0 -5649 0 -5650 0 -5651 0 -5652 0 -5653 0 -5654 1 -5655 0 -5656 0 -5657 0 -5658 0 -5659 0 -5660 0 -5661 0 -5662 1 -5663 0 -5664 0 -5665 0 -5666 0 -5667 0 -5668 0 -5669 0 -5670 1 -5671 0 -5672 0 -5673 0 -5674 0 -5675 0 -5676 0 -5677 0 -5678 0 -5679 1 -5680 2 -5681 1 -5682 0 -5683 0 -5684 0 -5685 0 -5686 0 -5687 1 -5688 0 -5689 0 -5690 0 -5691 0 -5692 1 -5693 0 -5694 0 -5695 0 -5696 0 -5697 1 -5698 0 -5699 0 -5700 0 -5701 0 -5702 0 -5703 0 -5704 0 -5705 1 -5706 0 -5707 0 -5708 0 -5709 0 -5710 0 -5711 1 -5712 0 -5713 0 -5714 0 -5715 0 -5716 0 -5717 0 -5718 0 -5719 0 -5720 0 -5721 0 -5722 0 -5723 0 -5724 0 -5725 0 -5726 1 -5727 0 -5728 0 -5729 0 -5730 0 -5731 0 -5732 0 -5733 0 -5734 1 -5735 0 -5736 0 -5737 0 -5738 0 -5739 0 -5740 0 -5741 0 -5742 1 -5743 0 -5744 0 -5745 0 -5746 0 -5747 0 -5748 0 -5749 0 -5750 0 -5751 1 -5752 0 -5753 0 -5754 0 -5755 0 -5756 0 -5757 0 -5758 0 -5759 1 -5760 0 -5761 0 -5762 0 -5763 0 -5764 0 -5765 0 -5766 1 -5767 0 -5768 0 -5769 0 -5770 0 -5771 0 -5772 0 -5773 0 -5774 1 -5775 0 -5776 0 -5777 0 -5778 0 -5779 0 -5780 0 -5781 0 -5782 1 -5783 0 -5784 0 -5785 0 -5786 0 -5787 0 -5788 0 -5789 0 -5790 0 -5791 1 -5792 0 -5793 0 -5794 0 -5795 0 -5796 0 -5797 0 -5798 0 -5799 0 -5800 1 -5801 0 -5802 0 -5803 0 -5804 0 -5805 0 -5806 0 -5807 0 -5808 0 -5809 1 -5810 0 -5811 0 -5812 0 -5813 0 -5814 0 -5815 0 -5816 1 -5817 0 -5818 0 -5819 0 -5820 0 -5821 0 -5822 0 -5823 0 -5824 0 -5825 1 -5826 0 -5827 0 -5828 0 -5829 0 -5830 0 -5831 0 -5832 0 -5833 0 -5834 1 -5835 0 -5836 0 -5837 0 -5838 0 -5839 0 -5840 0 -5841 0 -5842 1 -5843 0 -5844 0 -5845 0 -5846 0 -5847 0 -5848 0 -5849 0 -5850 1 -5851 0 -5852 0 -5853 0 -5854 0 -5855 0 -5856 0 -5857 0 -5858 1 -5859 0 -5860 0 -5861 0 -5862 0 -5863 0 -5864 0 -5865 0 -5866 0 -5867 1 -5868 0 -5869 0 -5870 0 -5871 0 -5872 0 -5873 0 -5874 0 -5875 1 -5876 0 -5877 0 -5878 0 -5879 0 -5880 0 -5881 0 -5882 0 -5883 0 -5884 1 -5885 0 -5886 0 -5887 0 -5888 0 -5889 0 -5890 0 -5891 1 -5892 0 -5893 0 -5894 0 -5895 0 -5896 0 -5897 0 -5898 0 -5899 0 -5900 1 -5901 0 -5902 0 -5903 0 -5904 0 -5905 0 -5906 0 -5907 0 -5908 0 -5909 1 -5910 0 -5911 0 -5912 0 -5913 0 -5914 0 -5915 0 -5916 0 -5917 1 -5918 0 -5919 0 -5920 0 -5921 0 -5922 0 -5923 0 -5924 0 -5925 0 -5926 1 -5927 0 -5928 0 -5929 0 -5930 0 -5931 0 -5932 0 -5933 0 -5934 1 -5935 0 -5936 0 -5937 0 -5938 0 -5939 0 -5940 0 -5941 0 -5942 0 -5943 0 -5944 1 -5945 0 -5946 0 -5947 0 -5948 0 -5949 0 -5950 0 -5951 0 -5952 0 -5953 0 -5954 0 -5955 0 -5956 0 -5957 0 -5958 0 -5959 0 -5960 0 -5961 0 -5962 0 -5963 0 -5964 0 -5965 0 -5966 0 -5967 0 -5968 0 -5969 0 -5970 1 -5971 0 -5972 0 -5973 0 -5974 0 -5975 0 -5976 0 -5977 0 -5978 1 -5979 0 -5980 0 -5981 0 -5982 0 -5983 0 -5984 0 -5985 0 -5986 0 -5987 1 -5988 0 -5989 0 -5990 0 -5991 0 -5992 0 -5993 0 -5994 0 -5995 0 -5996 1 -5997 0 -5998 0 -5999 0 -6000 0 -6001 0 -6002 0 -6003 0 -6004 0 -6005 0 -6006 1 -6007 0 -6008 0 -6009 0 -6010 0 -6011 0 -6012 0 -6013 0 -6014 1 -6015 0 -6016 0 -6017 0 -6018 0 -6019 0 -6020 0 -6021 0 -6022 0 -6023 1 -6024 0 -6025 0 -6026 0 -6027 0 -6028 0 -6029 0 -6030 0 -6031 1 -6032 0 -6033 0 -6034 0 -6035 0 -6036 0 -6037 0 -6038 1 -6039 0 -6040 0 -6041 0 -6042 0 -6043 0 -6044 0 -6045 0 -6046 0 -6047 0 -6048 1 -6049 0 -6050 0 -6051 0 -6052 0 -6053 0 -6054 0 -6055 1 -6056 0 -6057 0 -6058 0 -6059 0 -6060 0 -6061 1 -6062 0 -6063 0 -6064 0 -6065 0 -6066 0 -6067 0 -6068 1 -6069 0 -6070 0 -6071 0 -6072 0 -6073 0 -6074 0 -6075 0 -6076 1 -6077 0 -6078 0 -6079 0 -6080 0 -6081 0 -6082 0 -6083 0 -6084 0 -6085 1 -6086 0 -6087 0 -6088 0 -6089 0 -6090 0 -6091 0 -6092 0 -6093 0 -6094 0 -6095 1 -6096 0 -6097 0 -6098 0 -6099 0 -6100 0 -6101 0 -6102 0 -6103 0 -6104 1 -6105 0 -6106 0 -6107 0 -6108 0 -6109 0 -6110 0 -6111 0 -6112 1 -6113 0 -6114 0 -6115 0 -6116 0 -6117 0 -6118 0 -6119 0 -6120 0 -6121 0 -6122 0 -6123 0 -6124 0 -6125 1 -6126 0 -6127 0 -6128 0 -6129 0 -6130 0 -6131 0 -6132 0 -6133 0 -6134 0 -6135 0 -6136 0 -6137 0 -6138 0 -6139 0 -6140 0 -6141 0 -6142 1 -6143 0 -6144 0 -6145 0 -6146 0 -6147 0 -6148 0 -6149 0 -6150 1 -6151 0 -6152 0 -6153 0 -6154 0 -6155 0 -6156 0 -6157 0 -6158 0 -6159 1 -6160 0 -6161 0 -6162 0 -6163 0 -6164 0 -6165 0 -6166 0 -6167 1 -6168 0 -6169 0 -6170 0 -6171 0 -6172 0 -6173 0 -6174 0 -6175 1 -6176 0 -6177 0 -6178 0 -6179 0 -6180 0 -6181 0 -6182 0 -6183 1 -6184 0 -6185 0 -6186 0 -6187 0 -6188 0 -6189 0 -6190 0 -6191 0 -6192 1 -6193 0 -6194 0 -6195 0 -6196 0 -6197 0 -6198 0 -6199 0 -6200 0 -6201 1 -6202 0 -6203 0 -6204 0 -6205 0 -6206 0 -6207 0 -6208 0 -6209 0 -6210 1 -6211 0 -6212 0 -6213 0 -6214 0 -6215 0 -6216 0 -6217 1 -6218 0 -6219 0 -6220 0 -6221 0 -6222 0 -6223 0 -6224 0 -6225 1 -6226 0 -6227 0 -6228 0 -6229 0 -6230 0 -6231 0 -6232 0 -6233 0 -6234 1 -6235 0 -6236 0 -6237 0 -6238 0 -6239 0 -6240 0 -6241 1 -6242 0 -6243 0 -6244 0 -6245 0 -6246 0 -6247 0 -6248 0 -6249 0 -6250 1 -6251 0 -6252 0 -6253 0 -6254 0 -6255 0 -6256 0 -6257 0 -6258 1 -6259 0 -6260 0 -6261 0 -6262 0 -6263 0 -6264 0 -6265 0 -6266 0 -6267 0 -6268 1 -6269 0 -6270 0 -6271 0 -6272 0 -6273 0 -6274 0 -6275 0 -6276 0 -6277 1 -6278 0 -6279 0 -6280 0 -6281 0 -6282 0 -6283 0 -6284 0 -6285 1 -6286 0 -6287 0 -6288 0 -6289 0 -6290 0 -6291 0 -6292 1 -6293 0 -6294 0 -6295 0 -6296 0 -6297 0 -6298 0 -6299 1 -6300 0 -6301 0 -6302 0 -6303 0 -6304 0 -6305 0 -6306 0 -6307 1 -6308 0 -6309 0 -6310 0 -6311 0 -6312 0 -6313 0 -6314 0 -6315 1 -6316 0 -6317 0 -6318 0 -6319 0 -6320 0 -6321 0 -6322 0 -6323 0 -6324 1 -6325 0 -6326 0 -6327 0 -6328 0 -6329 0 -6330 0 -6331 0 -6332 1 -6333 0 -6334 0 -6335 0 -6336 0 -6337 0 -6338 0 -6339 0 -6340 0 -6341 1 -6342 0 -6343 0 -6344 0 -6345 0 -6346 0 -6347 0 -6348 0 -6349 0 -6350 1 -6351 0 -6352 0 -6353 0 -6354 0 -6355 0 -6356 0 -6357 0 -6358 1 -6359 0 -6360 0 -6361 0 -6362 0 -6363 0 -6364 0 -6365 0 -6366 1 -6367 0 -6368 0 -6369 0 -6370 0 -6371 0 -6372 0 -6373 0 -6374 0 -6375 1 -6376 0 -6377 0 -6378 0 -6379 0 -6380 0 -6381 0 -6382 0 -6383 1 -6384 0 -6385 0 -6386 0 -6387 0 -6388 0 -6389 0 -6390 0 -6391 4 -6392 0 -6393 1 -6394 0 -6395 0 -6396 0 -6397 1 -6398 0 -6399 0 -6400 0 -6401 0 -6402 1 -6403 0 -6404 0 -6405 0 -6406 0 -6407 1 -6408 0 -6409 0 -6410 0 -6411 0 -6412 1 -6413 0 -6414 0 -6415 0 -6416 0 -6417 0 -6418 1 -6419 0 -6420 0 -6421 0 -6422 0 -6423 0 -6424 0 -6425 1 -6426 0 -6427 0 -6428 0 -6429 0 -6430 0 -6431 0 -6432 0 -6433 0 -6434 1 -6435 0 -6436 0 -6437 0 -6438 0 -6439 0 -6440 0 -6441 0 -6442 0 -6443 1 -6444 0 -6445 0 -6446 0 -6447 0 -6448 0 -6449 0 -6450 0 -6451 0 -6452 1 -6453 0 -6454 0 -6455 0 -6456 0 -6457 0 -6458 0 -6459 0 -6460 0 -6461 0 -6462 0 -6463 1 -6464 0 -6465 0 -6466 0 -6467 0 -6468 0 -6469 0 -6470 0 -6471 0 -6472 1 -6473 0 -6474 0 -6475 0 -6476 0 -6477 0 -6478 0 -6479 0 -6480 0 -6481 0 -6482 1 -6483 0 -6484 0 -6485 0 -6486 0 -6487 0 -6488 0 -6489 0 -6490 0 -6491 0 -6492 1 -6493 0 -6494 0 -6495 0 -6496 0 -6497 0 -6498 0 -6499 0 -6500 0 -6501 0 -6502 0 -6503 0 -6504 0 -6505 0 -6506 0 -6507 0 -6508 0 -6509 0 -6510 0 -6511 0 -6512 1 -6513 0 -6514 0 -6515 0 -6516 0 -6517 0 -6518 0 -6519 0 -6520 0 -6521 1 -6522 0 -6523 0 -6524 0 -6525 0 -6526 0 -6527 0 -6528 0 -6529 0 -6530 0 -6531 1 -6532 0 -6533 0 -6534 0 -6535 0 -6536 0 -6537 0 -6538 0 -6539 0 -6540 1 -6541 0 -6542 0 -6543 0 -6544 0 -6545 0 -6546 0 -6547 0 -6548 0 -6549 0 -6550 1 -6551 0 -6552 0 -6553 0 -6554 0 -6555 0 -6556 0 -6557 0 -6558 0 -6559 0 -6560 1 -6561 0 -6562 0 -6563 0 -6564 0 -6565 0 -6566 0 -6567 0 -6568 0 -6569 1 -6570 0 -6571 0 -6572 0 -6573 0 -6574 0 -6575 0 -6576 0 -6577 1 -6578 0 -6579 0 -6580 0 -6581 0 -6582 0 -6583 0 -6584 0 -6585 0 -6586 1 -6587 0 -6588 0 -6589 0 -6590 0 -6591 0 -6592 0 -6593 0 -6594 0 -6595 1 -6596 0 -6597 0 -6598 0 -6599 0 -6600 0 -6601 0 -6602 0 -6603 0 -6604 1 -6605 0 -6606 0 -6607 0 -6608 0 -6609 0 -6610 0 -6611 0 -6612 0 -6613 1 -6614 0 -6615 0 -6616 0 -6617 0 -6618 0 -6619 0 -6620 0 -6621 0 -6622 1 -6623 0 -6624 0 -6625 0 -6626 0 -6627 0 -6628 0 -6629 0 -6630 0 -6631 1 -6632 0 -6633 0 -6634 0 -6635 0 -6636 0 -6637 0 -6638 0 -6639 0 -6640 1 -6641 0 -6642 0 -6643 0 -6644 0 -6645 0 -6646 0 -6647 0 -6648 0 -6649 0 -6650 1 -6651 0 -6652 0 -6653 0 -6654 0 -6655 0 -6656 0 -6657 0 -6658 0 -6659 0 -6660 1 -6661 0 -6662 0 -6663 0 -6664 0 -6665 0 -6666 0 -6667 0 -6668 0 -6669 1 -6670 0 -6671 0 -6672 0 -6673 0 -6674 0 -6675 0 -6676 0 -6677 0 -6678 0 -6679 1 -6680 0 -6681 0 -6682 0 -6683 0 -6684 0 -6685 0 -6686 0 -6687 0 -6688 1 -6689 0 -6690 0 -6691 0 -6692 0 -6693 0 -6694 0 -6695 0 -6696 0 -6697 0 -6698 1 -6699 0 -6700 0 -6701 0 -6702 0 -6703 0 -6704 0 -6705 0 -6706 1 -6707 0 -6708 0 -6709 0 -6710 0 -6711 0 -6712 0 -6713 0 -6714 0 -6715 0 -6716 1 -6717 0 -6718 0 -6719 0 -6720 0 -6721 0 -6722 0 -6723 0 -6724 0 -6725 0 -6726 1 -6727 0 -6728 0 -6729 0 -6730 0 -6731 0 -6732 0 -6733 0 -6734 0 -6735 0 -6736 0 -6737 1 -6738 0 -6739 0 -6740 0 -6741 0 -6742 0 -6743 0 -6744 0 -6745 0 -6746 1 -6747 0 -6748 0 -6749 0 -6750 0 -6751 0 -6752 0 -6753 0 -6754 0 -6755 0 -6756 1 -6757 0 -6758 0 -6759 0 -6760 0 -6761 0 -6762 0 -6763 0 -6764 0 -6765 0 -6766 1 -6767 0 -6768 0 -6769 0 -6770 0 -6771 0 -6772 0 -6773 0 -6774 0 -6775 1 -6776 0 -6777 0 -6778 0 -6779 0 -6780 0 -6781 0 -6782 0 -6783 0 -6784 1 -6785 0 -6786 0 -6787 0 -6788 0 -6789 0 -6790 0 -6791 0 -6792 0 -6793 0 -6794 1 -6795 0 -6796 0 -6797 0 -6798 0 -6799 0 -6800 0 -6801 0 -6802 0 -6803 1 -6804 0 -6805 0 -6806 0 -6807 0 -6808 0 -6809 0 -6810 0 -6811 0 -6812 0 -6813 1 -6814 0 -6815 0 -6816 0 -6817 0 -6818 0 -6819 0 -6820 0 -6821 0 -6822 0 -6823 0 -6824 1 -6825 0 -6826 0 -6827 0 -6828 0 -6829 0 -6830 0 -6831 0 -6832 1 -6833 0 -6834 0 -6835 0 -6836 0 -6837 0 -6838 0 -6839 0 -6840 0 -6841 0 -6842 1 -6843 0 -6844 0 -6845 0 -6846 0 -6847 0 -6848 0 -6849 0 -6850 0 -6851 1 -6852 0 -6853 0 -6854 0 -6855 0 -6856 0 -6857 0 -6858 0 -6859 0 -6860 0 -6861 0 -6862 1 -6863 0 -6864 0 -6865 0 -6866 0 -6867 0 -6868 0 -6869 0 -6870 0 -6871 1 -6872 0 -6873 0 -6874 0 -6875 0 -6876 0 -6877 0 -6878 0 -6879 1 -6880 0 -6881 0 -6882 0 -6883 0 -6884 0 -6885 0 -6886 1 -6887 0 -6888 0 -6889 0 -6890 0 -6891 0 -6892 0 -6893 0 -6894 0 -6895 1 -6896 0 -6897 0 -6898 0 -6899 0 -6900 0 -6901 0 -6902 0 -6903 0 -6904 0 -6905 0 -6906 0 -6907 0 -6908 0 -6909 0 -6910 0 -6911 0 -6912 0 -6913 0 -6914 1 -6915 0 -6916 0 -6917 0 -6918 0 -6919 0 -6920 0 -6921 0 -6922 0 -6923 1 -6924 0 -6925 0 -6926 0 -6927 0 -6928 0 -6929 0 -6930 0 -6931 0 -6932 0 -6933 0 -6934 1 -6935 0 -6936 0 -6937 0 -6938 0 -6939 0 -6940 0 -6941 0 -6942 0 -6943 0 -6944 1 -6945 0 -6946 0 -6947 0 -6948 0 -6949 0 -6950 0 -6951 0 -6952 0 -6953 0 -6954 1 -6955 0 -6956 0 -6957 0 -6958 0 -6959 0 -6960 0 -6961 0 -6962 0 -6963 0 -6964 1 -6965 0 -6966 0 -6967 0 -6968 0 -6969 0 -6970 0 -6971 0 -6972 0 -6973 0 -6974 1 -6975 0 -6976 0 -6977 0 -6978 0 -6979 0 -6980 0 -6981 0 -6982 0 -6983 1 -6984 0 -6985 0 -6986 0 -6987 0 -6988 0 -6989 0 -6990 0 -6991 0 -6992 1 -6993 0 -6994 0 -6995 0 -6996 0 -6997 0 -6998 0 -6999 0 -7000 0 -7001 1 -7002 0 -7003 0 -7004 0 -7005 0 -7006 0 -7007 0 -7008 0 -7009 0 -7010 1 -7011 0 -7012 0 -7013 0 -7014 0 -7015 0 -7016 0 -7017 0 -7018 0 -7019 0 -7020 1 -7021 0 -7022 0 -7023 0 -7024 0 -7025 0 -7026 0 -7027 0 -7028 0 -7029 0 -7030 1 -7031 0 -7032 0 -7033 0 -7034 0 -7035 0 -7036 0 -7037 0 -7038 0 -7039 1 -7040 0 -7041 0 -7042 0 -7043 0 -7044 0 -7045 0 -7046 0 -7047 0 -7048 1 -7049 0 -7050 0 -7051 0 -7052 0 -7053 0 -7054 0 -7055 0 -7056 0 -7057 0 -7058 0 -7059 1 -7060 0 -7061 0 -7062 0 -7063 0 -7064 0 -7065 0 -7066 0 -7067 0 -7068 0 -7069 1 -7070 0 -7071 0 -7072 0 -7073 0 -7074 0 -7075 0 -7076 0 -7077 0 -7078 0 -7079 1 -7080 0 -7081 0 -7082 0 -7083 0 -7084 0 -7085 0 -7086 0 -7087 1 -7088 0 -7089 0 -7090 0 -7091 0 -7092 0 -7093 0 -7094 0 -7095 0 -7096 0 -7097 1 -7098 0 -7099 0 -7100 0 -7101 0 -7102 0 -7103 0 -7104 0 -7105 1 -7106 0 -7107 0 -7108 0 -7109 0 -7110 0 -7111 0 -7112 0 -7113 0 -7114 1 -7115 0 -7116 0 -7117 0 -7118 0 -7119 0 -7120 0 -7121 0 -7122 0 -7123 0 -7124 1 -7125 0 -7126 0 -7127 0 -7128 0 -7129 0 -7130 0 -7131 0 -7132 0 -7133 0 -7134 1 -7135 0 -7136 0 -7137 0 -7138 0 -7139 0 -7140 0 -7141 0 -7142 0 -7143 1 -7144 0 -7145 0 -7146 0 -7147 0 -7148 0 -7149 0 -7150 0 -7151 0 -7152 1 -7153 0 -7154 0 -7155 0 -7156 0 -7157 0 -7158 0 -7159 0 -7160 0 -7161 0 -7162 1 -7163 0 -7164 0 -7165 0 -7166 0 -7167 0 -7168 0 -7169 0 -7170 0 -7171 0 -7172 1 -7173 0 -7174 0 -7175 0 -7176 0 -7177 0 -7178 0 -7179 0 -7180 0 -7181 0 -7182 1 -7183 0 -7184 0 -7185 0 -7186 0 -7187 0 -7188 0 -7189 0 -7190 0 -7191 0 -7192 0 -7193 1 -7194 0 -7195 0 -7196 0 -7197 0 -7198 0 -7199 0 -7200 0 -7201 0 -7202 0 -7203 1 -7204 0 -7205 0 -7206 0 -7207 0 -7208 0 -7209 0 -7210 0 -7211 0 -7212 0 -7213 0 -7214 0 -7215 0 -7216 0 -7217 0 -7218 0 -7219 0 -7220 0 -7221 0 -7222 1 -7223 0 -7224 0 -7225 0 -7226 0 -7227 0 -7228 0 -7229 0 -7230 0 -7231 0 -7232 1 -7233 0 -7234 0 -7235 0 -7236 0 -7237 0 -7238 0 -7239 0 -7240 0 -7241 0 -7242 0 -7243 1 -7244 0 -7245 0 -7246 0 -7247 0 -7248 0 -7249 0 -7250 0 -7251 0 -7252 0 -7253 1 -7254 0 -7255 0 -7256 0 -7257 0 -7258 0 -7259 0 -7260 0 -7261 0 -7262 0 -7263 0 -7264 1 -7265 0 -7266 0 -7267 0 -7268 0 -7269 0 -7270 0 -7271 0 -7272 0 -7273 0 -7274 1 -7275 0 -7276 0 -7277 0 -7278 0 -7279 0 -7280 0 -7281 0 -7282 0 -7283 0 -7284 0 -7285 1 -7286 0 -7287 0 -7288 0 -7289 0 -7290 0 -7291 0 -7292 0 -7293 0 -7294 0 -7295 0 -7296 0 -7297 0 -7298 0 -7299 0 -7300 0 -7301 0 -7302 0 -7303 0 -7304 1 -7305 0 -7306 0 -7307 0 -7308 0 -7309 0 -7310 0 -7311 0 -7312 0 -7313 0 -7314 0 -7315 1 -7316 0 -7317 0 -7318 0 -7319 0 -7320 0 -7321 0 -7322 0 -7323 0 -7324 1 -7325 0 -7326 0 -7327 0 -7328 0 -7329 0 -7330 0 -7331 0 -7332 0 -7333 1 -7334 0 -7335 0 -7336 0 -7337 0 -7338 0 -7339 0 -7340 0 -7341 0 -7342 1 -7343 0 -7344 0 -7345 0 -7346 0 -7347 0 -7348 0 -7349 0 -7350 0 -7351 0 -7352 1 -7353 0 -7354 0 -7355 0 -7356 0 -7357 0 -7358 0 -7359 0 -7360 0 -7361 0 -7362 0 -7363 1 -7364 0 -7365 0 -7366 0 -7367 0 -7368 0 -7369 0 -7370 0 -7371 0 -7372 1 -7373 0 -7374 0 -7375 0 -7376 0 -7377 0 -7378 0 -7379 0 -7380 0 -7381 0 -7382 1 -7383 0 -7384 0 -7385 0 -7386 0 -7387 0 -7388 0 -7389 0 -7390 0 -7391 1 -7392 0 -7393 0 -7394 0 -7395 0 -7396 0 -7397 0 -7398 0 -7399 0 -7400 0 -7401 1 -7402 0 -7403 0 -7404 0 -7405 0 -7406 0 -7407 0 -7408 0 -7409 0 -7410 0 -7411 0 -7412 1 -7413 0 -7414 0 -7415 0 -7416 0 -7417 0 -7418 0 -7419 0 -7420 0 -7421 0 -7422 1 -7423 0 -7424 0 -7425 0 -7426 0 -7427 0 -7428 0 -7429 0 -7430 0 -7431 0 -7432 1 -7433 0 -7434 0 -7435 0 -7436 0 -7437 0 -7438 0 -7439 0 -7440 0 -7441 1 -7442 0 -7443 0 -7444 0 -7445 0 -7446 0 -7447 0 -7448 0 -7449 1 -7450 0 -7451 0 -7452 0 -7453 0 -7454 0 -7455 0 -7456 0 -7457 0 -7458 0 -7459 0 -7460 1 -7461 0 -7462 0 -7463 0 -7464 0 -7465 0 -7466 0 -7467 0 -7468 0 -7469 1 -7470 0 -7471 0 -7472 0 -7473 0 -7474 0 -7475 0 -7476 0 -7477 0 -7478 1 -7479 0 -7480 0 -7481 0 -7482 0 -7483 0 -7484 0 -7485 0 -7486 0 -7487 1 -7488 0 -7489 0 -7490 0 -7491 0 -7492 0 -7493 0 -7494 0 -7495 0 -7496 0 -7497 1 -7498 0 -7499 0 -7500 0 -7501 0 -7502 0 -7503 0 -7504 0 -7505 0 -7506 0 -7507 0 -7508 1 -7509 0 -7510 0 -7511 0 -7512 0 -7513 0 -7514 0 -7515 0 -7516 0 -7517 0 -7518 1 -7519 0 -7520 0 -7521 0 -7522 0 -7523 0 -7524 0 -7525 0 -7526 0 -7527 0 -7528 0 -7529 0 -7530 0 -7531 0 -7532 0 -7533 0 -7534 0 -7535 0 -7536 0 -7537 0 -7538 0 -7539 1 -7540 0 -7541 0 -7542 0 -7543 0 -7544 0 -7545 0 -7546 0 -7547 0 -7548 0 -7549 2 -7550 0 -7551 0 -7552 0 -7553 0 -7554 0 -7555 0 -7556 0 -7557 1 -7558 0 -7559 0 -7560 0 -7561 0 -7562 0 -7563 0 -7564 0 -7565 0 -7566 0 -7567 0 -7568 1 -7569 0 -7570 0 -7571 0 -7572 0 -7573 0 -7574 0 -7575 0 -7576 0 -7577 0 -7578 0 -7579 0 -7580 0 -7581 0 -7582 0 -7583 0 -7584 0 -7585 0 -7586 0 -7587 0 -7588 1 -7589 0 -7590 0 -7591 0 -7592 0 -7593 0 -7594 0 -7595 0 -7596 0 -7597 0 -7598 0 -7599 1 -7600 0 -7601 0 -7602 0 -7603 0 -7604 0 -7605 0 -7606 0 -7607 0 -7608 0 -7609 0 -7610 1 -7611 0 -7612 0 -7613 0 -7614 0 -7615 0 -7616 0 -7617 0 -7618 0 -7619 0 -7620 0 -7621 1 -7622 0 -7623 0 -7624 0 -7625 0 -7626 0 -7627 1 -7628 0 -7629 0 -7630 0 -7631 0 -7632 0 -7633 0 -7634 1 -7635 0 -7636 0 -7637 0 -7638 0 -7639 0 -7640 0 -7641 1 -7642 0 -7643 0 -7644 0 -7645 0 -7646 0 -7647 0 -7648 0 -7649 1 -7650 0 -7651 0 -7652 0 -7653 0 -7654 0 -7655 0 -7656 0 -7657 0 -7658 0 -7659 0 -7660 1 -7661 0 -7662 0 -7663 0 -7664 0 -7665 0 -7666 0 -7667 0 -7668 0 -7669 0 -7670 1 -7671 0 -7672 0 -7673 0 -7674 0 -7675 0 -7676 0 -7677 0 -7678 0 -7679 0 -7680 0 -7681 1 -7682 0 -7683 0 -7684 0 -7685 0 -7686 0 -7687 0 -7688 0 -7689 0 -7690 0 -7691 1 -7692 0 -7693 0 -7694 0 -7695 0 -7696 0 -7697 0 -7698 0 -7699 0 -7700 0 -7701 0 -7702 1 -7703 0 -7704 0 -7705 0 -7706 0 -7707 0 -7708 0 -7709 0 -7710 0 -7711 0 -7712 1 -7713 0 -7714 0 -7715 0 -7716 0 -7717 0 -7718 0 -7719 0 -7720 0 -7721 0 -7722 1 -7723 0 -7724 0 -7725 0 -7726 0 -7727 0 -7728 0 -7729 0 -7730 0 -7731 0 -7732 1 -7733 0 -7734 0 -7735 0 -7736 0 -7737 0 -7738 0 -7739 0 -7740 0 -7741 0 -7742 1 -7743 0 -7744 0 -7745 0 -7746 0 -7747 0 -7748 0 -7749 0 -7750 0 -7751 0 -7752 1 -7753 0 -7754 0 -7755 0 -7756 0 -7757 0 -7758 0 -7759 0 -7760 0 -7761 1 -7762 0 -7763 0 -7764 0 -7765 0 -7766 0 -7767 0 -7768 0 -7769 0 -7770 1 -7771 0 -7772 0 -7773 0 -7774 0 -7775 0 -7776 0 -7777 0 -7778 0 -7779 1 -7780 0 -7781 0 -7782 0 -7783 0 -7784 0 -7785 0 -7786 0 -7787 0 -7788 0 -7789 1 -7790 0 -7791 0 -7792 0 -7793 0 -7794 0 -7795 0 -7796 0 -7797 0 -7798 0 -7799 1 -7800 0 -7801 0 -7802 0 -7803 0 -7804 0 -7805 0 -7806 0 -7807 0 -7808 0 -7809 0 -7810 1 -7811 0 -7812 0 -7813 0 -7814 0 -7815 0 -7816 0 -7817 0 -7818 0 -7819 1 -7820 0 -7821 0 -7822 0 -7823 0 -7824 0 -7825 0 -7826 0 -7827 0 -7828 1 -7829 0 -7830 0 -7831 0 -7832 0 -7833 0 -7834 0 -7835 0 -7836 0 -7837 0 -7838 0 -7839 1 -7840 0 -7841 0 -7842 0 -7843 0 -7844 0 -7845 0 -7846 0 -7847 0 -7848 0 -7849 1 -7850 0 -7851 0 -7852 0 -7853 0 -7854 0 -7855 0 -7856 0 -7857 0 -7858 1 -7859 0 -7860 0 -7861 0 -7862 0 -7863 0 -7864 0 -7865 0 -7866 0 -7867 0 -7868 1 -7869 0 -7870 0 -7871 0 -7872 0 -7873 0 -7874 0 -7875 0 -7876 0 -7877 0 -7878 0 -7879 0 -7880 0 -7881 0 -7882 0 -7883 0 -7884 0 -7885 0 -7886 0 -7887 1 -7888 0 -7889 0 -7890 0 -7891 0 -7892 0 -7893 0 -7894 0 -7895 0 -7896 0 -7897 0 -7898 1 -7899 0 -7900 0 -7901 0 -7902 0 -7903 0 -7904 0 -7905 0 -7906 0 -7907 0 -7908 1 -7909 0 -7910 0 -7911 0 -7912 0 -7913 0 -7914 0 -7915 0 -7916 0 -7917 0 -7918 1 -7919 0 -7920 0 -7921 0 -7922 0 -7923 0 -7924 0 -7925 0 -7926 0 -7927 0 -7928 1 -7929 0 -7930 0 -7931 0 -7932 0 -7933 0 -7934 0 -7935 0 -7936 0 -7937 0 -7938 1 -7939 0 -7940 0 -7941 0 -7942 0 -7943 0 -7944 0 -7945 0 -7946 0 -7947 0 -7948 1 -7949 0 -7950 0 -7951 0 -7952 0 -7953 0 -7954 0 -7955 0 -7956 0 -7957 0 -7958 1 -7959 0 -7960 0 -7961 0 -7962 0 -7963 0 -7964 0 -7965 0 -7966 0 -7967 0 -7968 1 -7969 0 -7970 0 -7971 0 -7972 0 -7973 0 -7974 0 -7975 0 -7976 0 -7977 0 -7978 1 -7979 0 -7980 0 -7981 0 -7982 0 -7983 0 -7984 0 -7985 1 -7986 0 -7987 0 -7988 0 -7989 0 -7990 0 -7991 0 -7992 0 -7993 0 -7994 0 -7995 1 -7996 0 -7997 0 -7998 0 -7999 0 -8000 0 -8001 0 -8002 0 -8003 0 -8004 0 -8005 0 -8006 1 -8007 0 -8008 0 -8009 0 -8010 0 -8011 0 -8012 0 -8013 0 -8014 0 -8015 1 -8016 0 -8017 0 -8018 0 -8019 0 -8020 0 -8021 0 -8022 0 -8023 0 -8024 0 -8025 1 -8026 0 -8027 0 -8028 0 -8029 0 -8030 0 -8031 0 -8032 0 -8033 0 -8034 0 -8035 0 -8036 1 -8037 0 -8038 0 -8039 0 -8040 0 -8041 0 -8042 0 -8043 0 -8044 0 -8045 0 -8046 1 -8047 0 -8048 0 -8049 0 -8050 0 -8051 0 -8052 0 -8053 0 -8054 0 -8055 0 -8056 0 -8057 1 -8058 0 -8059 0 -8060 0 -8061 0 -8062 0 -8063 0 -8064 0 -8065 0 -8066 0 -8067 1 -8068 0 -8069 0 -8070 0 -8071 0 -8072 0 -8073 0 -8074 0 -8075 0 -8076 0 -8077 0 -8078 1 -8079 0 -8080 0 -8081 0 -8082 0 -8083 0 -8084 0 -8085 0 -8086 0 -8087 0 -8088 1 -8089 0 -8090 0 -8091 0 -8092 0 -8093 0 -8094 0 -8095 0 -8096 0 -8097 0 -8098 1 -8099 0 -8100 0 -8101 0 -8102 0 -8103 0 -8104 0 -8105 1 -8106 0 -8107 0 -8108 0 -8109 0 -8110 0 -8111 0 -8112 0 -8113 0 -8114 0 -8115 1 -8116 0 -8117 0 -8118 0 -8119 0 -8120 0 -8121 0 -8122 0 -8123 0 -8124 0 -8125 1 -8126 0 -8127 0 -8128 0 -8129 0 -8130 0 -8131 0 -8132 0 -8133 0 -8134 1 -8135 0 -8136 0 -8137 0 -8138 0 -8139 0 -8140 0 -8141 0 -8142 0 -8143 0 -8144 0 -8145 1 -8146 0 -8147 0 -8148 0 -8149 0 -8150 0 -8151 0 -8152 0 -8153 0 -8154 0 -8155 0 -8156 1 -8157 0 -8158 0 -8159 0 -8160 0 -8161 0 -8162 0 -8163 0 -8164 0 -8165 0 -8166 1 -8167 0 -8168 0 -8169 0 -8170 0 -8171 0 -8172 0 -8173 0 -8174 0 -8175 0 -8176 1 -8177 0 -8178 0 -8179 0 -8180 0 -8181 0 -8182 0 -8183 0 -8184 0 -8185 0 -8186 1 -8187 0 -8188 0 -8189 0 -8190 0 -8191 0 -8192 0 -8193 0 -8194 0 -8195 0 -8196 0 -8197 1 -8198 0 -8199 0 -8200 0 -8201 0 -8202 0 -8203 0 -8204 0 -8205 0 -8206 0 -8207 1 -8208 0 -8209 0 -8210 0 -8211 0 -8212 0 -8213 0 -8214 0 -8215 0 -8216 1 -8217 0 -8218 0 -8219 0 -8220 0 -8221 0 -8222 0 -8223 0 -8224 0 -8225 1 -8226 0 -8227 0 -8228 0 -8229 0 -8230 0 -8231 0 -8232 0 -8233 0 -8234 0 -8235 1 -8236 0 -8237 0 -8238 0 -8239 0 -8240 0 -8241 0 -8242 0 -8243 0 -8244 1 -8245 0 -8246 0 -8247 0 -8248 0 -8249 0 -8250 0 -8251 0 -8252 0 -8253 0 -8254 1 -8255 0 -8256 0 -8257 0 -8258 0 -8259 0 -8260 0 -8261 0 -8262 0 -8263 0 -8264 0 -8265 1 -8266 0 -8267 0 -8268 0 -8269 0 -8270 0 -8271 0 -8272 0 -8273 0 -8274 0 -8275 1 -8276 0 -8277 0 -8278 0 -8279 0 -8280 0 -8281 0 -8282 0 -8283 0 -8284 0 -8285 0 -8286 1 -8287 0 -8288 0 -8289 0 -8290 0 -8291 0 -8292 0 -8293 0 -8294 0 -8295 0 -8296 1 -8297 0 -8298 0 -8299 0 -8300 0 -8301 0 -8302 0 -8303 0 -8304 1 -8305 0 -8306 0 -8307 0 -8308 0 -8309 0 -8310 0 -8311 0 -8312 0 -8313 0 -8314 1 -8315 0 -8316 0 -8317 0 -8318 0 -8319 0 -8320 0 -8321 0 -8322 0 -8323 0 -8324 1 -8325 0 -8326 0 -8327 0 -8328 0 -8329 0 -8330 0 -8331 0 -8332 0 -8333 0 -8334 0 -8335 0 -8336 0 -8337 0 -8338 0 -8339 0 -8340 0 -8341 0 -8342 1 -8343 0 -8344 0 -8345 0 -8346 0 -8347 0 -8348 0 -8349 0 -8350 0 -8351 1 -8352 0 -8353 0 -8354 0 -8355 0 -8356 0 -8357 0 -8358 0 -8359 0 -8360 0 -8361 1 -8362 0 -8363 0 -8364 0 -8365 0 -8366 0 -8367 0 -8368 0 -8369 0 -8370 0 -8371 1 -8372 0 -8373 0 -8374 0 -8375 0 -8376 0 -8377 0 -8378 0 -8379 0 -8380 1 -8381 0 -8382 0 -8383 0 -8384 0 -8385 0 -8386 0 -8387 0 -8388 0 -8389 1 -8390 0 -8391 0 -8392 0 -8393 0 -8394 0 -8395 0 -8396 0 -8397 0 -8398 0 -8399 1 -8400 0 -8401 0 -8402 0 -8403 0 -8404 0 -8405 0 -8406 0 -8407 0 -8408 0 -8409 1 -8410 0 -8411 0 -8412 0 -8413 0 -8414 0 -8415 0 -8416 0 -8417 0 -8418 0 -8419 1 -8420 0 -8421 0 -8422 0 -8423 0 -8424 0 -8425 0 -8426 0 -8427 0 -8428 0 -8429 0 -8430 1 -8431 0 -8432 0 -8433 0 -8434 0 -8435 0 -8436 0 -8437 0 -8438 1 -8439 0 -8440 0 -8441 0 -8442 0 -8443 0 -8444 0 -8445 0 -8446 0 -8447 1 -8448 0 -8449 0 -8450 0 -8451 0 -8452 0 -8453 0 -8454 0 -8455 0 -8456 0 -8457 1 -8458 0 -8459 0 -8460 0 -8461 0 -8462 0 -8463 0 -8464 0 -8465 0 -8466 0 -8467 1 -8468 0 -8469 0 -8470 0 -8471 0 -8472 0 -8473 0 -8474 0 -8475 0 -8476 0 -8477 1 -8478 0 -8479 0 -8480 0 -8481 0 -8482 0 -8483 0 -8484 0 -8485 0 -8486 1 -8487 0 -8488 0 -8489 0 -8490 0 -8491 0 -8492 0 -8493 0 -8494 0 -8495 0 -8496 0 -8497 0 -8498 0 -8499 0 -8500 0 -8501 0 -8502 0 -8503 0 -8504 0 -8505 0 -8506 1 -8507 0 -8508 0 -8509 0 -8510 0 -8511 0 -8512 0 -8513 0 -8514 0 -8515 0 -8516 0 -8517 0 -8518 0 -8519 0 -8520 0 -8521 0 -8522 0 -8523 1 -8524 0 -8525 0 -8526 0 -8527 0 -8528 0 -8529 0 -8530 0 -8531 0 -8532 1 -8533 0 -8534 0 -8535 0 -8536 0 -8537 0 -8538 0 -8539 0 -8540 0 -8541 1 -8542 0 -8543 0 -8544 0 -8545 0 -8546 0 -8547 0 -8548 0 -8549 1 -8550 0 -8551 0 -8552 0 -8553 0 -8554 0 -8555 0 -8556 0 -8557 0 -8558 0 -8559 1 -8560 0 -8561 0 -8562 0 -8563 0 -8564 0 -8565 0 -8566 0 -8567 0 -8568 1 -8569 0 -8570 0 -8571 0 -8572 0 -8573 0 -8574 0 -8575 0 -8576 0 -8577 1 -8578 0 -8579 0 -8580 0 -8581 0 -8582 0 -8583 0 -8584 0 -8585 0 -8586 1 -8587 0 -8588 0 -8589 0 -8590 0 -8591 0 -8592 0 -8593 0 -8594 0 -8595 0 -8596 1 -8597 0 -8598 0 -8599 0 -8600 0 -8601 0 -8602 0 -8603 0 -8604 0 -8605 0 -8606 1 -8607 0 -8608 0 -8609 0 -8610 0 -8611 0 -8612 0 -8613 0 -8614 0 -8615 0 -8616 1 -8617 0 -8618 0 -8619 0 -8620 0 -8621 0 -8622 0 -8623 0 -8624 0 -8625 1 -8626 0 -8627 0 -8628 0 -8629 0 -8630 0 -8631 0 -8632 0 -8633 1 -8634 0 -8635 0 -8636 0 -8637 0 -8638 0 -8639 0 -8640 0 -8641 0 -8642 0 -8643 1 -8644 0 -8645 0 -8646 0 -8647 0 -8648 0 -8649 0 -8650 0 -8651 1 -8652 0 -8653 0 -8654 0 -8655 0 -8656 0 -8657 0 -8658 0 -8659 0 -8660 1 -8661 0 -8662 0 -8663 0 -8664 0 -8665 0 -8666 0 -8667 0 -8668 0 -8669 1 -8670 0 -8671 0 -8672 0 -8673 0 -8674 0 -8675 0 -8676 0 -8677 1 -8678 0 -8679 0 -8680 0 -8681 0 -8682 0 -8683 0 -8684 0 -8685 0 -8686 1 -8687 0 -8688 0 -8689 0 -8690 0 -8691 0 -8692 0 -8693 0 -8694 0 -8695 0 -8696 1 -8697 0 -8698 0 -8699 0 -8700 0 -8701 0 -8702 0 -8703 0 -8704 0 -8705 1 -8706 0 -8707 0 -8708 0 -8709 0 -8710 0 -8711 0 -8712 0 -8713 0 -8714 0 -8715 1 -8716 0 -8717 0 -8718 0 -8719 0 -8720 0 -8721 0 -8722 0 -8723 0 -8724 0 -8725 1 -8726 0 -8727 0 -8728 0 -8729 0 -8730 0 -8731 0 -8732 0 -8733 0 -8734 0 -8735 1 -8736 0 -8737 0 -8738 0 -8739 0 -8740 0 -8741 0 -8742 0 -8743 0 -8744 0 -8745 1 -8746 0 -8747 0 -8748 0 -8749 0 -8750 0 -8751 0 -8752 0 -8753 0 -8754 0 -8755 1 -8756 0 -8757 0 -8758 0 -8759 0 -8760 0 -8761 0 -8762 0 -8763 1 -8764 0 -8765 0 -8766 0 -8767 0 -8768 0 -8769 0 -8770 1 -8771 0 -8772 0 -8773 0 -8774 0 -8775 0 -8776 0 -8777 0 -8778 0 -8779 0 -8780 1 -8781 0 -8782 0 -8783 0 -8784 0 -8785 0 -8786 0 -8787 0 -8788 0 -8789 1 -8790 0 -8791 0 -8792 0 -8793 0 -8794 0 -8795 0 -8796 0 -8797 0 -8798 1 -8799 0 -8800 0 -8801 0 -8802 0 -8803 0 -8804 0 -8805 0 -8806 0 -8807 3 -8808 0 -8809 0 -8810 1 -8811 0 -8812 0 -8813 0 -8814 0 -8815 1 -8816 0 -8817 0 -8818 0 -8819 0 -8820 1 -8821 0 -8822 0 -8823 0 -8824 1 -8825 0 -8826 0 -8827 0 -8828 0 -8829 0 -8830 1 -8831 0 -8832 0 -8833 0 -8834 0 -8835 0 -8836 0 -8837 1 -8838 0 -8839 0 -8840 0 -8841 0 -8842 0 -8843 0 -8844 0 -8845 1 -8846 0 -8847 0 -8848 0 -8849 0 -8850 0 -8851 0 -8852 0 -8853 0 -8854 0 -8855 1 -8856 0 -8857 0 -8858 0 -8859 0 -8860 0 -8861 0 -8862 0 -8863 0 -8864 0 -8865 1 -8866 0 -8867 0 -8868 0 -8869 0 -8870 0 -8871 0 -8872 1 -8873 0 -8874 0 -8875 0 -8876 0 -8877 0 -8878 0 -8879 0 -8880 1 -8881 0 -8882 0 -8883 0 -8884 0 -8885 0 -8886 0 -8887 0 -8888 1 -8889 0 -8890 0 -8891 0 -8892 0 -8893 0 -8894 0 -8895 0 -8896 0 -8897 0 -8898 0 -8899 0 -8900 0 -8901 0 -8902 0 -8903 0 -8904 0 -8905 1 -8906 0 -8907 0 -8908 0 -8909 0 -8910 0 -8911 0 -8912 1 -8913 0 -8914 0 -8915 0 -8916 0 -8917 0 -8918 0 -8919 0 -8920 1 -8921 0 -8922 0 -8923 0 -8924 0 -8925 0 -8926 0 -8927 0 -8928 0 -8929 1 -8930 0 -8931 0 -8932 0 -8933 0 -8934 0 -8935 0 -8936 0 -8937 0 -8938 0 -8939 1 -8940 0 -8941 0 -8942 0 -8943 0 -8944 0 -8945 0 -8946 0 -8947 0 -8948 0 -8949 1 -8950 0 -8951 0 -8952 0 -8953 0 -8954 0 -8955 0 -8956 0 -8957 0 -8958 0 -8959 1 -8960 0 -8961 0 -8962 0 -8963 0 -8964 0 -8965 0 -8966 0 -8967 0 -8968 0 -8969 1 -8970 0 -8971 0 -8972 0 -8973 0 -8974 0 -8975 0 -8976 0 -8977 0 -8978 1 -8979 0 -8980 0 -8981 0 -8982 0 -8983 0 -8984 0 -8985 0 -8986 0 -8987 1 -8988 0 -8989 0 -8990 0 -8991 0 -8992 0 -8993 0 -8994 0 -8995 0 -8996 0 -8997 1 -8998 0 -8999 0 -9000 0 -9001 0 -9002 0 -9003 0 -9004 0 -9005 0 -9006 1 -9007 0 -9008 0 -9009 0 -9010 0 -9011 0 -9012 0 -9013 0 -9014 1 -9015 0 -9016 0 -9017 0 -9018 0 -9019 0 -9020 0 -9021 0 -9022 1 -9023 0 -9024 0 -9025 0 -9026 0 -9027 0 -9028 0 -9029 0 -9030 1 -9031 0 -9032 0 -9033 0 -9034 0 -9035 0 -9036 0 -9037 0 -9038 1 -9039 0 -9040 0 -9041 0 -9042 0 -9043 0 -9044 0 -9045 0 -9046 0 -9047 1 -9048 0 -9049 0 -9050 0 -9051 0 -9052 0 -9053 0 -9054 0 -9055 1 -9056 0 -9057 0 -9058 0 -9059 0 -9060 0 -9061 0 -9062 0 -9063 1 -9064 0 -9065 0 -9066 0 -9067 0 -9068 0 -9069 0 -9070 0 -9071 0 -9072 0 -9073 1 -9074 0 -9075 0 -9076 0 -9077 0 -9078 0 -9079 0 -9080 0 -9081 0 -9082 0 -9083 0 -9084 0 -9085 0 -9086 0 -9087 0 -9088 0 -9089 0 -9090 0 -9091 0 -9092 1 -9093 0 -9094 0 -9095 0 -9096 0 -9097 0 -9098 0 -9099 0 -9100 1 -9101 0 -9102 0 -9103 0 -9104 0 -9105 0 -9106 0 -9107 0 -9108 1 -9109 0 -9110 0 -9111 0 -9112 0 -9113 0 -9114 0 -9115 0 -9116 0 -9117 1 -9118 0 -9119 0 -9120 0 -9121 0 -9122 0 -9123 0 -9124 0 -9125 0 -9126 1 -9127 0 -9128 0 -9129 0 -9130 0 -9131 0 -9132 0 -9133 0 -9134 0 -9135 1 -9136 0 -9137 0 -9138 0 -9139 0 -9140 0 -9141 0 -9142 0 -9143 1 -9144 0 -9145 0 -9146 0 -9147 0 -9148 0 -9149 0 -9150 0 -9151 0 -9152 1 -9153 0 -9154 0 -9155 0 -9156 0 -9157 0 -9158 0 -9159 0 -9160 0 -9161 1 -9162 0 -9163 0 -9164 0 -9165 0 -9166 0 -9167 0 -9168 0 -9169 1 -9170 0 -9171 0 -9172 0 -9173 0 -9174 0 -9175 0 -9176 0 -9177 0 -9178 1 -9179 0 -9180 0 -9181 0 -9182 0 -9183 0 -9184 0 -9185 0 -9186 0 -9187 0 -9188 1 -9189 0 -9190 0 -9191 0 -9192 0 -9193 0 -9194 0 -9195 0 -9196 0 -9197 1 -9198 0 -9199 0 -9200 0 -9201 0 -9202 0 -9203 0 -9204 0 -9205 0 -9206 0 -9207 0 -9208 0 -9209 0 -9210 0 -9211 0 -9212 0 -9213 0 -9214 0 -9215 0 -9216 0 -9217 0 -9218 0 -9219 0 -9220 0 -9221 1 -9222 0 -9223 0 -9224 0 -9225 0 -9226 0 -9227 0 -9228 1 -9229 0 -9230 0 -9231 0 -9232 0 -9233 0 -9234 0 -9235 0 -9236 0 -9237 1 -9238 0 -9239 0 -9240 0 -9241 0 -9242 0 -9243 0 -9244 0 -9245 0 -9246 1 -9247 0 -9248 0 -9249 0 -9250 0 -9251 0 -9252 0 -9253 0 -9254 0 -9255 1 -9256 0 -9257 0 -9258 0 -9259 0 -9260 0 -9261 1 -9262 0 -9263 0 -9264 0 -9265 0 -9266 0 -9267 0 -9268 0 -9269 0 -9270 0 -9271 0 -9272 0 -9273 0 -9274 0 -9275 0 -9276 1 -9277 0 -9278 0 -9279 0 -9280 0 -9281 0 -9282 0 -9283 0 -9284 0 -9285 0 -9286 0 -9287 0 -9288 0 -9289 0 -9290 1 -9291 0 -9292 0 -9293 0 -9294 0 -9295 0 -9296 0 -9297 0 -9298 0 -9299 0 -9300 1 -9301 0 -9302 0 -9303 0 -9304 0 -9305 0 -9306 0 -9307 0 -9308 1 -9309 0 -9310 0 -9311 0 -9312 0 -9313 0 -9314 0 -9315 0 -9316 1 -9317 0 -9318 0 -9319 0 -9320 0 -9321 0 -9322 0 -9323 1 -9324 0 -9325 0 -9326 0 -9327 0 -9328 0 -9329 0 -9330 0 -9331 1 -9332 0 -9333 0 -9334 0 -9335 0 -9336 0 -9337 0 -9338 1 -9339 0 -9340 0 -9341 0 -9342 0 -9343 0 -9344 0 -9345 1 -9346 0 -9347 0 -9348 0 -9349 0 -9350 0 -9351 0 -9352 0 -9353 0 -9354 0 -9355 1 -9356 0 -9357 0 -9358 0 -9359 0 -9360 0 -9361 0 -9362 0 -9363 1 -9364 0 -9365 0 -9366 0 -9367 0 -9368 0 -9369 0 -9370 1 -9371 0 -9372 0 -9373 0 -9374 0 -9375 0 -9376 0 -9377 0 -9378 1 -9379 0 -9380 0 -9381 0 -9382 0 -9383 0 -9384 0 -9385 0 -9386 0 -9387 0 -9388 0 -9389 0 -9390 0 -9391 0 -9392 0 -9393 0 -9394 0 -9395 1 -9396 0 -9397 0 -9398 0 -9399 0 -9400 0 -9401 0 -9402 0 -9403 1 -9404 0 -9405 0 -9406 0 -9407 0 -9408 0 -9409 0 -9410 0 -9411 0 -9412 1 -9413 0 -9414 0 -9415 0 -9416 0 -9417 0 -9418 0 -9419 0 -9420 1 -9421 0 -9422 0 -9423 0 -9424 0 -9425 0 -9426 0 -9427 0 -9428 0 -9429 1 -9430 0 -9431 0 -9432 0 -9433 0 -9434 0 -9435 0 -9436 0 -9437 0 -9438 0 -9439 1 -9440 0 -9441 0 -9442 0 -9443 0 -9444 0 -9445 0 -9446 0 -9447 0 -9448 0 -9449 1 -9450 0 -9451 0 -9452 0 -9453 0 -9454 0 -9455 0 -9456 0 -9457 1 -9458 0 -9459 0 -9460 0 -9461 0 -9462 0 -9463 0 -9464 1 -9465 0 -9466 0 -9467 0 -9468 0 -9469 0 -9470 0 -9471 0 -9472 0 -9473 1 -9474 0 -9475 0 -9476 0 -9477 0 -9478 0 -9479 0 -9480 0 -9481 1 -9482 0 -9483 0 -9484 0 -9485 0 -9486 0 -9487 0 -9488 1 -9489 0 -9490 0 -9491 0 -9492 0 -9493 0 -9494 0 -9495 0 -9496 0 -9497 1 -9498 0 -9499 0 -9500 0 -9501 0 -9502 0 -9503 0 -9504 0 -9505 0 -9506 0 -9507 0 -9508 0 -9509 0 -9510 0 -9511 0 -9512 0 -9513 0 -9514 1 -9515 0 -9516 0 -9517 0 -9518 0 -9519 0 -9520 0 -9521 0 -9522 1 -9523 0 -9524 0 -9525 0 -9526 0 -9527 0 -9528 0 -9529 0 -9530 1 -9531 0 -9532 0 -9533 0 -9534 0 -9535 0 -9536 0 -9537 0 -9538 1 -9539 0 -9540 0 -9541 0 -9542 0 -9543 0 -9544 0 -9545 0 -9546 0 -9547 1 -9548 0 -9549 0 -9550 0 -9551 0 -9552 0 -9553 0 -9554 0 -9555 1 -9556 0 -9557 0 -9558 0 -9559 0 -9560 0 -9561 0 -9562 0 -9563 1 -9564 0 -9565 0 -9566 0 -9567 0 -9568 0 -9569 0 -9570 0 -9571 0 -9572 1 -9573 0 -9574 0 -9575 0 -9576 0 -9577 0 -9578 0 -9579 0 -9580 1 -9581 0 -9582 0 -9583 0 -9584 0 -9585 0 -9586 0 -9587 0 -9588 0 -9589 1 -9590 0 -9591 0 -9592 0 -9593 0 -9594 0 -9595 0 -9596 0 -9597 0 -9598 0 -9599 0 -9600 0 -9601 0 -9602 0 -9603 0 -9604 0 -9605 0 -9606 0 -9607 0 -9608 1 -9609 0 -9610 0 -9611 0 -9612 0 -9613 0 -9614 0 -9615 1 -9616 0 -9617 0 -9618 0 -9619 0 -9620 0 -9621 0 -9622 1 -9623 0 -9624 0 -9625 0 -9626 0 -9627 0 -9628 0 -9629 0 -9630 1 -9631 0 -9632 0 -9633 0 -9634 0 -9635 0 -9636 0 -9637 0 -9638 0 -9639 1 -9640 0 -9641 0 -9642 0 -9643 0 -9644 0 -9645 0 -9646 0 -9647 0 -9648 1 -9649 0 -9650 0 -9651 0 -9652 0 -9653 0 -9654 0 -9655 0 -9656 1 -9657 0 -9658 0 -9659 0 -9660 0 -9661 0 -9662 0 -9663 1 -9664 0 -9665 0 -9666 0 -9667 0 -9668 0 -9669 0 -9670 0 -9671 0 -9672 0 -9673 1 -9674 0 -9675 0 -9676 0 -9677 0 -9678 0 -9679 0 -9680 0 -9681 1 -9682 0 -9683 0 -9684 0 -9685 0 -9686 0 -9687 0 -9688 0 -9689 1 -9690 0 -9691 0 -9692 0 -9693 0 -9694 0 -9695 0 -9696 1 -9697 0 -9698 0 -9699 0 -9700 0 -9701 0 -9702 0 -9703 0 -9704 1 -9705 0 -9706 0 -9707 0 -9708 0 -9709 0 -9710 0 -9711 0 -9712 1 -9713 0 -9714 0 -9715 0 -9716 0 -9717 0 -9718 0 -9719 0 -9720 0 -9721 0 -9722 1 -9723 0 -9724 0 -9725 0 -9726 0 -9727 0 -9728 0 -9729 0 -9730 0 -9731 1 -9732 0 -9733 0 -9734 0 -9735 0 -9736 0 -9737 0 -9738 0 -9739 0 -9740 1 -9741 0 -9742 0 -9743 0 -9744 0 -9745 0 -9746 0 -9747 0 -9748 0 -9749 1 -9750 0 -9751 0 -9752 0 -9753 0 -9754 0 -9755 0 -9756 1 -9757 0 -9758 0 -9759 0 -9760 0 -9761 0 -9762 0 -9763 0 -9764 0 -9765 0 -9766 0 -9767 0 -9768 0 -9769 0 -9770 0 -9771 0 -9772 0 -9773 1 -9774 0 -9775 0 -9776 0 -9777 0 -9778 0 -9779 0 -9780 1 -9781 0 -9782 0 -9783 0 -9784 0 -9785 0 -9786 0 -9787 0 -9788 1 -9789 0 -9790 0 -9791 0 -9792 0 -9793 0 -9794 0 -9795 0 -9796 0 -9797 0 -9798 0 -9799 0 -9800 0 -9801 0 -9802 0 -9803 1 -9804 0 -9805 0 -9806 0 -9807 0 -9808 0 -9809 0 -9810 0 -9811 0 -9812 1 -9813 0 -9814 0 -9815 0 -9816 0 -9817 0 -9818 0 -9819 0 -9820 1 -9821 0 -9822 0 -9823 0 -9824 0 -9825 0 -9826 0 -9827 0 -9828 0 -9829 1 -9830 0 -9831 0 -9832 0 -9833 0 -9834 0 -9835 0 -9836 0 -9837 0 -9838 1 -9839 0 -9840 0 -9841 0 -9842 0 -9843 0 -9844 0 -9845 0 -9846 0 -9847 0 -9848 1 -9849 0 -9850 0 -9851 0 -9852 0 -9853 0 -9854 4 -9855 0 -9856 0 -9857 1 -9858 0 -9859 0 -9860 0 -9861 0 -9862 1 -9863 0 -9864 0 -9865 0 -9866 0 -9867 0 -9868 1 -9869 0 -9870 0 -9871 0 -9872 0 -9873 1 -9874 0 -9875 0 -9876 0 -9877 0 -9878 1 -9879 0 -9880 0 -9881 0 -9882 0 -9883 0 -9884 0 -9885 0 -9886 1 -9887 0 -9888 0 -9889 0 -9890 0 -9891 0 -9892 0 -9893 0 -9894 0 -9895 1 -9896 0 -9897 0 -9898 0 -9899 0 -9900 0 -9901 0 -9902 0 -9903 0 -9904 1 -9905 0 -9906 0 -9907 0 -9908 0 -9909 0 -9910 0 -9911 0 -9912 0 -9913 0 -9914 0 -9915 0 -9916 0 -9917 0 -9918 0 -9919 0 -9920 0 -9921 0 -9922 0 -9923 0 -9924 1 -9925 0 -9926 0 -9927 0 -9928 0 -9929 0 -9930 0 -9931 0 -9932 0 -9933 0 -9934 1 -9935 0 -9936 0 -9937 0 -9938 0 -9939 0 -9940 0 -9941 0 -9942 0 -9943 0 -9944 1 -9945 0 -9946 0 -9947 0 -9948 0 -9949 0 -9950 0 -9951 0 -9952 0 -9953 0 -9954 1 -9955 0 -9956 0 -9957 0 -9958 0 -9959 0 -9960 0 -9961 0 -9962 0 -9963 1 -9964 0 -9965 0 -9966 0 -9967 0 -9968 0 -9969 0 -9970 0 -9971 0 -9972 1 -9973 0 -9974 0 -9975 0 -9976 0 -9977 0 -9978 0 -9979 0 -9980 0 -9981 0 -9982 0 -9983 1 -9984 0 -9985 0 -9986 0 -9987 0 -9988 0 -9989 0 -9990 0 -9991 0 -9992 0 -9993 1 -9994 0 -9995 0 -9996 0 -9997 0 -9998 0 -9999 0 -10000 0 -10001 0 -10002 0 -10003 0 -10004 1 -10005 0 -10006 0 -10007 0 -10008 0 -10009 0 -10010 0 -10011 0 -10012 0 -10013 1 -10014 0 -10015 0 -10016 0 -10017 0 -10018 0 -10019 0 -10020 0 -10021 0 -10022 0 -10023 1 -10024 0 -10025 0 -10026 0 -10027 0 -10028 0 -10029 0 -10030 0 -10031 1 -10032 0 -10033 0 -10034 0 -10035 0 -10036 0 -10037 0 -10038 0 -10039 0 -10040 0 -10041 1 -10042 0 -10043 0 -10044 0 -10045 0 -10046 0 -10047 0 -10048 0 -10049 0 -10050 0 -10051 1 -10052 0 -10053 0 -10054 0 -10055 0 -10056 0 -10057 0 -10058 0 -10059 0 -10060 1 -10061 0 -10062 0 -10063 0 -10064 0 -10065 0 -10066 0 -10067 0 -10068 0 -10069 1 -10070 0 -10071 0 -10072 0 -10073 0 -10074 0 -10075 0 -10076 0 -10077 0 -10078 1 -10079 0 -10080 0 -10081 0 -10082 0 -10083 0 -10084 0 -10085 0 -10086 0 -10087 1 -10088 0 -10089 0 -10090 0 -10091 0 -10092 0 -10093 0 -10094 0 -10095 0 -10096 0 -10097 1 -10098 0 -10099 0 -10100 0 -10101 0 -10102 0 -10103 0 -10104 0 -10105 0 -10106 0 -10107 0 -10108 1 -10109 0 -10110 0 -10111 0 -10112 0 -10113 0 -10114 0 -10115 0 -10116 0 -10117 0 -10118 1 -10119 0 -10120 0 -10121 0 -10122 0 -10123 0 -10124 0 -10125 0 -10126 0 -10127 1 -10128 0 -10129 0 -10130 0 -10131 0 -10132 0 -10133 0 -10134 0 -10135 0 -10136 0 -10137 1 -10138 0 -10139 0 -10140 0 -10141 0 -10142 0 -10143 0 -10144 0 -10145 0 -10146 0 -10147 1 -10148 0 -10149 0 -10150 0 -10151 0 -10152 0 -10153 0 -10154 0 -10155 0 -10156 0 -10157 1 -10158 0 -10159 0 -10160 0 -10161 0 -10162 0 -10163 0 -10164 0 -10165 0 -10166 0 -10167 1 -10168 0 -10169 0 -10170 0 -10171 0 -10172 0 -10173 0 -10174 0 -10175 0 -10176 1 -10177 0 -10178 0 -10179 0 -10180 0 -10181 0 -10182 0 -10183 0 -10184 0 -10185 1 -10186 0 -10187 0 -10188 0 -10189 0 -10190 0 -10191 0 -10192 0 -10193 1 -10194 0 -10195 0 -10196 0 -10197 0 -10198 0 -10199 0 -10200 0 -10201 1 -10202 0 -10203 0 -10204 0 -10205 0 -10206 0 -10207 0 -10208 0 -10209 0 -10210 0 -10211 1 -10212 0 -10213 0 -10214 0 -10215 0 -10216 0 -10217 0 -10218 0 -10219 0 -10220 1 -10221 0 -10222 0 -10223 0 -10224 0 -10225 0 -10226 0 -10227 0 -10228 0 -10229 0 -10230 1 -10231 0 -10232 0 -10233 0 -10234 0 -10235 0 -10236 0 -10237 0 -10238 0 -10239 0 -10240 1 -10241 0 -10242 0 -10243 0 -10244 0 -10245 0 -10246 0 -10247 0 -10248 0 -10249 0 -10250 1 -10251 0 -10252 0 -10253 0 -10254 0 -10255 0 -10256 0 -10257 0 -10258 0 -10259 0 -10260 1 -10261 0 -10262 0 -10263 0 -10264 1 -10265 0 -10266 0 -10267 0 -10268 0 -10269 0 -10270 1 -10271 0 -10272 0 -10273 0 -10274 0 -10275 0 -10276 0 -10277 0 -10278 1 -10279 0 -10280 0 -10281 0 -10282 0 -10283 0 -10284 0 -10285 0 -10286 1 -10287 0 -10288 0 -10289 0 -10290 0 -10291 0 -10292 0 -10293 0 -10294 0 -10295 0 -10296 1 -10297 0 -10298 0 -10299 0 -10300 0 -10301 0 -10302 0 -10303 0 -10304 0 -10305 1 -10306 0 -10307 0 -10308 0 -10309 0 -10310 0 -10311 0 -10312 0 -10313 0 -10314 1 -10315 0 -10316 0 -10317 0 -10318 0 -10319 0 -10320 0 -10321 0 -10322 0 -10323 1 -10324 0 -10325 0 -10326 0 -10327 0 -10328 0 -10329 0 -10330 0 -10331 0 -10332 0 -10333 1 -10334 0 -10335 0 -10336 0 -10337 0 -10338 0 -10339 0 -10340 0 -10341 0 -10342 0 -10343 0 -10344 0 -10345 0 -10346 0 -10347 0 -10348 0 -10349 0 -10350 0 -10351 1 -10352 0 -10353 0 -10354 0 -10355 0 -10356 0 -10357 0 -10358 0 -10359 0 -10360 1 -10361 0 -10362 0 -10363 0 -10364 0 -10365 0 -10366 0 -10367 0 -10368 0 -10369 0 -10370 1 -10371 0 -10372 0 -10373 0 -10374 0 -10375 0 -10376 0 -10377 0 -10378 0 -10379 0 -10380 1 -10381 0 -10382 0 -10383 0 -10384 0 -10385 0 -10386 0 -10387 1 -10388 0 -10389 0 -10390 0 -10391 0 -10392 0 -10393 0 -10394 0 -10395 1 -10396 0 -10397 0 -10398 0 -10399 0 -10400 0 -10401 0 -10402 0 -10403 0 -10404 1 -10405 0 -10406 0 -10407 0 -10408 0 -10409 0 -10410 0 -10411 0 -10412 0 -10413 0 -10414 1 -10415 0 -10416 0 -10417 0 -10418 0 -10419 0 -10420 0 -10421 0 -10422 0 -10423 1 -10424 0 -10425 0 -10426 0 -10427 0 -10428 0 -10429 0 -10430 0 -10431 0 -10432 0 -10433 1 -10434 0 -10435 0 -10436 0 -10437 0 -10438 0 -10439 0 -10440 0 -10441 0 -10442 0 -10443 1 -10444 0 -10445 0 -10446 0 -10447 0 -10448 0 -10449 0 -10450 0 -10451 0 -10452 1 -10453 0 -10454 0 -10455 0 -10456 0 -10457 0 -10458 0 -10459 0 -10460 1 -10461 0 -10462 0 -10463 0 -10464 0 -10465 0 -10466 0 -10467 0 -10468 0 -10469 1 -10470 0 -10471 0 -10472 0 -10473 0 -10474 0 -10475 0 -10476 0 -10477 0 -10478 0 -10479 1 -10480 0 -10481 0 -10482 0 -10483 0 -10484 0 -10485 0 -10486 0 -10487 0 -10488 0 -10489 1 -10490 0 -10491 0 -10492 0 -10493 0 -10494 0 -10495 0 -10496 0 -10497 0 -10498 1 -10499 0 -10500 0 -10501 0 -10502 0 -10503 0 -10504 0 -10505 0 -10506 1 -10507 0 -10508 0 -10509 0 -10510 0 -10511 0 -10512 0 -10513 0 -10514 0 -10515 0 -10516 0 -10517 1 -10518 0 -10519 0 -10520 0 -10521 0 -10522 0 -10523 0 -10524 0 -10525 0 -10526 0 -10527 1 -10528 0 -10529 0 -10530 0 -10531 0 -10532 0 -10533 0 -10534 0 -10535 0 -10536 1 -10537 0 -10538 0 -10539 0 -10540 0 -10541 0 -10542 0 -10543 0 -10544 0 -10545 1 -10546 0 -10547 0 -10548 0 -10549 0 -10550 0 -10551 0 -10552 0 -10553 0 -10554 0 -10555 1 -10556 0 -10557 0 -10558 0 -10559 0 -10560 0 -10561 0 -10562 0 -10563 0 -10564 0 -10565 0 -10566 1 -10567 0 -10568 0 -10569 0 -10570 0 -10571 0 -10572 0 -10573 0 -10574 0 -10575 0 -10576 0 -10577 0 -10578 0 -10579 0 -10580 0 -10581 0 -10582 0 -10583 0 -10584 0 -10585 0 -10586 0 -10587 1 -10588 0 -10589 0 -10590 0 -10591 0 -10592 0 -10593 0 -10594 0 -10595 0 -10596 0 -10597 0 -10598 1 -10599 0 -10600 0 -10601 0 -10602 0 -10603 0 -10604 0 -10605 0 -10606 0 -10607 0 -10608 0 -10609 1 -10610 0 -10611 0 -10612 0 -10613 0 -10614 0 -10615 0 -10616 0 -10617 1 -10618 0 -10619 0 -10620 0 -10621 0 -10622 0 -10623 0 -10624 0 -10625 1 -10626 0 -10627 0 -10628 0 -10629 0 -10630 0 -10631 0 -10632 0 -10633 0 -10634 1 -10635 0 -10636 0 -10637 0 -10638 0 -10639 0 -10640 0 -10641 0 -10642 0 -10643 0 -10644 1 -10645 0 -10646 0 -10647 0 -10648 0 -10649 0 -10650 0 -10651 0 -10652 0 -10653 1 -10654 0 -10655 0 -10656 0 -10657 0 -10658 0 -10659 0 -10660 0 -10661 1 -10662 0 -10663 0 -10664 0 -10665 0 -10666 0 -10667 0 -10668 0 -10669 0 -10670 0 -10671 1 -10672 0 -10673 0 -10674 0 -10675 0 -10676 0 -10677 0 -10678 0 -10679 0 -10680 0 -10681 1 -10682 0 -10683 0 -10684 0 -10685 0 -10686 0 -10687 0 -10688 0 -10689 0 -10690 0 -10691 0 -10692 0 -10693 0 -10694 0 -10695 0 -10696 0 -10697 0 -10698 0 -10699 0 -10700 0 -10701 1 -10702 0 -10703 0 -10704 0 -10705 0 -10706 0 -10707 0 -10708 0 -10709 0 -10710 0 -10711 1 -10712 0 -10713 0 -10714 0 -10715 0 -10716 0 -10717 0 -10718 0 -10719 0 -10720 0 -10721 1 -10722 0 -10723 0 -10724 0 -10725 0 -10726 0 -10727 0 -10728 0 -10729 0 -10730 1 -10731 0 -10732 0 -10733 0 -10734 0 -10735 0 -10736 0 -10737 0 -10738 0 -10739 0 -10740 1 -10741 0 -10742 0 -10743 0 -10744 0 -10745 0 -10746 0 -10747 0 -10748 0 -10749 1 -10750 0 -10751 0 -10752 0 -10753 0 -10754 0 -10755 0 -10756 0 -10757 0 -10758 0 -10759 1 -10760 0 -10761 0 -10762 0 -10763 0 -10764 0 -10765 0 -10766 0 -10767 0 -10768 0 -10769 0 -10770 1 -10771 0 -10772 0 -10773 0 -10774 0 -10775 0 -10776 0 -10777 0 -10778 0 -10779 0 -10780 1 -10781 0 -10782 0 -10783 0 -10784 0 -10785 0 -10786 0 -10787 0 -10788 0 -10789 0 -10790 1 -10791 0 -10792 0 -10793 0 -10794 0 -10795 0 -10796 0 -10797 0 -10798 0 -10799 0 -10800 1 -10801 0 -10802 0 -10803 0 -10804 0 -10805 0 -10806 0 -10807 0 -10808 0 -10809 0 -10810 0 -10811 0 -10812 0 -10813 0 -10814 0 -10815 0 -10816 0 -10817 0 -10818 0 -10819 0 -10820 1 -10821 0 -10822 0 -10823 0 -10824 0 -10825 0 -10826 0 -10827 0 -10828 0 -10829 0 -10830 0 -10831 1 -10832 0 -10833 0 -10834 0 -10835 0 -10836 0 -10837 0 -10838 0 -10839 0 -10840 1 -10841 0 -10842 0 -10843 0 -10844 0 -10845 0 -10846 0 -10847 0 -10848 0 -10849 0 -10850 0 -10851 0 -10852 0 -10853 0 -10854 0 -10855 0 -10856 0 -10857 0 -10858 0 -10859 0 -10860 1 -10861 0 -10862 0 -10863 0 -10864 0 -10865 0 -10866 0 -10867 0 -10868 0 -10869 1 -10870 0 -10871 0 -10872 0 -10873 0 -10874 0 -10875 0 -10876 0 -10877 0 -10878 0 -10879 0 -10880 1 -10881 0 -10882 0 -10883 0 -10884 0 -10885 0 -10886 0 -10887 0 -10888 0 -10889 0 -10890 1 -10891 0 -10892 0 -10893 0 -10894 0 -10895 0 -10896 0 -10897 0 -10898 0 -10899 0 -10900 1 -10901 0 -10902 0 -10903 0 -10904 0 -10905 0 -10906 0 -10907 0 -10908 0 -10909 0 -10910 0 -10911 1 -10912 0 -10913 0 -10914 0 -10915 0 -10916 0 -10917 0 -10918 0 -10919 0 -10920 0 -10921 1 -10922 0 -10923 0 -10924 0 -10925 0 -10926 0 -10927 0 -10928 0 -10929 0 -10930 0 -10931 1 -10932 0 -10933 0 -10934 0 -10935 0 -10936 0 -10937 0 -10938 0 -10939 0 -10940 1 -10941 0 -10942 0 -10943 0 -10944 0 -10945 0 -10946 0 -10947 0 -10948 0 -10949 1 -10950 0 -10951 0 -10952 0 -10953 0 -10954 0 -10955 0 -10956 0 -10957 0 -10958 1 -10959 0 -10960 0 -10961 0 -10962 0 -10963 0 -10964 0 -10965 0 -10966 0 -10967 0 -10968 1 -10969 0 -10970 0 -10971 0 -10972 0 -10973 0 -10974 0 -10975 0 -10976 0 -10977 0 -10978 1 -10979 0 -10980 0 -10981 0 -10982 0 -10983 0 -10984 0 -10985 0 -10986 0 -10987 0 -10988 0 -10989 1 -10990 0 -10991 0 -10992 0 -10993 0 -10994 0 -10995 0 -10996 0 -10997 0 -10998 0 -10999 0 -11000 1 \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore deleted file mode 100644 index 38344f87..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -build/ -test/ -examples/ -fs.js -zlib.js \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE deleted file mode 100644 index 0c44ae71..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) Isaac Z. Schlueter ("Author") -All rights reserved. - -The BSD License - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS -BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR -BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, -WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE -OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN -IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md deleted file mode 100644 index 34c11897..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# readable-stream - -***Node-core streams for userland*** - -[![NPM](https://nodei.co/npm/readable-stream.png?downloads=true)](https://nodei.co/npm/readable-stream/) -[![NPM](https://nodei.co/npm-dl/readable-stream.png)](https://nodei.co/npm/readable-stream/) - -This package is a mirror of the Streams2 and Streams3 implementations in Node-core. - -If you want to guarantee a stable streams base, regardless of what version of Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core. - -**readable-stream** comes in two major versions, v1.0.x and v1.1.x. The former tracks the Streams2 implementation in Node 0.10, including bug-fixes and minor improvements as they are added. The latter tracks Streams3 as it develops in Node 0.11; we will likely see a v1.2.x branch for Node 0.12. - -**readable-stream** uses proper patch-level versioning so if you pin to `"~1.0.0"` you’ll get the latest Node 0.10 Streams2 implementation, including any fixes and minor non-breaking improvements. The patch-level versions of 1.0.x and 1.1.x should mirror the patch-level versions of Node-core releases. You should prefer the **1.0.x** releases for now and when you’re ready to start using Streams3, pin to `"~1.1.0"` - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js deleted file mode 100644 index ca807af8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/duplex.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_duplex.js") diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js deleted file mode 100644 index b513d61a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_duplex.js +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a duplex stream is just a stream that is both readable and writable. -// Since JS doesn't have multiple prototypal inheritance, this class -// prototypally inherits from Readable, and then parasitically from -// Writable. - -module.exports = Duplex; - -/**/ -var objectKeys = Object.keys || function (obj) { - var keys = []; - for (var key in obj) keys.push(key); - return keys; -} -/**/ - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Readable = require('./_stream_readable'); -var Writable = require('./_stream_writable'); - -util.inherits(Duplex, Readable); - -forEach(objectKeys(Writable.prototype), function(method) { - if (!Duplex.prototype[method]) - Duplex.prototype[method] = Writable.prototype[method]; -}); - -function Duplex(options) { - if (!(this instanceof Duplex)) - return new Duplex(options); - - Readable.call(this, options); - Writable.call(this, options); - - if (options && options.readable === false) - this.readable = false; - - if (options && options.writable === false) - this.writable = false; - - this.allowHalfOpen = true; - if (options && options.allowHalfOpen === false) - this.allowHalfOpen = false; - - this.once('end', onend); -} - -// the no-half-open enforcer -function onend() { - // if we allow half-open state, or if the writable side ended, - // then we're ok. - if (this.allowHalfOpen || this._writableState.ended) - return; - - // no more data can be written. - // But allow more writes to happen in this tick. - process.nextTick(this.end.bind(this)); -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js deleted file mode 100644 index 895ca50a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_passthrough.js +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// a passthrough stream. -// basically just the most minimal sort of Transform stream. -// Every written chunk gets output as-is. - -module.exports = PassThrough; - -var Transform = require('./_stream_transform'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(PassThrough, Transform); - -function PassThrough(options) { - if (!(this instanceof PassThrough)) - return new PassThrough(options); - - Transform.call(this, options); -} - -PassThrough.prototype._transform = function(chunk, encoding, cb) { - cb(null, chunk); -}; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js deleted file mode 100644 index 63072209..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_readable.js +++ /dev/null @@ -1,982 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -module.exports = Readable; - -/**/ -var isArray = require('isarray'); -/**/ - - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Readable.ReadableState = ReadableState; - -var EE = require('events').EventEmitter; - -/**/ -if (!EE.listenerCount) EE.listenerCount = function(emitter, type) { - return emitter.listeners(type).length; -}; -/**/ - -var Stream = require('stream'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var StringDecoder; - -util.inherits(Readable, Stream); - -function ReadableState(options, stream) { - options = options || {}; - - // the point at which it stops calling _read() to fill the buffer - // Note: 0 is a valid value, means "don't call _read preemptively ever" - var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.buffer = []; - this.length = 0; - this.pipes = null; - this.pipesCount = 0; - this.flowing = false; - this.ended = false; - this.endEmitted = false; - this.reading = false; - - // In streams that never have any data, and do push(null) right away, - // the consumer can miss the 'end' event if they do some I/O before - // consuming the stream. So, we don't emit('end') until some reading - // happens. - this.calledRead = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // whenever we return null, then we set a flag to say - // that we're awaiting a 'readable' event emission. - this.needReadable = false; - this.emittedReadable = false; - this.readableListening = false; - - - // object stream flag. Used to make read(n) ignore n and to - // make all the buffer merging and length checks go away - this.objectMode = !!options.objectMode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // when piping, we only care about 'readable' events that happen - // after read()ing all the bytes and not getting any pushback. - this.ranOut = false; - - // the number of writers that are awaiting a drain event in .pipe()s - this.awaitDrain = 0; - - // if true, a maybeReadMore has been scheduled - this.readingMore = false; - - this.decoder = null; - this.encoding = null; - if (options.encoding) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this.decoder = new StringDecoder(options.encoding); - this.encoding = options.encoding; - } -} - -function Readable(options) { - if (!(this instanceof Readable)) - return new Readable(options); - - this._readableState = new ReadableState(options, this); - - // legacy - this.readable = true; - - Stream.call(this); -} - -// Manually shove something into the read() buffer. -// This returns true if the highWaterMark has not been hit yet, -// similar to how Writable.write() returns true if you should -// write() some more. -Readable.prototype.push = function(chunk, encoding) { - var state = this._readableState; - - if (typeof chunk === 'string' && !state.objectMode) { - encoding = encoding || state.defaultEncoding; - if (encoding !== state.encoding) { - chunk = new Buffer(chunk, encoding); - encoding = ''; - } - } - - return readableAddChunk(this, state, chunk, encoding, false); -}; - -// Unshift should *always* be something directly out of read() -Readable.prototype.unshift = function(chunk) { - var state = this._readableState; - return readableAddChunk(this, state, chunk, '', true); -}; - -function readableAddChunk(stream, state, chunk, encoding, addToFront) { - var er = chunkInvalid(state, chunk); - if (er) { - stream.emit('error', er); - } else if (chunk === null || chunk === undefined) { - state.reading = false; - if (!state.ended) - onEofChunk(stream, state); - } else if (state.objectMode || chunk && chunk.length > 0) { - if (state.ended && !addToFront) { - var e = new Error('stream.push() after EOF'); - stream.emit('error', e); - } else if (state.endEmitted && addToFront) { - var e = new Error('stream.unshift() after end event'); - stream.emit('error', e); - } else { - if (state.decoder && !addToFront && !encoding) - chunk = state.decoder.write(chunk); - - // update the buffer info. - state.length += state.objectMode ? 1 : chunk.length; - if (addToFront) { - state.buffer.unshift(chunk); - } else { - state.reading = false; - state.buffer.push(chunk); - } - - if (state.needReadable) - emitReadable(stream); - - maybeReadMore(stream, state); - } - } else if (!addToFront) { - state.reading = false; - } - - return needMoreData(state); -} - - - -// if it's past the high water mark, we can push in some more. -// Also, if we have no data yet, we can stand some -// more bytes. This is to work around cases where hwm=0, -// such as the repl. Also, if the push() triggered a -// readable event, and the user called read(largeNumber) such that -// needReadable was set, then we ought to push more, so that another -// 'readable' event will be triggered. -function needMoreData(state) { - return !state.ended && - (state.needReadable || - state.length < state.highWaterMark || - state.length === 0); -} - -// backwards compatibility. -Readable.prototype.setEncoding = function(enc) { - if (!StringDecoder) - StringDecoder = require('string_decoder/').StringDecoder; - this._readableState.decoder = new StringDecoder(enc); - this._readableState.encoding = enc; -}; - -// Don't raise the hwm > 128MB -var MAX_HWM = 0x800000; -function roundUpToNextPowerOf2(n) { - if (n >= MAX_HWM) { - n = MAX_HWM; - } else { - // Get the next highest power of 2 - n--; - for (var p = 1; p < 32; p <<= 1) n |= n >> p; - n++; - } - return n; -} - -function howMuchToRead(n, state) { - if (state.length === 0 && state.ended) - return 0; - - if (state.objectMode) - return n === 0 ? 0 : 1; - - if (n === null || isNaN(n)) { - // only flow one buffer at a time - if (state.flowing && state.buffer.length) - return state.buffer[0].length; - else - return state.length; - } - - if (n <= 0) - return 0; - - // If we're asking for more than the target buffer level, - // then raise the water mark. Bump up to the next highest - // power of 2, to prevent increasing it excessively in tiny - // amounts. - if (n > state.highWaterMark) - state.highWaterMark = roundUpToNextPowerOf2(n); - - // don't have that much. return null, unless we've ended. - if (n > state.length) { - if (!state.ended) { - state.needReadable = true; - return 0; - } else - return state.length; - } - - return n; -} - -// you can override either this method, or the async _read(n) below. -Readable.prototype.read = function(n) { - var state = this._readableState; - state.calledRead = true; - var nOrig = n; - var ret; - - if (typeof n !== 'number' || n > 0) - state.emittedReadable = false; - - // if we're doing read(0) to trigger a readable event, but we - // already have a bunch of data in the buffer, then just trigger - // the 'readable' event and move on. - if (n === 0 && - state.needReadable && - (state.length >= state.highWaterMark || state.ended)) { - emitReadable(this); - return null; - } - - n = howMuchToRead(n, state); - - // if we've ended, and we're now clear, then finish it up. - if (n === 0 && state.ended) { - ret = null; - - // In cases where the decoder did not receive enough data - // to produce a full chunk, then immediately received an - // EOF, state.buffer will contain [, ]. - // howMuchToRead will see this and coerce the amount to - // read to zero (because it's looking at the length of the - // first in state.buffer), and we'll end up here. - // - // This can only happen via state.decoder -- no other venue - // exists for pushing a zero-length chunk into state.buffer - // and triggering this behavior. In this case, we return our - // remaining data and end the stream, if appropriate. - if (state.length > 0 && state.decoder) { - ret = fromList(n, state); - state.length -= ret.length; - } - - if (state.length === 0) - endReadable(this); - - return ret; - } - - // All the actual chunk generation logic needs to be - // *below* the call to _read. The reason is that in certain - // synthetic stream cases, such as passthrough streams, _read - // may be a completely synchronous operation which may change - // the state of the read buffer, providing enough data when - // before there was *not* enough. - // - // So, the steps are: - // 1. Figure out what the state of things will be after we do - // a read from the buffer. - // - // 2. If that resulting state will trigger a _read, then call _read. - // Note that this may be asynchronous, or synchronous. Yes, it is - // deeply ugly to write APIs this way, but that still doesn't mean - // that the Readable class should behave improperly, as streams are - // designed to be sync/async agnostic. - // Take note if the _read call is sync or async (ie, if the read call - // has returned yet), so that we know whether or not it's safe to emit - // 'readable' etc. - // - // 3. Actually pull the requested chunks out of the buffer and return. - - // if we need a readable event, then we need to do some reading. - var doRead = state.needReadable; - - // if we currently have less than the highWaterMark, then also read some - if (state.length - n <= state.highWaterMark) - doRead = true; - - // however, if we've ended, then there's no point, and if we're already - // reading, then it's unnecessary. - if (state.ended || state.reading) - doRead = false; - - if (doRead) { - state.reading = true; - state.sync = true; - // if the length is currently zero, then we *need* a readable event. - if (state.length === 0) - state.needReadable = true; - // call internal read method - this._read(state.highWaterMark); - state.sync = false; - } - - // If _read called its callback synchronously, then `reading` - // will be false, and we need to re-evaluate how much data we - // can return to the user. - if (doRead && !state.reading) - n = howMuchToRead(nOrig, state); - - if (n > 0) - ret = fromList(n, state); - else - ret = null; - - if (ret === null) { - state.needReadable = true; - n = 0; - } - - state.length -= n; - - // If we have nothing in the buffer, then we want to know - // as soon as we *do* get something into the buffer. - if (state.length === 0 && !state.ended) - state.needReadable = true; - - // If we happened to read() exactly the remaining amount in the - // buffer, and the EOF has been seen at this point, then make sure - // that we emit 'end' on the very next tick. - if (state.ended && !state.endEmitted && state.length === 0) - endReadable(this); - - return ret; -}; - -function chunkInvalid(state, chunk) { - var er = null; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && - !state.objectMode) { - er = new TypeError('Invalid non-string/buffer chunk'); - } - return er; -} - - -function onEofChunk(stream, state) { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) { - state.buffer.push(chunk); - state.length += state.objectMode ? 1 : chunk.length; - } - } - state.ended = true; - - // if we've ended and we have some data left, then emit - // 'readable' now to make sure it gets picked up. - if (state.length > 0) - emitReadable(stream); - else - endReadable(stream); -} - -// Don't emit readable right away in sync mode, because this can trigger -// another read() call => stack overflow. This way, it might trigger -// a nextTick recursion warning, but that's not so bad. -function emitReadable(stream) { - var state = stream._readableState; - state.needReadable = false; - if (state.emittedReadable) - return; - - state.emittedReadable = true; - if (state.sync) - process.nextTick(function() { - emitReadable_(stream); - }); - else - emitReadable_(stream); -} - -function emitReadable_(stream) { - stream.emit('readable'); -} - - -// at this point, the user has presumably seen the 'readable' event, -// and called read() to consume some data. that may have triggered -// in turn another _read(n) call, in which case reading = true if -// it's in progress. -// However, if we're not ended, or reading, and the length < hwm, -// then go ahead and try to read some more preemptively. -function maybeReadMore(stream, state) { - if (!state.readingMore) { - state.readingMore = true; - process.nextTick(function() { - maybeReadMore_(stream, state); - }); - } -} - -function maybeReadMore_(stream, state) { - var len = state.length; - while (!state.reading && !state.flowing && !state.ended && - state.length < state.highWaterMark) { - stream.read(0); - if (len === state.length) - // didn't get any data, stop spinning. - break; - else - len = state.length; - } - state.readingMore = false; -} - -// abstract method. to be overridden in specific implementation classes. -// call cb(er, data) where data is <= n in length. -// for virtual (non-string, non-buffer) streams, "length" is somewhat -// arbitrary, and perhaps not very meaningful. -Readable.prototype._read = function(n) { - this.emit('error', new Error('not implemented')); -}; - -Readable.prototype.pipe = function(dest, pipeOpts) { - var src = this; - var state = this._readableState; - - switch (state.pipesCount) { - case 0: - state.pipes = dest; - break; - case 1: - state.pipes = [state.pipes, dest]; - break; - default: - state.pipes.push(dest); - break; - } - state.pipesCount += 1; - - var doEnd = (!pipeOpts || pipeOpts.end !== false) && - dest !== process.stdout && - dest !== process.stderr; - - var endFn = doEnd ? onend : cleanup; - if (state.endEmitted) - process.nextTick(endFn); - else - src.once('end', endFn); - - dest.on('unpipe', onunpipe); - function onunpipe(readable) { - if (readable !== src) return; - cleanup(); - } - - function onend() { - dest.end(); - } - - // when the dest drains, it reduces the awaitDrain counter - // on the source. This would be more elegant with a .once() - // handler in flow(), but adding and removing repeatedly is - // too slow. - var ondrain = pipeOnDrain(src); - dest.on('drain', ondrain); - - function cleanup() { - // cleanup event handlers once the pipe is broken - dest.removeListener('close', onclose); - dest.removeListener('finish', onfinish); - dest.removeListener('drain', ondrain); - dest.removeListener('error', onerror); - dest.removeListener('unpipe', onunpipe); - src.removeListener('end', onend); - src.removeListener('end', cleanup); - - // if the reader is waiting for a drain event from this - // specific writer, then it would cause it to never start - // flowing again. - // So, if this is awaiting a drain, then we just call it now. - // If we don't know, then assume that we are waiting for one. - if (!dest._writableState || dest._writableState.needDrain) - ondrain(); - } - - // if the dest has an error, then stop piping into it. - // however, don't suppress the throwing behavior for this. - function onerror(er) { - unpipe(); - dest.removeListener('error', onerror); - if (EE.listenerCount(dest, 'error') === 0) - dest.emit('error', er); - } - // This is a brutally ugly hack to make sure that our error handler - // is attached before any userland ones. NEVER DO THIS. - if (!dest._events || !dest._events.error) - dest.on('error', onerror); - else if (isArray(dest._events.error)) - dest._events.error.unshift(onerror); - else - dest._events.error = [onerror, dest._events.error]; - - - - // Both close and finish should trigger unpipe, but only once. - function onclose() { - dest.removeListener('finish', onfinish); - unpipe(); - } - dest.once('close', onclose); - function onfinish() { - dest.removeListener('close', onclose); - unpipe(); - } - dest.once('finish', onfinish); - - function unpipe() { - src.unpipe(dest); - } - - // tell the dest that it's being piped to - dest.emit('pipe', src); - - // start the flow if it hasn't been started already. - if (!state.flowing) { - // the handler that waits for readable events after all - // the data gets sucked out in flow. - // This would be easier to follow with a .once() handler - // in flow(), but that is too slow. - this.on('readable', pipeOnReadable); - - state.flowing = true; - process.nextTick(function() { - flow(src); - }); - } - - return dest; -}; - -function pipeOnDrain(src) { - return function() { - var dest = this; - var state = src._readableState; - state.awaitDrain--; - if (state.awaitDrain === 0) - flow(src); - }; -} - -function flow(src) { - var state = src._readableState; - var chunk; - state.awaitDrain = 0; - - function write(dest, i, list) { - var written = dest.write(chunk); - if (false === written) { - state.awaitDrain++; - } - } - - while (state.pipesCount && null !== (chunk = src.read())) { - - if (state.pipesCount === 1) - write(state.pipes, 0, null); - else - forEach(state.pipes, write); - - src.emit('data', chunk); - - // if anyone needs a drain, then we have to wait for that. - if (state.awaitDrain > 0) - return; - } - - // if every destination was unpiped, either before entering this - // function, or in the while loop, then stop flowing. - // - // NB: This is a pretty rare edge case. - if (state.pipesCount === 0) { - state.flowing = false; - - // if there were data event listeners added, then switch to old mode. - if (EE.listenerCount(src, 'data') > 0) - emitDataEvents(src); - return; - } - - // at this point, no one needed a drain, so we just ran out of data - // on the next readable event, start it over again. - state.ranOut = true; -} - -function pipeOnReadable() { - if (this._readableState.ranOut) { - this._readableState.ranOut = false; - flow(this); - } -} - - -Readable.prototype.unpipe = function(dest) { - var state = this._readableState; - - // if we're not piping anywhere, then do nothing. - if (state.pipesCount === 0) - return this; - - // just one destination. most common case. - if (state.pipesCount === 1) { - // passed in one, but it's not the right one. - if (dest && dest !== state.pipes) - return this; - - if (!dest) - dest = state.pipes; - - // got a match. - state.pipes = null; - state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); - state.flowing = false; - if (dest) - dest.emit('unpipe', this); - return this; - } - - // slow case. multiple pipe destinations. - - if (!dest) { - // remove all. - var dests = state.pipes; - var len = state.pipesCount; - state.pipes = null; - state.pipesCount = 0; - this.removeListener('readable', pipeOnReadable); - state.flowing = false; - - for (var i = 0; i < len; i++) - dests[i].emit('unpipe', this); - return this; - } - - // try to find the right one. - var i = indexOf(state.pipes, dest); - if (i === -1) - return this; - - state.pipes.splice(i, 1); - state.pipesCount -= 1; - if (state.pipesCount === 1) - state.pipes = state.pipes[0]; - - dest.emit('unpipe', this); - - return this; -}; - -// set up data events if they are asked for -// Ensure readable listeners eventually get something -Readable.prototype.on = function(ev, fn) { - var res = Stream.prototype.on.call(this, ev, fn); - - if (ev === 'data' && !this._readableState.flowing) - emitDataEvents(this); - - if (ev === 'readable' && this.readable) { - var state = this._readableState; - if (!state.readableListening) { - state.readableListening = true; - state.emittedReadable = false; - state.needReadable = true; - if (!state.reading) { - this.read(0); - } else if (state.length) { - emitReadable(this, state); - } - } - } - - return res; -}; -Readable.prototype.addListener = Readable.prototype.on; - -// pause() and resume() are remnants of the legacy readable stream API -// If the user uses them, then switch into old mode. -Readable.prototype.resume = function() { - emitDataEvents(this); - this.read(0); - this.emit('resume'); -}; - -Readable.prototype.pause = function() { - emitDataEvents(this, true); - this.emit('pause'); -}; - -function emitDataEvents(stream, startPaused) { - var state = stream._readableState; - - if (state.flowing) { - // https://github.com/isaacs/readable-stream/issues/16 - throw new Error('Cannot switch to old mode now.'); - } - - var paused = startPaused || false; - var readable = false; - - // convert to an old-style stream. - stream.readable = true; - stream.pipe = Stream.prototype.pipe; - stream.on = stream.addListener = Stream.prototype.on; - - stream.on('readable', function() { - readable = true; - - var c; - while (!paused && (null !== (c = stream.read()))) - stream.emit('data', c); - - if (c === null) { - readable = false; - stream._readableState.needReadable = true; - } - }); - - stream.pause = function() { - paused = true; - this.emit('pause'); - }; - - stream.resume = function() { - paused = false; - if (readable) - process.nextTick(function() { - stream.emit('readable'); - }); - else - this.read(0); - this.emit('resume'); - }; - - // now make it start, just in case it hadn't already. - stream.emit('readable'); -} - -// wrap an old-style stream as the async data source. -// This is *not* part of the readable stream interface. -// It is an ugly unfortunate mess of history. -Readable.prototype.wrap = function(stream) { - var state = this._readableState; - var paused = false; - - var self = this; - stream.on('end', function() { - if (state.decoder && !state.ended) { - var chunk = state.decoder.end(); - if (chunk && chunk.length) - self.push(chunk); - } - - self.push(null); - }); - - stream.on('data', function(chunk) { - if (state.decoder) - chunk = state.decoder.write(chunk); - - // don't skip over falsy values in objectMode - //if (state.objectMode && util.isNullOrUndefined(chunk)) - if (state.objectMode && (chunk === null || chunk === undefined)) - return; - else if (!state.objectMode && (!chunk || !chunk.length)) - return; - - var ret = self.push(chunk); - if (!ret) { - paused = true; - stream.pause(); - } - }); - - // proxy all the other methods. - // important when wrapping filters and duplexes. - for (var i in stream) { - if (typeof stream[i] === 'function' && - typeof this[i] === 'undefined') { - this[i] = function(method) { return function() { - return stream[method].apply(stream, arguments); - }}(i); - } - } - - // proxy certain important events. - var events = ['error', 'close', 'destroy', 'pause', 'resume']; - forEach(events, function(ev) { - stream.on(ev, self.emit.bind(self, ev)); - }); - - // when we try to consume some more bytes, simply unpause the - // underlying stream. - self._read = function(n) { - if (paused) { - paused = false; - stream.resume(); - } - }; - - return self; -}; - - - -// exposed for testing purposes only. -Readable._fromList = fromList; - -// Pluck off n bytes from an array of buffers. -// Length is the combined lengths of all the buffers in the list. -function fromList(n, state) { - var list = state.buffer; - var length = state.length; - var stringMode = !!state.decoder; - var objectMode = !!state.objectMode; - var ret; - - // nothing in the list, definitely empty. - if (list.length === 0) - return null; - - if (length === 0) - ret = null; - else if (objectMode) - ret = list.shift(); - else if (!n || n >= length) { - // read it all, truncate the array. - if (stringMode) - ret = list.join(''); - else - ret = Buffer.concat(list, length); - list.length = 0; - } else { - // read just some of it. - if (n < list[0].length) { - // just take a part of the first list item. - // slice is the same for buffers and strings. - var buf = list[0]; - ret = buf.slice(0, n); - list[0] = buf.slice(n); - } else if (n === list[0].length) { - // first list is a perfect match - ret = list.shift(); - } else { - // complex case. - // we have enough to cover it, but it spans past the first buffer. - if (stringMode) - ret = ''; - else - ret = new Buffer(n); - - var c = 0; - for (var i = 0, l = list.length; i < l && c < n; i++) { - var buf = list[0]; - var cpy = Math.min(n - c, buf.length); - - if (stringMode) - ret += buf.slice(0, cpy); - else - buf.copy(ret, c, 0, cpy); - - if (cpy < buf.length) - list[0] = buf.slice(cpy); - else - list.shift(); - - c += cpy; - } - } - } - - return ret; -} - -function endReadable(stream) { - var state = stream._readableState; - - // If we get here before consuming all the bytes, then that is a - // bug in node. Should never happen. - if (state.length > 0) - throw new Error('endReadable called on non-empty stream'); - - if (!state.endEmitted && state.calledRead) { - state.ended = true; - process.nextTick(function() { - // Check that we didn't get one last unshift. - if (!state.endEmitted && state.length === 0) { - state.endEmitted = true; - stream.readable = false; - stream.emit('end'); - } - }); - } -} - -function forEach (xs, f) { - for (var i = 0, l = xs.length; i < l; i++) { - f(xs[i], i); - } -} - -function indexOf (xs, x) { - for (var i = 0, l = xs.length; i < l; i++) { - if (xs[i] === x) return i; - } - return -1; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js deleted file mode 100644 index eb188df3..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_transform.js +++ /dev/null @@ -1,210 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - - -// a transform stream is a readable/writable stream where you do -// something with the data. Sometimes it's called a "filter", -// but that's not a great name for it, since that implies a thing where -// some bits pass through, and others are simply ignored. (That would -// be a valid example of a transform, of course.) -// -// While the output is causally related to the input, it's not a -// necessarily symmetric or synchronous transformation. For example, -// a zlib stream might take multiple plain-text writes(), and then -// emit a single compressed chunk some time in the future. -// -// Here's how this works: -// -// The Transform stream has all the aspects of the readable and writable -// stream classes. When you write(chunk), that calls _write(chunk,cb) -// internally, and returns false if there's a lot of pending writes -// buffered up. When you call read(), that calls _read(n) until -// there's enough pending readable data buffered up. -// -// In a transform stream, the written data is placed in a buffer. When -// _read(n) is called, it transforms the queued up data, calling the -// buffered _write cb's as it consumes chunks. If consuming a single -// written chunk would result in multiple output chunks, then the first -// outputted bit calls the readcb, and subsequent chunks just go into -// the read buffer, and will cause it to emit 'readable' if necessary. -// -// This way, back-pressure is actually determined by the reading side, -// since _read has to be called to start processing a new chunk. However, -// a pathological inflate type of transform can cause excessive buffering -// here. For example, imagine a stream where every byte of input is -// interpreted as an integer from 0-255, and then results in that many -// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in -// 1kb of data being output. In this case, you could write a very small -// amount of input, and end up with a very large amount of output. In -// such a pathological inflating mechanism, there'd be no way to tell -// the system to stop doing the transform. A single 4MB write could -// cause the system to run out of memory. -// -// However, even in such a pathological case, only a single written chunk -// would be consumed, and then the rest would wait (un-transformed) until -// the results of the previous transformed chunk were consumed. - -module.exports = Transform; - -var Duplex = require('./_stream_duplex'); - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -util.inherits(Transform, Duplex); - - -function TransformState(options, stream) { - this.afterTransform = function(er, data) { - return afterTransform(stream, er, data); - }; - - this.needTransform = false; - this.transforming = false; - this.writecb = null; - this.writechunk = null; -} - -function afterTransform(stream, er, data) { - var ts = stream._transformState; - ts.transforming = false; - - var cb = ts.writecb; - - if (!cb) - return stream.emit('error', new Error('no writecb in Transform class')); - - ts.writechunk = null; - ts.writecb = null; - - if (data !== null && data !== undefined) - stream.push(data); - - if (cb) - cb(er); - - var rs = stream._readableState; - rs.reading = false; - if (rs.needReadable || rs.length < rs.highWaterMark) { - stream._read(rs.highWaterMark); - } -} - - -function Transform(options) { - if (!(this instanceof Transform)) - return new Transform(options); - - Duplex.call(this, options); - - var ts = this._transformState = new TransformState(options, this); - - // when the writable side finishes, then flush out anything remaining. - var stream = this; - - // start out asking for a readable event once data is transformed. - this._readableState.needReadable = true; - - // we have implemented the _read method, and done the other things - // that Readable wants before the first _read call, so unset the - // sync guard flag. - this._readableState.sync = false; - - this.once('finish', function() { - if ('function' === typeof this._flush) - this._flush(function(er) { - done(stream, er); - }); - else - done(stream); - }); -} - -Transform.prototype.push = function(chunk, encoding) { - this._transformState.needTransform = false; - return Duplex.prototype.push.call(this, chunk, encoding); -}; - -// This is the part where you do stuff! -// override this function in implementation classes. -// 'chunk' is an input chunk. -// -// Call `push(newChunk)` to pass along transformed output -// to the readable side. You may call 'push' zero or more times. -// -// Call `cb(err)` when you are done with this chunk. If you pass -// an error, then that'll put the hurt on the whole operation. If you -// never call cb(), then you'll never get another chunk. -Transform.prototype._transform = function(chunk, encoding, cb) { - throw new Error('not implemented'); -}; - -Transform.prototype._write = function(chunk, encoding, cb) { - var ts = this._transformState; - ts.writecb = cb; - ts.writechunk = chunk; - ts.writeencoding = encoding; - if (!ts.transforming) { - var rs = this._readableState; - if (ts.needTransform || - rs.needReadable || - rs.length < rs.highWaterMark) - this._read(rs.highWaterMark); - } -}; - -// Doesn't matter what the args are here. -// _transform does all the work. -// That we got here means that the readable side wants more data. -Transform.prototype._read = function(n) { - var ts = this._transformState; - - if (ts.writechunk !== null && ts.writecb && !ts.transforming) { - ts.transforming = true; - this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); - } else { - // mark that we need a transform, so that any data that comes in - // will get processed, now that we've asked for it. - ts.needTransform = true; - } -}; - - -function done(stream, er) { - if (er) - return stream.emit('error', er); - - // if there's nothing in the write buffer, then that means - // that nothing more will ever be provided - var ws = stream._writableState; - var rs = stream._readableState; - var ts = stream._transformState; - - if (ws.length) - throw new Error('calling transform done when ws.length != 0'); - - if (ts.transforming) - throw new Error('calling transform done when still transforming'); - - return stream.push(null); -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js deleted file mode 100644 index 4bdaa4fa..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/lib/_stream_writable.js +++ /dev/null @@ -1,386 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// A bit simpler than readable streams. -// Implement an async ._write(chunk, cb), and it'll handle all -// the drain event emission and buffering. - -module.exports = Writable; - -/**/ -var Buffer = require('buffer').Buffer; -/**/ - -Writable.WritableState = WritableState; - - -/**/ -var util = require('core-util-is'); -util.inherits = require('inherits'); -/**/ - -var Stream = require('stream'); - -util.inherits(Writable, Stream); - -function WriteReq(chunk, encoding, cb) { - this.chunk = chunk; - this.encoding = encoding; - this.callback = cb; -} - -function WritableState(options, stream) { - options = options || {}; - - // the point at which write() starts returning false - // Note: 0 is a valid value, means that we always return false if - // the entire buffer is not flushed immediately on write() - var hwm = options.highWaterMark; - this.highWaterMark = (hwm || hwm === 0) ? hwm : 16 * 1024; - - // object stream flag to indicate whether or not this stream - // contains buffers or objects. - this.objectMode = !!options.objectMode; - - // cast to ints. - this.highWaterMark = ~~this.highWaterMark; - - this.needDrain = false; - // at the start of calling end() - this.ending = false; - // when end() has been called, and returned - this.ended = false; - // when 'finish' is emitted - this.finished = false; - - // should we decode strings into buffers before passing to _write? - // this is here so that some node-core streams can optimize string - // handling at a lower level. - var noDecode = options.decodeStrings === false; - this.decodeStrings = !noDecode; - - // Crypto is kind of old and crusty. Historically, its default string - // encoding is 'binary' so we have to make this configurable. - // Everything else in the universe uses 'utf8', though. - this.defaultEncoding = options.defaultEncoding || 'utf8'; - - // not an actual buffer we keep track of, but a measurement - // of how much we're waiting to get pushed to some underlying - // socket or file. - this.length = 0; - - // a flag to see when we're in the middle of a write. - this.writing = false; - - // a flag to be able to tell if the onwrite cb is called immediately, - // or on a later tick. We set this to true at first, becuase any - // actions that shouldn't happen until "later" should generally also - // not happen before the first write call. - this.sync = true; - - // a flag to know if we're processing previously buffered items, which - // may call the _write() callback in the same tick, so that we don't - // end up in an overlapped onwrite situation. - this.bufferProcessing = false; - - // the callback that's passed to _write(chunk,cb) - this.onwrite = function(er) { - onwrite(stream, er); - }; - - // the callback that the user supplies to write(chunk,encoding,cb) - this.writecb = null; - - // the amount that is being written when _write is called. - this.writelen = 0; - - this.buffer = []; - - // True if the error was already emitted and should not be thrown again - this.errorEmitted = false; -} - -function Writable(options) { - var Duplex = require('./_stream_duplex'); - - // Writable ctor is applied to Duplexes, though they're not - // instanceof Writable, they're instanceof Readable. - if (!(this instanceof Writable) && !(this instanceof Duplex)) - return new Writable(options); - - this._writableState = new WritableState(options, this); - - // legacy. - this.writable = true; - - Stream.call(this); -} - -// Otherwise people can pipe Writable streams, which is just wrong. -Writable.prototype.pipe = function() { - this.emit('error', new Error('Cannot pipe. Not readable.')); -}; - - -function writeAfterEnd(stream, state, cb) { - var er = new Error('write after end'); - // TODO: defer error events consistently everywhere, not just the cb - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); -} - -// If we get something that is not a buffer, string, null, or undefined, -// and we're not in objectMode, then that's an error. -// Otherwise stream chunks are all considered to be of length=1, and the -// watermarks determine how many objects to keep in the buffer, rather than -// how many bytes or characters. -function validChunk(stream, state, chunk, cb) { - var valid = true; - if (!Buffer.isBuffer(chunk) && - 'string' !== typeof chunk && - chunk !== null && - chunk !== undefined && - !state.objectMode) { - var er = new TypeError('Invalid non-string/buffer chunk'); - stream.emit('error', er); - process.nextTick(function() { - cb(er); - }); - valid = false; - } - return valid; -} - -Writable.prototype.write = function(chunk, encoding, cb) { - var state = this._writableState; - var ret = false; - - if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (Buffer.isBuffer(chunk)) - encoding = 'buffer'; - else if (!encoding) - encoding = state.defaultEncoding; - - if (typeof cb !== 'function') - cb = function() {}; - - if (state.ended) - writeAfterEnd(this, state, cb); - else if (validChunk(this, state, chunk, cb)) - ret = writeOrBuffer(this, state, chunk, encoding, cb); - - return ret; -}; - -function decodeChunk(state, chunk, encoding) { - if (!state.objectMode && - state.decodeStrings !== false && - typeof chunk === 'string') { - chunk = new Buffer(chunk, encoding); - } - return chunk; -} - -// if we're already writing something, then just put this -// in the queue, and wait our turn. Otherwise, call _write -// If we return false, then we need a drain event, so set that flag. -function writeOrBuffer(stream, state, chunk, encoding, cb) { - chunk = decodeChunk(state, chunk, encoding); - if (Buffer.isBuffer(chunk)) - encoding = 'buffer'; - var len = state.objectMode ? 1 : chunk.length; - - state.length += len; - - var ret = state.length < state.highWaterMark; - // we must ensure that previous needDrain will not be reset to false. - if (!ret) - state.needDrain = true; - - if (state.writing) - state.buffer.push(new WriteReq(chunk, encoding, cb)); - else - doWrite(stream, state, len, chunk, encoding, cb); - - return ret; -} - -function doWrite(stream, state, len, chunk, encoding, cb) { - state.writelen = len; - state.writecb = cb; - state.writing = true; - state.sync = true; - stream._write(chunk, encoding, state.onwrite); - state.sync = false; -} - -function onwriteError(stream, state, sync, er, cb) { - if (sync) - process.nextTick(function() { - cb(er); - }); - else - cb(er); - - stream._writableState.errorEmitted = true; - stream.emit('error', er); -} - -function onwriteStateUpdate(state) { - state.writing = false; - state.writecb = null; - state.length -= state.writelen; - state.writelen = 0; -} - -function onwrite(stream, er) { - var state = stream._writableState; - var sync = state.sync; - var cb = state.writecb; - - onwriteStateUpdate(state); - - if (er) - onwriteError(stream, state, sync, er, cb); - else { - // Check if we're actually ready to finish, but don't emit yet - var finished = needFinish(stream, state); - - if (!finished && !state.bufferProcessing && state.buffer.length) - clearBuffer(stream, state); - - if (sync) { - process.nextTick(function() { - afterWrite(stream, state, finished, cb); - }); - } else { - afterWrite(stream, state, finished, cb); - } - } -} - -function afterWrite(stream, state, finished, cb) { - if (!finished) - onwriteDrain(stream, state); - cb(); - if (finished) - finishMaybe(stream, state); -} - -// Must force callback to be called on nextTick, so that we don't -// emit 'drain' before the write() consumer gets the 'false' return -// value, and has a chance to attach a 'drain' listener. -function onwriteDrain(stream, state) { - if (state.length === 0 && state.needDrain) { - state.needDrain = false; - stream.emit('drain'); - } -} - - -// if there's something in the buffer waiting, then process it -function clearBuffer(stream, state) { - state.bufferProcessing = true; - - for (var c = 0; c < state.buffer.length; c++) { - var entry = state.buffer[c]; - var chunk = entry.chunk; - var encoding = entry.encoding; - var cb = entry.callback; - var len = state.objectMode ? 1 : chunk.length; - - doWrite(stream, state, len, chunk, encoding, cb); - - // if we didn't call the onwrite immediately, then - // it means that we need to wait until it does. - // also, that means that the chunk and cb are currently - // being processed, so move the buffer counter past them. - if (state.writing) { - c++; - break; - } - } - - state.bufferProcessing = false; - if (c < state.buffer.length) - state.buffer = state.buffer.slice(c); - else - state.buffer.length = 0; -} - -Writable.prototype._write = function(chunk, encoding, cb) { - cb(new Error('not implemented')); -}; - -Writable.prototype.end = function(chunk, encoding, cb) { - var state = this._writableState; - - if (typeof chunk === 'function') { - cb = chunk; - chunk = null; - encoding = null; - } else if (typeof encoding === 'function') { - cb = encoding; - encoding = null; - } - - if (typeof chunk !== 'undefined' && chunk !== null) - this.write(chunk, encoding); - - // ignore unnecessary end() calls. - if (!state.ending && !state.finished) - endWritable(this, state, cb); -}; - - -function needFinish(stream, state) { - return (state.ending && - state.length === 0 && - !state.finished && - !state.writing); -} - -function finishMaybe(stream, state) { - var need = needFinish(stream, state); - if (need) { - state.finished = true; - stream.emit('finish'); - } - return need; -} - -function endWritable(stream, state, cb) { - state.ending = true; - finishMaybe(stream, state); - if (cb) { - if (state.finished) - process.nextTick(cb); - else - stream.once('finish', cb); - } - state.ended = true; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md deleted file mode 100644 index 5a76b414..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/README.md +++ /dev/null @@ -1,3 +0,0 @@ -# core-util-is - -The `util.is*` functions introduced in Node v0.12. diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch deleted file mode 100644 index a06d5c05..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/float.patch +++ /dev/null @@ -1,604 +0,0 @@ -diff --git a/lib/util.js b/lib/util.js -index a03e874..9074e8e 100644 ---- a/lib/util.js -+++ b/lib/util.js -@@ -19,430 +19,6 @@ - // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE - // USE OR OTHER DEALINGS IN THE SOFTWARE. - --var formatRegExp = /%[sdj%]/g; --exports.format = function(f) { -- if (!isString(f)) { -- var objects = []; -- for (var i = 0; i < arguments.length; i++) { -- objects.push(inspect(arguments[i])); -- } -- return objects.join(' '); -- } -- -- var i = 1; -- var args = arguments; -- var len = args.length; -- var str = String(f).replace(formatRegExp, function(x) { -- if (x === '%%') return '%'; -- if (i >= len) return x; -- switch (x) { -- case '%s': return String(args[i++]); -- case '%d': return Number(args[i++]); -- case '%j': -- try { -- return JSON.stringify(args[i++]); -- } catch (_) { -- return '[Circular]'; -- } -- default: -- return x; -- } -- }); -- for (var x = args[i]; i < len; x = args[++i]) { -- if (isNull(x) || !isObject(x)) { -- str += ' ' + x; -- } else { -- str += ' ' + inspect(x); -- } -- } -- return str; --}; -- -- --// Mark that a method should not be used. --// Returns a modified function which warns once by default. --// If --no-deprecation is set, then it is a no-op. --exports.deprecate = function(fn, msg) { -- // Allow for deprecating things in the process of starting up. -- if (isUndefined(global.process)) { -- return function() { -- return exports.deprecate(fn, msg).apply(this, arguments); -- }; -- } -- -- if (process.noDeprecation === true) { -- return fn; -- } -- -- var warned = false; -- function deprecated() { -- if (!warned) { -- if (process.throwDeprecation) { -- throw new Error(msg); -- } else if (process.traceDeprecation) { -- console.trace(msg); -- } else { -- console.error(msg); -- } -- warned = true; -- } -- return fn.apply(this, arguments); -- } -- -- return deprecated; --}; -- -- --var debugs = {}; --var debugEnviron; --exports.debuglog = function(set) { -- if (isUndefined(debugEnviron)) -- debugEnviron = process.env.NODE_DEBUG || ''; -- set = set.toUpperCase(); -- if (!debugs[set]) { -- if (new RegExp('\\b' + set + '\\b', 'i').test(debugEnviron)) { -- var pid = process.pid; -- debugs[set] = function() { -- var msg = exports.format.apply(exports, arguments); -- console.error('%s %d: %s', set, pid, msg); -- }; -- } else { -- debugs[set] = function() {}; -- } -- } -- return debugs[set]; --}; -- -- --/** -- * Echos the value of a value. Trys to print the value out -- * in the best way possible given the different types. -- * -- * @param {Object} obj The object to print out. -- * @param {Object} opts Optional options object that alters the output. -- */ --/* legacy: obj, showHidden, depth, colors*/ --function inspect(obj, opts) { -- // default options -- var ctx = { -- seen: [], -- stylize: stylizeNoColor -- }; -- // legacy... -- if (arguments.length >= 3) ctx.depth = arguments[2]; -- if (arguments.length >= 4) ctx.colors = arguments[3]; -- if (isBoolean(opts)) { -- // legacy... -- ctx.showHidden = opts; -- } else if (opts) { -- // got an "options" object -- exports._extend(ctx, opts); -- } -- // set default options -- if (isUndefined(ctx.showHidden)) ctx.showHidden = false; -- if (isUndefined(ctx.depth)) ctx.depth = 2; -- if (isUndefined(ctx.colors)) ctx.colors = false; -- if (isUndefined(ctx.customInspect)) ctx.customInspect = true; -- if (ctx.colors) ctx.stylize = stylizeWithColor; -- return formatValue(ctx, obj, ctx.depth); --} --exports.inspect = inspect; -- -- --// http://en.wikipedia.org/wiki/ANSI_escape_code#graphics --inspect.colors = { -- 'bold' : [1, 22], -- 'italic' : [3, 23], -- 'underline' : [4, 24], -- 'inverse' : [7, 27], -- 'white' : [37, 39], -- 'grey' : [90, 39], -- 'black' : [30, 39], -- 'blue' : [34, 39], -- 'cyan' : [36, 39], -- 'green' : [32, 39], -- 'magenta' : [35, 39], -- 'red' : [31, 39], -- 'yellow' : [33, 39] --}; -- --// Don't use 'blue' not visible on cmd.exe --inspect.styles = { -- 'special': 'cyan', -- 'number': 'yellow', -- 'boolean': 'yellow', -- 'undefined': 'grey', -- 'null': 'bold', -- 'string': 'green', -- 'date': 'magenta', -- // "name": intentionally not styling -- 'regexp': 'red' --}; -- -- --function stylizeWithColor(str, styleType) { -- var style = inspect.styles[styleType]; -- -- if (style) { -- return '\u001b[' + inspect.colors[style][0] + 'm' + str + -- '\u001b[' + inspect.colors[style][1] + 'm'; -- } else { -- return str; -- } --} -- -- --function stylizeNoColor(str, styleType) { -- return str; --} -- -- --function arrayToHash(array) { -- var hash = {}; -- -- array.forEach(function(val, idx) { -- hash[val] = true; -- }); -- -- return hash; --} -- -- --function formatValue(ctx, value, recurseTimes) { -- // Provide a hook for user-specified inspect functions. -- // Check that value is an object with an inspect function on it -- if (ctx.customInspect && -- value && -- isFunction(value.inspect) && -- // Filter out the util module, it's inspect function is special -- value.inspect !== exports.inspect && -- // Also filter out any prototype objects using the circular check. -- !(value.constructor && value.constructor.prototype === value)) { -- var ret = value.inspect(recurseTimes, ctx); -- if (!isString(ret)) { -- ret = formatValue(ctx, ret, recurseTimes); -- } -- return ret; -- } -- -- // Primitive types cannot have properties -- var primitive = formatPrimitive(ctx, value); -- if (primitive) { -- return primitive; -- } -- -- // Look up the keys of the object. -- var keys = Object.keys(value); -- var visibleKeys = arrayToHash(keys); -- -- if (ctx.showHidden) { -- keys = Object.getOwnPropertyNames(value); -- } -- -- // Some type of object without properties can be shortcutted. -- if (keys.length === 0) { -- if (isFunction(value)) { -- var name = value.name ? ': ' + value.name : ''; -- return ctx.stylize('[Function' + name + ']', 'special'); -- } -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } -- if (isDate(value)) { -- return ctx.stylize(Date.prototype.toString.call(value), 'date'); -- } -- if (isError(value)) { -- return formatError(value); -- } -- } -- -- var base = '', array = false, braces = ['{', '}']; -- -- // Make Array say that they are Array -- if (isArray(value)) { -- array = true; -- braces = ['[', ']']; -- } -- -- // Make functions say that they are functions -- if (isFunction(value)) { -- var n = value.name ? ': ' + value.name : ''; -- base = ' [Function' + n + ']'; -- } -- -- // Make RegExps say that they are RegExps -- if (isRegExp(value)) { -- base = ' ' + RegExp.prototype.toString.call(value); -- } -- -- // Make dates with properties first say the date -- if (isDate(value)) { -- base = ' ' + Date.prototype.toUTCString.call(value); -- } -- -- // Make error with message first say the error -- if (isError(value)) { -- base = ' ' + formatError(value); -- } -- -- if (keys.length === 0 && (!array || value.length == 0)) { -- return braces[0] + base + braces[1]; -- } -- -- if (recurseTimes < 0) { -- if (isRegExp(value)) { -- return ctx.stylize(RegExp.prototype.toString.call(value), 'regexp'); -- } else { -- return ctx.stylize('[Object]', 'special'); -- } -- } -- -- ctx.seen.push(value); -- -- var output; -- if (array) { -- output = formatArray(ctx, value, recurseTimes, visibleKeys, keys); -- } else { -- output = keys.map(function(key) { -- return formatProperty(ctx, value, recurseTimes, visibleKeys, key, array); -- }); -- } -- -- ctx.seen.pop(); -- -- return reduceToSingleString(output, base, braces); --} -- -- --function formatPrimitive(ctx, value) { -- if (isUndefined(value)) -- return ctx.stylize('undefined', 'undefined'); -- if (isString(value)) { -- var simple = '\'' + JSON.stringify(value).replace(/^"|"$/g, '') -- .replace(/'/g, "\\'") -- .replace(/\\"/g, '"') + '\''; -- return ctx.stylize(simple, 'string'); -- } -- if (isNumber(value)) { -- // Format -0 as '-0'. Strict equality won't distinguish 0 from -0, -- // so instead we use the fact that 1 / -0 < 0 whereas 1 / 0 > 0 . -- if (value === 0 && 1 / value < 0) -- return ctx.stylize('-0', 'number'); -- return ctx.stylize('' + value, 'number'); -- } -- if (isBoolean(value)) -- return ctx.stylize('' + value, 'boolean'); -- // For some reason typeof null is "object", so special case here. -- if (isNull(value)) -- return ctx.stylize('null', 'null'); --} -- -- --function formatError(value) { -- return '[' + Error.prototype.toString.call(value) + ']'; --} -- -- --function formatArray(ctx, value, recurseTimes, visibleKeys, keys) { -- var output = []; -- for (var i = 0, l = value.length; i < l; ++i) { -- if (hasOwnProperty(value, String(i))) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- String(i), true)); -- } else { -- output.push(''); -- } -- } -- keys.forEach(function(key) { -- if (!key.match(/^\d+$/)) { -- output.push(formatProperty(ctx, value, recurseTimes, visibleKeys, -- key, true)); -- } -- }); -- return output; --} -- -- --function formatProperty(ctx, value, recurseTimes, visibleKeys, key, array) { -- var name, str, desc; -- desc = Object.getOwnPropertyDescriptor(value, key) || { value: value[key] }; -- if (desc.get) { -- if (desc.set) { -- str = ctx.stylize('[Getter/Setter]', 'special'); -- } else { -- str = ctx.stylize('[Getter]', 'special'); -- } -- } else { -- if (desc.set) { -- str = ctx.stylize('[Setter]', 'special'); -- } -- } -- if (!hasOwnProperty(visibleKeys, key)) { -- name = '[' + key + ']'; -- } -- if (!str) { -- if (ctx.seen.indexOf(desc.value) < 0) { -- if (isNull(recurseTimes)) { -- str = formatValue(ctx, desc.value, null); -- } else { -- str = formatValue(ctx, desc.value, recurseTimes - 1); -- } -- if (str.indexOf('\n') > -1) { -- if (array) { -- str = str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n').substr(2); -- } else { -- str = '\n' + str.split('\n').map(function(line) { -- return ' ' + line; -- }).join('\n'); -- } -- } -- } else { -- str = ctx.stylize('[Circular]', 'special'); -- } -- } -- if (isUndefined(name)) { -- if (array && key.match(/^\d+$/)) { -- return str; -- } -- name = JSON.stringify('' + key); -- if (name.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)) { -- name = name.substr(1, name.length - 2); -- name = ctx.stylize(name, 'name'); -- } else { -- name = name.replace(/'/g, "\\'") -- .replace(/\\"/g, '"') -- .replace(/(^"|"$)/g, "'"); -- name = ctx.stylize(name, 'string'); -- } -- } -- -- return name + ': ' + str; --} -- -- --function reduceToSingleString(output, base, braces) { -- var numLinesEst = 0; -- var length = output.reduce(function(prev, cur) { -- numLinesEst++; -- if (cur.indexOf('\n') >= 0) numLinesEst++; -- return prev + cur.replace(/\u001b\[\d\d?m/g, '').length + 1; -- }, 0); -- -- if (length > 60) { -- return braces[0] + -- (base === '' ? '' : base + '\n ') + -- ' ' + -- output.join(',\n ') + -- ' ' + -- braces[1]; -- } -- -- return braces[0] + base + ' ' + output.join(', ') + ' ' + braces[1]; --} -- -- - // NOTE: These type checking functions intentionally don't use `instanceof` - // because it is fragile and can be easily faked with `Object.create()`. - function isArray(ar) { -@@ -522,166 +98,10 @@ function isPrimitive(arg) { - exports.isPrimitive = isPrimitive; - - function isBuffer(arg) { -- return arg instanceof Buffer; -+ return Buffer.isBuffer(arg); - } - exports.isBuffer = isBuffer; - - function objectToString(o) { - return Object.prototype.toString.call(o); --} -- -- --function pad(n) { -- return n < 10 ? '0' + n.toString(10) : n.toString(10); --} -- -- --var months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', -- 'Oct', 'Nov', 'Dec']; -- --// 26 Feb 16:19:34 --function timestamp() { -- var d = new Date(); -- var time = [pad(d.getHours()), -- pad(d.getMinutes()), -- pad(d.getSeconds())].join(':'); -- return [d.getDate(), months[d.getMonth()], time].join(' '); --} -- -- --// log is just a thin wrapper to console.log that prepends a timestamp --exports.log = function() { -- console.log('%s - %s', timestamp(), exports.format.apply(exports, arguments)); --}; -- -- --/** -- * Inherit the prototype methods from one constructor into another. -- * -- * The Function.prototype.inherits from lang.js rewritten as a standalone -- * function (not on Function.prototype). NOTE: If this file is to be loaded -- * during bootstrapping this function needs to be rewritten using some native -- * functions as prototype setup using normal JavaScript does not work as -- * expected during bootstrapping (see mirror.js in r114903). -- * -- * @param {function} ctor Constructor function which needs to inherit the -- * prototype. -- * @param {function} superCtor Constructor function to inherit prototype from. -- */ --exports.inherits = function(ctor, superCtor) { -- ctor.super_ = superCtor; -- ctor.prototype = Object.create(superCtor.prototype, { -- constructor: { -- value: ctor, -- enumerable: false, -- writable: true, -- configurable: true -- } -- }); --}; -- --exports._extend = function(origin, add) { -- // Don't do anything if add isn't an object -- if (!add || !isObject(add)) return origin; -- -- var keys = Object.keys(add); -- var i = keys.length; -- while (i--) { -- origin[keys[i]] = add[keys[i]]; -- } -- return origin; --}; -- --function hasOwnProperty(obj, prop) { -- return Object.prototype.hasOwnProperty.call(obj, prop); --} -- -- --// Deprecated old stuff. -- --exports.p = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- console.error(exports.inspect(arguments[i])); -- } --}, 'util.p: Use console.error() instead'); -- -- --exports.exec = exports.deprecate(function() { -- return require('child_process').exec.apply(this, arguments); --}, 'util.exec is now called `child_process.exec`.'); -- -- --exports.print = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(String(arguments[i])); -- } --}, 'util.print: Use console.log instead'); -- -- --exports.puts = exports.deprecate(function() { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stdout.write(arguments[i] + '\n'); -- } --}, 'util.puts: Use console.log instead'); -- -- --exports.debug = exports.deprecate(function(x) { -- process.stderr.write('DEBUG: ' + x + '\n'); --}, 'util.debug: Use console.error instead'); -- -- --exports.error = exports.deprecate(function(x) { -- for (var i = 0, len = arguments.length; i < len; ++i) { -- process.stderr.write(arguments[i] + '\n'); -- } --}, 'util.error: Use console.error instead'); -- -- --exports.pump = exports.deprecate(function(readStream, writeStream, callback) { -- var callbackCalled = false; -- -- function call(a, b, c) { -- if (callback && !callbackCalled) { -- callback(a, b, c); -- callbackCalled = true; -- } -- } -- -- readStream.addListener('data', function(chunk) { -- if (writeStream.write(chunk) === false) readStream.pause(); -- }); -- -- writeStream.addListener('drain', function() { -- readStream.resume(); -- }); -- -- readStream.addListener('end', function() { -- writeStream.end(); -- }); -- -- readStream.addListener('close', function() { -- call(); -- }); -- -- readStream.addListener('error', function(err) { -- writeStream.end(); -- call(err); -- }); -- -- writeStream.addListener('error', function(err) { -- readStream.destroy(); -- call(err); -- }); --}, 'util.pump(): Use readableStream.pipe() instead'); -- -- --var uv; --exports._errnoException = function(err, syscall) { -- if (isUndefined(uv)) uv = process.binding('uv'); -- var errname = uv.errname(err); -- var e = new Error(syscall + ' ' + errname); -- e.code = errname; -- e.errno = errname; -- e.syscall = syscall; -- return e; --}; -+} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js deleted file mode 100644 index 9074e8eb..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/lib/util.js +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && - (objectToString(e) === '[object Error]' || e instanceof Error); -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return Buffer.isBuffer(arg); -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json deleted file mode 100644 index 2b7593c1..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "core-util-is", - "version": "1.0.1", - "description": "The `util.is*` functions introduced in Node v0.12.", - "main": "lib/util.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/core-util-is" - }, - "keywords": [ - "util", - "isBuffer", - "isArray", - "isNumber", - "isString", - "isRegExp", - "isThis", - "isThat", - "polyfill" - ], - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/isaacs/core-util-is/issues" - }, - "readme": "# core-util-is\n\nThe `util.is*` functions introduced in Node v0.12.\n", - "readmeFilename": "README.md", - "homepage": "https://github.com/isaacs/core-util-is", - "_id": "core-util-is@1.0.1", - "dist": { - "shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", - "tarball": "http://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz" - }, - "_from": "core-util-is@~1.0.0", - "_npmVersion": "1.3.23", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_shasum": "6b07085aef9a3ccac6ee53bf9d3df0c1521a5538", - "_resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz", - "scripts": {} -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js deleted file mode 100644 index 007fa105..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/core-util-is/util.js +++ /dev/null @@ -1,106 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -// NOTE: These type checking functions intentionally don't use `instanceof` -// because it is fragile and can be easily faked with `Object.create()`. -function isArray(ar) { - return Array.isArray(ar); -} -exports.isArray = isArray; - -function isBoolean(arg) { - return typeof arg === 'boolean'; -} -exports.isBoolean = isBoolean; - -function isNull(arg) { - return arg === null; -} -exports.isNull = isNull; - -function isNullOrUndefined(arg) { - return arg == null; -} -exports.isNullOrUndefined = isNullOrUndefined; - -function isNumber(arg) { - return typeof arg === 'number'; -} -exports.isNumber = isNumber; - -function isString(arg) { - return typeof arg === 'string'; -} -exports.isString = isString; - -function isSymbol(arg) { - return typeof arg === 'symbol'; -} -exports.isSymbol = isSymbol; - -function isUndefined(arg) { - return arg === void 0; -} -exports.isUndefined = isUndefined; - -function isRegExp(re) { - return isObject(re) && objectToString(re) === '[object RegExp]'; -} -exports.isRegExp = isRegExp; - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} -exports.isObject = isObject; - -function isDate(d) { - return isObject(d) && objectToString(d) === '[object Date]'; -} -exports.isDate = isDate; - -function isError(e) { - return isObject(e) && objectToString(e) === '[object Error]'; -} -exports.isError = isError; - -function isFunction(arg) { - return typeof arg === 'function'; -} -exports.isFunction = isFunction; - -function isPrimitive(arg) { - return arg === null || - typeof arg === 'boolean' || - typeof arg === 'number' || - typeof arg === 'string' || - typeof arg === 'symbol' || // ES6 symbol - typeof arg === 'undefined'; -} -exports.isPrimitive = isPrimitive; - -function isBuffer(arg) { - return arg instanceof Buffer; -} -exports.isBuffer = isBuffer; - -function objectToString(o) { - return Object.prototype.toString.call(o); -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE deleted file mode 100644 index dea3013d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/LICENSE +++ /dev/null @@ -1,16 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter - -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. - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md deleted file mode 100644 index b1c56658..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/README.md +++ /dev/null @@ -1,42 +0,0 @@ -Browser-friendly inheritance fully compatible with standard node.js -[inherits](http://nodejs.org/api/util.html#util_util_inherits_constructor_superconstructor). - -This package exports standard `inherits` from node.js `util` module in -node environment, but also provides alternative browser-friendly -implementation through [browser -field](https://gist.github.com/shtylman/4339901). Alternative -implementation is a literal copy of standard one located in standalone -module to avoid requiring of `util`. It also has a shim for old -browsers with no `Object.create` support. - -While keeping you sure you are using standard `inherits` -implementation in node.js environment, it allows bundlers such as -[browserify](https://github.com/substack/node-browserify) to not -include full `util` package to your client code if all you need is -just `inherits` function. It worth, because browser shim for `util` -package is large and `inherits` is often the single function you need -from it. - -It's recommended to use this package instead of -`require('util').inherits` for any code that has chances to be used -not only in node.js but in browser too. - -## usage - -```js -var inherits = require('inherits'); -// then use exactly as the standard one -``` - -## note on version ~1.0 - -Version ~1.0 had completely different motivation and is not compatible -neither with 2.0 nor with standard node.js `inherits`. - -If you are using version ~1.0 and planning to switch to ~2.0, be -careful: - -* new version uses `super_` instead of `super` for referencing - superclass -* new version overwrites current prototype while old one preserves any - existing fields on it diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js deleted file mode 100644 index 29f5e24f..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('util').inherits diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js deleted file mode 100644 index c1e78a75..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/inherits_browser.js +++ /dev/null @@ -1,23 +0,0 @@ -if (typeof Object.create === 'function') { - // implementation from standard node.js 'util' module - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - ctor.prototype = Object.create(superCtor.prototype, { - constructor: { - value: ctor, - enumerable: false, - writable: true, - configurable: true - } - }); - }; -} else { - // old school shim for old browsers - module.exports = function inherits(ctor, superCtor) { - ctor.super_ = superCtor - var TempCtor = function () {} - TempCtor.prototype = superCtor.prototype - ctor.prototype = new TempCtor() - ctor.prototype.constructor = ctor - } -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json deleted file mode 100644 index 6c556ed3..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "inherits", - "description": "Browser-friendly inheritance fully compatible with standard node.js inherits()", - "version": "2.0.1", - "keywords": [ - "inheritance", - "class", - "klass", - "oop", - "object-oriented", - "inherits", - "browser", - "browserify" - ], - "main": "./inherits.js", - "browser": "./inherits_browser.js", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/inherits" - }, - "license": "ISC", - "scripts": { - "test": "node test" - }, - "bugs": { - "url": "https://github.com/isaacs/inherits/issues" - }, - "_id": "inherits@2.0.1", - "dist": { - "shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "tarball": "http://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz" - }, - "_from": "inherits@~2.0.1", - "_npmVersion": "1.3.8", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "directories": {}, - "_shasum": "b17d08d326b4423e568eff719f91b0b1cbdf69f1", - "_resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "readme": "ERROR: No README data found!", - "homepage": "https://github.com/isaacs/inherits" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js deleted file mode 100644 index fc53012d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/inherits/test.js +++ /dev/null @@ -1,25 +0,0 @@ -var inherits = require('./inherits.js') -var assert = require('assert') - -function test(c) { - assert(c.constructor === Child) - assert(c.constructor.super_ === Parent) - assert(Object.getPrototypeOf(c) === Child.prototype) - assert(Object.getPrototypeOf(Object.getPrototypeOf(c)) === Parent.prototype) - assert(c instanceof Child) - assert(c instanceof Parent) -} - -function Child() { - Parent.call(this) - test(this) -} - -function Parent() {} - -inherits(Child, Parent) - -var c = new Child -test(c) - -console.log('ok') diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md deleted file mode 100644 index 052a62b8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/README.md +++ /dev/null @@ -1,54 +0,0 @@ - -# isarray - -`Array#isArray` for older browsers. - -## Usage - -```js -var isArray = require('isarray'); - -console.log(isArray([])); // => true -console.log(isArray({})); // => false -``` - -## Installation - -With [npm](http://npmjs.org) do - -```bash -$ npm install isarray -``` - -Then bundle for the browser with -[browserify](https://github.com/substack/browserify). - -With [component](http://component.io) do - -```bash -$ component install juliangruber/isarray -``` - -## License - -(MIT) - -Copyright (c) 2013 Julian Gruber <julian@juliangruber.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/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js deleted file mode 100644 index ec58596a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/build/build.js +++ /dev/null @@ -1,209 +0,0 @@ - -/** - * Require the given path. - * - * @param {String} path - * @return {Object} exports - * @api public - */ - -function require(path, parent, orig) { - var resolved = require.resolve(path); - - // lookup failed - if (null == resolved) { - orig = orig || path; - parent = parent || 'root'; - var err = new Error('Failed to require "' + orig + '" from "' + parent + '"'); - err.path = orig; - err.parent = parent; - err.require = true; - throw err; - } - - var module = require.modules[resolved]; - - // perform real require() - // by invoking the module's - // registered function - if (!module.exports) { - module.exports = {}; - module.client = module.component = true; - module.call(this, module.exports, require.relative(resolved), module); - } - - return module.exports; -} - -/** - * Registered modules. - */ - -require.modules = {}; - -/** - * Registered aliases. - */ - -require.aliases = {}; - -/** - * Resolve `path`. - * - * Lookup: - * - * - PATH/index.js - * - PATH.js - * - PATH - * - * @param {String} path - * @return {String} path or null - * @api private - */ - -require.resolve = function(path) { - if (path.charAt(0) === '/') path = path.slice(1); - var index = path + '/index.js'; - - var paths = [ - path, - path + '.js', - path + '.json', - path + '/index.js', - path + '/index.json' - ]; - - for (var i = 0; i < paths.length; i++) { - var path = paths[i]; - if (require.modules.hasOwnProperty(path)) return path; - } - - if (require.aliases.hasOwnProperty(index)) { - return require.aliases[index]; - } -}; - -/** - * Normalize `path` relative to the current path. - * - * @param {String} curr - * @param {String} path - * @return {String} - * @api private - */ - -require.normalize = function(curr, path) { - var segs = []; - - if ('.' != path.charAt(0)) return path; - - curr = curr.split('/'); - path = path.split('/'); - - for (var i = 0; i < path.length; ++i) { - if ('..' == path[i]) { - curr.pop(); - } else if ('.' != path[i] && '' != path[i]) { - segs.push(path[i]); - } - } - - return curr.concat(segs).join('/'); -}; - -/** - * Register module at `path` with callback `definition`. - * - * @param {String} path - * @param {Function} definition - * @api private - */ - -require.register = function(path, definition) { - require.modules[path] = definition; -}; - -/** - * Alias a module definition. - * - * @param {String} from - * @param {String} to - * @api private - */ - -require.alias = function(from, to) { - if (!require.modules.hasOwnProperty(from)) { - throw new Error('Failed to alias "' + from + '", it does not exist'); - } - require.aliases[to] = from; -}; - -/** - * Return a require function relative to the `parent` path. - * - * @param {String} parent - * @return {Function} - * @api private - */ - -require.relative = function(parent) { - var p = require.normalize(parent, '..'); - - /** - * lastIndexOf helper. - */ - - function lastIndexOf(arr, obj) { - var i = arr.length; - while (i--) { - if (arr[i] === obj) return i; - } - return -1; - } - - /** - * The relative require() itself. - */ - - function localRequire(path) { - var resolved = localRequire.resolve(path); - return require(resolved, parent, path); - } - - /** - * Resolve relative to the parent. - */ - - localRequire.resolve = function(path) { - var c = path.charAt(0); - if ('/' == c) return path.slice(1); - if ('.' == c) return require.normalize(p, path); - - // resolve deps by returning - // the dep in the nearest "deps" - // directory - var segs = parent.split('/'); - var i = lastIndexOf(segs, 'deps') + 1; - if (!i) i = 0; - path = segs.slice(0, i + 1).join('/') + '/deps/' + path; - return path; - }; - - /** - * Check if module is defined at `path`. - */ - - localRequire.exists = function(path) { - return require.modules.hasOwnProperty(localRequire.resolve(path)); - }; - - return localRequire; -}; -require.register("isarray/index.js", function(exports, require, module){ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; - -}); -require.alias("isarray/index.js", "isarray/index.js"); - diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json deleted file mode 100644 index 9e31b683..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name" : "isarray", - "description" : "Array#isArray for older browsers", - "version" : "0.0.1", - "repository" : "juliangruber/isarray", - "homepage": "https://github.com/juliangruber/isarray", - "main" : "index.js", - "scripts" : [ - "index.js" - ], - "dependencies" : {}, - "keywords": ["browser","isarray","array"], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js deleted file mode 100644 index 5f5ad45d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/index.js +++ /dev/null @@ -1,3 +0,0 @@ -module.exports = Array.isArray || function (arr) { - return Object.prototype.toString.call(arr) == '[object Array]'; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json deleted file mode 100644 index 19228ab6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/isarray/package.json +++ /dev/null @@ -1,53 +0,0 @@ -{ - "name": "isarray", - "description": "Array#isArray for older browsers", - "version": "0.0.1", - "repository": { - "type": "git", - "url": "git://github.com/juliangruber/isarray.git" - }, - "homepage": "https://github.com/juliangruber/isarray", - "main": "index.js", - "scripts": { - "test": "tap test/*.js" - }, - "dependencies": {}, - "devDependencies": { - "tap": "*" - }, - "keywords": [ - "browser", - "isarray", - "array" - ], - "author": { - "name": "Julian Gruber", - "email": "mail@juliangruber.com", - "url": "http://juliangruber.com" - }, - "license": "MIT", - "_id": "isarray@0.0.1", - "dist": { - "shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "tarball": "http://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" - }, - "_from": "isarray@0.0.1", - "_npmVersion": "1.2.18", - "_npmUser": { - "name": "juliangruber", - "email": "julian@juliangruber.com" - }, - "maintainers": [ - { - "name": "juliangruber", - "email": "julian@juliangruber.com" - } - ], - "directories": {}, - "_shasum": "8a18acfca9a8f4177e09abfc6038939b05d1eedf", - "_resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "bugs": { - "url": "https://github.com/juliangruber/isarray/issues" - }, - "readme": "ERROR: No README data found!" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore deleted file mode 100644 index 206320cc..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -build -test diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE deleted file mode 100644 index 6de584a4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright Joyent, Inc. and other Node contributors. - -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/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md deleted file mode 100644 index 4d2aa001..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/README.md +++ /dev/null @@ -1,7 +0,0 @@ -**string_decoder.js** (`require('string_decoder')`) from Node.js core - -Copyright Joyent, Inc. and other Node contributors. See LICENCE file for details. - -Version numbers match the versions found in Node core, e.g. 0.10.24 matches Node 0.10.24, likewise 0.11.10 matches Node 0.11.10. **Prefer the stable version over the unstable.** - -The *build/* directory contains a build script that will scrape the source from the [joyent/node](https://github.com/joyent/node) repo given a specific Node version. \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js deleted file mode 100644 index b00e54fb..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/index.js +++ /dev/null @@ -1,221 +0,0 @@ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -var Buffer = require('buffer').Buffer; - -var isBufferEncoding = Buffer.isEncoding - || function(encoding) { - switch (encoding && encoding.toLowerCase()) { - case 'hex': case 'utf8': case 'utf-8': case 'ascii': case 'binary': case 'base64': case 'ucs2': case 'ucs-2': case 'utf16le': case 'utf-16le': case 'raw': return true; - default: return false; - } - } - - -function assertEncoding(encoding) { - if (encoding && !isBufferEncoding(encoding)) { - throw new Error('Unknown encoding: ' + encoding); - } -} - -// StringDecoder provides an interface for efficiently splitting a series of -// buffers into a series of JS strings without breaking apart multi-byte -// characters. CESU-8 is handled as part of the UTF-8 encoding. -// -// @TODO Handling all encodings inside a single object makes it very difficult -// to reason about this code, so it should be split up in the future. -// @TODO There should be a utf8-strict encoding that rejects invalid UTF-8 code -// points as used by CESU-8. -var StringDecoder = exports.StringDecoder = function(encoding) { - this.encoding = (encoding || 'utf8').toLowerCase().replace(/[-_]/, ''); - assertEncoding(encoding); - switch (this.encoding) { - case 'utf8': - // CESU-8 represents each of Surrogate Pair by 3-bytes - this.surrogateSize = 3; - break; - case 'ucs2': - case 'utf16le': - // UTF-16 represents each of Surrogate Pair by 2-bytes - this.surrogateSize = 2; - this.detectIncompleteChar = utf16DetectIncompleteChar; - break; - case 'base64': - // Base-64 stores 3 bytes in 4 chars, and pads the remainder. - this.surrogateSize = 3; - this.detectIncompleteChar = base64DetectIncompleteChar; - break; - default: - this.write = passThroughWrite; - return; - } - - // Enough space to store all bytes of a single character. UTF-8 needs 4 - // bytes, but CESU-8 may require up to 6 (3 bytes per surrogate). - this.charBuffer = new Buffer(6); - // Number of bytes received for the current incomplete multi-byte character. - this.charReceived = 0; - // Number of bytes expected for the current incomplete multi-byte character. - this.charLength = 0; -}; - - -// write decodes the given buffer and returns it as JS string that is -// guaranteed to not contain any partial multi-byte characters. Any partial -// character found at the end of the buffer is buffered up, and will be -// returned when calling write again with the remaining bytes. -// -// Note: Converting a Buffer containing an orphan surrogate to a String -// currently works, but converting a String to a Buffer (via `new Buffer`, or -// Buffer#write) will replace incomplete surrogates with the unicode -// replacement character. See https://codereview.chromium.org/121173009/ . -StringDecoder.prototype.write = function(buffer) { - var charStr = ''; - // if our last write ended with an incomplete multibyte character - while (this.charLength) { - // determine how many remaining bytes this buffer has to offer for this char - var available = (buffer.length >= this.charLength - this.charReceived) ? - this.charLength - this.charReceived : - buffer.length; - - // add the new bytes to the char buffer - buffer.copy(this.charBuffer, this.charReceived, 0, available); - this.charReceived += available; - - if (this.charReceived < this.charLength) { - // still not enough chars in this buffer? wait for more ... - return ''; - } - - // remove bytes belonging to the current character from the buffer - buffer = buffer.slice(available, buffer.length); - - // get the character that was split - charStr = this.charBuffer.slice(0, this.charLength).toString(this.encoding); - - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - var charCode = charStr.charCodeAt(charStr.length - 1); - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - this.charLength += this.surrogateSize; - charStr = ''; - continue; - } - this.charReceived = this.charLength = 0; - - // if there are no more bytes in this buffer, just emit our char - if (buffer.length === 0) { - return charStr; - } - break; - } - - // determine and set charLength / charReceived - this.detectIncompleteChar(buffer); - - var end = buffer.length; - if (this.charLength) { - // buffer the incomplete character bytes we got - buffer.copy(this.charBuffer, 0, buffer.length - this.charReceived, end); - end -= this.charReceived; - } - - charStr += buffer.toString(this.encoding, 0, end); - - var end = charStr.length - 1; - var charCode = charStr.charCodeAt(end); - // CESU-8: lead surrogate (D800-DBFF) is also the incomplete character - if (charCode >= 0xD800 && charCode <= 0xDBFF) { - var size = this.surrogateSize; - this.charLength += size; - this.charReceived += size; - this.charBuffer.copy(this.charBuffer, size, 0, size); - buffer.copy(this.charBuffer, 0, 0, size); - return charStr.substring(0, end); - } - - // or just emit the charStr - return charStr; -}; - -// detectIncompleteChar determines if there is an incomplete UTF-8 character at -// the end of the given buffer. If so, it sets this.charLength to the byte -// length that character, and sets this.charReceived to the number of bytes -// that are available for this character. -StringDecoder.prototype.detectIncompleteChar = function(buffer) { - // determine how many bytes we have to check at the end of this buffer - var i = (buffer.length >= 3) ? 3 : buffer.length; - - // Figure out if one of the last i bytes of our buffer announces an - // incomplete char. - for (; i > 0; i--) { - var c = buffer[buffer.length - i]; - - // See http://en.wikipedia.org/wiki/UTF-8#Description - - // 110XXXXX - if (i == 1 && c >> 5 == 0x06) { - this.charLength = 2; - break; - } - - // 1110XXXX - if (i <= 2 && c >> 4 == 0x0E) { - this.charLength = 3; - break; - } - - // 11110XXX - if (i <= 3 && c >> 3 == 0x1E) { - this.charLength = 4; - break; - } - } - this.charReceived = i; -}; - -StringDecoder.prototype.end = function(buffer) { - var res = ''; - if (buffer && buffer.length) - res = this.write(buffer); - - if (this.charReceived) { - var cr = this.charReceived; - var buf = this.charBuffer; - var enc = this.encoding; - res += buf.slice(0, cr).toString(enc); - } - - return res; -}; - -function passThroughWrite(buffer) { - return buffer.toString(this.encoding); -} - -function utf16DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 2; - this.charLength = this.charReceived ? 2 : 0; -} - -function base64DetectIncompleteChar(buffer) { - this.charReceived = buffer.length % 3; - this.charLength = this.charReceived ? 3 : 0; -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json deleted file mode 100644 index a8c586bf..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/node_modules/string_decoder/package.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "name": "string_decoder", - "version": "0.10.31", - "description": "The string_decoder module from Node core", - "main": "index.js", - "dependencies": {}, - "devDependencies": { - "tap": "~0.4.8" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/rvagg/string_decoder.git" - }, - "homepage": "https://github.com/rvagg/string_decoder", - "keywords": [ - "string", - "decoder", - "browser", - "browserify" - ], - "license": "MIT", - "gitHead": "d46d4fd87cf1d06e031c23f1ba170ca7d4ade9a0", - "bugs": { - "url": "https://github.com/rvagg/string_decoder/issues" - }, - "_id": "string_decoder@0.10.31", - "_shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "_from": "string_decoder@~0.10.x", - "_npmVersion": "1.4.23", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "substack", - "email": "mail@substack.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "62e203bc41766c6c28c9fc84301dab1c5310fa94", - "tarball": "http://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json deleted file mode 100644 index e7b6c28d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "readable-stream", - "version": "1.0.31", - "description": "Streams2, a user-land copy of the stream library from Node.js v0.10.x", - "main": "readable.js", - "dependencies": { - "core-util-is": "~1.0.0", - "isarray": "0.0.1", - "string_decoder": "~0.10.x", - "inherits": "~2.0.1" - }, - "devDependencies": { - "tap": "~0.2.6" - }, - "scripts": { - "test": "tap test/simple/*.js" - }, - "repository": { - "type": "git", - "url": "git://github.com/isaacs/readable-stream" - }, - "keywords": [ - "readable", - "stream", - "pipe" - ], - "browser": { - "util": false - }, - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/isaacs/readable-stream/issues" - }, - "homepage": "https://github.com/isaacs/readable-stream", - "_id": "readable-stream@1.0.31", - "_shasum": "8f2502e0bc9e3b0da1b94520aabb4e2603ecafae", - "_from": "readable-stream@1.0.31", - "_npmVersion": "1.4.9", - "_npmUser": { - "name": "rvagg", - "email": "rod@vagg.org" - }, - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - { - "name": "rvagg", - "email": "rod@vagg.org" - } - ], - "dist": { - "shasum": "8f2502e0bc9e3b0da1b94520aabb4e2603ecafae", - "tarball": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.31.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js deleted file mode 100644 index 27e8d8a5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/passthrough.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_passthrough.js") diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js deleted file mode 100644 index 4d1ddfc7..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/readable.js +++ /dev/null @@ -1,6 +0,0 @@ -exports = module.exports = require('./lib/_stream_readable.js'); -exports.Readable = exports; -exports.Writable = require('./lib/_stream_writable.js'); -exports.Duplex = require('./lib/_stream_duplex.js'); -exports.Transform = require('./lib/_stream_transform.js'); -exports.PassThrough = require('./lib/_stream_passthrough.js'); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js deleted file mode 100644 index 5d482f07..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/transform.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_transform.js") diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js b/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js deleted file mode 100644 index e1e9efdf..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/node_modules/readable-stream/writable.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require("./lib/_stream_writable.js") diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/package.json b/Databases/node_modules/mongoose/node_modules/mongodb/package.json deleted file mode 100644 index 9ed840b6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "mongodb", - "version": "2.0.45", - "description": "MongoDB legacy driver emulation layer on top of mongodb-core", - "main": "index.js", - "repository": { - "type": "git", - "url": "git@github.com:mongodb/node-mongodb-native.git" - }, - "keywords": [ - "mongodb", - "driver", - "legacy" - ], - "dependencies": { - "mongodb-core": "1.2.14", - "readable-stream": "1.0.31", - "es6-promise": "2.1.1" - }, - "devDependencies": { - "integra": "0.1.8", - "optimist": "0.6.1", - "bson": "~0.4", - "jsdoc": "3.3.0-beta3", - "semver": "4.1.0", - "rimraf": "2.2.6", - "gleak": "0.5.0", - "mongodb-version-manager": "^0.7.1", - "mongodb-tools": "~1.0", - "co": "4.5.4", - "bluebird": "2.9.27" - }, - "author": { - "name": "Christian Kvalheim" - }, - "license": "Apache-2.0", - "bugs": { - "url": "https://github.com/mongodb/node-mongodb-native/issues" - }, - "scripts": { - "test": "node test/runner.js -t functional" - }, - "homepage": "https://github.com/mongodb/node-mongodb-native", - "gitHead": "45d433baa92cb160f895d47911ee5776fbaad3be", - "_id": "mongodb@2.0.45", - "_shasum": "c63d42b918f19a53b32d4c64043f6a9f66c9aba5", - "_from": "mongodb@2.0.45", - "_npmVersion": "2.14.4", - "_nodeVersion": "4.1.1", - "_npmUser": { - "name": "christkv", - "email": "christkv@gmail.com" - }, - "maintainers": [ - { - "name": "christkv", - "email": "christkv@gmail.com" - } - ], - "dist": { - "shasum": "c63d42b918f19a53b32d4c64043f6a9f66c9aba5", - "tarball": "http://registry.npmjs.org/mongodb/-/mongodb-2.0.45.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/mongodb/-/mongodb-2.0.45.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/t.js b/Databases/node_modules/mongoose/node_modules/mongodb/t.js deleted file mode 100644 index af73362c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/t.js +++ /dev/null @@ -1,73 +0,0 @@ -var MongoClient = require('./').MongoClient - , assert = require('assert') - , cappedCollectionName = "capped_test"; - - -function capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); -} - - function createTailedCursor(db, callback) { - var collection = db.collection(cappedCollectionName) - , cursor = collection.find({}, { tailable: true, awaitdata: true, numberOfRetries: Number.MAX_VALUE}) - , stream = cursor.stream() - , statusGetters = ['notified', 'closed', 'dead', 'killed']; - - console.log('After stream open'); - statusGetters.forEach(function (s) { - var getter = 'is' + capitalizeFirstLetter(s); - console.log("cursor " + getter + " => ", cursor[getter]()); - }); - - - stream.on('error', callback); - stream.on('end', callback.bind(null, 'end')); - stream.on('close', callback.bind(null, 'close')); - stream.on('readable', callback.bind(null, 'readable')); - stream.on('data', callback.bind(null, null, 'data')); - - console.log('After stream attach events'); - statusGetters.forEach(function (s) { - var getter = 'is' + capitalizeFirstLetter(s); - console.log("cursor " + getter + " => ", cursor[getter]()); - }); - } - - function cappedStreamEvent(err, evName, data) { - if (err) { - console.log("capped stream got error", err); - return; - } - - if (evName) { - console.log("capped stream got event", evName); - } - - if (data) { - console.log("capped stream got data", data); - } - } - - -// Connection URL -var url = 'mongodb://localhost:27017/myproject'; -// Use connect method to connect to the Server -MongoClient.connect(url, function(err, db) { - assert.equal(null, err); - console.log("Connected correctly to server"); - - db.createCollection(cappedCollectionName, - { "capped": true, - "size": 100000, - "max": 5000 }, - function(err, collection) { - - assert.equal(null, err); - console.log("Created capped collection " + cappedCollectionName); - - createTailedCursor(db, cappedStreamEvent); - }); - - - //db.close(); -}); \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/t1.js b/Databases/node_modules/mongoose/node_modules/mongodb/t1.js deleted file mode 100644 index 392ed8ec..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/t1.js +++ /dev/null @@ -1,77 +0,0 @@ -var MongoClient = require('./').MongoClient; - -MongoClient.connect('mongodb://localhost:27017/page-testing', function (err, db) { - collection = db.collection('test'); - - collection.insertMany([{a:1}, {a:2}], {w:1}, function (err, docs) { - if (err) { - console.log("ERROR"); - } - - collection.find().sort({'a': -1}).toArray(function(err, items) { - if (err) { - console.log("ERROR"); - } - console.log("Items: ", items); - }); - }); -}); -// var database = null; -// -// var MongoClient = require('./').MongoClient; -// -// function connect_to_mongo(callback) { -// if (database != null) { -// callback(null, database); -// } else { -// var connection = "mongodb://127.0.0.1:27017/test_db"; -// MongoClient.connect(connection, { -// server : { -// reconnectTries : 5, -// reconnectInterval: 1000, -// autoReconnect : true -// } -// }, function (err, db) { -// database = db; -// callback(err, db); -// }); -// } -// } -// -// function log(message) { -// console.log(new Date(), message); -// } -// -// var queryNumber = 0; -// -// function make_query(db) { -// var currentNumber = queryNumber; -// ++queryNumber; -// log("query " + currentNumber + ": started"); -// -// setTimeout(function() { -// make_query(db); -// }, 5000); -// -// var collection = db.collection('test_collection'); -// collection.findOne({}, -// function (err, result) { -// if (err != null) { -// log("query " + currentNumber + ": find one error: " + err.message); -// return; -// } -// log("query " + currentNumber + ": find one result: " + result); -// } -// ); -// } -// -// connect_to_mongo( -// function(err, db) { -// if (err != null) { -// log(err.message); -// return; -// } -// -// make_query(db); -// } -// ); diff --git a/Databases/node_modules/mongoose/node_modules/mongodb/wercker.yml b/Databases/node_modules/mongoose/node_modules/mongodb/wercker.yml deleted file mode 100644 index b64845fc..00000000 --- a/Databases/node_modules/mongoose/node_modules/mongodb/wercker.yml +++ /dev/null @@ -1,19 +0,0 @@ -box: wercker/nodejs -services: - - wercker/mongodb@1.0.1 -# Build definition -build: - # The steps that will be executed on build - steps: - # A step that executes `npm install` command - - npm-install - # A step that executes `npm test` command - - npm-test - - # A custom script step, name value is used in the UI - # and the code value contains the command that get executed - - script: - name: echo nodejs information - code: | - echo "node version $(node -v) running" - echo "npm version $(npm -v) running" diff --git a/Databases/node_modules/mongoose/node_modules/mpath/.npmignore b/Databases/node_modules/mongoose/node_modules/mpath/.npmignore deleted file mode 100644 index be106cac..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/.npmignore +++ /dev/null @@ -1,2 +0,0 @@ -*.sw* -node_modules/ diff --git a/Databases/node_modules/mongoose/node_modules/mpath/.travis.yml b/Databases/node_modules/mongoose/node_modules/mpath/.travis.yml deleted file mode 100644 index 09c230f0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js -node_js: - - 0.6 - - 0.8 diff --git a/Databases/node_modules/mongoose/node_modules/mpath/History.md b/Databases/node_modules/mongoose/node_modules/mpath/History.md deleted file mode 100644 index 4fbf3385..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/History.md +++ /dev/null @@ -1,16 +0,0 @@ - -0.1.1 / 2012-12-21 -================== - - * added; map support - -0.1.0 / 2012-12-13 -================== - - * added; set('array.property', val, object) support - * added; get('array.property', object) support - -0.0.1 / 2012-11-03 -================== - - * initial release diff --git a/Databases/node_modules/mongoose/node_modules/mpath/LICENSE b/Databases/node_modules/mongoose/node_modules/mpath/LICENSE deleted file mode 100644 index 38c529da..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.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/Databases/node_modules/mongoose/node_modules/mpath/Makefile b/Databases/node_modules/mongoose/node_modules/mpath/Makefile deleted file mode 100644 index b0bb0819..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/Makefile +++ /dev/null @@ -1,5 +0,0 @@ - -test: - @node_modules/mocha/bin/mocha -A $(T) - -.PHONY: test diff --git a/Databases/node_modules/mongoose/node_modules/mpath/README.md b/Databases/node_modules/mongoose/node_modules/mpath/README.md deleted file mode 100644 index 9831dd06..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/README.md +++ /dev/null @@ -1,278 +0,0 @@ -#mpath - -{G,S}et javascript object values using MongoDB-like path notation. - -###Getting - -```js -var mpath = require('mpath'); - -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.get('comments.1.title', obj) // 'exciting!' -``` - -`mpath.get` supports array property notation as well. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.get('comments.title', obj) // ['funny', 'exciting!'] -``` - -Array property and indexing syntax, when used together, are very powerful. - -```js -var obj = { - array: [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: 'Turkey Day' }] }} - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; -} - -var found = mpath.get('array.o.array.x.b.1', obj); - -console.log(found); // prints.. - - [ [6, undefined] - , [2, undefined, undefined] - , [null, 1] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - -``` - -#####Field selection rules: - -The following rules are iteratively applied to each `segment` in the passed `path`. For example: - -```js -var path = 'one.two.14'; // path -'one' // segment 0 -'two' // segment 1 -14 // segment 2 -``` - -- 1) when value of the segment parent is not an array, return the value of `parent.segment` -- 2) when value of the segment parent is an array - - a) if the segment is an integer, replace the parent array with the value at `parent[segment]` - - b) if not an integer, keep the array but replace each array `item` with the value returned from calling `get(remainingSegments, item)` or undefined if falsey. - -#####Maps - -`mpath.get` also accepts an optional `map` argument which receives each individual found value. The value returned from the `map` function will be used in the original found values place. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.get('comments.title', obj, function (val) { - return 'funny' == val - ? 'amusing' - : val; -}); -// ['amusing', 'exciting!'] -``` - -###Setting - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.1.title', 'hilarious', obj) -console.log(obj.comments[1].title) // 'hilarious' -``` - -`mpath.set` supports the same array property notation as `mpath.get`. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.title', ['hilarious', 'fruity'], obj); - -console.log(obj); // prints.. - - { comments: [ - { title: 'hilarious' }, - { title: 'fruity' } - ]} -``` - -Array property and indexing syntax can be used together also when setting. - -```js -var obj = { - array: [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: 'Turkey Day' }] }} - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ] -} - -mpath.set('array.1.o', 'this was changed', obj); - -console.log(require('util').inspect(obj, false, 1000)); // prints.. - -{ - array: [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: 'this was changed' } - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; -} - -mpath.set('array.o.array.x', 'this was changed too', obj); - -console.log(require('util').inspect(obj, false, 1000)); // prints.. - -{ - array: [ - { o: { array: [{x: 'this was changed too'}, { y: 10, x: 'this was changed too'} ] }} - , { o: 'this was changed' } - , { o: { array: [{x: 'this was changed too'}, { x: 'this was changed too'}] }} - , { o: { array: [{x: 'this was changed too'}] }} - , { o: { array: [{x: 'this was changed too', y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; -} -``` - -####Setting arrays - -By default, setting a property within an array to another array results in each element of the new array being set to the item in the destination array at the matching index. An example is helpful. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.title', ['hilarious', 'fruity'], obj); - -console.log(obj); // prints.. - - { comments: [ - { title: 'hilarious' }, - { title: 'fruity' } - ]} -``` - -If we do not desire this destructuring-like assignment behavior we may instead specify the `$` operator in the path being set to force the array to be copied directly. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.$.title', ['hilarious', 'fruity'], obj); - -console.log(obj); // prints.. - - { comments: [ - { title: ['hilarious', 'fruity'] }, - { title: ['hilarious', 'fruity'] } - ]} -``` - -####Field assignment rules - -The rules utilized mirror those used on `mpath.get`, meaning we can take values returned from `mpath.get`, update them, and reassign them using `mpath.set`. Note that setting nested arrays of arrays can get unweildy quickly. Check out the [tests](https://github.com/aheckmann/mpath/blob/master/test/index.js) for more extreme examples. - -#####Maps - -`mpath.set` also accepts an optional `map` argument which receives each individual value being set. The value returned from the `map` function will be used in the original values place. - -```js -var obj = { - comments: [ - { title: 'funny' }, - { title: 'exciting!' } - ] -} - -mpath.set('comments.title', ['hilarious', 'fruity'], obj, function (val) { - return val.length; -}); - -console.log(obj); // prints.. - - { comments: [ - { title: 9 }, - { title: 6 } - ]} -``` - -### Custom object types - -Sometimes you may want to enact the same functionality on custom object types that store all their real data internally, say for an ODM type object. No fear, `mpath` has you covered. Simply pass the name of the property being used to store the internal data and it will be traversed instead: - -```js -var mpath = require('mpath'); - -var obj = { - comments: [ - { title: 'exciting!', _doc: { title: 'great!' }} - ] -} - -mpath.get('comments.0.title', obj, '_doc') // 'great!' -mpath.set('comments.0.title', 'nov 3rd', obj, '_doc') -mpath.get('comments.0.title', obj, '_doc') // 'nov 3rd' -mpath.get('comments.0.title', obj) // 'exciting' -``` - -When used with a `map`, the `map` argument comes last. - -```js -mpath.get(path, obj, '_doc', map); -mpath.set(path, val, obj, '_doc', map); -``` - -[LICENSE](https://github.com/aheckmann/mpath/blob/master/LICENSE) - diff --git a/Databases/node_modules/mongoose/node_modules/mpath/index.js b/Databases/node_modules/mongoose/node_modules/mpath/index.js deleted file mode 100644 index f7b65dd5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = exports = require('./lib'); diff --git a/Databases/node_modules/mongoose/node_modules/mpath/lib/index.js b/Databases/node_modules/mongoose/node_modules/mpath/lib/index.js deleted file mode 100644 index 24e1e832..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/lib/index.js +++ /dev/null @@ -1,183 +0,0 @@ - -/** - * Returns the value of object `o` at the given `path`. - * - * ####Example: - * - * var obj = { - * comments: [ - * { title: 'exciting!', _doc: { title: 'great!' }} - * , { title: 'number dos' } - * ] - * } - * - * mpath.get('comments.0.title', o) // 'exciting!' - * mpath.get('comments.0.title', o, '_doc') // 'great!' - * mpath.get('comments.title', o) // ['exciting!', 'number dos'] - * - * // summary - * mpath.get(path, o) - * mpath.get(path, o, special) - * mpath.get(path, o, map) - * mpath.get(path, o, special, map) - * - * @param {String} path - * @param {Object} o - * @param {String} [special] When this property name is present on any object in the path, walking will continue on the value of this property. - * @param {Function} [map] Optional function which receives each individual found value. The value returned from `map` is used in the original values place. - */ - -exports.get = function (path, o, special, map) { - if ('function' == typeof special) { - map = special; - special = undefined; - } - - map || (map = K); - - var parts = 'string' == typeof path - ? path.split('.') - : path - - if (!Array.isArray(parts)) { - throw new TypeError('Invalid `path`. Must be either string or array'); - } - - var obj = o - , part; - - for (var i = 0; i < parts.length; ++i) { - part = parts[i]; - - if (Array.isArray(obj) && !/^\d+$/.test(part)) { - // reading a property from the array items - var paths = parts.slice(i); - - return obj.map(function (item) { - return item - ? exports.get(paths, item, special, map) - : map(undefined); - }); - } - - obj = special && obj[special] - ? obj[special][part] - : obj[part]; - - if (!obj) return map(obj); - } - - return map(obj); -} - -/** - * Sets the `val` at the given `path` of object `o`. - * - * @param {String} path - * @param {Anything} val - * @param {Object} o - * @param {String} [special] When this property name is present on any object in the path, walking will continue on the value of this property. - * @param {Function} [map] Optional function which is passed each individual value before setting it. The value returned from `map` is used in the original values place. - - */ - -exports.set = function (path, val, o, special, map, _copying) { - if ('function' == typeof special) { - map = special; - special = undefined; - } - - map || (map = K); - - var parts = 'string' == typeof path - ? path.split('.') - : path - - if (!Array.isArray(parts)) { - throw new TypeError('Invalid `path`. Must be either string or array'); - } - - if (null == o) return; - - // the existance of $ in a path tells us if the user desires - // the copying of an array instead of setting each value of - // the array to the one by one to matching positions of the - // current array. - var copy = _copying || /\$/.test(path) - , obj = o - , part - - for (var i = 0, len = parts.length - 1; i < len; ++i) { - part = parts[i]; - - if ('$' == part) { - if (i == len - 1) { - break; - } else { - continue; - } - } - - if (Array.isArray(obj) && !/^\d+$/.test(part)) { - var paths = parts.slice(i); - if (!copy && Array.isArray(val)) { - for (var j = 0; j < obj.length && j < val.length; ++j) { - // assignment of single values of array - exports.set(paths, val[j], obj[j], special, map, copy); - } - } else { - for (var j = 0; j < obj.length; ++j) { - // assignment of entire value - exports.set(paths, val, obj[j], special, map, copy); - } - } - return; - } - - obj = special && obj[special] - ? obj[special][part] - : obj[part]; - - if (!obj) return; - } - - // process the last property of the path - - part = parts[len]; - - // use the special property if exists - if (special && obj[special]) { - obj = obj[special]; - } - - // set the value on the last branch - if (Array.isArray(obj) && !/^\d+$/.test(part)) { - if (!copy && Array.isArray(val)) { - for (var item, j = 0; j < obj.length && j < val.length; ++j) { - item = obj[j]; - if (item) { - if (item[special]) item = item[special]; - item[part] = map(val[j]); - } - } - } else { - for (var j = 0; j < obj.length; ++j) { - item = obj[j]; - if (item) { - if (item[special]) item = item[special]; - item[part] = map(val); - } - } - } - } else { - obj[part] = map(val); - } -} - -/*! - * Returns the value passed to it. - */ - -function K (v) { - return v; -} diff --git a/Databases/node_modules/mongoose/node_modules/mpath/package.json b/Databases/node_modules/mongoose/node_modules/mpath/package.json deleted file mode 100644 index 75e91111..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/package.json +++ /dev/null @@ -1,47 +0,0 @@ -{ - "name": "mpath", - "version": "0.1.1", - "description": "{G,S}et object values using MongoDB path notation", - "main": "index.js", - "scripts": { - "test": "make test" - }, - "repository": { - "type": "git", - "url": "git://github.com/aheckmann/mpath.git" - }, - "keywords": [ - "mongodb", - "path", - "get", - "set" - ], - "author": { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - "license": "MIT", - "devDependencies": { - "mocha": "1.6.0" - }, - "_id": "mpath@0.1.1", - "dist": { - "shasum": "23da852b7c232ee097f4759d29c0ee9cd22d5e46", - "tarball": "http://registry.npmjs.org/mpath/-/mpath-0.1.1.tgz" - }, - "_npmVersion": "1.1.59", - "_npmUser": { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - }, - "maintainers": [ - { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - } - ], - "directories": {}, - "_shasum": "23da852b7c232ee097f4759d29c0ee9cd22d5e46", - "_from": "mpath@0.1.1", - "_resolved": "https://registry.npmjs.org/mpath/-/mpath-0.1.1.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mpath/test/index.js b/Databases/node_modules/mongoose/node_modules/mpath/test/index.js deleted file mode 100644 index 98e119a7..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpath/test/index.js +++ /dev/null @@ -1,1630 +0,0 @@ - -/** - * Test dependencies. - */ - -var mpath = require('../') -var assert = require('assert') - -/** - * logging helper - */ - -function log (o) { - console.log(); - console.log(require('util').inspect(o, false, 1000)); -} - -/** - * special path for override tests - */ - -var special = '_doc'; - -/** - * Tests - */ - -describe('mpath', function(){ - - /** - * test doc creator - */ - - function doc () { - var o = { first: { second: { third: [3,{ name: 'aaron' }, 9] }}}; - o.comments = [ - { name: 'one' } - , { name: 'two', _doc: { name: '2' }} - , { name: 'three' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}] }} - ]; - o.name = 'jiro'; - o.array = [ - { o: { array: [{x: {b: [4,6,8]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: {b: 'hi'}}] }} - , { o: { array: [{x: {b: null }}, { x: { b: [null, 1]}}] }} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; - o.arr = [ - { arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true } - ] - return o; - } - - describe('get', function(){ - var o = doc(); - - it('`path` must be a string or array', function(done){ - assert.throws(function () { - mpath.get({}, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(4, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(function(){}, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(/asdf/, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(Math, o); - }, /Must be either string or array/); - assert.throws(function () { - mpath.get(Buffer, o); - }, /Must be either string or array/); - assert.doesNotThrow(function () { - mpath.get('string', o); - }); - assert.doesNotThrow(function () { - mpath.get([], o); - }); - done(); - }) - - describe('without `special`', function(){ - it('works', function(done){ - assert.equal('jiro', mpath.get('name', o)); - - assert.deepEqual( - { second: { third: [3,{ name: 'aaron' }, 9] }} - , mpath.get('first', o) - ); - - assert.deepEqual( - { third: [3,{ name: 'aaron' }, 9] } - , mpath.get('first.second', o) - ); - - assert.deepEqual( - [3,{ name: 'aaron' }, 9] - , mpath.get('first.second.third', o) - ); - - assert.deepEqual( - 3 - , mpath.get('first.second.third.0', o) - ); - - assert.deepEqual( - 9 - , mpath.get('first.second.third.2', o) - ); - - assert.deepEqual( - { name: 'aaron' } - , mpath.get('first.second.third.1', o) - ); - - assert.deepEqual( - 'aaron' - , mpath.get('first.second.third.1.name', o) - ); - - assert.deepEqual([ - { name: 'one' } - , { name: 'two', _doc: { name: '2' }} - , { name: 'three' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}]}}], - mpath.get('comments', o)); - - assert.deepEqual({ name: 'one' }, mpath.get('comments.0', o)); - assert.deepEqual('one', mpath.get('comments.0.name', o)); - assert.deepEqual('two', mpath.get('comments.1.name', o)); - assert.deepEqual('three', mpath.get('comments.2.name', o)); - - assert.deepEqual([{},{ comments: [{val: 'twoo'}]}] - , mpath.get('comments.2.comments', o)); - - assert.deepEqual({ comments: [{val: 'twoo'}]} - , mpath.get('comments.2.comments.1', o)); - - assert.deepEqual('twoo', mpath.get('comments.2.comments.1.comments.0.val', o)); - - done(); - }) - - it('handles array.property dot-notation', function(done){ - assert.deepEqual( - ['one', 'two', 'three'] - , mpath.get('comments.name', o) - ); - done(); - }) - - it('handles array.array notation', function(done){ - assert.deepEqual( - [undefined, undefined, [{}, {comments:[{val:'twoo'}]}]] - , mpath.get('comments.comments', o) - ); - done(); - }) - - it('handles prop.prop.prop.arrayProperty notation', function(done){ - assert.deepEqual( - [undefined, 'aaron', undefined] - , mpath.get('first.second.third.name', o) - ); - assert.deepEqual( - [1, 'aaron', 1] - , mpath.get('first.second.third.name', o, function (v) { - return undefined === v ? 1 : v; - }) - ); - done(); - }) - - it('handles array.prop.array', function(done){ - assert.deepEqual( - [ [{x: {b: [4,6,8]}}, { y: 10} ] - , [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: {b: 'hi'}}] - , [{x: {b: null }}, { x: { b: [null, 1]}}] - , [{x: null }] - , [{y: 3 }] - , [3, 0, null] - , undefined - ] - , mpath.get('array.o.array', o) - ); - done(); - }) - - it('handles array.prop.array.index', function(done){ - assert.deepEqual( - [ {x: {b: [4,6,8]}} - , {x: {b: [1,2,3]}} - , {x: {b: null }} - , {x: null } - , {y: 3 } - , 3 - , undefined - ] - , mpath.get('array.o.array.0', o) - ); - done(); - }) - - it('handles array.prop.array.index.prop', function(done){ - assert.deepEqual( - [ {b: [4,6,8]} - , {b: [1,2,3]} - , {b: null } - , null - , undefined - , undefined - , undefined - ] - , mpath.get('array.o.array.0.x', o) - ); - done(); - }) - - it('handles array.prop.array.prop', function(done){ - assert.deepEqual( - [ [undefined, 10 ] - , [undefined, undefined, undefined] - , [undefined, undefined] - , [undefined] - , [3] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.y', o) - ); - assert.deepEqual( - [ [{b: [4,6,8]}, undefined] - , [{b: [1,2,3]}, {z: 10 }, {b: 'hi'}] - , [{b: null }, { b: [null, 1]}] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.x', o) - ); - done(); - }) - - it('handles array.prop.array.prop.prop', function(done){ - assert.deepEqual( - [ [[4,6,8], undefined] - , [[1,2,3], undefined, 'hi'] - , [null, [null, 1]] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.x.b', o) - ); - done(); - }) - - it('handles array.prop.array.prop.prop.index', function(done){ - assert.deepEqual( - [ [6, undefined] - , [2, undefined, 'i'] // undocumented feature (string indexing) - , [null, 1] - , [null] - , [undefined] - , [undefined, undefined, undefined] - , undefined - ] - , mpath.get('array.o.array.x.b.1', o) - ); - assert.deepEqual( - [ [6, 0] - , [2, 0, 'i'] // undocumented feature (string indexing) - , [null, 1] - , [null] - , [0] - , [0, 0, 0] - , 0 - ] - , mpath.get('array.o.array.x.b.1', o, function (v) { - return undefined === v ? 0 : v; - }) - ); - done(); - }) - - it('handles array.index.prop.prop', function(done){ - assert.deepEqual( - [{x: {b: [1,2,3]}}, { x: {z: 10 }}, { x: {b: 'hi'}}] - , mpath.get('array.1.o.array', o) - ); - assert.deepEqual( - ['hi','hi','hi'] - , mpath.get('array.1.o.array', o, function (v) { - if (Array.isArray(v)) { - return v.map(function (val) { - return 'hi'; - }) - } - return v; - }) - ); - done(); - }) - - it('handles array.array.index', function(done){ - assert.deepEqual( - [{ a: { c: 48 }}, undefined] - , mpath.get('arr.arr.1', o) - ); - assert.deepEqual( - ['woot', undefined] - , mpath.get('arr.arr.1', o, function (v) { - if (v && v.a && v.a.c) return 'woot'; - return v; - }) - ); - done(); - }) - - it('handles array.array.index.prop', function(done){ - assert.deepEqual( - [{ c: 48 }, 'woot'] - , mpath.get('arr.arr.1.a', o, function (v) { - if (undefined === v) return 'woot'; - return v; - }) - ); - assert.deepEqual( - [{ c: 48 }, undefined] - , mpath.get('arr.arr.1.a', o) - ); - mpath.set('arr.arr.1.a', [{c:49},undefined], o) - assert.deepEqual( - [{ c: 49 }, undefined] - , mpath.get('arr.arr.1.a', o) - ); - mpath.set('arr.arr.1.a', [{c:48},undefined], o) - done(); - }) - - it('handles array.array.index.prop.prop', function(done){ - assert.deepEqual( - [48, undefined] - , mpath.get('arr.arr.1.a.c', o) - ); - assert.deepEqual( - [48, 'woot'] - , mpath.get('arr.arr.1.a.c', o, function (v) { - if (undefined === v) return 'woot'; - return v; - }) - ); - done(); - }) - - }) - - describe('with `special`', function(){ - it('works', function(done){ - assert.equal('jiro', mpath.get('name', o, special)); - - assert.deepEqual( - { second: { third: [3,{ name: 'aaron' }, 9] }} - , mpath.get('first', o, special) - ); - - assert.deepEqual( - { third: [3,{ name: 'aaron' }, 9] } - , mpath.get('first.second', o, special) - ); - - assert.deepEqual( - [3,{ name: 'aaron' }, 9] - , mpath.get('first.second.third', o, special) - ); - - assert.deepEqual( - 3 - , mpath.get('first.second.third.0', o, special) - ); - - assert.deepEqual( - 4 - , mpath.get('first.second.third.0', o, special, function (v) { - return 3 === v ? 4 : v; - }) - ); - - assert.deepEqual( - 9 - , mpath.get('first.second.third.2', o, special) - ); - - assert.deepEqual( - { name: 'aaron' } - , mpath.get('first.second.third.1', o, special) - ); - - assert.deepEqual( - 'aaron' - , mpath.get('first.second.third.1.name', o, special) - ); - - assert.deepEqual([ - { name: 'one' } - , { name: 'two', _doc: { name: '2' }} - , { name: 'three' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}]}}], - mpath.get('comments', o, special)); - - assert.deepEqual({ name: 'one' }, mpath.get('comments.0', o, special)); - assert.deepEqual('one', mpath.get('comments.0.name', o, special)); - assert.deepEqual('2', mpath.get('comments.1.name', o, special)); - assert.deepEqual('3', mpath.get('comments.2.name', o, special)); - assert.deepEqual('nice', mpath.get('comments.2.name', o, special, function (v) { - return '3' === v ? 'nice' : v; - })); - - assert.deepEqual([{},{ _doc: { comments: [{ val: 2 }] }}] - , mpath.get('comments.2.comments', o, special)); - - assert.deepEqual({ _doc: { comments: [{val: 2}]}} - , mpath.get('comments.2.comments.1', o, special)); - - assert.deepEqual(2, mpath.get('comments.2.comments.1.comments.0.val', o, special)); - done(); - }) - - it('handles array.property dot-notation', function(done){ - assert.deepEqual( - ['one', '2', '3'] - , mpath.get('comments.name', o, special) - ); - assert.deepEqual( - ['one', 2, '3'] - , mpath.get('comments.name', o, special, function (v) { - return '2' === v ? 2 : v - }) - ); - done(); - }) - - it('handles array.array notation', function(done){ - assert.deepEqual( - [undefined, undefined, [{}, {_doc: { comments:[{val:2}]}}]] - , mpath.get('comments.comments', o, special) - ); - done(); - }) - - it('handles array.array.index.array', function(done){ - assert.deepEqual( - [undefined, undefined, [{val:2}]] - , mpath.get('comments.comments.1.comments', o, special) - ); - done(); - }) - - it('handles array.array.index.array.prop', function(done){ - assert.deepEqual( - [undefined, undefined, [2]] - , mpath.get('comments.comments.1.comments.val', o, special) - ); - assert.deepEqual( - ['nil', 'nil', [2]] - , mpath.get('comments.comments.1.comments.val', o, special, function (v) { - return undefined === v ? 'nil' : v; - }) - ); - done(); - }) - }) - - }) - - describe('set', function(){ - describe('without `special`', function(){ - var o = doc(); - - it('works', function(done){ - mpath.set('name', 'a new val', o, function (v) { - return 'a new val' === v ? 'changed' : v; - }); - assert.deepEqual('changed', o.name); - - mpath.set('name', 'changed', o); - assert.deepEqual('changed', o.name); - - mpath.set('first.second.third', [1,{name:'x'},9], o); - assert.deepEqual([1,{name:'x'},9], o.first.second.third); - - mpath.set('first.second.third.1.name', 'y', o) - assert.deepEqual([1,{name:'y'},9], o.first.second.third); - - mpath.set('comments.1.name', 'ttwwoo', o); - assert.deepEqual({ name: 'ttwwoo', _doc: { name: '2' }}, o.comments[1]); - - mpath.set('comments.2.comments.1.comments.0.expand', 'added', o); - assert.deepEqual( - { val: 'twoo', expand: 'added'} - , o.comments[2].comments[1].comments[0]); - - mpath.set('comments.2.comments.1.comments.2', 'added', o); - assert.equal(3, o.comments[2].comments[1].comments.length); - assert.deepEqual( - { val: 'twoo', expand: 'added'} - , o.comments[2].comments[1].comments[0]); - assert.deepEqual( - undefined - , o.comments[2].comments[1].comments[1]); - assert.deepEqual( - 'added' - , o.comments[2].comments[1].comments[2]); - - done(); - }) - - describe('array.path', function(){ - describe('with single non-array value', function(){ - it('works', function(done){ - mpath.set('arr.yep', false, o, function (v) { - return false === v ? true: v; - }); - assert.deepEqual([ - { yep: true, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true } - ], o.arr); - - mpath.set('arr.yep', false, o); - - assert.deepEqual([ - { yep: false, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: false } - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('that are equal in length', function(done){ - mpath.set('arr.yep', ['one',2], o, function (v) { - return 'one' === v ? 1 : v; - }); - assert.deepEqual([ - { yep: 1, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - mpath.set('arr.yep', ['one',2], o); - - assert.deepEqual([ - { yep: 'one', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - - done(); - }) - - it('that is less than length', function(done){ - mpath.set('arr.yep', [47], o, function (v) { - return 47 === v ? 4 : v; - }); - assert.deepEqual([ - { yep: 4, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - - mpath.set('arr.yep', [47], o); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 2 } - ], o.arr); - - done(); - }) - - it('that is greater than length', function(done){ - mpath.set('arr.yep', [5,6,7], o, function (v) { - return 5 === v ? 'five' : v; - }); - assert.deepEqual([ - { yep: 'five', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 6 } - ], o.arr); - - mpath.set('arr.yep', [5,6,7], o); - assert.deepEqual([ - { yep: 5, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 6 } - ], o.arr); - - done(); - }) - }) - }) - - describe('array.$.path', function(){ - describe('with single non-array value', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', {xtra: 'double good'}, o, function (v) { - return v && v.xtra ? 'hi' : v; - }); - assert.deepEqual([ - { yep: 'hi', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 'hi'} - ], o.arr); - - mpath.set('arr.$.yep', {xtra: 'double good'}, o); - assert.deepEqual([ - { yep: {xtra:'double good'}, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: {xtra:'double good'}} - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', [15], o, function (v) { - return v.length === 1 ? [] : v; - }); - assert.deepEqual([ - { yep: [], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: []} - ], o.arr); - - mpath.set('arr.$.yep', [15], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: [15]} - ], o.arr); - - done(); - }) - }) - }) - - describe('array.index.path', function(){ - it('works', function(done){ - mpath.set('arr.1.yep', 0, o, function (v) { - return 0 === v ? 'zero' : v; - }); - assert.deepEqual([ - { yep: [15] , arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 'zero' } - ], o.arr); - - mpath.set('arr.1.yep', 0, o); - assert.deepEqual([ - { yep: [15] , arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.e', 35, o, function (v) { - return 35 === v ? 3 : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 3}, { a: { c: 48 }, e: 3}, { d: 'yep', e: 3 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.e', 35, o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 35}, { a: { c: 48 }, e: 35}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.e', ['a','b'], o, function (v) { - return 'a' === v ? 'x' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 'x'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.e', ['a','b'], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 47 }, e: 'a'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.a.b', 36, o, function (v) { - return 36 === v ? 3 : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 3 }, e: 'a'}, { a: { c: 48, b: 3 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.a.b', 36, o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 36 }, e: 'a'}, { a: { c: 48, b: 36 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.a.b', [1,2,3,4], o, function (v) { - return 2 === v ? 'two' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 1 }, e: 'a'}, { a: { c: 48, b: 'two' }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.a.b', [1,2,3,4], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 1 }, e: 'a'}, { a: { c: 48, b: 2 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.$.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.$.a.b', '$', o, function (v) { - return '$' === v ? 'dolla billz' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: 'dolla billz' }, e: 'a'}, { a: { c: 48, b: 'dolla billz' }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', '$', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: '$' }, e: 'a'}, { a: { c: 48, b: '$' }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.$.a.b', [1], o, function (v) { - return Array.isArray(v) ? {} : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: {} }, e: 'a'}, { a: { c: 48, b: {} }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', [1], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: { b: [1] }, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - }) - - describe('array.array.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.0.a', 'single', o, function (v) { - return 'single' === v ? 'double' : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'double', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.arr.0.a', 'single', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o, function (v) { - return 4 === v ? 3 : v; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 3, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: false } - ], o.arr); - - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 4, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: false } - ], o.arr); - - done(); - }) - }) - - describe('array.array.$.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.$.0.a', 'singles', o, function (v) { - return 0; - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 0, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('arr.arr.$.0.a', 'singles', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'singles', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - mpath.set('$.arr.arr.0.a', 'single', o); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0 } - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o, function (v) { - return 'nope' - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: 'nope', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - mpath.set('arr.$.arr.0.a', [4,8,15,16,23,42,108], o); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - done(); - }) - }) - - describe('array.array.path.index', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.a.7', 47, o, function (v) { - return 1 - }); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,1], e: 'a'}, { a: { c: 48, b: [1], '7': 1 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - mpath.set('arr.arr.a.7', 47, o); - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,47], e: 'a'}, { a: { c: 48, b: [1], '7': 47 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0} - ], o.arr); - - done(); - }) - it('with array', function(done){ - o.arr[1].arr = [{ a: [] }, { a: [] }, { a: null }]; - mpath.set('arr.arr.a.7', [[null,46], [undefined, 'woot']], o); - - var a1 = []; - var a2 = []; - a1[7] = undefined; - a2[7] = 'woot'; - - assert.deepEqual([ - { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,null], e: 'a'}, { a: { c: 48, b: [1], '7': 46 }, e: 'b'}, { d: 'yep', e: 35 }] } - , { yep: 0, arr: [{a:a1},{a:a2},{a:null}] } - ], o.arr); - - done(); - }) - }) - - describe('handles array.array.path', function(){ - it('with single', function(done){ - o.arr[1].arr = [{},{}]; - assert.deepEqual([{},{}], o.arr[1].arr); - o.arr.push({ arr: 'something else' }); - o.arr.push({ arr: ['something else'] }); - o.arr.push({ arr: [[]] }); - o.arr.push({ arr: [5] }); - - var weird = []; - weird.e = 'xmas'; - - // test - mpath.set('arr.arr.e', 47, o, function (v) { - return 'xmas' - }); - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 'xmas'} - , { a: { c: 48, b: [1], '7': 46 }, e: 'xmas'} - , { d: 'yep', e: 'xmas' } - ] - } - , { yep: 0, arr: [{e: 'xmas'}, {e:'xmas'}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - weird.e = 47; - - mpath.set('arr.arr.e', 47, o); - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 47} - , { a: { c: 48, b: [1], '7': 46 }, e: 47} - , { d: 'yep', e: 47 } - ] - } - , { yep: 0, arr: [{e: 47}, {e:47}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - done(); - }) - it('with arrays', function(done){ - mpath.set('arr.arr.e', [[1,2,3],[4,5],null,[],[6], [7,8,9]], o, function (v) { - return 10; - }); - - var weird = []; - weird.e = 10; - - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 10} - , { a: { c: 48, b: [1], '7': 46 }, e: 10} - , { d: 'yep', e: 10 } - ] - } - , { yep: 0, arr: [{e: 10}, {e:10}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - mpath.set('arr.arr.e', [[1,2,3],[4,5],null,[],[6], [7,8,9]], o); - - weird.e = 6; - - assert.deepEqual([ - { yep: [15], arr: [ - { a: [4,8,15,16,23,42,108,null], e: 1} - , { a: { c: 48, b: [1], '7': 46 }, e: 2} - , { d: 'yep', e: 3 } - ] - } - , { yep: 0, arr: [{e: 4}, {e:5}] } - , { arr: 'something else' } - , { arr: ['something else'] } - , { arr: [weird] } - , { arr: [5] } - ] - , o.arr); - - done(); - }) - }) - }) - - describe('with `special`', function(){ - var o = doc(); - - it('works', function(done){ - mpath.set('name', 'chan', o, special, function (v) { - return 'hi'; - }); - assert.deepEqual('hi', o.name); - - mpath.set('name', 'changer', o, special); - assert.deepEqual('changer', o.name); - - mpath.set('first.second.third', [1,{name:'y'},9], o, special); - assert.deepEqual([1,{name:'y'},9], o.first.second.third); - - mpath.set('first.second.third.1.name', 'z', o, special) - assert.deepEqual([1,{name:'z'},9], o.first.second.third); - - mpath.set('comments.1.name', 'ttwwoo', o, special); - assert.deepEqual({ name: 'two', _doc: { name: 'ttwwoo' }}, o.comments[1]); - - mpath.set('comments.2.comments.1.comments.0.expander', 'adder', o, special, function (v) { - return 'super' - }); - assert.deepEqual( - { val: 2, expander: 'super'} - , o.comments[2]._doc.comments[1]._doc.comments[0]); - - mpath.set('comments.2.comments.1.comments.0.expander', 'adder', o, special); - assert.deepEqual( - { val: 2, expander: 'adder'} - , o.comments[2]._doc.comments[1]._doc.comments[0]); - - mpath.set('comments.2.comments.1.comments.2', 'set', o, special); - assert.equal(3, o.comments[2]._doc.comments[1]._doc.comments.length); - assert.deepEqual( - { val: 2, expander: 'adder'} - , o.comments[2]._doc.comments[1]._doc.comments[0]); - assert.deepEqual( - undefined - , o.comments[2]._doc.comments[1]._doc.comments[1]); - assert.deepEqual( - 'set' - , o.comments[2]._doc.comments[1]._doc.comments[2]); - done(); - }) - - describe('array.path', function(){ - describe('with single non-array value', function(){ - it('works', function(done){ - o.arr[1]._doc = { special: true } - - mpath.set('arr.yep', false, o, special, function (v) { - return 'yes'; - }); - assert.deepEqual([ - { yep: 'yes', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 'yes'}} - ], o.arr); - - mpath.set('arr.yep', false, o, special); - assert.deepEqual([ - { yep: false, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: false }} - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('that are equal in length', function(done){ - mpath.set('arr.yep', ['one',2], o, special, function (v) { - return 2 === v ? 20 : v; - }); - assert.deepEqual([ - { yep: 'one', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 20}} - ], o.arr); - - mpath.set('arr.yep', ['one',2], o, special); - assert.deepEqual([ - { yep: 'one', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - done(); - }) - - it('that is less than length', function(done){ - mpath.set('arr.yep', [47], o, special, function (v) { - return 80; - }); - assert.deepEqual([ - { yep: 80, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - mpath.set('arr.yep', [47], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - // add _doc to first element - o.arr[0]._doc = { yep: 46, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } - - mpath.set('arr.yep', [20], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }], _doc: { yep: 20, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 2}} - ], o.arr); - - done(); - }) - - it('that is greater than length', function(done){ - mpath.set('arr.yep', [5,6,7], o, special, function () { - return 'x'; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }], _doc: { yep: 'x', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 'x'}} - ], o.arr); - - mpath.set('arr.yep', [5,6,7], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }], _doc: { yep: 5, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 6}} - ], o.arr); - - done(); - }) - }) - }) - - describe('array.$.path', function(){ - describe('with single non-array value', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', {xtra: 'double good'}, o, special, function (v) { - return 9; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: 9, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 9}} - ], o.arr); - - mpath.set('arr.$.yep', {xtra: 'double good'}, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: {xtra:'double good'}, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: {xtra:'double good'}}} - ], o.arr); - - done(); - }) - }) - describe('with array of values', function(){ - it('copies the value to each item in array', function(done){ - mpath.set('arr.$.yep', [15], o, special, function (v) { - return 'array' - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: 'array', arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 'array'}} - ], o.arr); - - mpath.set('arr.$.yep', [15], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: [15]}} - ], o.arr); - - done(); - }) - }) - }) - - describe('array.index.path', function(){ - it('works', function(done){ - mpath.set('arr.1.yep', 0, o, special, function (v) { - return 1; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 1}} - ], o.arr); - - mpath.set('arr.1.yep', 0, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.e', 35, o, special, function (v) { - return 30 - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 30}, { a: { c: 48 }, e: 30}, { d: 'yep', e: 30 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.e', 35, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 35}, { a: { c: 48 }, e: 35}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.e', ['a','b'], o, special, function (v) { - return 'a' === v ? 'A' : v; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 'A'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.e', ['a','b'], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 47 }, e: 'a'}, { a: { c: 48 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.a.b', 36, o, special, function (v) { - return 20 - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 20 }, e: 'a'}, { a: { c: 48, b: 20 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.a.b', 36, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 36 }, e: 'a'}, { a: { c: 48, b: 36 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.a.b', [1,2,3,4], o, special, function (v) { - return v*2; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 2 }, e: 'a'}, { a: { c: 48, b: 4 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.a.b', [1,2,3,4], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 1 }, e: 'a'}, { a: { c: 48, b: 2 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.index.array.$.path.path', function(){ - it('with single value', function(done){ - mpath.set('arr.0.arr.$.a.b', '$', o, special, function (v) { - return 'dollaz' - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: 'dollaz' }, e: 'a'}, { a: { c: 48, b: 'dollaz' }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', '$', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: '$' }, e: 'a'}, { a: { c: 48, b: '$' }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.0.arr.$.a.b', [1], o, special, function (v) { - return {}; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: {} }, e: 'a'}, { a: { c: 48, b: {} }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.0.arr.$.a.b', [1], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: { b: [1] }, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.array.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.0.a', 'single', o, special, function (v) { - return 88; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 88, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.0.a', 'single', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o, special, function (v) { - return v*2; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 8, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.0.a', [4,8,15,16,23,42], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 4, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.array.$.index.path', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.$.0.a', 'singles', o, special, function (v) { - return v.toUpperCase(); - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'SINGLES', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.$.0.a', 'singles', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'singles', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('$.arr.arr.0.a', 'single', o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: 'single', e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o, special, function (v) { - return Array - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: Array, e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.$.0.a', [4,8,15,16,23,42], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.$.arr.0.a', [4,8,15,16,23,42,108], o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108], e: 'a'}, { a: { c: 48, b: [1] }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('array.array.path.index', function(){ - it('with single value', function(done){ - mpath.set('arr.arr.a.7', 47, o, special, function (v) { - return Object; - }); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,Object], e: 'a'}, { a: { c: 48, b: [1], '7': Object }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.a.7', 47, o, special); - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,47], e: 'a'}, { a: { c: 48, b: [1], '7': 47 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { special: true, yep: 0}} - ], o.arr); - - done(); - }) - it('with array', function(done){ - o.arr[1]._doc.arr = [{ a: [] }, { a: [] }, { a: null }]; - mpath.set('arr.arr.a.7', [[null,46], [undefined, 'woot']], o, special, function (v) { - return undefined === v ? 'nope' : v; - }); - - var a1 = []; - var a2 = []; - a1[7] = 'nope'; - a2[7] = 'woot'; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,null], e: 'a'}, { a: { c: 48, b: [1], '7': 46 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { arr: [{a:a1},{a:a2},{a:null}], special: true, yep: 0}} - ], o.arr); - - mpath.set('arr.arr.a.7', [[null,46], [undefined, 'woot']], o, special); - - a1[7] = undefined; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { yep: [15], arr: [{ a: [4,8,15,16,23,42,108,null], e: 'a'}, { a: { c: 48, b: [1], '7': 46 }, e: 'b'}, { d: 'yep', e: 35 }] } } - , { yep: true, _doc: { arr: [{a:a1},{a:a2},{a:null}], special: true, yep: 0}} - ], o.arr); - - done(); - }) - }) - - describe('handles array.array.path', function(){ - it('with single', function(done){ - o.arr[1]._doc.arr = [{},{}]; - assert.deepEqual([{},{}], o.arr[1]._doc.arr); - o.arr.push({ _doc: { arr: 'something else' }}); - o.arr.push({ _doc: { arr: ['something else'] }}); - o.arr.push({ _doc: { arr: [[]] }}); - o.arr.push({ _doc: { arr: [5] }}); - - // test - mpath.set('arr.arr.e', 47, o, special); - - var weird = []; - weird.e = 47; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { - yep: [15] - , arr: [ - { a: [4,8,15,16,23,42,108,null], e: 47} - , { a: { c: 48, b: [1], '7': 46 }, e: 47} - , { d: 'yep', e: 47 } - ] - } - } - , { yep: true - , _doc: { - arr: [ - {e:47} - , {e:47} - ] - , special: true - , yep: 0 - } - } - , { _doc: { arr: 'something else' }} - , { _doc: { arr: ['something else'] }} - , { _doc: { arr: [weird] }} - , { _doc: { arr: [5] }} - ] - , o.arr); - - done(); - }) - it('with arrays', function(done){ - mpath.set('arr.arr.e', [[1,2,3],[4,5],null,[],[6], [7,8,9]], o, special); - - var weird = []; - weird.e = 6; - - assert.deepEqual([ - { yep: 47, arr: [{ a: { b: 47 }}, { a: { c: 48 }}, { d: 'yep' }] - , _doc: { - yep: [15] - , arr: [ - { a: [4,8,15,16,23,42,108,null], e: 1} - , { a: { c: 48, b: [1], '7': 46 }, e: 2} - , { d: 'yep', e: 3 } - ] - } - } - , { yep: true - , _doc: { - arr: [ - {e:4} - , {e:5} - ] - , special: true - , yep: 0 - } - } - , { _doc: { arr: 'something else' }} - , { _doc: { arr: ['something else'] }} - , { _doc: { arr: [weird] }} - , { _doc: { arr: [5] }} - ] - , o.arr); - - done(); - }) - }) - - }) - - describe('get/set integration', function(){ - var o = doc(); - - it('works', function(done){ - var vals = mpath.get('array.o.array.x.b', o); - - vals[0][0][2] = 10; - vals[1][0][1] = 0; - vals[1][1] = 'Rambaldi'; - vals[1][2] = [12,14]; - vals[2] = [{changed:true}, [null, ['changed','to','array']]]; - - mpath.set('array.o.array.x.b', vals, o); - - var t = [ - { o: { array: [{x: {b: [4,6,10]}}, { y: 10} ] }} - , { o: { array: [{x: {b: [1,0,3]}}, { x: {b:'Rambaldi',z: 10 }}, { x: {b: [12,14]}}] }} - , { o: { array: [{x: {b: {changed:true}}}, { x: { b: [null, ['changed','to','array']]}}]}} - , { o: { array: [{x: null }] }} - , { o: { array: [{y: 3 }] }} - , { o: { array: [3, 0, null] }} - , { o: { name: 'ha' }} - ]; - assert.deepEqual(t, o.array); - done(); - }) - - it('array.prop', function(done){ - mpath.set('comments.name', ['this', 'was', 'changed'], o); - - assert.deepEqual([ - { name: 'this' } - , { name: 'was', _doc: { name: '2' }} - , { name: 'changed' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: '3', comments: [{},{ _doc: { comments: [{ val: 2 }] }}] }} - ], o.comments); - - mpath.set('comments.name', ['also', 'changed', 'this'], o, special); - - assert.deepEqual([ - { name: 'also' } - , { name: 'was', _doc: { name: 'changed' }} - , { name: 'changed' - , comments: [{},{ comments: [{val: 'twoo'}]}] - , _doc: { name: 'this', comments: [{},{ _doc: { comments: [{ val: 2 }] }}] }} - ], o.comments); - - done(); - }) - - }) - - describe('multiple $ use', function(){ - var o = doc(); - it('is ok', function(done){ - assert.doesNotThrow(function () { - mpath.set('arr.$.arr.$.a', 35, o); - }); - done(); - }) - }) - - it('ignores setting a nested path that doesnt exist', function(done){ - var o = doc(); - assert.doesNotThrow(function(){ - mpath.set('thing.that.is.new', 10, o); - }) - done(); - }) - }) - -}) diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/.npmignore b/Databases/node_modules/mongoose/node_modules/mpromise/.npmignore deleted file mode 100644 index e86496f9..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -*.sw* -node_modules/ -.DS_Store -.idea \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/.travis.yml b/Databases/node_modules/mongoose/node_modules/mpromise/.travis.yml deleted file mode 100644 index d63ba095..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/.travis.yml +++ /dev/null @@ -1,5 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.10 - - 0.11 diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/History.md b/Databases/node_modules/mongoose/node_modules/mpromise/History.md deleted file mode 100644 index a64788e8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/History.md +++ /dev/null @@ -1,74 +0,0 @@ -0.5.1 / 2014-01-20 -================== - - * fixed; `end` is much more consistent (especially for `then` chains) - -0.4.4 / 2014-01-20 -================== - - * fixed; `end` is much more consistent (especially for `then` chains) - -0.4.3 / 2013-12-17 -================== - - * fixed; non-A+ behavior on fulfill and reject [lbeschastny](https://github.com/lbeschastny) - * tests; simplified harness + compatible with travis + compatible with windows - -0.5.0 / 2013-12-14 -================== - - * fixed; non-A+ behavior on fulfill and reject [lbeschastny](https://github.com/lbeschastny) - * tests; simplified harness + compatible with travis + compatible with windows - -0.4.2 / 2013-11-26 -================== - - * fixed; enter the domain only if not the present domain - * added; `end` returns the promise - -0.4.1 / 2013-10-26 -================== - - * Add `all` - * Longjohn for easier debugging - * can end a promise chain with an error handler - * Add ```chain``` - -0.4.0 / 2013-10-24 -================== - - * fixed; now plays nice with domains #3 [refack](https://github.com/refack) - * updated; compatibility for Promises A+ 2.0.0 [refack](https://github.com/refack) - * updated; guard against invalid arguments [refack](https://github.com/refack) - -0.3.0 / 2013-07-25 -================== - - * updated; sliced to 0.0.5 - * fixed; then is passed all fulfillment values - * use setImmediate if available - * conform to Promises A+ 1.1 - -0.2.1 / 2013-02-09 -================== - - * fixed; conformancy with A+ 1.2 - -0.2.0 / 2013-01-09 -================== - - * added; .end() - * fixed; only catch handler executions - -0.1.0 / 2013-01-08 -================== - - * cleaned up API - * customizable event names - * docs - -0.0.1 / 2013-01-07 -================== - - * original release - diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/LICENSE b/Databases/node_modules/mongoose/node_modules/mpromise/LICENSE deleted file mode 100644 index 38c529da..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.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/Databases/node_modules/mongoose/node_modules/mpromise/README.md b/Databases/node_modules/mongoose/node_modules/mpromise/README.md deleted file mode 100644 index 2906f563..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/README.md +++ /dev/null @@ -1,224 +0,0 @@ -#mpromise -========== - -[![Build Status](https://travis-ci.org/aheckmann/mpromise.png)](https://travis-ci.org/aheckmann/mpromise) - -A [promises/A+](https://github.com/promises-aplus/promises-spec) conformant implementation, written for [mongoose](http://mongoosejs.com). - -## installation - -``` -$ npm install mpromise -``` - -## docs - -An `mpromise` can be in any of three states, pending, fulfilled (success), or rejected (error). Once it is either fulfilled or rejected it's state can no longer be changed. - -The exports object is the Promise constructor. - -```js -var Promise = require('mpromise'); -``` - -The constructor accepts an optional function which is executed when the promise is first resolved (either fulfilled or rejected). - -```js -var promise = new Promise(fn); -``` - -This is the same as passing the `fn` to `onResolve` directly. - -```js -var promise = new Promise; -promise.onResolve(function (err, args..) { - ... -}); -``` - -### Methods - -####fulfill - -Fulfilling a promise with values: - -```js -var promise = new Promise; -promise.fulfill(args...); -``` - -If the promise has already been fulfilled or rejected, no action is taken. - -####reject - -Rejecting a promise with a reason: - -```js -var promise = new Promise; -promise.reject(reason); -``` - -If the promise has already been fulfilled or rejected, no action is taken. - -####resolve - -Node.js callback style promise resolution `(err, args...)`: - -```js -var promise = new Promise; -promise.resolve([reason], [arg1, arg2, ...]); -``` - -If the promise has already been fulfilled or rejected, no action is taken. - -####onFulfill - -To register a function for execution when the promise is fulfilled, pass it to `onFulfill`. When executed it will receive the arguments passed to `fulfill()`. - -```js -var promise = new Promise; -promise.onFulfill(function (a, b) { - assert.equal(3, a + b); -}); -promise.fulfill(1, 2); -``` - -The function will only be called once when the promise is fulfilled, never when rejected. - -Registering a function with `onFulfill` after the promise has already been fulfilled results in the immediate execution of the function with the original arguments used to fulfill the promise. - -```js -var promise = new Promise; -promise.fulfill(" :D "); -promise.onFulfill(function (arg) { - console.log(arg); // logs " :D " -}) -``` - -####onReject - -To register a function for execution when the promise is rejected, pass it to `onReject`. When executed it will receive the argument passed to `reject()`. - -```js -var promise = new Promise; -promise.onReject(function (reason) { - assert.equal('sad', reason); -}); -promise.reject('sad'); -``` - -The function will only be called once when the promise is rejected, never when fulfilled. - -Registering a function with `onReject` after the promise has already been rejected results in the immediate execution of the function with the original argument used to reject the promise. - -```js -var promise = new Promise; -promise.reject(" :( "); -promise.onReject(function (reason) { - console.log(reason); // logs " :( " -}) -``` - -####onResolve - -Allows registration of node.js style callbacks `(err, args..)` to handle either promise resolution type (fulfill or reject). - -```js -// fulfillment -var promise = new Promise; -promise.onResolve(function (err, a, b) { - console.log(a + b); // logs 3 -}); -promise.fulfill(1, 2); - -// rejection -var promise = new Promise; -promise.onResolve(function (err) { - if (err) { - console.log(err.message); // logs "failed" - } -}); -promise.reject(new Error('failed')); -``` - -####then - -Creates a new promise and returns it. If `onFulfill` or `onReject` are passed, they are added as SUCCESS/ERROR callbacks to this promise after the nextTick. - -Conforms to [promises/A+](https://github.com/promises-aplus/promises-spec) specification and passes its [tests](https://github.com/promises-aplus/promises-tests). - -```js -// promise.then(onFulfill, onReject); - -var p = new Promise; - -p.then(function (arg) { - return arg + 1; -}).then(function (arg) { - throw new Error(arg + ' is an error!'); -}).then(null, function (err) { - assert.ok(err instanceof Error); - assert.equal('2 is an error', err.message); -}); -p.fullfill(1); -``` - -####end - -Signifies that this promise was the last in a chain of `then()s`: if a handler passed to the call to `then` which produced this promise throws, the exception be rethrown. -You can pass an OnReject handler to `end` so that exceptions will be handled (like a final catch clause); -This method returns it's promise for easy use with `return`. - -```js -var p = new Promise; -p.then(function(){ throw new Error('shucks') }); -setTimeout(function () { - p.fulfill(); - // error was caught and swallowed by the promise returned from - // p.then(). we either have to always register handlers on - // the returned promises or we can do the following... -}, 10); - -// this time we use .end() which prevents catching thrown errors -var p = new Promise; -setTimeout(function () { - p.fulfill(); // throws "shucks" -}, 10); -return p.then(function(){ throw new Error('shucks') }).end(); // <-- -``` - - -### chain - -Allows direct promise to promise chaining (especially useful by a outside aggregating function). It doesn't use the asynchronous `resolve` algorithm and so excepts only another Promise as it's argument. - -```js -function makeMeAPromise(i) { - var p = new Promise; - p.fulfill(i); - return p; -} - -var returnPromise = initialPromise = new Promise; -for (i=0; i<10; ++i) - returnPromise = returnPromise.chain(makeMeAPromise(i)); - -initialPromise.fulfill(); -return returnPromise; -``` - -###Event names - -If you'd like to alter this implementations event names used to signify success and failure you may do so by setting `Promise.SUCCESS` or `Promise.FAILURE` respectively. - -```js -Promise.SUCCESS = 'complete'; -Promise.FAILURE = 'err'; -``` - -###Luke, use the Source -For more ideas read the [source](https://github.com/aheckmann/mpromise/blob/master/lib), [tests](https://github.com/aheckmann/mpromise/blob/master/test), or the [mongoose implementation](https://github.com/LearnBoost/mongoose/blob/3.6x/lib/promise.js). - -## license - -[MIT](https://github.com/aheckmann/mpromise/blob/master/LICENSE) diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/lib/promise.js b/Databases/node_modules/mongoose/node_modules/mpromise/lib/promise.js deleted file mode 100644 index ff2768f1..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/lib/promise.js +++ /dev/null @@ -1,440 +0,0 @@ -'use strict'; -var util = require('util'); -var EventEmitter = require('events').EventEmitter; -function toArray(arr, start, end) { - return Array.prototype.slice.call(arr, start, end) -} -function strongUnshift(x, arrLike) { - var arr = toArray(arrLike); - arr.unshift(x); - return arr; -} - - -/** - * Promise constructor. - * - * _NOTE: The success and failure event names can be overridden by setting `Promise.SUCCESS` and `Promise.FAILURE` respectively._ - * - * @param {Function} back a function that accepts `fn(err, ...){}` as signature - * @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter - * @event `reject`: Emits when the promise is rejected (event name may be overridden) - * @event `fulfill`: Emits when the promise is fulfilled (event name may be overridden) - * @api public - */ -function Promise(back) { - this.emitter = new EventEmitter(); - this.emitted = {}; - this.ended = false; - if ('function' == typeof back) - this.onResolve(back); -} - - -/* - * Module exports. - */ -module.exports = Promise; - - -/*! - * event names - */ -Promise.SUCCESS = 'fulfill'; -Promise.FAILURE = 'reject'; - - -/** - * Adds `listener` to the `event`. - * - * If `event` is either the success or failure event and the event has already been emitted, the`listener` is called immediately and passed the results of the original emitted event. - * - * @param {String} event - * @param {Function} callback - * @return {Promise} this - * @api private - */ -Promise.prototype.on = function (event, callback) { - if (this.emitted[event]) - callback.apply(undefined, this.emitted[event]); - else - this.emitter.on(event, callback); - - return this; -}; - - -/** - * Keeps track of emitted events to run them on `on`. - * - * @api private - */ -Promise.prototype.safeEmit = function (event) { - // ensures a promise can't be fulfill() or reject() more than once - if (event == Promise.SUCCESS || event == Promise.FAILURE) { - if (this.emitted[Promise.SUCCESS] || this.emitted[Promise.FAILURE]) { - return this; - } - this.emitted[event] = toArray(arguments, 1); - } - - this.emitter.emit.apply(this.emitter, arguments); - return this; -}; - - -/** - * Fulfills this promise with passed arguments. - * - * If this promise has already been fulfilled or rejected, no action is taken. - * - * @api public - */ -Promise.prototype.fulfill = function () { - return this.safeEmit.apply(this, strongUnshift(Promise.SUCCESS, arguments)); -}; - - -/** - * Rejects this promise with `reason`. - * - * If this promise has already been fulfilled or rejected, no action is taken. - * - * @api public - * @param {Object|String} reason - * @return {Promise} this - */ -Promise.prototype.reject = function (reason) { - if (this.ended && !this.hasRejectListeners()) throw reason; - return this.safeEmit(Promise.FAILURE, reason); -}; - - -/** - * Resolves this promise to a rejected state if `err` is passed or - * fulfilled state if no `err` is passed. - * - * @param {Error} [err] error or null - * @param {Object} [val] value to fulfill the promise with - * @api public - */ -Promise.prototype.resolve = function (err, val) { - if (err) return this.reject(err); - return this.fulfill(val); -}; - - -/** - * Adds a listener to the SUCCESS event. - * - * @return {Promise} this - * @api public - */ -Promise.prototype.onFulfill = function (fn) { - if (!fn) return this; - if ('function' != typeof fn) throw new TypeError("fn should be a function"); - return this.on(Promise.SUCCESS, fn); -}; - - -Promise.prototype.hasRejectListeners = function () { - return this.emitter.listeners(Promise.FAILURE).length > 0; -}; - - -/** - * Adds a listener to the FAILURE event. - * - * @return {Promise} this - * @api public - */ -Promise.prototype.onReject = function (fn) { - if (!fn) return this; - if ('function' != typeof fn) throw new TypeError("fn should be a function"); - return this.on(Promise.FAILURE, fn); -}; - - -/** - * Adds a single function as a listener to both SUCCESS and FAILURE. - * - * It will be executed with traditional node.js argument position: - * function (err, args...) {} - * - * Also marks the promise as `end`ed, since it's the common use-case, and yet has no - * side effects unless `fn` is undefined or null. - * - * @param {Function} fn - * @return {Promise} this - */ -Promise.prototype.onResolve = function (fn) { - this.end(); - if (!fn) return this; - if ('function' != typeof fn) throw new TypeError("fn should be a function"); - this.on(Promise.FAILURE, function (err) { fn.call(this, err); }); - this.on(Promise.SUCCESS, function () { fn.apply(this, strongUnshift(null, arguments)); }); - return this; -}; - - -/** - * Creates a new promise and returns it. If `onFulfill` or - * `onReject` are passed, they are added as SUCCESS/ERROR callbacks - * to this promise after the next tick. - * - * Conforms to [promises/A+](https://github.com/promises-aplus/promises-spec) specification. Read for more detail how to use this method. - * - * ####Example: - * - * var p = new Promise; - * p.then(function (arg) { - * return arg + 1; - * }).then(function (arg) { - * throw new Error(arg + ' is an error!'); - * }).then(null, function (err) { - * assert.ok(err instanceof Error); - * assert.equal('2 is an error', err.message); - * }); - * p.complete(1); - * - * @see promises-A+ https://github.com/promises-aplus/promises-spec - * @param {Function} onFulfill - * @param {Function} [onReject] - * @return {Promise} newPromise - */ -Promise.prototype.then = function (onFulfill, onReject) { - var newPromise = new Promise; - - if ('function' == typeof onFulfill) { - this.onFulfill(handler(newPromise, onFulfill)); - } else { - this.onFulfill(newPromise.fulfill.bind(newPromise)); - } - - if ('function' == typeof onReject) { - this.onReject(handler(newPromise, onReject)); - } else { - this.onReject(newPromise.reject.bind(newPromise)); - } - - return newPromise; -}; - - -function handler(promise, fn) { - function newTickHandler() { - var pDomain = promise.emitter.domain; - if (pDomain && pDomain !== process.domain) pDomain.enter(); - try { - var x = fn.apply(undefined, boundHandler.args); - } catch (err) { - promise.reject(err); - return; - } - resolve(promise, x); - } - function boundHandler() { - boundHandler.args = arguments; - process.nextTick(newTickHandler); - } - return boundHandler; -} - - -function resolve(promise, x) { - function fulfillOnce() { - if (done++) return; - resolve.apply(undefined, strongUnshift(promise, arguments)); - } - function rejectOnce(reason) { - if (done++) return; - promise.reject(reason); - } - - if (promise === x) { - promise.reject(new TypeError("promise and x are the same")); - return; - } - var rest = toArray(arguments, 1); - var type = typeof x; - if ('undefined' == type || null == x || !('object' == type || 'function' == type)) { - promise.fulfill.apply(promise, rest); - return; - } - - try { - var theThen = x.then; - } catch (err) { - promise.reject(err); - return; - } - - if ('function' != typeof theThen) { - promise.fulfill.apply(promise, rest); - return; - } - - var done = 0; - try { - var ret = theThen.call(x, fulfillOnce, rejectOnce); - return ret; - } catch (err) { - if (done++) return; - promise.reject(err); - } -} - - -/** - * Signifies that this promise was the last in a chain of `then()s`: if a handler passed to the call to `then` which produced this promise throws, the exception will go uncaught. - * - * ####Example: - * - * var p = new Promise; - * p.then(function(){ throw new Error('shucks') }); - * setTimeout(function () { - * p.fulfill(); - * // error was caught and swallowed by the promise returned from - * // p.then(). we either have to always register handlers on - * // the returned promises or we can do the following... - * }, 10); - * - * // this time we use .end() which prevents catching thrown errors - * var p = new Promise; - * var p2 = p.then(function(){ throw new Error('shucks') }).end(); // <-- - * setTimeout(function () { - * p.fulfill(); // throws "shucks" - * }, 10); - * - * @api public - * @param {Function} [onReject] - * @return {Promise} this - */ -Promise.prototype.end = function (onReject) { - this.onReject(onReject); - this.ended = true; - return this; -}; - - -/** - * A debug utility function that adds handlers to a promise that will log some output to the `console` - * - * ####Example: - * - * var p = new Promise; - * p.then(function(){ throw new Error('shucks') }); - * setTimeout(function () { - * p.fulfill(); - * // error was caught and swallowed by the promise returned from - * // p.then(). we either have to always register handlers on - * // the returned promises or we can do the following... - * }, 10); - * - * // this time we use .end() which prevents catching thrown errors - * var p = new Promise; - * var p2 = p.then(function(){ throw new Error('shucks') }).end(); // <-- - * setTimeout(function () { - * p.fulfill(); // throws "shucks" - * }, 10); - * - * @api public - * @param {Promise} p - * @param {String} name - * @return {Promise} this - */ -Promise.trace = function (p, name) { - p.then( - function () { - console.log("%s fulfill %j", name, toArray(arguments)); - }, - function () { - console.log("%s reject %j", name, toArray(arguments)); - } - ) -}; - - -Promise.prototype.chain = function (p2) { - var p1 = this; - p1.onFulfill(p2.fulfill.bind(p2)); - p1.onReject(p2.reject.bind(p2)); - return p2; -}; - - -Promise.prototype.all = function (promiseOfArr) { - var pRet = new Promise; - this.then(promiseOfArr).then( - function (promiseArr) { - var count = 0; - var ret = []; - var errSentinel; - if (!promiseArr.length) pRet.resolve(); - promiseArr.forEach(function (promise, index) { - if (errSentinel) return; - count++; - promise.then( - function (val) { - if (errSentinel) return; - ret[index] = val; - --count; - if (count == 0) pRet.fulfill(ret); - }, - function (err) { - if (errSentinel) return; - errSentinel = err; - pRet.reject(err); - } - ); - }); - return pRet; - } - , pRet.reject.bind(pRet) - ); - return pRet; -}; - - -Promise.hook = function (arr) { - var p1 = new Promise; - var pFinal = new Promise; - var signalP = function () { - --count; - if (count == 0) - pFinal.fulfill(); - return pFinal; - }; - var count = 1; - var ps = p1; - arr.forEach(function (hook) { - ps = ps.then( - function () { - var p = new Promise; - count++; - hook(p.resolve.bind(p), signalP); - return p; - } - ) - }); - ps = ps.then(signalP); - p1.resolve(); - return ps; -}; - - -/* This is for the A+ tests, but it's very useful as well */ -Promise.fulfilled = function fulfilled() { var p = new Promise; p.fulfill.apply(p, arguments); return p; }; -Promise.rejected = function rejected(reason) { return new Promise().reject(reason); }; -Promise.deferred = function deferred() { - var p = new Promise; - return { - promise: p, - reject: p.reject.bind(p), - resolve: p.fulfill.bind(p), - callback: p.resolve.bind(p) - } -}; -/* End A+ tests adapter bit */ - - diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/package.json b/Databases/node_modules/mongoose/node_modules/mpromise/package.json deleted file mode 100644 index 3f07a93b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "name": "mpromise", - "version": "0.5.4", - "publishConfig": { - "tag": "beta" - }, - "description": "Promises A+ conformant implementation", - "main": "lib/promise.js", - "scripts": { - "test": "mocha" - }, - "devDependencies": { - "promises-aplus-tests": "2.0.3", - "mocha": "1.17.1" - }, - "repository": { - "type": "git", - "url": "git://github.com/aheckmann/mpromise" - }, - "keywords": [ - "promise", - "mongoose", - "aplus", - "a+", - "plus" - ], - "author": { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - "license": "MIT", - "bugs": { - "url": "https://github.com/aheckmann/mpromise/issues" - }, - "homepage": "https://github.com/aheckmann/mpromise", - "_id": "mpromise@0.5.4", - "dist": { - "shasum": "b610613ec6de37419f944b35f0783b4de9f5dc75", - "tarball": "http://registry.npmjs.org/mpromise/-/mpromise-0.5.4.tgz" - }, - "_from": "mpromise@0.5.4", - "_npmVersion": "1.3.26", - "_npmUser": { - "name": "refack", - "email": "refael@empeeric.com" - }, - "maintainers": [ - { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - }, - { - "name": "refack", - "email": "refael@empeeric.com" - } - ], - "directories": {}, - "_shasum": "b610613ec6de37419f944b35f0783b4de9f5dc75", - "_resolved": "https://registry.npmjs.org/mpromise/-/mpromise-0.5.4.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js b/Databases/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js deleted file mode 100644 index a6a6be74..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/test/promise.domain.test.js +++ /dev/null @@ -1,28 +0,0 @@ -var Promise = require('../') - , Domain = require('domain').Domain - , assert = require('assert'); - - -describe("domains", function () { - it("exceptions should not breakout of domain boundaries", function (done) { - if (process.version.indexOf('v0.10') != 0) return done(); - var d = new Domain; - d.on('error', function (err) { - assert.equal(err.message, 'gaga'); - done() - }); - - var p = new Promise(); - d.run(function () { - p.then( - function () {} - ).then( - function () { throw new Error('gaga'); } - ).end(); - }); - - process.nextTick(function () { - p.fulfill(); - }); - }); -}); diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/test/promise.test.js b/Databases/node_modules/mongoose/node_modules/mpromise/test/promise.test.js deleted file mode 100644 index 30be6903..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/test/promise.test.js +++ /dev/null @@ -1,554 +0,0 @@ -/*global describe,it */ -/** - * Module dependencies. - */ - -var assert = require('assert'); -var Promise = require('../'); - -/** - * Test. - */ - -describe('promise', function () { - it('events fire right after fulfill()', function (done) { - var promise = new Promise() - , called = 0; - - promise.on('fulfill', function (a, b) { - assert.equal(a, '1'); - assert.equal(b, '2'); - called++; - }); - - promise.fulfill('1', '2'); - - promise.on('fulfill', function (a, b) { - assert.equal(a, '1'); - assert.equal(b, '2'); - called++; - }); - - assert.equal(2, called); - done(); - }); - - it('events fire right after reject()', function (done) { - var promise = new Promise() - , called = 0; - - promise.on('reject', function (err) { - assert.ok(err instanceof Error); - called++; - }); - - promise.reject(new Error('booyah')); - - promise.on('reject', function (err) { - assert.ok(err instanceof Error); - called++; - }); - - assert.equal(2, called); - done() - }); - - describe('onResolve()', function () { - it('from constructor works', function (done) { - var called = 0; - - var promise = new Promise(function (err) { - assert.ok(err instanceof Error); - called++; - }); - - promise.reject(new Error('dawg')); - - assert.equal(1, called); - done(); - }); - - it('after fulfill()', function (done) { - var promise = new Promise() - , called = 0; - - promise.fulfill('woot'); - - promise.onResolve(function (err, data) { - assert.equal(data, 'woot'); - called++; - }); - - promise.onResolve(function (err) { - assert.strictEqual(err, null); - called++; - }); - - assert.equal(2, called); - done(); - }) - }); - - describe('onFulfill shortcut', function () { - it('works', function (done) { - var promise = new Promise() - , called = 0; - - promise.onFulfill(function (woot) { - assert.strictEqual(woot, undefined); - called++; - }); - - promise.fulfill(); - - assert.equal(1, called); - done(); - }); - }); - - describe('onReject shortcut', function () { - it('works', function (done) { - var promise = new Promise() - , called = 0; - - promise.onReject(function (err) { - assert.ok(err instanceof Error); - called++; - }); - - promise.reject(new Error); - assert.equal(1, called); - done(); - }) - }); - - describe('return values', function () { - it('on()', function (done) { - var promise = new Promise(); - assert.ok(promise.on('jump', function () {}) instanceof Promise); - done() - }); - - it('onFulfill()', function (done) { - var promise = new Promise(); - assert.ok(promise.onFulfill(function () {}) instanceof Promise); - done(); - }); - it('onReject()', function (done) { - var promise = new Promise(); - assert.ok(promise.onReject(function () {}) instanceof Promise); - done(); - }); - it('onResolve()', function (done) { - var promise = new Promise(); - assert.ok(promise.onResolve(function () {}) instanceof Promise); - done(); - }) - }); - - describe('casting errors', function () { - describe('reject()', function () { - it('does not cast arguments to Error', function (done) { - var p = new Promise(function (err) { - assert.equal(3, err); - done(); - }); - - p.reject(3); - }) - }) - }); - - describe('then', function () { - describe('catching', function () { - it('should not catch returned promise fulfillments', function (done) { - var errorSentinal - , p = new Promise; - p.then(function () { throw errorSentinal = new Error("boo!") }); - - p.fulfill(); - done(); - }); - - - it('should not catch returned promise fulfillments even async', function (done) { - var errorSentinal - , p = new Promise; - p.then(function () { throw errorSentinal = new Error("boo!") }); - - setTimeout(function () { - p.fulfill(); - done(); - }, 10); - }); - - - it('can be disabled using .end()', function (done) { - if (process.version.indexOf('v0.8') == 0) return done(); - var errorSentinal - , overTimeout - , domain = require('domain').create(); - - domain.once('error', function (err) { - assert(err, errorSentinal); - clearTimeout(overTimeout); - done() - }); - - domain.run(function () { - var p = new Promise; - var p2 = p.then(function () { - throw errorSentinal = new Error('shucks') - }); - p2.end(); - - p.fulfill(); - }); - overTimeout = setTimeout(function () { done(new Error('error was swallowed')); }, 10); - }); - - - it('can be disabled using .end() even when async', function (done) { - if (process.version.indexOf('v0.10') != 0) return done(); - var errorSentinal - , overTimeout - , domain = require('domain').create(); - - domain.on('error', function (err) { - assert(err, errorSentinal); - clearTimeout(overTimeout); - done() - }); - - domain.run(function () { - var p = new Promise; - var p2 = p.then(function () { - throw errorSentinal = new Error("boo!") - }); - p2.end(); - - setTimeout(function () {p.fulfill();}, 10); - }); - overTimeout = setTimeout(function () { done(new Error('error was swallowed')); }, 20); - }); - - - it('can be handled using .end() so no throwing', function (done) { - var errorSentinal - , overTimeout - , domain = require('domain').create(); - - domain.run(function () { - var p = new Promise; - var p2 = p.then(function () { - throw errorSentinal = new Error("boo!") - }); - p2.end(function (err) { - assert.equal(err, errorSentinal); - clearTimeout(overTimeout); - done() - }); - - setTimeout(function () {p.fulfill();}, 10); - }); - overTimeout = setTimeout(function () { done(new Error('error was swallowed')); }, 20); - }); - - }); - - it('persistent', function (done) { - var p = new Promise; - v = null; - - function ensure(val) { - v = v || val; - assert.equal(v, val); - } - - function guard() { - throw new Error('onReject should not be called'); - } - - p.then(ensure, guard).end(); - - p.fulfill('foo'); - p.fulfill('bar'); - p.reject(new Error('baz')); - - p.then(ensure, guard).end(); - - setTimeout(done, 0); - }); - - - it('accepts multiple completion values', function (done) { - var p = new Promise; - - p.then(function (a, b) { - assert.equal(2, arguments.length); - assert.equal('hi', a); - assert.equal(4, b); - done(); - }, done).end(); - - p.fulfill('hi', 4); - }) - }); - - describe('fulfill values and splats', function () { - it('should handle multiple values', function (done) { - var p = new Promise; - p.onFulfill(function (a, b, c) { - assert.equal('a', a); - assert.equal('b', b); - assert.equal('c', c); - done(); - }); - p.fulfill('a', 'b', 'c'); - }); - - it('should handle multiple values from a then', function (done) { - Promise.fulfilled().then( - function () { - return Promise.fulfilled().then( - function () { - var p = new Promise; - p.fulfill('a', 'b', 'c'); - return p; - } - ); - } - ).onFulfill( - function (a, b, c) { - assert.equal('a', a); - assert.equal('b', b); - assert.equal('c', c); - done(); - } - ).end() - }); - - it('should work with `fulfilled` convenience method', function (done) { - Promise.fulfilled('a', 'b', 'c').then(function (a, b, c) { - assert.equal('a', a); - assert.equal('b', b); - assert.equal('c', c); - done(); - }) - }); - }); - - - describe('end', function () { - it("should return the promise", function (done) { - var p = new Promise; - var p1 = p.end(); - assert.equal(p, p1); - done(); - }); - - - it("should throw for chain", function (done) { - var p = new Promise; - p.then().then().then().then().end(); - try { - p.reject('bad'); - } catch (e) { - done(); - } - }); - - - it("should not throw for chain with reject handler", function (done) { - var p = new Promise; - p.then().then().then().then().end(function () { - done(); - }); - try { - p.reject('bad'); - } catch (e) { - done(e); - } - }); - }); - - - describe('chain', function () { - it('should propagate fulfillment', function (done) { - var varSentinel = {a: 'a'}; - var p1 = new Promise; - p1.chain(new Promise(function (err, doc) { - assert.equal(doc, varSentinel); - done(); - })); - p1.fulfill(varSentinel); - }); - - - it('should propagate rejection', function (done) { - var e = new Error("gaga"); - var p1 = new Promise; - p1.chain(new Promise(function (err) { - assert.equal(err, e); - done(); - })); - p1.reject(e); - }); - - - it('should propagate resolution err', function (done) { - var e = new Error("gaga"); - var p1 = new Promise; - p1.chain(new Promise(function (err) { - assert.equal(err, e); - done(); - })); - p1.resolve(e); - }); - - - it('should propagate resolution val', function (done) { - var varSentinel = {a: 'a'}; - var p1 = new Promise; - p1.chain(new Promise(function (err, val) { - assert.equal(val, varSentinel); - done(); - })); - p1.resolve(null, varSentinel); - }) - }); - - - describe("all", function () { - it("works", function (done) { - var count = 0; - var p = new Promise; - var p2 = p.all(function () { - return [ - (function () { - var p = new Promise(); - count++; - p.resolve(); - return p; - })() - , (function () { - var p = new Promise(); - count++; - p.resolve(); - return p; - })() - ]; - }); - p2.then(function () { - assert.equal(count, 2); - done(); - }); - p.resolve(); - }); - - - it("handles rejects", function (done) { - var count = 0; - var p = new Promise; - var p2 = p.all(function () { - return [ - (function () { - var p = new Promise(); - count++; - p.resolve(); - return p; - })() - , (function () { - count++; - throw new Error("gaga"); - })() - ]; - }); - p2.onReject(function (err) { - assert(err.message, "gaga"); - assert.equal(count, 2); - done(); - }); - p.resolve(); - }); - }); - - - describe("deferred", function () { - it("works", function (done) { - var d = Promise.deferred(); - assert.ok(d.promise instanceof Promise); - assert.ok(d.reject instanceof Function); - assert.ok(d.resolve instanceof Function); - assert.ok(d.callback instanceof Function); - done(); - }); - }); - - - describe("hook", function () { - it("works", function (done) { - var run = 0; - var l1 = function (ser, par) { - run++; - ser(); - par(); - }; - Promise.hook([l1, l1, l1]).then(function () { - assert(run, 3); - done(); - }) - - }); - - - it("works with async serial hooks", function (done) { - this.timeout(800); - var run = 0; - var l1 = function (ser, par) { - run++; - setTimeout(function () {ser();}, 200); - par(); - }; - Promise.hook([l1, l1, l1]).then(function () { - assert(run, 3); - done(); - }) - }); - - - it("works with async parallel hooks", function (done) { - this.timeout(400); - var run = 0; - var l1 = function (ser, par) { - run++; - ser(); - setTimeout(function () {par();}, 200); - }; - Promise.hook([l1, l1, l1]).then(function () { - assert(run, 3); - done(); - }) - }); - - - it("catches errors in hook logic", function (done) { - var run = 0; - var l1 = function (ser, par) { - run++; - ser(); - par(); - }; - var l2 = function (ser, par) { - run++; - ser(); - par(); - throw new Error("err") - }; - Promise.hook([l1, l2, l1]).end(function (err) { - assert(run, 2); - done(); - }); - }); - }); -}); diff --git a/Databases/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js b/Databases/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js deleted file mode 100644 index d30bb32c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mpromise/test/promises.Aplus.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Module dependencies. - */ -var Promise = require('../lib/promise'); -var aplus = require('promises-aplus-tests'); - -// tests -describe("run A+ suite", function () { - aplus.mocha({ - fulfilled: Promise.fulfilled, - rejected: Promise.rejected, - deferred: Promise.deferred - }); -}); - diff --git a/Databases/node_modules/mongoose/node_modules/mquery/.npmignore b/Databases/node_modules/mongoose/node_modules/mquery/.npmignore deleted file mode 100644 index 5a14ae1e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -*.sw* -node_modules/ -coverage/ diff --git a/Databases/node_modules/mongoose/node_modules/mquery/.travis.yml b/Databases/node_modules/mongoose/node_modules/mquery/.travis.yml deleted file mode 100644 index 4dc3a7d4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: node_js -node_js: - - 0.8 - - 0.10 - - 0.11 -services: - - mongodb diff --git a/Databases/node_modules/mongoose/node_modules/mquery/History.md b/Databases/node_modules/mongoose/node_modules/mquery/History.md deleted file mode 100644 index 99726648..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/History.md +++ /dev/null @@ -1,230 +0,0 @@ - -1.6.2 / 2015-07-12 -================== - - * fixed; support exec cb being called synchronously #66 - -1.6.1 / 2015-06-16 -================== - - * fixed; do not treat $meta projection as inclusive [vkarpov15](https://github.com/vkarpov15) - -1.6.0 / 2015-05-27 -================== - - * update dependencies #65 [bachp](https://github.com/bachp) - -1.5.0 / 2015-03-31 -================== - - * fixed; debug output - * fixed; allow hint usage with count #61 [trueinsider](https://github.com/trueinsider) - -1.4.0 / 2015-03-29 -================== - - * added; object support to slice() #60 [vkarpov15](https://github.com/vkarpov15) - * debug; improved output #57 [flyvictor](https://github.com/flyvictor) - -1.3.0 / 2014-11-06 -================== - - * added; setTraceFunction() #53 from [jlai](https://github.com/jlai) - -1.2.1 / 2014-09-26 -================== - - * fixed; distinct assignment in toConstructor() #51 from [esco](https://github.com/esco) - -1.2.0 / 2014-09-18 -================== - - * added; stream() support for find() - -1.1.0 / 2014-09-15 -================== - - * add #then for co / koa support - * start checking code coverage - -1.0.0 / 2014-07-07 -================== - - * Remove broken require() calls until they're actually implemented #48 [vkarpov15](https://github.com/vkarpov15) - -0.9.0 / 2014-05-22 -================== - - * added; thunk() support - * release 0.8.0 - -0.8.0 / 2014-05-15 -================== - - * added; support for maxTimeMS #44 [yoitsro](https://github.com/yoitsro) - * updated; devDependency (driver to 1.4.4) - -0.7.0 / 2014-05-02 -================== - - * fixed; pass $maxDistance in $near object as described in docs #43 [vkarpov15](https://github.com/vkarpov15) - * fixed; cloning buffers #42 [gjohnson](https://github.com/gjohnson) - * tests; a little bit more `mongodb` agnostic #34 [refack](https://github.com/refack) - -0.6.0 / 2014-04-01 -================== - - * fixed; Allow $meta args in sort() so text search sorting works #37 [vkarpov15](https://github.com/vkarpov15) - -0.5.3 / 2014-02-22 -================== - - * fixed; cloning mongodb.Binary - -0.5.2 / 2014-01-30 -================== - - * fixed; cloning ObjectId constructors - * fixed; cloning of ReadPreferences #30 [ashtuchkin](https://github.com/ashtuchkin) - * tests; use specific mongodb version #29 [AvianFlu](https://github.com/AvianFlu) - * tests; remove dependency on ObjectId #28 [refack](https://github.com/refack) - * tests; add failing ReadPref test - -0.5.1 / 2014-01-17 -================== - - * added; deprecation notice to tags parameter #27 [ashtuchkin](https://github.com/ashtuchkin) - * readme; add links - -0.5.0 / 2014-01-16 -================== - - * removed; mongodb driver dependency #26 [ashtuchkin](https://github.com/ashtuchkin) - * removed; first class support of read preference tags #26 (still supported though) [ashtuchkin](https://github.com/ashtuchkin) - * added; better ObjectId clone support - * fixed; cloning objects that have no constructor #21 - * docs; cleaned up [ashtuchkin](https://github.com/ashtuchkin) - -0.4.2 / 2014-01-08 -================== - - * updated; debug module 0.7.4 [refack](https://github.com/refack) - -0.4.1 / 2014-01-07 -================== - - * fixed; inclusive/exclusive logic - -0.4.0 / 2014-01-06 -================== - - * added; selected() - * added; selectedInclusively() - * added; selectedExclusively() - -0.3.3 / 2013-11-14 -================== - - * Fix Mongo DB Dependency #20 [rschmukler](https://github.com/rschmukler) - -0.3.2 / 2013-09-06 -================== - - * added; geometry support for near() - -0.3.1 / 2013-08-22 -================== - - * fixed; update retains key order #19 - -0.3.0 / 2013-08-22 -================== - - * less hardcoded isNode env detection #18 [vshulyak](https://github.com/vshulyak) - * added; validation of findAndModify varients - * clone update doc before execution - * stricter env checks - -0.2.7 / 2013-08-2 -================== - - * Now support GeoJSON point values for Query#near - -0.2.6 / 2013-07-30 -================== - - * internally, 'asc' and 'desc' for sorts are now converted into 1 and -1, respectively - -0.2.5 / 2013-07-30 -================== - - * updated docs - * changed internal representation of `sort` to use objects instead of arrays - -0.2.4 / 2013-07-25 -================== - - * updated; sliced to 0.0.5 - -0.2.3 / 2013-07-09 -================== - - * now using a callback in collection.find instead of directly calling toArray() on the cursor [ebensing](https://github.com/ebensing) - -0.2.2 / 2013-07-09 -================== - - * now exposing mongodb export to allow for better testing [ebensing](https://github.com/ebensing) - -0.2.1 / 2013-07-08 -================== - - * select no longer accepts arrays as parameters [ebensing](https://github.com/ebensing) - -0.2.0 / 2013-07-05 -================== - - * use $geoWithin by default - -0.1.2 / 2013-07-02 -================== - - * added use$geoWithin flag [ebensing](https://github.com/ebensing) - * fix read preferences typo [ebensing](https://github.com/ebensing) - * fix reference to old param name in exists() [ebensing](https://github.com/ebensing) - -0.1.1 / 2013-06-24 -================== - - * fixed; $intersects -> $geoIntersects #14 [ebensing](https://github.com/ebensing) - * fixed; Retain key order when copying objects #15 [ebensing](https://github.com/ebensing) - * bump mongodb dev dep - -0.1.0 / 2013-05-06 -================== - - * findAndModify; return the query - * move mquery.proto.canMerge to mquery.canMerge - * overwrite option now works with non-empty objects - * use strict mode - * validate count options - * validate distinct options - * add aggregate to base collection methods - * clone merge arguments - * clone merged update arguments - * move subclass to mquery.prototype.toConstructor - * fixed; maxScan casing - * use regexp-clone - * added; geometry/intersects support - * support $and - * near: do not use "radius" - * callbacks always fire on next turn of loop - * defined collection interface - * remove time from tests - * clarify goals - * updated docs; - -0.0.1 / 2012-12-15 -================== - - * initial release diff --git a/Databases/node_modules/mongoose/node_modules/mquery/LICENSE b/Databases/node_modules/mongoose/node_modules/mquery/LICENSE deleted file mode 100644 index 38c529da..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -(The MIT License) - -Copyright (c) 2012 [Aaron Heckmann](aaron.heckmann+github@gmail.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/Databases/node_modules/mongoose/node_modules/mquery/Makefile b/Databases/node_modules/mongoose/node_modules/mquery/Makefile deleted file mode 100644 index dbb28318..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/Makefile +++ /dev/null @@ -1,22 +0,0 @@ - -test: - @NODE_ENV=test ./node_modules/.bin/mocha $(T) $(TESTS) - -test-cov: - @NODE_ENV=test node \ - node_modules/.bin/istanbul cover \ - ./node_modules/.bin/_mocha \ - -- -u exports \ - -open-cov: - open coverage/lcov-report/index.html - -test-travis: - @NODE_ENV=test node \ - node_modules/.bin/istanbul cover \ - ./node_modules/.bin/_mocha \ - --report lcovonly \ - -- -u exports \ - --bail - -.PHONY: test test-cov open-cov test-travis diff --git a/Databases/node_modules/mongoose/node_modules/mquery/README.md b/Databases/node_modules/mongoose/node_modules/mquery/README.md deleted file mode 100644 index f7bf7f44..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/README.md +++ /dev/null @@ -1,1220 +0,0 @@ -#mquery -=========== - -`mquery` is a fluent mongodb query builder designed to run in multiple environments. As of v0.1, `mquery` runs on `Node.js` only with support for the MongoDB shell and browser environments planned for upcoming releases. - -##Features - - - fluent query builder api - - custom base query support - - MongoDB 2.4 geoJSON support - - method + option combinations validation - - node.js driver compatibility - - environment detection - - [debug](https://github.com/visionmedia/debug) support - - separated collection implementations for maximum flexibility - -[![Build Status](https://travis-ci.org/aheckmann/mquery.png)](https://travis-ci.org/aheckmann/mquery) - -##Use - -```js -require('mongodb').connect(uri, function (err, db) { - if (err) return handleError(err); - - // get a collection - var collection = db.collection('artists'); - - // pass it to the constructor - mquery(collection).find({..}, callback); - - // or pass it to the collection method - mquery().find({..}).collection(collection).exec(callback) - - // or better yet, create a custom query constructor that has it always set - var Artist = mquery(collection).toConstructor(); - Artist().find(..).where(..).exec(callback) -}) -``` - -`mquery` requires a collection object to work with. In the example above we just pass the collection object created using the official [MongoDB driver](https://github.com/mongodb/node-mongodb-native). - - -##Fluent API - -- [find](#find) -- [findOne](#findOne) -- [count](#count) -- [remove](#remove) -- [update](#update) -- [findOneAndUpdate](#findoneandupdate) -- [findOneAndRemove](#findoneandremove) -- [distinct](#distinct) -- [exec](#exec) -- [stream](#stream) -- [all](#all) -- [and](#and) -- [box](#box) -- [circle](#circle) -- [elemMatch](#elemmatch) -- [equals](#equals) -- [exists](#exists) -- [geometry](#geometry) -- [gt](#gt) -- [gte](#gte) -- [in](#in) -- [intersects](#intersects) -- [lt](#lt) -- [lte](#lte) -- [maxDistance](#maxdistance) -- [mod](#mod) -- [ne](#ne) -- [nin](#nin) -- [nor](#nor) -- [near](#near) -- [or](#or) -- [polygon](#polygon) -- [regex](#regex) -- [select](#select) -- [selected](#selected) -- [selectedInclusively](#selectedinclusively) -- [selectedExclusively](#selectedexclusively) -- [size](#size) -- [slice](#slice) -- [within](#within) -- [where](#where) -- [$where](#where-1) -- [batchSize](#batchsize) -- [comment](#comment) -- [hint](#hint) -- [limit](#limit) -- [maxScan](#maxscan) -- [maxTime](#maxtime) -- [skip](#skip) -- [sort](#sort) -- [read](#read) -- [slaveOk](#slaveok) -- [snapshot](#snapshot) -- [tailable](#tailable) - -## Helpers - -- [collection](#collection) -- [then](#then) -- [thunk](#thunk) -- [merge](#mergeobject) -- [setOptions](#setoptionsoptions) -- [setTraceFunction](#settracefunctionfunc) -- [mquery.setGlobalTraceFunction](#mquerysetglobaltracefunctionfunc) -- [mquery.canMerge](#mquerycanmerge) -- [mquery.use$geoWithin](#mqueryusegeowithin) - -###find() - -Declares this query a _find_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().find() -mquery().find(match) -mquery().find(callback) -mquery().find(match, function (err, docs) { - assert(Array.isArray(docs)); -}) -``` - -###findOne() - -Declares this query a _findOne_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().findOne() -mquery().findOne(match) -mquery().findOne(callback) -mquery().findOne(match, function (err, doc) { - if (doc) { - // the document may not be found - console.log(doc); - } -}) -``` - -###count() - -Declares this query a _count_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().count() -mquery().count(match) -mquery().count(callback) -mquery().count(match, function (err, number){ - console.log('we found %d matching documents', number); -}) -``` - -###remove() - -Declares this query a _remove_ query. Optionally pass a match clause and / or callback. If a callback is passed the query is executed. - -```js -mquery().remove() -mquery().remove(match) -mquery().remove(callback) -mquery().remove(match, function (err){}) -``` - -###update() - -Declares this query an _update_ query. Optionally pass an update document, match clause, options or callback. If a callback is passed, the query is executed. To force execution without passing a callback, run `update(true)`. - -```js -mquery().update() -mquery().update(match, updateDocument) -mquery().update(match, updateDocument, options) - -// the following all execute the command -mquery().update(callback) -mquery().update({$set: updateDocument, callback) -mquery().update(match, updateDocument, callback) -mquery().update(match, updateDocument, options, function (err, result){}) -mquery().update(true) // executes (unsafe write) -``` - -#####the update document - -All paths passed that are not `$atomic` operations will become `$set` ops. For example: - -```js -mquery(collection).where({ _id: id }).update({ title: 'words' }, callback) -``` - -becomes - -```js -collection.update({ _id: id }, { $set: { title: 'words' }}, callback) -``` - -This behavior can be overridden using the `overwrite` option (see below). - -#####options - -Options are passed to the `setOptions()` method. - -- overwrite - -Passing an empty object `{ }` as the update document will result in a no-op unless the `overwrite` option is passed. Without the `overwrite` option, the update operation will be ignored and the callback executed without sending the command to MongoDB to prevent accidently overwritting documents in the collection. - -```js -var q = mquery(collection).where({ _id: id }).setOptions({ overwrite: true }); -q.update({ }, callback); // overwrite with an empty doc -``` - -The `overwrite` option isn't just for empty objects, it also provides a means to override the default `$set` conversion and send the update document as is. - -```js -// create a base query -var base = mquery({ _id: 108 }).collection(collection).toConstructor(); - -base().findOne(function (err, doc) { - console.log(doc); // { _id: 108, name: 'cajon' }) - - base().setOptions({ overwrite: true }).update({ changed: true }, function (err) { - base.findOne(function (err, doc) { - console.log(doc); // { _id: 108, changed: true }) - the doc was overwritten - }); - }); -}) -``` - -- multi - -Updates only modify a single document by default. To update multiple documents, set the `multi` option to `true`. - -```js -mquery() - .collection(coll) - .update({ name: /^match/ }, { $addToSet: { arr: 4 }}, { multi: true }, callback) - -// another way of doing it -mquery({ name: /^match/ }) - .collection(coll) - .setOptions({ multi: true }) - .update({ $addToSet: { arr: 4 }}, callback) - -// update multiple documents with an empty doc -var q = mquery(collection).where({ name: /^match/ }); -q.setOptions({ multi: true, overwrite: true }) -q.update({ }); -q.update(function (err, result) { - console.log(arguments); -}); -``` - -###findOneAndUpdate() - -Declares this query a _findAndModify_ with update query. Optionally pass a match clause, update document, options, or callback. If a callback is passed, the query is executed. - -When executed, the first matching document (if found) is modified according to the update document and passed back to the callback. - -#####options - -Options are passed to the `setOptions()` method. - -- `new`: boolean - true to return the modified document rather than the original. defaults to true -- `upsert`: boolean - creates the object if it doesn't exist. defaults to false -- `sort`: if multiple docs are found by the match condition, sets the sort order to choose which doc to update - -```js -query.findOneAndUpdate() -query.findOneAndUpdate(updateDocument) -query.findOneAndUpdate(match, updateDocument) -query.findOneAndUpdate(match, updateDocument, options) - -// the following all execute the command -query.findOneAndUpdate(callback) -query.findOneAndUpdate(updateDocument, callback) -query.findOneAndUpdate(match, updateDocument, callback) -query.findOneAndUpdate(match, updateDocument, options, function (err, doc) { - if (doc) { - // the document may not be found - console.log(doc); - } -}) - ``` - -###findOneAndRemove() - -Declares this query a _findAndModify_ with remove query. Optionally pass a match clause, options, or callback. If a callback is passed, the query is executed. - -When executed, the first matching document (if found) is modified according to the update document, removed from the collection and passed to the callback. - -#####options - -Options are passed to the `setOptions()` method. - -- `sort`: if multiple docs are found by the condition, sets the sort order to choose which doc to modify and remove - -```js -A.where().findOneAndRemove() -A.where().findOneAndRemove(match) -A.where().findOneAndRemove(match, options) - -// the following all execute the command -A.where().findOneAndRemove(callback) -A.where().findOneAndRemove(match, callback) -A.where().findOneAndRemove(match, options, function (err, doc) { - if (doc) { - // the document may not be found - console.log(doc); - } -}) - ``` - -###distinct() - -Declares this query a _distinct_ query. Optionally pass the distinct field, a match clause or callback. If a callback is passed the query is executed. - -```js -mquery().distinct() -mquery().distinct(match) -mquery().distinct(match, field) -mquery().distinct(field) - -// the following all execute the command -mquery().distinct(callback) -mquery().distinct(field, callback) -mquery().distinct(match, callback) -mquery().distinct(match, field, function (err, result) { - console.log(result); -}) -``` - -###exec() - -Executes the query. - -```js -mquery().findOne().where('route').intersects(polygon).exec(function (err, docs){}) -``` - -###stream() - -Executes the query and returns a stream. - -```js -var stream = mquery().find().stream(options); -stream.on('data', cb); -stream.on('close', fn); -``` - -Note: this only works with `find()` operations. - -Note: returns the stream object directly from the node-mongodb-native driver. (currently streams1 type stream). Any options will be passed along to the [driver method](http://mongodb.github.io/node-mongodb-native/api-generated/cursor.html#stream). - -------------- - -###all() - -Specifies an `$all` query condition - -```js -mquery().where('permission').all(['read', 'write']) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/all/) - -###and() - -Specifies arguments for an `$and` condition - -```js -mquery().and([{ color: 'green' }, { status: 'ok' }]) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/and/) - -###box() - -Specifies a `$box` condition - -```js -var lowerLeft = [40.73083, -73.99756] -var upperRight= [40.741404, -73.988135] - -mquery().where('location').within().box(lowerLeft, upperRight) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/box/) - -###circle() - -Specifies a `$center` or `$centerSphere` condition. - -```js -var area = { center: [50, 50], radius: 10, unique: true } -query.where('loc').within().circle(area) -query.circle('loc', area); - -// for spherical calculations -var area = { center: [50, 50], radius: 10, unique: true, spherical: true } -query.where('loc').within().circle(area) -query.circle('loc', area); -``` - -- [MongoDB Documentation - center](http://docs.mongodb.org/manual/reference/operator/center/) -- [MongoDB Documentation - centerSphere](http://docs.mongodb.org/manual/reference/operator/centerSphere/) - -###elemMatch() - -Specifies an `$elemMatch` condition - -```js -query.where('comment').elemMatch({ author: 'autobot', votes: {$gte: 5}}) - -query.elemMatch('comment', function (elem) { - elem.where('author').equals('autobot'); - elem.where('votes').gte(5); -}) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/elemMatch/) - -###equals() - -Specifies the complementary comparison value for the path specified with `where()`. - -```js -mquery().where('age').equals(49); - -// is the same as - -mquery().where({ 'age': 49 }); -``` - -###exists() - -Specifies an `$exists` condition - -```js -// { name: { $exists: true }} -mquery().where('name').exists() -mquery().where('name').exists(true) -mquery().exists('name') - -// { name: { $exists: false }} -mquery().where('name').exists(false); -mquery().exists('name', false); -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/exists/) - -###geometry() - -Specifies a `$geometry` condition - -```js -var polyA = [[[ 10, 20 ], [ 10, 40 ], [ 30, 40 ], [ 30, 20 ]]] -query.where('loc').within().geometry({ type: 'Polygon', coordinates: polyA }) - -// or -var polyB = [[ 0, 0 ], [ 1, 1 ]] -query.where('loc').within().geometry({ type: 'LineString', coordinates: polyB }) - -// or -var polyC = [ 0, 0 ] -query.where('loc').within().geometry({ type: 'Point', coordinates: polyC }) - -// or -query.where('loc').intersects().geometry({ type: 'Point', coordinates: polyC }) - -// or -query.where('loc').near().geometry({ type: 'Point', coordinates: [3,5] }) -``` - -`geometry()` **must** come after `intersects()`, `within()`, or `near()`. - -The `object` argument must contain `type` and `coordinates` properties. - -- type `String` -- coordinates `Array` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/geometry/) - -###gt() - -Specifies a `$gt` query condition. - -```js -mquery().where('clicks').gt(999) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/gt/) - -###gte() - -Specifies a `$gte` query condition. - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/gte/) - -```js -mquery().where('clicks').gte(1000) -``` - -###in() - -Specifies an `$in` query condition. - -```js -mquery().where('author_id').in([3, 48901, 761]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/in/) - -###intersects() - -Declares an `$geoIntersects` query for `geometry()`. - -```js -query.where('path').intersects().geometry({ - type: 'LineString' - , coordinates: [[180.0, 11.0], [180, 9.0]] -}) - -// geometry arguments are supported -query.where('path').intersects({ - type: 'LineString' - , coordinates: [[180.0, 11.0], [180, 9.0]] -}) -``` - -**Must** be used after `where()`. - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/geoIntersects/) - -###lt() - -Specifies a `$lt` query condition. - -```js -mquery().where('clicks').lt(50) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/lt/) - -###lte() - -Specifies a `$lte` query condition. - -```js -mquery().where('clicks').lte(49) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/lte/) - -###maxDistance() - -Specifies a `$maxDistance` query condition. - -```js -mquery().where('location').near({ center: [139, 74.3] }).maxDistance(5) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/maxDistance/) - -###mod() - -Specifies a `$mod` condition - -```js -mquery().where('count').mod(2, 0) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/mod/) - -###ne() - -Specifies a `$ne` query condition. - -```js -mquery().where('status').ne('ok') -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/ne/) - -###nin() - -Specifies an `$nin` query condition. - -```js -mquery().where('author_id').nin([3, 48901, 761]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/nin/) - -###nor() - -Specifies arguments for an `$nor` condition. - -```js -mquery().nor([{ color: 'green' }, { status: 'ok' }]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/nor/) - -###near() - -Specifies arguments for a `$near` or `$nearSphere` condition. - -These operators return documents sorted by distance. - -####Example - -```js -query.where('loc').near({ center: [10, 10] }); -query.where('loc').near({ center: [10, 10], maxDistance: 5 }); -query.near('loc', { center: [10, 10], maxDistance: 5 }); - -// GeoJSON -query.where('loc').near({ center: { type: 'Point', coordinates: [10, 10] }}); -query.where('loc').near({ center: { type: 'Point', coordinates: [10, 10] }, maxDistance: 5, spherical: true }); -query.where('loc').near().geometry({ type: 'Point', coordinates: [10, 10] }); - -// For a $nearSphere condition, pass the `spherical` option. -query.near({ center: [10, 10], maxDistance: 5, spherical: true }); -``` - -[MongoDB Documentation](http://www.mongodb.org/display/DOCS/Geospatial+Indexing) - -###or() - -Specifies arguments for an `$or` condition. - -```js -mquery().or([{ color: 'red' }, { status: 'emergency' }]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/or/) - -###polygon() - -Specifies a `$polygon` condition - -```js -mquery().where('loc').within().polygon([10,20], [13, 25], [7,15]) -mquery().polygon('loc', [10,20], [13, 25], [7,15]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/polygon/) - -###regex() - -Specifies a `$regex` query condition. - -```js -mquery().where('name').regex(/^sixstepsrecords/) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/regex/) - -###select() - -Specifies which document fields to include or exclude - -```js -// 1 means include, 0 means exclude -mquery().select({ name: 1, address: 1, _id: 0 }) - -// or - -mquery().select('name address -_id') -``` - -#####String syntax - -When passing a string, prefixing a path with `-` will flag that path as excluded. When a path does not have the `-` prefix, it is included. - -```js -// include a and b, exclude c -query.select('a b -c'); - -// or you may use object notation, useful when -// you have keys already prefixed with a "-" -query.select({a: 1, b: 1, c: 0}); -``` - -_Cannot be used with `distinct()`._ - -###selected() - -Determines if the query has selected any fields. - -```js -var query = mquery(); -query.selected() // false -query.select('-name'); -query.selected() // true -``` - -###selectedInclusively() - -Determines if the query has selected any fields inclusively. - -```js -var query = mquery().select('name'); -query.selectedInclusively() // true - -var query = mquery(); -query.selected() // false -query.select('-name'); -query.selectedInclusively() // false -query.selectedExclusively() // true -``` - -###selectedExclusively() - -Determines if the query has selected any fields exclusively. - -```js -var query = mquery().select('-name'); -query.selectedExclusively() // true - -var query = mquery(); -query.selected() // false -query.select('name'); -query.selectedExclusively() // false -query.selectedInclusively() // true -``` - -###size() - -Specifies a `$size` query condition. - -```js -mquery().where('someArray').size(6) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/size/) - -###slice() - -Specifies a `$slice` projection for a `path` - -```js -mquery().where('comments').slice(5) -mquery().where('comments').slice(-5) -mquery().where('comments').slice([-10, 5]) -``` - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/projection/slice/) - -###within() - -Sets a `$geoWithin` or `$within` argument for geo-spatial queries. - -```js -mquery().within().box() -mquery().within().circle() -mquery().within().geometry() - -mquery().where('loc').within({ center: [50,50], radius: 10, unique: true, spherical: true }); -mquery().where('loc').within({ box: [[40.73, -73.9], [40.7, -73.988]] }); -mquery().where('loc').within({ polygon: [[],[],[],[]] }); - -mquery().where('loc').within([], [], []) // polygon -mquery().where('loc').within([], []) // box -mquery().where('loc').within({ type: 'LineString', coordinates: [...] }); // geometry -``` - -As of mquery 2.0, `$geoWithin` is used by default. This impacts you if running MongoDB < 2.4. To alter this behavior, see [mquery.use$geoWithin](#mqueryusegeowithin). - -**Must** be used after `where()`. - -[MongoDB Documentation](http://docs.mongodb.org/manual/reference/operator/geoWithin/) - -###where() - -Specifies a `path` for use with chaining - -```js -// instead of writing: -mquery().find({age: {$gte: 21, $lte: 65}}); - -// we can instead write: -mquery().where('age').gte(21).lte(65); - -// passing query conditions is permitted too -mquery().find().where({ name: 'vonderful' }) - -// chaining -mquery() -.where('age').gte(21).lte(65) -.where({ 'name': /^vonderful/i }) -.where('friends').slice(10) -.exec(callback) -``` - -###$where() - -Specifies a `$where` condition. - -Use `$where` when you need to select documents using a JavaScript expression. - -```js -query.$where('this.comments.length > 10 || this.name.length > 5').exec(callback) - -query.$where(function () { - return this.comments.length > 10 || this.name.length > 5; -}) -``` - -Only use `$where` when you have a condition that cannot be met using other MongoDB operators like `$lt`. Be sure to read about all of [its caveats](http://docs.mongodb.org/manual/reference/operator/where/) before using. - ------------ - -###batchSize() - -Specifies the batchSize option. - -```js -query.batchSize(100) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.batchSize/) - -###comment() - -Specifies the comment option. - -```js -query.comment('login query'); -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/) - -###hint() - -Sets query hints. - -```js -mquery().hint({ indexA: 1, indexB: -1 }) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/hint/) - -###limit() - -Specifies the limit option. - -```js -query.limit(20) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.limit/) - -###maxScan() - -Specifies the maxScan option. - -```js -query.maxScan(100) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/maxScan/) - -###maxTime() - -Specifies the maxTimeMS option. - -```js -query.maxTime(100) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.maxTimeMS/) - - -###skip() - -Specifies the skip option. - -```js -query.skip(100).limit(20) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.skip/) - -###sort() - -Sets the query sort order. - -If an object is passed, key values allowed are `asc`, `desc`, `ascending`, `descending`, `1`, and `-1`. - -If a string is passed, it must be a space delimited list of path names. The sort order of each path is ascending unless the path name is prefixed with `-` which will be treated as descending. - -```js -// these are equivalent -query.sort({ field: 'asc', test: -1 }); -query.sort('field -test'); -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/cursor.sort/) - -###read() - -Sets the readPreference option for the query. - -```js -mquery().read('primary') -mquery().read('p') // same as primary - -mquery().read('primaryPreferred') -mquery().read('pp') // same as primaryPreferred - -mquery().read('secondary') -mquery().read('s') // same as secondary - -mquery().read('secondaryPreferred') -mquery().read('sp') // same as secondaryPreferred - -mquery().read('nearest') -mquery().read('n') // same as nearest -``` - -#####Preferences: - -- `primary` - (default) Read from primary only. Operations will produce an error if primary is unavailable. Cannot be combined with tags. -- `secondary` - Read from secondary if available, otherwise error. -- `primaryPreferred` - Read from primary if available, otherwise a secondary. -- `secondaryPreferred` - Read from a secondary if available, otherwise read from the primary. -- `nearest` - All operations read from among the nearest candidates, but unlike other modes, this option will include both the primary and all secondaries in the random selection. - -Aliases - -- `p` primary -- `pp` primaryPreferred -- `s` secondary -- `sp` secondaryPreferred -- `n` nearest - -#####Preference Tags: - -To keep the separation of concerns between `mquery` and your driver -clean, `mquery#read()` no longer handles specifying a second `tags` argument as of version 0.5. -If you need to specify tags, pass any non-string argument as the first argument. -`mquery` will pass this argument untouched to your collections methods later. -For example: - -```js -// example of specifying tags using the Node.js driver -var ReadPref = require('mongodb').ReadPreference; -var preference = new ReadPref('secondary', [{ dc:'sf', s: 1 },{ dc:'ma', s: 2 }]); -mquery(..).read(preference).exec(); -``` - -Read more about how to use read preferences [here](http://docs.mongodb.org/manual/applications/replication/#read-preference) and [here](http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences). - -###slaveOk() - -Sets the slaveOk option. `true` allows reading from secondaries. - -**deprecated** use [read()](#read) preferences instead if on mongodb >= 2.2 - -```js -query.slaveOk() // true -query.slaveOk(true) -query.slaveOk(false) -``` - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/method/rs.slaveOk/) - -###snapshot() - -Specifies this query as a snapshot query. - -```js -mquery().snapshot() // true -mquery().snapshot(true) -mquery().snapshot(false) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB documentation](http://docs.mongodb.org/manual/reference/operator/snapshot/) - -###tailable() - -Sets tailable option. - -```js -mquery().tailable() <== true -mquery().tailable(true) -mquery().tailable(false) -``` - -_Cannot be used with `distinct()`._ - -[MongoDB Documentation](http://docs.mongodb.org/manual/tutorial/create-tailable-cursor/) - -##Helpers - -###collection() - -Sets the querys collection. - -```js -mquery().collection(aCollection) -``` - -###then() - -Executes the query and returns a promise which will be resolved with the query results or rejected if the query responds with an error. - -```js -mquery().find(..).then(success, error); -``` - -This is very useful when combined with [co](https://github.com/visionmedia/co) or [koa](https://github.com/koajs/koa), which automatically resolve promise-like objects for you. - -```js -co(function*(){ - var doc = yield mquery().findOne({ _id: 499 }); - console.log(doc); // { _id: 499, name: 'amazing', .. } -})(); -``` - -_NOTE_: -The returned promise is a [bluebird](https://github.com/petkaantonov/bluebird/) promise but this is customizable. If you want to -use your favorite promise library, simply set `mquery.Promise = YourPromiseConstructor`. -Your `Promise` must be [promises A+](http://promisesaplus.com/) compliant. - -###thunk() - -Returns a thunk which when called runs the query's `exec` method passing the results to the callback. - -```js -var thunk = mquery(collection).find({..}).thunk(); - -thunk(function(err, results) { - -}) -``` - -###merge(object) - -Merges other mquery or match condition objects into this one. When an muery instance is passed, its match conditions, field selection and options are merged. - -```js -var drum = mquery({ type: 'drum' }).collection(instruments); -var redDrum = mqery({ color: 'red' }).merge(drum); -redDrum.count(function (err, n) { - console.log('there are %d red drums', n); -}) -``` - -Internally uses `mquery.canMerge` to determine validity. - -###setOptions(options) - -Sets query options. - -```js -mquery().setOptions({ collection: coll, limit: 20 }) -``` - -#####options - -- [tailable](#tailable) * -- [sort](#sort) * -- [limit](#limit) * -- [skip](#skip) * -- [maxScan](#maxscan) * -- [maxTime](#maxtime) * -- [batchSize](#batchSize) * -- [comment](#comment) * -- [snapshot](#snapshot) * -- [hint](#hint) * -- [slaveOk](#slaveOk) * -- [safe](http://docs.mongodb.org/manual/reference/write-concern/): Boolean - passed through to the collection. Setting to `true` is equivalent to `{ w: 1 }` -- [collection](#collection): the collection to query against - -_* denotes a query helper method is also available_ - -###setTraceFunction(func) - -Set a function to trace this query. Useful for profiling or logging. - -```js -function traceFunction (method, queryInfo, query) { - console.log('starting ' + method + ' query'); - - return function (err, result, millis) { - console.log('finished ' + method + ' query in ' + millis + 'ms'); - }; -} - -mquery().setTraceFunction(traceFunction).findOne({name: 'Joe'}, cb); -``` - -The trace function is passed (method, queryInfo, query) - -- method is the name of the method being called (e.g. findOne) -- queryInfo contains information about the query: - - conditions: query conditions/criteria - - options: options such as sort, fields, etc - - doc: document being updated -- query is the query object - -The trace function should return a callback function which accepts: -- err: error, if any -- result: result, if any -- millis: time spent waiting for query result - -NOTE: stream requests are not traced. - -###mquery.setGlobalTraceFunction(func) - -Similar to `setTraceFunction()` but automatically applied to all queries. - -```js -mquery.setTraceFunction(traceFunction); -``` - -###mquery.canMerge(conditions) - -Determines if `conditions` can be merged using `mquery().merge()`. - -```js -var query = mquery({ type: 'drum' }); -var okToMerge = mquery.canMerge(anObject) -if (okToMerge) { - query.merge(anObject); -} -``` - -##mquery.use$geoWithin - -MongoDB 2.4 introduced the `$geoWithin` operator which replaces and is 100% backward compatible with `$within`. As of mquery 0.2, we default to using `$geoWithin` for all `within()` calls. - -If you are running MongoDB < 2.4 this will be problematic. To force `mquery` to be backward compatible and always use `$within`, set the `mquery.use$geoWithin` flag to `false`. - -```js -mquery.use$geoWithin = false; -``` - -##Custom Base Queries - -Often times we want custom base queries that encapsulate predefined criteria. With `mquery` this is easy. First create the query you want to reuse and call its `toConstructor()` method which returns a new subclass of `mquery` that retains all options and criteria of the original. - -```js -var greatMovies = mquery(movieCollection).where('rating').gte(4.5).toConstructor(); - -// use it! -greatMovies().count(function (err, n) { - console.log('There are %d great movies', n); -}); - -greatMovies().where({ name: /^Life/ }).select('name').find(function (err, docs) { - console.log(docs); -}); -``` - -##Validation - -Method and options combinations are checked for validity at runtime to prevent creation of invalid query constructs. For example, a `distinct` query does not support specifying options like `hint` or field selection. In this case an error will be thrown so you can catch these mistakes in development. - -##Debug support - -Debug mode is provided through the use of the [debug](https://github.com/visionmedia/debug) module. To enable: - - DEBUG=mquery node yourprogram.js - -Read the debug module documentation for more details. - -## General compatibility - -#### ObjectIds - -`mquery` clones query arguments before passing them to a `collection` method for execution. -This prevents accidental side-affects to the objects you pass. -To clone `ObjectIds` we need to make some assumptions. - -First, to check if an object is an `ObjectId`, we check its constructors name. If it matches either -`ObjectId` or `ObjectID` we clone it. - -To clone `ObjectIds`, we call its optional `clone` method. If a `clone` method does not exist, we fall -back to calling `new obj.constructor(obj.id)`. We assume, for compatibility with the -Node.js driver, that the `ObjectId` instance has a public `id` property and that -when creating an `ObjectId` instance we can pass that `id` as an argument. - -#### Read Preferences - -`mquery` supports specifying [Read Preferences]() to control from which MongoDB node your query will read. -The Read Preferences spec also support specifying tags. To pass tags, some -drivers (Node.js driver) require passing a special constructor that handles both the read preference and its tags. -If you need to specify tags, pass an instance of your drivers ReadPreference constructor or roll your own. `mquery` will store whatever you provide and pass later to your collection during execution. - -##Future goals - - - mongo shell compatibility - - browser compatibility - -## Installation - - $ npm install mquery - -## License - -[MIT](https://github.com/aheckmann/mquery/blob/master/LICENSE) - diff --git a/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js b/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js deleted file mode 100644 index bce3c38b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/collection.js +++ /dev/null @@ -1,42 +0,0 @@ -'use strict'; - -/** - * methods a collection must implement - */ - -var methods = [ - 'find' - , 'findOne' - , 'update' - , 'remove' - , 'count' - , 'distinct' - , 'findAndModify' - , 'aggregate' - , 'findStream' -]; - -/** - * Collection base class from which implementations inherit - */ - -function Collection () {} - -for (var i = 0, len = methods.length; i < len; ++i) { - var method = methods[i]; - Collection.prototype[method] = notImplemented(method); -} - -module.exports = exports = Collection; -Collection.methods = methods; - -/** - * creates a function which throws an implementation error - */ - -function notImplemented (method) { - return function () { - throw new Error('collection.' + method + ' not implemented'); - } -} - diff --git a/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/index.js b/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/index.js deleted file mode 100644 index e3cf44d4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/index.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -var env = require('../env') - -if ('unknown' == env.type) { - throw new Error('Unknown environment') -} - -module.exports = - env.isNode ? require('./node') : - env.isMongo ? require('./collection') : - require('./collection'); - diff --git a/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/node.js b/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/node.js deleted file mode 100644 index f2544566..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/lib/collection/node.js +++ /dev/null @@ -1,100 +0,0 @@ -'use strict'; - -/** - * Module dependencies - */ - -var Collection = require('./collection'); -var utils = require('../utils'); - -function NodeCollection (col) { - this.collection = col; - this.collectionName = col.collectionName; -} - -/** - * inherit from collection base class - */ - -utils.inherits(NodeCollection, Collection); - -/** - * find(match, options, function(err, docs)) - */ - -NodeCollection.prototype.find = function (match, options, cb) { - this.collection.find(match, options, function (err, cursor) { - if (err) return cb(err); - - cursor.toArray(cb); - }); -} - -/** - * findOne(match, options, function(err, doc)) - */ - -NodeCollection.prototype.findOne = function (match, options, cb) { - this.collection.findOne(match, options, cb); -} - -/** - * count(match, options, function(err, count)) - */ - -NodeCollection.prototype.count = function (match, options, cb) { - this.collection.count(match, options, cb); -} - -/** - * distinct(prop, match, options, function(err, count)) - */ - -NodeCollection.prototype.distinct = function (prop, match, options, cb) { - this.collection.distinct(prop, match, options, cb); -} - -/** - * update(match, update, options, function(err[, result])) - */ - -NodeCollection.prototype.update = function (match, update, options, cb) { - this.collection.update(match, update, options, cb); -} - -/** - * remove(match, options, function(err[, result]) - */ - -NodeCollection.prototype.remove = function (match, options, cb) { - this.collection.remove(match, options, cb); -} - -/** - * findAndModify(match, update, options, function(err, doc)) - */ - -NodeCollection.prototype.findAndModify = function (match, update, options, cb) { - var sort = Array.isArray(options.sort) ? options.sort : []; - this.collection.findAndModify(match, sort, update, options, cb); -} - -/** - * var stream = findStream(match, findOptions, streamOptions) - */ - -NodeCollection.prototype.findStream = function(match, findOptions, streamOptions) { - return this.collection.find(match, findOptions).stream(streamOptions); -} - -/** - * aggregation(operators..., function(err, doc)) - * TODO - */ - -/** - * Expose - */ - -module.exports = exports = NodeCollection; - diff --git a/Databases/node_modules/mongoose/node_modules/mquery/lib/env.js b/Databases/node_modules/mongoose/node_modules/mquery/lib/env.js deleted file mode 100644 index 3313b462..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/lib/env.js +++ /dev/null @@ -1,22 +0,0 @@ -'use strict'; - -exports.isNode = 'undefined' != typeof process - && 'object' == typeof module - && 'object' == typeof global - && 'function' == typeof Buffer - && process.argv - -exports.isMongo = !exports.isNode - && 'function' == typeof printjson - && 'function' == typeof ObjectId - && 'function' == typeof rs - && 'function' == typeof sh; - -exports.isBrowser = !exports.isNode - && !exports.isMongo - && 'undefined' != typeof window; - -exports.type = exports.isNode ? 'node' - : exports.isMongo ? 'mongo' - : exports.isBrowser ? 'browser' - : 'unknown' diff --git a/Databases/node_modules/mongoose/node_modules/mquery/lib/mquery.js b/Databases/node_modules/mongoose/node_modules/mquery/lib/mquery.js deleted file mode 100644 index ca078676..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/lib/mquery.js +++ /dev/null @@ -1,2612 +0,0 @@ -'use strict'; - -/** - * Dependencies - */ - -var slice = require('sliced') -var assert = require('assert') -var util = require('util') -var utils = require('./utils') -var debug = require('debug')('mquery'); - -/** - * Query constructor used for building queries. - * - * ####Example: - * - * var query = new Query({ name: 'mquery' }); - * query.setOptions({ collection: moduleCollection }) - * query.where('age').gte(21).exec(callback); - * - * @param {Object} [criteria] - * @param {Object} [options] - * @api public - */ - -function Query (criteria, options) { - if (!(this instanceof Query)) - return new Query(criteria, options); - - var proto = this.constructor.prototype; - - this.op = proto.op || undefined; - - this.options = {}; - this.setOptions(proto.options); - - this._conditions = proto._conditions - ? utils.clone(proto._conditions) - : {}; - - this._fields = proto._fields - ? utils.clone(proto._fields) - : undefined; - - this._update = proto._update - ? utils.clone(proto._update) - : undefined; - - this._path = proto._path || undefined; - this._distinct = proto._distinct || undefined; - this._collection = proto._collection || undefined; - this._traceFunction = proto._traceFunction || undefined; - - if (options) { - this.setOptions(options); - } - - if (criteria) { - if (criteria.find && criteria.remove && criteria.update) { - // quack quack! - this.collection(criteria); - } else { - this.find(criteria); - } - } -} - -/** - * This is a parameter that the user can set which determines if mquery - * uses $within or $geoWithin for queries. It defaults to true which - * means $geoWithin will be used. If using MongoDB < 2.4 you should - * set this to false. - * - * @api public - * @property use$geoWithin - */ - -var $withinCmd = '$geoWithin'; -Object.defineProperty(Query, 'use$geoWithin', { - get: function ( ) { return $withinCmd == '$geoWithin' } - , set: function (v) { - if (true === v) { - // mongodb >= 2.4 - $withinCmd = '$geoWithin'; - } else { - $withinCmd = '$within'; - } - } -}); - -/** - * Converts this query to a constructor function with all arguments and options retained. - * - * ####Example - * - * // Create a query that will read documents with a "video" category from - * // `aCollection` on the primary node in the replica-set unless it is down, - * // in which case we'll read from a secondary node. - * var query = mquery({ category: 'video' }) - * query.setOptions({ collection: aCollection, read: 'primaryPreferred' }); - * - * // create a constructor based off these settings - * var Video = query.toConstructor(); - * - * // Video is now a subclass of mquery() and works the same way but with the - * // default query parameters and options set. - * - * // run a query with the previous settings but filter for movies with names - * // that start with "Life". - * Video().where({ name: /^Life/ }).exec(cb); - * - * @return {Query} new Query - * @api public - */ - -Query.prototype.toConstructor = function toConstructor () { - function CustomQuery (criteria, options) { - if (!(this instanceof CustomQuery)) - return new CustomQuery(criteria, options); - Query.call(this, criteria, options); - } - - utils.inherits(CustomQuery, Query); - - // set inherited defaults - var p = CustomQuery.prototype; - - p.options = {}; - p.setOptions(this.options); - - p.op = this.op; - p._conditions = utils.clone(this._conditions); - p._fields = utils.clone(this._fields); - p._update = utils.clone(this._update); - p._path = this._path; - p._distinct = this._distinct; - p._collection = this._collection; - p._traceFunction = this._traceFunction; - - return CustomQuery; -} - -/** - * Sets query options. - * - * ####Options: - * - * - [tailable](http://www.mongodb.org/display/DOCS/Tailable+Cursors) * - * - [sort](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsort(\)%7D%7D) * - * - [limit](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Blimit%28%29%7D%7D) * - * - [skip](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bskip%28%29%7D%7D) * - * - [maxScan](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24maxScan) * - * - [maxTime](http://docs.mongodb.org/manual/reference/operator/meta/maxTimeMS/#op._S_maxTimeMS) * - * - [batchSize](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7BbatchSize%28%29%7D%7D) * - * - [comment](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24comment) * - * - [snapshot](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsnapshot%28%29%7D%7D) * - * - [hint](http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24hint) * - * - [slaveOk](http://docs.mongodb.org/manual/applications/replication/#read-preference) * - * - [safe](http://www.mongodb.org/display/DOCS/getLastError+Command) - * - collection the collection to query against - * - * _* denotes a query helper method is also available_ - * - * @param {Object} options - * @api public - */ - -Query.prototype.setOptions = function (options) { - if (!(options && utils.isObject(options))) - return this; - - // set arbitrary options - var methods = utils.keys(options) - , method - - for (var i = 0; i < methods.length; ++i) { - method = methods[i]; - - // use methods if exist (safer option manipulation) - if ('function' == typeof this[method]) { - var args = utils.isArray(options[method]) - ? options[method] - : [options[method]]; - this[method].apply(this, args) - } else { - this.options[method] = options[method]; - } - } - - return this; -} - -/** - * Sets this Querys collection. - * - * @param {Collection} coll - * @return {Query} this - */ - -Query.prototype.collection = function collection (coll) { - this._collection = new Query.Collection(coll); - - return this; -} - -/** - * Specifies a `$where` condition - * - * Use `$where` when you need to select documents using a JavaScript expression. - * - * ####Example - * - * query.$where('this.comments.length > 10 || this.name.length > 5') - * - * query.$where(function () { - * return this.comments.length > 10 || this.name.length > 5; - * }) - * - * @param {String|Function} js javascript string or function - * @return {Query} this - * @memberOf Query - * @method $where - * @api public - */ - -Query.prototype.$where = function (js) { - this._conditions.$where = js; - return this; -} - -/** - * Specifies a `path` for use with chaining. - * - * ####Example - * - * // instead of writing: - * User.find({age: {$gte: 21, $lte: 65}}, callback); - * - * // we can instead write: - * User.where('age').gte(21).lte(65); - * - * // passing query conditions is permitted - * User.find().where({ name: 'vonderful' }) - * - * // chaining - * User - * .where('age').gte(21).lte(65) - * .where('name', /^vonderful/i) - * .where('friends').slice(10) - * .exec(callback) - * - * @param {String} [path] - * @param {Object} [val] - * @return {Query} this - * @api public - */ - -Query.prototype.where = function () { - if (!arguments.length) return this; - if (!this.op) this.op = 'find'; - - var type = typeof arguments[0]; - - if ('string' == type) { - this._path = arguments[0]; - - if (2 === arguments.length) { - this._conditions[this._path] = arguments[1]; - } - - return this; - } - - if ('object' == type && !Array.isArray(arguments[0])) { - return this.merge(arguments[0]); - } - - throw new TypeError('path must be a string or object'); -} - -/** - * Specifies the complementary comparison value for paths specified with `where()` - * - * ####Example - * - * User.where('age').equals(49); - * - * // is the same as - * - * User.where('age', 49); - * - * @param {Object} val - * @return {Query} this - * @api public - */ - -Query.prototype.equals = function equals (val) { - this._ensurePath('equals'); - var path = this._path; - this._conditions[path] = val; - return this; -} - -/** - * Specifies arguments for an `$or` condition. - * - * ####Example - * - * query.or([{ color: 'red' }, { status: 'emergency' }]) - * - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -Query.prototype.or = function or (array) { - var or = this._conditions.$or || (this._conditions.$or = []); - if (!utils.isArray(array)) array = [array]; - or.push.apply(or, array); - return this; -} - -/** - * Specifies arguments for a `$nor` condition. - * - * ####Example - * - * query.nor([{ color: 'green' }, { status: 'ok' }]) - * - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -Query.prototype.nor = function nor (array) { - var nor = this._conditions.$nor || (this._conditions.$nor = []); - if (!utils.isArray(array)) array = [array]; - nor.push.apply(nor, array); - return this; -} - -/** - * Specifies arguments for a `$and` condition. - * - * ####Example - * - * query.and([{ color: 'green' }, { status: 'ok' }]) - * - * @see $and http://docs.mongodb.org/manual/reference/operator/and/ - * @param {Array} array array of conditions - * @return {Query} this - * @api public - */ - -Query.prototype.and = function and (array) { - var and = this._conditions.$and || (this._conditions.$and = []); - if (!Array.isArray(array)) array = [array]; - and.push.apply(and, array); - return this; -} - -/** - * Specifies a $gt query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * ####Example - * - * Thing.find().where('age').gt(21) - * - * // or - * Thing.find().gt('age', 21) - * - * @method gt - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $gte query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method gte - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $lt query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method lt - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $lte query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method lte - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $ne query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method ne - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $in query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method in - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $nin query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method nin - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies an $all query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method all - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $size query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method size - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $regex query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method regex - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/** - * Specifies a $maxDistance query condition. - * - * When called with one argument, the most recent path passed to `where()` is used. - * - * @method maxDistance - * @memberOf Query - * @param {String} [path] - * @param {Number} val - * @api public - */ - -/*! - * gt, gte, lt, lte, ne, in, nin, all, regex, size, maxDistance - * - * Thing.where('type').nin(array) - */ - -'gt gte lt lte ne in nin all regex size maxDistance'.split(' ').forEach(function ($conditional) { - Query.prototype[$conditional] = function () { - var path, val; - - if (1 === arguments.length) { - this._ensurePath($conditional); - val = arguments[0]; - path = this._path; - } else { - val = arguments[1]; - path = arguments[0]; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds['$' + $conditional] = val; - return this; - }; -}) - -/** - * Specifies a `$mod` condition - * - * @param {String} [path] - * @param {Number} val - * @return {Query} this - * @api public - */ - -Query.prototype.mod = function () { - var val, path; - - if (1 === arguments.length) { - this._ensurePath('mod') - val = arguments[0]; - path = this._path; - } else if (2 === arguments.length && !utils.isArray(arguments[1])) { - this._ensurePath('mod') - val = slice(arguments); - path = this._path; - } else if (3 === arguments.length) { - val = slice(arguments, 1); - path = arguments[0]; - } else { - val = arguments[1]; - path = arguments[0]; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds.$mod = val; - return this; -} - -/** - * Specifies an `$exists` condition - * - * ####Example - * - * // { name: { $exists: true }} - * Thing.where('name').exists() - * Thing.where('name').exists(true) - * Thing.find().exists('name') - * - * // { name: { $exists: false }} - * Thing.where('name').exists(false); - * Thing.find().exists('name', false); - * - * @param {String} [path] - * @param {Number} val - * @return {Query} this - * @api public - */ - -Query.prototype.exists = function () { - var path, val; - - if (0 === arguments.length) { - this._ensurePath('exists'); - path = this._path; - val = true; - } else if (1 === arguments.length) { - if ('boolean' === typeof arguments[0]) { - this._ensurePath('exists'); - path = this._path; - val = arguments[0]; - } else { - path = arguments[0]; - val = true; - } - } else if (2 === arguments.length) { - path = arguments[0]; - val = arguments[1]; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds.$exists = val; - return this; -} - -/** - * Specifies an `$elemMatch` condition - * - * ####Example - * - * query.elemMatch('comment', { author: 'autobot', votes: {$gte: 5}}) - * - * query.where('comment').elemMatch({ author: 'autobot', votes: {$gte: 5}}) - * - * query.elemMatch('comment', function (elem) { - * elem.where('author').equals('autobot'); - * elem.where('votes').gte(5); - * }) - * - * query.where('comment').elemMatch(function (elem) { - * elem.where({ author: 'autobot' }); - * elem.where('votes').gte(5); - * }) - * - * @param {String|Object|Function} path - * @param {Object|Function} criteria - * @return {Query} this - * @api public - */ - -Query.prototype.elemMatch = function () { - if (null == arguments[0]) - throw new TypeError("Invalid argument"); - - var fn, path, criteria; - - if ('function' === typeof arguments[0]) { - this._ensurePath('elemMatch'); - path = this._path; - fn = arguments[0]; - } else if (utils.isObject(arguments[0])) { - this._ensurePath('elemMatch'); - path = this._path; - criteria = arguments[0]; - } else if ('function' === typeof arguments[1]) { - path = arguments[0]; - fn = arguments[1]; - } else if (arguments[1] && utils.isObject(arguments[1])) { - path = arguments[0]; - criteria = arguments[1]; - } else { - throw new TypeError("Invalid argument"); - } - - if (fn) { - criteria = new Query; - fn(criteria); - criteria = criteria._conditions; - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds.$elemMatch = criteria; - return this; -} - -// Spatial queries - -/** - * Sugar for geo-spatial queries. - * - * ####Example - * - * query.within().box() - * query.within().circle() - * query.within().geometry() - * - * query.where('loc').within({ center: [50,50], radius: 10, unique: true, spherical: true }); - * query.where('loc').within({ box: [[40.73, -73.9], [40.7, -73.988]] }); - * query.where('loc').within({ polygon: [[],[],[],[]] }); - * - * query.where('loc').within([], [], []) // polygon - * query.where('loc').within([], []) // box - * query.where('loc').within({ type: 'LineString', coordinates: [...] }); // geometry - * - * ####NOTE: - * - * Must be used after `where()`. - * - * @memberOf Query - * @return {Query} this - * @api public - */ - -Query.prototype.within = function within () { - // opinionated, must be used after where - this._ensurePath('within'); - this._geoComparison = $withinCmd; - - if (0 === arguments.length) { - return this; - } - - if (2 === arguments.length) { - return this.box.apply(this, arguments); - } else if (2 < arguments.length) { - return this.polygon.apply(this, arguments); - } - - var area = arguments[0]; - - if (!area) - throw new TypeError('Invalid argument'); - - if (area.center) - return this.circle(area); - - if (area.box) - return this.box.apply(this, area.box); - - if (area.polygon) - return this.polygon.apply(this, area.polygon); - - if (area.type && area.coordinates) - return this.geometry(area); - - throw new TypeError('Invalid argument'); -} - -/** - * Specifies a $box condition - * - * ####Example - * - * var lowerLeft = [40.73083, -73.99756] - * var upperRight= [40.741404, -73.988135] - * - * query.where('loc').within().box(lowerLeft, upperRight) - * query.box('loc', lowerLeft, upperRight ) - * - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @see Query#within #query_Query-within - * @param {String} path - * @param {Object} val - * @return {Query} this - * @api public - */ - -Query.prototype.box = function () { - var path, box; - - if (3 === arguments.length) { - // box('loc', [], []) - path = arguments[0]; - box = [arguments[1], arguments[2]]; - } else if (2 === arguments.length) { - // box([], []) - this._ensurePath('box'); - path = this._path; - box = [arguments[0], arguments[1]]; - } else { - throw new TypeError("Invalid argument"); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds[this._geoComparison || $withinCmd] = { '$box': box }; - return this; -} - -/** - * Specifies a $polygon condition - * - * ####Example - * - * query.where('loc').within().polygon([10,20], [13, 25], [7,15]) - * query.polygon('loc', [10,20], [13, 25], [7,15]) - * - * @param {String|Array} [path] - * @param {Array|Object} [val] - * @return {Query} this - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -Query.prototype.polygon = function () { - var val, path; - - if ('string' == typeof arguments[0]) { - // polygon('loc', [],[],[]) - path = arguments[0]; - val = slice(arguments, 1); - } else { - // polygon([],[],[]) - this._ensurePath('polygon'); - path = this._path; - val = slice(arguments); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds[this._geoComparison || $withinCmd] = { '$polygon': val }; - return this; -} - -/** - * Specifies a $center or $centerSphere condition. - * - * ####Example - * - * var area = { center: [50, 50], radius: 10, unique: true } - * query.where('loc').within().circle(area) - * query.center('loc', area); - * - * // for spherical calculations - * var area = { center: [50, 50], radius: 10, unique: true, spherical: true } - * query.where('loc').within().circle(area) - * query.center('loc', area); - * - * @param {String} [path] - * @param {Object} area - * @return {Query} this - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -Query.prototype.circle = function () { - var path, val; - - if (1 === arguments.length) { - this._ensurePath('circle'); - path = this._path; - val = arguments[0]; - } else if (2 === arguments.length) { - path = arguments[0]; - val = arguments[1]; - } else { - throw new TypeError("Invalid argument"); - } - - if (!('radius' in val && val.center)) - throw new Error('center and radius are required'); - - var conds = this._conditions[path] || (this._conditions[path] = {}); - - var type = val.spherical - ? '$centerSphere' - : '$center'; - - var wKey = this._geoComparison || $withinCmd; - conds[wKey] = {}; - conds[wKey][type] = [val.center, val.radius]; - - if ('unique' in val) - conds[wKey].$uniqueDocs = !! val.unique; - - return this; -} - -/** - * Specifies a `$near` or `$nearSphere` condition - * - * These operators return documents sorted by distance. - * - * ####Example - * - * query.where('loc').near({ center: [10, 10] }); - * query.where('loc').near({ center: [10, 10], maxDistance: 5 }); - * query.where('loc').near({ center: [10, 10], maxDistance: 5, spherical: true }); - * query.near('loc', { center: [10, 10], maxDistance: 5 }); - * query.near({ center: { type: 'Point', coordinates: [..] }}) - * query.near().geometry({ type: 'Point', coordinates: [..] }) - * - * @param {String} [path] - * @param {Object} val - * @return {Query} this - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @api public - */ - -Query.prototype.near = function near () { - var path, val; - - this._geoComparison = '$near'; - - if (0 === arguments.length) { - return this; - } else if (1 === arguments.length) { - this._ensurePath('near'); - path = this._path; - val = arguments[0]; - } else if (2 === arguments.length) { - path = arguments[0]; - val = arguments[1]; - } else { - throw new TypeError("Invalid argument"); - } - - if (!val.center) { - throw new Error('center is required'); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - - var type = val.spherical - ? '$nearSphere' - : '$near'; - - // center could be a GeoJSON object or an Array - if (Array.isArray(val.center)) { - conds[type] = val.center; - - var radius = 'maxDistance' in val - ? val.maxDistance - : null; - - if (null != radius) { - conds.$maxDistance = radius; - } - } else { - // GeoJSON? - if (val.center.type != 'Point' || !Array.isArray(val.center.coordinates)) { - throw new Error(util.format("Invalid GeoJSON specified for %s", type)); - } - conds[type] = { $geometry : val.center }; - - // MongoDB 2.6 insists on maxDistance being in $near / $nearSphere - if ('maxDistance' in val) { - conds[type]['$maxDistance'] = val.maxDistance; - } - } - - return this; -} - -/** - * Declares an intersects query for `geometry()`. - * - * ####Example - * - * query.where('path').intersects().geometry({ - * type: 'LineString' - * , coordinates: [[180.0, 11.0], [180, 9.0]] - * }) - * - * query.where('path').intersects({ - * type: 'LineString' - * , coordinates: [[180.0, 11.0], [180, 9.0]] - * }) - * - * @param {Object} [arg] - * @return {Query} this - * @api public - */ - -Query.prototype.intersects = function intersects () { - // opinionated, must be used after where - this._ensurePath('intersects'); - - this._geoComparison = '$geoIntersects'; - - if (0 === arguments.length) { - return this; - } - - var area = arguments[0]; - - if (null != area && area.type && area.coordinates) - return this.geometry(area); - - throw new TypeError('Invalid argument'); -} - -/** - * Specifies a `$geometry` condition - * - * ####Example - * - * var polyA = [[[ 10, 20 ], [ 10, 40 ], [ 30, 40 ], [ 30, 20 ]]] - * query.where('loc').within().geometry({ type: 'Polygon', coordinates: polyA }) - * - * // or - * var polyB = [[ 0, 0 ], [ 1, 1 ]] - * query.where('loc').within().geometry({ type: 'LineString', coordinates: polyB }) - * - * // or - * var polyC = [ 0, 0 ] - * query.where('loc').within().geometry({ type: 'Point', coordinates: polyC }) - * - * // or - * query.where('loc').intersects().geometry({ type: 'Point', coordinates: polyC }) - * - * ####NOTE: - * - * `geometry()` **must** come after either `intersects()` or `within()`. - * - * The `object` argument must contain `type` and `coordinates` properties. - * - type {String} - * - coordinates {Array} - * - * The most recent path passed to `where()` is used. - * - * @param {Object} object Must contain a `type` property which is a String and a `coordinates` property which is an Array. See the examples. - * @return {Query} this - * @see http://docs.mongodb.org/manual/release-notes/2.4/#new-geospatial-indexes-with-geojson-and-improved-spherical-geometry - * @see http://www.mongodb.org/display/DOCS/Geospatial+Indexing - * @see $geometry http://docs.mongodb.org/manual/reference/operator/geometry/ - * @api public - */ - -Query.prototype.geometry = function geometry () { - if (!('$within' == this._geoComparison || - '$geoWithin' == this._geoComparison || - '$near' == this._geoComparison || - '$geoIntersects' == this._geoComparison)) { - throw new Error('geometry() must come after `within()`, `intersects()`, or `near()'); - } - - var val, path; - - if (1 === arguments.length) { - this._ensurePath('geometry'); - path = this._path; - val = arguments[0]; - } else { - throw new TypeError("Invalid argument"); - } - - if (!(val.type && Array.isArray(val.coordinates))) { - throw new TypeError('Invalid argument'); - } - - var conds = this._conditions[path] || (this._conditions[path] = {}); - conds[this._geoComparison] = { $geometry: val }; - - return this; -} - -// end spatial - -/** - * Specifies which document fields to include or exclude - * - * ####String syntax - * - * When passing a string, prefixing a path with `-` will flag that path as excluded. When a path does not have the `-` prefix, it is included. - * - * ####Example - * - * // include a and b, exclude c - * query.select('a b -c'); - * - * // or you may use object notation, useful when - * // you have keys already prefixed with a "-" - * query.select({a: 1, b: 1, c: 0}); - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Object|String} arg - * @return {Query} this - * @see SchemaType - * @api public - */ - -Query.prototype.select = function select () { - var arg = arguments[0]; - if (!arg) return this; - - if (arguments.length !== 1) { - throw new Error("Invalid select: select only takes 1 argument"); - } - - this._validate('select'); - - var fields = this._fields || (this._fields = {}); - var type = typeof arg; - - if ('string' == type || 'object' == type && 'number' == typeof arg.length && !Array.isArray(arg)) { - if ('string' == type) - arg = arg.split(/\s+/); - - for (var i = 0, len = arg.length; i < len; ++i) { - var field = arg[i]; - if (!field) continue; - var include = '-' == field[0] ? 0 : 1; - if (include === 0) field = field.substring(1); - fields[field] = include; - } - - return this; - } - - if (utils.isObject(arg) && !Array.isArray(arg)) { - var keys = utils.keys(arg); - for (var i = 0; i < keys.length; ++i) { - fields[keys[i]] = arg[keys[i]]; - } - return this; - } - - throw new TypeError('Invalid select() argument. Must be string or object.'); -} - -/** - * Specifies a $slice condition for a `path` - * - * ####Example - * - * query.slice('comments', 5) - * query.slice('comments', -5) - * query.slice('comments', [10, 5]) - * query.where('comments').slice(5) - * query.where('comments').slice([-10, 5]) - * - * @param {String} [path] - * @param {Number} val number/range of elements to slice - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Retrieving+a+Subset+of+Fields#RetrievingaSubsetofFields-RetrievingaSubrangeofArrayElements - * @api public - */ - -Query.prototype.slice = function () { - if (0 === arguments.length) - return this; - - this._validate('slice'); - - var path, val; - - if (1 === arguments.length) { - var arg = arguments[0]; - if (typeof arg === 'object' && !Array.isArray(arg)) { - var keys = Object.keys(arg); - var numKeys = keys.length; - for (var i = 0; i < numKeys; ++i) { - this.slice(keys[i], arg[keys[i]]); - } - return this; - } - this._ensurePath('slice'); - path = this._path; - val = arguments[0]; - } else if (2 === arguments.length) { - if ('number' === typeof arguments[0]) { - this._ensurePath('slice'); - path = this._path; - val = slice(arguments); - } else { - path = arguments[0]; - val = arguments[1]; - } - } else if (3 === arguments.length) { - path = arguments[0]; - val = slice(arguments, 1); - } - - var myFields = this._fields || (this._fields = {}); - myFields[path] = { '$slice': val }; - return this; -} - -/** - * Sets the sort order - * - * If an object is passed, values allowed are 'asc', 'desc', 'ascending', 'descending', 1, and -1. - * - * If a string is passed, it must be a space delimited list of path names. The sort order of each path is ascending unless the path name is prefixed with `-` which will be treated as descending. - * - * ####Example - * - * // these are equivalent - * query.sort({ field: 'asc', test: -1 }); - * query.sort('field -test'); - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Object|String} arg - * @return {Query} this - * @api public - */ - -Query.prototype.sort = function (arg) { - if (!arg) return this; - - this._validate('sort'); - - var type = typeof arg; - - if (1 === arguments.length && 'string' == type) { - arg = arg.split(/\s+/); - - for (var i = 0, len = arg.length; i < len; ++i) { - var field = arg[i]; - if (!field) continue; - var ascend = '-' == field[0] ? -1 : 1; - if (ascend === -1) field = field.substring(1); - push(this.options, field, ascend); - } - - return this; - } - - if (utils.isObject(arg)) { - var keys = utils.keys(arg); - for (var i = 0; i < keys.length; ++i) { - var field = keys[i]; - push(this.options, field, arg[field]); - } - - return this; - } - - throw new TypeError('Invalid sort() argument. Must be a string or object.'); -} - -/*! - * @ignore - */ - -function push (opts, field, value) { - if (value && value.$meta) { - var s = opts.sort || (opts.sort = {}); - s[field] = { $meta : value.$meta }; - return; - } - - var val = String(value || 1).toLowerCase(); - if (!/^(?:ascending|asc|descending|desc|1|-1)$/.test(val)) { - if (utils.isArray(value)) value = '['+value+']'; - throw new TypeError('Invalid sort value: {' + field + ': ' + value + ' }'); - } - // store `sort` in a sane format - var s = opts.sort || (opts.sort = {}); - var valueStr = value.toString() - .replace("asc", "1") - .replace("ascending", "1") - .replace("desc", "-1") - .replace("descending", "-1"); - s[field] = parseInt(valueStr, 10); -} - -/** - * Specifies the limit option. - * - * ####Example - * - * query.limit(20) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method limit - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Blimit%28%29%7D%7D - * @api public - */ -/** - * Specifies the skip option. - * - * ####Example - * - * query.skip(100).limit(20) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method skip - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bskip%28%29%7D%7D - * @api public - */ -/** - * Specifies the maxScan option. - * - * ####Example - * - * query.maxScan(100) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method maxScan - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24maxScan - * @api public - */ -/** - * Specifies the batchSize option. - * - * ####Example - * - * query.batchSize(100) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method batchSize - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7BbatchSize%28%29%7D%7D - * @api public - */ -/** - * Specifies the `comment` option. - * - * ####Example - * - * query.comment('login query') - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @method comment - * @memberOf Query - * @param {Number} val - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24comment - * @api public - */ - -/*! - * limit, skip, maxScan, batchSize, comment - * - * Sets these associated options. - * - * query.comment('feed query'); - */ - -;['limit', 'skip', 'maxScan', 'batchSize', 'comment'].forEach(function (method) { - Query.prototype[method] = function (v) { - this._validate(method); - this.options[method] = v; - return this; - }; -}) - -/** - * Specifies the maxTimeMS option. - * - * ####Example - * - * query.maxTime(100) - * - * @method maxTime - * @memberOf Query - * @param {Number} val - * @see mongodb http://docs.mongodb.org/manual/reference/operator/meta/maxTimeMS/#op._S_maxTimeMS - * @api public - */ - -Query.prototype.maxTime = function (v) { - this._validate('maxTime'); - this.options.maxTimeMS = v; - return this; -}; - -/** - * Specifies this query as a `snapshot` query. - * - * ####Example - * - * mquery().snapshot() // true - * mquery().snapshot(true) - * mquery().snapshot(false) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%7B%7Bsnapshot%28%29%7D%7D - * @return {Query} this - * @api public - */ - -Query.prototype.snapshot = function () { - this._validate('snapshot'); - - this.options.snapshot = arguments.length - ? !! arguments[0] - : true - - return this; -} - -/** - * Sets query hints. - * - * ####Example - * - * query.hint({ indexA: 1, indexB: -1}) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Object} val a hint object - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Advanced+Queries#AdvancedQueries-%24hint - * @api public - */ - -Query.prototype.hint = function () { - if (0 === arguments.length) return this; - - this._validate('hint'); - - var arg = arguments[0]; - if (utils.isObject(arg)) { - var hint = this.options.hint || (this.options.hint = {}); - - // must keep object keys in order so don't use Object.keys() - for (var k in arg) { - hint[k] = arg[k]; - } - - return this; - } - - throw new TypeError('Invalid hint. ' + arg); -} - -/** - * Sets the slaveOk option. _Deprecated_ in MongoDB 2.2 in favor of read preferences. - * - * ####Example: - * - * query.slaveOk() // true - * query.slaveOk(true) - * query.slaveOk(false) - * - * @deprecated use read() preferences instead if on mongodb >= 2.2 - * @param {Boolean} v defaults to true - * @see mongodb http://docs.mongodb.org/manual/applications/replication/#read-preference - * @see read() - * @return {Query} this - * @api public - */ - -Query.prototype.slaveOk = function (v) { - this.options.slaveOk = arguments.length ? !!v : true; - return this; -} - -/** - * Sets the readPreference option for the query. - * - * ####Example: - * - * new Query().read('primary') - * new Query().read('p') // same as primary - * - * new Query().read('primaryPreferred') - * new Query().read('pp') // same as primaryPreferred - * - * new Query().read('secondary') - * new Query().read('s') // same as secondary - * - * new Query().read('secondaryPreferred') - * new Query().read('sp') // same as secondaryPreferred - * - * new Query().read('nearest') - * new Query().read('n') // same as nearest - * - * // you can also use mongodb.ReadPreference class to also specify tags - * new Query().read(mongodb.ReadPreference('secondary', [{ dc:'sf', s: 1 },{ dc:'ma', s: 2 }])) - * - * ####Preferences: - * - * primary - (default) Read from primary only. Operations will produce an error if primary is unavailable. Cannot be combined with tags. - * secondary Read from secondary if available, otherwise error. - * primaryPreferred Read from primary if available, otherwise a secondary. - * secondaryPreferred Read from a secondary if available, otherwise read from the primary. - * nearest All operations read from among the nearest candidates, but unlike other modes, this option will include both the primary and all secondaries in the random selection. - * - * Aliases - * - * p primary - * pp primaryPreferred - * s secondary - * sp secondaryPreferred - * n nearest - * - * Read more about how to use read preferences [here](http://docs.mongodb.org/manual/applications/replication/#read-preference) and [here](http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences). - * - * @param {String|ReadPreference} pref one of the listed preference options or their aliases - * @see mongodb http://docs.mongodb.org/manual/applications/replication/#read-preference - * @see driver http://mongodb.github.com/node-mongodb-native/driver-articles/anintroductionto1_1and2_2.html#read-preferences - * @return {Query} this - * @api public - */ - -Query.prototype.read = function (pref) { - if (arguments.length > 1 && !Query.prototype.read.deprecationWarningIssued) { - console.error("Deprecation warning: 'tags' argument is not supported anymore in Query.read() method. Please use mongodb.ReadPreference object instead."); - Query.prototype.read.deprecationWarningIssued = true; - } - this.options.readPreference = utils.readPref(pref); - return this; -} - -/** - * Sets tailable option. - * - * ####Example - * - * query.tailable() <== true - * query.tailable(true) - * query.tailable(false) - * - * ####Note - * - * Cannot be used with `distinct()` - * - * @param {Boolean} v defaults to true - * @see mongodb http://www.mongodb.org/display/DOCS/Tailable+Cursors - * @api public - */ - -Query.prototype.tailable = function () { - this._validate('tailable'); - - this.options.tailable = arguments.length - ? !! arguments[0] - : true; - - return this; -} - -/** - * Merges another Query or conditions object into this one. - * - * When a Query is passed, conditions, field selection and options are merged. - * - * @param {Query|Object} source - * @return {Query} this - */ - -Query.prototype.merge = function (source) { - if (!source) - return this; - - if (!Query.canMerge(source)) - throw new TypeError('Invalid argument. Expected instanceof mquery or plain object'); - - if (source instanceof Query) { - // if source has a feature, apply it to ourselves - - if (source._conditions) { - utils.merge(this._conditions, source._conditions); - } - - if (source._fields) { - this._fields || (this._fields = {}); - utils.merge(this._fields, source._fields); - } - - if (source.options) { - this.options || (this.options = {}); - utils.merge(this.options, source.options); - } - - if (source._update) { - this._update || (this._update = {}); - utils.mergeClone(this._update, source._update); - } - - if (source._distinct) { - this._distinct = source._distinct; - } - - return this; - } - - // plain object - utils.merge(this._conditions, source); - - return this; -} - -/** - * Finds documents. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * query.find() - * query.find(callback) - * query.find({ name: 'Burning Lights' }, callback) - * - * @param {Object} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.find = function (criteria, callback) { - this.op = 'find'; - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) return this; - - var self = this - , conds = this._conditions - , options = this._optionsForExec() - - options.fields = this._fieldsForExec() - - debug('find', this._collection.collectionName, conds, options); - callback = this._wrapCallback('find', callback, { - conditions: conds - , options: options - }); - - this._collection.find(conds, options, utils.tick(callback)); - return this; -} - -/** - * Executes the query as a findOne() operation. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * query.findOne().where('name', /^Burning/); - * - * query.findOne({ name: /^Burning/ }) - * - * query.findOne({ name: /^Burning/ }, callback); // executes - * - * query.findOne(function (err, doc) { - * if (err) return handleError(err); - * if (doc) { - * // doc may be null if no document matched - * - * } - * }); - * - * @param {Object|Query} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.findOne = function (criteria, callback) { - this.op = 'findOne'; - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) return this; - - var self = this - , conds = this._conditions - , options = this._optionsForExec() - - options.fields = this._fieldsForExec(); - - debug('findOne', this._collection.collectionName, conds, options); - callback = this._wrapCallback('findOne', callback, { - conditions: conds - , options: options - }); - - this._collection.findOne(conds, options, utils.tick(callback)); - - return this; -} - -/** - * Exectues the query as a count() operation. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * query.count().where('color', 'black').exec(callback); - * - * query.count({ color: 'black' }).count(callback) - * - * query.count({ color: 'black' }, callback) - * - * query.where('color', 'black').count(function (err, count) { - * if (err) return handleError(err); - * console.log('there are %d kittens', count); - * }) - * - * @param {Object} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Count - * @api public - */ - -Query.prototype.count = function (criteria, callback) { - this.op = 'count'; - this._validate(); - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) return this; - - var conds = this._conditions - , options = this._optionsForExec() - - debug('count', this._collection.collectionName, conds, options); - callback = this._wrapCallback('count', callback, { - conditions: conds - , options: options - }); - - this._collection.count(conds, options, utils.tick(callback)); - return this; -} - -/** - * Declares or executes a distinct() operation. - * - * Passing a `callback` executes the query. - * - * ####Example - * - * distinct(criteria, field, fn) - * distinct(criteria, field) - * distinct(field, fn) - * distinct(field) - * distinct(fn) - * distinct() - * - * @param {Object|Query} [criteria] - * @param {String} [field] - * @param {Function} [callback] - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/Aggregation#Aggregation-Distinct - * @api public - */ - -Query.prototype.distinct = function (criteria, field, callback) { - this.op = 'distinct'; - this._validate(); - - if (!callback) { - switch (typeof field) { - case 'function': - callback = field; - if ('string' == typeof criteria) { - field = criteria; - criteria = undefined; - } - break; - case 'undefined': - case 'string': - break; - default: - throw new TypeError('Invalid `field` argument. Must be string or function') - break; - } - - switch (typeof criteria) { - case 'function': - callback = criteria; - criteria = field = undefined; - break; - case 'string': - field = criteria; - criteria = undefined; - break; - } - } - - if ('string' == typeof field) { - this._distinct = field; - } - - if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (!callback) { - return this; - } - - if (!this._distinct) { - throw new Error('No value for `distinct` has been declared'); - } - - var conds = this._conditions - , options = this._optionsForExec() - - debug('distinct', this._collection.collectionName, conds, options); - callback = this._wrapCallback('distinct', callback, { - conditions: conds - , options: options - }); - - this._collection.distinct(this._distinct, conds, options, utils.tick(callback)); - - return this; -} - -/** - * Declare and/or execute this query as an update() operation. - * - * _All paths passed that are not $atomic operations will become $set ops._ - * - * ####Example - * - * mquery({ _id: id }).update({ title: 'words' }, ...) - * - * becomes - * - * collection.update({ _id: id }, { $set: { title: 'words' }}, ...) - * - * ####Note - * - * Passing an empty object `{}` as the doc will result in a no-op unless the `overwrite` option is passed. Without the `overwrite` option set, the update operation will be ignored and the callback executed without sending the command to MongoDB so as to prevent accidently overwritting documents in the collection. - * - * ####Note - * - * The operation is only executed when a callback is passed. To force execution without a callback (which would be an unsafe write), we must first call update() and then execute it by using the `exec()` method. - * - * var q = mquery(collection).where({ _id: id }); - * q.update({ $set: { name: 'bob' }}).update(); // not executed - * - * var q = mquery(collection).where({ _id: id }); - * q.update({ $set: { name: 'bob' }}).exec(); // executed as unsafe - * - * // keys that are not $atomic ops become $set. - * // this executes the same command as the previous example. - * q.update({ name: 'bob' }).where({ _id: id }).exec(); - * - * var q = mquery(collection).update(); // not executed - * - * // overwriting with empty docs - * var q.where({ _id: id }).setOptions({ overwrite: true }) - * q.update({ }, callback); // executes - * - * // multi update with overwrite to empty doc - * var q = mquery(collection).where({ _id: id }); - * q.setOptions({ multi: true, overwrite: true }) - * q.update({ }); - * q.update(callback); // executed - * - * // multi updates - * mquery() - * .collection(coll) - * .update({ name: /^match/ }, { $set: { arr: [] }}, { multi: true }, callback) - * // more multi updates - * mquery({ }) - * .collection(coll) - * .setOptions({ multi: true }) - * .update({ $set: { arr: [] }}, callback) - * - * // single update by default - * mquery({ email: 'address@example.com' }) - * .collection(coll) - * .update({ $inc: { counter: 1 }}, callback) - * - * // summary - * update(criteria, doc, opts, cb) // executes - * update(criteria, doc, opts) - * update(criteria, doc, cb) // executes - * update(criteria, doc) - * update(doc, cb) // executes - * update(doc) - * update(cb) // executes - * update(true) // executes (unsafe write) - * update() - * - * @param {Object} [criteria] - * @param {Object} [doc] the update command - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.update = function update (criteria, doc, options, callback) { - this.op = 'update'; - var force; - - switch (arguments.length) { - case 3: - if ('function' == typeof options) { - callback = options; - options = undefined; - } - break; - case 2: - if ('function' == typeof doc) { - callback = doc; - doc = criteria; - criteria = undefined; - } - break; - case 1: - switch (typeof criteria) { - case 'function': - callback = criteria; - criteria = options = doc = undefined; - break; - case 'boolean': - // execution with no callback (unsafe write) - force = criteria; - criteria = undefined; - break; - default: - doc = criteria; - criteria = options = undefined; - break; - } - } - - if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - if (doc) { - this._mergeUpdate(doc); - } - - if (utils.isObject(options)) { - // { overwrite: true } - this.setOptions(options); - } - - // we are done if we don't have callback and they are - // not forcing an unsafe write. - if (!(force || callback)) - return this; - - if (!this._update || - !this.options.overwrite && 0 === utils.keys(this._update).length) { - callback && utils.soon(callback.bind(null, null, 0)); - return this; - } - - options = this._optionsForExec(); - if (!callback) options.safe = false; - - var criteria = this._conditions; - doc = this._updateForExec(); - - debug('update', this._collection.collectionName, criteria, doc, options); - callback = this._wrapCallback('update', callback, { - conditions: criteria - , doc: doc - , options: options - }); - - this._collection.update(criteria, doc, options, utils.tick(callback)); - - return this; -} - -/** - * Declare and/or execute this query as a remove() operation. - * - * ####Example - * - * mquery(collection).remove({ artist: 'Anne Murray' }, callback) - * - * ####Note - * - * The operation is only executed when a callback is passed. To force execution without a callback (which would be an unsafe write), we must first call remove() and then execute it by using the `exec()` method. - * - * // not executed - * var query = mquery(collection).remove({ name: 'Anne Murray' }) - * - * // executed - * mquery(collection).remove({ name: 'Anne Murray' }, callback) - * mquery(collection).remove({ name: 'Anne Murray' }).remove(callback) - * - * // executed without a callback (unsafe write) - * query.exec() - * - * // summary - * query.remove(conds, fn); // executes - * query.remove(conds) - * query.remove(fn) // executes - * query.remove() - * - * @param {Object|Query} [criteria] mongodb selector - * @param {Function} [callback] - * @return {Query} this - * @api public - */ - -Query.prototype.remove = function (criteria, callback) { - this.op = 'remove'; - var force; - - if ('function' === typeof criteria) { - callback = criteria; - criteria = undefined; - } else if (Query.canMerge(criteria)) { - this.merge(criteria); - } else if (true === criteria) { - force = criteria; - criteria = undefined; - } - - if (!(force || callback)) - return this; - - var options = this._optionsForExec() - if (!callback) options.safe = false; - - var conds = this._conditions; - - debug('remove', this._collection.collectionName, conds, options); - callback = this._wrapCallback('remove', callback, { - conditions: conds - , options: options - }); - - this._collection.remove(conds, options, utils.tick(callback)); - - return this; -} - -/** - * Issues a mongodb [findAndModify](http://www.mongodb.org/display/DOCS/findAndModify+Command) update command. - * - * Finds a matching document, updates it according to the `update` arg, passing any `options`, and returns the found document (if any) to the callback. The query executes immediately if `callback` is passed. - * - * ####Available options - * - * - `new`: bool - true to return the modified document rather than the original. defaults to true - * - `upsert`: bool - creates the object if it doesn't exist. defaults to false. - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - * ####Examples - * - * query.findOneAndUpdate(conditions, update, options, callback) // executes - * query.findOneAndUpdate(conditions, update, options) // returns Query - * query.findOneAndUpdate(conditions, update, callback) // executes - * query.findOneAndUpdate(conditions, update) // returns Query - * query.findOneAndUpdate(update, callback) // returns Query - * query.findOneAndUpdate(update) // returns Query - * query.findOneAndUpdate(callback) // executes - * query.findOneAndUpdate() // returns Query - * - * @param {Object|Query} [query] - * @param {Object} [doc] - * @param {Object} [options] - * @param {Function} [callback] - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @return {Query} this - * @api public - */ - -Query.prototype.findOneAndUpdate = function (criteria, doc, options, callback) { - this.op = 'findOneAndUpdate'; - this._validate(); - - switch (arguments.length) { - case 3: - if ('function' == typeof options) { - callback = options; - options = {}; - } - break; - case 2: - if ('function' == typeof doc) { - callback = doc; - doc = criteria; - criteria = undefined; - } - options = undefined; - break; - case 1: - if ('function' == typeof criteria) { - callback = criteria; - criteria = options = doc = undefined; - } else { - doc = criteria; - criteria = options = undefined; - } - } - - if (Query.canMerge(criteria)) { - this.merge(criteria); - } - - // apply doc - if (doc) { - this._mergeUpdate(doc); - } - - options && this.setOptions(options); - - if (!callback) return this; - return this._findAndModify('update', callback); -} - -/** - * Issues a mongodb [findAndModify](http://www.mongodb.org/display/DOCS/findAndModify+Command) remove command. - * - * Finds a matching document, removes it, passing the found document (if any) to the callback. Executes immediately if `callback` is passed. - * - * ####Available options - * - * - `sort`: if multiple docs are found by the conditions, sets the sort order to choose which doc to update - * - * ####Examples - * - * A.where().findOneAndRemove(conditions, options, callback) // executes - * A.where().findOneAndRemove(conditions, options) // return Query - * A.where().findOneAndRemove(conditions, callback) // executes - * A.where().findOneAndRemove(conditions) // returns Query - * A.where().findOneAndRemove(callback) // executes - * A.where().findOneAndRemove() // returns Query - * - * @param {Object} [conditions] - * @param {Object} [options] - * @param {Function} [callback] - * @return {Query} this - * @see mongodb http://www.mongodb.org/display/DOCS/findAndModify+Command - * @api public - */ - -Query.prototype.findOneAndRemove = function (conditions, options, callback) { - this.op = 'findOneAndRemove'; - this._validate(); - - if ('function' == typeof options) { - callback = options; - options = undefined; - } else if ('function' == typeof conditions) { - callback = conditions; - conditions = undefined; - } - - // apply conditions - if (Query.canMerge(conditions)) { - this.merge(conditions); - } - - // apply options - options && this.setOptions(options); - - if (!callback) return this; - - return this._findAndModify('remove', callback); -} - -/** - * _findAndModify - * - * @param {String} type - either "remove" or "update" - * @param {Function} callback - * @api private - */ - -Query.prototype._findAndModify = function (type, callback) { - assert.equal('function', typeof callback); - - var opts = this._optionsForExec() - , self = this - , fields - , sort - , doc - - if ('remove' == type) { - opts.remove = true; - } else { - if (!('new' in opts)) opts.new = true; - if (!('upsert' in opts)) opts.upsert = false; - - doc = this._updateForExec() - if (!doc) { - if (opts.upsert) { - // still need to do the upsert to empty doc - doc = { $set: {} }; - } else { - return this.findOne(callback); - } - } - } - - var fields = this._fieldsForExec(); - if (fields) { - opts.fields = fields; - } - - var conds = this._conditions; - - debug('findAndModify', this._collection.collectionName, conds, doc, opts); - callback = this._wrapCallback('findAndModify', callback, { - conditions: conds - , doc: doc - , options: opts - }); - - this._collection - .findAndModify(conds, doc, opts, utils.tick(callback)); - - return this; -} - -/** - * Wrap callback to add tracing - * - * @param {Function} callback - * @param {Object} [queryInfo] - * @api private - */ -Query.prototype._wrapCallback = function (method, callback, queryInfo) { - var traceFunction = this._traceFunction || Query.traceFunction; - - if (traceFunction) { - queryInfo.collectionName = this._collection.collectionName; - - var traceCallback = traceFunction && - traceFunction.call(null, method, queryInfo, this); - - var startTime = new Date().getTime(); - - return function wrapperCallback (err, result) { - if (traceCallback) { - var millis = new Date().getTime() - startTime; - traceCallback.call(null, err, result, millis); - } - - if (callback) { - callback.apply(null, arguments); - } - }; - } - - return callback; -} - -/** - * Add trace function that gets called when the query is executed. - * The function will be called with (method, queryInfo, query) and - * should return a callback function which will be called - * with (err, result, millis) when the query is complete. - * - * queryInfo is an object containing: { - * collectionName: , - * conditions: , - * options: , - * doc: [document to update, if applicable] - * } - * - * NOTE: Does not trace stream queries. - * - * @param {Function} traceFunction - * @return {Query} this - * @api public - */ -Query.prototype.setTraceFunction = function (traceFunction) { - this._traceFunction = traceFunction; - return this; -} - -/** - * Executes the query - * - * ####Examples - * - * query.exec(); - * query.exec(callback); - * query.exec('update'); - * query.exec('find', callback); - * - * @param {String|Function} [operation] - * @param {Function} [callback] - * @api public - */ - -Query.prototype.exec = function exec (op, callback) { - switch (typeof op) { - case 'function': - callback = op; - op = null; - break; - case 'string': - this.op = op; - break; - } - - assert.ok(this.op, "Missing query type: (find, update, etc)"); - - if ('update' == this.op || 'remove' == this.op) { - callback || (callback = true); - } - - this[this.op](callback); -} - -/** - * Returns a thunk which when called runs this.exec() - * - * The thunk receives a callback function which will be - * passed to `this.exec()` - * - * @return {Function} - * @api public - */ - -Query.prototype.thunk = function() { - var self = this; - return function(cb) { - self.exec(cb); - } -} - -/** - * Executes the query returning a `Promise` which will be - * resolved with either the doc(s) or rejected with the error. - * - * @param {Function} [resolve] - * @param {Function} [reject] - * @return {Promise} - * @api public - */ - -Query.prototype.then = function(resolve, reject) { - var self = this; - var promise = new Query.Promise(function(success, error) { - self.exec(function(err, val) { - if (err) error(err); - else success(val); - self = success = error = null; - }); - }); - return promise.then(resolve, reject); -} - -/** - * Returns a stream for the given find query. - * - * @throws Error if operation is not a find - * @returns {Stream} Node 0.8 style - */ - -Query.prototype.stream = function(streamOptions) { - if ('find' != this.op) - throw new Error('stream() is only available for find'); - - var conds = this._conditions; - - var options = this._optionsForExec() - options.fields = this._fieldsForExec() - - debug('stream', this._collection.collectionName, conds, options, streamOptions); - - return this._collection.findStream(conds, options, streamOptions); -} - -/** - * Determines if field selection has been made. - * - * @return {Boolean} - * @api public - */ - -Query.prototype.selected = function selected () { - return !! (this._fields && Object.keys(this._fields).length > 0); -} - -/** - * Determines if inclusive field selection has been made. - * - * query.selectedInclusively() // false - * query.select('name') - * query.selectedInclusively() // true - * query.selectedExlusively() // false - * - * @returns {Boolean} - */ - -Query.prototype.selectedInclusively = function selectedInclusively () { - if (!this._fields) return false; - - var keys = Object.keys(this._fields); - if (0 === keys.length) return false; - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (0 === this._fields[key]) return false; - if (this._fields[key] && - typeof this._fields[key] === 'object' && - this._fields[key].$meta) { - return false; - } - } - - return true; -} - -/** - * Determines if exclusive field selection has been made. - * - * query.selectedExlusively() // false - * query.select('-name') - * query.selectedExlusively() // true - * query.selectedInclusively() // false - * - * @returns {Boolean} - */ - -Query.prototype.selectedExclusively = function selectedExclusively () { - if (!this._fields) return false; - - var keys = Object.keys(this._fields); - if (0 === keys.length) return false; - - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (0 === this._fields[key]) return true; - } - - return false; -} - -/** - * Merges `doc` with the current update object. - * - * @param {Object} doc - */ - -Query.prototype._mergeUpdate = function (doc) { - if (!this._update) this._update = {}; - if (doc instanceof Query) { - if (doc._update) { - utils.mergeClone(this._update, doc._update); - } - } else { - utils.mergeClone(this._update, doc); - } -} - -/** - * Returns default options. - * - * @return {Object} - * @api private - */ - -Query.prototype._optionsForExec = function () { - var options = utils.clone(this.options, { retainKeyOrder: true }); - return options; -} - -/** - * Returns fields selection for this query. - * - * @return {Object} - * @api private - */ - -Query.prototype._fieldsForExec = function () { - return utils.clone(this._fields, { retainKeyOrder: true }); -} - -/** - * Return an update document with corrected $set operations. - * - * @api private - */ - -Query.prototype._updateForExec = function () { - var update = utils.clone(this._update, { retainKeyOrder: true }) - , ops = utils.keys(update) - , i = ops.length - , ret = {} - , hasKeys - , val - - while (i--) { - var op = ops[i]; - - if (this.options.overwrite) { - ret[op] = update[op]; - continue; - } - - if ('$' !== op[0]) { - // fix up $set sugar - if (!ret.$set) { - if (update.$set) { - ret.$set = update.$set; - } else { - ret.$set = {}; - } - } - ret.$set[op] = update[op]; - ops.splice(i, 1); - if (!~ops.indexOf('$set')) ops.push('$set'); - } else if ('$set' === op) { - if (!ret.$set) { - ret[op] = update[op]; - } - } else { - ret[op] = update[op]; - } - } - - return ret; -} - -/** - * Make sure _path is set. - * - * @parmam {String} method - */ - -Query.prototype._ensurePath = function (method) { - if (!this._path) { - var msg = method + '() must be used after where() ' - + 'when called with these arguments' - throw new Error(msg); - } -} - -/*! - * Permissions - */ - -Query.permissions = require('./permissions'); - -Query._isPermitted = function (a, b) { - var denied = Query.permissions[b]; - if (!denied) return true; - return true !== denied[a]; -} - -Query.prototype._validate = function (action) { - var fail; - var validator; - - if (undefined === action) { - - validator = Query.permissions[this.op]; - if ('function' != typeof validator) return true; - - fail = validator(this); - - } else if (!Query._isPermitted(action, this.op)) { - fail = action; - } - - if (fail) { - throw new Error(fail + ' cannot be used with ' + this.op); - } -} - -/** - * Determines if `conds` can be merged using `mquery().merge()` - * - * @param {Object} conds - * @return {Boolean} - */ - -Query.canMerge = function (conds) { - return conds instanceof Query || utils.isObject(conds); -} - -/** - * Set a trace function that will get called whenever a - * query is executed. - * - * See `setTraceFunction()` for details. - * - * @param {Object} conds - * @return {Boolean} - */ -Query.setGlobalTraceFunction = function (traceFunction) { - Query.traceFunction = traceFunction; -} - -/*! - * Exports. - */ - -Query.utils = utils; -Query.env = require('./env') -Query.Collection = require('./collection'); -Query.BaseCollection = require('./collection/collection'); -Query.Promise = require('bluebird'); -module.exports = exports = Query; - -// TODO -// test utils diff --git a/Databases/node_modules/mongoose/node_modules/mquery/lib/permissions.js b/Databases/node_modules/mongoose/node_modules/mquery/lib/permissions.js deleted file mode 100644 index 5008a972..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/lib/permissions.js +++ /dev/null @@ -1,90 +0,0 @@ -'use strict'; - -var denied = exports; - -denied.distinct = function (self) { - if (self._fields && Object.keys(self._fields).length > 0) { - return 'field selection and slice' - } - - var keys = Object.keys(denied.distinct); - var err; - - keys.every(function (option) { - if (self.options[option]) { - err = option; - return false; - } - return true; - }); - - return err; -}; -denied.distinct.select = -denied.distinct.slice = -denied.distinct.sort = -denied.distinct.limit = -denied.distinct.skip = -denied.distinct.batchSize = -denied.distinct.comment = -denied.distinct.maxScan = -denied.distinct.snapshot = -denied.distinct.hint = -denied.distinct.tailable = true; - - -// aggregation integration - - -denied.findOneAndUpdate = -denied.findOneAndRemove = function (self) { - var keys = Object.keys(denied.findOneAndUpdate); - var err; - - keys.every(function (option) { - if (self.options[option]) { - err = option; - return false; - } - return true; - }); - - return err; -} -denied.findOneAndUpdate.limit = -denied.findOneAndUpdate.skip = -denied.findOneAndUpdate.batchSize = -denied.findOneAndUpdate.maxScan = -denied.findOneAndUpdate.snapshot = -denied.findOneAndUpdate.hint = -denied.findOneAndUpdate.tailable = -denied.findOneAndUpdate.comment = true; - - -denied.count = function (self) { - if (self._fields && Object.keys(self._fields).length > 0) { - return 'field selection and slice' - } - - var keys = Object.keys(denied.count); - var err; - - keys.every(function (option) { - if (self.options[option]) { - err = option; - return false; - } - return true; - }); - - return err; -} - -denied.count.select = -denied.count.slice = -denied.count.sort = -denied.count.batchSize = -denied.count.comment = -denied.count.maxScan = -denied.count.snapshot = -denied.count.tailable = true; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/lib/utils.js b/Databases/node_modules/mongoose/node_modules/mquery/lib/utils.js deleted file mode 100644 index 6707ce23..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/lib/utils.js +++ /dev/null @@ -1,331 +0,0 @@ -'use strict'; - -/*! - * Module dependencies. - */ - -var RegExpClone = require('regexp-clone') - -/** - * Clones objects - * - * @param {Object} obj the object to clone - * @param {Object} options - * @return {Object} the cloned object - * @api private - */ - -var clone = exports.clone = function clone (obj, options) { - if (obj === undefined || obj === null) - return obj; - - if (Array.isArray(obj)) - return exports.cloneArray(obj, options); - - if (obj.constructor) { - if (/ObjectI[dD]$/.test(obj.constructor.name)) { - return 'function' == typeof obj.clone - ? obj.clone() - : new obj.constructor(obj.id); - } - - if ('ReadPreference' === obj._type && obj.isValid && obj.toObject) { - return 'function' == typeof obj.clone - ? obj.clone() - : new obj.constructor(obj.mode, clone(obj.tags, options)); - } - - if ('Binary' == obj._bsontype && obj.buffer && obj.value) { - return 'function' == typeof obj.clone - ? obj.clone() - : new obj.constructor(obj.value(true), obj.sub_type); - } - - if ('Date' === obj.constructor.name || 'Function' === obj.constructor.name) - return new obj.constructor(+obj); - - if ('RegExp' === obj.constructor.name) - return RegExpClone(obj); - - if ('Buffer' === obj.constructor.name) - return exports.cloneBuffer(obj); - } - - if (isObject(obj)) - return exports.cloneObject(obj, options); - - if (obj.valueOf) - return obj.valueOf(); -}; - -/*! - * ignore - */ - -var cloneObject = exports.cloneObject = function cloneObject (obj, options) { - var retainKeyOrder = options && options.retainKeyOrder - , minimize = options && options.minimize - , ret = {} - , hasKeys - , keys - , val - , k - , i - - if (retainKeyOrder) { - for (k in obj) { - val = clone(obj[k], options); - - if (!minimize || ('undefined' !== typeof val)) { - hasKeys || (hasKeys = true); - ret[k] = val; - } - } - } else { - // faster - - keys = Object.keys(obj); - i = keys.length; - - while (i--) { - k = keys[i]; - val = clone(obj[k], options); - - if (!minimize || ('undefined' !== typeof val)) { - if (!hasKeys) hasKeys = true; - ret[k] = val; - } - } - } - - return minimize - ? hasKeys && ret - : ret; -}; - -var cloneArray = exports.cloneArray = function cloneArray (arr, options) { - var ret = []; - for (var i = 0, l = arr.length; i < l; i++) - ret.push(clone(arr[i], options)); - return ret; -}; - -/** - * process.nextTick helper. - * - * Wraps the given `callback` in a try/catch. If an error is - * caught it will be thrown on nextTick. - * - * node-mongodb-native had a habit of state corruption when - * an error was immediately thrown from within a collection - * method (find, update, etc) callback. - * - * @param {Function} [callback] - * @api private - */ - -var tick = exports.tick = function tick (callback) { - if ('function' !== typeof callback) return; - return function () { - // callbacks should always be fired on the next - // turn of the event loop. A side benefit is - // errors thrown from executing the callback - // will not cause drivers state to be corrupted - // which has historically been a problem. - var args = arguments; - soon(function(){ - callback.apply(this, args); - }); - } -} - -/** - * Merges `from` into `to` without overwriting existing properties. - * - * @param {Object} to - * @param {Object} from - * @api private - */ - -var merge = exports.merge = function merge (to, from) { - var keys = Object.keys(from) - , i = keys.length - , key - - while (i--) { - key = keys[i]; - if ('undefined' === typeof to[key]) { - to[key] = from[key]; - } else { - if (exports.isObject(from[key])) { - merge(to[key], from[key]); - } else { - to[key] = from[key]; - } - } - } -} - -/** - * Same as merge but clones the assigned values. - * - * @param {Object} to - * @param {Object} from - * @api private - */ - -var mergeClone = exports.mergeClone = function mergeClone (to, from) { - var keys = Object.keys(from) - , i = keys.length - , key - - while (i--) { - key = keys[i]; - if ('undefined' === typeof to[key]) { - // make sure to retain key order here because of a bug handling the $each - // operator in mongodb 2.4.4 - to[key] = clone(from[key], { retainKeyOrder : 1}); - } else { - if (exports.isObject(from[key])) { - mergeClone(to[key], from[key]); - } else { - // make sure to retain key order here because of a bug handling the - // $each operator in mongodb 2.4.4 - to[key] = clone(from[key], { retainKeyOrder : 1}); - } - } - } -} - -/** - * Read pref helper (mongo 2.2 drivers support this) - * - * Allows using aliases instead of full preference names: - * - * p primary - * pp primaryPreferred - * s secondary - * sp secondaryPreferred - * n nearest - * - * @param {String} pref - */ - -exports.readPref = function readPref (pref) { - switch (pref) { - case 'p': - pref = 'primary'; - break; - case 'pp': - pref = 'primaryPreferred'; - break; - case 's': - pref = 'secondary'; - break; - case 'sp': - pref = 'secondaryPreferred'; - break; - case 'n': - pref = 'nearest'; - break; - } - - return pref; -} - -/** - * Object.prototype.toString.call helper - */ - -var _toString = Object.prototype.toString; -var toString = exports.toString = function (arg) { - return _toString.call(arg); -} - -/** - * Determines if `arg` is an object. - * - * @param {Object|Array|String|Function|RegExp|any} arg - * @return {Boolean} - */ - -var isObject = exports.isObject = function (arg) { - return '[object Object]' == exports.toString(arg); -} - -/** - * Determines if `arg` is an array. - * - * @param {Object} - * @return {Boolean} - * @see nodejs utils - */ - -var isArray = exports.isArray = function (arg) { - return Array.isArray(arg) || - 'object' == typeof arg && '[object Array]' == exports.toString(arg); -} - -/** - * Object.keys helper - */ - -exports.keys = Object.keys || function (obj) { - var keys = []; - for (var k in obj) if (obj.hasOwnProperty(k)) { - keys.push(k); - } - return keys; -} - -/** - * Basic Object.create polyfill. - * Only one argument is supported. - * - * Based on https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Object/create - */ - -exports.create = 'function' == typeof Object.create - ? Object.create - : create; - -function create (proto) { - if (arguments.length > 1) { - throw new Error("Adding properties is not supported") - } - - function F () {} - F.prototype = proto; - return new F; -} - -/** - * inheritance - */ - -exports.inherits = function (ctor, superCtor) { - ctor.prototype = exports.create(superCtor.prototype); - ctor.prototype.constructor = ctor; -} - -/** - * nextTick helper - * compat with node 0.10 which behaves differently than previous versions - */ - -var soon = exports.soon = 'function' == typeof setImmediate - ? setImmediate - : process.nextTick; - -/** - * Clones the contents of a buffer. - * - * @param {Buffer} buff - * @return {Buffer} - */ - -exports.cloneBuffer = function (buff) { - var dupe = new Buffer(buff.length); - buff.copy(dupe, 0, 0, buff.length); - return dupe; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE deleted file mode 100644 index a3966cf9..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Petka Antonov - -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/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md deleted file mode 100644 index 5e920957..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/README.md +++ /dev/null @@ -1,676 +0,0 @@ - - Promises/A+ logo - -[![Build Status](https://travis-ci.org/petkaantonov/bluebird.svg?branch=master)](https://travis-ci.org/petkaantonov/bluebird) -[![coverage-98%](http://img.shields.io/badge/coverage-98%-brightgreen.svg?style=flat)](http://petkaantonov.github.io/bluebird/coverage/debug/index.html) - - -# Introduction - -Bluebird is a fully featured [promise](#what-are-promises-and-why-should-i-use-them) library with focus on innovative features and performance - - - -# Topics - -- [Features](#features) -- [Quick start](#quick-start) -- [API Reference and examples](API.md) -- [Support](#support) -- [What are promises and why should I use them?](#what-are-promises-and-why-should-i-use-them) -- [Questions and issues](#questions-and-issues) -- [Error handling](#error-handling) -- [Development](#development) - - [Testing](#testing) - - [Benchmarking](#benchmarks) - - [Custom builds](#custom-builds) - - [For library authors](#for-library-authors) -- [What is the sync build?](#what-is-the-sync-build) -- [License](#license) -- [Snippets for common problems](https://github.com/petkaantonov/bluebird/wiki/Snippets) -- [Promise anti-patterns](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns) -- [Changelog](changelog.md) -- [Optimization guide](#optimization-guide) - -# Features -bluebird logo - -- [Promises A+](http://promisesaplus.com) -- [Synchronous inspection](API.md#synchronous-inspection) -- [Concurrency coordination](API.md#collections) -- [Promisification on steroids](API.md#promisification) -- [Resource management through a parallel of python `with`/C# `using`](API.md#resource-management) -- [Cancellation and timeouts](API.md#cancellation) -- [Parallel for C# `async` and `await`](API.md#generators) -- Mind blowing utilities such as - - [`.bind()`](API.md#binddynamic-thisarg---promise) - - [`.call()`](API.md#callstring-propertyname--dynamic-arg---promise) - - [`Promise.join()`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) - - [And](API.md#core) [much](API.md#timers) [more](API.md#utility)! -- [Practical debugging solutions and sane defaults](#error-handling) -- [Sick performance](benchmark/) - -
        - -# Quick start - -## Node.js - - npm install bluebird - -Then: - -```js -var Promise = require("bluebird"); -``` - -## Browsers - -There are many ways to use bluebird in browsers: - -- Direct downloads - - Full build [bluebird.js](https://cdn.jsdelivr.net/bluebird/latest/bluebird.js) - - Full build minified [bluebird.min.js](https://cdn.jsdelivr.net/bluebird/latest/bluebird.min.js) -- You may use browserify on the main export -- You may use the [bower](http://bower.io) package. - -When using script tags the global variables `Promise` and `P` (alias for `Promise`) become available. - -A [minimal bluebird browser build](#custom-builds) is ≈38.92KB minified*, 11.65KB gzipped and has no external dependencies. - -*Google Closure Compiler using Simple. - -#### Browser support - -Browsers that [implement ECMA-262, edition 3](http://en.wikipedia.org/wiki/Ecmascript#Implementations) and later are supported. - -[![Selenium Test Status](https://saucelabs.com/browser-matrix/petka_antonov.svg)](https://saucelabs.com/u/petka_antonov) - -**Note** that in ECMA-262, edition 3 (IE7, IE8 etc.) it is not possible to use methods that have keyword names like `.catch` and `.finally`. The [API documentation](API.md) always lists a compatible alternative name that you can use if you need to support these browsers. For example `.catch` is replaced with `.caught` and `.finally` with `.lastly`. - -Also, [long stack trace](API.md#promiselongstacktraces---void) support is only available in Chrome, Firefox and Internet Explorer 10+. - -After quick start, see [API Reference and examples](API.md) - -
        - -# Support - -- Mailing list: [bluebird-js@googlegroups.com](https://groups.google.com/forum/#!forum/bluebird-js) -- IRC: #promises @freenode -- StackOverflow: [bluebird tag](http://stackoverflow.com/questions/tagged/bluebird) -- Bugs and feature requests: [github issue tracker](https://github.com/petkaantonov/bluebird/issues?state=open) - -
        - -# What are promises and why should I use them? - -You should use promises to turn this: - -```js -fs.readFile("file.json", function(err, val) { - if( err ) { - console.error("unable to read file"); - } - else { - try { - val = JSON.parse(val); - console.log(val.success); - } - catch( e ) { - console.error("invalid json in file"); - } - } -}); -``` - -Into this: - -```js -fs.readFileAsync("file.json").then(JSON.parse).then(function(val) { - console.log(val.success); -}) -.catch(SyntaxError, function(e) { - console.error("invalid json in file"); -}) -.catch(function(e) { - console.error("unable to read file") -}); -``` - -*If you are wondering "there is no `readFileAsync` method on `fs` that returns a promise", see [promisification](API.md#promisification)* - -Actually you might notice the latter has a lot in common with code that would do the same using synchronous I/O: - -```js -try { - var val = JSON.parse(fs.readFileSync("file.json")); - console.log(val.success); -} -//Syntax actually not supported in JS but drives the point -catch(SyntaxError e) { - console.error("invalid json in file"); -} -catch(Error e) { - console.error("unable to read file") -} -``` - -And that is the point - being able to have something that is a lot like `return` and `throw` in synchronous code. - -You can also use promises to improve code that was written with callback helpers: - - -```js -//Copyright Plato http://stackoverflow.com/a/19385911/995876 -//CC BY-SA 2.5 -mapSeries(URLs, function (URL, done) { - var options = {}; - needle.get(URL, options, function (error, response, body) { - if (error) { - return done(error) - } - try { - var ret = JSON.parse(body); - return done(null, ret); - } - catch (e) { - done(e); - } - }); -}, function (err, results) { - if (err) { - console.log(err) - } else { - console.log('All Needle requests successful'); - // results is a 1 to 1 mapping in order of URLs > needle.body - processAndSaveAllInDB(results, function (err) { - if (err) { - return done(err) - } - console.log('All Needle requests saved'); - done(null); - }); - } -}); -``` - -Is more pleasing to the eye when done with promises: - -```js -Promise.promisifyAll(needle); -var options = {}; - -var current = Promise.resolve(); -Promise.map(URLs, function(URL) { - current = current.then(function () { - return needle.getAsync(URL, options); - }); - return current; -}).map(function(responseAndBody){ - return JSON.parse(responseAndBody[1]); -}).then(function (results) { - return processAndSaveAllInDB(results); -}).then(function(){ - console.log('All Needle requests saved'); -}).catch(function (e) { - console.log(e); -}); -``` - -Also promises don't just give you correspondences for synchronous features but can also be used as limited event emitters or callback aggregators. - -More reading: - - - [Promise nuggets](https://promise-nuggets.github.io/) - - [Why I am switching to promises](http://spion.github.io/posts/why-i-am-switching-to-promises.html) - - [What is the the point of promises](http://domenic.me/2012/10/14/youre-missing-the-point-of-promises/#toc_1) - - [Snippets for common problems](https://github.com/petkaantonov/bluebird/wiki/Snippets) - - [Promise anti-patterns](https://github.com/petkaantonov/bluebird/wiki/Promise-anti-patterns) - -# Questions and issues - -If you find a bug in bluebird or have a feature request, file an issue in the [github issue tracker](https://github.com/petkaantonov/bluebird/issues). Anything else, such as questions for help in using the library, should be posted in [StackOverflow](http://stackoverflow.com/questions/tagged/bluebird) under tags `promise` and `bluebird`. - -# Error handling - -This is a problem every promise library needs to handle in some way. Unhandled rejections/exceptions don't really have a good agreed-on asynchronous correspondence. The problem is that it is impossible to predict the future and know if a rejected promise will eventually be handled. - -There are two common pragmatic attempts at solving the problem that promise libraries do. - -The more popular one is to have the user explicitly communicate that they are done and any unhandled rejections should be thrown, like so: - -```js -download().then(...).then(...).done(); -``` - -For handling this problem, in my opinion, this is completely unacceptable and pointless. The user must remember to explicitly call `.done` and that cannot be justified when the problem is forgetting to create an error handler in the first place. - -The second approach, which is what bluebird by default takes, is to call a registered handler if a rejection is unhandled by the start of a second turn. The default handler is to write the stack trace to `stderr` or `console.error` in browsers. This is close to what happens with synchronous code - your code doesn't work as expected and you open console and see a stack trace. Nice. - -Of course this is not perfect, if your code for some reason needs to swoop in and attach error handler to some promise after the promise has been hanging around a while then you will see annoying messages. In that case you can use the `.done()` method to signal that any hanging exceptions should be thrown. - -If you want to override the default handler for these possibly unhandled rejections, you can pass yours like so: - -```js -Promise.onPossiblyUnhandledRejection(function(error){ - throw error; -}); -``` - -If you want to also enable long stack traces, call: - -```js -Promise.longStackTraces(); -``` - -right after the library is loaded. - -In node.js use the environment flag `BLUEBIRD_DEBUG`: - -``` -BLUEBIRD_DEBUG=1 node server.js -``` - -to enable long stack traces in all instances of bluebird. - -Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. Long stack traces imply a substantial performance penalty, even after using every trick to optimize them. - -Long stack traces are enabled by default in the debug build. - -#### Expected and unexpected errors - -A practical problem with Promises/A+ is that it models Javascript `try-catch` too closely for its own good. Therefore by default promises inherit `try-catch` warts such as the inability to specify the error types that the catch block is eligible for. It is an anti-pattern in every other language to use catch-all handlers because they swallow exceptions that you might not know about. - -Now, Javascript does have a perfectly fine and working way of creating error type hierarchies. It is still quite awkward to use them with the built-in `try-catch` however: - -```js -try { - //code -} -catch(e) { - if( e instanceof WhatIWantError) { - //handle - } - else { - throw e; - } -} -``` - -Without such checking, unexpected errors would be silently swallowed. However, with promises, bluebird brings the future (hopefully) here now and extends the `.catch` to [accept potential error type eligibility](API.md#catchfunction-errorclass-function-handler---promise). - -For instance here it is expected that some evil or incompetent entity will try to crash our server from `SyntaxError` by providing syntactically invalid JSON: - -```js -getJSONFromSomewhere().then(function(jsonString) { - return JSON.parse(jsonString); -}).then(function(object) { - console.log("it was valid json: ", object); -}).catch(SyntaxError, function(e){ - console.log("don't be evil"); -}); -``` - -Here any kind of unexpected error will automatically reported on `stderr` along with a stack trace because we only register a handler for the expected `SyntaxError`. - -Ok, so, that's pretty neat. But actually not many libraries define error types and it is in fact a complete ghetto out there with ad hoc strings being attached as some arbitrary property name like `.name`, `.type`, `.code`, not having any property at all or even throwing strings as errors and so on. So how can we still listen for expected errors? - -Bluebird defines a special error type `OperationalError` (you can get a reference from `Promise.OperationalError`). This type of error is given as rejection reason by promisified methods when -their underlying library gives an untyped, but expected error. Primitives such as strings, and error objects that are directly created like `new Error("database didn't respond")` are considered untyped. - -Example of such library is the node core library `fs`. So if we promisify it, we can catch just the errors we want pretty easily and have programmer errors be redirected to unhandled rejection handler so that we notice them: - -```js -//Read more about promisification in the API Reference: -//API.md -var fs = Promise.promisifyAll(require("fs")); - -fs.readFileAsync("myfile.json").then(JSON.parse).then(function (json) { - console.log("Successful json") -}).catch(SyntaxError, function (e) { - console.error("file contains invalid json"); -}).catch(Promise.OperationalError, function (e) { - console.error("unable to read file, because: ", e.message); -}); -``` - -The last `catch` handler is only invoked when the `fs` module explicitly used the `err` argument convention of async callbacks to inform of an expected error. The `OperationalError` instance will contain the original error in its `.cause` property but it does have a direct copy of the `.message` and `.stack` too. In this code any unexpected error - be it in our code or the `fs` module - would not be caught by these handlers and therefore not swallowed. - -Since a `catch` handler typed to `Promise.OperationalError` is expected to be used very often, it has a neat shorthand: - -```js -.error(function (e) { - console.error("unable to read file, because: ", e.message); -}); -``` - -See [API documentation for `.error()`](API.md#error-rejectedhandler----promise) - -Finally, Bluebird also supports predicate-based filters. If you pass a -predicate function instead of an error type, the predicate will receive -the error as an argument. The return result will be used to determine whether -the error handler should be called. - -Predicates should allow for very fine grained control over caught errors: -pattern matching, error typesets with set operations and many other techniques -can be implemented on top of them. - -Example of using a predicate-based filter: - -```js -var Promise = require("bluebird"); -var request = Promise.promisify(require("request")); - -function clientError(e) { - return e.code >= 400 && e.code < 500; -} - -request("http://www.google.com").then(function(contents){ - console.log(contents); -}).catch(clientError, function(e){ - //A client error like 400 Bad Request happened -}); -``` - -**Danger:** The JavaScript language allows throwing primitive values like strings. Throwing primitives can lead to worse or no stack traces. Primitives [are not exceptions](http://www.devthought.com/2011/12/22/a-string-is-not-an-error/). You should consider always throwing Error objects when handling exceptions. - -
        - -#### How do long stack traces differ from e.g. Q? - -Bluebird attempts to have more elaborate traces. Consider: - -```js -Error.stackTraceLimit = 25; -Q.longStackSupport = true; -Q().then(function outer() { - return Q().then(function inner() { - return Q().then(function evenMoreInner() { - a.b.c.d(); - }).catch(function catcher(e){ - console.error(e.stack); - }); - }) -}); -``` - -You will see - - ReferenceError: a is not defined - at evenMoreInner (:7:13) - From previous event: - at inner (:6:20) - -Compare to: - -```js -Error.stackTraceLimit = 25; -Promise.longStackTraces(); -Promise.resolve().then(function outer() { - return Promise.resolve().then(function inner() { - return Promise.resolve().then(function evenMoreInner() { - a.b.c.d() - }).catch(function catcher(e){ - console.error(e.stack); - }); - }); -}); -``` - - ReferenceError: a is not defined - at evenMoreInner (:7:13) - From previous event: - at inner (:6:36) - From previous event: - at outer (:5:32) - From previous event: - at :4:21 - at Object.InjectedScript._evaluateOn (:572:39) - at Object.InjectedScript._evaluateAndWrap (:531:52) - at Object.InjectedScript.evaluate (:450:21) - - -A better and more practical example of the differences can be seen in gorgikosev's [debuggability competition](https://github.com/spion/async-compare#debuggability). - -
        - -# Development - -For development tasks such as running benchmarks or testing, you need to clone the repository and install dev-dependencies. - -Install [node](http://nodejs.org/) and [npm](https://npmjs.org/) - - git clone git@github.com:petkaantonov/bluebird.git - cd bluebird - npm install - -## Testing - -To run all tests, run - - node tools/test - -If you need to run generator tests run the `tool/test.js` script with `--harmony` argument and node 0.11+: - - node-dev --harmony tools/test - -You may specify an individual test file to run with the `--run` script flag: - - node tools/test --run=cancel.js - - -This enables output from the test and may give a better idea where the test is failing. The paramter to `--run` can be any file name located in `test/mocha` folder. - -#### Testing in browsers - -To run the test in a browser instead of node, pass the flag `--browser` to the test tool - - node tools/test --run=cancel.js --browser - -This will automatically create a server (default port 9999) and open it in your default browser once the tests have been compiled. - -Keep the test tab active because some tests are timing-sensitive and will fail if the browser is throttling timeouts. Chrome will do this for example when the tab is not active. - -#### Supported options by the test tool - -The value of boolean flags is determined by presence, if you want to pass false value for a boolean flag, use the `no-`-prefix e.g. `--no-browser`. - - - `--run=String`. Which tests to run (or compile when testing in browser). Default `"all"`. Can also be a glob string (relative to ./test/mocha folder) - - `--cover=String`. Create code coverage using the String as istanbul reporter. Coverage is created in the ./coverage folder. No coverage is created by default, default reporter is `"html"` (use `--cover` to use default reporter). - - `--browser` - Whether to compile tests for browsers. Default `false`. - - `--port=Number` - Whe port where local server is hosted when testing in browser. Default `9999` - - `--execute-browser-tests` - Whether to execute the compiled tests for browser when using `--browser`. Default `true`. - - `--open-browser` - Whether to open the default browser when executing browser tests. Default `true`. - - `--fake-timers` - Whether to use fake timers (`setTimeout` etc) when running tests in node. Default `true`. - - `--js-hint` - Whether to run JSHint on source files. Default `true`. - - `--saucelabs` Wheter to create a tunnel to sauce labs and run tests in their VMs instead of your browser when compiling tests for browser.Default `false`. - -## Benchmarks - -To run a benchmark, run the given command for a benchmark while on the project root. Requires bash (on windows the mingw32 that comes with git works fine too). - -Node 0.11.2+ is required to run the generator examples. - -### 1\. DoxBee sequential - -Currently the most relevant benchmark is @gorkikosev's benchmark in the article [Analysis of generators and other async patterns in node](http://spion.github.io/posts/analysis-generators-and-other-async-patterns-node.html). The benchmark emulates a situation where n amount of users are making a request in parallel to execute some mixed async/sync action. The benchmark has been modified to include a warm-up phase to minimize any JITing during timed sections. - -Command: `bench doxbee` - -### 2\. Made-up parallel - -This made-up scenario runs 15 shimmed queries in parallel. - -Command: `bench parallel` - -## Custom builds - -Custom builds for browsers are supported through a command-line utility. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        The following features can be disabled
        Feature(s)Command line identifier
        .any and Promise.anyany
        .race and Promise.racerace
        .call and .getcall_get
        .filter and Promise.filterfilter
        .map and Promise.mapmap
        .reduce and Promise.reducereduce
        .props and Promise.propsprops
        .settle and Promise.settlesettle
        .some and Promise.somesome
        .nodeifynodeify
        Promise.coroutine and Promise.spawngenerators
        Progressionprogress
        Promisificationpromisify
        Cancellationcancel
        Timerstimers
        Resource managementusing
        - - -Make sure you have cloned the repo somewhere and did `npm install` successfully. - -After that you can run: - - node tools/build --features="core" - - -The above builds the most minimal build you can get. You can add more features separated by spaces from the above list: - - node tools/build --features="core filter map reduce" - -The custom build file will be found from `/js/browser/bluebird.js`. It will have a comment that lists the disabled and enabled features. - -Note that the build leaves the `/js/main` etc folders with same features so if you use the folder for node.js at the same time, don't forget to build -a full version afterwards (after having taken a copy of the bluebird.js somewhere): - - node tools/build --debug --main --zalgo --browser --minify - -#### Supported options by the build tool - -The value of boolean flags is determined by presence, if you want to pass false value for a boolean flag, use the `no-`-prefix e.g. `--no-debug`. - - - `--main` - Whether to build the main build. The main build is placed at `js/main` directory. Default `false`. - - `--debug` - Whether to build the debug build. The debug build is placed at `js/debug` directory. Default `false`. - - `--zalgo` - Whether to build the zalgo build. The zalgo build is placed at `js/zalgo` directory. Default `false`. - - `--browser` - Whether to compile the browser build. The browser build file is placed at `js/browser/bluebird.js` Default `false`. - - `--minify` - Whether to minify the compiled browser build. The minified browser build file is placed at `js/browser/bluebird.min.js` Default `true`. - - `--features=String` - See [custom builds](#custom-builds) - -
        - -## For library authors - -Building a library that depends on bluebird? You should know about a few features. - -If your library needs to do something obtrusive like adding or modifying methods on the `Promise` prototype, uses long stack traces or uses a custom unhandled rejection handler then... that's totally ok as long as you don't use `require("bluebird")`. Instead you should create a file -that creates an isolated copy. For example, creating a file called `bluebird-extended.js` that contains: - -```js - //NOTE the function call right after -module.exports = require("bluebird/js/main/promise")(); -``` - -Your library can then use `var Promise = require("bluebird-extended");` and do whatever it wants with it. Then if the application or other library uses their own bluebird promises they will all play well together because of Promises/A+ thenable assimilation magic. - -You should also know about [`.nodeify()`](API.md#nodeifyfunction-callback---promise) which makes it easy to provide a dual callback/promise API. - -
        - -## What is the sync build? - -You may now use sync build by: - - var Promise = require("bluebird/zalgo"); - -The sync build is provided to see how forced asynchronity affects benchmarks. It should not be used in real code due to the implied hazards. - -The normal async build gives Promises/A+ guarantees about asynchronous resolution of promises. Some people think this affects performance or just plain love their code having a possibility -of stack overflow errors and non-deterministic behavior. - -The sync build skips the async call trampoline completely, e.g code like: - - async.invoke( this.fn, this, val ); - -Appears as this in the sync build: - - this.fn(val); - -This should pressure the CPU slightly less and thus the sync build should perform better. Indeed it does, but only marginally. The biggest performance boosts are from writing efficient Javascript, not from compromising determinism. - -Note that while some benchmarks are waiting for the next event tick, the CPU is actually not in use during that time. So the resulting benchmark result is not completely accurate because on node.js you only care about how much the CPU is taxed. Any time spent on CPU is time the whole process (or server) is paralyzed. And it is not graceful like it would be with threads. - - -```js -var cache = new Map(); //ES6 Map or DataStructures/Map or whatever... -function getResult(url) { - var resolver = Promise.pending(); - if (cache.has(url)) { - resolver.resolve(cache.get(url)); - } - else { - http.get(url, function(err, content) { - if (err) resolver.reject(err); - else { - cache.set(url, content); - resolver.resolve(content); - } - }); - } - return resolver.promise; -} - - - -//The result of console.log is truly random without async guarantees -function guessWhatItPrints( url ) { - var i = 3; - getResult(url).then(function(){ - i = 4; - }); - console.log(i); -} -``` - -# Optimization guide - -Articles about optimization will be periodically posted in [the wiki section](https://github.com/petkaantonov/bluebird/wiki), polishing edits are welcome. - -A single cohesive guide compiled from the articles will probably be done eventually. - -# License - -The MIT License (MIT) - -Copyright (c) 2014 Petka Antonov - -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/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md deleted file mode 100644 index 46729e1e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/changelog.md +++ /dev/null @@ -1,1643 +0,0 @@ -## 2.9.26 (2015-05-25) - -Bugfixes: - - - Fix crash in NW [#624](.) - - Fix [`.return()`](.) not supporting `undefined` as return value [#627](.) - -## 2.9.25 (2015-04-28) - -Bugfixes: - - - Fix crash in node 0.8 - -## 2.9.24 (2015-04-02) - -Bugfixes: - - - Fix not being able to load multiple bluebird copies introduced in 2.9.22 ([#559](.), [#561](.), [#560](.)). - -## 2.9.23 (2015-04-02) - -Bugfixes: - - - Fix node.js domain propagation ([#521](.)). - -## 2.9.22 (2015-04-02) - - - Fix `.promisify` crashing in phantom JS ([#556](.)) - -## 2.9.21 (2015-03-30) - - - Fix error object's `'stack'`' overwriting causing an error when its defined to be a setter that throws an error ([#552](.)). - -## 2.9.20 (2015-03-29) - -Bugfixes: - - - Fix regression where there is a long delay between calling `.cancel()` and promise actually getting cancelled in Chrome when long stack traces are enabled - -## 2.9.19 (2015-03-29) - -Bugfixes: - - - Fix crashing in Chrome when long stack traces are disabled - -## 2.9.18 (2015-03-29) - -Bugfixes: - - - Fix settlePromises using trampoline - -## 2.9.17 (2015-03-29) - - -Bugfixes: - - - Fix Chrome DevTools async stack traceability ([#542](.)). - -## 2.9.16 (2015-03-28) - -Features: - - - Use setImmediate if available - -## 2.9.15 (2015-03-26) - -Features: - - - Added `.asCallback` alias for `.nodeify`. - -Bugfixes: - - - Don't always use nextTick, but try to pick up setImmediate or setTimeout in NW. Fixes [#534](.), [#525](.) - - Make progress a core feature. Fixes [#535](.) Note that progress has been removed in 3.x - this is only a fix necessary for 2.x custom builds. - -## 2.9.14 (2015-03-12) - -Bugfixes: - - - Always use process.nextTick. Fixes [#525](.) - -## 2.9.13 (2015-02-27) - -Bugfixes: - - - Fix .each, .filter, .reduce and .map callbacks being called synchornously if the input is immediate. ([#513](.)) - -## 2.9.12 (2015-02-19) - -Bugfixes: - - - Fix memory leak introduced in 2.9.0 ([#502](.)) - -## 2.9.11 (2015-02-19) - -Bugfixes: - - - Fix [#503](.) - -## 2.9.10 (2015-02-18) - -Bugfixes: - - - Fix [#501](.) - -## 2.9.9 (2015-02-12) - -Bugfixes: - - - Fix `TypeError: Cannot assign to read only property 'length'` when jsdom has declared a read-only length for all objects to inherit. - -## 2.9.8 (2015-02-10) - -Bugfixes: - - - Fix regression introduced in 2.9.7 where promisify didn't properly dynamically look up methods on `this` - -## 2.9.7 (2015-02-08) - -Bugfixes: - - - Fix `promisify` not retaining custom properties of the function. This enables promisifying the `"request"` module's export function and its methods at the same time. - - Fix `promisifyAll` methods being dependent on `this` when they are not originally dependent on `this`. This enables e.g. passing promisified `fs` functions directly as callbacks without having to bind them to `fs`. - - Fix `process.nextTick` being used over `setImmediate` in node. - -## 2.9.6 (2015-02-02) - -Bugfixes: - - - Node environment detection can no longer be fooled - -## 2.9.5 (2015-02-02) - -Misc: - - - Warn when [`.then()`](.) is passed non-functions - -## 2.9.4 (2015-01-30) - -Bugfixes: - - - Fix [.timeout()](.) not calling `clearTimeout` with the proper handle in node causing the process to wait for unneeded timeout. This was a regression introduced in 2.9.1. - -## 2.9.3 (2015-01-27) - -Bugfixes: - - - Fix node-webkit compatibility issue ([#467](https://github.com/petkaantonov/bluebird/pull/467)) - - Fix long stack trace support in recent firefox versions - -## 2.9.2 (2015-01-26) - -Bugfixes: - - - Fix critical bug regarding to using promisifyAll in browser that was introduced in 2.9.0 ([#466](https://github.com/petkaantonov/bluebird/issues/466)). - -Misc: - - - Add `"browser"` entry point to package.json - -## 2.9.1 (2015-01-24) - -Features: - - - If a bound promise is returned by the callback to [`Promise.method`](#promisemethodfunction-fn---function) and [`Promise.try`](#promisetryfunction-fn--arraydynamicdynamic-arguments--dynamic-ctx----promise), the returned promise will be bound to the same value - -## 2.9.0 (2015-01-24) - -Features: - - - Add [`Promise.fromNode`](API.md#promisefromnodefunction-resolver---promise) - - Add new paramter `value` for [`Promise.bind`](API.md#promisebinddynamic-thisarg--dynamic-value---promise) - -Bugfixes: - - - Fix several issues with [`cancellation`](API.md#cancellation) and [`.bind()`](API.md#binddynamic-thisarg---promise) interoperation when `thisArg` is a promise or thenable - - Fix promises created in [`disposers`](API#disposerfunction-disposer---disposer) not having proper long stack trace context - - Fix [`Promise.join`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) sometimes passing the passed in callback function as the last argument to itself. - -Misc: - - - Reduce minified full browser build file size by not including unused code generation functionality. - - Major internal refactoring related to testing code and source code file layout - -## 2.8.2 (2015-01-20) - -Features: - - - [Global rejection events](https://github.com/petkaantonov/bluebird/blob/master/API.md#global-rejection-events) are now fired both as DOM3 events and as legacy events in browsers - -## 2.8.1 (2015-01-20) - -Bugfixes: - - - Fix long stack trace stiching consistency when rejected from thenables - -## 2.8.0 (2015-01-19) - -Features: - - - Major debuggability improvements: - - Long stack traces have been re-designed. They are now much more readable, - succint, relevant and consistent across bluebird features. - - Long stack traces are supported now in IE10+ - -## 2.7.1 (2015-01-15) - -Bugfixes: - - - Fix [#447](https://github.com/petkaantonov/bluebird/issues/447) - -## 2.7.0 (2015-01-15) - -Features: - - - Added more context to stack traces originating from coroutines ([#421](https://github.com/petkaantonov/bluebird/issues/421)) - - Implemented [global rejection events](https://github.com/petkaantonov/bluebird/blob/master/API.md#global-rejection-events) ([#428](https://github.com/petkaantonov/bluebird/issues/428), [#357](https://github.com/petkaantonov/bluebird/issues/357)) - - [Custom promisifiers](https://github.com/petkaantonov/bluebird/blob/master/API.md#option-promisifier) are now passed the default promisifier which can be used to add enhancements on top of normal node promisification - - [Promisification filters](https://github.com/petkaantonov/bluebird/blob/master/API.md#option-filter) are now passed `passesDefaultFilter` boolean - -Bugfixes: - - - Fix `.noConflict()` call signature ([#446]()) - - Fix `Promise.method`ified functions being called with `undefined` when they were called with no arguments - -## 2.6.4 (2015-01-12) - -Bugfixes: - - - `OperationalErrors` thrown by promisified functions retain custom properties, such as `.code` and `.path`. - -## 2.6.3 (2015-01-12) - -Bugfixes: - - - Fix [#429](https://github.com/petkaantonov/bluebird/issues/429) - - Fix [#432](https://github.com/petkaantonov/bluebird/issues/432) - - Fix [#433](https://github.com/petkaantonov/bluebird/issues/433) - -## 2.6.2 (2015-01-07) - -Bugfixes: - - - Fix [#426](https://github.com/petkaantonov/bluebird/issues/426) - -## 2.6.1 (2015-01-07) - -Bugfixes: - - - Fixed built browser files not being included in the git tag release for bower - -## 2.6.0 (2015-01-06) - -Features: - - - Significantly improve parallel promise performance and memory usage (+50% faster, -50% less memory) - - -## 2.5.3 (2014-12-30) - -## 2.5.2 (2014-12-29) - -Bugfixes: - - - Fix bug where already resolved promise gets attached more handlers while calling its handlers resulting in some handlers not being called - - Fix bug where then handlers are not called in the same order as they would run if Promises/A+ 2.3.2 was implemented as adoption - - Fix bug where using `Object.create(null)` as a rejection reason would crash bluebird - -## 2.5.1 (2014-12-29) - -Bugfixes: - - - Fix `.finally` throwing null error when it is derived from a promise that is resolved with a promise that is resolved with a promise - -## 2.5.0 (2014-12-28) - -Features: - - - [`.get`](#API.md#https://github.com/petkaantonov/bluebird/blob/master/API.md#getstring-propertyname---promise) now supports negative indexing. - -Bugfixes: - - - Fix bug with `Promise.method` wrapped function returning a promise that never resolves if the function returns a promise that is resolved with another promise - - Fix bug with `Promise.delay` never resolving if the value is a promise that is resolved with another promise - -## 2.4.3 (2014-12-28) - -Bugfixes: - - - Fix memory leak as described in [this Promises/A+ spec issue](https://github.com/promises-aplus/promises-spec/issues/179). - -## 2.4.2 (2014-12-21) - -Bugfixes: - - - Fix bug where spread rejected handler is ignored in case of rejection - - Fix synchronous scheduler passed to `setScheduler` causing infinite loop - -## 2.4.1 (2014-12-20) - -Features: - - - Error messages now have links to wiki pages for additional information - - Promises now clean up all references (to handlers, child promises etc) as soon as possible. - -## 2.4.0 (2014-12-18) - -Features: - - - Better filtering of bluebird internal calls in long stack traces, especially when using minified file in browsers - - Small performance improvements for all collection methods - - Promises now delete references to handlers attached to them as soon as possible - - Additional stack traces are now output on stderr/`console.warn` for errors that are thrown in the process/window from rejected `.done()` promises. See [#411](https://github.com/petkaantonov/bluebird/issues/411) - -## 2.3.11 (2014-10-31) - -Bugfixes: - - - Fix [#371](https://github.com/petkaantonov/bluebird/issues/371), [#373](https://github.com/petkaantonov/bluebird/issues/373) - - -## 2.3.10 (2014-10-28) - -Features: - - - `Promise.method` no longer wraps primitive errors - - `Promise.try` no longer wraps primitive errors - -## 2.3.7 (2014-10-25) - -Bugfixes: - - - Fix [#359](https://github.com/petkaantonov/bluebird/issues/359), [#362](https://github.com/petkaantonov/bluebird/issues/362) and [#364](https://github.com/petkaantonov/bluebird/issues/364) - -## 2.3.6 (2014-10-15) - -Features: - - - Implement [`.reflect()`](API.md#reflect---promisepromiseinspection) - -## 2.3.5 (2014-10-06) - -Bugfixes: - - - Fix issue when promisifying methods whose names contain the string 'args' - -## 2.3.4 (2014-09-27) - - - `P` alias was not declared inside WebWorkers - -## 2.3.3 (2014-09-27) - -Bugfixes: - - - Fix [#318](https://github.com/petkaantonov/bluebird/issues/318), [#314](https://github.com/petkaantonov/bluebird/issues/#314) - -## 2.3.2 (2014-08-25) - -Bugfixes: - - - `P` alias for `Promise` now exists in global scope when using browser builds without a module loader, fixing an issue with firefox extensions - -## 2.3.1 (2014-08-23) - -Features: - - - `.using` can now be used with disposers created from different bluebird copy - -## 2.3.0 (2014-08-13) - -Features: - - - [`.bind()`](API.md#binddynamic-thisarg---promise) and [`Promise.bind()`](API.md#promisebinddynamic-thisarg---promise) now await for the resolution of the `thisArg` if it's a promise or a thenable - -Bugfixes: - - - Fix [#276](https://github.com/petkaantonov/bluebird/issues/276) - -## 2.2.2 (2014-07-14) - - - Fix [#259](https://github.com/petkaantonov/bluebird/issues/259) - -## 2.2.1 (2014-07-07) - - - Fix multiline error messages only showing the first line - -## 2.2.0 (2014-07-07) - -Bugfixes: - - - `.any` and `.some` now consistently reject with RangeError when input array contains too few promises - - Fix iteration bug with `.reduce` when input array contains already fulfilled promises - -## 2.1.3 (2014-06-18) - -Bugfixes: - - - Fix [#235](https://github.com/petkaantonov/bluebird/issues/235) - -## 2.1.2 (2014-06-15) - -Bugfixes: - - - Fix [#232](https://github.com/petkaantonov/bluebird/issues/232) - -## 2.1.1 (2014-06-11) - -## 2.1.0 (2014-06-11) - -Features: - - - Add [`promisifier`](API.md#option-promisifier) option to `Promise.promisifyAll()` - - Improve performance of `.props()` and collection methods when used with immediate values - - -Bugfixes: - - - Fix a bug where .reduce calls the callback for an already visited item - - Fix a bug where stack trace limit is calculated to be too small, which resulted in too short stack traces - -Add undocumented experimental `yieldHandler` option to `Promise.coroutine` - -## 2.0.7 (2014-06-08) -## 2.0.6 (2014-06-07) -## 2.0.5 (2014-06-05) -## 2.0.4 (2014-06-05) -## 2.0.3 (2014-06-05) -## 2.0.2 (2014-06-04) -## 2.0.1 (2014-06-04) - -## 2.0.0 (2014-06-04) - -#What's new in 2.0 - -- [Resource management](API.md#resource-management) - never leak resources again -- [Promisification](API.md#promisification) on steroids - entire modules can now be promisified with one line of code -- [`.map()`](API.md#mapfunction-mapper--object-options---promise), [`.each()`](API.md#eachfunction-iterator---promise), [`.filter()`](API.md#filterfunction-filterer--object-options---promise), [`.reduce()`](API.md#reducefunction-reducer--dynamic-initialvalue---promise) reimagined from simple sugar to powerful concurrency coordination tools -- [API Documentation](API.md) has been reorganized and more elaborate examples added -- Deprecated [progression](#progression-migration) and [deferreds](#deferred-migration) -- Improved performance and readability - -Features: - -- Added [`using()`](API.md#promiseusingpromisedisposer-promise-promisedisposer-promise--function-handler---promise) and [`disposer()`](API.md#disposerfunction-disposer---disposer) -- [`.map()`](API.md#mapfunction-mapper--object-options---promise) now calls the handler as soon as items in the input array become fulfilled -- Added a concurrency option to [`.map()`](API.md#mapfunction-mapper--object-options---promise) -- [`.filter()`](API.md#filterfunction-filterer--object-options---promise) now calls the handler as soon as items in the input array become fulfilled -- Added a concurrency option to [`.filter()`](API.md#filterfunction-filterer--object-options---promise) -- [`.reduce()`](API.md#reducefunction-reducer--dynamic-initialvalue---promise) now calls the handler as soon as items in the input array become fulfilled, but in-order -- Added [`.each()`](API.md#eachfunction-iterator---promise) -- [`Promise.resolve()`](API.md#promiseresolvedynamic-value---promise) behaves like `Promise.cast`. `Promise.cast` deprecated. -- [Synchronous inspection](API.md#synchronous-inspection): Removed `.inspect()`, added [`.value()`](API.md#value---dynamic) and [`.reason()`](API.md#reason---dynamic) -- [`Promise.join()`](API.md#promisejoinpromisethenablevalue-promises-function-handler---promise) now takes a function as the last argument -- Added [`Promise.setScheduler()`](API.md#promisesetschedulerfunction-scheduler---void) -- [`.cancel()`](API.md#cancelerror-reason---promise) supports a custom cancellation reason -- [`.timeout()`](API.md#timeoutint-ms--string-message---promise) now cancels the promise instead of rejecting it -- [`.nodeify()`](API.md#nodeifyfunction-callback--object-options---promise) now supports passing multiple success results when mapping promises to nodebacks -- Added `suffix` and `filter` options to [`Promise.promisifyAll()`](API.md#promisepromisifyallobject-target--object-options---object) - -Breaking changes: - -- Sparse array holes are not skipped by collection methods but treated as existing elements with `undefined` value -- `.map()` and `.filter()` do not call the given mapper or filterer function in any specific order -- Removed the `.inspect()` method -- Yielding an array from a coroutine is not supported by default. You can use [`coroutine.addYieldHandler()`](API.md#promisecoroutineaddyieldhandlerfunction-handler---void) to configure the old behavior (or any behavior you want). -- [`.any()`](API.md#any---promise) and [`.some()`](API.md#someint-count---promise) no longer use an array as the rejection reason. [`AggregateError`](API.md#aggregateerror) is used instead. - - -## 1.2.4 (2014-04-27) - -Bugfixes: - - - Fix promisifyAll causing a syntax error when a method name is not a valid identifier - - Fix syntax error when es5.js is used in strict mode - -## 1.2.3 (2014-04-17) - -Bugfixes: - - - Fix [#179](https://github.com/petkaantonov/bluebird/issues/179) - -## 1.2.2 (2014-04-09) - -Bugfixes: - - - Promisified methods from promisifyAll no longer call the original method when it is overriden - - Nodeify doesn't pass second argument to the callback if the promise is fulfilled with `undefined` - -## 1.2.1 (2014-03-31) - -Bugfixes: - - - Fix [#168](https://github.com/petkaantonov/bluebird/issues/168) - -## 1.2.0 (2014-03-29) - -Features: - - - New method: [`.value()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#value---dynamic) - - New method: [`.reason()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#reason---dynamic) - - New method: [`Promise.onUnhandledRejectionHandled()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promiseonunhandledrejectionhandledfunction-handler---undefined) - - `Promise.map()`, `.map()`, `Promise.filter()` and `.filter()` start calling their callbacks as soon as possible while retaining a correct order. See [`8085922f`](https://github.com/petkaantonov/bluebird/commit/8085922fb95a9987fda0cf2337598ab4a98dc315). - -Bugfixes: - - - Fix [#165](https://github.com/petkaantonov/bluebird/issues/165) - - Fix [#166](https://github.com/petkaantonov/bluebird/issues/166) - -## 1.1.1 (2014-03-18) - -Bugfixes: - - - [#138](https://github.com/petkaantonov/bluebird/issues/138) - - [#144](https://github.com/petkaantonov/bluebird/issues/144) - - [#148](https://github.com/petkaantonov/bluebird/issues/148) - - [#151](https://github.com/petkaantonov/bluebird/issues/151) - -## 1.1.0 (2014-03-08) - -Features: - - - Implement [`Promise.prototype.tap()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#tapfunction-handler---promise) - - Implement [`Promise.coroutine.addYieldHandler()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisecoroutineaddyieldhandlerfunction-handler---void) - - Deprecate `Promise.prototype.spawn` - -Bugfixes: - - - Fix already rejected promises being reported as unhandled when handled through collection methods - - Fix browserisfy crashing from checking `process.version.indexOf` - -## 1.0.8 (2014-03-03) - -Bugfixes: - - - Fix active domain being lost across asynchronous boundaries in Node.JS 10.xx - -## 1.0.7 (2014-02-25) - -Bugfixes: - - - Fix handled errors being reported - -## 1.0.6 (2014-02-17) - -Bugfixes: - - - Fix bug with unhandled rejections not being reported - when using `Promise.try` or `Promise.method` without - attaching further handlers - -## 1.0.5 (2014-02-15) - -Features: - - - Node.js performance: promisified functions try to check amount of passed arguments in most optimal order - - Node.js promisified functions will have same `.length` as the original function minus one (for the callback parameter) - -## 1.0.4 (2014-02-09) - -Features: - - - Possibly unhandled rejection handler will always get a stack trace, even if the rejection or thrown error was not an error - - Unhandled rejections are tracked per promise, not per error. So if you create multiple branches from a single ancestor and that ancestor gets rejected, each branch with no error handler with the end will cause a possibly unhandled rejection handler invocation - -Bugfixes: - - - Fix unhandled non-writable objects or primitives not reported by possibly unhandled rejection handler - -## 1.0.3 (2014-02-05) - -Bugfixes: - - - [#93](https://github.com/petkaantonov/bluebird/issues/88) - -## 1.0.2 (2014-02-04) - -Features: - - - Significantly improve performance of foreign bluebird thenables - -Bugfixes: - - - [#88](https://github.com/petkaantonov/bluebird/issues/88) - -## 1.0.1 (2014-01-28) - -Features: - - - Error objects that have property `.isAsync = true` will now be caught by `.error()` - -Bugfixes: - - - Fix TypeError and RangeError shims not working without `new` operator - -## 1.0.0 (2014-01-12) - -Features: - - - `.filter`, `.map`, and `.reduce` no longer skip sparse array holes. This is a backwards incompatible change. - - Like `.map` and `.filter`, `.reduce` now allows returning promises and thenables from the iteration function. - -Bugfixes: - - - [#58](https://github.com/petkaantonov/bluebird/issues/58) - - [#61](https://github.com/petkaantonov/bluebird/issues/61) - - [#64](https://github.com/petkaantonov/bluebird/issues/64) - - [#60](https://github.com/petkaantonov/bluebird/issues/60) - -## 0.11.6-1 (2013-12-29) - -## 0.11.6-0 (2013-12-29) - -Features: - - - You may now return promises and thenables from the filterer function used in `Promise.filter` and `Promise.prototype.filter`. - - - `.error()` now catches additional sources of rejections: - - - Rejections originating from `Promise.reject` - - - Rejections originating from thenables using - the `reject` callback - - - Rejections originating from promisified callbacks - which use the `errback` argument - - - Rejections originating from `new Promise` constructor - where the `reject` callback is called explicitly - - - Rejections originating from `PromiseResolver` where - `.reject()` method is called explicitly - -Bugfixes: - - - Fix `captureStackTrace` being called when it was `null` - - Fix `Promise.map` not unwrapping thenables - -## 0.11.5-1 (2013-12-15) - -## 0.11.5-0 (2013-12-03) - -Features: - - - Improve performance of collection methods - - Improve performance of promise chains - -## 0.11.4-1 (2013-12-02) - -## 0.11.4-0 (2013-12-02) - -Bugfixes: - - - Fix `Promise.some` behavior with arguments like negative integers, 0... - - Fix stack traces of synchronously throwing promisified functions' - -## 0.11.3-0 (2013-12-02) - -Features: - - - Improve performance of generators - -Bugfixes: - - - Fix critical bug with collection methods. - -## 0.11.2-0 (2013-12-02) - -Features: - - - Improve performance of all collection methods - -## 0.11.1-0 (2013-12-02) - -Features: - -- Improve overall performance. -- Improve performance of promisified functions. -- Improve performance of catch filters. -- Improve performance of .finally. - -Bugfixes: - -- Fix `.finally()` rejecting if passed non-function. It will now ignore non-functions like `.then`. -- Fix `.finally()` not converting thenables returned from the handler to promises. -- `.spread()` now rejects if the ultimate value given to it is not spreadable. - -## 0.11.0-0 (2013-12-02) - -Features: - - - Improve overall performance when not using `.bind()` or cancellation. - - Promises are now not cancellable by default. This is backwards incompatible change - see [`.cancellable()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#cancellable---promise) - - [`Promise.delay`](https://github.com/petkaantonov/bluebird/blob/master/API.md#promisedelaydynamic-value-int-ms---promise) - - [`.delay()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#delayint-ms---promise) - - [`.timeout()`](https://github.com/petkaantonov/bluebird/blob/master/API.md#timeoutint-ms--string-message---promise) - -## 0.10.14-0 (2013-12-01) - -Bugfixes: - - - Fix race condition when mixing 3rd party asynchrony. - -## 0.10.13-1 (2013-11-30) - -## 0.10.13-0 (2013-11-30) - -Bugfixes: - - - Fix another bug with progression. - -## 0.10.12-0 (2013-11-30) - -Bugfixes: - - - Fix bug with progression. - -## 0.10.11-4 (2013-11-29) - -## 0.10.11-2 (2013-11-29) - -Bugfixes: - - - Fix `.race()` not propagating bound values. - -## 0.10.11-1 (2013-11-29) - -Features: - - - Improve performance of `Promise.race` - -## 0.10.11-0 (2013-11-29) - -Bugfixes: - - - Fixed `Promise.promisifyAll` invoking property accessors. Only data properties with function values are considered. - -## 0.10.10-0 (2013-11-28) - -Features: - - - Disable long stack traces in browsers by default. Call `Promise.longStackTraces()` to enable them. - -## 0.10.9-1 (2013-11-27) - -Bugfixes: - - - Fail early when `new Promise` is constructed incorrectly - -## 0.10.9-0 (2013-11-27) - -Bugfixes: - - - Promise.props now takes a [thenable-for-collection](https://github.com/petkaantonov/bluebird/blob/f41edac61b7c421608ff439bb5a09b7cffeadcf9/test/mocha/props.js#L197-L217) - - All promise collection methods now reject when a promise-or-thenable-for-collection turns out not to give a collection - -## 0.10.8-0 (2013-11-25) - -Features: - - - All static collection methods take thenable-for-collection - -## 0.10.7-0 (2013-11-25) - -Features: - - - throw TypeError when thenable resolves with itself - - Make .race() and Promise.race() forever pending on empty collections - -## 0.10.6-0 (2013-11-25) - -Bugfixes: - - - Promise.resolve and PromiseResolver.resolve follow thenables too. - -## 0.10.5-0 (2013-11-24) - -Bugfixes: - - - Fix infinite loop when thenable resolves with itself - -## 0.10.4-1 (2013-11-24) - -Bugfixes: - - - Fix a file missing from build. (Critical fix) - -## 0.10.4-0 (2013-11-24) - -Features: - - - Remove dependency of es5-shim and es5-sham when using ES3. - -## 0.10.3-0 (2013-11-24) - -Features: - - - Improve performance of `Promise.method` - -## 0.10.2-1 (2013-11-24) - -Features: - - - Rename PromiseResolver#asCallback to PromiseResolver#callback - -## 0.10.2-0 (2013-11-24) - -Features: - - - Remove memoization of thenables - -## 0.10.1-0 (2013-11-21) - -Features: - - - Add methods `Promise.resolve()`, `Promise.reject()`, `Promise.defer()` and `.resolve()`. - -## 0.10.0-1 (2013-11-17) - -## 0.10.0-0 (2013-11-17) - -Features: - - - Implement `Promise.method()` - - Implement `.return()` - - Implement `.throw()` - -Bugfixes: - - - Fix promises being able to use themselves as resolution or follower value - -## 0.9.11-1 (2013-11-14) - -Features: - - - Implicit `Promise.all()` when yielding an array from generators - -## 0.9.11-0 (2013-11-13) - -Bugfixes: - - - Fix `.spread` not unwrapping thenables - -## 0.9.10-2 (2013-11-13) - -Features: - - - Improve performance of promisified functions on V8 - -Bugfixes: - - - Report unhandled rejections even when long stack traces are disabled - - Fix `.error()` showing up in stack traces - -## 0.9.10-1 (2013-11-05) - -Bugfixes: - - - Catch filter method calls showing in stack traces - -## 0.9.10-0 (2013-11-05) - -Bugfixes: - - - Support primitives in catch filters - -## 0.9.9-0 (2013-11-05) - -Features: - - - Add `Promise.race()` and `.race()` - -## 0.9.8-0 (2013-11-01) - -Bugfixes: - - - Fix bug with `Promise.try` not unwrapping returned promises and thenables - -## 0.9.7-0 (2013-10-29) - -Bugfixes: - - - Fix bug with build files containing duplicated code for promise.js - -## 0.9.6-0 (2013-10-28) - -Features: - - - Improve output of reporting unhandled non-errors - - Implement RejectionError wrapping and `.error()` method - -## 0.9.5-0 (2013-10-27) - -Features: - - - Allow fresh copies of the library to be made - -## 0.9.4-1 (2013-10-27) - -## 0.9.4-0 (2013-10-27) - -Bugfixes: - - - Rollback non-working multiple fresh copies feature - -## 0.9.3-0 (2013-10-27) - -Features: - - - Allow fresh copies of the library to be made - - Add more components to customized builds - -## 0.9.2-1 (2013-10-25) - -## 0.9.2-0 (2013-10-25) - -Features: - - - Allow custom builds - -## 0.9.1-1 (2013-10-22) - -Bugfixes: - - - Fix unhandled rethrown exceptions not reported - -## 0.9.1-0 (2013-10-22) - -Features: - - - Improve performance of `Promise.try` - - Extend `Promise.try` to accept arguments and ctx to make it more usable in promisification of synchronous functions. - -## 0.9.0-0 (2013-10-18) - -Features: - - - Implement `.bind` and `Promise.bind` - -Bugfixes: - - - Fix `.some()` when argument is a pending promise that later resolves to an array - -## 0.8.5-1 (2013-10-17) - -Features: - - - Enable process wide long stack traces through BLUEBIRD_DEBUG environment variable - -## 0.8.5-0 (2013-10-16) - -Features: - - - Improve performance of all collection methods - -Bugfixes: - - - Fix .finally passing the value to handlers - - Remove kew from benchmarks due to bugs in the library breaking the benchmark - - Fix some bluebird library calls potentially appearing in stack traces - -## 0.8.4-1 (2013-10-15) - -Bugfixes: - - - Fix .pending() call showing in long stack traces - -## 0.8.4-0 (2013-10-15) - -Bugfixes: - - - Fix PromiseArray and its sub-classes swallowing possibly unhandled rejections - -## 0.8.3-3 (2013-10-14) - -Bugfixes: - - - Fix AMD-declaration using named module. - -## 0.8.3-2 (2013-10-14) - -Features: - - - The mortals that can handle it may now release Zalgo by `require("bluebird/zalgo");` - -## 0.8.3-1 (2013-10-14) - -Bugfixes: - - - Fix memory leak when using the same promise to attach handlers over and over again - -## 0.8.3-0 (2013-10-13) - -Features: - - - Add `Promise.props()` and `Promise.prototype.props()`. They work like `.all()` for object properties. - -Bugfixes: - - - Fix bug with .some returning garbage when sparse arrays have rejections - -## 0.8.2-2 (2013-10-13) - -Features: - - - Improve performance of `.reduce()` when `initialValue` can be synchronously cast to a value - -## 0.8.2-1 (2013-10-12) - -Bugfixes: - - - Fix .npmignore having irrelevant files - -## 0.8.2-0 (2013-10-12) - -Features: - - - Improve performance of `.some()` - -## 0.8.1-0 (2013-10-11) - -Bugfixes: - - - Remove uses of dynamic evaluation (`new Function`, `eval` etc) when strictly not necessary. Use feature detection to use static evaluation to avoid errors when dynamic evaluation is prohibited. - -## 0.8.0-3 (2013-10-10) - -Features: - - - Add `.asCallback` property to `PromiseResolver`s - -## 0.8.0-2 (2013-10-10) - -## 0.8.0-1 (2013-10-09) - -Features: - - - Improve overall performance. Be able to sustain infinite recursion when using promises. - -## 0.8.0-0 (2013-10-09) - -Bugfixes: - - - Fix stackoverflow error when function calls itself "synchronously" from a promise handler - -## 0.7.12-2 (2013-10-09) - -Bugfixes: - - - Fix safari 6 not using `MutationObserver` as a scheduler - - Fix process exceptions interfering with internal queue flushing - -## 0.7.12-1 (2013-10-09) - -Bugfixes: - - - Don't try to detect if generators are available to allow shims to be used - -## 0.7.12-0 (2013-10-08) - -Features: - - - Promisification now consider all functions on the object and its prototype chain - - Individual promisifcation uses current `this` if no explicit receiver is given - - Give better stack traces when promisified callbacks throw or errback primitives such as strings by wrapping them in an `Error` object. - -Bugfixes: - - - Fix runtime APIs throwing synchronous errors - -## 0.7.11-0 (2013-10-08) - -Features: - - - Deprecate `Promise.promisify(Object target)` in favor of `Promise.promisifyAll(Object target)` to avoid confusion with function objects - - Coroutines now throw error when a non-promise is `yielded` - -## 0.7.10-1 (2013-10-05) - -Features: - - - Make tests pass Internet Explorer 8 - -## 0.7.10-0 (2013-10-05) - -Features: - - - Create browser tests - -## 0.7.9-1 (2013-10-03) - -Bugfixes: - - - Fix promise cast bug when thenable fulfills using itself as the fulfillment value - -## 0.7.9-0 (2013-10-03) - -Features: - - - More performance improvements when long stack traces are enabled - -## 0.7.8-1 (2013-10-02) - -Features: - - - Performance improvements when long stack traces are enabled - -## 0.7.8-0 (2013-10-02) - -Bugfixes: - - - Fix promisified methods not turning synchronous exceptions into rejections - -## 0.7.7-1 (2013-10-02) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.7-0 (2013-10-01) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.6-0 (2013-09-29) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.5-0 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.4-1 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.4-0 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.3-1 (2013-09-28) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.3-0 (2013-09-27) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.2-0 (2013-09-27) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-5 (2013-09-26) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-4 (2013-09-25) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-3 (2013-09-25) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-2 (2013-09-24) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-1 (2013-09-24) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.1-0 (2013-09-24) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.0-1 (2013-09-23) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.7.0-0 (2013-09-23) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.5-2 (2013-09-20) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.5-1 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.5-0 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.4-1 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.4-0 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-4 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-3 (2013-09-18) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-2 (2013-09-16) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-1 (2013-09-16) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.3-0 (2013-09-15) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.2-1 (2013-09-14) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.2-0 (2013-09-14) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.1-0 (2013-09-14) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.6.0-0 (2013-09-13) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-6 (2013-09-12) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-5 (2013-09-12) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-4 (2013-09-12) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-3 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-2 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-1 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.9-0 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.8-1 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.8-0 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.7-0 (2013-09-11) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.6-1 (2013-09-10) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.6-0 (2013-09-10) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.5-1 (2013-09-10) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.5-0 (2013-09-09) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.4-1 (2013-09-08) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.4-0 (2013-09-08) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.3-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.2-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.1-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.5.0-0 (2013-09-07) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.4.0-0 (2013-09-06) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.3.0-1 (2013-09-06) - -Features: - - - feature - -Bugfixes: - - - bugfix - -## 0.3.0 (2013-09-06) diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js deleted file mode 100644 index 69a6ffd8..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.js +++ /dev/null @@ -1,5105 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2014 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 2.9.26 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, cancel, using, filter, any, each, timers -*/ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var f;"undefined"!=typeof window?f=window:"undefined"!=typeof global?f=global:"undefined"!=typeof self&&(f=self),f.Promise=e()}}(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof _dereq_=="function"&&_dereq_;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof _dereq_=="function"&&_dereq_;for(var o=0;o 0; -}; - -Async.prototype.throwLater = function(fn, arg) { - if (arguments.length === 1) { - arg = fn; - fn = function () { throw arg; }; - } - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - if (typeof setTimeout !== "undefined") { - setTimeout(function() { - fn(arg); - }, 0); - } else try { - this._schedule(function() { - fn(arg); - }); - } catch (e) { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/m3OTXk\u000a"); - } -}; - -Async.prototype._getDomain = function() {}; - -if (!true) { -if (util.isNode) { - var EventsModule = _dereq_("events"); - - var domainGetter = function() { - var domain = process.domain; - if (domain === null) return undefined; - return domain; - }; - - if (EventsModule.usingDomains) { - Async.prototype._getDomain = domainGetter; - } else { - var descriptor = - Object.getOwnPropertyDescriptor(EventsModule, "usingDomains"); - - if (descriptor) { - if (!descriptor.configurable) { - process.on("domainsActivated", function() { - Async.prototype._getDomain = domainGetter; - }); - } else { - var usingDomains = false; - Object.defineProperty(EventsModule, "usingDomains", { - configurable: false, - enumerable: true, - get: function() { - return usingDomains; - }, - set: function(value) { - if (usingDomains || !value) return; - usingDomains = true; - Async.prototype._getDomain = domainGetter; - util.toFastProperties(process); - process.emit("domainsActivated"); - } - }); - } - } - } -} -} - -function AsyncInvokeLater(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._lateQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncInvoke(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncSettlePromises(promise) { - var domain = this._getDomain(); - if (domain !== undefined) { - var fn = domain.bind(promise._settlePromises); - this._normalQueue.push(fn, promise, undefined); - } else { - this._normalQueue._pushOne(promise); - } - this._queueTick(); -} - -if (!util.hasDevTools) { - Async.prototype.invokeLater = AsyncInvokeLater; - Async.prototype.invoke = AsyncInvoke; - Async.prototype.settlePromises = AsyncSettlePromises; -} else { - Async.prototype.invokeLater = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvokeLater.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 100); - } - }; - - Async.prototype.invoke = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvoke.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 0); - } - }; - - Async.prototype.settlePromises = function(promise) { - if (this._trampolineEnabled) { - AsyncSettlePromises.call(this, promise); - } else { - setTimeout(function() { - promise._settlePromises(); - }, 0); - } - }; -} - -Async.prototype.invokeFirst = function (fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.unshift(fn, receiver, arg); - this._queueTick(); -}; - -Async.prototype._drainQueue = function(queue) { - while (queue.length() > 0) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - continue; - } - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -}; - -Async.prototype._drainQueues = function () { - this._drainQueue(this._normalQueue); - this._reset(); - this._drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = new Async(); -module.exports.firstLineError = firstLineError; - -},{"./queue.js":28,"./schedule.js":31,"./util.js":38,"events":39}],3:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise) { -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - this._setBoundTo(thisArg); - if (this._isPending()) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, ret._progress, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, ret._progress, ret, context); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 131072; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~131072); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 131072) === 131072; -}; - -Promise.bind = function (thisArg, value) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - - if (maybePromise instanceof Promise) { - maybePromise._then(function(thisArg) { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - }, ret._reject, ret._progress, ret, null); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - } - return ret; -}; -}; - -},{}],4:[function(_dereq_,module,exports){ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = _dereq_("./promise.js")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; - -},{"./promise.js":23}],5:[function(_dereq_,module,exports){ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} - -module.exports = function(Promise) { -var util = _dereq_("./util.js"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; - -var getMethodCaller; -var getGetter; -if (!true) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; - -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; - -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; - } - } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; - -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); - } - return fn; -} - -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - if (!true) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); - } - } - } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; - -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; - } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; - -},{"./util.js":38}],6:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var errors = _dereq_("./errors.js"); -var async = _dereq_("./async.js"); -var CancellationError = errors.CancellationError; - -Promise.prototype._cancel = function (reason) { - if (!this.isCancellable()) return this; - var parent; - var promiseToReject = this; - while ((parent = promiseToReject._cancellationParent) !== undefined && - parent.isCancellable()) { - promiseToReject = parent; - } - this._unsetCancellable(); - promiseToReject._target()._rejectCallback(reason, false, true); -}; - -Promise.prototype.cancel = function (reason) { - if (!this.isCancellable()) return this; - if (reason === undefined) reason = new CancellationError(); - async.invokeLater(this._cancel, this, reason); - return this; -}; - -Promise.prototype.cancellable = function () { - if (this._cancellable()) return this; - async.enableTrampoline(); - this._setCancellable(); - this._cancellationParent = undefined; - return this; -}; - -Promise.prototype.uncancellable = function () { - var ret = this.then(); - ret._unsetCancellable(); - return ret; -}; - -Promise.prototype.fork = function (didFulfill, didReject, didProgress) { - var ret = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - - ret._setCancellable(); - ret._cancellationParent = undefined; - return ret; -}; -}; - -},{"./async.js":2,"./errors.js":13}],7:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var async = _dereq_("./async.js"); -var util = _dereq_("./util.js"); -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var warn; - -function CapturedTrace(parent) { - this._parent = parent; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.parent = function() { - return this._parent; -}; - -CapturedTrace.prototype.hasParent = function() { - return this._parent !== undefined; -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = CapturedTrace.parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = stackFramePattern.test(line) || - " (No stack trace)" === line; - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0) { - stack = stack.slice(i); - } - return stack; -} - -CapturedTrace.parseStackAndMessage = function(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: cleanStack(stack) - }; -}; - -CapturedTrace.formatAndLogError = function(error, title) { - if (typeof console !== "undefined") { - var message; - if (typeof error === "object" || typeof error === "function") { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof warn === "function") { - warn(message); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -}; - -CapturedTrace.unhandledRejection = function (reason) { - CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: "); -}; - -CapturedTrace.isSupported = function () { - return typeof captureStackTrace === "function"; -}; - -CapturedTrace.fireRejectionEvent = -function(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent(name, reason, promise); - } catch (e) { - globalEventFired = true; - async.throwLater(e); - } - - var domEventFired = false; - if (fireDomEvent) { - try { - domEventFired = fireDomEvent(name.toLowerCase(), { - reason: reason, - promise: promise - }); - } catch (e) { - domEventFired = true; - async.throwLater(e); - } - } - - if (!globalEventFired && !localEventFired && !domEventFired && - name === "unhandledRejection") { - CapturedTrace.formatAndLogError(reason, "Unhandled rejection "); - } -}; - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj.toString(); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} -CapturedTrace.setBounds = function(firstLineError, lastLineError) { - if (!CapturedTrace.isSupported()) return; - var firstStackLines = firstLineError.stack.split("\n"); - var lastStackLines = lastLineError.stack.split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow) { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -var fireDomEvent; -var fireGlobalEvent = (function() { - if (util.isNode) { - return function(name, reason, promise) { - if (name === "rejectionHandled") { - return process.emit(name, promise); - } else { - return process.emit(name, reason, promise); - } - }; - } else { - var customEventWorks = false; - var anyEventWorks = true; - try { - var ev = new self.CustomEvent("test"); - customEventWorks = ev instanceof CustomEvent; - } catch (e) {} - if (!customEventWorks) { - try { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - self.dispatchEvent(event); - } catch (e) { - anyEventWorks = false; - } - } - if (anyEventWorks) { - fireDomEvent = function(type, detail) { - var event; - if (customEventWorks) { - event = new self.CustomEvent(type, { - detail: detail, - bubbles: false, - cancelable: true - }); - } else if (self.dispatchEvent) { - event = document.createEvent("CustomEvent"); - event.initCustomEvent(type, false, true, detail); - } - - return event ? !self.dispatchEvent(event) : false; - }; - } - - var toWindowMethodNameMap = {}; - toWindowMethodNameMap["unhandledRejection"] = ("on" + - "unhandledRejection").toLowerCase(); - toWindowMethodNameMap["rejectionHandled"] = ("on" + - "rejectionHandled").toLowerCase(); - - return function(name, reason, promise) { - var methodName = toWindowMethodNameMap[name]; - var method = self[methodName]; - if (!method) return false; - if (name === "rejectionHandled") { - method.call(self, promise); - } else { - method.call(self, reason, promise); - } - return true; - }; - } -})(); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - warn = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - warn = function(message) { - process.stderr.write("\u001b[31m" + message + "\u001b[39m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - warn = function(message) { - console.warn("%c" + message, "color: red"); - }; - } -} - -return CapturedTrace; -}; - -},{"./async.js":2,"./util.js":38}],8:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = _dereq_("./util.js"); -var errors = _dereq_("./errors.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var keys = _dereq_("./es5.js").keys; -var TypeError = errors.TypeError; - -function CatchFilter(instances, callback, promise) { - this._instances = instances; - this._callback = callback; - this._promise = promise; -} - -function safePredicate(predicate, e) { - var safeObject = {}; - var retfilter = tryCatch(predicate).call(safeObject, e); - - if (retfilter === errorObj) return retfilter; - - var safeKeys = keys(safeObject); - if (safeKeys.length) { - errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"); - return errorObj; - } - return retfilter; -} - -CatchFilter.prototype.doFilter = function (e) { - var cb = this._callback; - var promise = this._promise; - var boundTo = promise._boundTo; - for (var i = 0, len = this._instances.length; i < len; ++i) { - var item = this._instances[i]; - var itemIsErrorType = item === Error || - (item != null && item.prototype instanceof Error); - - if (itemIsErrorType && e instanceof item) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } else if (typeof item === "function" && !itemIsErrorType) { - var shouldHandle = safePredicate(item, e); - if (shouldHandle === errorObj) { - e = errorObj.e; - break; - } else if (shouldHandle) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } - } - } - NEXT_FILTER.e = e; - return NEXT_FILTER; -}; - -return CatchFilter; -}; - -},{"./errors.js":13,"./es5.js":14,"./util.js":38}],9:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, CapturedTrace, isDebugging) { -var contextStack = []; -function Context() { - this._trace = new CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.pop(); - } -}; - -function createContext() { - if (isDebugging()) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} - -Promise.prototype._peekContext = peekContext; -Promise.prototype._pushContext = Context.prototype._pushContext; -Promise.prototype._popContext = Context.prototype._popContext; - -return createContext; -}; - -},{}],10:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, CapturedTrace) { -var async = _dereq_("./async.js"); -var Warning = _dereq_("./errors.js").Warning; -var util = _dereq_("./util.js"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var debugging = false || (util.isNode && - (!!process.env["BLUEBIRD_DEBUG"] || - process.env["NODE_ENV"] === "development")); - -if (debugging) { - async.disableTrampolineIfNecessary(); -} - -Promise.prototype._ensurePossibleRejectionHandled = function () { - this._setRejectionIsUnhandled(); - async.invokeLater(this._notifyUnhandledRejection, this, undefined); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - CapturedTrace.fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._getCarriedStackTrace() || this._settledValue; - this._setUnhandledRejectionIsNotified(); - CapturedTrace.fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 524288; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~524288); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 524288) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 2097152; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~2097152); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 2097152) > 0; -}; - -Promise.prototype._setCarriedStackTrace = function (capturedTrace) { - this._bitField = this._bitField | 1048576; - this._fulfillmentHandler0 = capturedTrace; -}; - -Promise.prototype._isCarryingStackTrace = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._getCarriedStackTrace = function () { - return this._isCarryingStackTrace() - ? this._fulfillmentHandler0 - : undefined; -}; - -Promise.prototype._captureStackTrace = function () { - if (debugging) { - this._trace = new CapturedTrace(this._peekContext()); - } - return this; -}; - -Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { - if (debugging && canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = CapturedTrace.parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -}; - -Promise.prototype._warn = function(message) { - var warning = new Warning(message); - var ctx = this._peekContext(); - if (ctx) { - ctx.attachExtraTrace(warning); - } else { - var parsed = CapturedTrace.parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - CapturedTrace.formatAndLogError(warning, ""); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - unhandledRejectionHandled = typeof fn === "function" ? fn : undefined; -}; - -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && - debugging === false - ) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a"); - } - debugging = CapturedTrace.isSupported(); - if (debugging) { - async.disableTrampolineIfNecessary(); - } -}; - -Promise.hasLongStackTraces = function () { - return debugging && CapturedTrace.isSupported(); -}; - -if (!CapturedTrace.isSupported()) { - Promise.longStackTraces = function(){}; - debugging = false; -} - -return function() { - return debugging; -}; -}; - -},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util.js"); -var isPrimitive = util.isPrimitive; -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; - -module.exports = function(Promise) { -var returner = function () { - return this; -}; -var thrower = function () { - throw this; -}; -var returnUndefined = function() {}; -var throwUndefined = function() { - throw undefined; -}; - -var wrapper = function (value, action) { - if (action === 1) { - return function () { - throw value; - }; - } else if (action === 2) { - return function () { - return value; - }; - } -}; - - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value === undefined) return this.then(returnUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(value)) { - return this._then( - wrapper(value, 2), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(returner, undefined, undefined, value, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - if (reason === undefined) return this.then(throwUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(reason)) { - return this._then( - wrapper(reason, 1), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(thrower, undefined, undefined, reason, undefined); -}; -}; - -},{"./util.js":38}],12:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; - -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, null, INTERNAL); -}; - -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, null, INTERNAL); -}; -}; - -},{}],13:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5.js"); -var Objectfreeze = es5.freeze; -var util = _dereq_("./util.js"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; - -},{"./es5.js":14,"./util.js":38}],14:[function(_dereq_,module,exports){ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} - -},{}],15:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; - -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; - -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; - -},{}],16:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) { -var util = _dereq_("./util.js"); -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; -var isPrimitive = util.isPrimitive; -var thrower = util.thrower; - -function returnThis() { - return this; -} -function throwThis() { - throw this; -} -function return$(r) { - return function() { - return r; - }; -} -function throw$(r) { - return function() { - throw r; - }; -} -function promisedFinally(ret, reasonOrValue, isFulfilled) { - var then; - if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) { - then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue); - } else { - then = isFulfilled ? returnThis : throwThis; - } - return ret._then(then, thrower, undefined, reasonOrValue, undefined); -} - -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo) - : handler(); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, reasonOrValue, - promise.isFulfilled()); - } - } - - if (promise.isRejected()) { - NEXT_FILTER.e = reasonOrValue; - return NEXT_FILTER; - } else { - return reasonOrValue; - } -} - -function tapHandler(value) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo, value) - : handler(value); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, value, true); - } - } - return value; -} - -Promise.prototype._passThroughHandler = function (handler, isFinally) { - if (typeof handler !== "function") return this.then(); - - var promiseAndHandler = { - promise: this, - handler: handler - }; - - return this._then( - isFinally ? finallyHandler : tapHandler, - isFinally ? finallyHandler : undefined, undefined, - promiseAndHandler, undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThroughHandler(handler, true); -}; - -Promise.prototype.tap = function (handler) { - return this._passThroughHandler(handler, false); -}; -}; - -},{"./util.js":38}],17:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise) { -var errors = _dereq_("./errors.js"); -var TypeError = errors.TypeError; -var util = _dereq_("./util.js"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; - -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; - } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} - -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; -} - -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; - -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._next(undefined); -}; - -PromiseSpawn.prototype._continue = function (result) { - if (result === errorObj) { - return this._promise._rejectCallback(result.e, false, true); - } - - var value = result.value; - if (result.done === true) { - this._promise._resolveCallback(value); - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._throw( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } - } - maybePromise._then( - this._next, - this._throw, - undefined, - this, - null - ); - } -}; - -PromiseSpawn.prototype._throw = function (reason) { - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._next = function (value) { - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; - -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - spawn._generator = generator; - spawn._next(undefined); - return spawn.promise(); - }; -}; - -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - yieldHandlers.push(fn); -}; - -Promise.spawn = function (generatorFunction) { - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; - -},{"./errors.js":13,"./util.js":38}],18:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) { -var util = _dereq_("./util.js"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!true) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var caller = function(count) { - var values = []; - for (var i = 1; i <= count; ++i) values.push("holder.p" + i); - return new Function("holder", " \n\ - 'use strict'; \n\ - var callback = holder.fn; \n\ - return callback(values); \n\ - ".replace(/values/g, values.join(", "))); - }; - var thenCallbacks = []; - var callers = [undefined]; - for (var i = 1; i <= 5; ++i) { - thenCallbacks.push(thenCallback(i)); - callers.push(caller(i)); - } - - var Holder = function(total, fn) { - this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null; - this.fn = fn; - this.total = total; - this.now = 0; - }; - - Holder.prototype.callers = callers; - Holder.prototype.checkFulfillment = function(promise) { - var now = this.now; - now++; - var total = this.total; - if (now >= total) { - var handler = this.callers[total]; - promise._pushContext(); - var ret = tryCatch(handler)(this); - promise._popContext(); - if (ret === errorObj) { - promise._rejectCallback(ret.e, false, true); - } else { - promise._resolveCallback(ret); - } - } else { - this.now = now; - } - }; - - var reject = function (reason) { - this._reject(reason); - }; -} -} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!true) { - if (last < 6 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var holder = new Holder(last, fn); - var callbacks = thenCallbacks; - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - } else if (maybePromise._isFulfilled()) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else { - ret._reject(maybePromise._reason()); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - return ret; - } - } - } - var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; - -},{"./util.js":38}],19:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = _dereq_("./async.js"); -var util = _dereq_("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var PENDING = {}; -var EMPTY_ARRAY = []; - -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._callback = fn; - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = limit >= 1 ? [] : EMPTY_ARRAY; - async.invoke(init, this, undefined); -} -util.inherits(MappingPromiseArray, PromiseArray); -function init() {this._init$(undefined, -2);} - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - if (values[index] === PENDING) { - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return; - } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return; - } - if (preservedValues !== null) preservedValues[index] = value; - - var callback = this._callback; - var receiver = this._promise._boundTo; - this._promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - this._promise._popContext(); - if (ret === errorObj) return this._reject(ret.e); - - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - if (limit >= 1) this._inFlight++; - values[index] = PENDING; - return maybePromise._proxyPromiseArray(this, index); - } else if (maybePromise._isFulfilled()) { - ret = maybePromise._value(); - } else { - return this._reject(maybePromise._reason()); - } - } - values[index] = ret; - } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); - } else { - this._resolve(values); - } - - } -}; - -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); - } -}; - -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; - } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; - -function map(promises, fn, options, _filter) { - var limit = typeof options === "object" && options !== null - ? options.concurrency - : 0; - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter); -} - -Promise.prototype.map = function (fn, options) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - - return map(this, fn, options, null).promise(); -}; - -Promise.map = function (promises, fn, options, _filter) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - return map(promises, fn, options, _filter).promise(); -}; - - -}; - -},{"./async.js":2,"./util.js":38}],20:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util.js"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn, args, ctx) { - if (typeof fn !== "function") { - return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = util.isArray(args) - ? tryCatch(fn).apply(ctx, args) - : tryCatch(fn).call(ctx, args); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false, true); - } else { - this._resolveCallback(value, true); - } -}; -}; - -},{"./util.js":38}],21:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -var util = _dereq_("./util.js"); -var async = _dereq_("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundTo; - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var target = promise._target(); - var newReason = target._getCarriedStackTrace(); - newReason.cause = reason; - reason = newReason; - } - var ret = tryCatch(nodeback).call(promise._boundTo, reason); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -Promise.prototype.asCallback = -Promise.prototype.nodeify = function (nodeback, options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); - } - return this; -}; -}; - -},{"./async.js":2,"./util.js":38}],22:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, PromiseArray) { -var util = _dereq_("./util.js"); -var async = _dereq_("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -Promise.prototype.progressed = function (handler) { - return this._then(undefined, undefined, handler, undefined, undefined); -}; - -Promise.prototype._progress = function (progressValue) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._target()._progressUnchecked(progressValue); - -}; - -Promise.prototype._progressHandlerAt = function (index) { - return index === 0 - ? this._progressHandler0 - : this[(index << 2) + index - 5 + 2]; -}; - -Promise.prototype._doProgressWith = function (progression) { - var progressValue = progression.value; - var handler = progression.handler; - var promise = progression.promise; - var receiver = progression.receiver; - - var ret = tryCatch(handler).call(receiver, progressValue); - if (ret === errorObj) { - if (ret.e != null && - ret.e.name !== "StopProgressPropagation") { - var trace = util.canAttachTrace(ret.e) - ? ret.e : new Error(util.toString(ret.e)); - promise._attachExtraTrace(trace); - promise._progress(ret.e); - } - } else if (ret instanceof Promise) { - ret._then(promise._progress, null, null, promise, undefined); - } else { - promise._progress(ret); - } -}; - - -Promise.prototype._progressUnchecked = function (progressValue) { - var len = this._length(); - var progress = this._progress; - for (var i = 0; i < len; i++) { - var handler = this._progressHandlerAt(i); - var promise = this._promiseAt(i); - if (!(promise instanceof Promise)) { - var receiver = this._receiverAt(i); - if (typeof handler === "function") { - handler.call(receiver, progressValue, promise); - } else if (receiver instanceof PromiseArray && - !receiver._isResolved()) { - receiver._promiseProgressed(progressValue, promise); - } - continue; - } - - if (typeof handler === "function") { - async.invoke(this._doProgressWith, this, { - handler: handler, - promise: promise, - receiver: this._receiverAt(i), - value: progressValue - }); - } else { - async.invoke(progress, promise, progressValue); - } - } -}; -}; - -},{"./async.js":2,"./util.js":38}],23:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a"); -}; -var reflect = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -var util = _dereq_("./util.js"); -var async = _dereq_("./async.js"); -var errors = _dereq_("./errors.js"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {e: null}; -var tryConvertToPromise = _dereq_("./thenables.js")(Promise, INTERNAL); -var PromiseArray = - _dereq_("./promise_array.js")(Promise, INTERNAL, - tryConvertToPromise, apiRejection); -var CapturedTrace = _dereq_("./captured_trace.js")(); -var isDebugging = _dereq_("./debuggability.js")(Promise, CapturedTrace); - /*jshint unused:false*/ -var createContext = - _dereq_("./context.js")(Promise, CapturedTrace, isDebugging); -var CatchFilter = _dereq_("./catch_filter.js")(NEXT_FILTER); -var PromiseResolver = _dereq_("./promise_resolver.js"); -var nodebackForPromise = PromiseResolver._nodebackForPromise; -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function Promise(resolver) { - if (typeof resolver !== "function") { - throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a"); - } - if (this.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a"); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._progressHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._settledValue = undefined; - if (resolver !== INTERNAL) this._resolveFromResolver(resolver); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (typeof item === "function") { - catchInstances[j++] = item; - } else { - return Promise.reject( - new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a")); - } - } - catchInstances.length = j; - fn = arguments[i]; - var catchFilter = new CatchFilter(catchInstances, fn, this); - return this._then(undefined, catchFilter.doFilter, undefined, - catchFilter, undefined); - } - return this._then(undefined, fn, undefined, undefined, undefined); -}; - -Promise.prototype.reflect = function () { - return this._then(reflect, reflect, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject, didProgress) { - if (isDebugging() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, didProgress, - undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject, didProgress) { - var promise = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (didFulfill, didReject) { - return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined); -}; - -Promise.prototype.isCancellable = function () { - return !this.isResolved() && - this._cancellable(); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = function(fn) { - var ret = new Promise(INTERNAL); - var result = tryCatch(fn)(nodebackForPromise(ret)); - if (result === errorObj) { - ret._rejectCallback(result.e, true, true); - } - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.defer = Promise.pending = function () { - var promise = new Promise(INTERNAL); - return new PromiseResolver(promise); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - var val = ret; - ret = new Promise(INTERNAL); - ret._fulfillUnchecked(val); - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - var prev = async._schedule; - async._schedule = fn; - return prev; -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - didProgress, - receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var ret = haveInternalData ? internalData : new Promise(INTERNAL); - - if (!haveInternalData) { - ret._propagateFrom(this, 4 | 1); - ret._captureStackTrace(); - } - - var target = this._target(); - if (target !== this) { - if (receiver === undefined) receiver = this._boundTo; - if (!haveInternalData) ret._setIsMigrated(); - } - - var callbackIndex = - target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver); - - if (target._isResolved() && !target._isSettlePromisesQueued()) { - async.invoke( - target._settlePromiseAtPostResolution, target, callbackIndex); - } - - return ret; -}; - -Promise.prototype._settlePromiseAtPostResolution = function (index) { - if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled(); - this._settlePromiseAt(index); -}; - -Promise.prototype._length = function () { - return this._bitField & 131071; -}; - -Promise.prototype._isFollowingOrFulfilledOrRejected = function () { - return (this._bitField & 939524096) > 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 536870912) === 536870912; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -131072) | - (len & 131071); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 134217728; -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 536870912; -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 33554432; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 33554432) > 0; -}; - -Promise.prototype._cancellable = function () { - return (this._bitField & 67108864) > 0; -}; - -Promise.prototype._setCancellable = function () { - this._bitField = this._bitField | 67108864; -}; - -Promise.prototype._unsetCancellable = function () { - this._bitField = this._bitField & (~67108864); -}; - -Promise.prototype._setIsMigrated = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._unsetIsMigrated = function () { - this._bitField = this._bitField & (~4194304); -}; - -Promise.prototype._isMigrated = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 - ? this._receiver0 - : this[ - index * 5 - 5 + 4]; - if (ret === undefined && this._isBound()) { - return this._boundTo; - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return index === 0 - ? this._promise0 - : this[index * 5 - 5 + 3]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return index === 0 - ? this._fulfillmentHandler0 - : this[index * 5 - 5 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return index === 0 - ? this._rejectionHandler0 - : this[index * 5 - 5 + 1]; -}; - -Promise.prototype._migrateCallbacks = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var progress = follower._progressHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (promise instanceof Promise) promise._setIsMigrated(); - this._addCallbacks(fulfill, reject, progress, promise, receiver); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - progress, - promise, - receiver -) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - if (receiver !== undefined) this._receiver0 = receiver; - if (typeof fulfill === "function" && !this._isCarryingStackTrace()) - this._fulfillmentHandler0 = fulfill; - if (typeof reject === "function") this._rejectionHandler0 = reject; - if (typeof progress === "function") this._progressHandler0 = progress; - } else { - var base = index * 5 - 5; - this[base + 3] = promise; - this[base + 4] = receiver; - if (typeof fulfill === "function") - this[base + 0] = fulfill; - if (typeof reject === "function") - this[base + 1] = reject; - if (typeof progress === "function") - this[base + 2] = progress; - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - if (index === 0) { - this._promise0 = promiseSlotValue; - this._receiver0 = receiver; - } else { - var base = index * 5 - 5; - this[base + 3] = promiseSlotValue; - this[base + 4] = receiver; - } - this._setLength(index + 1); -}; - -Promise.prototype._proxyPromiseArray = function (promiseArray, index) { - this._setProxyHandlers(promiseArray, index); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (this._isFollowingOrFulfilledOrRejected()) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false, true); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - var propagationFlags = 1 | (shouldBind ? 4 : 0); - this._propagateFrom(maybePromise, propagationFlags); - var promise = maybePromise._target(); - if (promise._isPending()) { - var len = this._length(); - for (var i = 0; i < len; ++i) { - promise._migrateCallbacks(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(promise); - } else if (promise._isFulfilled()) { - this._fulfillUnchecked(promise._value()); - } else { - this._rejectUnchecked(promise._reason(), - promise._getCarriedStackTrace()); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, shouldNotMarkOriginatingFromRejection) { - if (!shouldNotMarkOriginatingFromRejection) { - util.markAsOriginatingFromRejection(reason); - } - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason, hasStack ? undefined : trace); -}; - -Promise.prototype._resolveFromResolver = function (resolver) { - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = tryCatch(resolver)(function(value) { - if (promise === null) return; - promise._resolveCallback(value); - promise = null; - }, function (reason) { - if (promise === null) return; - promise._rejectCallback(reason, synchronous); - promise = null; - }); - synchronous = false; - this._popContext(); - - if (r !== undefined && r === errorObj && promise !== null) { - promise._rejectCallback(r.e, true, true); - promise = null; - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - if (promise._isRejected()) return; - promise._pushContext(); - var x; - if (receiver === APPLY && !this._isRejected()) { - x = tryCatch(handler).apply(this._boundTo, value); - } else { - x = tryCatch(handler).call(receiver, value); - } - promise._popContext(); - - if (x === errorObj || x === promise || x === NEXT_FILTER) { - var err = x === promise ? makeSelfResolutionError() : x.e; - promise._rejectCallback(err, false, true); - } else { - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._cleanValues = function () { - if (this._cancellable()) { - this._cancellationParent = undefined; - } -}; - -Promise.prototype._propagateFrom = function (parent, flags) { - if ((flags & 1) > 0 && parent._cancellable()) { - this._setCancellable(); - this._cancellationParent = parent; - } - if ((flags & 4) > 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -}; - -Promise.prototype._fulfill = function (value) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._fulfillUnchecked(value); -}; - -Promise.prototype._reject = function (reason, carriedStackTrace) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._rejectUnchecked(reason, carriedStackTrace); -}; - -Promise.prototype._settlePromiseAt = function (index) { - var promise = this._promiseAt(index); - var isPromise = promise instanceof Promise; - - if (isPromise && promise._isMigrated()) { - promise._unsetIsMigrated(); - return async.invoke(this._settlePromiseAt, this, index); - } - var handler = this._isFulfilled() - ? this._fulfillmentHandlerAt(index) - : this._rejectionHandlerAt(index); - - var carriedStackTrace = - this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined; - var value = this._settledValue; - var receiver = this._receiverAt(index); - - - this._clearCallbackDataAtIndex(index); - - if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof PromiseArray) { - if (!receiver._isResolved()) { - if (this._isFulfilled()) { - receiver._promiseFulfilled(value, promise); - } - else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (this._isFulfilled()) { - promise._fulfill(value); - } else { - promise._reject(value, carriedStackTrace); - } - } - - if (index >= 4 && (index & 31) === 4) - async.invokeLater(this._setLength, this, 0); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - if (index === 0) { - if (!this._isCarryingStackTrace()) { - this._fulfillmentHandler0 = undefined; - } - this._rejectionHandler0 = - this._progressHandler0 = - this._receiver0 = - this._promise0 = undefined; - } else { - var base = index * 5 - 5; - this[base + 3] = - this[base + 4] = - this[base + 0] = - this[base + 1] = - this[base + 2] = undefined; - } -}; - -Promise.prototype._isSettlePromisesQueued = function () { - return (this._bitField & - -1073741824) === -1073741824; -}; - -Promise.prototype._setSettlePromisesQueued = function () { - this._bitField = this._bitField | -1073741824; -}; - -Promise.prototype._unsetSettlePromisesQueued = function () { - this._bitField = this._bitField & (~-1073741824); -}; - -Promise.prototype._queueSettlePromises = function() { - async.settlePromises(this); - this._setSettlePromisesQueued(); -}; - -Promise.prototype._fulfillUnchecked = function (value) { - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err, undefined); - } - this._setFulfilled(); - this._settledValue = value; - this._cleanValues(); - - if (this._length() > 0) { - this._queueSettlePromises(); - } -}; - -Promise.prototype._rejectUncheckedCheckError = function (reason) { - var trace = util.ensureErrorObject(reason); - this._rejectUnchecked(reason, trace === reason ? undefined : trace); -}; - -Promise.prototype._rejectUnchecked = function (reason, trace) { - if (reason === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err); - } - this._setRejected(); - this._settledValue = reason; - this._cleanValues(); - - if (this._isFinal()) { - async.throwLater(function(e) { - if ("stack" in e) { - async.invokeFirst( - CapturedTrace.unhandledRejection, undefined, e); - } - throw e; - }, trace === undefined ? reason : trace); - return; - } - - if (trace !== undefined && trace !== reason) { - this._setCarriedStackTrace(trace); - } - - if (this._length() > 0) { - this._queueSettlePromises(); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._settlePromises = function () { - this._unsetSettlePromisesQueued(); - var len = this._length(); - for (var i = 0; i < len; i++) { - this._settlePromiseAt(i); - } -}; - -Promise._makeSelfResolutionError = makeSelfResolutionError; -_dereq_("./progress.js")(Promise, PromiseArray); -_dereq_("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection); -_dereq_("./bind.js")(Promise, INTERNAL, tryConvertToPromise); -_dereq_("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise); -_dereq_("./direct_resolve.js")(Promise); -_dereq_("./synchronous_inspection.js")(Promise); -_dereq_("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL); -Promise.Promise = Promise; -_dereq_('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -_dereq_('./cancel.js')(Promise); -_dereq_('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext); -_dereq_('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise); -_dereq_('./nodeify.js')(Promise); -_dereq_('./call_get.js')(Promise); -_dereq_('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -_dereq_('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -_dereq_('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -_dereq_('./settle.js')(Promise, PromiseArray); -_dereq_('./some.js')(Promise, PromiseArray, apiRejection); -_dereq_('./promisify.js')(Promise, INTERNAL); -_dereq_('./any.js')(Promise); -_dereq_('./each.js')(Promise, INTERNAL); -_dereq_('./timers.js')(Promise, INTERNAL); -_dereq_('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._progressHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - p._settledValue = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - CapturedTrace.setBounds(async.firstLineError, util.lastLineError); - return Promise; - -}; - -},{"./any.js":1,"./async.js":2,"./bind.js":3,"./call_get.js":5,"./cancel.js":6,"./captured_trace.js":7,"./catch_filter.js":8,"./context.js":9,"./debuggability.js":10,"./direct_resolve.js":11,"./each.js":12,"./errors.js":13,"./filter.js":15,"./finally.js":16,"./generators.js":17,"./join.js":18,"./map.js":19,"./method.js":20,"./nodeify.js":21,"./progress.js":22,"./promise_array.js":24,"./promise_resolver.js":25,"./promisify.js":26,"./props.js":27,"./race.js":29,"./reduce.js":30,"./settle.js":32,"./some.js":33,"./synchronous_inspection.js":34,"./thenables.js":35,"./timers.js":36,"./using.js":37,"./util.js":38}],24:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection) { -var util = _dereq_("./util.js"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - var parent; - if (values instanceof Promise) { - parent = values; - promise._propagateFrom(parent, 1 | 4); - } - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - this._values = values; - if (values._isFulfilled()) { - values = values._value(); - if (!isArray(values)) { - var err = new Promise.TypeError("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - this.__hardReject__(err); - return; - } - } else if (values._isPending()) { - values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - return; - } else { - this._reject(values._reason()); - return; - } - } else if (!isArray(values)) { - this._promise._reject(apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a")._reason()); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var promise = this._promise; - for (var i = 0; i < len; ++i) { - var isResolved = this._isResolved(); - var maybePromise = tryConvertToPromise(values[i], promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (isResolved) { - maybePromise._unsetRejectionIsUnhandled(); - } else if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, i); - } else if (maybePromise._isFulfilled()) { - this._promiseFulfilled(maybePromise._value(), i); - } else { - this._promiseRejected(maybePromise._reason(), i); - } - } else if (!isResolved) { - this._promiseFulfilled(maybePromise, i); - } - } -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype.__hardReject__ = -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false, true); -}; - -PromiseArray.prototype._promiseProgressed = function (progressValue, index) { - this._promise._progress({ - index: index, - value: progressValue - }); -}; - - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -PromiseArray.prototype._promiseRejected = function (reason, index) { - this._totalResolved++; - this._reject(reason); -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; - -},{"./util.js":38}],25:[function(_dereq_,module,exports){ -"use strict"; -var util = _dereq_("./util.js"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = _dereq_("./errors.js"); -var TimeoutError = errors.TimeoutError; -var OperationalError = errors.OperationalError; -var haveGetters = util.haveGetters; -var es5 = _dereq_("./es5.js"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise) { - return function(err, value) { - if (promise === null) return; - - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (arguments.length > 2) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - promise._fulfill(args); - } else { - promise._fulfill(value); - } - - promise = null; - }; -} - - -var PromiseResolver; -if (!haveGetters) { - PromiseResolver = function (promise) { - this.promise = promise; - this.asCallback = nodebackForPromise(promise); - this.callback = this.asCallback; - }; -} -else { - PromiseResolver = function (promise) { - this.promise = promise; - }; -} -if (haveGetters) { - var prop = { - get: function() { - return nodebackForPromise(this.promise); - } - }; - es5.defineProperty(PromiseResolver.prototype, "asCallback", prop); - es5.defineProperty(PromiseResolver.prototype, "callback", prop); -} - -PromiseResolver._nodebackForPromise = nodebackForPromise; - -PromiseResolver.prototype.toString = function () { - return "[object PromiseResolver]"; -}; - -PromiseResolver.prototype.resolve = -PromiseResolver.prototype.fulfill = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._resolveCallback(value); -}; - -PromiseResolver.prototype.reject = function (reason) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._rejectCallback(reason); -}; - -PromiseResolver.prototype.progress = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._progress(value); -}; - -PromiseResolver.prototype.cancel = function (err) { - this.promise.cancel(err); -}; - -PromiseResolver.prototype.timeout = function () { - this.reject(new TimeoutError("timeout")); -}; - -PromiseResolver.prototype.isResolved = function () { - return this.promise.isResolved(); -}; - -PromiseResolver.prototype.toJSON = function () { - return this.promise.toJSON(); -}; - -module.exports = PromiseResolver; - -},{"./errors.js":13,"./es5.js":14,"./util.js":38}],26:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = _dereq_("./util.js"); -var nodebackForPromise = _dereq_("./promise_resolver.js") - ._nodebackForPromise; -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = _dereq_("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyPropsPattern = - /^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/; -var defaultFilter = function(name, func) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - !util.isClass(func); -}; - -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} - -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} - -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/iWrZbw\u000a" - .replace("%s", suffix)); - } - } - } - } -} - -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} - -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; - -var makeNodePromisifiedEval; -if (!true) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; - -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; - -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; - -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; - -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; - - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); - } - - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } - - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; - } - - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "INTERNAL","'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - return promise; \n\ - }; \n\ - ret.__isPromisified__ = true; \n\ - return ret; \n\ - " - .replace("Parameters", parameterDeclaration(newParameterCount)) - .replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode))( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - INTERNAL - ); -}; -} - -function makeNodePromisifiedClosure(callback, receiver, _, fn) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; - } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - return promise; - } - promisified.__isPromisified__ = true; - return promisified; -} - -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; - -function promisifyAll(obj, suffix, filter, promisifier) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); - - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - obj[promisifiedKey] = promisifier === makeNodePromisified - ? makeNodePromisified(key, THIS, key, fn, suffix) - : promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, fn, suffix); - }); - } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver) { - return makeNodePromisified(callback, receiver, undefined, callback); -} - -Promise.promisify = function (fn, receiver) { - if (typeof fn !== "function") { - throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - if (isPromisified(fn)) { - return fn; - } - var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/9ITlV0\u000a"); - } - options = Object(options); - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; - - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/8FZo5V\u000a"); - } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier); - promisifyAll(value, suffix, filter, promisifier); - } - } - - return promisifyAll(target, suffix, filter, promisifier); -}; -}; - - -},{"./errors":13,"./promise_resolver.js":25,"./util.js":38}],27:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = _dereq_("./util.js"); -var isObject = util.isObject; -var es5 = _dereq_("./es5.js"); - -function PropertiesPromiseArray(obj) { - var keys = es5.keys(obj); - var len = keys.length; - var values = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - values[i] = obj[key]; - values[i + len] = key; - } - this.constructor$(values); -} -util.inherits(PropertiesPromiseArray, PromiseArray); - -PropertiesPromiseArray.prototype._init = function () { - this._init$(undefined, -3) ; -}; - -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - this._resolve(val); - } -}; - -PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { - this._promise._progress({ - key: this._values[index + this.length()], - value: value - }); -}; - -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; - -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); - - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/OsFKC8\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } - - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 4); - } - return ret; -} - -Promise.prototype.props = function () { - return props(this); -}; - -Promise.props = function (promises) { - return props(promises); -}; -}; - -},{"./es5.js":14,"./util.js":38}],28:[function(_dereq_,module,exports){ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype._unshiftOne = function(value) { - var capacity = this._capacity; - this._checkCapacity(this.length() + 1); - var front = this._front; - var i = (((( front - 1 ) & - ( capacity - 1) ) ^ capacity ) - capacity ); - this[i] = value; - this._front = i; - this._length = this.length() + 1; -}; - -Queue.prototype.unshift = function(fn, receiver, arg) { - this._unshiftOne(arg); - this._unshiftOne(receiver); - this._unshiftOne(fn); -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; - -},{}],29:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var isArray = _dereq_("./util.js").isArray; - -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; - -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); - - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else if (!isArray(promises)) { - return apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - } - - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 4 | 1); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; - - if (val === undefined && !(i in promises)) { - continue; - } - - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} - -Promise.race = function (promises) { - return race(promises, undefined); -}; - -Promise.prototype.race = function () { - return race(this, undefined); -}; - -}; - -},{"./util.js":38}],30:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = _dereq_("./async.js"); -var util = _dereq_("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -function ReductionPromiseArray(promises, fn, accum, _each) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._preservedValues = _each === INTERNAL ? [] : null; - this._zerothIsAccum = (accum === undefined); - this._gotAccum = false; - this._reducingIndex = (this._zerothIsAccum ? 1 : 0); - this._valuesPhase = undefined; - var maybePromise = tryConvertToPromise(accum, this._promise); - var rejected = false; - var isPromise = maybePromise instanceof Promise; - if (isPromise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, -1); - } else if (maybePromise._isFulfilled()) { - accum = maybePromise._value(); - this._gotAccum = true; - } else { - this._reject(maybePromise._reason()); - rejected = true; - } - } - if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true; - this._callback = fn; - this._accum = accum; - if (!rejected) async.invoke(init, this, undefined); -} -function init() { - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); - -ReductionPromiseArray.prototype._init = function () {}; - -ReductionPromiseArray.prototype._resolveEmptyArray = function () { - if (this._gotAccum || this._zerothIsAccum) { - this._resolve(this._preservedValues !== null - ? [] : this._accum); - } -}; - -ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - values[index] = value; - var length = this.length(); - var preservedValues = this._preservedValues; - var isEach = preservedValues !== null; - var gotAccum = this._gotAccum; - var valuesPhase = this._valuesPhase; - var valuesPhaseIndex; - if (!valuesPhase) { - valuesPhase = this._valuesPhase = new Array(length); - for (valuesPhaseIndex=0; valuesPhaseIndex 10) || (version[0] > 0) - ? function(fn) { global.setImmediate(fn); } : process.nextTick; - - if (!schedule) { - if (typeof setImmediate !== "undefined") { - schedule = setImmediate; - } else if (typeof setTimeout !== "undefined") { - schedule = setTimeout; - } else { - schedule = noAsyncScheduler; - } - } -} else if (typeof MutationObserver !== "undefined") { - schedule = function(fn) { - var div = document.createElement("div"); - var observer = new MutationObserver(fn); - observer.observe(div, {attributes: true}); - return function() { div.classList.toggle("foo"); }; - }; - schedule.isStatic = true; -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; - -},{"./util.js":38}],32:[function(_dereq_,module,exports){ -"use strict"; -module.exports = - function(Promise, PromiseArray) { -var PromiseInspection = Promise.PromiseInspection; -var util = _dereq_("./util.js"); - -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); - -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 268435456; - ret._settledValue = value; - this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 134217728; - ret._settledValue = reason; - this._promiseResolved(index, ret); -}; - -Promise.settle = function (promises) { - return new SettledPromiseArray(promises).promise(); -}; - -Promise.prototype.settle = function () { - return new SettledPromiseArray(this).promise(); -}; -}; - -},{"./util.js":38}],33:[function(_dereq_,module,exports){ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = _dereq_("./util.js"); -var RangeError = _dereq_("./errors.js").RangeError; -var AggregateError = _dereq_("./errors.js").AggregateError; -var isArray = util.isArray; - - -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); - -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; - -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; - -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; - -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; - -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; - -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - } - -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - e.push(this._values[i]); - } - this._reject(e); - } -}; - -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; - -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; - -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; - -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; - -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; - -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; - -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; - -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/1wAmHx\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} - -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; - -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; - -Promise._SomePromiseArray = SomePromiseArray; -}; - -},{"./errors.js":13,"./util.js":38}],34:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValue = promise._settledValue; - } - else { - this._bitField = 0; - this._settledValue = undefined; - } -} - -PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.isFulfilled = -Promise.prototype._isFulfilled = function () { - return (this._bitField & 268435456) > 0; -}; - -PromiseInspection.prototype.isRejected = -Promise.prototype._isRejected = function () { - return (this._bitField & 134217728) > 0; -}; - -PromiseInspection.prototype.isPending = -Promise.prototype._isPending = function () { - return (this._bitField & 402653184) === 0; -}; - -PromiseInspection.prototype.isResolved = -Promise.prototype._isResolved = function () { - return (this._bitField & 402653184) > 0; -}; - -Promise.prototype.isPending = function() { - return this._target()._isPending(); -}; - -Promise.prototype.isRejected = function() { - return this._target()._isRejected(); -}; - -Promise.prototype.isFulfilled = function() { - return this._target()._isFulfilled(); -}; - -Promise.prototype.isResolved = function() { - return this._target()._isResolved(); -}; - -Promise.prototype._value = function() { - return this._settledValue; -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue; -}; - -Promise.prototype.value = function() { - var target = this._target(); - if (!target.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return target._settledValue; -}; - -Promise.prototype.reason = function() { - var target = this._target(); - if (!target.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - target._unsetRejectionIsUnhandled(); - return target._settledValue; -}; - - -Promise.PromiseInspection = PromiseInspection; -}; - -},{}],35:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util.js"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) { - return obj; - } - else if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfillUnchecked, - ret._rejectUncheckedCheckError, - ret._progressUnchecked, - ret, - null - ); - return ret; - } - var then = util.tryCatch(getThen)(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - return doThenable(obj, then, context); - } - } - return obj; -} - -function getThen(obj) { - return obj.then; -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - return hasProp.call(obj, "_promise0"); -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, - resolveFromThenable, - rejectFromThenable, - progressFromThenable); - synchronous = false; - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolveFromThenable(value) { - if (!promise) return; - if (x === value) { - promise._rejectCallback( - Promise._makeSelfResolutionError(), false, true); - } else { - promise._resolveCallback(value); - } - promise = null; - } - - function rejectFromThenable(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - - function progressFromThenable(value) { - if (!promise) return; - if (typeof promise._progress === "function") { - promise._progress(value); - } - } - return ret; -} - -return tryConvertToPromise; -}; - -},{"./util.js":38}],36:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = _dereq_("./util.js"); -var TimeoutError = Promise.TimeoutError; - -var afterTimeout = function (promise, message) { - if (!promise.isPending()) return; - if (typeof message !== "string") { - message = "operation timed out"; - } - var err = new TimeoutError(message); - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._cancel(err); -}; - -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (value, ms) { - if (ms === undefined) { - ms = value; - value = undefined; - var ret = new Promise(INTERNAL); - setTimeout(function() { ret._fulfill(); }, ms); - return ret; - } - ms = +ms; - return Promise.resolve(value)._then(afterValue, null, null, ms, undefined); -}; - -Promise.prototype.delay = function (ms) { - return delay(this, ms); -}; - -function successClear(value) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - return value; -} - -function failureClear(reason) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - throw reason; -} - -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret = this.then().cancellable(); - ret._cancellationParent = this; - var handle = setTimeout(function timeoutTimeout() { - afterTimeout(ret, message); - }, ms); - return ret._then(successClear, failureClear, undefined, handle, undefined); -}; - -}; - -},{"./util.js":38}],37:[function(_dereq_,module,exports){ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext) { - var TypeError = _dereq_("./errors.js").TypeError; - var inherits = _dereq_("./util.js").inherits; - var PromiseInspection = Promise.PromiseInspection; - - function inspectionMapper(inspections) { - var len = inspections.length; - for (var i = 0; i < len; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - return Promise.reject(inspection.error()); - } - inspections[i] = inspection._settledValue; - } - return inspections; - } - - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } - - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = Promise.defer(); - function iterator() { - if (i >= len) return ret.resolve(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); - } - } - iterator(); - } - iterator(); - return ret.promise; - } - - function disposerSuccess(value) { - var inspection = new PromiseInspection(); - inspection._settledValue = value; - inspection._bitField = 268435456; - return dispose(this, inspection).thenReturn(value); - } - - function disposerFail(reason) { - var inspection = new PromiseInspection(); - inspection._settledValue = reason; - inspection._bitField = 134217728; - return dispose(this, inspection).thenThrow(reason); - } - - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } - - Disposer.prototype.data = function () { - return this._data; - }; - - Disposer.prototype.promise = function () { - return this._promise; - }; - - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return null; - }; - - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== null - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; - - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; - - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); - - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; - - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } - - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - len--; - var resources = new Array(len); - for (var i = 0; i < len; ++i) { - var resource = arguments[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } - - var promise = Promise.settle(resources) - .then(inspectionMapper) - .then(function(vals) { - promise._pushContext(); - var ret; - try { - ret = fn.apply(undefined, vals); - } finally { - promise._popContext(); - } - return ret; - }) - ._then( - disposerSuccess, disposerFail, undefined, resources, undefined); - resources.promise = promise; - return promise; - }; - - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 262144; - this._disposer = disposer; - }; - - Promise.prototype._isDisposable = function () { - return (this._bitField & 262144) > 0; - }; - - Promise.prototype._getDisposer = function () { - return this._disposer; - }; - - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~262144); - this._disposer = undefined; - }; - - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; - -}; - -},{"./errors.js":13,"./util.js":38}],38:[function(_dereq_,module,exports){ -"use strict"; -var es5 = _dereq_("./es5.js"); -var canEvaluate = typeof navigator == "undefined"; -var haveGetters = (function(){ - try { - var o = {}; - es5.defineProperty(o, "f", { - get: function () { - return 3; - } - }); - return o.f === 3; - } - catch (e) { - return false; - } - -})(); - -var errorObj = {e: {}}; -var tryCatchTarget; -function tryCatcher() { - try { - return tryCatchTarget.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return !isPrimitive(value); -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - - -var wrapsPrimitiveReceiver = (function() { - return this !== "string"; -}).call("string"); - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - if (es5.isES5) { - var oProto = Object.prototype; - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && obj !== oProto) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - return function(obj) { - var ret = []; - /*jshint forin:false */ - for (var key in obj) { - ret.push(key); - } - return ret; - }; - } - -})(); - -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - if (es5.isES5) return keys.length > 1; - return keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function f() {} - f.prototype = obj; - var l = 8; - while (l--) new f(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return obj instanceof Error && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } - } -} - -var ret = { - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - haveGetters: haveGetters, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - wrapsPrimitiveReceiver: wrapsPrimitiveReceiver, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - hasDevTools: typeof chrome !== "undefined" && chrome && - typeof chrome.loadTimes === "function", - isNode: typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]" -}; -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; - -},{"./es5.js":14}],39:[function(_dereq_,module,exports){ -// Copyright Joyent, Inc. and other Node contributors. -// -// 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. - -function EventEmitter() { - this._events = this._events || {}; - this._maxListeners = this._maxListeners || undefined; -} -module.exports = EventEmitter; - -// Backwards-compat with node 0.10.x -EventEmitter.EventEmitter = EventEmitter; - -EventEmitter.prototype._events = undefined; -EventEmitter.prototype._maxListeners = undefined; - -// By default EventEmitters will print a warning if more than 10 listeners are -// added to it. This is a useful default which helps finding memory leaks. -EventEmitter.defaultMaxListeners = 10; - -// Obviously not all Emitters should be limited to 10. This function allows -// that to be increased. Set to zero for unlimited. -EventEmitter.prototype.setMaxListeners = function(n) { - if (!isNumber(n) || n < 0 || isNaN(n)) - throw TypeError('n must be a positive number'); - this._maxListeners = n; - return this; -}; - -EventEmitter.prototype.emit = function(type) { - var er, handler, len, args, i, listeners; - - if (!this._events) - this._events = {}; - - // If there is no 'error' event listener then throw. - if (type === 'error') { - if (!this._events.error || - (isObject(this._events.error) && !this._events.error.length)) { - er = arguments[1]; - if (er instanceof Error) { - throw er; // Unhandled 'error' event - } - throw TypeError('Uncaught, unspecified "error" event.'); - } - } - - handler = this._events[type]; - - if (isUndefined(handler)) - return false; - - if (isFunction(handler)) { - switch (arguments.length) { - // fast cases - case 1: - handler.call(this); - break; - case 2: - handler.call(this, arguments[1]); - break; - case 3: - handler.call(this, arguments[1], arguments[2]); - break; - // slower - default: - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - handler.apply(this, args); - } - } else if (isObject(handler)) { - len = arguments.length; - args = new Array(len - 1); - for (i = 1; i < len; i++) - args[i - 1] = arguments[i]; - - listeners = handler.slice(); - len = listeners.length; - for (i = 0; i < len; i++) - listeners[i].apply(this, args); - } - - return true; -}; - -EventEmitter.prototype.addListener = function(type, listener) { - var m; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events) - this._events = {}; - - // To avoid recursion in the case that type === "newListener"! Before - // adding it to the listeners, first emit "newListener". - if (this._events.newListener) - this.emit('newListener', type, - isFunction(listener.listener) ? - listener.listener : listener); - - if (!this._events[type]) - // Optimize the case of one listener. Don't need the extra array object. - this._events[type] = listener; - else if (isObject(this._events[type])) - // If we've already got an array, just append. - this._events[type].push(listener); - else - // Adding the second element, need to change to array. - this._events[type] = [this._events[type], listener]; - - // Check for listener leak - if (isObject(this._events[type]) && !this._events[type].warned) { - var m; - if (!isUndefined(this._maxListeners)) { - m = this._maxListeners; - } else { - m = EventEmitter.defaultMaxListeners; - } - - if (m && m > 0 && this._events[type].length > m) { - this._events[type].warned = true; - console.error('(node) warning: possible EventEmitter memory ' + - 'leak detected. %d listeners added. ' + - 'Use emitter.setMaxListeners() to increase limit.', - this._events[type].length); - if (typeof console.trace === 'function') { - // not supported in IE 10 - console.trace(); - } - } - } - - return this; -}; - -EventEmitter.prototype.on = EventEmitter.prototype.addListener; - -EventEmitter.prototype.once = function(type, listener) { - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - var fired = false; - - function g() { - this.removeListener(type, g); - - if (!fired) { - fired = true; - listener.apply(this, arguments); - } - } - - g.listener = listener; - this.on(type, g); - - return this; -}; - -// emits a 'removeListener' event iff the listener was removed -EventEmitter.prototype.removeListener = function(type, listener) { - var list, position, length, i; - - if (!isFunction(listener)) - throw TypeError('listener must be a function'); - - if (!this._events || !this._events[type]) - return this; - - list = this._events[type]; - length = list.length; - position = -1; - - if (list === listener || - (isFunction(list.listener) && list.listener === listener)) { - delete this._events[type]; - if (this._events.removeListener) - this.emit('removeListener', type, listener); - - } else if (isObject(list)) { - for (i = length; i-- > 0;) { - if (list[i] === listener || - (list[i].listener && list[i].listener === listener)) { - position = i; - break; - } - } - - if (position < 0) - return this; - - if (list.length === 1) { - list.length = 0; - delete this._events[type]; - } else { - list.splice(position, 1); - } - - if (this._events.removeListener) - this.emit('removeListener', type, listener); - } - - return this; -}; - -EventEmitter.prototype.removeAllListeners = function(type) { - var key, listeners; - - if (!this._events) - return this; - - // not listening for removeListener, no need to emit - if (!this._events.removeListener) { - if (arguments.length === 0) - this._events = {}; - else if (this._events[type]) - delete this._events[type]; - return this; - } - - // emit removeListener for all listeners on all events - if (arguments.length === 0) { - for (key in this._events) { - if (key === 'removeListener') continue; - this.removeAllListeners(key); - } - this.removeAllListeners('removeListener'); - this._events = {}; - return this; - } - - listeners = this._events[type]; - - if (isFunction(listeners)) { - this.removeListener(type, listeners); - } else { - // LIFO order - while (listeners.length) - this.removeListener(type, listeners[listeners.length - 1]); - } - delete this._events[type]; - - return this; -}; - -EventEmitter.prototype.listeners = function(type) { - var ret; - if (!this._events || !this._events[type]) - ret = []; - else if (isFunction(this._events[type])) - ret = [this._events[type]]; - else - ret = this._events[type].slice(); - return ret; -}; - -EventEmitter.listenerCount = function(emitter, type) { - var ret; - if (!emitter._events || !emitter._events[type]) - ret = 0; - else if (isFunction(emitter._events[type])) - ret = 1; - else - ret = emitter._events[type].length; - return ret; -}; - -function isFunction(arg) { - return typeof arg === 'function'; -} - -function isNumber(arg) { - return typeof arg === 'number'; -} - -function isObject(arg) { - return typeof arg === 'object' && arg !== null; -} - -function isUndefined(arg) { - return arg === void 0; -} - -},{}]},{},[4])(4) -}); ;if (typeof window !== 'undefined' && window !== null) { window.P = window.Promise; } else if (typeof self !== 'undefined' && self !== null) { self.P = self.Promise; } \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js deleted file mode 100644 index 679f7780..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/browser/bluebird.min.js +++ /dev/null @@ -1,31 +0,0 @@ -/* @preserve - * The MIT License (MIT) - * - * Copyright (c) 2014 Petka Antonov - * - * 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. - * - */ -/** - * bluebird build version 2.9.26 - * Features enabled: core, race, call_get, generators, map, nodeify, promisify, props, reduce, settle, some, cancel, using, filter, any, each, timers -*/ -!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Promise=t()}}(function(){var t,e,r;return function n(t,e,r){function i(s,a){if(!e[s]){if(!t[s]){var u="function"==typeof _dereq_&&_dereq_;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=e[s]={exports:{}};t[s][0].call(l.exports,function(e){var r=t[s][1][e];return i(r?r:e)},l,l.exports,n,t,e,r)}return e[s].exports}for(var o="function"==typeof _dereq_&&_dereq_,s=0;s0},r.prototype.throwLater=function(t,e){1===arguments.length&&(e=t,t=function(){throw e});var r=this._getDomain();if(void 0!==r&&(t=r.bind(t)),"undefined"!=typeof setTimeout)setTimeout(function(){t(e)},0);else try{this._schedule(function(){t(e)})}catch(n){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")}},r.prototype._getDomain=function(){};l.hasDevTools?(r.prototype.invokeLater=function(t,e,r){this._trampolineEnabled?n.call(this,t,e,r):setTimeout(function(){t.call(e,r)},100)},r.prototype.invoke=function(t,e,r){this._trampolineEnabled?i.call(this,t,e,r):setTimeout(function(){t.call(e,r)},0)},r.prototype.settlePromises=function(t){this._trampolineEnabled?o.call(this,t):setTimeout(function(){t._settlePromises()},0)}):(r.prototype.invokeLater=n,r.prototype.invoke=i,r.prototype.settlePromises=o),r.prototype.invokeFirst=function(t,e,r){var n=this._getDomain();void 0!==n&&(t=n.bind(t)),this._normalQueue.unshift(t,e,r),this._queueTick()},r.prototype._drainQueue=function(t){for(;t.length()>0;){var e=t.shift();if("function"==typeof e){var r=t.shift(),n=t.shift();e.call(r,n)}else e._settlePromises()}},r.prototype._drainQueues=function(){this._drainQueue(this._normalQueue),this._reset(),this._drainQueue(this._lateQueue)},r.prototype._queueTick=function(){this._isTickUsed||(this._isTickUsed=!0,this._schedule(this.drainQueues))},r.prototype._reset=function(){this._isTickUsed=!1},e.exports=new r,e.exports.firstLineError=s},{"./queue.js":28,"./schedule.js":31,"./util.js":38,events:39}],3:[function(t,e){"use strict";e.exports=function(t,e,r){var n=function(t,e){this._reject(e)},i=function(t,e){e.promiseRejectionQueued=!0,e.bindingPromise._then(n,n,null,this,t)},o=function(t,e){this._setBoundTo(t),this._isPending()&&this._resolveCallback(e.target)},s=function(t,e){e.promiseRejectionQueued||this._reject(t)};t.prototype.bind=function(n){var a=r(n),u=new t(e);u._propagateFrom(this,1);var c=this._target();if(a instanceof t){var l={promiseRejectionQueued:!1,promise:u,target:c,bindingPromise:a};c._then(e,i,u._progress,u,l),a._then(o,s,u._progress,u,l)}else u._setBoundTo(n),u._resolveCallback(c);return u},t.prototype._setBoundTo=function(t){void 0!==t?(this._bitField=131072|this._bitField,this._boundTo=t):this._bitField=-131073&this._bitField},t.prototype._isBound=function(){return 131072===(131072&this._bitField)},t.bind=function(n,i){var o=r(n),s=new t(e);return o instanceof t?o._then(function(t){s._setBoundTo(t),s._resolveCallback(i)},s._reject,s._progress,s,null):(s._setBoundTo(n),s._resolveCallback(i)),s}}},{}],4:[function(t,e){"use strict";function r(){try{Promise===i&&(Promise=n)}catch(t){}return i}var n;"undefined"!=typeof Promise&&(n=Promise);var i=t("./promise.js")();i.noConflict=r,e.exports=i},{"./promise.js":23}],5:[function(t,e){"use strict";var r=Object.create;if(r){var n=r(null),i=r(null);n[" size"]=i[" size"]=0}e.exports=function(e){function r(t,r){var n;if(null!=t&&(n=t[r]),"function"!=typeof n){var i="Object "+a.classString(t)+" has no method '"+a.toString(r)+"'";throw new e.TypeError(i)}return n}function n(t){var e=this.pop(),n=r(t,e);return n.apply(t,this)}function i(t){return t[this]}function o(t){var e=+this;return 0>e&&(e=Math.max(0,e+t.length)),t[e]}{var s,a=t("./util.js"),u=a.canEvaluate;a.isIdentifier}e.prototype.call=function(t){for(var e=arguments.length,r=new Array(e-1),i=1;e>i;++i)r[i-1]=arguments[i];return r.push(t),this._then(n,void 0,void 0,r,void 0)},e.prototype.get=function(t){var e,r="number"==typeof t;if(r)e=o;else if(u){var n=s(t);e=null!==n?n:i}else e=i;return this._then(e,void 0,void 0,t,void 0)}}},{"./util.js":38}],6:[function(t,e){"use strict";e.exports=function(e){var r=t("./errors.js"),n=t("./async.js"),i=r.CancellationError;e.prototype._cancel=function(t){if(!this.isCancellable())return this;for(var e,r=this;void 0!==(e=r._cancellationParent)&&e.isCancellable();)r=e;this._unsetCancellable(),r._target()._rejectCallback(t,!1,!0)},e.prototype.cancel=function(t){return this.isCancellable()?(void 0===t&&(t=new i),n.invokeLater(this._cancel,this,t),this):this},e.prototype.cancellable=function(){return this._cancellable()?this:(n.enableTrampoline(),this._setCancellable(),this._cancellationParent=void 0,this)},e.prototype.uncancellable=function(){var t=this.then();return t._unsetCancellable(),t},e.prototype.fork=function(t,e,r){var n=this._then(t,e,r,void 0,void 0);return n._setCancellable(),n._cancellationParent=void 0,n}}},{"./async.js":2,"./errors.js":13}],7:[function(t,e){"use strict";e.exports=function(){function e(t){this._parent=t;var r=this._length=1+(void 0===t?0:t._length);j(this,e),r>32&&this.uncycle()}function r(t,e){for(var r=0;r=0;--a)if(n[a]===o){s=a;break}for(var a=s;a>=0;--a){var u=n[a];if(e[i]!==u)break;e.pop(),i--}e=n}}function o(t){for(var e=[],r=0;r0&&(e=e.slice(r)),e}function a(t){var e;if("function"==typeof t)e="[function "+(t.name||"anonymous")+"]";else{e=t.toString();var r=/\[object [a-zA-Z0-9$_]+\]/;if(r.test(e))try{var n=JSON.stringify(t);e=n}catch(i){}0===e.length&&(e="(empty array)")}return"(<"+u(e)+">, no stack trace)"}function u(t){var e=41;return t.lengtht)){for(var e=[],r={},n=0,i=this;void 0!==i;++n)e.push(i),i=i._parent;t=this._length=n;for(var n=t-1;n>=0;--n){var o=e[n].stack;void 0===r[o]&&(r[o]=n)}for(var n=0;t>n;++n){var s=e[n].stack,a=r[s];if(void 0!==a&&a!==n){a>0&&(e[a-1]._parent=void 0,e[a-1]._length=1),e[n]._parent=void 0,e[n]._length=1;var u=n>0?e[n-1]:this;t-1>a?(u._parent=e[a+1],u._parent.uncycle(),u._length=u._parent._length+1):(u._parent=void 0,u._length=1);for(var c=u._length+1,l=n-2;l>=0;--l)e[l]._length=c,c++;return}}}},e.prototype.parent=function(){return this._parent},e.prototype.hasParent=function(){return void 0!==this._parent},e.prototype.attachExtraTrace=function(t){if(!t.__stackCleaned__){this.uncycle();for(var s=e.parseStackAndMessage(t),a=s.message,u=[s.stack],c=this;void 0!==c;)u.push(o(c.stack.split("\n"))),c=c._parent;i(u),n(u),p.notEnumerableProp(t,"stack",r(a,u)),p.notEnumerableProp(t,"__stackCleaned__",!0)}},e.parseStackAndMessage=function(t){var e=t.stack,r=t.toString();return e="string"==typeof e&&e.length>0?s(t):[" (No stack trace)"],{message:r,stack:o(e)}},e.formatAndLogError=function(t,e){if("undefined"!=typeof console){var r;if("object"==typeof t||"function"==typeof t){var n=t.stack;r=e+d(n,t)}else r=e+String(t);"function"==typeof l?l(r):("function"==typeof console.log||"object"==typeof console.log)&&console.log(r)}},e.unhandledRejection=function(t){e.formatAndLogError(t,"^--- With additional stack trace: ")},e.isSupported=function(){return"function"==typeof j},e.fireRejectionEvent=function(t,r,n,i){var o=!1;try{"function"==typeof r&&(o=!0,"rejectionHandled"===t?r(i):r(n,i))}catch(s){h.throwLater(s)}var a=!1;try{a=b(t,n,i)}catch(s){a=!0,h.throwLater(s)}var u=!1;if(m)try{u=m(t.toLowerCase(),{reason:n,promise:i})}catch(s){u=!0,h.throwLater(s)}a||o||u||"unhandledRejection"!==t||e.formatAndLogError(n,"Unhandled rejection ")};var y=function(){return!1},g=/[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/;e.setBounds=function(t,r){if(e.isSupported()){for(var n,i,o=t.stack.split("\n"),s=r.stack.split("\n"),a=-1,u=-1,l=0;la||0>u||!n||!i||n!==i||a>=u||(y=function(t){if(f.test(t))return!0;var e=c(t);return e&&e.fileName===n&&a<=e.line&&e.line<=u?!0:!1})}};var m,j=function(){var t=/^\s*at\s*/,e=function(t,e){return"string"==typeof t?t:void 0!==e.name&&void 0!==e.message?e.toString():a(e)};if("number"==typeof Error.stackTraceLimit&&"function"==typeof Error.captureStackTrace){Error.stackTraceLimit=Error.stackTraceLimit+6,_=t,d=e;var r=Error.captureStackTrace;return y=function(t){return f.test(t)},function(t,e){Error.stackTraceLimit=Error.stackTraceLimit+6,r(t,e),Error.stackTraceLimit=Error.stackTraceLimit-6}}var n=new Error;if("string"==typeof n.stack&&n.stack.split("\n")[0].indexOf("stackDetection@")>=0)return _=/@/,d=e,v=!0,function(t){t.stack=(new Error).stack};var i;try{throw new Error}catch(o){i="stack"in o}return"stack"in n||!i?(d=function(t,e){return"string"==typeof t?t:"object"!=typeof e&&"function"!=typeof e||void 0===e.name||void 0===e.message?a(e):e.toString()},null):(_=t,d=e,function(t){Error.stackTraceLimit=Error.stackTraceLimit+6;try{throw new Error}catch(e){t.stack=e.stack}Error.stackTraceLimit=Error.stackTraceLimit-6})}([]),b=function(){if(p.isNode)return function(t,e,r){return"rejectionHandled"===t?process.emit(t,r):process.emit(t,e,r)};var t=!1,e=!0;try{var r=new self.CustomEvent("test");t=r instanceof CustomEvent}catch(n){}if(!t)try{var i=document.createEvent("CustomEvent");i.initCustomEvent("testingtheevent",!1,!0,{}),self.dispatchEvent(i)}catch(n){e=!1}e&&(m=function(e,r){var n;return t?n=new self.CustomEvent(e,{detail:r,bubbles:!1,cancelable:!0}):self.dispatchEvent&&(n=document.createEvent("CustomEvent"),n.initCustomEvent(e,!1,!0,r)),n?!self.dispatchEvent(n):!1});var o={};return o.unhandledRejection="onunhandledRejection".toLowerCase(),o.rejectionHandled="onrejectionHandled".toLowerCase(),function(t,e,r){var n=o[t],i=self[n];return i?("rejectionHandled"===t?i.call(self,r):i.call(self,e,r),!0):!1}}();return"undefined"!=typeof console&&"undefined"!=typeof console.warn&&(l=function(t){console.warn(t)},p.isNode&&process.stderr.isTTY?l=function(t){process.stderr.write(""+t+"\n")}:p.isNode||"string"!=typeof(new Error).stack||(l=function(t){console.warn("%c"+t,"color: red")})),e}},{"./async.js":2,"./util.js":38}],8:[function(t,e){"use strict";e.exports=function(e){function r(t,e,r){this._instances=t,this._callback=e,this._promise=r}function n(t,e){var r={},n=s(t).call(r,e);if(n===a)return n;var i=u(r);return i.length?(a.e=new c("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"),a):n}var i=t("./util.js"),o=t("./errors.js"),s=i.tryCatch,a=i.errorObj,u=t("./es5.js").keys,c=o.TypeError;return r.prototype.doFilter=function(t){for(var r=this._callback,i=this._promise,o=i._boundTo,u=0,c=this._instances.length;c>u;++u){var l=this._instances[u],h=l===Error||null!=l&&l.prototype instanceof Error;if(h&&t instanceof l){var p=s(r).call(o,t);return p===a?(e.e=p.e,e):p}if("function"==typeof l&&!h){var f=n(l,t);if(f===a){t=a.e;break}if(f){var p=s(r).call(o,t);return p===a?(e.e=p.e,e):p}}}return e.e=t,e},r}},{"./errors.js":13,"./es5.js":14,"./util.js":38}],9:[function(t,e){"use strict";e.exports=function(t,e,r){function n(){this._trace=new e(o())}function i(){return r()?new n:void 0}function o(){var t=s.length-1;return t>=0?s[t]:void 0}var s=[];return n.prototype._pushContext=function(){r()&&void 0!==this._trace&&s.push(this._trace)},n.prototype._popContext=function(){r()&&void 0!==this._trace&&s.pop()},t.prototype._peekContext=o,t.prototype._pushContext=n.prototype._pushContext,t.prototype._popContext=n.prototype._popContext,i}},{}],10:[function(t,e){"use strict";e.exports=function(e,r){var n,i,o=t("./async.js"),s=t("./errors.js").Warning,a=t("./util.js"),u=a.canAttachTrace,c=!1||a.isNode&&(!!process.env.BLUEBIRD_DEBUG||"development"===process.env.NODE_ENV);return c&&o.disableTrampolineIfNecessary(),e.prototype._ensurePossibleRejectionHandled=function(){this._setRejectionIsUnhandled(),o.invokeLater(this._notifyUnhandledRejection,this,void 0)},e.prototype._notifyUnhandledRejectionIsHandled=function(){r.fireRejectionEvent("rejectionHandled",n,void 0,this)},e.prototype._notifyUnhandledRejection=function(){if(this._isRejectionUnhandled()){var t=this._getCarriedStackTrace()||this._settledValue;this._setUnhandledRejectionIsNotified(),r.fireRejectionEvent("unhandledRejection",i,t,this)}},e.prototype._setUnhandledRejectionIsNotified=function(){this._bitField=524288|this._bitField},e.prototype._unsetUnhandledRejectionIsNotified=function(){this._bitField=-524289&this._bitField},e.prototype._isUnhandledRejectionNotified=function(){return(524288&this._bitField)>0},e.prototype._setRejectionIsUnhandled=function(){this._bitField=2097152|this._bitField},e.prototype._unsetRejectionIsUnhandled=function(){this._bitField=-2097153&this._bitField,this._isUnhandledRejectionNotified()&&(this._unsetUnhandledRejectionIsNotified(),this._notifyUnhandledRejectionIsHandled())},e.prototype._isRejectionUnhandled=function(){return(2097152&this._bitField)>0},e.prototype._setCarriedStackTrace=function(t){this._bitField=1048576|this._bitField,this._fulfillmentHandler0=t},e.prototype._isCarryingStackTrace=function(){return(1048576&this._bitField)>0},e.prototype._getCarriedStackTrace=function(){return this._isCarryingStackTrace()?this._fulfillmentHandler0:void 0},e.prototype._captureStackTrace=function(){return c&&(this._trace=new r(this._peekContext())),this},e.prototype._attachExtraTrace=function(t,e){if(c&&u(t)){var n=this._trace;if(void 0!==n&&e&&(n=n._parent),void 0!==n)n.attachExtraTrace(t);else if(!t.__stackCleaned__){var i=r.parseStackAndMessage(t);a.notEnumerableProp(t,"stack",i.message+"\n"+i.stack.join("\n")),a.notEnumerableProp(t,"__stackCleaned__",!0)}}},e.prototype._warn=function(t){var e=new s(t),n=this._peekContext();if(n)n.attachExtraTrace(e);else{var i=r.parseStackAndMessage(e);e.stack=i.message+"\n"+i.stack.join("\n")}r.formatAndLogError(e,"")},e.onPossiblyUnhandledRejection=function(t){i="function"==typeof t?t:void 0},e.onUnhandledRejectionHandled=function(t){n="function"==typeof t?t:void 0},e.longStackTraces=function(){if(o.haveItemsQueued()&&c===!1)throw new Error("cannot enable long stack traces after promises have been created\n\n See http://goo.gl/DT1qyG\n");c=r.isSupported(),c&&o.disableTrampolineIfNecessary()},e.hasLongStackTraces=function(){return c&&r.isSupported()},r.isSupported()||(e.longStackTraces=function(){},c=!1),function(){return c}}},{"./async.js":2,"./errors.js":13,"./util.js":38}],11:[function(t,e){"use strict";var r=t("./util.js"),n=r.isPrimitive,i=r.wrapsPrimitiveReceiver;e.exports=function(t){var e=function(){return this},r=function(){throw this},o=function(){},s=function(){throw void 0},a=function(t,e){return 1===e?function(){throw t}:2===e?function(){return t}:void 0};t.prototype["return"]=t.prototype.thenReturn=function(t){return void 0===t?this.then(o):i&&n(t)?this._then(a(t,2),void 0,void 0,void 0,void 0):this._then(e,void 0,void 0,t,void 0)},t.prototype["throw"]=t.prototype.thenThrow=function(t){return void 0===t?this.then(s):i&&n(t)?this._then(a(t,1),void 0,void 0,void 0,void 0):this._then(r,void 0,void 0,t,void 0)}}},{"./util.js":38}],12:[function(t,e){"use strict";e.exports=function(t,e){var r=t.reduce;t.prototype.each=function(t){return r(this,t,null,e)},t.each=function(t,n){return r(t,n,null,e)}}},{}],13:[function(t,e){"use strict";function r(t,e){function r(n){return this instanceof r?(l(this,"message","string"==typeof n?n:e),l(this,"name",t),void(Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):Error.call(this))):new r(n)}return c(r,Error),r}function n(t){return this instanceof n?(l(this,"name","OperationalError"),l(this,"message",t),this.cause=t,this.isOperational=!0,void(t instanceof Error?(l(this,"message",t.message),l(this,"stack",t.stack)):Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor))):new n(t)}var i,o,s=t("./es5.js"),a=s.freeze,u=t("./util.js"),c=u.inherits,l=u.notEnumerableProp,h=r("Warning","warning"),p=r("CancellationError","cancellation error"),f=r("TimeoutError","timeout error"),_=r("AggregateError","aggregate error");try{i=TypeError,o=RangeError}catch(d){i=r("TypeError","type error"),o=r("RangeError","range error")}for(var v="join pop push shift unshift slice filter forEach some every map indexOf lastIndexOf reduce reduceRight sort reverse".split(" "),y=0;y0&&"function"==typeof arguments[e]){t=arguments[e];var n}for(var i=arguments.length,o=new Array(i),s=0;i>s;++s)o[s]=arguments[s];t&&o.pop();var n=new r(o).promise();return void 0!==t?n.spread(t):n}}},{"./util.js":38}],19:[function(t,e){"use strict";e.exports=function(e,r,n,i,o){function s(t,e,r,n){this.constructor$(t),this._promise._captureStackTrace(),this._callback=e,this._preservedValues=n===o?new Array(this.length()):null,this._limit=r,this._inFlight=0,this._queue=r>=1?[]:_,c.invoke(a,this,void 0)}function a(){this._init$(void 0,-2)}function u(t,e,r,n){var i="object"==typeof r&&null!==r?r.concurrency:0;return i="number"==typeof i&&isFinite(i)&&i>=1?i:0,new s(t,e,i,n)}var c=t("./async.js"),l=t("./util.js"),h=l.tryCatch,p=l.errorObj,f={},_=[];l.inherits(s,r),s.prototype._init=function(){},s.prototype._promiseFulfilled=function(t,r){var n=this._values,o=this.length(),s=this._preservedValues,a=this._limit;if(n[r]===f){if(n[r]=t,a>=1&&(this._inFlight--,this._drainQueue(),this._isResolved()))return}else{if(a>=1&&this._inFlight>=a)return n[r]=t,void this._queue.push(r);null!==s&&(s[r]=t);var u=this._callback,c=this._promise._boundTo;this._promise._pushContext();var l=h(u).call(c,t,r,o);if(this._promise._popContext(),l===p)return this._reject(l.e);var _=i(l,this._promise);if(_ instanceof e){if(_=_._target(),_._isPending())return a>=1&&this._inFlight++,n[r]=f,_._proxyPromiseArray(this,r);if(!_._isFulfilled())return this._reject(_._reason());l=_._value()}n[r]=l}var d=++this._totalResolved;d>=o&&(null!==s?this._filter(n,s):this._resolve(n))},s.prototype._drainQueue=function(){for(var t=this._queue,e=this._limit,r=this._values;t.length>0&&this._inFlighto;++o)t[o]&&(n[i++]=e[o]);n.length=i,this._resolve(n)},s.prototype.preservedValues=function(){return this._preservedValues},e.prototype.map=function(t,e){return"function"!=typeof t?n("fn must be a function\n\n See http://goo.gl/916lJJ\n"):u(this,t,e,null).promise()},e.map=function(t,e,r,i){return"function"!=typeof e?n("fn must be a function\n\n See http://goo.gl/916lJJ\n"):u(t,e,r,i).promise()}}},{"./async.js":2,"./util.js":38}],20:[function(t,e){"use strict";e.exports=function(e,r,n,i){var o=t("./util.js"),s=o.tryCatch;e.method=function(t){if("function"!=typeof t)throw new e.TypeError("fn must be a function\n\n See http://goo.gl/916lJJ\n");return function(){var n=new e(r);n._captureStackTrace(),n._pushContext();var i=s(t).apply(this,arguments);return n._popContext(),n._resolveFromSyncValue(i),n}},e.attempt=e["try"]=function(t,n,a){if("function"!=typeof t)return i("fn must be a function\n\n See http://goo.gl/916lJJ\n");var u=new e(r);u._captureStackTrace(),u._pushContext();var c=o.isArray(n)?s(t).apply(a,n):s(t).call(a,n);return u._popContext(),u._resolveFromSyncValue(c),u},e.prototype._resolveFromSyncValue=function(t){t===o.errorObj?this._rejectCallback(t.e,!1,!0):this._resolveCallback(t,!0)}}},{"./util.js":38}],21:[function(t,e){"use strict";e.exports=function(e){function r(t,e){var r=this;if(!o.isArray(t))return n.call(r,t,e);var i=a(e).apply(r._boundTo,[null].concat(t));i===u&&s.throwLater(i.e)}function n(t,e){var r=this,n=r._boundTo,i=void 0===t?a(e).call(n,null):a(e).call(n,null,t);i===u&&s.throwLater(i.e)}function i(t,e){var r=this;if(!t){var n=r._target(),i=n._getCarriedStackTrace();i.cause=t,t=i}var o=a(e).call(r._boundTo,t);o===u&&s.throwLater(o.e)}var o=t("./util.js"),s=t("./async.js"),a=o.tryCatch,u=o.errorObj;e.prototype.asCallback=e.prototype.nodeify=function(t,e){if("function"==typeof t){var o=n;void 0!==e&&Object(e).spread&&(o=r),this._then(o,i,void 0,this,t)}return this}}},{"./async.js":2,"./util.js":38}],22:[function(t,e){"use strict";e.exports=function(e,r){var n=t("./util.js"),i=t("./async.js"),o=n.tryCatch,s=n.errorObj;e.prototype.progressed=function(t){return this._then(void 0,void 0,t,void 0,void 0)},e.prototype._progress=function(t){this._isFollowingOrFulfilledOrRejected()||this._target()._progressUnchecked(t)},e.prototype._progressHandlerAt=function(t){return 0===t?this._progressHandler0:this[(t<<2)+t-5+2]},e.prototype._doProgressWith=function(t){var r=t.value,i=t.handler,a=t.promise,u=t.receiver,c=o(i).call(u,r);if(c===s){if(null!=c.e&&"StopProgressPropagation"!==c.e.name){var l=n.canAttachTrace(c.e)?c.e:new Error(n.toString(c.e));a._attachExtraTrace(l),a._progress(c.e)}}else c instanceof e?c._then(a._progress,null,null,a,void 0):a._progress(c)},e.prototype._progressUnchecked=function(t){for(var n=this._length(),o=this._progress,s=0;n>s;s++){var a=this._progressHandlerAt(s),u=this._promiseAt(s);if(u instanceof e)"function"==typeof a?i.invoke(this._doProgressWith,this,{handler:a,promise:u,receiver:this._receiverAt(s),value:t}):i.invoke(o,u,t);else{var c=this._receiverAt(s);"function"==typeof a?a.call(c,t,u):c instanceof r&&!c._isResolved()&&c._promiseProgressed(t,u)}}}}},{"./async.js":2,"./util.js":38}],23:[function(t,e){"use strict";e.exports=function(){function e(t){if("function"!=typeof t)throw new c("the promise constructor requires a resolver function\n\n See http://goo.gl/EC22Yn\n");if(this.constructor!==e)throw new c("the promise constructor cannot be invoked directly\n\n See http://goo.gl/KsIlge\n");this._bitField=0,this._fulfillmentHandler0=void 0,this._rejectionHandler0=void 0,this._progressHandler0=void 0,this._promise0=void 0,this._receiver0=void 0,this._settledValue=void 0,t!==l&&this._resolveFromResolver(t)}function r(t){var r=new e(l);r._fulfillmentHandler0=t,r._rejectionHandler0=t,r._progressHandler0=t,r._promise0=t,r._receiver0=t,r._settledValue=t}var n=function(){return new c("circular promise resolution chain\n\n See http://goo.gl/LhFpo0\n")},i=function(){return new e.PromiseInspection(this._target())},o=function(t){return e.reject(new c(t))},s=t("./util.js"),a=t("./async.js"),u=t("./errors.js"),c=e.TypeError=u.TypeError;e.RangeError=u.RangeError,e.CancellationError=u.CancellationError,e.TimeoutError=u.TimeoutError,e.OperationalError=u.OperationalError,e.RejectionError=u.OperationalError,e.AggregateError=u.AggregateError;var l=function(){},h={},p={e:null},f=t("./thenables.js")(e,l),_=t("./promise_array.js")(e,l,f,o),d=t("./captured_trace.js")(),v=t("./debuggability.js")(e,d),y=t("./context.js")(e,d,v),g=t("./catch_filter.js")(p),m=t("./promise_resolver.js"),j=m._nodebackForPromise,b=s.errorObj,w=s.tryCatch;return e.prototype.toString=function(){return"[object Promise]"},e.prototype.caught=e.prototype["catch"]=function(t){var r=arguments.length;if(r>1){var n,i=new Array(r-1),o=0;for(n=0;r-1>n;++n){var s=arguments[n];if("function"!=typeof s)return e.reject(new c("Catch filter must inherit from Error or be a simple predicate function\n\n See http://goo.gl/o84o68\n"));i[o++]=s}i.length=o,t=arguments[n];var a=new g(i,t,this);return this._then(void 0,a.doFilter,void 0,a,void 0)}return this._then(void 0,t,void 0,void 0,void 0)},e.prototype.reflect=function(){return this._then(i,i,void 0,this,void 0)},e.prototype.then=function(t,e,r){if(v()&&arguments.length>0&&"function"!=typeof t&&"function"!=typeof e){var n=".then() only accepts functions but was passed: "+s.classString(t);arguments.length>1&&(n+=", "+s.classString(e)),this._warn(n)}return this._then(t,e,r,void 0,void 0)},e.prototype.done=function(t,e,r){var n=this._then(t,e,r,void 0,void 0);n._setIsFinal()},e.prototype.spread=function(t,e){return this.all()._then(t,e,void 0,h,void 0)},e.prototype.isCancellable=function(){return!this.isResolved()&&this._cancellable() -},e.prototype.toJSON=function(){var t={isFulfilled:!1,isRejected:!1,fulfillmentValue:void 0,rejectionReason:void 0};return this.isFulfilled()?(t.fulfillmentValue=this.value(),t.isFulfilled=!0):this.isRejected()&&(t.rejectionReason=this.reason(),t.isRejected=!0),t},e.prototype.all=function(){return new _(this).promise()},e.prototype.error=function(t){return this.caught(s.originatesFromRejection,t)},e.is=function(t){return t instanceof e},e.fromNode=function(t){var r=new e(l),n=w(t)(j(r));return n===b&&r._rejectCallback(n.e,!0,!0),r},e.all=function(t){return new _(t).promise()},e.defer=e.pending=function(){var t=new e(l);return new m(t)},e.cast=function(t){var r=f(t);if(!(r instanceof e)){var n=r;r=new e(l),r._fulfillUnchecked(n)}return r},e.resolve=e.fulfilled=e.cast,e.reject=e.rejected=function(t){var r=new e(l);return r._captureStackTrace(),r._rejectCallback(t,!0),r},e.setScheduler=function(t){if("function"!=typeof t)throw new c("fn must be a function\n\n See http://goo.gl/916lJJ\n");var e=a._schedule;return a._schedule=t,e},e.prototype._then=function(t,r,n,i,o){var s=void 0!==o,u=s?o:new e(l);s||(u._propagateFrom(this,5),u._captureStackTrace());var c=this._target();c!==this&&(void 0===i&&(i=this._boundTo),s||u._setIsMigrated());var h=c._addCallbacks(t,r,n,u,i);return c._isResolved()&&!c._isSettlePromisesQueued()&&a.invoke(c._settlePromiseAtPostResolution,c,h),u},e.prototype._settlePromiseAtPostResolution=function(t){this._isRejectionUnhandled()&&this._unsetRejectionIsUnhandled(),this._settlePromiseAt(t)},e.prototype._length=function(){return 131071&this._bitField},e.prototype._isFollowingOrFulfilledOrRejected=function(){return(939524096&this._bitField)>0},e.prototype._isFollowing=function(){return 536870912===(536870912&this._bitField)},e.prototype._setLength=function(t){this._bitField=-131072&this._bitField|131071&t},e.prototype._setFulfilled=function(){this._bitField=268435456|this._bitField},e.prototype._setRejected=function(){this._bitField=134217728|this._bitField},e.prototype._setFollowing=function(){this._bitField=536870912|this._bitField},e.prototype._setIsFinal=function(){this._bitField=33554432|this._bitField},e.prototype._isFinal=function(){return(33554432&this._bitField)>0},e.prototype._cancellable=function(){return(67108864&this._bitField)>0},e.prototype._setCancellable=function(){this._bitField=67108864|this._bitField},e.prototype._unsetCancellable=function(){this._bitField=-67108865&this._bitField},e.prototype._setIsMigrated=function(){this._bitField=4194304|this._bitField},e.prototype._unsetIsMigrated=function(){this._bitField=-4194305&this._bitField},e.prototype._isMigrated=function(){return(4194304&this._bitField)>0},e.prototype._receiverAt=function(t){var e=0===t?this._receiver0:this[5*t-5+4];return void 0===e&&this._isBound()?this._boundTo:e},e.prototype._promiseAt=function(t){return 0===t?this._promise0:this[5*t-5+3]},e.prototype._fulfillmentHandlerAt=function(t){return 0===t?this._fulfillmentHandler0:this[5*t-5+0]},e.prototype._rejectionHandlerAt=function(t){return 0===t?this._rejectionHandler0:this[5*t-5+1]},e.prototype._migrateCallbacks=function(t,r){var n=t._fulfillmentHandlerAt(r),i=t._rejectionHandlerAt(r),o=t._progressHandlerAt(r),s=t._promiseAt(r),a=t._receiverAt(r);s instanceof e&&s._setIsMigrated(),this._addCallbacks(n,i,o,s,a)},e.prototype._addCallbacks=function(t,e,r,n,i){var o=this._length();if(o>=131066&&(o=0,this._setLength(0)),0===o)this._promise0=n,void 0!==i&&(this._receiver0=i),"function"!=typeof t||this._isCarryingStackTrace()||(this._fulfillmentHandler0=t),"function"==typeof e&&(this._rejectionHandler0=e),"function"==typeof r&&(this._progressHandler0=r);else{var s=5*o-5;this[s+3]=n,this[s+4]=i,"function"==typeof t&&(this[s+0]=t),"function"==typeof e&&(this[s+1]=e),"function"==typeof r&&(this[s+2]=r)}return this._setLength(o+1),o},e.prototype._setProxyHandlers=function(t,e){var r=this._length();if(r>=131066&&(r=0,this._setLength(0)),0===r)this._promise0=e,this._receiver0=t;else{var n=5*r-5;this[n+3]=e,this[n+4]=t}this._setLength(r+1)},e.prototype._proxyPromiseArray=function(t,e){this._setProxyHandlers(t,e)},e.prototype._resolveCallback=function(t,r){if(!this._isFollowingOrFulfilledOrRejected()){if(t===this)return this._rejectCallback(n(),!1,!0);var i=f(t,this);if(!(i instanceof e))return this._fulfill(t);var o=1|(r?4:0);this._propagateFrom(i,o);var s=i._target();if(s._isPending()){for(var a=this._length(),u=0;a>u;++u)s._migrateCallbacks(this,u);this._setFollowing(),this._setLength(0),this._setFollowee(s)}else s._isFulfilled()?this._fulfillUnchecked(s._value()):this._rejectUnchecked(s._reason(),s._getCarriedStackTrace())}},e.prototype._rejectCallback=function(t,e,r){r||s.markAsOriginatingFromRejection(t);var n=s.ensureErrorObject(t),i=n===t;this._attachExtraTrace(n,e?i:!1),this._reject(t,i?void 0:n)},e.prototype._resolveFromResolver=function(t){var e=this;this._captureStackTrace(),this._pushContext();var r=!0,n=w(t)(function(t){null!==e&&(e._resolveCallback(t),e=null)},function(t){null!==e&&(e._rejectCallback(t,r),e=null)});r=!1,this._popContext(),void 0!==n&&n===b&&null!==e&&(e._rejectCallback(n.e,!0,!0),e=null)},e.prototype._settlePromiseFromHandler=function(t,e,r,i){if(!i._isRejected()){i._pushContext();var o;if(o=e!==h||this._isRejected()?w(t).call(e,r):w(t).apply(this._boundTo,r),i._popContext(),o===b||o===i||o===p){var s=o===i?n():o.e;i._rejectCallback(s,!1,!0)}else i._resolveCallback(o)}},e.prototype._target=function(){for(var t=this;t._isFollowing();)t=t._followee();return t},e.prototype._followee=function(){return this._rejectionHandler0},e.prototype._setFollowee=function(t){this._rejectionHandler0=t},e.prototype._cleanValues=function(){this._cancellable()&&(this._cancellationParent=void 0)},e.prototype._propagateFrom=function(t,e){(1&e)>0&&t._cancellable()&&(this._setCancellable(),this._cancellationParent=t),(4&e)>0&&t._isBound()&&this._setBoundTo(t._boundTo)},e.prototype._fulfill=function(t){this._isFollowingOrFulfilledOrRejected()||this._fulfillUnchecked(t)},e.prototype._reject=function(t,e){this._isFollowingOrFulfilledOrRejected()||this._rejectUnchecked(t,e)},e.prototype._settlePromiseAt=function(t){var r=this._promiseAt(t),n=r instanceof e;if(n&&r._isMigrated())return r._unsetIsMigrated(),a.invoke(this._settlePromiseAt,this,t);var i=this._isFulfilled()?this._fulfillmentHandlerAt(t):this._rejectionHandlerAt(t),o=this._isCarryingStackTrace()?this._getCarriedStackTrace():void 0,s=this._settledValue,u=this._receiverAt(t);this._clearCallbackDataAtIndex(t),"function"==typeof i?n?this._settlePromiseFromHandler(i,u,s,r):i.call(u,s,r):u instanceof _?u._isResolved()||(this._isFulfilled()?u._promiseFulfilled(s,r):u._promiseRejected(s,r)):n&&(this._isFulfilled()?r._fulfill(s):r._reject(s,o)),t>=4&&4===(31&t)&&a.invokeLater(this._setLength,this,0)},e.prototype._clearCallbackDataAtIndex=function(t){if(0===t)this._isCarryingStackTrace()||(this._fulfillmentHandler0=void 0),this._rejectionHandler0=this._progressHandler0=this._receiver0=this._promise0=void 0;else{var e=5*t-5;this[e+3]=this[e+4]=this[e+0]=this[e+1]=this[e+2]=void 0}},e.prototype._isSettlePromisesQueued=function(){return-1073741824===(-1073741824&this._bitField)},e.prototype._setSettlePromisesQueued=function(){this._bitField=-1073741824|this._bitField},e.prototype._unsetSettlePromisesQueued=function(){this._bitField=1073741823&this._bitField},e.prototype._queueSettlePromises=function(){a.settlePromises(this),this._setSettlePromisesQueued()},e.prototype._fulfillUnchecked=function(t){if(t===this){var e=n();return this._attachExtraTrace(e),this._rejectUnchecked(e,void 0)}this._setFulfilled(),this._settledValue=t,this._cleanValues(),this._length()>0&&this._queueSettlePromises()},e.prototype._rejectUncheckedCheckError=function(t){var e=s.ensureErrorObject(t);this._rejectUnchecked(t,e===t?void 0:e)},e.prototype._rejectUnchecked=function(t,e){if(t===this){var r=n();return this._attachExtraTrace(r),this._rejectUnchecked(r)}return this._setRejected(),this._settledValue=t,this._cleanValues(),this._isFinal()?void a.throwLater(function(t){throw"stack"in t&&a.invokeFirst(d.unhandledRejection,void 0,t),t},void 0===e?t:e):(void 0!==e&&e!==t&&this._setCarriedStackTrace(e),void(this._length()>0?this._queueSettlePromises():this._ensurePossibleRejectionHandled()))},e.prototype._settlePromises=function(){this._unsetSettlePromisesQueued();for(var t=this._length(),e=0;t>e;e++)this._settlePromiseAt(e)},e._makeSelfResolutionError=n,t("./progress.js")(e,_),t("./method.js")(e,l,f,o),t("./bind.js")(e,l,f),t("./finally.js")(e,p,f),t("./direct_resolve.js")(e),t("./synchronous_inspection.js")(e),t("./join.js")(e,_,f,l),e.Promise=e,t("./map.js")(e,_,o,f,l),t("./cancel.js")(e),t("./using.js")(e,o,f,y),t("./generators.js")(e,o,l,f),t("./nodeify.js")(e),t("./call_get.js")(e),t("./props.js")(e,_,f,o),t("./race.js")(e,l,f,o),t("./reduce.js")(e,_,o,f,l),t("./settle.js")(e,_),t("./some.js")(e,_,o),t("./promisify.js")(e,l),t("./any.js")(e),t("./each.js")(e,l),t("./timers.js")(e,l),t("./filter.js")(e,l),s.toFastProperties(e),s.toFastProperties(e.prototype),r({a:1}),r({b:2}),r({c:3}),r(1),r(function(){}),r(void 0),r(!1),r(new e(l)),d.setBounds(a.firstLineError,s.lastLineError),e}},{"./any.js":1,"./async.js":2,"./bind.js":3,"./call_get.js":5,"./cancel.js":6,"./captured_trace.js":7,"./catch_filter.js":8,"./context.js":9,"./debuggability.js":10,"./direct_resolve.js":11,"./each.js":12,"./errors.js":13,"./filter.js":15,"./finally.js":16,"./generators.js":17,"./join.js":18,"./map.js":19,"./method.js":20,"./nodeify.js":21,"./progress.js":22,"./promise_array.js":24,"./promise_resolver.js":25,"./promisify.js":26,"./props.js":27,"./race.js":29,"./reduce.js":30,"./settle.js":32,"./some.js":33,"./synchronous_inspection.js":34,"./thenables.js":35,"./timers.js":36,"./using.js":37,"./util.js":38}],24:[function(t,e){"use strict";e.exports=function(e,r,n,i){function o(t){switch(t){case-2:return[];case-3:return{}}}function s(t){var n,i=this._promise=new e(r);t instanceof e&&(n=t,i._propagateFrom(n,5)),this._values=t,this._length=0,this._totalResolved=0,this._init(void 0,-2)}var a=t("./util.js"),u=a.isArray;return s.prototype.length=function(){return this._length},s.prototype.promise=function(){return this._promise},s.prototype._init=function c(t,r){var s=n(this._values,this._promise);if(s instanceof e){if(s=s._target(),this._values=s,!s._isFulfilled())return s._isPending()?void s._then(c,this._reject,void 0,this,r):void this._reject(s._reason());if(s=s._value(),!u(s)){var a=new e.TypeError("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n");return void this.__hardReject__(a)}}else if(!u(s))return void this._promise._reject(i("expecting an array, a promise or a thenable\n\n See http://goo.gl/s8MMhc\n")._reason());if(0===s.length)return void(-5===r?this._resolveEmptyArray():this._resolve(o(r)));var l=this.getActualLength(s.length);this._length=l,this._values=this.shouldCopyValues()?new Array(l):this._values;for(var h=this._promise,p=0;l>p;++p){var f=this._isResolved(),_=n(s[p],h);_ instanceof e?(_=_._target(),f?_._unsetRejectionIsUnhandled():_._isPending()?_._proxyPromiseArray(this,p):_._isFulfilled()?this._promiseFulfilled(_._value(),p):this._promiseRejected(_._reason(),p)):f||this._promiseFulfilled(_,p)}},s.prototype._isResolved=function(){return null===this._values},s.prototype._resolve=function(t){this._values=null,this._promise._fulfill(t)},s.prototype.__hardReject__=s.prototype._reject=function(t){this._values=null,this._promise._rejectCallback(t,!1,!0)},s.prototype._promiseProgressed=function(t,e){this._promise._progress({index:e,value:t})},s.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var r=++this._totalResolved;r>=this._length&&this._resolve(this._values)},s.prototype._promiseRejected=function(t){this._totalResolved++,this._reject(t)},s.prototype.shouldCopyValues=function(){return!0},s.prototype.getActualLength=function(t){return t},s}},{"./util.js":38}],25:[function(t,e){"use strict";function r(t){return t instanceof Error&&p.getPrototypeOf(t)===Error.prototype}function n(t){var e;if(r(t)){e=new l(t),e.name=t.name,e.message=t.message,e.stack=t.stack;for(var n=p.keys(t),i=0;i2){for(var o=arguments.length,s=new Array(o-1),u=1;o>u;++u)s[u-1]=arguments[u];t._fulfill(s)}else t._fulfill(r);t=null}}}var o,s=t("./util.js"),a=s.maybeWrapAsError,u=t("./errors.js"),c=u.TimeoutError,l=u.OperationalError,h=s.haveGetters,p=t("./es5.js"),f=/^(?:name|message|stack|cause)$/;if(o=h?function(t){this.promise=t}:function(t){this.promise=t,this.asCallback=i(t),this.callback=this.asCallback},h){var _={get:function(){return i(this.promise)}};p.defineProperty(o.prototype,"asCallback",_),p.defineProperty(o.prototype,"callback",_)}o._nodebackForPromise=i,o.prototype.toString=function(){return"[object PromiseResolver]"},o.prototype.resolve=o.prototype.fulfill=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._resolveCallback(t)},o.prototype.reject=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._rejectCallback(t)},o.prototype.progress=function(t){if(!(this instanceof o))throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\n\n See http://goo.gl/sdkXL9\n");this.promise._progress(t)},o.prototype.cancel=function(t){this.promise.cancel(t)},o.prototype.timeout=function(){this.reject(new c("timeout"))},o.prototype.isResolved=function(){return this.promise.isResolved()},o.prototype.toJSON=function(){return this.promise.toJSON()},e.exports=o},{"./errors.js":13,"./es5.js":14,"./util.js":38}],26:[function(t,e){"use strict";e.exports=function(e,r){function n(t){return!b.test(t)}function i(t){try{return t.__isPromisified__===!0}catch(e){return!1}}function o(t,e,r){var n=f.getDataPropertyOrDefault(t,e+r,j);return n?i(n):!1}function s(t,e,r){for(var n=0;ns;s+=2){var c=o[s],l=o[s+1],h=c+e;t[h]=n===E?E(c,p,c,l,e):n(l,function(){return E(c,p,c,l,e)})}return f.toFastProperties(t),t}function l(t,e){return E(t,e,void 0,t)}var h,p={},f=t("./util.js"),_=t("./promise_resolver.js")._nodebackForPromise,d=f.withAppended,v=f.maybeWrapAsError,y=f.canEvaluate,g=t("./errors").TypeError,m="Async",j={__isPromisified__:!0},b=/^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/,w=function(t,e){return f.isIdentifier(t)&&"_"!==t.charAt(0)&&!f.isClass(e)},k=function(t){return t.replace(/([$])/,"\\$")},E=y?h:u;e.promisify=function(t,e){if("function"!=typeof t)throw new g("fn must be a function\n\n See http://goo.gl/916lJJ\n");if(i(t))return t;var r=l(t,arguments.length<2?p:e);return f.copyDescriptors(t,r,n),r},e.promisifyAll=function(t,e){if("function"!=typeof t&&"object"!=typeof t)throw new g("the target of promisifyAll must be an object or a function\n\n See http://goo.gl/9ITlV0\n");e=Object(e);var r=e.suffix;"string"!=typeof r&&(r=m);var n=e.filter;"function"!=typeof n&&(n=w);var i=e.promisifier;if("function"!=typeof i&&(i=E),!f.isIdentifier(r))throw new RangeError("suffix must be a valid identifier\n\n See http://goo.gl/8FZo5V\n");for(var o=f.inheritedDataKeys(t),s=0;si;++i){var o=e[i];n[i]=t[o],n[i+r]=o}this.constructor$(n)}function s(t){var r,s=n(t);return u(s)?(r=s instanceof e?s._then(e.props,void 0,void 0,void 0,void 0):new o(s).promise(),s instanceof e&&r._propagateFrom(s,4),r):i("cannot await properties of a non-object\n\n See http://goo.gl/OsFKC8\n")}var a=t("./util.js"),u=a.isObject,c=t("./es5.js");a.inherits(o,r),o.prototype._init=function(){this._init$(void 0,-3)},o.prototype._promiseFulfilled=function(t,e){this._values[e]=t;var r=++this._totalResolved;if(r>=this._length){for(var n={},i=this.length(),o=0,s=this.length();s>o;++o)n[this._values[o+i]]=this._values[o];this._resolve(n)}},o.prototype._promiseProgressed=function(t,e){this._promise._progress({key:this._values[e+this.length()],value:t})},o.prototype.shouldCopyValues=function(){return!1},o.prototype.getActualLength=function(t){return t>>1},e.prototype.props=function(){return s(this)},e.props=function(t){return s(t)}}},{"./es5.js":14,"./util.js":38}],28:[function(t,e){"use strict";function r(t,e,r,n,i){for(var o=0;i>o;++o)r[o+n]=t[o+e],t[o+e]=void 0}function n(t){this._capacity=t,this._length=0,this._front=0}n.prototype._willBeOverCapacity=function(t){return this._capacityp;++p){var _=t[p];(void 0!==_||p in t)&&e.cast(_)._then(l,h,void 0,c,null)}return c}var s=t("./util.js").isArray,a=function(t){return t.then(function(e){return o(e,t)})};e.race=function(t){return o(t,void 0)},e.prototype.race=function(){return o(this,void 0)}}},{"./util.js":38}],30:[function(t,e){"use strict";e.exports=function(e,r,n,i,o){function s(t,r,n,s){this.constructor$(t),this._promise._captureStackTrace(),this._preservedValues=s===o?[]:null,this._zerothIsAccum=void 0===n,this._gotAccum=!1,this._reducingIndex=this._zerothIsAccum?1:0,this._valuesPhase=void 0;var u=i(n,this._promise),l=!1,h=u instanceof e;h&&(u=u._target(),u._isPending()?u._proxyPromiseArray(this,-1):u._isFulfilled()?(n=u._value(),this._gotAccum=!0):(this._reject(u._reason()),l=!0)),h||this._zerothIsAccum||(this._gotAccum=!0),this._callback=r,this._accum=n,l||c.invoke(a,this,void 0)}function a(){this._init$(void 0,-5)}function u(t,e,r,i){if("function"!=typeof e)return n("fn must be a function\n\n See http://goo.gl/916lJJ\n");var o=new s(t,e,r,i);return o.promise()}var c=t("./async.js"),l=t("./util.js"),h=l.tryCatch,p=l.errorObj;l.inherits(s,r),s.prototype._init=function(){},s.prototype._resolveEmptyArray=function(){(this._gotAccum||this._zerothIsAccum)&&this._resolve(null!==this._preservedValues?[]:this._accum)},s.prototype._promiseFulfilled=function(t,r){var n=this._values;n[r]=t;var o,s=this.length(),a=this._preservedValues,u=null!==a,c=this._gotAccum,l=this._valuesPhase;if(!l)for(l=this._valuesPhase=new Array(s),o=0;s>o;++o)l[o]=0;if(o=l[r],0===r&&this._zerothIsAccum?(this._accum=t,this._gotAccum=c=!0,l[r]=0===o?1:2):-1===r?(this._accum=t,this._gotAccum=c=!0):0===o?l[r]=1:(l[r]=2,this._accum=t),c){for(var f,_=this._callback,d=this._promise._boundTo,v=this._reducingIndex;s>v;++v)if(o=l[v],2!==o){if(1!==o)return;if(t=n[v],this._promise._pushContext(),u?(a.push(t),f=h(_).call(d,t,v,s)):f=h(_).call(d,this._accum,t,v,s),this._promise._popContext(),f===p)return this._reject(f.e);var y=i(f,this._promise);if(y instanceof e){if(y=y._target(),y._isPending())return l[v]=4,y._proxyPromiseArray(this,v);if(!y._isFulfilled())return this._reject(y._reason());f=y._value()}this._reducingIndex=v+1,this._accum=f}else this._reducingIndex=v+1;this._resolve(u?a:this._accum)}},e.prototype.reduce=function(t,e){return u(this,t,e,null)},e.reduce=function(t,e,r,n){return u(t,e,r,n)}}},{"./async.js":2,"./util.js":38}],31:[function(t,e){"use strict";var r,n=function(){throw new Error("No async scheduler available\n\n See http://goo.gl/m3OTXk\n")};if(t("./util.js").isNode){var i=process.versions.node.split(".").map(Number);r=0===i[0]&&i[1]>10||i[0]>0?function(t){global.setImmediate(t)}:process.nextTick,r||(r="undefined"!=typeof setImmediate?setImmediate:"undefined"!=typeof setTimeout?setTimeout:n)}else"undefined"!=typeof MutationObserver?(r=function(t){var e=document.createElement("div"),r=new MutationObserver(t);return r.observe(e,{attributes:!0}),function(){e.classList.toggle("foo")}},r.isStatic=!0):r="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:"undefined"!=typeof setTimeout?function(t){setTimeout(t,0)}:n;e.exports=r},{"./util.js":38}],32:[function(t,e){"use strict";e.exports=function(e,r){function n(t){this.constructor$(t)}var i=e.PromiseInspection,o=t("./util.js");o.inherits(n,r),n.prototype._promiseResolved=function(t,e){this._values[t]=e;var r=++this._totalResolved;r>=this._length&&this._resolve(this._values)},n.prototype._promiseFulfilled=function(t,e){var r=new i;r._bitField=268435456,r._settledValue=t,this._promiseResolved(e,r)},n.prototype._promiseRejected=function(t,e){var r=new i;r._bitField=134217728,r._settledValue=t,this._promiseResolved(e,r)},e.settle=function(t){return new n(t).promise()},e.prototype.settle=function(){return new n(this).promise()}}},{"./util.js":38}],33:[function(t,e){"use strict";e.exports=function(e,r,n){function i(t){this.constructor$(t),this._howMany=0,this._unwrap=!1,this._initialized=!1}function o(t,e){if((0|e)!==e||0>e)return n("expecting a positive integer\n\n See http://goo.gl/1wAmHx\n");var r=new i(t),o=r.promise();return r.setHowMany(e),r.init(),o}var s=t("./util.js"),a=t("./errors.js").RangeError,u=t("./errors.js").AggregateError,c=s.isArray;s.inherits(i,r),i.prototype._init=function(){if(this._initialized){if(0===this._howMany)return void this._resolve([]);this._init$(void 0,-5);var t=c(this._values);!this._isResolved()&&t&&this._howMany>this._canPossiblyFulfill()&&this._reject(this._getRangeError(this.length()))}},i.prototype.init=function(){this._initialized=!0,this._init()},i.prototype.setUnwrap=function(){this._unwrap=!0},i.prototype.howMany=function(){return this._howMany},i.prototype.setHowMany=function(t){this._howMany=t},i.prototype._promiseFulfilled=function(t){this._addFulfilled(t),this._fulfilled()===this.howMany()&&(this._values.length=this.howMany(),this._resolve(1===this.howMany()&&this._unwrap?this._values[0]:this._values))},i.prototype._promiseRejected=function(t){if(this._addRejected(t),this.howMany()>this._canPossiblyFulfill()){for(var e=new u,r=this.length();r0},e.prototype.isRejected=t.prototype._isRejected=function(){return(134217728&this._bitField)>0},e.prototype.isPending=t.prototype._isPending=function(){return 0===(402653184&this._bitField)},e.prototype.isResolved=t.prototype._isResolved=function(){return(402653184&this._bitField)>0},t.prototype.isPending=function(){return this._target()._isPending()},t.prototype.isRejected=function(){return this._target()._isRejected()},t.prototype.isFulfilled=function(){return this._target()._isFulfilled()},t.prototype.isResolved=function(){return this._target()._isResolved()},t.prototype._value=function(){return this._settledValue},t.prototype._reason=function(){return this._unsetRejectionIsUnhandled(),this._settledValue},t.prototype.value=function(){var t=this._target();if(!t.isFulfilled())throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\n\n See http://goo.gl/hc1DLj\n");return t._settledValue},t.prototype.reason=function(){var t=this._target();if(!t.isRejected())throw new TypeError("cannot get rejection reason of a non-rejected promise\n\n See http://goo.gl/hPuiwB\n");return t._unsetRejectionIsUnhandled(),t._settledValue},t.PromiseInspection=e}},{}],35:[function(t,e){"use strict";e.exports=function(e,r){function n(t,n){if(c(t)){if(t instanceof e)return t;if(o(t)){var l=new e(r);return t._then(l._fulfillUnchecked,l._rejectUncheckedCheckError,l._progressUnchecked,l,null),l}var h=a.tryCatch(i)(t);if(h===u){n&&n._pushContext();var l=e.reject(h.e);return n&&n._popContext(),l}if("function"==typeof h)return s(t,h,n)}return t}function i(t){return t.then}function o(t){return l.call(t,"_promise0")}function s(t,n,i){function o(r){l&&(t===r?l._rejectCallback(e._makeSelfResolutionError(),!1,!0):l._resolveCallback(r),l=null)}function s(t){l&&(l._rejectCallback(t,p,!0),l=null)}function c(t){l&&"function"==typeof l._progress&&l._progress(t)}var l=new e(r),h=l;i&&i._pushContext(),l._captureStackTrace(),i&&i._popContext();var p=!0,f=a.tryCatch(n).call(t,o,s,c);return p=!1,l&&f===u&&(l._rejectCallback(f.e,!0,!0),l=null),h}var a=t("./util.js"),u=a.errorObj,c=a.isObject,l={}.hasOwnProperty;return n}},{"./util.js":38}],36:[function(t,e){"use strict";e.exports=function(e,r){function n(t){var e=this;return e instanceof Number&&(e=+e),clearTimeout(e),t}function i(t){var e=this;throw e instanceof Number&&(e=+e),clearTimeout(e),t}var o=t("./util.js"),s=e.TimeoutError,a=function(t,e){if(t.isPending()){"string"!=typeof e&&(e="operation timed out");var r=new s(e);o.markAsOriginatingFromRejection(r),t._attachExtraTrace(r),t._cancel(r)}},u=function(t){return c(+this).thenReturn(t)},c=e.delay=function(t,n){if(void 0===n){n=t,t=void 0;var i=new e(r);return setTimeout(function(){i._fulfill()},n),i}return n=+n,e.resolve(t)._then(u,null,null,n,void 0)};e.prototype.delay=function(t){return c(this,t)},e.prototype.timeout=function(t,e){t=+t;var r=this.then().cancellable();r._cancellationParent=this;var o=setTimeout(function(){a(r,e)},t);return r._then(n,i,void 0,o,void 0)}}},{"./util.js":38}],37:[function(t,e){"use strict";e.exports=function(e,r,n,i){function o(t){for(var r=t.length,n=0;r>n;++n){var i=t[n];if(i.isRejected())return e.reject(i.error());t[n]=i._settledValue}return t}function s(t){setTimeout(function(){throw t},0)}function a(t){var e=n(t);return e!==t&&"function"==typeof t._isDisposable&&"function"==typeof t._getDisposer&&t._isDisposable()&&e._setDisposable(t._getDisposer()),e}function u(t,r){function i(){if(o>=u)return c.resolve();var l=a(t[o++]);if(l instanceof e&&l._isDisposable()){try{l=n(l._getDisposer().tryDispose(r),t.promise)}catch(h){return s(h)}if(l instanceof e)return l._then(i,s,null,null,null)}i()}var o=0,u=t.length,c=e.defer();return i(),c.promise}function c(t){var e=new v;return e._settledValue=t,e._bitField=268435456,u(this,e).thenReturn(t)}function l(t){var e=new v;return e._settledValue=t,e._bitField=134217728,u(this,e).thenThrow(t)}function h(t,e,r){this._data=t,this._promise=e,this._context=r}function p(t,e,r){this.constructor$(t,e,r)}function f(t){return h.isDisposer(t)?(this.resources[this.index]._setDisposable(t),t.promise()):t}var _=t("./errors.js").TypeError,d=t("./util.js").inherits,v=e.PromiseInspection;h.prototype.data=function(){return this._data},h.prototype.promise=function(){return this._promise},h.prototype.resource=function(){return this.promise().isFulfilled()?this.promise().value():null},h.prototype.tryDispose=function(t){var e=this.resource(),r=this._context;void 0!==r&&r._pushContext();var n=null!==e?this.doDispose(e,t):null;return void 0!==r&&r._popContext(),this._promise._unsetDisposable(),this._data=null,n},h.isDisposer=function(t){return null!=t&&"function"==typeof t.resource&&"function"==typeof t.tryDispose},d(p,h),p.prototype.doDispose=function(t,e){var r=this.data();return r.call(t,t,e)},e.using=function(){var t=arguments.length;if(2>t)return r("you must pass at least 2 arguments to Promise.using");var i=arguments[t-1];if("function"!=typeof i)return r("fn must be a function\n\n See http://goo.gl/916lJJ\n");t--;for(var s=new Array(t),a=0;t>a;++a){var u=arguments[a];if(h.isDisposer(u)){var p=u;u=u.promise(),u._setDisposable(p)}else{var _=n(u);_ instanceof e&&(u=_._then(f,null,null,{resources:s,index:a},void 0))}s[a]=u}var d=e.settle(s).then(o).then(function(t){d._pushContext();var e;try{e=i.apply(void 0,t)}finally{d._popContext()}return e})._then(c,l,void 0,s,void 0);return s.promise=d,d},e.prototype._setDisposable=function(t){this._bitField=262144|this._bitField,this._disposer=t},e.prototype._isDisposable=function(){return(262144&this._bitField)>0},e.prototype._getDisposer=function(){return this._disposer},e.prototype._unsetDisposable=function(){this._bitField=-262145&this._bitField,this._disposer=void 0},e.prototype.disposer=function(t){if("function"==typeof t)return new p(t,this,i());throw new _}}},{"./errors.js":13,"./util.js":38}],38:[function(t,e,r){"use strict"; -function n(){try{return T.apply(this,arguments)}catch(t){return F.e=t,F}}function i(t){return T=t,n}function o(t){return null==t||t===!0||t===!1||"string"==typeof t||"number"==typeof t}function s(t){return!o(t)}function a(t){return o(t)?new Error(v(t)):t}function u(t,e){var r,n=t.length,i=new Array(n+1);for(r=0;n>r;++r)i[r]=t[r];return i[r]=e,i}function c(t,e,r){if(!w.isES5)return{}.hasOwnProperty.call(t,e)?t[e]:void 0;var n=Object.getOwnPropertyDescriptor(t,e);return null!=n?null==n.get&&null==n.set?n.value:r:void 0}function l(t,e,r){if(o(t))return t;var n={value:r,configurable:!0,enumerable:!1,writable:!0};return w.defineProperty(t,e,n),t}function h(t){throw t}function p(t){try{if("function"==typeof t){var e=w.names(t.prototype);return w.isES5?e.length>1:e.length>0&&!(1===e.length&&"constructor"===e[0])}return!1}catch(r){return!1}}function f(t){function e(){}e.prototype=t;for(var r=8;r--;)new e;return t}function _(t){return R.test(t)}function d(t,e,r){for(var n=new Array(t),i=0;t>i;++i)n[i]=e+i+r;return n}function v(t){try{return t+""}catch(e){return"[no string representation]"}}function y(t){try{l(t,"isOperational",!0)}catch(e){}}function g(t){return null==t?!1:t instanceof Error.__BluebirdErrorTypes__.OperationalError||t.isOperational===!0}function m(t){return t instanceof Error&&w.propertyIsWritable(t,"stack")}function j(t){return{}.toString.call(t)}function b(t,e,r){for(var n=w.names(t),i=0;it||isNaN(t))throw TypeError("n must be a positive number");return this._maxListeners=t,this},r.prototype.emit=function(t){var e,r,i,a,u,c;if(this._events||(this._events={}),"error"===t&&(!this._events.error||o(this._events.error)&&!this._events.error.length)){if(e=arguments[1],e instanceof Error)throw e;throw TypeError('Uncaught, unspecified "error" event.')}if(r=this._events[t],s(r))return!1;if(n(r))switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:for(i=arguments.length,a=new Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];r.apply(this,a)}else if(o(r)){for(i=arguments.length,a=new Array(i-1),u=1;i>u;u++)a[u-1]=arguments[u];for(c=r.slice(),i=c.length,u=0;i>u;u++)c[u].apply(this,a)}return!0},r.prototype.addListener=function(t,e){var i;if(!n(e))throw TypeError("listener must be a function");if(this._events||(this._events={}),this._events.newListener&&this.emit("newListener",t,n(e.listener)?e.listener:e),this._events[t]?o(this._events[t])?this._events[t].push(e):this._events[t]=[this._events[t],e]:this._events[t]=e,o(this._events[t])&&!this._events[t].warned){var i;i=s(this._maxListeners)?r.defaultMaxListeners:this._maxListeners,i&&i>0&&this._events[t].length>i&&(this._events[t].warned=!0,console.error("(node) warning: possible EventEmitter memory leak detected. %d listeners added. Use emitter.setMaxListeners() to increase limit.",this._events[t].length),"function"==typeof console.trace&&console.trace())}return this},r.prototype.on=r.prototype.addListener,r.prototype.once=function(t,e){function r(){this.removeListener(t,r),i||(i=!0,e.apply(this,arguments))}if(!n(e))throw TypeError("listener must be a function");var i=!1;return r.listener=e,this.on(t,r),this},r.prototype.removeListener=function(t,e){var r,i,s,a;if(!n(e))throw TypeError("listener must be a function");if(!this._events||!this._events[t])return this;if(r=this._events[t],s=r.length,i=-1,r===e||n(r.listener)&&r.listener===e)delete this._events[t],this._events.removeListener&&this.emit("removeListener",t,e);else if(o(r)){for(a=s;a-->0;)if(r[a]===e||r[a].listener&&r[a].listener===e){i=a;break}if(0>i)return this;1===r.length?(r.length=0,delete this._events[t]):r.splice(i,1),this._events.removeListener&&this.emit("removeListener",t,e)}return this},r.prototype.removeAllListeners=function(t){var e,r;if(!this._events)return this;if(!this._events.removeListener)return 0===arguments.length?this._events={}:this._events[t]&&delete this._events[t],this;if(0===arguments.length){for(e in this._events)"removeListener"!==e&&this.removeAllListeners(e);return this.removeAllListeners("removeListener"),this._events={},this}if(r=this._events[t],n(r))this.removeListener(t,r);else for(;r.length;)this.removeListener(t,r[r.length-1]);return delete this._events[t],this},r.prototype.listeners=function(t){var e;return e=this._events&&this._events[t]?n(this._events[t])?[this._events[t]]:this._events[t].slice():[]},r.listenerCount=function(t,e){var r;return r=t._events&&t._events[e]?n(t._events[e])?1:t._events[e].length:0}},{}]},{},[4])(4)}),"undefined"!=typeof window&&null!==window?window.P=window.Promise:"undefined"!=typeof self&&null!==self&&(self.P=self.Promise); \ No newline at end of file diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js deleted file mode 100644 index 05a6228e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/any.js +++ /dev/null @@ -1,21 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var SomePromiseArray = Promise._SomePromiseArray; -function any(promises) { - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(1); - ret.setUnwrap(); - ret.init(); - return promise; -} - -Promise.any = function (promises) { - return any(promises); -}; - -Promise.prototype.any = function () { - return any(this); -}; - -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js deleted file mode 100644 index a98955c4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/assert.js +++ /dev/null @@ -1,55 +0,0 @@ -"use strict"; -module.exports = (function(){ -var AssertionError = (function() { - function AssertionError(a) { - this.constructor$(a); - this.message = a; - this.name = "AssertionError"; - } - AssertionError.prototype = new Error(); - AssertionError.prototype.constructor = AssertionError; - AssertionError.prototype.constructor$ = Error; - return AssertionError; -})(); - -function getParams(args) { - var params = []; - for (var i = 0; i < args.length; ++i) params.push("arg" + i); - return params; -} - -function nativeAssert(callName, args, expect) { - try { - var params = getParams(args); - var constructorArgs = params; - constructorArgs.push("return " + - callName + "("+ params.join(",") + ");"); - var fn = Function.apply(null, constructorArgs); - return fn.apply(null, args); - } catch (e) { - if (!(e instanceof SyntaxError)) { - throw e; - } else { - return expect; - } - } -} - -return function assert(boolExpr, message) { - if (boolExpr === true) return; - - if (typeof boolExpr === "string" && - boolExpr.charAt(0) === "%") { - var nativeCallName = boolExpr; - var $_len = arguments.length;var args = new Array($_len - 2); for(var $_i = 2; $_i < $_len; ++$_i) {args[$_i - 2] = arguments[$_i];} - if (nativeAssert(nativeCallName, args, message) === message) return; - message = (nativeCallName + " !== " + message); - } - - var ret = new AssertionError(message); - if (Error.captureStackTrace) { - Error.captureStackTrace(ret, assert); - } - throw ret; -}; -})(); diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js deleted file mode 100644 index 3b5f828c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/async.js +++ /dev/null @@ -1,204 +0,0 @@ -"use strict"; -var firstLineError; -try {throw new Error(); } catch (e) {firstLineError = e;} -var schedule = require("./schedule.js"); -var Queue = require("./queue.js"); -var util = require("./util.js"); - -function Async() { - this._isTickUsed = false; - this._lateQueue = new Queue(16); - this._normalQueue = new Queue(16); - this._trampolineEnabled = true; - var self = this; - this.drainQueues = function () { - self._drainQueues(); - }; - this._schedule = - schedule.isStatic ? schedule(this.drainQueues) : schedule; -} - -Async.prototype.disableTrampolineIfNecessary = function() { - if (util.hasDevTools) { - this._trampolineEnabled = false; - } -}; - -Async.prototype.enableTrampoline = function() { - if (!this._trampolineEnabled) { - this._trampolineEnabled = true; - this._schedule = function(fn) { - setTimeout(fn, 0); - }; - } -}; - -Async.prototype.haveItemsQueued = function () { - return this._normalQueue.length() > 0; -}; - -Async.prototype.throwLater = function(fn, arg) { - if (arguments.length === 1) { - arg = fn; - fn = function () { throw arg; }; - } - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - if (typeof setTimeout !== "undefined") { - setTimeout(function() { - fn(arg); - }, 0); - } else try { - this._schedule(function() { - fn(arg); - }); - } catch (e) { - throw new Error("No async scheduler available\u000a\u000a See http://goo.gl/m3OTXk\u000a"); - } -}; - -Async.prototype._getDomain = function() {}; - -if (!false) { -if (util.isNode) { - var EventsModule = require("events"); - - var domainGetter = function() { - var domain = process.domain; - if (domain === null) return undefined; - return domain; - }; - - if (EventsModule.usingDomains) { - Async.prototype._getDomain = domainGetter; - } else { - var descriptor = - Object.getOwnPropertyDescriptor(EventsModule, "usingDomains"); - - if (descriptor) { - if (!descriptor.configurable) { - process.on("domainsActivated", function() { - Async.prototype._getDomain = domainGetter; - }); - } else { - var usingDomains = false; - Object.defineProperty(EventsModule, "usingDomains", { - configurable: false, - enumerable: true, - get: function() { - return usingDomains; - }, - set: function(value) { - if (usingDomains || !value) return; - usingDomains = true; - Async.prototype._getDomain = domainGetter; - util.toFastProperties(process); - process.emit("domainsActivated"); - } - }); - } - } - } -} -} - -function AsyncInvokeLater(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._lateQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncInvoke(fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.push(fn, receiver, arg); - this._queueTick(); -} - -function AsyncSettlePromises(promise) { - var domain = this._getDomain(); - if (domain !== undefined) { - var fn = domain.bind(promise._settlePromises); - this._normalQueue.push(fn, promise, undefined); - } else { - this._normalQueue._pushOne(promise); - } - this._queueTick(); -} - -if (!util.hasDevTools) { - Async.prototype.invokeLater = AsyncInvokeLater; - Async.prototype.invoke = AsyncInvoke; - Async.prototype.settlePromises = AsyncSettlePromises; -} else { - Async.prototype.invokeLater = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvokeLater.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 100); - } - }; - - Async.prototype.invoke = function (fn, receiver, arg) { - if (this._trampolineEnabled) { - AsyncInvoke.call(this, fn, receiver, arg); - } else { - setTimeout(function() { - fn.call(receiver, arg); - }, 0); - } - }; - - Async.prototype.settlePromises = function(promise) { - if (this._trampolineEnabled) { - AsyncSettlePromises.call(this, promise); - } else { - setTimeout(function() { - promise._settlePromises(); - }, 0); - } - }; -} - -Async.prototype.invokeFirst = function (fn, receiver, arg) { - var domain = this._getDomain(); - if (domain !== undefined) fn = domain.bind(fn); - this._normalQueue.unshift(fn, receiver, arg); - this._queueTick(); -}; - -Async.prototype._drainQueue = function(queue) { - while (queue.length() > 0) { - var fn = queue.shift(); - if (typeof fn !== "function") { - fn._settlePromises(); - continue; - } - var receiver = queue.shift(); - var arg = queue.shift(); - fn.call(receiver, arg); - } -}; - -Async.prototype._drainQueues = function () { - this._drainQueue(this._normalQueue); - this._reset(); - this._drainQueue(this._lateQueue); -}; - -Async.prototype._queueTick = function () { - if (!this._isTickUsed) { - this._isTickUsed = true; - this._schedule(this.drainQueues); - } -}; - -Async.prototype._reset = function () { - this._isTickUsed = false; -}; - -module.exports = new Async(); -module.exports.firstLineError = firstLineError; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js deleted file mode 100644 index d6f6da25..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bind.js +++ /dev/null @@ -1,73 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise) { -var rejectThis = function(_, e) { - this._reject(e); -}; - -var targetRejected = function(e, context) { - context.promiseRejectionQueued = true; - context.bindingPromise._then(rejectThis, rejectThis, null, this, e); -}; - -var bindingResolved = function(thisArg, context) { - this._setBoundTo(thisArg); - if (this._isPending()) { - this._resolveCallback(context.target); - } -}; - -var bindingRejected = function(e, context) { - if (!context.promiseRejectionQueued) this._reject(e); -}; - -Promise.prototype.bind = function (thisArg) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - ret._propagateFrom(this, 1); - var target = this._target(); - if (maybePromise instanceof Promise) { - var context = { - promiseRejectionQueued: false, - promise: ret, - target: target, - bindingPromise: maybePromise - }; - target._then(INTERNAL, targetRejected, ret._progress, ret, context); - maybePromise._then( - bindingResolved, bindingRejected, ret._progress, ret, context); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(target); - } - return ret; -}; - -Promise.prototype._setBoundTo = function (obj) { - if (obj !== undefined) { - this._bitField = this._bitField | 131072; - this._boundTo = obj; - } else { - this._bitField = this._bitField & (~131072); - } -}; - -Promise.prototype._isBound = function () { - return (this._bitField & 131072) === 131072; -}; - -Promise.bind = function (thisArg, value) { - var maybePromise = tryConvertToPromise(thisArg); - var ret = new Promise(INTERNAL); - - if (maybePromise instanceof Promise) { - maybePromise._then(function(thisArg) { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - }, ret._reject, ret._progress, ret, null); - } else { - ret._setBoundTo(thisArg); - ret._resolveCallback(value); - } - return ret; -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js deleted file mode 100644 index ed6226e7..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/bluebird.js +++ /dev/null @@ -1,11 +0,0 @@ -"use strict"; -var old; -if (typeof Promise !== "undefined") old = Promise; -function noConflict() { - try { if (Promise === bluebird) Promise = old; } - catch (e) {} - return bluebird; -} -var bluebird = require("./promise.js")(); -bluebird.noConflict = noConflict; -module.exports = bluebird; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js deleted file mode 100644 index 62c166d5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/call_get.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -var cr = Object.create; -if (cr) { - var callerCache = cr(null); - var getterCache = cr(null); - callerCache[" size"] = getterCache[" size"] = 0; -} - -module.exports = function(Promise) { -var util = require("./util.js"); -var canEvaluate = util.canEvaluate; -var isIdentifier = util.isIdentifier; - -var getMethodCaller; -var getGetter; -if (!false) { -var makeMethodCaller = function (methodName) { - return new Function("ensureMethod", " \n\ - return function(obj) { \n\ - 'use strict' \n\ - var len = this.length; \n\ - ensureMethod(obj, 'methodName'); \n\ - switch(len) { \n\ - case 1: return obj.methodName(this[0]); \n\ - case 2: return obj.methodName(this[0], this[1]); \n\ - case 3: return obj.methodName(this[0], this[1], this[2]); \n\ - case 0: return obj.methodName(); \n\ - default: \n\ - return obj.methodName.apply(obj, this); \n\ - } \n\ - }; \n\ - ".replace(/methodName/g, methodName))(ensureMethod); -}; - -var makeGetter = function (propertyName) { - return new Function("obj", " \n\ - 'use strict'; \n\ - return obj.propertyName; \n\ - ".replace("propertyName", propertyName)); -}; - -var getCompiled = function(name, compiler, cache) { - var ret = cache[name]; - if (typeof ret !== "function") { - if (!isIdentifier(name)) { - return null; - } - ret = compiler(name); - cache[name] = ret; - cache[" size"]++; - if (cache[" size"] > 512) { - var keys = Object.keys(cache); - for (var i = 0; i < 256; ++i) delete cache[keys[i]]; - cache[" size"] = keys.length - 256; - } - } - return ret; -}; - -getMethodCaller = function(name) { - return getCompiled(name, makeMethodCaller, callerCache); -}; - -getGetter = function(name) { - return getCompiled(name, makeGetter, getterCache); -}; -} - -function ensureMethod(obj, methodName) { - var fn; - if (obj != null) fn = obj[methodName]; - if (typeof fn !== "function") { - var message = "Object " + util.classString(obj) + " has no method '" + - util.toString(methodName) + "'"; - throw new Promise.TypeError(message); - } - return fn; -} - -function caller(obj) { - var methodName = this.pop(); - var fn = ensureMethod(obj, methodName); - return fn.apply(obj, this); -} -Promise.prototype.call = function (methodName) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - if (!false) { - if (canEvaluate) { - var maybeCaller = getMethodCaller(methodName); - if (maybeCaller !== null) { - return this._then( - maybeCaller, undefined, undefined, args, undefined); - } - } - } - args.push(methodName); - return this._then(caller, undefined, undefined, args, undefined); -}; - -function namedGetter(obj) { - return obj[this]; -} -function indexedGetter(obj) { - var index = +this; - if (index < 0) index = Math.max(0, index + obj.length); - return obj[index]; -} -Promise.prototype.get = function (propertyName) { - var isIndex = (typeof propertyName === "number"); - var getter; - if (!isIndex) { - if (canEvaluate) { - var maybeGetter = getGetter(propertyName); - getter = maybeGetter !== null ? maybeGetter : namedGetter; - } else { - getter = namedGetter; - } - } else { - getter = indexedGetter; - } - return this._then(getter, undefined, undefined, propertyName, undefined); -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js deleted file mode 100644 index 9eb40b6f..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/cancel.js +++ /dev/null @@ -1,48 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var errors = require("./errors.js"); -var async = require("./async.js"); -var CancellationError = errors.CancellationError; - -Promise.prototype._cancel = function (reason) { - if (!this.isCancellable()) return this; - var parent; - var promiseToReject = this; - while ((parent = promiseToReject._cancellationParent) !== undefined && - parent.isCancellable()) { - promiseToReject = parent; - } - this._unsetCancellable(); - promiseToReject._target()._rejectCallback(reason, false, true); -}; - -Promise.prototype.cancel = function (reason) { - if (!this.isCancellable()) return this; - if (reason === undefined) reason = new CancellationError(); - async.invokeLater(this._cancel, this, reason); - return this; -}; - -Promise.prototype.cancellable = function () { - if (this._cancellable()) return this; - async.enableTrampoline(); - this._setCancellable(); - this._cancellationParent = undefined; - return this; -}; - -Promise.prototype.uncancellable = function () { - var ret = this.then(); - ret._unsetCancellable(); - return ret; -}; - -Promise.prototype.fork = function (didFulfill, didReject, didProgress) { - var ret = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - - ret._setCancellable(); - ret._cancellationParent = undefined; - return ret; -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js deleted file mode 100644 index 6fda9e80..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/captured_trace.js +++ /dev/null @@ -1,492 +0,0 @@ -"use strict"; -module.exports = function() { -var async = require("./async.js"); -var util = require("./util.js"); -var bluebirdFramePattern = - /[\\\/]bluebird[\\\/]js[\\\/](main|debug|zalgo|instrumented)/; -var stackFramePattern = null; -var formatStack = null; -var indentStackFrames = false; -var warn; - -function CapturedTrace(parent) { - this._parent = parent; - var length = this._length = 1 + (parent === undefined ? 0 : parent._length); - captureStackTrace(this, CapturedTrace); - if (length > 32) this.uncycle(); -} -util.inherits(CapturedTrace, Error); - -CapturedTrace.prototype.uncycle = function() { - var length = this._length; - if (length < 2) return; - var nodes = []; - var stackToIndex = {}; - - for (var i = 0, node = this; node !== undefined; ++i) { - nodes.push(node); - node = node._parent; - } - length = this._length = i; - for (var i = length - 1; i >= 0; --i) { - var stack = nodes[i].stack; - if (stackToIndex[stack] === undefined) { - stackToIndex[stack] = i; - } - } - for (var i = 0; i < length; ++i) { - var currentStack = nodes[i].stack; - var index = stackToIndex[currentStack]; - if (index !== undefined && index !== i) { - if (index > 0) { - nodes[index - 1]._parent = undefined; - nodes[index - 1]._length = 1; - } - nodes[i]._parent = undefined; - nodes[i]._length = 1; - var cycleEdgeNode = i > 0 ? nodes[i - 1] : this; - - if (index < length - 1) { - cycleEdgeNode._parent = nodes[index + 1]; - cycleEdgeNode._parent.uncycle(); - cycleEdgeNode._length = - cycleEdgeNode._parent._length + 1; - } else { - cycleEdgeNode._parent = undefined; - cycleEdgeNode._length = 1; - } - var currentChildLength = cycleEdgeNode._length + 1; - for (var j = i - 2; j >= 0; --j) { - nodes[j]._length = currentChildLength; - currentChildLength++; - } - return; - } - } -}; - -CapturedTrace.prototype.parent = function() { - return this._parent; -}; - -CapturedTrace.prototype.hasParent = function() { - return this._parent !== undefined; -}; - -CapturedTrace.prototype.attachExtraTrace = function(error) { - if (error.__stackCleaned__) return; - this.uncycle(); - var parsed = CapturedTrace.parseStackAndMessage(error); - var message = parsed.message; - var stacks = [parsed.stack]; - - var trace = this; - while (trace !== undefined) { - stacks.push(cleanStack(trace.stack.split("\n"))); - trace = trace._parent; - } - removeCommonRoots(stacks); - removeDuplicateOrEmptyJumps(stacks); - util.notEnumerableProp(error, "stack", reconstructStack(message, stacks)); - util.notEnumerableProp(error, "__stackCleaned__", true); -}; - -function reconstructStack(message, stacks) { - for (var i = 0; i < stacks.length - 1; ++i) { - stacks[i].push("From previous event:"); - stacks[i] = stacks[i].join("\n"); - } - if (i < stacks.length) { - stacks[i] = stacks[i].join("\n"); - } - return message + "\n" + stacks.join("\n"); -} - -function removeDuplicateOrEmptyJumps(stacks) { - for (var i = 0; i < stacks.length; ++i) { - if (stacks[i].length === 0 || - ((i + 1 < stacks.length) && stacks[i][0] === stacks[i+1][0])) { - stacks.splice(i, 1); - i--; - } - } -} - -function removeCommonRoots(stacks) { - var current = stacks[0]; - for (var i = 1; i < stacks.length; ++i) { - var prev = stacks[i]; - var currentLastIndex = current.length - 1; - var currentLastLine = current[currentLastIndex]; - var commonRootMeetPoint = -1; - - for (var j = prev.length - 1; j >= 0; --j) { - if (prev[j] === currentLastLine) { - commonRootMeetPoint = j; - break; - } - } - - for (var j = commonRootMeetPoint; j >= 0; --j) { - var line = prev[j]; - if (current[currentLastIndex] === line) { - current.pop(); - currentLastIndex--; - } else { - break; - } - } - current = prev; - } -} - -function cleanStack(stack) { - var ret = []; - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - var isTraceLine = stackFramePattern.test(line) || - " (No stack trace)" === line; - var isInternalFrame = isTraceLine && shouldIgnore(line); - if (isTraceLine && !isInternalFrame) { - if (indentStackFrames && line.charAt(0) !== " ") { - line = " " + line; - } - ret.push(line); - } - } - return ret; -} - -function stackFramesAsArray(error) { - var stack = error.stack.replace(/\s+$/g, "").split("\n"); - for (var i = 0; i < stack.length; ++i) { - var line = stack[i]; - if (" (No stack trace)" === line || stackFramePattern.test(line)) { - break; - } - } - if (i > 0) { - stack = stack.slice(i); - } - return stack; -} - -CapturedTrace.parseStackAndMessage = function(error) { - var stack = error.stack; - var message = error.toString(); - stack = typeof stack === "string" && stack.length > 0 - ? stackFramesAsArray(error) : [" (No stack trace)"]; - return { - message: message, - stack: cleanStack(stack) - }; -}; - -CapturedTrace.formatAndLogError = function(error, title) { - if (typeof console !== "undefined") { - var message; - if (typeof error === "object" || typeof error === "function") { - var stack = error.stack; - message = title + formatStack(stack, error); - } else { - message = title + String(error); - } - if (typeof warn === "function") { - warn(message); - } else if (typeof console.log === "function" || - typeof console.log === "object") { - console.log(message); - } - } -}; - -CapturedTrace.unhandledRejection = function (reason) { - CapturedTrace.formatAndLogError(reason, "^--- With additional stack trace: "); -}; - -CapturedTrace.isSupported = function () { - return typeof captureStackTrace === "function"; -}; - -CapturedTrace.fireRejectionEvent = -function(name, localHandler, reason, promise) { - var localEventFired = false; - try { - if (typeof localHandler === "function") { - localEventFired = true; - if (name === "rejectionHandled") { - localHandler(promise); - } else { - localHandler(reason, promise); - } - } - } catch (e) { - async.throwLater(e); - } - - var globalEventFired = false; - try { - globalEventFired = fireGlobalEvent(name, reason, promise); - } catch (e) { - globalEventFired = true; - async.throwLater(e); - } - - var domEventFired = false; - if (fireDomEvent) { - try { - domEventFired = fireDomEvent(name.toLowerCase(), { - reason: reason, - promise: promise - }); - } catch (e) { - domEventFired = true; - async.throwLater(e); - } - } - - if (!globalEventFired && !localEventFired && !domEventFired && - name === "unhandledRejection") { - CapturedTrace.formatAndLogError(reason, "Unhandled rejection "); - } -}; - -function formatNonError(obj) { - var str; - if (typeof obj === "function") { - str = "[function " + - (obj.name || "anonymous") + - "]"; - } else { - str = obj.toString(); - var ruselessToString = /\[object [a-zA-Z0-9$_]+\]/; - if (ruselessToString.test(str)) { - try { - var newStr = JSON.stringify(obj); - str = newStr; - } - catch(e) { - - } - } - if (str.length === 0) { - str = "(empty array)"; - } - } - return ("(<" + snip(str) + ">, no stack trace)"); -} - -function snip(str) { - var maxChars = 41; - if (str.length < maxChars) { - return str; - } - return str.substr(0, maxChars - 3) + "..."; -} - -var shouldIgnore = function() { return false; }; -var parseLineInfoRegex = /[\/<\(]([^:\/]+):(\d+):(?:\d+)\)?\s*$/; -function parseLineInfo(line) { - var matches = line.match(parseLineInfoRegex); - if (matches) { - return { - fileName: matches[1], - line: parseInt(matches[2], 10) - }; - } -} -CapturedTrace.setBounds = function(firstLineError, lastLineError) { - if (!CapturedTrace.isSupported()) return; - var firstStackLines = firstLineError.stack.split("\n"); - var lastStackLines = lastLineError.stack.split("\n"); - var firstIndex = -1; - var lastIndex = -1; - var firstFileName; - var lastFileName; - for (var i = 0; i < firstStackLines.length; ++i) { - var result = parseLineInfo(firstStackLines[i]); - if (result) { - firstFileName = result.fileName; - firstIndex = result.line; - break; - } - } - for (var i = 0; i < lastStackLines.length; ++i) { - var result = parseLineInfo(lastStackLines[i]); - if (result) { - lastFileName = result.fileName; - lastIndex = result.line; - break; - } - } - if (firstIndex < 0 || lastIndex < 0 || !firstFileName || !lastFileName || - firstFileName !== lastFileName || firstIndex >= lastIndex) { - return; - } - - shouldIgnore = function(line) { - if (bluebirdFramePattern.test(line)) return true; - var info = parseLineInfo(line); - if (info) { - if (info.fileName === firstFileName && - (firstIndex <= info.line && info.line <= lastIndex)) { - return true; - } - } - return false; - }; -}; - -var captureStackTrace = (function stackDetection() { - var v8stackFramePattern = /^\s*at\s*/; - var v8stackFormatter = function(stack, error) { - if (typeof stack === "string") return stack; - - if (error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - if (typeof Error.stackTraceLimit === "number" && - typeof Error.captureStackTrace === "function") { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - var captureStackTrace = Error.captureStackTrace; - - shouldIgnore = function(line) { - return bluebirdFramePattern.test(line); - }; - return function(receiver, ignoreUntil) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - captureStackTrace(receiver, ignoreUntil); - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - var err = new Error(); - - if (typeof err.stack === "string" && - err.stack.split("\n")[0].indexOf("stackDetection@") >= 0) { - stackFramePattern = /@/; - formatStack = v8stackFormatter; - indentStackFrames = true; - return function captureStackTrace(o) { - o.stack = new Error().stack; - }; - } - - var hasStackAfterThrow; - try { throw new Error(); } - catch(e) { - hasStackAfterThrow = ("stack" in e); - } - if (!("stack" in err) && hasStackAfterThrow) { - stackFramePattern = v8stackFramePattern; - formatStack = v8stackFormatter; - return function captureStackTrace(o) { - Error.stackTraceLimit = Error.stackTraceLimit + 6; - try { throw new Error(); } - catch(e) { o.stack = e.stack; } - Error.stackTraceLimit = Error.stackTraceLimit - 6; - }; - } - - formatStack = function(stack, error) { - if (typeof stack === "string") return stack; - - if ((typeof error === "object" || - typeof error === "function") && - error.name !== undefined && - error.message !== undefined) { - return error.toString(); - } - return formatNonError(error); - }; - - return null; - -})([]); - -var fireDomEvent; -var fireGlobalEvent = (function() { - if (util.isNode) { - return function(name, reason, promise) { - if (name === "rejectionHandled") { - return process.emit(name, promise); - } else { - return process.emit(name, reason, promise); - } - }; - } else { - var customEventWorks = false; - var anyEventWorks = true; - try { - var ev = new self.CustomEvent("test"); - customEventWorks = ev instanceof CustomEvent; - } catch (e) {} - if (!customEventWorks) { - try { - var event = document.createEvent("CustomEvent"); - event.initCustomEvent("testingtheevent", false, true, {}); - self.dispatchEvent(event); - } catch (e) { - anyEventWorks = false; - } - } - if (anyEventWorks) { - fireDomEvent = function(type, detail) { - var event; - if (customEventWorks) { - event = new self.CustomEvent(type, { - detail: detail, - bubbles: false, - cancelable: true - }); - } else if (self.dispatchEvent) { - event = document.createEvent("CustomEvent"); - event.initCustomEvent(type, false, true, detail); - } - - return event ? !self.dispatchEvent(event) : false; - }; - } - - var toWindowMethodNameMap = {}; - toWindowMethodNameMap["unhandledRejection"] = ("on" + - "unhandledRejection").toLowerCase(); - toWindowMethodNameMap["rejectionHandled"] = ("on" + - "rejectionHandled").toLowerCase(); - - return function(name, reason, promise) { - var methodName = toWindowMethodNameMap[name]; - var method = self[methodName]; - if (!method) return false; - if (name === "rejectionHandled") { - method.call(self, promise); - } else { - method.call(self, reason, promise); - } - return true; - }; - } -})(); - -if (typeof console !== "undefined" && typeof console.warn !== "undefined") { - warn = function (message) { - console.warn(message); - }; - if (util.isNode && process.stderr.isTTY) { - warn = function(message) { - process.stderr.write("\u001b[31m" + message + "\u001b[39m\n"); - }; - } else if (!util.isNode && typeof (new Error().stack) === "string") { - warn = function(message) { - console.warn("%c" + message, "color: red"); - }; - } -} - -return CapturedTrace; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js deleted file mode 100644 index 040f0572..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/catch_filter.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -module.exports = function(NEXT_FILTER) { -var util = require("./util.js"); -var errors = require("./errors.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var keys = require("./es5.js").keys; -var TypeError = errors.TypeError; - -function CatchFilter(instances, callback, promise) { - this._instances = instances; - this._callback = callback; - this._promise = promise; -} - -function safePredicate(predicate, e) { - var safeObject = {}; - var retfilter = tryCatch(predicate).call(safeObject, e); - - if (retfilter === errorObj) return retfilter; - - var safeKeys = keys(safeObject); - if (safeKeys.length) { - errorObj.e = new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a"); - return errorObj; - } - return retfilter; -} - -CatchFilter.prototype.doFilter = function (e) { - var cb = this._callback; - var promise = this._promise; - var boundTo = promise._boundTo; - for (var i = 0, len = this._instances.length; i < len; ++i) { - var item = this._instances[i]; - var itemIsErrorType = item === Error || - (item != null && item.prototype instanceof Error); - - if (itemIsErrorType && e instanceof item) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } else if (typeof item === "function" && !itemIsErrorType) { - var shouldHandle = safePredicate(item, e); - if (shouldHandle === errorObj) { - e = errorObj.e; - break; - } else if (shouldHandle) { - var ret = tryCatch(cb).call(boundTo, e); - if (ret === errorObj) { - NEXT_FILTER.e = ret.e; - return NEXT_FILTER; - } - return ret; - } - } - } - NEXT_FILTER.e = e; - return NEXT_FILTER; -}; - -return CatchFilter; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js deleted file mode 100644 index ccd7702b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/context.js +++ /dev/null @@ -1,38 +0,0 @@ -"use strict"; -module.exports = function(Promise, CapturedTrace, isDebugging) { -var contextStack = []; -function Context() { - this._trace = new CapturedTrace(peekContext()); -} -Context.prototype._pushContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.push(this._trace); - } -}; - -Context.prototype._popContext = function () { - if (!isDebugging()) return; - if (this._trace !== undefined) { - contextStack.pop(); - } -}; - -function createContext() { - if (isDebugging()) return new Context(); -} - -function peekContext() { - var lastIndex = contextStack.length - 1; - if (lastIndex >= 0) { - return contextStack[lastIndex]; - } - return undefined; -} - -Promise.prototype._peekContext = peekContext; -Promise.prototype._pushContext = Context.prototype._pushContext; -Promise.prototype._popContext = Context.prototype._popContext; - -return createContext; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js deleted file mode 100644 index 5ac17670..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/debuggability.js +++ /dev/null @@ -1,147 +0,0 @@ -"use strict"; -module.exports = function(Promise, CapturedTrace) { -var async = require("./async.js"); -var Warning = require("./errors.js").Warning; -var util = require("./util.js"); -var canAttachTrace = util.canAttachTrace; -var unhandledRejectionHandled; -var possiblyUnhandledRejection; -var debugging = false || (util.isNode && - (!!process.env["BLUEBIRD_DEBUG"] || - process.env["NODE_ENV"] === "development")); - -if (debugging) { - async.disableTrampolineIfNecessary(); -} - -Promise.prototype._ensurePossibleRejectionHandled = function () { - this._setRejectionIsUnhandled(); - async.invokeLater(this._notifyUnhandledRejection, this, undefined); -}; - -Promise.prototype._notifyUnhandledRejectionIsHandled = function () { - CapturedTrace.fireRejectionEvent("rejectionHandled", - unhandledRejectionHandled, undefined, this); -}; - -Promise.prototype._notifyUnhandledRejection = function () { - if (this._isRejectionUnhandled()) { - var reason = this._getCarriedStackTrace() || this._settledValue; - this._setUnhandledRejectionIsNotified(); - CapturedTrace.fireRejectionEvent("unhandledRejection", - possiblyUnhandledRejection, reason, this); - } -}; - -Promise.prototype._setUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField | 524288; -}; - -Promise.prototype._unsetUnhandledRejectionIsNotified = function () { - this._bitField = this._bitField & (~524288); -}; - -Promise.prototype._isUnhandledRejectionNotified = function () { - return (this._bitField & 524288) > 0; -}; - -Promise.prototype._setRejectionIsUnhandled = function () { - this._bitField = this._bitField | 2097152; -}; - -Promise.prototype._unsetRejectionIsUnhandled = function () { - this._bitField = this._bitField & (~2097152); - if (this._isUnhandledRejectionNotified()) { - this._unsetUnhandledRejectionIsNotified(); - this._notifyUnhandledRejectionIsHandled(); - } -}; - -Promise.prototype._isRejectionUnhandled = function () { - return (this._bitField & 2097152) > 0; -}; - -Promise.prototype._setCarriedStackTrace = function (capturedTrace) { - this._bitField = this._bitField | 1048576; - this._fulfillmentHandler0 = capturedTrace; -}; - -Promise.prototype._isCarryingStackTrace = function () { - return (this._bitField & 1048576) > 0; -}; - -Promise.prototype._getCarriedStackTrace = function () { - return this._isCarryingStackTrace() - ? this._fulfillmentHandler0 - : undefined; -}; - -Promise.prototype._captureStackTrace = function () { - if (debugging) { - this._trace = new CapturedTrace(this._peekContext()); - } - return this; -}; - -Promise.prototype._attachExtraTrace = function (error, ignoreSelf) { - if (debugging && canAttachTrace(error)) { - var trace = this._trace; - if (trace !== undefined) { - if (ignoreSelf) trace = trace._parent; - } - if (trace !== undefined) { - trace.attachExtraTrace(error); - } else if (!error.__stackCleaned__) { - var parsed = CapturedTrace.parseStackAndMessage(error); - util.notEnumerableProp(error, "stack", - parsed.message + "\n" + parsed.stack.join("\n")); - util.notEnumerableProp(error, "__stackCleaned__", true); - } - } -}; - -Promise.prototype._warn = function(message) { - var warning = new Warning(message); - var ctx = this._peekContext(); - if (ctx) { - ctx.attachExtraTrace(warning); - } else { - var parsed = CapturedTrace.parseStackAndMessage(warning); - warning.stack = parsed.message + "\n" + parsed.stack.join("\n"); - } - CapturedTrace.formatAndLogError(warning, ""); -}; - -Promise.onPossiblyUnhandledRejection = function (fn) { - possiblyUnhandledRejection = typeof fn === "function" ? fn : undefined; -}; - -Promise.onUnhandledRejectionHandled = function (fn) { - unhandledRejectionHandled = typeof fn === "function" ? fn : undefined; -}; - -Promise.longStackTraces = function () { - if (async.haveItemsQueued() && - debugging === false - ) { - throw new Error("cannot enable long stack traces after promises have been created\u000a\u000a See http://goo.gl/DT1qyG\u000a"); - } - debugging = CapturedTrace.isSupported(); - if (debugging) { - async.disableTrampolineIfNecessary(); - } -}; - -Promise.hasLongStackTraces = function () { - return debugging && CapturedTrace.isSupported(); -}; - -if (!CapturedTrace.isSupported()) { - Promise.longStackTraces = function(){}; - debugging = false; -} - -return function() { - return debugging; -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js deleted file mode 100644 index 47a9ce9d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/direct_resolve.js +++ /dev/null @@ -1,62 +0,0 @@ -"use strict"; -var util = require("./util.js"); -var isPrimitive = util.isPrimitive; -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; - -module.exports = function(Promise) { -var returner = function () { - return this; -}; -var thrower = function () { - throw this; -}; -var returnUndefined = function() {}; -var throwUndefined = function() { - throw undefined; -}; - -var wrapper = function (value, action) { - if (action === 1) { - return function () { - throw value; - }; - } else if (action === 2) { - return function () { - return value; - }; - } -}; - - -Promise.prototype["return"] = -Promise.prototype.thenReturn = function (value) { - if (value === undefined) return this.then(returnUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(value)) { - return this._then( - wrapper(value, 2), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(returner, undefined, undefined, value, undefined); -}; - -Promise.prototype["throw"] = -Promise.prototype.thenThrow = function (reason) { - if (reason === undefined) return this.then(throwUndefined); - - if (wrapsPrimitiveReceiver && isPrimitive(reason)) { - return this._then( - wrapper(reason, 1), - undefined, - undefined, - undefined, - undefined - ); - } - return this._then(thrower, undefined, undefined, reason, undefined); -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js deleted file mode 100644 index a37e22c0..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/each.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseReduce = Promise.reduce; - -Promise.prototype.each = function (fn) { - return PromiseReduce(this, fn, null, INTERNAL); -}; - -Promise.each = function (promises, fn) { - return PromiseReduce(promises, fn, null, INTERNAL); -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js deleted file mode 100644 index c334bb1c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/errors.js +++ /dev/null @@ -1,111 +0,0 @@ -"use strict"; -var es5 = require("./es5.js"); -var Objectfreeze = es5.freeze; -var util = require("./util.js"); -var inherits = util.inherits; -var notEnumerableProp = util.notEnumerableProp; - -function subError(nameProperty, defaultMessage) { - function SubError(message) { - if (!(this instanceof SubError)) return new SubError(message); - notEnumerableProp(this, "message", - typeof message === "string" ? message : defaultMessage); - notEnumerableProp(this, "name", nameProperty); - if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } else { - Error.call(this); - } - } - inherits(SubError, Error); - return SubError; -} - -var _TypeError, _RangeError; -var Warning = subError("Warning", "warning"); -var CancellationError = subError("CancellationError", "cancellation error"); -var TimeoutError = subError("TimeoutError", "timeout error"); -var AggregateError = subError("AggregateError", "aggregate error"); -try { - _TypeError = TypeError; - _RangeError = RangeError; -} catch(e) { - _TypeError = subError("TypeError", "type error"); - _RangeError = subError("RangeError", "range error"); -} - -var methods = ("join pop push shift unshift slice filter forEach some " + - "every map indexOf lastIndexOf reduce reduceRight sort reverse").split(" "); - -for (var i = 0; i < methods.length; ++i) { - if (typeof Array.prototype[methods[i]] === "function") { - AggregateError.prototype[methods[i]] = Array.prototype[methods[i]]; - } -} - -es5.defineProperty(AggregateError.prototype, "length", { - value: 0, - configurable: false, - writable: true, - enumerable: true -}); -AggregateError.prototype["isOperational"] = true; -var level = 0; -AggregateError.prototype.toString = function() { - var indent = Array(level * 4 + 1).join(" "); - var ret = "\n" + indent + "AggregateError of:" + "\n"; - level++; - indent = Array(level * 4 + 1).join(" "); - for (var i = 0; i < this.length; ++i) { - var str = this[i] === this ? "[Circular AggregateError]" : this[i] + ""; - var lines = str.split("\n"); - for (var j = 0; j < lines.length; ++j) { - lines[j] = indent + lines[j]; - } - str = lines.join("\n"); - ret += str + "\n"; - } - level--; - return ret; -}; - -function OperationalError(message) { - if (!(this instanceof OperationalError)) - return new OperationalError(message); - notEnumerableProp(this, "name", "OperationalError"); - notEnumerableProp(this, "message", message); - this.cause = message; - this["isOperational"] = true; - - if (message instanceof Error) { - notEnumerableProp(this, "message", message.message); - notEnumerableProp(this, "stack", message.stack); - } else if (Error.captureStackTrace) { - Error.captureStackTrace(this, this.constructor); - } - -} -inherits(OperationalError, Error); - -var errorTypes = Error["__BluebirdErrorTypes__"]; -if (!errorTypes) { - errorTypes = Objectfreeze({ - CancellationError: CancellationError, - TimeoutError: TimeoutError, - OperationalError: OperationalError, - RejectionError: OperationalError, - AggregateError: AggregateError - }); - notEnumerableProp(Error, "__BluebirdErrorTypes__", errorTypes); -} - -module.exports = { - Error: Error, - TypeError: _TypeError, - RangeError: _RangeError, - CancellationError: errorTypes.CancellationError, - OperationalError: errorTypes.OperationalError, - TimeoutError: errorTypes.TimeoutError, - AggregateError: errorTypes.AggregateError, - Warning: Warning -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js deleted file mode 100644 index ea41d5a5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/es5.js +++ /dev/null @@ -1,80 +0,0 @@ -var isES5 = (function(){ - "use strict"; - return this === undefined; -})(); - -if (isES5) { - module.exports = { - freeze: Object.freeze, - defineProperty: Object.defineProperty, - getDescriptor: Object.getOwnPropertyDescriptor, - keys: Object.keys, - names: Object.getOwnPropertyNames, - getPrototypeOf: Object.getPrototypeOf, - isArray: Array.isArray, - isES5: isES5, - propertyIsWritable: function(obj, prop) { - var descriptor = Object.getOwnPropertyDescriptor(obj, prop); - return !!(!descriptor || descriptor.writable || descriptor.set); - } - }; -} else { - var has = {}.hasOwnProperty; - var str = {}.toString; - var proto = {}.constructor.prototype; - - var ObjectKeys = function (o) { - var ret = []; - for (var key in o) { - if (has.call(o, key)) { - ret.push(key); - } - } - return ret; - }; - - var ObjectGetDescriptor = function(o, key) { - return {value: o[key]}; - }; - - var ObjectDefineProperty = function (o, key, desc) { - o[key] = desc.value; - return o; - }; - - var ObjectFreeze = function (obj) { - return obj; - }; - - var ObjectGetPrototypeOf = function (obj) { - try { - return Object(obj).constructor.prototype; - } - catch (e) { - return proto; - } - }; - - var ArrayIsArray = function (obj) { - try { - return str.call(obj) === "[object Array]"; - } - catch(e) { - return false; - } - }; - - module.exports = { - isArray: ArrayIsArray, - keys: ObjectKeys, - names: ObjectKeys, - defineProperty: ObjectDefineProperty, - getDescriptor: ObjectGetDescriptor, - freeze: ObjectFreeze, - getPrototypeOf: ObjectGetPrototypeOf, - isES5: isES5, - propertyIsWritable: function() { - return true; - } - }; -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js deleted file mode 100644 index ed57bf01..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/filter.js +++ /dev/null @@ -1,12 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var PromiseMap = Promise.map; - -Promise.prototype.filter = function (fn, options) { - return PromiseMap(this, fn, options, INTERNAL); -}; - -Promise.filter = function (promises, fn, options) { - return PromiseMap(promises, fn, options, INTERNAL); -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js deleted file mode 100644 index ed84a2a1..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/finally.js +++ /dev/null @@ -1,99 +0,0 @@ -"use strict"; -module.exports = function(Promise, NEXT_FILTER, tryConvertToPromise) { -var util = require("./util.js"); -var wrapsPrimitiveReceiver = util.wrapsPrimitiveReceiver; -var isPrimitive = util.isPrimitive; -var thrower = util.thrower; - -function returnThis() { - return this; -} -function throwThis() { - throw this; -} -function return$(r) { - return function() { - return r; - }; -} -function throw$(r) { - return function() { - throw r; - }; -} -function promisedFinally(ret, reasonOrValue, isFulfilled) { - var then; - if (wrapsPrimitiveReceiver && isPrimitive(reasonOrValue)) { - then = isFulfilled ? return$(reasonOrValue) : throw$(reasonOrValue); - } else { - then = isFulfilled ? returnThis : throwThis; - } - return ret._then(then, thrower, undefined, reasonOrValue, undefined); -} - -function finallyHandler(reasonOrValue) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo) - : handler(); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, reasonOrValue, - promise.isFulfilled()); - } - } - - if (promise.isRejected()) { - NEXT_FILTER.e = reasonOrValue; - return NEXT_FILTER; - } else { - return reasonOrValue; - } -} - -function tapHandler(value) { - var promise = this.promise; - var handler = this.handler; - - var ret = promise._isBound() - ? handler.call(promise._boundTo, value) - : handler(value); - - if (ret !== undefined) { - var maybePromise = tryConvertToPromise(ret, promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - return promisedFinally(maybePromise, value, true); - } - } - return value; -} - -Promise.prototype._passThroughHandler = function (handler, isFinally) { - if (typeof handler !== "function") return this.then(); - - var promiseAndHandler = { - promise: this, - handler: handler - }; - - return this._then( - isFinally ? finallyHandler : tapHandler, - isFinally ? finallyHandler : undefined, undefined, - promiseAndHandler, undefined); -}; - -Promise.prototype.lastly = -Promise.prototype["finally"] = function (handler) { - return this._passThroughHandler(handler, true); -}; - -Promise.prototype.tap = function (handler) { - return this._passThroughHandler(handler, false); -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js deleted file mode 100644 index 4c0568d2..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/generators.js +++ /dev/null @@ -1,136 +0,0 @@ -"use strict"; -module.exports = function(Promise, - apiRejection, - INTERNAL, - tryConvertToPromise) { -var errors = require("./errors.js"); -var TypeError = errors.TypeError; -var util = require("./util.js"); -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -var yieldHandlers = []; - -function promiseFromYieldHandler(value, yieldHandlers, traceParent) { - for (var i = 0; i < yieldHandlers.length; ++i) { - traceParent._pushContext(); - var result = tryCatch(yieldHandlers[i])(value); - traceParent._popContext(); - if (result === errorObj) { - traceParent._pushContext(); - var ret = Promise.reject(errorObj.e); - traceParent._popContext(); - return ret; - } - var maybePromise = tryConvertToPromise(result, traceParent); - if (maybePromise instanceof Promise) return maybePromise; - } - return null; -} - -function PromiseSpawn(generatorFunction, receiver, yieldHandler, stack) { - var promise = this._promise = new Promise(INTERNAL); - promise._captureStackTrace(); - this._stack = stack; - this._generatorFunction = generatorFunction; - this._receiver = receiver; - this._generator = undefined; - this._yieldHandlers = typeof yieldHandler === "function" - ? [yieldHandler].concat(yieldHandlers) - : yieldHandlers; -} - -PromiseSpawn.prototype.promise = function () { - return this._promise; -}; - -PromiseSpawn.prototype._run = function () { - this._generator = this._generatorFunction.call(this._receiver); - this._receiver = - this._generatorFunction = undefined; - this._next(undefined); -}; - -PromiseSpawn.prototype._continue = function (result) { - if (result === errorObj) { - return this._promise._rejectCallback(result.e, false, true); - } - - var value = result.value; - if (result.done === true) { - this._promise._resolveCallback(value); - } else { - var maybePromise = tryConvertToPromise(value, this._promise); - if (!(maybePromise instanceof Promise)) { - maybePromise = - promiseFromYieldHandler(maybePromise, - this._yieldHandlers, - this._promise); - if (maybePromise === null) { - this._throw( - new TypeError( - "A value %s was yielded that could not be treated as a promise\u000a\u000a See http://goo.gl/4Y4pDk\u000a\u000a".replace("%s", value) + - "From coroutine:\u000a" + - this._stack.split("\n").slice(1, -7).join("\n") - ) - ); - return; - } - } - maybePromise._then( - this._next, - this._throw, - undefined, - this, - null - ); - } -}; - -PromiseSpawn.prototype._throw = function (reason) { - this._promise._attachExtraTrace(reason); - this._promise._pushContext(); - var result = tryCatch(this._generator["throw"]) - .call(this._generator, reason); - this._promise._popContext(); - this._continue(result); -}; - -PromiseSpawn.prototype._next = function (value) { - this._promise._pushContext(); - var result = tryCatch(this._generator.next).call(this._generator, value); - this._promise._popContext(); - this._continue(result); -}; - -Promise.coroutine = function (generatorFunction, options) { - if (typeof generatorFunction !== "function") { - throw new TypeError("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var yieldHandler = Object(options).yieldHandler; - var PromiseSpawn$ = PromiseSpawn; - var stack = new Error().stack; - return function () { - var generator = generatorFunction.apply(this, arguments); - var spawn = new PromiseSpawn$(undefined, undefined, yieldHandler, - stack); - spawn._generator = generator; - spawn._next(undefined); - return spawn.promise(); - }; -}; - -Promise.coroutine.addYieldHandler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - yieldHandlers.push(fn); -}; - -Promise.spawn = function (generatorFunction) { - if (typeof generatorFunction !== "function") { - return apiRejection("generatorFunction must be a function\u000a\u000a See http://goo.gl/6Vqhm0\u000a"); - } - var spawn = new PromiseSpawn(generatorFunction, this); - var ret = spawn.promise(); - spawn._run(Promise.spawn); - return ret; -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js deleted file mode 100644 index cf33eb1d..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/join.js +++ /dev/null @@ -1,107 +0,0 @@ -"use strict"; -module.exports = -function(Promise, PromiseArray, tryConvertToPromise, INTERNAL) { -var util = require("./util.js"); -var canEvaluate = util.canEvaluate; -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var reject; - -if (!false) { -if (canEvaluate) { - var thenCallback = function(i) { - return new Function("value", "holder", " \n\ - 'use strict'; \n\ - holder.pIndex = value; \n\ - holder.checkFulfillment(this); \n\ - ".replace(/Index/g, i)); - }; - - var caller = function(count) { - var values = []; - for (var i = 1; i <= count; ++i) values.push("holder.p" + i); - return new Function("holder", " \n\ - 'use strict'; \n\ - var callback = holder.fn; \n\ - return callback(values); \n\ - ".replace(/values/g, values.join(", "))); - }; - var thenCallbacks = []; - var callers = [undefined]; - for (var i = 1; i <= 5; ++i) { - thenCallbacks.push(thenCallback(i)); - callers.push(caller(i)); - } - - var Holder = function(total, fn) { - this.p1 = this.p2 = this.p3 = this.p4 = this.p5 = null; - this.fn = fn; - this.total = total; - this.now = 0; - }; - - Holder.prototype.callers = callers; - Holder.prototype.checkFulfillment = function(promise) { - var now = this.now; - now++; - var total = this.total; - if (now >= total) { - var handler = this.callers[total]; - promise._pushContext(); - var ret = tryCatch(handler)(this); - promise._popContext(); - if (ret === errorObj) { - promise._rejectCallback(ret.e, false, true); - } else { - promise._resolveCallback(ret); - } - } else { - this.now = now; - } - }; - - var reject = function (reason) { - this._reject(reason); - }; -} -} - -Promise.join = function () { - var last = arguments.length - 1; - var fn; - if (last > 0 && typeof arguments[last] === "function") { - fn = arguments[last]; - if (!false) { - if (last < 6 && canEvaluate) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - var holder = new Holder(last, fn); - var callbacks = thenCallbacks; - for (var i = 0; i < last; ++i) { - var maybePromise = tryConvertToPromise(arguments[i], ret); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._then(callbacks[i], reject, - undefined, ret, holder); - } else if (maybePromise._isFulfilled()) { - callbacks[i].call(ret, - maybePromise._value(), holder); - } else { - ret._reject(maybePromise._reason()); - } - } else { - callbacks[i].call(ret, maybePromise, holder); - } - } - return ret; - } - } - } - var $_len = arguments.length;var args = new Array($_len); for(var $_i = 0; $_i < $_len; ++$_i) {args[$_i] = arguments[$_i];} - if (fn) args.pop(); - var ret = new PromiseArray(args).promise(); - return fn !== undefined ? ret.spread(fn) : ret; -}; - -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js deleted file mode 100644 index 66a5b179..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/map.js +++ /dev/null @@ -1,131 +0,0 @@ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = require("./async.js"); -var util = require("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -var PENDING = {}; -var EMPTY_ARRAY = []; - -function MappingPromiseArray(promises, fn, limit, _filter) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._callback = fn; - this._preservedValues = _filter === INTERNAL - ? new Array(this.length()) - : null; - this._limit = limit; - this._inFlight = 0; - this._queue = limit >= 1 ? [] : EMPTY_ARRAY; - async.invoke(init, this, undefined); -} -util.inherits(MappingPromiseArray, PromiseArray); -function init() {this._init$(undefined, -2);} - -MappingPromiseArray.prototype._init = function () {}; - -MappingPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - var length = this.length(); - var preservedValues = this._preservedValues; - var limit = this._limit; - if (values[index] === PENDING) { - values[index] = value; - if (limit >= 1) { - this._inFlight--; - this._drainQueue(); - if (this._isResolved()) return; - } - } else { - if (limit >= 1 && this._inFlight >= limit) { - values[index] = value; - this._queue.push(index); - return; - } - if (preservedValues !== null) preservedValues[index] = value; - - var callback = this._callback; - var receiver = this._promise._boundTo; - this._promise._pushContext(); - var ret = tryCatch(callback).call(receiver, value, index, length); - this._promise._popContext(); - if (ret === errorObj) return this._reject(ret.e); - - var maybePromise = tryConvertToPromise(ret, this._promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - if (limit >= 1) this._inFlight++; - values[index] = PENDING; - return maybePromise._proxyPromiseArray(this, index); - } else if (maybePromise._isFulfilled()) { - ret = maybePromise._value(); - } else { - return this._reject(maybePromise._reason()); - } - } - values[index] = ret; - } - var totalResolved = ++this._totalResolved; - if (totalResolved >= length) { - if (preservedValues !== null) { - this._filter(values, preservedValues); - } else { - this._resolve(values); - } - - } -}; - -MappingPromiseArray.prototype._drainQueue = function () { - var queue = this._queue; - var limit = this._limit; - var values = this._values; - while (queue.length > 0 && this._inFlight < limit) { - if (this._isResolved()) return; - var index = queue.pop(); - this._promiseFulfilled(values[index], index); - } -}; - -MappingPromiseArray.prototype._filter = function (booleans, values) { - var len = values.length; - var ret = new Array(len); - var j = 0; - for (var i = 0; i < len; ++i) { - if (booleans[i]) ret[j++] = values[i]; - } - ret.length = j; - this._resolve(ret); -}; - -MappingPromiseArray.prototype.preservedValues = function () { - return this._preservedValues; -}; - -function map(promises, fn, options, _filter) { - var limit = typeof options === "object" && options !== null - ? options.concurrency - : 0; - limit = typeof limit === "number" && - isFinite(limit) && limit >= 1 ? limit : 0; - return new MappingPromiseArray(promises, fn, limit, _filter); -} - -Promise.prototype.map = function (fn, options) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - - return map(this, fn, options, null).promise(); -}; - -Promise.map = function (promises, fn, options, _filter) { - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - return map(promises, fn, options, _filter).promise(); -}; - - -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js deleted file mode 100644 index 3d3eeb17..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/method.js +++ /dev/null @@ -1,44 +0,0 @@ -"use strict"; -module.exports = -function(Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var util = require("./util.js"); -var tryCatch = util.tryCatch; - -Promise.method = function (fn) { - if (typeof fn !== "function") { - throw new Promise.TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - return function () { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = tryCatch(fn).apply(this, arguments); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; - }; -}; - -Promise.attempt = Promise["try"] = function (fn, args, ctx) { - if (typeof fn !== "function") { - return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._pushContext(); - var value = util.isArray(args) - ? tryCatch(fn).apply(ctx, args) - : tryCatch(fn).call(ctx, args); - ret._popContext(); - ret._resolveFromSyncValue(value); - return ret; -}; - -Promise.prototype._resolveFromSyncValue = function (value) { - if (value === util.errorObj) { - this._rejectCallback(value.e, false, true); - } else { - this._resolveCallback(value, true); - } -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js deleted file mode 100644 index f305b936..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/nodeify.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -var util = require("./util.js"); -var async = require("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -function spreadAdapter(val, nodeback) { - var promise = this; - if (!util.isArray(val)) return successAdapter.call(promise, val, nodeback); - var ret = tryCatch(nodeback).apply(promise._boundTo, [null].concat(val)); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -function successAdapter(val, nodeback) { - var promise = this; - var receiver = promise._boundTo; - var ret = val === undefined - ? tryCatch(nodeback).call(receiver, null) - : tryCatch(nodeback).call(receiver, null, val); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} -function errorAdapter(reason, nodeback) { - var promise = this; - if (!reason) { - var target = promise._target(); - var newReason = target._getCarriedStackTrace(); - newReason.cause = reason; - reason = newReason; - } - var ret = tryCatch(nodeback).call(promise._boundTo, reason); - if (ret === errorObj) { - async.throwLater(ret.e); - } -} - -Promise.prototype.asCallback = -Promise.prototype.nodeify = function (nodeback, options) { - if (typeof nodeback == "function") { - var adapter = successAdapter; - if (options !== undefined && Object(options).spread) { - adapter = spreadAdapter; - } - this._then( - adapter, - errorAdapter, - undefined, - this, - nodeback - ); - } - return this; -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js deleted file mode 100644 index 2e3e95e5..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/progress.js +++ /dev/null @@ -1,76 +0,0 @@ -"use strict"; -module.exports = function(Promise, PromiseArray) { -var util = require("./util.js"); -var async = require("./async.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; - -Promise.prototype.progressed = function (handler) { - return this._then(undefined, undefined, handler, undefined, undefined); -}; - -Promise.prototype._progress = function (progressValue) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._target()._progressUnchecked(progressValue); - -}; - -Promise.prototype._progressHandlerAt = function (index) { - return index === 0 - ? this._progressHandler0 - : this[(index << 2) + index - 5 + 2]; -}; - -Promise.prototype._doProgressWith = function (progression) { - var progressValue = progression.value; - var handler = progression.handler; - var promise = progression.promise; - var receiver = progression.receiver; - - var ret = tryCatch(handler).call(receiver, progressValue); - if (ret === errorObj) { - if (ret.e != null && - ret.e.name !== "StopProgressPropagation") { - var trace = util.canAttachTrace(ret.e) - ? ret.e : new Error(util.toString(ret.e)); - promise._attachExtraTrace(trace); - promise._progress(ret.e); - } - } else if (ret instanceof Promise) { - ret._then(promise._progress, null, null, promise, undefined); - } else { - promise._progress(ret); - } -}; - - -Promise.prototype._progressUnchecked = function (progressValue) { - var len = this._length(); - var progress = this._progress; - for (var i = 0; i < len; i++) { - var handler = this._progressHandlerAt(i); - var promise = this._promiseAt(i); - if (!(promise instanceof Promise)) { - var receiver = this._receiverAt(i); - if (typeof handler === "function") { - handler.call(receiver, progressValue, promise); - } else if (receiver instanceof PromiseArray && - !receiver._isResolved()) { - receiver._promiseProgressed(progressValue, promise); - } - continue; - } - - if (typeof handler === "function") { - async.invoke(this._doProgressWith, this, { - handler: handler, - promise: promise, - receiver: this._receiverAt(i), - value: progressValue - }); - } else { - async.invoke(progress, promise, progressValue); - } - } -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js deleted file mode 100644 index f80d247b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise.js +++ /dev/null @@ -1,700 +0,0 @@ -"use strict"; -module.exports = function() { -var makeSelfResolutionError = function () { - return new TypeError("circular promise resolution chain\u000a\u000a See http://goo.gl/LhFpo0\u000a"); -}; -var reflect = function() { - return new Promise.PromiseInspection(this._target()); -}; -var apiRejection = function(msg) { - return Promise.reject(new TypeError(msg)); -}; -var util = require("./util.js"); -var async = require("./async.js"); -var errors = require("./errors.js"); -var TypeError = Promise.TypeError = errors.TypeError; -Promise.RangeError = errors.RangeError; -Promise.CancellationError = errors.CancellationError; -Promise.TimeoutError = errors.TimeoutError; -Promise.OperationalError = errors.OperationalError; -Promise.RejectionError = errors.OperationalError; -Promise.AggregateError = errors.AggregateError; -var INTERNAL = function(){}; -var APPLY = {}; -var NEXT_FILTER = {e: null}; -var tryConvertToPromise = require("./thenables.js")(Promise, INTERNAL); -var PromiseArray = - require("./promise_array.js")(Promise, INTERNAL, - tryConvertToPromise, apiRejection); -var CapturedTrace = require("./captured_trace.js")(); -var isDebugging = require("./debuggability.js")(Promise, CapturedTrace); - /*jshint unused:false*/ -var createContext = - require("./context.js")(Promise, CapturedTrace, isDebugging); -var CatchFilter = require("./catch_filter.js")(NEXT_FILTER); -var PromiseResolver = require("./promise_resolver.js"); -var nodebackForPromise = PromiseResolver._nodebackForPromise; -var errorObj = util.errorObj; -var tryCatch = util.tryCatch; -function Promise(resolver) { - if (typeof resolver !== "function") { - throw new TypeError("the promise constructor requires a resolver function\u000a\u000a See http://goo.gl/EC22Yn\u000a"); - } - if (this.constructor !== Promise) { - throw new TypeError("the promise constructor cannot be invoked directly\u000a\u000a See http://goo.gl/KsIlge\u000a"); - } - this._bitField = 0; - this._fulfillmentHandler0 = undefined; - this._rejectionHandler0 = undefined; - this._progressHandler0 = undefined; - this._promise0 = undefined; - this._receiver0 = undefined; - this._settledValue = undefined; - if (resolver !== INTERNAL) this._resolveFromResolver(resolver); -} - -Promise.prototype.toString = function () { - return "[object Promise]"; -}; - -Promise.prototype.caught = Promise.prototype["catch"] = function (fn) { - var len = arguments.length; - if (len > 1) { - var catchInstances = new Array(len - 1), - j = 0, i; - for (i = 0; i < len - 1; ++i) { - var item = arguments[i]; - if (typeof item === "function") { - catchInstances[j++] = item; - } else { - return Promise.reject( - new TypeError("Catch filter must inherit from Error or be a simple predicate function\u000a\u000a See http://goo.gl/o84o68\u000a")); - } - } - catchInstances.length = j; - fn = arguments[i]; - var catchFilter = new CatchFilter(catchInstances, fn, this); - return this._then(undefined, catchFilter.doFilter, undefined, - catchFilter, undefined); - } - return this._then(undefined, fn, undefined, undefined, undefined); -}; - -Promise.prototype.reflect = function () { - return this._then(reflect, reflect, undefined, this, undefined); -}; - -Promise.prototype.then = function (didFulfill, didReject, didProgress) { - if (isDebugging() && arguments.length > 0 && - typeof didFulfill !== "function" && - typeof didReject !== "function") { - var msg = ".then() only accepts functions but was passed: " + - util.classString(didFulfill); - if (arguments.length > 1) { - msg += ", " + util.classString(didReject); - } - this._warn(msg); - } - return this._then(didFulfill, didReject, didProgress, - undefined, undefined); -}; - -Promise.prototype.done = function (didFulfill, didReject, didProgress) { - var promise = this._then(didFulfill, didReject, didProgress, - undefined, undefined); - promise._setIsFinal(); -}; - -Promise.prototype.spread = function (didFulfill, didReject) { - return this.all()._then(didFulfill, didReject, undefined, APPLY, undefined); -}; - -Promise.prototype.isCancellable = function () { - return !this.isResolved() && - this._cancellable(); -}; - -Promise.prototype.toJSON = function () { - var ret = { - isFulfilled: false, - isRejected: false, - fulfillmentValue: undefined, - rejectionReason: undefined - }; - if (this.isFulfilled()) { - ret.fulfillmentValue = this.value(); - ret.isFulfilled = true; - } else if (this.isRejected()) { - ret.rejectionReason = this.reason(); - ret.isRejected = true; - } - return ret; -}; - -Promise.prototype.all = function () { - return new PromiseArray(this).promise(); -}; - -Promise.prototype.error = function (fn) { - return this.caught(util.originatesFromRejection, fn); -}; - -Promise.is = function (val) { - return val instanceof Promise; -}; - -Promise.fromNode = function(fn) { - var ret = new Promise(INTERNAL); - var result = tryCatch(fn)(nodebackForPromise(ret)); - if (result === errorObj) { - ret._rejectCallback(result.e, true, true); - } - return ret; -}; - -Promise.all = function (promises) { - return new PromiseArray(promises).promise(); -}; - -Promise.defer = Promise.pending = function () { - var promise = new Promise(INTERNAL); - return new PromiseResolver(promise); -}; - -Promise.cast = function (obj) { - var ret = tryConvertToPromise(obj); - if (!(ret instanceof Promise)) { - var val = ret; - ret = new Promise(INTERNAL); - ret._fulfillUnchecked(val); - } - return ret; -}; - -Promise.resolve = Promise.fulfilled = Promise.cast; - -Promise.reject = Promise.rejected = function (reason) { - var ret = new Promise(INTERNAL); - ret._captureStackTrace(); - ret._rejectCallback(reason, true); - return ret; -}; - -Promise.setScheduler = function(fn) { - if (typeof fn !== "function") throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - var prev = async._schedule; - async._schedule = fn; - return prev; -}; - -Promise.prototype._then = function ( - didFulfill, - didReject, - didProgress, - receiver, - internalData -) { - var haveInternalData = internalData !== undefined; - var ret = haveInternalData ? internalData : new Promise(INTERNAL); - - if (!haveInternalData) { - ret._propagateFrom(this, 4 | 1); - ret._captureStackTrace(); - } - - var target = this._target(); - if (target !== this) { - if (receiver === undefined) receiver = this._boundTo; - if (!haveInternalData) ret._setIsMigrated(); - } - - var callbackIndex = - target._addCallbacks(didFulfill, didReject, didProgress, ret, receiver); - - if (target._isResolved() && !target._isSettlePromisesQueued()) { - async.invoke( - target._settlePromiseAtPostResolution, target, callbackIndex); - } - - return ret; -}; - -Promise.prototype._settlePromiseAtPostResolution = function (index) { - if (this._isRejectionUnhandled()) this._unsetRejectionIsUnhandled(); - this._settlePromiseAt(index); -}; - -Promise.prototype._length = function () { - return this._bitField & 131071; -}; - -Promise.prototype._isFollowingOrFulfilledOrRejected = function () { - return (this._bitField & 939524096) > 0; -}; - -Promise.prototype._isFollowing = function () { - return (this._bitField & 536870912) === 536870912; -}; - -Promise.prototype._setLength = function (len) { - this._bitField = (this._bitField & -131072) | - (len & 131071); -}; - -Promise.prototype._setFulfilled = function () { - this._bitField = this._bitField | 268435456; -}; - -Promise.prototype._setRejected = function () { - this._bitField = this._bitField | 134217728; -}; - -Promise.prototype._setFollowing = function () { - this._bitField = this._bitField | 536870912; -}; - -Promise.prototype._setIsFinal = function () { - this._bitField = this._bitField | 33554432; -}; - -Promise.prototype._isFinal = function () { - return (this._bitField & 33554432) > 0; -}; - -Promise.prototype._cancellable = function () { - return (this._bitField & 67108864) > 0; -}; - -Promise.prototype._setCancellable = function () { - this._bitField = this._bitField | 67108864; -}; - -Promise.prototype._unsetCancellable = function () { - this._bitField = this._bitField & (~67108864); -}; - -Promise.prototype._setIsMigrated = function () { - this._bitField = this._bitField | 4194304; -}; - -Promise.prototype._unsetIsMigrated = function () { - this._bitField = this._bitField & (~4194304); -}; - -Promise.prototype._isMigrated = function () { - return (this._bitField & 4194304) > 0; -}; - -Promise.prototype._receiverAt = function (index) { - var ret = index === 0 - ? this._receiver0 - : this[ - index * 5 - 5 + 4]; - if (ret === undefined && this._isBound()) { - return this._boundTo; - } - return ret; -}; - -Promise.prototype._promiseAt = function (index) { - return index === 0 - ? this._promise0 - : this[index * 5 - 5 + 3]; -}; - -Promise.prototype._fulfillmentHandlerAt = function (index) { - return index === 0 - ? this._fulfillmentHandler0 - : this[index * 5 - 5 + 0]; -}; - -Promise.prototype._rejectionHandlerAt = function (index) { - return index === 0 - ? this._rejectionHandler0 - : this[index * 5 - 5 + 1]; -}; - -Promise.prototype._migrateCallbacks = function (follower, index) { - var fulfill = follower._fulfillmentHandlerAt(index); - var reject = follower._rejectionHandlerAt(index); - var progress = follower._progressHandlerAt(index); - var promise = follower._promiseAt(index); - var receiver = follower._receiverAt(index); - if (promise instanceof Promise) promise._setIsMigrated(); - this._addCallbacks(fulfill, reject, progress, promise, receiver); -}; - -Promise.prototype._addCallbacks = function ( - fulfill, - reject, - progress, - promise, - receiver -) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - - if (index === 0) { - this._promise0 = promise; - if (receiver !== undefined) this._receiver0 = receiver; - if (typeof fulfill === "function" && !this._isCarryingStackTrace()) - this._fulfillmentHandler0 = fulfill; - if (typeof reject === "function") this._rejectionHandler0 = reject; - if (typeof progress === "function") this._progressHandler0 = progress; - } else { - var base = index * 5 - 5; - this[base + 3] = promise; - this[base + 4] = receiver; - if (typeof fulfill === "function") - this[base + 0] = fulfill; - if (typeof reject === "function") - this[base + 1] = reject; - if (typeof progress === "function") - this[base + 2] = progress; - } - this._setLength(index + 1); - return index; -}; - -Promise.prototype._setProxyHandlers = function (receiver, promiseSlotValue) { - var index = this._length(); - - if (index >= 131071 - 5) { - index = 0; - this._setLength(0); - } - if (index === 0) { - this._promise0 = promiseSlotValue; - this._receiver0 = receiver; - } else { - var base = index * 5 - 5; - this[base + 3] = promiseSlotValue; - this[base + 4] = receiver; - } - this._setLength(index + 1); -}; - -Promise.prototype._proxyPromiseArray = function (promiseArray, index) { - this._setProxyHandlers(promiseArray, index); -}; - -Promise.prototype._resolveCallback = function(value, shouldBind) { - if (this._isFollowingOrFulfilledOrRejected()) return; - if (value === this) - return this._rejectCallback(makeSelfResolutionError(), false, true); - var maybePromise = tryConvertToPromise(value, this); - if (!(maybePromise instanceof Promise)) return this._fulfill(value); - - var propagationFlags = 1 | (shouldBind ? 4 : 0); - this._propagateFrom(maybePromise, propagationFlags); - var promise = maybePromise._target(); - if (promise._isPending()) { - var len = this._length(); - for (var i = 0; i < len; ++i) { - promise._migrateCallbacks(this, i); - } - this._setFollowing(); - this._setLength(0); - this._setFollowee(promise); - } else if (promise._isFulfilled()) { - this._fulfillUnchecked(promise._value()); - } else { - this._rejectUnchecked(promise._reason(), - promise._getCarriedStackTrace()); - } -}; - -Promise.prototype._rejectCallback = -function(reason, synchronous, shouldNotMarkOriginatingFromRejection) { - if (!shouldNotMarkOriginatingFromRejection) { - util.markAsOriginatingFromRejection(reason); - } - var trace = util.ensureErrorObject(reason); - var hasStack = trace === reason; - this._attachExtraTrace(trace, synchronous ? hasStack : false); - this._reject(reason, hasStack ? undefined : trace); -}; - -Promise.prototype._resolveFromResolver = function (resolver) { - var promise = this; - this._captureStackTrace(); - this._pushContext(); - var synchronous = true; - var r = tryCatch(resolver)(function(value) { - if (promise === null) return; - promise._resolveCallback(value); - promise = null; - }, function (reason) { - if (promise === null) return; - promise._rejectCallback(reason, synchronous); - promise = null; - }); - synchronous = false; - this._popContext(); - - if (r !== undefined && r === errorObj && promise !== null) { - promise._rejectCallback(r.e, true, true); - promise = null; - } -}; - -Promise.prototype._settlePromiseFromHandler = function ( - handler, receiver, value, promise -) { - if (promise._isRejected()) return; - promise._pushContext(); - var x; - if (receiver === APPLY && !this._isRejected()) { - x = tryCatch(handler).apply(this._boundTo, value); - } else { - x = tryCatch(handler).call(receiver, value); - } - promise._popContext(); - - if (x === errorObj || x === promise || x === NEXT_FILTER) { - var err = x === promise ? makeSelfResolutionError() : x.e; - promise._rejectCallback(err, false, true); - } else { - promise._resolveCallback(x); - } -}; - -Promise.prototype._target = function() { - var ret = this; - while (ret._isFollowing()) ret = ret._followee(); - return ret; -}; - -Promise.prototype._followee = function() { - return this._rejectionHandler0; -}; - -Promise.prototype._setFollowee = function(promise) { - this._rejectionHandler0 = promise; -}; - -Promise.prototype._cleanValues = function () { - if (this._cancellable()) { - this._cancellationParent = undefined; - } -}; - -Promise.prototype._propagateFrom = function (parent, flags) { - if ((flags & 1) > 0 && parent._cancellable()) { - this._setCancellable(); - this._cancellationParent = parent; - } - if ((flags & 4) > 0 && parent._isBound()) { - this._setBoundTo(parent._boundTo); - } -}; - -Promise.prototype._fulfill = function (value) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._fulfillUnchecked(value); -}; - -Promise.prototype._reject = function (reason, carriedStackTrace) { - if (this._isFollowingOrFulfilledOrRejected()) return; - this._rejectUnchecked(reason, carriedStackTrace); -}; - -Promise.prototype._settlePromiseAt = function (index) { - var promise = this._promiseAt(index); - var isPromise = promise instanceof Promise; - - if (isPromise && promise._isMigrated()) { - promise._unsetIsMigrated(); - return async.invoke(this._settlePromiseAt, this, index); - } - var handler = this._isFulfilled() - ? this._fulfillmentHandlerAt(index) - : this._rejectionHandlerAt(index); - - var carriedStackTrace = - this._isCarryingStackTrace() ? this._getCarriedStackTrace() : undefined; - var value = this._settledValue; - var receiver = this._receiverAt(index); - - - this._clearCallbackDataAtIndex(index); - - if (typeof handler === "function") { - if (!isPromise) { - handler.call(receiver, value, promise); - } else { - this._settlePromiseFromHandler(handler, receiver, value, promise); - } - } else if (receiver instanceof PromiseArray) { - if (!receiver._isResolved()) { - if (this._isFulfilled()) { - receiver._promiseFulfilled(value, promise); - } - else { - receiver._promiseRejected(value, promise); - } - } - } else if (isPromise) { - if (this._isFulfilled()) { - promise._fulfill(value); - } else { - promise._reject(value, carriedStackTrace); - } - } - - if (index >= 4 && (index & 31) === 4) - async.invokeLater(this._setLength, this, 0); -}; - -Promise.prototype._clearCallbackDataAtIndex = function(index) { - if (index === 0) { - if (!this._isCarryingStackTrace()) { - this._fulfillmentHandler0 = undefined; - } - this._rejectionHandler0 = - this._progressHandler0 = - this._receiver0 = - this._promise0 = undefined; - } else { - var base = index * 5 - 5; - this[base + 3] = - this[base + 4] = - this[base + 0] = - this[base + 1] = - this[base + 2] = undefined; - } -}; - -Promise.prototype._isSettlePromisesQueued = function () { - return (this._bitField & - -1073741824) === -1073741824; -}; - -Promise.prototype._setSettlePromisesQueued = function () { - this._bitField = this._bitField | -1073741824; -}; - -Promise.prototype._unsetSettlePromisesQueued = function () { - this._bitField = this._bitField & (~-1073741824); -}; - -Promise.prototype._queueSettlePromises = function() { - async.settlePromises(this); - this._setSettlePromisesQueued(); -}; - -Promise.prototype._fulfillUnchecked = function (value) { - if (value === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err, undefined); - } - this._setFulfilled(); - this._settledValue = value; - this._cleanValues(); - - if (this._length() > 0) { - this._queueSettlePromises(); - } -}; - -Promise.prototype._rejectUncheckedCheckError = function (reason) { - var trace = util.ensureErrorObject(reason); - this._rejectUnchecked(reason, trace === reason ? undefined : trace); -}; - -Promise.prototype._rejectUnchecked = function (reason, trace) { - if (reason === this) { - var err = makeSelfResolutionError(); - this._attachExtraTrace(err); - return this._rejectUnchecked(err); - } - this._setRejected(); - this._settledValue = reason; - this._cleanValues(); - - if (this._isFinal()) { - async.throwLater(function(e) { - if ("stack" in e) { - async.invokeFirst( - CapturedTrace.unhandledRejection, undefined, e); - } - throw e; - }, trace === undefined ? reason : trace); - return; - } - - if (trace !== undefined && trace !== reason) { - this._setCarriedStackTrace(trace); - } - - if (this._length() > 0) { - this._queueSettlePromises(); - } else { - this._ensurePossibleRejectionHandled(); - } -}; - -Promise.prototype._settlePromises = function () { - this._unsetSettlePromisesQueued(); - var len = this._length(); - for (var i = 0; i < len; i++) { - this._settlePromiseAt(i); - } -}; - -Promise._makeSelfResolutionError = makeSelfResolutionError; -require("./progress.js")(Promise, PromiseArray); -require("./method.js")(Promise, INTERNAL, tryConvertToPromise, apiRejection); -require("./bind.js")(Promise, INTERNAL, tryConvertToPromise); -require("./finally.js")(Promise, NEXT_FILTER, tryConvertToPromise); -require("./direct_resolve.js")(Promise); -require("./synchronous_inspection.js")(Promise); -require("./join.js")(Promise, PromiseArray, tryConvertToPromise, INTERNAL); -Promise.Promise = Promise; -require('./map.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -require('./cancel.js')(Promise); -require('./using.js')(Promise, apiRejection, tryConvertToPromise, createContext); -require('./generators.js')(Promise, apiRejection, INTERNAL, tryConvertToPromise); -require('./nodeify.js')(Promise); -require('./call_get.js')(Promise); -require('./props.js')(Promise, PromiseArray, tryConvertToPromise, apiRejection); -require('./race.js')(Promise, INTERNAL, tryConvertToPromise, apiRejection); -require('./reduce.js')(Promise, PromiseArray, apiRejection, tryConvertToPromise, INTERNAL); -require('./settle.js')(Promise, PromiseArray); -require('./some.js')(Promise, PromiseArray, apiRejection); -require('./promisify.js')(Promise, INTERNAL); -require('./any.js')(Promise); -require('./each.js')(Promise, INTERNAL); -require('./timers.js')(Promise, INTERNAL); -require('./filter.js')(Promise, INTERNAL); - - util.toFastProperties(Promise); - util.toFastProperties(Promise.prototype); - function fillTypes(value) { - var p = new Promise(INTERNAL); - p._fulfillmentHandler0 = value; - p._rejectionHandler0 = value; - p._progressHandler0 = value; - p._promise0 = value; - p._receiver0 = value; - p._settledValue = value; - } - // Complete slack tracking, opt out of field-type tracking and - // stabilize map - fillTypes({a: 1}); - fillTypes({b: 2}); - fillTypes({c: 3}); - fillTypes(1); - fillTypes(function(){}); - fillTypes(undefined); - fillTypes(false); - fillTypes(new Promise(INTERNAL)); - CapturedTrace.setBounds(async.firstLineError, util.lastLineError); - return Promise; - -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js deleted file mode 100644 index 6dac8664..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_array.js +++ /dev/null @@ -1,142 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL, tryConvertToPromise, - apiRejection) { -var util = require("./util.js"); -var isArray = util.isArray; - -function toResolutionValue(val) { - switch(val) { - case -2: return []; - case -3: return {}; - } -} - -function PromiseArray(values) { - var promise = this._promise = new Promise(INTERNAL); - var parent; - if (values instanceof Promise) { - parent = values; - promise._propagateFrom(parent, 1 | 4); - } - this._values = values; - this._length = 0; - this._totalResolved = 0; - this._init(undefined, -2); -} -PromiseArray.prototype.length = function () { - return this._length; -}; - -PromiseArray.prototype.promise = function () { - return this._promise; -}; - -PromiseArray.prototype._init = function init(_, resolveValueIfEmpty) { - var values = tryConvertToPromise(this._values, this._promise); - if (values instanceof Promise) { - values = values._target(); - this._values = values; - if (values._isFulfilled()) { - values = values._value(); - if (!isArray(values)) { - var err = new Promise.TypeError("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - this.__hardReject__(err); - return; - } - } else if (values._isPending()) { - values._then( - init, - this._reject, - undefined, - this, - resolveValueIfEmpty - ); - return; - } else { - this._reject(values._reason()); - return; - } - } else if (!isArray(values)) { - this._promise._reject(apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a")._reason()); - return; - } - - if (values.length === 0) { - if (resolveValueIfEmpty === -5) { - this._resolveEmptyArray(); - } - else { - this._resolve(toResolutionValue(resolveValueIfEmpty)); - } - return; - } - var len = this.getActualLength(values.length); - this._length = len; - this._values = this.shouldCopyValues() ? new Array(len) : this._values; - var promise = this._promise; - for (var i = 0; i < len; ++i) { - var isResolved = this._isResolved(); - var maybePromise = tryConvertToPromise(values[i], promise); - if (maybePromise instanceof Promise) { - maybePromise = maybePromise._target(); - if (isResolved) { - maybePromise._unsetRejectionIsUnhandled(); - } else if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, i); - } else if (maybePromise._isFulfilled()) { - this._promiseFulfilled(maybePromise._value(), i); - } else { - this._promiseRejected(maybePromise._reason(), i); - } - } else if (!isResolved) { - this._promiseFulfilled(maybePromise, i); - } - } -}; - -PromiseArray.prototype._isResolved = function () { - return this._values === null; -}; - -PromiseArray.prototype._resolve = function (value) { - this._values = null; - this._promise._fulfill(value); -}; - -PromiseArray.prototype.__hardReject__ = -PromiseArray.prototype._reject = function (reason) { - this._values = null; - this._promise._rejectCallback(reason, false, true); -}; - -PromiseArray.prototype._promiseProgressed = function (progressValue, index) { - this._promise._progress({ - index: index, - value: progressValue - }); -}; - - -PromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -PromiseArray.prototype._promiseRejected = function (reason, index) { - this._totalResolved++; - this._reject(reason); -}; - -PromiseArray.prototype.shouldCopyValues = function () { - return true; -}; - -PromiseArray.prototype.getActualLength = function (len) { - return len; -}; - -return PromiseArray; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js deleted file mode 100644 index b180a328..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promise_resolver.js +++ /dev/null @@ -1,123 +0,0 @@ -"use strict"; -var util = require("./util.js"); -var maybeWrapAsError = util.maybeWrapAsError; -var errors = require("./errors.js"); -var TimeoutError = errors.TimeoutError; -var OperationalError = errors.OperationalError; -var haveGetters = util.haveGetters; -var es5 = require("./es5.js"); - -function isUntypedError(obj) { - return obj instanceof Error && - es5.getPrototypeOf(obj) === Error.prototype; -} - -var rErrorKey = /^(?:name|message|stack|cause)$/; -function wrapAsOperationalError(obj) { - var ret; - if (isUntypedError(obj)) { - ret = new OperationalError(obj); - ret.name = obj.name; - ret.message = obj.message; - ret.stack = obj.stack; - var keys = es5.keys(obj); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (!rErrorKey.test(key)) { - ret[key] = obj[key]; - } - } - return ret; - } - util.markAsOriginatingFromRejection(obj); - return obj; -} - -function nodebackForPromise(promise) { - return function(err, value) { - if (promise === null) return; - - if (err) { - var wrapped = wrapAsOperationalError(maybeWrapAsError(err)); - promise._attachExtraTrace(wrapped); - promise._reject(wrapped); - } else if (arguments.length > 2) { - var $_len = arguments.length;var args = new Array($_len - 1); for(var $_i = 1; $_i < $_len; ++$_i) {args[$_i - 1] = arguments[$_i];} - promise._fulfill(args); - } else { - promise._fulfill(value); - } - - promise = null; - }; -} - - -var PromiseResolver; -if (!haveGetters) { - PromiseResolver = function (promise) { - this.promise = promise; - this.asCallback = nodebackForPromise(promise); - this.callback = this.asCallback; - }; -} -else { - PromiseResolver = function (promise) { - this.promise = promise; - }; -} -if (haveGetters) { - var prop = { - get: function() { - return nodebackForPromise(this.promise); - } - }; - es5.defineProperty(PromiseResolver.prototype, "asCallback", prop); - es5.defineProperty(PromiseResolver.prototype, "callback", prop); -} - -PromiseResolver._nodebackForPromise = nodebackForPromise; - -PromiseResolver.prototype.toString = function () { - return "[object PromiseResolver]"; -}; - -PromiseResolver.prototype.resolve = -PromiseResolver.prototype.fulfill = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._resolveCallback(value); -}; - -PromiseResolver.prototype.reject = function (reason) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._rejectCallback(reason); -}; - -PromiseResolver.prototype.progress = function (value) { - if (!(this instanceof PromiseResolver)) { - throw new TypeError("Illegal invocation, resolver resolve/reject must be called within a resolver context. Consider using the promise constructor instead.\u000a\u000a See http://goo.gl/sdkXL9\u000a"); - } - this.promise._progress(value); -}; - -PromiseResolver.prototype.cancel = function (err) { - this.promise.cancel(err); -}; - -PromiseResolver.prototype.timeout = function () { - this.reject(new TimeoutError("timeout")); -}; - -PromiseResolver.prototype.isResolved = function () { - return this.promise.isResolved(); -}; - -PromiseResolver.prototype.toJSON = function () { - return this.promise.toJSON(); -}; - -module.exports = PromiseResolver; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js deleted file mode 100644 index 03553445..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/promisify.js +++ /dev/null @@ -1,291 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var THIS = {}; -var util = require("./util.js"); -var nodebackForPromise = require("./promise_resolver.js") - ._nodebackForPromise; -var withAppended = util.withAppended; -var maybeWrapAsError = util.maybeWrapAsError; -var canEvaluate = util.canEvaluate; -var TypeError = require("./errors").TypeError; -var defaultSuffix = "Async"; -var defaultPromisified = {__isPromisified__: true}; -var noCopyPropsPattern = - /^(?:length|name|arguments|caller|callee|prototype|__isPromisified__)$/; -var defaultFilter = function(name, func) { - return util.isIdentifier(name) && - name.charAt(0) !== "_" && - !util.isClass(func); -}; - -function propsFilter(key) { - return !noCopyPropsPattern.test(key); -} - -function isPromisified(fn) { - try { - return fn.__isPromisified__ === true; - } - catch (e) { - return false; - } -} - -function hasPromisified(obj, key, suffix) { - var val = util.getDataPropertyOrDefault(obj, key + suffix, - defaultPromisified); - return val ? isPromisified(val) : false; -} -function checkValid(ret, suffix, suffixRegexp) { - for (var i = 0; i < ret.length; i += 2) { - var key = ret[i]; - if (suffixRegexp.test(key)) { - var keyWithoutAsyncSuffix = key.replace(suffixRegexp, ""); - for (var j = 0; j < ret.length; j += 2) { - if (ret[j] === keyWithoutAsyncSuffix) { - throw new TypeError("Cannot promisify an API that has normal methods with '%s'-suffix\u000a\u000a See http://goo.gl/iWrZbw\u000a" - .replace("%s", suffix)); - } - } - } - } -} - -function promisifiableMethods(obj, suffix, suffixRegexp, filter) { - var keys = util.inheritedDataKeys(obj); - var ret = []; - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - var value = obj[key]; - var passesDefaultFilter = filter === defaultFilter - ? true : defaultFilter(key, value, obj); - if (typeof value === "function" && - !isPromisified(value) && - !hasPromisified(obj, key, suffix) && - filter(key, value, obj, passesDefaultFilter)) { - ret.push(key, value); - } - } - checkValid(ret, suffix, suffixRegexp); - return ret; -} - -var escapeIdentRegex = function(str) { - return str.replace(/([$])/, "\\$"); -}; - -var makeNodePromisifiedEval; -if (!false) { -var switchCaseArgumentOrder = function(likelyArgumentCount) { - var ret = [likelyArgumentCount]; - var min = Math.max(0, likelyArgumentCount - 1 - 3); - for(var i = likelyArgumentCount - 1; i >= min; --i) { - ret.push(i); - } - for(var i = likelyArgumentCount + 1; i <= 3; ++i) { - ret.push(i); - } - return ret; -}; - -var argumentSequence = function(argumentCount) { - return util.filledRange(argumentCount, "_arg", ""); -}; - -var parameterDeclaration = function(parameterCount) { - return util.filledRange( - Math.max(parameterCount, 3), "_arg", ""); -}; - -var parameterCount = function(fn) { - if (typeof fn.length === "number") { - return Math.max(Math.min(fn.length, 1023 + 1), 0); - } - return 0; -}; - -makeNodePromisifiedEval = -function(callback, receiver, originalName, fn) { - var newParameterCount = Math.max(0, parameterCount(fn) - 1); - var argumentOrder = switchCaseArgumentOrder(newParameterCount); - var shouldProxyThis = typeof callback === "string" || receiver === THIS; - - function generateCallForArgumentCount(count) { - var args = argumentSequence(count).join(", "); - var comma = count > 0 ? ", " : ""; - var ret; - if (shouldProxyThis) { - ret = "ret = callback.call(this, {{args}}, nodeback); break;\n"; - } else { - ret = receiver === undefined - ? "ret = callback({{args}}, nodeback); break;\n" - : "ret = callback.call(receiver, {{args}}, nodeback); break;\n"; - } - return ret.replace("{{args}}", args).replace(", ", comma); - } - - function generateArgumentSwitchCase() { - var ret = ""; - for (var i = 0; i < argumentOrder.length; ++i) { - ret += "case " + argumentOrder[i] +":" + - generateCallForArgumentCount(argumentOrder[i]); - } - - ret += " \n\ - default: \n\ - var args = new Array(len + 1); \n\ - var i = 0; \n\ - for (var i = 0; i < len; ++i) { \n\ - args[i] = arguments[i]; \n\ - } \n\ - args[i] = nodeback; \n\ - [CodeForCall] \n\ - break; \n\ - ".replace("[CodeForCall]", (shouldProxyThis - ? "ret = callback.apply(this, args);\n" - : "ret = callback.apply(receiver, args);\n")); - return ret; - } - - var getFunctionCode = typeof callback === "string" - ? ("this != null ? this['"+callback+"'] : fn") - : "fn"; - - return new Function("Promise", - "fn", - "receiver", - "withAppended", - "maybeWrapAsError", - "nodebackForPromise", - "tryCatch", - "errorObj", - "INTERNAL","'use strict'; \n\ - var ret = function (Parameters) { \n\ - 'use strict'; \n\ - var len = arguments.length; \n\ - var promise = new Promise(INTERNAL); \n\ - promise._captureStackTrace(); \n\ - var nodeback = nodebackForPromise(promise); \n\ - var ret; \n\ - var callback = tryCatch([GetFunctionCode]); \n\ - switch(len) { \n\ - [CodeForSwitchCase] \n\ - } \n\ - if (ret === errorObj) { \n\ - promise._rejectCallback(maybeWrapAsError(ret.e), true, true);\n\ - } \n\ - return promise; \n\ - }; \n\ - ret.__isPromisified__ = true; \n\ - return ret; \n\ - " - .replace("Parameters", parameterDeclaration(newParameterCount)) - .replace("[CodeForSwitchCase]", generateArgumentSwitchCase()) - .replace("[GetFunctionCode]", getFunctionCode))( - Promise, - fn, - receiver, - withAppended, - maybeWrapAsError, - nodebackForPromise, - util.tryCatch, - util.errorObj, - INTERNAL - ); -}; -} - -function makeNodePromisifiedClosure(callback, receiver, _, fn) { - var defaultThis = (function() {return this;})(); - var method = callback; - if (typeof method === "string") { - callback = fn; - } - function promisified() { - var _receiver = receiver; - if (receiver === THIS) _receiver = this; - var promise = new Promise(INTERNAL); - promise._captureStackTrace(); - var cb = typeof method === "string" && this !== defaultThis - ? this[method] : callback; - var fn = nodebackForPromise(promise); - try { - cb.apply(_receiver, withAppended(arguments, fn)); - } catch(e) { - promise._rejectCallback(maybeWrapAsError(e), true, true); - } - return promise; - } - promisified.__isPromisified__ = true; - return promisified; -} - -var makeNodePromisified = canEvaluate - ? makeNodePromisifiedEval - : makeNodePromisifiedClosure; - -function promisifyAll(obj, suffix, filter, promisifier) { - var suffixRegexp = new RegExp(escapeIdentRegex(suffix) + "$"); - var methods = - promisifiableMethods(obj, suffix, suffixRegexp, filter); - - for (var i = 0, len = methods.length; i < len; i+= 2) { - var key = methods[i]; - var fn = methods[i+1]; - var promisifiedKey = key + suffix; - obj[promisifiedKey] = promisifier === makeNodePromisified - ? makeNodePromisified(key, THIS, key, fn, suffix) - : promisifier(fn, function() { - return makeNodePromisified(key, THIS, key, fn, suffix); - }); - } - util.toFastProperties(obj); - return obj; -} - -function promisify(callback, receiver) { - return makeNodePromisified(callback, receiver, undefined, callback); -} - -Promise.promisify = function (fn, receiver) { - if (typeof fn !== "function") { - throw new TypeError("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - } - if (isPromisified(fn)) { - return fn; - } - var ret = promisify(fn, arguments.length < 2 ? THIS : receiver); - util.copyDescriptors(fn, ret, propsFilter); - return ret; -}; - -Promise.promisifyAll = function (target, options) { - if (typeof target !== "function" && typeof target !== "object") { - throw new TypeError("the target of promisifyAll must be an object or a function\u000a\u000a See http://goo.gl/9ITlV0\u000a"); - } - options = Object(options); - var suffix = options.suffix; - if (typeof suffix !== "string") suffix = defaultSuffix; - var filter = options.filter; - if (typeof filter !== "function") filter = defaultFilter; - var promisifier = options.promisifier; - if (typeof promisifier !== "function") promisifier = makeNodePromisified; - - if (!util.isIdentifier(suffix)) { - throw new RangeError("suffix must be a valid identifier\u000a\u000a See http://goo.gl/8FZo5V\u000a"); - } - - var keys = util.inheritedDataKeys(target); - for (var i = 0; i < keys.length; ++i) { - var value = target[keys[i]]; - if (keys[i] !== "constructor" && - util.isClass(value)) { - promisifyAll(value.prototype, suffix, filter, promisifier); - promisifyAll(value, suffix, filter, promisifier); - } - } - - return promisifyAll(target, suffix, filter, promisifier); -}; -}; - diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js deleted file mode 100644 index d6f9e64b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/props.js +++ /dev/null @@ -1,79 +0,0 @@ -"use strict"; -module.exports = function( - Promise, PromiseArray, tryConvertToPromise, apiRejection) { -var util = require("./util.js"); -var isObject = util.isObject; -var es5 = require("./es5.js"); - -function PropertiesPromiseArray(obj) { - var keys = es5.keys(obj); - var len = keys.length; - var values = new Array(len * 2); - for (var i = 0; i < len; ++i) { - var key = keys[i]; - values[i] = obj[key]; - values[i + len] = key; - } - this.constructor$(values); -} -util.inherits(PropertiesPromiseArray, PromiseArray); - -PropertiesPromiseArray.prototype._init = function () { - this._init$(undefined, -3) ; -}; - -PropertiesPromiseArray.prototype._promiseFulfilled = function (value, index) { - this._values[index] = value; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - var val = {}; - var keyOffset = this.length(); - for (var i = 0, len = this.length(); i < len; ++i) { - val[this._values[i + keyOffset]] = this._values[i]; - } - this._resolve(val); - } -}; - -PropertiesPromiseArray.prototype._promiseProgressed = function (value, index) { - this._promise._progress({ - key: this._values[index + this.length()], - value: value - }); -}; - -PropertiesPromiseArray.prototype.shouldCopyValues = function () { - return false; -}; - -PropertiesPromiseArray.prototype.getActualLength = function (len) { - return len >> 1; -}; - -function props(promises) { - var ret; - var castValue = tryConvertToPromise(promises); - - if (!isObject(castValue)) { - return apiRejection("cannot await properties of a non-object\u000a\u000a See http://goo.gl/OsFKC8\u000a"); - } else if (castValue instanceof Promise) { - ret = castValue._then( - Promise.props, undefined, undefined, undefined, undefined); - } else { - ret = new PropertiesPromiseArray(castValue).promise(); - } - - if (castValue instanceof Promise) { - ret._propagateFrom(castValue, 4); - } - return ret; -} - -Promise.prototype.props = function () { - return props(this); -}; - -Promise.props = function (promises) { - return props(promises); -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js deleted file mode 100644 index 84d57d5f..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/queue.js +++ /dev/null @@ -1,90 +0,0 @@ -"use strict"; -function arrayMove(src, srcIndex, dst, dstIndex, len) { - for (var j = 0; j < len; ++j) { - dst[j + dstIndex] = src[j + srcIndex]; - src[j + srcIndex] = void 0; - } -} - -function Queue(capacity) { - this._capacity = capacity; - this._length = 0; - this._front = 0; -} - -Queue.prototype._willBeOverCapacity = function (size) { - return this._capacity < size; -}; - -Queue.prototype._pushOne = function (arg) { - var length = this.length(); - this._checkCapacity(length + 1); - var i = (this._front + length) & (this._capacity - 1); - this[i] = arg; - this._length = length + 1; -}; - -Queue.prototype._unshiftOne = function(value) { - var capacity = this._capacity; - this._checkCapacity(this.length() + 1); - var front = this._front; - var i = (((( front - 1 ) & - ( capacity - 1) ) ^ capacity ) - capacity ); - this[i] = value; - this._front = i; - this._length = this.length() + 1; -}; - -Queue.prototype.unshift = function(fn, receiver, arg) { - this._unshiftOne(arg); - this._unshiftOne(receiver); - this._unshiftOne(fn); -}; - -Queue.prototype.push = function (fn, receiver, arg) { - var length = this.length() + 3; - if (this._willBeOverCapacity(length)) { - this._pushOne(fn); - this._pushOne(receiver); - this._pushOne(arg); - return; - } - var j = this._front + length - 3; - this._checkCapacity(length); - var wrapMask = this._capacity - 1; - this[(j + 0) & wrapMask] = fn; - this[(j + 1) & wrapMask] = receiver; - this[(j + 2) & wrapMask] = arg; - this._length = length; -}; - -Queue.prototype.shift = function () { - var front = this._front, - ret = this[front]; - - this[front] = undefined; - this._front = (front + 1) & (this._capacity - 1); - this._length--; - return ret; -}; - -Queue.prototype.length = function () { - return this._length; -}; - -Queue.prototype._checkCapacity = function (size) { - if (this._capacity < size) { - this._resizeTo(this._capacity << 1); - } -}; - -Queue.prototype._resizeTo = function (capacity) { - var oldCapacity = this._capacity; - this._capacity = capacity; - var front = this._front; - var length = this._length; - var moveItemsCount = (front + length) & (oldCapacity - 1); - arrayMove(this, 0, this, oldCapacity, moveItemsCount); -}; - -module.exports = Queue; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js deleted file mode 100644 index 30e7bb09..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/race.js +++ /dev/null @@ -1,47 +0,0 @@ -"use strict"; -module.exports = function( - Promise, INTERNAL, tryConvertToPromise, apiRejection) { -var isArray = require("./util.js").isArray; - -var raceLater = function (promise) { - return promise.then(function(array) { - return race(array, promise); - }); -}; - -function race(promises, parent) { - var maybePromise = tryConvertToPromise(promises); - - if (maybePromise instanceof Promise) { - return raceLater(maybePromise); - } else if (!isArray(promises)) { - return apiRejection("expecting an array, a promise or a thenable\u000a\u000a See http://goo.gl/s8MMhc\u000a"); - } - - var ret = new Promise(INTERNAL); - if (parent !== undefined) { - ret._propagateFrom(parent, 4 | 1); - } - var fulfill = ret._fulfill; - var reject = ret._reject; - for (var i = 0, len = promises.length; i < len; ++i) { - var val = promises[i]; - - if (val === undefined && !(i in promises)) { - continue; - } - - Promise.cast(val)._then(fulfill, reject, undefined, ret, null); - } - return ret; -} - -Promise.race = function (promises) { - return race(promises, undefined); -}; - -Promise.prototype.race = function () { - return race(this, undefined); -}; - -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js deleted file mode 100644 index 31922201..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/reduce.js +++ /dev/null @@ -1,146 +0,0 @@ -"use strict"; -module.exports = function(Promise, - PromiseArray, - apiRejection, - tryConvertToPromise, - INTERNAL) { -var async = require("./async.js"); -var util = require("./util.js"); -var tryCatch = util.tryCatch; -var errorObj = util.errorObj; -function ReductionPromiseArray(promises, fn, accum, _each) { - this.constructor$(promises); - this._promise._captureStackTrace(); - this._preservedValues = _each === INTERNAL ? [] : null; - this._zerothIsAccum = (accum === undefined); - this._gotAccum = false; - this._reducingIndex = (this._zerothIsAccum ? 1 : 0); - this._valuesPhase = undefined; - var maybePromise = tryConvertToPromise(accum, this._promise); - var rejected = false; - var isPromise = maybePromise instanceof Promise; - if (isPromise) { - maybePromise = maybePromise._target(); - if (maybePromise._isPending()) { - maybePromise._proxyPromiseArray(this, -1); - } else if (maybePromise._isFulfilled()) { - accum = maybePromise._value(); - this._gotAccum = true; - } else { - this._reject(maybePromise._reason()); - rejected = true; - } - } - if (!(isPromise || this._zerothIsAccum)) this._gotAccum = true; - this._callback = fn; - this._accum = accum; - if (!rejected) async.invoke(init, this, undefined); -} -function init() { - this._init$(undefined, -5); -} -util.inherits(ReductionPromiseArray, PromiseArray); - -ReductionPromiseArray.prototype._init = function () {}; - -ReductionPromiseArray.prototype._resolveEmptyArray = function () { - if (this._gotAccum || this._zerothIsAccum) { - this._resolve(this._preservedValues !== null - ? [] : this._accum); - } -}; - -ReductionPromiseArray.prototype._promiseFulfilled = function (value, index) { - var values = this._values; - values[index] = value; - var length = this.length(); - var preservedValues = this._preservedValues; - var isEach = preservedValues !== null; - var gotAccum = this._gotAccum; - var valuesPhase = this._valuesPhase; - var valuesPhaseIndex; - if (!valuesPhase) { - valuesPhase = this._valuesPhase = new Array(length); - for (valuesPhaseIndex=0; valuesPhaseIndex 10) || (version[0] > 0) - ? function(fn) { global.setImmediate(fn); } : process.nextTick; - - if (!schedule) { - if (typeof setImmediate !== "undefined") { - schedule = setImmediate; - } else if (typeof setTimeout !== "undefined") { - schedule = setTimeout; - } else { - schedule = noAsyncScheduler; - } - } -} else if (typeof MutationObserver !== "undefined") { - schedule = function(fn) { - var div = document.createElement("div"); - var observer = new MutationObserver(fn); - observer.observe(div, {attributes: true}); - return function() { div.classList.toggle("foo"); }; - }; - schedule.isStatic = true; -} else if (typeof setImmediate !== "undefined") { - schedule = function (fn) { - setImmediate(fn); - }; -} else if (typeof setTimeout !== "undefined") { - schedule = function (fn) { - setTimeout(fn, 0); - }; -} else { - schedule = noAsyncScheduler; -} -module.exports = schedule; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js deleted file mode 100644 index f9299c25..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/settle.js +++ /dev/null @@ -1,40 +0,0 @@ -"use strict"; -module.exports = - function(Promise, PromiseArray) { -var PromiseInspection = Promise.PromiseInspection; -var util = require("./util.js"); - -function SettledPromiseArray(values) { - this.constructor$(values); -} -util.inherits(SettledPromiseArray, PromiseArray); - -SettledPromiseArray.prototype._promiseResolved = function (index, inspection) { - this._values[index] = inspection; - var totalResolved = ++this._totalResolved; - if (totalResolved >= this._length) { - this._resolve(this._values); - } -}; - -SettledPromiseArray.prototype._promiseFulfilled = function (value, index) { - var ret = new PromiseInspection(); - ret._bitField = 268435456; - ret._settledValue = value; - this._promiseResolved(index, ret); -}; -SettledPromiseArray.prototype._promiseRejected = function (reason, index) { - var ret = new PromiseInspection(); - ret._bitField = 134217728; - ret._settledValue = reason; - this._promiseResolved(index, ret); -}; - -Promise.settle = function (promises) { - return new SettledPromiseArray(promises).promise(); -}; - -Promise.prototype.settle = function () { - return new SettledPromiseArray(this).promise(); -}; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js deleted file mode 100644 index f3968cf1..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/some.js +++ /dev/null @@ -1,125 +0,0 @@ -"use strict"; -module.exports = -function(Promise, PromiseArray, apiRejection) { -var util = require("./util.js"); -var RangeError = require("./errors.js").RangeError; -var AggregateError = require("./errors.js").AggregateError; -var isArray = util.isArray; - - -function SomePromiseArray(values) { - this.constructor$(values); - this._howMany = 0; - this._unwrap = false; - this._initialized = false; -} -util.inherits(SomePromiseArray, PromiseArray); - -SomePromiseArray.prototype._init = function () { - if (!this._initialized) { - return; - } - if (this._howMany === 0) { - this._resolve([]); - return; - } - this._init$(undefined, -5); - var isArrayResolved = isArray(this._values); - if (!this._isResolved() && - isArrayResolved && - this._howMany > this._canPossiblyFulfill()) { - this._reject(this._getRangeError(this.length())); - } -}; - -SomePromiseArray.prototype.init = function () { - this._initialized = true; - this._init(); -}; - -SomePromiseArray.prototype.setUnwrap = function () { - this._unwrap = true; -}; - -SomePromiseArray.prototype.howMany = function () { - return this._howMany; -}; - -SomePromiseArray.prototype.setHowMany = function (count) { - this._howMany = count; -}; - -SomePromiseArray.prototype._promiseFulfilled = function (value) { - this._addFulfilled(value); - if (this._fulfilled() === this.howMany()) { - this._values.length = this.howMany(); - if (this.howMany() === 1 && this._unwrap) { - this._resolve(this._values[0]); - } else { - this._resolve(this._values); - } - } - -}; -SomePromiseArray.prototype._promiseRejected = function (reason) { - this._addRejected(reason); - if (this.howMany() > this._canPossiblyFulfill()) { - var e = new AggregateError(); - for (var i = this.length(); i < this._values.length; ++i) { - e.push(this._values[i]); - } - this._reject(e); - } -}; - -SomePromiseArray.prototype._fulfilled = function () { - return this._totalResolved; -}; - -SomePromiseArray.prototype._rejected = function () { - return this._values.length - this.length(); -}; - -SomePromiseArray.prototype._addRejected = function (reason) { - this._values.push(reason); -}; - -SomePromiseArray.prototype._addFulfilled = function (value) { - this._values[this._totalResolved++] = value; -}; - -SomePromiseArray.prototype._canPossiblyFulfill = function () { - return this.length() - this._rejected(); -}; - -SomePromiseArray.prototype._getRangeError = function (count) { - var message = "Input array must contain at least " + - this._howMany + " items but contains only " + count + " items"; - return new RangeError(message); -}; - -SomePromiseArray.prototype._resolveEmptyArray = function () { - this._reject(this._getRangeError(0)); -}; - -function some(promises, howMany) { - if ((howMany | 0) !== howMany || howMany < 0) { - return apiRejection("expecting a positive integer\u000a\u000a See http://goo.gl/1wAmHx\u000a"); - } - var ret = new SomePromiseArray(promises); - var promise = ret.promise(); - ret.setHowMany(howMany); - ret.init(); - return promise; -} - -Promise.some = function (promises, howMany) { - return some(promises, howMany); -}; - -Promise.prototype.some = function (howMany) { - return some(this, howMany); -}; - -Promise._SomePromiseArray = SomePromiseArray; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js deleted file mode 100644 index 7aac1496..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/synchronous_inspection.js +++ /dev/null @@ -1,94 +0,0 @@ -"use strict"; -module.exports = function(Promise) { -function PromiseInspection(promise) { - if (promise !== undefined) { - promise = promise._target(); - this._bitField = promise._bitField; - this._settledValue = promise._settledValue; - } - else { - this._bitField = 0; - this._settledValue = undefined; - } -} - -PromiseInspection.prototype.value = function () { - if (!this.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.error = -PromiseInspection.prototype.reason = function () { - if (!this.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - return this._settledValue; -}; - -PromiseInspection.prototype.isFulfilled = -Promise.prototype._isFulfilled = function () { - return (this._bitField & 268435456) > 0; -}; - -PromiseInspection.prototype.isRejected = -Promise.prototype._isRejected = function () { - return (this._bitField & 134217728) > 0; -}; - -PromiseInspection.prototype.isPending = -Promise.prototype._isPending = function () { - return (this._bitField & 402653184) === 0; -}; - -PromiseInspection.prototype.isResolved = -Promise.prototype._isResolved = function () { - return (this._bitField & 402653184) > 0; -}; - -Promise.prototype.isPending = function() { - return this._target()._isPending(); -}; - -Promise.prototype.isRejected = function() { - return this._target()._isRejected(); -}; - -Promise.prototype.isFulfilled = function() { - return this._target()._isFulfilled(); -}; - -Promise.prototype.isResolved = function() { - return this._target()._isResolved(); -}; - -Promise.prototype._value = function() { - return this._settledValue; -}; - -Promise.prototype._reason = function() { - this._unsetRejectionIsUnhandled(); - return this._settledValue; -}; - -Promise.prototype.value = function() { - var target = this._target(); - if (!target.isFulfilled()) { - throw new TypeError("cannot get fulfillment value of a non-fulfilled promise\u000a\u000a See http://goo.gl/hc1DLj\u000a"); - } - return target._settledValue; -}; - -Promise.prototype.reason = function() { - var target = this._target(); - if (!target.isRejected()) { - throw new TypeError("cannot get rejection reason of a non-rejected promise\u000a\u000a See http://goo.gl/hPuiwB\u000a"); - } - target._unsetRejectionIsUnhandled(); - return target._settledValue; -}; - - -Promise.PromiseInspection = PromiseInspection; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js deleted file mode 100644 index c858f86a..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/thenables.js +++ /dev/null @@ -1,89 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = require("./util.js"); -var errorObj = util.errorObj; -var isObject = util.isObject; - -function tryConvertToPromise(obj, context) { - if (isObject(obj)) { - if (obj instanceof Promise) { - return obj; - } - else if (isAnyBluebirdPromise(obj)) { - var ret = new Promise(INTERNAL); - obj._then( - ret._fulfillUnchecked, - ret._rejectUncheckedCheckError, - ret._progressUnchecked, - ret, - null - ); - return ret; - } - var then = util.tryCatch(getThen)(obj); - if (then === errorObj) { - if (context) context._pushContext(); - var ret = Promise.reject(then.e); - if (context) context._popContext(); - return ret; - } else if (typeof then === "function") { - return doThenable(obj, then, context); - } - } - return obj; -} - -function getThen(obj) { - return obj.then; -} - -var hasProp = {}.hasOwnProperty; -function isAnyBluebirdPromise(obj) { - return hasProp.call(obj, "_promise0"); -} - -function doThenable(x, then, context) { - var promise = new Promise(INTERNAL); - var ret = promise; - if (context) context._pushContext(); - promise._captureStackTrace(); - if (context) context._popContext(); - var synchronous = true; - var result = util.tryCatch(then).call(x, - resolveFromThenable, - rejectFromThenable, - progressFromThenable); - synchronous = false; - if (promise && result === errorObj) { - promise._rejectCallback(result.e, true, true); - promise = null; - } - - function resolveFromThenable(value) { - if (!promise) return; - if (x === value) { - promise._rejectCallback( - Promise._makeSelfResolutionError(), false, true); - } else { - promise._resolveCallback(value); - } - promise = null; - } - - function rejectFromThenable(reason) { - if (!promise) return; - promise._rejectCallback(reason, synchronous, true); - promise = null; - } - - function progressFromThenable(value) { - if (!promise) return; - if (typeof promise._progress === "function") { - promise._progress(value); - } - } - return ret; -} - -return tryConvertToPromise; -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js deleted file mode 100644 index ecf1b576..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/timers.js +++ /dev/null @@ -1,58 +0,0 @@ -"use strict"; -module.exports = function(Promise, INTERNAL) { -var util = require("./util.js"); -var TimeoutError = Promise.TimeoutError; - -var afterTimeout = function (promise, message) { - if (!promise.isPending()) return; - if (typeof message !== "string") { - message = "operation timed out"; - } - var err = new TimeoutError(message); - util.markAsOriginatingFromRejection(err); - promise._attachExtraTrace(err); - promise._cancel(err); -}; - -var afterValue = function(value) { return delay(+this).thenReturn(value); }; -var delay = Promise.delay = function (value, ms) { - if (ms === undefined) { - ms = value; - value = undefined; - var ret = new Promise(INTERNAL); - setTimeout(function() { ret._fulfill(); }, ms); - return ret; - } - ms = +ms; - return Promise.resolve(value)._then(afterValue, null, null, ms, undefined); -}; - -Promise.prototype.delay = function (ms) { - return delay(this, ms); -}; - -function successClear(value) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - return value; -} - -function failureClear(reason) { - var handle = this; - if (handle instanceof Number) handle = +handle; - clearTimeout(handle); - throw reason; -} - -Promise.prototype.timeout = function (ms, message) { - ms = +ms; - var ret = this.then().cancellable(); - ret._cancellationParent = this; - var handle = setTimeout(function timeoutTimeout() { - afterTimeout(ret, message); - }, ms); - return ret._then(successClear, failureClear, undefined, handle, undefined); -}; - -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js deleted file mode 100644 index 40387117..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/using.js +++ /dev/null @@ -1,202 +0,0 @@ -"use strict"; -module.exports = function (Promise, apiRejection, tryConvertToPromise, - createContext) { - var TypeError = require("./errors.js").TypeError; - var inherits = require("./util.js").inherits; - var PromiseInspection = Promise.PromiseInspection; - - function inspectionMapper(inspections) { - var len = inspections.length; - for (var i = 0; i < len; ++i) { - var inspection = inspections[i]; - if (inspection.isRejected()) { - return Promise.reject(inspection.error()); - } - inspections[i] = inspection._settledValue; - } - return inspections; - } - - function thrower(e) { - setTimeout(function(){throw e;}, 0); - } - - function castPreservingDisposable(thenable) { - var maybePromise = tryConvertToPromise(thenable); - if (maybePromise !== thenable && - typeof thenable._isDisposable === "function" && - typeof thenable._getDisposer === "function" && - thenable._isDisposable()) { - maybePromise._setDisposable(thenable._getDisposer()); - } - return maybePromise; - } - function dispose(resources, inspection) { - var i = 0; - var len = resources.length; - var ret = Promise.defer(); - function iterator() { - if (i >= len) return ret.resolve(); - var maybePromise = castPreservingDisposable(resources[i++]); - if (maybePromise instanceof Promise && - maybePromise._isDisposable()) { - try { - maybePromise = tryConvertToPromise( - maybePromise._getDisposer().tryDispose(inspection), - resources.promise); - } catch (e) { - return thrower(e); - } - if (maybePromise instanceof Promise) { - return maybePromise._then(iterator, thrower, - null, null, null); - } - } - iterator(); - } - iterator(); - return ret.promise; - } - - function disposerSuccess(value) { - var inspection = new PromiseInspection(); - inspection._settledValue = value; - inspection._bitField = 268435456; - return dispose(this, inspection).thenReturn(value); - } - - function disposerFail(reason) { - var inspection = new PromiseInspection(); - inspection._settledValue = reason; - inspection._bitField = 134217728; - return dispose(this, inspection).thenThrow(reason); - } - - function Disposer(data, promise, context) { - this._data = data; - this._promise = promise; - this._context = context; - } - - Disposer.prototype.data = function () { - return this._data; - }; - - Disposer.prototype.promise = function () { - return this._promise; - }; - - Disposer.prototype.resource = function () { - if (this.promise().isFulfilled()) { - return this.promise().value(); - } - return null; - }; - - Disposer.prototype.tryDispose = function(inspection) { - var resource = this.resource(); - var context = this._context; - if (context !== undefined) context._pushContext(); - var ret = resource !== null - ? this.doDispose(resource, inspection) : null; - if (context !== undefined) context._popContext(); - this._promise._unsetDisposable(); - this._data = null; - return ret; - }; - - Disposer.isDisposer = function (d) { - return (d != null && - typeof d.resource === "function" && - typeof d.tryDispose === "function"); - }; - - function FunctionDisposer(fn, promise, context) { - this.constructor$(fn, promise, context); - } - inherits(FunctionDisposer, Disposer); - - FunctionDisposer.prototype.doDispose = function (resource, inspection) { - var fn = this.data(); - return fn.call(resource, resource, inspection); - }; - - function maybeUnwrapDisposer(value) { - if (Disposer.isDisposer(value)) { - this.resources[this.index]._setDisposable(value); - return value.promise(); - } - return value; - } - - Promise.using = function () { - var len = arguments.length; - if (len < 2) return apiRejection( - "you must pass at least 2 arguments to Promise.using"); - var fn = arguments[len - 1]; - if (typeof fn !== "function") return apiRejection("fn must be a function\u000a\u000a See http://goo.gl/916lJJ\u000a"); - len--; - var resources = new Array(len); - for (var i = 0; i < len; ++i) { - var resource = arguments[i]; - if (Disposer.isDisposer(resource)) { - var disposer = resource; - resource = resource.promise(); - resource._setDisposable(disposer); - } else { - var maybePromise = tryConvertToPromise(resource); - if (maybePromise instanceof Promise) { - resource = - maybePromise._then(maybeUnwrapDisposer, null, null, { - resources: resources, - index: i - }, undefined); - } - } - resources[i] = resource; - } - - var promise = Promise.settle(resources) - .then(inspectionMapper) - .then(function(vals) { - promise._pushContext(); - var ret; - try { - ret = fn.apply(undefined, vals); - } finally { - promise._popContext(); - } - return ret; - }) - ._then( - disposerSuccess, disposerFail, undefined, resources, undefined); - resources.promise = promise; - return promise; - }; - - Promise.prototype._setDisposable = function (disposer) { - this._bitField = this._bitField | 262144; - this._disposer = disposer; - }; - - Promise.prototype._isDisposable = function () { - return (this._bitField & 262144) > 0; - }; - - Promise.prototype._getDisposer = function () { - return this._disposer; - }; - - Promise.prototype._unsetDisposable = function () { - this._bitField = this._bitField & (~262144); - this._disposer = undefined; - }; - - Promise.prototype.disposer = function (fn) { - if (typeof fn === "function") { - return new FunctionDisposer(fn, this, createContext()); - } - throw new TypeError(); - }; - -}; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js deleted file mode 100644 index fbee5deb..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/js/main/util.js +++ /dev/null @@ -1,280 +0,0 @@ -"use strict"; -var es5 = require("./es5.js"); -var canEvaluate = typeof navigator == "undefined"; -var haveGetters = (function(){ - try { - var o = {}; - es5.defineProperty(o, "f", { - get: function () { - return 3; - } - }); - return o.f === 3; - } - catch (e) { - return false; - } - -})(); - -var errorObj = {e: {}}; -var tryCatchTarget; -function tryCatcher() { - try { - return tryCatchTarget.apply(this, arguments); - } catch (e) { - errorObj.e = e; - return errorObj; - } -} -function tryCatch(fn) { - tryCatchTarget = fn; - return tryCatcher; -} - -var inherits = function(Child, Parent) { - var hasProp = {}.hasOwnProperty; - - function T() { - this.constructor = Child; - this.constructor$ = Parent; - for (var propertyName in Parent.prototype) { - if (hasProp.call(Parent.prototype, propertyName) && - propertyName.charAt(propertyName.length-1) !== "$" - ) { - this[propertyName + "$"] = Parent.prototype[propertyName]; - } - } - } - T.prototype = Parent.prototype; - Child.prototype = new T(); - return Child.prototype; -}; - - -function isPrimitive(val) { - return val == null || val === true || val === false || - typeof val === "string" || typeof val === "number"; - -} - -function isObject(value) { - return !isPrimitive(value); -} - -function maybeWrapAsError(maybeError) { - if (!isPrimitive(maybeError)) return maybeError; - - return new Error(safeToString(maybeError)); -} - -function withAppended(target, appendee) { - var len = target.length; - var ret = new Array(len + 1); - var i; - for (i = 0; i < len; ++i) { - ret[i] = target[i]; - } - ret[i] = appendee; - return ret; -} - -function getDataPropertyOrDefault(obj, key, defaultValue) { - if (es5.isES5) { - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null) { - return desc.get == null && desc.set == null - ? desc.value - : defaultValue; - } - } else { - return {}.hasOwnProperty.call(obj, key) ? obj[key] : undefined; - } -} - -function notEnumerableProp(obj, name, value) { - if (isPrimitive(obj)) return obj; - var descriptor = { - value: value, - configurable: true, - enumerable: false, - writable: true - }; - es5.defineProperty(obj, name, descriptor); - return obj; -} - - -var wrapsPrimitiveReceiver = (function() { - return this !== "string"; -}).call("string"); - -function thrower(r) { - throw r; -} - -var inheritedDataKeys = (function() { - if (es5.isES5) { - var oProto = Object.prototype; - var getKeys = Object.getOwnPropertyNames; - return function(obj) { - var ret = []; - var visitedKeys = Object.create(null); - while (obj != null && obj !== oProto) { - var keys; - try { - keys = getKeys(obj); - } catch (e) { - return ret; - } - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (visitedKeys[key]) continue; - visitedKeys[key] = true; - var desc = Object.getOwnPropertyDescriptor(obj, key); - if (desc != null && desc.get == null && desc.set == null) { - ret.push(key); - } - } - obj = es5.getPrototypeOf(obj); - } - return ret; - }; - } else { - return function(obj) { - var ret = []; - /*jshint forin:false */ - for (var key in obj) { - ret.push(key); - } - return ret; - }; - } - -})(); - -function isClass(fn) { - try { - if (typeof fn === "function") { - var keys = es5.names(fn.prototype); - if (es5.isES5) return keys.length > 1; - return keys.length > 0 && - !(keys.length === 1 && keys[0] === "constructor"); - } - return false; - } catch (e) { - return false; - } -} - -function toFastProperties(obj) { - /*jshint -W027,-W055,-W031*/ - function f() {} - f.prototype = obj; - var l = 8; - while (l--) new f(); - return obj; - eval(obj); -} - -var rident = /^[a-z$_][a-z$_0-9]*$/i; -function isIdentifier(str) { - return rident.test(str); -} - -function filledRange(count, prefix, suffix) { - var ret = new Array(count); - for(var i = 0; i < count; ++i) { - ret[i] = prefix + i + suffix; - } - return ret; -} - -function safeToString(obj) { - try { - return obj + ""; - } catch (e) { - return "[no string representation]"; - } -} - -function markAsOriginatingFromRejection(e) { - try { - notEnumerableProp(e, "isOperational", true); - } - catch(ignore) {} -} - -function originatesFromRejection(e) { - if (e == null) return false; - return ((e instanceof Error["__BluebirdErrorTypes__"].OperationalError) || - e["isOperational"] === true); -} - -function canAttachTrace(obj) { - return obj instanceof Error && es5.propertyIsWritable(obj, "stack"); -} - -var ensureErrorObject = (function() { - if (!("stack" in new Error())) { - return function(value) { - if (canAttachTrace(value)) return value; - try {throw new Error(safeToString(value));} - catch(err) {return err;} - }; - } else { - return function(value) { - if (canAttachTrace(value)) return value; - return new Error(safeToString(value)); - }; - } -})(); - -function classString(obj) { - return {}.toString.call(obj); -} - -function copyDescriptors(from, to, filter) { - var keys = es5.names(from); - for (var i = 0; i < keys.length; ++i) { - var key = keys[i]; - if (filter(key)) { - es5.defineProperty(to, key, es5.getDescriptor(from, key)); - } - } -} - -var ret = { - isClass: isClass, - isIdentifier: isIdentifier, - inheritedDataKeys: inheritedDataKeys, - getDataPropertyOrDefault: getDataPropertyOrDefault, - thrower: thrower, - isArray: es5.isArray, - haveGetters: haveGetters, - notEnumerableProp: notEnumerableProp, - isPrimitive: isPrimitive, - isObject: isObject, - canEvaluate: canEvaluate, - errorObj: errorObj, - tryCatch: tryCatch, - inherits: inherits, - withAppended: withAppended, - maybeWrapAsError: maybeWrapAsError, - wrapsPrimitiveReceiver: wrapsPrimitiveReceiver, - toFastProperties: toFastProperties, - filledRange: filledRange, - toString: safeToString, - canAttachTrace: canAttachTrace, - ensureErrorObject: ensureErrorObject, - originatesFromRejection: originatesFromRejection, - markAsOriginatingFromRejection: markAsOriginatingFromRejection, - classString: classString, - copyDescriptors: copyDescriptors, - hasDevTools: typeof chrome !== "undefined" && chrome && - typeof chrome.loadTimes === "function", - isNode: typeof process !== "undefined" && - classString(process).toLowerCase() === "[object process]" -}; -try {throw new Error(); } catch (e) {ret.lastLineError = e;} -module.exports = ret; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json deleted file mode 100644 index 09263640..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/bluebird/package.json +++ /dev/null @@ -1,96 +0,0 @@ -{ - "name": "bluebird", - "description": "Full featured Promises/A+ implementation with exceptionally good performance", - "version": "2.9.26", - "keywords": [ - "promise", - "performance", - "promises", - "promises-a", - "promises-aplus", - "async", - "await", - "deferred", - "deferreds", - "future", - "flow control", - "dsl", - "fluent interface" - ], - "scripts": { - "lint": "node scripts/jshint.js", - "test": "node tools/test.js", - "istanbul": "istanbul", - "prepublish": "node tools/build.js --no-debug --main --zalgo --browser --minify" - }, - "homepage": "https://github.com/petkaantonov/bluebird", - "repository": { - "type": "git", - "url": "git://github.com/petkaantonov/bluebird.git" - }, - "bugs": { - "url": "http://github.com/petkaantonov/bluebird/issues" - }, - "license": "MIT", - "author": { - "name": "Petka Antonov", - "email": "petka_antonov@hotmail.com", - "url": "http://github.com/petkaantonov/" - }, - "devDependencies": { - "acorn": "~0.6.0", - "baconjs": "^0.7.43", - "bluebird": "^2.9.2", - "body-parser": "^1.10.2", - "browserify": "^8.1.1", - "cli-table": "~0.3.1", - "co": "^4.2.0", - "cross-spawn": "^0.2.3", - "glob": "^4.3.2", - "grunt-saucelabs": "~8.4.1", - "highland": "^2.3.0", - "istanbul": "^0.3.5", - "jshint": "^2.6.0", - "jshint-stylish": "~0.2.0", - "mkdirp": "~0.5.0", - "mocha": "~2.1", - "open": "~0.0.5", - "optimist": "~0.6.1", - "rimraf": "~2.2.6", - "rx": "^2.3.25", - "serve-static": "^1.7.1", - "sinon": "~1.7.3", - "uglify-js": "~2.4.16" - }, - "main": "./js/main/bluebird.js", - "browser": "./js/browser/bluebird.js", - "files": [ - "js/browser", - "js/main", - "js/zalgo", - "LICENSE", - "zalgo.js" - ], - "gitHead": "c6604d44f219af9da683f6e28d818008fa374af2", - "_id": "bluebird@2.9.26", - "_shasum": "362772ea4d09f556a4b9f3b64c2fd136e87e3a55", - "_from": "bluebird@2.9.26", - "_npmVersion": "2.7.1", - "_nodeVersion": "1.6.2", - "_npmUser": { - "name": "esailija", - "email": "petka_antonov@hotmail.com" - }, - "maintainers": [ - { - "name": "esailija", - "email": "petka_antonov@hotmail.com" - } - ], - "dist": { - "shasum": "362772ea4d09f556a4b9f3b64c2fd136e87e3a55", - "tarball": "http://registry.npmjs.org/bluebird/-/bluebird-2.9.26.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.9.26.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc deleted file mode 100644 index 299877f2..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.jshintrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "laxbreak": true -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore deleted file mode 100644 index 7e6163db..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/.npmignore +++ /dev/null @@ -1,6 +0,0 @@ -support -test -examples -example -*.sock -dist diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md deleted file mode 100644 index 854c9711..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/History.md +++ /dev/null @@ -1,195 +0,0 @@ - -2.2.0 / 2015-05-09 -================== - - * package: update "ms" to v0.7.1 (#202, @dougwilson) - * README: add logging to file example (#193, @DanielOchoa) - * README: fixed a typo (#191, @amir-s) - * browser: expose `storage` (#190, @stephenmathieson) - * Makefile: add a `distclean` target (#189, @stephenmathieson) - -2.1.3 / 2015-03-13 -================== - - * Updated stdout/stderr example (#186) - * Updated example/stdout.js to match debug current behaviour - * Renamed example/stderr.js to stdout.js - * Update Readme.md (#184) - * replace high intensity foreground color for bold (#182, #183) - -2.1.2 / 2015-03-01 -================== - - * dist: recompile - * update "ms" to v0.7.0 - * package: update "browserify" to v9.0.3 - * component: fix "ms.js" repo location - * changed bower package name - * updated documentation about using debug in a browser - * fix: security error on safari (#167, #168, @yields) - -2.1.1 / 2014-12-29 -================== - - * browser: use `typeof` to check for `console` existence - * browser: check for `console.log` truthiness (fix IE 8/9) - * browser: add support for Chrome apps - * Readme: added Windows usage remarks - * Add `bower.json` to properly support bower install - -2.1.0 / 2014-10-15 -================== - - * node: implement `DEBUG_FD` env variable support - * package: update "browserify" to v6.1.0 - * package: add "license" field to package.json (#135, @panuhorsmalahti) - -2.0.0 / 2014-09-01 -================== - - * package: update "browserify" to v5.11.0 - * node: use stderr rather than stdout for logging (#29, @stephenmathieson) - -1.0.4 / 2014-07-15 -================== - - * dist: recompile - * example: remove `console.info()` log usage - * example: add "Content-Type" UTF-8 header to browser example - * browser: place %c marker after the space character - * browser: reset the "content" color via `color: inherit` - * browser: add colors support for Firefox >= v31 - * debug: prefer an instance `log()` function over the global one (#119) - * Readme: update documentation about styled console logs for FF v31 (#116, @wryk) - -1.0.3 / 2014-07-09 -================== - - * Add support for multiple wildcards in namespaces (#122, @seegno) - * browser: fix lint - -1.0.2 / 2014-06-10 -================== - - * browser: update color palette (#113, @gscottolson) - * common: make console logging function configurable (#108, @timoxley) - * node: fix %o colors on old node <= 0.8.x - * Makefile: find node path using shell/which (#109, @timoxley) - -1.0.1 / 2014-06-06 -================== - - * browser: use `removeItem()` to clear localStorage - * browser, node: don't set DEBUG if namespaces is undefined (#107, @leedm777) - * package: add "contributors" section - * node: fix comment typo - * README: list authors - -1.0.0 / 2014-06-04 -================== - - * make ms diff be global, not be scope - * debug: ignore empty strings in enable() - * node: make DEBUG_COLORS able to disable coloring - * *: export the `colors` array - * npmignore: don't publish the `dist` dir - * Makefile: refactor to use browserify - * package: add "browserify" as a dev dependency - * Readme: add Web Inspector Colors section - * node: reset terminal color for the debug content - * node: map "%o" to `util.inspect()` - * browser: map "%j" to `JSON.stringify()` - * debug: add custom "formatters" - * debug: use "ms" module for humanizing the diff - * Readme: add "bash" syntax highlighting - * browser: add Firebug color support - * browser: add colors for WebKit browsers - * node: apply log to `console` - * rewrite: abstract common logic for Node & browsers - * add .jshintrc file - -0.8.1 / 2014-04-14 -================== - - * package: re-add the "component" section - -0.8.0 / 2014-03-30 -================== - - * add `enable()` method for nodejs. Closes #27 - * change from stderr to stdout - * remove unnecessary index.js file - -0.7.4 / 2013-11-13 -================== - - * remove "browserify" key from package.json (fixes something in browserify) - -0.7.3 / 2013-10-30 -================== - - * fix: catch localStorage security error when cookies are blocked (Chrome) - * add debug(err) support. Closes #46 - * add .browser prop to package.json. Closes #42 - -0.7.2 / 2013-02-06 -================== - - * fix package.json - * fix: Mobile Safari (private mode) is broken with debug - * fix: Use unicode to send escape character to shell instead of octal to work with strict mode javascript - -0.7.1 / 2013-02-05 -================== - - * add repository URL to package.json - * add DEBUG_COLORED to force colored output - * add browserify support - * fix component. Closes #24 - -0.7.0 / 2012-05-04 -================== - - * Added .component to package.json - * Added debug.component.js build - -0.6.0 / 2012-03-16 -================== - - * Added support for "-" prefix in DEBUG [Vinay Pulim] - * Added `.enabled` flag to the node version [TooTallNate] - -0.5.0 / 2012-02-02 -================== - - * Added: humanize diffs. Closes #8 - * Added `debug.disable()` to the CS variant - * Removed padding. Closes #10 - * Fixed: persist client-side variant again. Closes #9 - -0.4.0 / 2012-02-01 -================== - - * Added browser variant support for older browsers [TooTallNate] - * Added `debug.enable('project:*')` to browser variant [TooTallNate] - * Added padding to diff (moved it to the right) - -0.3.0 / 2012-01-26 -================== - - * Added millisecond diff when isatty, otherwise UTC string - -0.2.0 / 2012-01-22 -================== - - * Added wildcard support - -0.1.0 / 2011-12-02 -================== - - * Added: remove colors unless stderr isatty [TooTallNate] - -0.0.1 / 2010-01-03 -================== - - * Initial release diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile deleted file mode 100644 index 5cf4a596..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Makefile +++ /dev/null @@ -1,36 +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 dist - -dist: - @mkdir -p $@ - -dist/debug.js: node_modules browser.js debug.js dist - @$(BROWSERIFY) \ - --standalone debug \ - . > $@ - -distclean: clean - @rm -rf node_modules - -node_modules: package.json - @NODE_ENV= $(NPM) install - @touch node_modules - -.PHONY: all install clean distclean diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md deleted file mode 100644 index b4f45e3c..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/Readme.md +++ /dev/null @@ -1,188 +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) - -#### Windows note - - On Windows the environment variable is set using the `set` command. - - ```cmd - set DEBUG=*,-not_this - ``` - -Then, run the program to be debugged as usual. - -## Millisecond diff - - When actively developing an application it can be useful to see when the time spent between one `debug()` call and the next. Suppose for example you invoke `debug()` before requesting a resource, and after as well, the "+NNNms" will show you how much time was spent between calls. - - ![](http://f.cl.ly/items/2i3h1d3t121M2Z1A3Q0N/Screenshot.png) - - When stdout is not a TTY, `Date#toUTCString()` is used, making it more useful for logging the debug information as shown below: - - ![](http://f.cl.ly/items/112H3i0e0o0P0a2Q2r11/Screenshot.png) - -## Conventions - - If you're using this in one or more of your libraries, you _should_ use the name of your library so that developers may toggle debugging as desired without guessing names. If you have more than one debuggers you _should_ prefix them with your library name and use ":" to separate features. For example "bodyParser" from Connect would then be "connect:bodyParser". - -## Wildcards - - The `*` character may be used as a wildcard. Suppose for example your library has debuggers named "connect:bodyParser", "connect:compress", "connect:session", instead of listing all three with `DEBUG=connect:bodyParser,connect:compress,connect:session`, you may simply do `DEBUG=connect:*`, or to run everything using this module simply use `DEBUG=*`. - - You can also exclude specific debuggers by prefixing them with a "-" character. For example, `DEBUG=*,-connect:*` would include all debuggers except those starting with "connect:". - -## Browser support - - Debug works in the browser as well, currently persisted by `localStorage`. Consider the situation shown below where you have `worker:a` and `worker:b`, and wish to debug both. Somewhere in the code on your page, include: - -```js -window.myDebug = require("debug"); -``` - - ("debug" is a global object in the browser so we give this object a different name.) When your page is open in the browser, type the following in the console: - -```js -myDebug.enable("worker:*") -``` - - Refresh the page. Debug output will continue to be sent to the console until it is disabled by typing `myDebug.disable()` in the console. - -```js -a = debug('worker:a'); -b = debug('worker:b'); - -setInterval(function(){ - a('doing some work'); -}, 1000); - -setInterval(function(){ - b('doing some work'); -}, 1200); -``` - -#### Web Inspector Colors - - Colors are also enabled on "Web Inspectors" that understand the `%c` formatting - option. These are WebKit web inspectors, Firefox ([since version - 31](https://hacks.mozilla.org/2014/05/editable-box-model-multiple-selection-sublime-text-keys-much-more-firefox-developer-tools-episode-31/)) - and the Firebug plugin for Firefox (any version). - - Colored output looks something like: - - ![](https://cloud.githubusercontent.com/assets/71256/3139768/b98c5fd8-e8ef-11e3-862a-f7253b6f47c6.png) - -### stderr vs stdout - -You can set an alternative logging method per-namespace by overriding the `log` method on a per-namespace or globally: - -Example _stdout.js_: - -```js -var debug = require('debug'); -var error = debug('app:error'); - -// by default stderr is used -error('goes to stderr!'); - -var log = debug('app:log'); -// set this namespace to log via console.log -log.log = console.log.bind(console); // don't forget to bind to console! -log('goes to stdout'); -error('still goes to stderr!'); - -// set all output to go via console.info -// overrides all per-namespace log settings -debug.log = console.info.bind(console); -error('now goes to stdout via console.info'); -log('still goes to stdout, but via console.info now'); -``` - -### Save debug output to a file - -You can save all debug statements to a file by piping them. - -Example: - -```bash -$ DEBUG_FD=3 node your-app.js 3> whatever.log -``` - -## Authors - - - TJ Holowaychuk - - Nathan Rajlich - -## License - -(The MIT License) - -Copyright (c) 2014 TJ Holowaychuk <tj@vision-media.ca> - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -'Software'), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json deleted file mode 100644 index 6af573ff..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/bower.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "name": "visionmedia-debug", - "main": "dist/debug.js", - "version": "2.2.0", - "homepage": "https://github.com/visionmedia/debug", - "authors": [ - "TJ Holowaychuk " - ], - "description": "visionmedia-debug", - "moduleType": [ - "amd", - "es6", - "globals", - "node" - ], - "keywords": [ - "visionmedia", - "debug" - ], - "license": "MIT", - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ] -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js deleted file mode 100644 index 7c764522..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/browser.js +++ /dev/null @@ -1,168 +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; -exports.storage = 'undefined' != typeof chrome - && 'undefined' != typeof chrome.storage - ? chrome.storage.local - : localstorage(); - -/** - * Colors. - */ - -exports.colors = [ - 'lightseagreen', - 'forestgreen', - 'goldenrod', - 'dodgerblue', - 'darkorchid', - 'crimson' -]; - -/** - * Currently only WebKit-based Web Inspectors, Firefox >= v31, - * and the Firebug extension (any Firefox version) are known - * to support "%c" CSS customizations. - * - * TODO: add a `localStorage` variable to explicitly enable/disable colors - */ - -function useColors() { - // is webkit? http://stackoverflow.com/a/16459606/376773 - return ('WebkitAppearance' in document.documentElement.style) || - // is firebug? http://stackoverflow.com/a/398120/376773 - (window.console && (console.firebug || (console.exception && console.table))) || - // is firefox >= v31? - // https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages - (navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31); -} - -/** - * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. - */ - -exports.formatters.j = function(v) { - return JSON.stringify(v); -}; - - -/** - * Colorize log arguments if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - - args[0] = (useColors ? '%c' : '') - + this.namespace - + (useColors ? ' %c' : ' ') - + args[0] - + (useColors ? '%c ' : ' ') - + '+' + exports.humanize(this.diff); - - if (!useColors) return args; - - var c = 'color: ' + this.color; - args = [args[0], c, 'color: inherit'].concat(Array.prototype.slice.call(args, 1)); - - // the final "%c" is somewhat tricky, because there could be other - // arguments passed either before or after the %c, so we need to - // figure out the correct index to insert the CSS into - var index = 0; - var lastC = 0; - args[0].replace(/%[a-z%]/g, function(match) { - if ('%%' === match) return; - index++; - if ('%c' === match) { - // we only are interested in the *last* %c - // (the user may have provided their own) - lastC = index; - } - }); - - args.splice(lastC, 0, c); - return args; -} - -/** - * Invokes `console.log()` when available. - * No-op when `console.log` is not a "function". - * - * @api public - */ - -function log() { - // this hackery is required for IE8/9, where - // the `console.log` function doesn't have 'apply' - return 'object' === typeof console - && console.log - && Function.prototype.apply.call(console.log, console, arguments); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - try { - if (null == namespaces) { - exports.storage.removeItem('debug'); - } else { - exports.storage.debug = namespaces; - } - } catch(e) {} -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - var r; - try { - r = exports.storage.debug; - } catch(e) {} - return r; -} - -/** - * Enable namespaces listed in `localStorage.debug` initially. - */ - -exports.enable(load()); - -/** - * Localstorage attempts to return the localstorage. - * - * This is necessary because safari throws - * when a user disables cookies/localstorage - * and you attempt to access it. - * - * @return {LocalStorage} - * @api private - */ - -function localstorage(){ - try { - return window.localStorage; - } catch (e) {} -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json deleted file mode 100644 index ca106372..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/component.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "debug", - "repo": "visionmedia/debug", - "description": "small debugging utility", - "version": "2.2.0", - "keywords": [ - "debug", - "log", - "debugger" - ], - "main": "browser.js", - "scripts": [ - "browser.js", - "debug.js" - ], - "dependencies": { - "rauchg/ms.js": "0.7.1" - } -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/debug.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/debug.js deleted file mode 100644 index 7571a860..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/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/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js deleted file mode 100644 index 1d392a81..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node.js +++ /dev/null @@ -1,209 +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]; - -/** - * The file descriptor to write the `debug()` calls to. - * Set the `DEBUG_FD` env variable to override with another value. i.e.: - * - * $ DEBUG_FD=3 node script.js 3>debug.log - */ - -var fd = parseInt(process.env.DEBUG_FD, 10) || 2; -var stream = 1 === fd ? process.stdout : - 2 === fd ? process.stderr : - createWritableStdioStream(fd); - -/** - * Is stdout a TTY? Colored output is enabled when `true`. - */ - -function useColors() { - var debugColors = (process.env.DEBUG_COLORS || '').trim().toLowerCase(); - if (0 === debugColors.length) { - return tty.isatty(fd); - } else { - return '0' !== debugColors - && 'no' !== debugColors - && 'false' !== debugColors - && 'disabled' !== debugColors; - } -} - -/** - * Map %o to `util.inspect()`, since Node doesn't do that out of the box. - */ - -var inspect = (4 === util.inspect.length ? - // node <= 0.8.x - function (v, colors) { - return util.inspect(v, void 0, void 0, colors); - } : - // node > 0.8.x - function (v, colors) { - return util.inspect(v, { colors: colors }); - } -); - -exports.formatters.o = function(v) { - return inspect(v, this.useColors) - .replace(/\s*\n\s*/g, ' '); -}; - -/** - * Adds ANSI color escape codes if enabled. - * - * @api public - */ - -function formatArgs() { - var args = arguments; - var useColors = this.useColors; - var name = this.namespace; - - if (useColors) { - var c = this.color; - - args[0] = ' \u001b[3' + c + ';1m' + name + ' ' - + '\u001b[0m' - + args[0] + '\u001b[3' + c + 'm' - + ' +' + exports.humanize(this.diff) + '\u001b[0m'; - } else { - args[0] = new Date().toUTCString() - + ' ' + name + ' ' + args[0]; - } - return args; -} - -/** - * Invokes `console.error()` with the specified arguments. - */ - -function log() { - return stream.write(util.format.apply(this, arguments) + '\n'); -} - -/** - * Save `namespaces`. - * - * @param {String} namespaces - * @api private - */ - -function save(namespaces) { - if (null == namespaces) { - // If you set a process.env field to null or undefined, it gets cast to the - // string 'null' or 'undefined'. Just delete instead. - delete process.env.DEBUG; - } else { - process.env.DEBUG = namespaces; - } -} - -/** - * Load `namespaces`. - * - * @return {String} returns the previously persisted debug modes - * @api private - */ - -function load() { - return process.env.DEBUG; -} - -/** - * Copied from `node/src/node.js`. - * - * XXX: It's lame that node doesn't expose this API out-of-the-box. It also - * relies on the undocumented `tty_wrap.guessHandleType()` which is also lame. - */ - -function createWritableStdioStream (fd) { - var stream; - var tty_wrap = process.binding('tty_wrap'); - - // Note stream._type is used for test-module-load-list.js - - switch (tty_wrap.guessHandleType(fd)) { - case 'TTY': - stream = new tty.WriteStream(fd); - stream._type = 'tty'; - - // Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - case 'FILE': - var fs = require('fs'); - stream = new fs.SyncWriteStream(fd, { autoClose: false }); - stream._type = 'fs'; - break; - - case 'PIPE': - case 'TCP': - var net = require('net'); - stream = new net.Socket({ - fd: fd, - readable: false, - writable: true - }); - - // FIXME Should probably have an option in net.Socket to create a - // stream from an existing fd which is writable only. But for now - // we'll just add this hack and set the `readable` member to false. - // Test: ./node test/fixtures/echo.js < /etc/passwd - stream.readable = false; - stream.read = null; - stream._type = 'pipe'; - - // FIXME Hack to have stream not keep the event loop alive. - // See https://github.com/joyent/node/issues/1726 - if (stream._handle && stream._handle.unref) { - stream._handle.unref(); - } - break; - - default: - // Probably an error on in uv_guess_handle() - throw new Error('Implement me. Unknown stream file type!'); - } - - // For supporting legacy API we put the FD here. - stream.fd = fd; - - stream._isStdio = true; - - return stream; -} - -/** - * Enable namespaces listed in `process.env.DEBUG` initially. - */ - -exports.enable(load()); diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore deleted file mode 100644 index d1aa0ce4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/.npmignore +++ /dev/null @@ -1,5 +0,0 @@ -node_modules -test -History.md -Makefile -component.json diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md deleted file mode 100644 index 32fdfc17..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/History.md +++ /dev/null @@ -1,66 +0,0 @@ - -0.7.1 / 2015-04-20 -================== - - * prevent extraordinary long inputs (@evilpacket) - * Fixed broken readme link - -0.7.0 / 2014-11-24 -================== - - * add time abbreviations, updated tests and readme for the new units - * fix example in the readme. - * add LICENSE file - -0.6.2 / 2013-12-05 -================== - - * Adding repository section to package.json to suppress warning from NPM. - -0.6.1 / 2013-05-10 -================== - - * fix singularization [visionmedia] - -0.6.0 / 2013-03-15 -================== - - * fix minutes - -0.5.1 / 2013-02-24 -================== - - * add component namespace - -0.5.0 / 2012-11-09 -================== - - * add short formatting as default and .long option - * add .license property to component.json - * add version to component.json - -0.4.0 / 2012-10-22 -================== - - * add rounding to fix crazy decimals - -0.3.0 / 2012-09-07 -================== - - * fix `ms()` [visionmedia] - -0.2.0 / 2012-09-03 -================== - - * add component.json [visionmedia] - * add days support [visionmedia] - * add hours support [visionmedia] - * add minutes support [visionmedia] - * add seconds support [visionmedia] - * add ms string support [visionmedia] - * refactor tests to facilitate ms(number) [visionmedia] - -0.1.0 / 2012-03-07 -================== - - * Initial release diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE deleted file mode 100644 index 6c07561b..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -(The MIT License) - -Copyright (c) 2014 Guillermo Rauch - -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/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md deleted file mode 100644 index 9b4fd035..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/README.md +++ /dev/null @@ -1,35 +0,0 @@ -# ms.js: miliseconds conversion utility - -```js -ms('2 days') // 172800000 -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2.5 hrs') // 9000000 -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`](https://www.npmjs.org/package/ms) in [NPM](http://nodejs.org/download). -- 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 diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js deleted file mode 100644 index 4f927716..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/index.js +++ /dev/null @@ -1,125 +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) { - str = '' + str; - if (str.length > 10000) return; - var match = /^((?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|years?|yrs?|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 'yrs': - case 'yr': - case 'y': - return n * y; - case 'days': - case 'day': - case 'd': - return n * d; - case 'hours': - case 'hour': - case 'hrs': - case 'hr': - case 'h': - return n * h; - case 'minutes': - case 'minute': - case 'mins': - case 'min': - case 'm': - return n * m; - case 'seconds': - case 'second': - case 'secs': - case 'sec': - case 's': - return n * s; - case 'milliseconds': - case 'millisecond': - case 'msecs': - case 'msec': - 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/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json deleted file mode 100644 index 253335e6..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/node_modules/ms/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "ms", - "version": "0.7.1", - "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" - } - }, - "gitHead": "713dcf26d9e6fd9dbc95affe7eff9783b7f1b909", - "bugs": { - "url": "https://github.com/guille/ms.js/issues" - }, - "homepage": "https://github.com/guille/ms.js", - "_id": "ms@0.7.1", - "scripts": {}, - "_shasum": "9cd13c03adbff25b65effde7ce864ee952017098", - "_from": "ms@0.7.1", - "_npmVersion": "2.7.5", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "dist": { - "shasum": "9cd13c03adbff25b65effde7ce864ee952017098", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.7.1.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.7.1.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json b/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json deleted file mode 100644 index 6ecc8c9e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/node_modules/debug/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "debug", - "version": "2.2.0", - "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" - } - ], - "license": "MIT", - "dependencies": { - "ms": "0.7.1" - }, - "devDependencies": { - "browserify": "9.0.3", - "mocha": "*" - }, - "main": "./node.js", - "browser": "./browser.js", - "component": { - "scripts": { - "debug/index.js": "browser.js", - "debug/debug.js": "debug.js" - } - }, - "gitHead": "b38458422b5aa8aa6d286b10dfe427e8a67e2b35", - "bugs": { - "url": "https://github.com/visionmedia/debug/issues" - }, - "homepage": "https://github.com/visionmedia/debug", - "_id": "debug@2.2.0", - "scripts": {}, - "_shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", - "_from": "debug@2.2.0", - "_npmVersion": "2.7.4", - "_nodeVersion": "0.12.2", - "_npmUser": { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - }, - "maintainers": [ - { - "name": "tjholowaychuk", - "email": "tj@vision-media.ca" - }, - { - "name": "tootallnate", - "email": "nathan@tootallnate.net" - } - ], - "dist": { - "shasum": "f87057e995b1a1f6ae6a4960664137bc56f039da", - "tarball": "http://registry.npmjs.org/debug/-/debug-2.2.0.tgz" - }, - "directories": {}, - "_resolved": "https://registry.npmjs.org/debug/-/debug-2.2.0.tgz", - "readme": "ERROR: No README data found!" -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/package.json b/Databases/node_modules/mongoose/node_modules/mquery/package.json deleted file mode 100644 index b05ee082..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "mquery", - "version": "1.6.3", - "description": "Expressive query building for MongoDB", - "main": "lib/mquery.js", - "scripts": { - "test": "make test" - }, - "repository": { - "type": "git", - "url": "git://github.com/aheckmann/mquery.git" - }, - "dependencies": { - "bluebird": "2.9.26", - "debug": "2.2.0", - "regexp-clone": "0.0.1", - "sliced": "0.0.5" - }, - "devDependencies": { - "mongodb": "1.4.38", - "mocha": "1.9.x", - "istanbul": "0.3.2" - }, - "bugs": { - "url": "https://github.com/aheckmann/mquery/issues/new" - }, - "author": { - "name": "Aaron Heckmann", - "email": "aaron.heckmann+github@gmail.com" - }, - "license": "MIT", - "keywords": [ - "mongodb", - "query", - "builder" - ], - "homepage": "https://github.com/aheckmann/mquery/", - "gitHead": "cd0c3284df2089eed5f0a331802e15c6ff0e7fab", - "_id": "mquery@1.6.3", - "_shasum": "7c02bfb7e49c8012cece1556c5e65fef61f3c8e5", - "_from": "mquery@1.6.3", - "_npmVersion": "2.9.1", - "_nodeVersion": "0.12.3", - "_npmUser": { - "name": "vkarpov15", - "email": "val@karpov.io" - }, - "dist": { - "shasum": "7c02bfb7e49c8012cece1556c5e65fef61f3c8e5", - "tarball": "http://registry.npmjs.org/mquery/-/mquery-1.6.3.tgz" - }, - "maintainers": [ - { - "name": "aaron", - "email": "aaron.heckmann+github@gmail.com" - }, - { - "name": "ebensing", - "email": "ebensing38@gmail.com" - }, - { - "name": "vkarpov15", - "email": "valkar207@gmail.com" - } - ], - "directories": {}, - "_resolved": "https://registry.npmjs.org/mquery/-/mquery-1.6.3.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/test/collection/browser.js b/Databases/node_modules/mongoose/node_modules/mquery/test/collection/browser.js deleted file mode 100644 index e69de29b..00000000 diff --git a/Databases/node_modules/mongoose/node_modules/mquery/test/collection/mongo.js b/Databases/node_modules/mongoose/node_modules/mquery/test/collection/mongo.js deleted file mode 100644 index e69de29b..00000000 diff --git a/Databases/node_modules/mongoose/node_modules/mquery/test/collection/node.js b/Databases/node_modules/mongoose/node_modules/mquery/test/collection/node.js deleted file mode 100644 index 43f446ed..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/test/collection/node.js +++ /dev/null @@ -1,29 +0,0 @@ - -var assert = require('assert') -var slice = require('sliced') -var mongo = require('mongodb') -var utils = require('../../').utils; - -var uri = process.env.MQUERY_URI || 'mongodb://localhost/mquery'; -var db; - -exports.getCollection = function (cb) { - mongo.Db.connect(uri, function (err, db_) { - assert.ifError(err); - db = db_; - - var collection = db.collection('stuff'); - collection.opts.safe = true; - - // clean test db before starting - db.dropDatabase(function () { - cb(null, collection); - }); - }) -} - -exports.dropCollection = function (cb) { - db.dropDatabase(function () { - db.close(cb); - }) -} diff --git a/Databases/node_modules/mongoose/node_modules/mquery/test/env.js b/Databases/node_modules/mongoose/node_modules/mquery/test/env.js deleted file mode 100644 index 9b9b80b4..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/test/env.js +++ /dev/null @@ -1,20 +0,0 @@ - -var assert = require('assert') -var env = require('../').env; - -console.log('environment: %s', env.type); - -var col; -switch (env.type) { - case 'node': - col = require('./collection/node'); - break; - case 'mongo': - col = require('./collection/mongo'); - case 'browser': - col = require('./collection/browser'); - default: - throw new Error('missing collection implementation for environment: ' + env.type); -} - -module.exports = exports = col; diff --git a/Databases/node_modules/mongoose/node_modules/mquery/test/index.js b/Databases/node_modules/mongoose/node_modules/mquery/test/index.js deleted file mode 100644 index 747c947e..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/test/index.js +++ /dev/null @@ -1,2875 +0,0 @@ -var mquery = require('../'); -var assert = require('assert'); - -describe('mquery', function(){ - var col; - - before(function(done){ - // get the env specific collection interface - require('./env').getCollection(function (err, collection) { - assert.ifError(err); - col = collection; - done(); - }); - }) - - after(function(done){ - require('./env').dropCollection(done); - }) - - describe('mquery', function(){ - it('is a function', function(){ - assert.equal('function', typeof mquery); - }) - it('creates instances with the `new` keyword', function(){ - assert.ok(mquery() instanceof mquery); - }) - describe('defaults', function(){ - it('are set', function(){ - var m = mquery(); - assert.strictEqual(undefined, m.op); - assert.deepEqual({}, m.options); - }) - }) - describe('criteria', function(){ - it('if collection-like is used as collection', function(){ - var m = mquery(col); - assert.equal(col, m._collection.collection); - }) - it('non-collection-like is used as criteria', function(){ - var m = mquery({ works: true }); - assert.ok(!m._collection); - assert.deepEqual({ works: true }, m._conditions); - }) - }) - describe('options', function(){ - it('are merged when passed', function(){ - var m = mquery(col, { safe: true }); - assert.deepEqual({ safe: true }, m.options); - var m = mquery({ name: 'mquery' }, { safe: true }); - assert.deepEqual({ safe: true }, m.options); - }) - }) - }) - - describe('toConstructor', function(){ - it('creates subclasses of mquery', function(){ - var opts = { safe: { w: 'majority' }, readPreference: 'p' }; - var match = { name: 'test', count: { $gt: 101 }}; - var select = { name: 1, count: 0 } - var update = { $set: { x: true }}; - var path = 'street'; - - var q = mquery().setOptions(opts); - q.where(match); - q.select(select); - q.update(update); - q.where(path); - q.find(); - - var M = q.toConstructor(); - var m = M(); - - assert.ok(m instanceof mquery); - assert.deepEqual(opts, m.options); - assert.deepEqual(match, m._conditions); - assert.deepEqual(select, m._fields); - assert.deepEqual(update, m._update); - assert.equal(path, m._path); - assert.equal('find', m.op); - }) - }) - - describe('setOptions', function(){ - it('calls associated methods', function(){ - var m = mquery(); - assert.equal(m._collection, null); - m.setOptions({ collection: col }); - assert.equal(m._collection.collection, col); - }) - it('directly sets option when no method exists', function(){ - var m = mquery(); - assert.equal(m.options.woot, null); - m.setOptions({ woot: 'yay' }); - assert.equal(m.options.woot, 'yay'); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.setOptions(); - assert.equal(m, n); - var n = m.setOptions({ x: 1 }); - assert.equal(m, n); - }) - }) - - describe('collection', function(){ - it('sets the _collection', function(){ - var m = mquery(); - m.collection(col); - assert.equal(m._collection.collection, col); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.collection(col); - assert.equal(m, n); - }) - }) - - describe('$where', function(){ - it('sets the $where condition', function(){ - var m = mquery(); - function go () {} - m.$where(go); - assert.ok(go === m._conditions.$where); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.$where('x'); - assert.equal(m, n); - }) - }) - - describe('where', function(){ - it('without arguments', function(){ - var m = mquery(); - m.where(); - assert.deepEqual({}, m._conditions); - }) - it('with non-string/object argument', function(){ - var m = mquery(); - - assert.throws(function(){ - m.where([]); - }, /path must be a string or object/); - }) - describe('with one argument', function(){ - it('that is an object', function(){ - var m = mquery(); - m.where({ name: 'flawed' }); - assert.strictEqual(m._conditions.name, 'flawed'); - }) - it('that is a query', function(){ - var m = mquery({ name: 'first' }); - var n = mquery({ name: 'changed' }); - m.where(n); - assert.strictEqual(m._conditions.name, 'changed'); - }) - it('that is a string', function(){ - var m = mquery(); - m.where('name'); - assert.equal('name', m._path); - assert.strictEqual(m._conditions.name, undefined); - }) - }) - it('with two arguments', function(){ - var m = mquery(); - m.where('name', 'The Great Pumpkin'); - assert.equal('name', m._path); - assert.strictEqual(m._conditions.name, 'The Great Pumpkin'); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.where('x', 'y'); - assert.equal(m, n); - var n = m.where() - assert.equal(m, n); - }) - }) - - describe('equals', function(){ - it('must be called after where()', function(){ - var m = mquery(); - assert.throws(function () { - m.equals(); - }, /must be used after where/) - }) - it('sets value of path set with where()', function(){ - var m = mquery(); - m.where('age').equals(1000); - assert.deepEqual({ age: 1000 }, m._conditions); - }) - it('is chainable', function(){ - var m = mquery(); - var n = m.where('x').equals(3); - assert.equal(m, n); - }) - }) - - describe('or', function(){ - it('pushes onto the internal $or condition', function(){ - var m = mquery(); - m.or({ 'Nightmare Before Christmas': true }); - assert.deepEqual([{'Nightmare Before Christmas': true }], m._conditions.$or) - }) - it('allows passing arrays', function(){ - var m = mquery(); - var arg = [{ 'Nightmare Before Christmas': true }, { x: 1 }]; - m.or(arg); - assert.deepEqual(arg, m._conditions.$or) - }) - it('allows calling multiple times', function(){ - var m = mquery(); - var arg = [{ looper: true }, { x: 1 }]; - m.or(arg); - m.or({ y: 1 }) - m.or([{ w: 'oo' }, { z: 'oo'} ]) - assert.deepEqual([{looper:true},{x:1},{y:1},{w:'oo'},{z:'oo'}], m._conditions.$or) - }) - it('is chainable', function(){ - var m = mquery(); - m.or({ o: "k"}).where('name', 'table'); - assert.deepEqual({ name: 'table', $or: [{ o: 'k' }] }, m._conditions) - }) - }) - - describe('nor', function(){ - it('pushes onto the internal $nor condition', function(){ - var m = mquery(); - m.nor({ 'Nightmare Before Christmas': true }); - assert.deepEqual([{'Nightmare Before Christmas': true }], m._conditions.$nor) - }) - it('allows passing arrays', function(){ - var m = mquery(); - var arg = [{ 'Nightmare Before Christmas': true }, { x: 1 }]; - m.nor(arg); - assert.deepEqual(arg, m._conditions.$nor) - }) - it('allows calling multiple times', function(){ - var m = mquery(); - var arg = [{ looper: true }, { x: 1 }]; - m.nor(arg); - m.nor({ y: 1 }) - m.nor([{ w: 'oo' }, { z: 'oo'} ]) - assert.deepEqual([{looper:true},{x:1},{y:1},{w:'oo'},{z:'oo'}], m._conditions.$nor) - }) - it('is chainable', function(){ - var m = mquery(); - m.nor({ o: "k"}).where('name', 'table'); - assert.deepEqual({ name: 'table', $nor: [{ o: 'k' }] }, m._conditions) - }) - }) - - describe('and', function(){ - it('pushes onto the internal $and condition', function(){ - var m = mquery(); - m.and({ 'Nightmare Before Christmas': true }); - assert.deepEqual([{'Nightmare Before Christmas': true }], m._conditions.$and) - }) - it('allows passing arrays', function(){ - var m = mquery(); - var arg = [{ 'Nightmare Before Christmas': true }, { x: 1 }]; - m.and(arg); - assert.deepEqual(arg, m._conditions.$and) - }) - it('allows calling multiple times', function(){ - var m = mquery(); - var arg = [{ looper: true }, { x: 1 }]; - m.and(arg); - m.and({ y: 1 }) - m.and([{ w: 'oo' }, { z: 'oo'} ]) - assert.deepEqual([{looper:true},{x:1},{y:1},{w:'oo'},{z:'oo'}], m._conditions.$and) - }) - it('is chainable', function(){ - var m = mquery(); - m.and({ o: "k"}).where('name', 'table'); - assert.deepEqual({ name: 'table', $and: [{ o: 'k' }] }, m._conditions) - }) - }) - - function generalCondition (type) { - return function () { - it('accepts 2 args', function(){ - var m = mquery()[type]('count', 3); - var check = {}; - check['$' + type] = 3; - assert.deepEqual(m._conditions.count, check); - }) - it('uses previously set `where` path if 1 arg passed', function(){ - var m = mquery().where('count')[type](3); - var check = {}; - check['$' + type] = 3; - assert.deepEqual(m._conditions.count, check); - }) - it('throws if 1 arg was passed but no previous `where` was used', function(){ - assert.throws(function(){ - mquery()[type](3); - }, /must be used after where/); - }) - it('is chainable', function(){ - var m = mquery().where('count')[type](3).where('x', 8); - var check = {x: 8, count: {}}; - check.count['$' + type] = 3; - assert.deepEqual(m._conditions, check); - }) - it('overwrites previous value', function(){ - var m = mquery().where('count')[type](3)[type](8); - var check = {}; - check['$' + type] = 8; - assert.deepEqual(m._conditions.count, check); - }) - } - } - - 'gt gte lt lte ne in nin regex size maxDistance'.split(' ').forEach(function (type) { - describe(type, generalCondition(type)) - }) - - describe('mod', function () { - describe('with 1 argument', function(){ - it('requires a previous where()', function(){ - assert.throws(function () { - mquery().mod([30, 10]) - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('madmen').mod([10,20]); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - }) - - describe('with 2 arguments and second is non-Array', function(){ - it('requires a previous where()', function(){ - assert.throws(function () { - mquery().mod('x', 10) - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('madmen').mod(10, 20); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - }) - - it('with 2 arguments and second is an array', function(){ - var m = mquery().mod('madmen', [10,20]); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - - it('with 3 arguments', function(){ - var m = mquery().mod('madmen', 10, 20); - assert.deepEqual(m._conditions, { madmen: { $mod: [10,20] }}) - }) - - it('is chainable', function(){ - var m = mquery().mod('madmen', 10, 20).where('x', 8); - var check = { madmen: { $mod: [10,20] }, x: 8}; - assert.deepEqual(m._conditions, check); - }) - }) - - describe('exists', function(){ - it('with 0 args', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().exists() - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('name').exists(); - var check = { name: { $exists: true }}; - assert.deepEqual(m._conditions, check); - }) - }) - - describe('with 1 arg', function(){ - describe('that is boolean', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().exists() - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().exists('name', false); - var check = { name: { $exists: false }}; - assert.deepEqual(m._conditions, check); - }) - }) - describe('that is not boolean', function(){ - it('sets the value to `true`', function(){ - var m = mquery().where('name').exists('yummy'); - var check = { yummy: { $exists: true }}; - assert.deepEqual(m._conditions, check); - }) - }) - }) - - describe('with 2 args', function(){ - it('works', function(){ - var m = mquery().exists('yummy', false); - var check = { yummy: { $exists: false }}; - assert.deepEqual(m._conditions, check); - }) - }) - - it('is chainable', function(){ - var m = mquery().where('name').exists().find({ x: 1 }); - var check = { name: { $exists: true }, x: 1}; - assert.deepEqual(m._conditions, check); - }) - }) - - describe('elemMatch', function(){ - describe('with null/undefined first argument', function(){ - assert.throws(function () { - mquery().elemMatch(); - }, /Invalid argument/); - assert.throws(function () { - mquery().elemMatch(null); - }, /Invalid argument/); - assert.doesNotThrow(function () { - mquery().elemMatch('', {}); - }); - }) - - describe('with 1 argument', function(){ - it('throws if not a function or object', function(){ - assert.throws(function () { - mquery().elemMatch([]); - }, /Invalid argument/); - }) - - describe('that is an object', function(){ - it('throws if no previous `where` was used', function(){ - assert.throws(function () { - mquery().elemMatch({}); - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('comment').elemMatch({ author: 'joe', votes: {$gte: 3 }}); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - describe('that is a function', function(){ - it('throws if no previous `where` was used', function(){ - assert.throws(function () { - mquery().elemMatch(function(){}); - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('comment').elemMatch(function (query) { - query.where({ author: 'joe', votes: {$gte: 3 }}) - }); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - }) - - describe('with 2 arguments', function(){ - describe('and the 2nd is an object', function(){ - it('works', function(){ - var m = mquery().elemMatch('comment', { author: 'joe', votes: {$gte: 3 }}); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - describe('and the 2nd is a function', function(){ - it('works', function(){ - var m = mquery().elemMatch('comment', function (query) { - query.where({ author: 'joe', votes: {$gte: 3 }}) - }); - assert.deepEqual({ comment: { $elemMatch: { author: 'joe', votes: {$gte: 3}}}}, m._conditions); - }) - }) - it('and the 2nd is not a function or object', function(){ - assert.throws(function () { - mquery().elemMatch('comment', []); - }, /Invalid argument/); - }) - }) - }) - - describe('within', function(){ - it('is chainable', function(){ - var m = mquery(); - assert.equal(m.where('a').within(), m); - }) - describe('when called with arguments', function(){ - it('must follow where()', function(){ - assert.throws(function () { - mquery().within([]); - }, /must be used after where/); - }) - - describe('of length 1', function(){ - it('throws if not a recognized shape', function(){ - assert.throws(function () { - mquery().where('loc').within({}); - }, /Invalid argument/) - assert.throws(function () { - mquery().where('loc').within(null); - }, /Invalid argument/) - }) - it('delegates to circle when center exists', function(){ - var m = mquery().where('loc').within({ center: [10,10], radius: 3 }); - assert.deepEqual({ $geoWithin: {$center:[[10,10], 3]}}, m._conditions.loc); - }) - it('delegates to box when exists', function(){ - var m = mquery().where('loc').within({ box: [[10,10], [11,14]] }); - assert.deepEqual({ $geoWithin: {$box:[[10,10], [11,14]]}}, m._conditions.loc); - }) - it('delegates to polygon when exists', function(){ - var m = mquery().where('loc').within({ polygon: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $geoWithin: {$polygon:[[10,10], [11,14],[10,9]]}}, m._conditions.loc); - }) - it('delegates to geometry when exists', function(){ - var m = mquery().where('loc').within({ type: 'Polygon', coordinates: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $geoWithin: {$geometry: {type:'Polygon', coordinates: [[10,10], [11,14],[10,9]]}}}, m._conditions.loc); - }) - }) - - describe('of length 2', function(){ - it('delegates to box()', function(){ - var m = mquery().where('loc').within([1,2],[2,5]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $box: [[1,2],[2,5]]}}); - }) - }) - - describe('of length > 2', function(){ - it('delegates to polygon()', function(){ - var m = mquery().where('loc').within([1,2],[2,5],[2,4],[1,3]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $polygon: [[1,2],[2,5],[2,4],[1,3]]}}); - }) - }) - }) - }) - - describe('geoWithin', function(){ - before(function(){ - mquery.use$geoWithin = false; - }) - after(function(){ - mquery.use$geoWithin = true; - }) - describe('when called with arguments', function(){ - describe('of length 1', function(){ - it('delegates to circle when center exists', function(){ - var m = mquery().where('loc').within({ center: [10,10], radius: 3 }); - assert.deepEqual({ $within: {$center:[[10,10], 3]}}, m._conditions.loc); - }) - it('delegates to box when exists', function(){ - var m = mquery().where('loc').within({ box: [[10,10], [11,14]] }); - assert.deepEqual({ $within: {$box:[[10,10], [11,14]]}}, m._conditions.loc); - }) - it('delegates to polygon when exists', function(){ - var m = mquery().where('loc').within({ polygon: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $within: {$polygon:[[10,10], [11,14],[10,9]]}}, m._conditions.loc); - }) - it('delegates to geometry when exists', function(){ - var m = mquery().where('loc').within({ type: 'Polygon', coordinates: [[10,10], [11,14],[10,9]] }); - assert.deepEqual({ $within: {$geometry: {type:'Polygon', coordinates: [[10,10], [11,14],[10,9]]}}}, m._conditions.loc); - }) - }) - - describe('of length 2', function(){ - it('delegates to box()', function(){ - var m = mquery().where('loc').within([1,2],[2,5]); - assert.deepEqual(m._conditions.loc, { $within: { $box: [[1,2],[2,5]]}}); - }) - }) - - describe('of length > 2', function(){ - it('delegates to polygon()', function(){ - var m = mquery().where('loc').within([1,2],[2,5],[2,4],[1,3]); - assert.deepEqual(m._conditions.loc, { $within: { $polygon: [[1,2],[2,5],[2,4],[1,3]]}}); - }) - }) - }) - }) - - describe('box', function(){ - describe('with 1 argument', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().box('sometihng'); - }, /Invalid argument/); - }) - }) - describe('with > 3 arguments', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().box(1,2,3,4); - }, /Invalid argument/); - }) - }) - - describe('with 2 arguments', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().box([],[]); - }, /must be used after where/); - }) - it('works', function(){ - var m = mquery().where('loc').box([1,2],[3,4]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $box: [[1,2],[3,4]] }}); - }) - }) - - describe('with 3 arguments', function(){ - it('works', function(){ - var m = mquery().box('loc', [1,2],[3,4]); - assert.deepEqual(m._conditions.loc, { $geoWithin: { $box: [[1,2],[3,4]] }}); - }) - }) - }) - - describe('polygon', function(){ - describe('when first argument is not a string', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().polygon({}); - }, /must be used after where/); - - assert.doesNotThrow(function () { - mquery().where('loc').polygon([1,2], [2,3], [3,6]); - }); - }) - - it('assigns arguments to within polygon condition', function(){ - var m = mquery().where('loc').polygon([1,2], [2,3], [3,6]); - assert.deepEqual(m._conditions, { loc: {$geoWithin: {$polygon: [[1,2],[2,3],[3,6]]}} }); - }) - }) - - describe('when first arg is a string', function(){ - it('assigns remaining arguments to within polygon condition', function(){ - var m = mquery().polygon('loc', [1,2], [2,3], [3,6]); - assert.deepEqual(m._conditions, { loc: {$geoWithin: {$polygon: [[1,2],[2,3],[3,6]]}} }); - }) - }) - }) - - describe('circle', function(){ - describe('with one arg', function(){ - it('must follow where()', function(){ - assert.throws(function () { - mquery().circle('x'); - }, /must be used after where/); - assert.doesNotThrow(function () { - mquery().where('loc').circle({center:[0,0], radius: 3 }); - }); - }) - it('works', function(){ - var m = mquery().where('loc').circle({center:[0,0], radius: 3 }); - assert.deepEqual(m._conditions, { loc: { $geoWithin: {$center: [[0,0],3] }}}); - }) - }) - describe('with 3 args', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().where('loc').circle(1,2,3); - }, /Invalid argument/); - }) - }) - describe('requires radius and center', function(){ - assert.throws(function () { - mquery().circle('loc', { center: 1 }); - }, /center and radius are required/); - assert.throws(function () { - mquery().circle('loc', { radius: 1 }); - }, /center and radius are required/); - assert.doesNotThrow(function () { - mquery().circle('loc', { center: [1,2], radius: 1 }); - }); - }) - }) - - describe('geometry', function(){ - // within + intersects - var point = { type: 'Point', coordinates: [[0,0],[1,1]] }; - - it('must be called after within or intersects', function(done){ - assert.throws(function () { - mquery().where('a').geometry(point); - }, /must come after/); - - assert.doesNotThrow(function () { - mquery().where('a').within().geometry(point); - }); - - assert.doesNotThrow(function () { - mquery().where('a').intersects().geometry(point); - }); - - done(); - }) - - describe('when called with one argument', function(){ - describe('after within()', function(){ - it('and arg quacks like geoJSON', function(done){ - var m = mquery().where('a').within().geometry(point); - assert.deepEqual({ a: { $geoWithin: { $geometry: point }}}, m._conditions); - done(); - }) - }) - - describe('after intersects()', function(){ - it('and arg quacks like geoJSON', function(done){ - var m = mquery().where('a').intersects().geometry(point); - assert.deepEqual({ a: { $geoIntersects: { $geometry: point }}}, m._conditions); - done(); - }) - }) - - it('and arg does not quack like geoJSON', function(done){ - assert.throws(function () { - mquery().where('b').within().geometry({type:1, coordinates:2}); - }, /Invalid argument/); - done(); - }) - }) - - describe('when called with zero arguments', function(){ - it('throws', function(done){ - assert.throws(function () { - mquery().where('a').within().geometry(); - }, /Invalid argument/); - - done(); - }) - }) - - describe('when called with more than one arguments', function(){ - it('throws', function(done){ - assert.throws(function () { - mquery().where('a').within().geometry({type:'a',coordinates:[]}, 2); - }, /Invalid argument/); - done(); - }) - }) - }) - - describe('intersects', function(){ - it('must be used after where()', function(done){ - var m = mquery(); - assert.throws(function () { - m.intersects(); - }, /must be used after where/) - done(); - }) - - it('sets geo comparison to "$intersects"', function(done){ - var n = mquery().where('a').intersects(); - assert.equal('$geoIntersects', n._geoComparison); - done(); - }) - - it('is chainable', function(){ - var m = mquery(); - assert.equal(m.where('a').intersects(), m); - }) - - it('calls geometry if argument quacks like geojson', function(done){ - var m = mquery(); - var o = { type: 'LineString', coordinates: [[0,1],[3,40]] }; - var ran = false; - - m.geometry = function (arg) { - ran = true; - assert.deepEqual(o, arg); - } - - m.where('a').intersects(o); - assert.ok(ran); - - done(); - }) - - it('throws if argument is not geometry-like', function(done){ - var m = mquery().where('a'); - - assert.throws(function () { - m.intersects(null); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(undefined); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(false); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects({}); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects([]); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(function(){}); - }, /Invalid argument/); - - assert.throws(function () { - m.intersects(NaN); - }, /Invalid argument/); - - done(); - }) - }) - - describe('near', function(){ - // near nearSphere - describe('with 0 args', function(){ - it('is compatible with geometry()', function(done){ - var q = mquery().where('x').near().geometry({ type: 'Point', coordinates: [180, 11] }); - assert.deepEqual({ $near: {$geometry: {type:'Point', coordinates: [180,11]}}}, q._conditions.x); - done(); - }) - }) - - describe('with 1 arg', function(){ - it('throws if not used after where()', function(){ - assert.throws(function () { - mquery().near(1); - }, /must be used after where/) - }) - it('does not throw if used after where()', function(){ - assert.doesNotThrow(function () { - mquery().where('loc').near({center:[1,1]}); - }) - }) - }) - describe('with > 2 args', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().near(1,2,3); - }, /Invalid argument/) - }) - }) - - it('creates $geometry args for GeoJSON', function(){ - var m = mquery().where('loc').near({ center: { type: 'Point', coordinates: [10,10] }}); - assert.deepEqual({ $near: {$geometry: {type:'Point', coordinates: [10,10]}}}, m._conditions.loc); - }) - - it('expects `center`', function(){ - assert.throws(function () { - mquery().near('loc', { maxDistance: 3 }); - }, /center is required/) - assert.doesNotThrow(function () { - mquery().near('loc', { center: [3,4] }); - }) - }) - - it('accepts spherical conditions', function(){ - var m = mquery().where('loc').near({ center: [1,2], spherical: true }); - assert.deepEqual(m._conditions, { loc: { $nearSphere: [1,2]}}); - }) - - it('is non-spherical by default', function(){ - var m = mquery().where('loc').near({ center: [1,2] }); - assert.deepEqual(m._conditions, { loc: { $near: [1,2]}}); - }) - - it('supports maxDistance', function(){ - var m = mquery().where('loc').near({ center: [1,2], maxDistance:4 }); - assert.deepEqual(m._conditions, { loc: { $near: [1,2], $maxDistance: 4}}); - }) - - it('is chainable', function(){ - var m = mquery().where('loc').near({ center: [1,2], maxDistance:4 }).find({ x: 1 }); - assert.deepEqual(m._conditions, { loc: { $near: [1,2], $maxDistance: 4}, x: 1}); - }) - - describe('supports passing GeoJSON, gh-13', function(){ - it('with center', function(){ - var m = mquery().where('loc').near({ - center: { type: 'Point', coordinates: [1,1] } - , maxDistance: 2 - }); - - var expect = { - loc: { - $near: { - $geometry: { - type: 'Point' - , coordinates : [1,1] - } - , $maxDistance : 2 - } - } - } - - assert.deepEqual(m._conditions, expect); - }) - }) - }) - - // fields - - describe('select', function(){ - describe('with 0 args', function(){ - it('is chainable', function(){ - var m = mquery() - assert.equal(m, m.select()); - }) - }) - - it('accepts an object', function(){ - var o = { x: 1, y: 1 } - var m = mquery().select(o); - assert.deepEqual(m._fields, o); - }) - - it('accepts a string', function(){ - var o = 'x -y'; - var m = mquery().select(o); - assert.deepEqual(m._fields, { x: 1, y: 0 }); - }) - - it('does not accept an array', function(done){ - assert.throws(function () { - var o = ['x', '-y']; - var m = mquery().select(o); - }, /Invalid select/); - done(); - }) - - it('merges previous arguments', function(){ - var o = { x: 1, y: 0, a: 1 } - var m = mquery().select(o); - m.select('z -u w').select({ x: 0 }) - assert.deepEqual(m._fields, { - x: 0 - , y: 0 - , z: 1 - , u: 0 - , w: 1 - , a: 1 - }); - }) - - it('rejects non-string, object, arrays', function(){ - assert.throws(function () { - mquery().select(function(){}); - }, /Invalid select\(\) argument/); - }) - - it('accepts aguments objects', function(){ - var m = mquery(); - function t () { - m.select(arguments); - assert.deepEqual(m._fields, { x: 1, y: 0 }); - } - t('x', '-y'); - }) - - noDistinct('select'); - no('count', 'select'); - }) - - describe('selected', function() { - it('returns true when fields have been selected', function(done) { - var m = mquery().select({ name: 1 }); - assert.ok(m.selected()); - - var m = mquery().select('name'); - assert.ok(m.selected()); - - done(); - }); - - it('returns false when no fields have been selected', function(done) { - var m = mquery(); - assert.strictEqual(false, m.selected()); - done(); - }); - }); - - describe('selectedInclusively', function() { - describe('returns false', function(){ - it('when no fields have been selected', function(done) { - assert.strictEqual(false, mquery().selectedInclusively()); - assert.equal(false, mquery().select({}).selectedInclusively()); - done(); - }); - it('when any fields have been excluded', function(done) { - assert.strictEqual(false, mquery().select('-name').selectedInclusively()); - assert.strictEqual(false, mquery().select({ name: 0 }).selectedInclusively()); - assert.strictEqual(false, mquery().select('name bio -_id').selectedInclusively()); - assert.strictEqual(false, mquery().select({ name: 1, _id: 0 }).selectedInclusively()); - done(); - }); - it('when using $meta', function(done) { - assert.strictEqual(false, mquery().select({ name: { $meta: 'textScore' } }).selectedInclusively()); - done(); - }); - }); - - describe('returns true', function() { - it('when fields have been included', function(done) { - assert.equal(true, mquery().select('name').selectedInclusively()); - assert.equal(true, mquery().select({ name:1 }).selectedInclusively()); - done(); - }); - }); - }); - - describe('selectedExclusively', function() { - describe('returns false', function(){ - it('when no fields have been selected', function(done) { - assert.equal(false, mquery().selectedExclusively()); - assert.equal(false, mquery().select({}).selectedExclusively()); - done(); - }); - it('when fields have only been included', function(done) { - assert.equal(false, mquery().select('name').selectedExclusively()); - assert.equal(false, mquery().select({ name: 1 }).selectedExclusively()); - done(); - }); - }); - - describe('returns true', function() { - it('when any field has been excluded', function(done) { - assert.equal(true, mquery().select('-name').selectedExclusively()); - assert.equal(true, mquery().select({ name:0 }).selectedExclusively()); - assert.equal(true, mquery().select('-_id').selectedExclusively()); - assert.strictEqual(true, mquery().select('name bio -_id').selectedExclusively()); - assert.strictEqual(true, mquery().select({ name: 1, _id: 0 }).selectedExclusively()); - done(); - }); - }); - }); - - describe('slice', function(){ - describe('with 0 args', function(){ - it('is chainable', function(){ - var m = mquery() - assert.equal(m, m.slice()); - }) - it('is a noop', function(){ - var m = mquery().slice(); - assert.deepEqual(m._fields, undefined); - }) - }) - - describe('with 1 arg', function(){ - it('throws if not called after where()', function(){ - assert.throws(function () { - mquery().slice(1); - }, /must be used after where/); - assert.doesNotThrow(function () { - mquery().where('a').slice(1); - }); - }) - it('that is a number', function(){ - var query = mquery(); - query.where('collection').slice(5); - assert.deepEqual(query._fields, {collection: {$slice: 5}}); - }) - it('that is an array', function(){ - var query = mquery(); - query.where('collection').slice([5,10]); - assert.deepEqual(query._fields, {collection: {$slice: [5,10]}}); - }) - it('that is an object', function() { - var query = mquery(); - query.slice({ collection: [5, 10] }); - assert.deepEqual(query._fields, {collection: {$slice: [5,10]}}); - }) - }) - - describe('with 2 args', function(){ - describe('and first is a number', function(){ - it('throws if not called after where', function(){ - assert.throws(function () { - mquery().slice(2,3); - }, /must be used after where/); - }) - it('does not throw if used after where', function(){ - var query = mquery(); - query.where('collection').slice(2,3); - assert.deepEqual(query._fields, {collection: {$slice: [2,3]}}); - }) - }) - it('and first is not a number', function(){ - var query = mquery().slice('collection', [-5, 2]); - assert.deepEqual(query._fields, {collection: {$slice: [-5,2]}}); - }) - }) - - describe('with 3 args', function(){ - it('works', function(){ - var query = mquery(); - query.slice('collection', 14, 10); - assert.deepEqual(query._fields, {collection: {$slice: [14, 10]}}); - }) - }) - - noDistinct('slice'); - no('count', 'slice'); - }) - - // options - - describe('sort', function(){ - describe('with 0 args', function(){ - it('chains', function(){ - var m = mquery(); - assert.equal(m, m.sort()); - }) - it('has no affect', function(){ - var m = mquery(); - assert.equal(m.options.sort, undefined); - }) - }) - - it('works', function(){ - var query = mquery(); - query.sort('a -c b'); - assert.deepEqual(query.options.sort, { a : 1, b: 1, c : -1}); - - query = mquery(); - query.sort({'a': 1, 'c': -1, 'b': 'asc', e: 'descending', f: 'ascending'}); - assert.deepEqual(query.options.sort, {'a': 1, 'c': -1, 'b': 1, 'e': -1, 'f': 1}); - - query = mquery(); - var e= undefined; - try { - query.sort(['a', 1]); - } catch (err) { - e= err; - } - assert.ok(e, 'uh oh. no error was thrown'); - assert.equal(e.message, 'Invalid sort() argument. Must be a string or object.'); - - e= undefined; - try { - query.sort('a', 1, 'c', -1, 'b', 1); - } catch (err) { - e= err; - } - assert.ok(e, 'uh oh. no error was thrown'); - assert.equal(e.message, 'Invalid sort() argument. Must be a string or object.'); - }) - - it('handles $meta sort options', function(){ - var query = mquery(); - query.sort({ score: { $meta : "textScore" } }); - assert.deepEqual(query.options.sort, { score : { $meta : "textScore" } }); - }) - - no('count', 'sort'); - }) - - function simpleOption (type, options) { - describe(type, function(){ - it('sets the ' + type + ' option', function(){ - var m = mquery()[type](2); - var optionName = options.name || type; - assert.equal(2, m.options[optionName]); - }) - it('is chainable', function(){ - var m = mquery(); - assert.equal(m[type](3), m); - }) - - if (!options.distinct) noDistinct(type); - if (!options.count) no('count', type); - }) - } - - var negated = { - limit: {distinct: false, count: true} - , skip: {distinct: false, count: true} - , maxScan: {distinct: false, count: false} - , batchSize: {distinct: false, count: false} - , maxTime: {distinct: true, count: true, name: 'maxTimeMS' } - , comment: {distinct: false, count: false} - }; - Object.keys(negated).forEach(function (key) { - simpleOption(key, negated[key]); - }) - - describe('snapshot', function(){ - it('works', function(){ - var query = mquery(); - query.snapshot(); - assert.equal(true, query.options.snapshot); - - var query = mquery() - query.snapshot(true); - assert.equal(true, query.options.snapshot); - - var query = mquery() - query.snapshot(false); - assert.equal(false, query.options.snapshot); - }) - noDistinct('snapshot'); - no('count', 'snapshot'); - }) - - describe('hint', function(){ - it('accepts an object', function(){ - var query2 = mquery(); - query2.hint({'a': 1, 'b': -1}); - assert.deepEqual(query2.options.hint, {'a': 1, 'b': -1}); - }) - - it('rejects everything else', function(){ - assert.throws(function(){ - mquery().hint('c'); - }, /Invalid hint./); - assert.throws(function(){ - mquery().hint(['c']); - }, /Invalid hint./); - assert.throws(function(){ - mquery().hint(1); - }, /Invalid hint./); - }) - - describe('does not have side affects', function(){ - it('on invalid arg', function(){ - var m = mquery(); - try { - m.hint(1); - } catch (err) { - // ignore - } - assert.equal(undefined, m.options.hint); - }) - it('on missing arg', function(){ - var m = mquery().hint(); - assert.equal(undefined, m.options.hint); - }) - }) - - noDistinct('hint'); - }) - - describe('slaveOk', function(){ - it('works', function(){ - var query = mquery(); - query.slaveOk(); - assert.equal(true, query.options.slaveOk); - - var query = mquery() - query.slaveOk(true); - assert.equal(true, query.options.slaveOk); - - var query = mquery() - query.slaveOk(false); - assert.equal(false, query.options.slaveOk); - }) - }) - - describe('read', function(){ - it('sets associated readPreference option', function(){ - var m = mquery(); - m.read('p'); - assert.equal('primary', m.options.readPreference); - }) - it('is chainable', function(){ - var m = mquery(); - assert.equal(m, m.read('sp')); - }) - }) - - describe('tailable', function(){ - it('works', function(){ - var query = mquery(); - query.tailable(); - assert.equal(true, query.options.tailable); - - var query = mquery() - query.tailable(true); - assert.equal(true, query.options.tailable); - - var query = mquery() - query.tailable(false); - assert.equal(false, query.options.tailable); - }) - it('is chainable', function(){ - var m = mquery(); - assert.equal(m, m.tailable()); - }) - noDistinct('tailable'); - no('count', 'tailable'); - }) - - // query utilities - - describe('merge', function(){ - describe('with falsy arg', function(){ - it('returns itself', function(){ - var m = mquery(); - assert.equal(m, m.merge()); - assert.equal(m, m.merge(null)); - assert.equal(m, m.merge(0)); - }) - }) - describe('with an argument', function(){ - describe('that is not a query or plain object', function(){ - it('throws', function(){ - assert.throws(function () { - mquery().merge([]); - }, /Invalid argument/); - assert.throws(function () { - mquery().merge('merge'); - }, /Invalid argument/); - assert.doesNotThrow(function () { - mquery().merge({}); - }, /Invalid argument/); - }) - }) - - describe('that is a query', function(){ - it('merges conditions, field selection, and options', function(){ - var m = mquery({ x: 'hi' }, { select: 'x y', another: true }) - var n = mquery().merge(m); - assert.deepEqual(n._conditions, m._conditions); - assert.deepEqual(n._fields, m._fields); - assert.deepEqual(n.options, m.options); - }) - it('clones update arguments', function(done){ - var original = { $set: { iTerm: true }} - var m = mquery().update(original); - var n = mquery().merge(m); - m.update({ $set: { x: 2 }}) - assert.notDeepEqual(m._update, n._update); - done(); - }) - it('is chainable', function(){ - var m = mquery({ x: 'hi' }); - var n = mquery(); - assert.equal(n, n.merge(m)); - }) - }) - - describe('that is an object', function(){ - it('merges', function(){ - var m = { x: 'hi' }; - var n = mquery().merge(m); - assert.deepEqual(n._conditions, { x: 'hi' }); - }) - it('clones update arguments', function(done){ - var original = { $set: { iTerm: true }} - var m = mquery().update(original); - var n = mquery().merge(original); - m.update({ $set: { x: 2 }}) - assert.notDeepEqual(m._update, n._update); - done(); - }) - it('is chainable', function(){ - var m = { x: 'hi' }; - var n = mquery(); - assert.equal(n, n.merge(m)); - }) - }) - }) - }) - - // queries - - describe('find', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.find() - }) - assert.doesNotThrow(function () { - m.find({ x: 1 }) - }) - }) - }) - - it('is chainable', function(){ - var m = mquery().find({ x: 1 }).find().find({ y: 2 }); - assert.deepEqual(m._conditions, {x:1,y:2}); - }) - - it('merges other queries', function(){ - var m = mquery({ name: 'mquery' }); - m.tailable(); - m.select('_id'); - var a = mquery().find(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery' }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery' }, done); - }) - - it('when criteria is passed with a callback', function(done){ - mquery(col).find({ name: 'mquery' }, function (err, docs) { - assert.ifError(err); - assert.equal(1, docs.length); - done(); - }) - }) - it('when Query is passed with a callback', function(done){ - var m = mquery({ name: 'mquery' }); - mquery(col).find(m, function (err, docs) { - assert.ifError(err); - assert.equal(1, docs.length); - done(); - }) - }) - it('when just a callback is passed', function(done){ - mquery({ name: 'mquery' }).collection(col).find(function (err, docs) { - assert.ifError(err); - assert.equal(1, docs.length); - done(); - }); - }) - }) - }) - - describe('findOne', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.findOne() - }) - assert.doesNotThrow(function () { - m.findOne({ x: 1 }) - }) - }) - }) - - it('is chainable', function(){ - var m = mquery(); - var n = m.findOne({ x: 1 }).findOne().findOne({ y: 2 }); - assert.equal(m, n); - assert.deepEqual(m._conditions, {x:1,y:2}); - assert.equal('findOne', m.op); - }) - - it('merges other queries', function(){ - var m = mquery({ name: 'mquery' }); - m.read('nearest'); - m.select('_id'); - var a = mquery().findOne(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery findone' }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery findone' }, done); - }) - - it('when criteria is passed with a callback', function(done){ - mquery(col).findOne({ name: 'mquery findone' }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('mquery findone', doc.name); - done(); - }) - }) - it('when Query is passed with a callback', function(done){ - var m = mquery(col).where({ name: 'mquery findone' }); - mquery(col).findOne(m, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('mquery findone', doc.name); - done(); - }) - }) - it('when just a callback is passed', function(done){ - mquery({ name: 'mquery findone' }).collection(col).findOne(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('mquery findone', doc.name); - done(); - }); - }) - }) - }) - - describe('count', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.count() - }) - assert.doesNotThrow(function () { - m.count({ x: 1 }) - }) - }) - }) - - it('is chainable', function(){ - var m = mquery(); - var n = m.count({ x: 1 }).count().count({ y: 2 }); - assert.equal(m, n); - assert.deepEqual(m._conditions, {x:1,y:2}); - assert.equal('count', m.op); - }) - - it('merges other queries', function(){ - var m = mquery({ name: 'mquery' }); - m.read('nearest'); - m.select('_id'); - var a = mquery().count(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery count' }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery count' }, done); - }) - - it('when criteria is passed with a callback', function(done){ - mquery(col).count({ name: 'mquery count' }, function (err, count) { - assert.ifError(err); - assert.ok(count); - assert.ok(1 === count); - done(); - }) - }) - it('when Query is passed with a callback', function(done){ - var m = mquery({ name: 'mquery count' }); - mquery(col).count(m, function (err, count) { - assert.ifError(err); - assert.ok(count); - assert.ok(1 === count); - done(); - }) - }) - it('when just a callback is passed', function(done){ - mquery({ name: 'mquery count' }).collection(col).count(function (err, count) { - assert.ifError(err); - assert.ok(1 === count); - done(); - }); - }) - }) - - describe('validates its option', function(){ - it('sort', function(done){ - assert.throws(function(){ - var m = mquery().sort('x').count(); - }, /sort cannot be used with count/); - done(); - }) - - it('select', function(done){ - assert.throws(function(){ - var m = mquery().select('x').count(); - }, /field selection and slice cannot be used with count/); - done(); - }) - - it('slice', function(done){ - assert.throws(function(){ - var m = mquery().where('x').slice(-3).count(); - }, /field selection and slice cannot be used with count/); - done(); - }) - - it('limit', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().limit(3).count(); - }) - done(); - }) - - it('skip', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().skip(3).count(); - }) - done(); - }) - - it('batchSize', function(done){ - assert.throws(function(){ - var m = mquery({}, { batchSize: 3 }).count(); - }, /batchSize cannot be used with count/); - done(); - }) - - it('comment', function(done){ - assert.throws(function(){ - var m = mquery().comment('mquery').count(); - }, /comment cannot be used with count/); - done(); - }) - - it('maxScan', function(done){ - assert.throws(function(){ - var m = mquery().maxScan(300).count(); - }, /maxScan cannot be used with count/); - done(); - }) - - it('snapshot', function(done){ - assert.throws(function(){ - var m = mquery().snapshot().count(); - }, /snapshot cannot be used with count/); - done(); - }) - - it('tailable', function(done){ - assert.throws(function(){ - var m = mquery().tailable().count(); - }, /tailable cannot be used with count/); - done(); - }) - }) - }) - - describe('distinct', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.distinct() - }) - assert.doesNotThrow(function () { - m.distinct('name') - }) - assert.doesNotThrow(function () { - m.distinct({ name: 'mquery distinct' }) - }) - assert.doesNotThrow(function () { - m.distinct({ name: 'mquery distinct' }, 'name') - }) - }) - }) - - it('is chainable', function(){ - var m = mquery({x:1}).distinct('name'); - var n = m.distinct({y:2}); - assert.equal(m, n); - assert.deepEqual(n._conditions, {x:1, y:2}); - assert.equal('name', n._distinct); - assert.equal('distinct', n.op); - }); - - it('overwrites field', function(){ - var m = mquery({ name: 'mquery' }).distinct('name'); - m.distinct('rename'); - assert.equal(m._distinct, 'rename'); - m.distinct({x:1}, 'renamed'); - assert.equal(m._distinct, 'renamed'); - }) - - it('merges other queries', function(){ - var m = mquery().distinct({ name: 'mquery' }, 'age') - m.read('nearest'); - var a = mquery().distinct(m); - assert.deepEqual(a._conditions, m._conditions); - assert.deepEqual(a.options, m.options); - assert.deepEqual(a._fields, m._fields); - assert.deepEqual(a._distinct, m._distinct); - }) - - describe('executes', function(){ - before(function (done) { - col.insert({ name: 'mquery distinct', age: 1 }, { safe: true }, done); - }); - - after(function(done){ - col.remove({ name: 'mquery distinct' }, done); - }) - - it('when distinct arg is passed with a callback', function(done){ - mquery(col).distinct('distinct', function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }) - }) - describe('when criteria is passed with a callback', function(){ - it('if distinct arg was declared', function(done){ - mquery(col).distinct('age').distinct({ name: 'mquery distinct' }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }) - }) - it('but not if distinct arg was not declared', function(){ - assert.throws(function(){ - mquery(col).distinct({ name: 'mquery distinct' }, function(){}) - }, /No value for `distinct`/) - }) - }) - describe('when Query is passed with a callback', function(){ - var m = mquery({ name: 'mquery distinct' }); - it('if distinct arg was declared', function(done){ - mquery(col).distinct('age').distinct(m, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }) - }) - it('but not if distinct arg was not declared', function(){ - assert.throws(function(){ - mquery(col).distinct(m, function(){}) - }, /No value for `distinct`/) - }) - }) - describe('when just a callback is passed', function(done){ - it('if distinct arg was declared', function(done){ - var m = mquery({ name: 'mquery distinct' }); - m.collection(col); - m.distinct('age'); - m.distinct(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - done(); - }); - }) - it('but not if no distinct arg was declared', function(){ - var m = mquery(); - m.collection(col); - assert.throws(function () { - m.distinct(function(){}); - }, /No value for `distinct`/); - }) - }) - }) - - describe('validates its option', function(){ - it('sort', function(done){ - assert.throws(function(){ - var m = mquery().sort('x').distinct(); - }, /sort cannot be used with distinct/); - done(); - }) - - it('select', function(done){ - assert.throws(function(){ - var m = mquery().select('x').distinct(); - }, /field selection and slice cannot be used with distinct/); - done(); - }) - - it('slice', function(done){ - assert.throws(function(){ - var m = mquery().where('x').slice(-3).distinct(); - }, /field selection and slice cannot be used with distinct/); - done(); - }) - - it('limit', function(done){ - assert.throws(function(){ - var m = mquery().limit(3).distinct(); - }, /limit cannot be used with distinct/); - done(); - }) - - it('skip', function(done){ - assert.throws(function(){ - var m = mquery().skip(3).distinct(); - }, /skip cannot be used with distinct/); - done(); - }) - - it('batchSize', function(done){ - assert.throws(function(){ - var m = mquery({}, { batchSize: 3 }).distinct(); - }, /batchSize cannot be used with distinct/); - done(); - }) - - it('comment', function(done){ - assert.throws(function(){ - var m = mquery().comment('mquery').distinct(); - }, /comment cannot be used with distinct/); - done(); - }) - - it('maxScan', function(done){ - assert.throws(function(){ - var m = mquery().maxScan(300).distinct(); - }, /maxScan cannot be used with distinct/); - done(); - }) - - it('snapshot', function(done){ - assert.throws(function(){ - var m = mquery().snapshot().distinct(); - }, /snapshot cannot be used with distinct/); - done(); - }) - - it('hint', function(done){ - assert.throws(function(){ - var m = mquery().hint({ x: 1 }).distinct(); - }, /hint cannot be used with distinct/); - done(); - }) - - it('tailable', function(done){ - assert.throws(function(){ - var m = mquery().tailable().distinct(); - }, /tailable cannot be used with distinct/); - done(); - }) - }) - }) - - describe('update', function(){ - describe('with no callback', function(){ - it('does not execute', function(){ - var m = mquery(); - assert.doesNotThrow(function () { - m.update({ name: 'old' }, { name: 'updated' }, { multi: true }) - }) - assert.doesNotThrow(function () { - m.update({ name: 'old' }, { name: 'updated' }) - }) - assert.doesNotThrow(function () { - m.update({ name: 'updated' }) - }) - assert.doesNotThrow(function () { - m.update() - }) - }) - }) - - it('is chainable', function(){ - var m = mquery({x:1}).update({ y: 2 }); - var n = m.where({y:2}); - assert.equal(m, n); - assert.deepEqual(n._conditions, {x:1, y:2}); - assert.deepEqual({ y: 2 }, n._update); - assert.equal('update', n.op); - }); - - it('merges update doc arg', function(){ - var a = [1,2]; - var m = mquery().where({ name: 'mquery' }).update({ x: 'stuff', a: a }); - m.update({ z: 'stuff' }); - assert.deepEqual(m._update, { z: 'stuff', x: 'stuff', a: a }); - assert.deepEqual(m._conditions, { name: 'mquery' }); - assert.ok(!m.options.overwrite); - m.update({}, { z: 'renamed' }, { overwrite: true }); - assert.ok(m.options.overwrite === true); - assert.deepEqual(m._conditions, { name: 'mquery' }); - assert.deepEqual(m._update, { z: 'renamed', x: 'stuff', a: a }); - a.push(3); - assert.notDeepEqual(m._update, { z: 'renamed', x: 'stuff', a: a }); - }) - - it('merges other options', function(){ - var m = mquery(); - m.setOptions({ overwrite: true }); - m.update({ age: 77 }, { name: 'pagemill' }, { multi: true }) - assert.deepEqual({ age: 77 }, m._conditions); - assert.deepEqual({ name: 'pagemill' }, m._update); - assert.deepEqual({ overwrite: true, multi: true }, m.options); - }) - - describe('executes', function(){ - var id; - before(function (done) { - col.insert({ name: 'mquery update', age: 1 }, { safe: true }, function (err, docs) { - var elem = docs[0]; - id = elem._id; - done(); - }); - }); - - after(function(done){ - col.remove({ _id: id }, done); - }) - - describe('when conds + doc + opts + callback passed', function(){ - it('works', function(done){ - var m = mquery(col).where({ _id: id }) - m.update({}, { name: 'Sparky' }, { safe: true }, function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'Sparky'); - done(); - }) - }) - }) - }) - - describe('when conds + doc + callback passed', function(){ - it('works', function (done) { - var m = mquery(col).update({ _id: id }, { name: 'fairgrounds' }, function (err, num, doc) { - assert.ifError(err); - assert.ok(1, num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'fairgrounds'); - done(); - }) - }) - }) - }) - - describe('when doc + callback passed', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }).update({ name: 'changed' }, function (err, num, doc) { - assert.ifError(err); - assert.ok(1, num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'changed'); - done(); - }) - }) - }) - }) - - describe('when just callback passed', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true }); - m.update({ name: 'Frankenweenie' }); - m.update(function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(doc.name, 'Frankenweenie'); - done(); - }) - }) - }) - }) - - describe('without a callback', function(){ - it('when forced by exec()', function(done){ - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true, multi: true }); - m.update({ name: 'forced' }); - - var update = m._collection.update; - m._collection.update = function (conds, doc, opts, cb) { - m._collection.update = update; - - assert.ok(!opts.safe); - assert.ok(true === opts.multi); - assert.equal('forced', doc.$set.name); - done(); - } - - m.exec() - }) - }) - - describe('except when update doc is empty and missing overwrite flag', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true }); - m.update({ }, function (err, num) { - assert.ifError(err); - assert.ok(0 === num); - setTimeout(function(){ - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(3, mquery.utils.keys(doc).length); - assert.equal(id, doc._id.toString()); - assert.equal('Frankenweenie', doc.name); - done(); - }) - }, 300); - }) - }) - }); - - describe('when update doc is set with overwrite flag', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true, overwrite: true }); - m.update({ all: 'yep', two: 2 }, function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(3, mquery.utils.keys(doc).length); - assert.equal('yep', doc.all); - assert.equal(2, doc.two); - assert.equal(id, doc._id.toString()); - done(); - }) - }) - }) - }) - - describe('when update doc is empty with overwrite flag', function(){ - it('works', function (done) { - var m = mquery(col).where({ _id: id }); - m.setOptions({ safe: true, overwrite: true }); - m.update({ }, function (err, num) { - assert.ifError(err); - assert.ok(1 === num); - m.findOne(function (err, doc) { - assert.ifError(err); - assert.equal(1, mquery.utils.keys(doc).length); - assert.equal(id, doc._id.toString()); - done(); - }) - }) - }) - }) - - describe('when boolean (true) - exec()', function(){ - it('works', function(done){ - var m = mquery(col).where({ _id: id }); - m.update({ name: 'bool' }).update(true); - setTimeout(function () { - m.findOne(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal('bool', doc.name); - done(); - }) - }, 300) - }) - }) - }) - }) - - describe('remove', function(){ - describe('with 0 args', function(){ - var name = 'remove: no args test' - before(function(done){ - col.insert({ name: name }, { safe: true }, done) - }) - after(function(done){ - col.remove({ name: name }, { safe: true }, done) - }) - - it('does not execute', function(done){ - var remove = col.remove; - col.remove = function () { - col.remove = remove; - done(new Error('remove executed!')); - } - - var m = mquery(col).where({ name: name }).remove() - setTimeout(function () { - col.remove = remove; - done(); - }, 10); - }) - - it('chains', function(){ - var m = mquery(); - assert.equal(m, m.remove()); - }) - }) - - describe('with 1 argument', function(){ - var name = 'remove: 1 arg test' - before(function(done){ - col.insert({ name: name }, { safe: true }, done) - }) - after(function(done){ - col.remove({ name: name }, { safe: true }, done) - }) - - describe('that is a', function(){ - it('plain object', function(){ - var m = mquery(col).remove({ name: 'Whiskers' }); - m.remove({ color: '#fff' }) - assert.deepEqual({ name: 'Whiskers', color: '#fff' }, m._conditions); - }) - - it('query', function(){ - var q = mquery({ color: '#fff' }); - var m = mquery(col).remove({ name: 'Whiskers' }); - m.remove(q) - assert.deepEqual({ name: 'Whiskers', color: '#fff' }, m._conditions); - }) - - it('function', function(done){ - mquery(col, { safe: true }).where({name: name}).remove(function (err) { - assert.ifError(err); - mquery(col).findOne({ name: name }, function (err, doc) { - assert.ifError(err); - assert.equal(null, doc); - done(); - }) - }); - }) - - it('boolean (true) - execute', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - mquery(col).findOne({ name: name }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - mquery(col).remove(true); - setTimeout(function () { - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.ok(docs); - assert.equal(0, docs.length); - done(); - }) - }, 300) - }) - }) - }) - }) - }) - - describe('with 2 arguments', function(){ - var name = 'remove: 2 arg test' - beforeEach(function(done){ - col.remove({}, { safe: true }, function (err) { - assert.ifError(err); - col.insert([{ name: 'shelly' }, { name: name }], { safe: true }, function (err) { - assert.ifError(err); - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }) - }) - }) - - describe('plain object + callback', function(){ - it('works', function(done){ - mquery(col).remove({ name: name }, function (err) { - assert.ifError(err); - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.ok(docs); - assert.equal(1, docs.length); - assert.equal('shelly', docs[0].name); - done(); - }) - }); - }) - }) - - describe('mquery + callback', function(){ - it('works', function(done){ - var m = mquery({ name: name }); - mquery(col).remove(m, function (err) { - assert.ifError(err); - mquery(col).find(function (err, docs) { - assert.ifError(err); - assert.ok(docs); - assert.equal(1, docs.length); - assert.equal('shelly', docs[0].name); - done(); - }) - }); - }) - }) - }) - }) - - function validateFindAndModifyOptions (method) { - describe('validates its option', function(){ - it('sort', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().sort('x')[method](); - }) - done(); - }) - - it('select', function(done){ - assert.doesNotThrow(function(){ - var m = mquery().select('x')[method](); - }) - done(); - }) - - it('limit', function(done){ - assert.throws(function(){ - var m = mquery().limit(3)[method](); - }, new RegExp('limit cannot be used with ' + method)); - done(); - }) - - it('skip', function(done){ - assert.throws(function(){ - var m = mquery().skip(3)[method](); - }, new RegExp('skip cannot be used with ' + method)); - done(); - }) - - it('batchSize', function(done){ - assert.throws(function(){ - var m = mquery({}, { batchSize: 3 })[method](); - }, new RegExp('batchSize cannot be used with ' + method)); - done(); - }) - - it('maxScan', function(done){ - assert.throws(function(){ - var m = mquery().maxScan(300)[method](); - }, new RegExp('maxScan cannot be used with ' + method)); - done(); - }) - - it('snapshot', function(done){ - assert.throws(function(){ - var m = mquery().snapshot()[method](); - }, new RegExp('snapshot cannot be used with ' + method)); - done(); - }) - - it('hint', function(done){ - assert.throws(function(){ - var m = mquery().hint({ x: 1 })[method](); - }, new RegExp('hint cannot be used with ' + method)); - done(); - }) - - it('tailable', function(done){ - assert.throws(function(){ - var m = mquery().tailable()[method](); - }, new RegExp('tailable cannot be used with ' + method)); - done(); - }) - - it('comment', function(done){ - assert.throws(function(){ - var m = mquery().comment('mquery')[method](); - }, new RegExp('comment cannot be used with ' + method)); - done(); - }) - }) - } - - describe('findOneAndUpdate', function(){ - var name = 'findOneAndUpdate + fn' - - validateFindAndModifyOptions('findOneAndUpdate'); - - describe('with 0 args', function(){ - it('makes no changes', function(){ - var m = mquery(); - var n = m.findOneAndUpdate(); - assert.deepEqual(m, n); - }) - }) - describe('with 1 arg', function(){ - describe('that is an object', function(){ - it('updates the doc', function(){ - var m = mquery(); - var n = m.findOneAndUpdate({ $set: { name: '1 arg' }}); - assert.deepEqual(n._update, { $set: { name: '1 arg' }}); - }) - }) - describe('that is a query', function(){ - it('updates the doc', function(){ - var m = mquery({ name: name }).update({ x: 1 }); - var n = mquery().findOneAndUpdate(m); - assert.deepEqual(n._update, { x: 1 }); - }) - }) - it('that is a function', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var m = mquery({ name: name }).collection(col); - name = '1 arg'; - var n = m.update({ $set: { name: name }}); - n.findOneAndUpdate(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - done(); - }); - }) - }) - }) - describe('with 2 args', function(){ - it('conditions + update', function(){ - var m = mquery(col); - m.findOneAndUpdate({ name: name }, { age: 100 }); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ age: 100 }, m._update); - }) - it('query + update', function(){ - var n = mquery({ name: name }); - var m = mquery(col); - m.findOneAndUpdate(n, { age: 100 }); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ age: 100 }, m._update); - }) - it('update + callback', function(done){ - var m = mquery(col).where({ name: name }); - m.findOneAndUpdate({ $inc: { age: 10 }}, function (err, doc) { - assert.ifError(err); - assert.equal(10, doc.age); - done(); - }); - }) - }) - describe('with 3 args', function(){ - it('conditions + update + options', function(){ - var m = mquery(); - var n = m.findOneAndUpdate({ name: name }, { works: true }, { new: false }); - assert.deepEqual({ name: name}, n._conditions); - assert.deepEqual({ works: true }, n._update); - assert.deepEqual({ new: false }, n.options); - }) - it('conditions + update + callback', function(done){ - var m = mquery(col); - m.findOneAndUpdate({ name: name }, { works: true }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - assert.ok(true === doc.works); - done(); - }); - }) - }) - describe('with 4 args', function(){ - it('conditions + update + options + callback', function(done){ - var m = mquery(col); - m.findOneAndUpdate({ name: name }, { works: false }, { new: false }, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - assert.ok(true === doc.works); - done(); - }); - }) - }) - }) - - describe('findOneAndRemove', function(){ - var name = 'findOneAndRemove' - - validateFindAndModifyOptions('findOneAndRemove'); - - describe('with 0 args', function(){ - it('makes no changes', function(){ - var m = mquery(); - var n = m.findOneAndRemove(); - assert.deepEqual(m, n); - }) - }) - describe('with 1 arg', function(){ - describe('that is an object', function(){ - it('updates the doc', function(){ - var m = mquery(); - var n = m.findOneAndRemove({ name: '1 arg' }); - assert.deepEqual(n._conditions, { name: '1 arg' }); - }) - }) - describe('that is a query', function(){ - it('updates the doc', function(){ - var m = mquery({ name: name }); - var n = m.findOneAndRemove(m); - assert.deepEqual(n._conditions, { name: name }); - }) - }) - it('that is a function', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var m = mquery({ name: name }).collection(col); - m.findOneAndRemove(function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - done(); - }); - }) - }) - }) - describe('with 2 args', function(){ - it('conditions + options', function(){ - var m = mquery(col); - m.findOneAndRemove({ name: name }, { new: false }); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ new: false }, m.options); - }) - it('query + options', function(){ - var n = mquery({ name: name }); - var m = mquery(col); - m.findOneAndRemove(n, { sort: { x: 1 }}); - assert.deepEqual({ name: name }, m._conditions); - assert.deepEqual({ sort: { 'x': 1 }}, m.options); - }) - it('conditions + callback', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var m = mquery(col); - m.findOneAndRemove({ name: name }, function (err, doc) { - assert.ifError(err); - assert.equal(name, doc.name); - done(); - }); - }); - }) - it('query + callback', function(done){ - col.insert({ name: name }, { safe: true }, function (err) { - assert.ifError(err); - var n = mquery({ name: name }) - var m = mquery(col); - m.findOneAndRemove(n, function (err, doc) { - assert.ifError(err); - assert.equal(name, doc.name); - done(); - }); - }); - }) - }) - describe('with 3 args', function(){ - it('conditions + options + callback', function(done){ - name = 'findOneAndRemove + conds + options + cb'; - col.insert([{ name: name }, { name: 'a' }], { safe: true }, function (err) { - assert.ifError(err); - var m = mquery(col); - m.findOneAndRemove({ name: name }, { sort: { name: 1 }}, function (err, doc) { - assert.ifError(err); - assert.ok(doc); - assert.equal(name, doc.name); - done(); - }); - }) - }) - }) - }) - - describe('exec', function(){ - beforeEach(function(done){ - col.insert([{ name: 'exec', age: 1 }, { name: 'exec', age: 2 }], done); - }) - - afterEach(function(done){ - mquery(col).remove(done); - }) - - it('requires an op', function(){ - assert.throws(function () { - mquery().exec() - }, /Missing query type/); - }) - - describe('find', function() { - it('works', function(done){ - var m = mquery(col).find({ name: 'exec' }); - m.exec(function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }) - - it('works with readPreferences', function (done) { - var m = mquery(col).find({ name: 'exec' }); - try { - var rp = new require('mongodb').ReadPreference('primary'); - m.read(rp); - } catch (e) { - if (e.code === 'MODULE_NOT_FOUND') - e = null; - done(e); - return; - } - m.exec(function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }) - }); - - it('findOne', function(done){ - var m = mquery(col).findOne({ age: 2 }); - m.exec(function (err, doc) { - assert.ifError(err); - assert.equal(2, doc.age); - done(); - }) - }) - - it('count', function(done){ - var m = mquery(col).count({ name: 'exec' }); - m.exec(function (err, count) { - assert.ifError(err); - assert.equal(2, count); - done(); - }) - }) - - it('distinct', function(done){ - var m = mquery({ name: 'exec' }); - m.collection(col); - m.distinct('age'); - m.exec(function (err, array) { - assert.ifError(err); - assert.ok(Array.isArray(array)); - assert.equal(2, array.length); - assert(~array.indexOf(1)); - assert(~array.indexOf(2)); - done(); - }); - }) - - describe('update', function(){ - var num; - - it('with a callback', function(done){ - var m = mquery(col); - m.where({ name: 'exec' }) - - m.count(function (err, _num) { - assert.ifError(err); - num = _num; - m.setOptions({ multi: true }) - m.update({ name: 'exec + update' }); - m.exec(function (err, res) { - assert.ifError(err); - assert.equal(num, res); - mquery(col).find({ name: 'exec + update' }, function (err, docs) { - assert.ifError(err); - assert.equal(num, docs.length); - done(); - }) - }) - }) - }) - - it('without a callback', function(done){ - var m = mquery(col) - m.where({ name: 'exec + update' }).setOptions({ multi: true }) - m.update({ name: 'exec' }); - - // unsafe write - m.exec(); - - setTimeout(function () { - mquery(col).find({ name: 'exec' }, function (err, docs) { - assert.ifError(err); - assert.equal(2, docs.length); - done(); - }) - }, 200) - }) - it('preserves key ordering', function(done) { - var m = mquery(col); - - var m2 = m.update({ _id : 'something' }, { '1' : 1, '2' : 2, '3' : 3}); - var doc = m2._updateForExec().$set; - var count = 0; - for (var i in doc) { - if (count == 0) { - assert.equal('1', i); - } else if (count == 1) { - assert.equal('2', i); - } else if (count ==2) { - assert.equal('3', i); - } - count++; - } - done(); - }); - }) - - describe('remove', function(){ - it('with a callback', function(done){ - var m = mquery(col).where({ age: 2 }).remove(); - m.exec(function (err, num) { - assert.ifError(err); - assert.equal(1, num); - done(); - }) - }) - - it('without a callback', function(done){ - var m = mquery(col).where({ age: 1 }).remove(); - m.exec(); - - setTimeout(function () { - mquery(col).where('name', 'exec').count(function(err, num) { - assert.equal(1, num); - done(); - }) - }, 200) - }) - }) - - describe('findOneAndUpdate', function(){ - it('with a callback', function(done){ - var m = mquery(col); - m.findOneAndUpdate({ name: 'exec', age: 1 }, { $set: { name: 'findOneAndUpdate' }}); - m.exec(function (err, doc) { - assert.ifError(err); - assert.equal('findOneAndUpdate', doc.name); - done(); - }); - }) - }) - - describe('findOneAndRemove', function(){ - it('with a callback', function(done){ - var m = mquery(col); - m.findOneAndRemove({ name: 'exec', age: 2 }); - m.exec(function (err, doc) { - assert.ifError(err); - assert.equal('exec', doc.name); - assert.equal(2, doc.age); - mquery(col).count({ name: 'exec' }, function (err, num) { - assert.ifError(err); - assert.equal(1, num); - done(); - }); - }); - }) - }) - }) - - describe('setTraceFunction', function() { - beforeEach(function(done){ - col.insert([{ name: 'trace', age: 93 }], done); - }) - - it('calls trace function when executing query', function(done) { - var m = mquery(col); - - var resultTraceCalled; - - m.setTraceFunction(function (method, queryInfo) { - try { - assert.equal('findOne', method); - assert.equal('trace', queryInfo.conditions.name); - } catch (e) { - done(e); - } - - return function(err, result, millis) { - try { - assert.equal(93, result.age); - } catch (e) { - done(e); - } - resultTraceCalled = true; - }; - }); - - m.findOne({name: 'trace'}, function (err, doc) { - assert.ifError(err); - assert.equal(resultTraceCalled, true); - assert.equal(93, doc.age); - done(); - }); - }); - - it('inherits trace function when calling toConstructor', function(done) { - function traceFunction () { return function() {} }; - - var tracedQuery = mquery().setTraceFunction(traceFunction).toConstructor(); - - var query = tracedQuery(); - assert.equal(traceFunction, query._traceFunction); - - done(); - }); - }); - - describe('thunk', function() { - it('returns a function', function(done) { - assert.equal('function', typeof mquery().thunk()); - done(); - }); - - it('passes the fn arg to `exec`', function(done) { - function cb() {} - var m = mquery(); - - m.exec = function testing(fn) { - assert.equal(this, m); - assert.equal(cb, fn); - done(); - } - - m.thunk()(cb); - }); - }); - - describe('then', function() { - before(function(done){ - col.insert([{ name: 'then', age: 1 }, { name: 'then', age: 2 }], done); - }) - - after(function(done){ - mquery(col).remove({ name: 'then' }).exec(done); - }) - - it('returns a promise A+ compat object', function(done) { - var m = mquery(col).find(); - assert.equal('function', typeof m.then); - done(); - }); - - it('creates a promise that is resolved on success', function(done) { - var promise = mquery(col).count({ name: 'then' }).then(); - promise.then(function(count){ - assert.equal(2, count); - done(); - }, done); - }); - - it('supports exec() cb being called synchronously #66', function(done) { - var query = mquery(col).count({ name: 'then' }); - query.exec = function(cb) { - cb(null, 66); - } - - query.then(success, done); - function success(count){ - assert.equal(66, count); - done(); - } - }); - - it('supports other Promise libs', function(done) { - var bluebird = mquery.Promise; - - // hack for testing - mquery.Promise = function P() { - mquery.Promise = bluebird; - this.then = function(x, y) { - return x + y; - } - } - - var val = mquery(col).count({ name: 'exec' }).then(1, 2); - assert.equal(val, 3); - done(); - }); - }); - - describe('stream', function() { - before(function(done){ - col.insert([{ name: 'stream', age: 1 }, { name: 'stream', age: 2 }], done); - }) - - after(function(done){ - mquery(col).remove({ name: 'stream' }).exec(done); - }) - - describe('throws', function() { - describe('if used with non-find operations', function() { - var ops = ['update', 'findOneAndUpdate', 'remove', 'count', 'distinct']; - - ops.forEach(function(op) { - assert.throws(function(){ - mquery(col)[op]().stream(); - }); - }); - }); - }); - - it('returns a stream', function(done) { - var stream = mquery(col).find({ name: 'stream' }).stream(); - var count = 0; - var err; - - stream.on('data', function(doc){ - assert.equal('stream', doc.name); - ++count; - }); - - stream.on('error', function(er) { - err = er; - }); - - stream.on('close', function(){ - if (err) return done(err); - assert.equal(2, count); - done(); - }); - }); - - it('supports find options', function(done) { - var stream = mquery(col) - .find({ name: 'stream' }) - .limit(1) - .select('-_id') - .stream({ transform: xform }); - - function xform(doc) { - doc.name = doc.name + '-xformed'; - return doc; - } - - var count = 0; - var err; - - stream.on('data', function(doc){ - assert(!doc._id); - assert.equal('stream-xformed', doc.name); - ++count; - }); - - stream.on('error', function(er) { - err = er; - }); - - stream.on('close', function(){ - if (err) return done(err); - assert.equal(1, count); - done(); - }); - }); - - }); - - function noDistinct (type) { - it('cannot be used with distinct()', function(done){ - assert.throws(function () { - mquery().distinct('name')[type](4); - }, new RegExp(type + ' cannot be used with distinct')); - done(); - }) - } - - function no (method, type) { - it('cannot be used with ' + method + '()', function(done){ - assert.throws(function () { - mquery()[method]()[type](4); - }, new RegExp(type + ' cannot be used with ' + method)); - done(); - }) - } - - // query internal - - describe('_updateForExec', function(){ - it('returns a clone of the update object with same key order #19', function(done){ - var update = {}; - update.$push = { n: { $each: [{x:10}], $slice: -1, $sort: {x:1}}}; - - var q = mquery().update({ x: 1 }, update); - - // capture original key order - var order = []; - for (var key in q._update.$push.n) { - order.push(key); - } - - // compare output - var doc = q._updateForExec(); - var i = 0; - for (var key in doc.$push.n) { - assert.equal(key, order[i]); - i++; - } - - done(); - }) - }) -}) diff --git a/Databases/node_modules/mongoose/node_modules/mquery/test/utils.test.js b/Databases/node_modules/mongoose/node_modules/mquery/test/utils.test.js deleted file mode 100644 index fa5972a2..00000000 --- a/Databases/node_modules/mongoose/node_modules/mquery/test/utils.test.js +++ /dev/null @@ -1,143 +0,0 @@ - -var utils = require('../lib/utils'); -var assert = require('assert'); - -var mongo; -try { - mongo = new require('mongodb'); -} catch (e) {} - -describe('lib/utils', function() { - describe('clone', function() { - it('clones constructors named ObjectId', function(done) { - function ObjectId (id) { - this.id = id; - } - - var o1 = new ObjectId('1234'); - var o2 = utils.clone(o1); - assert.ok(o2 instanceof ObjectId); - - done(); - }); - - it('clones constructors named ObjectID', function(done) { - function ObjectID (id) { - this.id = id; - } - - var o1 = new ObjectID('1234'); - var o2 = utils.clone(o1); - - assert.ok(o2 instanceof ObjectID); - done(); - }); - - it('does not clone constructors named ObjectIdd', function(done) { - function ObjectIdd (id) { - this.id = id; - } - - var o1 = new ObjectIdd('1234'); - var o2 = utils.clone(o1); - assert.ok(!(o2 instanceof ObjectIdd)); - - done(); - }); - - it('optionally clones ObjectId constructors using its clone method', function(done) { - function ObjectID (id) { - this.id = id; - this.cloned = false; - } - - ObjectID.prototype.clone = function () { - var ret = new ObjectID(this.id); - ret.cloned = true; - return ret; - } - - var id = 1234; - var o1 = new ObjectID(id); - assert.equal(id, o1.id); - assert.equal(false, o1.cloned); - - var o2 = utils.clone(o1); - assert.ok(o2 instanceof ObjectID); - assert.equal(id, o2.id); - assert.ok(o2.cloned); - done(); - }); - - it('clones mongodb.ReadPreferences', function (done) { - if (!mongo) return done(); - - var tags = [ - {dc: 'tag1'} - ]; - var prefs = [ - new mongo.ReadPreference("primary"), - new mongo.ReadPreference(mongo.ReadPreference.PRIMARY_PREFERRED), - new mongo.ReadPreference("primary", tags), - mongo.ReadPreference("primary", tags) - ]; - - var prefsCloned = utils.clone(prefs); - - for (var i = 0; i < prefsCloned.length; i++) { - assert.notEqual(prefs[i], prefsCloned[i]); - assert.ok(prefsCloned[i] instanceof mongo.ReadPreference); - assert.ok(prefsCloned[i].isValid()); - if (prefs[i].tags) { - assert.ok(prefsCloned[i].tags); - assert.notEqual(prefs[i].tags, prefsCloned[i].tags); - assert.notEqual(prefs[i].tags[0], prefsCloned[i].tags[0]); - } else { - assert.equal(prefsCloned[i].tags, null); - } - } - - done(); - }); - - it('clones mongodb.Binary', function(done){ - if (!mongo) return done(); - - var buf = new Buffer('hi'); - var binary= new mongo.Binary(buf, 2); - var clone = utils.clone(binary); - assert.equal(binary.sub_type, clone.sub_type); - assert.equal(String(binary.buffer), String(buf)); - assert.ok(binary !== clone); - done(); - }) - - it('handles objects with no constructor', function(done) { - var name ='335'; - - var o = Object.create(null); - o.name = name; - - var clone; - assert.doesNotThrow(function() { - clone = utils.clone(o); - }); - - assert.equal(name, clone.name); - assert.ok(o != clone); - done(); - }); - - it('handles buffers', function(done){ - var buff = new Buffer(10); - buff.fill(1); - var clone = utils.clone(buff); - - for (var i = 0; i < buff.length; i++) { - assert.equal(buff[i], clone[i]); - } - - done(); - }); - }); -}); diff --git a/Databases/node_modules/mongoose/node_modules/ms/.npmignore b/Databases/node_modules/mongoose/node_modules/ms/.npmignore deleted file mode 100644 index 3c3629e6..00000000 --- a/Databases/node_modules/mongoose/node_modules/ms/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/Databases/node_modules/mongoose/node_modules/ms/Makefile b/Databases/node_modules/mongoose/node_modules/ms/Makefile deleted file mode 100644 index dded504d..00000000 --- a/Databases/node_modules/mongoose/node_modules/ms/Makefile +++ /dev/null @@ -1,8 +0,0 @@ - -test: - ./node_modules/.bin/mocha test/test.js - -test-browser: - ./node_modules/.bin/serve test/ - -.PHONY: test diff --git a/Databases/node_modules/mongoose/node_modules/ms/README.md b/Databases/node_modules/mongoose/node_modules/ms/README.md deleted file mode 100644 index c93d43f4..00000000 --- a/Databases/node_modules/mongoose/node_modules/ms/README.md +++ /dev/null @@ -1,65 +0,0 @@ - -# ms.js - -Ever find yourself doing math in your head or writing `1000 * 60 * 60 …`? -Don't want to add obstrusive `Number` prototype extensions to your reusable -/ distributable modules and projects? - -`ms` is a tiny utility that you can leverage when your application needs to -accept a number of miliseconds as a parameter. - -If a number is supplied to `ms`, it returns it immediately (e.g: -If a string that contains the number is supplied, it returns it immediately as -a number (e.g: it returns `100` for `'100'`). - -However, if you pass a string with a number and a valid unit, hte number of -equivalent ms is returned. - -```js -ms('1d') // 86400000 -ms('10h') // 36000000 -ms('2h') // 7200000 -ms('1m') // 60000 -ms('5ms') // 5000 -ms('100') // '100' -ms(100) // 100 -``` - -## How to use - -### Node - -```js -require('ms') -``` - -### Browser - -```html - -``` - -## Credits - -(The MIT License) - -Copyright (c) 2011 Guillermo Rauch <guillermo@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. diff --git a/Databases/node_modules/mongoose/node_modules/ms/ms.js b/Databases/node_modules/mongoose/node_modules/ms/ms.js deleted file mode 100644 index b4621bcd..00000000 --- a/Databases/node_modules/mongoose/node_modules/ms/ms.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - -# ms.js - -No more painful `setTimeout(fn, 60 * 4 * 3 * 2 * 1 * Infinity * NaN * '☃')`. - - ms('2d') // 172800000 - ms('1.5h') // 5400000 - ms('1h') // 3600000 - ms('1m') // 60000 - ms('5s') // 5000 - ms('500ms') // 500 - ms('100') // '100' - ms(100) // 100 - -**/ - -(function (g) { - var r = /(\d*.?\d+)([mshd]+)/ - , _ = {} - - _.ms = 1; - _.s = 1000; - _.m = _.s * 60; - _.h = _.m * 60; - _.d = _.h * 24; - - function ms (s) { - if (s == Number(s)) return Number(s); - r.exec(s.toLowerCase()); - return RegExp.$1 * _[RegExp.$2]; - } - - g.top ? g.ms = ms : module.exports = ms; -})(this); diff --git a/Databases/node_modules/mongoose/node_modules/ms/package.json b/Databases/node_modules/mongoose/node_modules/ms/package.json deleted file mode 100644 index fafd8e90..00000000 --- a/Databases/node_modules/mongoose/node_modules/ms/package.json +++ /dev/null @@ -1,38 +0,0 @@ -{ - "name": "ms", - "version": "0.1.0", - "description": "Tiny ms conversion utility", - "main": "./ms", - "devDependencies": { - "mocha": "*", - "expect.js": "*", - "serve": "*" - }, - "_npmUser": { - "name": "rauchg", - "email": "rauchg@gmail.com" - }, - "_id": "ms@0.1.0", - "dependencies": {}, - "engines": { - "node": "*" - }, - "_engineSupported": true, - "_npmVersion": "1.0.106", - "_nodeVersion": "v0.4.12", - "_defaultsLoaded": true, - "dist": { - "shasum": "f21fac490daf1d7667fd180fe9077389cc9442b2", - "tarball": "http://registry.npmjs.org/ms/-/ms-0.1.0.tgz" - }, - "maintainers": [ - { - "name": "rauchg", - "email": "rauchg@gmail.com" - } - ], - "directories": {}, - "_shasum": "f21fac490daf1d7667fd180fe9077389cc9442b2", - "_from": "ms@0.1.0", - "_resolved": "https://registry.npmjs.org/ms/-/ms-0.1.0.tgz" -} diff --git a/Databases/node_modules/mongoose/node_modules/ms/test/index.html b/Databases/node_modules/mongoose/node_modules/ms/test/index.html deleted file mode 100644 index 79edc409..00000000 --- a/Databases/node_modules/mongoose/node_modules/ms/test/index.html +++ /dev/null @@ -1,19 +0,0 @@ - - - - ms.js tests - - - - - - - - - - - - -
        - - diff --git a/Databases/node_modules/mongoose/node_modules/ms/test/support/jquery.js b/Databases/node_modules/mongoose/node_modules/ms/test/support/jquery.js deleted file mode 100644 index 8ccd0ea7..00000000 --- a/Databases/node_modules/mongoose/node_modules/ms/test/support/jquery.js +++ /dev/null @@ -1,9266 +0,0 @@ -/*! - * jQuery JavaScript Library v1.7.1 - * http://jquery.com/ - * - * Copyright 2011, John Resig - * Dual licensed under the MIT or GPL Version 2 licenses. - * http://jquery.org/license - * - * Includes Sizzle.js - * http://sizzlejs.com/ - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * - * Date: Mon Nov 21 21:11:03 2011 -0500 - */ -(function( window, undefined ) { - -// Use the correct document accordingly with window argument (sandbox) -var document = window.document, - navigator = window.navigator, - location = window.location; -var jQuery = (function() { - -// Define a local copy of jQuery -var jQuery = function( selector, context ) { - // The jQuery object is actually just the init constructor 'enhanced' - return new jQuery.fn.init( selector, context, rootjQuery ); - }, - - // Map over jQuery in case of overwrite - _jQuery = window.jQuery, - - // Map over the $ in case of overwrite - _$ = window.$, - - // A central reference to the root jQuery(document) - rootjQuery, - - // A simple way to check for HTML strings or ID strings - // Prioritize #id over to avoid XSS via location.hash (#9521) - quickExpr = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, - - // Check if a string has a non-whitespace character in it - rnotwhite = /\S/, - - // Used for trimming whitespace - trimLeft = /^\s+/, - trimRight = /\s+$/, - - // Match a standalone tag - rsingleTag = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, - - // JSON RegExp - rvalidchars = /^[\],:{}\s]*$/, - rvalidescape = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, - rvalidtokens = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, - rvalidbraces = /(?:^|:|,)(?:\s*\[)+/g, - - // Useragent RegExp - rwebkit = /(webkit)[ \/]([\w.]+)/, - ropera = /(opera)(?:.*version)?[ \/]([\w.]+)/, - rmsie = /(msie) ([\w.]+)/, - rmozilla = /(mozilla)(?:.*? rv:([\w.]+))?/, - - // Matches dashed string for camelizing - rdashAlpha = /-([a-z]|[0-9])/ig, - rmsPrefix = /^-ms-/, - - // Used by jQuery.camelCase as callback to replace() - fcamelCase = function( all, letter ) { - return ( letter + "" ).toUpperCase(); - }, - - // Keep a UserAgent string for use with jQuery.browser - userAgent = navigator.userAgent, - - // For matching the engine and version of the browser - browserMatch, - - // The deferred used on DOM ready - readyList, - - // The ready event handler - DOMContentLoaded, - - // Save a reference to some core methods - toString = Object.prototype.toString, - hasOwn = Object.prototype.hasOwnProperty, - push = Array.prototype.push, - slice = Array.prototype.slice, - trim = String.prototype.trim, - indexOf = Array.prototype.indexOf, - - // [[Class]] -> type pairs - class2type = {}; - -jQuery.fn = jQuery.prototype = { - constructor: jQuery, - init: function( selector, context, rootjQuery ) { - var match, elem, ret, doc; - - // Handle $(""), $(null), or $(undefined) - if ( !selector ) { - return this; - } - - // Handle $(DOMElement) - if ( selector.nodeType ) { - this.context = this[0] = selector; - this.length = 1; - return this; - } - - // The body element only exists once, optimize finding it - if ( selector === "body" && !context && document.body ) { - this.context = document; - this[0] = document.body; - this.selector = selector; - this.length = 1; - return this; - } - - // Handle HTML strings - if ( typeof selector === "string" ) { - // Are we dealing with HTML string or an ID? - if ( selector.charAt(0) === "<" && selector.charAt( selector.length - 1 ) === ">" && selector.length >= 3 ) { - // Assume that strings that start and end with <> are HTML and skip the regex check - match = [ null, selector, null ]; - - } else { - match = quickExpr.exec( selector ); - } - - // Verify a match, and that no context was specified for #id - if ( match && (match[1] || !context) ) { - - // HANDLE: $(html) -> $(array) - if ( match[1] ) { - context = context instanceof jQuery ? context[0] : context; - doc = ( context ? context.ownerDocument || context : document ); - - // If a single string is passed in and it's a single tag - // just do a createElement and skip the rest - ret = rsingleTag.exec( selector ); - - if ( ret ) { - if ( jQuery.isPlainObject( context ) ) { - selector = [ document.createElement( ret[1] ) ]; - jQuery.fn.attr.call( selector, context, true ); - - } else { - selector = [ doc.createElement( ret[1] ) ]; - } - - } else { - ret = jQuery.buildFragment( [ match[1] ], [ doc ] ); - selector = ( ret.cacheable ? jQuery.clone(ret.fragment) : ret.fragment ).childNodes; - } - - return jQuery.merge( this, selector ); - - // HANDLE: $("#id") - } else { - elem = document.getElementById( match[2] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id !== match[2] ) { - return rootjQuery.find( selector ); - } - - // Otherwise, we inject the element directly into the jQuery object - this.length = 1; - this[0] = elem; - } - - this.context = document; - this.selector = selector; - return this; - } - - // HANDLE: $(expr, $(...)) - } else if ( !context || context.jquery ) { - return ( context || rootjQuery ).find( selector ); - - // HANDLE: $(expr, context) - // (which is just equivalent to: $(context).find(expr) - } else { - return this.constructor( context ).find( selector ); - } - - // HANDLE: $(function) - // Shortcut for document ready - } else if ( jQuery.isFunction( selector ) ) { - return rootjQuery.ready( selector ); - } - - if ( selector.selector !== undefined ) { - this.selector = selector.selector; - this.context = selector.context; - } - - return jQuery.makeArray( selector, this ); - }, - - // Start with an empty selector - selector: "", - - // The current version of jQuery being used - jquery: "1.7.1", - - // The default length of a jQuery object is 0 - length: 0, - - // The number of elements contained in the matched element set - size: function() { - return this.length; - }, - - toArray: function() { - return slice.call( this, 0 ); - }, - - // Get the Nth element in the matched element set OR - // Get the whole matched element set as a clean array - get: function( num ) { - return num == null ? - - // Return a 'clean' array - this.toArray() : - - // Return just the object - ( num < 0 ? this[ this.length + num ] : this[ num ] ); - }, - - // Take an array of elements and push it onto the stack - // (returning the new matched element set) - pushStack: function( elems, name, selector ) { - // Build a new jQuery matched element set - var ret = this.constructor(); - - if ( jQuery.isArray( elems ) ) { - push.apply( ret, elems ); - - } else { - jQuery.merge( ret, elems ); - } - - // Add the old object onto the stack (as a reference) - ret.prevObject = this; - - ret.context = this.context; - - if ( name === "find" ) { - ret.selector = this.selector + ( this.selector ? " " : "" ) + selector; - } else if ( name ) { - ret.selector = this.selector + "." + name + "(" + selector + ")"; - } - - // Return the newly-formed element set - return ret; - }, - - // Execute a callback for every element in the matched set. - // (You can seed the arguments with an array of args, but this is - // only used internally.) - each: function( callback, args ) { - return jQuery.each( this, callback, args ); - }, - - ready: function( fn ) { - // Attach the listeners - jQuery.bindReady(); - - // Add the callback - readyList.add( fn ); - - return this; - }, - - eq: function( i ) { - i = +i; - return i === -1 ? - this.slice( i ) : - this.slice( i, i + 1 ); - }, - - first: function() { - return this.eq( 0 ); - }, - - last: function() { - return this.eq( -1 ); - }, - - slice: function() { - return this.pushStack( slice.apply( this, arguments ), - "slice", slice.call(arguments).join(",") ); - }, - - map: function( callback ) { - return this.pushStack( jQuery.map(this, function( elem, i ) { - return callback.call( elem, i, elem ); - })); - }, - - end: function() { - return this.prevObject || this.constructor(null); - }, - - // For internal use only. - // Behaves like an Array's method, not like a jQuery method. - push: push, - sort: [].sort, - splice: [].splice -}; - -// Give the init function the jQuery prototype for later instantiation -jQuery.fn.init.prototype = jQuery.fn; - -jQuery.extend = jQuery.fn.extend = function() { - var options, name, src, copy, copyIsArray, clone, - target = arguments[0] || {}, - i = 1, - length = arguments.length, - deep = false; - - // Handle a deep copy situation - if ( typeof target === "boolean" ) { - deep = target; - target = arguments[1] || {}; - // skip the boolean and the target - i = 2; - } - - // Handle case when target is a string or something (possible in deep copy) - if ( typeof target !== "object" && !jQuery.isFunction(target) ) { - target = {}; - } - - // extend jQuery itself if only one argument is passed - if ( length === i ) { - target = this; - --i; - } - - for ( ; i < length; i++ ) { - // Only deal with non-null/undefined values - if ( (options = arguments[ i ]) != null ) { - // Extend the base object - for ( name in options ) { - src = target[ name ]; - copy = options[ name ]; - - // Prevent never-ending loop - if ( target === copy ) { - continue; - } - - // Recurse if we're merging plain objects or arrays - if ( deep && copy && ( jQuery.isPlainObject(copy) || (copyIsArray = jQuery.isArray(copy)) ) ) { - if ( copyIsArray ) { - copyIsArray = false; - clone = src && jQuery.isArray(src) ? src : []; - - } else { - clone = src && jQuery.isPlainObject(src) ? src : {}; - } - - // Never move original objects, clone them - target[ name ] = jQuery.extend( deep, clone, copy ); - - // Don't bring in undefined values - } else if ( copy !== undefined ) { - target[ name ] = copy; - } - } - } - } - - // Return the modified object - return target; -}; - -jQuery.extend({ - noConflict: function( deep ) { - if ( window.$ === jQuery ) { - window.$ = _$; - } - - if ( deep && window.jQuery === jQuery ) { - window.jQuery = _jQuery; - } - - return jQuery; - }, - - // Is the DOM ready to be used? Set to true once it occurs. - isReady: false, - - // A counter to track how many items to wait for before - // the ready event fires. See #6781 - readyWait: 1, - - // Hold (or release) the ready event - holdReady: function( hold ) { - if ( hold ) { - jQuery.readyWait++; - } else { - jQuery.ready( true ); - } - }, - - // Handle when the DOM is ready - ready: function( wait ) { - // Either a released hold or an DOMready/load event and not yet ready - if ( (wait === true && !--jQuery.readyWait) || (wait !== true && !jQuery.isReady) ) { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( !document.body ) { - return setTimeout( jQuery.ready, 1 ); - } - - // Remember that the DOM is ready - jQuery.isReady = true; - - // If a normal DOM Ready event fired, decrement, and wait if need be - if ( wait !== true && --jQuery.readyWait > 0 ) { - return; - } - - // If there are functions bound, to execute - readyList.fireWith( document, [ jQuery ] ); - - // Trigger any bound ready events - if ( jQuery.fn.trigger ) { - jQuery( document ).trigger( "ready" ).off( "ready" ); - } - } - }, - - bindReady: function() { - if ( readyList ) { - return; - } - - readyList = jQuery.Callbacks( "once memory" ); - - // Catch cases where $(document).ready() is called after the - // browser event has already occurred. - if ( document.readyState === "complete" ) { - // Handle it asynchronously to allow scripts the opportunity to delay ready - return setTimeout( jQuery.ready, 1 ); - } - - // Mozilla, Opera and webkit nightlies currently support this event - if ( document.addEventListener ) { - // Use the handy event callback - document.addEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - - // A fallback to window.onload, that will always work - window.addEventListener( "load", jQuery.ready, false ); - - // If IE event model is used - } else if ( document.attachEvent ) { - // ensure firing before onload, - // maybe late but safe also for iframes - document.attachEvent( "onreadystatechange", DOMContentLoaded ); - - // A fallback to window.onload, that will always work - window.attachEvent( "onload", jQuery.ready ); - - // If IE and not a frame - // continually check to see if the document is ready - var toplevel = false; - - try { - toplevel = window.frameElement == null; - } catch(e) {} - - if ( document.documentElement.doScroll && toplevel ) { - doScrollCheck(); - } - } - }, - - // See test/unit/core.js for details concerning isFunction. - // Since version 1.3, DOM methods and functions like alert - // aren't supported. They return false on IE (#2968). - isFunction: function( obj ) { - return jQuery.type(obj) === "function"; - }, - - isArray: Array.isArray || function( obj ) { - return jQuery.type(obj) === "array"; - }, - - // A crude way of determining if an object is a window - isWindow: function( obj ) { - return obj && typeof obj === "object" && "setInterval" in obj; - }, - - isNumeric: function( obj ) { - return !isNaN( parseFloat(obj) ) && isFinite( obj ); - }, - - type: function( obj ) { - return obj == null ? - String( obj ) : - class2type[ toString.call(obj) ] || "object"; - }, - - isPlainObject: function( obj ) { - // Must be an Object. - // Because of IE, we also have to check the presence of the constructor property. - // Make sure that DOM nodes and window objects don't pass through, as well - if ( !obj || jQuery.type(obj) !== "object" || obj.nodeType || jQuery.isWindow( obj ) ) { - return false; - } - - try { - // Not own constructor property must be Object - if ( obj.constructor && - !hasOwn.call(obj, "constructor") && - !hasOwn.call(obj.constructor.prototype, "isPrototypeOf") ) { - return false; - } - } catch ( e ) { - // IE8,9 Will throw exceptions on certain host objects #9897 - return false; - } - - // Own properties are enumerated firstly, so to speed up, - // if last one is own, then all properties are own. - - var key; - for ( key in obj ) {} - - return key === undefined || hasOwn.call( obj, key ); - }, - - isEmptyObject: function( obj ) { - for ( var name in obj ) { - return false; - } - return true; - }, - - error: function( msg ) { - throw new Error( msg ); - }, - - parseJSON: function( data ) { - if ( typeof data !== "string" || !data ) { - return null; - } - - // Make sure leading/trailing whitespace is removed (IE can't handle it) - data = jQuery.trim( data ); - - // Attempt to parse using the native JSON parser first - if ( window.JSON && window.JSON.parse ) { - return window.JSON.parse( data ); - } - - // Make sure the incoming data is actual JSON - // Logic borrowed from http://json.org/json2.js - if ( rvalidchars.test( data.replace( rvalidescape, "@" ) - .replace( rvalidtokens, "]" ) - .replace( rvalidbraces, "")) ) { - - return ( new Function( "return " + data ) )(); - - } - jQuery.error( "Invalid JSON: " + data ); - }, - - // Cross-browser xml parsing - parseXML: function( data ) { - var xml, tmp; - try { - if ( window.DOMParser ) { // Standard - tmp = new DOMParser(); - xml = tmp.parseFromString( data , "text/xml" ); - } else { // IE - xml = new ActiveXObject( "Microsoft.XMLDOM" ); - xml.async = "false"; - xml.loadXML( data ); - } - } catch( e ) { - xml = undefined; - } - if ( !xml || !xml.documentElement || xml.getElementsByTagName( "parsererror" ).length ) { - jQuery.error( "Invalid XML: " + data ); - } - return xml; - }, - - noop: function() {}, - - // Evaluates a script in a global context - // Workarounds based on findings by Jim Driscoll - // http://weblogs.java.net/blog/driscoll/archive/2009/09/08/eval-javascript-global-context - globalEval: function( data ) { - if ( data && rnotwhite.test( data ) ) { - // We use execScript on Internet Explorer - // We use an anonymous function so that context is window - // rather than jQuery in Firefox - ( window.execScript || function( data ) { - window[ "eval" ].call( window, data ); - } )( data ); - } - }, - - // Convert dashed to camelCase; used by the css and data modules - // Microsoft forgot to hump their vendor prefix (#9572) - camelCase: function( string ) { - return string.replace( rmsPrefix, "ms-" ).replace( rdashAlpha, fcamelCase ); - }, - - nodeName: function( elem, name ) { - return elem.nodeName && elem.nodeName.toUpperCase() === name.toUpperCase(); - }, - - // args is for internal usage only - each: function( object, callback, args ) { - var name, i = 0, - length = object.length, - isObj = length === undefined || jQuery.isFunction( object ); - - if ( args ) { - if ( isObj ) { - for ( name in object ) { - if ( callback.apply( object[ name ], args ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.apply( object[ i++ ], args ) === false ) { - break; - } - } - } - - // A special, fast, case for the most common use of each - } else { - if ( isObj ) { - for ( name in object ) { - if ( callback.call( object[ name ], name, object[ name ] ) === false ) { - break; - } - } - } else { - for ( ; i < length; ) { - if ( callback.call( object[ i ], i, object[ i++ ] ) === false ) { - break; - } - } - } - } - - return object; - }, - - // Use native String.trim function wherever possible - trim: trim ? - function( text ) { - return text == null ? - "" : - trim.call( text ); - } : - - // Otherwise use our own trimming functionality - function( text ) { - return text == null ? - "" : - text.toString().replace( trimLeft, "" ).replace( trimRight, "" ); - }, - - // results is for internal usage only - makeArray: function( array, results ) { - var ret = results || []; - - if ( array != null ) { - // The window, strings (and functions) also have 'length' - // Tweaked logic slightly to handle Blackberry 4.7 RegExp issues #6930 - var type = jQuery.type( array ); - - if ( array.length == null || type === "string" || type === "function" || type === "regexp" || jQuery.isWindow( array ) ) { - push.call( ret, array ); - } else { - jQuery.merge( ret, array ); - } - } - - return ret; - }, - - inArray: function( elem, array, i ) { - var len; - - if ( array ) { - if ( indexOf ) { - return indexOf.call( array, elem, i ); - } - - len = array.length; - i = i ? i < 0 ? Math.max( 0, len + i ) : i : 0; - - for ( ; i < len; i++ ) { - // Skip accessing in sparse arrays - if ( i in array && array[ i ] === elem ) { - return i; - } - } - } - - return -1; - }, - - merge: function( first, second ) { - var i = first.length, - j = 0; - - if ( typeof second.length === "number" ) { - for ( var l = second.length; j < l; j++ ) { - first[ i++ ] = second[ j ]; - } - - } else { - while ( second[j] !== undefined ) { - first[ i++ ] = second[ j++ ]; - } - } - - first.length = i; - - return first; - }, - - grep: function( elems, callback, inv ) { - var ret = [], retVal; - inv = !!inv; - - // Go through the array, only saving the items - // that pass the validator function - for ( var i = 0, length = elems.length; i < length; i++ ) { - retVal = !!callback( elems[ i ], i ); - if ( inv !== retVal ) { - ret.push( elems[ i ] ); - } - } - - return ret; - }, - - // arg is for internal usage only - map: function( elems, callback, arg ) { - var value, key, ret = [], - i = 0, - length = elems.length, - // jquery objects are treated as arrays - isArray = elems instanceof jQuery || length !== undefined && typeof length === "number" && ( ( length > 0 && elems[ 0 ] && elems[ length -1 ] ) || length === 0 || jQuery.isArray( elems ) ) ; - - // Go through the array, translating each of the items to their - if ( isArray ) { - for ( ; i < length; i++ ) { - value = callback( elems[ i ], i, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - - // Go through every key on the object, - } else { - for ( key in elems ) { - value = callback( elems[ key ], key, arg ); - - if ( value != null ) { - ret[ ret.length ] = value; - } - } - } - - // Flatten any nested arrays - return ret.concat.apply( [], ret ); - }, - - // A global GUID counter for objects - guid: 1, - - // Bind a function to a context, optionally partially applying any - // arguments. - proxy: function( fn, context ) { - if ( typeof context === "string" ) { - var tmp = fn[ context ]; - context = fn; - fn = tmp; - } - - // Quick check to determine if target is callable, in the spec - // this throws a TypeError, but we will just return undefined. - if ( !jQuery.isFunction( fn ) ) { - return undefined; - } - - // Simulated bind - var args = slice.call( arguments, 2 ), - proxy = function() { - return fn.apply( context, args.concat( slice.call( arguments ) ) ); - }; - - // Set the guid of unique handler to the same of original handler, so it can be removed - proxy.guid = fn.guid = fn.guid || proxy.guid || jQuery.guid++; - - return proxy; - }, - - // Mutifunctional method to get and set values to a collection - // The value/s can optionally be executed if it's a function - access: function( elems, key, value, exec, fn, pass ) { - var length = elems.length; - - // Setting many attributes - if ( typeof key === "object" ) { - for ( var k in key ) { - jQuery.access( elems, k, key[k], exec, fn, value ); - } - return elems; - } - - // Setting one attribute - if ( value !== undefined ) { - // Optionally, function values get executed if exec is true - exec = !pass && exec && jQuery.isFunction(value); - - for ( var i = 0; i < length; i++ ) { - fn( elems[i], key, exec ? value.call( elems[i], i, fn( elems[i], key ) ) : value, pass ); - } - - return elems; - } - - // Getting an attribute - return length ? fn( elems[0], key ) : undefined; - }, - - now: function() { - return ( new Date() ).getTime(); - }, - - // Use of jQuery.browser is frowned upon. - // More details: http://docs.jquery.com/Utilities/jQuery.browser - uaMatch: function( ua ) { - ua = ua.toLowerCase(); - - var match = rwebkit.exec( ua ) || - ropera.exec( ua ) || - rmsie.exec( ua ) || - ua.indexOf("compatible") < 0 && rmozilla.exec( ua ) || - []; - - return { browser: match[1] || "", version: match[2] || "0" }; - }, - - sub: function() { - function jQuerySub( selector, context ) { - return new jQuerySub.fn.init( selector, context ); - } - jQuery.extend( true, jQuerySub, this ); - jQuerySub.superclass = this; - jQuerySub.fn = jQuerySub.prototype = this(); - jQuerySub.fn.constructor = jQuerySub; - jQuerySub.sub = this.sub; - jQuerySub.fn.init = function init( selector, context ) { - if ( context && context instanceof jQuery && !(context instanceof jQuerySub) ) { - context = jQuerySub( context ); - } - - return jQuery.fn.init.call( this, selector, context, rootjQuerySub ); - }; - jQuerySub.fn.init.prototype = jQuerySub.fn; - var rootjQuerySub = jQuerySub(document); - return jQuerySub; - }, - - browser: {} -}); - -// Populate the class2type map -jQuery.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(i, name) { - class2type[ "[object " + name + "]" ] = name.toLowerCase(); -}); - -browserMatch = jQuery.uaMatch( userAgent ); -if ( browserMatch.browser ) { - jQuery.browser[ browserMatch.browser ] = true; - jQuery.browser.version = browserMatch.version; -} - -// Deprecated, use jQuery.browser.webkit instead -if ( jQuery.browser.webkit ) { - jQuery.browser.safari = true; -} - -// IE doesn't match non-breaking spaces with \s -if ( rnotwhite.test( "\xA0" ) ) { - trimLeft = /^[\s\xA0]+/; - trimRight = /[\s\xA0]+$/; -} - -// All jQuery objects should point back to these -rootjQuery = jQuery(document); - -// Cleanup functions for the document ready method -if ( document.addEventListener ) { - DOMContentLoaded = function() { - document.removeEventListener( "DOMContentLoaded", DOMContentLoaded, false ); - jQuery.ready(); - }; - -} else if ( document.attachEvent ) { - DOMContentLoaded = function() { - // Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). - if ( document.readyState === "complete" ) { - document.detachEvent( "onreadystatechange", DOMContentLoaded ); - jQuery.ready(); - } - }; -} - -// The DOM ready check for Internet Explorer -function doScrollCheck() { - if ( jQuery.isReady ) { - return; - } - - try { - // If IE is used, use the trick by Diego Perini - // http://javascript.nwbox.com/IEContentLoaded/ - document.documentElement.doScroll("left"); - } catch(e) { - setTimeout( doScrollCheck, 1 ); - return; - } - - // and execute any waiting functions - jQuery.ready(); -} - -return jQuery; - -})(); - - -// String to Object flags format cache -var flagsCache = {}; - -// Convert String-formatted flags into Object-formatted ones and store in cache -function createFlags( flags ) { - var object = flagsCache[ flags ] = {}, - i, length; - flags = flags.split( /\s+/ ); - for ( i = 0, length = flags.length; i < length; i++ ) { - object[ flags[i] ] = true; - } - return object; -} - -/* - * Create a callback list using the following parameters: - * - * flags: an optional list of space-separated flags that will change how - * the callback list behaves - * - * By default a callback list will act like an event callback list and can be - * "fired" multiple times. - * - * Possible flags: - * - * once: will ensure the callback list can only be fired once (like a Deferred) - * - * memory: will keep track of previous values and will call any callback added - * after the list has been fired right away with the latest "memorized" - * values (like a Deferred) - * - * unique: will ensure a callback can only be added once (no duplicate in the list) - * - * stopOnFalse: interrupt callings when a callback returns false - * - */ -jQuery.Callbacks = function( flags ) { - - // Convert flags from String-formatted to Object-formatted - // (we check in cache first) - flags = flags ? ( flagsCache[ flags ] || createFlags( flags ) ) : {}; - - var // Actual callback list - list = [], - // Stack of fire calls for repeatable lists - stack = [], - // Last fire value (for non-forgettable lists) - memory, - // Flag to know if list is currently firing - firing, - // First callback to fire (used internally by add and fireWith) - firingStart, - // End of the loop when firing - firingLength, - // Index of currently firing callback (modified by remove if needed) - firingIndex, - // Add one or several callbacks to the list - add = function( args ) { - var i, - length, - elem, - type, - actual; - for ( i = 0, length = args.length; i < length; i++ ) { - elem = args[ i ]; - type = jQuery.type( elem ); - if ( type === "array" ) { - // Inspect recursively - add( elem ); - } else if ( type === "function" ) { - // Add if not in unique mode and callback is not in - if ( !flags.unique || !self.has( elem ) ) { - list.push( elem ); - } - } - } - }, - // Fire callbacks - fire = function( context, args ) { - args = args || []; - memory = !flags.memory || [ context, args ]; - firing = true; - firingIndex = firingStart || 0; - firingStart = 0; - firingLength = list.length; - for ( ; list && firingIndex < firingLength; firingIndex++ ) { - if ( list[ firingIndex ].apply( context, args ) === false && flags.stopOnFalse ) { - memory = true; // Mark as halted - break; - } - } - firing = false; - if ( list ) { - if ( !flags.once ) { - if ( stack && stack.length ) { - memory = stack.shift(); - self.fireWith( memory[ 0 ], memory[ 1 ] ); - } - } else if ( memory === true ) { - self.disable(); - } else { - list = []; - } - } - }, - // Actual Callbacks object - self = { - // Add a callback or a collection of callbacks to the list - add: function() { - if ( list ) { - var length = list.length; - add( arguments ); - // Do we need to add the callbacks to the - // current firing batch? - if ( firing ) { - firingLength = list.length; - // With memory, if we're not firing then - // we should call right away, unless previous - // firing was halted (stopOnFalse) - } else if ( memory && memory !== true ) { - firingStart = length; - fire( memory[ 0 ], memory[ 1 ] ); - } - } - return this; - }, - // Remove a callback from the list - remove: function() { - if ( list ) { - var args = arguments, - argIndex = 0, - argLength = args.length; - for ( ; argIndex < argLength ; argIndex++ ) { - for ( var i = 0; i < list.length; i++ ) { - if ( args[ argIndex ] === list[ i ] ) { - // Handle firingIndex and firingLength - if ( firing ) { - if ( i <= firingLength ) { - firingLength--; - if ( i <= firingIndex ) { - firingIndex--; - } - } - } - // Remove the element - list.splice( i--, 1 ); - // If we have some unicity property then - // we only need to do this once - if ( flags.unique ) { - break; - } - } - } - } - } - return this; - }, - // Control if a given callback is in the list - has: function( fn ) { - if ( list ) { - var i = 0, - length = list.length; - for ( ; i < length; i++ ) { - if ( fn === list[ i ] ) { - return true; - } - } - } - return false; - }, - // Remove all callbacks from the list - empty: function() { - list = []; - return this; - }, - // Have the list do nothing anymore - disable: function() { - list = stack = memory = undefined; - return this; - }, - // Is it disabled? - disabled: function() { - return !list; - }, - // Lock the list in its current state - lock: function() { - stack = undefined; - if ( !memory || memory === true ) { - self.disable(); - } - return this; - }, - // Is it locked? - locked: function() { - return !stack; - }, - // Call all callbacks with the given context and arguments - fireWith: function( context, args ) { - if ( stack ) { - if ( firing ) { - if ( !flags.once ) { - stack.push( [ context, args ] ); - } - } else if ( !( flags.once && memory ) ) { - fire( context, args ); - } - } - return this; - }, - // Call all the callbacks with the given arguments - fire: function() { - self.fireWith( this, arguments ); - return this; - }, - // To know if the callbacks have already been called at least once - fired: function() { - return !!memory; - } - }; - - return self; -}; - - - - -var // Static reference to slice - sliceDeferred = [].slice; - -jQuery.extend({ - - Deferred: function( func ) { - var doneList = jQuery.Callbacks( "once memory" ), - failList = jQuery.Callbacks( "once memory" ), - progressList = jQuery.Callbacks( "memory" ), - state = "pending", - lists = { - resolve: doneList, - reject: failList, - notify: progressList - }, - promise = { - done: doneList.add, - fail: failList.add, - progress: progressList.add, - - state: function() { - return state; - }, - - // Deprecated - isResolved: doneList.fired, - isRejected: failList.fired, - - then: function( doneCallbacks, failCallbacks, progressCallbacks ) { - deferred.done( doneCallbacks ).fail( failCallbacks ).progress( progressCallbacks ); - return this; - }, - always: function() { - deferred.done.apply( deferred, arguments ).fail.apply( deferred, arguments ); - return this; - }, - pipe: function( fnDone, fnFail, fnProgress ) { - return jQuery.Deferred(function( newDefer ) { - jQuery.each( { - done: [ fnDone, "resolve" ], - fail: [ fnFail, "reject" ], - progress: [ fnProgress, "notify" ] - }, function( handler, data ) { - var fn = data[ 0 ], - action = data[ 1 ], - returned; - if ( jQuery.isFunction( fn ) ) { - deferred[ handler ](function() { - returned = fn.apply( this, arguments ); - if ( returned && jQuery.isFunction( returned.promise ) ) { - returned.promise().then( newDefer.resolve, newDefer.reject, newDefer.notify ); - } else { - newDefer[ action + "With" ]( this === deferred ? newDefer : this, [ returned ] ); - } - }); - } else { - deferred[ handler ]( newDefer[ action ] ); - } - }); - }).promise(); - }, - // Get a promise for this deferred - // If obj is provided, the promise aspect is added to the object - promise: function( obj ) { - if ( obj == null ) { - obj = promise; - } else { - for ( var key in promise ) { - obj[ key ] = promise[ key ]; - } - } - return obj; - } - }, - deferred = promise.promise({}), - key; - - for ( key in lists ) { - deferred[ key ] = lists[ key ].fire; - deferred[ key + "With" ] = lists[ key ].fireWith; - } - - // Handle state - deferred.done( function() { - state = "resolved"; - }, failList.disable, progressList.lock ).fail( function() { - state = "rejected"; - }, doneList.disable, progressList.lock ); - - // Call given func if any - if ( func ) { - func.call( deferred, deferred ); - } - - // All done! - return deferred; - }, - - // Deferred helper - when: function( firstParam ) { - var args = sliceDeferred.call( arguments, 0 ), - i = 0, - length = args.length, - pValues = new Array( length ), - count = length, - pCount = length, - deferred = length <= 1 && firstParam && jQuery.isFunction( firstParam.promise ) ? - firstParam : - jQuery.Deferred(), - promise = deferred.promise(); - function resolveFunc( i ) { - return function( value ) { - args[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - if ( !( --count ) ) { - deferred.resolveWith( deferred, args ); - } - }; - } - function progressFunc( i ) { - return function( value ) { - pValues[ i ] = arguments.length > 1 ? sliceDeferred.call( arguments, 0 ) : value; - deferred.notifyWith( promise, pValues ); - }; - } - if ( length > 1 ) { - for ( ; i < length; i++ ) { - if ( args[ i ] && args[ i ].promise && jQuery.isFunction( args[ i ].promise ) ) { - args[ i ].promise().then( resolveFunc(i), deferred.reject, progressFunc(i) ); - } else { - --count; - } - } - if ( !count ) { - deferred.resolveWith( deferred, args ); - } - } else if ( deferred !== firstParam ) { - deferred.resolveWith( deferred, length ? [ firstParam ] : [] ); - } - return promise; - } -}); - - - - -jQuery.support = (function() { - - var support, - all, - a, - select, - opt, - input, - marginDiv, - fragment, - tds, - events, - eventName, - i, - isSupported, - div = document.createElement( "div" ), - documentElement = document.documentElement; - - // Preliminary tests - div.setAttribute("className", "t"); - div.innerHTML = "
        a"; - - all = div.getElementsByTagName( "*" ); - a = div.getElementsByTagName( "a" )[ 0 ]; - - // Can't get basic test support - if ( !all || !all.length || !a ) { - return {}; - } - - // First batch of supports tests - select = document.createElement( "select" ); - opt = select.appendChild( document.createElement("option") ); - input = div.getElementsByTagName( "input" )[ 0 ]; - - support = { - // IE strips leading whitespace when .innerHTML is used - leadingWhitespace: ( div.firstChild.nodeType === 3 ), - - // Make sure that tbody elements aren't automatically inserted - // IE will insert them into empty tables - tbody: !div.getElementsByTagName("tbody").length, - - // Make sure that link elements get serialized correctly by innerHTML - // This requires a wrapper element in IE - htmlSerialize: !!div.getElementsByTagName("link").length, - - // Get the style information from getAttribute - // (IE uses .cssText instead) - style: /top/.test( a.getAttribute("style") ), - - // Make sure that URLs aren't manipulated - // (IE normalizes it by default) - hrefNormalized: ( a.getAttribute("href") === "/a" ), - - // Make sure that element opacity exists - // (IE uses filter instead) - // Use a regex to work around a WebKit issue. See #5145 - opacity: /^0.55/.test( a.style.opacity ), - - // Verify style float existence - // (IE uses styleFloat instead of cssFloat) - cssFloat: !!a.style.cssFloat, - - // Make sure that if no value is specified for a checkbox - // that it defaults to "on". - // (WebKit defaults to "" instead) - checkOn: ( input.value === "on" ), - - // Make sure that a selected-by-default option has a working selected property. - // (WebKit defaults to false instead of true, IE too, if it's in an optgroup) - optSelected: opt.selected, - - // Test setAttribute on camelCase class. If it works, we need attrFixes when doing get/setAttribute (ie6/7) - getSetAttribute: div.className !== "t", - - // Tests for enctype support on a form(#6743) - enctype: !!document.createElement("form").enctype, - - // Makes sure cloning an html5 element does not cause problems - // Where outerHTML is undefined, this still works - html5Clone: document.createElement("nav").cloneNode( true ).outerHTML !== "<:nav>", - - // Will be defined later - submitBubbles: true, - changeBubbles: true, - focusinBubbles: false, - deleteExpando: true, - noCloneEvent: true, - inlineBlockNeedsLayout: false, - shrinkWrapBlocks: false, - reliableMarginRight: true - }; - - // Make sure checked status is properly cloned - input.checked = true; - support.noCloneChecked = input.cloneNode( true ).checked; - - // Make sure that the options inside disabled selects aren't marked as disabled - // (WebKit marks them as disabled) - select.disabled = true; - support.optDisabled = !opt.disabled; - - // Test to see if it's possible to delete an expando from an element - // Fails in Internet Explorer - try { - delete div.test; - } catch( e ) { - support.deleteExpando = false; - } - - if ( !div.addEventListener && div.attachEvent && div.fireEvent ) { - div.attachEvent( "onclick", function() { - // Cloning a node shouldn't copy over any - // bound event handlers (IE does this) - support.noCloneEvent = false; - }); - div.cloneNode( true ).fireEvent( "onclick" ); - } - - // Check if a radio maintains its value - // after being appended to the DOM - input = document.createElement("input"); - input.value = "t"; - input.setAttribute("type", "radio"); - support.radioValue = input.value === "t"; - - input.setAttribute("checked", "checked"); - div.appendChild( input ); - fragment = document.createDocumentFragment(); - fragment.appendChild( div.lastChild ); - - // WebKit doesn't clone checked state correctly in fragments - support.checkClone = fragment.cloneNode( true ).cloneNode( true ).lastChild.checked; - - // Check if a disconnected checkbox will retain its checked - // value of true after appended to the DOM (IE6/7) - support.appendChecked = input.checked; - - fragment.removeChild( input ); - fragment.appendChild( div ); - - div.innerHTML = ""; - - // Check if div with explicit width and no margin-right incorrectly - // gets computed margin-right based on width of container. For more - // info see bug #3333 - // Fails in WebKit before Feb 2011 nightlies - // WebKit Bug 13343 - getComputedStyle returns wrong value for margin-right - if ( window.getComputedStyle ) { - marginDiv = document.createElement( "div" ); - marginDiv.style.width = "0"; - marginDiv.style.marginRight = "0"; - div.style.width = "2px"; - div.appendChild( marginDiv ); - support.reliableMarginRight = - ( parseInt( ( window.getComputedStyle( marginDiv, null ) || { marginRight: 0 } ).marginRight, 10 ) || 0 ) === 0; - } - - // Technique from Juriy Zaytsev - // http://perfectionkills.com/detecting-event-support-without-browser-sniffing/ - // We only care about the case where non-standard event systems - // are used, namely in IE. Short-circuiting here helps us to - // avoid an eval call (in setAttribute) which can cause CSP - // to go haywire. See: https://developer.mozilla.org/en/Security/CSP - if ( div.attachEvent ) { - for( i in { - submit: 1, - change: 1, - focusin: 1 - }) { - eventName = "on" + i; - isSupported = ( eventName in div ); - if ( !isSupported ) { - div.setAttribute( eventName, "return;" ); - isSupported = ( typeof div[ eventName ] === "function" ); - } - support[ i + "Bubbles" ] = isSupported; - } - } - - fragment.removeChild( div ); - - // Null elements to avoid leaks in IE - fragment = select = opt = marginDiv = div = input = null; - - // Run tests that need a body at doc ready - jQuery(function() { - var container, outer, inner, table, td, offsetSupport, - conMarginTop, ptlm, vb, style, html, - body = document.getElementsByTagName("body")[0]; - - if ( !body ) { - // Return for frameset docs that don't have a body - return; - } - - conMarginTop = 1; - ptlm = "position:absolute;top:0;left:0;width:1px;height:1px;margin:0;"; - vb = "visibility:hidden;border:0;"; - style = "style='" + ptlm + "border:5px solid #000;padding:0;'"; - html = "
        " + - "" + - "
        "; - - container = document.createElement("div"); - container.style.cssText = vb + "width:0;height:0;position:static;top:0;margin-top:" + conMarginTop + "px"; - body.insertBefore( container, body.firstChild ); - - // Construct the test element - div = document.createElement("div"); - container.appendChild( div ); - - // Check if table cells still have offsetWidth/Height when they are set - // to display:none and there are still other visible table cells in a - // table row; if so, offsetWidth/Height are not reliable for use when - // determining if an element has been hidden directly using - // display:none (it is still safe to use offsets if a parent element is - // hidden; don safety goggles and see bug #4512 for more information). - // (only IE 8 fails this test) - div.innerHTML = "
        t
        "; - tds = div.getElementsByTagName( "td" ); - isSupported = ( tds[ 0 ].offsetHeight === 0 ); - - tds[ 0 ].style.display = ""; - tds[ 1 ].style.display = "none"; - - // Check if empty table cells still have offsetWidth/Height - // (IE <= 8 fail this test) - support.reliableHiddenOffsets = isSupported && ( tds[ 0 ].offsetHeight === 0 ); - - // Figure out if the W3C box model works as expected - div.innerHTML = ""; - div.style.width = div.style.paddingLeft = "1px"; - jQuery.boxModel = support.boxModel = div.offsetWidth === 2; - - if ( typeof div.style.zoom !== "undefined" ) { - // Check if natively block-level elements act like inline-block - // elements when setting their display to 'inline' and giving - // them layout - // (IE < 8 does this) - div.style.display = "inline"; - div.style.zoom = 1; - support.inlineBlockNeedsLayout = ( div.offsetWidth === 2 ); - - // Check if elements with layout shrink-wrap their children - // (IE 6 does this) - div.style.display = ""; - div.innerHTML = "
        "; - support.shrinkWrapBlocks = ( div.offsetWidth !== 2 ); - } - - div.style.cssText = ptlm + vb; - div.innerHTML = html; - - outer = div.firstChild; - inner = outer.firstChild; - td = outer.nextSibling.firstChild.firstChild; - - offsetSupport = { - doesNotAddBorder: ( inner.offsetTop !== 5 ), - doesAddBorderForTableAndCells: ( td.offsetTop === 5 ) - }; - - inner.style.position = "fixed"; - inner.style.top = "20px"; - - // safari subtracts parent border width here which is 5px - offsetSupport.fixedPosition = ( inner.offsetTop === 20 || inner.offsetTop === 15 ); - inner.style.position = inner.style.top = ""; - - outer.style.overflow = "hidden"; - outer.style.position = "relative"; - - offsetSupport.subtractsBorderForOverflowNotVisible = ( inner.offsetTop === -5 ); - offsetSupport.doesNotIncludeMarginInBodyOffset = ( body.offsetTop !== conMarginTop ); - - body.removeChild( container ); - div = container = null; - - jQuery.extend( support, offsetSupport ); - }); - - return support; -})(); - - - - -var rbrace = /^(?:\{.*\}|\[.*\])$/, - rmultiDash = /([A-Z])/g; - -jQuery.extend({ - cache: {}, - - // Please use with caution - uuid: 0, - - // Unique for each copy of jQuery on the page - // Non-digits removed to match rinlinejQuery - expando: "jQuery" + ( jQuery.fn.jquery + Math.random() ).replace( /\D/g, "" ), - - // The following elements throw uncatchable exceptions if you - // attempt to add expando properties to them. - noData: { - "embed": true, - // Ban all objects except for Flash (which handle expandos) - "object": "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", - "applet": true - }, - - hasData: function( elem ) { - elem = elem.nodeType ? jQuery.cache[ elem[jQuery.expando] ] : elem[ jQuery.expando ]; - return !!elem && !isEmptyDataObject( elem ); - }, - - data: function( elem, name, data, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var privateCache, thisCache, ret, - internalKey = jQuery.expando, - getByName = typeof name === "string", - - // We have to handle DOM nodes and JS objects differently because IE6-7 - // can't GC object references properly across the DOM-JS boundary - isNode = elem.nodeType, - - // Only DOM nodes need the global jQuery cache; JS object data is - // attached directly to the object so GC can occur automatically - cache = isNode ? jQuery.cache : elem, - - // Only defining an ID for JS objects if its cache already exists allows - // the code to shortcut on the same path as a DOM node with no cache - id = isNode ? elem[ internalKey ] : elem[ internalKey ] && internalKey, - isEvents = name === "events"; - - // Avoid doing any more work than we need to when trying to get data on an - // object that has no data at all - if ( (!id || !cache[id] || (!isEvents && !pvt && !cache[id].data)) && getByName && data === undefined ) { - return; - } - - if ( !id ) { - // Only DOM nodes need a new unique ID for each element since their data - // ends up in the global cache - if ( isNode ) { - elem[ internalKey ] = id = ++jQuery.uuid; - } else { - id = internalKey; - } - } - - if ( !cache[ id ] ) { - cache[ id ] = {}; - - // Avoids exposing jQuery metadata on plain JS objects when the object - // is serialized using JSON.stringify - if ( !isNode ) { - cache[ id ].toJSON = jQuery.noop; - } - } - - // An object can be passed to jQuery.data instead of a key/value pair; this gets - // shallow copied over onto the existing cache - if ( typeof name === "object" || typeof name === "function" ) { - if ( pvt ) { - cache[ id ] = jQuery.extend( cache[ id ], name ); - } else { - cache[ id ].data = jQuery.extend( cache[ id ].data, name ); - } - } - - privateCache = thisCache = cache[ id ]; - - // jQuery data() is stored in a separate object inside the object's internal data - // cache in order to avoid key collisions between internal data and user-defined - // data. - if ( !pvt ) { - if ( !thisCache.data ) { - thisCache.data = {}; - } - - thisCache = thisCache.data; - } - - if ( data !== undefined ) { - thisCache[ jQuery.camelCase( name ) ] = data; - } - - // Users should not attempt to inspect the internal events object using jQuery.data, - // it is undocumented and subject to change. But does anyone listen? No. - if ( isEvents && !thisCache[ name ] ) { - return privateCache.events; - } - - // Check for both converted-to-camel and non-converted data property names - // If a data property was specified - if ( getByName ) { - - // First Try to find as-is property data - ret = thisCache[ name ]; - - // Test for null|undefined property data - if ( ret == null ) { - - // Try to find the camelCased property - ret = thisCache[ jQuery.camelCase( name ) ]; - } - } else { - ret = thisCache; - } - - return ret; - }, - - removeData: function( elem, name, pvt /* Internal Use Only */ ) { - if ( !jQuery.acceptData( elem ) ) { - return; - } - - var thisCache, i, l, - - // Reference to internal data cache key - internalKey = jQuery.expando, - - isNode = elem.nodeType, - - // See jQuery.data for more information - cache = isNode ? jQuery.cache : elem, - - // See jQuery.data for more information - id = isNode ? elem[ internalKey ] : internalKey; - - // If there is already no cache entry for this object, there is no - // purpose in continuing - if ( !cache[ id ] ) { - return; - } - - if ( name ) { - - thisCache = pvt ? cache[ id ] : cache[ id ].data; - - if ( thisCache ) { - - // Support array or space separated string names for data keys - if ( !jQuery.isArray( name ) ) { - - // try the string as a key before any manipulation - if ( name in thisCache ) { - name = [ name ]; - } else { - - // split the camel cased version by spaces unless a key with the spaces exists - name = jQuery.camelCase( name ); - if ( name in thisCache ) { - name = [ name ]; - } else { - name = name.split( " " ); - } - } - } - - for ( i = 0, l = name.length; i < l; i++ ) { - delete thisCache[ name[i] ]; - } - - // If there is no data left in the cache, we want to continue - // and let the cache object itself get destroyed - if ( !( pvt ? isEmptyDataObject : jQuery.isEmptyObject )( thisCache ) ) { - return; - } - } - } - - // See jQuery.data for more information - if ( !pvt ) { - delete cache[ id ].data; - - // Don't destroy the parent cache unless the internal data object - // had been the only thing left in it - if ( !isEmptyDataObject(cache[ id ]) ) { - return; - } - } - - // Browsers that fail expando deletion also refuse to delete expandos on - // the window, but it will allow it on all other JS objects; other browsers - // don't care - // Ensure that `cache` is not a window object #10080 - if ( jQuery.support.deleteExpando || !cache.setInterval ) { - delete cache[ id ]; - } else { - cache[ id ] = null; - } - - // We destroyed the cache and need to eliminate the expando on the node to avoid - // false lookups in the cache for entries that no longer exist - if ( isNode ) { - // IE does not allow us to delete expando properties from nodes, - // nor does it have a removeAttribute function on Document nodes; - // we must handle all of these cases - if ( jQuery.support.deleteExpando ) { - delete elem[ internalKey ]; - } else if ( elem.removeAttribute ) { - elem.removeAttribute( internalKey ); - } else { - elem[ internalKey ] = null; - } - } - }, - - // For internal use only. - _data: function( elem, name, data ) { - return jQuery.data( elem, name, data, true ); - }, - - // A method for determining if a DOM node can handle the data expando - acceptData: function( elem ) { - if ( elem.nodeName ) { - var match = jQuery.noData[ elem.nodeName.toLowerCase() ]; - - if ( match ) { - return !(match === true || elem.getAttribute("classid") !== match); - } - } - - return true; - } -}); - -jQuery.fn.extend({ - data: function( key, value ) { - var parts, attr, name, - data = null; - - if ( typeof key === "undefined" ) { - if ( this.length ) { - data = jQuery.data( this[0] ); - - if ( this[0].nodeType === 1 && !jQuery._data( this[0], "parsedAttrs" ) ) { - attr = this[0].attributes; - for ( var i = 0, l = attr.length; i < l; i++ ) { - name = attr[i].name; - - if ( name.indexOf( "data-" ) === 0 ) { - name = jQuery.camelCase( name.substring(5) ); - - dataAttr( this[0], name, data[ name ] ); - } - } - jQuery._data( this[0], "parsedAttrs", true ); - } - } - - return data; - - } else if ( typeof key === "object" ) { - return this.each(function() { - jQuery.data( this, key ); - }); - } - - parts = key.split("."); - parts[1] = parts[1] ? "." + parts[1] : ""; - - if ( value === undefined ) { - data = this.triggerHandler("getData" + parts[1] + "!", [parts[0]]); - - // Try to fetch any internally stored data first - if ( data === undefined && this.length ) { - data = jQuery.data( this[0], key ); - data = dataAttr( this[0], key, data ); - } - - return data === undefined && parts[1] ? - this.data( parts[0] ) : - data; - - } else { - return this.each(function() { - var self = jQuery( this ), - args = [ parts[0], value ]; - - self.triggerHandler( "setData" + parts[1] + "!", args ); - jQuery.data( this, key, value ); - self.triggerHandler( "changeData" + parts[1] + "!", args ); - }); - } - }, - - removeData: function( key ) { - return this.each(function() { - jQuery.removeData( this, key ); - }); - } -}); - -function dataAttr( elem, key, data ) { - // If nothing was found internally, try to fetch any - // data from the HTML5 data-* attribute - if ( data === undefined && elem.nodeType === 1 ) { - - var name = "data-" + key.replace( rmultiDash, "-$1" ).toLowerCase(); - - data = elem.getAttribute( name ); - - if ( typeof data === "string" ) { - try { - data = data === "true" ? true : - data === "false" ? false : - data === "null" ? null : - jQuery.isNumeric( data ) ? parseFloat( data ) : - rbrace.test( data ) ? jQuery.parseJSON( data ) : - data; - } catch( e ) {} - - // Make sure we set the data so it isn't changed later - jQuery.data( elem, key, data ); - - } else { - data = undefined; - } - } - - return data; -} - -// checks a cache object for emptiness -function isEmptyDataObject( obj ) { - for ( var name in obj ) { - - // if the public data object is empty, the private is still empty - if ( name === "data" && jQuery.isEmptyObject( obj[name] ) ) { - continue; - } - if ( name !== "toJSON" ) { - return false; - } - } - - return true; -} - - - - -function handleQueueMarkDefer( elem, type, src ) { - var deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - defer = jQuery._data( elem, deferDataKey ); - if ( defer && - ( src === "queue" || !jQuery._data(elem, queueDataKey) ) && - ( src === "mark" || !jQuery._data(elem, markDataKey) ) ) { - // Give room for hard-coded callbacks to fire first - // and eventually mark/queue something else on the element - setTimeout( function() { - if ( !jQuery._data( elem, queueDataKey ) && - !jQuery._data( elem, markDataKey ) ) { - jQuery.removeData( elem, deferDataKey, true ); - defer.fire(); - } - }, 0 ); - } -} - -jQuery.extend({ - - _mark: function( elem, type ) { - if ( elem ) { - type = ( type || "fx" ) + "mark"; - jQuery._data( elem, type, (jQuery._data( elem, type ) || 0) + 1 ); - } - }, - - _unmark: function( force, elem, type ) { - if ( force !== true ) { - type = elem; - elem = force; - force = false; - } - if ( elem ) { - type = type || "fx"; - var key = type + "mark", - count = force ? 0 : ( (jQuery._data( elem, key ) || 1) - 1 ); - if ( count ) { - jQuery._data( elem, key, count ); - } else { - jQuery.removeData( elem, key, true ); - handleQueueMarkDefer( elem, type, "mark" ); - } - } - }, - - queue: function( elem, type, data ) { - var q; - if ( elem ) { - type = ( type || "fx" ) + "queue"; - q = jQuery._data( elem, type ); - - // Speed up dequeue by getting out quickly if this is just a lookup - if ( data ) { - if ( !q || jQuery.isArray(data) ) { - q = jQuery._data( elem, type, jQuery.makeArray(data) ); - } else { - q.push( data ); - } - } - return q || []; - } - }, - - dequeue: function( elem, type ) { - type = type || "fx"; - - var queue = jQuery.queue( elem, type ), - fn = queue.shift(), - hooks = {}; - - // If the fx queue is dequeued, always remove the progress sentinel - if ( fn === "inprogress" ) { - fn = queue.shift(); - } - - if ( fn ) { - // Add a progress sentinel to prevent the fx queue from being - // automatically dequeued - if ( type === "fx" ) { - queue.unshift( "inprogress" ); - } - - jQuery._data( elem, type + ".run", hooks ); - fn.call( elem, function() { - jQuery.dequeue( elem, type ); - }, hooks ); - } - - if ( !queue.length ) { - jQuery.removeData( elem, type + "queue " + type + ".run", true ); - handleQueueMarkDefer( elem, type, "queue" ); - } - } -}); - -jQuery.fn.extend({ - queue: function( type, data ) { - if ( typeof type !== "string" ) { - data = type; - type = "fx"; - } - - if ( data === undefined ) { - return jQuery.queue( this[0], type ); - } - return this.each(function() { - var queue = jQuery.queue( this, type, data ); - - if ( type === "fx" && queue[0] !== "inprogress" ) { - jQuery.dequeue( this, type ); - } - }); - }, - dequeue: function( type ) { - return this.each(function() { - jQuery.dequeue( this, type ); - }); - }, - // Based off of the plugin by Clint Helfers, with permission. - // http://blindsignals.com/index.php/2009/07/jquery-delay/ - delay: function( time, type ) { - time = jQuery.fx ? jQuery.fx.speeds[ time ] || time : time; - type = type || "fx"; - - return this.queue( type, function( next, hooks ) { - var timeout = setTimeout( next, time ); - hooks.stop = function() { - clearTimeout( timeout ); - }; - }); - }, - clearQueue: function( type ) { - return this.queue( type || "fx", [] ); - }, - // Get a promise resolved when queues of a certain type - // are emptied (fx is the type by default) - promise: function( type, object ) { - if ( typeof type !== "string" ) { - object = type; - type = undefined; - } - type = type || "fx"; - var defer = jQuery.Deferred(), - elements = this, - i = elements.length, - count = 1, - deferDataKey = type + "defer", - queueDataKey = type + "queue", - markDataKey = type + "mark", - tmp; - function resolve() { - if ( !( --count ) ) { - defer.resolveWith( elements, [ elements ] ); - } - } - while( i-- ) { - if (( tmp = jQuery.data( elements[ i ], deferDataKey, undefined, true ) || - ( jQuery.data( elements[ i ], queueDataKey, undefined, true ) || - jQuery.data( elements[ i ], markDataKey, undefined, true ) ) && - jQuery.data( elements[ i ], deferDataKey, jQuery.Callbacks( "once memory" ), true ) )) { - count++; - tmp.add( resolve ); - } - } - resolve(); - return defer.promise(); - } -}); - - - - -var rclass = /[\n\t\r]/g, - rspace = /\s+/, - rreturn = /\r/g, - rtype = /^(?:button|input)$/i, - rfocusable = /^(?:button|input|object|select|textarea)$/i, - rclickable = /^a(?:rea)?$/i, - rboolean = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, - getSetAttribute = jQuery.support.getSetAttribute, - nodeHook, boolHook, fixSpecified; - -jQuery.fn.extend({ - attr: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.attr ); - }, - - removeAttr: function( name ) { - return this.each(function() { - jQuery.removeAttr( this, name ); - }); - }, - - prop: function( name, value ) { - return jQuery.access( this, name, value, true, jQuery.prop ); - }, - - removeProp: function( name ) { - name = jQuery.propFix[ name ] || name; - return this.each(function() { - // try/catch handles cases where IE balks (such as removing a property on window) - try { - this[ name ] = undefined; - delete this[ name ]; - } catch( e ) {} - }); - }, - - addClass: function( value ) { - var classNames, i, l, elem, - setClass, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).addClass( value.call(this, j, this.className) ); - }); - } - - if ( value && typeof value === "string" ) { - classNames = value.split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 ) { - if ( !elem.className && classNames.length === 1 ) { - elem.className = value; - - } else { - setClass = " " + elem.className + " "; - - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - if ( !~setClass.indexOf( " " + classNames[ c ] + " " ) ) { - setClass += classNames[ c ] + " "; - } - } - elem.className = jQuery.trim( setClass ); - } - } - } - } - - return this; - }, - - removeClass: function( value ) { - var classNames, i, l, elem, className, c, cl; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( j ) { - jQuery( this ).removeClass( value.call(this, j, this.className) ); - }); - } - - if ( (value && typeof value === "string") || value === undefined ) { - classNames = ( value || "" ).split( rspace ); - - for ( i = 0, l = this.length; i < l; i++ ) { - elem = this[ i ]; - - if ( elem.nodeType === 1 && elem.className ) { - if ( value ) { - className = (" " + elem.className + " ").replace( rclass, " " ); - for ( c = 0, cl = classNames.length; c < cl; c++ ) { - className = className.replace(" " + classNames[ c ] + " ", " "); - } - elem.className = jQuery.trim( className ); - - } else { - elem.className = ""; - } - } - } - } - - return this; - }, - - toggleClass: function( value, stateVal ) { - var type = typeof value, - isBool = typeof stateVal === "boolean"; - - if ( jQuery.isFunction( value ) ) { - return this.each(function( i ) { - jQuery( this ).toggleClass( value.call(this, i, this.className, stateVal), stateVal ); - }); - } - - return this.each(function() { - if ( type === "string" ) { - // toggle individual class names - var className, - i = 0, - self = jQuery( this ), - state = stateVal, - classNames = value.split( rspace ); - - while ( (className = classNames[ i++ ]) ) { - // check each className given, space seperated list - state = isBool ? state : !self.hasClass( className ); - self[ state ? "addClass" : "removeClass" ]( className ); - } - - } else if ( type === "undefined" || type === "boolean" ) { - if ( this.className ) { - // store className if set - jQuery._data( this, "__className__", this.className ); - } - - // toggle whole className - this.className = this.className || value === false ? "" : jQuery._data( this, "__className__" ) || ""; - } - }); - }, - - hasClass: function( selector ) { - var className = " " + selector + " ", - i = 0, - l = this.length; - for ( ; i < l; i++ ) { - if ( this[i].nodeType === 1 && (" " + this[i].className + " ").replace(rclass, " ").indexOf( className ) > -1 ) { - return true; - } - } - - return false; - }, - - val: function( value ) { - var hooks, ret, isFunction, - elem = this[0]; - - if ( !arguments.length ) { - if ( elem ) { - hooks = jQuery.valHooks[ elem.nodeName.toLowerCase() ] || jQuery.valHooks[ elem.type ]; - - if ( hooks && "get" in hooks && (ret = hooks.get( elem, "value" )) !== undefined ) { - return ret; - } - - ret = elem.value; - - return typeof ret === "string" ? - // handle most common string cases - ret.replace(rreturn, "") : - // handle cases where value is null/undef or number - ret == null ? "" : ret; - } - - return; - } - - isFunction = jQuery.isFunction( value ); - - return this.each(function( i ) { - var self = jQuery(this), val; - - if ( this.nodeType !== 1 ) { - return; - } - - if ( isFunction ) { - val = value.call( this, i, self.val() ); - } else { - val = value; - } - - // Treat null/undefined as ""; convert numbers to string - if ( val == null ) { - val = ""; - } else if ( typeof val === "number" ) { - val += ""; - } else if ( jQuery.isArray( val ) ) { - val = jQuery.map(val, function ( value ) { - return value == null ? "" : value + ""; - }); - } - - hooks = jQuery.valHooks[ this.nodeName.toLowerCase() ] || jQuery.valHooks[ this.type ]; - - // If set returns undefined, fall back to normal setting - if ( !hooks || !("set" in hooks) || hooks.set( this, val, "value" ) === undefined ) { - this.value = val; - } - }); - } -}); - -jQuery.extend({ - valHooks: { - option: { - get: function( elem ) { - // attributes.value is undefined in Blackberry 4.7 but - // uses .value. See #6932 - var val = elem.attributes.value; - return !val || val.specified ? elem.value : elem.text; - } - }, - select: { - get: function( elem ) { - var value, i, max, option, - index = elem.selectedIndex, - values = [], - options = elem.options, - one = elem.type === "select-one"; - - // Nothing was selected - if ( index < 0 ) { - return null; - } - - // Loop through all the selected options - i = one ? index : 0; - max = one ? index + 1 : options.length; - for ( ; i < max; i++ ) { - option = options[ i ]; - - // Don't return options that are disabled or in a disabled optgroup - if ( option.selected && (jQuery.support.optDisabled ? !option.disabled : option.getAttribute("disabled") === null) && - (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) { - - // Get the specific value for the option - value = jQuery( option ).val(); - - // We don't need an array for one selects - if ( one ) { - return value; - } - - // Multi-Selects return an array - values.push( value ); - } - } - - // Fixes Bug #2551 -- select.val() broken in IE after form.reset() - if ( one && !values.length && options.length ) { - return jQuery( options[ index ] ).val(); - } - - return values; - }, - - set: function( elem, value ) { - var values = jQuery.makeArray( value ); - - jQuery(elem).find("option").each(function() { - this.selected = jQuery.inArray( jQuery(this).val(), values ) >= 0; - }); - - if ( !values.length ) { - elem.selectedIndex = -1; - } - return values; - } - } - }, - - attrFn: { - val: true, - css: true, - html: true, - text: true, - data: true, - width: true, - height: true, - offset: true - }, - - attr: function( elem, name, value, pass ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set attributes on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - if ( pass && name in jQuery.attrFn ) { - return jQuery( elem )[ name ]( value ); - } - - // Fallback to prop when attributes are not supported - if ( typeof elem.getAttribute === "undefined" ) { - return jQuery.prop( elem, name, value ); - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - // All attributes are lowercase - // Grab necessary hook if one is defined - if ( notxml ) { - name = name.toLowerCase(); - hooks = jQuery.attrHooks[ name ] || ( rboolean.test( name ) ? boolHook : nodeHook ); - } - - if ( value !== undefined ) { - - if ( value === null ) { - jQuery.removeAttr( elem, name ); - return; - - } else if ( hooks && "set" in hooks && notxml && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - elem.setAttribute( name, "" + value ); - return value; - } - - } else if ( hooks && "get" in hooks && notxml && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - - ret = elem.getAttribute( name ); - - // Non-existent attributes return null, we normalize to undefined - return ret === null ? - undefined : - ret; - } - }, - - removeAttr: function( elem, value ) { - var propName, attrNames, name, l, - i = 0; - - if ( value && elem.nodeType === 1 ) { - attrNames = value.toLowerCase().split( rspace ); - l = attrNames.length; - - for ( ; i < l; i++ ) { - name = attrNames[ i ]; - - if ( name ) { - propName = jQuery.propFix[ name ] || name; - - // See #9699 for explanation of this approach (setting first, then removal) - jQuery.attr( elem, name, "" ); - elem.removeAttribute( getSetAttribute ? name : propName ); - - // Set corresponding property to false for boolean attributes - if ( rboolean.test( name ) && propName in elem ) { - elem[ propName ] = false; - } - } - } - } - }, - - attrHooks: { - type: { - set: function( elem, value ) { - // We can't allow the type property to be changed (since it causes problems in IE) - if ( rtype.test( elem.nodeName ) && elem.parentNode ) { - jQuery.error( "type property can't be changed" ); - } else if ( !jQuery.support.radioValue && value === "radio" && jQuery.nodeName(elem, "input") ) { - // Setting the type on a radio button after the value resets the value in IE6-9 - // Reset value to it's default in case type is set after value - // This is for element creation - var val = elem.value; - elem.setAttribute( "type", value ); - if ( val ) { - elem.value = val; - } - return value; - } - } - }, - // Use the value property for back compat - // Use the nodeHook for button elements in IE6/7 (#1954) - value: { - get: function( elem, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.get( elem, name ); - } - return name in elem ? - elem.value : - null; - }, - set: function( elem, value, name ) { - if ( nodeHook && jQuery.nodeName( elem, "button" ) ) { - return nodeHook.set( elem, value, name ); - } - // Does not return so that setAttribute is also used - elem.value = value; - } - } - }, - - propFix: { - tabindex: "tabIndex", - readonly: "readOnly", - "for": "htmlFor", - "class": "className", - maxlength: "maxLength", - cellspacing: "cellSpacing", - cellpadding: "cellPadding", - rowspan: "rowSpan", - colspan: "colSpan", - usemap: "useMap", - frameborder: "frameBorder", - contenteditable: "contentEditable" - }, - - prop: function( elem, name, value ) { - var ret, hooks, notxml, - nType = elem.nodeType; - - // don't get/set properties on text, comment and attribute nodes - if ( !elem || nType === 3 || nType === 8 || nType === 2 ) { - return; - } - - notxml = nType !== 1 || !jQuery.isXMLDoc( elem ); - - if ( notxml ) { - // Fix name and attach hooks - name = jQuery.propFix[ name ] || name; - hooks = jQuery.propHooks[ name ]; - } - - if ( value !== undefined ) { - if ( hooks && "set" in hooks && (ret = hooks.set( elem, value, name )) !== undefined ) { - return ret; - - } else { - return ( elem[ name ] = value ); - } - - } else { - if ( hooks && "get" in hooks && (ret = hooks.get( elem, name )) !== null ) { - return ret; - - } else { - return elem[ name ]; - } - } - }, - - propHooks: { - tabIndex: { - get: function( elem ) { - // elem.tabIndex doesn't always return the correct value when it hasn't been explicitly set - // http://fluidproject.org/blog/2008/01/09/getting-setting-and-removing-tabindex-values-with-javascript/ - var attributeNode = elem.getAttributeNode("tabindex"); - - return attributeNode && attributeNode.specified ? - parseInt( attributeNode.value, 10 ) : - rfocusable.test( elem.nodeName ) || rclickable.test( elem.nodeName ) && elem.href ? - 0 : - undefined; - } - } - } -}); - -// Add the tabIndex propHook to attrHooks for back-compat (different case is intentional) -jQuery.attrHooks.tabindex = jQuery.propHooks.tabIndex; - -// Hook for boolean attributes -boolHook = { - get: function( elem, name ) { - // Align boolean attributes with corresponding properties - // Fall back to attribute presence where some booleans are not supported - var attrNode, - property = jQuery.prop( elem, name ); - return property === true || typeof property !== "boolean" && ( attrNode = elem.getAttributeNode(name) ) && attrNode.nodeValue !== false ? - name.toLowerCase() : - undefined; - }, - set: function( elem, value, name ) { - var propName; - if ( value === false ) { - // Remove boolean attributes when set to false - jQuery.removeAttr( elem, name ); - } else { - // value is true since we know at this point it's type boolean and not false - // Set boolean attributes to the same name and set the DOM property - propName = jQuery.propFix[ name ] || name; - if ( propName in elem ) { - // Only set the IDL specifically if it already exists on the element - elem[ propName ] = true; - } - - elem.setAttribute( name, name.toLowerCase() ); - } - return name; - } -}; - -// IE6/7 do not support getting/setting some attributes with get/setAttribute -if ( !getSetAttribute ) { - - fixSpecified = { - name: true, - id: true - }; - - // Use this for any attribute in IE6/7 - // This fixes almost every IE6/7 issue - nodeHook = jQuery.valHooks.button = { - get: function( elem, name ) { - var ret; - ret = elem.getAttributeNode( name ); - return ret && ( fixSpecified[ name ] ? ret.nodeValue !== "" : ret.specified ) ? - ret.nodeValue : - undefined; - }, - set: function( elem, value, name ) { - // Set the existing or create a new attribute node - var ret = elem.getAttributeNode( name ); - if ( !ret ) { - ret = document.createAttribute( name ); - elem.setAttributeNode( ret ); - } - return ( ret.nodeValue = value + "" ); - } - }; - - // Apply the nodeHook to tabindex - jQuery.attrHooks.tabindex.set = nodeHook.set; - - // Set width and height to auto instead of 0 on empty string( Bug #8150 ) - // This is for removals - jQuery.each([ "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - set: function( elem, value ) { - if ( value === "" ) { - elem.setAttribute( name, "auto" ); - return value; - } - } - }); - }); - - // Set contenteditable to false on removals(#10429) - // Setting to empty string throws an error as an invalid value - jQuery.attrHooks.contenteditable = { - get: nodeHook.get, - set: function( elem, value, name ) { - if ( value === "" ) { - value = "false"; - } - nodeHook.set( elem, value, name ); - } - }; -} - - -// Some attributes require a special call on IE -if ( !jQuery.support.hrefNormalized ) { - jQuery.each([ "href", "src", "width", "height" ], function( i, name ) { - jQuery.attrHooks[ name ] = jQuery.extend( jQuery.attrHooks[ name ], { - get: function( elem ) { - var ret = elem.getAttribute( name, 2 ); - return ret === null ? undefined : ret; - } - }); - }); -} - -if ( !jQuery.support.style ) { - jQuery.attrHooks.style = { - get: function( elem ) { - // Return undefined in the case of empty string - // Normalize to lowercase since IE uppercases css property names - return elem.style.cssText.toLowerCase() || undefined; - }, - set: function( elem, value ) { - return ( elem.style.cssText = "" + value ); - } - }; -} - -// Safari mis-reports the default selected property of an option -// Accessing the parent's selectedIndex property fixes it -if ( !jQuery.support.optSelected ) { - jQuery.propHooks.selected = jQuery.extend( jQuery.propHooks.selected, { - get: function( elem ) { - var parent = elem.parentNode; - - if ( parent ) { - parent.selectedIndex; - - // Make sure that it also works with optgroups, see #5701 - if ( parent.parentNode ) { - parent.parentNode.selectedIndex; - } - } - return null; - } - }); -} - -// IE6/7 call enctype encoding -if ( !jQuery.support.enctype ) { - jQuery.propFix.enctype = "encoding"; -} - -// Radios and checkboxes getter/setter -if ( !jQuery.support.checkOn ) { - jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = { - get: function( elem ) { - // Handle the case where in Webkit "" is returned instead of "on" if a value isn't specified - return elem.getAttribute("value") === null ? "on" : elem.value; - } - }; - }); -} -jQuery.each([ "radio", "checkbox" ], function() { - jQuery.valHooks[ this ] = jQuery.extend( jQuery.valHooks[ this ], { - set: function( elem, value ) { - if ( jQuery.isArray( value ) ) { - return ( elem.checked = jQuery.inArray( jQuery(elem).val(), value ) >= 0 ); - } - } - }); -}); - - - - -var rformElems = /^(?:textarea|input|select)$/i, - rtypenamespace = /^([^\.]*)?(?:\.(.+))?$/, - rhoverHack = /\bhover(\.\S+)?\b/, - rkeyEvent = /^key/, - rmouseEvent = /^(?:mouse|contextmenu)|click/, - rfocusMorph = /^(?:focusinfocus|focusoutblur)$/, - rquickIs = /^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/, - quickParse = function( selector ) { - var quick = rquickIs.exec( selector ); - if ( quick ) { - // 0 1 2 3 - // [ _, tag, id, class ] - quick[1] = ( quick[1] || "" ).toLowerCase(); - quick[3] = quick[3] && new RegExp( "(?:^|\\s)" + quick[3] + "(?:\\s|$)" ); - } - return quick; - }, - quickIs = function( elem, m ) { - var attrs = elem.attributes || {}; - return ( - (!m[1] || elem.nodeName.toLowerCase() === m[1]) && - (!m[2] || (attrs.id || {}).value === m[2]) && - (!m[3] || m[3].test( (attrs[ "class" ] || {}).value )) - ); - }, - hoverHack = function( events ) { - return jQuery.event.special.hover ? events : events.replace( rhoverHack, "mouseenter$1 mouseleave$1" ); - }; - -/* - * Helper functions for managing events -- not part of the public interface. - * Props to Dean Edwards' addEvent library for many of the ideas. - */ -jQuery.event = { - - add: function( elem, types, handler, data, selector ) { - - var elemData, eventHandle, events, - t, tns, type, namespaces, handleObj, - handleObjIn, quick, handlers, special; - - // Don't attach events to noData or text/comment nodes (allow plain objects tho) - if ( elem.nodeType === 3 || elem.nodeType === 8 || !types || !handler || !(elemData = jQuery._data( elem )) ) { - return; - } - - // Caller can pass in an object of custom data in lieu of the handler - if ( handler.handler ) { - handleObjIn = handler; - handler = handleObjIn.handler; - } - - // Make sure that the handler has a unique ID, used to find/remove it later - if ( !handler.guid ) { - handler.guid = jQuery.guid++; - } - - // Init the element's event structure and main handler, if this is the first - events = elemData.events; - if ( !events ) { - elemData.events = events = {}; - } - eventHandle = elemData.handle; - if ( !eventHandle ) { - elemData.handle = eventHandle = function( e ) { - // Discard the second event of a jQuery.event.trigger() and - // when an event is called after a page has unloaded - return typeof jQuery !== "undefined" && (!e || jQuery.event.triggered !== e.type) ? - jQuery.event.dispatch.apply( eventHandle.elem, arguments ) : - undefined; - }; - // Add elem as a property of the handle fn to prevent a memory leak with IE non-native events - eventHandle.elem = elem; - } - - // Handle multiple events separated by a space - // jQuery(...).bind("mouseover mouseout", fn); - types = jQuery.trim( hoverHack(types) ).split( " " ); - for ( t = 0; t < types.length; t++ ) { - - tns = rtypenamespace.exec( types[t] ) || []; - type = tns[1]; - namespaces = ( tns[2] || "" ).split( "." ).sort(); - - // If event changes its type, use the special event handlers for the changed type - special = jQuery.event.special[ type ] || {}; - - // If selector defined, determine special event api type, otherwise given type - type = ( selector ? special.delegateType : special.bindType ) || type; - - // Update special based on newly reset type - special = jQuery.event.special[ type ] || {}; - - // handleObj is passed to all event handlers - handleObj = jQuery.extend({ - type: type, - origType: tns[1], - data: data, - handler: handler, - guid: handler.guid, - selector: selector, - quick: quickParse( selector ), - namespace: namespaces.join(".") - }, handleObjIn ); - - // Init the event handler queue if we're the first - handlers = events[ type ]; - if ( !handlers ) { - handlers = events[ type ] = []; - handlers.delegateCount = 0; - - // Only use addEventListener/attachEvent if the special events handler returns false - if ( !special.setup || special.setup.call( elem, data, namespaces, eventHandle ) === false ) { - // Bind the global event handler to the element - if ( elem.addEventListener ) { - elem.addEventListener( type, eventHandle, false ); - - } else if ( elem.attachEvent ) { - elem.attachEvent( "on" + type, eventHandle ); - } - } - } - - if ( special.add ) { - special.add.call( elem, handleObj ); - - if ( !handleObj.handler.guid ) { - handleObj.handler.guid = handler.guid; - } - } - - // Add to the element's handler list, delegates in front - if ( selector ) { - handlers.splice( handlers.delegateCount++, 0, handleObj ); - } else { - handlers.push( handleObj ); - } - - // Keep track of which events have ever been used, for event optimization - jQuery.event.global[ type ] = true; - } - - // Nullify elem to prevent memory leaks in IE - elem = null; - }, - - global: {}, - - // Detach an event or set of events from an element - remove: function( elem, types, handler, selector, mappedTypes ) { - - var elemData = jQuery.hasData( elem ) && jQuery._data( elem ), - t, tns, type, origType, namespaces, origCount, - j, events, special, handle, eventType, handleObj; - - if ( !elemData || !(events = elemData.events) ) { - return; - } - - // Once for each type.namespace in types; type may be omitted - types = jQuery.trim( hoverHack( types || "" ) ).split(" "); - for ( t = 0; t < types.length; t++ ) { - tns = rtypenamespace.exec( types[t] ) || []; - type = origType = tns[1]; - namespaces = tns[2]; - - // Unbind all events (on this namespace, if provided) for the element - if ( !type ) { - for ( type in events ) { - jQuery.event.remove( elem, type + types[ t ], handler, selector, true ); - } - continue; - } - - special = jQuery.event.special[ type ] || {}; - type = ( selector? special.delegateType : special.bindType ) || type; - eventType = events[ type ] || []; - origCount = eventType.length; - namespaces = namespaces ? new RegExp("(^|\\.)" + namespaces.split(".").sort().join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - - // Remove matching events - for ( j = 0; j < eventType.length; j++ ) { - handleObj = eventType[ j ]; - - if ( ( mappedTypes || origType === handleObj.origType ) && - ( !handler || handler.guid === handleObj.guid ) && - ( !namespaces || namespaces.test( handleObj.namespace ) ) && - ( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) { - eventType.splice( j--, 1 ); - - if ( handleObj.selector ) { - eventType.delegateCount--; - } - if ( special.remove ) { - special.remove.call( elem, handleObj ); - } - } - } - - // Remove generic event handler if we removed something and no more handlers exist - // (avoids potential for endless recursion during removal of special event handlers) - if ( eventType.length === 0 && origCount !== eventType.length ) { - if ( !special.teardown || special.teardown.call( elem, namespaces ) === false ) { - jQuery.removeEvent( elem, type, elemData.handle ); - } - - delete events[ type ]; - } - } - - // Remove the expando if it's no longer used - if ( jQuery.isEmptyObject( events ) ) { - handle = elemData.handle; - if ( handle ) { - handle.elem = null; - } - - // removeData also checks for emptiness and clears the expando if empty - // so use it instead of delete - jQuery.removeData( elem, [ "events", "handle" ], true ); - } - }, - - // Events that are safe to short-circuit if no handlers are attached. - // Native DOM events should not be added, they may have inline handlers. - customEvent: { - "getData": true, - "setData": true, - "changeData": true - }, - - trigger: function( event, data, elem, onlyHandlers ) { - // Don't do events on text and comment nodes - if ( elem && (elem.nodeType === 3 || elem.nodeType === 8) ) { - return; - } - - // Event object or event type - var type = event.type || event, - namespaces = [], - cache, exclusive, i, cur, old, ontype, special, handle, eventPath, bubbleType; - - // focus/blur morphs to focusin/out; ensure we're not firing them right now - if ( rfocusMorph.test( type + jQuery.event.triggered ) ) { - return; - } - - if ( type.indexOf( "!" ) >= 0 ) { - // Exclusive events trigger only for the exact event (no namespaces) - type = type.slice(0, -1); - exclusive = true; - } - - if ( type.indexOf( "." ) >= 0 ) { - // Namespaced trigger; create a regexp to match event type in handle() - namespaces = type.split("."); - type = namespaces.shift(); - namespaces.sort(); - } - - if ( (!elem || jQuery.event.customEvent[ type ]) && !jQuery.event.global[ type ] ) { - // No jQuery handlers for this event type, and it can't have inline handlers - return; - } - - // Caller can pass in an Event, Object, or just an event type string - event = typeof event === "object" ? - // jQuery.Event object - event[ jQuery.expando ] ? event : - // Object literal - new jQuery.Event( type, event ) : - // Just the event type (string) - new jQuery.Event( type ); - - event.type = type; - event.isTrigger = true; - event.exclusive = exclusive; - event.namespace = namespaces.join( "." ); - event.namespace_re = event.namespace? new RegExp("(^|\\.)" + namespaces.join("\\.(?:.*\\.)?") + "(\\.|$)") : null; - ontype = type.indexOf( ":" ) < 0 ? "on" + type : ""; - - // Handle a global trigger - if ( !elem ) { - - // TODO: Stop taunting the data cache; remove global events and always attach to document - cache = jQuery.cache; - for ( i in cache ) { - if ( cache[ i ].events && cache[ i ].events[ type ] ) { - jQuery.event.trigger( event, data, cache[ i ].handle.elem, true ); - } - } - return; - } - - // Clean up the event in case it is being reused - event.result = undefined; - if ( !event.target ) { - event.target = elem; - } - - // Clone any incoming data and prepend the event, creating the handler arg list - data = data != null ? jQuery.makeArray( data ) : []; - data.unshift( event ); - - // Allow special events to draw outside the lines - special = jQuery.event.special[ type ] || {}; - if ( special.trigger && special.trigger.apply( elem, data ) === false ) { - return; - } - - // Determine event propagation path in advance, per W3C events spec (#9951) - // Bubble up to document, then to window; watch for a global ownerDocument var (#9724) - eventPath = [[ elem, special.bindType || type ]]; - if ( !onlyHandlers && !special.noBubble && !jQuery.isWindow( elem ) ) { - - bubbleType = special.delegateType || type; - cur = rfocusMorph.test( bubbleType + type ) ? elem : elem.parentNode; - old = null; - for ( ; cur; cur = cur.parentNode ) { - eventPath.push([ cur, bubbleType ]); - old = cur; - } - - // Only add window if we got to document (e.g., not plain obj or detached DOM) - if ( old && old === elem.ownerDocument ) { - eventPath.push([ old.defaultView || old.parentWindow || window, bubbleType ]); - } - } - - // Fire handlers on the event path - for ( i = 0; i < eventPath.length && !event.isPropagationStopped(); i++ ) { - - cur = eventPath[i][0]; - event.type = eventPath[i][1]; - - handle = ( jQuery._data( cur, "events" ) || {} )[ event.type ] && jQuery._data( cur, "handle" ); - if ( handle ) { - handle.apply( cur, data ); - } - // Note that this is a bare JS function and not a jQuery handler - handle = ontype && cur[ ontype ]; - if ( handle && jQuery.acceptData( cur ) && handle.apply( cur, data ) === false ) { - event.preventDefault(); - } - } - event.type = type; - - // If nobody prevented the default action, do it now - if ( !onlyHandlers && !event.isDefaultPrevented() ) { - - if ( (!special._default || special._default.apply( elem.ownerDocument, data ) === false) && - !(type === "click" && jQuery.nodeName( elem, "a" )) && jQuery.acceptData( elem ) ) { - - // Call a native DOM method on the target with the same name name as the event. - // Can't use an .isFunction() check here because IE6/7 fails that test. - // Don't do default actions on window, that's where global variables be (#6170) - // IE<9 dies on focus/blur to hidden element (#1486) - if ( ontype && elem[ type ] && ((type !== "focus" && type !== "blur") || event.target.offsetWidth !== 0) && !jQuery.isWindow( elem ) ) { - - // Don't re-trigger an onFOO event when we call its FOO() method - old = elem[ ontype ]; - - if ( old ) { - elem[ ontype ] = null; - } - - // Prevent re-triggering of the same event, since we already bubbled it above - jQuery.event.triggered = type; - elem[ type ](); - jQuery.event.triggered = undefined; - - if ( old ) { - elem[ ontype ] = old; - } - } - } - } - - return event.result; - }, - - dispatch: function( event ) { - - // Make a writable jQuery.Event from the native event object - event = jQuery.event.fix( event || window.event ); - - var handlers = ( (jQuery._data( this, "events" ) || {} )[ event.type ] || []), - delegateCount = handlers.delegateCount, - args = [].slice.call( arguments, 0 ), - run_all = !event.exclusive && !event.namespace, - handlerQueue = [], - i, j, cur, jqcur, ret, selMatch, matched, matches, handleObj, sel, related; - - // Use the fix-ed jQuery.Event rather than the (read-only) native event - args[0] = event; - event.delegateTarget = this; - - // Determine handlers that should run if there are delegated events - // Avoid disabled elements in IE (#6911) and non-left-click bubbling in Firefox (#3861) - if ( delegateCount && !event.target.disabled && !(event.button && event.type === "click") ) { - - // Pregenerate a single jQuery object for reuse with .is() - jqcur = jQuery(this); - jqcur.context = this.ownerDocument || this; - - for ( cur = event.target; cur != this; cur = cur.parentNode || this ) { - selMatch = {}; - matches = []; - jqcur[0] = cur; - for ( i = 0; i < delegateCount; i++ ) { - handleObj = handlers[ i ]; - sel = handleObj.selector; - - if ( selMatch[ sel ] === undefined ) { - selMatch[ sel ] = ( - handleObj.quick ? quickIs( cur, handleObj.quick ) : jqcur.is( sel ) - ); - } - if ( selMatch[ sel ] ) { - matches.push( handleObj ); - } - } - if ( matches.length ) { - handlerQueue.push({ elem: cur, matches: matches }); - } - } - } - - // Add the remaining (directly-bound) handlers - if ( handlers.length > delegateCount ) { - handlerQueue.push({ elem: this, matches: handlers.slice( delegateCount ) }); - } - - // Run delegates first; they may want to stop propagation beneath us - for ( i = 0; i < handlerQueue.length && !event.isPropagationStopped(); i++ ) { - matched = handlerQueue[ i ]; - event.currentTarget = matched.elem; - - for ( j = 0; j < matched.matches.length && !event.isImmediatePropagationStopped(); j++ ) { - handleObj = matched.matches[ j ]; - - // Triggered event must either 1) be non-exclusive and have no namespace, or - // 2) have namespace(s) a subset or equal to those in the bound event (both can have no namespace). - if ( run_all || (!event.namespace && !handleObj.namespace) || event.namespace_re && event.namespace_re.test( handleObj.namespace ) ) { - - event.data = handleObj.data; - event.handleObj = handleObj; - - ret = ( (jQuery.event.special[ handleObj.origType ] || {}).handle || handleObj.handler ) - .apply( matched.elem, args ); - - if ( ret !== undefined ) { - event.result = ret; - if ( ret === false ) { - event.preventDefault(); - event.stopPropagation(); - } - } - } - } - } - - return event.result; - }, - - // Includes some event props shared by KeyEvent and MouseEvent - // *** attrChange attrName relatedNode srcElement are not normalized, non-W3C, deprecated, will be removed in 1.8 *** - props: "attrChange attrName relatedNode srcElement altKey bubbles cancelable ctrlKey currentTarget eventPhase metaKey relatedTarget shiftKey target timeStamp view which".split(" "), - - fixHooks: {}, - - keyHooks: { - props: "char charCode key keyCode".split(" "), - filter: function( event, original ) { - - // Add which for key events - if ( event.which == null ) { - event.which = original.charCode != null ? original.charCode : original.keyCode; - } - - return event; - } - }, - - mouseHooks: { - props: "button buttons clientX clientY fromElement offsetX offsetY pageX pageY screenX screenY toElement".split(" "), - filter: function( event, original ) { - var eventDoc, doc, body, - button = original.button, - fromElement = original.fromElement; - - // Calculate pageX/Y if missing and clientX/Y available - if ( event.pageX == null && original.clientX != null ) { - eventDoc = event.target.ownerDocument || document; - doc = eventDoc.documentElement; - body = eventDoc.body; - - event.pageX = original.clientX + ( doc && doc.scrollLeft || body && body.scrollLeft || 0 ) - ( doc && doc.clientLeft || body && body.clientLeft || 0 ); - event.pageY = original.clientY + ( doc && doc.scrollTop || body && body.scrollTop || 0 ) - ( doc && doc.clientTop || body && body.clientTop || 0 ); - } - - // Add relatedTarget, if necessary - if ( !event.relatedTarget && fromElement ) { - event.relatedTarget = fromElement === event.target ? original.toElement : fromElement; - } - - // Add which for click: 1 === left; 2 === middle; 3 === right - // Note: button is not normalized, so don't use it - if ( !event.which && button !== undefined ) { - event.which = ( button & 1 ? 1 : ( button & 2 ? 3 : ( button & 4 ? 2 : 0 ) ) ); - } - - return event; - } - }, - - fix: function( event ) { - if ( event[ jQuery.expando ] ) { - return event; - } - - // Create a writable copy of the event object and normalize some properties - var i, prop, - originalEvent = event, - fixHook = jQuery.event.fixHooks[ event.type ] || {}, - copy = fixHook.props ? this.props.concat( fixHook.props ) : this.props; - - event = jQuery.Event( originalEvent ); - - for ( i = copy.length; i; ) { - prop = copy[ --i ]; - event[ prop ] = originalEvent[ prop ]; - } - - // Fix target property, if necessary (#1925, IE 6/7/8 & Safari2) - if ( !event.target ) { - event.target = originalEvent.srcElement || document; - } - - // Target should not be a text node (#504, Safari) - if ( event.target.nodeType === 3 ) { - event.target = event.target.parentNode; - } - - // For mouse/key events; add metaKey if it's not there (#3368, IE6/7/8) - if ( event.metaKey === undefined ) { - event.metaKey = event.ctrlKey; - } - - return fixHook.filter? fixHook.filter( event, originalEvent ) : event; - }, - - special: { - ready: { - // Make sure the ready event is setup - setup: jQuery.bindReady - }, - - load: { - // Prevent triggered image.load events from bubbling to window.load - noBubble: true - }, - - focus: { - delegateType: "focusin" - }, - blur: { - delegateType: "focusout" - }, - - beforeunload: { - setup: function( data, namespaces, eventHandle ) { - // We only want to do this special case on windows - if ( jQuery.isWindow( this ) ) { - this.onbeforeunload = eventHandle; - } - }, - - teardown: function( namespaces, eventHandle ) { - if ( this.onbeforeunload === eventHandle ) { - this.onbeforeunload = null; - } - } - } - }, - - simulate: function( type, elem, event, bubble ) { - // Piggyback on a donor event to simulate a different one. - // Fake originalEvent to avoid donor's stopPropagation, but if the - // simulated event prevents default then we do the same on the donor. - var e = jQuery.extend( - new jQuery.Event(), - event, - { type: type, - isSimulated: true, - originalEvent: {} - } - ); - if ( bubble ) { - jQuery.event.trigger( e, null, elem ); - } else { - jQuery.event.dispatch.call( elem, e ); - } - if ( e.isDefaultPrevented() ) { - event.preventDefault(); - } - } -}; - -// Some plugins are using, but it's undocumented/deprecated and will be removed. -// The 1.7 special event interface should provide all the hooks needed now. -jQuery.event.handle = jQuery.event.dispatch; - -jQuery.removeEvent = document.removeEventListener ? - function( elem, type, handle ) { - if ( elem.removeEventListener ) { - elem.removeEventListener( type, handle, false ); - } - } : - function( elem, type, handle ) { - if ( elem.detachEvent ) { - elem.detachEvent( "on" + type, handle ); - } - }; - -jQuery.Event = function( src, props ) { - // Allow instantiation without the 'new' keyword - if ( !(this instanceof jQuery.Event) ) { - return new jQuery.Event( src, props ); - } - - // Event object - if ( src && src.type ) { - this.originalEvent = src; - this.type = src.type; - - // Events bubbling up the document may have been marked as prevented - // by a handler lower down the tree; reflect the correct value. - this.isDefaultPrevented = ( src.defaultPrevented || src.returnValue === false || - src.getPreventDefault && src.getPreventDefault() ) ? returnTrue : returnFalse; - - // Event type - } else { - this.type = src; - } - - // Put explicitly provided properties onto the event object - if ( props ) { - jQuery.extend( this, props ); - } - - // Create a timestamp if incoming event doesn't have one - this.timeStamp = src && src.timeStamp || jQuery.now(); - - // Mark it as fixed - this[ jQuery.expando ] = true; -}; - -function returnFalse() { - return false; -} -function returnTrue() { - return true; -} - -// jQuery.Event is based on DOM3 Events as specified by the ECMAScript Language Binding -// http://www.w3.org/TR/2003/WD-DOM-Level-3-Events-20030331/ecma-script-binding.html -jQuery.Event.prototype = { - preventDefault: function() { - this.isDefaultPrevented = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - - // if preventDefault exists run it on the original event - if ( e.preventDefault ) { - e.preventDefault(); - - // otherwise set the returnValue property of the original event to false (IE) - } else { - e.returnValue = false; - } - }, - stopPropagation: function() { - this.isPropagationStopped = returnTrue; - - var e = this.originalEvent; - if ( !e ) { - return; - } - // if stopPropagation exists run it on the original event - if ( e.stopPropagation ) { - e.stopPropagation(); - } - // otherwise set the cancelBubble property of the original event to true (IE) - e.cancelBubble = true; - }, - stopImmediatePropagation: function() { - this.isImmediatePropagationStopped = returnTrue; - this.stopPropagation(); - }, - isDefaultPrevented: returnFalse, - isPropagationStopped: returnFalse, - isImmediatePropagationStopped: returnFalse -}; - -// Create mouseenter/leave events using mouseover/out and event-time checks -jQuery.each({ - mouseenter: "mouseover", - mouseleave: "mouseout" -}, function( orig, fix ) { - jQuery.event.special[ orig ] = { - delegateType: fix, - bindType: fix, - - handle: function( event ) { - var target = this, - related = event.relatedTarget, - handleObj = event.handleObj, - selector = handleObj.selector, - ret; - - // For mousenter/leave call the handler if related is outside the target. - // NB: No relatedTarget if the mouse left/entered the browser window - if ( !related || (related !== target && !jQuery.contains( target, related )) ) { - event.type = handleObj.origType; - ret = handleObj.handler.apply( this, arguments ); - event.type = fix; - } - return ret; - } - }; -}); - -// IE submit delegation -if ( !jQuery.support.submitBubbles ) { - - jQuery.event.special.submit = { - setup: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Lazy-add a submit handler when a descendant form may potentially be submitted - jQuery.event.add( this, "click._submit keypress._submit", function( e ) { - // Node name check avoids a VML-related crash in IE (#9807) - var elem = e.target, - form = jQuery.nodeName( elem, "input" ) || jQuery.nodeName( elem, "button" ) ? elem.form : undefined; - if ( form && !form._submit_attached ) { - jQuery.event.add( form, "submit._submit", function( event ) { - // If form was submitted by the user, bubble the event up the tree - if ( this.parentNode && !event.isTrigger ) { - jQuery.event.simulate( "submit", this.parentNode, event, true ); - } - }); - form._submit_attached = true; - } - }); - // return undefined since we don't need an event listener - }, - - teardown: function() { - // Only need this for delegated form submit events - if ( jQuery.nodeName( this, "form" ) ) { - return false; - } - - // Remove delegated handlers; cleanData eventually reaps submit handlers attached above - jQuery.event.remove( this, "._submit" ); - } - }; -} - -// IE change delegation and checkbox/radio fix -if ( !jQuery.support.changeBubbles ) { - - jQuery.event.special.change = { - - setup: function() { - - if ( rformElems.test( this.nodeName ) ) { - // IE doesn't fire change on a check/radio until blur; trigger it on click - // after a propertychange. Eat the blur-change in special.change.handle. - // This still fires onchange a second time for check/radio after blur. - if ( this.type === "checkbox" || this.type === "radio" ) { - jQuery.event.add( this, "propertychange._change", function( event ) { - if ( event.originalEvent.propertyName === "checked" ) { - this._just_changed = true; - } - }); - jQuery.event.add( this, "click._change", function( event ) { - if ( this._just_changed && !event.isTrigger ) { - this._just_changed = false; - jQuery.event.simulate( "change", this, event, true ); - } - }); - } - return false; - } - // Delegated event; lazy-add a change handler on descendant inputs - jQuery.event.add( this, "beforeactivate._change", function( e ) { - var elem = e.target; - - if ( rformElems.test( elem.nodeName ) && !elem._change_attached ) { - jQuery.event.add( elem, "change._change", function( event ) { - if ( this.parentNode && !event.isSimulated && !event.isTrigger ) { - jQuery.event.simulate( "change", this.parentNode, event, true ); - } - }); - elem._change_attached = true; - } - }); - }, - - handle: function( event ) { - var elem = event.target; - - // Swallow native change events from checkbox/radio, we already triggered them above - if ( this !== elem || event.isSimulated || event.isTrigger || (elem.type !== "radio" && elem.type !== "checkbox") ) { - return event.handleObj.handler.apply( this, arguments ); - } - }, - - teardown: function() { - jQuery.event.remove( this, "._change" ); - - return rformElems.test( this.nodeName ); - } - }; -} - -// Create "bubbling" focus and blur events -if ( !jQuery.support.focusinBubbles ) { - jQuery.each({ focus: "focusin", blur: "focusout" }, function( orig, fix ) { - - // Attach a single capturing handler while someone wants focusin/focusout - var attaches = 0, - handler = function( event ) { - jQuery.event.simulate( fix, event.target, jQuery.event.fix( event ), true ); - }; - - jQuery.event.special[ fix ] = { - setup: function() { - if ( attaches++ === 0 ) { - document.addEventListener( orig, handler, true ); - } - }, - teardown: function() { - if ( --attaches === 0 ) { - document.removeEventListener( orig, handler, true ); - } - } - }; - }); -} - -jQuery.fn.extend({ - - on: function( types, selector, data, fn, /*INTERNAL*/ one ) { - var origFn, type; - - // Types can be a map of types/handlers - if ( typeof types === "object" ) { - // ( types-Object, selector, data ) - if ( typeof selector !== "string" ) { - // ( types-Object, data ) - data = selector; - selector = undefined; - } - for ( type in types ) { - this.on( type, selector, data, types[ type ], one ); - } - return this; - } - - if ( data == null && fn == null ) { - // ( types, fn ) - fn = selector; - data = selector = undefined; - } else if ( fn == null ) { - if ( typeof selector === "string" ) { - // ( types, selector, fn ) - fn = data; - data = undefined; - } else { - // ( types, data, fn ) - fn = data; - data = selector; - selector = undefined; - } - } - if ( fn === false ) { - fn = returnFalse; - } else if ( !fn ) { - return this; - } - - if ( one === 1 ) { - origFn = fn; - fn = function( event ) { - // Can use an empty set, since event contains the info - jQuery().off( event ); - return origFn.apply( this, arguments ); - }; - // Use same guid so caller can remove using origFn - fn.guid = origFn.guid || ( origFn.guid = jQuery.guid++ ); - } - return this.each( function() { - jQuery.event.add( this, types, fn, data, selector ); - }); - }, - one: function( types, selector, data, fn ) { - return this.on.call( this, types, selector, data, fn, 1 ); - }, - off: function( types, selector, fn ) { - if ( types && types.preventDefault && types.handleObj ) { - // ( event ) dispatched jQuery.Event - var handleObj = types.handleObj; - jQuery( types.delegateTarget ).off( - handleObj.namespace? handleObj.type + "." + handleObj.namespace : handleObj.type, - handleObj.selector, - handleObj.handler - ); - return this; - } - if ( typeof types === "object" ) { - // ( types-object [, selector] ) - for ( var type in types ) { - this.off( type, selector, types[ type ] ); - } - return this; - } - if ( selector === false || typeof selector === "function" ) { - // ( types [, fn] ) - fn = selector; - selector = undefined; - } - if ( fn === false ) { - fn = returnFalse; - } - return this.each(function() { - jQuery.event.remove( this, types, fn, selector ); - }); - }, - - bind: function( types, data, fn ) { - return this.on( types, null, data, fn ); - }, - unbind: function( types, fn ) { - return this.off( types, null, fn ); - }, - - live: function( types, data, fn ) { - jQuery( this.context ).on( types, this.selector, data, fn ); - return this; - }, - die: function( types, fn ) { - jQuery( this.context ).off( types, this.selector || "**", fn ); - return this; - }, - - delegate: function( selector, types, data, fn ) { - return this.on( types, selector, data, fn ); - }, - undelegate: function( selector, types, fn ) { - // ( namespace ) or ( selector, types [, fn] ) - return arguments.length == 1? this.off( selector, "**" ) : this.off( types, selector, fn ); - }, - - trigger: function( type, data ) { - return this.each(function() { - jQuery.event.trigger( type, data, this ); - }); - }, - triggerHandler: function( type, data ) { - if ( this[0] ) { - return jQuery.event.trigger( type, data, this[0], true ); - } - }, - - toggle: function( fn ) { - // Save reference to arguments for access in closure - var args = arguments, - guid = fn.guid || jQuery.guid++, - i = 0, - toggler = function( event ) { - // Figure out which function to execute - var lastToggle = ( jQuery._data( this, "lastToggle" + fn.guid ) || 0 ) % i; - jQuery._data( this, "lastToggle" + fn.guid, lastToggle + 1 ); - - // Make sure that clicks stop - event.preventDefault(); - - // and execute the function - return args[ lastToggle ].apply( this, arguments ) || false; - }; - - // link all the functions, so any of them can unbind this click handler - toggler.guid = guid; - while ( i < args.length ) { - args[ i++ ].guid = guid; - } - - return this.click( toggler ); - }, - - hover: function( fnOver, fnOut ) { - return this.mouseenter( fnOver ).mouseleave( fnOut || fnOver ); - } -}); - -jQuery.each( ("blur focus focusin focusout load resize scroll unload click dblclick " + - "mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave " + - "change select submit keydown keypress keyup error contextmenu").split(" "), function( i, name ) { - - // Handle event binding - jQuery.fn[ name ] = function( data, fn ) { - if ( fn == null ) { - fn = data; - data = null; - } - - return arguments.length > 0 ? - this.on( name, null, data, fn ) : - this.trigger( name ); - }; - - if ( jQuery.attrFn ) { - jQuery.attrFn[ name ] = true; - } - - if ( rkeyEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.keyHooks; - } - - if ( rmouseEvent.test( name ) ) { - jQuery.event.fixHooks[ name ] = jQuery.event.mouseHooks; - } -}); - - - -/*! - * Sizzle CSS Selector Engine - * Copyright 2011, The Dojo Foundation - * Released under the MIT, BSD, and GPL Licenses. - * More information: http://sizzlejs.com/ - */ -(function(){ - -var chunker = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, - expando = "sizcache" + (Math.random() + '').replace('.', ''), - done = 0, - toString = Object.prototype.toString, - hasDuplicate = false, - baseHasDuplicate = true, - rBackslash = /\\/g, - rReturn = /\r\n/g, - rNonWord = /\W/; - -// Here we check if the JavaScript engine is using some sort of -// optimization where it does not always call our comparision -// function. If that is the case, discard the hasDuplicate value. -// Thus far that includes Google Chrome. -[0, 0].sort(function() { - baseHasDuplicate = false; - return 0; -}); - -var Sizzle = function( selector, context, results, seed ) { - results = results || []; - context = context || document; - - var origContext = context; - - if ( context.nodeType !== 1 && context.nodeType !== 9 ) { - return []; - } - - if ( !selector || typeof selector !== "string" ) { - return results; - } - - var m, set, checkSet, extra, ret, cur, pop, i, - prune = true, - contextXML = Sizzle.isXML( context ), - parts = [], - soFar = selector; - - // Reset the position of the chunker regexp (start from head) - do { - chunker.exec( "" ); - m = chunker.exec( soFar ); - - if ( m ) { - soFar = m[3]; - - parts.push( m[1] ); - - if ( m[2] ) { - extra = m[3]; - break; - } - } - } while ( m ); - - if ( parts.length > 1 && origPOS.exec( selector ) ) { - - if ( parts.length === 2 && Expr.relative[ parts[0] ] ) { - set = posProcess( parts[0] + parts[1], context, seed ); - - } else { - set = Expr.relative[ parts[0] ] ? - [ context ] : - Sizzle( parts.shift(), context ); - - while ( parts.length ) { - selector = parts.shift(); - - if ( Expr.relative[ selector ] ) { - selector += parts.shift(); - } - - set = posProcess( selector, set, seed ); - } - } - - } else { - // Take a shortcut and set the context if the root selector is an ID - // (but not if it'll be faster if the inner selector is an ID) - if ( !seed && parts.length > 1 && context.nodeType === 9 && !contextXML && - Expr.match.ID.test(parts[0]) && !Expr.match.ID.test(parts[parts.length - 1]) ) { - - ret = Sizzle.find( parts.shift(), context, contextXML ); - context = ret.expr ? - Sizzle.filter( ret.expr, ret.set )[0] : - ret.set[0]; - } - - if ( context ) { - ret = seed ? - { expr: parts.pop(), set: makeArray(seed) } : - Sizzle.find( parts.pop(), parts.length === 1 && (parts[0] === "~" || parts[0] === "+") && context.parentNode ? context.parentNode : context, contextXML ); - - set = ret.expr ? - Sizzle.filter( ret.expr, ret.set ) : - ret.set; - - if ( parts.length > 0 ) { - checkSet = makeArray( set ); - - } else { - prune = false; - } - - while ( parts.length ) { - cur = parts.pop(); - pop = cur; - - if ( !Expr.relative[ cur ] ) { - cur = ""; - } else { - pop = parts.pop(); - } - - if ( pop == null ) { - pop = context; - } - - Expr.relative[ cur ]( checkSet, pop, contextXML ); - } - - } else { - checkSet = parts = []; - } - } - - if ( !checkSet ) { - checkSet = set; - } - - if ( !checkSet ) { - Sizzle.error( cur || selector ); - } - - if ( toString.call(checkSet) === "[object Array]" ) { - if ( !prune ) { - results.push.apply( results, checkSet ); - - } else if ( context && context.nodeType === 1 ) { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && (checkSet[i] === true || checkSet[i].nodeType === 1 && Sizzle.contains(context, checkSet[i])) ) { - results.push( set[i] ); - } - } - - } else { - for ( i = 0; checkSet[i] != null; i++ ) { - if ( checkSet[i] && checkSet[i].nodeType === 1 ) { - results.push( set[i] ); - } - } - } - - } else { - makeArray( checkSet, results ); - } - - if ( extra ) { - Sizzle( extra, origContext, results, seed ); - Sizzle.uniqueSort( results ); - } - - return results; -}; - -Sizzle.uniqueSort = function( results ) { - if ( sortOrder ) { - hasDuplicate = baseHasDuplicate; - results.sort( sortOrder ); - - if ( hasDuplicate ) { - for ( var i = 1; i < results.length; i++ ) { - if ( results[i] === results[ i - 1 ] ) { - results.splice( i--, 1 ); - } - } - } - } - - return results; -}; - -Sizzle.matches = function( expr, set ) { - return Sizzle( expr, null, null, set ); -}; - -Sizzle.matchesSelector = function( node, expr ) { - return Sizzle( expr, null, null, [node] ).length > 0; -}; - -Sizzle.find = function( expr, context, isXML ) { - var set, i, len, match, type, left; - - if ( !expr ) { - return []; - } - - for ( i = 0, len = Expr.order.length; i < len; i++ ) { - type = Expr.order[i]; - - if ( (match = Expr.leftMatch[ type ].exec( expr )) ) { - left = match[1]; - match.splice( 1, 1 ); - - if ( left.substr( left.length - 1 ) !== "\\" ) { - match[1] = (match[1] || "").replace( rBackslash, "" ); - set = Expr.find[ type ]( match, context, isXML ); - - if ( set != null ) { - expr = expr.replace( Expr.match[ type ], "" ); - break; - } - } - } - } - - if ( !set ) { - set = typeof context.getElementsByTagName !== "undefined" ? - context.getElementsByTagName( "*" ) : - []; - } - - return { set: set, expr: expr }; -}; - -Sizzle.filter = function( expr, set, inplace, not ) { - var match, anyFound, - type, found, item, filter, left, - i, pass, - old = expr, - result = [], - curLoop = set, - isXMLFilter = set && set[0] && Sizzle.isXML( set[0] ); - - while ( expr && set.length ) { - for ( type in Expr.filter ) { - if ( (match = Expr.leftMatch[ type ].exec( expr )) != null && match[2] ) { - filter = Expr.filter[ type ]; - left = match[1]; - - anyFound = false; - - match.splice(1,1); - - if ( left.substr( left.length - 1 ) === "\\" ) { - continue; - } - - if ( curLoop === result ) { - result = []; - } - - if ( Expr.preFilter[ type ] ) { - match = Expr.preFilter[ type ]( match, curLoop, inplace, result, not, isXMLFilter ); - - if ( !match ) { - anyFound = found = true; - - } else if ( match === true ) { - continue; - } - } - - if ( match ) { - for ( i = 0; (item = curLoop[i]) != null; i++ ) { - if ( item ) { - found = filter( item, match, i, curLoop ); - pass = not ^ found; - - if ( inplace && found != null ) { - if ( pass ) { - anyFound = true; - - } else { - curLoop[i] = false; - } - - } else if ( pass ) { - result.push( item ); - anyFound = true; - } - } - } - } - - if ( found !== undefined ) { - if ( !inplace ) { - curLoop = result; - } - - expr = expr.replace( Expr.match[ type ], "" ); - - if ( !anyFound ) { - return []; - } - - break; - } - } - } - - // Improper expression - if ( expr === old ) { - if ( anyFound == null ) { - Sizzle.error( expr ); - - } else { - break; - } - } - - old = expr; - } - - return curLoop; -}; - -Sizzle.error = function( msg ) { - throw new Error( "Syntax error, unrecognized expression: " + msg ); -}; - -/** - * Utility function for retreiving the text value of an array of DOM nodes - * @param {Array|Element} elem - */ -var getText = Sizzle.getText = function( elem ) { - var i, node, - nodeType = elem.nodeType, - ret = ""; - - if ( nodeType ) { - if ( nodeType === 1 || nodeType === 9 ) { - // Use textContent || innerText for elements - if ( typeof elem.textContent === 'string' ) { - return elem.textContent; - } else if ( typeof elem.innerText === 'string' ) { - // Replace IE's carriage returns - return elem.innerText.replace( rReturn, '' ); - } else { - // Traverse it's children - for ( elem = elem.firstChild; elem; elem = elem.nextSibling) { - ret += getText( elem ); - } - } - } else if ( nodeType === 3 || nodeType === 4 ) { - return elem.nodeValue; - } - } else { - - // If no nodeType, this is expected to be an array - for ( i = 0; (node = elem[i]); i++ ) { - // Do not traverse comment nodes - if ( node.nodeType !== 8 ) { - ret += getText( node ); - } - } - } - return ret; -}; - -var Expr = Sizzle.selectors = { - order: [ "ID", "NAME", "TAG" ], - - match: { - ID: /#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - CLASS: /\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, - NAME: /\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, - ATTR: /\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, - TAG: /^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, - CHILD: /:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, - POS: /:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, - PSEUDO: /:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/ - }, - - leftMatch: {}, - - attrMap: { - "class": "className", - "for": "htmlFor" - }, - - attrHandle: { - href: function( elem ) { - return elem.getAttribute( "href" ); - }, - type: function( elem ) { - return elem.getAttribute( "type" ); - } - }, - - relative: { - "+": function(checkSet, part){ - var isPartStr = typeof part === "string", - isTag = isPartStr && !rNonWord.test( part ), - isPartStrNotTag = isPartStr && !isTag; - - if ( isTag ) { - part = part.toLowerCase(); - } - - for ( var i = 0, l = checkSet.length, elem; i < l; i++ ) { - if ( (elem = checkSet[i]) ) { - while ( (elem = elem.previousSibling) && elem.nodeType !== 1 ) {} - - checkSet[i] = isPartStrNotTag || elem && elem.nodeName.toLowerCase() === part ? - elem || false : - elem === part; - } - } - - if ( isPartStrNotTag ) { - Sizzle.filter( part, checkSet, true ); - } - }, - - ">": function( checkSet, part ) { - var elem, - isPartStr = typeof part === "string", - i = 0, - l = checkSet.length; - - if ( isPartStr && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - var parent = elem.parentNode; - checkSet[i] = parent.nodeName.toLowerCase() === part ? parent : false; - } - } - - } else { - for ( ; i < l; i++ ) { - elem = checkSet[i]; - - if ( elem ) { - checkSet[i] = isPartStr ? - elem.parentNode : - elem.parentNode === part; - } - } - - if ( isPartStr ) { - Sizzle.filter( part, checkSet, true ); - } - } - }, - - "": function(checkSet, part, isXML){ - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "parentNode", part, doneName, checkSet, nodeCheck, isXML ); - }, - - "~": function( checkSet, part, isXML ) { - var nodeCheck, - doneName = done++, - checkFn = dirCheck; - - if ( typeof part === "string" && !rNonWord.test( part ) ) { - part = part.toLowerCase(); - nodeCheck = part; - checkFn = dirNodeCheck; - } - - checkFn( "previousSibling", part, doneName, checkSet, nodeCheck, isXML ); - } - }, - - find: { - ID: function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - return m && m.parentNode ? [m] : []; - } - }, - - NAME: function( match, context ) { - if ( typeof context.getElementsByName !== "undefined" ) { - var ret = [], - results = context.getElementsByName( match[1] ); - - for ( var i = 0, l = results.length; i < l; i++ ) { - if ( results[i].getAttribute("name") === match[1] ) { - ret.push( results[i] ); - } - } - - return ret.length === 0 ? null : ret; - } - }, - - TAG: function( match, context ) { - if ( typeof context.getElementsByTagName !== "undefined" ) { - return context.getElementsByTagName( match[1] ); - } - } - }, - preFilter: { - CLASS: function( match, curLoop, inplace, result, not, isXML ) { - match = " " + match[1].replace( rBackslash, "" ) + " "; - - if ( isXML ) { - return match; - } - - for ( var i = 0, elem; (elem = curLoop[i]) != null; i++ ) { - if ( elem ) { - if ( not ^ (elem.className && (" " + elem.className + " ").replace(/[\t\n\r]/g, " ").indexOf(match) >= 0) ) { - if ( !inplace ) { - result.push( elem ); - } - - } else if ( inplace ) { - curLoop[i] = false; - } - } - } - - return false; - }, - - ID: function( match ) { - return match[1].replace( rBackslash, "" ); - }, - - TAG: function( match, curLoop ) { - return match[1].replace( rBackslash, "" ).toLowerCase(); - }, - - CHILD: function( match ) { - if ( match[1] === "nth" ) { - if ( !match[2] ) { - Sizzle.error( match[0] ); - } - - match[2] = match[2].replace(/^\+|\s*/g, ''); - - // parse equations like 'even', 'odd', '5', '2n', '3n+2', '4n-1', '-n+6' - var test = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec( - match[2] === "even" && "2n" || match[2] === "odd" && "2n+1" || - !/\D/.test( match[2] ) && "0n+" + match[2] || match[2]); - - // calculate the numbers (first)n+(last) including if they are negative - match[2] = (test[1] + (test[2] || 1)) - 0; - match[3] = test[3] - 0; - } - else if ( match[2] ) { - Sizzle.error( match[0] ); - } - - // TODO: Move to normal caching system - match[0] = done++; - - return match; - }, - - ATTR: function( match, curLoop, inplace, result, not, isXML ) { - var name = match[1] = match[1].replace( rBackslash, "" ); - - if ( !isXML && Expr.attrMap[name] ) { - match[1] = Expr.attrMap[name]; - } - - // Handle if an un-quoted value was used - match[4] = ( match[4] || match[5] || "" ).replace( rBackslash, "" ); - - if ( match[2] === "~=" ) { - match[4] = " " + match[4] + " "; - } - - return match; - }, - - PSEUDO: function( match, curLoop, inplace, result, not ) { - if ( match[1] === "not" ) { - // If we're dealing with a complex expression, or a simple one - if ( ( chunker.exec(match[3]) || "" ).length > 1 || /^\w/.test(match[3]) ) { - match[3] = Sizzle(match[3], null, null, curLoop); - - } else { - var ret = Sizzle.filter(match[3], curLoop, inplace, true ^ not); - - if ( !inplace ) { - result.push.apply( result, ret ); - } - - return false; - } - - } else if ( Expr.match.POS.test( match[0] ) || Expr.match.CHILD.test( match[0] ) ) { - return true; - } - - return match; - }, - - POS: function( match ) { - match.unshift( true ); - - return match; - } - }, - - filters: { - enabled: function( elem ) { - return elem.disabled === false && elem.type !== "hidden"; - }, - - disabled: function( elem ) { - return elem.disabled === true; - }, - - checked: function( elem ) { - return elem.checked === true; - }, - - selected: function( elem ) { - // Accessing this property makes selected-by-default - // options in Safari work properly - if ( elem.parentNode ) { - elem.parentNode.selectedIndex; - } - - return elem.selected === true; - }, - - parent: function( elem ) { - return !!elem.firstChild; - }, - - empty: function( elem ) { - return !elem.firstChild; - }, - - has: function( elem, i, match ) { - return !!Sizzle( match[3], elem ).length; - }, - - header: function( elem ) { - return (/h\d/i).test( elem.nodeName ); - }, - - text: function( elem ) { - var attr = elem.getAttribute( "type" ), type = elem.type; - // IE6 and 7 will map elem.type to 'text' for new HTML5 types (search, etc) - // use getAttribute instead to test this case - return elem.nodeName.toLowerCase() === "input" && "text" === type && ( attr === type || attr === null ); - }, - - radio: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "radio" === elem.type; - }, - - checkbox: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "checkbox" === elem.type; - }, - - file: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "file" === elem.type; - }, - - password: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "password" === elem.type; - }, - - submit: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "submit" === elem.type; - }, - - image: function( elem ) { - return elem.nodeName.toLowerCase() === "input" && "image" === elem.type; - }, - - reset: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return (name === "input" || name === "button") && "reset" === elem.type; - }, - - button: function( elem ) { - var name = elem.nodeName.toLowerCase(); - return name === "input" && "button" === elem.type || name === "button"; - }, - - input: function( elem ) { - return (/input|select|textarea|button/i).test( elem.nodeName ); - }, - - focus: function( elem ) { - return elem === elem.ownerDocument.activeElement; - } - }, - setFilters: { - first: function( elem, i ) { - return i === 0; - }, - - last: function( elem, i, match, array ) { - return i === array.length - 1; - }, - - even: function( elem, i ) { - return i % 2 === 0; - }, - - odd: function( elem, i ) { - return i % 2 === 1; - }, - - lt: function( elem, i, match ) { - return i < match[3] - 0; - }, - - gt: function( elem, i, match ) { - return i > match[3] - 0; - }, - - nth: function( elem, i, match ) { - return match[3] - 0 === i; - }, - - eq: function( elem, i, match ) { - return match[3] - 0 === i; - } - }, - filter: { - PSEUDO: function( elem, match, i, array ) { - var name = match[1], - filter = Expr.filters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - - } else if ( name === "contains" ) { - return (elem.textContent || elem.innerText || getText([ elem ]) || "").indexOf(match[3]) >= 0; - - } else if ( name === "not" ) { - var not = match[3]; - - for ( var j = 0, l = not.length; j < l; j++ ) { - if ( not[j] === elem ) { - return false; - } - } - - return true; - - } else { - Sizzle.error( name ); - } - }, - - CHILD: function( elem, match ) { - var first, last, - doneName, parent, cache, - count, diff, - type = match[1], - node = elem; - - switch ( type ) { - case "only": - case "first": - while ( (node = node.previousSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - if ( type === "first" ) { - return true; - } - - node = elem; - - case "last": - while ( (node = node.nextSibling) ) { - if ( node.nodeType === 1 ) { - return false; - } - } - - return true; - - case "nth": - first = match[2]; - last = match[3]; - - if ( first === 1 && last === 0 ) { - return true; - } - - doneName = match[0]; - parent = elem.parentNode; - - if ( parent && (parent[ expando ] !== doneName || !elem.nodeIndex) ) { - count = 0; - - for ( node = parent.firstChild; node; node = node.nextSibling ) { - if ( node.nodeType === 1 ) { - node.nodeIndex = ++count; - } - } - - parent[ expando ] = doneName; - } - - diff = elem.nodeIndex - last; - - if ( first === 0 ) { - return diff === 0; - - } else { - return ( diff % first === 0 && diff / first >= 0 ); - } - } - }, - - ID: function( elem, match ) { - return elem.nodeType === 1 && elem.getAttribute("id") === match; - }, - - TAG: function( elem, match ) { - return (match === "*" && elem.nodeType === 1) || !!elem.nodeName && elem.nodeName.toLowerCase() === match; - }, - - CLASS: function( elem, match ) { - return (" " + (elem.className || elem.getAttribute("class")) + " ") - .indexOf( match ) > -1; - }, - - ATTR: function( elem, match ) { - var name = match[1], - result = Sizzle.attr ? - Sizzle.attr( elem, name ) : - Expr.attrHandle[ name ] ? - Expr.attrHandle[ name ]( elem ) : - elem[ name ] != null ? - elem[ name ] : - elem.getAttribute( name ), - value = result + "", - type = match[2], - check = match[4]; - - return result == null ? - type === "!=" : - !type && Sizzle.attr ? - result != null : - type === "=" ? - value === check : - type === "*=" ? - value.indexOf(check) >= 0 : - type === "~=" ? - (" " + value + " ").indexOf(check) >= 0 : - !check ? - value && result !== false : - type === "!=" ? - value !== check : - type === "^=" ? - value.indexOf(check) === 0 : - type === "$=" ? - value.substr(value.length - check.length) === check : - type === "|=" ? - value === check || value.substr(0, check.length + 1) === check + "-" : - false; - }, - - POS: function( elem, match, i, array ) { - var name = match[2], - filter = Expr.setFilters[ name ]; - - if ( filter ) { - return filter( elem, i, match, array ); - } - } - } -}; - -var origPOS = Expr.match.POS, - fescape = function(all, num){ - return "\\" + (num - 0 + 1); - }; - -for ( var type in Expr.match ) { - Expr.match[ type ] = new RegExp( Expr.match[ type ].source + (/(?![^\[]*\])(?![^\(]*\))/.source) ); - Expr.leftMatch[ type ] = new RegExp( /(^(?:.|\r|\n)*?)/.source + Expr.match[ type ].source.replace(/\\(\d+)/g, fescape) ); -} - -var makeArray = function( array, results ) { - array = Array.prototype.slice.call( array, 0 ); - - if ( results ) { - results.push.apply( results, array ); - return results; - } - - return array; -}; - -// Perform a simple check to determine if the browser is capable of -// converting a NodeList to an array using builtin methods. -// Also verifies that the returned array holds DOM nodes -// (which is not the case in the Blackberry browser) -try { - Array.prototype.slice.call( document.documentElement.childNodes, 0 )[0].nodeType; - -// Provide a fallback method if it does not work -} catch( e ) { - makeArray = function( array, results ) { - var i = 0, - ret = results || []; - - if ( toString.call(array) === "[object Array]" ) { - Array.prototype.push.apply( ret, array ); - - } else { - if ( typeof array.length === "number" ) { - for ( var l = array.length; i < l; i++ ) { - ret.push( array[i] ); - } - - } else { - for ( ; array[i]; i++ ) { - ret.push( array[i] ); - } - } - } - - return ret; - }; -} - -var sortOrder, siblingCheck; - -if ( document.documentElement.compareDocumentPosition ) { - sortOrder = function( a, b ) { - if ( a === b ) { - hasDuplicate = true; - return 0; - } - - if ( !a.compareDocumentPosition || !b.compareDocumentPosition ) { - return a.compareDocumentPosition ? -1 : 1; - } - - return a.compareDocumentPosition(b) & 4 ? -1 : 1; - }; - -} else { - sortOrder = function( a, b ) { - // The nodes are identical, we can exit early - if ( a === b ) { - hasDuplicate = true; - return 0; - - // Fallback to using sourceIndex (in IE) if it's available on both nodes - } else if ( a.sourceIndex && b.sourceIndex ) { - return a.sourceIndex - b.sourceIndex; - } - - var al, bl, - ap = [], - bp = [], - aup = a.parentNode, - bup = b.parentNode, - cur = aup; - - // If the nodes are siblings (or identical) we can do a quick check - if ( aup === bup ) { - return siblingCheck( a, b ); - - // If no parents were found then the nodes are disconnected - } else if ( !aup ) { - return -1; - - } else if ( !bup ) { - return 1; - } - - // Otherwise they're somewhere else in the tree so we need - // to build up a full list of the parentNodes for comparison - while ( cur ) { - ap.unshift( cur ); - cur = cur.parentNode; - } - - cur = bup; - - while ( cur ) { - bp.unshift( cur ); - cur = cur.parentNode; - } - - al = ap.length; - bl = bp.length; - - // Start walking down the tree looking for a discrepancy - for ( var i = 0; i < al && i < bl; i++ ) { - if ( ap[i] !== bp[i] ) { - return siblingCheck( ap[i], bp[i] ); - } - } - - // We ended someplace up the tree so do a sibling check - return i === al ? - siblingCheck( a, bp[i], -1 ) : - siblingCheck( ap[i], b, 1 ); - }; - - siblingCheck = function( a, b, ret ) { - if ( a === b ) { - return ret; - } - - var cur = a.nextSibling; - - while ( cur ) { - if ( cur === b ) { - return -1; - } - - cur = cur.nextSibling; - } - - return 1; - }; -} - -// Check to see if the browser returns elements by name when -// querying by getElementById (and provide a workaround) -(function(){ - // We're going to inject a fake input element with a specified name - var form = document.createElement("div"), - id = "script" + (new Date()).getTime(), - root = document.documentElement; - - form.innerHTML = ""; - - // Inject it into the root element, check its status, and remove it quickly - root.insertBefore( form, root.firstChild ); - - // The workaround has to do additional checks after a getElementById - // Which slows things down for other browsers (hence the branching) - if ( document.getElementById( id ) ) { - Expr.find.ID = function( match, context, isXML ) { - if ( typeof context.getElementById !== "undefined" && !isXML ) { - var m = context.getElementById(match[1]); - - return m ? - m.id === match[1] || typeof m.getAttributeNode !== "undefined" && m.getAttributeNode("id").nodeValue === match[1] ? - [m] : - undefined : - []; - } - }; - - Expr.filter.ID = function( elem, match ) { - var node = typeof elem.getAttributeNode !== "undefined" && elem.getAttributeNode("id"); - - return elem.nodeType === 1 && node && node.nodeValue === match; - }; - } - - root.removeChild( form ); - - // release memory in IE - root = form = null; -})(); - -(function(){ - // Check to see if the browser returns only elements - // when doing getElementsByTagName("*") - - // Create a fake element - var div = document.createElement("div"); - div.appendChild( document.createComment("") ); - - // Make sure no comments are found - if ( div.getElementsByTagName("*").length > 0 ) { - Expr.find.TAG = function( match, context ) { - var results = context.getElementsByTagName( match[1] ); - - // Filter out possible comments - if ( match[1] === "*" ) { - var tmp = []; - - for ( var i = 0; results[i]; i++ ) { - if ( results[i].nodeType === 1 ) { - tmp.push( results[i] ); - } - } - - results = tmp; - } - - return results; - }; - } - - // Check to see if an attribute returns normalized href attributes - div.innerHTML = ""; - - if ( div.firstChild && typeof div.firstChild.getAttribute !== "undefined" && - div.firstChild.getAttribute("href") !== "#" ) { - - Expr.attrHandle.href = function( elem ) { - return elem.getAttribute( "href", 2 ); - }; - } - - // release memory in IE - div = null; -})(); - -if ( document.querySelectorAll ) { - (function(){ - var oldSizzle = Sizzle, - div = document.createElement("div"), - id = "__sizzle__"; - - div.innerHTML = "

        "; - - // Safari can't handle uppercase or unicode characters when - // in quirks mode. - if ( div.querySelectorAll && div.querySelectorAll(".TEST").length === 0 ) { - return; - } - - Sizzle = function( query, context, extra, seed ) { - context = context || document; - - // Only use querySelectorAll on non-XML documents - // (ID selectors don't work in non-HTML documents) - if ( !seed && !Sizzle.isXML(context) ) { - // See if we find a selector to speed up - var match = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec( query ); - - if ( match && (context.nodeType === 1 || context.nodeType === 9) ) { - // Speed-up: Sizzle("TAG") - if ( match[1] ) { - return makeArray( context.getElementsByTagName( query ), extra ); - - // Speed-up: Sizzle(".CLASS") - } else if ( match[2] && Expr.find.CLASS && context.getElementsByClassName ) { - return makeArray( context.getElementsByClassName( match[2] ), extra ); - } - } - - if ( context.nodeType === 9 ) { - // Speed-up: Sizzle("body") - // The body element only exists once, optimize finding it - if ( query === "body" && context.body ) { - return makeArray( [ context.body ], extra ); - - // Speed-up: Sizzle("#ID") - } else if ( match && match[3] ) { - var elem = context.getElementById( match[3] ); - - // Check parentNode to catch when Blackberry 4.6 returns - // nodes that are no longer in the document #6963 - if ( elem && elem.parentNode ) { - // Handle the case where IE and Opera return items - // by name instead of ID - if ( elem.id === match[3] ) { - return makeArray( [ elem ], extra ); - } - - } else { - return makeArray( [], extra ); - } - } - - try { - return makeArray( context.querySelectorAll(query), extra ); - } catch(qsaError) {} - - // qSA works strangely on Element-rooted queries - // We can work around this by specifying an extra ID on the root - // and working up from there (Thanks to Andrew Dupont for the technique) - // IE 8 doesn't work on object elements - } else if ( context.nodeType === 1 && context.nodeName.toLowerCase() !== "object" ) { - var oldContext = context, - old = context.getAttribute( "id" ), - nid = old || id, - hasParent = context.parentNode, - relativeHierarchySelector = /^\s*[+~]/.test( query ); - - if ( !old ) { - context.setAttribute( "id", nid ); - } else { - nid = nid.replace( /'/g, "\\$&" ); - } - if ( relativeHierarchySelector && hasParent ) { - context = context.parentNode; - } - - try { - if ( !relativeHierarchySelector || hasParent ) { - return makeArray( context.querySelectorAll( "[id='" + nid + "'] " + query ), extra ); - } - - } catch(pseudoError) { - } finally { - if ( !old ) { - oldContext.removeAttribute( "id" ); - } - } - } - } - - return oldSizzle(query, context, extra, seed); - }; - - for ( var prop in oldSizzle ) { - Sizzle[ prop ] = oldSizzle[ prop ]; - } - - // release memory in IE - div = null; - })(); -} - -(function(){ - var html = document.documentElement, - matches = html.matchesSelector || html.mozMatchesSelector || html.webkitMatchesSelector || html.msMatchesSelector; - - if ( matches ) { - // Check to see if it's possible to do matchesSelector - // on a disconnected node (IE 9 fails this) - var disconnectedMatch = !matches.call( document.createElement( "div" ), "div" ), - pseudoWorks = false; - - try { - // This should fail with an exception - // Gecko does not error, returns false instead - matches.call( document.documentElement, "[test!='']:sizzle" ); - - } catch( pseudoError ) { - pseudoWorks = true; - } - - Sizzle.matchesSelector = function( node, expr ) { - // Make sure that attribute selectors are quoted - expr = expr.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); - - if ( !Sizzle.isXML( node ) ) { - try { - if ( pseudoWorks || !Expr.match.PSEUDO.test( expr ) && !/!=/.test( expr ) ) { - var ret = matches.call( node, expr ); - - // IE 9's matchesSelector returns false on disconnected nodes - if ( ret || !disconnectedMatch || - // As well, disconnected nodes are said to be in a document - // fragment in IE 9, so check for that - node.document && node.document.nodeType !== 11 ) { - return ret; - } - } - } catch(e) {} - } - - return Sizzle(expr, null, null, [node]).length > 0; - }; - } -})(); - -(function(){ - var div = document.createElement("div"); - - div.innerHTML = "
        "; - - // Opera can't find a second classname (in 9.6) - // Also, make sure that getElementsByClassName actually exists - if ( !div.getElementsByClassName || div.getElementsByClassName("e").length === 0 ) { - return; - } - - // Safari caches class attributes, doesn't catch changes (in 3.2) - div.lastChild.className = "e"; - - if ( div.getElementsByClassName("e").length === 1 ) { - return; - } - - Expr.order.splice(1, 0, "CLASS"); - Expr.find.CLASS = function( match, context, isXML ) { - if ( typeof context.getElementsByClassName !== "undefined" && !isXML ) { - return context.getElementsByClassName(match[1]); - } - }; - - // release memory in IE - div = null; -})(); - -function dirNodeCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 && !isXML ){ - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( elem.nodeName.toLowerCase() === cur ) { - match = elem; - break; - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -function dirCheck( dir, cur, doneName, checkSet, nodeCheck, isXML ) { - for ( var i = 0, l = checkSet.length; i < l; i++ ) { - var elem = checkSet[i]; - - if ( elem ) { - var match = false; - - elem = elem[dir]; - - while ( elem ) { - if ( elem[ expando ] === doneName ) { - match = checkSet[elem.sizset]; - break; - } - - if ( elem.nodeType === 1 ) { - if ( !isXML ) { - elem[ expando ] = doneName; - elem.sizset = i; - } - - if ( typeof cur !== "string" ) { - if ( elem === cur ) { - match = true; - break; - } - - } else if ( Sizzle.filter( cur, [elem] ).length > 0 ) { - match = elem; - break; - } - } - - elem = elem[dir]; - } - - checkSet[i] = match; - } - } -} - -if ( document.documentElement.contains ) { - Sizzle.contains = function( a, b ) { - return a !== b && (a.contains ? a.contains(b) : true); - }; - -} else if ( document.documentElement.compareDocumentPosition ) { - Sizzle.contains = function( a, b ) { - return !!(a.compareDocumentPosition(b) & 16); - }; - -} else { - Sizzle.contains = function() { - return false; - }; -} - -Sizzle.isXML = function( elem ) { - // documentElement is verified for cases where it doesn't yet exist - // (such as loading iframes in IE - #4833) - var documentElement = (elem ? elem.ownerDocument || elem : 0).documentElement; - - return documentElement ? documentElement.nodeName !== "HTML" : false; -}; - -var posProcess = function( selector, context, seed ) { - var match, - tmpSet = [], - later = "", - root = context.nodeType ? [context] : context; - - // Position selectors must be done after the filter - // And so must :not(positional) so we move all PSEUDOs to the end - while ( (match = Expr.match.PSEUDO.exec( selector )) ) { - later += match[0]; - selector = selector.replace( Expr.match.PSEUDO, "" ); - } - - selector = Expr.relative[selector] ? selector + "*" : selector; - - for ( var i = 0, l = root.length; i < l; i++ ) { - Sizzle( selector, root[i], tmpSet, seed ); - } - - return Sizzle.filter( later, tmpSet ); -}; - -// EXPOSE -// Override sizzle attribute retrieval -Sizzle.attr = jQuery.attr; -Sizzle.selectors.attrMap = {}; -jQuery.find = Sizzle; -jQuery.expr = Sizzle.selectors; -jQuery.expr[":"] = jQuery.expr.filters; -jQuery.unique = Sizzle.uniqueSort; -jQuery.text = Sizzle.getText; -jQuery.isXMLDoc = Sizzle.isXML; -jQuery.contains = Sizzle.contains; - - -})(); - - -var runtil = /Until$/, - rparentsprev = /^(?:parents|prevUntil|prevAll)/, - // Note: This RegExp should be improved, or likely pulled from Sizzle - rmultiselector = /,/, - isSimple = /^.[^:#\[\.,]*$/, - slice = Array.prototype.slice, - POS = jQuery.expr.match.POS, - // methods guaranteed to produce a unique set when starting from a unique set - guaranteedUnique = { - children: true, - contents: true, - next: true, - prev: true - }; - -jQuery.fn.extend({ - find: function( selector ) { - var self = this, - i, l; - - if ( typeof selector !== "string" ) { - return jQuery( selector ).filter(function() { - for ( i = 0, l = self.length; i < l; i++ ) { - if ( jQuery.contains( self[ i ], this ) ) { - return true; - } - } - }); - } - - var ret = this.pushStack( "", "find", selector ), - length, n, r; - - for ( i = 0, l = this.length; i < l; i++ ) { - length = ret.length; - jQuery.find( selector, this[i], ret ); - - if ( i > 0 ) { - // Make sure that the results are unique - for ( n = length; n < ret.length; n++ ) { - for ( r = 0; r < length; r++ ) { - if ( ret[r] === ret[n] ) { - ret.splice(n--, 1); - break; - } - } - } - } - } - - return ret; - }, - - has: function( target ) { - var targets = jQuery( target ); - return this.filter(function() { - for ( var i = 0, l = targets.length; i < l; i++ ) { - if ( jQuery.contains( this, targets[i] ) ) { - return true; - } - } - }); - }, - - not: function( selector ) { - return this.pushStack( winnow(this, selector, false), "not", selector); - }, - - filter: function( selector ) { - return this.pushStack( winnow(this, selector, true), "filter", selector ); - }, - - is: function( selector ) { - return !!selector && ( - typeof selector === "string" ? - // If this is a positional selector, check membership in the returned set - // so $("p:first").is("p:last") won't return true for a doc with two "p". - POS.test( selector ) ? - jQuery( selector, this.context ).index( this[0] ) >= 0 : - jQuery.filter( selector, this ).length > 0 : - this.filter( selector ).length > 0 ); - }, - - closest: function( selectors, context ) { - var ret = [], i, l, cur = this[0]; - - // Array (deprecated as of jQuery 1.7) - if ( jQuery.isArray( selectors ) ) { - var level = 1; - - while ( cur && cur.ownerDocument && cur !== context ) { - for ( i = 0; i < selectors.length; i++ ) { - - if ( jQuery( cur ).is( selectors[ i ] ) ) { - ret.push({ selector: selectors[ i ], elem: cur, level: level }); - } - } - - cur = cur.parentNode; - level++; - } - - return ret; - } - - // String - var pos = POS.test( selectors ) || typeof selectors !== "string" ? - jQuery( selectors, context || this.context ) : - 0; - - for ( i = 0, l = this.length; i < l; i++ ) { - cur = this[i]; - - while ( cur ) { - if ( pos ? pos.index(cur) > -1 : jQuery.find.matchesSelector(cur, selectors) ) { - ret.push( cur ); - break; - - } else { - cur = cur.parentNode; - if ( !cur || !cur.ownerDocument || cur === context || cur.nodeType === 11 ) { - break; - } - } - } - } - - ret = ret.length > 1 ? jQuery.unique( ret ) : ret; - - return this.pushStack( ret, "closest", selectors ); - }, - - // Determine the position of an element within - // the matched set of elements - index: function( elem ) { - - // No argument, return index in parent - if ( !elem ) { - return ( this[0] && this[0].parentNode ) ? this.prevAll().length : -1; - } - - // index in selector - if ( typeof elem === "string" ) { - return jQuery.inArray( this[0], jQuery( elem ) ); - } - - // Locate the position of the desired element - return jQuery.inArray( - // If it receives a jQuery object, the first element is used - elem.jquery ? elem[0] : elem, this ); - }, - - add: function( selector, context ) { - var set = typeof selector === "string" ? - jQuery( selector, context ) : - jQuery.makeArray( selector && selector.nodeType ? [ selector ] : selector ), - all = jQuery.merge( this.get(), set ); - - return this.pushStack( isDisconnected( set[0] ) || isDisconnected( all[0] ) ? - all : - jQuery.unique( all ) ); - }, - - andSelf: function() { - return this.add( this.prevObject ); - } -}); - -// A painfully simple check to see if an element is disconnected -// from a document (should be improved, where feasible). -function isDisconnected( node ) { - return !node || !node.parentNode || node.parentNode.nodeType === 11; -} - -jQuery.each({ - parent: function( elem ) { - var parent = elem.parentNode; - return parent && parent.nodeType !== 11 ? parent : null; - }, - parents: function( elem ) { - return jQuery.dir( elem, "parentNode" ); - }, - parentsUntil: function( elem, i, until ) { - return jQuery.dir( elem, "parentNode", until ); - }, - next: function( elem ) { - return jQuery.nth( elem, 2, "nextSibling" ); - }, - prev: function( elem ) { - return jQuery.nth( elem, 2, "previousSibling" ); - }, - nextAll: function( elem ) { - return jQuery.dir( elem, "nextSibling" ); - }, - prevAll: function( elem ) { - return jQuery.dir( elem, "previousSibling" ); - }, - nextUntil: function( elem, i, until ) { - return jQuery.dir( elem, "nextSibling", until ); - }, - prevUntil: function( elem, i, until ) { - return jQuery.dir( elem, "previousSibling", until ); - }, - siblings: function( elem ) { - return jQuery.sibling( elem.parentNode.firstChild, elem ); - }, - children: function( elem ) { - return jQuery.sibling( elem.firstChild ); - }, - contents: function( elem ) { - return jQuery.nodeName( elem, "iframe" ) ? - elem.contentDocument || elem.contentWindow.document : - jQuery.makeArray( elem.childNodes ); - } -}, function( name, fn ) { - jQuery.fn[ name ] = function( until, selector ) { - var ret = jQuery.map( this, fn, until ); - - if ( !runtil.test( name ) ) { - selector = until; - } - - if ( selector && typeof selector === "string" ) { - ret = jQuery.filter( selector, ret ); - } - - ret = this.length > 1 && !guaranteedUnique[ name ] ? jQuery.unique( ret ) : ret; - - if ( (this.length > 1 || rmultiselector.test( selector )) && rparentsprev.test( name ) ) { - ret = ret.reverse(); - } - - return this.pushStack( ret, name, slice.call( arguments ).join(",") ); - }; -}); - -jQuery.extend({ - filter: function( expr, elems, not ) { - if ( not ) { - expr = ":not(" + expr + ")"; - } - - return elems.length === 1 ? - jQuery.find.matchesSelector(elems[0], expr) ? [ elems[0] ] : [] : - jQuery.find.matches(expr, elems); - }, - - dir: function( elem, dir, until ) { - var matched = [], - cur = elem[ dir ]; - - while ( cur && cur.nodeType !== 9 && (until === undefined || cur.nodeType !== 1 || !jQuery( cur ).is( until )) ) { - if ( cur.nodeType === 1 ) { - matched.push( cur ); - } - cur = cur[dir]; - } - return matched; - }, - - nth: function( cur, result, dir, elem ) { - result = result || 1; - var num = 0; - - for ( ; cur; cur = cur[dir] ) { - if ( cur.nodeType === 1 && ++num === result ) { - break; - } - } - - return cur; - }, - - sibling: function( n, elem ) { - var r = []; - - for ( ; n; n = n.nextSibling ) { - if ( n.nodeType === 1 && n !== elem ) { - r.push( n ); - } - } - - return r; - } -}); - -// Implement the identical functionality for filter and not -function winnow( elements, qualifier, keep ) { - - // Can't pass null or undefined to indexOf in Firefox 4 - // Set to 0 to skip string check - qualifier = qualifier || 0; - - if ( jQuery.isFunction( qualifier ) ) { - return jQuery.grep(elements, function( elem, i ) { - var retVal = !!qualifier.call( elem, i, elem ); - return retVal === keep; - }); - - } else if ( qualifier.nodeType ) { - return jQuery.grep(elements, function( elem, i ) { - return ( elem === qualifier ) === keep; - }); - - } else if ( typeof qualifier === "string" ) { - var filtered = jQuery.grep(elements, function( elem ) { - return elem.nodeType === 1; - }); - - if ( isSimple.test( qualifier ) ) { - return jQuery.filter(qualifier, filtered, !keep); - } else { - qualifier = jQuery.filter( qualifier, filtered ); - } - } - - return jQuery.grep(elements, function( elem, i ) { - return ( jQuery.inArray( elem, qualifier ) >= 0 ) === keep; - }); -} - - - - -function createSafeFragment( document ) { - var list = nodeNames.split( "|" ), - safeFrag = document.createDocumentFragment(); - - if ( safeFrag.createElement ) { - while ( list.length ) { - safeFrag.createElement( - list.pop() - ); - } - } - return safeFrag; -} - -var nodeNames = "abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|" + - "header|hgroup|mark|meter|nav|output|progress|section|summary|time|video", - rinlinejQuery = / jQuery\d+="(?:\d+|null)"/g, - rleadingWhitespace = /^\s+/, - rxhtmlTag = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, - rtagName = /<([\w:]+)/, - rtbody = /", "" ], - legend: [ 1, "
        ", "
        " ], - thead: [ 1, "", "
        " ], - tr: [ 2, "", "
        " ], - td: [ 3, "", "
        " ], - col: [ 2, "", "
        " ], - area: [ 1, "", "" ], - _default: [ 0, "", "" ] - }, - safeFragment = createSafeFragment( document ); - -wrapMap.optgroup = wrapMap.option; -wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead; -wrapMap.th = wrapMap.td; - -// IE can't serialize and